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 -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-imultilib @var{dir} -isysroot @var{dir} @gol 474-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 475-P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol 476-remap -trigraphs -undef -U@var{macro} @gol 477-Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp} 478 479@item Assembler Option 480@xref{Assembler Options,,Passing Options to the Assembler}. 481@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 482 483@item Linker Options 484@xref{Link Options,,Options for Linking}. 485@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 486-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 487-s -static -static-libgcc -static-libstdc++ @gol 488-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 489-static-libmpx -static-libmpxwrappers @gol 490-shared -shared-libgcc -symbolic @gol 491-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 492-u @var{symbol} -z @var{keyword}} 493 494@item Directory Options 495@xref{Directory Options,,Options for Directory Search}. 496@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol 497-iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol 498--sysroot=@var{dir} --no-sysroot-suffix} 499 500@item Machine Dependent Options 501@xref{Submodel Options,,Hardware Models and Configurations}. 502@c This list is ordered alphanumerically by subsection name. 503@c Try and put the significant identifier (CPU or system) first, 504@c so users have a clue at guessing where the ones they want will be. 505 506@emph{AArch64 Options} 507@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 508-mgeneral-regs-only @gol 509-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 510-mstrict-align @gol 511-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 512-mtls-dialect=desc -mtls-dialect=traditional @gol 513-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol 514-mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol 515-march=@var{name} -mcpu=@var{name} -mtune=@var{name}} 516 517@emph{Adapteva Epiphany Options} 518@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 519-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 520-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 521-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 522-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 523-msplit-vecmove-early -m1reg-@var{reg}} 524 525@emph{ARC Options} 526@gccoptlist{-mbarrel-shifter @gol 527-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol 528-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol 529-mea -mno-mpy -mmul32x16 -mmul64 @gol 530-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol 531-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol 532-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol 533-mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol 534-mucb-mcount -mvolatile-cache @gol 535-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol 536-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol 537-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol 538-mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol 539-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol 540-mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}} 541 542@emph{ARM Options} 543@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 544-mabi=@var{name} @gol 545-mapcs-stack-check -mno-apcs-stack-check @gol 546-mapcs-float -mno-apcs-float @gol 547-mapcs-reentrant -mno-apcs-reentrant @gol 548-msched-prolog -mno-sched-prolog @gol 549-mlittle-endian -mbig-endian @gol 550-mfloat-abi=@var{name} @gol 551-mfp16-format=@var{name} 552-mthumb-interwork -mno-thumb-interwork @gol 553-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 554-mtune=@var{name} -mprint-tune-info @gol 555-mstructure-size-boundary=@var{n} @gol 556-mabort-on-noreturn @gol 557-mlong-calls -mno-long-calls @gol 558-msingle-pic-base -mno-single-pic-base @gol 559-mpic-register=@var{reg} @gol 560-mnop-fun-dllimport @gol 561-mpoke-function-name @gol 562-mthumb -marm @gol 563-mtpcs-frame -mtpcs-leaf-frame @gol 564-mcaller-super-interworking -mcallee-super-interworking @gol 565-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 566-mword-relocations @gol 567-mfix-cortex-m3-ldrd @gol 568-munaligned-access @gol 569-mneon-for-64bits @gol 570-mslow-flash-data @gol 571-masm-syntax-unified @gol 572-mrestrict-it} 573 574@emph{AVR Options} 575@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol 576-mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol 577-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert} 578 579@emph{Blackfin Options} 580@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 581-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 582-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 583-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 584-mno-id-shared-library -mshared-library-id=@var{n} @gol 585-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 586-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 587-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 588-micplb} 589 590@emph{C6X Options} 591@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 592-msim -msdata=@var{sdata-type}} 593 594@emph{CRIS Options} 595@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 596-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 597-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 598-mstack-align -mdata-align -mconst-align @gol 599-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 600-melf -maout -melinux -mlinux -sim -sim2 @gol 601-mmul-bug-workaround -mno-mul-bug-workaround} 602 603@emph{CR16 Options} 604@gccoptlist{-mmac @gol 605-mcr16cplus -mcr16c @gol 606-msim -mint32 -mbit-ops 607-mdata-model=@var{model}} 608 609@emph{Darwin Options} 610@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 611-arch_only -bind_at_load -bundle -bundle_loader @gol 612-client_name -compatibility_version -current_version @gol 613-dead_strip @gol 614-dependency-file -dylib_file -dylinker_install_name @gol 615-dynamic -dynamiclib -exported_symbols_list @gol 616-filelist -flat_namespace -force_cpusubtype_ALL @gol 617-force_flat_namespace -headerpad_max_install_names @gol 618-iframework @gol 619-image_base -init -install_name -keep_private_externs @gol 620-multi_module -multiply_defined -multiply_defined_unused @gol 621-noall_load -no_dead_strip_inits_and_terms @gol 622-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 623-pagezero_size -prebind -prebind_all_twolevel_modules @gol 624-private_bundle -read_only_relocs -sectalign @gol 625-sectobjectsymbols -whyload -seg1addr @gol 626-sectcreate -sectobjectsymbols -sectorder @gol 627-segaddr -segs_read_only_addr -segs_read_write_addr @gol 628-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 629-segprot -segs_read_only_addr -segs_read_write_addr @gol 630-single_module -static -sub_library -sub_umbrella @gol 631-twolevel_namespace -umbrella -undefined @gol 632-unexported_symbols_list -weak_reference_mismatches @gol 633-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 634-mkernel -mone-byte-bool} 635 636@emph{DEC Alpha Options} 637@gccoptlist{-mno-fp-regs -msoft-float @gol 638-mieee -mieee-with-inexact -mieee-conformant @gol 639-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 640-mtrap-precision=@var{mode} -mbuild-constants @gol 641-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 642-mbwx -mmax -mfix -mcix @gol 643-mfloat-vax -mfloat-ieee @gol 644-mexplicit-relocs -msmall-data -mlarge-data @gol 645-msmall-text -mlarge-text @gol 646-mmemory-latency=@var{time}} 647 648@emph{FR30 Options} 649@gccoptlist{-msmall-model -mno-lsim} 650 651@emph{FRV Options} 652@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 653-mhard-float -msoft-float @gol 654-malloc-cc -mfixed-cc -mdword -mno-dword @gol 655-mdouble -mno-double @gol 656-mmedia -mno-media -mmuladd -mno-muladd @gol 657-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 658-mlinked-fp -mlong-calls -malign-labels @gol 659-mlibrary-pic -macc-4 -macc-8 @gol 660-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 661-moptimize-membar -mno-optimize-membar @gol 662-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 663-mvliw-branch -mno-vliw-branch @gol 664-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 665-mno-nested-cond-exec -mtomcat-stats @gol 666-mTLS -mtls @gol 667-mcpu=@var{cpu}} 668 669@emph{GNU/Linux Options} 670@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol 671-tno-android-cc -tno-android-ld} 672 673@emph{H8/300 Options} 674@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 675 676@emph{HPPA Options} 677@gccoptlist{-march=@var{architecture-type} @gol 678-mdisable-fpregs -mdisable-indexing @gol 679-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 680-mfixed-range=@var{register-range} @gol 681-mjump-in-delay -mlinker-opt -mlong-calls @gol 682-mlong-load-store -mno-disable-fpregs @gol 683-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 684-mno-jump-in-delay -mno-long-load-store @gol 685-mno-portable-runtime -mno-soft-float @gol 686-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 687-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 688-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 689-munix=@var{unix-std} -nolibdld -static -threads} 690 691@emph{IA-64 Options} 692@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 693-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 694-mconstant-gp -mauto-pic -mfused-madd @gol 695-minline-float-divide-min-latency @gol 696-minline-float-divide-max-throughput @gol 697-mno-inline-float-divide @gol 698-minline-int-divide-min-latency @gol 699-minline-int-divide-max-throughput @gol 700-mno-inline-int-divide @gol 701-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 702-mno-inline-sqrt @gol 703-mdwarf2-asm -mearly-stop-bits @gol 704-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 705-mtune=@var{cpu-type} -milp32 -mlp64 @gol 706-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 707-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 708-msched-spec-ldc -msched-spec-control-ldc @gol 709-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 710-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 711-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 712-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 713 714@emph{LM32 Options} 715@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 716-msign-extend-enabled -muser-enabled} 717 718@emph{M32R/D Options} 719@gccoptlist{-m32r2 -m32rx -m32r @gol 720-mdebug @gol 721-malign-loops -mno-align-loops @gol 722-missue-rate=@var{number} @gol 723-mbranch-cost=@var{number} @gol 724-mmodel=@var{code-size-model-type} @gol 725-msdata=@var{sdata-type} @gol 726-mno-flush-func -mflush-func=@var{name} @gol 727-mno-flush-trap -mflush-trap=@var{number} @gol 728-G @var{num}} 729 730@emph{M32C Options} 731@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 732 733@emph{M680x0 Options} 734@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol 735-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 736-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 737-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 738-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 739-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 740-malign-int -mstrict-align -msep-data -mno-sep-data @gol 741-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 742-mxgot -mno-xgot} 743 744@emph{MCore Options} 745@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 746-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 747-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 748-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 749-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 750 751@emph{MeP Options} 752@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 753-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 754-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 755-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 756-mtiny=@var{n}} 757 758@emph{MicroBlaze Options} 759@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 760-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 761-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 762-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 763-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}} 764 765@emph{MIPS Options} 766@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 767-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol 768-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol 769-mips16 -mno-mips16 -mflip-mips16 @gol 770-minterlink-compressed -mno-interlink-compressed @gol 771-minterlink-mips16 -mno-interlink-mips16 @gol 772-mabi=@var{abi} -mabicalls -mno-abicalls @gol 773-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 774-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol 775-mno-float -msingle-float -mdouble-float @gol 776-modd-spreg -mno-odd-spreg @gol 777-mabs=@var{mode} -mnan=@var{encoding} @gol 778-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 779-mmcu -mmno-mcu @gol 780-meva -mno-eva @gol 781-mvirt -mno-virt @gol 782-mxpa -mno-xpa @gol 783-mmicromips -mno-micromips @gol 784-mfpu=@var{fpu-type} @gol 785-msmartmips -mno-smartmips @gol 786-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 787-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 788-mlong64 -mlong32 -msym32 -mno-sym32 @gol 789-G@var{num} -mlocal-sdata -mno-local-sdata @gol 790-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 791-membedded-data -mno-embedded-data @gol 792-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 793-mcode-readable=@var{setting} @gol 794-msplit-addresses -mno-split-addresses @gol 795-mexplicit-relocs -mno-explicit-relocs @gol 796-mcheck-zero-division -mno-check-zero-division @gol 797-mdivide-traps -mdivide-breaks @gol 798-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 799-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol 800-mfix-24k -mno-fix-24k @gol 801-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 802-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol 803-mfix-vr4120 -mno-fix-vr4120 @gol 804-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 805-mflush-func=@var{func} -mno-flush-func @gol 806-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 807-mfp-exceptions -mno-fp-exceptions @gol 808-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 809-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address} 810 811@emph{MMIX Options} 812@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 813-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 814-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 815-mno-base-addresses -msingle-exit -mno-single-exit} 816 817@emph{MN10300 Options} 818@gccoptlist{-mmult-bug -mno-mult-bug @gol 819-mno-am33 -mam33 -mam33-2 -mam34 @gol 820-mtune=@var{cpu-type} @gol 821-mreturn-pointer-on-d0 @gol 822-mno-crt0 -mrelax -mliw -msetlb} 823 824@emph{Moxie Options} 825@gccoptlist{-meb -mel -mmul.x -mno-crt0} 826 827@emph{MSP430 Options} 828@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol 829-mhwmult= -minrt} 830 831@emph{NDS32 Options} 832@gccoptlist{-mbig-endian -mlittle-endian @gol 833-mreduced-regs -mfull-regs @gol 834-mcmov -mno-cmov @gol 835-mperf-ext -mno-perf-ext @gol 836-mv3push -mno-v3push @gol 837-m16bit -mno-16bit @gol 838-misr-vector-size=@var{num} @gol 839-mcache-block-size=@var{num} @gol 840-march=@var{arch} @gol 841-mcmodel=@var{code-model} @gol 842-mctor-dtor -mrelax} 843 844@emph{Nios II Options} 845@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol 846-mel -meb @gol 847-mno-bypass-cache -mbypass-cache @gol 848-mno-cache-volatile -mcache-volatile @gol 849-mno-fast-sw-div -mfast-sw-div @gol 850-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol 851-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol 852-mcustom-fpu-cfg=@var{name} @gol 853-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}} 854 855@emph{Nvidia PTX Options} 856@gccoptlist{-m32 -m64 -mmainkernel} 857 858@emph{PDP-11 Options} 859@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 860-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 861-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 862-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 863-mbranch-expensive -mbranch-cheap @gol 864-munix-asm -mdec-asm} 865 866@emph{picoChip Options} 867@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 868-msymbol-as-address -mno-inefficient-warnings} 869 870@emph{PowerPC Options} 871See RS/6000 and PowerPC Options. 872 873@emph{RL78 Options} 874@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 @gol 875-m64bit-doubles -m32bit-doubles} 876 877@emph{RS/6000 and PowerPC Options} 878@gccoptlist{-mcpu=@var{cpu-type} @gol 879-mtune=@var{cpu-type} @gol 880-mcmodel=@var{code-model} @gol 881-mpowerpc64 @gol 882-maltivec -mno-altivec @gol 883-mpowerpc-gpopt -mno-powerpc-gpopt @gol 884-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 885-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 886-mfprnd -mno-fprnd @gol 887-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol 888-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 889-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 890-malign-power -malign-natural @gol 891-msoft-float -mhard-float -mmultiple -mno-multiple @gol 892-msingle-float -mdouble-float -msimple-fpu @gol 893-mstring -mno-string -mupdate -mno-update @gol 894-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 895-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 896-mstrict-align -mno-strict-align -mrelocatable @gol 897-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 898-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 899-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol 900-mprioritize-restricted-insns=@var{priority} @gol 901-msched-costly-dep=@var{dependence_type} @gol 902-minsert-sched-nops=@var{scheme} @gol 903-mcall-sysv -mcall-netbsd @gol 904-maix-struct-return -msvr4-struct-return @gol 905-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 906-mblock-move-inline-limit=@var{num} @gol 907-misel -mno-isel @gol 908-misel=yes -misel=no @gol 909-mspe -mno-spe @gol 910-mspe=yes -mspe=no @gol 911-mpaired @gol 912-mgen-cell-microcode -mwarn-cell-microcode @gol 913-mvrsave -mno-vrsave @gol 914-mmulhw -mno-mulhw @gol 915-mdlmzb -mno-dlmzb @gol 916-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 917-mprototype -mno-prototype @gol 918-msim -mmvme -mads -myellowknife -memb -msdata @gol 919-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol 920-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 921-mno-recip-precision @gol 922-mveclibabi=@var{type} -mfriz -mno-friz @gol 923-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 924-msave-toc-indirect -mno-save-toc-indirect @gol 925-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 926-mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol 927-mquad-memory -mno-quad-memory @gol 928-mquad-memory-atomic -mno-quad-memory-atomic @gol 929-mcompat-align-parm -mno-compat-align-parm @gol 930-mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol 931-mupper-regs -mno-upper-regs} 932 933@emph{RX Options} 934@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 935-mcpu=@gol 936-mbig-endian-data -mlittle-endian-data @gol 937-msmall-data @gol 938-msim -mno-sim@gol 939-mas100-syntax -mno-as100-syntax@gol 940-mrelax@gol 941-mmax-constant-size=@gol 942-mint-register=@gol 943-mpid@gol 944-mno-warn-multiple-fast-interrupts@gol 945-msave-acc-in-interrupts} 946 947@emph{S/390 and zSeries Options} 948@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 949-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 950-mlong-double-64 -mlong-double-128 @gol 951-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 952-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 953-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 954-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 955-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 956-mhotpatch=@var{halfwords},@var{halfwords}} 957 958@emph{Score Options} 959@gccoptlist{-meb -mel @gol 960-mnhwloop @gol 961-muls @gol 962-mmac @gol 963-mscore5 -mscore5u -mscore7 -mscore7d} 964 965@emph{SH Options} 966@gccoptlist{-m1 -m2 -m2e @gol 967-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 968-m3 -m3e @gol 969-m4-nofpu -m4-single-only -m4-single -m4 @gol 970-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 971-m5-64media -m5-64media-nofpu @gol 972-m5-32media -m5-32media-nofpu @gol 973-m5-compact -m5-compact-nofpu @gol 974-mb -ml -mdalign -mrelax @gol 975-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 976-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 977-mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 978-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 979-mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 980-maccumulate-outgoing-args -minvalid-symbols @gol 981-matomic-model=@var{atomic-model} @gol 982-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol 983-mcbranch-force-delay-slot @gol 984-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 985-mpretend-cmove -mtas} 986 987@emph{Solaris 2 Options} 988@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol 989-pthreads -pthread} 990 991@emph{SPARC Options} 992@gccoptlist{-mcpu=@var{cpu-type} @gol 993-mtune=@var{cpu-type} @gol 994-mcmodel=@var{code-model} @gol 995-mmemory-model=@var{mem-model} @gol 996-m32 -m64 -mapp-regs -mno-app-regs @gol 997-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 998-mfpu -mno-fpu -mhard-float -msoft-float @gol 999-mhard-quad-float -msoft-quad-float @gol 1000-mstack-bias -mno-stack-bias @gol 1001-munaligned-doubles -mno-unaligned-doubles @gol 1002-muser-mode -mno-user-mode @gol 1003-mv8plus -mno-v8plus -mvis -mno-vis @gol 1004-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 1005-mcbcond -mno-cbcond @gol 1006-mfmaf -mno-fmaf -mpopc -mno-popc @gol 1007-mfix-at697f -mfix-ut699} 1008 1009@emph{SPU Options} 1010@gccoptlist{-mwarn-reloc -merror-reloc @gol 1011-msafe-dma -munsafe-dma @gol 1012-mbranch-hints @gol 1013-msmall-mem -mlarge-mem -mstdmain @gol 1014-mfixed-range=@var{register-range} @gol 1015-mea32 -mea64 @gol 1016-maddress-space-conversion -mno-address-space-conversion @gol 1017-mcache-size=@var{cache-size} @gol 1018-matomic-updates -mno-atomic-updates} 1019 1020@emph{System V Options} 1021@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 1022 1023@emph{TILE-Gx Options} 1024@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol 1025-mcmodel=@var{code-model}} 1026 1027@emph{TILEPro Options} 1028@gccoptlist{-mcpu=@var{cpu} -m32} 1029 1030@emph{V850 Options} 1031@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 1032-mprolog-function -mno-prolog-function -mspace @gol 1033-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 1034-mapp-regs -mno-app-regs @gol 1035-mdisable-callt -mno-disable-callt @gol 1036-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 1037-mv850e -mv850 -mv850e3v5 @gol 1038-mloop @gol 1039-mrelax @gol 1040-mlong-jumps @gol 1041-msoft-float @gol 1042-mhard-float @gol 1043-mgcc-abi @gol 1044-mrh850-abi @gol 1045-mbig-switch} 1046 1047@emph{VAX Options} 1048@gccoptlist{-mg -mgnu -munix} 1049 1050@emph{Visium Options} 1051@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol 1052-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} 1053 1054@emph{VMS Options} 1055@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 1056-mpointer-size=@var{size}} 1057 1058@emph{VxWorks Options} 1059@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 1060-Xbind-lazy -Xbind-now} 1061 1062@emph{x86 Options} 1063@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1064-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol 1065-mfpmath=@var{unit} @gol 1066-masm=@var{dialect} -mno-fancy-math-387 @gol 1067-mno-fp-ret-in-387 -msoft-float @gol 1068-mno-wide-multiply -mrtd -malign-double @gol 1069-mpreferred-stack-boundary=@var{num} @gol 1070-mincoming-stack-boundary=@var{num} @gol 1071-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol 1072-mrecip -mrecip=@var{opt} @gol 1073-mvzeroupper -mprefer-avx128 @gol 1074-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 1075-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol 1076-maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol 1077-mclflushopt -mxsavec -mxsaves @gol 1078-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol 1079-mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mthreads @gol 1080-mno-align-stringops -minline-all-stringops @gol 1081-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 1082-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol 1083-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 1084-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol 1085-mregparm=@var{num} -msseregparm @gol 1086-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 1087-mpc32 -mpc64 -mpc80 -mstackrealign @gol 1088-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 1089-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 1090-m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol 1091-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol 1092-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol 1093-malign-data=@var{type} -mstack-protector-guard=@var{guard}} 1094 1095@emph{x86 Windows Options} 1096@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 1097-mnop-fun-dllimport -mthread @gol 1098-municode -mwin32 -mwindows -fno-set-stack-executable} 1099 1100@emph{Xstormy16 Options} 1101@gccoptlist{-msim} 1102 1103@emph{Xtensa Options} 1104@gccoptlist{-mconst16 -mno-const16 @gol 1105-mfused-madd -mno-fused-madd @gol 1106-mforce-no-pic @gol 1107-mserialize-volatile -mno-serialize-volatile @gol 1108-mtext-section-literals -mno-text-section-literals @gol 1109-mtarget-align -mno-target-align @gol 1110-mlongcalls -mno-longcalls} 1111 1112@emph{zSeries Options} 1113See S/390 and zSeries Options. 1114 1115@item Code Generation Options 1116@xref{Code Gen Options,,Options for Code Generation Conventions}. 1117@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 1118-ffixed-@var{reg} -fexceptions @gol 1119-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 1120-fasynchronous-unwind-tables @gol 1121-fno-gnu-unique @gol 1122-finhibit-size-directive -finstrument-functions @gol 1123-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 1124-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 1125-fno-common -fno-ident @gol 1126-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 1127-fno-jump-tables @gol 1128-frecord-gcc-switches @gol 1129-freg-struct-return -fshort-enums @gol 1130-fshort-double -fshort-wchar @gol 1131-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 1132-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 1133-fno-stack-limit -fsplit-stack @gol 1134-fleading-underscore -ftls-model=@var{model} @gol 1135-fstack-reuse=@var{reuse_level} @gol 1136-ftrapv -fwrapv -fbounds-check @gol 1137-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 1138-fstrict-volatile-bitfields -fsync-libcalls} 1139@end table 1140 1141 1142@node Overall Options 1143@section Options Controlling the Kind of Output 1144 1145Compilation can involve up to four stages: preprocessing, compilation 1146proper, assembly and linking, always in that order. GCC is capable of 1147preprocessing and compiling several files either into several 1148assembler input files, or into one assembler input file; then each 1149assembler input file produces an object file, and linking combines all 1150the object files (those newly compiled, and those specified as input) 1151into an executable file. 1152 1153@cindex file name suffix 1154For any given input file, the file name suffix determines what kind of 1155compilation is done: 1156 1157@table @gcctabopt 1158@item @var{file}.c 1159C source code that must be preprocessed. 1160 1161@item @var{file}.i 1162C source code that should not be preprocessed. 1163 1164@item @var{file}.ii 1165C++ source code that should not be preprocessed. 1166 1167@item @var{file}.m 1168Objective-C source code. Note that you must link with the @file{libobjc} 1169library to make an Objective-C program work. 1170 1171@item @var{file}.mi 1172Objective-C source code that should not be preprocessed. 1173 1174@item @var{file}.mm 1175@itemx @var{file}.M 1176Objective-C++ source code. Note that you must link with the @file{libobjc} 1177library to make an Objective-C++ program work. Note that @samp{.M} refers 1178to a literal capital M@. 1179 1180@item @var{file}.mii 1181Objective-C++ source code that should not be preprocessed. 1182 1183@item @var{file}.h 1184C, C++, Objective-C or Objective-C++ header file to be turned into a 1185precompiled header (default), or C, C++ header file to be turned into an 1186Ada spec (via the @option{-fdump-ada-spec} switch). 1187 1188@item @var{file}.cc 1189@itemx @var{file}.cp 1190@itemx @var{file}.cxx 1191@itemx @var{file}.cpp 1192@itemx @var{file}.CPP 1193@itemx @var{file}.c++ 1194@itemx @var{file}.C 1195C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1196the last two letters must both be literally @samp{x}. Likewise, 1197@samp{.C} refers to a literal capital C@. 1198 1199@item @var{file}.mm 1200@itemx @var{file}.M 1201Objective-C++ source code that must be preprocessed. 1202 1203@item @var{file}.mii 1204Objective-C++ source code that should not be preprocessed. 1205 1206@item @var{file}.hh 1207@itemx @var{file}.H 1208@itemx @var{file}.hp 1209@itemx @var{file}.hxx 1210@itemx @var{file}.hpp 1211@itemx @var{file}.HPP 1212@itemx @var{file}.h++ 1213@itemx @var{file}.tcc 1214C++ header file to be turned into a precompiled header or Ada spec. 1215 1216@item @var{file}.f 1217@itemx @var{file}.for 1218@itemx @var{file}.ftn 1219Fixed form Fortran source code that should not be preprocessed. 1220 1221@item @var{file}.F 1222@itemx @var{file}.FOR 1223@itemx @var{file}.fpp 1224@itemx @var{file}.FPP 1225@itemx @var{file}.FTN 1226Fixed form Fortran source code that must be preprocessed (with the traditional 1227preprocessor). 1228 1229@item @var{file}.f90 1230@itemx @var{file}.f95 1231@itemx @var{file}.f03 1232@itemx @var{file}.f08 1233Free form Fortran source code that should not be preprocessed. 1234 1235@item @var{file}.F90 1236@itemx @var{file}.F95 1237@itemx @var{file}.F03 1238@itemx @var{file}.F08 1239Free form Fortran source code that must be preprocessed (with the 1240traditional preprocessor). 1241 1242@item @var{file}.go 1243Go source code. 1244 1245@c FIXME: Descriptions of Java file types. 1246@c @var{file}.java 1247@c @var{file}.class 1248@c @var{file}.zip 1249@c @var{file}.jar 1250 1251@item @var{file}.ads 1252Ada source code file that contains a library unit declaration (a 1253declaration of a package, subprogram, or generic, or a generic 1254instantiation), or a library unit renaming declaration (a package, 1255generic, or subprogram renaming declaration). Such files are also 1256called @dfn{specs}. 1257 1258@item @var{file}.adb 1259Ada source code file containing a library unit body (a subprogram or 1260package body). Such files are also called @dfn{bodies}. 1261 1262@c GCC also knows about some suffixes for languages not yet included: 1263@c Pascal: 1264@c @var{file}.p 1265@c @var{file}.pas 1266@c Ratfor: 1267@c @var{file}.r 1268 1269@item @var{file}.s 1270Assembler code. 1271 1272@item @var{file}.S 1273@itemx @var{file}.sx 1274Assembler code that must be preprocessed. 1275 1276@item @var{other} 1277An object file to be fed straight into linking. 1278Any file name with no recognized suffix is treated this way. 1279@end table 1280 1281@opindex x 1282You can specify the input language explicitly with the @option{-x} option: 1283 1284@table @gcctabopt 1285@item -x @var{language} 1286Specify explicitly the @var{language} for the following input files 1287(rather than letting the compiler choose a default based on the file 1288name suffix). This option applies to all following input files until 1289the next @option{-x} option. Possible values for @var{language} are: 1290@smallexample 1291c c-header cpp-output 1292c++ c++-header c++-cpp-output 1293objective-c objective-c-header objective-c-cpp-output 1294objective-c++ objective-c++-header objective-c++-cpp-output 1295assembler assembler-with-cpp 1296ada 1297f77 f77-cpp-input f95 f95-cpp-input 1298go 1299java 1300@end smallexample 1301 1302@item -x none 1303Turn off any specification of a language, so that subsequent files are 1304handled according to their file name suffixes (as they are if @option{-x} 1305has not been used at all). 1306 1307@item -pass-exit-codes 1308@opindex pass-exit-codes 1309Normally the @command{gcc} program exits with the code of 1 if any 1310phase of the compiler returns a non-success return code. If you specify 1311@option{-pass-exit-codes}, the @command{gcc} program instead returns with 1312the numerically highest error produced by any phase returning an error 1313indication. The C, C++, and Fortran front ends return 4 if an internal 1314compiler error is encountered. 1315@end table 1316 1317If you only want some of the stages of compilation, you can use 1318@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1319one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1320@command{gcc} is to stop. Note that some combinations (for example, 1321@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1322 1323@table @gcctabopt 1324@item -c 1325@opindex c 1326Compile or assemble the source files, but do not link. The linking 1327stage simply is not done. The ultimate output is in the form of an 1328object file for each source file. 1329 1330By default, the object file name for a source file is made by replacing 1331the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1332 1333Unrecognized input files, not requiring compilation or assembly, are 1334ignored. 1335 1336@item -S 1337@opindex S 1338Stop after the stage of compilation proper; do not assemble. The output 1339is in the form of an assembler code file for each non-assembler input 1340file specified. 1341 1342By default, the assembler file name for a source file is made by 1343replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1344 1345Input files that don't require compilation are ignored. 1346 1347@item -E 1348@opindex E 1349Stop after the preprocessing stage; do not run the compiler proper. The 1350output is in the form of preprocessed source code, which is sent to the 1351standard output. 1352 1353Input files that don't require preprocessing are ignored. 1354 1355@cindex output file option 1356@item -o @var{file} 1357@opindex o 1358Place output in file @var{file}. This applies to whatever 1359sort of output is being produced, whether it be an executable file, 1360an object file, an assembler file or preprocessed C code. 1361 1362If @option{-o} is not specified, the default is to put an executable 1363file in @file{a.out}, the object file for 1364@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1365assembler file in @file{@var{source}.s}, a precompiled header file in 1366@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1367standard output. 1368 1369@item -v 1370@opindex v 1371Print (on standard error output) the commands executed to run the stages 1372of compilation. Also print the version number of the compiler driver 1373program and of the preprocessor and the compiler proper. 1374 1375@item -### 1376@opindex ### 1377Like @option{-v} except the commands are not executed and arguments 1378are quoted unless they contain only alphanumeric characters or @code{./-_}. 1379This is useful for shell scripts to capture the driver-generated command lines. 1380 1381@item -pipe 1382@opindex pipe 1383Use pipes rather than temporary files for communication between the 1384various stages of compilation. This fails to work on some systems where 1385the assembler is unable to read from a pipe; but the GNU assembler has 1386no trouble. 1387 1388@item --help 1389@opindex help 1390Print (on the standard output) a description of the command-line options 1391understood by @command{gcc}. If the @option{-v} option is also specified 1392then @option{--help} is also passed on to the various processes 1393invoked by @command{gcc}, so that they can display the command-line options 1394they accept. If the @option{-Wextra} option has also been specified 1395(prior to the @option{--help} option), then command-line options that 1396have no documentation associated with them are also displayed. 1397 1398@item --target-help 1399@opindex target-help 1400Print (on the standard output) a description of target-specific command-line 1401options for each tool. For some targets extra target-specific 1402information may also be printed. 1403 1404@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 1405Print (on the standard output) a description of the command-line 1406options understood by the compiler that fit into all specified classes 1407and qualifiers. These are the supported classes: 1408 1409@table @asis 1410@item @samp{optimizers} 1411Display all of the optimization options supported by the 1412compiler. 1413 1414@item @samp{warnings} 1415Display all of the options controlling warning messages 1416produced by the compiler. 1417 1418@item @samp{target} 1419Display target-specific options. Unlike the 1420@option{--target-help} option however, target-specific options of the 1421linker and assembler are not displayed. This is because those 1422tools do not currently support the extended @option{--help=} syntax. 1423 1424@item @samp{params} 1425Display the values recognized by the @option{--param} 1426option. 1427 1428@item @var{language} 1429Display the options supported for @var{language}, where 1430@var{language} is the name of one of the languages supported in this 1431version of GCC@. 1432 1433@item @samp{common} 1434Display the options that are common to all languages. 1435@end table 1436 1437These are the supported qualifiers: 1438 1439@table @asis 1440@item @samp{undocumented} 1441Display only those options that are undocumented. 1442 1443@item @samp{joined} 1444Display options taking an argument that appears after an equal 1445sign in the same continuous piece of text, such as: 1446@samp{--help=target}. 1447 1448@item @samp{separate} 1449Display options taking an argument that appears as a separate word 1450following the original option, such as: @samp{-o output-file}. 1451@end table 1452 1453Thus for example to display all the undocumented target-specific 1454switches supported by the compiler, use: 1455 1456@smallexample 1457--help=target,undocumented 1458@end smallexample 1459 1460The sense of a qualifier can be inverted by prefixing it with the 1461@samp{^} character, so for example to display all binary warning 1462options (i.e., ones that are either on or off and that do not take an 1463argument) that have a description, use: 1464 1465@smallexample 1466--help=warnings,^joined,^undocumented 1467@end smallexample 1468 1469The argument to @option{--help=} should not consist solely of inverted 1470qualifiers. 1471 1472Combining several classes is possible, although this usually 1473restricts the output so much that there is nothing to display. One 1474case where it does work, however, is when one of the classes is 1475@var{target}. For example, to display all the target-specific 1476optimization options, use: 1477 1478@smallexample 1479--help=target,optimizers 1480@end smallexample 1481 1482The @option{--help=} option can be repeated on the command line. Each 1483successive use displays its requested class of options, skipping 1484those that have already been displayed. 1485 1486If the @option{-Q} option appears on the command line before the 1487@option{--help=} option, then the descriptive text displayed by 1488@option{--help=} is changed. Instead of describing the displayed 1489options, an indication is given as to whether the option is enabled, 1490disabled or set to a specific value (assuming that the compiler 1491knows this at the point where the @option{--help=} option is used). 1492 1493Here is a truncated example from the ARM port of @command{gcc}: 1494 1495@smallexample 1496 % gcc -Q -mabi=2 --help=target -c 1497 The following options are target specific: 1498 -mabi= 2 1499 -mabort-on-noreturn [disabled] 1500 -mapcs [disabled] 1501@end smallexample 1502 1503The output is sensitive to the effects of previous command-line 1504options, so for example it is possible to find out which optimizations 1505are enabled at @option{-O2} by using: 1506 1507@smallexample 1508-Q -O2 --help=optimizers 1509@end smallexample 1510 1511Alternatively you can discover which binary optimizations are enabled 1512by @option{-O3} by using: 1513 1514@smallexample 1515gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 1516gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 1517diff /tmp/O2-opts /tmp/O3-opts | grep enabled 1518@end smallexample 1519 1520@item -no-canonical-prefixes 1521@opindex no-canonical-prefixes 1522Do not expand any symbolic links, resolve references to @samp{/../} 1523or @samp{/./}, or make the path absolute when generating a relative 1524prefix. 1525 1526@item --version 1527@opindex version 1528Display the version number and copyrights of the invoked GCC@. 1529 1530@item -wrapper 1531@opindex wrapper 1532Invoke all subcommands under a wrapper program. The name of the 1533wrapper program and its parameters are passed as a comma separated 1534list. 1535 1536@smallexample 1537gcc -c t.c -wrapper gdb,--args 1538@end smallexample 1539 1540@noindent 1541This invokes all subprograms of @command{gcc} under 1542@samp{gdb --args}, thus the invocation of @command{cc1} is 1543@samp{gdb --args cc1 @dots{}}. 1544 1545@item -fplugin=@var{name}.so 1546@opindex fplugin 1547Load the plugin code in file @var{name}.so, assumed to be a 1548shared object to be dlopen'd by the compiler. The base name of 1549the shared object file is used to identify the plugin for the 1550purposes of argument parsing (See 1551@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 1552Each plugin should define the callback functions specified in the 1553Plugins API. 1554 1555@item -fplugin-arg-@var{name}-@var{key}=@var{value} 1556@opindex fplugin-arg 1557Define an argument called @var{key} with a value of @var{value} 1558for the plugin called @var{name}. 1559 1560@item -fdump-ada-spec@r{[}-slim@r{]} 1561@opindex fdump-ada-spec 1562For C and C++ source and include files, generate corresponding Ada specs. 1563@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 1564GNAT User's Guide}, which provides detailed documentation on this feature. 1565 1566@item -fada-spec-parent=@var{unit} 1567@opindex fada-spec-parent 1568In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 1569Ada specs as child units of parent @var{unit}. 1570 1571@item -fdump-go-spec=@var{file} 1572@opindex fdump-go-spec 1573For input files in any language, generate corresponding Go 1574declarations in @var{file}. This generates Go @code{const}, 1575@code{type}, @code{var}, and @code{func} declarations which may be a 1576useful way to start writing a Go interface to code written in some 1577other language. 1578 1579@include @value{srcdir}/../libiberty/at-file.texi 1580@end table 1581 1582@node Invoking G++ 1583@section Compiling C++ Programs 1584 1585@cindex suffixes for C++ source 1586@cindex C++ source file suffixes 1587C++ source files conventionally use one of the suffixes @samp{.C}, 1588@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1589@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 1590@samp{.H}, or (for shared template code) @samp{.tcc}; and 1591preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1592files with these names and compiles them as C++ programs even if you 1593call the compiler the same way as for compiling C programs (usually 1594with the name @command{gcc}). 1595 1596@findex g++ 1597@findex c++ 1598However, the use of @command{gcc} does not add the C++ library. 1599@command{g++} is a program that calls GCC and automatically specifies linking 1600against the C++ library. It treats @samp{.c}, 1601@samp{.h} and @samp{.i} files as C++ source files instead of C source 1602files unless @option{-x} is used. This program is also useful when 1603precompiling a C header file with a @samp{.h} extension for use in C++ 1604compilations. On many systems, @command{g++} is also installed with 1605the name @command{c++}. 1606 1607@cindex invoking @command{g++} 1608When you compile C++ programs, you may specify many of the same 1609command-line options that you use for compiling programs in any 1610language; or command-line options meaningful for C and related 1611languages; or options that are meaningful only for C++ programs. 1612@xref{C Dialect Options,,Options Controlling C Dialect}, for 1613explanations of options for languages related to C@. 1614@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1615explanations of options that are meaningful only for C++ programs. 1616 1617@node C Dialect Options 1618@section Options Controlling C Dialect 1619@cindex dialect options 1620@cindex language dialect options 1621@cindex options, dialect 1622 1623The following options control the dialect of C (or languages derived 1624from C, such as C++, Objective-C and Objective-C++) that the compiler 1625accepts: 1626 1627@table @gcctabopt 1628@cindex ANSI support 1629@cindex ISO support 1630@item -ansi 1631@opindex ansi 1632In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 1633equivalent to @option{-std=c++98}. 1634 1635This turns off certain features of GCC that are incompatible with ISO 1636C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1637such as the @code{asm} and @code{typeof} keywords, and 1638predefined macros such as @code{unix} and @code{vax} that identify the 1639type of system you are using. It also enables the undesirable and 1640rarely used ISO trigraph feature. For the C compiler, 1641it disables recognition of C++ style @samp{//} comments as well as 1642the @code{inline} keyword. 1643 1644The alternate keywords @code{__asm__}, @code{__extension__}, 1645@code{__inline__} and @code{__typeof__} continue to work despite 1646@option{-ansi}. You would not want to use them in an ISO C program, of 1647course, but it is useful to put them in header files that might be included 1648in compilations done with @option{-ansi}. Alternate predefined macros 1649such as @code{__unix__} and @code{__vax__} are also available, with or 1650without @option{-ansi}. 1651 1652The @option{-ansi} option does not cause non-ISO programs to be 1653rejected gratuitously. For that, @option{-Wpedantic} is required in 1654addition to @option{-ansi}. @xref{Warning Options}. 1655 1656The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1657option is used. Some header files may notice this macro and refrain 1658from declaring certain functions or defining certain macros that the 1659ISO standard doesn't call for; this is to avoid interfering with any 1660programs that might use these names for other things. 1661 1662Functions that are normally built in but do not have semantics 1663defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1664functions when @option{-ansi} is used. @xref{Other Builtins,,Other 1665built-in functions provided by GCC}, for details of the functions 1666affected. 1667 1668@item -std= 1669@opindex std 1670Determine the language standard. @xref{Standards,,Language Standards 1671Supported by GCC}, for details of these standard versions. This option 1672is currently only supported when compiling C or C++. 1673 1674The compiler can accept several base standards, such as @samp{c90} or 1675@samp{c++98}, and GNU dialects of those standards, such as 1676@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 1677compiler accepts all programs following that standard plus those 1678using GNU extensions that do not contradict it. For example, 1679@option{-std=c90} turns off certain features of GCC that are 1680incompatible with ISO C90, such as the @code{asm} and @code{typeof} 1681keywords, but not other GNU extensions that do not have a meaning in 1682ISO C90, such as omitting the middle term of a @code{?:} 1683expression. On the other hand, when a GNU dialect of a standard is 1684specified, all features supported by the compiler are enabled, even when 1685those features change the meaning of the base standard. As a result, some 1686strict-conforming programs may be rejected. The particular standard 1687is used by @option{-Wpedantic} to identify which features are GNU 1688extensions given that version of the standard. For example 1689@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 1690comments, while @option{-std=gnu99 -Wpedantic} does not. 1691 1692A value for this option must be provided; possible values are 1693 1694@table @samp 1695@item c90 1696@itemx c89 1697@itemx iso9899:1990 1698Support all ISO C90 programs (certain GNU extensions that conflict 1699with ISO C90 are disabled). Same as @option{-ansi} for C code. 1700 1701@item iso9899:199409 1702ISO C90 as modified in amendment 1. 1703 1704@item c99 1705@itemx c9x 1706@itemx iso9899:1999 1707@itemx iso9899:199x 1708ISO C99. This standard is substantially completely supported, modulo 1709bugs and floating-point issues 1710(mainly but not entirely relating to optional C99 features from 1711Annexes F and G). See 1712@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The 1713names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1714 1715@item c11 1716@itemx c1x 1717@itemx iso9899:2011 1718ISO C11, the 2011 revision of the ISO C standard. This standard is 1719substantially completely supported, modulo bugs, floating-point issues 1720(mainly but not entirely relating to optional C11 features from 1721Annexes F and G) and the optional Annexes K (Bounds-checking 1722interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. 1723 1724@item gnu90 1725@itemx gnu89 1726GNU dialect of ISO C90 (including some C99 features). 1727 1728@item gnu99 1729@itemx gnu9x 1730GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. 1731 1732@item gnu11 1733@itemx gnu1x 1734GNU dialect of ISO C11. This is the default for C code. 1735The name @samp{gnu1x} is deprecated. 1736 1737@item c++98 1738@itemx c++03 1739The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 1740additional defect reports. Same as @option{-ansi} for C++ code. 1741 1742@item gnu++98 1743@itemx gnu++03 1744GNU dialect of @option{-std=c++98}. This is the default for 1745C++ code. 1746 1747@item c++11 1748@itemx c++0x 1749The 2011 ISO C++ standard plus amendments. 1750The name @samp{c++0x} is deprecated. 1751 1752@item gnu++11 1753@itemx gnu++0x 1754GNU dialect of @option{-std=c++11}. 1755The name @samp{gnu++0x} is deprecated. 1756 1757@item c++14 1758@itemx c++1y 1759The 2014 ISO C++ standard plus amendments. 1760The name @samp{c++1y} is deprecated. 1761 1762@item gnu++14 1763@itemx gnu++1y 1764GNU dialect of @option{-std=c++14}. 1765The name @samp{gnu++1y} is deprecated. 1766 1767@item c++1z 1768The next revision of the ISO C++ standard, tentatively planned for 17692017. Support is highly experimental, and will almost certainly 1770change in incompatible ways in future releases. 1771 1772@item gnu++1z 1773GNU dialect of @option{-std=c++1z}. Support is highly experimental, 1774and will almost certainly change in incompatible ways in future 1775releases. 1776@end table 1777 1778@item -fgnu89-inline 1779@opindex fgnu89-inline 1780The option @option{-fgnu89-inline} tells GCC to use the traditional 1781GNU semantics for @code{inline} functions when in C99 mode. 1782@xref{Inline,,An Inline Function is As Fast As a Macro}. 1783Using this option is roughly equivalent to adding the 1784@code{gnu_inline} function attribute to all inline functions 1785(@pxref{Function Attributes}). 1786 1787The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 1788C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 1789specifies the default behavior). 1790This option is not supported in @option{-std=c90} or 1791@option{-std=gnu90} mode. 1792 1793The preprocessor macros @code{__GNUC_GNU_INLINE__} and 1794@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1795in effect for @code{inline} functions. @xref{Common Predefined 1796Macros,,,cpp,The C Preprocessor}. 1797 1798@item -aux-info @var{filename} 1799@opindex aux-info 1800Output to the given filename prototyped declarations for all functions 1801declared and/or defined in a translation unit, including those in header 1802files. This option is silently ignored in any language other than C@. 1803 1804Besides declarations, the file indicates, in comments, the origin of 1805each declaration (source file and line), whether the declaration was 1806implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1807@samp{O} for old, respectively, in the first character after the line 1808number and the colon), and whether it came from a declaration or a 1809definition (@samp{C} or @samp{F}, respectively, in the following 1810character). In the case of function definitions, a K&R-style list of 1811arguments followed by their declarations is also provided, inside 1812comments, after the declaration. 1813 1814@item -fallow-parameterless-variadic-functions 1815@opindex fallow-parameterless-variadic-functions 1816Accept variadic functions without named parameters. 1817 1818Although it is possible to define such a function, this is not very 1819useful as it is not possible to read the arguments. This is only 1820supported for C as this construct is allowed by C++. 1821 1822@item -fno-asm 1823@opindex fno-asm 1824Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1825keyword, so that code can use these words as identifiers. You can use 1826the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1827instead. @option{-ansi} implies @option{-fno-asm}. 1828 1829In C++, this switch only affects the @code{typeof} keyword, since 1830@code{asm} and @code{inline} are standard keywords. You may want to 1831use the @option{-fno-gnu-keywords} flag instead, which has the same 1832effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1833switch only affects the @code{asm} and @code{typeof} keywords, since 1834@code{inline} is a standard keyword in ISO C99. 1835 1836@item -fno-builtin 1837@itemx -fno-builtin-@var{function} 1838@opindex fno-builtin 1839@cindex built-in functions 1840Don't recognize built-in functions that do not begin with 1841@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1842functions provided by GCC}, for details of the functions affected, 1843including those which are not built-in functions when @option{-ansi} or 1844@option{-std} options for strict ISO C conformance are used because they 1845do not have an ISO standard meaning. 1846 1847GCC normally generates special code to handle certain built-in functions 1848more efficiently; for instance, calls to @code{alloca} may become single 1849instructions which adjust the stack directly, and calls to @code{memcpy} 1850may become inline copy loops. The resulting code is often both smaller 1851and faster, but since the function calls no longer appear as such, you 1852cannot set a breakpoint on those calls, nor can you change the behavior 1853of the functions by linking with a different library. In addition, 1854when a function is recognized as a built-in function, GCC may use 1855information about that function to warn about problems with calls to 1856that function, or to generate more efficient code, even if the 1857resulting code still contains calls to that function. For example, 1858warnings are given with @option{-Wformat} for bad calls to 1859@code{printf} when @code{printf} is built in and @code{strlen} is 1860known not to modify global memory. 1861 1862With the @option{-fno-builtin-@var{function}} option 1863only the built-in function @var{function} is 1864disabled. @var{function} must not begin with @samp{__builtin_}. If a 1865function is named that is not built-in in this version of GCC, this 1866option is ignored. There is no corresponding 1867@option{-fbuiltin-@var{function}} option; if you wish to enable 1868built-in functions selectively when using @option{-fno-builtin} or 1869@option{-ffreestanding}, you may define macros such as: 1870 1871@smallexample 1872#define abs(n) __builtin_abs ((n)) 1873#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1874@end smallexample 1875 1876@item -fhosted 1877@opindex fhosted 1878@cindex hosted environment 1879 1880Assert that compilation targets a hosted environment. This implies 1881@option{-fbuiltin}. A hosted environment is one in which the 1882entire standard library is available, and in which @code{main} has a return 1883type of @code{int}. Examples are nearly everything except a kernel. 1884This is equivalent to @option{-fno-freestanding}. 1885 1886@item -ffreestanding 1887@opindex ffreestanding 1888@cindex hosted environment 1889 1890Assert that compilation targets a freestanding environment. This 1891implies @option{-fno-builtin}. A freestanding environment 1892is one in which the standard library may not exist, and program startup may 1893not necessarily be at @code{main}. The most obvious example is an OS kernel. 1894This is equivalent to @option{-fno-hosted}. 1895 1896@xref{Standards,,Language Standards Supported by GCC}, for details of 1897freestanding and hosted environments. 1898 1899@item -fopenacc 1900@opindex fopenacc 1901@cindex OpenACC accelerator programming 1902Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and 1903@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the 1904compiler generates accelerated code according to the OpenACC Application 1905Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option 1906implies @option{-pthread}, and thus is only supported on targets that 1907have support for @option{-pthread}. 1908 1909Note that this is an experimental feature, incomplete, and subject to 1910change in future versions of GCC. See 1911@w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information. 1912 1913@item -fopenmp 1914@opindex fopenmp 1915@cindex OpenMP parallel 1916Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1917@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1918compiler generates parallel code according to the OpenMP Application 1919Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option 1920implies @option{-pthread}, and thus is only supported on targets that 1921have support for @option{-pthread}. @option{-fopenmp} implies 1922@option{-fopenmp-simd}. 1923 1924@item -fopenmp-simd 1925@opindex fopenmp-simd 1926@cindex OpenMP SIMD 1927@cindex SIMD 1928Enable handling of OpenMP's SIMD directives with @code{#pragma omp} 1929in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives 1930are ignored. 1931 1932@item -fcilkplus 1933@opindex fcilkplus 1934@cindex Enable Cilk Plus 1935Enable the usage of Cilk Plus language extension features for C/C++. 1936When the option @option{-fcilkplus} is specified, enable the usage of 1937the Cilk Plus Language extension features for C/C++. The present 1938implementation follows ABI version 1.2. This is an experimental 1939feature that is only partially complete, and whose interface may 1940change in future versions of GCC as the official specification 1941changes. Currently, all features but @code{_Cilk_for} have been 1942implemented. 1943 1944@item -fgnu-tm 1945@opindex fgnu-tm 1946When the option @option{-fgnu-tm} is specified, the compiler 1947generates code for the Linux variant of Intel's current Transactional 1948Memory ABI specification document (Revision 1.1, May 6 2009). This is 1949an experimental feature whose interface may change in future versions 1950of GCC, as the official specification changes. Please note that not 1951all architectures are supported for this feature. 1952 1953For more information on GCC's support for transactional memory, 1954@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 1955Transactional Memory Library}. 1956 1957Note that the transactional memory feature is not supported with 1958non-call exceptions (@option{-fnon-call-exceptions}). 1959 1960@item -fms-extensions 1961@opindex fms-extensions 1962Accept some non-standard constructs used in Microsoft header files. 1963 1964In C++ code, this allows member names in structures to be similar 1965to previous types declarations. 1966 1967@smallexample 1968typedef int UOW; 1969struct ABC @{ 1970 UOW UOW; 1971@}; 1972@end smallexample 1973 1974Some cases of unnamed fields in structures and unions are only 1975accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1976fields within structs/unions}, for details. 1977 1978Note that this option is off for all targets but x86 1979targets using ms-abi. 1980 1981@item -fplan9-extensions 1982@opindex fplan9-extensions 1983Accept some non-standard constructs used in Plan 9 code. 1984 1985This enables @option{-fms-extensions}, permits passing pointers to 1986structures with anonymous fields to functions that expect pointers to 1987elements of the type of the field, and permits referring to anonymous 1988fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 1989struct/union fields within structs/unions}, for details. This is only 1990supported for C, not C++. 1991 1992@item -trigraphs 1993@opindex trigraphs 1994Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1995options for strict ISO C conformance) implies @option{-trigraphs}. 1996 1997@cindex traditional C language 1998@cindex C language, traditional 1999@item -traditional 2000@itemx -traditional-cpp 2001@opindex traditional-cpp 2002@opindex traditional 2003Formerly, these options caused GCC to attempt to emulate a pre-standard 2004C compiler. They are now only supported with the @option{-E} switch. 2005The preprocessor continues to support a pre-standard mode. See the GNU 2006CPP manual for details. 2007 2008@item -fcond-mismatch 2009@opindex fcond-mismatch 2010Allow conditional expressions with mismatched types in the second and 2011third arguments. The value of such an expression is void. This option 2012is not supported for C++. 2013 2014@item -flax-vector-conversions 2015@opindex flax-vector-conversions 2016Allow implicit conversions between vectors with differing numbers of 2017elements and/or incompatible element types. This option should not be 2018used for new code. 2019 2020@item -funsigned-char 2021@opindex funsigned-char 2022Let the type @code{char} be unsigned, like @code{unsigned char}. 2023 2024Each kind of machine has a default for what @code{char} should 2025be. It is either like @code{unsigned char} by default or like 2026@code{signed char} by default. 2027 2028Ideally, a portable program should always use @code{signed char} or 2029@code{unsigned char} when it depends on the signedness of an object. 2030But many programs have been written to use plain @code{char} and 2031expect it to be signed, or expect it to be unsigned, depending on the 2032machines they were written for. This option, and its inverse, let you 2033make such a program work with the opposite default. 2034 2035The type @code{char} is always a distinct type from each of 2036@code{signed char} or @code{unsigned char}, even though its behavior 2037is always just like one of those two. 2038 2039@item -fsigned-char 2040@opindex fsigned-char 2041Let the type @code{char} be signed, like @code{signed char}. 2042 2043Note that this is equivalent to @option{-fno-unsigned-char}, which is 2044the negative form of @option{-funsigned-char}. Likewise, the option 2045@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 2046 2047@item -fsigned-bitfields 2048@itemx -funsigned-bitfields 2049@itemx -fno-signed-bitfields 2050@itemx -fno-unsigned-bitfields 2051@opindex fsigned-bitfields 2052@opindex funsigned-bitfields 2053@opindex fno-signed-bitfields 2054@opindex fno-unsigned-bitfields 2055These options control whether a bit-field is signed or unsigned, when the 2056declaration does not use either @code{signed} or @code{unsigned}. By 2057default, such a bit-field is signed, because this is consistent: the 2058basic integer types such as @code{int} are signed types. 2059@end table 2060 2061@node C++ Dialect Options 2062@section Options Controlling C++ Dialect 2063 2064@cindex compiler options, C++ 2065@cindex C++ options, command-line 2066@cindex options, C++ 2067This section describes the command-line options that are only meaningful 2068for C++ programs. You can also use most of the GNU compiler options 2069regardless of what language your program is in. For example, you 2070might compile a file @file{firstClass.C} like this: 2071 2072@smallexample 2073g++ -g -frepo -O -c firstClass.C 2074@end smallexample 2075 2076@noindent 2077In this example, only @option{-frepo} is an option meant 2078only for C++ programs; you can use the other options with any 2079language supported by GCC@. 2080 2081Here is a list of options that are @emph{only} for compiling C++ programs: 2082 2083@table @gcctabopt 2084 2085@item -fabi-version=@var{n} 2086@opindex fabi-version 2087Use version @var{n} of the C++ ABI@. The default is version 0. 2088 2089Version 0 refers to the version conforming most closely to 2090the C++ ABI specification. Therefore, the ABI obtained using version 0 2091will change in different versions of G++ as ABI bugs are fixed. 2092 2093Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 2094 2095Version 2 is the version of the C++ ABI that first appeared in G++ 20963.4, and was the default through G++ 4.9. 2097 2098Version 3 corrects an error in mangling a constant address as a 2099template argument. 2100 2101Version 4, which first appeared in G++ 4.5, implements a standard 2102mangling for vector types. 2103 2104Version 5, which first appeared in G++ 4.6, corrects the mangling of 2105attribute const/volatile on function pointer types, decltype of a 2106plain decl, and use of a function parameter in the declaration of 2107another parameter. 2108 2109Version 6, which first appeared in G++ 4.7, corrects the promotion 2110behavior of C++11 scoped enums and the mangling of template argument 2111packs, const/static_cast, prefix ++ and --, and a class scope function 2112used as a template argument. 2113 2114Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a 2115builtin type and corrects the mangling of lambdas in default argument 2116scope. 2117 2118Version 8, which first appeared in G++ 4.9, corrects the substitution 2119behavior of function types with function-cv-qualifiers. 2120 2121Version 9, which first appeared in G++ 5.2, corrects the alignment of 2122@code{nullptr_t}. 2123 2124See also @option{-Wabi}. 2125 2126@item -fabi-compat-version=@var{n} 2127@opindex fabi-compat-version 2128On targets that support strong aliases, G++ 2129works around mangling changes by creating an alias with the correct 2130mangled name when defining a symbol with an incorrect mangled name. 2131This switch specifies which ABI version to use for the alias. 2132 2133With @option{-fabi-version=0} (the default), this defaults to 2. If 2134another ABI version is explicitly selected, this defaults to 0. 2135 2136The compatibility version is also set by @option{-Wabi=@var{n}}. 2137 2138@item -fno-access-control 2139@opindex fno-access-control 2140Turn off all access checking. This switch is mainly useful for working 2141around bugs in the access control code. 2142 2143@item -fcheck-new 2144@opindex fcheck-new 2145Check that the pointer returned by @code{operator new} is non-null 2146before attempting to modify the storage allocated. This check is 2147normally unnecessary because the C++ standard specifies that 2148@code{operator new} only returns @code{0} if it is declared 2149@code{throw()}, in which case the compiler always checks the 2150return value even without this option. In all other cases, when 2151@code{operator new} has a non-empty exception specification, memory 2152exhaustion is signalled by throwing @code{std::bad_alloc}. See also 2153@samp{new (nothrow)}. 2154 2155@item -fconstexpr-depth=@var{n} 2156@opindex fconstexpr-depth 2157Set the maximum nested evaluation depth for C++11 constexpr functions 2158to @var{n}. A limit is needed to detect endless recursion during 2159constant expression evaluation. The minimum specified by the standard 2160is 512. 2161 2162@item -fdeduce-init-list 2163@opindex fdeduce-init-list 2164Enable deduction of a template type parameter as 2165@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@: 2166 2167@smallexample 2168template <class T> auto forward(T t) -> decltype (realfn (t)) 2169@{ 2170 return realfn (t); 2171@} 2172 2173void f() 2174@{ 2175 forward(@{1,2@}); // call forward<std::initializer_list<int>> 2176@} 2177@end smallexample 2178 2179This deduction was implemented as a possible extension to the 2180originally proposed semantics for the C++11 standard, but was not part 2181of the final standard, so it is disabled by default. This option is 2182deprecated, and may be removed in a future version of G++. 2183 2184@item -ffriend-injection 2185@opindex ffriend-injection 2186Inject friend functions into the enclosing namespace, so that they are 2187visible outside the scope of the class in which they are declared. 2188Friend functions were documented to work this way in the old Annotated 2189C++ Reference Manual. 2190However, in ISO C++ a friend function that is not declared 2191in an enclosing scope can only be found using argument dependent 2192lookup. GCC defaults to the standard behavior. 2193 2194This option is for compatibility, and may be removed in a future 2195release of G++. 2196 2197@item -fno-elide-constructors 2198@opindex fno-elide-constructors 2199The C++ standard allows an implementation to omit creating a temporary 2200that is only used to initialize another object of the same type. 2201Specifying this option disables that optimization, and forces G++ to 2202call the copy constructor in all cases. 2203 2204@item -fno-enforce-eh-specs 2205@opindex fno-enforce-eh-specs 2206Don't generate code to check for violation of exception specifications 2207at run time. This option violates the C++ standard, but may be useful 2208for reducing code size in production builds, much like defining 2209@code{NDEBUG}. This does not give user code permission to throw 2210exceptions in violation of the exception specifications; the compiler 2211still optimizes based on the specifications, so throwing an 2212unexpected exception results in undefined behavior at run time. 2213 2214@item -fextern-tls-init 2215@itemx -fno-extern-tls-init 2216@opindex fextern-tls-init 2217@opindex fno-extern-tls-init 2218The C++11 and OpenMP standards allow @code{thread_local} and 2219@code{threadprivate} variables to have dynamic (runtime) 2220initialization. To support this, any use of such a variable goes 2221through a wrapper function that performs any necessary initialization. 2222When the use and definition of the variable are in the same 2223translation unit, this overhead can be optimized away, but when the 2224use is in a different translation unit there is significant overhead 2225even if the variable doesn't actually need dynamic initialization. If 2226the programmer can be sure that no use of the variable in a 2227non-defining TU needs to trigger dynamic initialization (either 2228because the variable is statically initialized, or a use of the 2229variable in the defining TU will be executed before any uses in 2230another TU), they can avoid this overhead with the 2231@option{-fno-extern-tls-init} option. 2232 2233On targets that support symbol aliases, the default is 2234@option{-fextern-tls-init}. On targets that do not support symbol 2235aliases, the default is @option{-fno-extern-tls-init}. 2236 2237@item -ffor-scope 2238@itemx -fno-for-scope 2239@opindex ffor-scope 2240@opindex fno-for-scope 2241If @option{-ffor-scope} is specified, the scope of variables declared in 2242a @i{for-init-statement} is limited to the @code{for} loop itself, 2243as specified by the C++ standard. 2244If @option{-fno-for-scope} is specified, the scope of variables declared in 2245a @i{for-init-statement} extends to the end of the enclosing scope, 2246as was the case in old versions of G++, and other (traditional) 2247implementations of C++. 2248 2249If neither flag is given, the default is to follow the standard, 2250but to allow and give a warning for old-style code that would 2251otherwise be invalid, or have different behavior. 2252 2253@item -fno-gnu-keywords 2254@opindex fno-gnu-keywords 2255Do not recognize @code{typeof} as a keyword, so that code can use this 2256word as an identifier. You can use the keyword @code{__typeof__} instead. 2257@option{-ansi} implies @option{-fno-gnu-keywords}. 2258 2259@item -fno-implicit-templates 2260@opindex fno-implicit-templates 2261Never emit code for non-inline templates that are instantiated 2262implicitly (i.e.@: by use); only emit code for explicit instantiations. 2263@xref{Template Instantiation}, for more information. 2264 2265@item -fno-implicit-inline-templates 2266@opindex fno-implicit-inline-templates 2267Don't emit code for implicit instantiations of inline templates, either. 2268The default is to handle inlines differently so that compiles with and 2269without optimization need the same set of explicit instantiations. 2270 2271@item -fno-implement-inlines 2272@opindex fno-implement-inlines 2273To save space, do not emit out-of-line copies of inline functions 2274controlled by @code{#pragma implementation}. This causes linker 2275errors if these functions are not inlined everywhere they are called. 2276 2277@item -fms-extensions 2278@opindex fms-extensions 2279Disable Wpedantic warnings about constructs used in MFC, such as implicit 2280int and getting a pointer to member function via non-standard syntax. 2281 2282@item -fno-nonansi-builtins 2283@opindex fno-nonansi-builtins 2284Disable built-in declarations of functions that are not mandated by 2285ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 2286@code{index}, @code{bzero}, @code{conjf}, and other related functions. 2287 2288@item -fnothrow-opt 2289@opindex fnothrow-opt 2290Treat a @code{throw()} exception specification as if it were a 2291@code{noexcept} specification to reduce or eliminate the text size 2292overhead relative to a function with no exception specification. If 2293the function has local variables of types with non-trivial 2294destructors, the exception specification actually makes the 2295function smaller because the EH cleanups for those variables can be 2296optimized away. The semantic effect is that an exception thrown out of 2297a function with such an exception specification results in a call 2298to @code{terminate} rather than @code{unexpected}. 2299 2300@item -fno-operator-names 2301@opindex fno-operator-names 2302Do not treat the operator name keywords @code{and}, @code{bitand}, 2303@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 2304synonyms as keywords. 2305 2306@item -fno-optional-diags 2307@opindex fno-optional-diags 2308Disable diagnostics that the standard says a compiler does not need to 2309issue. Currently, the only such diagnostic issued by G++ is the one for 2310a name having multiple meanings within a class. 2311 2312@item -fpermissive 2313@opindex fpermissive 2314Downgrade some diagnostics about nonconformant code from errors to 2315warnings. Thus, using @option{-fpermissive} allows some 2316nonconforming code to compile. 2317 2318@item -fno-pretty-templates 2319@opindex fno-pretty-templates 2320When an error message refers to a specialization of a function 2321template, the compiler normally prints the signature of the 2322template followed by the template arguments and any typedefs or 2323typenames in the signature (e.g. @code{void f(T) [with T = int]} 2324rather than @code{void f(int)}) so that it's clear which template is 2325involved. When an error message refers to a specialization of a class 2326template, the compiler omits any template arguments that match 2327the default template arguments for that template. If either of these 2328behaviors make it harder to understand the error message rather than 2329easier, you can use @option{-fno-pretty-templates} to disable them. 2330 2331@item -frepo 2332@opindex frepo 2333Enable automatic template instantiation at link time. This option also 2334implies @option{-fno-implicit-templates}. @xref{Template 2335Instantiation}, for more information. 2336 2337@item -fno-rtti 2338@opindex fno-rtti 2339Disable generation of information about every class with virtual 2340functions for use by the C++ run-time type identification features 2341(@code{dynamic_cast} and @code{typeid}). If you don't use those parts 2342of the language, you can save some space by using this flag. Note that 2343exception handling uses the same information, but G++ generates it as 2344needed. The @code{dynamic_cast} operator can still be used for casts that 2345do not require run-time type information, i.e.@: casts to @code{void *} or to 2346unambiguous base classes. 2347 2348@item -fsized-deallocation 2349@opindex fsized-deallocation 2350Enable the built-in global declarations 2351@smallexample 2352void operator delete (void *, std::size_t) noexcept; 2353void operator delete[] (void *, std::size_t) noexcept; 2354@end smallexample 2355as introduced in C++14. This is useful for user-defined replacement 2356deallocation functions that, for example, use the size of the object 2357to make deallocation faster. Enabled by default under 2358@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} 2359warns about places that might want to add a definition. 2360 2361@item -fstats 2362@opindex fstats 2363Emit statistics about front-end processing at the end of the compilation. 2364This information is generally only useful to the G++ development team. 2365 2366@item -fstrict-enums 2367@opindex fstrict-enums 2368Allow the compiler to optimize using the assumption that a value of 2369enumerated type can only be one of the values of the enumeration (as 2370defined in the C++ standard; basically, a value that can be 2371represented in the minimum number of bits needed to represent all the 2372enumerators). This assumption may not be valid if the program uses a 2373cast to convert an arbitrary integer value to the enumerated type. 2374 2375@item -ftemplate-backtrace-limit=@var{n} 2376@opindex ftemplate-backtrace-limit 2377Set the maximum number of template instantiation notes for a single 2378warning or error to @var{n}. The default value is 10. 2379 2380@item -ftemplate-depth=@var{n} 2381@opindex ftemplate-depth 2382Set the maximum instantiation depth for template classes to @var{n}. 2383A limit on the template instantiation depth is needed to detect 2384endless recursions during template class instantiation. ANSI/ISO C++ 2385conforming programs must not rely on a maximum depth greater than 17 2386(changed to 1024 in C++11). The default value is 900, as the compiler 2387can run out of stack space before hitting 1024 in some situations. 2388 2389@item -fno-threadsafe-statics 2390@opindex fno-threadsafe-statics 2391Do not emit the extra code to use the routines specified in the C++ 2392ABI for thread-safe initialization of local statics. You can use this 2393option to reduce code size slightly in code that doesn't need to be 2394thread-safe. 2395 2396@item -fuse-cxa-atexit 2397@opindex fuse-cxa-atexit 2398Register destructors for objects with static storage duration with the 2399@code{__cxa_atexit} function rather than the @code{atexit} function. 2400This option is required for fully standards-compliant handling of static 2401destructors, but only works if your C library supports 2402@code{__cxa_atexit}. 2403 2404@item -fno-use-cxa-get-exception-ptr 2405@opindex fno-use-cxa-get-exception-ptr 2406Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 2407causes @code{std::uncaught_exception} to be incorrect, but is necessary 2408if the runtime routine is not available. 2409 2410@item -fvisibility-inlines-hidden 2411@opindex fvisibility-inlines-hidden 2412This switch declares that the user does not attempt to compare 2413pointers to inline functions or methods where the addresses of the two functions 2414are taken in different shared objects. 2415 2416The effect of this is that GCC may, effectively, mark inline methods with 2417@code{__attribute__ ((visibility ("hidden")))} so that they do not 2418appear in the export table of a DSO and do not require a PLT indirection 2419when used within the DSO@. Enabling this option can have a dramatic effect 2420on load and link times of a DSO as it massively reduces the size of the 2421dynamic export table when the library makes heavy use of templates. 2422 2423The behavior of this switch is not quite the same as marking the 2424methods as hidden directly, because it does not affect static variables 2425local to the function or cause the compiler to deduce that 2426the function is defined in only one shared object. 2427 2428You may mark a method as having a visibility explicitly to negate the 2429effect of the switch for that method. For example, if you do want to 2430compare pointers to a particular inline method, you might mark it as 2431having default visibility. Marking the enclosing class with explicit 2432visibility has no effect. 2433 2434Explicitly instantiated inline methods are unaffected by this option 2435as their linkage might otherwise cross a shared library boundary. 2436@xref{Template Instantiation}. 2437 2438@item -fvisibility-ms-compat 2439@opindex fvisibility-ms-compat 2440This flag attempts to use visibility settings to make GCC's C++ 2441linkage model compatible with that of Microsoft Visual Studio. 2442 2443The flag makes these changes to GCC's linkage model: 2444 2445@enumerate 2446@item 2447It sets the default visibility to @code{hidden}, like 2448@option{-fvisibility=hidden}. 2449 2450@item 2451Types, but not their members, are not hidden by default. 2452 2453@item 2454The One Definition Rule is relaxed for types without explicit 2455visibility specifications that are defined in more than one 2456shared object: those declarations are permitted if they are 2457permitted when this option is not used. 2458@end enumerate 2459 2460In new code it is better to use @option{-fvisibility=hidden} and 2461export those classes that are intended to be externally visible. 2462Unfortunately it is possible for code to rely, perhaps accidentally, 2463on the Visual Studio behavior. 2464 2465Among the consequences of these changes are that static data members 2466of the same type with the same name but defined in different shared 2467objects are different, so changing one does not change the other; 2468and that pointers to function members defined in different shared 2469objects may not compare equal. When this flag is given, it is a 2470violation of the ODR to define types with the same name differently. 2471 2472@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 2473@opindex fvtable-verify 2474Turn on (or off, if using @option{-fvtable-verify=none}) the security 2475feature that verifies at run time, for every virtual call, that 2476the vtable pointer through which the call is made is valid for the type of 2477the object, and has not been corrupted or overwritten. If an invalid vtable 2478pointer is detected at run time, an error is reported and execution of the 2479program is immediately halted. 2480 2481This option causes run-time data structures to be built at program startup, 2482which are used for verifying the vtable pointers. 2483The options @samp{std} and @samp{preinit} 2484control the timing of when these data structures are built. In both cases the 2485data structures are built before execution reaches @code{main}. Using 2486@option{-fvtable-verify=std} causes the data structures to be built after 2487shared libraries have been loaded and initialized. 2488@option{-fvtable-verify=preinit} causes them to be built before shared 2489libraries have been loaded and initialized. 2490 2491If this option appears multiple times in the command line with different 2492values specified, @samp{none} takes highest priority over both @samp{std} and 2493@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 2494 2495@item -fvtv-debug 2496@opindex fvtv-debug 2497When used in conjunction with @option{-fvtable-verify=std} or 2498@option{-fvtable-verify=preinit}, causes debug versions of the 2499runtime functions for the vtable verification feature to be called. 2500This flag also causes the compiler to log information about which 2501vtable pointers it finds for each class. 2502This information is written to a file named @file{vtv_set_ptr_data.log} 2503in the directory named by the environment variable @env{VTV_LOGS_DIR} 2504if that is defined or the current working directory otherwise. 2505 2506Note: This feature @emph{appends} data to the log file. If you want a fresh log 2507file, be sure to delete any existing one. 2508 2509@item -fvtv-counts 2510@opindex fvtv-counts 2511This is a debugging flag. When used in conjunction with 2512@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 2513causes the compiler to keep track of the total number of virtual calls 2514it encounters and the number of verifications it inserts. It also 2515counts the number of calls to certain run-time library functions 2516that it inserts and logs this information for each compilation unit. 2517The compiler writes this information to a file named 2518@file{vtv_count_data.log} in the directory named by the environment 2519variable @env{VTV_LOGS_DIR} if that is defined or the current working 2520directory otherwise. It also counts the size of the vtable pointer sets 2521for each class, and writes this information to @file{vtv_class_set_sizes.log} 2522in the same directory. 2523 2524Note: This feature @emph{appends} data to the log files. To get fresh log 2525files, be sure to delete any existing ones. 2526 2527@item -fno-weak 2528@opindex fno-weak 2529Do not use weak symbol support, even if it is provided by the linker. 2530By default, G++ uses weak symbols if they are available. This 2531option exists only for testing, and should not be used by end-users; 2532it results in inferior code and has no benefits. This option may 2533be removed in a future release of G++. 2534 2535@item -nostdinc++ 2536@opindex nostdinc++ 2537Do not search for header files in the standard directories specific to 2538C++, but do still search the other standard directories. (This option 2539is used when building the C++ library.) 2540@end table 2541 2542In addition, these optimization, warning, and code generation options 2543have meanings only for C++ programs: 2544 2545@table @gcctabopt 2546@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 2547@opindex Wabi 2548@opindex Wno-abi 2549When an explicit @option{-fabi-version=@var{n}} option is used, causes 2550G++ to warn when it generates code that is probably not compatible with the 2551vendor-neutral C++ ABI@. Since G++ now defaults to 2552@option{-fabi-version=0}, @option{-Wabi} has no effect unless either 2553an older ABI version is selected (with @option{-fabi-version=@var{n}}) 2554or an older compatibility version is selected (with 2555@option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}). 2556 2557Although an effort has been made to warn about 2558all such cases, there are probably some cases that are not warned about, 2559even though G++ is generating incompatible code. There may also be 2560cases where warnings are emitted even though the code that is generated 2561is compatible. 2562 2563You should rewrite your code to avoid these warnings if you are 2564concerned about the fact that code generated by G++ may not be binary 2565compatible with code generated by other compilers. 2566 2567@option{-Wabi} can also be used with an explicit version number to 2568warn about compatibility with a particular @option{-fabi-version} 2569level, e.g. @option{-Wabi=2} to warn about changes relative to 2570@option{-fabi-version=2}. Specifying a version number also sets 2571@option{-fabi-compat-version=@var{n}}. 2572 2573The known incompatibilities in @option{-fabi-version=2} (which was the 2574default from GCC 3.4 to 4.9) include: 2575 2576@itemize @bullet 2577 2578@item 2579A template with a non-type template parameter of reference type was 2580mangled incorrectly: 2581@smallexample 2582extern int N; 2583template <int &> struct S @{@}; 2584void n (S<N>) @{2@} 2585@end smallexample 2586 2587This was fixed in @option{-fabi-version=3}. 2588 2589@item 2590SIMD vector types declared using @code{__attribute ((vector_size))} were 2591mangled in a non-standard way that does not allow for overloading of 2592functions taking vectors of different sizes. 2593 2594The mangling was changed in @option{-fabi-version=4}. 2595 2596@item 2597@code{__attribute ((const))} and @code{noreturn} were mangled as type 2598qualifiers, and @code{decltype} of a plain declaration was folded away. 2599 2600These mangling issues were fixed in @option{-fabi-version=5}. 2601 2602@item 2603Scoped enumerators passed as arguments to a variadic function are 2604promoted like unscoped enumerators, causing @code{va_arg} to complain. 2605On most targets this does not actually affect the parameter passing 2606ABI, as there is no way to pass an argument smaller than @code{int}. 2607 2608Also, the ABI changed the mangling of template argument packs, 2609@code{const_cast}, @code{static_cast}, prefix increment/decrement, and 2610a class scope function used as a template argument. 2611 2612These issues were corrected in @option{-fabi-version=6}. 2613 2614@item 2615Lambdas in default argument scope were mangled incorrectly, and the 2616ABI changed the mangling of @code{nullptr_t}. 2617 2618These issues were corrected in @option{-fabi-version=7}. 2619 2620@item 2621When mangling a function type with function-cv-qualifiers, the 2622un-qualified function type was incorrectly treated as a substitution 2623candidate. 2624 2625This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. 2626 2627@item 2628@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to 2629unaligned accesses. Note that this did not affect the ABI of a 2630function with a @code{nullptr_t} parameter, as parameters have a 2631minimum alignment. 2632 2633This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. 2634@end itemize 2635 2636It also warns about psABI-related changes. The known psABI changes at this 2637point include: 2638 2639@itemize @bullet 2640 2641@item 2642For SysV/x86-64, unions with @code{long double} members are 2643passed in memory as specified in psABI. For example: 2644 2645@smallexample 2646union U @{ 2647 long double ld; 2648 int i; 2649@}; 2650@end smallexample 2651 2652@noindent 2653@code{union U} is always passed in memory. 2654 2655@end itemize 2656 2657@item -Wabi-tag @r{(C++ and Objective-C++ only)} 2658@opindex Wabi-tag 2659@opindex -Wabi-tag 2660Warn when a type with an ABI tag is used in a context that does not 2661have that ABI tag. See @ref{C++ Attributes} for more information 2662about ABI tags. 2663 2664@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 2665@opindex Wctor-dtor-privacy 2666@opindex Wno-ctor-dtor-privacy 2667Warn when a class seems unusable because all the constructors or 2668destructors in that class are private, and it has neither friends nor 2669public static member functions. Also warn if there are no non-private 2670methods, and there's at least one private member function that isn't 2671a constructor or destructor. 2672 2673@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 2674@opindex Wdelete-non-virtual-dtor 2675@opindex Wno-delete-non-virtual-dtor 2676Warn when @code{delete} is used to destroy an instance of a class that 2677has virtual functions and non-virtual destructor. It is unsafe to delete 2678an instance of a derived class through a pointer to a base class if the 2679base class does not have a virtual destructor. This warning is enabled 2680by @option{-Wall}. 2681 2682@item -Wliteral-suffix @r{(C++ and Objective-C++ only)} 2683@opindex Wliteral-suffix 2684@opindex Wno-literal-suffix 2685Warn when a string or character literal is followed by a ud-suffix which does 2686not begin with an underscore. As a conforming extension, GCC treats such 2687suffixes as separate preprocessing tokens in order to maintain backwards 2688compatibility with code that uses formatting macros from @code{<inttypes.h>}. 2689For example: 2690 2691@smallexample 2692#define __STDC_FORMAT_MACROS 2693#include <inttypes.h> 2694#include <stdio.h> 2695 2696int main() @{ 2697 int64_t i64 = 123; 2698 printf("My int64: %"PRId64"\n", i64); 2699@} 2700@end smallexample 2701 2702In this case, @code{PRId64} is treated as a separate preprocessing token. 2703 2704This warning is enabled by default. 2705 2706@item -Wnarrowing @r{(C++ and Objective-C++ only)} 2707@opindex Wnarrowing 2708@opindex Wno-narrowing 2709Warn when a narrowing conversion prohibited by C++11 occurs within 2710@samp{@{ @}}, e.g. 2711 2712@smallexample 2713int i = @{ 2.2 @}; // error: narrowing from double to int 2714@end smallexample 2715 2716This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 2717 2718With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic 2719required by the standard. Note that this does not affect the meaning 2720of well-formed code; narrowing conversions are still considered 2721ill-formed in SFINAE context. 2722 2723@item -Wnoexcept @r{(C++ and Objective-C++ only)} 2724@opindex Wnoexcept 2725@opindex Wno-noexcept 2726Warn when a noexcept-expression evaluates to false because of a call 2727to a function that does not have a non-throwing exception 2728specification (i.e. @code{throw()} or @code{noexcept}) but is known by 2729the compiler to never throw an exception. 2730 2731@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 2732@opindex Wnon-virtual-dtor 2733@opindex Wno-non-virtual-dtor 2734Warn when a class has virtual functions and an accessible non-virtual 2735destructor itself or in an accessible polymorphic base class, in which 2736case it is possible but unsafe to delete an instance of a derived 2737class through a pointer to the class itself or base class. This 2738warning is automatically enabled if @option{-Weffc++} is specified. 2739 2740@item -Wreorder @r{(C++ and Objective-C++ only)} 2741@opindex Wreorder 2742@opindex Wno-reorder 2743@cindex reordering, warning 2744@cindex warning for reordering of member initializers 2745Warn when the order of member initializers given in the code does not 2746match the order in which they must be executed. For instance: 2747 2748@smallexample 2749struct A @{ 2750 int i; 2751 int j; 2752 A(): j (0), i (1) @{ @} 2753@}; 2754@end smallexample 2755 2756@noindent 2757The compiler rearranges the member initializers for @code{i} 2758and @code{j} to match the declaration order of the members, emitting 2759a warning to that effect. This warning is enabled by @option{-Wall}. 2760 2761@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 2762@opindex fext-numeric-literals 2763@opindex fno-ext-numeric-literals 2764Accept imaginary, fixed-point, or machine-defined 2765literal number suffixes as GNU extensions. 2766When this option is turned off these suffixes are treated 2767as C++11 user-defined literal numeric suffixes. 2768This is on by default for all pre-C++11 dialects and all GNU dialects: 2769@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 2770@option{-std=gnu++14}. 2771This option is off by default 2772for ISO C++11 onwards (@option{-std=c++11}, ...). 2773@end table 2774 2775The following @option{-W@dots{}} options are not affected by @option{-Wall}. 2776 2777@table @gcctabopt 2778@item -Weffc++ @r{(C++ and Objective-C++ only)} 2779@opindex Weffc++ 2780@opindex Wno-effc++ 2781Warn about violations of the following style guidelines from Scott Meyers' 2782@cite{Effective C++} series of books: 2783 2784@itemize @bullet 2785@item 2786Define a copy constructor and an assignment operator for classes 2787with dynamically-allocated memory. 2788 2789@item 2790Prefer initialization to assignment in constructors. 2791 2792@item 2793Have @code{operator=} return a reference to @code{*this}. 2794 2795@item 2796Don't try to return a reference when you must return an object. 2797 2798@item 2799Distinguish between prefix and postfix forms of increment and 2800decrement operators. 2801 2802@item 2803Never overload @code{&&}, @code{||}, or @code{,}. 2804 2805@end itemize 2806 2807This option also enables @option{-Wnon-virtual-dtor}, which is also 2808one of the effective C++ recommendations. However, the check is 2809extended to warn about the lack of virtual destructor in accessible 2810non-polymorphic bases classes too. 2811 2812When selecting this option, be aware that the standard library 2813headers do not obey all of these guidelines; use @samp{grep -v} 2814to filter out those warnings. 2815 2816@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 2817@opindex Wstrict-null-sentinel 2818@opindex Wno-strict-null-sentinel 2819Warn about the use of an uncasted @code{NULL} as sentinel. When 2820compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 2821to @code{__null}. Although it is a null pointer constant rather than a 2822null pointer, it is guaranteed to be of the same size as a pointer. 2823But this use is not portable across different compilers. 2824 2825@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 2826@opindex Wno-non-template-friend 2827@opindex Wnon-template-friend 2828Disable warnings when non-templatized friend functions are declared 2829within a template. Since the advent of explicit template specification 2830support in G++, if the name of the friend is an unqualified-id (i.e., 2831@samp{friend foo(int)}), the C++ language specification demands that the 2832friend declare or define an ordinary, nontemplate function. (Section 283314.5.3). Before G++ implemented explicit specification, unqualified-ids 2834could be interpreted as a particular specialization of a templatized 2835function. Because this non-conforming behavior is no longer the default 2836behavior for G++, @option{-Wnon-template-friend} allows the compiler to 2837check existing code for potential trouble spots and is on by default. 2838This new compiler behavior can be turned off with 2839@option{-Wno-non-template-friend}, which keeps the conformant compiler code 2840but disables the helpful warning. 2841 2842@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 2843@opindex Wold-style-cast 2844@opindex Wno-old-style-cast 2845Warn if an old-style (C-style) cast to a non-void type is used within 2846a C++ program. The new-style casts (@code{dynamic_cast}, 2847@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are 2848less vulnerable to unintended effects and much easier to search for. 2849 2850@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 2851@opindex Woverloaded-virtual 2852@opindex Wno-overloaded-virtual 2853@cindex overloaded virtual function, warning 2854@cindex warning for overloaded virtual function 2855Warn when a function declaration hides virtual functions from a 2856base class. For example, in: 2857 2858@smallexample 2859struct A @{ 2860 virtual void f(); 2861@}; 2862 2863struct B: public A @{ 2864 void f(int); 2865@}; 2866@end smallexample 2867 2868the @code{A} class version of @code{f} is hidden in @code{B}, and code 2869like: 2870 2871@smallexample 2872B* b; 2873b->f(); 2874@end smallexample 2875 2876@noindent 2877fails to compile. 2878 2879@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 2880@opindex Wno-pmf-conversions 2881@opindex Wpmf-conversions 2882Disable the diagnostic for converting a bound pointer to member function 2883to a plain pointer. 2884 2885@item -Wsign-promo @r{(C++ and Objective-C++ only)} 2886@opindex Wsign-promo 2887@opindex Wno-sign-promo 2888Warn when overload resolution chooses a promotion from unsigned or 2889enumerated type to a signed type, over a conversion to an unsigned type of 2890the same size. Previous versions of G++ tried to preserve 2891unsignedness, but the standard mandates the current behavior. 2892@end table 2893 2894@node Objective-C and Objective-C++ Dialect Options 2895@section Options Controlling Objective-C and Objective-C++ Dialects 2896 2897@cindex compiler options, Objective-C and Objective-C++ 2898@cindex Objective-C and Objective-C++ options, command-line 2899@cindex options, Objective-C and Objective-C++ 2900(NOTE: This manual does not describe the Objective-C and Objective-C++ 2901languages themselves. @xref{Standards,,Language Standards 2902Supported by GCC}, for references.) 2903 2904This section describes the command-line options that are only meaningful 2905for Objective-C and Objective-C++ programs. You can also use most of 2906the language-independent GNU compiler options. 2907For example, you might compile a file @file{some_class.m} like this: 2908 2909@smallexample 2910gcc -g -fgnu-runtime -O -c some_class.m 2911@end smallexample 2912 2913@noindent 2914In this example, @option{-fgnu-runtime} is an option meant only for 2915Objective-C and Objective-C++ programs; you can use the other options with 2916any language supported by GCC@. 2917 2918Note that since Objective-C is an extension of the C language, Objective-C 2919compilations may also use options specific to the C front-end (e.g., 2920@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 2921C++-specific options (e.g., @option{-Wabi}). 2922 2923Here is a list of options that are @emph{only} for compiling Objective-C 2924and Objective-C++ programs: 2925 2926@table @gcctabopt 2927@item -fconstant-string-class=@var{class-name} 2928@opindex fconstant-string-class 2929Use @var{class-name} as the name of the class to instantiate for each 2930literal string specified with the syntax @code{@@"@dots{}"}. The default 2931class name is @code{NXConstantString} if the GNU runtime is being used, and 2932@code{NSConstantString} if the NeXT runtime is being used (see below). The 2933@option{-fconstant-cfstrings} option, if also present, overrides the 2934@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals 2935to be laid out as constant CoreFoundation strings. 2936 2937@item -fgnu-runtime 2938@opindex fgnu-runtime 2939Generate object code compatible with the standard GNU Objective-C 2940runtime. This is the default for most types of systems. 2941 2942@item -fnext-runtime 2943@opindex fnext-runtime 2944Generate output compatible with the NeXT runtime. This is the default 2945for NeXT-based systems, including Darwin and Mac OS X@. The macro 2946@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 2947used. 2948 2949@item -fno-nil-receivers 2950@opindex fno-nil-receivers 2951Assume that all Objective-C message dispatches (@code{[receiver 2952message:arg]}) in this translation unit ensure that the receiver is 2953not @code{nil}. This allows for more efficient entry points in the 2954runtime to be used. This option is only available in conjunction with 2955the NeXT runtime and ABI version 0 or 1. 2956 2957@item -fobjc-abi-version=@var{n} 2958@opindex fobjc-abi-version 2959Use version @var{n} of the Objective-C ABI for the selected runtime. 2960This option is currently supported only for the NeXT runtime. In that 2961case, Version 0 is the traditional (32-bit) ABI without support for 2962properties and other Objective-C 2.0 additions. Version 1 is the 2963traditional (32-bit) ABI with support for properties and other 2964Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 2965nothing is specified, the default is Version 0 on 32-bit target 2966machines, and Version 2 on 64-bit target machines. 2967 2968@item -fobjc-call-cxx-cdtors 2969@opindex fobjc-call-cxx-cdtors 2970For each Objective-C class, check if any of its instance variables is a 2971C++ object with a non-trivial default constructor. If so, synthesize a 2972special @code{- (id) .cxx_construct} instance method which runs 2973non-trivial default constructors on any such instance variables, in order, 2974and then return @code{self}. Similarly, check if any instance variable 2975is a C++ object with a non-trivial destructor, and if so, synthesize a 2976special @code{- (void) .cxx_destruct} method which runs 2977all such default destructors, in reverse order. 2978 2979The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 2980methods thusly generated only operate on instance variables 2981declared in the current Objective-C class, and not those inherited 2982from superclasses. It is the responsibility of the Objective-C 2983runtime to invoke all such methods in an object's inheritance 2984hierarchy. The @code{- (id) .cxx_construct} methods are invoked 2985by the runtime immediately after a new object instance is allocated; 2986the @code{- (void) .cxx_destruct} methods are invoked immediately 2987before the runtime deallocates an object instance. 2988 2989As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 2990support for invoking the @code{- (id) .cxx_construct} and 2991@code{- (void) .cxx_destruct} methods. 2992 2993@item -fobjc-direct-dispatch 2994@opindex fobjc-direct-dispatch 2995Allow fast jumps to the message dispatcher. On Darwin this is 2996accomplished via the comm page. 2997 2998@item -fobjc-exceptions 2999@opindex fobjc-exceptions 3000Enable syntactic support for structured exception handling in 3001Objective-C, similar to what is offered by C++ and Java. This option 3002is required to use the Objective-C keywords @code{@@try}, 3003@code{@@throw}, @code{@@catch}, @code{@@finally} and 3004@code{@@synchronized}. This option is available with both the GNU 3005runtime and the NeXT runtime (but not available in conjunction with 3006the NeXT runtime on Mac OS X 10.2 and earlier). 3007 3008@item -fobjc-gc 3009@opindex fobjc-gc 3010Enable garbage collection (GC) in Objective-C and Objective-C++ 3011programs. This option is only available with the NeXT runtime; the 3012GNU runtime has a different garbage collection implementation that 3013does not require special compiler flags. 3014 3015@item -fobjc-nilcheck 3016@opindex fobjc-nilcheck 3017For the NeXT runtime with version 2 of the ABI, check for a nil 3018receiver in method invocations before doing the actual method call. 3019This is the default and can be disabled using 3020@option{-fno-objc-nilcheck}. Class methods and super calls are never 3021checked for nil in this way no matter what this flag is set to. 3022Currently this flag does nothing when the GNU runtime, or an older 3023version of the NeXT runtime ABI, is used. 3024 3025@item -fobjc-std=objc1 3026@opindex fobjc-std 3027Conform to the language syntax of Objective-C 1.0, the language 3028recognized by GCC 4.0. This only affects the Objective-C additions to 3029the C/C++ language; it does not affect conformance to C/C++ standards, 3030which is controlled by the separate C/C++ dialect option flags. When 3031this option is used with the Objective-C or Objective-C++ compiler, 3032any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 3033This is useful if you need to make sure that your Objective-C code can 3034be compiled with older versions of GCC@. 3035 3036@item -freplace-objc-classes 3037@opindex freplace-objc-classes 3038Emit a special marker instructing @command{ld(1)} not to statically link in 3039the resulting object file, and allow @command{dyld(1)} to load it in at 3040run time instead. This is used in conjunction with the Fix-and-Continue 3041debugging mode, where the object file in question may be recompiled and 3042dynamically reloaded in the course of program execution, without the need 3043to restart the program itself. Currently, Fix-and-Continue functionality 3044is only available in conjunction with the NeXT runtime on Mac OS X 10.3 3045and later. 3046 3047@item -fzero-link 3048@opindex fzero-link 3049When compiling for the NeXT runtime, the compiler ordinarily replaces calls 3050to @code{objc_getClass("@dots{}")} (when the name of the class is known at 3051compile time) with static class references that get initialized at load time, 3052which improves run-time performance. Specifying the @option{-fzero-link} flag 3053suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 3054to be retained. This is useful in Zero-Link debugging mode, since it allows 3055for individual class implementations to be modified during program execution. 3056The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 3057regardless of command-line options. 3058 3059@item -fno-local-ivars 3060@opindex fno-local-ivars 3061@opindex flocal-ivars 3062By default instance variables in Objective-C can be accessed as if 3063they were local variables from within the methods of the class they're 3064declared in. This can lead to shadowing between instance variables 3065and other variables declared either locally inside a class method or 3066globally with the same name. Specifying the @option{-fno-local-ivars} 3067flag disables this behavior thus avoiding variable shadowing issues. 3068 3069@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} 3070@opindex fivar-visibility 3071Set the default instance variable visibility to the specified option 3072so that instance variables declared outside the scope of any access 3073modifier directives default to the specified visibility. 3074 3075@item -gen-decls 3076@opindex gen-decls 3077Dump interface declarations for all classes seen in the source file to a 3078file named @file{@var{sourcename}.decl}. 3079 3080@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 3081@opindex Wassign-intercept 3082@opindex Wno-assign-intercept 3083Warn whenever an Objective-C assignment is being intercepted by the 3084garbage collector. 3085 3086@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 3087@opindex Wno-protocol 3088@opindex Wprotocol 3089If a class is declared to implement a protocol, a warning is issued for 3090every method in the protocol that is not implemented by the class. The 3091default behavior is to issue a warning for every method not explicitly 3092implemented in the class, even if a method implementation is inherited 3093from the superclass. If you use the @option{-Wno-protocol} option, then 3094methods inherited from the superclass are considered to be implemented, 3095and no warning is issued for them. 3096 3097@item -Wselector @r{(Objective-C and Objective-C++ only)} 3098@opindex Wselector 3099@opindex Wno-selector 3100Warn if multiple methods of different types for the same selector are 3101found during compilation. The check is performed on the list of methods 3102in the final stage of compilation. Additionally, a check is performed 3103for each selector appearing in a @code{@@selector(@dots{})} 3104expression, and a corresponding method for that selector has been found 3105during compilation. Because these checks scan the method table only at 3106the end of compilation, these warnings are not produced if the final 3107stage of compilation is not reached, for example because an error is 3108found during compilation, or because the @option{-fsyntax-only} option is 3109being used. 3110 3111@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 3112@opindex Wstrict-selector-match 3113@opindex Wno-strict-selector-match 3114Warn if multiple methods with differing argument and/or return types are 3115found for a given selector when attempting to send a message using this 3116selector to a receiver of type @code{id} or @code{Class}. When this flag 3117is off (which is the default behavior), the compiler omits such warnings 3118if any differences found are confined to types that share the same size 3119and alignment. 3120 3121@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 3122@opindex Wundeclared-selector 3123@opindex Wno-undeclared-selector 3124Warn if a @code{@@selector(@dots{})} expression referring to an 3125undeclared selector is found. A selector is considered undeclared if no 3126method with that name has been declared before the 3127@code{@@selector(@dots{})} expression, either explicitly in an 3128@code{@@interface} or @code{@@protocol} declaration, or implicitly in 3129an @code{@@implementation} section. This option always performs its 3130checks as soon as a @code{@@selector(@dots{})} expression is found, 3131while @option{-Wselector} only performs its checks in the final stage of 3132compilation. This also enforces the coding style convention 3133that methods and selectors must be declared before being used. 3134 3135@item -print-objc-runtime-info 3136@opindex print-objc-runtime-info 3137Generate C header describing the largest structure that is passed by 3138value, if any. 3139 3140@end table 3141 3142@node Language Independent Options 3143@section Options to Control Diagnostic Messages Formatting 3144@cindex options to control diagnostics formatting 3145@cindex diagnostic messages 3146@cindex message formatting 3147 3148Traditionally, diagnostic messages have been formatted irrespective of 3149the output device's aspect (e.g.@: its width, @dots{}). You can use the 3150options described below 3151to control the formatting algorithm for diagnostic messages, 3152e.g.@: how many characters per line, how often source location 3153information should be reported. Note that some language front ends may not 3154honor these options. 3155 3156@table @gcctabopt 3157@item -fmessage-length=@var{n} 3158@opindex fmessage-length 3159Try to format error messages so that they fit on lines of about 3160@var{n} characters. If @var{n} is zero, then no line-wrapping is 3161done; each error message appears on a single line. This is the 3162default for all front ends. 3163 3164@item -fdiagnostics-show-location=once 3165@opindex fdiagnostics-show-location 3166Only meaningful in line-wrapping mode. Instructs the diagnostic messages 3167reporter to emit source location information @emph{once}; that is, in 3168case the message is too long to fit on a single physical line and has to 3169be wrapped, the source location won't be emitted (as prefix) again, 3170over and over, in subsequent continuation lines. This is the default 3171behavior. 3172 3173@item -fdiagnostics-show-location=every-line 3174Only meaningful in line-wrapping mode. Instructs the diagnostic 3175messages reporter to emit the same source location information (as 3176prefix) for physical lines that result from the process of breaking 3177a message which is too long to fit on a single line. 3178 3179@item -fdiagnostics-color[=@var{WHEN}] 3180@itemx -fno-diagnostics-color 3181@opindex fdiagnostics-color 3182@cindex highlight, color, colour 3183@vindex GCC_COLORS @r{environment variable} 3184Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, 3185or @samp{auto}. The default depends on how the compiler has been configured, 3186it can be any of the above @var{WHEN} options or also @samp{never} 3187if @env{GCC_COLORS} environment variable isn't present in the environment, 3188and @samp{auto} otherwise. 3189@samp{auto} means to use color only when the standard error is a terminal. 3190The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are 3191aliases for @option{-fdiagnostics-color=always} and 3192@option{-fdiagnostics-color=never}, respectively. 3193 3194The colors are defined by the environment variable @env{GCC_COLORS}. 3195Its value is a colon-separated list of capabilities and Select Graphic 3196Rendition (SGR) substrings. SGR commands are interpreted by the 3197terminal or terminal emulator. (See the section in the documentation 3198of your text terminal for permitted values and their meanings as 3199character attributes.) These substring values are integers in decimal 3200representation and can be concatenated with semicolons. 3201Common values to concatenate include 3202@samp{1} for bold, 3203@samp{4} for underline, 3204@samp{5} for blink, 3205@samp{7} for inverse, 3206@samp{39} for default foreground color, 3207@samp{30} to @samp{37} for foreground colors, 3208@samp{90} to @samp{97} for 16-color mode foreground colors, 3209@samp{38;5;0} to @samp{38;5;255} 3210for 88-color and 256-color modes foreground colors, 3211@samp{49} for default background color, 3212@samp{40} to @samp{47} for background colors, 3213@samp{100} to @samp{107} for 16-color mode background colors, 3214and @samp{48;5;0} to @samp{48;5;255} 3215for 88-color and 256-color modes background colors. 3216 3217The default @env{GCC_COLORS} is 3218@smallexample 3219error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01 3220@end smallexample 3221@noindent 3222where @samp{01;31} is bold red, @samp{01;35} is bold magenta, 3223@samp{01;36} is bold cyan, @samp{01;32} is bold green and 3224@samp{01} is bold. Setting @env{GCC_COLORS} to the empty 3225string disables colors. 3226Supported capabilities are as follows. 3227 3228@table @code 3229@item error= 3230@vindex error GCC_COLORS @r{capability} 3231SGR substring for error: markers. 3232 3233@item warning= 3234@vindex warning GCC_COLORS @r{capability} 3235SGR substring for warning: markers. 3236 3237@item note= 3238@vindex note GCC_COLORS @r{capability} 3239SGR substring for note: markers. 3240 3241@item caret= 3242@vindex caret GCC_COLORS @r{capability} 3243SGR substring for caret line. 3244 3245@item locus= 3246@vindex locus GCC_COLORS @r{capability} 3247SGR substring for location information, @samp{file:line} or 3248@samp{file:line:column} etc. 3249 3250@item quote= 3251@vindex quote GCC_COLORS @r{capability} 3252SGR substring for information printed within quotes. 3253@end table 3254 3255@item -fno-diagnostics-show-option 3256@opindex fno-diagnostics-show-option 3257@opindex fdiagnostics-show-option 3258By default, each diagnostic emitted includes text indicating the 3259command-line option that directly controls the diagnostic (if such an 3260option is known to the diagnostic machinery). Specifying the 3261@option{-fno-diagnostics-show-option} flag suppresses that behavior. 3262 3263@item -fno-diagnostics-show-caret 3264@opindex fno-diagnostics-show-caret 3265@opindex fdiagnostics-show-caret 3266By default, each diagnostic emitted includes the original source line 3267and a caret '^' indicating the column. This option suppresses this 3268information. The source line is truncated to @var{n} characters, if 3269the @option{-fmessage-length=n} option is given. When the output is done 3270to the terminal, the width is limited to the width given by the 3271@env{COLUMNS} environment variable or, if not set, to the terminal width. 3272 3273@end table 3274 3275@node Warning Options 3276@section Options to Request or Suppress Warnings 3277@cindex options to control warnings 3278@cindex warning messages 3279@cindex messages, warning 3280@cindex suppressing warnings 3281 3282Warnings are diagnostic messages that report constructions that 3283are not inherently erroneous but that are risky or suggest there 3284may have been an error. 3285 3286The following language-independent options do not enable specific 3287warnings but control the kinds of diagnostics produced by GCC@. 3288 3289@table @gcctabopt 3290@cindex syntax checking 3291@item -fsyntax-only 3292@opindex fsyntax-only 3293Check the code for syntax errors, but don't do anything beyond that. 3294 3295@item -fmax-errors=@var{n} 3296@opindex fmax-errors 3297Limits the maximum number of error messages to @var{n}, at which point 3298GCC bails out rather than attempting to continue processing the source 3299code. If @var{n} is 0 (the default), there is no limit on the number 3300of error messages produced. If @option{-Wfatal-errors} is also 3301specified, then @option{-Wfatal-errors} takes precedence over this 3302option. 3303 3304@item -w 3305@opindex w 3306Inhibit all warning messages. 3307 3308@item -Werror 3309@opindex Werror 3310@opindex Wno-error 3311Make all warnings into errors. 3312 3313@item -Werror= 3314@opindex Werror= 3315@opindex Wno-error= 3316Make the specified warning into an error. The specifier for a warning 3317is appended; for example @option{-Werror=switch} turns the warnings 3318controlled by @option{-Wswitch} into errors. This switch takes a 3319negative form, to be used to negate @option{-Werror} for specific 3320warnings; for example @option{-Wno-error=switch} makes 3321@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3322is in effect. 3323 3324The warning message for each controllable warning includes the 3325option that controls the warning. That option can then be used with 3326@option{-Werror=} and @option{-Wno-error=} as described above. 3327(Printing of the option in the warning message can be disabled using the 3328@option{-fno-diagnostics-show-option} flag.) 3329 3330Note that specifying @option{-Werror=}@var{foo} automatically implies 3331@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3332imply anything. 3333 3334@item -Wfatal-errors 3335@opindex Wfatal-errors 3336@opindex Wno-fatal-errors 3337This option causes the compiler to abort compilation on the first error 3338occurred rather than trying to keep going and printing further error 3339messages. 3340 3341@end table 3342 3343You can request many specific warnings with options beginning with 3344@samp{-W}, for example @option{-Wimplicit} to request warnings on 3345implicit declarations. Each of these specific warning options also 3346has a negative form beginning @samp{-Wno-} to turn off warnings; for 3347example, @option{-Wno-implicit}. This manual lists only one of the 3348two forms, whichever is not the default. For further 3349language-specific options also refer to @ref{C++ Dialect Options} and 3350@ref{Objective-C and Objective-C++ Dialect Options}. 3351 3352Some options, such as @option{-Wall} and @option{-Wextra}, turn on other 3353options, such as @option{-Wunused}, which may turn on further options, 3354such as @option{-Wunused-value}. The combined effect of positive and 3355negative forms is that more specific options have priority over less 3356specific ones, independently of their position in the command-line. For 3357options of the same specificity, the last one takes effect. Options 3358enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect 3359as if they appeared at the end of the command-line. 3360 3361When an unrecognized warning option is requested (e.g., 3362@option{-Wunknown-warning}), GCC emits a diagnostic stating 3363that the option is not recognized. However, if the @option{-Wno-} form 3364is used, the behavior is slightly different: no diagnostic is 3365produced for @option{-Wno-unknown-warning} unless other diagnostics 3366are being produced. This allows the use of new @option{-Wno-} options 3367with old compilers, but if something goes wrong, the compiler 3368warns that an unrecognized option is present. 3369 3370@table @gcctabopt 3371@item -Wpedantic 3372@itemx -pedantic 3373@opindex pedantic 3374@opindex Wpedantic 3375Issue all the warnings demanded by strict ISO C and ISO C++; 3376reject all programs that use forbidden extensions, and some other 3377programs that do not follow ISO C and ISO C++. For ISO C, follows the 3378version of the ISO C standard specified by any @option{-std} option used. 3379 3380Valid ISO C and ISO C++ programs should compile properly with or without 3381this option (though a rare few require @option{-ansi} or a 3382@option{-std} option specifying the required version of ISO C)@. However, 3383without this option, certain GNU extensions and traditional C and C++ 3384features are supported as well. With this option, they are rejected. 3385 3386@option{-Wpedantic} does not cause warning messages for use of the 3387alternate keywords whose names begin and end with @samp{__}. Pedantic 3388warnings are also disabled in the expression that follows 3389@code{__extension__}. However, only system header files should use 3390these escape routes; application programs should avoid them. 3391@xref{Alternate Keywords}. 3392 3393Some users try to use @option{-Wpedantic} to check programs for strict ISO 3394C conformance. They soon find that it does not do quite what they want: 3395it finds some non-ISO practices, but not all---only those for which 3396ISO C @emph{requires} a diagnostic, and some others for which 3397diagnostics have been added. 3398 3399A feature to report any failure to conform to ISO C might be useful in 3400some instances, but would require considerable additional work and would 3401be quite different from @option{-Wpedantic}. We don't have plans to 3402support such a feature in the near future. 3403 3404Where the standard specified with @option{-std} represents a GNU 3405extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 3406corresponding @dfn{base standard}, the version of ISO C on which the GNU 3407extended dialect is based. Warnings from @option{-Wpedantic} are given 3408where they are required by the base standard. (It does not make sense 3409for such warnings to be given only for features not in the specified GNU 3410C dialect, since by definition the GNU dialects of C include all 3411features the compiler supports with the given option, and there would be 3412nothing to warn about.) 3413 3414@item -pedantic-errors 3415@opindex pedantic-errors 3416Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 3417requires a diagnostic, in some cases where there is undefined behavior 3418at compile-time and in some other cases that do not prevent compilation 3419of programs that are valid according to the standard. This is not 3420equivalent to @option{-Werror=pedantic}, since there are errors enabled 3421by this option and not enabled by the latter and vice versa. 3422 3423@item -Wall 3424@opindex Wall 3425@opindex Wno-all 3426This enables all the warnings about constructions that some users 3427consider questionable, and that are easy to avoid (or modify to 3428prevent the warning), even in conjunction with macros. This also 3429enables some language-specific warnings described in @ref{C++ Dialect 3430Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 3431 3432@option{-Wall} turns on the following warning flags: 3433 3434@gccoptlist{-Waddress @gol 3435-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 3436-Wc++11-compat -Wc++14-compat@gol 3437-Wchar-subscripts @gol 3438-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 3439-Wimplicit-int @r{(C and Objective-C only)} @gol 3440-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 3441-Wcomment @gol 3442-Wformat @gol 3443-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 3444-Wmaybe-uninitialized @gol 3445-Wmissing-braces @r{(only for C/ObjC)} @gol 3446-Wnonnull @gol 3447-Wopenmp-simd @gol 3448-Wparentheses @gol 3449-Wpointer-sign @gol 3450-Wreorder @gol 3451-Wreturn-type @gol 3452-Wsequence-point @gol 3453-Wsign-compare @r{(only in C++)} @gol 3454-Wstrict-aliasing @gol 3455-Wstrict-overflow=1 @gol 3456-Wswitch @gol 3457-Wtrigraphs @gol 3458-Wuninitialized @gol 3459-Wunknown-pragmas @gol 3460-Wunused-function @gol 3461-Wunused-label @gol 3462-Wunused-value @gol 3463-Wunused-variable @gol 3464-Wvolatile-register-var @gol 3465} 3466 3467Note that some warning flags are not implied by @option{-Wall}. Some of 3468them warn about constructions that users generally do not consider 3469questionable, but which occasionally you might wish to check for; 3470others warn about constructions that are necessary or hard to avoid in 3471some cases, and there is no simple way to modify the code to suppress 3472the warning. Some of them are enabled by @option{-Wextra} but many of 3473them must be enabled individually. 3474 3475@item -Wextra 3476@opindex W 3477@opindex Wextra 3478@opindex Wno-extra 3479This enables some extra warning flags that are not enabled by 3480@option{-Wall}. (This option used to be called @option{-W}. The older 3481name is still supported, but the newer name is more descriptive.) 3482 3483@gccoptlist{-Wclobbered @gol 3484-Wempty-body @gol 3485-Wignored-qualifiers @gol 3486-Wmissing-field-initializers @gol 3487-Wmissing-parameter-type @r{(C only)} @gol 3488-Wold-style-declaration @r{(C only)} @gol 3489-Woverride-init @gol 3490-Wsign-compare @gol 3491-Wtype-limits @gol 3492-Wuninitialized @gol 3493-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 3494-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 3495} 3496 3497The option @option{-Wextra} also prints warning messages for the 3498following cases: 3499 3500@itemize @bullet 3501 3502@item 3503A pointer is compared against integer zero with @code{<}, @code{<=}, 3504@code{>}, or @code{>=}. 3505 3506@item 3507(C++ only) An enumerator and a non-enumerator both appear in a 3508conditional expression. 3509 3510@item 3511(C++ only) Ambiguous virtual bases. 3512 3513@item 3514(C++ only) Subscripting an array that has been declared @code{register}. 3515 3516@item 3517(C++ only) Taking the address of a variable that has been declared 3518@code{register}. 3519 3520@item 3521(C++ only) A base class is not initialized in a derived class's copy 3522constructor. 3523 3524@end itemize 3525 3526@item -Wchar-subscripts 3527@opindex Wchar-subscripts 3528@opindex Wno-char-subscripts 3529Warn if an array subscript has type @code{char}. This is a common cause 3530of error, as programmers often forget that this type is signed on some 3531machines. 3532This warning is enabled by @option{-Wall}. 3533 3534@item -Wcomment 3535@opindex Wcomment 3536@opindex Wno-comment 3537Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 3538comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 3539This warning is enabled by @option{-Wall}. 3540 3541@item -Wno-coverage-mismatch 3542@opindex Wno-coverage-mismatch 3543Warn if feedback profiles do not match when using the 3544@option{-fprofile-use} option. 3545If a source file is changed between compiling with @option{-fprofile-gen} and 3546with @option{-fprofile-use}, the files with the profile feedback can fail 3547to match the source file and GCC cannot use the profile feedback 3548information. By default, this warning is enabled and is treated as an 3549error. @option{-Wno-coverage-mismatch} can be used to disable the 3550warning or @option{-Wno-error=coverage-mismatch} can be used to 3551disable the error. Disabling the error for this warning can result in 3552poorly optimized code and is useful only in the 3553case of very minor changes such as bug fixes to an existing code-base. 3554Completely disabling the warning is not recommended. 3555 3556@item -Wno-cpp 3557@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 3558 3559Suppress warning messages emitted by @code{#warning} directives. 3560 3561@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 3562@opindex Wdouble-promotion 3563@opindex Wno-double-promotion 3564Give a warning when a value of type @code{float} is implicitly 3565promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 3566floating-point unit implement @code{float} in hardware, but emulate 3567@code{double} in software. On such a machine, doing computations 3568using @code{double} values is much more expensive because of the 3569overhead required for software emulation. 3570 3571It is easy to accidentally do computations with @code{double} because 3572floating-point literals are implicitly of type @code{double}. For 3573example, in: 3574@smallexample 3575@group 3576float area(float radius) 3577@{ 3578 return 3.14159 * radius * radius; 3579@} 3580@end group 3581@end smallexample 3582the compiler performs the entire computation with @code{double} 3583because the floating-point literal is a @code{double}. 3584 3585@item -Wformat 3586@itemx -Wformat=@var{n} 3587@opindex Wformat 3588@opindex Wno-format 3589@opindex ffreestanding 3590@opindex fno-builtin 3591@opindex Wformat= 3592Check calls to @code{printf} and @code{scanf}, etc., to make sure that 3593the arguments supplied have types appropriate to the format string 3594specified, and that the conversions specified in the format string make 3595sense. This includes standard functions, and others specified by format 3596attributes (@pxref{Function Attributes}), in the @code{printf}, 3597@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 3598not in the C standard) families (or other target-specific families). 3599Which functions are checked without format attributes having been 3600specified depends on the standard version selected, and such checks of 3601functions without the attribute specified are disabled by 3602@option{-ffreestanding} or @option{-fno-builtin}. 3603 3604The formats are checked against the format features supported by GNU 3605libc version 2.2. These include all ISO C90 and C99 features, as well 3606as features from the Single Unix Specification and some BSD and GNU 3607extensions. Other library implementations may not support all these 3608features; GCC does not support warning about features that go beyond a 3609particular library's limitations. However, if @option{-Wpedantic} is used 3610with @option{-Wformat}, warnings are given about format features not 3611in the selected standard version (but not for @code{strfmon} formats, 3612since those are not in any version of the C standard). @xref{C Dialect 3613Options,,Options Controlling C Dialect}. 3614 3615@table @gcctabopt 3616@item -Wformat=1 3617@itemx -Wformat 3618@opindex Wformat 3619@opindex Wformat=1 3620Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 3621@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 3622@option{-Wformat} also checks for null format arguments for several 3623functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 3624aspects of this level of format checking can be disabled by the 3625options: @option{-Wno-format-contains-nul}, 3626@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 3627@option{-Wformat} is enabled by @option{-Wall}. 3628 3629@item -Wno-format-contains-nul 3630@opindex Wno-format-contains-nul 3631@opindex Wformat-contains-nul 3632If @option{-Wformat} is specified, do not warn about format strings that 3633contain NUL bytes. 3634 3635@item -Wno-format-extra-args 3636@opindex Wno-format-extra-args 3637@opindex Wformat-extra-args 3638If @option{-Wformat} is specified, do not warn about excess arguments to a 3639@code{printf} or @code{scanf} format function. The C standard specifies 3640that such arguments are ignored. 3641 3642Where the unused arguments lie between used arguments that are 3643specified with @samp{$} operand number specifications, normally 3644warnings are still given, since the implementation could not know what 3645type to pass to @code{va_arg} to skip the unused arguments. However, 3646in the case of @code{scanf} formats, this option suppresses the 3647warning if the unused arguments are all pointers, since the Single 3648Unix Specification says that such unused arguments are allowed. 3649 3650@item -Wno-format-zero-length 3651@opindex Wno-format-zero-length 3652@opindex Wformat-zero-length 3653If @option{-Wformat} is specified, do not warn about zero-length formats. 3654The C standard specifies that zero-length formats are allowed. 3655 3656 3657@item -Wformat=2 3658@opindex Wformat=2 3659Enable @option{-Wformat} plus additional format checks. Currently 3660equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 3661-Wformat-y2k}. 3662 3663@item -Wformat-nonliteral 3664@opindex Wformat-nonliteral 3665@opindex Wno-format-nonliteral 3666If @option{-Wformat} is specified, also warn if the format string is not a 3667string literal and so cannot be checked, unless the format function 3668takes its format arguments as a @code{va_list}. 3669 3670@item -Wformat-security 3671@opindex Wformat-security 3672@opindex Wno-format-security 3673If @option{-Wformat} is specified, also warn about uses of format 3674functions that represent possible security problems. At present, this 3675warns about calls to @code{printf} and @code{scanf} functions where the 3676format string is not a string literal and there are no format arguments, 3677as in @code{printf (foo);}. This may be a security hole if the format 3678string came from untrusted input and contains @samp{%n}. (This is 3679currently a subset of what @option{-Wformat-nonliteral} warns about, but 3680in future warnings may be added to @option{-Wformat-security} that are not 3681included in @option{-Wformat-nonliteral}.) 3682 3683@item -Wformat-signedness 3684@opindex Wformat-signedness 3685@opindex Wno-format-signedness 3686If @option{-Wformat} is specified, also warn if the format string 3687requires an unsigned argument and the argument is signed and vice versa. 3688 3689@item -Wformat-y2k 3690@opindex Wformat-y2k 3691@opindex Wno-format-y2k 3692If @option{-Wformat} is specified, also warn about @code{strftime} 3693formats that may yield only a two-digit year. 3694@end table 3695 3696@item -Wnonnull 3697@opindex Wnonnull 3698@opindex Wno-nonnull 3699Warn about passing a null pointer for arguments marked as 3700requiring a non-null value by the @code{nonnull} function attribute. 3701 3702@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 3703can be disabled with the @option{-Wno-nonnull} option. 3704 3705@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 3706@opindex Winit-self 3707@opindex Wno-init-self 3708Warn about uninitialized variables that are initialized with themselves. 3709Note this option can only be used with the @option{-Wuninitialized} option. 3710 3711For example, GCC warns about @code{i} being uninitialized in the 3712following snippet only when @option{-Winit-self} has been specified: 3713@smallexample 3714@group 3715int f() 3716@{ 3717 int i = i; 3718 return i; 3719@} 3720@end group 3721@end smallexample 3722 3723This warning is enabled by @option{-Wall} in C++. 3724 3725@item -Wimplicit-int @r{(C and Objective-C only)} 3726@opindex Wimplicit-int 3727@opindex Wno-implicit-int 3728Warn when a declaration does not specify a type. 3729This warning is enabled by @option{-Wall}. 3730 3731@item -Wimplicit-function-declaration @r{(C and Objective-C only)} 3732@opindex Wimplicit-function-declaration 3733@opindex Wno-implicit-function-declaration 3734Give a warning whenever a function is used before being declared. In 3735C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is 3736enabled by default and it is made into an error by 3737@option{-pedantic-errors}. This warning is also enabled by 3738@option{-Wall}. 3739 3740@item -Wimplicit @r{(C and Objective-C only)} 3741@opindex Wimplicit 3742@opindex Wno-implicit 3743Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 3744This warning is enabled by @option{-Wall}. 3745 3746@item -Wignored-qualifiers @r{(C and C++ only)} 3747@opindex Wignored-qualifiers 3748@opindex Wno-ignored-qualifiers 3749Warn if the return type of a function has a type qualifier 3750such as @code{const}. For ISO C such a type qualifier has no effect, 3751since the value returned by a function is not an lvalue. 3752For C++, the warning is only emitted for scalar types or @code{void}. 3753ISO C prohibits qualified @code{void} return types on function 3754definitions, so such return types always receive a warning 3755even without this option. 3756 3757This warning is also enabled by @option{-Wextra}. 3758 3759@item -Wmain 3760@opindex Wmain 3761@opindex Wno-main 3762Warn if the type of @code{main} is suspicious. @code{main} should be 3763a function with external linkage, returning int, taking either zero 3764arguments, two, or three arguments of appropriate types. This warning 3765is enabled by default in C++ and is enabled by either @option{-Wall} 3766or @option{-Wpedantic}. 3767 3768@item -Wmissing-braces 3769@opindex Wmissing-braces 3770@opindex Wno-missing-braces 3771Warn if an aggregate or union initializer is not fully bracketed. In 3772the following example, the initializer for @code{a} is not fully 3773bracketed, but that for @code{b} is fully bracketed. This warning is 3774enabled by @option{-Wall} in C. 3775 3776@smallexample 3777int a[2][2] = @{ 0, 1, 2, 3 @}; 3778int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 3779@end smallexample 3780 3781This warning is enabled by @option{-Wall}. 3782 3783@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 3784@opindex Wmissing-include-dirs 3785@opindex Wno-missing-include-dirs 3786Warn if a user-supplied include directory does not exist. 3787 3788@item -Wparentheses 3789@opindex Wparentheses 3790@opindex Wno-parentheses 3791Warn if parentheses are omitted in certain contexts, such 3792as when there is an assignment in a context where a truth value 3793is expected, or when operators are nested whose precedence people 3794often get confused about. 3795 3796Also warn if a comparison like @code{x<=y<=z} appears; this is 3797equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 3798interpretation from that of ordinary mathematical notation. 3799 3800Also warn about constructions where there may be confusion to which 3801@code{if} statement an @code{else} branch belongs. Here is an example of 3802such a case: 3803 3804@smallexample 3805@group 3806@{ 3807 if (a) 3808 if (b) 3809 foo (); 3810 else 3811 bar (); 3812@} 3813@end group 3814@end smallexample 3815 3816In C/C++, every @code{else} branch belongs to the innermost possible 3817@code{if} statement, which in this example is @code{if (b)}. This is 3818often not what the programmer expected, as illustrated in the above 3819example by indentation the programmer chose. When there is the 3820potential for this confusion, GCC issues a warning when this flag 3821is specified. To eliminate the warning, add explicit braces around 3822the innermost @code{if} statement so there is no way the @code{else} 3823can belong to the enclosing @code{if}. The resulting code 3824looks like this: 3825 3826@smallexample 3827@group 3828@{ 3829 if (a) 3830 @{ 3831 if (b) 3832 foo (); 3833 else 3834 bar (); 3835 @} 3836@} 3837@end group 3838@end smallexample 3839 3840Also warn for dangerous uses of the GNU extension to 3841@code{?:} with omitted middle operand. When the condition 3842in the @code{?}: operator is a boolean expression, the omitted value is 3843always 1. Often programmers expect it to be a value computed 3844inside the conditional expression instead. 3845 3846This warning is enabled by @option{-Wall}. 3847 3848@item -Wsequence-point 3849@opindex Wsequence-point 3850@opindex Wno-sequence-point 3851Warn about code that may have undefined semantics because of violations 3852of sequence point rules in the C and C++ standards. 3853 3854The C and C++ standards define the order in which expressions in a C/C++ 3855program are evaluated in terms of @dfn{sequence points}, which represent 3856a partial ordering between the execution of parts of the program: those 3857executed before the sequence point, and those executed after it. These 3858occur after the evaluation of a full expression (one which is not part 3859of a larger expression), after the evaluation of the first operand of a 3860@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 3861function is called (but after the evaluation of its arguments and the 3862expression denoting the called function), and in certain other places. 3863Other than as expressed by the sequence point rules, the order of 3864evaluation of subexpressions of an expression is not specified. All 3865these rules describe only a partial order rather than a total order, 3866since, for example, if two functions are called within one expression 3867with no sequence point between them, the order in which the functions 3868are called is not specified. However, the standards committee have 3869ruled that function calls do not overlap. 3870 3871It is not specified when between sequence points modifications to the 3872values of objects take effect. Programs whose behavior depends on this 3873have undefined behavior; the C and C++ standards specify that ``Between 3874the previous and next sequence point an object shall have its stored 3875value modified at most once by the evaluation of an expression. 3876Furthermore, the prior value shall be read only to determine the value 3877to be stored.''. If a program breaks these rules, the results on any 3878particular implementation are entirely unpredictable. 3879 3880Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 3881= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 3882diagnosed by this option, and it may give an occasional false positive 3883result, but in general it has been found fairly effective at detecting 3884this sort of problem in programs. 3885 3886The standard is worded confusingly, therefore there is some debate 3887over the precise meaning of the sequence point rules in subtle cases. 3888Links to discussions of the problem, including proposed formal 3889definitions, may be found on the GCC readings page, at 3890@uref{http://gcc.gnu.org/@/readings.html}. 3891 3892This warning is enabled by @option{-Wall} for C and C++. 3893 3894@item -Wno-return-local-addr 3895@opindex Wno-return-local-addr 3896@opindex Wreturn-local-addr 3897Do not warn about returning a pointer (or in C++, a reference) to a 3898variable that goes out of scope after the function returns. 3899 3900@item -Wreturn-type 3901@opindex Wreturn-type 3902@opindex Wno-return-type 3903Warn whenever a function is defined with a return type that defaults 3904to @code{int}. Also warn about any @code{return} statement with no 3905return value in a function whose return type is not @code{void} 3906(falling off the end of the function body is considered returning 3907without a value), and about a @code{return} statement with an 3908expression in a function whose return type is @code{void}. 3909 3910For C++, a function without return type always produces a diagnostic 3911message, even when @option{-Wno-return-type} is specified. The only 3912exceptions are @code{main} and functions defined in system headers. 3913 3914This warning is enabled by @option{-Wall}. 3915 3916@item -Wshift-count-negative 3917@opindex Wshift-count-negative 3918@opindex Wno-shift-count-negative 3919Warn if shift count is negative. This warning is enabled by default. 3920 3921@item -Wshift-count-overflow 3922@opindex Wshift-count-overflow 3923@opindex Wno-shift-count-overflow 3924Warn if shift count >= width of type. This warning is enabled by default. 3925 3926@item -Wswitch 3927@opindex Wswitch 3928@opindex Wno-switch 3929Warn whenever a @code{switch} statement has an index of enumerated type 3930and lacks a @code{case} for one or more of the named codes of that 3931enumeration. (The presence of a @code{default} label prevents this 3932warning.) @code{case} labels outside the enumeration range also 3933provoke warnings when this option is used (even if there is a 3934@code{default} label). 3935This warning is enabled by @option{-Wall}. 3936 3937@item -Wswitch-default 3938@opindex Wswitch-default 3939@opindex Wno-switch-default 3940Warn whenever a @code{switch} statement does not have a @code{default} 3941case. 3942 3943@item -Wswitch-enum 3944@opindex Wswitch-enum 3945@opindex Wno-switch-enum 3946Warn whenever a @code{switch} statement has an index of enumerated type 3947and lacks a @code{case} for one or more of the named codes of that 3948enumeration. @code{case} labels outside the enumeration range also 3949provoke warnings when this option is used. The only difference 3950between @option{-Wswitch} and this option is that this option gives a 3951warning about an omitted enumeration code even if there is a 3952@code{default} label. 3953 3954@item -Wswitch-bool 3955@opindex Wswitch-bool 3956@opindex Wno-switch-bool 3957Warn whenever a @code{switch} statement has an index of boolean type. 3958It is possible to suppress this warning by casting the controlling 3959expression to a type other than @code{bool}. For example: 3960@smallexample 3961@group 3962switch ((int) (a == 4)) 3963 @{ 3964 @dots{} 3965 @} 3966@end group 3967@end smallexample 3968This warning is enabled by default for C and C++ programs. 3969 3970@item -Wsync-nand @r{(C and C++ only)} 3971@opindex Wsync-nand 3972@opindex Wno-sync-nand 3973Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 3974built-in functions are used. These functions changed semantics in GCC 4.4. 3975 3976@item -Wtrigraphs 3977@opindex Wtrigraphs 3978@opindex Wno-trigraphs 3979Warn if any trigraphs are encountered that might change the meaning of 3980the program (trigraphs within comments are not warned about). 3981This warning is enabled by @option{-Wall}. 3982 3983@item -Wunused-but-set-parameter 3984@opindex Wunused-but-set-parameter 3985@opindex Wno-unused-but-set-parameter 3986Warn whenever a function parameter is assigned to, but otherwise unused 3987(aside from its declaration). 3988 3989To suppress this warning use the @code{unused} attribute 3990(@pxref{Variable Attributes}). 3991 3992This warning is also enabled by @option{-Wunused} together with 3993@option{-Wextra}. 3994 3995@item -Wunused-but-set-variable 3996@opindex Wunused-but-set-variable 3997@opindex Wno-unused-but-set-variable 3998Warn whenever a local variable is assigned to, but otherwise unused 3999(aside from its declaration). 4000This warning is enabled by @option{-Wall}. 4001 4002To suppress this warning use the @code{unused} attribute 4003(@pxref{Variable Attributes}). 4004 4005This warning is also enabled by @option{-Wunused}, which is enabled 4006by @option{-Wall}. 4007 4008@item -Wunused-function 4009@opindex Wunused-function 4010@opindex Wno-unused-function 4011Warn whenever a static function is declared but not defined or a 4012non-inline static function is unused. 4013This warning is enabled by @option{-Wall}. 4014 4015@item -Wunused-label 4016@opindex Wunused-label 4017@opindex Wno-unused-label 4018Warn whenever a label is declared but not used. 4019This warning is enabled by @option{-Wall}. 4020 4021To suppress this warning use the @code{unused} attribute 4022(@pxref{Variable Attributes}). 4023 4024@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 4025@opindex Wunused-local-typedefs 4026Warn when a typedef locally defined in a function is not used. 4027This warning is enabled by @option{-Wall}. 4028 4029@item -Wunused-parameter 4030@opindex Wunused-parameter 4031@opindex Wno-unused-parameter 4032Warn whenever a function parameter is unused aside from its declaration. 4033 4034To suppress this warning use the @code{unused} attribute 4035(@pxref{Variable Attributes}). 4036 4037@item -Wno-unused-result 4038@opindex Wunused-result 4039@opindex Wno-unused-result 4040Do not warn if a caller of a function marked with attribute 4041@code{warn_unused_result} (@pxref{Function Attributes}) does not use 4042its return value. The default is @option{-Wunused-result}. 4043 4044@item -Wunused-variable 4045@opindex Wunused-variable 4046@opindex Wno-unused-variable 4047Warn whenever a local variable or non-constant static variable is unused 4048aside from its declaration. 4049This warning is enabled by @option{-Wall}. 4050 4051To suppress this warning use the @code{unused} attribute 4052(@pxref{Variable Attributes}). 4053 4054@item -Wunused-value 4055@opindex Wunused-value 4056@opindex Wno-unused-value 4057Warn whenever a statement computes a result that is explicitly not 4058used. To suppress this warning cast the unused expression to 4059@code{void}. This includes an expression-statement or the left-hand 4060side of a comma expression that contains no side effects. For example, 4061an expression such as @code{x[i,j]} causes a warning, while 4062@code{x[(void)i,j]} does not. 4063 4064This warning is enabled by @option{-Wall}. 4065 4066@item -Wunused 4067@opindex Wunused 4068@opindex Wno-unused 4069All the above @option{-Wunused} options combined. 4070 4071In order to get a warning about an unused function parameter, you must 4072either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 4073@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 4074 4075@item -Wuninitialized 4076@opindex Wuninitialized 4077@opindex Wno-uninitialized 4078Warn if an automatic variable is used without first being initialized 4079or if a variable may be clobbered by a @code{setjmp} call. In C++, 4080warn if a non-static reference or non-static @code{const} member 4081appears in a class without constructors. 4082 4083If you want to warn about code that uses the uninitialized value of the 4084variable in its own initializer, use the @option{-Winit-self} option. 4085 4086These warnings occur for individual uninitialized or clobbered 4087elements of structure, union or array variables as well as for 4088variables that are uninitialized or clobbered as a whole. They do 4089not occur for variables or elements declared @code{volatile}. Because 4090these warnings depend on optimization, the exact variables or elements 4091for which there are warnings depends on the precise optimization 4092options and version of GCC used. 4093 4094Note that there may be no warning about a variable that is used only 4095to compute a value that itself is never used, because such 4096computations may be deleted by data flow analysis before the warnings 4097are printed. 4098 4099@item -Wmaybe-uninitialized 4100@opindex Wmaybe-uninitialized 4101@opindex Wno-maybe-uninitialized 4102For an automatic variable, if there exists a path from the function 4103entry to a use of the variable that is initialized, but there exist 4104some other paths for which the variable is not initialized, the compiler 4105emits a warning if it cannot prove the uninitialized paths are not 4106executed at run time. These warnings are made optional because GCC is 4107not smart enough to see all the reasons why the code might be correct 4108in spite of appearing to have an error. Here is one example of how 4109this can happen: 4110 4111@smallexample 4112@group 4113@{ 4114 int x; 4115 switch (y) 4116 @{ 4117 case 1: x = 1; 4118 break; 4119 case 2: x = 4; 4120 break; 4121 case 3: x = 5; 4122 @} 4123 foo (x); 4124@} 4125@end group 4126@end smallexample 4127 4128@noindent 4129If the value of @code{y} is always 1, 2 or 3, then @code{x} is 4130always initialized, but GCC doesn't know this. To suppress the 4131warning, you need to provide a default case with assert(0) or 4132similar code. 4133 4134@cindex @code{longjmp} warnings 4135This option also warns when a non-volatile automatic variable might be 4136changed by a call to @code{longjmp}. These warnings as well are possible 4137only in optimizing compilation. 4138 4139The compiler sees only the calls to @code{setjmp}. It cannot know 4140where @code{longjmp} will be called; in fact, a signal handler could 4141call it at any point in the code. As a result, you may get a warning 4142even when there is in fact no problem because @code{longjmp} cannot 4143in fact be called at the place that would cause a problem. 4144 4145Some spurious warnings can be avoided if you declare all the functions 4146you use that never return as @code{noreturn}. @xref{Function 4147Attributes}. 4148 4149This warning is enabled by @option{-Wall} or @option{-Wextra}. 4150 4151@item -Wunknown-pragmas 4152@opindex Wunknown-pragmas 4153@opindex Wno-unknown-pragmas 4154@cindex warning for unknown pragmas 4155@cindex unknown pragmas, warning 4156@cindex pragmas, warning of unknown 4157Warn when a @code{#pragma} directive is encountered that is not understood by 4158GCC@. If this command-line option is used, warnings are even issued 4159for unknown pragmas in system header files. This is not the case if 4160the warnings are only enabled by the @option{-Wall} command-line option. 4161 4162@item -Wno-pragmas 4163@opindex Wno-pragmas 4164@opindex Wpragmas 4165Do not warn about misuses of pragmas, such as incorrect parameters, 4166invalid syntax, or conflicts between pragmas. See also 4167@option{-Wunknown-pragmas}. 4168 4169@item -Wstrict-aliasing 4170@opindex Wstrict-aliasing 4171@opindex Wno-strict-aliasing 4172This option is only active when @option{-fstrict-aliasing} is active. 4173It warns about code that might break the strict aliasing rules that the 4174compiler is using for optimization. The warning does not catch all 4175cases, but does attempt to catch the more common pitfalls. It is 4176included in @option{-Wall}. 4177It is equivalent to @option{-Wstrict-aliasing=3} 4178 4179@item -Wstrict-aliasing=n 4180@opindex Wstrict-aliasing=n 4181This option is only active when @option{-fstrict-aliasing} is active. 4182It warns about code that might break the strict aliasing rules that the 4183compiler is using for optimization. 4184Higher levels correspond to higher accuracy (fewer false positives). 4185Higher levels also correspond to more effort, similar to the way @option{-O} 4186works. 4187@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 4188 4189Level 1: Most aggressive, quick, least accurate. 4190Possibly useful when higher levels 4191do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 4192false negatives. However, it has many false positives. 4193Warns for all pointer conversions between possibly incompatible types, 4194even if never dereferenced. Runs in the front end only. 4195 4196Level 2: Aggressive, quick, not too precise. 4197May still have many false positives (not as many as level 1 though), 4198and few false negatives (but possibly more than level 1). 4199Unlike level 1, it only warns when an address is taken. Warns about 4200incomplete types. Runs in the front end only. 4201 4202Level 3 (default for @option{-Wstrict-aliasing}): 4203Should have very few false positives and few false 4204negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 4205Takes care of the common pun+dereference pattern in the front end: 4206@code{*(int*)&some_float}. 4207If optimization is enabled, it also runs in the back end, where it deals 4208with multiple statement cases using flow-sensitive points-to information. 4209Only warns when the converted pointer is dereferenced. 4210Does not warn about incomplete types. 4211 4212@item -Wstrict-overflow 4213@itemx -Wstrict-overflow=@var{n} 4214@opindex Wstrict-overflow 4215@opindex Wno-strict-overflow 4216This option is only active when @option{-fstrict-overflow} is active. 4217It warns about cases where the compiler optimizes based on the 4218assumption that signed overflow does not occur. Note that it does not 4219warn about all cases where the code might overflow: it only warns 4220about cases where the compiler implements some optimization. Thus 4221this warning depends on the optimization level. 4222 4223An optimization that assumes that signed overflow does not occur is 4224perfectly safe if the values of the variables involved are such that 4225overflow never does, in fact, occur. Therefore this warning can 4226easily give a false positive: a warning about code that is not 4227actually a problem. To help focus on important issues, several 4228warning levels are defined. No warnings are issued for the use of 4229undefined signed overflow when estimating how many iterations a loop 4230requires, in particular when determining whether a loop will be 4231executed at all. 4232 4233@table @gcctabopt 4234@item -Wstrict-overflow=1 4235Warn about cases that are both questionable and easy to avoid. For 4236example, with @option{-fstrict-overflow}, the compiler simplifies 4237@code{x + 1 > x} to @code{1}. This level of 4238@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 4239are not, and must be explicitly requested. 4240 4241@item -Wstrict-overflow=2 4242Also warn about other cases where a comparison is simplified to a 4243constant. For example: @code{abs (x) >= 0}. This can only be 4244simplified when @option{-fstrict-overflow} is in effect, because 4245@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 4246zero. @option{-Wstrict-overflow} (with no level) is the same as 4247@option{-Wstrict-overflow=2}. 4248 4249@item -Wstrict-overflow=3 4250Also warn about other cases where a comparison is simplified. For 4251example: @code{x + 1 > 1} is simplified to @code{x > 0}. 4252 4253@item -Wstrict-overflow=4 4254Also warn about other simplifications not covered by the above cases. 4255For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 4256 4257@item -Wstrict-overflow=5 4258Also warn about cases where the compiler reduces the magnitude of a 4259constant involved in a comparison. For example: @code{x + 2 > y} is 4260simplified to @code{x + 1 >= y}. This is reported only at the 4261highest warning level because this simplification applies to many 4262comparisons, so this warning level gives a very large number of 4263false positives. 4264@end table 4265 4266@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} 4267@opindex Wsuggest-attribute= 4268@opindex Wno-suggest-attribute= 4269Warn for cases where adding an attribute may be beneficial. The 4270attributes currently supported are listed below. 4271 4272@table @gcctabopt 4273@item -Wsuggest-attribute=pure 4274@itemx -Wsuggest-attribute=const 4275@itemx -Wsuggest-attribute=noreturn 4276@opindex Wsuggest-attribute=pure 4277@opindex Wno-suggest-attribute=pure 4278@opindex Wsuggest-attribute=const 4279@opindex Wno-suggest-attribute=const 4280@opindex Wsuggest-attribute=noreturn 4281@opindex Wno-suggest-attribute=noreturn 4282 4283Warn about functions that might be candidates for attributes 4284@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for 4285functions visible in other compilation units or (in the case of @code{pure} and 4286@code{const}) if it cannot prove that the function returns normally. A function 4287returns normally if it doesn't contain an infinite loop or return abnormally 4288by throwing, calling @code{abort} or trapping. This analysis requires option 4289@option{-fipa-pure-const}, which is enabled by default at @option{-O} and 4290higher. Higher optimization levels improve the accuracy of the analysis. 4291 4292@item -Wsuggest-attribute=format 4293@itemx -Wmissing-format-attribute 4294@opindex Wsuggest-attribute=format 4295@opindex Wmissing-format-attribute 4296@opindex Wno-suggest-attribute=format 4297@opindex Wno-missing-format-attribute 4298@opindex Wformat 4299@opindex Wno-format 4300 4301Warn about function pointers that might be candidates for @code{format} 4302attributes. Note these are only possible candidates, not absolute ones. 4303GCC guesses that function pointers with @code{format} attributes that 4304are used in assignment, initialization, parameter passing or return 4305statements should have a corresponding @code{format} attribute in the 4306resulting type. I.e.@: the left-hand side of the assignment or 4307initialization, the type of the parameter variable, or the return type 4308of the containing function respectively should also have a @code{format} 4309attribute to avoid the warning. 4310 4311GCC also warns about function definitions that might be 4312candidates for @code{format} attributes. Again, these are only 4313possible candidates. GCC guesses that @code{format} attributes 4314might be appropriate for any function that calls a function like 4315@code{vprintf} or @code{vscanf}, but this might not always be the 4316case, and some functions for which @code{format} attributes are 4317appropriate may not be detected. 4318@end table 4319 4320@item -Wsuggest-final-types 4321@opindex Wno-suggest-final-types 4322@opindex Wsuggest-final-types 4323Warn about types with virtual methods where code quality would be improved 4324if the type were declared with the C++11 @code{final} specifier, 4325or, if possible, 4326declared in an anonymous namespace. This allows GCC to more aggressively 4327devirtualize the polymorphic calls. This warning is more effective with link 4328time optimization, where the information about the class hierarchy graph is 4329more complete. 4330 4331@item -Wsuggest-final-methods 4332@opindex Wno-suggest-final-methods 4333@opindex Wsuggest-final-methods 4334Warn about virtual methods where code quality would be improved if the method 4335were declared with the C++11 @code{final} specifier, 4336or, if possible, its type were 4337declared in an anonymous namespace or with the @code{final} specifier. 4338This warning is 4339more effective with link time optimization, where the information about the 4340class hierarchy graph is more complete. It is recommended to first consider 4341suggestions of @option{-Wsuggest-final-types} and then rebuild with new 4342annotations. 4343 4344@item -Wsuggest-override 4345Warn about overriding virtual functions that are not marked with the override 4346keyword. 4347 4348@item -Warray-bounds 4349@itemx -Warray-bounds=@var{n} 4350@opindex Wno-array-bounds 4351@opindex Warray-bounds 4352This option is only active when @option{-ftree-vrp} is active 4353(default for @option{-O2} and above). It warns about subscripts to arrays 4354that are always out of bounds. This warning is enabled by @option{-Wall}. 4355 4356@table @gcctabopt 4357@item -Warray-bounds=1 4358This is the warning level of @option{-Warray-bounds} and is enabled 4359by @option{-Wall}; higher levels are not, and must be explicitly requested. 4360 4361@item -Warray-bounds=2 4362This warning level also warns about out of bounds access for 4363arrays at the end of a struct and for arrays accessed through 4364pointers. This warning level may give a larger number of 4365false positives and is deactivated by default. 4366@end table 4367 4368 4369@item -Wbool-compare 4370@opindex Wno-bool-compare 4371@opindex Wbool-compare 4372Warn about boolean expression compared with an integer value different from 4373@code{true}/@code{false}. For instance, the following comparison is 4374always false: 4375@smallexample 4376int n = 5; 4377@dots{} 4378if ((n > 1) == 2) @{ @dots{} @} 4379@end smallexample 4380This warning is enabled by @option{-Wall}. 4381 4382@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 4383@opindex Wno-discarded-qualifiers 4384@opindex Wdiscarded-qualifiers 4385Do not warn if type qualifiers on pointers are being discarded. 4386Typically, the compiler warns if a @code{const char *} variable is 4387passed to a function that takes a @code{char *} parameter. This option 4388can be used to suppress such a warning. 4389 4390@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 4391@opindex Wno-discarded-array-qualifiers 4392@opindex Wdiscarded-array-qualifiers 4393Do not warn if type qualifiers on arrays which are pointer targets 4394are being discarded. Typically, the compiler warns if a 4395@code{const int (*)[]} variable is passed to a function that 4396takes a @code{int (*)[]} parameter. This option can be used to 4397suppress such a warning. 4398 4399@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 4400@opindex Wno-incompatible-pointer-types 4401@opindex Wincompatible-pointer-types 4402Do not warn when there is a conversion between pointers that have incompatible 4403types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 4404which warns for pointer argument passing or assignment with different 4405signedness. 4406 4407@item -Wno-int-conversion @r{(C and Objective-C only)} 4408@opindex Wno-int-conversion 4409@opindex Wint-conversion 4410Do not warn about incompatible integer to pointer and pointer to integer 4411conversions. This warning is about implicit conversions; for explicit 4412conversions the warnings @option{-Wno-int-to-pointer-cast} and 4413@option{-Wno-pointer-to-int-cast} may be used. 4414 4415@item -Wno-div-by-zero 4416@opindex Wno-div-by-zero 4417@opindex Wdiv-by-zero 4418Do not warn about compile-time integer division by zero. Floating-point 4419division by zero is not warned about, as it can be a legitimate way of 4420obtaining infinities and NaNs. 4421 4422@item -Wsystem-headers 4423@opindex Wsystem-headers 4424@opindex Wno-system-headers 4425@cindex warnings from system headers 4426@cindex system headers, warnings from 4427Print warning messages for constructs found in system header files. 4428Warnings from system headers are normally suppressed, on the assumption 4429that they usually do not indicate real problems and would only make the 4430compiler output harder to read. Using this command-line option tells 4431GCC to emit warnings from system headers as if they occurred in user 4432code. However, note that using @option{-Wall} in conjunction with this 4433option does @emph{not} warn about unknown pragmas in system 4434headers---for that, @option{-Wunknown-pragmas} must also be used. 4435 4436@item -Wtrampolines 4437@opindex Wtrampolines 4438@opindex Wno-trampolines 4439Warn about trampolines generated for pointers to nested functions. 4440A trampoline is a small piece of data or code that is created at run 4441time on the stack when the address of a nested function is taken, and is 4442used to call the nested function indirectly. For some targets, it is 4443made up of data only and thus requires no special treatment. But, for 4444most targets, it is made up of code and thus requires the stack to be 4445made executable in order for the program to work properly. 4446 4447@item -Wfloat-equal 4448@opindex Wfloat-equal 4449@opindex Wno-float-equal 4450Warn if floating-point values are used in equality comparisons. 4451 4452The idea behind this is that sometimes it is convenient (for the 4453programmer) to consider floating-point values as approximations to 4454infinitely precise real numbers. If you are doing this, then you need 4455to compute (by analyzing the code, or in some other way) the maximum or 4456likely maximum error that the computation introduces, and allow for it 4457when performing comparisons (and when producing output, but that's a 4458different problem). In particular, instead of testing for equality, you 4459should check to see whether the two values have ranges that overlap; and 4460this is done with the relational operators, so equality comparisons are 4461probably mistaken. 4462 4463@item -Wtraditional @r{(C and Objective-C only)} 4464@opindex Wtraditional 4465@opindex Wno-traditional 4466Warn about certain constructs that behave differently in traditional and 4467ISO C@. Also warn about ISO C constructs that have no traditional C 4468equivalent, and/or problematic constructs that should be avoided. 4469 4470@itemize @bullet 4471@item 4472Macro parameters that appear within string literals in the macro body. 4473In traditional C macro replacement takes place within string literals, 4474but in ISO C it does not. 4475 4476@item 4477In traditional C, some preprocessor directives did not exist. 4478Traditional preprocessors only considered a line to be a directive 4479if the @samp{#} appeared in column 1 on the line. Therefore 4480@option{-Wtraditional} warns about directives that traditional C 4481understands but ignores because the @samp{#} does not appear as the 4482first character on the line. It also suggests you hide directives like 4483@code{#pragma} not understood by traditional C by indenting them. Some 4484traditional implementations do not recognize @code{#elif}, so this option 4485suggests avoiding it altogether. 4486 4487@item 4488A function-like macro that appears without arguments. 4489 4490@item 4491The unary plus operator. 4492 4493@item 4494The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 4495constant suffixes. (Traditional C does support the @samp{L} suffix on integer 4496constants.) Note, these suffixes appear in macros defined in the system 4497headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 4498Use of these macros in user code might normally lead to spurious 4499warnings, however GCC's integrated preprocessor has enough context to 4500avoid warning in these cases. 4501 4502@item 4503A function declared external in one block and then used after the end of 4504the block. 4505 4506@item 4507A @code{switch} statement has an operand of type @code{long}. 4508 4509@item 4510A non-@code{static} function declaration follows a @code{static} one. 4511This construct is not accepted by some traditional C compilers. 4512 4513@item 4514The ISO type of an integer constant has a different width or 4515signedness from its traditional type. This warning is only issued if 4516the base of the constant is ten. I.e.@: hexadecimal or octal values, which 4517typically represent bit patterns, are not warned about. 4518 4519@item 4520Usage of ISO string concatenation is detected. 4521 4522@item 4523Initialization of automatic aggregates. 4524 4525@item 4526Identifier conflicts with labels. Traditional C lacks a separate 4527namespace for labels. 4528 4529@item 4530Initialization of unions. If the initializer is zero, the warning is 4531omitted. This is done under the assumption that the zero initializer in 4532user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 4533initializer warnings and relies on default initialization to zero in the 4534traditional C case. 4535 4536@item 4537Conversions by prototypes between fixed/floating-point values and vice 4538versa. The absence of these prototypes when compiling with traditional 4539C causes serious problems. This is a subset of the possible 4540conversion warnings; for the full set use @option{-Wtraditional-conversion}. 4541 4542@item 4543Use of ISO C style function definitions. This warning intentionally is 4544@emph{not} issued for prototype declarations or variadic functions 4545because these ISO C features appear in your code when using 4546libiberty's traditional C compatibility macros, @code{PARAMS} and 4547@code{VPARAMS}. This warning is also bypassed for nested functions 4548because that feature is already a GCC extension and thus not relevant to 4549traditional C compatibility. 4550@end itemize 4551 4552@item -Wtraditional-conversion @r{(C and Objective-C only)} 4553@opindex Wtraditional-conversion 4554@opindex Wno-traditional-conversion 4555Warn if a prototype causes a type conversion that is different from what 4556would happen to the same argument in the absence of a prototype. This 4557includes conversions of fixed point to floating and vice versa, and 4558conversions changing the width or signedness of a fixed-point argument 4559except when the same as the default promotion. 4560 4561@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 4562@opindex Wdeclaration-after-statement 4563@opindex Wno-declaration-after-statement 4564Warn when a declaration is found after a statement in a block. This 4565construct, known from C++, was introduced with ISO C99 and is by default 4566allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}. 4567 4568@item -Wundef 4569@opindex Wundef 4570@opindex Wno-undef 4571Warn if an undefined identifier is evaluated in an @code{#if} directive. 4572 4573@item -Wno-endif-labels 4574@opindex Wno-endif-labels 4575@opindex Wendif-labels 4576Do not warn whenever an @code{#else} or an @code{#endif} are followed by text. 4577 4578@item -Wshadow 4579@opindex Wshadow 4580@opindex Wno-shadow 4581Warn whenever a local variable or type declaration shadows another 4582variable, parameter, type, class member (in C++), or instance variable 4583(in Objective-C) or whenever a built-in function is shadowed. Note 4584that in C++, the compiler warns if a local variable shadows an 4585explicit typedef, but not if it shadows a struct/class/enum. 4586 4587@item -Wno-shadow-ivar @r{(Objective-C only)} 4588@opindex Wno-shadow-ivar 4589@opindex Wshadow-ivar 4590Do not warn whenever a local variable shadows an instance variable in an 4591Objective-C method. 4592 4593@item -Wlarger-than=@var{len} 4594@opindex Wlarger-than=@var{len} 4595@opindex Wlarger-than-@var{len} 4596Warn whenever an object of larger than @var{len} bytes is defined. 4597 4598@item -Wframe-larger-than=@var{len} 4599@opindex Wframe-larger-than 4600Warn if the size of a function frame is larger than @var{len} bytes. 4601The computation done to determine the stack frame size is approximate 4602and not conservative. 4603The actual requirements may be somewhat greater than @var{len} 4604even if you do not get a warning. In addition, any space allocated 4605via @code{alloca}, variable-length arrays, or related constructs 4606is not included by the compiler when determining 4607whether or not to issue a warning. 4608 4609@item -Wno-free-nonheap-object 4610@opindex Wno-free-nonheap-object 4611@opindex Wfree-nonheap-object 4612Do not warn when attempting to free an object that was not allocated 4613on the heap. 4614 4615@item -Wstack-usage=@var{len} 4616@opindex Wstack-usage 4617Warn if the stack usage of a function might be larger than @var{len} bytes. 4618The computation done to determine the stack usage is conservative. 4619Any space allocated via @code{alloca}, variable-length arrays, or related 4620constructs is included by the compiler when determining whether or not to 4621issue a warning. 4622 4623The message is in keeping with the output of @option{-fstack-usage}. 4624 4625@itemize 4626@item 4627If the stack usage is fully static but exceeds the specified amount, it's: 4628 4629@smallexample 4630 warning: stack usage is 1120 bytes 4631@end smallexample 4632@item 4633If the stack usage is (partly) dynamic but bounded, it's: 4634 4635@smallexample 4636 warning: stack usage might be 1648 bytes 4637@end smallexample 4638@item 4639If the stack usage is (partly) dynamic and not bounded, it's: 4640 4641@smallexample 4642 warning: stack usage might be unbounded 4643@end smallexample 4644@end itemize 4645 4646@item -Wunsafe-loop-optimizations 4647@opindex Wunsafe-loop-optimizations 4648@opindex Wno-unsafe-loop-optimizations 4649Warn if the loop cannot be optimized because the compiler cannot 4650assume anything on the bounds of the loop indices. With 4651@option{-funsafe-loop-optimizations} warn if the compiler makes 4652such assumptions. 4653 4654@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 4655@opindex Wno-pedantic-ms-format 4656@opindex Wpedantic-ms-format 4657When used in combination with @option{-Wformat} 4658and @option{-pedantic} without GNU extensions, this option 4659disables the warnings about non-ISO @code{printf} / @code{scanf} format 4660width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 4661which depend on the MS runtime. 4662 4663@item -Wpointer-arith 4664@opindex Wpointer-arith 4665@opindex Wno-pointer-arith 4666Warn about anything that depends on the ``size of'' a function type or 4667of @code{void}. GNU C assigns these types a size of 1, for 4668convenience in calculations with @code{void *} pointers and pointers 4669to functions. In C++, warn also when an arithmetic operation involves 4670@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 4671 4672@item -Wtype-limits 4673@opindex Wtype-limits 4674@opindex Wno-type-limits 4675Warn if a comparison is always true or always false due to the limited 4676range of the data type, but do not warn for constant expressions. For 4677example, warn if an unsigned variable is compared against zero with 4678@code{<} or @code{>=}. This warning is also enabled by 4679@option{-Wextra}. 4680 4681@item -Wbad-function-cast @r{(C and Objective-C only)} 4682@opindex Wbad-function-cast 4683@opindex Wno-bad-function-cast 4684Warn when a function call is cast to a non-matching type. 4685For example, warn if a call to a function returning an integer type 4686is cast to a pointer type. 4687 4688@item -Wc90-c99-compat @r{(C and Objective-C only)} 4689@opindex Wc90-c99-compat 4690@opindex Wno-c90-c99-compat 4691Warn about features not present in ISO C90, but present in ISO C99. 4692For instance, warn about use of variable length arrays, @code{long long} 4693type, @code{bool} type, compound literals, designated initializers, and so 4694on. This option is independent of the standards mode. Warnings are disabled 4695in the expression that follows @code{__extension__}. 4696 4697@item -Wc99-c11-compat @r{(C and Objective-C only)} 4698@opindex Wc99-c11-compat 4699@opindex Wno-c99-c11-compat 4700Warn about features not present in ISO C99, but present in ISO C11. 4701For instance, warn about use of anonymous structures and unions, 4702@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 4703@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 4704and so on. This option is independent of the standards mode. Warnings are 4705disabled in the expression that follows @code{__extension__}. 4706 4707@item -Wc++-compat @r{(C and Objective-C only)} 4708@opindex Wc++-compat 4709Warn about ISO C constructs that are outside of the common subset of 4710ISO C and ISO C++, e.g.@: request for implicit conversion from 4711@code{void *} to a pointer to non-@code{void} type. 4712 4713@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 4714@opindex Wc++11-compat 4715Warn about C++ constructs whose meaning differs between ISO C++ 1998 4716and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 4717in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 4718enabled by @option{-Wall}. 4719 4720@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 4721@opindex Wc++14-compat 4722Warn about C++ constructs whose meaning differs between ISO C++ 2011 4723and ISO C++ 2014. This warning is enabled by @option{-Wall}. 4724 4725@item -Wcast-qual 4726@opindex Wcast-qual 4727@opindex Wno-cast-qual 4728Warn whenever a pointer is cast so as to remove a type qualifier from 4729the target type. For example, warn if a @code{const char *} is cast 4730to an ordinary @code{char *}. 4731 4732Also warn when making a cast that introduces a type qualifier in an 4733unsafe way. For example, casting @code{char **} to @code{const char **} 4734is unsafe, as in this example: 4735 4736@smallexample 4737 /* p is char ** value. */ 4738 const char **q = (const char **) p; 4739 /* Assignment of readonly string to const char * is OK. */ 4740 *q = "string"; 4741 /* Now char** pointer points to read-only memory. */ 4742 **p = 'b'; 4743@end smallexample 4744 4745@item -Wcast-align 4746@opindex Wcast-align 4747@opindex Wno-cast-align 4748Warn whenever a pointer is cast such that the required alignment of the 4749target is increased. For example, warn if a @code{char *} is cast to 4750an @code{int *} on machines where integers can only be accessed at 4751two- or four-byte boundaries. 4752 4753@item -Wwrite-strings 4754@opindex Wwrite-strings 4755@opindex Wno-write-strings 4756When compiling C, give string constants the type @code{const 4757char[@var{length}]} so that copying the address of one into a 4758non-@code{const} @code{char *} pointer produces a warning. These 4759warnings help you find at compile time code that can try to write 4760into a string constant, but only if you have been very careful about 4761using @code{const} in declarations and prototypes. Otherwise, it is 4762just a nuisance. This is why we did not make @option{-Wall} request 4763these warnings. 4764 4765When compiling C++, warn about the deprecated conversion from string 4766literals to @code{char *}. This warning is enabled by default for C++ 4767programs. 4768 4769@item -Wclobbered 4770@opindex Wclobbered 4771@opindex Wno-clobbered 4772Warn for variables that might be changed by @code{longjmp} or 4773@code{vfork}. This warning is also enabled by @option{-Wextra}. 4774 4775@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 4776@opindex Wconditionally-supported 4777@opindex Wno-conditionally-supported 4778Warn for conditionally-supported (C++11 [intro.defs]) constructs. 4779 4780@item -Wconversion 4781@opindex Wconversion 4782@opindex Wno-conversion 4783Warn for implicit conversions that may alter a value. This includes 4784conversions between real and integer, like @code{abs (x)} when 4785@code{x} is @code{double}; conversions between signed and unsigned, 4786like @code{unsigned ui = -1}; and conversions to smaller types, like 4787@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 4788((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 4789changed by the conversion like in @code{abs (2.0)}. Warnings about 4790conversions between signed and unsigned integers can be disabled by 4791using @option{-Wno-sign-conversion}. 4792 4793For C++, also warn for confusing overload resolution for user-defined 4794conversions; and conversions that never use a type conversion 4795operator: conversions to @code{void}, the same type, a base class or a 4796reference to them. Warnings about conversions between signed and 4797unsigned integers are disabled by default in C++ unless 4798@option{-Wsign-conversion} is explicitly enabled. 4799 4800@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 4801@opindex Wconversion-null 4802@opindex Wno-conversion-null 4803Do not warn for conversions between @code{NULL} and non-pointer 4804types. @option{-Wconversion-null} is enabled by default. 4805 4806@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 4807@opindex Wzero-as-null-pointer-constant 4808@opindex Wno-zero-as-null-pointer-constant 4809Warn when a literal '0' is used as null pointer constant. This can 4810be useful to facilitate the conversion to @code{nullptr} in C++11. 4811 4812@item -Wdate-time 4813@opindex Wdate-time 4814@opindex Wno-date-time 4815Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 4816are encountered as they might prevent bit-wise-identical reproducible 4817compilations. 4818 4819@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)} 4820@opindex Wdelete-incomplete 4821@opindex Wno-delete-incomplete 4822Warn when deleting a pointer to incomplete type, which may cause 4823undefined behavior at runtime. This warning is enabled by default. 4824 4825@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 4826@opindex Wuseless-cast 4827@opindex Wno-useless-cast 4828Warn when an expression is casted to its own type. 4829 4830@item -Wempty-body 4831@opindex Wempty-body 4832@opindex Wno-empty-body 4833Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 4834while} statement. This warning is also enabled by @option{-Wextra}. 4835 4836@item -Wenum-compare 4837@opindex Wenum-compare 4838@opindex Wno-enum-compare 4839Warn about a comparison between values of different enumerated types. 4840In C++ enumeral mismatches in conditional expressions are also 4841diagnosed and the warning is enabled by default. In C this warning is 4842enabled by @option{-Wall}. 4843 4844@item -Wjump-misses-init @r{(C, Objective-C only)} 4845@opindex Wjump-misses-init 4846@opindex Wno-jump-misses-init 4847Warn if a @code{goto} statement or a @code{switch} statement jumps 4848forward across the initialization of a variable, or jumps backward to a 4849label after the variable has been initialized. This only warns about 4850variables that are initialized when they are declared. This warning is 4851only supported for C and Objective-C; in C++ this sort of branch is an 4852error in any case. 4853 4854@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 4855can be disabled with the @option{-Wno-jump-misses-init} option. 4856 4857@item -Wsign-compare 4858@opindex Wsign-compare 4859@opindex Wno-sign-compare 4860@cindex warning for comparison of signed and unsigned values 4861@cindex comparison of signed and unsigned values, warning 4862@cindex signed and unsigned values, comparison warning 4863Warn when a comparison between signed and unsigned values could produce 4864an incorrect result when the signed value is converted to unsigned. 4865This warning is also enabled by @option{-Wextra}; to get the other warnings 4866of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}. 4867 4868@item -Wsign-conversion 4869@opindex Wsign-conversion 4870@opindex Wno-sign-conversion 4871Warn for implicit conversions that may change the sign of an integer 4872value, like assigning a signed integer expression to an unsigned 4873integer variable. An explicit cast silences the warning. In C, this 4874option is enabled also by @option{-Wconversion}. 4875 4876@item -Wfloat-conversion 4877@opindex Wfloat-conversion 4878@opindex Wno-float-conversion 4879Warn for implicit conversions that reduce the precision of a real value. 4880This includes conversions from real to integer, and from higher precision 4881real to lower precision real values. This option is also enabled by 4882@option{-Wconversion}. 4883 4884@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 4885@opindex Wsized-deallocation 4886@opindex Wno-sized-deallocation 4887Warn about a definition of an unsized deallocation function 4888@smallexample 4889void operator delete (void *) noexcept; 4890void operator delete[] (void *) noexcept; 4891@end smallexample 4892without a definition of the corresponding sized deallocation function 4893@smallexample 4894void operator delete (void *, std::size_t) noexcept; 4895void operator delete[] (void *, std::size_t) noexcept; 4896@end smallexample 4897or vice versa. Enabled by @option{-Wextra} along with 4898@option{-fsized-deallocation}. 4899 4900@item -Wsizeof-pointer-memaccess 4901@opindex Wsizeof-pointer-memaccess 4902@opindex Wno-sizeof-pointer-memaccess 4903Warn for suspicious length parameters to certain string and memory built-in 4904functions if the argument uses @code{sizeof}. This warning warns e.g.@: 4905about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array, 4906but a pointer, and suggests a possible fix, or about 4907@code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by 4908@option{-Wall}. 4909 4910@item -Wsizeof-array-argument 4911@opindex Wsizeof-array-argument 4912@opindex Wno-sizeof-array-argument 4913Warn when the @code{sizeof} operator is applied to a parameter that is 4914declared as an array in a function definition. This warning is enabled by 4915default for C and C++ programs. 4916 4917@item -Wmemset-transposed-args 4918@opindex Wmemset-transposed-args 4919@opindex Wno-memset-transposed-args 4920Warn for suspicious calls to the @code{memset} built-in function, if the 4921second argument is not zero and the third argument is zero. This warns e.g.@ 4922about @code{memset (buf, sizeof buf, 0)} where most probably 4923@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics 4924is only emitted if the third argument is literal zero. If it is some 4925expression that is folded to zero, a cast of zero to some type, etc., 4926it is far less likely that the user has mistakenly exchanged the arguments 4927and no warning is emitted. This warning is enabled by @option{-Wall}. 4928 4929@item -Waddress 4930@opindex Waddress 4931@opindex Wno-address 4932Warn about suspicious uses of memory addresses. These include using 4933the address of a function in a conditional expression, such as 4934@code{void func(void); if (func)}, and comparisons against the memory 4935address of a string literal, such as @code{if (x == "abc")}. Such 4936uses typically indicate a programmer error: the address of a function 4937always evaluates to true, so their use in a conditional usually 4938indicate that the programmer forgot the parentheses in a function 4939call; and comparisons against string literals result in unspecified 4940behavior and are not portable in C, so they usually indicate that the 4941programmer intended to use @code{strcmp}. This warning is enabled by 4942@option{-Wall}. 4943 4944@item -Wlogical-op 4945@opindex Wlogical-op 4946@opindex Wno-logical-op 4947Warn about suspicious uses of logical operators in expressions. 4948This includes using logical operators in contexts where a 4949bit-wise operator is likely to be expected. 4950 4951@item -Wlogical-not-parentheses 4952@opindex Wlogical-not-parentheses 4953@opindex Wno-logical-not-parentheses 4954Warn about logical not used on the left hand side operand of a comparison. 4955This option does not warn if the RHS operand is of a boolean type. Its 4956purpose is to detect suspicious code like the following: 4957@smallexample 4958int a; 4959@dots{} 4960if (!a > 1) @{ @dots{} @} 4961@end smallexample 4962 4963It is possible to suppress the warning by wrapping the LHS into 4964parentheses: 4965@smallexample 4966if ((!a) > 1) @{ @dots{} @} 4967@end smallexample 4968 4969This warning is enabled by @option{-Wall}. 4970 4971@item -Waggregate-return 4972@opindex Waggregate-return 4973@opindex Wno-aggregate-return 4974Warn if any functions that return structures or unions are defined or 4975called. (In languages where you can return an array, this also elicits 4976a warning.) 4977 4978@item -Wno-aggressive-loop-optimizations 4979@opindex Wno-aggressive-loop-optimizations 4980@opindex Waggressive-loop-optimizations 4981Warn if in a loop with constant number of iterations the compiler detects 4982undefined behavior in some statement during one or more of the iterations. 4983 4984@item -Wno-attributes 4985@opindex Wno-attributes 4986@opindex Wattributes 4987Do not warn if an unexpected @code{__attribute__} is used, such as 4988unrecognized attributes, function attributes applied to variables, 4989etc. This does not stop errors for incorrect use of supported 4990attributes. 4991 4992@item -Wno-builtin-macro-redefined 4993@opindex Wno-builtin-macro-redefined 4994@opindex Wbuiltin-macro-redefined 4995Do not warn if certain built-in macros are redefined. This suppresses 4996warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 4997@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 4998 4999@item -Wstrict-prototypes @r{(C and Objective-C only)} 5000@opindex Wstrict-prototypes 5001@opindex Wno-strict-prototypes 5002Warn if a function is declared or defined without specifying the 5003argument types. (An old-style function definition is permitted without 5004a warning if preceded by a declaration that specifies the argument 5005types.) 5006 5007@item -Wold-style-declaration @r{(C and Objective-C only)} 5008@opindex Wold-style-declaration 5009@opindex Wno-old-style-declaration 5010Warn for obsolescent usages, according to the C Standard, in a 5011declaration. For example, warn if storage-class specifiers like 5012@code{static} are not the first things in a declaration. This warning 5013is also enabled by @option{-Wextra}. 5014 5015@item -Wold-style-definition @r{(C and Objective-C only)} 5016@opindex Wold-style-definition 5017@opindex Wno-old-style-definition 5018Warn if an old-style function definition is used. A warning is given 5019even if there is a previous prototype. 5020 5021@item -Wmissing-parameter-type @r{(C and Objective-C only)} 5022@opindex Wmissing-parameter-type 5023@opindex Wno-missing-parameter-type 5024A function parameter is declared without a type specifier in K&R-style 5025functions: 5026 5027@smallexample 5028void foo(bar) @{ @} 5029@end smallexample 5030 5031This warning is also enabled by @option{-Wextra}. 5032 5033@item -Wmissing-prototypes @r{(C and Objective-C only)} 5034@opindex Wmissing-prototypes 5035@opindex Wno-missing-prototypes 5036Warn if a global function is defined without a previous prototype 5037declaration. This warning is issued even if the definition itself 5038provides a prototype. Use this option to detect global functions 5039that do not have a matching prototype declaration in a header file. 5040This option is not valid for C++ because all function declarations 5041provide prototypes and a non-matching declaration declares an 5042overload rather than conflict with an earlier declaration. 5043Use @option{-Wmissing-declarations} to detect missing declarations in C++. 5044 5045@item -Wmissing-declarations 5046@opindex Wmissing-declarations 5047@opindex Wno-missing-declarations 5048Warn if a global function is defined without a previous declaration. 5049Do so even if the definition itself provides a prototype. 5050Use this option to detect global functions that are not declared in 5051header files. In C, no warnings are issued for functions with previous 5052non-prototype declarations; use @option{-Wmissing-prototypes} to detect 5053missing prototypes. In C++, no warnings are issued for function templates, 5054or for inline functions, or for functions in anonymous namespaces. 5055 5056@item -Wmissing-field-initializers 5057@opindex Wmissing-field-initializers 5058@opindex Wno-missing-field-initializers 5059@opindex W 5060@opindex Wextra 5061@opindex Wno-extra 5062Warn if a structure's initializer has some fields missing. For 5063example, the following code causes such a warning, because 5064@code{x.h} is implicitly zero: 5065 5066@smallexample 5067struct s @{ int f, g, h; @}; 5068struct s x = @{ 3, 4 @}; 5069@end smallexample 5070 5071This option does not warn about designated initializers, so the following 5072modification does not trigger a warning: 5073 5074@smallexample 5075struct s @{ int f, g, h; @}; 5076struct s x = @{ .f = 3, .g = 4 @}; 5077@end smallexample 5078 5079In C++ this option does not warn either about the empty @{ @} 5080initializer, for example: 5081 5082@smallexample 5083struct s @{ int f, g, h; @}; 5084s x = @{ @}; 5085@end smallexample 5086 5087This warning is included in @option{-Wextra}. To get other @option{-Wextra} 5088warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 5089 5090@item -Wno-multichar 5091@opindex Wno-multichar 5092@opindex Wmultichar 5093Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 5094Usually they indicate a typo in the user's code, as they have 5095implementation-defined values, and should not be used in portable code. 5096 5097@item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]} 5098@opindex Wnormalized= 5099@opindex Wnormalized 5100@opindex Wno-normalized 5101@cindex NFC 5102@cindex NFKC 5103@cindex character set, input normalization 5104In ISO C and ISO C++, two identifiers are different if they are 5105different sequences of characters. However, sometimes when characters 5106outside the basic ASCII character set are used, you can have two 5107different character sequences that look the same. To avoid confusion, 5108the ISO 10646 standard sets out some @dfn{normalization rules} which 5109when applied ensure that two sequences that look the same are turned into 5110the same sequence. GCC can warn you if you are using identifiers that 5111have not been normalized; this option controls that warning. 5112 5113There are four levels of warning supported by GCC@. The default is 5114@option{-Wnormalized=nfc}, which warns about any identifier that is 5115not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 5116recommended form for most uses. It is equivalent to 5117@option{-Wnormalized}. 5118 5119Unfortunately, there are some characters allowed in identifiers by 5120ISO C and ISO C++ that, when turned into NFC, are not allowed in 5121identifiers. That is, there's no way to use these symbols in portable 5122ISO C or C++ and have all your identifiers in NFC@. 5123@option{-Wnormalized=id} suppresses the warning for these characters. 5124It is hoped that future versions of the standards involved will correct 5125this, which is why this option is not the default. 5126 5127You can switch the warning off for all characters by writing 5128@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 5129only do this if you are using some other normalization scheme (like 5130``D''), because otherwise you can easily create bugs that are 5131literally impossible to see. 5132 5133Some characters in ISO 10646 have distinct meanings but look identical 5134in some fonts or display methodologies, especially once formatting has 5135been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 5136LETTER N'', displays just like a regular @code{n} that has been 5137placed in a superscript. ISO 10646 defines the @dfn{NFKC} 5138normalization scheme to convert all these into a standard form as 5139well, and GCC warns if your code is not in NFKC if you use 5140@option{-Wnormalized=nfkc}. This warning is comparable to warning 5141about every identifier that contains the letter O because it might be 5142confused with the digit 0, and so is not the default, but may be 5143useful as a local coding convention if the programming environment 5144cannot be fixed to display these characters distinctly. 5145 5146@item -Wno-deprecated 5147@opindex Wno-deprecated 5148@opindex Wdeprecated 5149Do not warn about usage of deprecated features. @xref{Deprecated Features}. 5150 5151@item -Wno-deprecated-declarations 5152@opindex Wno-deprecated-declarations 5153@opindex Wdeprecated-declarations 5154Do not warn about uses of functions (@pxref{Function Attributes}), 5155variables (@pxref{Variable Attributes}), and types (@pxref{Type 5156Attributes}) marked as deprecated by using the @code{deprecated} 5157attribute. 5158 5159@item -Wno-overflow 5160@opindex Wno-overflow 5161@opindex Woverflow 5162Do not warn about compile-time overflow in constant expressions. 5163 5164@item -Wno-odr 5165@opindex Wno-odr 5166@opindex Wodr 5167Warn about One Definition Rule violations during link-time optimization. 5168Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default. 5169 5170@item -Wopenmp-simd 5171@opindex Wopenm-simd 5172Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus 5173simd directive set by user. The @option{-fsimd-cost-model=unlimited} 5174option can be used to relax the cost model. 5175 5176@item -Woverride-init @r{(C and Objective-C only)} 5177@opindex Woverride-init 5178@opindex Wno-override-init 5179@opindex W 5180@opindex Wextra 5181@opindex Wno-extra 5182Warn if an initialized field without side effects is overridden when 5183using designated initializers (@pxref{Designated Inits, , Designated 5184Initializers}). 5185 5186This warning is included in @option{-Wextra}. To get other 5187@option{-Wextra} warnings without this one, use @option{-Wextra 5188-Wno-override-init}. 5189 5190@item -Wpacked 5191@opindex Wpacked 5192@opindex Wno-packed 5193Warn if a structure is given the packed attribute, but the packed 5194attribute has no effect on the layout or size of the structure. 5195Such structures may be mis-aligned for little benefit. For 5196instance, in this code, the variable @code{f.x} in @code{struct bar} 5197is misaligned even though @code{struct bar} does not itself 5198have the packed attribute: 5199 5200@smallexample 5201@group 5202struct foo @{ 5203 int x; 5204 char a, b, c, d; 5205@} __attribute__((packed)); 5206struct bar @{ 5207 char z; 5208 struct foo f; 5209@}; 5210@end group 5211@end smallexample 5212 5213@item -Wpacked-bitfield-compat 5214@opindex Wpacked-bitfield-compat 5215@opindex Wno-packed-bitfield-compat 5216The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 5217on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but 5218the change can lead to differences in the structure layout. GCC 5219informs you when the offset of such a field has changed in GCC 4.4. 5220For example there is no longer a 4-bit padding between field @code{a} 5221and @code{b} in this structure: 5222 5223@smallexample 5224struct foo 5225@{ 5226 char a:4; 5227 char b:8; 5228@} __attribute__ ((packed)); 5229@end smallexample 5230 5231This warning is enabled by default. Use 5232@option{-Wno-packed-bitfield-compat} to disable this warning. 5233 5234@item -Wpadded 5235@opindex Wpadded 5236@opindex Wno-padded 5237Warn if padding is included in a structure, either to align an element 5238of the structure or to align the whole structure. Sometimes when this 5239happens it is possible to rearrange the fields of the structure to 5240reduce the padding and so make the structure smaller. 5241 5242@item -Wredundant-decls 5243@opindex Wredundant-decls 5244@opindex Wno-redundant-decls 5245Warn if anything is declared more than once in the same scope, even in 5246cases where multiple declaration is valid and changes nothing. 5247 5248@item -Wnested-externs @r{(C and Objective-C only)} 5249@opindex Wnested-externs 5250@opindex Wno-nested-externs 5251Warn if an @code{extern} declaration is encountered within a function. 5252 5253@item -Wno-inherited-variadic-ctor 5254@opindex Winherited-variadic-ctor 5255@opindex Wno-inherited-variadic-ctor 5256Suppress warnings about use of C++11 inheriting constructors when the 5257base class inherited from has a C variadic constructor; the warning is 5258on by default because the ellipsis is not inherited. 5259 5260@item -Winline 5261@opindex Winline 5262@opindex Wno-inline 5263Warn if a function that is declared as inline cannot be inlined. 5264Even with this option, the compiler does not warn about failures to 5265inline functions declared in system headers. 5266 5267The compiler uses a variety of heuristics to determine whether or not 5268to inline a function. For example, the compiler takes into account 5269the size of the function being inlined and the amount of inlining 5270that has already been done in the current function. Therefore, 5271seemingly insignificant changes in the source program can cause the 5272warnings produced by @option{-Winline} to appear or disappear. 5273 5274@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 5275@opindex Wno-invalid-offsetof 5276@opindex Winvalid-offsetof 5277Suppress warnings from applying the @code{offsetof} macro to a non-POD 5278type. According to the 2014 ISO C++ standard, applying @code{offsetof} 5279to a non-standard-layout type is undefined. In existing C++ implementations, 5280however, @code{offsetof} typically gives meaningful results. 5281This flag is for users who are aware that they are 5282writing nonportable code and who have deliberately chosen to ignore the 5283warning about it. 5284 5285The restrictions on @code{offsetof} may be relaxed in a future version 5286of the C++ standard. 5287 5288@item -Wno-int-to-pointer-cast 5289@opindex Wno-int-to-pointer-cast 5290@opindex Wint-to-pointer-cast 5291Suppress warnings from casts to pointer type of an integer of a 5292different size. In C++, casting to a pointer type of smaller size is 5293an error. @option{Wint-to-pointer-cast} is enabled by default. 5294 5295 5296@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 5297@opindex Wno-pointer-to-int-cast 5298@opindex Wpointer-to-int-cast 5299Suppress warnings from casts from a pointer to an integer type of a 5300different size. 5301 5302@item -Winvalid-pch 5303@opindex Winvalid-pch 5304@opindex Wno-invalid-pch 5305Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 5306the search path but can't be used. 5307 5308@item -Wlong-long 5309@opindex Wlong-long 5310@opindex Wno-long-long 5311Warn if @code{long long} type is used. This is enabled by either 5312@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 5313modes. To inhibit the warning messages, use @option{-Wno-long-long}. 5314 5315@item -Wvariadic-macros 5316@opindex Wvariadic-macros 5317@opindex Wno-variadic-macros 5318Warn if variadic macros are used in ISO C90 mode, or if the GNU 5319alternate syntax is used in ISO C99 mode. This is enabled by either 5320@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 5321messages, use @option{-Wno-variadic-macros}. 5322 5323@item -Wvarargs 5324@opindex Wvarargs 5325@opindex Wno-varargs 5326Warn upon questionable usage of the macros used to handle variable 5327arguments like @code{va_start}. This is default. To inhibit the 5328warning messages, use @option{-Wno-varargs}. 5329 5330@item -Wvector-operation-performance 5331@opindex Wvector-operation-performance 5332@opindex Wno-vector-operation-performance 5333Warn if vector operation is not implemented via SIMD capabilities of the 5334architecture. Mainly useful for the performance tuning. 5335Vector operation can be implemented @code{piecewise}, which means that the 5336scalar operation is performed on every vector element; 5337@code{in parallel}, which means that the vector operation is implemented 5338using scalars of wider type, which normally is more performance efficient; 5339and @code{as a single scalar}, which means that vector fits into a 5340scalar type. 5341 5342@item -Wno-virtual-move-assign 5343@opindex Wvirtual-move-assign 5344@opindex Wno-virtual-move-assign 5345Suppress warnings about inheriting from a virtual base with a 5346non-trivial C++11 move assignment operator. This is dangerous because 5347if the virtual base is reachable along more than one path, it is 5348moved multiple times, which can mean both objects end up in the 5349moved-from state. If the move assignment operator is written to avoid 5350moving from a moved-from object, this warning can be disabled. 5351 5352@item -Wvla 5353@opindex Wvla 5354@opindex Wno-vla 5355Warn if variable length array is used in the code. 5356@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 5357the variable length array. 5358 5359@item -Wvolatile-register-var 5360@opindex Wvolatile-register-var 5361@opindex Wno-volatile-register-var 5362Warn if a register variable is declared volatile. The volatile 5363modifier does not inhibit all optimizations that may eliminate reads 5364and/or writes to register variables. This warning is enabled by 5365@option{-Wall}. 5366 5367@item -Wdisabled-optimization 5368@opindex Wdisabled-optimization 5369@opindex Wno-disabled-optimization 5370Warn if a requested optimization pass is disabled. This warning does 5371not generally indicate that there is anything wrong with your code; it 5372merely indicates that GCC's optimizers are unable to handle the code 5373effectively. Often, the problem is that your code is too big or too 5374complex; GCC refuses to optimize programs when the optimization 5375itself is likely to take inordinate amounts of time. 5376 5377@item -Wpointer-sign @r{(C and Objective-C only)} 5378@opindex Wpointer-sign 5379@opindex Wno-pointer-sign 5380Warn for pointer argument passing or assignment with different signedness. 5381This option is only supported for C and Objective-C@. It is implied by 5382@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 5383@option{-Wno-pointer-sign}. 5384 5385@item -Wstack-protector 5386@opindex Wstack-protector 5387@opindex Wno-stack-protector 5388This option is only active when @option{-fstack-protector} is active. It 5389warns about functions that are not protected against stack smashing. 5390 5391@item -Woverlength-strings 5392@opindex Woverlength-strings 5393@opindex Wno-overlength-strings 5394Warn about string constants that are longer than the ``minimum 5395maximum'' length specified in the C standard. Modern compilers 5396generally allow string constants that are much longer than the 5397standard's minimum limit, but very portable programs should avoid 5398using longer strings. 5399 5400The limit applies @emph{after} string constant concatenation, and does 5401not count the trailing NUL@. In C90, the limit was 509 characters; in 5402C99, it was raised to 4095. C++98 does not specify a normative 5403minimum maximum, so we do not diagnose overlength strings in C++@. 5404 5405This option is implied by @option{-Wpedantic}, and can be disabled with 5406@option{-Wno-overlength-strings}. 5407 5408@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 5409@opindex Wunsuffixed-float-constants 5410 5411Issue a warning for any floating constant that does not have 5412a suffix. When used together with @option{-Wsystem-headers} it 5413warns about such constants in system header files. This can be useful 5414when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 5415from the decimal floating-point extension to C99. 5416 5417@item -Wno-designated-init @r{(C and Objective-C only)} 5418Suppress warnings when a positional initializer is used to initialize 5419a structure that has been marked with the @code{designated_init} 5420attribute. 5421 5422@end table 5423 5424@node Debugging Options 5425@section Options for Debugging Your Program or GCC 5426@cindex options, debugging 5427@cindex debugging information options 5428 5429GCC has various special options that are used for debugging 5430either your program or GCC: 5431 5432@table @gcctabopt 5433@item -g 5434@opindex g 5435Produce debugging information in the operating system's native format 5436(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 5437information. 5438 5439On most systems that use stabs format, @option{-g} enables use of extra 5440debugging information that only GDB can use; this extra information 5441makes debugging work better in GDB but probably makes other debuggers 5442crash or 5443refuse to read the program. If you want to control for certain whether 5444to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 5445@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 5446 5447GCC allows you to use @option{-g} with 5448@option{-O}. The shortcuts taken by optimized code may occasionally 5449produce surprising results: some variables you declared may not exist 5450at all; flow of control may briefly move where you did not expect it; 5451some statements may not be executed because they compute constant 5452results or their values are already at hand; some statements may 5453execute in different places because they have been moved out of loops. 5454 5455Nevertheless it proves possible to debug optimized output. This makes 5456it reasonable to use the optimizer for programs that might have bugs. 5457 5458The following options are useful when GCC is generated with the 5459capability for more than one debugging format. 5460 5461@item -gsplit-dwarf 5462@opindex gsplit-dwarf 5463Separate as much dwarf debugging information as possible into a 5464separate output file with the extension .dwo. This option allows 5465the build system to avoid linking files with debug information. To 5466be useful, this option requires a debugger capable of reading .dwo 5467files. 5468 5469@item -ggdb 5470@opindex ggdb 5471Produce debugging information for use by GDB@. This means to use the 5472most expressive format available (DWARF 2, stabs, or the native format 5473if neither of those are supported), including GDB extensions if at all 5474possible. 5475 5476@item -gpubnames 5477@opindex gpubnames 5478Generate dwarf .debug_pubnames and .debug_pubtypes sections. 5479 5480@item -ggnu-pubnames 5481@opindex ggnu-pubnames 5482Generate .debug_pubnames and .debug_pubtypes sections in a format 5483suitable for conversion into a GDB@ index. This option is only useful 5484with a linker that can produce GDB@ index version 7. 5485 5486@item -gstabs 5487@opindex gstabs 5488Produce debugging information in stabs format (if that is supported), 5489without GDB extensions. This is the format used by DBX on most BSD 5490systems. On MIPS, Alpha and System V Release 4 systems this option 5491produces stabs debugging output that is not understood by DBX or SDB@. 5492On System V Release 4 systems this option requires the GNU assembler. 5493 5494@item -feliminate-unused-debug-symbols 5495@opindex feliminate-unused-debug-symbols 5496Produce debugging information in stabs format (if that is supported), 5497for only symbols that are actually used. 5498 5499@item -femit-class-debug-always 5500@opindex femit-class-debug-always 5501Instead of emitting debugging information for a C++ class in only one 5502object file, emit it in all object files using the class. This option 5503should be used only with debuggers that are unable to handle the way GCC 5504normally emits debugging information for classes because using this 5505option increases the size of debugging information by as much as a 5506factor of two. 5507 5508@item -fdebug-types-section 5509@opindex fdebug-types-section 5510@opindex fno-debug-types-section 5511When using DWARF Version 4 or higher, type DIEs can be put into 5512their own @code{.debug_types} section instead of making them part of the 5513@code{.debug_info} section. It is more efficient to put them in a separate 5514comdat sections since the linker can then remove duplicates. 5515But not all DWARF consumers support @code{.debug_types} sections yet 5516and on some objects @code{.debug_types} produces larger instead of smaller 5517debugging information. 5518 5519@item -gstabs+ 5520@opindex gstabs+ 5521Produce debugging information in stabs format (if that is supported), 5522using GNU extensions understood only by the GNU debugger (GDB)@. The 5523use of these extensions is likely to make other debuggers crash or 5524refuse to read the program. 5525 5526@item -gcoff 5527@opindex gcoff 5528Produce debugging information in COFF format (if that is supported). 5529This is the format used by SDB on most System V systems prior to 5530System V Release 4. 5531 5532@item -gxcoff 5533@opindex gxcoff 5534Produce debugging information in XCOFF format (if that is supported). 5535This is the format used by the DBX debugger on IBM RS/6000 systems. 5536 5537@item -gxcoff+ 5538@opindex gxcoff+ 5539Produce debugging information in XCOFF format (if that is supported), 5540using GNU extensions understood only by the GNU debugger (GDB)@. The 5541use of these extensions is likely to make other debuggers crash or 5542refuse to read the program, and may cause assemblers other than the GNU 5543assembler (GAS) to fail with an error. 5544 5545@item -gdwarf-@var{version} 5546@opindex gdwarf-@var{version} 5547Produce debugging information in DWARF format (if that is supported). 5548The value of @var{version} may be either 2, 3, 4 or 5; the default version 5549for most targets is 4. DWARF Version 5 is only experimental. 5550 5551Note that with DWARF Version 2, some ports require and always 5552use some non-conflicting DWARF 3 extensions in the unwind tables. 5553 5554Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 5555for maximum benefit. 5556 5557@item -grecord-gcc-switches 5558@opindex grecord-gcc-switches 5559This switch causes the command-line options used to invoke the 5560compiler that may affect code generation to be appended to the 5561DW_AT_producer attribute in DWARF debugging information. The options 5562are concatenated with spaces separating them from each other and from 5563the compiler version. See also @option{-frecord-gcc-switches} for another 5564way of storing compiler options into the object file. This is the default. 5565 5566@item -gno-record-gcc-switches 5567@opindex gno-record-gcc-switches 5568Disallow appending command-line options to the DW_AT_producer attribute 5569in DWARF debugging information. 5570 5571@item -gstrict-dwarf 5572@opindex gstrict-dwarf 5573Disallow using extensions of later DWARF standard version than selected 5574with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 5575DWARF extensions from later standard versions is allowed. 5576 5577@item -gno-strict-dwarf 5578@opindex gno-strict-dwarf 5579Allow using extensions of later DWARF standard version than selected with 5580@option{-gdwarf-@var{version}}. 5581 5582@item -gz@r{[}=@var{type}@r{]} 5583@opindex gz 5584Produce compressed debug sections in DWARF format, if that is supported. 5585If @var{type} is not given, the default type depends on the capabilities 5586of the assembler and linker used. @var{type} may be one of 5587@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 5588compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 5589compression in traditional GNU format). If the linker doesn't support 5590writing compressed debug sections, the option is rejected. Otherwise, 5591if the assembler does not support them, @option{-gz} is silently ignored 5592when producing object files. 5593 5594@item -gvms 5595@opindex gvms 5596Produce debugging information in Alpha/VMS debug format (if that is 5597supported). This is the format used by DEBUG on Alpha/VMS systems. 5598 5599@item -g@var{level} 5600@itemx -ggdb@var{level} 5601@itemx -gstabs@var{level} 5602@itemx -gcoff@var{level} 5603@itemx -gxcoff@var{level} 5604@itemx -gvms@var{level} 5605Request debugging information and also use @var{level} to specify how 5606much information. The default level is 2. 5607 5608Level 0 produces no debug information at all. Thus, @option{-g0} negates 5609@option{-g}. 5610 5611Level 1 produces minimal information, enough for making backtraces in 5612parts of the program that you don't plan to debug. This includes 5613descriptions of functions and external variables, and line number 5614tables, but no information about local variables. 5615 5616Level 3 includes extra information, such as all the macro definitions 5617present in the program. Some debuggers support macro expansion when 5618you use @option{-g3}. 5619 5620@option{-gdwarf-2} does not accept a concatenated debug level, because 5621GCC used to support an option @option{-gdwarf} that meant to generate 5622debug information in version 1 of the DWARF format (which is very 5623different from version 2), and it would have been too confusing. That 5624debug format is long obsolete, but the option cannot be changed now. 5625Instead use an additional @option{-g@var{level}} option to change the 5626debug level for DWARF. 5627 5628@item -gtoggle 5629@opindex gtoggle 5630Turn off generation of debug info, if leaving out this option 5631generates it, or turn it on at level 2 otherwise. The position of this 5632argument in the command line does not matter; it takes effect after all 5633other options are processed, and it does so only once, no matter how 5634many times it is given. This is mainly intended to be used with 5635@option{-fcompare-debug}. 5636 5637@item -fsanitize=address 5638@opindex fsanitize=address 5639Enable AddressSanitizer, a fast memory error detector. 5640Memory access instructions are instrumented to detect 5641out-of-bounds and use-after-free bugs. 5642See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 5643more details. The run-time behavior can be influenced using the 5644@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 5645the available options are shown at startup of the instrumended program. See 5646@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 5647for a list of supported options. 5648 5649@item -fsanitize=kernel-address 5650@opindex fsanitize=kernel-address 5651Enable AddressSanitizer for Linux kernel. 5652See @uref{https://github.com/google/kasan/wiki} for more details. 5653 5654@item -fsanitize=thread 5655@opindex fsanitize=thread 5656Enable ThreadSanitizer, a fast data race detector. 5657Memory access instructions are instrumented to detect 5658data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 5659details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 5660environment variable; see 5661@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 5662supported options. 5663 5664@item -fsanitize=leak 5665@opindex fsanitize=leak 5666Enable LeakSanitizer, a memory leak detector. 5667This option only matters for linking of executables and if neither 5668@option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that 5669case the executable is linked against a library that overrides @code{malloc} 5670and other allocator functions. See 5671@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 5672details. The run-time behavior can be influenced using the 5673@env{LSAN_OPTIONS} environment variable. 5674 5675@item -fsanitize=undefined 5676@opindex fsanitize=undefined 5677Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 5678Various computations are instrumented to detect undefined behavior 5679at runtime. Current suboptions are: 5680 5681@table @gcctabopt 5682 5683@item -fsanitize=shift 5684@opindex fsanitize=shift 5685This option enables checking that the result of a shift operation is 5686not undefined. Note that what exactly is considered undefined differs 5687slightly between C and C++, as well as between ISO C90 and C99, etc. 5688 5689@item -fsanitize=integer-divide-by-zero 5690@opindex fsanitize=integer-divide-by-zero 5691Detect integer division by zero as well as @code{INT_MIN / -1} division. 5692 5693@item -fsanitize=unreachable 5694@opindex fsanitize=unreachable 5695With this option, the compiler turns the @code{__builtin_unreachable} 5696call into a diagnostics message call instead. When reaching the 5697@code{__builtin_unreachable} call, the behavior is undefined. 5698 5699@item -fsanitize=vla-bound 5700@opindex fsanitize=vla-bound 5701This option instructs the compiler to check that the size of a variable 5702length array is positive. 5703 5704@item -fsanitize=null 5705@opindex fsanitize=null 5706This option enables pointer checking. Particularly, the application 5707built with this option turned on will issue an error message when it 5708tries to dereference a NULL pointer, or if a reference (possibly an 5709rvalue reference) is bound to a NULL pointer, or if a method is invoked 5710on an object pointed by a NULL pointer. 5711 5712@item -fsanitize=return 5713@opindex fsanitize=return 5714This option enables return statement checking. Programs 5715built with this option turned on will issue an error message 5716when the end of a non-void function is reached without actually 5717returning a value. This option works in C++ only. 5718 5719@item -fsanitize=signed-integer-overflow 5720@opindex fsanitize=signed-integer-overflow 5721This option enables signed integer overflow checking. We check that 5722the result of @code{+}, @code{*}, and both unary and binary @code{-} 5723does not overflow in the signed arithmetics. Note, integer promotion 5724rules must be taken into account. That is, the following is not an 5725overflow: 5726@smallexample 5727signed char a = SCHAR_MAX; 5728a++; 5729@end smallexample 5730 5731@item -fsanitize=bounds 5732@opindex fsanitize=bounds 5733This option enables instrumentation of array bounds. Various out of bounds 5734accesses are detected. Flexible array members, flexible array member-like 5735arrays, and initializers of variables with static storage are not instrumented. 5736 5737@item -fsanitize=alignment 5738@opindex fsanitize=alignment 5739 5740This option enables checking of alignment of pointers when they are 5741dereferenced, or when a reference is bound to insufficiently aligned target, 5742or when a method or constructor is invoked on insufficiently aligned object. 5743 5744@item -fsanitize=object-size 5745@opindex fsanitize=object-size 5746This option enables instrumentation of memory references using the 5747@code{__builtin_object_size} function. Various out of bounds pointer 5748accesses are detected. 5749 5750@item -fsanitize=float-divide-by-zero 5751@opindex fsanitize=float-divide-by-zero 5752Detect floating-point division by zero. Unlike other similar options, 5753@option{-fsanitize=float-divide-by-zero} is not enabled by 5754@option{-fsanitize=undefined}, since floating-point division by zero can 5755be a legitimate way of obtaining infinities and NaNs. 5756 5757@item -fsanitize=float-cast-overflow 5758@opindex fsanitize=float-cast-overflow 5759This option enables floating-point type to integer conversion checking. 5760We check that the result of the conversion does not overflow. 5761Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 5762not enabled by @option{-fsanitize=undefined}. 5763This option does not work well with @code{FE_INVALID} exceptions enabled. 5764 5765@item -fsanitize=nonnull-attribute 5766@opindex fsanitize=nonnull-attribute 5767 5768This option enables instrumentation of calls, checking whether null values 5769are not passed to arguments marked as requiring a non-null value by the 5770@code{nonnull} function attribute. 5771 5772@item -fsanitize=returns-nonnull-attribute 5773@opindex fsanitize=returns-nonnull-attribute 5774 5775This option enables instrumentation of return statements in functions 5776marked with @code{returns_nonnull} function attribute, to detect returning 5777of null values from such functions. 5778 5779@item -fsanitize=bool 5780@opindex fsanitize=bool 5781 5782This option enables instrumentation of loads from bool. If a value other 5783than 0/1 is loaded, a run-time error is issued. 5784 5785@item -fsanitize=enum 5786@opindex fsanitize=enum 5787 5788This option enables instrumentation of loads from an enum type. If 5789a value outside the range of values for the enum type is loaded, 5790a run-time error is issued. 5791 5792@item -fsanitize=vptr 5793@opindex fsanitize=vptr 5794 5795This option enables instrumentation of C++ member function calls, member 5796accesses and some conversions between pointers to base and derived classes, 5797to verify the referenced object has the correct dynamic type. 5798 5799@end table 5800 5801While @option{-ftrapv} causes traps for signed overflows to be emitted, 5802@option{-fsanitize=undefined} gives a diagnostic message. 5803This currently works only for the C family of languages. 5804 5805@item -fno-sanitize=all 5806@opindex fno-sanitize=all 5807 5808This option disables all previously enabled sanitizers. 5809@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 5810together. 5811 5812@item -fasan-shadow-offset=@var{number} 5813@opindex fasan-shadow-offset 5814This option forces GCC to use custom shadow offset in AddressSanitizer checks. 5815It is useful for experimenting with different shadow memory layouts in 5816Kernel AddressSanitizer. 5817 5818@item -fsanitize-recover@r{[}=@var{opts}@r{]} 5819@opindex fsanitize-recover 5820@opindex fno-sanitize-recover 5821@option{-fsanitize-recover=} controls error recovery mode for sanitizers 5822mentioned in comma-separated list of @var{opts}. Enabling this option 5823for a sanitizer component causes it to attempt to continue 5824running the program as if no error happened. This means multiple 5825runtime errors can be reported in a single program run, and the exit 5826code of the program may indicate success even when errors 5827have been reported. The @option{-fno-sanitize-recover=} option 5828can be used to alter 5829this behavior: only the first detected error is reported 5830and program then exits with a non-zero exit code. 5831 5832Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 5833except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 5834@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and 5835@option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default. 5836@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 5837accepted, the former enables recovery for all sanitizers that support it, 5838the latter disables recovery for all sanitizers that support it. 5839 5840Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to 5841@smallexample 5842-fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero 5843@end smallexample 5844@noindent 5845Similarly @option{-fno-sanitize-recover} is equivalent to 5846@smallexample 5847-fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero 5848@end smallexample 5849 5850@item -fsanitize-undefined-trap-on-error 5851@opindex fsanitize-undefined-trap-on-error 5852The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 5853report undefined behavior using @code{__builtin_trap} rather than 5854a @code{libubsan} library routine. The advantage of this is that the 5855@code{libubsan} library is not needed and is not linked in, so this 5856is usable even in freestanding environments. 5857 5858@item -fcheck-pointer-bounds 5859@opindex fcheck-pointer-bounds 5860@opindex fno-check-pointer-bounds 5861@cindex Pointer Bounds Checker options 5862Enable Pointer Bounds Checker instrumentation. Each memory reference 5863is instrumented with checks of the pointer used for memory access against 5864bounds associated with that pointer. 5865 5866Currently there 5867is only an implementation for Intel MPX available, thus x86 target 5868and @option{-mmpx} are required to enable this feature. 5869MPX-based instrumentation requires 5870a runtime library to enable MPX in hardware and handle bounds 5871violation signals. By default when @option{-fcheck-pointer-bounds} 5872and @option{-mmpx} options are used to link a program, the GCC driver 5873links against the @file{libmpx} runtime library and @file{libmpxwrappers} 5874library. It also passes '-z bndplt' to a linker in case it supports this 5875option (which is checked on libmpx configuration). Note that old versions 5876of linker may ignore option. Gold linker doesn't support '-z bndplt' 5877option. With no '-z bndplt' support in linker all calls to dynamic libraries 5878lose passed bounds reducing overall protection level. It's highly 5879recommended to use linker with '-z bndplt' support. In case such linker 5880is not available it is adviced to always use @option{-static-libmpxwrappers} 5881for better protection level or use @option{-static} to completely avoid 5882external calls to dynamic libraries. MPX-based instrumentation 5883may be used for debugging and also may be included in production code 5884to increase program security. Depending on usage, you may 5885have different requirements for the runtime library. The current version 5886of the MPX runtime library is more oriented for use as a debugging 5887tool. MPX runtime library usage implies @option{-lpthread}. See 5888also @option{-static-libmpx}. The runtime library behavior can be 5889influenced using various @env{CHKP_RT_*} environment variables. See 5890@uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler} 5891for more details. 5892 5893Generated instrumentation may be controlled by various 5894@option{-fchkp-*} options and by the @code{bnd_variable_size} 5895structure field attribute (@pxref{Type Attributes}) and 5896@code{bnd_legacy}, and @code{bnd_instrument} function attributes 5897(@pxref{Function Attributes}). GCC also provides a number of built-in 5898functions for controlling the Pointer Bounds Checker. @xref{Pointer 5899Bounds Checker builtins}, for more information. 5900 5901@item -fchkp-check-incomplete-type 5902@opindex fchkp-check-incomplete-type 5903@opindex fno-chkp-check-incomplete-type 5904Generate pointer bounds checks for variables with incomplete type. 5905Enabled by default. 5906 5907@item -fchkp-narrow-bounds 5908@opindex fchkp-narrow-bounds 5909@opindex fno-chkp-narrow-bounds 5910Controls bounds used by Pointer Bounds Checker for pointers to object 5911fields. If narrowing is enabled then field bounds are used. Otherwise 5912object bounds are used. See also @option{-fchkp-narrow-to-innermost-array} 5913and @option{-fchkp-first-field-has-own-bounds}. Enabled by default. 5914 5915@item -fchkp-first-field-has-own-bounds 5916@opindex fchkp-first-field-has-own-bounds 5917@opindex fno-chkp-first-field-has-own-bounds 5918Forces Pointer Bounds Checker to use narrowed bounds for the address of the 5919first field in the structure. By default a pointer to the first field has 5920the same bounds as a pointer to the whole structure. 5921 5922@item -fchkp-narrow-to-innermost-array 5923@opindex fchkp-narrow-to-innermost-array 5924@opindex fno-chkp-narrow-to-innermost-array 5925Forces Pointer Bounds Checker to use bounds of the innermost arrays in 5926case of nested static array access. By default this option is disabled and 5927bounds of the outermost array are used. 5928 5929@item -fchkp-optimize 5930@opindex fchkp-optimize 5931@opindex fno-chkp-optimize 5932Enables Pointer Bounds Checker optimizations. Enabled by default at 5933optimization levels @option{-O}, @option{-O2}, @option{-O3}. 5934 5935@item -fchkp-use-fast-string-functions 5936@opindex fchkp-use-fast-string-functions 5937@opindex fno-chkp-use-fast-string-functions 5938Enables use of @code{*_nobnd} versions of string functions (not copying bounds) 5939by Pointer Bounds Checker. Disabled by default. 5940 5941@item -fchkp-use-nochk-string-functions 5942@opindex fchkp-use-nochk-string-functions 5943@opindex fno-chkp-use-nochk-string-functions 5944Enables use of @code{*_nochk} versions of string functions (not checking bounds) 5945by Pointer Bounds Checker. Disabled by default. 5946 5947@item -fchkp-use-static-bounds 5948@opindex fchkp-use-static-bounds 5949@opindex fno-chkp-use-static-bounds 5950Allow Pointer Bounds Checker to generate static bounds holding 5951bounds of static variables. Enabled by default. 5952 5953@item -fchkp-use-static-const-bounds 5954@opindex fchkp-use-static-const-bounds 5955@opindex fno-chkp-use-static-const-bounds 5956Use statically-initialized bounds for constant bounds instead of 5957generating them each time they are required. By default enabled when 5958@option{-fchkp-use-static-bounds} is enabled. 5959 5960@item -fchkp-treat-zero-dynamic-size-as-infinite 5961@opindex fchkp-treat-zero-dynamic-size-as-infinite 5962@opindex fno-chkp-treat-zero-dynamic-size-as-infinite 5963With this option, objects with incomplete type whose 5964dynamically-obtained size is zero are treated as having infinite size 5965instead by Pointer Bounds 5966Checker. This option may be helpful if a program is linked with a library 5967missing size information for some symbols. Disabled by default. 5968 5969@item -fchkp-check-read 5970@opindex fchkp-check-read 5971@opindex fno-chkp-check-read 5972Instructs Pointer Bounds Checker to generate checks for all read 5973accesses to memory. Enabled by default. 5974 5975@item -fchkp-check-write 5976@opindex fchkp-check-write 5977@opindex fno-chkp-check-write 5978Instructs Pointer Bounds Checker to generate checks for all write 5979accesses to memory. Enabled by default. 5980 5981@item -fchkp-store-bounds 5982@opindex fchkp-store-bounds 5983@opindex fno-chkp-store-bounds 5984Instructs Pointer Bounds Checker to generate bounds stores for 5985pointer writes. Enabled by default. 5986 5987@item -fchkp-instrument-calls 5988@opindex fchkp-instrument-calls 5989@opindex fno-chkp-instrument-calls 5990Instructs Pointer Bounds Checker to pass pointer bounds to calls. 5991Enabled by default. 5992 5993@item -fchkp-instrument-marked-only 5994@opindex fchkp-instrument-marked-only 5995@opindex fno-chkp-instrument-marked-only 5996Instructs Pointer Bounds Checker to instrument only functions 5997marked with the @code{bnd_instrument} attribute 5998(@pxref{Function Attributes}). Disabled by default. 5999 6000@item -fchkp-use-wrappers 6001@opindex fchkp-use-wrappers 6002@opindex fno-chkp-use-wrappers 6003Allows Pointer Bounds Checker to replace calls to built-in functions 6004with calls to wrapper functions. When @option{-fchkp-use-wrappers} 6005is used to link a program, the GCC driver automatically links 6006against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}. 6007Enabled by default. 6008 6009@item -fdump-final-insns@r{[}=@var{file}@r{]} 6010@opindex fdump-final-insns 6011Dump the final internal representation (RTL) to @var{file}. If the 6012optional argument is omitted (or if @var{file} is @code{.}), the name 6013of the dump file is determined by appending @code{.gkd} to the 6014compilation output file name. 6015 6016@item -fcompare-debug@r{[}=@var{opts}@r{]} 6017@opindex fcompare-debug 6018@opindex fno-compare-debug 6019If no error occurs during compilation, run the compiler a second time, 6020adding @var{opts} and @option{-fcompare-debug-second} to the arguments 6021passed to the second compilation. Dump the final internal 6022representation in both compilations, and print an error if they differ. 6023 6024If the equal sign is omitted, the default @option{-gtoggle} is used. 6025 6026The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 6027and nonzero, implicitly enables @option{-fcompare-debug}. If 6028@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 6029then it is used for @var{opts}, otherwise the default @option{-gtoggle} 6030is used. 6031 6032@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 6033is equivalent to @option{-fno-compare-debug}, which disables the dumping 6034of the final representation and the second compilation, preventing even 6035@env{GCC_COMPARE_DEBUG} from taking effect. 6036 6037To verify full coverage during @option{-fcompare-debug} testing, set 6038@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 6039which GCC rejects as an invalid option in any actual compilation 6040(rather than preprocessing, assembly or linking). To get just a 6041warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 6042not overridden} will do. 6043 6044@item -fcompare-debug-second 6045@opindex fcompare-debug-second 6046This option is implicitly passed to the compiler for the second 6047compilation requested by @option{-fcompare-debug}, along with options to 6048silence warnings, and omitting other options that would cause 6049side-effect compiler outputs to files or to the standard output. Dump 6050files and preserved temporary files are renamed so as to contain the 6051@code{.gk} additional extension during the second compilation, to avoid 6052overwriting those generated by the first. 6053 6054When this option is passed to the compiler driver, it causes the 6055@emph{first} compilation to be skipped, which makes it useful for little 6056other than debugging the compiler proper. 6057 6058@item -feliminate-dwarf2-dups 6059@opindex feliminate-dwarf2-dups 6060Compress DWARF 2 debugging information by eliminating duplicated 6061information about each symbol. This option only makes sense when 6062generating DWARF 2 debugging information with @option{-gdwarf-2}. 6063 6064@item -femit-struct-debug-baseonly 6065@opindex femit-struct-debug-baseonly 6066Emit debug information for struct-like types 6067only when the base name of the compilation source file 6068matches the base name of file in which the struct is defined. 6069 6070This option substantially reduces the size of debugging information, 6071but at significant potential loss in type information to the debugger. 6072See @option{-femit-struct-debug-reduced} for a less aggressive option. 6073See @option{-femit-struct-debug-detailed} for more detailed control. 6074 6075This option works only with DWARF 2. 6076 6077@item -femit-struct-debug-reduced 6078@opindex femit-struct-debug-reduced 6079Emit debug information for struct-like types 6080only when the base name of the compilation source file 6081matches the base name of file in which the type is defined, 6082unless the struct is a template or defined in a system header. 6083 6084This option significantly reduces the size of debugging information, 6085with some potential loss in type information to the debugger. 6086See @option{-femit-struct-debug-baseonly} for a more aggressive option. 6087See @option{-femit-struct-debug-detailed} for more detailed control. 6088 6089This option works only with DWARF 2. 6090 6091@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 6092@opindex femit-struct-debug-detailed 6093Specify the struct-like types 6094for which the compiler generates debug information. 6095The intent is to reduce duplicate struct debug information 6096between different object files within the same program. 6097 6098This option is a detailed version of 6099@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 6100which serves for most needs. 6101 6102A specification has the syntax@* 6103[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 6104 6105The optional first word limits the specification to 6106structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 6107A struct type is used directly when it is the type of a variable, member. 6108Indirect uses arise through pointers to structs. 6109That is, when use of an incomplete struct is valid, the use is indirect. 6110An example is 6111@samp{struct one direct; struct two * indirect;}. 6112 6113The optional second word limits the specification to 6114ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 6115Generic structs are a bit complicated to explain. 6116For C++, these are non-explicit specializations of template classes, 6117or non-template classes within the above. 6118Other programming languages have generics, 6119but @option{-femit-struct-debug-detailed} does not yet implement them. 6120 6121The third word specifies the source files for those 6122structs for which the compiler should emit debug information. 6123The values @samp{none} and @samp{any} have the normal meaning. 6124The value @samp{base} means that 6125the base of name of the file in which the type declaration appears 6126must match the base of the name of the main compilation file. 6127In practice, this means that when compiling @file{foo.c}, debug information 6128is generated for types declared in that file and @file{foo.h}, 6129but not other header files. 6130The value @samp{sys} means those types satisfying @samp{base} 6131or declared in system or compiler headers. 6132 6133You may need to experiment to determine the best settings for your application. 6134 6135The default is @option{-femit-struct-debug-detailed=all}. 6136 6137This option works only with DWARF 2. 6138 6139@item -fno-merge-debug-strings 6140@opindex fmerge-debug-strings 6141@opindex fno-merge-debug-strings 6142Direct the linker to not merge together strings in the debugging 6143information that are identical in different object files. Merging is 6144not supported by all assemblers or linkers. Merging decreases the size 6145of the debug information in the output file at the cost of increasing 6146link processing time. Merging is enabled by default. 6147 6148@item -fdebug-prefix-map=@var{old}=@var{new} 6149@opindex fdebug-prefix-map 6150When compiling files in directory @file{@var{old}}, record debugging 6151information describing them as in @file{@var{new}} instead. 6152 6153@item -fno-dwarf2-cfi-asm 6154@opindex fdwarf2-cfi-asm 6155@opindex fno-dwarf2-cfi-asm 6156Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section 6157instead of using GAS @code{.cfi_*} directives. 6158 6159@cindex @command{prof} 6160@item -p 6161@opindex p 6162Generate extra code to write profile information suitable for the 6163analysis program @command{prof}. You must use this option when compiling 6164the source files you want data about, and you must also use it when 6165linking. 6166 6167@cindex @command{gprof} 6168@item -pg 6169@opindex pg 6170Generate extra code to write profile information suitable for the 6171analysis program @command{gprof}. You must use this option when compiling 6172the source files you want data about, and you must also use it when 6173linking. 6174 6175@item -Q 6176@opindex Q 6177Makes the compiler print out each function name as it is compiled, and 6178print some statistics about each pass when it finishes. 6179 6180@item -ftime-report 6181@opindex ftime-report 6182Makes the compiler print some statistics about the time consumed by each 6183pass when it finishes. 6184 6185@item -fmem-report 6186@opindex fmem-report 6187Makes the compiler print some statistics about permanent memory 6188allocation when it finishes. 6189 6190@item -fmem-report-wpa 6191@opindex fmem-report-wpa 6192Makes the compiler print some statistics about permanent memory 6193allocation for the WPA phase only. 6194 6195@item -fpre-ipa-mem-report 6196@opindex fpre-ipa-mem-report 6197@item -fpost-ipa-mem-report 6198@opindex fpost-ipa-mem-report 6199Makes the compiler print some statistics about permanent memory 6200allocation before or after interprocedural optimization. 6201 6202@item -fprofile-report 6203@opindex fprofile-report 6204Makes the compiler print some statistics about consistency of the 6205(estimated) profile and effect of individual passes. 6206 6207@item -fstack-usage 6208@opindex fstack-usage 6209Makes the compiler output stack usage information for the program, on a 6210per-function basis. The filename for the dump is made by appending 6211@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 6212the output file, if explicitly specified and it is not an executable, 6213otherwise it is the basename of the source file. An entry is made up 6214of three fields: 6215 6216@itemize 6217@item 6218The name of the function. 6219@item 6220A number of bytes. 6221@item 6222One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 6223@end itemize 6224 6225The qualifier @code{static} means that the function manipulates the stack 6226statically: a fixed number of bytes are allocated for the frame on function 6227entry and released on function exit; no stack adjustments are otherwise made 6228in the function. The second field is this fixed number of bytes. 6229 6230The qualifier @code{dynamic} means that the function manipulates the stack 6231dynamically: in addition to the static allocation described above, stack 6232adjustments are made in the body of the function, for example to push/pop 6233arguments around function calls. If the qualifier @code{bounded} is also 6234present, the amount of these adjustments is bounded at compile time and 6235the second field is an upper bound of the total amount of stack used by 6236the function. If it is not present, the amount of these adjustments is 6237not bounded at compile time and the second field only represents the 6238bounded part. 6239 6240@item -fprofile-arcs 6241@opindex fprofile-arcs 6242Add code so that program flow @dfn{arcs} are instrumented. During 6243execution the program records how many times each branch and call is 6244executed and how many times it is taken or returns. When the compiled 6245program exits it saves this data to a file called 6246@file{@var{auxname}.gcda} for each source file. The data may be used for 6247profile-directed optimizations (@option{-fbranch-probabilities}), or for 6248test coverage analysis (@option{-ftest-coverage}). Each object file's 6249@var{auxname} is generated from the name of the output file, if 6250explicitly specified and it is not the final executable, otherwise it is 6251the basename of the source file. In both cases any suffix is removed 6252(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 6253@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 6254@xref{Cross-profiling}. 6255 6256@cindex @command{gcov} 6257@item --coverage 6258@opindex coverage 6259 6260This option is used to compile and link code instrumented for coverage 6261analysis. The option is a synonym for @option{-fprofile-arcs} 6262@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 6263linking). See the documentation for those options for more details. 6264 6265@itemize 6266 6267@item 6268Compile the source files with @option{-fprofile-arcs} plus optimization 6269and code generation options. For test coverage analysis, use the 6270additional @option{-ftest-coverage} option. You do not need to profile 6271every source file in a program. 6272 6273@item 6274Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 6275(the latter implies the former). 6276 6277@item 6278Run the program on a representative workload to generate the arc profile 6279information. This may be repeated any number of times. You can run 6280concurrent instances of your program, and provided that the file system 6281supports locking, the data files will be correctly updated. Also 6282@code{fork} calls are detected and correctly handled (double counting 6283will not happen). 6284 6285@item 6286For profile-directed optimizations, compile the source files again with 6287the same optimization and code generation options plus 6288@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 6289Control Optimization}). 6290 6291@item 6292For test coverage analysis, use @command{gcov} to produce human readable 6293information from the @file{.gcno} and @file{.gcda} files. Refer to the 6294@command{gcov} documentation for further information. 6295 6296@end itemize 6297 6298With @option{-fprofile-arcs}, for each function of your program GCC 6299creates a program flow graph, then finds a spanning tree for the graph. 6300Only arcs that are not on the spanning tree have to be instrumented: the 6301compiler adds code to count the number of times that these arcs are 6302executed. When an arc is the only exit or only entrance to a block, the 6303instrumentation code can be added to the block; otherwise, a new basic 6304block must be created to hold the instrumentation code. 6305 6306@need 2000 6307@item -ftest-coverage 6308@opindex ftest-coverage 6309Produce a notes file that the @command{gcov} code-coverage utility 6310(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 6311show program coverage. Each source file's note file is called 6312@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 6313above for a description of @var{auxname} and instructions on how to 6314generate test coverage data. Coverage data matches the source files 6315more closely if you do not optimize. 6316 6317@item -fdbg-cnt-list 6318@opindex fdbg-cnt-list 6319Print the name and the counter upper bound for all debug counters. 6320 6321 6322@item -fdbg-cnt=@var{counter-value-list} 6323@opindex fdbg-cnt 6324Set the internal debug counter upper bound. @var{counter-value-list} 6325is a comma-separated list of @var{name}:@var{value} pairs 6326which sets the upper bound of each debug counter @var{name} to @var{value}. 6327All debug counters have the initial upper bound of @code{UINT_MAX}; 6328thus @code{dbg_cnt} returns true always unless the upper bound 6329is set by this option. 6330For example, with @option{-fdbg-cnt=dce:10,tail_call:0}, 6331@code{dbg_cnt(dce)} returns true only for first 10 invocations. 6332 6333@item -fenable-@var{kind}-@var{pass} 6334@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 6335@opindex fdisable- 6336@opindex fenable- 6337 6338This is a set of options that are used to explicitly disable/enable 6339optimization passes. These options are intended for use for debugging GCC. 6340Compiler users should use regular options for enabling/disabling 6341passes instead. 6342 6343@table @gcctabopt 6344 6345@item -fdisable-ipa-@var{pass} 6346Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 6347statically invoked in the compiler multiple times, the pass name should be 6348appended with a sequential number starting from 1. 6349 6350@item -fdisable-rtl-@var{pass} 6351@itemx -fdisable-rtl-@var{pass}=@var{range-list} 6352Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 6353statically invoked in the compiler multiple times, the pass name should be 6354appended with a sequential number starting from 1. @var{range-list} is a 6355comma-separated list of function ranges or assembler names. Each range is a number 6356pair separated by a colon. The range is inclusive in both ends. If the range 6357is trivial, the number pair can be simplified as a single number. If the 6358function's call graph node's @var{uid} falls within one of the specified ranges, 6359the @var{pass} is disabled for that function. The @var{uid} is shown in the 6360function header of a dump file, and the pass names can be dumped by using 6361option @option{-fdump-passes}. 6362 6363@item -fdisable-tree-@var{pass} 6364@itemx -fdisable-tree-@var{pass}=@var{range-list} 6365Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 6366option arguments. 6367 6368@item -fenable-ipa-@var{pass} 6369Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 6370statically invoked in the compiler multiple times, the pass name should be 6371appended with a sequential number starting from 1. 6372 6373@item -fenable-rtl-@var{pass} 6374@itemx -fenable-rtl-@var{pass}=@var{range-list} 6375Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 6376description and examples. 6377 6378@item -fenable-tree-@var{pass} 6379@itemx -fenable-tree-@var{pass}=@var{range-list} 6380Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 6381of option arguments. 6382 6383@end table 6384 6385Here are some examples showing uses of these options. 6386 6387@smallexample 6388 6389# disable ccp1 for all functions 6390 -fdisable-tree-ccp1 6391# disable complete unroll for function whose cgraph node uid is 1 6392 -fenable-tree-cunroll=1 6393# disable gcse2 for functions at the following ranges [1,1], 6394# [300,400], and [400,1000] 6395# disable gcse2 for functions foo and foo2 6396 -fdisable-rtl-gcse2=foo,foo2 6397# disable early inlining 6398 -fdisable-tree-einline 6399# disable ipa inlining 6400 -fdisable-ipa-inline 6401# enable tree full unroll 6402 -fenable-tree-unroll 6403 6404@end smallexample 6405 6406@item -d@var{letters} 6407@itemx -fdump-rtl-@var{pass} 6408@itemx -fdump-rtl-@var{pass}=@var{filename} 6409@opindex d 6410@opindex fdump-rtl-@var{pass} 6411Says to make debugging dumps during compilation at times specified by 6412@var{letters}. This is used for debugging the RTL-based passes of the 6413compiler. The file names for most of the dumps are made by appending 6414a pass number and a word to the @var{dumpname}, and the files are 6415created in the directory of the output file. In case of 6416@option{=@var{filename}} option, the dump is output on the given file 6417instead of the pass numbered dump files. Note that the pass number is 6418computed statically as passes get registered into the pass manager. 6419Thus the numbering is not related to the dynamic order of execution of 6420passes. In particular, a pass installed by a plugin could have a 6421number over 200 even if it executed quite early. @var{dumpname} is 6422generated from the name of the output file, if explicitly specified 6423and it is not an executable, otherwise it is the basename of the 6424source file. These switches may have different effects when 6425@option{-E} is used for preprocessing. 6426 6427Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 6428@option{-d} option @var{letters}. Here are the possible 6429letters for use in @var{pass} and @var{letters}, and their meanings: 6430 6431@table @gcctabopt 6432 6433@item -fdump-rtl-alignments 6434@opindex fdump-rtl-alignments 6435Dump after branch alignments have been computed. 6436 6437@item -fdump-rtl-asmcons 6438@opindex fdump-rtl-asmcons 6439Dump after fixing rtl statements that have unsatisfied in/out constraints. 6440 6441@item -fdump-rtl-auto_inc_dec 6442@opindex fdump-rtl-auto_inc_dec 6443Dump after auto-inc-dec discovery. This pass is only run on 6444architectures that have auto inc or auto dec instructions. 6445 6446@item -fdump-rtl-barriers 6447@opindex fdump-rtl-barriers 6448Dump after cleaning up the barrier instructions. 6449 6450@item -fdump-rtl-bbpart 6451@opindex fdump-rtl-bbpart 6452Dump after partitioning hot and cold basic blocks. 6453 6454@item -fdump-rtl-bbro 6455@opindex fdump-rtl-bbro 6456Dump after block reordering. 6457 6458@item -fdump-rtl-btl1 6459@itemx -fdump-rtl-btl2 6460@opindex fdump-rtl-btl2 6461@opindex fdump-rtl-btl2 6462@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 6463after the two branch 6464target load optimization passes. 6465 6466@item -fdump-rtl-bypass 6467@opindex fdump-rtl-bypass 6468Dump after jump bypassing and control flow optimizations. 6469 6470@item -fdump-rtl-combine 6471@opindex fdump-rtl-combine 6472Dump after the RTL instruction combination pass. 6473 6474@item -fdump-rtl-compgotos 6475@opindex fdump-rtl-compgotos 6476Dump after duplicating the computed gotos. 6477 6478@item -fdump-rtl-ce1 6479@itemx -fdump-rtl-ce2 6480@itemx -fdump-rtl-ce3 6481@opindex fdump-rtl-ce1 6482@opindex fdump-rtl-ce2 6483@opindex fdump-rtl-ce3 6484@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 6485@option{-fdump-rtl-ce3} enable dumping after the three 6486if conversion passes. 6487 6488@item -fdump-rtl-cprop_hardreg 6489@opindex fdump-rtl-cprop_hardreg 6490Dump after hard register copy propagation. 6491 6492@item -fdump-rtl-csa 6493@opindex fdump-rtl-csa 6494Dump after combining stack adjustments. 6495 6496@item -fdump-rtl-cse1 6497@itemx -fdump-rtl-cse2 6498@opindex fdump-rtl-cse1 6499@opindex fdump-rtl-cse2 6500@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 6501the two common subexpression elimination passes. 6502 6503@item -fdump-rtl-dce 6504@opindex fdump-rtl-dce 6505Dump after the standalone dead code elimination passes. 6506 6507@item -fdump-rtl-dbr 6508@opindex fdump-rtl-dbr 6509Dump after delayed branch scheduling. 6510 6511@item -fdump-rtl-dce1 6512@itemx -fdump-rtl-dce2 6513@opindex fdump-rtl-dce1 6514@opindex fdump-rtl-dce2 6515@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 6516the two dead store elimination passes. 6517 6518@item -fdump-rtl-eh 6519@opindex fdump-rtl-eh 6520Dump after finalization of EH handling code. 6521 6522@item -fdump-rtl-eh_ranges 6523@opindex fdump-rtl-eh_ranges 6524Dump after conversion of EH handling range regions. 6525 6526@item -fdump-rtl-expand 6527@opindex fdump-rtl-expand 6528Dump after RTL generation. 6529 6530@item -fdump-rtl-fwprop1 6531@itemx -fdump-rtl-fwprop2 6532@opindex fdump-rtl-fwprop1 6533@opindex fdump-rtl-fwprop2 6534@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 6535dumping after the two forward propagation passes. 6536 6537@item -fdump-rtl-gcse1 6538@itemx -fdump-rtl-gcse2 6539@opindex fdump-rtl-gcse1 6540@opindex fdump-rtl-gcse2 6541@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 6542after global common subexpression elimination. 6543 6544@item -fdump-rtl-init-regs 6545@opindex fdump-rtl-init-regs 6546Dump after the initialization of the registers. 6547 6548@item -fdump-rtl-initvals 6549@opindex fdump-rtl-initvals 6550Dump after the computation of the initial value sets. 6551 6552@item -fdump-rtl-into_cfglayout 6553@opindex fdump-rtl-into_cfglayout 6554Dump after converting to cfglayout mode. 6555 6556@item -fdump-rtl-ira 6557@opindex fdump-rtl-ira 6558Dump after iterated register allocation. 6559 6560@item -fdump-rtl-jump 6561@opindex fdump-rtl-jump 6562Dump after the second jump optimization. 6563 6564@item -fdump-rtl-loop2 6565@opindex fdump-rtl-loop2 6566@option{-fdump-rtl-loop2} enables dumping after the rtl 6567loop optimization passes. 6568 6569@item -fdump-rtl-mach 6570@opindex fdump-rtl-mach 6571Dump after performing the machine dependent reorganization pass, if that 6572pass exists. 6573 6574@item -fdump-rtl-mode_sw 6575@opindex fdump-rtl-mode_sw 6576Dump after removing redundant mode switches. 6577 6578@item -fdump-rtl-rnreg 6579@opindex fdump-rtl-rnreg 6580Dump after register renumbering. 6581 6582@item -fdump-rtl-outof_cfglayout 6583@opindex fdump-rtl-outof_cfglayout 6584Dump after converting from cfglayout mode. 6585 6586@item -fdump-rtl-peephole2 6587@opindex fdump-rtl-peephole2 6588Dump after the peephole pass. 6589 6590@item -fdump-rtl-postreload 6591@opindex fdump-rtl-postreload 6592Dump after post-reload optimizations. 6593 6594@item -fdump-rtl-pro_and_epilogue 6595@opindex fdump-rtl-pro_and_epilogue 6596Dump after generating the function prologues and epilogues. 6597 6598@item -fdump-rtl-sched1 6599@itemx -fdump-rtl-sched2 6600@opindex fdump-rtl-sched1 6601@opindex fdump-rtl-sched2 6602@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 6603after the basic block scheduling passes. 6604 6605@item -fdump-rtl-ree 6606@opindex fdump-rtl-ree 6607Dump after sign/zero extension elimination. 6608 6609@item -fdump-rtl-seqabstr 6610@opindex fdump-rtl-seqabstr 6611Dump after common sequence discovery. 6612 6613@item -fdump-rtl-shorten 6614@opindex fdump-rtl-shorten 6615Dump after shortening branches. 6616 6617@item -fdump-rtl-sibling 6618@opindex fdump-rtl-sibling 6619Dump after sibling call optimizations. 6620 6621@item -fdump-rtl-split1 6622@itemx -fdump-rtl-split2 6623@itemx -fdump-rtl-split3 6624@itemx -fdump-rtl-split4 6625@itemx -fdump-rtl-split5 6626@opindex fdump-rtl-split1 6627@opindex fdump-rtl-split2 6628@opindex fdump-rtl-split3 6629@opindex fdump-rtl-split4 6630@opindex fdump-rtl-split5 6631These options enable dumping after five rounds of 6632instruction splitting. 6633 6634@item -fdump-rtl-sms 6635@opindex fdump-rtl-sms 6636Dump after modulo scheduling. This pass is only run on some 6637architectures. 6638 6639@item -fdump-rtl-stack 6640@opindex fdump-rtl-stack 6641Dump after conversion from GCC's ``flat register file'' registers to the 6642x87's stack-like registers. This pass is only run on x86 variants. 6643 6644@item -fdump-rtl-subreg1 6645@itemx -fdump-rtl-subreg2 6646@opindex fdump-rtl-subreg1 6647@opindex fdump-rtl-subreg2 6648@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 6649the two subreg expansion passes. 6650 6651@item -fdump-rtl-unshare 6652@opindex fdump-rtl-unshare 6653Dump after all rtl has been unshared. 6654 6655@item -fdump-rtl-vartrack 6656@opindex fdump-rtl-vartrack 6657Dump after variable tracking. 6658 6659@item -fdump-rtl-vregs 6660@opindex fdump-rtl-vregs 6661Dump after converting virtual registers to hard registers. 6662 6663@item -fdump-rtl-web 6664@opindex fdump-rtl-web 6665Dump after live range splitting. 6666 6667@item -fdump-rtl-regclass 6668@itemx -fdump-rtl-subregs_of_mode_init 6669@itemx -fdump-rtl-subregs_of_mode_finish 6670@itemx -fdump-rtl-dfinit 6671@itemx -fdump-rtl-dfinish 6672@opindex fdump-rtl-regclass 6673@opindex fdump-rtl-subregs_of_mode_init 6674@opindex fdump-rtl-subregs_of_mode_finish 6675@opindex fdump-rtl-dfinit 6676@opindex fdump-rtl-dfinish 6677These dumps are defined but always produce empty files. 6678 6679@item -da 6680@itemx -fdump-rtl-all 6681@opindex da 6682@opindex fdump-rtl-all 6683Produce all the dumps listed above. 6684 6685@item -dA 6686@opindex dA 6687Annotate the assembler output with miscellaneous debugging information. 6688 6689@item -dD 6690@opindex dD 6691Dump all macro definitions, at the end of preprocessing, in addition to 6692normal output. 6693 6694@item -dH 6695@opindex dH 6696Produce a core dump whenever an error occurs. 6697 6698@item -dp 6699@opindex dp 6700Annotate the assembler output with a comment indicating which 6701pattern and alternative is used. The length of each instruction is 6702also printed. 6703 6704@item -dP 6705@opindex dP 6706Dump the RTL in the assembler output as a comment before each instruction. 6707Also turns on @option{-dp} annotation. 6708 6709@item -dx 6710@opindex dx 6711Just generate RTL for a function instead of compiling it. Usually used 6712with @option{-fdump-rtl-expand}. 6713@end table 6714 6715@item -fdump-noaddr 6716@opindex fdump-noaddr 6717When doing debugging dumps, suppress address output. This makes it more 6718feasible to use diff on debugging dumps for compiler invocations with 6719different compiler binaries and/or different 6720text / bss / data / heap / stack / dso start locations. 6721 6722@item -freport-bug 6723@opindex freport-bug 6724Collect and dump debug information into temporary file if ICE in C/C++ 6725compiler occured. 6726 6727@item -fdump-unnumbered 6728@opindex fdump-unnumbered 6729When doing debugging dumps, suppress instruction numbers and address output. 6730This makes it more feasible to use diff on debugging dumps for compiler 6731invocations with different options, in particular with and without 6732@option{-g}. 6733 6734@item -fdump-unnumbered-links 6735@opindex fdump-unnumbered-links 6736When doing debugging dumps (see @option{-d} option above), suppress 6737instruction numbers for the links to the previous and next instructions 6738in a sequence. 6739 6740@item -fdump-translation-unit @r{(C++ only)} 6741@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 6742@opindex fdump-translation-unit 6743Dump a representation of the tree structure for the entire translation 6744unit to a file. The file name is made by appending @file{.tu} to the 6745source file name, and the file is created in the same directory as the 6746output file. If the @samp{-@var{options}} form is used, @var{options} 6747controls the details of the dump as described for the 6748@option{-fdump-tree} options. 6749 6750@item -fdump-class-hierarchy @r{(C++ only)} 6751@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 6752@opindex fdump-class-hierarchy 6753Dump a representation of each class's hierarchy and virtual function 6754table layout to a file. The file name is made by appending 6755@file{.class} to the source file name, and the file is created in the 6756same directory as the output file. If the @samp{-@var{options}} form 6757is used, @var{options} controls the details of the dump as described 6758for the @option{-fdump-tree} options. 6759 6760@item -fdump-ipa-@var{switch} 6761@opindex fdump-ipa 6762Control the dumping at various stages of inter-procedural analysis 6763language tree to a file. The file name is generated by appending a 6764switch specific suffix to the source file name, and the file is created 6765in the same directory as the output file. The following dumps are 6766possible: 6767 6768@table @samp 6769@item all 6770Enables all inter-procedural analysis dumps. 6771 6772@item cgraph 6773Dumps information about call-graph optimization, unused function removal, 6774and inlining decisions. 6775 6776@item inline 6777Dump after function inlining. 6778 6779@end table 6780 6781@item -fdump-passes 6782@opindex fdump-passes 6783Dump the list of optimization passes that are turned on and off by 6784the current command-line options. 6785 6786@item -fdump-statistics-@var{option} 6787@opindex fdump-statistics 6788Enable and control dumping of pass statistics in a separate file. The 6789file name is generated by appending a suffix ending in 6790@samp{.statistics} to the source file name, and the file is created in 6791the same directory as the output file. If the @samp{-@var{option}} 6792form is used, @samp{-stats} causes counters to be summed over the 6793whole compilation unit while @samp{-details} dumps every event as 6794the passes generate them. The default with no option is to sum 6795counters for each function compiled. 6796 6797@item -fdump-tree-@var{switch} 6798@itemx -fdump-tree-@var{switch}-@var{options} 6799@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 6800@opindex fdump-tree 6801Control the dumping at various stages of processing the intermediate 6802language tree to a file. The file name is generated by appending a 6803switch-specific suffix to the source file name, and the file is 6804created in the same directory as the output file. In case of 6805@option{=@var{filename}} option, the dump is output on the given file 6806instead of the auto named dump files. If the @samp{-@var{options}} 6807form is used, @var{options} is a list of @samp{-} separated options 6808which control the details of the dump. Not all options are applicable 6809to all dumps; those that are not meaningful are ignored. The 6810following options are available 6811 6812@table @samp 6813@item address 6814Print the address of each node. Usually this is not meaningful as it 6815changes according to the environment and source file. Its primary use 6816is for tying up a dump file with a debug environment. 6817@item asmname 6818If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 6819in the dump instead of @code{DECL_NAME}. Its primary use is ease of 6820use working backward from mangled names in the assembly file. 6821@item slim 6822When dumping front-end intermediate representations, inhibit dumping 6823of members of a scope or body of a function merely because that scope 6824has been reached. Only dump such items when they are directly reachable 6825by some other path. 6826 6827When dumping pretty-printed trees, this option inhibits dumping the 6828bodies of control structures. 6829 6830When dumping RTL, print the RTL in slim (condensed) form instead of 6831the default LISP-like representation. 6832@item raw 6833Print a raw representation of the tree. By default, trees are 6834pretty-printed into a C-like representation. 6835@item details 6836Enable more detailed dumps (not honored by every dump option). Also 6837include information from the optimization passes. 6838@item stats 6839Enable dumping various statistics about the pass (not honored by every dump 6840option). 6841@item blocks 6842Enable showing basic block boundaries (disabled in raw dumps). 6843@item graph 6844For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 6845dump a representation of the control flow graph suitable for viewing with 6846GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 6847the file is pretty-printed as a subgraph, so that GraphViz can render them 6848all in a single plot. 6849 6850This option currently only works for RTL dumps, and the RTL is always 6851dumped in slim form. 6852@item vops 6853Enable showing virtual operands for every statement. 6854@item lineno 6855Enable showing line numbers for statements. 6856@item uid 6857Enable showing the unique ID (@code{DECL_UID}) for each variable. 6858@item verbose 6859Enable showing the tree dump for each statement. 6860@item eh 6861Enable showing the EH region number holding each statement. 6862@item scev 6863Enable showing scalar evolution analysis details. 6864@item optimized 6865Enable showing optimization information (only available in certain 6866passes). 6867@item missed 6868Enable showing missed optimization information (only available in certain 6869passes). 6870@item note 6871Enable other detailed optimization information (only available in 6872certain passes). 6873@item =@var{filename} 6874Instead of an auto named dump file, output into the given file 6875name. The file names @file{stdout} and @file{stderr} are treated 6876specially and are considered already open standard streams. For 6877example, 6878 6879@smallexample 6880gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump 6881 -fdump-tree-pre=stderr file.c 6882@end smallexample 6883 6884outputs vectorizer dump into @file{foo.dump}, while the PRE dump is 6885output on to @file{stderr}. If two conflicting dump filenames are 6886given for the same pass, then the latter option overrides the earlier 6887one. 6888 6889@item all 6890Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 6891and @option{lineno}. 6892 6893@item optall 6894Turn on all optimization options, i.e., @option{optimized}, 6895@option{missed}, and @option{note}. 6896@end table 6897 6898The following tree dumps are possible: 6899@table @samp 6900 6901@item original 6902@opindex fdump-tree-original 6903Dump before any tree based optimization, to @file{@var{file}.original}. 6904 6905@item optimized 6906@opindex fdump-tree-optimized 6907Dump after all tree based optimization, to @file{@var{file}.optimized}. 6908 6909@item gimple 6910@opindex fdump-tree-gimple 6911Dump each function before and after the gimplification pass to a file. The 6912file name is made by appending @file{.gimple} to the source file name. 6913 6914@item cfg 6915@opindex fdump-tree-cfg 6916Dump the control flow graph of each function to a file. The file name is 6917made by appending @file{.cfg} to the source file name. 6918 6919@item ch 6920@opindex fdump-tree-ch 6921Dump each function after copying loop headers. The file name is made by 6922appending @file{.ch} to the source file name. 6923 6924@item ssa 6925@opindex fdump-tree-ssa 6926Dump SSA related information to a file. The file name is made by appending 6927@file{.ssa} to the source file name. 6928 6929@item alias 6930@opindex fdump-tree-alias 6931Dump aliasing information for each function. The file name is made by 6932appending @file{.alias} to the source file name. 6933 6934@item ccp 6935@opindex fdump-tree-ccp 6936Dump each function after CCP@. The file name is made by appending 6937@file{.ccp} to the source file name. 6938 6939@item storeccp 6940@opindex fdump-tree-storeccp 6941Dump each function after STORE-CCP@. The file name is made by appending 6942@file{.storeccp} to the source file name. 6943 6944@item pre 6945@opindex fdump-tree-pre 6946Dump trees after partial redundancy elimination. The file name is made 6947by appending @file{.pre} to the source file name. 6948 6949@item fre 6950@opindex fdump-tree-fre 6951Dump trees after full redundancy elimination. The file name is made 6952by appending @file{.fre} to the source file name. 6953 6954@item copyprop 6955@opindex fdump-tree-copyprop 6956Dump trees after copy propagation. The file name is made 6957by appending @file{.copyprop} to the source file name. 6958 6959@item store_copyprop 6960@opindex fdump-tree-store_copyprop 6961Dump trees after store copy-propagation. The file name is made 6962by appending @file{.store_copyprop} to the source file name. 6963 6964@item dce 6965@opindex fdump-tree-dce 6966Dump each function after dead code elimination. The file name is made by 6967appending @file{.dce} to the source file name. 6968 6969@item sra 6970@opindex fdump-tree-sra 6971Dump each function after performing scalar replacement of aggregates. The 6972file name is made by appending @file{.sra} to the source file name. 6973 6974@item sink 6975@opindex fdump-tree-sink 6976Dump each function after performing code sinking. The file name is made 6977by appending @file{.sink} to the source file name. 6978 6979@item dom 6980@opindex fdump-tree-dom 6981Dump each function after applying dominator tree optimizations. The file 6982name is made by appending @file{.dom} to the source file name. 6983 6984@item dse 6985@opindex fdump-tree-dse 6986Dump each function after applying dead store elimination. The file 6987name is made by appending @file{.dse} to the source file name. 6988 6989@item phiopt 6990@opindex fdump-tree-phiopt 6991Dump each function after optimizing PHI nodes into straightline code. The file 6992name is made by appending @file{.phiopt} to the source file name. 6993 6994@item forwprop 6995@opindex fdump-tree-forwprop 6996Dump each function after forward propagating single use variables. The file 6997name is made by appending @file{.forwprop} to the source file name. 6998 6999@item copyrename 7000@opindex fdump-tree-copyrename 7001Dump each function after applying the copy rename optimization. The file 7002name is made by appending @file{.copyrename} to the source file name. 7003 7004@item nrv 7005@opindex fdump-tree-nrv 7006Dump each function after applying the named return value optimization on 7007generic trees. The file name is made by appending @file{.nrv} to the source 7008file name. 7009 7010@item vect 7011@opindex fdump-tree-vect 7012Dump each function after applying vectorization of loops. The file name is 7013made by appending @file{.vect} to the source file name. 7014 7015@item slp 7016@opindex fdump-tree-slp 7017Dump each function after applying vectorization of basic blocks. The file name 7018is made by appending @file{.slp} to the source file name. 7019 7020@item vrp 7021@opindex fdump-tree-vrp 7022Dump each function after Value Range Propagation (VRP). The file name 7023is made by appending @file{.vrp} to the source file name. 7024 7025@item all 7026@opindex fdump-tree-all 7027Enable all the available tree dumps with the flags provided in this option. 7028@end table 7029 7030@item -fopt-info 7031@itemx -fopt-info-@var{options} 7032@itemx -fopt-info-@var{options}=@var{filename} 7033@opindex fopt-info 7034Controls optimization dumps from various optimization passes. If the 7035@samp{-@var{options}} form is used, @var{options} is a list of 7036@samp{-} separated option keywords to select the dump details and 7037optimizations. 7038 7039The @var{options} can be divided into two groups: options describing the 7040verbosity of the dump, and options describing which optimizations 7041should be included. The options from both the groups can be freely 7042mixed as they are non-overlapping. However, in case of any conflicts, 7043the later options override the earlier options on the command 7044line. 7045 7046The following options control the dump verbosity: 7047 7048@table @samp 7049@item optimized 7050Print information when an optimization is successfully applied. It is 7051up to a pass to decide which information is relevant. For example, the 7052vectorizer passes print the source location of loops which are 7053successfully vectorized. 7054@item missed 7055Print information about missed optimizations. Individual passes 7056control which information to include in the output. 7057@item note 7058Print verbose information about optimizations, such as certain 7059transformations, more detailed messages about decisions etc. 7060@item all 7061Print detailed optimization information. This includes 7062@samp{optimized}, @samp{missed}, and @samp{note}. 7063@end table 7064 7065One or more of the following option keywords can be used to describe a 7066group of optimizations: 7067 7068@table @samp 7069@item ipa 7070Enable dumps from all interprocedural optimizations. 7071@item loop 7072Enable dumps from all loop optimizations. 7073@item inline 7074Enable dumps from all inlining optimizations. 7075@item vec 7076Enable dumps from all vectorization optimizations. 7077@item optall 7078Enable dumps from all optimizations. This is a superset of 7079the optimization groups listed above. 7080@end table 7081 7082If @var{options} is 7083omitted, it defaults to @samp{optimized-optall}, which means to dump all 7084info about successful optimizations from all the passes. 7085 7086If the @var{filename} is provided, then the dumps from all the 7087applicable optimizations are concatenated into the @var{filename}. 7088Otherwise the dump is output onto @file{stderr}. Though multiple 7089@option{-fopt-info} options are accepted, only one of them can include 7090a @var{filename}. If other filenames are provided then all but the 7091first such option are ignored. 7092 7093Note that the output @var{filename} is overwritten 7094in case of multiple translation units. If a combined output from 7095multiple translation units is desired, @file{stderr} should be used 7096instead. 7097 7098In the following example, the optimization info is output to 7099@file{stderr}: 7100 7101@smallexample 7102gcc -O3 -fopt-info 7103@end smallexample 7104 7105This example: 7106@smallexample 7107gcc -O3 -fopt-info-missed=missed.all 7108@end smallexample 7109 7110@noindent 7111outputs missed optimization report from all the passes into 7112@file{missed.all}, and this one: 7113 7114@smallexample 7115gcc -O2 -ftree-vectorize -fopt-info-vec-missed 7116@end smallexample 7117 7118@noindent 7119prints information about missed optimization opportunities from 7120vectorization passes on @file{stderr}. 7121Note that @option{-fopt-info-vec-missed} is equivalent to 7122@option{-fopt-info-missed-vec}. 7123 7124As another example, 7125@smallexample 7126gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 7127@end smallexample 7128 7129@noindent 7130outputs information about missed optimizations as well as 7131optimized locations from all the inlining passes into 7132@file{inline.txt}. 7133 7134Finally, consider: 7135 7136@smallexample 7137gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 7138@end smallexample 7139 7140@noindent 7141Here the two output filenames @file{vec.miss} and @file{loop.opt} are 7142in conflict since only one output file is allowed. In this case, only 7143the first option takes effect and the subsequent options are 7144ignored. Thus only @file{vec.miss} is produced which contains 7145dumps from the vectorizer about missed opportunities. 7146 7147@item -frandom-seed=@var{string} 7148@opindex frandom-seed 7149This option provides a seed that GCC uses in place of 7150random numbers in generating certain symbol names 7151that have to be different in every compiled file. It is also used to 7152place unique stamps in coverage data files and the object files that 7153produce them. You can use the @option{-frandom-seed} option to produce 7154reproducibly identical object files. 7155 7156The @var{string} can either be a number (decimal, octal or hex) or an 7157arbitrary string (in which case it's converted to a number by 7158computing CRC32). 7159 7160The @var{string} should be different for every file you compile. 7161 7162@item -fsched-verbose=@var{n} 7163@opindex fsched-verbose 7164On targets that use instruction scheduling, this option controls the 7165amount of debugging output the scheduler prints. This information is 7166written to standard error, unless @option{-fdump-rtl-sched1} or 7167@option{-fdump-rtl-sched2} is specified, in which case it is output 7168to the usual dump listing file, @file{.sched1} or @file{.sched2} 7169respectively. However for @var{n} greater than nine, the output is 7170always printed to standard error. 7171 7172For @var{n} greater than zero, @option{-fsched-verbose} outputs the 7173same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 7174For @var{n} greater than one, it also output basic block probabilities, 7175detailed ready list information and unit/insn info. For @var{n} greater 7176than two, it includes RTL at abort point, control-flow and regions info. 7177And for @var{n} over four, @option{-fsched-verbose} also includes 7178dependence info. 7179 7180@item -save-temps 7181@itemx -save-temps=cwd 7182@opindex save-temps 7183Store the usual ``temporary'' intermediate files permanently; place them 7184in the current directory and name them based on the source file. Thus, 7185compiling @file{foo.c} with @option{-c -save-temps} produces files 7186@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 7187preprocessed @file{foo.i} output file even though the compiler now 7188normally uses an integrated preprocessor. 7189 7190When used in combination with the @option{-x} command-line option, 7191@option{-save-temps} is sensible enough to avoid over writing an 7192input source file with the same extension as an intermediate file. 7193The corresponding intermediate file may be obtained by renaming the 7194source file before using @option{-save-temps}. 7195 7196If you invoke GCC in parallel, compiling several different source 7197files that share a common base name in different subdirectories or the 7198same source file compiled for multiple output destinations, it is 7199likely that the different parallel compilers will interfere with each 7200other, and overwrite the temporary files. For instance: 7201 7202@smallexample 7203gcc -save-temps -o outdir1/foo.o indir1/foo.c& 7204gcc -save-temps -o outdir2/foo.o indir2/foo.c& 7205@end smallexample 7206 7207may result in @file{foo.i} and @file{foo.o} being written to 7208simultaneously by both compilers. 7209 7210@item -save-temps=obj 7211@opindex save-temps=obj 7212Store the usual ``temporary'' intermediate files permanently. If the 7213@option{-o} option is used, the temporary files are based on the 7214object file. If the @option{-o} option is not used, the 7215@option{-save-temps=obj} switch behaves like @option{-save-temps}. 7216 7217For example: 7218 7219@smallexample 7220gcc -save-temps=obj -c foo.c 7221gcc -save-temps=obj -c bar.c -o dir/xbar.o 7222gcc -save-temps=obj foobar.c -o dir2/yfoobar 7223@end smallexample 7224 7225@noindent 7226creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, 7227@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and 7228@file{dir2/yfoobar.o}. 7229 7230@item -time@r{[}=@var{file}@r{]} 7231@opindex time 7232Report the CPU time taken by each subprocess in the compilation 7233sequence. For C source files, this is the compiler proper and assembler 7234(plus the linker if linking is done). 7235 7236Without the specification of an output file, the output looks like this: 7237 7238@smallexample 7239# cc1 0.12 0.01 7240# as 0.00 0.01 7241@end smallexample 7242 7243The first number on each line is the ``user time'', that is time spent 7244executing the program itself. The second number is ``system time'', 7245time spent executing operating system routines on behalf of the program. 7246Both numbers are in seconds. 7247 7248With the specification of an output file, the output is appended to the 7249named file, and it looks like this: 7250 7251@smallexample 72520.12 0.01 cc1 @var{options} 72530.00 0.01 as @var{options} 7254@end smallexample 7255 7256The ``user time'' and the ``system time'' are moved before the program 7257name, and the options passed to the program are displayed, so that one 7258can later tell what file was being compiled, and with which options. 7259 7260@item -fvar-tracking 7261@opindex fvar-tracking 7262Run variable tracking pass. It computes where variables are stored at each 7263position in code. Better debugging information is then generated 7264(if the debugging information format supports this information). 7265 7266It is enabled by default when compiling with optimization (@option{-Os}, 7267@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 7268the debug info format supports it. 7269 7270@item -fvar-tracking-assignments 7271@opindex fvar-tracking-assignments 7272@opindex fno-var-tracking-assignments 7273Annotate assignments to user variables early in the compilation and 7274attempt to carry the annotations over throughout the compilation all the 7275way to the end, in an attempt to improve debug information while 7276optimizing. Use of @option{-gdwarf-4} is recommended along with it. 7277 7278It can be enabled even if var-tracking is disabled, in which case 7279annotations are created and maintained, but discarded at the end. 7280By default, this flag is enabled together with @option{-fvar-tracking}, 7281except when selective scheduling is enabled. 7282 7283@item -fvar-tracking-assignments-toggle 7284@opindex fvar-tracking-assignments-toggle 7285@opindex fno-var-tracking-assignments-toggle 7286Toggle @option{-fvar-tracking-assignments}, in the same way that 7287@option{-gtoggle} toggles @option{-g}. 7288 7289@item -print-file-name=@var{library} 7290@opindex print-file-name 7291Print the full absolute name of the library file @var{library} that 7292would be used when linking---and don't do anything else. With this 7293option, GCC does not compile or link anything; it just prints the 7294file name. 7295 7296@item -print-multi-directory 7297@opindex print-multi-directory 7298Print the directory name corresponding to the multilib selected by any 7299other switches present in the command line. This directory is supposed 7300to exist in @env{GCC_EXEC_PREFIX}. 7301 7302@item -print-multi-lib 7303@opindex print-multi-lib 7304Print the mapping from multilib directory names to compiler switches 7305that enable them. The directory name is separated from the switches by 7306@samp{;}, and each switch starts with an @samp{@@} instead of the 7307@samp{-}, without spaces between multiple switches. This is supposed to 7308ease shell processing. 7309 7310@item -print-multi-os-directory 7311@opindex print-multi-os-directory 7312Print the path to OS libraries for the selected 7313multilib, relative to some @file{lib} subdirectory. If OS libraries are 7314present in the @file{lib} subdirectory and no multilibs are used, this is 7315usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 7316sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 7317@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 7318subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 7319 7320@item -print-multiarch 7321@opindex print-multiarch 7322Print the path to OS libraries for the selected multiarch, 7323relative to some @file{lib} subdirectory. 7324 7325@item -print-prog-name=@var{program} 7326@opindex print-prog-name 7327Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 7328 7329@item -print-libgcc-file-name 7330@opindex print-libgcc-file-name 7331Same as @option{-print-file-name=libgcc.a}. 7332 7333This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 7334but you do want to link with @file{libgcc.a}. You can do: 7335 7336@smallexample 7337gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 7338@end smallexample 7339 7340@item -print-search-dirs 7341@opindex print-search-dirs 7342Print the name of the configured installation directory and a list of 7343program and library directories @command{gcc} searches---and don't do anything else. 7344 7345This is useful when @command{gcc} prints the error message 7346@samp{installation problem, cannot exec cpp0: No such file or directory}. 7347To resolve this you either need to put @file{cpp0} and the other compiler 7348components where @command{gcc} expects to find them, or you can set the environment 7349variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 7350Don't forget the trailing @samp{/}. 7351@xref{Environment Variables}. 7352 7353@item -print-sysroot 7354@opindex print-sysroot 7355Print the target sysroot directory that is used during 7356compilation. This is the target sysroot specified either at configure 7357time or using the @option{--sysroot} option, possibly with an extra 7358suffix that depends on compilation options. If no target sysroot is 7359specified, the option prints nothing. 7360 7361@item -print-sysroot-headers-suffix 7362@opindex print-sysroot-headers-suffix 7363Print the suffix added to the target sysroot when searching for 7364headers, or give an error if the compiler is not configured with such 7365a suffix---and don't do anything else. 7366 7367@item -dumpmachine 7368@opindex dumpmachine 7369Print the compiler's target machine (for example, 7370@samp{i686-pc-linux-gnu})---and don't do anything else. 7371 7372@item -dumpversion 7373@opindex dumpversion 7374Print the compiler version (for example, @code{3.0})---and don't do 7375anything else. 7376 7377@item -dumpspecs 7378@opindex dumpspecs 7379Print the compiler's built-in specs---and don't do anything else. (This 7380is used when GCC itself is being built.) @xref{Spec Files}. 7381 7382@item -fno-eliminate-unused-debug-types 7383@opindex feliminate-unused-debug-types 7384@opindex fno-eliminate-unused-debug-types 7385Normally, when producing DWARF 2 output, GCC avoids producing debug symbol 7386output for types that are nowhere used in the source file being compiled. 7387Sometimes it is useful to have GCC emit debugging 7388information for all types declared in a compilation 7389unit, regardless of whether or not they are actually used 7390in that compilation unit, for example 7391if, in the debugger, you want to cast a value to a type that is 7392not actually used in your program (but is declared). More often, 7393however, this results in a significant amount of wasted space. 7394@end table 7395 7396@node Optimize Options 7397@section Options That Control Optimization 7398@cindex optimize options 7399@cindex options, optimization 7400 7401These options control various sorts of optimizations. 7402 7403Without any optimization option, the compiler's goal is to reduce the 7404cost of compilation and to make debugging produce the expected 7405results. Statements are independent: if you stop the program with a 7406breakpoint between statements, you can then assign a new value to any 7407variable or change the program counter to any other statement in the 7408function and get exactly the results you expect from the source 7409code. 7410 7411Turning on optimization flags makes the compiler attempt to improve 7412the performance and/or code size at the expense of compilation time 7413and possibly the ability to debug the program. 7414 7415The compiler performs optimization based on the knowledge it has of the 7416program. Compiling multiple files at once to a single output file mode allows 7417the compiler to use information gained from all of the files when compiling 7418each of them. 7419 7420Not all optimizations are controlled directly by a flag. Only 7421optimizations that have a flag are listed in this section. 7422 7423Most optimizations are only enabled if an @option{-O} level is set on 7424the command line. Otherwise they are disabled, even if individual 7425optimization flags are specified. 7426 7427Depending on the target and how GCC was configured, a slightly different 7428set of optimizations may be enabled at each @option{-O} level than 7429those listed here. You can invoke GCC with @option{-Q --help=optimizers} 7430to find out the exact set of optimizations that are enabled at each level. 7431@xref{Overall Options}, for examples. 7432 7433@table @gcctabopt 7434@item -O 7435@itemx -O1 7436@opindex O 7437@opindex O1 7438Optimize. Optimizing compilation takes somewhat more time, and a lot 7439more memory for a large function. 7440 7441With @option{-O}, the compiler tries to reduce code size and execution 7442time, without performing any optimizations that take a great deal of 7443compilation time. 7444 7445@option{-O} turns on the following optimization flags: 7446@gccoptlist{ 7447-fauto-inc-dec @gol 7448-fbranch-count-reg @gol 7449-fcombine-stack-adjustments @gol 7450-fcompare-elim @gol 7451-fcprop-registers @gol 7452-fdce @gol 7453-fdefer-pop @gol 7454-fdelayed-branch @gol 7455-fdse @gol 7456-fforward-propagate @gol 7457-fguess-branch-probability @gol 7458-fif-conversion2 @gol 7459-fif-conversion @gol 7460-finline-functions-called-once @gol 7461-fipa-pure-const @gol 7462-fipa-profile @gol 7463-fipa-reference @gol 7464-fmerge-constants @gol 7465-fmove-loop-invariants @gol 7466-fshrink-wrap @gol 7467-fsplit-wide-types @gol 7468-ftree-bit-ccp @gol 7469-ftree-ccp @gol 7470-fssa-phiopt @gol 7471-ftree-ch @gol 7472-ftree-copy-prop @gol 7473-ftree-copyrename @gol 7474-ftree-dce @gol 7475-ftree-dominator-opts @gol 7476-ftree-dse @gol 7477-ftree-forwprop @gol 7478-ftree-fre @gol 7479-ftree-phiprop @gol 7480-ftree-sink @gol 7481-ftree-slsr @gol 7482-ftree-sra @gol 7483-ftree-pta @gol 7484-ftree-ter @gol 7485-funit-at-a-time} 7486 7487@option{-O} also turns on @option{-fomit-frame-pointer} on machines 7488where doing so does not interfere with debugging. 7489 7490@item -O2 7491@opindex O2 7492Optimize even more. GCC performs nearly all supported optimizations 7493that do not involve a space-speed tradeoff. 7494As compared to @option{-O}, this option increases both compilation time 7495and the performance of the generated code. 7496 7497@option{-O2} turns on all optimization flags specified by @option{-O}. It 7498also turns on the following optimization flags: 7499@gccoptlist{-fthread-jumps @gol 7500-falign-functions -falign-jumps @gol 7501-falign-loops -falign-labels @gol 7502-fcaller-saves @gol 7503-fcrossjumping @gol 7504-fcse-follow-jumps -fcse-skip-blocks @gol 7505-fdelete-null-pointer-checks @gol 7506-fdevirtualize -fdevirtualize-speculatively @gol 7507-fexpensive-optimizations @gol 7508-fgcse -fgcse-lm @gol 7509-fhoist-adjacent-loads @gol 7510-finline-small-functions @gol 7511-findirect-inlining @gol 7512-fipa-cp @gol 7513-fipa-cp-alignment @gol 7514-fipa-sra @gol 7515-fipa-icf @gol 7516-fisolate-erroneous-paths-dereference @gol 7517-flra-remat @gol 7518-foptimize-sibling-calls @gol 7519-foptimize-strlen @gol 7520-fpartial-inlining @gol 7521-fpeephole2 @gol 7522-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 7523-frerun-cse-after-loop @gol 7524-fsched-interblock -fsched-spec @gol 7525-fschedule-insns -fschedule-insns2 @gol 7526-fstrict-aliasing -fstrict-overflow @gol 7527-ftree-builtin-call-dce @gol 7528-ftree-switch-conversion -ftree-tail-merge @gol 7529-ftree-pre @gol 7530-ftree-vrp @gol 7531-fipa-ra} 7532 7533Please note the warning under @option{-fgcse} about 7534invoking @option{-O2} on programs that use computed gotos. 7535 7536@item -O3 7537@opindex O3 7538Optimize yet more. @option{-O3} turns on all optimizations specified 7539by @option{-O2} and also turns on the @option{-finline-functions}, 7540@option{-funswitch-loops}, @option{-fpredictive-commoning}, 7541@option{-fgcse-after-reload}, @option{-ftree-loop-vectorize}, 7542@option{-ftree-loop-distribute-patterns}, 7543@option{-ftree-slp-vectorize}, @option{-fvect-cost-model}, 7544@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options. 7545 7546@item -O0 7547@opindex O0 7548Reduce compilation time and make debugging produce the expected 7549results. This is the default. 7550 7551@item -Os 7552@opindex Os 7553Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 7554do not typically increase code size. It also performs further 7555optimizations designed to reduce code size. 7556 7557@option{-Os} disables the following optimization flags: 7558@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 7559-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 7560-fprefetch-loop-arrays} 7561 7562@item -Ofast 7563@opindex Ofast 7564Disregard strict standards compliance. @option{-Ofast} enables all 7565@option{-O3} optimizations. It also enables optimizations that are not 7566valid for all standard-compliant programs. 7567It turns on @option{-ffast-math} and the Fortran-specific 7568@option{-fno-protect-parens} and @option{-fstack-arrays}. 7569 7570@item -Og 7571@opindex Og 7572Optimize debugging experience. @option{-Og} enables optimizations 7573that do not interfere with debugging. It should be the optimization 7574level of choice for the standard edit-compile-debug cycle, offering 7575a reasonable level of optimization while maintaining fast compilation 7576and a good debugging experience. 7577 7578If you use multiple @option{-O} options, with or without level numbers, 7579the last such option is the one that is effective. 7580@end table 7581 7582Options of the form @option{-f@var{flag}} specify machine-independent 7583flags. Most flags have both positive and negative forms; the negative 7584form of @option{-ffoo} is @option{-fno-foo}. In the table 7585below, only one of the forms is listed---the one you typically 7586use. You can figure out the other form by either removing @samp{no-} 7587or adding it. 7588 7589The following options control specific optimizations. They are either 7590activated by @option{-O} options or are related to ones that are. You 7591can use the following flags in the rare cases when ``fine-tuning'' of 7592optimizations to be performed is desired. 7593 7594@table @gcctabopt 7595@item -fno-defer-pop 7596@opindex fno-defer-pop 7597Always pop the arguments to each function call as soon as that function 7598returns. For machines that must pop arguments after a function call, 7599the compiler normally lets arguments accumulate on the stack for several 7600function calls and pops them all at once. 7601 7602Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7603 7604@item -fforward-propagate 7605@opindex fforward-propagate 7606Perform a forward propagation pass on RTL@. The pass tries to combine two 7607instructions and checks if the result can be simplified. If loop unrolling 7608is active, two passes are performed and the second is scheduled after 7609loop unrolling. 7610 7611This option is enabled by default at optimization levels @option{-O}, 7612@option{-O2}, @option{-O3}, @option{-Os}. 7613 7614@item -ffp-contract=@var{style} 7615@opindex ffp-contract 7616@option{-ffp-contract=off} disables floating-point expression contraction. 7617@option{-ffp-contract=fast} enables floating-point expression contraction 7618such as forming of fused multiply-add operations if the target has 7619native support for them. 7620@option{-ffp-contract=on} enables floating-point expression contraction 7621if allowed by the language standard. This is currently not implemented 7622and treated equal to @option{-ffp-contract=off}. 7623 7624The default is @option{-ffp-contract=fast}. 7625 7626@item -fomit-frame-pointer 7627@opindex fomit-frame-pointer 7628Don't keep the frame pointer in a register for functions that 7629don't need one. This avoids the instructions to save, set up and 7630restore frame pointers; it also makes an extra register available 7631in many functions. @strong{It also makes debugging impossible on 7632some machines.} 7633 7634On some machines, such as the VAX, this flag has no effect, because 7635the standard calling sequence automatically handles the frame pointer 7636and nothing is saved by pretending it doesn't exist. The 7637machine-description macro @code{FRAME_POINTER_REQUIRED} controls 7638whether a target machine supports this flag. @xref{Registers,,Register 7639Usage, gccint, GNU Compiler Collection (GCC) Internals}. 7640 7641The default setting (when not optimizing for 7642size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is 7643@option{-fomit-frame-pointer}. You can configure GCC with the 7644@option{--enable-frame-pointer} configure option to change the default. 7645 7646Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7647 7648@item -foptimize-sibling-calls 7649@opindex foptimize-sibling-calls 7650Optimize sibling and tail recursive calls. 7651 7652Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7653 7654@item -foptimize-strlen 7655@opindex foptimize-strlen 7656Optimize various standard C string functions (e.g. @code{strlen}, 7657@code{strchr} or @code{strcpy}) and 7658their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 7659 7660Enabled at levels @option{-O2}, @option{-O3}. 7661 7662@item -fno-inline 7663@opindex fno-inline 7664Do not expand any functions inline apart from those marked with 7665the @code{always_inline} attribute. This is the default when not 7666optimizing. 7667 7668Single functions can be exempted from inlining by marking them 7669with the @code{noinline} attribute. 7670 7671@item -finline-small-functions 7672@opindex finline-small-functions 7673Integrate functions into their callers when their body is smaller than expected 7674function call code (so overall size of program gets smaller). The compiler 7675heuristically decides which functions are simple enough to be worth integrating 7676in this way. This inlining applies to all functions, even those not declared 7677inline. 7678 7679Enabled at level @option{-O2}. 7680 7681@item -findirect-inlining 7682@opindex findirect-inlining 7683Inline also indirect calls that are discovered to be known at compile 7684time thanks to previous inlining. This option has any effect only 7685when inlining itself is turned on by the @option{-finline-functions} 7686or @option{-finline-small-functions} options. 7687 7688Enabled at level @option{-O2}. 7689 7690@item -finline-functions 7691@opindex finline-functions 7692Consider all functions for inlining, even if they are not declared inline. 7693The compiler heuristically decides which functions are worth integrating 7694in this way. 7695 7696If all calls to a given function are integrated, and the function is 7697declared @code{static}, then the function is normally not output as 7698assembler code in its own right. 7699 7700Enabled at level @option{-O3}. 7701 7702@item -finline-functions-called-once 7703@opindex finline-functions-called-once 7704Consider all @code{static} functions called once for inlining into their 7705caller even if they are not marked @code{inline}. If a call to a given 7706function is integrated, then the function is not output as assembler code 7707in its own right. 7708 7709Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. 7710 7711@item -fearly-inlining 7712@opindex fearly-inlining 7713Inline functions marked by @code{always_inline} and functions whose body seems 7714smaller than the function call overhead early before doing 7715@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 7716makes profiling significantly cheaper and usually inlining faster on programs 7717having large chains of nested wrapper functions. 7718 7719Enabled by default. 7720 7721@item -fipa-sra 7722@opindex fipa-sra 7723Perform interprocedural scalar replacement of aggregates, removal of 7724unused parameters and replacement of parameters passed by reference 7725by parameters passed by value. 7726 7727Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 7728 7729@item -finline-limit=@var{n} 7730@opindex finline-limit 7731By default, GCC limits the size of functions that can be inlined. This flag 7732allows coarse control of this limit. @var{n} is the size of functions that 7733can be inlined in number of pseudo instructions. 7734 7735Inlining is actually controlled by a number of parameters, which may be 7736specified individually by using @option{--param @var{name}=@var{value}}. 7737The @option{-finline-limit=@var{n}} option sets some of these parameters 7738as follows: 7739 7740@table @gcctabopt 7741@item max-inline-insns-single 7742is set to @var{n}/2. 7743@item max-inline-insns-auto 7744is set to @var{n}/2. 7745@end table 7746 7747See below for a documentation of the individual 7748parameters controlling inlining and for the defaults of these parameters. 7749 7750@emph{Note:} there may be no value to @option{-finline-limit} that results 7751in default behavior. 7752 7753@emph{Note:} pseudo instruction represents, in this particular context, an 7754abstract measurement of function's size. In no way does it represent a count 7755of assembly instructions and as such its exact meaning might change from one 7756release to an another. 7757 7758@item -fno-keep-inline-dllexport 7759@opindex fno-keep-inline-dllexport 7760This is a more fine-grained version of @option{-fkeep-inline-functions}, 7761which applies only to functions that are declared using the @code{dllexport} 7762attribute or declspec (@xref{Function Attributes,,Declaring Attributes of 7763Functions}.) 7764 7765@item -fkeep-inline-functions 7766@opindex fkeep-inline-functions 7767In C, emit @code{static} functions that are declared @code{inline} 7768into the object file, even if the function has been inlined into all 7769of its callers. This switch does not affect functions using the 7770@code{extern inline} extension in GNU C90@. In C++, emit any and all 7771inline functions into the object file. 7772 7773@item -fkeep-static-consts 7774@opindex fkeep-static-consts 7775Emit variables declared @code{static const} when optimization isn't turned 7776on, even if the variables aren't referenced. 7777 7778GCC enables this option by default. If you want to force the compiler to 7779check if a variable is referenced, regardless of whether or not 7780optimization is turned on, use the @option{-fno-keep-static-consts} option. 7781 7782@item -fmerge-constants 7783@opindex fmerge-constants 7784Attempt to merge identical constants (string constants and floating-point 7785constants) across compilation units. 7786 7787This option is the default for optimized compilation if the assembler and 7788linker support it. Use @option{-fno-merge-constants} to inhibit this 7789behavior. 7790 7791Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7792 7793@item -fmerge-all-constants 7794@opindex fmerge-all-constants 7795Attempt to merge identical constants and identical variables. 7796 7797This option implies @option{-fmerge-constants}. In addition to 7798@option{-fmerge-constants} this considers e.g.@: even constant initialized 7799arrays or initialized constant variables with integral or floating-point 7800types. Languages like C or C++ require each variable, including multiple 7801instances of the same variable in recursive calls, to have distinct locations, 7802so using this option results in non-conforming 7803behavior. 7804 7805@item -fmodulo-sched 7806@opindex fmodulo-sched 7807Perform swing modulo scheduling immediately before the first scheduling 7808pass. This pass looks at innermost loops and reorders their 7809instructions by overlapping different iterations. 7810 7811@item -fmodulo-sched-allow-regmoves 7812@opindex fmodulo-sched-allow-regmoves 7813Perform more aggressive SMS-based modulo scheduling with register moves 7814allowed. By setting this flag certain anti-dependences edges are 7815deleted, which triggers the generation of reg-moves based on the 7816life-range analysis. This option is effective only with 7817@option{-fmodulo-sched} enabled. 7818 7819@item -fno-branch-count-reg 7820@opindex fno-branch-count-reg 7821Do not use ``decrement and branch'' instructions on a count register, 7822but instead generate a sequence of instructions that decrement a 7823register, compare it against zero, then branch based upon the result. 7824This option is only meaningful on architectures that support such 7825instructions, which include x86, PowerPC, IA-64 and S/390. 7826 7827Enabled by default at @option{-O1} and higher. 7828 7829The default is @option{-fbranch-count-reg}. 7830 7831@item -fno-function-cse 7832@opindex fno-function-cse 7833Do not put function addresses in registers; make each instruction that 7834calls a constant function contain the function's address explicitly. 7835 7836This option results in less efficient code, but some strange hacks 7837that alter the assembler output may be confused by the optimizations 7838performed when this option is not used. 7839 7840The default is @option{-ffunction-cse} 7841 7842@item -fno-zero-initialized-in-bss 7843@opindex fno-zero-initialized-in-bss 7844If the target supports a BSS section, GCC by default puts variables that 7845are initialized to zero into BSS@. This can save space in the resulting 7846code. 7847 7848This option turns off this behavior because some programs explicitly 7849rely on variables going to the data section---e.g., so that the 7850resulting executable can find the beginning of that section and/or make 7851assumptions based on that. 7852 7853The default is @option{-fzero-initialized-in-bss}. 7854 7855@item -fthread-jumps 7856@opindex fthread-jumps 7857Perform optimizations that check to see if a jump branches to a 7858location where another comparison subsumed by the first is found. If 7859so, the first branch is redirected to either the destination of the 7860second branch or a point immediately following it, depending on whether 7861the condition is known to be true or false. 7862 7863Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7864 7865@item -fsplit-wide-types 7866@opindex fsplit-wide-types 7867When using a type that occupies multiple registers, such as @code{long 7868long} on a 32-bit system, split the registers apart and allocate them 7869independently. This normally generates better code for those types, 7870but may make debugging more difficult. 7871 7872Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 7873@option{-Os}. 7874 7875@item -fcse-follow-jumps 7876@opindex fcse-follow-jumps 7877In common subexpression elimination (CSE), scan through jump instructions 7878when the target of the jump is not reached by any other path. For 7879example, when CSE encounters an @code{if} statement with an 7880@code{else} clause, CSE follows the jump when the condition 7881tested is false. 7882 7883Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7884 7885@item -fcse-skip-blocks 7886@opindex fcse-skip-blocks 7887This is similar to @option{-fcse-follow-jumps}, but causes CSE to 7888follow jumps that conditionally skip over blocks. When CSE 7889encounters a simple @code{if} statement with no else clause, 7890@option{-fcse-skip-blocks} causes CSE to follow the jump around the 7891body of the @code{if}. 7892 7893Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7894 7895@item -frerun-cse-after-loop 7896@opindex frerun-cse-after-loop 7897Re-run common subexpression elimination after loop optimizations are 7898performed. 7899 7900Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7901 7902@item -fgcse 7903@opindex fgcse 7904Perform a global common subexpression elimination pass. 7905This pass also performs global constant and copy propagation. 7906 7907@emph{Note:} When compiling a program using computed gotos, a GCC 7908extension, you may get better run-time performance if you disable 7909the global common subexpression elimination pass by adding 7910@option{-fno-gcse} to the command line. 7911 7912Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7913 7914@item -fgcse-lm 7915@opindex fgcse-lm 7916When @option{-fgcse-lm} is enabled, global common subexpression elimination 7917attempts to move loads that are only killed by stores into themselves. This 7918allows a loop containing a load/store sequence to be changed to a load outside 7919the loop, and a copy/store within the loop. 7920 7921Enabled by default when @option{-fgcse} is enabled. 7922 7923@item -fgcse-sm 7924@opindex fgcse-sm 7925When @option{-fgcse-sm} is enabled, a store motion pass is run after 7926global common subexpression elimination. This pass attempts to move 7927stores out of loops. When used in conjunction with @option{-fgcse-lm}, 7928loops containing a load/store sequence can be changed to a load before 7929the loop and a store after the loop. 7930 7931Not enabled at any optimization level. 7932 7933@item -fgcse-las 7934@opindex fgcse-las 7935When @option{-fgcse-las} is enabled, the global common subexpression 7936elimination pass eliminates redundant loads that come after stores to the 7937same memory location (both partial and full redundancies). 7938 7939Not enabled at any optimization level. 7940 7941@item -fgcse-after-reload 7942@opindex fgcse-after-reload 7943When @option{-fgcse-after-reload} is enabled, a redundant load elimination 7944pass is performed after reload. The purpose of this pass is to clean up 7945redundant spilling. 7946 7947@item -faggressive-loop-optimizations 7948@opindex faggressive-loop-optimizations 7949This option tells the loop optimizer to use language constraints to 7950derive bounds for the number of iterations of a loop. This assumes that 7951loop code does not invoke undefined behavior by for example causing signed 7952integer overflows or out-of-bound array accesses. The bounds for the 7953number of iterations of a loop are used to guide loop unrolling and peeling 7954and loop exit test optimizations. 7955This option is enabled by default. 7956 7957@item -funsafe-loop-optimizations 7958@opindex funsafe-loop-optimizations 7959This option tells the loop optimizer to assume that loop indices do not 7960overflow, and that loops with nontrivial exit condition are not 7961infinite. This enables a wider range of loop optimizations even if 7962the loop optimizer itself cannot prove that these assumptions are valid. 7963If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you 7964if it finds this kind of loop. 7965 7966@item -fcrossjumping 7967@opindex fcrossjumping 7968Perform cross-jumping transformation. 7969This transformation unifies equivalent code and saves code size. The 7970resulting code may or may not perform better than without cross-jumping. 7971 7972Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7973 7974@item -fauto-inc-dec 7975@opindex fauto-inc-dec 7976Combine increments or decrements of addresses with memory accesses. 7977This pass is always skipped on architectures that do not have 7978instructions to support this. Enabled by default at @option{-O} and 7979higher on architectures that support this. 7980 7981@item -fdce 7982@opindex fdce 7983Perform dead code elimination (DCE) on RTL@. 7984Enabled by default at @option{-O} and higher. 7985 7986@item -fdse 7987@opindex fdse 7988Perform dead store elimination (DSE) on RTL@. 7989Enabled by default at @option{-O} and higher. 7990 7991@item -fif-conversion 7992@opindex fif-conversion 7993Attempt to transform conditional jumps into branch-less equivalents. This 7994includes use of conditional moves, min, max, set flags and abs instructions, and 7995some tricks doable by standard arithmetics. The use of conditional execution 7996on chips where it is available is controlled by @option{-fif-conversion2}. 7997 7998Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7999 8000@item -fif-conversion2 8001@opindex fif-conversion2 8002Use conditional execution (where available) to transform conditional jumps into 8003branch-less equivalents. 8004 8005Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8006 8007@item -fdeclone-ctor-dtor 8008@opindex fdeclone-ctor-dtor 8009The C++ ABI requires multiple entry points for constructors and 8010destructors: one for a base subobject, one for a complete object, and 8011one for a virtual destructor that calls operator delete afterwards. 8012For a hierarchy with virtual bases, the base and complete variants are 8013clones, which means two copies of the function. With this option, the 8014base and complete variants are changed to be thunks that call a common 8015implementation. 8016 8017Enabled by @option{-Os}. 8018 8019@item -fdelete-null-pointer-checks 8020@opindex fdelete-null-pointer-checks 8021Assume that programs cannot safely dereference null pointers, and that 8022no code or data element resides there. This enables simple constant 8023folding optimizations at all optimization levels. In addition, other 8024optimization passes in GCC use this flag to control global dataflow 8025analyses that eliminate useless checks for null pointers; these assume 8026that if a pointer is checked after it has already been dereferenced, 8027it cannot be null. 8028 8029Note however that in some environments this assumption is not true. 8030Use @option{-fno-delete-null-pointer-checks} to disable this optimization 8031for programs that depend on that behavior. 8032 8033Some targets, especially embedded ones, disable this option at all levels. 8034Otherwise it is enabled at all levels: @option{-O0}, @option{-O1}, 8035@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information 8036are enabled independently at different optimization levels. 8037 8038@item -fdevirtualize 8039@opindex fdevirtualize 8040Attempt to convert calls to virtual functions to direct calls. This 8041is done both within a procedure and interprocedurally as part of 8042indirect inlining (@option{-findirect-inlining}) and interprocedural constant 8043propagation (@option{-fipa-cp}). 8044Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8045 8046@item -fdevirtualize-speculatively 8047@opindex fdevirtualize-speculatively 8048Attempt to convert calls to virtual functions to speculative direct calls. 8049Based on the analysis of the type inheritance graph, determine for a given call 8050the set of likely targets. If the set is small, preferably of size 1, change 8051the call into a conditional deciding between direct and indirect calls. The 8052speculative calls enable more optimizations, such as inlining. When they seem 8053useless after further optimization, they are converted back into original form. 8054 8055@item -fdevirtualize-at-ltrans 8056@opindex fdevirtualize-at-ltrans 8057Stream extra information needed for aggressive devirtualization when running 8058the link-time optimizer in local transformation mode. 8059This option enables more devirtualization but 8060significantly increases the size of streamed data. For this reason it is 8061disabled by default. 8062 8063@item -fexpensive-optimizations 8064@opindex fexpensive-optimizations 8065Perform a number of minor optimizations that are relatively expensive. 8066 8067Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8068 8069@item -free 8070@opindex free 8071Attempt to remove redundant extension instructions. This is especially 8072helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 8073registers after writing to their lower 32-bit half. 8074 8075Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 8076@option{-O3}, @option{-Os}. 8077 8078@item -fno-lifetime-dse 8079@opindex fno-lifetime-dse 8080In C++ the value of an object is only affected by changes within its 8081lifetime: when the constructor begins, the object has an indeterminate 8082value, and any changes during the lifetime of the object are dead when 8083the object is destroyed. Normally dead store elimination will take 8084advantage of this; if your code relies on the value of the object 8085storage persisting beyond the lifetime of the object, you can use this 8086flag to disable this optimization. 8087 8088@item -flive-range-shrinkage 8089@opindex flive-range-shrinkage 8090Attempt to decrease register pressure through register live range 8091shrinkage. This is helpful for fast processors with small or moderate 8092size register sets. 8093 8094@item -fira-algorithm=@var{algorithm} 8095@opindex fira-algorithm 8096Use the specified coloring algorithm for the integrated register 8097allocator. The @var{algorithm} argument can be @samp{priority}, which 8098specifies Chow's priority coloring, or @samp{CB}, which specifies 8099Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 8100for all architectures, but for those targets that do support it, it is 8101the default because it generates better code. 8102 8103@item -fira-region=@var{region} 8104@opindex fira-region 8105Use specified regions for the integrated register allocator. The 8106@var{region} argument should be one of the following: 8107 8108@table @samp 8109 8110@item all 8111Use all loops as register allocation regions. 8112This can give the best results for machines with a small and/or 8113irregular register set. 8114 8115@item mixed 8116Use all loops except for loops with small register pressure 8117as the regions. This value usually gives 8118the best results in most cases and for most architectures, 8119and is enabled by default when compiling with optimization for speed 8120(@option{-O}, @option{-O2}, @dots{}). 8121 8122@item one 8123Use all functions as a single region. 8124This typically results in the smallest code size, and is enabled by default for 8125@option{-Os} or @option{-O0}. 8126 8127@end table 8128 8129@item -fira-hoist-pressure 8130@opindex fira-hoist-pressure 8131Use IRA to evaluate register pressure in the code hoisting pass for 8132decisions to hoist expressions. This option usually results in smaller 8133code, but it can slow the compiler down. 8134 8135This option is enabled at level @option{-Os} for all targets. 8136 8137@item -fira-loop-pressure 8138@opindex fira-loop-pressure 8139Use IRA to evaluate register pressure in loops for decisions to move 8140loop invariants. This option usually results in generation 8141of faster and smaller code on machines with large register files (>= 32 8142registers), but it can slow the compiler down. 8143 8144This option is enabled at level @option{-O3} for some targets. 8145 8146@item -fno-ira-share-save-slots 8147@opindex fno-ira-share-save-slots 8148Disable sharing of stack slots used for saving call-used hard 8149registers living through a call. Each hard register gets a 8150separate stack slot, and as a result function stack frames are 8151larger. 8152 8153@item -fno-ira-share-spill-slots 8154@opindex fno-ira-share-spill-slots 8155Disable sharing of stack slots allocated for pseudo-registers. Each 8156pseudo-register that does not get a hard register gets a separate 8157stack slot, and as a result function stack frames are larger. 8158 8159@item -fira-verbose=@var{n} 8160@opindex fira-verbose 8161Control the verbosity of the dump file for the integrated register allocator. 8162The default value is 5. If the value @var{n} is greater or equal to 10, 8163the dump output is sent to stderr using the same format as @var{n} minus 10. 8164 8165@item -flra-remat 8166@opindex flra-remat 8167Enable CFG-sensitive rematerialization in LRA. Instead of loading 8168values of spilled pseudos, LRA tries to rematerialize (recalculate) 8169values if it is profitable. 8170 8171Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8172 8173@item -fdelayed-branch 8174@opindex fdelayed-branch 8175If supported for the target machine, attempt to reorder instructions 8176to exploit instruction slots available after delayed branch 8177instructions. 8178 8179Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8180 8181@item -fschedule-insns 8182@opindex fschedule-insns 8183If supported for the target machine, attempt to reorder instructions to 8184eliminate execution stalls due to required data being unavailable. This 8185helps machines that have slow floating point or memory load instructions 8186by allowing other instructions to be issued until the result of the load 8187or floating-point instruction is required. 8188 8189Enabled at levels @option{-O2}, @option{-O3}. 8190 8191@item -fschedule-insns2 8192@opindex fschedule-insns2 8193Similar to @option{-fschedule-insns}, but requests an additional pass of 8194instruction scheduling after register allocation has been done. This is 8195especially useful on machines with a relatively small number of 8196registers and where memory load instructions take more than one cycle. 8197 8198Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8199 8200@item -fno-sched-interblock 8201@opindex fno-sched-interblock 8202Don't schedule instructions across basic blocks. This is normally 8203enabled by default when scheduling before register allocation, i.e.@: 8204with @option{-fschedule-insns} or at @option{-O2} or higher. 8205 8206@item -fno-sched-spec 8207@opindex fno-sched-spec 8208Don't allow speculative motion of non-load instructions. This is normally 8209enabled by default when scheduling before register allocation, i.e.@: 8210with @option{-fschedule-insns} or at @option{-O2} or higher. 8211 8212@item -fsched-pressure 8213@opindex fsched-pressure 8214Enable register pressure sensitive insn scheduling before register 8215allocation. This only makes sense when scheduling before register 8216allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 8217@option{-O2} or higher. Usage of this option can improve the 8218generated code and decrease its size by preventing register pressure 8219increase above the number of available hard registers and subsequent 8220spills in register allocation. 8221 8222@item -fsched-spec-load 8223@opindex fsched-spec-load 8224Allow speculative motion of some load instructions. This only makes 8225sense when scheduling before register allocation, i.e.@: with 8226@option{-fschedule-insns} or at @option{-O2} or higher. 8227 8228@item -fsched-spec-load-dangerous 8229@opindex fsched-spec-load-dangerous 8230Allow speculative motion of more load instructions. This only makes 8231sense when scheduling before register allocation, i.e.@: with 8232@option{-fschedule-insns} or at @option{-O2} or higher. 8233 8234@item -fsched-stalled-insns 8235@itemx -fsched-stalled-insns=@var{n} 8236@opindex fsched-stalled-insns 8237Define how many insns (if any) can be moved prematurely from the queue 8238of stalled insns into the ready list during the second scheduling pass. 8239@option{-fno-sched-stalled-insns} means that no insns are moved 8240prematurely, @option{-fsched-stalled-insns=0} means there is no limit 8241on how many queued insns can be moved prematurely. 8242@option{-fsched-stalled-insns} without a value is equivalent to 8243@option{-fsched-stalled-insns=1}. 8244 8245@item -fsched-stalled-insns-dep 8246@itemx -fsched-stalled-insns-dep=@var{n} 8247@opindex fsched-stalled-insns-dep 8248Define how many insn groups (cycles) are examined for a dependency 8249on a stalled insn that is a candidate for premature removal from the queue 8250of stalled insns. This has an effect only during the second scheduling pass, 8251and only if @option{-fsched-stalled-insns} is used. 8252@option{-fno-sched-stalled-insns-dep} is equivalent to 8253@option{-fsched-stalled-insns-dep=0}. 8254@option{-fsched-stalled-insns-dep} without a value is equivalent to 8255@option{-fsched-stalled-insns-dep=1}. 8256 8257@item -fsched2-use-superblocks 8258@opindex fsched2-use-superblocks 8259When scheduling after register allocation, use superblock scheduling. 8260This allows motion across basic block boundaries, 8261resulting in faster schedules. This option is experimental, as not all machine 8262descriptions used by GCC model the CPU closely enough to avoid unreliable 8263results from the algorithm. 8264 8265This only makes sense when scheduling after register allocation, i.e.@: with 8266@option{-fschedule-insns2} or at @option{-O2} or higher. 8267 8268@item -fsched-group-heuristic 8269@opindex fsched-group-heuristic 8270Enable the group heuristic in the scheduler. This heuristic favors 8271the instruction that belongs to a schedule group. This is enabled 8272by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 8273or @option{-fschedule-insns2} or at @option{-O2} or higher. 8274 8275@item -fsched-critical-path-heuristic 8276@opindex fsched-critical-path-heuristic 8277Enable the critical-path heuristic in the scheduler. This heuristic favors 8278instructions on the critical path. This is enabled by default when 8279scheduling is enabled, i.e.@: with @option{-fschedule-insns} 8280or @option{-fschedule-insns2} or at @option{-O2} or higher. 8281 8282@item -fsched-spec-insn-heuristic 8283@opindex fsched-spec-insn-heuristic 8284Enable the speculative instruction heuristic in the scheduler. This 8285heuristic favors speculative instructions with greater dependency weakness. 8286This is enabled by default when scheduling is enabled, i.e.@: 8287with @option{-fschedule-insns} or @option{-fschedule-insns2} 8288or at @option{-O2} or higher. 8289 8290@item -fsched-rank-heuristic 8291@opindex fsched-rank-heuristic 8292Enable the rank heuristic in the scheduler. This heuristic favors 8293the instruction belonging to a basic block with greater size or frequency. 8294This is enabled by default when scheduling is enabled, i.e.@: 8295with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8296at @option{-O2} or higher. 8297 8298@item -fsched-last-insn-heuristic 8299@opindex fsched-last-insn-heuristic 8300Enable the last-instruction heuristic in the scheduler. This heuristic 8301favors the instruction that is less dependent on the last instruction 8302scheduled. This is enabled by default when scheduling is enabled, 8303i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8304at @option{-O2} or higher. 8305 8306@item -fsched-dep-count-heuristic 8307@opindex fsched-dep-count-heuristic 8308Enable the dependent-count heuristic in the scheduler. This heuristic 8309favors the instruction that has more instructions depending on it. 8310This is enabled by default when scheduling is enabled, i.e.@: 8311with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8312at @option{-O2} or higher. 8313 8314@item -freschedule-modulo-scheduled-loops 8315@opindex freschedule-modulo-scheduled-loops 8316Modulo scheduling is performed before traditional scheduling. If a loop 8317is modulo scheduled, later scheduling passes may change its schedule. 8318Use this option to control that behavior. 8319 8320@item -fselective-scheduling 8321@opindex fselective-scheduling 8322Schedule instructions using selective scheduling algorithm. Selective 8323scheduling runs instead of the first scheduler pass. 8324 8325@item -fselective-scheduling2 8326@opindex fselective-scheduling2 8327Schedule instructions using selective scheduling algorithm. Selective 8328scheduling runs instead of the second scheduler pass. 8329 8330@item -fsel-sched-pipelining 8331@opindex fsel-sched-pipelining 8332Enable software pipelining of innermost loops during selective scheduling. 8333This option has no effect unless one of @option{-fselective-scheduling} or 8334@option{-fselective-scheduling2} is turned on. 8335 8336@item -fsel-sched-pipelining-outer-loops 8337@opindex fsel-sched-pipelining-outer-loops 8338When pipelining loops during selective scheduling, also pipeline outer loops. 8339This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 8340 8341@item -fsemantic-interposition 8342@opindex fsemantic-interposition 8343Some object formats, like ELF, allow interposing of symbols by the 8344dynamic linker. 8345This means that for symbols exported from the DSO, the compiler cannot perform 8346interprocedural propagation, inlining and other optimizations in anticipation 8347that the function or variable in question may change. While this feature is 8348useful, for example, to rewrite memory allocation functions by a debugging 8349implementation, it is expensive in the terms of code quality. 8350With @option{-fno-semantic-interposition} the compiler assumes that 8351if interposition happens for functions the overwriting function will have 8352precisely the same semantics (and side effects). 8353Similarly if interposition happens 8354for variables, the constructor of the variable will be the same. The flag 8355has no effect for functions explicitly declared inline 8356(where it is never allowed for interposition to change semantics) 8357and for symbols explicitly declared weak. 8358 8359@item -fshrink-wrap 8360@opindex fshrink-wrap 8361Emit function prologues only before parts of the function that need it, 8362rather than at the top of the function. This flag is enabled by default at 8363@option{-O} and higher. 8364 8365@item -fcaller-saves 8366@opindex fcaller-saves 8367Enable allocation of values to registers that are clobbered by 8368function calls, by emitting extra instructions to save and restore the 8369registers around such calls. Such allocation is done only when it 8370seems to result in better code. 8371 8372This option is always enabled by default on certain machines, usually 8373those which have no call-preserved registers to use instead. 8374 8375Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8376 8377@item -fcombine-stack-adjustments 8378@opindex fcombine-stack-adjustments 8379Tracks stack adjustments (pushes and pops) and stack memory references 8380and then tries to find ways to combine them. 8381 8382Enabled by default at @option{-O1} and higher. 8383 8384@item -fipa-ra 8385@opindex fipa-ra 8386Use caller save registers for allocation if those registers are not used by 8387any called function. In that case it is not necessary to save and restore 8388them around calls. This is only possible if called functions are part of 8389same compilation unit as current function and they are compiled before it. 8390 8391Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8392 8393@item -fconserve-stack 8394@opindex fconserve-stack 8395Attempt to minimize stack usage. The compiler attempts to use less 8396stack space, even if that makes the program slower. This option 8397implies setting the @option{large-stack-frame} parameter to 100 8398and the @option{large-stack-frame-growth} parameter to 400. 8399 8400@item -ftree-reassoc 8401@opindex ftree-reassoc 8402Perform reassociation on trees. This flag is enabled by default 8403at @option{-O} and higher. 8404 8405@item -ftree-pre 8406@opindex ftree-pre 8407Perform partial redundancy elimination (PRE) on trees. This flag is 8408enabled by default at @option{-O2} and @option{-O3}. 8409 8410@item -ftree-partial-pre 8411@opindex ftree-partial-pre 8412Make partial redundancy elimination (PRE) more aggressive. This flag is 8413enabled by default at @option{-O3}. 8414 8415@item -ftree-forwprop 8416@opindex ftree-forwprop 8417Perform forward propagation on trees. This flag is enabled by default 8418at @option{-O} and higher. 8419 8420@item -ftree-fre 8421@opindex ftree-fre 8422Perform full redundancy elimination (FRE) on trees. The difference 8423between FRE and PRE is that FRE only considers expressions 8424that are computed on all paths leading to the redundant computation. 8425This analysis is faster than PRE, though it exposes fewer redundancies. 8426This flag is enabled by default at @option{-O} and higher. 8427 8428@item -ftree-phiprop 8429@opindex ftree-phiprop 8430Perform hoisting of loads from conditional pointers on trees. This 8431pass is enabled by default at @option{-O} and higher. 8432 8433@item -fhoist-adjacent-loads 8434@opindex fhoist-adjacent-loads 8435Speculatively hoist loads from both branches of an if-then-else if the 8436loads are from adjacent locations in the same structure and the target 8437architecture has a conditional move instruction. This flag is enabled 8438by default at @option{-O2} and higher. 8439 8440@item -ftree-copy-prop 8441@opindex ftree-copy-prop 8442Perform copy propagation on trees. This pass eliminates unnecessary 8443copy operations. This flag is enabled by default at @option{-O} and 8444higher. 8445 8446@item -fipa-pure-const 8447@opindex fipa-pure-const 8448Discover which functions are pure or constant. 8449Enabled by default at @option{-O} and higher. 8450 8451@item -fipa-reference 8452@opindex fipa-reference 8453Discover which static variables do not escape the 8454compilation unit. 8455Enabled by default at @option{-O} and higher. 8456 8457@item -fipa-pta 8458@opindex fipa-pta 8459Perform interprocedural pointer analysis and interprocedural modification 8460and reference analysis. This option can cause excessive memory and 8461compile-time usage on large compilation units. It is not enabled by 8462default at any optimization level. 8463 8464@item -fipa-profile 8465@opindex fipa-profile 8466Perform interprocedural profile propagation. The functions called only from 8467cold functions are marked as cold. Also functions executed once (such as 8468@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold 8469functions and loop less parts of functions executed once are then optimized for 8470size. 8471Enabled by default at @option{-O} and higher. 8472 8473@item -fipa-cp 8474@opindex fipa-cp 8475Perform interprocedural constant propagation. 8476This optimization analyzes the program to determine when values passed 8477to functions are constants and then optimizes accordingly. 8478This optimization can substantially increase performance 8479if the application has constants passed to functions. 8480This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 8481 8482@item -fipa-cp-clone 8483@opindex fipa-cp-clone 8484Perform function cloning to make interprocedural constant propagation stronger. 8485When enabled, interprocedural constant propagation performs function cloning 8486when externally visible function can be called with constant arguments. 8487Because this optimization can create multiple copies of functions, 8488it may significantly increase code size 8489(see @option{--param ipcp-unit-growth=@var{value}}). 8490This flag is enabled by default at @option{-O3}. 8491 8492@item -fipa-cp-alignment 8493@opindex -fipa-cp-alignment 8494When enabled, this optimization propagates alignment of function 8495parameters to support better vectorization and string operations. 8496 8497This flag is enabled by default at @option{-O2} and @option{-Os}. It 8498requires that @option{-fipa-cp} is enabled. 8499 8500@item -fipa-icf 8501@opindex fipa-icf 8502Perform Identical Code Folding for functions and read-only variables. 8503The optimization reduces code size and may disturb unwind stacks by replacing 8504a function by equivalent one with a different name. The optimization works 8505more effectively with link time optimization enabled. 8506 8507Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF 8508works on different levels and thus the optimizations are not same - there are 8509equivalences that are found only by GCC and equivalences found only by Gold. 8510 8511This flag is enabled by default at @option{-O2} and @option{-Os}. 8512 8513@item -fisolate-erroneous-paths-dereference 8514@opindex fisolate-erroneous-paths-dereference 8515Detect paths that trigger erroneous or undefined behavior due to 8516dereferencing a null pointer. Isolate those paths from the main control 8517flow and turn the statement with erroneous or undefined behavior into a trap. 8518This flag is enabled by default at @option{-O2} and higher. 8519 8520@item -fisolate-erroneous-paths-attribute 8521@opindex fisolate-erroneous-paths-attribute 8522Detect paths that trigger erroneous or undefined behavior due a null value 8523being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 8524attribute. Isolate those paths from the main control flow and turn the 8525statement with erroneous or undefined behavior into a trap. This is not 8526currently enabled, but may be enabled by @option{-O2} in the future. 8527 8528@item -ftree-sink 8529@opindex ftree-sink 8530Perform forward store motion on trees. This flag is 8531enabled by default at @option{-O} and higher. 8532 8533@item -ftree-bit-ccp 8534@opindex ftree-bit-ccp 8535Perform sparse conditional bit constant propagation on trees and propagate 8536pointer alignment information. 8537This pass only operates on local scalar variables and is enabled by default 8538at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled. 8539 8540@item -ftree-ccp 8541@opindex ftree-ccp 8542Perform sparse conditional constant propagation (CCP) on trees. This 8543pass only operates on local scalar variables and is enabled by default 8544at @option{-O} and higher. 8545 8546@item -fssa-phiopt 8547@opindex fssa-phiopt 8548Perform pattern matching on SSA PHI nodes to optimize conditional 8549code. This pass is enabled by default at @option{-O} and higher. 8550 8551@item -ftree-switch-conversion 8552@opindex ftree-switch-conversion 8553Perform conversion of simple initializations in a switch to 8554initializations from a scalar array. This flag is enabled by default 8555at @option{-O2} and higher. 8556 8557@item -ftree-tail-merge 8558@opindex ftree-tail-merge 8559Look for identical code sequences. When found, replace one with a jump to the 8560other. This optimization is known as tail merging or cross jumping. This flag 8561is enabled by default at @option{-O2} and higher. The compilation time 8562in this pass can 8563be limited using @option{max-tail-merge-comparisons} parameter and 8564@option{max-tail-merge-iterations} parameter. 8565 8566@item -ftree-dce 8567@opindex ftree-dce 8568Perform dead code elimination (DCE) on trees. This flag is enabled by 8569default at @option{-O} and higher. 8570 8571@item -ftree-builtin-call-dce 8572@opindex ftree-builtin-call-dce 8573Perform conditional dead code elimination (DCE) for calls to built-in functions 8574that may set @code{errno} but are otherwise side-effect free. This flag is 8575enabled by default at @option{-O2} and higher if @option{-Os} is not also 8576specified. 8577 8578@item -ftree-dominator-opts 8579@opindex ftree-dominator-opts 8580Perform a variety of simple scalar cleanups (constant/copy 8581propagation, redundancy elimination, range propagation and expression 8582simplification) based on a dominator tree traversal. This also 8583performs jump threading (to reduce jumps to jumps). This flag is 8584enabled by default at @option{-O} and higher. 8585 8586@item -ftree-dse 8587@opindex ftree-dse 8588Perform dead store elimination (DSE) on trees. A dead store is a store into 8589a memory location that is later overwritten by another store without 8590any intervening loads. In this case the earlier store can be deleted. This 8591flag is enabled by default at @option{-O} and higher. 8592 8593@item -ftree-ch 8594@opindex ftree-ch 8595Perform loop header copying on trees. This is beneficial since it increases 8596effectiveness of code motion optimizations. It also saves one jump. This flag 8597is enabled by default at @option{-O} and higher. It is not enabled 8598for @option{-Os}, since it usually increases code size. 8599 8600@item -ftree-loop-optimize 8601@opindex ftree-loop-optimize 8602Perform loop optimizations on trees. This flag is enabled by default 8603at @option{-O} and higher. 8604 8605@item -ftree-loop-linear 8606@opindex ftree-loop-linear 8607Perform loop interchange transformations on tree. Same as 8608@option{-floop-interchange}. To use this code transformation, GCC has 8609to be configured with @option{--with-isl} to enable the Graphite loop 8610transformation infrastructure. 8611 8612@item -floop-interchange 8613@opindex floop-interchange 8614Perform loop interchange transformations on loops. Interchanging two 8615nested loops switches the inner and outer loops. For example, given a 8616loop like: 8617@smallexample 8618DO J = 1, M 8619 DO I = 1, N 8620 A(J, I) = A(J, I) * C 8621 ENDDO 8622ENDDO 8623@end smallexample 8624@noindent 8625loop interchange transforms the loop as if it were written: 8626@smallexample 8627DO I = 1, N 8628 DO J = 1, M 8629 A(J, I) = A(J, I) * C 8630 ENDDO 8631ENDDO 8632@end smallexample 8633which can be beneficial when @code{N} is larger than the caches, 8634because in Fortran, the elements of an array are stored in memory 8635contiguously by column, and the original loop iterates over rows, 8636potentially creating at each access a cache miss. This optimization 8637applies to all the languages supported by GCC and is not limited to 8638Fortran. To use this code transformation, GCC has to be configured 8639with @option{--with-isl} to enable the Graphite loop transformation 8640infrastructure. 8641 8642@item -floop-strip-mine 8643@opindex floop-strip-mine 8644Perform loop strip mining transformations on loops. Strip mining 8645splits a loop into two nested loops. The outer loop has strides 8646equal to the strip size and the inner loop has strides of the 8647original loop within a strip. The strip length can be changed 8648using the @option{loop-block-tile-size} parameter. For example, 8649given a loop like: 8650@smallexample 8651DO I = 1, N 8652 A(I) = A(I) + C 8653ENDDO 8654@end smallexample 8655@noindent 8656loop strip mining transforms the loop as if it were written: 8657@smallexample 8658DO II = 1, N, 51 8659 DO I = II, min (II + 50, N) 8660 A(I) = A(I) + C 8661 ENDDO 8662ENDDO 8663@end smallexample 8664This optimization applies to all the languages supported by GCC and is 8665not limited to Fortran. To use this code transformation, GCC has to 8666be configured with @option{--with-isl} to enable the Graphite loop 8667transformation infrastructure. 8668 8669@item -floop-block 8670@opindex floop-block 8671Perform loop blocking transformations on loops. Blocking strip mines 8672each loop in the loop nest such that the memory accesses of the 8673element loops fit inside caches. The strip length can be changed 8674using the @option{loop-block-tile-size} parameter. For example, given 8675a loop like: 8676@smallexample 8677DO I = 1, N 8678 DO J = 1, M 8679 A(J, I) = B(I) + C(J) 8680 ENDDO 8681ENDDO 8682@end smallexample 8683@noindent 8684loop blocking transforms the loop as if it were written: 8685@smallexample 8686DO II = 1, N, 51 8687 DO JJ = 1, M, 51 8688 DO I = II, min (II + 50, N) 8689 DO J = JJ, min (JJ + 50, M) 8690 A(J, I) = B(I) + C(J) 8691 ENDDO 8692 ENDDO 8693 ENDDO 8694ENDDO 8695@end smallexample 8696which can be beneficial when @code{M} is larger than the caches, 8697because the innermost loop iterates over a smaller amount of data 8698which can be kept in the caches. This optimization applies to all the 8699languages supported by GCC and is not limited to Fortran. To use this 8700code transformation, GCC has to be configured with @option{--with-isl} 8701to enable the Graphite loop transformation infrastructure. 8702 8703@item -fgraphite-identity 8704@opindex fgraphite-identity 8705Enable the identity transformation for graphite. For every SCoP we generate 8706the polyhedral representation and transform it back to gimple. Using 8707@option{-fgraphite-identity} we can check the costs or benefits of the 8708GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 8709are also performed by the code generator ISL, like index splitting and 8710dead code elimination in loops. 8711 8712@item -floop-nest-optimize 8713@opindex floop-nest-optimize 8714Enable the ISL based loop nest optimizer. This is a generic loop nest 8715optimizer based on the Pluto optimization algorithms. It calculates a loop 8716structure optimized for data-locality and parallelism. This option 8717is experimental. 8718 8719@item -floop-unroll-and-jam 8720@opindex floop-unroll-and-jam 8721Enable unroll and jam for the ISL based loop nest optimizer. The unroll 8722factor can be changed using the @option{loop-unroll-jam-size} parameter. 8723The unrolled dimension (counting from the most inner one) can be changed 8724using the @option{loop-unroll-jam-depth} parameter. . 8725 8726@item -floop-parallelize-all 8727@opindex floop-parallelize-all 8728Use the Graphite data dependence analysis to identify loops that can 8729be parallelized. Parallelize all the loops that can be analyzed to 8730not contain loop carried dependences without checking that it is 8731profitable to parallelize the loops. 8732 8733@item -fcheck-data-deps 8734@opindex fcheck-data-deps 8735Compare the results of several data dependence analyzers. This option 8736is used for debugging the data dependence analyzers. 8737 8738@item -ftree-loop-if-convert 8739@opindex ftree-loop-if-convert 8740Attempt to transform conditional jumps in the innermost loops to 8741branch-less equivalents. The intent is to remove control-flow from 8742the innermost loops in order to improve the ability of the 8743vectorization pass to handle these loops. This is enabled by default 8744if vectorization is enabled. 8745 8746@item -ftree-loop-if-convert-stores 8747@opindex ftree-loop-if-convert-stores 8748Attempt to also if-convert conditional jumps containing memory writes. 8749This transformation can be unsafe for multi-threaded programs as it 8750transforms conditional memory writes into unconditional memory writes. 8751For example, 8752@smallexample 8753for (i = 0; i < N; i++) 8754 if (cond) 8755 A[i] = expr; 8756@end smallexample 8757is transformed to 8758@smallexample 8759for (i = 0; i < N; i++) 8760 A[i] = cond ? expr : A[i]; 8761@end smallexample 8762potentially producing data races. 8763 8764@item -ftree-loop-distribution 8765@opindex ftree-loop-distribution 8766Perform loop distribution. This flag can improve cache performance on 8767big loop bodies and allow further loop optimizations, like 8768parallelization or vectorization, to take place. For example, the loop 8769@smallexample 8770DO I = 1, N 8771 A(I) = B(I) + C 8772 D(I) = E(I) * F 8773ENDDO 8774@end smallexample 8775is transformed to 8776@smallexample 8777DO I = 1, N 8778 A(I) = B(I) + C 8779ENDDO 8780DO I = 1, N 8781 D(I) = E(I) * F 8782ENDDO 8783@end smallexample 8784 8785@item -ftree-loop-distribute-patterns 8786@opindex ftree-loop-distribute-patterns 8787Perform loop distribution of patterns that can be code generated with 8788calls to a library. This flag is enabled by default at @option{-O3}. 8789 8790This pass distributes the initialization loops and generates a call to 8791memset zero. For example, the loop 8792@smallexample 8793DO I = 1, N 8794 A(I) = 0 8795 B(I) = A(I) + I 8796ENDDO 8797@end smallexample 8798is transformed to 8799@smallexample 8800DO I = 1, N 8801 A(I) = 0 8802ENDDO 8803DO I = 1, N 8804 B(I) = A(I) + I 8805ENDDO 8806@end smallexample 8807and the initialization loop is transformed into a call to memset zero. 8808 8809@item -ftree-loop-im 8810@opindex ftree-loop-im 8811Perform loop invariant motion on trees. This pass moves only invariants that 8812are hard to handle at RTL level (function calls, operations that expand to 8813nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 8814operands of conditions that are invariant out of the loop, so that we can use 8815just trivial invariantness analysis in loop unswitching. The pass also includes 8816store motion. 8817 8818@item -ftree-loop-ivcanon 8819@opindex ftree-loop-ivcanon 8820Create a canonical counter for number of iterations in loops for which 8821determining number of iterations requires complicated analysis. Later 8822optimizations then may determine the number easily. Useful especially 8823in connection with unrolling. 8824 8825@item -fivopts 8826@opindex fivopts 8827Perform induction variable optimizations (strength reduction, induction 8828variable merging and induction variable elimination) on trees. 8829 8830@item -ftree-parallelize-loops=n 8831@opindex ftree-parallelize-loops 8832Parallelize loops, i.e., split their iteration space to run in n threads. 8833This is only possible for loops whose iterations are independent 8834and can be arbitrarily reordered. The optimization is only 8835profitable on multiprocessor machines, for loops that are CPU-intensive, 8836rather than constrained e.g.@: by memory bandwidth. This option 8837implies @option{-pthread}, and thus is only supported on targets 8838that have support for @option{-pthread}. 8839 8840@item -ftree-pta 8841@opindex ftree-pta 8842Perform function-local points-to analysis on trees. This flag is 8843enabled by default at @option{-O} and higher. 8844 8845@item -ftree-sra 8846@opindex ftree-sra 8847Perform scalar replacement of aggregates. This pass replaces structure 8848references with scalars to prevent committing structures to memory too 8849early. This flag is enabled by default at @option{-O} and higher. 8850 8851@item -ftree-copyrename 8852@opindex ftree-copyrename 8853Perform copy renaming on trees. This pass attempts to rename compiler 8854temporaries to other variables at copy locations, usually resulting in 8855variable names which more closely resemble the original variables. This flag 8856is enabled by default at @option{-O} and higher. 8857 8858@item -ftree-coalesce-inlined-vars 8859@opindex ftree-coalesce-inlined-vars 8860Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to 8861combine small user-defined variables too, but only if they are inlined 8862from other functions. It is a more limited form of 8863@option{-ftree-coalesce-vars}. This may harm debug information of such 8864inlined variables, but it keeps variables of the inlined-into 8865function apart from each other, such that they are more likely to 8866contain the expected values in a debugging session. 8867 8868@item -ftree-coalesce-vars 8869@opindex ftree-coalesce-vars 8870Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to 8871combine small user-defined variables too, instead of just compiler 8872temporaries. This may severely limit the ability to debug an optimized 8873program compiled with @option{-fno-var-tracking-assignments}. In the 8874negated form, this flag prevents SSA coalescing of user variables, 8875including inlined ones. This option is enabled by default. 8876 8877@item -ftree-ter 8878@opindex ftree-ter 8879Perform temporary expression replacement during the SSA->normal phase. Single 8880use/single def temporaries are replaced at their use location with their 8881defining expression. This results in non-GIMPLE code, but gives the expanders 8882much more complex trees to work on resulting in better RTL generation. This is 8883enabled by default at @option{-O} and higher. 8884 8885@item -ftree-slsr 8886@opindex ftree-slsr 8887Perform straight-line strength reduction on trees. This recognizes related 8888expressions involving multiplications and replaces them by less expensive 8889calculations when possible. This is enabled by default at @option{-O} and 8890higher. 8891 8892@item -ftree-vectorize 8893@opindex ftree-vectorize 8894Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 8895and @option{-ftree-slp-vectorize} if not explicitly specified. 8896 8897@item -ftree-loop-vectorize 8898@opindex ftree-loop-vectorize 8899Perform loop vectorization on trees. This flag is enabled by default at 8900@option{-O3} and when @option{-ftree-vectorize} is enabled. 8901 8902@item -ftree-slp-vectorize 8903@opindex ftree-slp-vectorize 8904Perform basic block vectorization on trees. This flag is enabled by default at 8905@option{-O3} and when @option{-ftree-vectorize} is enabled. 8906 8907@item -fvect-cost-model=@var{model} 8908@opindex fvect-cost-model 8909Alter the cost model used for vectorization. The @var{model} argument 8910should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}. 8911With the @samp{unlimited} model the vectorized code-path is assumed 8912to be profitable while with the @samp{dynamic} model a runtime check 8913guards the vectorized code-path to enable it only for iteration 8914counts that will likely execute faster than when executing the original 8915scalar loop. The @samp{cheap} model disables vectorization of 8916loops where doing so would be cost prohibitive for example due to 8917required runtime checks for data dependence or alignment but otherwise 8918is equal to the @samp{dynamic} model. 8919The default cost model depends on other optimization flags and is 8920either @samp{dynamic} or @samp{cheap}. 8921 8922@item -fsimd-cost-model=@var{model} 8923@opindex fsimd-cost-model 8924Alter the cost model used for vectorization of loops marked with the OpenMP 8925or Cilk Plus simd directive. The @var{model} argument should be one of 8926@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 8927have the same meaning as described in @option{-fvect-cost-model} and by 8928default a cost model defined with @option{-fvect-cost-model} is used. 8929 8930@item -ftree-vrp 8931@opindex ftree-vrp 8932Perform Value Range Propagation on trees. This is similar to the 8933constant propagation pass, but instead of values, ranges of values are 8934propagated. This allows the optimizers to remove unnecessary range 8935checks like array bound checks and null pointer checks. This is 8936enabled by default at @option{-O2} and higher. Null pointer check 8937elimination is only done if @option{-fdelete-null-pointer-checks} is 8938enabled. 8939 8940@item -fsplit-ivs-in-unroller 8941@opindex fsplit-ivs-in-unroller 8942Enables expression of values of induction variables in later iterations 8943of the unrolled loop using the value in the first iteration. This breaks 8944long dependency chains, thus improving efficiency of the scheduling passes. 8945 8946A combination of @option{-fweb} and CSE is often sufficient to obtain the 8947same effect. However, that is not reliable in cases where the loop body 8948is more complicated than a single basic block. It also does not work at all 8949on some architectures due to restrictions in the CSE pass. 8950 8951This optimization is enabled by default. 8952 8953@item -fvariable-expansion-in-unroller 8954@opindex fvariable-expansion-in-unroller 8955With this option, the compiler creates multiple copies of some 8956local variables when unrolling a loop, which can result in superior code. 8957 8958@item -fpartial-inlining 8959@opindex fpartial-inlining 8960Inline parts of functions. This option has any effect only 8961when inlining itself is turned on by the @option{-finline-functions} 8962or @option{-finline-small-functions} options. 8963 8964Enabled at level @option{-O2}. 8965 8966@item -fpredictive-commoning 8967@opindex fpredictive-commoning 8968Perform predictive commoning optimization, i.e., reusing computations 8969(especially memory loads and stores) performed in previous 8970iterations of loops. 8971 8972This option is enabled at level @option{-O3}. 8973 8974@item -fprefetch-loop-arrays 8975@opindex fprefetch-loop-arrays 8976If supported by the target machine, generate instructions to prefetch 8977memory to improve the performance of loops that access large arrays. 8978 8979This option may generate better or worse code; results are highly 8980dependent on the structure of loops within the source code. 8981 8982Disabled at level @option{-Os}. 8983 8984@item -fno-peephole 8985@itemx -fno-peephole2 8986@opindex fno-peephole 8987@opindex fno-peephole2 8988Disable any machine-specific peephole optimizations. The difference 8989between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 8990are implemented in the compiler; some targets use one, some use the 8991other, a few use both. 8992 8993@option{-fpeephole} is enabled by default. 8994@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8995 8996@item -fno-guess-branch-probability 8997@opindex fno-guess-branch-probability 8998Do not guess branch probabilities using heuristics. 8999 9000GCC uses heuristics to guess branch probabilities if they are 9001not provided by profiling feedback (@option{-fprofile-arcs}). These 9002heuristics are based on the control flow graph. If some branch probabilities 9003are specified by @code{__builtin_expect}, then the heuristics are 9004used to guess branch probabilities for the rest of the control flow graph, 9005taking the @code{__builtin_expect} info into account. The interactions 9006between the heuristics and @code{__builtin_expect} can be complex, and in 9007some cases, it may be useful to disable the heuristics so that the effects 9008of @code{__builtin_expect} are easier to understand. 9009 9010The default is @option{-fguess-branch-probability} at levels 9011@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9012 9013@item -freorder-blocks 9014@opindex freorder-blocks 9015Reorder basic blocks in the compiled function in order to reduce number of 9016taken branches and improve code locality. 9017 9018Enabled at levels @option{-O2}, @option{-O3}. 9019 9020@item -freorder-blocks-and-partition 9021@opindex freorder-blocks-and-partition 9022In addition to reordering basic blocks in the compiled function, in order 9023to reduce number of taken branches, partitions hot and cold basic blocks 9024into separate sections of the assembly and .o files, to improve 9025paging and cache locality performance. 9026 9027This optimization is automatically turned off in the presence of 9028exception handling, for linkonce sections, for functions with a user-defined 9029section attribute and on any architecture that does not support named 9030sections. 9031 9032Enabled for x86 at levels @option{-O2}, @option{-O3}. 9033 9034@item -freorder-functions 9035@opindex freorder-functions 9036Reorder functions in the object file in order to 9037improve code locality. This is implemented by using special 9038subsections @code{.text.hot} for most frequently executed functions and 9039@code{.text.unlikely} for unlikely executed functions. Reordering is done by 9040the linker so object file format must support named sections and linker must 9041place them in a reasonable way. 9042 9043Also profile feedback must be available to make this option effective. See 9044@option{-fprofile-arcs} for details. 9045 9046Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9047 9048@item -fstrict-aliasing 9049@opindex fstrict-aliasing 9050Allow the compiler to assume the strictest aliasing rules applicable to 9051the language being compiled. For C (and C++), this activates 9052optimizations based on the type of expressions. In particular, an 9053object of one type is assumed never to reside at the same address as an 9054object of a different type, unless the types are almost the same. For 9055example, an @code{unsigned int} can alias an @code{int}, but not a 9056@code{void*} or a @code{double}. A character type may alias any other 9057type. 9058 9059@anchor{Type-punning}Pay special attention to code like this: 9060@smallexample 9061union a_union @{ 9062 int i; 9063 double d; 9064@}; 9065 9066int f() @{ 9067 union a_union t; 9068 t.d = 3.0; 9069 return t.i; 9070@} 9071@end smallexample 9072The practice of reading from a different union member than the one most 9073recently written to (called ``type-punning'') is common. Even with 9074@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 9075is accessed through the union type. So, the code above works as 9076expected. @xref{Structures unions enumerations and bit-fields 9077implementation}. However, this code might not: 9078@smallexample 9079int f() @{ 9080 union a_union t; 9081 int* ip; 9082 t.d = 3.0; 9083 ip = &t.i; 9084 return *ip; 9085@} 9086@end smallexample 9087 9088Similarly, access by taking the address, casting the resulting pointer 9089and dereferencing the result has undefined behavior, even if the cast 9090uses a union type, e.g.: 9091@smallexample 9092int f() @{ 9093 double d = 3.0; 9094 return ((union a_union *) &d)->i; 9095@} 9096@end smallexample 9097 9098The @option{-fstrict-aliasing} option is enabled at levels 9099@option{-O2}, @option{-O3}, @option{-Os}. 9100 9101@item -fstrict-overflow 9102@opindex fstrict-overflow 9103Allow the compiler to assume strict signed overflow rules, depending 9104on the language being compiled. For C (and C++) this means that 9105overflow when doing arithmetic with signed numbers is undefined, which 9106means that the compiler may assume that it does not happen. This 9107permits various optimizations. For example, the compiler assumes 9108that an expression like @code{i + 10 > i} is always true for 9109signed @code{i}. This assumption is only valid if signed overflow is 9110undefined, as the expression is false if @code{i + 10} overflows when 9111using twos complement arithmetic. When this option is in effect any 9112attempt to determine whether an operation on signed numbers 9113overflows must be written carefully to not actually involve overflow. 9114 9115This option also allows the compiler to assume strict pointer 9116semantics: given a pointer to an object, if adding an offset to that 9117pointer does not produce a pointer to the same object, the addition is 9118undefined. This permits the compiler to conclude that @code{p + u > 9119p} is always true for a pointer @code{p} and unsigned integer 9120@code{u}. This assumption is only valid because pointer wraparound is 9121undefined, as the expression is false if @code{p + u} overflows using 9122twos complement arithmetic. 9123 9124See also the @option{-fwrapv} option. Using @option{-fwrapv} means 9125that integer signed overflow is fully defined: it wraps. When 9126@option{-fwrapv} is used, there is no difference between 9127@option{-fstrict-overflow} and @option{-fno-strict-overflow} for 9128integers. With @option{-fwrapv} certain types of overflow are 9129permitted. For example, if the compiler gets an overflow when doing 9130arithmetic on constants, the overflowed value can still be used with 9131@option{-fwrapv}, but not otherwise. 9132 9133The @option{-fstrict-overflow} option is enabled at levels 9134@option{-O2}, @option{-O3}, @option{-Os}. 9135 9136@item -falign-functions 9137@itemx -falign-functions=@var{n} 9138@opindex falign-functions 9139Align the start of functions to the next power-of-two greater than 9140@var{n}, skipping up to @var{n} bytes. For instance, 9141@option{-falign-functions=32} aligns functions to the next 32-byte 9142boundary, but @option{-falign-functions=24} aligns to the next 914332-byte boundary only if this can be done by skipping 23 bytes or less. 9144 9145@option{-fno-align-functions} and @option{-falign-functions=1} are 9146equivalent and mean that functions are not aligned. 9147 9148Some assemblers only support this flag when @var{n} is a power of two; 9149in that case, it is rounded up. 9150 9151If @var{n} is not specified or is zero, use a machine-dependent default. 9152 9153Enabled at levels @option{-O2}, @option{-O3}. 9154 9155@item -falign-labels 9156@itemx -falign-labels=@var{n} 9157@opindex falign-labels 9158Align all branch targets to a power-of-two boundary, skipping up to 9159@var{n} bytes like @option{-falign-functions}. This option can easily 9160make code slower, because it must insert dummy operations for when the 9161branch target is reached in the usual flow of the code. 9162 9163@option{-fno-align-labels} and @option{-falign-labels=1} are 9164equivalent and mean that labels are not aligned. 9165 9166If @option{-falign-loops} or @option{-falign-jumps} are applicable and 9167are greater than this value, then their values are used instead. 9168 9169If @var{n} is not specified or is zero, use a machine-dependent default 9170which is very likely to be @samp{1}, meaning no alignment. 9171 9172Enabled at levels @option{-O2}, @option{-O3}. 9173 9174@item -falign-loops 9175@itemx -falign-loops=@var{n} 9176@opindex falign-loops 9177Align loops to a power-of-two boundary, skipping up to @var{n} bytes 9178like @option{-falign-functions}. If the loops are 9179executed many times, this makes up for any execution of the dummy 9180operations. 9181 9182@option{-fno-align-loops} and @option{-falign-loops=1} are 9183equivalent and mean that loops are not aligned. 9184 9185If @var{n} is not specified or is zero, use a machine-dependent default. 9186 9187Enabled at levels @option{-O2}, @option{-O3}. 9188 9189@item -falign-jumps 9190@itemx -falign-jumps=@var{n} 9191@opindex falign-jumps 9192Align branch targets to a power-of-two boundary, for branch targets 9193where the targets can only be reached by jumping, skipping up to @var{n} 9194bytes like @option{-falign-functions}. In this case, no dummy operations 9195need be executed. 9196 9197@option{-fno-align-jumps} and @option{-falign-jumps=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 -funit-at-a-time 9205@opindex funit-at-a-time 9206This option is left for compatibility reasons. @option{-funit-at-a-time} 9207has no effect, while @option{-fno-unit-at-a-time} implies 9208@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 9209 9210Enabled by default. 9211 9212@item -fno-toplevel-reorder 9213@opindex fno-toplevel-reorder 9214Do not reorder top-level functions, variables, and @code{asm} 9215statements. Output them in the same order that they appear in the 9216input file. When this option is used, unreferenced static variables 9217are not removed. This option is intended to support existing code 9218that relies on a particular ordering. For new code, it is better to 9219use attributes when possible. 9220 9221Enabled at level @option{-O0}. When disabled explicitly, it also implies 9222@option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some 9223targets. 9224 9225@item -fweb 9226@opindex fweb 9227Constructs webs as commonly used for register allocation purposes and assign 9228each web individual pseudo register. This allows the register allocation pass 9229to operate on pseudos directly, but also strengthens several other optimization 9230passes, such as CSE, loop optimizer and trivial dead code remover. It can, 9231however, make debugging impossible, since variables no longer stay in a 9232``home register''. 9233 9234Enabled by default with @option{-funroll-loops}. 9235 9236@item -fwhole-program 9237@opindex fwhole-program 9238Assume that the current compilation unit represents the whole program being 9239compiled. All public functions and variables with the exception of @code{main} 9240and those merged by attribute @code{externally_visible} become static functions 9241and in effect are optimized more aggressively by interprocedural optimizers. 9242 9243This option should not be used in combination with @option{-flto}. 9244Instead relying on a linker plugin should provide safer and more precise 9245information. 9246 9247@item -flto[=@var{n}] 9248@opindex flto 9249This option runs the standard link-time optimizer. When invoked 9250with source code, it generates GIMPLE (one of GCC's internal 9251representations) and writes it to special ELF sections in the object 9252file. When the object files are linked together, all the function 9253bodies are read from these ELF sections and instantiated as if they 9254had been part of the same translation unit. 9255 9256To use the link-time optimizer, @option{-flto} and optimization 9257options should be specified at compile time and during the final link. 9258For example: 9259 9260@smallexample 9261gcc -c -O2 -flto foo.c 9262gcc -c -O2 -flto bar.c 9263gcc -o myprog -flto -O2 foo.o bar.o 9264@end smallexample 9265 9266The first two invocations to GCC save a bytecode representation 9267of GIMPLE into special ELF sections inside @file{foo.o} and 9268@file{bar.o}. The final invocation reads the GIMPLE bytecode from 9269@file{foo.o} and @file{bar.o}, merges the two files into a single 9270internal image, and compiles the result as usual. Since both 9271@file{foo.o} and @file{bar.o} are merged into a single image, this 9272causes all the interprocedural analyses and optimizations in GCC to 9273work across the two files as if they were a single one. This means, 9274for example, that the inliner is able to inline functions in 9275@file{bar.o} into functions in @file{foo.o} and vice-versa. 9276 9277Another (simpler) way to enable link-time optimization is: 9278 9279@smallexample 9280gcc -o myprog -flto -O2 foo.c bar.c 9281@end smallexample 9282 9283The above generates bytecode for @file{foo.c} and @file{bar.c}, 9284merges them together into a single GIMPLE representation and optimizes 9285them as usual to produce @file{myprog}. 9286 9287The only important thing to keep in mind is that to enable link-time 9288optimizations you need to use the GCC driver to perform the link-step. 9289GCC then automatically performs link-time optimization if any of the 9290objects involved were compiled with the @option{-flto} command-line option. 9291You generally 9292should specify the optimization options to be used for link-time 9293optimization though GCC tries to be clever at guessing an 9294optimization level to use from the options used at compile-time 9295if you fail to specify one at link-time. You can always override 9296the automatic decision to do link-time optimization at link-time 9297by passing @option{-fno-lto} to the link command. 9298 9299To make whole program optimization effective, it is necessary to make 9300certain whole program assumptions. The compiler needs to know 9301what functions and variables can be accessed by libraries and runtime 9302outside of the link-time optimized unit. When supported by the linker, 9303the linker plugin (see @option{-fuse-linker-plugin}) passes information 9304to the compiler about used and externally visible symbols. When 9305the linker plugin is not available, @option{-fwhole-program} should be 9306used to allow the compiler to make these assumptions, which leads 9307to more aggressive optimization decisions. 9308 9309When @option{-fuse-linker-plugin} is not enabled then, when a file is 9310compiled with @option{-flto}, the generated object file is larger than 9311a regular object file because it contains GIMPLE bytecodes and the usual 9312final code (see @option{-ffat-lto-objects}. This means that 9313object files with LTO information can be linked as normal object 9314files; if @option{-fno-lto} is passed to the linker, no 9315interprocedural optimizations are applied. Note that when 9316@option{-fno-fat-lto-objects} is enabled the compile-stage is faster 9317but you cannot perform a regular, non-LTO link on them. 9318 9319Additionally, the optimization flags used to compile individual files 9320are not necessarily related to those used at link time. For instance, 9321 9322@smallexample 9323gcc -c -O0 -ffat-lto-objects -flto foo.c 9324gcc -c -O0 -ffat-lto-objects -flto bar.c 9325gcc -o myprog -O3 foo.o bar.o 9326@end smallexample 9327 9328This produces individual object files with unoptimized assembler 9329code, but the resulting binary @file{myprog} is optimized at 9330@option{-O3}. If, instead, the final binary is generated with 9331@option{-fno-lto}, then @file{myprog} is not optimized. 9332 9333When producing the final binary, GCC only 9334applies link-time optimizations to those files that contain bytecode. 9335Therefore, you can mix and match object files and libraries with 9336GIMPLE bytecodes and final object code. GCC automatically selects 9337which files to optimize in LTO mode and which files to link without 9338further processing. 9339 9340There are some code generation flags preserved by GCC when 9341generating bytecodes, as they need to be used during the final link 9342stage. Generally options specified at link-time override those 9343specified at compile-time. 9344 9345If you do not specify an optimization level option @option{-O} at 9346link-time then GCC computes one based on the optimization levels 9347used when compiling the object files. The highest optimization 9348level wins here. 9349 9350Currently, the following options and their setting are take from 9351the first object file that explicitely specified it: 9352@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon}, 9353@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm} 9354and all the @option{-m} target flags. 9355 9356Certain ABI changing flags are required to match in all compilation-units 9357and trying to override this at link-time with a conflicting value 9358is ignored. This includes options such as @option{-freg-struct-return} 9359and @option{-fpcc-struct-return}. 9360 9361Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 9362@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 9363are passed through to the link stage and merged conservatively for 9364conflicting translation units. Specifically 9365@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 9366precedence and for example @option{-ffp-contract=off} takes precedence 9367over @option{-ffp-contract=fast}. You can override them at linke-time. 9368 9369It is recommended that you compile all the files participating in the 9370same link with the same options and also specify those options at 9371link time. 9372 9373If LTO encounters objects with C linkage declared with incompatible 9374types in separate translation units to be linked together (undefined 9375behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 9376issued. The behavior is still undefined at run time. Similar 9377diagnostics may be raised for other languages. 9378 9379Another feature of LTO is that it is possible to apply interprocedural 9380optimizations on files written in different languages: 9381 9382@smallexample 9383gcc -c -flto foo.c 9384g++ -c -flto bar.cc 9385gfortran -c -flto baz.f90 9386g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 9387@end smallexample 9388 9389Notice that the final link is done with @command{g++} to get the C++ 9390runtime libraries and @option{-lgfortran} is added to get the Fortran 9391runtime libraries. In general, when mixing languages in LTO mode, you 9392should use the same link command options as when mixing languages in a 9393regular (non-LTO) compilation. 9394 9395If object files containing GIMPLE bytecode are stored in a library archive, say 9396@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 9397are using a linker with plugin support. To create static libraries suitable 9398for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 9399and @command{ranlib}; 9400to show the symbols of object files with GIMPLE bytecode, use 9401@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 9402and @command{nm} have been compiled with plugin support. At link time, use the the 9403flag @option{-fuse-linker-plugin} to ensure that the library participates in 9404the LTO optimization process: 9405 9406@smallexample 9407gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 9408@end smallexample 9409 9410With the linker plugin enabled, the linker extracts the needed 9411GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 9412to make them part of the aggregated GIMPLE image to be optimized. 9413 9414If you are not using a linker with plugin support and/or do not 9415enable the linker plugin, then the objects inside @file{libfoo.a} 9416are extracted and linked as usual, but they do not participate 9417in the LTO optimization process. In order to make a static library suitable 9418for both LTO optimization and usual linkage, compile its object files with 9419@option{-flto} @option{-ffat-lto-objects}. 9420 9421Link-time optimizations do not require the presence of the whole program to 9422operate. If the program does not require any symbols to be exported, it is 9423possible to combine @option{-flto} and @option{-fwhole-program} to allow 9424the interprocedural optimizers to use more aggressive assumptions which may 9425lead to improved optimization opportunities. 9426Use of @option{-fwhole-program} is not needed when linker plugin is 9427active (see @option{-fuse-linker-plugin}). 9428 9429The current implementation of LTO makes no 9430attempt to generate bytecode that is portable between different 9431types of hosts. The bytecode files are versioned and there is a 9432strict version check, so bytecode files generated in one version of 9433GCC do not work with an older or newer version of GCC. 9434 9435Link-time optimization does not work well with generation of debugging 9436information. Combining @option{-flto} with 9437@option{-g} is currently experimental and expected to produce unexpected 9438results. 9439 9440If you specify the optional @var{n}, the optimization and code 9441generation done at link time is executed in parallel using @var{n} 9442parallel jobs by utilizing an installed @command{make} program. The 9443environment variable @env{MAKE} may be used to override the program 9444used. The default value for @var{n} is 1. 9445 9446You can also specify @option{-flto=jobserver} to use GNU make's 9447job server mode to determine the number of parallel jobs. This 9448is useful when the Makefile calling GCC is already executing in parallel. 9449You must prepend a @samp{+} to the command recipe in the parent Makefile 9450for this to work. This option likely only works if @env{MAKE} is 9451GNU make. 9452 9453@item -flto-partition=@var{alg} 9454@opindex flto-partition 9455Specify the partitioning algorithm used by the link-time optimizer. 9456The value is either @samp{1to1} to specify a partitioning mirroring 9457the original source files or @samp{balanced} to specify partitioning 9458into equally sized chunks (whenever possible) or @samp{max} to create 9459new partition for every symbol where possible. Specifying @samp{none} 9460as an algorithm disables partitioning and streaming completely. 9461The default value is @samp{balanced}. While @samp{1to1} can be used 9462as an workaround for various code ordering issues, the @samp{max} 9463partitioning is intended for internal testing only. 9464The value @samp{one} specifies that exactly one partition should be 9465used while the value @samp{none} bypasses partitioning and executes 9466the link-time optimization step directly from the WPA phase. 9467 9468@item -flto-odr-type-merging 9469@opindex flto-odr-type-merging 9470Enable streaming of mangled types names of C++ types and their unification 9471at linktime. This increases size of LTO object files, but enable 9472diagnostics about One Definition Rule violations. 9473 9474@item -flto-compression-level=@var{n} 9475@opindex flto-compression-level 9476This option specifies the level of compression used for intermediate 9477language written to LTO object files, and is only meaningful in 9478conjunction with LTO mode (@option{-flto}). Valid 9479values are 0 (no compression) to 9 (maximum compression). Values 9480outside this range are clamped to either 0 or 9. If the option is not 9481given, a default balanced compression setting is used. 9482 9483@item -flto-report 9484@opindex flto-report 9485Prints a report with internal details on the workings of the link-time 9486optimizer. The contents of this report vary from version to version. 9487It is meant to be useful to GCC developers when processing object 9488files in LTO mode (via @option{-flto}). 9489 9490Disabled by default. 9491 9492@item -flto-report-wpa 9493@opindex flto-report-wpa 9494Like @option{-flto-report}, but only print for the WPA phase of Link 9495Time Optimization. 9496 9497@item -fuse-linker-plugin 9498@opindex fuse-linker-plugin 9499Enables the use of a linker plugin during link-time optimization. This 9500option relies on plugin support in the linker, which is available in gold 9501or in GNU ld 2.21 or newer. 9502 9503This option enables the extraction of object files with GIMPLE bytecode out 9504of library archives. This improves the quality of optimization by exposing 9505more code to the link-time optimizer. This information specifies what 9506symbols can be accessed externally (by non-LTO object or during dynamic 9507linking). Resulting code quality improvements on binaries (and shared 9508libraries that use hidden visibility) are similar to @option{-fwhole-program}. 9509See @option{-flto} for a description of the effect of this flag and how to 9510use it. 9511 9512This option is enabled by default when LTO support in GCC is enabled 9513and GCC was configured for use with 9514a linker supporting plugins (GNU ld 2.21 or newer or gold). 9515 9516@item -ffat-lto-objects 9517@opindex ffat-lto-objects 9518Fat LTO objects are object files that contain both the intermediate language 9519and the object code. This makes them usable for both LTO linking and normal 9520linking. This option is effective only when compiling with @option{-flto} 9521and is ignored at link time. 9522 9523@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 9524requires the complete toolchain to be aware of LTO. It requires a linker with 9525linker plugin support for basic functionality. Additionally, 9526@command{nm}, @command{ar} and @command{ranlib} 9527need to support linker plugins to allow a full-featured build environment 9528(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 9529@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 9530to these tools. With non fat LTO makefiles need to be modified to use them. 9531 9532The default is @option{-fno-fat-lto-objects} on targets with linker plugin 9533support. 9534 9535@item -fcompare-elim 9536@opindex fcompare-elim 9537After register allocation and post-register allocation instruction splitting, 9538identify arithmetic instructions that compute processor flags similar to a 9539comparison operation based on that arithmetic. If possible, eliminate the 9540explicit comparison operation. 9541 9542This pass only applies to certain targets that cannot explicitly represent 9543the comparison operation before register allocation is complete. 9544 9545Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9546 9547@item -fcprop-registers 9548@opindex fcprop-registers 9549After register allocation and post-register allocation instruction splitting, 9550perform a copy-propagation pass to try to reduce scheduling dependencies 9551and occasionally eliminate the copy. 9552 9553Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9554 9555@item -fprofile-correction 9556@opindex fprofile-correction 9557Profiles collected using an instrumented binary for multi-threaded programs may 9558be inconsistent due to missed counter updates. When this option is specified, 9559GCC uses heuristics to correct or smooth out such inconsistencies. By 9560default, GCC emits an error message when an inconsistent profile is detected. 9561 9562@item -fprofile-dir=@var{path} 9563@opindex fprofile-dir 9564 9565Set the directory to search for the profile data files in to @var{path}. 9566This option affects only the profile data generated by 9567@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 9568and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 9569and its related options. Both absolute and relative paths can be used. 9570By default, GCC uses the current directory as @var{path}, thus the 9571profile data file appears in the same directory as the object file. 9572 9573@item -fprofile-generate 9574@itemx -fprofile-generate=@var{path} 9575@opindex fprofile-generate 9576 9577Enable options usually used for instrumenting application to produce 9578profile useful for later recompilation with profile feedback based 9579optimization. You must use @option{-fprofile-generate} both when 9580compiling and when linking your program. 9581 9582The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}. 9583 9584If @var{path} is specified, GCC looks at the @var{path} to find 9585the profile feedback data files. See @option{-fprofile-dir}. 9586 9587@item -fprofile-use 9588@itemx -fprofile-use=@var{path} 9589@opindex fprofile-use 9590Enable profile feedback-directed optimizations, 9591and the following optimizations 9592which are generally profitable only with profile feedback available: 9593@option{-fbranch-probabilities}, @option{-fvpt}, 9594@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, 9595@option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}. 9596 9597By default, GCC emits an error message if the feedback profiles do not 9598match the source code. This error can be turned into a warning by using 9599@option{-Wcoverage-mismatch}. Note this may result in poorly optimized 9600code. 9601 9602If @var{path} is specified, GCC looks at the @var{path} to find 9603the profile feedback data files. See @option{-fprofile-dir}. 9604 9605@item -fauto-profile 9606@itemx -fauto-profile=@var{path} 9607@opindex fauto-profile 9608Enable sampling-based feedback-directed optimizations, 9609and the following optimizations 9610which are generally profitable only with profile feedback available: 9611@option{-fbranch-probabilities}, @option{-fvpt}, 9612@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, 9613@option{-ftree-vectorize}, 9614@option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone}, 9615@option{-fpredictive-commoning}, @option{-funswitch-loops}, 9616@option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}. 9617 9618@var{path} is the name of a file containing AutoFDO profile information. 9619If omitted, it defaults to @file{fbdata.afdo} in the current directory. 9620 9621Producing an AutoFDO profile data file requires running your program 9622with the @command{perf} utility on a supported GNU/Linux target system. 9623For more information, see @uref{https://perf.wiki.kernel.org/}. 9624 9625E.g. 9626@smallexample 9627perf record -e br_inst_retired:near_taken -b -o perf.data \ 9628 -- your_program 9629@end smallexample 9630 9631Then use the @command{create_gcov} tool to convert the raw profile data 9632to a format that can be used by GCC.@ You must also supply the 9633unstripped binary for your program to this tool. 9634See @uref{https://github.com/google/autofdo}. 9635 9636E.g. 9637@smallexample 9638create_gcov --binary=your_program.unstripped --profile=perf.data \ 9639 --gcov=profile.afdo 9640@end smallexample 9641@end table 9642 9643The following options control compiler behavior regarding floating-point 9644arithmetic. These options trade off between speed and 9645correctness. All must be specifically enabled. 9646 9647@table @gcctabopt 9648@item -ffloat-store 9649@opindex ffloat-store 9650Do not store floating-point variables in registers, and inhibit other 9651options that might change whether a floating-point value is taken from a 9652register or memory. 9653 9654@cindex floating-point precision 9655This option prevents undesirable excess precision on machines such as 9656the 68000 where the floating registers (of the 68881) keep more 9657precision than a @code{double} is supposed to have. Similarly for the 9658x86 architecture. For most programs, the excess precision does only 9659good, but a few programs rely on the precise definition of IEEE floating 9660point. Use @option{-ffloat-store} for such programs, after modifying 9661them to store all pertinent intermediate computations into variables. 9662 9663@item -fexcess-precision=@var{style} 9664@opindex fexcess-precision 9665This option allows further control over excess precision on machines 9666where floating-point registers have more precision than the IEEE 9667@code{float} and @code{double} types and the processor does not 9668support operations rounding to those types. By default, 9669@option{-fexcess-precision=fast} is in effect; this means that 9670operations are carried out in the precision of the registers and that 9671it is unpredictable when rounding to the types specified in the source 9672code takes place. When compiling C, if 9673@option{-fexcess-precision=standard} is specified then excess 9674precision follows the rules specified in ISO C99; in particular, 9675both casts and assignments cause values to be rounded to their 9676semantic types (whereas @option{-ffloat-store} only affects 9677assignments). This option is enabled by default for C if a strict 9678conformance option such as @option{-std=c99} is used. 9679 9680@opindex mfpmath 9681@option{-fexcess-precision=standard} is not implemented for languages 9682other than C, and has no effect if 9683@option{-funsafe-math-optimizations} or @option{-ffast-math} is 9684specified. On the x86, it also has no effect if @option{-mfpmath=sse} 9685or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 9686semantics apply without excess precision, and in the latter, rounding 9687is unpredictable. 9688 9689@item -ffast-math 9690@opindex ffast-math 9691Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 9692@option{-ffinite-math-only}, @option{-fno-rounding-math}, 9693@option{-fno-signaling-nans} and @option{-fcx-limited-range}. 9694 9695This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 9696 9697This option is not turned on by any @option{-O} option besides 9698@option{-Ofast} since it can result in incorrect output for programs 9699that depend on an exact implementation of IEEE or ISO rules/specifications 9700for math functions. It may, however, yield faster code for programs 9701that do not require the guarantees of these specifications. 9702 9703@item -fno-math-errno 9704@opindex fno-math-errno 9705Do not set @code{errno} after calling math functions that are executed 9706with a single instruction, e.g., @code{sqrt}. A program that relies on 9707IEEE exceptions for math error handling may want to use this flag 9708for speed while maintaining IEEE arithmetic compatibility. 9709 9710This option is not turned on by any @option{-O} option since 9711it can result in incorrect output for programs that depend on 9712an exact implementation of IEEE or ISO rules/specifications for 9713math functions. It may, however, yield faster code for programs 9714that do not require the guarantees of these specifications. 9715 9716The default is @option{-fmath-errno}. 9717 9718On Darwin systems, the math library never sets @code{errno}. There is 9719therefore no reason for the compiler to consider the possibility that 9720it might, and @option{-fno-math-errno} is the default. 9721 9722@item -funsafe-math-optimizations 9723@opindex funsafe-math-optimizations 9724 9725Allow optimizations for floating-point arithmetic that (a) assume 9726that arguments and results are valid and (b) may violate IEEE or 9727ANSI standards. When used at link-time, it may include libraries 9728or startup files that change the default FPU control word or other 9729similar optimizations. 9730 9731This option is not turned on by any @option{-O} option since 9732it can result in incorrect output for programs that depend on 9733an exact implementation of IEEE or ISO rules/specifications for 9734math functions. It may, however, yield faster code for programs 9735that do not require the guarantees of these specifications. 9736Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 9737@option{-fassociative-math} and @option{-freciprocal-math}. 9738 9739The default is @option{-fno-unsafe-math-optimizations}. 9740 9741@item -fassociative-math 9742@opindex fassociative-math 9743 9744Allow re-association of operands in series of floating-point operations. 9745This violates the ISO C and C++ language standard by possibly changing 9746computation result. NOTE: re-ordering may change the sign of zero as 9747well as ignore NaNs and inhibit or create underflow or overflow (and 9748thus cannot be used on code that relies on rounding behavior like 9749@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 9750and thus may not be used when ordered comparisons are required. 9751This option requires that both @option{-fno-signed-zeros} and 9752@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 9753much sense with @option{-frounding-math}. For Fortran the option 9754is automatically enabled when both @option{-fno-signed-zeros} and 9755@option{-fno-trapping-math} are in effect. 9756 9757The default is @option{-fno-associative-math}. 9758 9759@item -freciprocal-math 9760@opindex freciprocal-math 9761 9762Allow the reciprocal of a value to be used instead of dividing by 9763the value if this enables optimizations. For example @code{x / y} 9764can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 9765is subject to common subexpression elimination. Note that this loses 9766precision and increases the number of flops operating on the value. 9767 9768The default is @option{-fno-reciprocal-math}. 9769 9770@item -ffinite-math-only 9771@opindex ffinite-math-only 9772Allow optimizations for floating-point arithmetic that assume 9773that arguments and results are not NaNs or +-Infs. 9774 9775This option is not turned on by any @option{-O} option since 9776it can result in incorrect output for programs that depend on 9777an exact implementation of IEEE or ISO rules/specifications for 9778math functions. It may, however, yield faster code for programs 9779that do not require the guarantees of these specifications. 9780 9781The default is @option{-fno-finite-math-only}. 9782 9783@item -fno-signed-zeros 9784@opindex fno-signed-zeros 9785Allow optimizations for floating-point arithmetic that ignore the 9786signedness of zero. IEEE arithmetic specifies the behavior of 9787distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 9788of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 9789This option implies that the sign of a zero result isn't significant. 9790 9791The default is @option{-fsigned-zeros}. 9792 9793@item -fno-trapping-math 9794@opindex fno-trapping-math 9795Compile code assuming that floating-point operations cannot generate 9796user-visible traps. These traps include division by zero, overflow, 9797underflow, inexact result and invalid operation. This option requires 9798that @option{-fno-signaling-nans} be in effect. Setting this option may 9799allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 9800 9801This option should never be turned on by any @option{-O} option since 9802it can result in incorrect output for programs that depend on 9803an exact implementation of IEEE or ISO rules/specifications for 9804math functions. 9805 9806The default is @option{-ftrapping-math}. 9807 9808@item -frounding-math 9809@opindex frounding-math 9810Disable transformations and optimizations that assume default floating-point 9811rounding behavior. This is round-to-zero for all floating point 9812to integer conversions, and round-to-nearest for all other arithmetic 9813truncations. This option should be specified for programs that change 9814the FP rounding mode dynamically, or that may be executed with a 9815non-default rounding mode. This option disables constant folding of 9816floating-point expressions at compile time (which may be affected by 9817rounding mode) and arithmetic transformations that are unsafe in the 9818presence of sign-dependent rounding modes. 9819 9820The default is @option{-fno-rounding-math}. 9821 9822This option is experimental and does not currently guarantee to 9823disable all GCC optimizations that are affected by rounding mode. 9824Future versions of GCC may provide finer control of this setting 9825using C99's @code{FENV_ACCESS} pragma. This command-line option 9826will be used to specify the default state for @code{FENV_ACCESS}. 9827 9828@item -fsignaling-nans 9829@opindex fsignaling-nans 9830Compile code assuming that IEEE signaling NaNs may generate user-visible 9831traps during floating-point operations. Setting this option disables 9832optimizations that may change the number of exceptions visible with 9833signaling NaNs. This option implies @option{-ftrapping-math}. 9834 9835This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 9836be defined. 9837 9838The default is @option{-fno-signaling-nans}. 9839 9840This option is experimental and does not currently guarantee to 9841disable all GCC optimizations that affect signaling NaN behavior. 9842 9843@item -fsingle-precision-constant 9844@opindex fsingle-precision-constant 9845Treat floating-point constants as single precision instead of 9846implicitly converting them to double-precision constants. 9847 9848@item -fcx-limited-range 9849@opindex fcx-limited-range 9850When enabled, this option states that a range reduction step is not 9851needed when performing complex division. Also, there is no checking 9852whether the result of a complex multiplication or division is @code{NaN 9853+ I*NaN}, with an attempt to rescue the situation in that case. The 9854default is @option{-fno-cx-limited-range}, but is enabled by 9855@option{-ffast-math}. 9856 9857This option controls the default setting of the ISO C99 9858@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 9859all languages. 9860 9861@item -fcx-fortran-rules 9862@opindex fcx-fortran-rules 9863Complex multiplication and division follow Fortran rules. Range 9864reduction is done as part of complex division, but there is no checking 9865whether the result of a complex multiplication or division is @code{NaN 9866+ I*NaN}, with an attempt to rescue the situation in that case. 9867 9868The default is @option{-fno-cx-fortran-rules}. 9869 9870@end table 9871 9872The following options control optimizations that may improve 9873performance, but are not enabled by any @option{-O} options. This 9874section includes experimental options that may produce broken code. 9875 9876@table @gcctabopt 9877@item -fbranch-probabilities 9878@opindex fbranch-probabilities 9879After running a program compiled with @option{-fprofile-arcs} 9880(@pxref{Debugging Options,, Options for Debugging Your Program or 9881@command{gcc}}), you can compile it a second time using 9882@option{-fbranch-probabilities}, to improve optimizations based on 9883the number of times each branch was taken. When a program 9884compiled with @option{-fprofile-arcs} exits, it saves arc execution 9885counts to a file called @file{@var{sourcename}.gcda} for each source 9886file. The information in this data file is very dependent on the 9887structure of the generated code, so you must use the same source code 9888and the same optimization options for both compilations. 9889 9890With @option{-fbranch-probabilities}, GCC puts a 9891@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 9892These can be used to improve optimization. Currently, they are only 9893used in one place: in @file{reorg.c}, instead of guessing which path a 9894branch is most likely to take, the @samp{REG_BR_PROB} values are used to 9895exactly determine which path is taken more often. 9896 9897@item -fprofile-values 9898@opindex fprofile-values 9899If combined with @option{-fprofile-arcs}, it adds code so that some 9900data about values of expressions in the program is gathered. 9901 9902With @option{-fbranch-probabilities}, it reads back the data gathered 9903from profiling values of expressions for usage in optimizations. 9904 9905Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 9906 9907@item -fprofile-reorder-functions 9908@opindex fprofile-reorder-functions 9909Function reordering based on profile instrumentation collects 9910first time of execution of a function and orders these functions 9911in ascending order. 9912 9913Enabled with @option{-fprofile-use}. 9914 9915@item -fvpt 9916@opindex fvpt 9917If combined with @option{-fprofile-arcs}, this option instructs the compiler 9918to add code to gather information about values of expressions. 9919 9920With @option{-fbranch-probabilities}, it reads back the data gathered 9921and actually performs the optimizations based on them. 9922Currently the optimizations include specialization of division operations 9923using the knowledge about the value of the denominator. 9924 9925@item -frename-registers 9926@opindex frename-registers 9927Attempt to avoid false dependencies in scheduled code by making use 9928of registers left over after register allocation. This optimization 9929most benefits processors with lots of registers. Depending on the 9930debug information format adopted by the target, however, it can 9931make debugging impossible, since variables no longer stay in 9932a ``home register''. 9933 9934Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}. 9935 9936@item -fschedule-fusion 9937@opindex fschedule-fusion 9938Performs a target dependent pass over the instruction stream to schedule 9939instructions of same type together because target machine can execute them 9940more efficiently if they are adjacent to each other in the instruction flow. 9941 9942Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9943 9944@item -ftracer 9945@opindex ftracer 9946Perform tail duplication to enlarge superblock size. This transformation 9947simplifies the control flow of the function allowing other optimizations to do 9948a better job. 9949 9950Enabled with @option{-fprofile-use}. 9951 9952@item -funroll-loops 9953@opindex funroll-loops 9954Unroll loops whose number of iterations can be determined at compile time or 9955upon entry to the loop. @option{-funroll-loops} implies 9956@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 9957It also turns on complete loop peeling (i.e.@: complete removal of loops with 9958a small constant number of iterations). This option makes code larger, and may 9959or may not make it run faster. 9960 9961Enabled with @option{-fprofile-use}. 9962 9963@item -funroll-all-loops 9964@opindex funroll-all-loops 9965Unroll all loops, even if their number of iterations is uncertain when 9966the loop is entered. This usually makes programs run more slowly. 9967@option{-funroll-all-loops} implies the same options as 9968@option{-funroll-loops}. 9969 9970@item -fpeel-loops 9971@opindex fpeel-loops 9972Peels loops for which there is enough information that they do not 9973roll much (from profile feedback). It also turns on complete loop peeling 9974(i.e.@: complete removal of loops with small constant number of iterations). 9975 9976Enabled with @option{-fprofile-use}. 9977 9978@item -fmove-loop-invariants 9979@opindex fmove-loop-invariants 9980Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 9981at level @option{-O1} 9982 9983@item -funswitch-loops 9984@opindex funswitch-loops 9985Move branches with loop invariant conditions out of the loop, with duplicates 9986of the loop on both branches (modified according to result of the condition). 9987 9988@item -ffunction-sections 9989@itemx -fdata-sections 9990@opindex ffunction-sections 9991@opindex fdata-sections 9992Place each function or data item into its own section in the output 9993file if the target supports arbitrary sections. The name of the 9994function or the name of the data item determines the section's name 9995in the output file. 9996 9997Use these options on systems where the linker can perform optimizations 9998to improve locality of reference in the instruction space. Most systems 9999using the ELF object format and SPARC processors running Solaris 2 have 10000linkers with such optimizations. AIX may have these optimizations in 10001the future. 10002 10003Only use these options when there are significant benefits from doing 10004so. When you specify these options, the assembler and linker 10005create larger object and executable files and are also slower. 10006You cannot use @command{gprof} on all systems if you 10007specify this option, and you may have problems with debugging if 10008you specify both this option and @option{-g}. 10009 10010@item -fbranch-target-load-optimize 10011@opindex fbranch-target-load-optimize 10012Perform branch target register load optimization before prologue / epilogue 10013threading. 10014The use of target registers can typically be exposed only during reload, 10015thus hoisting loads out of loops and doing inter-block scheduling needs 10016a separate optimization pass. 10017 10018@item -fbranch-target-load-optimize2 10019@opindex fbranch-target-load-optimize2 10020Perform branch target register load optimization after prologue / epilogue 10021threading. 10022 10023@item -fbtr-bb-exclusive 10024@opindex fbtr-bb-exclusive 10025When performing branch target register load optimization, don't reuse 10026branch target registers within any basic block. 10027 10028@item -fstack-protector 10029@opindex fstack-protector 10030Emit extra code to check for buffer overflows, such as stack smashing 10031attacks. This is done by adding a guard variable to functions with 10032vulnerable objects. This includes functions that call @code{alloca}, and 10033functions with buffers larger than 8 bytes. The guards are initialized 10034when a function is entered and then checked when the function exits. 10035If a guard check fails, an error message is printed and the program exits. 10036 10037@item -fstack-protector-all 10038@opindex fstack-protector-all 10039Like @option{-fstack-protector} except that all functions are protected. 10040 10041@item -fstack-protector-strong 10042@opindex fstack-protector-strong 10043Like @option{-fstack-protector} but includes additional functions to 10044be protected --- those that have local array definitions, or have 10045references to local frame addresses. 10046 10047@item -fstack-protector-explicit 10048@opindex fstack-protector-explicit 10049Like @option{-fstack-protector} but only protects those functions which 10050have the @code{stack_protect} attribute 10051 10052@item -fstdarg-opt 10053@opindex fstdarg-opt 10054Optimize the prologue of variadic argument functions with respect to usage of 10055those arguments. 10056 10057@item -fsection-anchors 10058@opindex fsection-anchors 10059Try to reduce the number of symbolic address calculations by using 10060shared ``anchor'' symbols to address nearby objects. This transformation 10061can help to reduce the number of GOT entries and GOT accesses on some 10062targets. 10063 10064For example, the implementation of the following function @code{foo}: 10065 10066@smallexample 10067static int a, b, c; 10068int foo (void) @{ return a + b + c; @} 10069@end smallexample 10070 10071@noindent 10072usually calculates the addresses of all three variables, but if you 10073compile it with @option{-fsection-anchors}, it accesses the variables 10074from a common anchor point instead. The effect is similar to the 10075following pseudocode (which isn't valid C): 10076 10077@smallexample 10078int foo (void) 10079@{ 10080 register int *xr = &x; 10081 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 10082@} 10083@end smallexample 10084 10085Not all targets support this option. 10086 10087@item --param @var{name}=@var{value} 10088@opindex param 10089In some places, GCC uses various constants to control the amount of 10090optimization that is done. For example, GCC does not inline functions 10091that contain more than a certain number of instructions. You can 10092control some of these constants on the command line using the 10093@option{--param} option. 10094 10095The names of specific parameters, and the meaning of the values, are 10096tied to the internals of the compiler, and are subject to change 10097without notice in future releases. 10098 10099In each case, the @var{value} is an integer. The allowable choices for 10100@var{name} are: 10101 10102@table @gcctabopt 10103@item predictable-branch-outcome 10104When branch is predicted to be taken with probability lower than this threshold 10105(in percent), then it is considered well predictable. The default is 10. 10106 10107@item max-crossjump-edges 10108The maximum number of incoming edges to consider for cross-jumping. 10109The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 10110the number of edges incoming to each block. Increasing values mean 10111more aggressive optimization, making the compilation time increase with 10112probably small improvement in executable size. 10113 10114@item min-crossjump-insns 10115The minimum number of instructions that must be matched at the end 10116of two blocks before cross-jumping is performed on them. This 10117value is ignored in the case where all instructions in the block being 10118cross-jumped from are matched. The default value is 5. 10119 10120@item max-grow-copy-bb-insns 10121The maximum code size expansion factor when copying basic blocks 10122instead of jumping. The expansion is relative to a jump instruction. 10123The default value is 8. 10124 10125@item max-goto-duplication-insns 10126The maximum number of instructions to duplicate to a block that jumps 10127to a computed goto. To avoid @math{O(N^2)} behavior in a number of 10128passes, GCC factors computed gotos early in the compilation process, 10129and unfactors them as late as possible. Only computed jumps at the 10130end of a basic blocks with no more than max-goto-duplication-insns are 10131unfactored. The default value is 8. 10132 10133@item max-delay-slot-insn-search 10134The maximum number of instructions to consider when looking for an 10135instruction to fill a delay slot. If more than this arbitrary number of 10136instructions are searched, the time savings from filling the delay slot 10137are minimal, so stop searching. Increasing values mean more 10138aggressive optimization, making the compilation time increase with probably 10139small improvement in execution time. 10140 10141@item max-delay-slot-live-search 10142When trying to fill delay slots, the maximum number of instructions to 10143consider when searching for a block with valid live register 10144information. Increasing this arbitrarily chosen value means more 10145aggressive optimization, increasing the compilation time. This parameter 10146should be removed when the delay slot code is rewritten to maintain the 10147control-flow graph. 10148 10149@item max-gcse-memory 10150The approximate maximum amount of memory that can be allocated in 10151order to perform the global common subexpression elimination 10152optimization. If more memory than specified is required, the 10153optimization is not done. 10154 10155@item max-gcse-insertion-ratio 10156If the ratio of expression insertions to deletions is larger than this value 10157for any expression, then RTL PRE inserts or removes the expression and thus 10158leaves partially redundant computations in the instruction stream. The default value is 20. 10159 10160@item max-pending-list-length 10161The maximum number of pending dependencies scheduling allows 10162before flushing the current state and starting over. Large functions 10163with few branches or calls can create excessively large lists which 10164needlessly consume memory and resources. 10165 10166@item max-modulo-backtrack-attempts 10167The maximum number of backtrack attempts the scheduler should make 10168when modulo scheduling a loop. Larger values can exponentially increase 10169compilation time. 10170 10171@item max-inline-insns-single 10172Several parameters control the tree inliner used in GCC@. 10173This number sets the maximum number of instructions (counted in GCC's 10174internal representation) in a single function that the tree inliner 10175considers for inlining. This only affects functions declared 10176inline and methods implemented in a class declaration (C++). 10177The default value is 400. 10178 10179@item max-inline-insns-auto 10180When you use @option{-finline-functions} (included in @option{-O3}), 10181a lot of functions that would otherwise not be considered for inlining 10182by the compiler are investigated. To those functions, a different 10183(more restrictive) limit compared to functions declared inline can 10184be applied. 10185The default value is 40. 10186 10187@item inline-min-speedup 10188When estimated performance improvement of caller + callee runtime exceeds this 10189threshold (in precent), the function can be inlined regardless the limit on 10190@option{--param max-inline-insns-single} and @option{--param 10191max-inline-insns-auto}. 10192 10193@item large-function-insns 10194The limit specifying really large functions. For functions larger than this 10195limit after inlining, inlining is constrained by 10196@option{--param large-function-growth}. This parameter is useful primarily 10197to avoid extreme compilation time caused by non-linear algorithms used by the 10198back end. 10199The default value is 2700. 10200 10201@item large-function-growth 10202Specifies maximal growth of large function caused by inlining in percents. 10203The default value is 100 which limits large function growth to 2.0 times 10204the original size. 10205 10206@item large-unit-insns 10207The limit specifying large translation unit. Growth caused by inlining of 10208units larger than this limit is limited by @option{--param inline-unit-growth}. 10209For small units this might be too tight. 10210For example, consider a unit consisting of function A 10211that is inline and B that just calls A three times. If B is small relative to 10212A, the growth of unit is 300\% and yet such inlining is very sane. For very 10213large units consisting of small inlineable functions, however, the overall unit 10214growth limit is needed to avoid exponential explosion of code size. Thus for 10215smaller units, the size is increased to @option{--param large-unit-insns} 10216before applying @option{--param inline-unit-growth}. The default is 10000. 10217 10218@item inline-unit-growth 10219Specifies maximal overall growth of the compilation unit caused by inlining. 10220The default value is 20 which limits unit growth to 1.2 times the original 10221size. Cold functions (either marked cold via an attribute or by profile 10222feedback) are not accounted into the unit size. 10223 10224@item ipcp-unit-growth 10225Specifies maximal overall growth of the compilation unit caused by 10226interprocedural constant propagation. The default value is 10 which limits 10227unit growth to 1.1 times the original size. 10228 10229@item large-stack-frame 10230The limit specifying large stack frames. While inlining the algorithm is trying 10231to not grow past this limit too much. The default value is 256 bytes. 10232 10233@item large-stack-frame-growth 10234Specifies maximal growth of large stack frames caused by inlining in percents. 10235The default value is 1000 which limits large stack frame growth to 11 times 10236the original size. 10237 10238@item max-inline-insns-recursive 10239@itemx max-inline-insns-recursive-auto 10240Specifies the maximum number of instructions an out-of-line copy of a 10241self-recursive inline 10242function can grow into by performing recursive inlining. 10243 10244@option{--param max-inline-insns-recursive} applies to functions 10245declared inline. 10246For functions not declared inline, recursive inlining 10247happens only when @option{-finline-functions} (included in @option{-O3}) is 10248enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The 10249default value is 450. 10250 10251@item max-inline-recursive-depth 10252@itemx max-inline-recursive-depth-auto 10253Specifies the maximum recursion depth used for recursive inlining. 10254 10255@option{--param max-inline-recursive-depth} applies to functions 10256declared inline. For functions not declared inline, recursive inlining 10257happens only when @option{-finline-functions} (included in @option{-O3}) is 10258enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The 10259default value is 8. 10260 10261@item min-inline-recursive-probability 10262Recursive inlining is profitable only for function having deep recursion 10263in average and can hurt for function having little recursion depth by 10264increasing the prologue size or complexity of function body to other 10265optimizers. 10266 10267When profile feedback is available (see @option{-fprofile-generate}) the actual 10268recursion depth can be guessed from probability that function recurses via a 10269given call expression. This parameter limits inlining only to call expressions 10270whose probability exceeds the given threshold (in percents). 10271The default value is 10. 10272 10273@item early-inlining-insns 10274Specify growth that the early inliner can make. In effect it increases 10275the amount of inlining for code having a large abstraction penalty. 10276The default value is 14. 10277 10278@item max-early-inliner-iterations 10279Limit of iterations of the early inliner. This basically bounds 10280the number of nested indirect calls the early inliner can resolve. 10281Deeper chains are still handled by late inlining. 10282 10283@item comdat-sharing-probability 10284Probability (in percent) that C++ inline function with comdat visibility 10285are shared across multiple compilation units. The default value is 20. 10286 10287@item profile-func-internal-id 10288A parameter to control whether to use function internal id in profile 10289database lookup. If the value is 0, the compiler uses an id that 10290is based on function assembler name and filename, which makes old profile 10291data more tolerant to source changes such as function reordering etc. 10292The default value is 0. 10293 10294@item min-vect-loop-bound 10295The minimum number of iterations under which loops are not vectorized 10296when @option{-ftree-vectorize} is used. The number of iterations after 10297vectorization needs to be greater than the value specified by this option 10298to allow vectorization. The default value is 0. 10299 10300@item gcse-cost-distance-ratio 10301Scaling factor in calculation of maximum distance an expression 10302can be moved by GCSE optimizations. This is currently supported only in the 10303code hoisting pass. The bigger the ratio, the more aggressive code hoisting 10304is with simple expressions, i.e., the expressions that have cost 10305less than @option{gcse-unrestricted-cost}. Specifying 0 disables 10306hoisting of simple expressions. The default value is 10. 10307 10308@item gcse-unrestricted-cost 10309Cost, roughly measured as the cost of a single typical machine 10310instruction, at which GCSE optimizations do not constrain 10311the distance an expression can travel. This is currently 10312supported only in the code hoisting pass. The lesser the cost, 10313the more aggressive code hoisting is. Specifying 0 10314allows all expressions to travel unrestricted distances. 10315The default value is 3. 10316 10317@item max-hoist-depth 10318The depth of search in the dominator tree for expressions to hoist. 10319This is used to avoid quadratic behavior in hoisting algorithm. 10320The value of 0 does not limit on the search, but may slow down compilation 10321of huge functions. The default value is 30. 10322 10323@item max-tail-merge-comparisons 10324The maximum amount of similar bbs to compare a bb with. This is used to 10325avoid quadratic behavior in tree tail merging. The default value is 10. 10326 10327@item max-tail-merge-iterations 10328The maximum amount of iterations of the pass over the function. This is used to 10329limit compilation time in tree tail merging. The default value is 2. 10330 10331@item max-unrolled-insns 10332The maximum number of instructions that a loop may have to be unrolled. 10333If a loop is unrolled, this parameter also determines how many times 10334the loop code is unrolled. 10335 10336@item max-average-unrolled-insns 10337The maximum number of instructions biased by probabilities of their execution 10338that a loop may have to be unrolled. If a loop is unrolled, 10339this parameter also determines how many times the loop code is unrolled. 10340 10341@item max-unroll-times 10342The maximum number of unrollings of a single loop. 10343 10344@item max-peeled-insns 10345The maximum number of instructions that a loop may have to be peeled. 10346If a loop is peeled, this parameter also determines how many times 10347the loop code is peeled. 10348 10349@item max-peel-times 10350The maximum number of peelings of a single loop. 10351 10352@item max-peel-branches 10353The maximum number of branches on the hot path through the peeled sequence. 10354 10355@item max-completely-peeled-insns 10356The maximum number of insns of a completely peeled loop. 10357 10358@item max-completely-peel-times 10359The maximum number of iterations of a loop to be suitable for complete peeling. 10360 10361@item max-completely-peel-loop-nest-depth 10362The maximum depth of a loop nest suitable for complete peeling. 10363 10364@item max-unswitch-insns 10365The maximum number of insns of an unswitched loop. 10366 10367@item max-unswitch-level 10368The maximum number of branches unswitched in a single loop. 10369 10370@item lim-expensive 10371The minimum cost of an expensive expression in the loop invariant motion. 10372 10373@item iv-consider-all-candidates-bound 10374Bound on number of candidates for induction variables, below which 10375all candidates are considered for each use in induction variable 10376optimizations. If there are more candidates than this, 10377only the most relevant ones are considered to avoid quadratic time complexity. 10378 10379@item iv-max-considered-uses 10380The induction variable optimizations give up on loops that contain more 10381induction variable uses. 10382 10383@item iv-always-prune-cand-set-bound 10384If the number of candidates in the set is smaller than this value, 10385always try to remove unnecessary ivs from the set 10386when adding a new one. 10387 10388@item scev-max-expr-size 10389Bound on size of expressions used in the scalar evolutions analyzer. 10390Large expressions slow the analyzer. 10391 10392@item scev-max-expr-complexity 10393Bound on the complexity of the expressions in the scalar evolutions analyzer. 10394Complex expressions slow the analyzer. 10395 10396@item omega-max-vars 10397The maximum number of variables in an Omega constraint system. 10398The default value is 128. 10399 10400@item omega-max-geqs 10401The maximum number of inequalities in an Omega constraint system. 10402The default value is 256. 10403 10404@item omega-max-eqs 10405The maximum number of equalities in an Omega constraint system. 10406The default value is 128. 10407 10408@item omega-max-wild-cards 10409The maximum number of wildcard variables that the Omega solver is 10410able to insert. The default value is 18. 10411 10412@item omega-hash-table-size 10413The size of the hash table in the Omega solver. The default value is 10414550. 10415 10416@item omega-max-keys 10417The maximal number of keys used by the Omega solver. The default 10418value is 500. 10419 10420@item omega-eliminate-redundant-constraints 10421When set to 1, use expensive methods to eliminate all redundant 10422constraints. The default value is 0. 10423 10424@item vect-max-version-for-alignment-checks 10425The maximum number of run-time checks that can be performed when 10426doing loop versioning for alignment in the vectorizer. 10427 10428@item vect-max-version-for-alias-checks 10429The maximum number of run-time checks that can be performed when 10430doing loop versioning for alias in the vectorizer. 10431 10432@item vect-max-peeling-for-alignment 10433The maximum number of loop peels to enhance access alignment 10434for vectorizer. Value -1 means 'no limit'. 10435 10436@item max-iterations-to-track 10437The maximum number of iterations of a loop the brute-force algorithm 10438for analysis of the number of iterations of the loop tries to evaluate. 10439 10440@item hot-bb-count-ws-permille 10441A basic block profile count is considered hot if it contributes to 10442the given permillage (i.e. 0...1000) of the entire profiled execution. 10443 10444@item hot-bb-frequency-fraction 10445Select fraction of the entry block frequency of executions of basic block in 10446function given basic block needs to have to be considered hot. 10447 10448@item max-predicted-iterations 10449The maximum number of loop iterations we predict statically. This is useful 10450in cases where a function contains a single loop with known bound and 10451another loop with unknown bound. 10452The known number of iterations is predicted correctly, while 10453the unknown number of iterations average to roughly 10. This means that the 10454loop without bounds appears artificially cold relative to the other one. 10455 10456@item builtin-expect-probability 10457Control the probability of the expression having the specified value. This 10458parameter takes a percentage (i.e. 0 ... 100) as input. 10459The default probability of 90 is obtained empirically. 10460 10461@item align-threshold 10462 10463Select fraction of the maximal frequency of executions of a basic block in 10464a function to align the basic block. 10465 10466@item align-loop-iterations 10467 10468A loop expected to iterate at least the selected number of iterations is 10469aligned. 10470 10471@item tracer-dynamic-coverage 10472@itemx tracer-dynamic-coverage-feedback 10473 10474This value is used to limit superblock formation once the given percentage of 10475executed instructions is covered. This limits unnecessary code size 10476expansion. 10477 10478The @option{tracer-dynamic-coverage-feedback} parameter 10479is used only when profile 10480feedback is available. The real profiles (as opposed to statically estimated 10481ones) are much less balanced allowing the threshold to be larger value. 10482 10483@item tracer-max-code-growth 10484Stop tail duplication once code growth has reached given percentage. This is 10485a rather artificial limit, as most of the duplicates are eliminated later in 10486cross jumping, so it may be set to much higher values than is the desired code 10487growth. 10488 10489@item tracer-min-branch-ratio 10490 10491Stop reverse growth when the reverse probability of best edge is less than this 10492threshold (in percent). 10493 10494@item tracer-min-branch-ratio 10495@itemx tracer-min-branch-ratio-feedback 10496 10497Stop forward growth if the best edge has probability lower than this 10498threshold. 10499 10500Similarly to @option{tracer-dynamic-coverage} two values are present, one for 10501compilation for profile feedback and one for compilation without. The value 10502for compilation with profile feedback needs to be more conservative (higher) in 10503order to make tracer effective. 10504 10505@item max-cse-path-length 10506 10507The maximum number of basic blocks on path that CSE considers. 10508The default is 10. 10509 10510@item max-cse-insns 10511The maximum number of instructions CSE processes before flushing. 10512The default is 1000. 10513 10514@item ggc-min-expand 10515 10516GCC uses a garbage collector to manage its own memory allocation. This 10517parameter specifies the minimum percentage by which the garbage 10518collector's heap should be allowed to expand between collections. 10519Tuning this may improve compilation speed; it has no effect on code 10520generation. 10521 10522The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 10523RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 10524the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 10525GCC is not able to calculate RAM on a particular platform, the lower 10526bound of 30% is used. Setting this parameter and 10527@option{ggc-min-heapsize} to zero causes a full collection to occur at 10528every opportunity. This is extremely slow, but can be useful for 10529debugging. 10530 10531@item ggc-min-heapsize 10532 10533Minimum size of the garbage collector's heap before it begins bothering 10534to collect garbage. The first collection occurs after the heap expands 10535by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 10536tuning this may improve compilation speed, and has no effect on code 10537generation. 10538 10539The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 10540tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 10541with a lower bound of 4096 (four megabytes) and an upper bound of 10542131072 (128 megabytes). If GCC is not able to calculate RAM on a 10543particular platform, the lower bound is used. Setting this parameter 10544very large effectively disables garbage collection. Setting this 10545parameter and @option{ggc-min-expand} to zero causes a full collection 10546to occur at every opportunity. 10547 10548@item max-reload-search-insns 10549The maximum number of instruction reload should look backward for equivalent 10550register. Increasing values mean more aggressive optimization, making the 10551compilation time increase with probably slightly better performance. 10552The default value is 100. 10553 10554@item max-cselib-memory-locations 10555The maximum number of memory locations cselib should take into account. 10556Increasing values mean more aggressive optimization, making the compilation time 10557increase with probably slightly better performance. The default value is 500. 10558 10559@item reorder-blocks-duplicate 10560@itemx reorder-blocks-duplicate-feedback 10561 10562Used by the basic block reordering pass to decide whether to use unconditional 10563branch or duplicate the code on its destination. Code is duplicated when its 10564estimated size is smaller than this value multiplied by the estimated size of 10565unconditional jump in the hot spots of the program. 10566 10567The @option{reorder-block-duplicate-feedback} parameter 10568is used only when profile 10569feedback is available. It may be set to higher values than 10570@option{reorder-block-duplicate} since information about the hot spots is more 10571accurate. 10572 10573@item max-sched-ready-insns 10574The maximum number of instructions ready to be issued the scheduler should 10575consider at any given time during the first scheduling pass. Increasing 10576values mean more thorough searches, making the compilation time increase 10577with probably little benefit. The default value is 100. 10578 10579@item max-sched-region-blocks 10580The maximum number of blocks in a region to be considered for 10581interblock scheduling. The default value is 10. 10582 10583@item max-pipeline-region-blocks 10584The maximum number of blocks in a region to be considered for 10585pipelining in the selective scheduler. The default value is 15. 10586 10587@item max-sched-region-insns 10588The maximum number of insns in a region to be considered for 10589interblock scheduling. The default value is 100. 10590 10591@item max-pipeline-region-insns 10592The maximum number of insns in a region to be considered for 10593pipelining in the selective scheduler. The default value is 200. 10594 10595@item min-spec-prob 10596The minimum probability (in percents) of reaching a source block 10597for interblock speculative scheduling. The default value is 40. 10598 10599@item max-sched-extend-regions-iters 10600The maximum number of iterations through CFG to extend regions. 10601A value of 0 (the default) disables region extensions. 10602 10603@item max-sched-insn-conflict-delay 10604The maximum conflict delay for an insn to be considered for speculative motion. 10605The default value is 3. 10606 10607@item sched-spec-prob-cutoff 10608The minimal probability of speculation success (in percents), so that 10609speculative insns are scheduled. 10610The default value is 40. 10611 10612@item sched-spec-state-edge-prob-cutoff 10613The minimum probability an edge must have for the scheduler to save its 10614state across it. 10615The default value is 10. 10616 10617@item sched-mem-true-dep-cost 10618Minimal distance (in CPU cycles) between store and load targeting same 10619memory locations. The default value is 1. 10620 10621@item selsched-max-lookahead 10622The maximum size of the lookahead window of selective scheduling. It is a 10623depth of search for available instructions. 10624The default value is 50. 10625 10626@item selsched-max-sched-times 10627The maximum number of times that an instruction is scheduled during 10628selective scheduling. This is the limit on the number of iterations 10629through which the instruction may be pipelined. The default value is 2. 10630 10631@item selsched-max-insns-to-rename 10632The maximum number of best instructions in the ready list that are considered 10633for renaming in the selective scheduler. The default value is 2. 10634 10635@item sms-min-sc 10636The minimum value of stage count that swing modulo scheduler 10637generates. The default value is 2. 10638 10639@item max-last-value-rtl 10640The maximum size measured as number of RTLs that can be recorded in an expression 10641in combiner for a pseudo register as last known value of that register. The default 10642is 10000. 10643 10644@item max-combine-insns 10645The maximum number of instructions the RTL combiner tries to combine. 10646The default value is 2 at @option{-Og} and 4 otherwise. 10647 10648@item integer-share-limit 10649Small integer constants can use a shared data structure, reducing the 10650compiler's memory usage and increasing its speed. This sets the maximum 10651value of a shared integer constant. The default value is 256. 10652 10653@item ssp-buffer-size 10654The minimum size of buffers (i.e.@: arrays) that receive stack smashing 10655protection when @option{-fstack-protection} is used. 10656 10657@item min-size-for-stack-sharing 10658The minimum size of variables taking part in stack slot sharing when not 10659optimizing. The default value is 32. 10660 10661@item max-jump-thread-duplication-stmts 10662Maximum number of statements allowed in a block that needs to be 10663duplicated when threading jumps. 10664 10665@item max-fields-for-field-sensitive 10666Maximum number of fields in a structure treated in 10667a field sensitive manner during pointer analysis. The default is zero 10668for @option{-O0} and @option{-O1}, 10669and 100 for @option{-Os}, @option{-O2}, and @option{-O3}. 10670 10671@item prefetch-latency 10672Estimate on average number of instructions that are executed before 10673prefetch finishes. The distance prefetched ahead is proportional 10674to this constant. Increasing this number may also lead to less 10675streams being prefetched (see @option{simultaneous-prefetches}). 10676 10677@item simultaneous-prefetches 10678Maximum number of prefetches that can run at the same time. 10679 10680@item l1-cache-line-size 10681The size of cache line in L1 cache, in bytes. 10682 10683@item l1-cache-size 10684The size of L1 cache, in kilobytes. 10685 10686@item l2-cache-size 10687The size of L2 cache, in kilobytes. 10688 10689@item min-insn-to-prefetch-ratio 10690The minimum ratio between the number of instructions and the 10691number of prefetches to enable prefetching in a loop. 10692 10693@item prefetch-min-insn-to-mem-ratio 10694The minimum ratio between the number of instructions and the 10695number of memory references to enable prefetching in a loop. 10696 10697@item use-canonical-types 10698Whether the compiler should use the ``canonical'' type system. By 10699default, this should always be 1, which uses a more efficient internal 10700mechanism for comparing types in C++ and Objective-C++. However, if 10701bugs in the canonical type system are causing compilation failures, 10702set this value to 0 to disable canonical types. 10703 10704@item switch-conversion-max-branch-ratio 10705Switch initialization conversion refuses to create arrays that are 10706bigger than @option{switch-conversion-max-branch-ratio} times the number of 10707branches in the switch. 10708 10709@item max-partial-antic-length 10710Maximum length of the partial antic set computed during the tree 10711partial redundancy elimination optimization (@option{-ftree-pre}) when 10712optimizing at @option{-O3} and above. For some sorts of source code 10713the enhanced partial redundancy elimination optimization can run away, 10714consuming all of the memory available on the host machine. This 10715parameter sets a limit on the length of the sets that are computed, 10716which prevents the runaway behavior. Setting a value of 0 for 10717this parameter allows an unlimited set length. 10718 10719@item sccvn-max-scc-size 10720Maximum size of a strongly connected component (SCC) during SCCVN 10721processing. If this limit is hit, SCCVN processing for the whole 10722function is not done and optimizations depending on it are 10723disabled. The default maximum SCC size is 10000. 10724 10725@item sccvn-max-alias-queries-per-access 10726Maximum number of alias-oracle queries we perform when looking for 10727redundancies for loads and stores. If this limit is hit the search 10728is aborted and the load or store is not considered redundant. The 10729number of queries is algorithmically limited to the number of 10730stores on all paths from the load to the function entry. 10731The default maxmimum number of queries is 1000. 10732 10733@item ira-max-loops-num 10734IRA uses regional register allocation by default. If a function 10735contains more loops than the number given by this parameter, only at most 10736the given number of the most frequently-executed loops form regions 10737for regional register allocation. The default value of the 10738parameter is 100. 10739 10740@item ira-max-conflict-table-size 10741Although IRA uses a sophisticated algorithm to compress the conflict 10742table, the table can still require excessive amounts of memory for 10743huge functions. If the conflict table for a function could be more 10744than the size in MB given by this parameter, the register allocator 10745instead uses a faster, simpler, and lower-quality 10746algorithm that does not require building a pseudo-register conflict table. 10747The default value of the parameter is 2000. 10748 10749@item ira-loop-reserved-regs 10750IRA can be used to evaluate more accurate register pressure in loops 10751for decisions to move loop invariants (see @option{-O3}). The number 10752of available registers reserved for some other purposes is given 10753by this parameter. The default value of the parameter is 2, which is 10754the minimal number of registers needed by typical instructions. 10755This value is the best found from numerous experiments. 10756 10757@item lra-inheritance-ebb-probability-cutoff 10758LRA tries to reuse values reloaded in registers in subsequent insns. 10759This optimization is called inheritance. EBB is used as a region to 10760do this optimization. The parameter defines a minimal fall-through 10761edge probability in percentage used to add BB to inheritance EBB in 10762LRA. The default value of the parameter is 40. The value was chosen 10763from numerous runs of SPEC2000 on x86-64. 10764 10765@item loop-invariant-max-bbs-in-loop 10766Loop invariant motion can be very expensive, both in compilation time and 10767in amount of needed compile-time memory, with very large loops. Loops 10768with more basic blocks than this parameter won't have loop invariant 10769motion optimization performed on them. The default value of the 10770parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above. 10771 10772@item loop-max-datarefs-for-datadeps 10773Building data dapendencies is expensive for very large loops. This 10774parameter limits the number of data references in loops that are 10775considered for data dependence analysis. These large loops are no 10776handled by the optimizations using loop data dependencies. 10777The default value is 1000. 10778 10779@item max-vartrack-size 10780Sets a maximum number of hash table slots to use during variable 10781tracking dataflow analysis of any function. If this limit is exceeded 10782with variable tracking at assignments enabled, analysis for that 10783function is retried without it, after removing all debug insns from 10784the function. If the limit is exceeded even without debug insns, var 10785tracking analysis is completely disabled for the function. Setting 10786the parameter to zero makes it unlimited. 10787 10788@item max-vartrack-expr-depth 10789Sets a maximum number of recursion levels when attempting to map 10790variable names or debug temporaries to value expressions. This trades 10791compilation time for more complete debug information. If this is set too 10792low, value expressions that are available and could be represented in 10793debug information may end up not being used; setting this higher may 10794enable the compiler to find more complex debug expressions, but compile 10795time and memory use may grow. The default is 12. 10796 10797@item min-nondebug-insn-uid 10798Use uids starting at this parameter for nondebug insns. The range below 10799the parameter is reserved exclusively for debug insns created by 10800@option{-fvar-tracking-assignments}, but debug insns may get 10801(non-overlapping) uids above it if the reserved range is exhausted. 10802 10803@item ipa-sra-ptr-growth-factor 10804IPA-SRA replaces a pointer to an aggregate with one or more new 10805parameters only when their cumulative size is less or equal to 10806@option{ipa-sra-ptr-growth-factor} times the size of the original 10807pointer parameter. 10808 10809@item sra-max-scalarization-size-Ospeed 10810@item sra-max-scalarization-size-Osize 10811The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 10812replace scalar parts of aggregates with uses of independent scalar 10813variables. These parameters control the maximum size, in storage units, 10814of aggregate which is considered for replacement when compiling for 10815speed 10816(@option{sra-max-scalarization-size-Ospeed}) or size 10817(@option{sra-max-scalarization-size-Osize}) respectively. 10818 10819@item tm-max-aggregate-size 10820When making copies of thread-local variables in a transaction, this 10821parameter specifies the size in bytes after which variables are 10822saved with the logging functions as opposed to save/restore code 10823sequence pairs. This option only applies when using 10824@option{-fgnu-tm}. 10825 10826@item graphite-max-nb-scop-params 10827To avoid exponential effects in the Graphite loop transforms, the 10828number of parameters in a Static Control Part (SCoP) is bounded. The 10829default value is 10 parameters. A variable whose value is unknown at 10830compilation time and defined outside a SCoP is a parameter of the SCoP. 10831 10832@item graphite-max-bbs-per-function 10833To avoid exponential effects in the detection of SCoPs, the size of 10834the functions analyzed by Graphite is bounded. The default value is 10835100 basic blocks. 10836 10837@item loop-block-tile-size 10838Loop blocking or strip mining transforms, enabled with 10839@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 10840loop in the loop nest by a given number of iterations. The strip 10841length can be changed using the @option{loop-block-tile-size} 10842parameter. The default value is 51 iterations. 10843 10844@item loop-unroll-jam-size 10845Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The 10846default value is 4. 10847 10848@item loop-unroll-jam-depth 10849Specify the dimension to be unrolled (counting from the most inner loop) 10850for the @option{-floop-unroll-and-jam}. The default value is 2. 10851 10852@item ipa-cp-value-list-size 10853IPA-CP attempts to track all possible values and types passed to a function's 10854parameter in order to propagate them and perform devirtualization. 10855@option{ipa-cp-value-list-size} is the maximum number of values and types it 10856stores per one formal parameter of a function. 10857 10858@item ipa-cp-eval-threshold 10859IPA-CP calculates its own score of cloning profitability heuristics 10860and performs those cloning opportunities with scores that exceed 10861@option{ipa-cp-eval-threshold}. 10862 10863@item ipa-cp-recursion-penalty 10864Percentage penalty the recursive functions will receive when they 10865are evaluated for cloning. 10866 10867@item ipa-cp-single-call-penalty 10868Percentage penalty functions containg a single call to another 10869function will receive when they are evaluated for cloning. 10870 10871 10872@item ipa-max-agg-items 10873IPA-CP is also capable to propagate a number of scalar values passed 10874in an aggregate. @option{ipa-max-agg-items} controls the maximum 10875number of such values per one parameter. 10876 10877@item ipa-cp-loop-hint-bonus 10878When IPA-CP determines that a cloning candidate would make the number 10879of iterations of a loop known, it adds a bonus of 10880@option{ipa-cp-loop-hint-bonus} to the profitability score of 10881the candidate. 10882 10883@item ipa-cp-array-index-hint-bonus 10884When IPA-CP determines that a cloning candidate would make the index of 10885an array access known, it adds a bonus of 10886@option{ipa-cp-array-index-hint-bonus} to the profitability 10887score of the candidate. 10888 10889@item ipa-max-aa-steps 10890During its analysis of function bodies, IPA-CP employs alias analysis 10891in order to track values pointed to by function parameters. In order 10892not spend too much time analyzing huge functions, it gives up and 10893consider all memory clobbered after examining 10894@option{ipa-max-aa-steps} statements modifying memory. 10895 10896@item lto-partitions 10897Specify desired number of partitions produced during WHOPR compilation. 10898The number of partitions should exceed the number of CPUs used for compilation. 10899The default value is 32. 10900 10901@item lto-minpartition 10902Size of minimal partition for WHOPR (in estimated instructions). 10903This prevents expenses of splitting very small programs into too many 10904partitions. 10905 10906@item cxx-max-namespaces-for-diagnostic-help 10907The maximum number of namespaces to consult for suggestions when C++ 10908name lookup fails for an identifier. The default is 1000. 10909 10910@item sink-frequency-threshold 10911The maximum relative execution frequency (in percents) of the target block 10912relative to a statement's original block to allow statement sinking of a 10913statement. Larger numbers result in more aggressive statement sinking. 10914The default value is 75. A small positive adjustment is applied for 10915statements with memory operands as those are even more profitable so sink. 10916 10917@item max-stores-to-sink 10918The maximum number of conditional stores paires that can be sunk. Set to 0 10919if either vectorization (@option{-ftree-vectorize}) or if-conversion 10920(@option{-ftree-loop-if-convert}) is disabled. The default is 2. 10921 10922@item allow-store-data-races 10923Allow optimizers to introduce new data races on stores. 10924Set to 1 to allow, otherwise to 0. This option is enabled by default 10925at optimization level @option{-Ofast}. 10926 10927@item case-values-threshold 10928The smallest number of different values for which it is best to use a 10929jump-table instead of a tree of conditional branches. If the value is 109300, use the default for the machine. The default is 0. 10931 10932@item tree-reassoc-width 10933Set the maximum number of instructions executed in parallel in 10934reassociated tree. This parameter overrides target dependent 10935heuristics used by default if has non zero value. 10936 10937@item sched-pressure-algorithm 10938Choose between the two available implementations of 10939@option{-fsched-pressure}. Algorithm 1 is the original implementation 10940and is the more likely to prevent instructions from being reordered. 10941Algorithm 2 was designed to be a compromise between the relatively 10942conservative approach taken by algorithm 1 and the rather aggressive 10943approach taken by the default scheduler. It relies more heavily on 10944having a regular register file and accurate register pressure classes. 10945See @file{haifa-sched.c} in the GCC sources for more details. 10946 10947The default choice depends on the target. 10948 10949@item max-slsr-cand-scan 10950Set the maximum number of existing candidates that are considered when 10951seeking a basis for a new straight-line strength reduction candidate. 10952 10953@item asan-globals 10954Enable buffer overflow detection for global objects. This kind 10955of protection is enabled by default if you are using 10956@option{-fsanitize=address} option. 10957To disable global objects protection use @option{--param asan-globals=0}. 10958 10959@item asan-stack 10960Enable buffer overflow detection for stack objects. This kind of 10961protection is enabled by default when using@option{-fsanitize=address}. 10962To disable stack protection use @option{--param asan-stack=0} option. 10963 10964@item asan-instrument-reads 10965Enable buffer overflow detection for memory reads. This kind of 10966protection is enabled by default when using @option{-fsanitize=address}. 10967To disable memory reads protection use 10968@option{--param asan-instrument-reads=0}. 10969 10970@item asan-instrument-writes 10971Enable buffer overflow detection for memory writes. This kind of 10972protection is enabled by default when using @option{-fsanitize=address}. 10973To disable memory writes protection use 10974@option{--param asan-instrument-writes=0} option. 10975 10976@item asan-memintrin 10977Enable detection for built-in functions. This kind of protection 10978is enabled by default when using @option{-fsanitize=address}. 10979To disable built-in functions protection use 10980@option{--param asan-memintrin=0}. 10981 10982@item asan-use-after-return 10983Enable detection of use-after-return. This kind of protection 10984is enabled by default when using @option{-fsanitize=address} option. 10985To disable use-after-return detection use 10986@option{--param asan-use-after-return=0}. 10987 10988@item asan-instrumentation-with-call-threshold 10989If number of memory accesses in function being instrumented 10990is greater or equal to this number, use callbacks instead of inline checks. 10991E.g. to disable inline code use 10992@option{--param asan-instrumentation-with-call-threshold=0}. 10993 10994@item chkp-max-ctor-size 10995Static constructors generated by Pointer Bounds Checker may become very 10996large and significantly increase compile time at optimization level 10997@option{-O1} and higher. This parameter is a maximum nubmer of statements 10998in a single generated constructor. Default value is 5000. 10999 11000@item max-fsm-thread-path-insns 11001Maximum number of instructions to copy when duplicating blocks on a 11002finite state automaton jump thread path. The default is 100. 11003 11004@item max-fsm-thread-length 11005Maximum number of basic blocks on a finite state automaton jump thread 11006path. The default is 10. 11007 11008@item max-fsm-thread-paths 11009Maximum number of new jump thread paths to create for a finite state 11010automaton. The default is 50. 11011 11012@end table 11013@end table 11014 11015@node Preprocessor Options 11016@section Options Controlling the Preprocessor 11017@cindex preprocessor options 11018@cindex options, preprocessor 11019 11020These options control the C preprocessor, which is run on each C source 11021file before actual compilation. 11022 11023If you use the @option{-E} option, nothing is done except preprocessing. 11024Some of these options make sense only together with @option{-E} because 11025they cause the preprocessor output to be unsuitable for actual 11026compilation. 11027 11028@table @gcctabopt 11029@item -Wp,@var{option} 11030@opindex Wp 11031You can use @option{-Wp,@var{option}} to bypass the compiler driver 11032and pass @var{option} directly through to the preprocessor. If 11033@var{option} contains commas, it is split into multiple options at the 11034commas. However, many options are modified, translated or interpreted 11035by the compiler driver before being passed to the preprocessor, and 11036@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 11037interface is undocumented and subject to change, so whenever possible 11038you should avoid using @option{-Wp} and let the driver handle the 11039options instead. 11040 11041@item -Xpreprocessor @var{option} 11042@opindex Xpreprocessor 11043Pass @var{option} as an option to the preprocessor. You can use this to 11044supply system-specific preprocessor options that GCC does not 11045recognize. 11046 11047If you want to pass an option that takes an argument, you must use 11048@option{-Xpreprocessor} twice, once for the option and once for the argument. 11049 11050@item -no-integrated-cpp 11051@opindex no-integrated-cpp 11052Perform preprocessing as a separate pass before compilation. 11053By default, GCC performs preprocessing as an integrated part of 11054input tokenization and parsing. 11055If this option is provided, the appropriate language front end 11056(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 11057and Objective-C, respectively) is instead invoked twice, 11058once for preprocessing only and once for actual compilation 11059of the preprocessed input. 11060This option may be useful in conjunction with the @option{-B} or 11061@option{-wrapper} options to specify an alternate preprocessor or 11062perform additional processing of the program source between 11063normal preprocessing and compilation. 11064@end table 11065 11066@include cppopts.texi 11067 11068@node Assembler Options 11069@section Passing Options to the Assembler 11070 11071@c prevent bad page break with this line 11072You can pass options to the assembler. 11073 11074@table @gcctabopt 11075@item -Wa,@var{option} 11076@opindex Wa 11077Pass @var{option} as an option to the assembler. If @var{option} 11078contains commas, it is split into multiple options at the commas. 11079 11080@item -Xassembler @var{option} 11081@opindex Xassembler 11082Pass @var{option} as an option to the assembler. You can use this to 11083supply system-specific assembler options that GCC does not 11084recognize. 11085 11086If you want to pass an option that takes an argument, you must use 11087@option{-Xassembler} twice, once for the option and once for the argument. 11088 11089@end table 11090 11091@node Link Options 11092@section Options for Linking 11093@cindex link options 11094@cindex options, linking 11095 11096These options come into play when the compiler links object files into 11097an executable output file. They are meaningless if the compiler is 11098not doing a link step. 11099 11100@table @gcctabopt 11101@cindex file names 11102@item @var{object-file-name} 11103A file name that does not end in a special recognized suffix is 11104considered to name an object file or library. (Object files are 11105distinguished from libraries by the linker according to the file 11106contents.) If linking is done, these object files are used as input 11107to the linker. 11108 11109@item -c 11110@itemx -S 11111@itemx -E 11112@opindex c 11113@opindex S 11114@opindex E 11115If any of these options is used, then the linker is not run, and 11116object file names should not be used as arguments. @xref{Overall 11117Options}. 11118 11119@item -fuse-ld=bfd 11120@opindex fuse-ld=bfd 11121Use the @command{bfd} linker instead of the default linker. 11122 11123@item -fuse-ld=gold 11124@opindex fuse-ld=gold 11125Use the @command{gold} linker instead of the default linker. 11126 11127@cindex Libraries 11128@item -l@var{library} 11129@itemx -l @var{library} 11130@opindex l 11131Search the library named @var{library} when linking. (The second 11132alternative with the library as a separate argument is only for 11133POSIX compliance and is not recommended.) 11134 11135It makes a difference where in the command you write this option; the 11136linker searches and processes libraries and object files in the order they 11137are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 11138after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 11139to functions in @samp{z}, those functions may not be loaded. 11140 11141The linker searches a standard list of directories for the library, 11142which is actually a file named @file{lib@var{library}.a}. The linker 11143then uses this file as if it had been specified precisely by name. 11144 11145The directories searched include several standard system directories 11146plus any that you specify with @option{-L}. 11147 11148Normally the files found this way are library files---archive files 11149whose members are object files. The linker handles an archive file by 11150scanning through it for members which define symbols that have so far 11151been referenced but not defined. But if the file that is found is an 11152ordinary object file, it is linked in the usual fashion. The only 11153difference between using an @option{-l} option and specifying a file name 11154is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 11155and searches several directories. 11156 11157@item -lobjc 11158@opindex lobjc 11159You need this special case of the @option{-l} option in order to 11160link an Objective-C or Objective-C++ program. 11161 11162@item -nostartfiles 11163@opindex nostartfiles 11164Do not use the standard system startup files when linking. 11165The standard system libraries are used normally, unless @option{-nostdlib} 11166or @option{-nodefaultlibs} is used. 11167 11168@item -nodefaultlibs 11169@opindex nodefaultlibs 11170Do not use the standard system libraries when linking. 11171Only the libraries you specify are passed to the linker, and options 11172specifying linkage of the system libraries, such as @option{-static-libgcc} 11173or @option{-shared-libgcc}, are ignored. 11174The standard startup files are used normally, unless @option{-nostartfiles} 11175is used. 11176 11177The compiler may generate calls to @code{memcmp}, 11178@code{memset}, @code{memcpy} and @code{memmove}. 11179These entries are usually resolved by entries in 11180libc. These entry points should be supplied through some other 11181mechanism when this option is specified. 11182 11183@item -nostdlib 11184@opindex nostdlib 11185Do not use the standard system startup files or libraries when linking. 11186No startup files and only the libraries you specify are passed to 11187the linker, and options specifying linkage of the system libraries, such as 11188@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 11189 11190The compiler may generate calls to @code{memcmp}, @code{memset}, 11191@code{memcpy} and @code{memmove}. 11192These entries are usually resolved by entries in 11193libc. These entry points should be supplied through some other 11194mechanism when this option is specified. 11195 11196@cindex @option{-lgcc}, use with @option{-nostdlib} 11197@cindex @option{-nostdlib} and unresolved references 11198@cindex unresolved references and @option{-nostdlib} 11199@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 11200@cindex @option{-nodefaultlibs} and unresolved references 11201@cindex unresolved references and @option{-nodefaultlibs} 11202One of the standard libraries bypassed by @option{-nostdlib} and 11203@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 11204which GCC uses to overcome shortcomings of particular machines, or special 11205needs for some languages. 11206(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 11207Collection (GCC) Internals}, 11208for more discussion of @file{libgcc.a}.) 11209In most cases, you need @file{libgcc.a} even when you want to avoid 11210other standard libraries. In other words, when you specify @option{-nostdlib} 11211or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 11212This ensures that you have no unresolved references to internal GCC 11213library subroutines. 11214(An example of such an internal subroutine is @code{__main}, used to ensure C++ 11215constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 11216GNU Compiler Collection (GCC) Internals}.) 11217 11218@item -pie 11219@opindex pie 11220Produce a position independent executable on targets that support it. 11221For predictable results, you must also specify the same set of options 11222used for compilation (@option{-fpie}, @option{-fPIE}, 11223or model suboptions) when you specify this linker option. 11224 11225@item -rdynamic 11226@opindex rdynamic 11227Pass the flag @option{-export-dynamic} to the ELF linker, on targets 11228that support it. This instructs the linker to add all symbols, not 11229only used ones, to the dynamic symbol table. This option is needed 11230for some uses of @code{dlopen} or to allow obtaining backtraces 11231from within a program. 11232 11233@item -s 11234@opindex s 11235Remove all symbol table and relocation information from the executable. 11236 11237@item -static 11238@opindex static 11239On systems that support dynamic linking, this prevents linking with the shared 11240libraries. On other systems, this option has no effect. 11241 11242@item -shared 11243@opindex shared 11244Produce a shared object which can then be linked with other objects to 11245form an executable. Not all systems support this option. For predictable 11246results, you must also specify the same set of options used for compilation 11247(@option{-fpic}, @option{-fPIC}, or model suboptions) when 11248you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 11249needs to build supplementary stub code for constructors to work. On 11250multi-libbed systems, @samp{gcc -shared} must select the correct support 11251libraries to link against. Failing to supply the correct flags may lead 11252to subtle defects. Supplying them in cases where they are not necessary 11253is innocuous.} 11254 11255@item -shared-libgcc 11256@itemx -static-libgcc 11257@opindex shared-libgcc 11258@opindex static-libgcc 11259On systems that provide @file{libgcc} as a shared library, these options 11260force the use of either the shared or static version, respectively. 11261If no shared version of @file{libgcc} was built when the compiler was 11262configured, these options have no effect. 11263 11264There are several situations in which an application should use the 11265shared @file{libgcc} instead of the static version. The most common 11266of these is when the application wishes to throw and catch exceptions 11267across different shared libraries. In that case, each of the libraries 11268as well as the application itself should use the shared @file{libgcc}. 11269 11270Therefore, the G++ and GCJ drivers automatically add 11271@option{-shared-libgcc} whenever you build a shared library or a main 11272executable, because C++ and Java programs typically use exceptions, so 11273this is the right thing to do. 11274 11275If, instead, you use the GCC driver to create shared libraries, you may 11276find that they are not always linked with the shared @file{libgcc}. 11277If GCC finds, at its configuration time, that you have a non-GNU linker 11278or a GNU linker that does not support option @option{--eh-frame-hdr}, 11279it links the shared version of @file{libgcc} into shared libraries 11280by default. Otherwise, it takes advantage of the linker and optimizes 11281away the linking with the shared version of @file{libgcc}, linking with 11282the static version of libgcc by default. This allows exceptions to 11283propagate through such shared libraries, without incurring relocation 11284costs at library load time. 11285 11286However, if a library or main executable is supposed to throw or catch 11287exceptions, you must link it using the G++ or GCJ driver, as appropriate 11288for the languages used in the program, or using the option 11289@option{-shared-libgcc}, such that it is linked with the shared 11290@file{libgcc}. 11291 11292@item -static-libasan 11293@opindex static-libasan 11294When the @option{-fsanitize=address} option is used to link a program, 11295the GCC driver automatically links against @option{libasan}. If 11296@file{libasan} is available as a shared library, and the @option{-static} 11297option is not used, then this links against the shared version of 11298@file{libasan}. The @option{-static-libasan} option directs the GCC 11299driver to link @file{libasan} statically, without necessarily linking 11300other libraries statically. 11301 11302@item -static-libtsan 11303@opindex static-libtsan 11304When the @option{-fsanitize=thread} option is used to link a program, 11305the GCC driver automatically links against @option{libtsan}. If 11306@file{libtsan} is available as a shared library, and the @option{-static} 11307option is not used, then this links against the shared version of 11308@file{libtsan}. The @option{-static-libtsan} option directs the GCC 11309driver to link @file{libtsan} statically, without necessarily linking 11310other libraries statically. 11311 11312@item -static-liblsan 11313@opindex static-liblsan 11314When the @option{-fsanitize=leak} option is used to link a program, 11315the GCC driver automatically links against @option{liblsan}. If 11316@file{liblsan} is available as a shared library, and the @option{-static} 11317option is not used, then this links against the shared version of 11318@file{liblsan}. The @option{-static-liblsan} option directs the GCC 11319driver to link @file{liblsan} statically, without necessarily linking 11320other libraries statically. 11321 11322@item -static-libubsan 11323@opindex static-libubsan 11324When the @option{-fsanitize=undefined} option is used to link a program, 11325the GCC driver automatically links against @option{libubsan}. If 11326@file{libubsan} is available as a shared library, and the @option{-static} 11327option is not used, then this links against the shared version of 11328@file{libubsan}. The @option{-static-libubsan} option directs the GCC 11329driver to link @file{libubsan} statically, without necessarily linking 11330other libraries statically. 11331 11332@item -static-libmpx 11333@opindex static-libmpx 11334When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are 11335used to link a program, the GCC driver automatically links against 11336@file{libmpx}. If @file{libmpx} is available as a shared library, 11337and the @option{-static} option is not used, then this links against 11338the shared version of @file{libmpx}. The @option{-static-libmpx} 11339option directs the GCC driver to link @file{libmpx} statically, 11340without necessarily linking other libraries statically. 11341 11342@item -static-libmpxwrappers 11343@opindex static-libmpxwrappers 11344When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used 11345to link a program without also using @option{-fno-chkp-use-wrappers}, the 11346GCC driver automatically links against @file{libmpxwrappers}. If 11347@file{libmpxwrappers} is available as a shared library, and the 11348@option{-static} option is not used, then this links against the shared 11349version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers} 11350option directs the GCC driver to link @file{libmpxwrappers} statically, 11351without necessarily linking other libraries statically. 11352 11353@item -static-libstdc++ 11354@opindex static-libstdc++ 11355When the @command{g++} program is used to link a C++ program, it 11356normally automatically links against @option{libstdc++}. If 11357@file{libstdc++} is available as a shared library, and the 11358@option{-static} option is not used, then this links against the 11359shared version of @file{libstdc++}. That is normally fine. However, it 11360is sometimes useful to freeze the version of @file{libstdc++} used by 11361the program without going all the way to a fully static link. The 11362@option{-static-libstdc++} option directs the @command{g++} driver to 11363link @file{libstdc++} statically, without necessarily linking other 11364libraries statically. 11365 11366@item -symbolic 11367@opindex symbolic 11368Bind references to global symbols when building a shared object. Warn 11369about any unresolved references (unless overridden by the link editor 11370option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 11371this option. 11372 11373@item -T @var{script} 11374@opindex T 11375@cindex linker script 11376Use @var{script} as the linker script. This option is supported by most 11377systems using the GNU linker. On some targets, such as bare-board 11378targets without an operating system, the @option{-T} option may be required 11379when linking to avoid references to undefined symbols. 11380 11381@item -Xlinker @var{option} 11382@opindex Xlinker 11383Pass @var{option} as an option to the linker. You can use this to 11384supply system-specific linker options that GCC does not recognize. 11385 11386If you want to pass an option that takes a separate argument, you must use 11387@option{-Xlinker} twice, once for the option and once for the argument. 11388For example, to pass @option{-assert definitions}, you must write 11389@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 11390@option{-Xlinker "-assert definitions"}, because this passes the entire 11391string as a single argument, which is not what the linker expects. 11392 11393When using the GNU linker, it is usually more convenient to pass 11394arguments to linker options using the @option{@var{option}=@var{value}} 11395syntax than as separate arguments. For example, you can specify 11396@option{-Xlinker -Map=output.map} rather than 11397@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 11398this syntax for command-line options. 11399 11400@item -Wl,@var{option} 11401@opindex Wl 11402Pass @var{option} as an option to the linker. If @var{option} contains 11403commas, it is split into multiple options at the commas. You can use this 11404syntax to pass an argument to the option. 11405For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 11406linker. When using the GNU linker, you can also get the same effect with 11407@option{-Wl,-Map=output.map}. 11408 11409@item -u @var{symbol} 11410@opindex u 11411Pretend the symbol @var{symbol} is undefined, to force linking of 11412library modules to define it. You can use @option{-u} multiple times with 11413different symbols to force loading of additional library modules. 11414 11415@item -z @var{keyword} 11416@opindex z 11417@option{-z} is passed directly on to the linker along with the keyword 11418@var{keyword}. See the section in the documentation of your linker for 11419permitted values and their meanings. 11420@end table 11421 11422@node Directory Options 11423@section Options for Directory Search 11424@cindex directory options 11425@cindex options, directory search 11426@cindex search path 11427 11428These options specify directories to search for header files, for 11429libraries and for parts of the compiler: 11430 11431@table @gcctabopt 11432@item -I@var{dir} 11433@opindex I 11434Add the directory @var{dir} to the head of the list of directories to be 11435searched for header files. This can be used to override a system header 11436file, substituting your own version, since these directories are 11437searched before the system header file directories. However, you should 11438not use this option to add directories that contain vendor-supplied 11439system header files (use @option{-isystem} for that). If you use more than 11440one @option{-I} option, the directories are scanned in left-to-right 11441order; the standard system directories come after. 11442 11443If a standard system include directory, or a directory specified with 11444@option{-isystem}, is also specified with @option{-I}, the @option{-I} 11445option is ignored. The directory is still searched but as a 11446system directory at its normal position in the system include chain. 11447This is to ensure that GCC's procedure to fix buggy system headers and 11448the ordering for the @code{include_next} directive are not inadvertently changed. 11449If you really need to change the search order for system directories, 11450use the @option{-nostdinc} and/or @option{-isystem} options. 11451 11452@item -iplugindir=@var{dir} 11453@opindex iplugindir= 11454Set the directory to search for plugins that are passed 11455by @option{-fplugin=@var{name}} instead of 11456@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 11457to be used by the user, but only passed by the driver. 11458 11459@item -iquote@var{dir} 11460@opindex iquote 11461Add the directory @var{dir} to the head of the list of directories to 11462be searched for header files only for the case of @code{#include 11463"@var{file}"}; they are not searched for @code{#include <@var{file}>}, 11464otherwise just like @option{-I}. 11465 11466@item -L@var{dir} 11467@opindex L 11468Add directory @var{dir} to the list of directories to be searched 11469for @option{-l}. 11470 11471@item -B@var{prefix} 11472@opindex B 11473This option specifies where to find the executables, libraries, 11474include files, and data files of the compiler itself. 11475 11476The compiler driver program runs one or more of the subprograms 11477@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 11478@var{prefix} as a prefix for each program it tries to run, both with and 11479without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 11480 11481For each subprogram to be run, the compiler driver first tries the 11482@option{-B} prefix, if any. If that name is not found, or if @option{-B} 11483is not specified, the driver tries two standard prefixes, 11484@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 11485those results in a file name that is found, the unmodified program 11486name is searched for using the directories specified in your 11487@env{PATH} environment variable. 11488 11489The compiler checks to see if the path provided by @option{-B} 11490refers to a directory, and if necessary it adds a directory 11491separator character at the end of the path. 11492 11493@option{-B} prefixes that effectively specify directory names also apply 11494to libraries in the linker, because the compiler translates these 11495options into @option{-L} options for the linker. They also apply to 11496include files in the preprocessor, because the compiler translates these 11497options into @option{-isystem} options for the preprocessor. In this case, 11498the compiler appends @samp{include} to the prefix. 11499 11500The runtime support file @file{libgcc.a} can also be searched for using 11501the @option{-B} prefix, if needed. If it is not found there, the two 11502standard prefixes above are tried, and that is all. The file is left 11503out of the link if it is not found by those means. 11504 11505Another way to specify a prefix much like the @option{-B} prefix is to use 11506the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 11507Variables}. 11508 11509As a special kludge, if the path provided by @option{-B} is 11510@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 115119, then it is replaced by @file{[dir/]include}. This is to help 11512with boot-strapping the compiler. 11513 11514@item -specs=@var{file} 11515@opindex specs 11516Process @var{file} after the compiler reads in the standard @file{specs} 11517file, in order to override the defaults which the @command{gcc} driver 11518program uses when determining what switches to pass to @command{cc1}, 11519@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 11520@option{-specs=@var{file}} can be specified on the command line, and they 11521are processed in order, from left to right. 11522 11523@item --sysroot=@var{dir} 11524@opindex sysroot 11525Use @var{dir} as the logical root directory for headers and libraries. 11526For example, if the compiler normally searches for headers in 11527@file{/usr/include} and libraries in @file{/usr/lib}, it instead 11528searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 11529 11530If you use both this option and the @option{-isysroot} option, then 11531the @option{--sysroot} option applies to libraries, but the 11532@option{-isysroot} option applies to header files. 11533 11534The GNU linker (beginning with version 2.16) has the necessary support 11535for this option. If your linker does not support this option, the 11536header file aspect of @option{--sysroot} still works, but the 11537library aspect does not. 11538 11539@item --no-sysroot-suffix 11540@opindex no-sysroot-suffix 11541For some targets, a suffix is added to the root directory specified 11542with @option{--sysroot}, depending on the other options used, so that 11543headers may for example be found in 11544@file{@var{dir}/@var{suffix}/usr/include} instead of 11545@file{@var{dir}/usr/include}. This option disables the addition of 11546such a suffix. 11547 11548@item -I- 11549@opindex I- 11550This option has been deprecated. Please use @option{-iquote} instead for 11551@option{-I} directories before the @option{-I-} and remove the @option{-I-} 11552option. 11553Any directories you specify with @option{-I} options before the @option{-I-} 11554option are searched only for the case of @code{#include "@var{file}"}; 11555they are not searched for @code{#include <@var{file}>}. 11556 11557If additional directories are specified with @option{-I} options after 11558the @option{-I-} option, these directories are searched for all @code{#include} 11559directives. (Ordinarily @emph{all} @option{-I} directories are used 11560this way.) 11561 11562In addition, the @option{-I-} option inhibits the use of the current 11563directory (where the current input file came from) as the first search 11564directory for @code{#include "@var{file}"}. There is no way to 11565override this effect of @option{-I-}. With @option{-I.} you can specify 11566searching the directory that is current when the compiler is 11567invoked. That is not exactly the same as what the preprocessor does 11568by default, but it is often satisfactory. 11569 11570@option{-I-} does not inhibit the use of the standard system directories 11571for header files. Thus, @option{-I-} and @option{-nostdinc} are 11572independent. 11573@end table 11574 11575@c man end 11576 11577@node Spec Files 11578@section Specifying Subprocesses and the Switches to Pass to Them 11579@cindex Spec Files 11580 11581@command{gcc} is a driver program. It performs its job by invoking a 11582sequence of other programs to do the work of compiling, assembling and 11583linking. GCC interprets its command-line parameters and uses these to 11584deduce which programs it should invoke, and which command-line options 11585it ought to place on their command lines. This behavior is controlled 11586by @dfn{spec strings}. In most cases there is one spec string for each 11587program that GCC can invoke, but a few programs have multiple spec 11588strings to control their behavior. The spec strings built into GCC can 11589be overridden by using the @option{-specs=} command-line switch to specify 11590a spec file. 11591 11592@dfn{Spec files} are plaintext files that are used to construct spec 11593strings. They consist of a sequence of directives separated by blank 11594lines. The type of directive is determined by the first non-whitespace 11595character on the line, which can be one of the following: 11596 11597@table @code 11598@item %@var{command} 11599Issues a @var{command} to the spec file processor. The commands that can 11600appear here are: 11601 11602@table @code 11603@item %include <@var{file}> 11604@cindex @code{%include} 11605Search for @var{file} and insert its text at the current point in the 11606specs file. 11607 11608@item %include_noerr <@var{file}> 11609@cindex @code{%include_noerr} 11610Just like @samp{%include}, but do not generate an error message if the include 11611file cannot be found. 11612 11613@item %rename @var{old_name} @var{new_name} 11614@cindex @code{%rename} 11615Rename the spec string @var{old_name} to @var{new_name}. 11616 11617@end table 11618 11619@item *[@var{spec_name}]: 11620This tells the compiler to create, override or delete the named spec 11621string. All lines after this directive up to the next directive or 11622blank line are considered to be the text for the spec string. If this 11623results in an empty string then the spec is deleted. (Or, if the 11624spec did not exist, then nothing happens.) Otherwise, if the spec 11625does not currently exist a new spec is created. If the spec does 11626exist then its contents are overridden by the text of this 11627directive, unless the first character of that text is the @samp{+} 11628character, in which case the text is appended to the spec. 11629 11630@item [@var{suffix}]: 11631Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 11632and up to the next directive or blank line are considered to make up the 11633spec string for the indicated suffix. When the compiler encounters an 11634input file with the named suffix, it processes the spec string in 11635order to work out how to compile that file. For example: 11636 11637@smallexample 11638.ZZ: 11639z-compile -input %i 11640@end smallexample 11641 11642This says that any input file whose name ends in @samp{.ZZ} should be 11643passed to the program @samp{z-compile}, which should be invoked with the 11644command-line switch @option{-input} and with the result of performing the 11645@samp{%i} substitution. (See below.) 11646 11647As an alternative to providing a spec string, the text following a 11648suffix directive can be one of the following: 11649 11650@table @code 11651@item @@@var{language} 11652This says that the suffix is an alias for a known @var{language}. This is 11653similar to using the @option{-x} command-line switch to GCC to specify a 11654language explicitly. For example: 11655 11656@smallexample 11657.ZZ: 11658@@c++ 11659@end smallexample 11660 11661Says that .ZZ files are, in fact, C++ source files. 11662 11663@item #@var{name} 11664This causes an error messages saying: 11665 11666@smallexample 11667@var{name} compiler not installed on this system. 11668@end smallexample 11669@end table 11670 11671GCC already has an extensive list of suffixes built into it. 11672This directive adds an entry to the end of the list of suffixes, but 11673since the list is searched from the end backwards, it is effectively 11674possible to override earlier entries using this technique. 11675 11676@end table 11677 11678GCC has the following spec strings built into it. Spec files can 11679override these strings or create their own. Note that individual 11680targets can also add their own spec strings to this list. 11681 11682@smallexample 11683asm Options to pass to the assembler 11684asm_final Options to pass to the assembler post-processor 11685cpp Options to pass to the C preprocessor 11686cc1 Options to pass to the C compiler 11687cc1plus Options to pass to the C++ compiler 11688endfile Object files to include at the end of the link 11689link Options to pass to the linker 11690lib Libraries to include on the command line to the linker 11691libgcc Decides which GCC support library to pass to the linker 11692linker Sets the name of the linker 11693predefines Defines to be passed to the C preprocessor 11694signed_char Defines to pass to CPP to say whether @code{char} is signed 11695 by default 11696startfile Object files to include at the start of the link 11697@end smallexample 11698 11699Here is a small example of a spec file: 11700 11701@smallexample 11702%rename lib old_lib 11703 11704*lib: 11705--start-group -lgcc -lc -leval1 --end-group %(old_lib) 11706@end smallexample 11707 11708This example renames the spec called @samp{lib} to @samp{old_lib} and 11709then overrides the previous definition of @samp{lib} with a new one. 11710The new definition adds in some extra command-line options before 11711including the text of the old definition. 11712 11713@dfn{Spec strings} are a list of command-line options to be passed to their 11714corresponding program. In addition, the spec strings can contain 11715@samp{%}-prefixed sequences to substitute variable text or to 11716conditionally insert text into the command line. Using these constructs 11717it is possible to generate quite complex command lines. 11718 11719Here is a table of all defined @samp{%}-sequences for spec 11720strings. Note that spaces are not generated automatically around the 11721results of expanding these sequences. Therefore you can concatenate them 11722together or combine them with constant text in a single argument. 11723 11724@table @code 11725@item %% 11726Substitute one @samp{%} into the program name or argument. 11727 11728@item %i 11729Substitute the name of the input file being processed. 11730 11731@item %b 11732Substitute the basename of the input file being processed. 11733This is the substring up to (and not including) the last period 11734and not including the directory. 11735 11736@item %B 11737This is the same as @samp{%b}, but include the file suffix (text after 11738the last period). 11739 11740@item %d 11741Marks the argument containing or following the @samp{%d} as a 11742temporary file name, so that that file is deleted if GCC exits 11743successfully. Unlike @samp{%g}, this contributes no text to the 11744argument. 11745 11746@item %g@var{suffix} 11747Substitute a file name that has suffix @var{suffix} and is chosen 11748once per compilation, and mark the argument in the same way as 11749@samp{%d}. To reduce exposure to denial-of-service attacks, the file 11750name is now chosen in a way that is hard to predict even when previously 11751chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 11752might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 11753the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 11754treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 11755was simply substituted with a file name chosen once per compilation, 11756without regard to any appended suffix (which was therefore treated 11757just like ordinary text), making such attacks more likely to succeed. 11758 11759@item %u@var{suffix} 11760Like @samp{%g}, but generates a new temporary file name 11761each time it appears instead of once per compilation. 11762 11763@item %U@var{suffix} 11764Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 11765new one if there is no such last file name. In the absence of any 11766@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 11767the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 11768involves the generation of two distinct file names, one 11769for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 11770simply substituted with a file name chosen for the previous @samp{%u}, 11771without regard to any appended suffix. 11772 11773@item %j@var{suffix} 11774Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 11775writable, and if @option{-save-temps} is not used; 11776otherwise, substitute the name 11777of a temporary file, just like @samp{%u}. This temporary file is not 11778meant for communication between processes, but rather as a junk 11779disposal mechanism. 11780 11781@item %|@var{suffix} 11782@itemx %m@var{suffix} 11783Like @samp{%g}, except if @option{-pipe} is in effect. In that case 11784@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 11785all. These are the two most common ways to instruct a program that it 11786should read from standard input or write to standard output. If you 11787need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 11788construct: see for example @file{f/lang-specs.h}. 11789 11790@item %.@var{SUFFIX} 11791Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 11792when it is subsequently output with @samp{%*}. @var{SUFFIX} is 11793terminated by the next space or %. 11794 11795@item %w 11796Marks the argument containing or following the @samp{%w} as the 11797designated output file of this compilation. This puts the argument 11798into the sequence of arguments that @samp{%o} substitutes. 11799 11800@item %o 11801Substitutes the names of all the output files, with spaces 11802automatically placed around them. You should write spaces 11803around the @samp{%o} as well or the results are undefined. 11804@samp{%o} is for use in the specs for running the linker. 11805Input files whose names have no recognized suffix are not compiled 11806at all, but they are included among the output files, so they are 11807linked. 11808 11809@item %O 11810Substitutes the suffix for object files. Note that this is 11811handled specially when it immediately follows @samp{%g, %u, or %U}, 11812because of the need for those to form complete file names. The 11813handling is such that @samp{%O} is treated exactly as if it had already 11814been substituted, except that @samp{%g, %u, and %U} do not currently 11815support additional @var{suffix} characters following @samp{%O} as they do 11816following, for example, @samp{.o}. 11817 11818@item %p 11819Substitutes the standard macro predefinitions for the 11820current target machine. Use this when running @command{cpp}. 11821 11822@item %P 11823Like @samp{%p}, but puts @samp{__} before and after the name of each 11824predefined macro, except for macros that start with @samp{__} or with 11825@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 11826C@. 11827 11828@item %I 11829Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 11830@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 11831@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 11832and @option{-imultilib} as necessary. 11833 11834@item %s 11835Current argument is the name of a library or startup file of some sort. 11836Search for that file in a standard list of directories and substitute 11837the full name found. The current working directory is included in the 11838list of directories scanned. 11839 11840@item %T 11841Current argument is the name of a linker script. Search for that file 11842in the current list of directories to scan for libraries. If the file 11843is located insert a @option{--script} option into the command line 11844followed by the full path name found. If the file is not found then 11845generate an error message. Note: the current working directory is not 11846searched. 11847 11848@item %e@var{str} 11849Print @var{str} as an error message. @var{str} is terminated by a newline. 11850Use this when inconsistent options are detected. 11851 11852@item %(@var{name}) 11853Substitute the contents of spec string @var{name} at this point. 11854 11855@item %x@{@var{option}@} 11856Accumulate an option for @samp{%X}. 11857 11858@item %X 11859Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 11860spec string. 11861 11862@item %Y 11863Output the accumulated assembler options specified by @option{-Wa}. 11864 11865@item %Z 11866Output the accumulated preprocessor options specified by @option{-Wp}. 11867 11868@item %a 11869Process the @code{asm} spec. This is used to compute the 11870switches to be passed to the assembler. 11871 11872@item %A 11873Process the @code{asm_final} spec. This is a spec string for 11874passing switches to an assembler post-processor, if such a program is 11875needed. 11876 11877@item %l 11878Process the @code{link} spec. This is the spec for computing the 11879command line passed to the linker. Typically it makes use of the 11880@samp{%L %G %S %D and %E} sequences. 11881 11882@item %D 11883Dump out a @option{-L} option for each directory that GCC believes might 11884contain startup files. If the target supports multilibs then the 11885current multilib directory is prepended to each of these paths. 11886 11887@item %L 11888Process the @code{lib} spec. This is a spec string for deciding which 11889libraries are included on the command line to the linker. 11890 11891@item %G 11892Process the @code{libgcc} spec. This is a spec string for deciding 11893which GCC support library is included on the command line to the linker. 11894 11895@item %S 11896Process the @code{startfile} spec. This is a spec for deciding which 11897object files are the first ones passed to the linker. Typically 11898this might be a file named @file{crt0.o}. 11899 11900@item %E 11901Process the @code{endfile} spec. This is a spec string that specifies 11902the last object files that are passed to the linker. 11903 11904@item %C 11905Process the @code{cpp} spec. This is used to construct the arguments 11906to be passed to the C preprocessor. 11907 11908@item %1 11909Process the @code{cc1} spec. This is used to construct the options to be 11910passed to the actual C compiler (@command{cc1}). 11911 11912@item %2 11913Process the @code{cc1plus} spec. This is used to construct the options to be 11914passed to the actual C++ compiler (@command{cc1plus}). 11915 11916@item %* 11917Substitute the variable part of a matched option. See below. 11918Note that each comma in the substituted string is replaced by 11919a single space. 11920 11921@item %<@code{S} 11922Remove all occurrences of @code{-S} from the command line. Note---this 11923command is position dependent. @samp{%} commands in the spec string 11924before this one see @code{-S}, @samp{%} commands in the spec string 11925after this one do not. 11926 11927@item %:@var{function}(@var{args}) 11928Call the named function @var{function}, passing it @var{args}. 11929@var{args} is first processed as a nested spec string, then split 11930into an argument vector in the usual fashion. The function returns 11931a string which is processed as if it had appeared literally as part 11932of the current spec. 11933 11934The following built-in spec functions are provided: 11935 11936@table @code 11937@item @code{getenv} 11938The @code{getenv} spec function takes two arguments: an environment 11939variable name and a string. If the environment variable is not 11940defined, a fatal error is issued. Otherwise, the return value is the 11941value of the environment variable concatenated with the string. For 11942example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 11943 11944@smallexample 11945%:getenv(TOPDIR /include) 11946@end smallexample 11947 11948expands to @file{/path/to/top/include}. 11949 11950@item @code{if-exists} 11951The @code{if-exists} spec function takes one argument, an absolute 11952pathname to a file. If the file exists, @code{if-exists} returns the 11953pathname. Here is a small example of its usage: 11954 11955@smallexample 11956*startfile: 11957crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 11958@end smallexample 11959 11960@item @code{if-exists-else} 11961The @code{if-exists-else} spec function is similar to the @code{if-exists} 11962spec function, except that it takes two arguments. The first argument is 11963an absolute pathname to a file. If the file exists, @code{if-exists-else} 11964returns the pathname. If it does not exist, it returns the second argument. 11965This way, @code{if-exists-else} can be used to select one file or another, 11966based on the existence of the first. Here is a small example of its usage: 11967 11968@smallexample 11969*startfile: 11970crt0%O%s %:if-exists(crti%O%s) \ 11971%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 11972@end smallexample 11973 11974@item @code{replace-outfile} 11975The @code{replace-outfile} spec function takes two arguments. It looks for the 11976first argument in the outfiles array and replaces it with the second argument. Here 11977is a small example of its usage: 11978 11979@smallexample 11980%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 11981@end smallexample 11982 11983@item @code{remove-outfile} 11984The @code{remove-outfile} spec function takes one argument. It looks for the 11985first argument in the outfiles array and removes it. Here is a small example 11986its usage: 11987 11988@smallexample 11989%:remove-outfile(-lm) 11990@end smallexample 11991 11992@item @code{pass-through-libs} 11993The @code{pass-through-libs} spec function takes any number of arguments. It 11994finds any @option{-l} options and any non-options ending in @file{.a} (which it 11995assumes are the names of linker input library archive files) and returns a 11996result containing all the found arguments each prepended by 11997@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 11998intended to be passed to the LTO linker plugin. 11999 12000@smallexample 12001%:pass-through-libs(%G %L %G) 12002@end smallexample 12003 12004@item @code{print-asm-header} 12005The @code{print-asm-header} function takes no arguments and simply 12006prints a banner like: 12007 12008@smallexample 12009Assembler options 12010================= 12011 12012Use "-Wa,OPTION" to pass "OPTION" to the assembler. 12013@end smallexample 12014 12015It is used to separate compiler options from assembler options 12016in the @option{--target-help} output. 12017@end table 12018 12019@item %@{@code{S}@} 12020Substitutes the @code{-S} switch, if that switch is given to GCC@. 12021If that switch is not specified, this substitutes nothing. Note that 12022the leading dash is omitted when specifying this option, and it is 12023automatically inserted if the substitution is performed. Thus the spec 12024string @samp{%@{foo@}} matches the command-line option @option{-foo} 12025and outputs the command-line option @option{-foo}. 12026 12027@item %W@{@code{S}@} 12028Like %@{@code{S}@} but mark last argument supplied within as a file to be 12029deleted on failure. 12030 12031@item %@{@code{S}*@} 12032Substitutes all the switches specified to GCC whose names start 12033with @code{-S}, but which also take an argument. This is used for 12034switches like @option{-o}, @option{-D}, @option{-I}, etc. 12035GCC considers @option{-o foo} as being 12036one switch whose name starts with @samp{o}. %@{o*@} substitutes this 12037text, including the space. Thus two arguments are generated. 12038 12039@item %@{@code{S}*&@code{T}*@} 12040Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 12041(the order of @code{S} and @code{T} in the spec is not significant). 12042There can be any number of ampersand-separated variables; for each the 12043wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 12044 12045@item %@{@code{S}:@code{X}@} 12046Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 12047 12048@item %@{!@code{S}:@code{X}@} 12049Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 12050 12051@item %@{@code{S}*:@code{X}@} 12052Substitutes @code{X} if one or more switches whose names start with 12053@code{-S} are specified to GCC@. Normally @code{X} is substituted only 12054once, no matter how many such switches appeared. However, if @code{%*} 12055appears somewhere in @code{X}, then @code{X} is substituted once 12056for each matching switch, with the @code{%*} replaced by the part of 12057that switch matching the @code{*}. 12058 12059If @code{%*} appears as the last part of a spec sequence then a space 12060is added after the end of the last substitution. If there is more 12061text in the sequence, however, then a space is not generated. This 12062allows the @code{%*} substitution to be used as part of a larger 12063string. For example, a spec string like this: 12064 12065@smallexample 12066%@{mcu=*:--script=%*/memory.ld@} 12067@end smallexample 12068 12069@noindent 12070when matching an option like @option{-mcu=newchip} produces: 12071 12072@smallexample 12073--script=newchip/memory.ld 12074@end smallexample 12075 12076@item %@{.@code{S}:@code{X}@} 12077Substitutes @code{X}, if processing a file with suffix @code{S}. 12078 12079@item %@{!.@code{S}:@code{X}@} 12080Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 12081 12082@item %@{,@code{S}:@code{X}@} 12083Substitutes @code{X}, if processing a file for language @code{S}. 12084 12085@item %@{!,@code{S}:@code{X}@} 12086Substitutes @code{X}, if not processing a file for language @code{S}. 12087 12088@item %@{@code{S}|@code{P}:@code{X}@} 12089Substitutes @code{X} if either @code{-S} or @code{-P} is given to 12090GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 12091@code{*} sequences as well, although they have a stronger binding than 12092the @samp{|}. If @code{%*} appears in @code{X}, all of the 12093alternatives must be starred, and only the first matching alternative 12094is substituted. 12095 12096For example, a spec string like this: 12097 12098@smallexample 12099%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 12100@end smallexample 12101 12102@noindent 12103outputs the following command-line options from the following input 12104command-line options: 12105 12106@smallexample 12107fred.c -foo -baz 12108jim.d -bar -boggle 12109-d fred.c -foo -baz -boggle 12110-d jim.d -bar -baz -boggle 12111@end smallexample 12112 12113@item %@{S:X; T:Y; :D@} 12114 12115If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 12116given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 12117be as many clauses as you need. This may be combined with @code{.}, 12118@code{,}, @code{!}, @code{|}, and @code{*} as needed. 12119 12120 12121@end table 12122 12123The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 12124construct may contain other nested @samp{%} constructs or spaces, or 12125even newlines. They are processed as usual, as described above. 12126Trailing white space in @code{X} is ignored. White space may also 12127appear anywhere on the left side of the colon in these constructs, 12128except between @code{.} or @code{*} and the corresponding word. 12129 12130The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 12131handled specifically in these constructs. If another value of 12132@option{-O} or the negated form of a @option{-f}, @option{-m}, or 12133@option{-W} switch is found later in the command line, the earlier 12134switch value is ignored, except with @{@code{S}*@} where @code{S} is 12135just one letter, which passes all matching options. 12136 12137The character @samp{|} at the beginning of the predicate text is used to 12138indicate that a command should be piped to the following command, but 12139only if @option{-pipe} is specified. 12140 12141It is built into GCC which switches take arguments and which do not. 12142(You might think it would be useful to generalize this to allow each 12143compiler's spec to say which switches take arguments. But this cannot 12144be done in a consistent fashion. GCC cannot even decide which input 12145files have been specified without knowing which switches take arguments, 12146and it must know which input files to compile in order to tell which 12147compilers to run). 12148 12149GCC also knows implicitly that arguments starting in @option{-l} are to be 12150treated as compiler output files, and passed to the linker in their 12151proper position among the other output files. 12152 12153@c man begin OPTIONS 12154 12155@node Target Options 12156@section Specifying Target Machine and Compiler Version 12157@cindex target options 12158@cindex cross compiling 12159@cindex specifying machine version 12160@cindex specifying compiler version and target machine 12161@cindex compiler version, specifying 12162@cindex target machine, specifying 12163 12164The usual way to run GCC is to run the executable called @command{gcc}, or 12165@command{@var{machine}-gcc} when cross-compiling, or 12166@command{@var{machine}-gcc-@var{version}} to run a version other than the 12167one that was installed last. 12168 12169@node Submodel Options 12170@section Hardware Models and Configurations 12171@cindex submodel options 12172@cindex specifying hardware config 12173@cindex hardware models and configurations, specifying 12174@cindex machine dependent options 12175 12176Each target machine types can have its own 12177special options, starting with @samp{-m}, to choose among various 12178hardware models or configurations---for example, 68010 vs 68020, 12179floating coprocessor or none. A single installed version of the 12180compiler can compile for any model or configuration, according to the 12181options specified. 12182 12183Some configurations of the compiler also support additional special 12184options, usually for compatibility with other compilers on the same 12185platform. 12186 12187@c This list is ordered alphanumerically by subsection name. 12188@c It should be the same order and spelling as these options are listed 12189@c in Machine Dependent Options 12190 12191@menu 12192* AArch64 Options:: 12193* Adapteva Epiphany Options:: 12194* ARC Options:: 12195* ARM Options:: 12196* AVR Options:: 12197* Blackfin Options:: 12198* C6X Options:: 12199* CRIS Options:: 12200* CR16 Options:: 12201* Darwin Options:: 12202* DEC Alpha Options:: 12203* FR30 Options:: 12204* FRV Options:: 12205* GNU/Linux Options:: 12206* H8/300 Options:: 12207* HPPA Options:: 12208* IA-64 Options:: 12209* LM32 Options:: 12210* M32C Options:: 12211* M32R/D Options:: 12212* M680x0 Options:: 12213* MCore Options:: 12214* MeP Options:: 12215* MicroBlaze Options:: 12216* MIPS Options:: 12217* MMIX Options:: 12218* MN10300 Options:: 12219* Moxie Options:: 12220* MSP430 Options:: 12221* NDS32 Options:: 12222* Nios II Options:: 12223* Nvidia PTX Options:: 12224* PDP-11 Options:: 12225* picoChip Options:: 12226* PowerPC Options:: 12227* RL78 Options:: 12228* RS/6000 and PowerPC Options:: 12229* RX Options:: 12230* S/390 and zSeries Options:: 12231* Score Options:: 12232* SH Options:: 12233* Solaris 2 Options:: 12234* SPARC Options:: 12235* SPU Options:: 12236* System V Options:: 12237* TILE-Gx Options:: 12238* TILEPro Options:: 12239* V850 Options:: 12240* VAX Options:: 12241* Visium Options:: 12242* VMS Options:: 12243* VxWorks Options:: 12244* x86 Options:: 12245* x86 Windows Options:: 12246* Xstormy16 Options:: 12247* Xtensa Options:: 12248* zSeries Options:: 12249@end menu 12250 12251@node AArch64 Options 12252@subsection AArch64 Options 12253@cindex AArch64 Options 12254 12255These options are defined for AArch64 implementations: 12256 12257@table @gcctabopt 12258 12259@item -mabi=@var{name} 12260@opindex mabi 12261Generate code for the specified data model. Permissible values 12262are @samp{ilp32} for SysV-like data model where int, long int and pointer 12263are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit, 12264but long int and pointer are 64-bit. 12265 12266The default depends on the specific target configuration. Note that 12267the LP64 and ILP32 ABIs are not link-compatible; you must compile your 12268entire program with the same ABI, and link with a compatible set of libraries. 12269 12270@item -mbig-endian 12271@opindex mbig-endian 12272Generate big-endian code. This is the default when GCC is configured for an 12273@samp{aarch64_be-*-*} target. 12274 12275@item -mgeneral-regs-only 12276@opindex mgeneral-regs-only 12277Generate code which uses only the general registers. 12278 12279@item -mlittle-endian 12280@opindex mlittle-endian 12281Generate little-endian code. This is the default when GCC is configured for an 12282@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 12283 12284@item -mcmodel=tiny 12285@opindex mcmodel=tiny 12286Generate code for the tiny code model. The program and its statically defined 12287symbols must be within 1GB of each other. Pointers are 64 bits. Programs can 12288be statically or dynamically linked. This model is not fully implemented and 12289mostly treated as @samp{small}. 12290 12291@item -mcmodel=small 12292@opindex mcmodel=small 12293Generate code for the small code model. The program and its statically defined 12294symbols must be within 4GB of each other. Pointers are 64 bits. Programs can 12295be statically or dynamically linked. This is the default code model. 12296 12297@item -mcmodel=large 12298@opindex mcmodel=large 12299Generate code for the large code model. This makes no assumptions about 12300addresses and sizes of sections. Pointers are 64 bits. Programs can be 12301statically linked only. 12302 12303@item -mstrict-align 12304@opindex mstrict-align 12305Do not assume that unaligned memory references are handled by the system. 12306 12307@item -momit-leaf-frame-pointer 12308@itemx -mno-omit-leaf-frame-pointer 12309@opindex momit-leaf-frame-pointer 12310@opindex mno-omit-leaf-frame-pointer 12311Omit or keep the frame pointer in leaf functions. The former behaviour is the 12312default. 12313 12314@item -mtls-dialect=desc 12315@opindex mtls-dialect=desc 12316Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 12317of TLS variables. This is the default. 12318 12319@item -mtls-dialect=traditional 12320@opindex mtls-dialect=traditional 12321Use traditional TLS as the thread-local storage mechanism for dynamic accesses 12322of TLS variables. 12323 12324@item -mfix-cortex-a53-835769 12325@itemx -mno-fix-cortex-a53-835769 12326@opindex mfix-cortex-a53-835769 12327@opindex mno-fix-cortex-a53-835769 12328Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 12329This involves inserting a NOP instruction between memory instructions and 1233064-bit integer multiply-accumulate instructions. 12331 12332@item -mfix-cortex-a53-843419 12333@itemx -mno-fix-cortex-a53-843419 12334@opindex mfix-cortex-a53-843419 12335@opindex mno-fix-cortex-a53-843419 12336Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 12337This erratum workaround is made at link time and this will only pass the 12338corresponding flag to the linker. 12339 12340@item -march=@var{name} 12341@opindex march 12342Specify the name of the target architecture, optionally suffixed by one or 12343more feature modifiers. This option has the form 12344@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the 12345only permissible value for @var{arch} is @samp{armv8-a}. The permissible 12346values for @var{feature} are documented in the sub-section below. 12347 12348Where conflicting feature modifiers are specified, the right-most feature is 12349used. 12350 12351GCC uses this name to determine what kind of instructions it can emit when 12352generating assembly code. 12353 12354Where @option{-march} is specified without either of @option{-mtune} 12355or @option{-mcpu} also being specified, the code is tuned to perform 12356well across a range of target processors implementing the target 12357architecture. 12358 12359@item -mtune=@var{name} 12360@opindex mtune 12361Specify the name of the target processor for which GCC should tune the 12362performance of the code. Permissible values for this option are: 12363@samp{generic}, @samp{cortex-a53}, @samp{cortex-a57}, @samp{cortex-a72}, 12364@samp{exynos-m1}, @samp{thunderx}, @samp{xgene1}. 12365 12366Additionally, this option can specify that GCC should tune the performance 12367of the code for a big.LITTLE system. Permissible values for this 12368option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}. 12369 12370Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 12371are specified, the code is tuned to perform well across a range 12372of target processors. 12373 12374This option cannot be suffixed by feature modifiers. 12375 12376@item -mcpu=@var{name} 12377@opindex mcpu 12378Specify the name of the target processor, optionally suffixed by one or more 12379feature modifiers. This option has the form 12380@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the 12381permissible values for @var{cpu} are the same as those available for 12382@option{-mtune}. 12383 12384The permissible values for @var{feature} are documented in the sub-section 12385below. 12386 12387Where conflicting feature modifiers are specified, the right-most feature is 12388used. 12389 12390GCC uses this name to determine what kind of instructions it can emit when 12391generating assembly code (as if by @option{-march}) and to determine 12392the target processor for which to tune for performance (as if 12393by @option{-mtune}). Where this option is used in conjunction 12394with @option{-march} or @option{-mtune}, those options take precedence 12395over the appropriate part of this option. 12396@end table 12397 12398@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 12399@cindex @option{-march} feature modifiers 12400@cindex @option{-mcpu} feature modifiers 12401Feature modifiers used with @option{-march} and @option{-mcpu} can be one 12402the following: 12403 12404@table @samp 12405@item crc 12406Enable CRC extension. 12407@item crypto 12408Enable Crypto extension. This implies Advanced SIMD is enabled. 12409@item fp 12410Enable floating-point instructions. 12411@item simd 12412Enable Advanced SIMD instructions. This implies floating-point instructions 12413are enabled. This is the default for all current possible values for options 12414@option{-march} and @option{-mcpu=}. 12415@end table 12416 12417@node Adapteva Epiphany Options 12418@subsection Adapteva Epiphany Options 12419 12420These @samp{-m} options are defined for Adapteva Epiphany: 12421 12422@table @gcctabopt 12423@item -mhalf-reg-file 12424@opindex mhalf-reg-file 12425Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 12426That allows code to run on hardware variants that lack these registers. 12427 12428@item -mprefer-short-insn-regs 12429@opindex mprefer-short-insn-regs 12430Preferrentially allocate registers that allow short instruction generation. 12431This can result in increased instruction count, so this may either reduce or 12432increase overall code size. 12433 12434@item -mbranch-cost=@var{num} 12435@opindex mbranch-cost 12436Set the cost of branches to roughly @var{num} ``simple'' instructions. 12437This cost is only a heuristic and is not guaranteed to produce 12438consistent results across releases. 12439 12440@item -mcmove 12441@opindex mcmove 12442Enable the generation of conditional moves. 12443 12444@item -mnops=@var{num} 12445@opindex mnops 12446Emit @var{num} NOPs before every other generated instruction. 12447 12448@item -mno-soft-cmpsf 12449@opindex mno-soft-cmpsf 12450For single-precision floating-point comparisons, emit an @code{fsub} instruction 12451and test the flags. This is faster than a software comparison, but can 12452get incorrect results in the presence of NaNs, or when two different small 12453numbers are compared such that their difference is calculated as zero. 12454The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 12455software comparisons. 12456 12457@item -mstack-offset=@var{num} 12458@opindex mstack-offset 12459Set the offset between the top of the stack and the stack pointer. 12460E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 12461can be used by leaf functions without stack allocation. 12462Values other than @samp{8} or @samp{16} are untested and unlikely to work. 12463Note also that this option changes the ABI; compiling a program with a 12464different stack offset than the libraries have been compiled with 12465generally does not work. 12466This option can be useful if you want to evaluate if a different stack 12467offset would give you better code, but to actually use a different stack 12468offset to build working programs, it is recommended to configure the 12469toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 12470 12471@item -mno-round-nearest 12472@opindex mno-round-nearest 12473Make the scheduler assume that the rounding mode has been set to 12474truncating. The default is @option{-mround-nearest}. 12475 12476@item -mlong-calls 12477@opindex mlong-calls 12478If not otherwise specified by an attribute, assume all calls might be beyond 12479the offset range of the @code{b} / @code{bl} instructions, and therefore load the 12480function address into a register before performing a (otherwise direct) call. 12481This is the default. 12482 12483@item -mshort-calls 12484@opindex short-calls 12485If not otherwise specified by an attribute, assume all direct calls are 12486in the range of the @code{b} / @code{bl} instructions, so use these instructions 12487for direct calls. The default is @option{-mlong-calls}. 12488 12489@item -msmall16 12490@opindex msmall16 12491Assume addresses can be loaded as 16-bit unsigned values. This does not 12492apply to function addresses for which @option{-mlong-calls} semantics 12493are in effect. 12494 12495@item -mfp-mode=@var{mode} 12496@opindex mfp-mode 12497Set the prevailing mode of the floating-point unit. 12498This determines the floating-point mode that is provided and expected 12499at function call and return time. Making this mode match the mode you 12500predominantly need at function start can make your programs smaller and 12501faster by avoiding unnecessary mode switches. 12502 12503@var{mode} can be set to one the following values: 12504 12505@table @samp 12506@item caller 12507Any mode at function entry is valid, and retained or restored when 12508the function returns, and when it calls other functions. 12509This mode is useful for compiling libraries or other compilation units 12510you might want to incorporate into different programs with different 12511prevailing FPU modes, and the convenience of being able to use a single 12512object file outweighs the size and speed overhead for any extra 12513mode switching that might be needed, compared with what would be needed 12514with a more specific choice of prevailing FPU mode. 12515 12516@item truncate 12517This is the mode used for floating-point calculations with 12518truncating (i.e.@: round towards zero) rounding mode. That includes 12519conversion from floating point to integer. 12520 12521@item round-nearest 12522This is the mode used for floating-point calculations with 12523round-to-nearest-or-even rounding mode. 12524 12525@item int 12526This is the mode used to perform integer calculations in the FPU, e.g.@: 12527integer multiply, or integer multiply-and-accumulate. 12528@end table 12529 12530The default is @option{-mfp-mode=caller} 12531 12532@item -mnosplit-lohi 12533@itemx -mno-postinc 12534@itemx -mno-postmodify 12535@opindex mnosplit-lohi 12536@opindex mno-postinc 12537@opindex mno-postmodify 12538Code generation tweaks that disable, respectively, splitting of 32-bit 12539loads, generation of post-increment addresses, and generation of 12540post-modify addresses. The defaults are @option{msplit-lohi}, 12541@option{-mpost-inc}, and @option{-mpost-modify}. 12542 12543@item -mnovect-double 12544@opindex mno-vect-double 12545Change the preferred SIMD mode to SImode. The default is 12546@option{-mvect-double}, which uses DImode as preferred SIMD mode. 12547 12548@item -max-vect-align=@var{num} 12549@opindex max-vect-align 12550The maximum alignment for SIMD vector mode types. 12551@var{num} may be 4 or 8. The default is 8. 12552Note that this is an ABI change, even though many library function 12553interfaces are unaffected if they don't use SIMD vector modes 12554in places that affect size and/or alignment of relevant types. 12555 12556@item -msplit-vecmove-early 12557@opindex msplit-vecmove-early 12558Split vector moves into single word moves before reload. In theory this 12559can give better register allocation, but so far the reverse seems to be 12560generally the case. 12561 12562@item -m1reg-@var{reg} 12563@opindex m1reg- 12564Specify a register to hold the constant @minus{}1, which makes loading small negative 12565constants and certain bitmasks faster. 12566Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 12567which specify use of that register as a fixed register, 12568and @samp{none}, which means that no register is used for this 12569purpose. The default is @option{-m1reg-none}. 12570 12571@end table 12572 12573@node ARC Options 12574@subsection ARC Options 12575@cindex ARC options 12576 12577The following options control the architecture variant for which code 12578is being compiled: 12579 12580@c architecture variants 12581@table @gcctabopt 12582 12583@item -mbarrel-shifter 12584@opindex mbarrel-shifter 12585Generate instructions supported by barrel shifter. This is the default 12586unless @option{-mcpu=ARC601} is in effect. 12587 12588@item -mcpu=@var{cpu} 12589@opindex mcpu 12590Set architecture type, register usage, and instruction scheduling 12591parameters for @var{cpu}. There are also shortcut alias options 12592available for backward compatibility and convenience. Supported 12593values for @var{cpu} are 12594 12595@table @samp 12596@opindex mA6 12597@opindex mARC600 12598@item ARC600 12599Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 12600 12601@item ARC601 12602@opindex mARC601 12603Compile for ARC601. Alias: @option{-mARC601}. 12604 12605@item ARC700 12606@opindex mA7 12607@opindex mARC700 12608Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 12609This is the default when configured with @option{--with-cpu=arc700}@. 12610@end table 12611 12612@item -mdpfp 12613@opindex mdpfp 12614@itemx -mdpfp-compact 12615@opindex mdpfp-compact 12616FPX: Generate Double Precision FPX instructions, tuned for the compact 12617implementation. 12618 12619@item -mdpfp-fast 12620@opindex mdpfp-fast 12621FPX: Generate Double Precision FPX instructions, tuned for the fast 12622implementation. 12623 12624@item -mno-dpfp-lrsr 12625@opindex mno-dpfp-lrsr 12626Disable LR and SR instructions from using FPX extension aux registers. 12627 12628@item -mea 12629@opindex mea 12630Generate Extended arithmetic instructions. Currently only 12631@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 12632supported. This is always enabled for @option{-mcpu=ARC700}. 12633 12634@item -mno-mpy 12635@opindex mno-mpy 12636Do not generate mpy instructions for ARC700. 12637 12638@item -mmul32x16 12639@opindex mmul32x16 12640Generate 32x16 bit multiply and mac instructions. 12641 12642@item -mmul64 12643@opindex mmul64 12644Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}. 12645 12646@item -mnorm 12647@opindex mnorm 12648Generate norm instruction. This is the default if @option{-mcpu=ARC700} 12649is in effect. 12650 12651@item -mspfp 12652@opindex mspfp 12653@itemx -mspfp-compact 12654@opindex mspfp-compact 12655FPX: Generate Single Precision FPX instructions, tuned for the compact 12656implementation. 12657 12658@item -mspfp-fast 12659@opindex mspfp-fast 12660FPX: Generate Single Precision FPX instructions, tuned for the fast 12661implementation. 12662 12663@item -msimd 12664@opindex msimd 12665Enable generation of ARC SIMD instructions via target-specific 12666builtins. Only valid for @option{-mcpu=ARC700}. 12667 12668@item -msoft-float 12669@opindex msoft-float 12670This option ignored; it is provided for compatibility purposes only. 12671Software floating point code is emitted by default, and this default 12672can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or 12673@samp{mspfp-fast} for single precision, and @samp{mdpfp}, 12674@samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision. 12675 12676@item -mswap 12677@opindex mswap 12678Generate swap instructions. 12679 12680@end table 12681 12682The following options are passed through to the assembler, and also 12683define preprocessor macro symbols. 12684 12685@c Flags used by the assembler, but for which we define preprocessor 12686@c macro symbols as well. 12687@table @gcctabopt 12688@item -mdsp-packa 12689@opindex mdsp-packa 12690Passed down to the assembler to enable the DSP Pack A extensions. 12691Also sets the preprocessor symbol @code{__Xdsp_packa}. 12692 12693@item -mdvbf 12694@opindex mdvbf 12695Passed down to the assembler to enable the dual viterbi butterfly 12696extension. Also sets the preprocessor symbol @code{__Xdvbf}. 12697 12698@c ARC700 4.10 extension instruction 12699@item -mlock 12700@opindex mlock 12701Passed down to the assembler to enable the Locked Load/Store 12702Conditional extension. Also sets the preprocessor symbol 12703@code{__Xlock}. 12704 12705@item -mmac-d16 12706@opindex mmac-d16 12707Passed down to the assembler. Also sets the preprocessor symbol 12708@code{__Xxmac_d16}. 12709 12710@item -mmac-24 12711@opindex mmac-24 12712Passed down to the assembler. Also sets the preprocessor symbol 12713@code{__Xxmac_24}. 12714 12715@c ARC700 4.10 extension instruction 12716@item -mrtsc 12717@opindex mrtsc 12718Passed down to the assembler to enable the 64-bit Time-Stamp Counter 12719extension instruction. Also sets the preprocessor symbol 12720@code{__Xrtsc}. 12721 12722@c ARC700 4.10 extension instruction 12723@item -mswape 12724@opindex mswape 12725Passed down to the assembler to enable the swap byte ordering 12726extension instruction. Also sets the preprocessor symbol 12727@code{__Xswape}. 12728 12729@item -mtelephony 12730@opindex mtelephony 12731Passed down to the assembler to enable dual and single operand 12732instructions for telephony. Also sets the preprocessor symbol 12733@code{__Xtelephony}. 12734 12735@item -mxy 12736@opindex mxy 12737Passed down to the assembler to enable the XY Memory extension. Also 12738sets the preprocessor symbol @code{__Xxy}. 12739 12740@end table 12741 12742The following options control how the assembly code is annotated: 12743 12744@c Assembly annotation options 12745@table @gcctabopt 12746@item -misize 12747@opindex misize 12748Annotate assembler instructions with estimated addresses. 12749 12750@item -mannotate-align 12751@opindex mannotate-align 12752Explain what alignment considerations lead to the decision to make an 12753instruction short or long. 12754 12755@end table 12756 12757The following options are passed through to the linker: 12758 12759@c options passed through to the linker 12760@table @gcctabopt 12761@item -marclinux 12762@opindex marclinux 12763Passed through to the linker, to specify use of the @code{arclinux} emulation. 12764This option is enabled by default in tool chains built for 12765@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 12766when profiling is not requested. 12767 12768@item -marclinux_prof 12769@opindex marclinux_prof 12770Passed through to the linker, to specify use of the 12771@code{arclinux_prof} emulation. This option is enabled by default in 12772tool chains built for @w{@code{arc-linux-uclibc}} and 12773@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 12774 12775@end table 12776 12777The following options control the semantics of generated code: 12778 12779@c semantically relevant code generation options 12780@table @gcctabopt 12781@item -mepilogue-cfi 12782@opindex mepilogue-cfi 12783Enable generation of call frame information for epilogues. 12784 12785@item -mno-epilogue-cfi 12786@opindex mno-epilogue-cfi 12787Disable generation of call frame information for epilogues. 12788 12789@item -mlong-calls 12790@opindex mlong-calls 12791Generate call insns as register indirect calls, thus providing access 12792to the full 32-bit address range. 12793 12794@item -mmedium-calls 12795@opindex mmedium-calls 12796Don't use less than 25 bit addressing range for calls, which is the 12797offset available for an unconditional branch-and-link 12798instruction. Conditional execution of function calls is suppressed, to 12799allow use of the 25-bit range, rather than the 21-bit range with 12800conditional branch-and-link. This is the default for tool chains built 12801for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 12802 12803@item -mno-sdata 12804@opindex mno-sdata 12805Do not generate sdata references. This is the default for tool chains 12806built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 12807targets. 12808 12809@item -mucb-mcount 12810@opindex mucb-mcount 12811Instrument with mcount calls as used in UCB code. I.e. do the 12812counting in the callee, not the caller. By default ARC instrumentation 12813counts in the caller. 12814 12815@item -mvolatile-cache 12816@opindex mvolatile-cache 12817Use ordinarily cached memory accesses for volatile references. This is the 12818default. 12819 12820@item -mno-volatile-cache 12821@opindex mno-volatile-cache 12822Enable cache bypass for volatile references. 12823 12824@end table 12825 12826The following options fine tune code generation: 12827@c code generation tuning options 12828@table @gcctabopt 12829@item -malign-call 12830@opindex malign-call 12831Do alignment optimizations for call instructions. 12832 12833@item -mauto-modify-reg 12834@opindex mauto-modify-reg 12835Enable the use of pre/post modify with register displacement. 12836 12837@item -mbbit-peephole 12838@opindex mbbit-peephole 12839Enable bbit peephole2. 12840 12841@item -mno-brcc 12842@opindex mno-brcc 12843This option disables a target-specific pass in @file{arc_reorg} to 12844generate @code{BRcc} instructions. It has no effect on @code{BRcc} 12845generation driven by the combiner pass. 12846 12847@item -mcase-vector-pcrel 12848@opindex mcase-vector-pcrel 12849Use pc-relative switch case tables - this enables case table shortening. 12850This is the default for @option{-Os}. 12851 12852@item -mcompact-casesi 12853@opindex mcompact-casesi 12854Enable compact casesi pattern. 12855This is the default for @option{-Os}. 12856 12857@item -mno-cond-exec 12858@opindex mno-cond-exec 12859Disable ARCompact specific pass to generate conditional execution instructions. 12860Due to delay slot scheduling and interactions between operand numbers, 12861literal sizes, instruction lengths, and the support for conditional execution, 12862the target-independent pass to generate conditional execution is often lacking, 12863so the ARC port has kept a special pass around that tries to find more 12864conditional execution generating opportunities after register allocation, 12865branch shortening, and delay slot scheduling have been done. This pass 12866generally, but not always, improves performance and code size, at the cost of 12867extra compilation time, which is why there is an option to switch it off. 12868If you have a problem with call instructions exceeding their allowable 12869offset range because they are conditionalized, you should consider using 12870@option{-mmedium-calls} instead. 12871 12872@item -mearly-cbranchsi 12873@opindex mearly-cbranchsi 12874Enable pre-reload use of the cbranchsi pattern. 12875 12876@item -mexpand-adddi 12877@opindex mexpand-adddi 12878Expand @code{adddi3} and @code{subdi3} at rtl generation time into 12879@code{add.f}, @code{adc} etc. 12880 12881@item -mindexed-loads 12882@opindex mindexed-loads 12883Enable the use of indexed loads. This can be problematic because some 12884optimizers then assume that indexed stores exist, which is not 12885the case. 12886 12887@item -mlra 12888@opindex mlra 12889Enable Local Register Allocation. This is still experimental for ARC, 12890so by default the compiler uses standard reload 12891(i.e. @option{-mno-lra}). 12892 12893@item -mlra-priority-none 12894@opindex mlra-priority-none 12895Don't indicate any priority for target registers. 12896 12897@item -mlra-priority-compact 12898@opindex mlra-priority-compact 12899Indicate target register priority for r0..r3 / r12..r15. 12900 12901@item -mlra-priority-noncompact 12902@opindex mlra-priority-noncompact 12903Reduce target regsiter priority for r0..r3 / r12..r15. 12904 12905@item -mno-millicode 12906@opindex mno-millicode 12907When optimizing for size (using @option{-Os}), prologues and epilogues 12908that have to save or restore a large number of registers are often 12909shortened by using call to a special function in libgcc; this is 12910referred to as a @emph{millicode} call. As these calls can pose 12911performance issues, and/or cause linking issues when linking in a 12912nonstandard way, this option is provided to turn off millicode call 12913generation. 12914 12915@item -mmixed-code 12916@opindex mmixed-code 12917Tweak register allocation to help 16-bit instruction generation. 12918This generally has the effect of decreasing the average instruction size 12919while increasing the instruction count. 12920 12921@item -mq-class 12922@opindex mq-class 12923Enable 'q' instruction alternatives. 12924This is the default for @option{-Os}. 12925 12926@item -mRcq 12927@opindex mRcq 12928Enable Rcq constraint handling - most short code generation depends on this. 12929This is the default. 12930 12931@item -mRcw 12932@opindex mRcw 12933Enable Rcw constraint handling - ccfsm condexec mostly depends on this. 12934This is the default. 12935 12936@item -msize-level=@var{level} 12937@opindex msize-level 12938Fine-tune size optimization with regards to instruction lengths and alignment. 12939The recognized values for @var{level} are: 12940@table @samp 12941@item 0 12942No size optimization. This level is deprecated and treated like @samp{1}. 12943 12944@item 1 12945Short instructions are used opportunistically. 12946 12947@item 2 12948In addition, alignment of loops and of code after barriers are dropped. 12949 12950@item 3 12951In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 12952 12953@end table 12954 12955This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 12956the behavior when this is not set is equivalent to level @samp{1}. 12957 12958@item -mtune=@var{cpu} 12959@opindex mtune 12960Set instruction scheduling parameters for @var{cpu}, overriding any implied 12961by @option{-mcpu=}. 12962 12963Supported values for @var{cpu} are 12964 12965@table @samp 12966@item ARC600 12967Tune for ARC600 cpu. 12968 12969@item ARC601 12970Tune for ARC601 cpu. 12971 12972@item ARC700 12973Tune for ARC700 cpu with standard multiplier block. 12974 12975@item ARC700-xmac 12976Tune for ARC700 cpu with XMAC block. 12977 12978@item ARC725D 12979Tune for ARC725D cpu. 12980 12981@item ARC750D 12982Tune for ARC750D cpu. 12983 12984@end table 12985 12986@item -mmultcost=@var{num} 12987@opindex mmultcost 12988Cost to assume for a multiply instruction, with @samp{4} being equal to a 12989normal instruction. 12990 12991@item -munalign-prob-threshold=@var{probability} 12992@opindex munalign-prob-threshold 12993Set probability threshold for unaligning branches. 12994When tuning for @samp{ARC700} and optimizing for speed, branches without 12995filled delay slot are preferably emitted unaligned and long, unless 12996profiling indicates that the probability for the branch to be taken 12997is below @var{probability}. @xref{Cross-profiling}. 12998The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. 12999 13000@end table 13001 13002The following options are maintained for backward compatibility, but 13003are now deprecated and will be removed in a future release: 13004 13005@c Deprecated options 13006@table @gcctabopt 13007 13008@item -margonaut 13009@opindex margonaut 13010Obsolete FPX. 13011 13012@item -mbig-endian 13013@opindex mbig-endian 13014@itemx -EB 13015@opindex EB 13016Compile code for big endian targets. Use of these options is now 13017deprecated. Users wanting big-endian code, should use the 13018@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when 13019building the tool chain, for which big-endian is the default. 13020 13021@item -mlittle-endian 13022@opindex mlittle-endian 13023@itemx -EL 13024@opindex EL 13025Compile code for little endian targets. Use of these options is now 13026deprecated. Users wanting little-endian code should use the 13027@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when 13028building the tool chain, for which little-endian is the default. 13029 13030@item -mbarrel_shifter 13031@opindex mbarrel_shifter 13032Replaced by @option{-mbarrel-shifter}. 13033 13034@item -mdpfp_compact 13035@opindex mdpfp_compact 13036Replaced by @option{-mdpfp-compact}. 13037 13038@item -mdpfp_fast 13039@opindex mdpfp_fast 13040Replaced by @option{-mdpfp-fast}. 13041 13042@item -mdsp_packa 13043@opindex mdsp_packa 13044Replaced by @option{-mdsp-packa}. 13045 13046@item -mEA 13047@opindex mEA 13048Replaced by @option{-mea}. 13049 13050@item -mmac_24 13051@opindex mmac_24 13052Replaced by @option{-mmac-24}. 13053 13054@item -mmac_d16 13055@opindex mmac_d16 13056Replaced by @option{-mmac-d16}. 13057 13058@item -mspfp_compact 13059@opindex mspfp_compact 13060Replaced by @option{-mspfp-compact}. 13061 13062@item -mspfp_fast 13063@opindex mspfp_fast 13064Replaced by @option{-mspfp-fast}. 13065 13066@item -mtune=@var{cpu} 13067@opindex mtune 13068Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 13069@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 13070@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively 13071 13072@item -multcost=@var{num} 13073@opindex multcost 13074Replaced by @option{-mmultcost}. 13075 13076@end table 13077 13078@node ARM Options 13079@subsection ARM Options 13080@cindex ARM options 13081 13082These @samp{-m} options are defined for the ARM port: 13083 13084@table @gcctabopt 13085@item -mabi=@var{name} 13086@opindex mabi 13087Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 13088@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 13089 13090@item -mapcs-frame 13091@opindex mapcs-frame 13092Generate a stack frame that is compliant with the ARM Procedure Call 13093Standard for all functions, even if this is not strictly necessary for 13094correct execution of the code. Specifying @option{-fomit-frame-pointer} 13095with this option causes the stack frames not to be generated for 13096leaf functions. The default is @option{-mno-apcs-frame}. 13097This option is deprecated. 13098 13099@item -mapcs 13100@opindex mapcs 13101This is a synonym for @option{-mapcs-frame} and is deprecated. 13102 13103@ignore 13104@c not currently implemented 13105@item -mapcs-stack-check 13106@opindex mapcs-stack-check 13107Generate code to check the amount of stack space available upon entry to 13108every function (that actually uses some stack space). If there is 13109insufficient space available then either the function 13110@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 13111called, depending upon the amount of stack space required. The runtime 13112system is required to provide these functions. The default is 13113@option{-mno-apcs-stack-check}, since this produces smaller code. 13114 13115@c not currently implemented 13116@item -mapcs-float 13117@opindex mapcs-float 13118Pass floating-point arguments using the floating-point registers. This is 13119one of the variants of the APCS@. This option is recommended if the 13120target hardware has a floating-point unit or if a lot of floating-point 13121arithmetic is going to be performed by the code. The default is 13122@option{-mno-apcs-float}, since the size of integer-only code is 13123slightly increased if @option{-mapcs-float} is used. 13124 13125@c not currently implemented 13126@item -mapcs-reentrant 13127@opindex mapcs-reentrant 13128Generate reentrant, position-independent code. The default is 13129@option{-mno-apcs-reentrant}. 13130@end ignore 13131 13132@item -mthumb-interwork 13133@opindex mthumb-interwork 13134Generate code that supports calling between the ARM and Thumb 13135instruction sets. Without this option, on pre-v5 architectures, the 13136two instruction sets cannot be reliably used inside one program. The 13137default is @option{-mno-thumb-interwork}, since slightly larger code 13138is generated when @option{-mthumb-interwork} is specified. In AAPCS 13139configurations this option is meaningless. 13140 13141@item -mno-sched-prolog 13142@opindex mno-sched-prolog 13143Prevent the reordering of instructions in the function prologue, or the 13144merging of those instruction with the instructions in the function's 13145body. This means that all functions start with a recognizable set 13146of instructions (or in fact one of a choice from a small set of 13147different function prologues), and this information can be used to 13148locate the start of functions inside an executable piece of code. The 13149default is @option{-msched-prolog}. 13150 13151@item -mfloat-abi=@var{name} 13152@opindex mfloat-abi 13153Specifies which floating-point ABI to use. Permissible values 13154are: @samp{soft}, @samp{softfp} and @samp{hard}. 13155 13156Specifying @samp{soft} causes GCC to generate output containing 13157library calls for floating-point operations. 13158@samp{softfp} allows the generation of code using hardware floating-point 13159instructions, but still uses the soft-float calling conventions. 13160@samp{hard} allows generation of floating-point instructions 13161and uses FPU-specific calling conventions. 13162 13163The default depends on the specific target configuration. Note that 13164the hard-float and soft-float ABIs are not link-compatible; you must 13165compile your entire program with the same ABI, and link with a 13166compatible set of libraries. 13167 13168@item -mlittle-endian 13169@opindex mlittle-endian 13170Generate code for a processor running in little-endian mode. This is 13171the default for all standard configurations. 13172 13173@item -mbig-endian 13174@opindex mbig-endian 13175Generate code for a processor running in big-endian mode; the default is 13176to compile code for a little-endian processor. 13177 13178@item -march=@var{name} 13179@opindex march 13180This specifies the name of the target ARM architecture. GCC uses this 13181name to determine what kind of instructions it can emit when generating 13182assembly code. This option can be used in conjunction with or instead 13183of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 13184@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 13185@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, 13186@samp{armv6}, @samp{armv6j}, 13187@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, 13188@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m}, 13189@samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, 13190@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. 13191 13192@option{-march=armv7ve} is the armv7-a architecture with virtualization 13193extensions. 13194 13195@option{-march=armv8-a+crc} enables code generation for the ARMv8-A 13196architecture together with the optional CRC32 extensions. 13197 13198@option{-march=native} causes the compiler to auto-detect the architecture 13199of the build computer. At present, this feature is only supported on 13200GNU/Linux, and not all architectures are recognized. If the auto-detect 13201is unsuccessful the option has no effect. 13202 13203@item -mtune=@var{name} 13204@opindex mtune 13205This option specifies the name of the target ARM processor for 13206which GCC should tune the performance of the code. 13207For some ARM implementations better performance can be obtained by using 13208this option. 13209Permissible names are: @samp{arm2}, @samp{arm250}, 13210@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 13211@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 13212@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 13213@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 13214@samp{arm720}, 13215@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 13216@samp{arm710t}, @samp{arm720t}, @samp{arm740t}, 13217@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 13218@samp{strongarm1110}, 13219@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 13220@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 13221@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 13222@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 13223@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 13224@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 13225@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 13226@samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, 13227@samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a53}, 13228@samp{cortex-a57}, @samp{cortex-a72}, 13229@samp{cortex-r4}, 13230@samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m7}, 13231@samp{cortex-m4}, 13232@samp{cortex-m3}, 13233@samp{cortex-m1}, 13234@samp{cortex-m0}, 13235@samp{cortex-m0plus}, 13236@samp{cortex-m1.small-multiply}, 13237@samp{cortex-m0.small-multiply}, 13238@samp{cortex-m0plus.small-multiply}, 13239@samp{exynos-m1}, 13240@samp{marvell-pj4}, 13241@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, 13242@samp{fa526}, @samp{fa626}, 13243@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, 13244@samp{xgene1}. 13245 13246Additionally, this option can specify that GCC should tune the performance 13247of the code for a big.LITTLE system. Permissible names are: 13248@samp{cortex-a15.cortex-a7}, @samp{cortex-a57.cortex-a53}, 13249@samp{cortex-a72.cortex-a53}. 13250 13251@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 13252performance for a blend of processors within architecture @var{arch}. 13253The aim is to generate code that run well on the current most popular 13254processors, balancing between optimizations that benefit some CPUs in the 13255range, and avoiding performance pitfalls of other CPUs. The effects of 13256this option may change in future GCC versions as CPU models come and go. 13257 13258@option{-mtune=native} causes the compiler to auto-detect the CPU 13259of the build computer. At present, this feature is only supported on 13260GNU/Linux, and not all architectures are recognized. If the auto-detect is 13261unsuccessful the option has no effect. 13262 13263@item -mcpu=@var{name} 13264@opindex mcpu 13265This specifies the name of the target ARM processor. GCC uses this name 13266to derive the name of the target ARM architecture (as if specified 13267by @option{-march}) and the ARM processor type for which to tune for 13268performance (as if specified by @option{-mtune}). Where this option 13269is used in conjunction with @option{-march} or @option{-mtune}, 13270those options take precedence over the appropriate part of this option. 13271 13272Permissible names for this option are the same as those for 13273@option{-mtune}. 13274 13275@option{-mcpu=generic-@var{arch}} is also permissible, and is 13276equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 13277See @option{-mtune} for more information. 13278 13279@option{-mcpu=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 13282is unsuccessful the option has no effect. 13283 13284@item -mfpu=@var{name} 13285@opindex mfpu 13286This specifies what floating-point hardware (or hardware emulation) is 13287available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3}, 13288@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 13289@samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, 13290@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 13291@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 13292@samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}. 13293 13294If @option{-msoft-float} is specified this specifies the format of 13295floating-point values. 13296 13297If the selected floating-point hardware includes the NEON extension 13298(e.g. @option{-mfpu}=@samp{neon}), note that floating-point 13299operations are not generated by GCC's auto-vectorization pass unless 13300@option{-funsafe-math-optimizations} is also specified. This is 13301because NEON hardware does not fully implement the IEEE 754 standard for 13302floating-point arithmetic (in particular denormal values are treated as 13303zero), so the use of NEON instructions may lead to a loss of precision. 13304 13305@item -mfp16-format=@var{name} 13306@opindex mfp16-format 13307Specify the format of the @code{__fp16} half-precision floating-point type. 13308Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 13309the default is @samp{none}, in which case the @code{__fp16} type is not 13310defined. @xref{Half-Precision}, for more information. 13311 13312@item -mstructure-size-boundary=@var{n} 13313@opindex mstructure-size-boundary 13314The sizes of all structures and unions are rounded up to a multiple 13315of the number of bits set by this option. Permissible values are 8, 32 13316and 64. The default value varies for different toolchains. For the COFF 13317targeted toolchain the default value is 8. A value of 64 is only allowed 13318if the underlying ABI supports it. 13319 13320Specifying a larger number can produce faster, more efficient code, but 13321can also increase the size of the program. Different values are potentially 13322incompatible. Code compiled with one value cannot necessarily expect to 13323work with code or libraries compiled with another value, if they exchange 13324information using structures or unions. 13325 13326@item -mabort-on-noreturn 13327@opindex mabort-on-noreturn 13328Generate a call to the function @code{abort} at the end of a 13329@code{noreturn} function. It is executed if the function tries to 13330return. 13331 13332@item -mlong-calls 13333@itemx -mno-long-calls 13334@opindex mlong-calls 13335@opindex mno-long-calls 13336Tells the compiler to perform function calls by first loading the 13337address of the function into a register and then performing a subroutine 13338call on this register. This switch is needed if the target function 13339lies outside of the 64-megabyte addressing range of the offset-based 13340version of subroutine call instruction. 13341 13342Even if this switch is enabled, not all function calls are turned 13343into long calls. The heuristic is that static functions, functions 13344that have the @code{short_call} attribute, functions that are inside 13345the scope of a @code{#pragma no_long_calls} directive, and functions whose 13346definitions have already been compiled within the current compilation 13347unit are not turned into long calls. The exceptions to this rule are 13348that weak function definitions, functions with the @code{long_call} 13349attribute or the @code{section} attribute, and functions that are within 13350the scope of a @code{#pragma long_calls} directive are always 13351turned into long calls. 13352 13353This feature is not enabled by default. Specifying 13354@option{-mno-long-calls} restores the default behavior, as does 13355placing the function calls within the scope of a @code{#pragma 13356long_calls_off} directive. Note these switches have no effect on how 13357the compiler generates code to handle function calls via function 13358pointers. 13359 13360@item -msingle-pic-base 13361@opindex msingle-pic-base 13362Treat the register used for PIC addressing as read-only, rather than 13363loading it in the prologue for each function. The runtime system is 13364responsible for initializing this register with an appropriate value 13365before execution begins. 13366 13367@item -mpic-register=@var{reg} 13368@opindex mpic-register 13369Specify the register to be used for PIC addressing. 13370For standard PIC base case, the default is any suitable register 13371determined by compiler. For single PIC base case, the default is 13372@samp{R9} if target is EABI based or stack-checking is enabled, 13373otherwise the default is @samp{R10}. 13374 13375@item -mpic-data-is-text-relative 13376@opindex mpic-data-is-text-relative 13377Assume that each data segments are relative to text segment at load time. 13378Therefore, it permits addressing data using PC-relative operations. 13379This option is on by default for targets other than VxWorks RTP. 13380 13381@item -mpoke-function-name 13382@opindex mpoke-function-name 13383Write the name of each function into the text section, directly 13384preceding the function prologue. The generated code is similar to this: 13385 13386@smallexample 13387 t0 13388 .ascii "arm_poke_function_name", 0 13389 .align 13390 t1 13391 .word 0xff000000 + (t1 - t0) 13392 arm_poke_function_name 13393 mov ip, sp 13394 stmfd sp!, @{fp, ip, lr, pc@} 13395 sub fp, ip, #4 13396@end smallexample 13397 13398When performing a stack backtrace, code can inspect the value of 13399@code{pc} stored at @code{fp + 0}. If the trace function then looks at 13400location @code{pc - 12} and the top 8 bits are set, then we know that 13401there is a function name embedded immediately preceding this location 13402and has length @code{((pc[-3]) & 0xff000000)}. 13403 13404@item -mthumb 13405@itemx -marm 13406@opindex marm 13407@opindex mthumb 13408 13409Select between generating code that executes in ARM and Thumb 13410states. The default for most configurations is to generate code 13411that executes in ARM state, but the default can be changed by 13412configuring GCC with the @option{--with-mode=}@var{state} 13413configure option. 13414 13415@item -mtpcs-frame 13416@opindex mtpcs-frame 13417Generate a stack frame that is compliant with the Thumb Procedure Call 13418Standard for all non-leaf functions. (A leaf function is one that does 13419not call any other functions.) The default is @option{-mno-tpcs-frame}. 13420 13421@item -mtpcs-leaf-frame 13422@opindex mtpcs-leaf-frame 13423Generate a stack frame that is compliant with the Thumb Procedure Call 13424Standard for all leaf functions. (A leaf function is one that does 13425not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 13426 13427@item -mcallee-super-interworking 13428@opindex mcallee-super-interworking 13429Gives all externally visible functions in the file being compiled an ARM 13430instruction set header which switches to Thumb mode before executing the 13431rest of the function. This allows these functions to be called from 13432non-interworking code. This option is not valid in AAPCS configurations 13433because interworking is enabled by default. 13434 13435@item -mcaller-super-interworking 13436@opindex mcaller-super-interworking 13437Allows calls via function pointers (including virtual functions) to 13438execute correctly regardless of whether the target code has been 13439compiled for interworking or not. There is a small overhead in the cost 13440of executing a function pointer if this option is enabled. This option 13441is not valid in AAPCS configurations because interworking is enabled 13442by default. 13443 13444@item -mtp=@var{name} 13445@opindex mtp 13446Specify the access model for the thread local storage pointer. The valid 13447models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 13448@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 13449(supported in the arm6k architecture), and @samp{auto}, which uses the 13450best available method for the selected processor. The default setting is 13451@samp{auto}. 13452 13453@item -mtls-dialect=@var{dialect} 13454@opindex mtls-dialect 13455Specify the dialect to use for accessing thread local storage. Two 13456@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 13457@samp{gnu} dialect selects the original GNU scheme for supporting 13458local and global dynamic TLS models. The @samp{gnu2} dialect 13459selects the GNU descriptor scheme, which provides better performance 13460for shared libraries. The GNU descriptor scheme is compatible with 13461the original scheme, but does require new assembler, linker and 13462library support. Initial and local exec TLS models are unaffected by 13463this option and always use the original scheme. 13464 13465@item -mword-relocations 13466@opindex mword-relocations 13467Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). 13468This is enabled by default on targets (uClinux, SymbianOS) where the runtime 13469loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 13470is specified. 13471 13472@item -mfix-cortex-m3-ldrd 13473@opindex mfix-cortex-m3-ldrd 13474Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 13475with overlapping destination and base registers are used. This option avoids 13476generating these instructions. This option is enabled by default when 13477@option{-mcpu=cortex-m3} is specified. 13478 13479@item -munaligned-access 13480@itemx -mno-unaligned-access 13481@opindex munaligned-access 13482@opindex mno-unaligned-access 13483Enables (or disables) reading and writing of 16- and 32- bit values 13484from addresses that are not 16- or 32- bit aligned. By default 13485unaligned access is disabled for all pre-ARMv6 and all ARMv6-M 13486architectures, and enabled for all other architectures. If unaligned 13487access is not enabled then words in packed data structures are 13488accessed a byte at a time. 13489 13490The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 13491generated object file to either true or false, depending upon the 13492setting of this option. If unaligned access is enabled then the 13493preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 13494defined. 13495 13496@item -mneon-for-64bits 13497@opindex mneon-for-64bits 13498Enables using Neon to handle scalar 64-bits operations. This is 13499disabled by default since the cost of moving data from core registers 13500to Neon is high. 13501 13502@item -mslow-flash-data 13503@opindex mslow-flash-data 13504Assume loading data from flash is slower than fetching instruction. 13505Therefore literal load is minimized for better performance. 13506This option is only supported when compiling for ARMv7 M-profile and 13507off by default. 13508 13509@item -masm-syntax-unified 13510@opindex masm-syntax-unified 13511Assume inline assembler is using unified asm syntax. The default is 13512currently off which implies divided syntax. Currently this option is 13513available only for Thumb1 and has no effect on ARM state and Thumb2. 13514However, this may change in future releases of GCC. Divided syntax 13515should be considered deprecated. 13516 13517@item -mrestrict-it 13518@opindex mrestrict-it 13519Restricts generation of IT blocks to conform to the rules of ARMv8. 13520IT blocks can only contain a single 16-bit instruction from a select 13521set of instructions. This option is on by default for ARMv8 Thumb mode. 13522 13523@item -mprint-tune-info 13524@opindex mprint-tune-info 13525Print CPU tuning information as comment in assembler file. This is 13526an option used only for regression testing of the compiler and not 13527intended for ordinary use in compiling code. This option is disabled 13528by default. 13529@end table 13530 13531@node AVR Options 13532@subsection AVR Options 13533@cindex AVR Options 13534 13535These options are defined for AVR implementations: 13536 13537@table @gcctabopt 13538@item -mmcu=@var{mcu} 13539@opindex mmcu 13540Specify Atmel AVR instruction set architectures (ISA) or MCU type. 13541 13542The default for this option is@tie{}@samp{avr2}. 13543 13544GCC supports the following AVR devices and ISAs: 13545 13546@include avr-mmcu.texi 13547 13548@item -maccumulate-args 13549@opindex maccumulate-args 13550Accumulate outgoing function arguments and acquire/release the needed 13551stack space for outgoing function arguments once in function 13552prologue/epilogue. Without this option, outgoing arguments are pushed 13553before calling a function and popped afterwards. 13554 13555Popping the arguments after the function call can be expensive on 13556AVR so that accumulating the stack space might lead to smaller 13557executables because arguments need not to be removed from the 13558stack after such a function call. 13559 13560This option can lead to reduced code size for functions that perform 13561several calls to functions that get their arguments on the stack like 13562calls to printf-like functions. 13563 13564@item -mbranch-cost=@var{cost} 13565@opindex mbranch-cost 13566Set the branch costs for conditional branch instructions to 13567@var{cost}. Reasonable values for @var{cost} are small, non-negative 13568integers. The default branch cost is 0. 13569 13570@item -mcall-prologues 13571@opindex mcall-prologues 13572Functions prologues/epilogues are expanded as calls to appropriate 13573subroutines. Code size is smaller. 13574 13575@item -mint8 13576@opindex mint8 13577Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 13578@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 13579and @code{long long} is 4 bytes. Please note that this option does not 13580conform to the C standards, but it results in smaller code 13581size. 13582 13583@item -mn-flash=@var{num} 13584@opindex mn-flash 13585Assume that the flash memory has a size of 13586@var{num} times 64@tie{}KiB. 13587 13588@item -mno-interrupts 13589@opindex mno-interrupts 13590Generated code is not compatible with hardware interrupts. 13591Code size is smaller. 13592 13593@item -mrelax 13594@opindex mrelax 13595Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 13596@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 13597Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 13598the assembler's command line and the @option{--relax} option to the 13599linker's command line. 13600 13601Jump relaxing is performed by the linker because jump offsets are not 13602known before code is located. Therefore, the assembler code generated by the 13603compiler is the same, but the instructions in the executable may 13604differ from instructions in the assembler code. 13605 13606Relaxing must be turned on if linker stubs are needed, see the 13607section on @code{EIND} and linker stubs below. 13608 13609@item -mrmw 13610@opindex mrmw 13611Assume that the device supports the Read-Modify-Write 13612instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 13613 13614@item -msp8 13615@opindex msp8 13616Treat the stack pointer register as an 8-bit register, 13617i.e.@: assume the high byte of the stack pointer is zero. 13618In general, you don't need to set this option by hand. 13619 13620This option is used internally by the compiler to select and 13621build multilibs for architectures @code{avr2} and @code{avr25}. 13622These architectures mix devices with and without @code{SPH}. 13623For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 13624the compiler driver adds or removes this option from the compiler 13625proper's command line, because the compiler then knows if the device 13626or architecture has an 8-bit stack pointer and thus no @code{SPH} 13627register or not. 13628 13629@item -mstrict-X 13630@opindex mstrict-X 13631Use address register @code{X} in a way proposed by the hardware. This means 13632that @code{X} is only used in indirect, post-increment or 13633pre-decrement addressing. 13634 13635Without this option, the @code{X} register may be used in the same way 13636as @code{Y} or @code{Z} which then is emulated by additional 13637instructions. 13638For example, loading a value with @code{X+const} addressing with a 13639small non-negative @code{const < 64} to a register @var{Rn} is 13640performed as 13641 13642@example 13643adiw r26, const ; X += const 13644ld @var{Rn}, X ; @var{Rn} = *X 13645sbiw r26, const ; X -= const 13646@end example 13647 13648@item -mtiny-stack 13649@opindex mtiny-stack 13650Only change the lower 8@tie{}bits of the stack pointer. 13651 13652@item -nodevicelib 13653@opindex nodevicelib 13654Don't link against AVR-LibC's device specific library @code{libdev.a}. 13655 13656@item -Waddr-space-convert 13657@opindex Waddr-space-convert 13658Warn about conversions between address spaces in the case where the 13659resulting address space is not contained in the incoming address space. 13660@end table 13661 13662@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 13663@cindex @code{EIND} 13664Pointers in the implementation are 16@tie{}bits wide. 13665The address of a function or label is represented as word address so 13666that indirect jumps and calls can target any code address in the 13667range of 64@tie{}Ki words. 13668 13669In order to facilitate indirect jump on devices with more than 128@tie{}Ki 13670bytes of program memory space, there is a special function register called 13671@code{EIND} that serves as most significant part of the target address 13672when @code{EICALL} or @code{EIJMP} instructions are used. 13673 13674Indirect jumps and calls on these devices are handled as follows by 13675the compiler and are subject to some limitations: 13676 13677@itemize @bullet 13678 13679@item 13680The compiler never sets @code{EIND}. 13681 13682@item 13683The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP} 13684instructions or might read @code{EIND} directly in order to emulate an 13685indirect call/jump by means of a @code{RET} instruction. 13686 13687@item 13688The compiler assumes that @code{EIND} never changes during the startup 13689code or during the application. In particular, @code{EIND} is not 13690saved/restored in function or interrupt service routine 13691prologue/epilogue. 13692 13693@item 13694For indirect calls to functions and computed goto, the linker 13695generates @emph{stubs}. Stubs are jump pads sometimes also called 13696@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 13697The stub contains a direct jump to the desired address. 13698 13699@item 13700Linker relaxation must be turned on so that the linker generates 13701the stubs correctly in all situations. See the compiler option 13702@option{-mrelax} and the linker option @option{--relax}. 13703There are corner cases where the linker is supposed to generate stubs 13704but aborts without relaxation and without a helpful error message. 13705 13706@item 13707The default linker script is arranged for code with @code{EIND = 0}. 13708If code is supposed to work for a setup with @code{EIND != 0}, a custom 13709linker script has to be used in order to place the sections whose 13710name start with @code{.trampolines} into the segment where @code{EIND} 13711points to. 13712 13713@item 13714The startup code from libgcc never sets @code{EIND}. 13715Notice that startup code is a blend of code from libgcc and AVR-LibC. 13716For the impact of AVR-LibC on @code{EIND}, see the 13717@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 13718 13719@item 13720It is legitimate for user-specific startup code to set up @code{EIND} 13721early, for example by means of initialization code located in 13722section @code{.init3}. Such code runs prior to general startup code 13723that initializes RAM and calls constructors, but after the bit 13724of startup code from AVR-LibC that sets @code{EIND} to the segment 13725where the vector table is located. 13726@example 13727#include <avr/io.h> 13728 13729static void 13730__attribute__((section(".init3"),naked,used,no_instrument_function)) 13731init3_set_eind (void) 13732@{ 13733 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 13734 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 13735@} 13736@end example 13737 13738@noindent 13739The @code{__trampolines_start} symbol is defined in the linker script. 13740 13741@item 13742Stubs are generated automatically by the linker if 13743the following two conditions are met: 13744@itemize @minus 13745 13746@item The address of a label is taken by means of the @code{gs} modifier 13747(short for @emph{generate stubs}) like so: 13748@example 13749LDI r24, lo8(gs(@var{func})) 13750LDI r25, hi8(gs(@var{func})) 13751@end example 13752@item The final location of that label is in a code segment 13753@emph{outside} the segment where the stubs are located. 13754@end itemize 13755 13756@item 13757The compiler emits such @code{gs} modifiers for code labels in the 13758following situations: 13759@itemize @minus 13760@item Taking address of a function or code label. 13761@item Computed goto. 13762@item If prologue-save function is used, see @option{-mcall-prologues} 13763command-line option. 13764@item Switch/case dispatch tables. If you do not want such dispatch 13765tables you can specify the @option{-fno-jump-tables} command-line option. 13766@item C and C++ constructors/destructors called during startup/shutdown. 13767@item If the tools hit a @code{gs()} modifier explained above. 13768@end itemize 13769 13770@item 13771Jumping to non-symbolic addresses like so is @emph{not} supported: 13772 13773@example 13774int main (void) 13775@{ 13776 /* Call function at word address 0x2 */ 13777 return ((int(*)(void)) 0x2)(); 13778@} 13779@end example 13780 13781Instead, a stub has to be set up, i.e.@: the function has to be called 13782through a symbol (@code{func_4} in the example): 13783 13784@example 13785int main (void) 13786@{ 13787 extern int func_4 (void); 13788 13789 /* Call function at byte address 0x4 */ 13790 return func_4(); 13791@} 13792@end example 13793 13794and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 13795Alternatively, @code{func_4} can be defined in the linker script. 13796@end itemize 13797 13798@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 13799@cindex @code{RAMPD} 13800@cindex @code{RAMPX} 13801@cindex @code{RAMPY} 13802@cindex @code{RAMPZ} 13803Some AVR devices support memories larger than the 64@tie{}KiB range 13804that can be accessed with 16-bit pointers. To access memory locations 13805outside this 64@tie{}KiB range, the contentent of a @code{RAMP} 13806register is used as high part of the address: 13807The @code{X}, @code{Y}, @code{Z} address register is concatenated 13808with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 13809register, respectively, to get a wide address. Similarly, 13810@code{RAMPD} is used together with direct addressing. 13811 13812@itemize 13813@item 13814The startup code initializes the @code{RAMP} special function 13815registers with zero. 13816 13817@item 13818If a @ref{AVR Named Address Spaces,named address space} other than 13819generic or @code{__flash} is used, then @code{RAMPZ} is set 13820as needed before the operation. 13821 13822@item 13823If the device supports RAM larger than 64@tie{}KiB and the compiler 13824needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 13825is reset to zero after the operation. 13826 13827@item 13828If the device comes with a specific @code{RAMP} register, the ISR 13829prologue/epilogue saves/restores that SFR and initializes it with 13830zero in case the ISR code might (implicitly) use it. 13831 13832@item 13833RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 13834If you use inline assembler to read from locations outside the 1383516-bit address range and change one of the @code{RAMP} registers, 13836you must reset it to zero after the access. 13837 13838@end itemize 13839 13840@subsubsection AVR Built-in Macros 13841 13842GCC defines several built-in macros so that the user code can test 13843for the presence or absence of features. Almost any of the following 13844built-in macros are deduced from device capabilities and thus 13845triggered by the @option{-mmcu=} command-line option. 13846 13847For even more AVR-specific built-in macros see 13848@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 13849 13850@table @code 13851 13852@item __AVR_ARCH__ 13853Build-in macro that resolves to a decimal number that identifies the 13854architecture and depends on the @option{-mmcu=@var{mcu}} option. 13855Possible values are: 13856 13857@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 13858@code{4}, @code{5}, @code{51}, @code{6} 13859 13860for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 13861@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 13862 13863respectively and 13864 13865@code{100}, @code{102}, @code{104}, 13866@code{105}, @code{106}, @code{107} 13867 13868for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4}, 13869@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 13870If @var{mcu} specifies a device, this built-in macro is set 13871accordingly. For example, with @option{-mmcu=atmega8} the macro is 13872defined to @code{4}. 13873 13874@item __AVR_@var{Device}__ 13875Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 13876the device's name. For example, @option{-mmcu=atmega8} defines the 13877built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 13878@code{__AVR_ATtiny261A__}, etc. 13879 13880The built-in macros' names follow 13881the scheme @code{__AVR_@var{Device}__} where @var{Device} is 13882the device name as from the AVR user manual. The difference between 13883@var{Device} in the built-in macro and @var{device} in 13884@option{-mmcu=@var{device}} is that the latter is always lowercase. 13885 13886If @var{device} is not a device but only a core architecture like 13887@samp{avr51}, this macro is not defined. 13888 13889@item __AVR_DEVICE_NAME__ 13890Setting @option{-mmcu=@var{device}} defines this built-in macro to 13891the device's name. For example, with @option{-mmcu=atmega8} the macro 13892is defined to @code{atmega8}. 13893 13894If @var{device} is not a device but only a core architecture like 13895@samp{avr51}, this macro is not defined. 13896 13897@item __AVR_XMEGA__ 13898The device / architecture belongs to the XMEGA family of devices. 13899 13900@item __AVR_HAVE_ELPM__ 13901The device has the the @code{ELPM} instruction. 13902 13903@item __AVR_HAVE_ELPMX__ 13904The device has the @code{ELPM R@var{n},Z} and @code{ELPM 13905R@var{n},Z+} instructions. 13906 13907@item __AVR_HAVE_MOVW__ 13908The device has the @code{MOVW} instruction to perform 16-bit 13909register-register moves. 13910 13911@item __AVR_HAVE_LPMX__ 13912The device has the @code{LPM R@var{n},Z} and 13913@code{LPM R@var{n},Z+} instructions. 13914 13915@item __AVR_HAVE_MUL__ 13916The device has a hardware multiplier. 13917 13918@item __AVR_HAVE_JMP_CALL__ 13919The device has the @code{JMP} and @code{CALL} instructions. 13920This is the case for devices with at least 16@tie{}KiB of program 13921memory. 13922 13923@item __AVR_HAVE_EIJMP_EICALL__ 13924@itemx __AVR_3_BYTE_PC__ 13925The device has the @code{EIJMP} and @code{EICALL} instructions. 13926This is the case for devices with more than 128@tie{}KiB of program memory. 13927This also means that the program counter 13928(PC) is 3@tie{}bytes wide. 13929 13930@item __AVR_2_BYTE_PC__ 13931The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 13932with up to 128@tie{}KiB of program memory. 13933 13934@item __AVR_HAVE_8BIT_SP__ 13935@itemx __AVR_HAVE_16BIT_SP__ 13936The stack pointer (SP) register is treated as 8-bit respectively 1393716-bit register by the compiler. 13938The definition of these macros is affected by @option{-mtiny-stack}. 13939 13940@item __AVR_HAVE_SPH__ 13941@itemx __AVR_SP8__ 13942The device has the SPH (high part of stack pointer) special function 13943register or has an 8-bit stack pointer, respectively. 13944The definition of these macros is affected by @option{-mmcu=} and 13945in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 13946by @option{-msp8}. 13947 13948@item __AVR_HAVE_RAMPD__ 13949@itemx __AVR_HAVE_RAMPX__ 13950@itemx __AVR_HAVE_RAMPY__ 13951@itemx __AVR_HAVE_RAMPZ__ 13952The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 13953@code{RAMPZ} special function register, respectively. 13954 13955@item __NO_INTERRUPTS__ 13956This macro reflects the @option{-mno-interrupts} command-line option. 13957 13958@item __AVR_ERRATA_SKIP__ 13959@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 13960Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 13961instructions because of a hardware erratum. Skip instructions are 13962@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 13963The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 13964set. 13965 13966@item __AVR_ISA_RMW__ 13967The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 13968 13969@item __AVR_SFR_OFFSET__=@var{offset} 13970Instructions that can address I/O special function registers directly 13971like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 13972address as if addressed by an instruction to access RAM like @code{LD} 13973or @code{STS}. This offset depends on the device architecture and has 13974to be subtracted from the RAM address in order to get the 13975respective I/O@tie{}address. 13976 13977@item __WITH_AVRLIBC__ 13978The compiler is configured to be used together with AVR-Libc. 13979See the @option{--with-avrlibc} configure option. 13980 13981@end table 13982 13983@node Blackfin Options 13984@subsection Blackfin Options 13985@cindex Blackfin Options 13986 13987@table @gcctabopt 13988@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 13989@opindex mcpu= 13990Specifies the name of the target Blackfin processor. Currently, @var{cpu} 13991can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 13992@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 13993@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 13994@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 13995@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 13996@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 13997@samp{bf561}, @samp{bf592}. 13998 13999The optional @var{sirevision} specifies the silicon revision of the target 14000Blackfin processor. Any workarounds available for the targeted silicon revision 14001are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 14002If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 14003are enabled. The @code{__SILICON_REVISION__} macro is defined to two 14004hexadecimal digits representing the major and minor numbers in the silicon 14005revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 14006is not defined. If @var{sirevision} is @samp{any}, the 14007@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 14008If this optional @var{sirevision} is not used, GCC assumes the latest known 14009silicon revision of the targeted Blackfin processor. 14010 14011GCC defines a preprocessor macro for the specified @var{cpu}. 14012For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 14013provided by libgloss to be linked in if @option{-msim} is not given. 14014 14015Without this option, @samp{bf532} is used as the processor by default. 14016 14017Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 14018only the preprocessor macro is defined. 14019 14020@item -msim 14021@opindex msim 14022Specifies that the program will be run on the simulator. This causes 14023the simulator BSP provided by libgloss to be linked in. This option 14024has effect only for @samp{bfin-elf} toolchain. 14025Certain other options, such as @option{-mid-shared-library} and 14026@option{-mfdpic}, imply @option{-msim}. 14027 14028@item -momit-leaf-frame-pointer 14029@opindex momit-leaf-frame-pointer 14030Don't keep the frame pointer in a register for leaf functions. This 14031avoids the instructions to save, set up and restore frame pointers and 14032makes an extra register available in leaf functions. The option 14033@option{-fomit-frame-pointer} removes the frame pointer for all functions, 14034which might make debugging harder. 14035 14036@item -mspecld-anomaly 14037@opindex mspecld-anomaly 14038When enabled, the compiler ensures that the generated code does not 14039contain speculative loads after jump instructions. If this option is used, 14040@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 14041 14042@item -mno-specld-anomaly 14043@opindex mno-specld-anomaly 14044Don't generate extra code to prevent speculative loads from occurring. 14045 14046@item -mcsync-anomaly 14047@opindex mcsync-anomaly 14048When enabled, the compiler ensures that the generated code does not 14049contain CSYNC or SSYNC instructions too soon after conditional branches. 14050If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 14051 14052@item -mno-csync-anomaly 14053@opindex mno-csync-anomaly 14054Don't generate extra code to prevent CSYNC or SSYNC instructions from 14055occurring too soon after a conditional branch. 14056 14057@item -mlow-64k 14058@opindex mlow-64k 14059When enabled, the compiler is free to take advantage of the knowledge that 14060the entire program fits into the low 64k of memory. 14061 14062@item -mno-low-64k 14063@opindex mno-low-64k 14064Assume that the program is arbitrarily large. This is the default. 14065 14066@item -mstack-check-l1 14067@opindex mstack-check-l1 14068Do stack checking using information placed into L1 scratchpad memory by the 14069uClinux kernel. 14070 14071@item -mid-shared-library 14072@opindex mid-shared-library 14073Generate code that supports shared libraries via the library ID method. 14074This allows for execute in place and shared libraries in an environment 14075without virtual memory management. This option implies @option{-fPIC}. 14076With a @samp{bfin-elf} target, this option implies @option{-msim}. 14077 14078@item -mno-id-shared-library 14079@opindex mno-id-shared-library 14080Generate code that doesn't assume ID-based shared libraries are being used. 14081This is the default. 14082 14083@item -mleaf-id-shared-library 14084@opindex mleaf-id-shared-library 14085Generate code that supports shared libraries via the library ID method, 14086but assumes that this library or executable won't link against any other 14087ID shared libraries. That allows the compiler to use faster code for jumps 14088and calls. 14089 14090@item -mno-leaf-id-shared-library 14091@opindex mno-leaf-id-shared-library 14092Do not assume that the code being compiled won't link against any ID shared 14093libraries. Slower code is generated for jump and call insns. 14094 14095@item -mshared-library-id=n 14096@opindex mshared-library-id 14097Specifies the identification number of the ID-based shared library being 14098compiled. Specifying a value of 0 generates more compact code; specifying 14099other values forces the allocation of that number to the current 14100library but is no more space- or time-efficient than omitting this option. 14101 14102@item -msep-data 14103@opindex msep-data 14104Generate code that allows the data segment to be located in a different 14105area of memory from the text segment. This allows for execute in place in 14106an environment without virtual memory management by eliminating relocations 14107against the text section. 14108 14109@item -mno-sep-data 14110@opindex mno-sep-data 14111Generate code that assumes that the data segment follows the text segment. 14112This is the default. 14113 14114@item -mlong-calls 14115@itemx -mno-long-calls 14116@opindex mlong-calls 14117@opindex mno-long-calls 14118Tells the compiler to perform function calls by first loading the 14119address of the function into a register and then performing a subroutine 14120call on this register. This switch is needed if the target function 14121lies outside of the 24-bit addressing range of the offset-based 14122version of subroutine call instruction. 14123 14124This feature is not enabled by default. Specifying 14125@option{-mno-long-calls} restores the default behavior. Note these 14126switches have no effect on how the compiler generates code to handle 14127function calls via function pointers. 14128 14129@item -mfast-fp 14130@opindex mfast-fp 14131Link with the fast floating-point library. This library relaxes some of 14132the IEEE floating-point standard's rules for checking inputs against 14133Not-a-Number (NAN), in the interest of performance. 14134 14135@item -minline-plt 14136@opindex minline-plt 14137Enable inlining of PLT entries in function calls to functions that are 14138not known to bind locally. It has no effect without @option{-mfdpic}. 14139 14140@item -mmulticore 14141@opindex mmulticore 14142Build a standalone application for multicore Blackfin processors. 14143This option causes proper start files and link scripts supporting 14144multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 14145It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 14146 14147This option can be used with @option{-mcorea} or @option{-mcoreb}, which 14148selects the one-application-per-core programming model. Without 14149@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 14150programming model is used. In this model, the main function of Core B 14151should be named as @code{coreb_main}. 14152 14153If this option is not used, the single-core application programming 14154model is used. 14155 14156@item -mcorea 14157@opindex mcorea 14158Build a standalone application for Core A of BF561 when using 14159the one-application-per-core programming model. Proper start files 14160and link scripts are used to support Core A, and the macro 14161@code{__BFIN_COREA} is defined. 14162This option can only be used in conjunction with @option{-mmulticore}. 14163 14164@item -mcoreb 14165@opindex mcoreb 14166Build a standalone application for Core B of BF561 when using 14167the one-application-per-core programming model. Proper start files 14168and link scripts are used to support Core B, and the macro 14169@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 14170should be used instead of @code{main}. 14171This option can only be used in conjunction with @option{-mmulticore}. 14172 14173@item -msdram 14174@opindex msdram 14175Build a standalone application for SDRAM. Proper start files and 14176link scripts are used to put the application into SDRAM, and the macro 14177@code{__BFIN_SDRAM} is defined. 14178The loader should initialize SDRAM before loading the application. 14179 14180@item -micplb 14181@opindex micplb 14182Assume that ICPLBs are enabled at run time. This has an effect on certain 14183anomaly workarounds. For Linux targets, the default is to assume ICPLBs 14184are enabled; for standalone applications the default is off. 14185@end table 14186 14187@node C6X Options 14188@subsection C6X Options 14189@cindex C6X Options 14190 14191@table @gcctabopt 14192@item -march=@var{name} 14193@opindex march 14194This specifies the name of the target architecture. GCC uses this 14195name to determine what kind of instructions it can emit when generating 14196assembly code. Permissible names are: @samp{c62x}, 14197@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 14198 14199@item -mbig-endian 14200@opindex mbig-endian 14201Generate code for a big-endian target. 14202 14203@item -mlittle-endian 14204@opindex mlittle-endian 14205Generate code for a little-endian target. This is the default. 14206 14207@item -msim 14208@opindex msim 14209Choose startup files and linker script suitable for the simulator. 14210 14211@item -msdata=default 14212@opindex msdata=default 14213Put small global and static data in the @code{.neardata} section, 14214which is pointed to by register @code{B14}. Put small uninitialized 14215global and static data in the @code{.bss} section, which is adjacent 14216to the @code{.neardata} section. Put small read-only data into the 14217@code{.rodata} section. The corresponding sections used for large 14218pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 14219 14220@item -msdata=all 14221@opindex msdata=all 14222Put all data, not just small objects, into the sections reserved for 14223small data, and use addressing relative to the @code{B14} register to 14224access them. 14225 14226@item -msdata=none 14227@opindex msdata=none 14228Make no use of the sections reserved for small data, and use absolute 14229addresses to access all data. Put all initialized global and static 14230data in the @code{.fardata} section, and all uninitialized data in the 14231@code{.far} section. Put all constant data into the @code{.const} 14232section. 14233@end table 14234 14235@node CRIS Options 14236@subsection CRIS Options 14237@cindex CRIS Options 14238 14239These options are defined specifically for the CRIS ports. 14240 14241@table @gcctabopt 14242@item -march=@var{architecture-type} 14243@itemx -mcpu=@var{architecture-type} 14244@opindex march 14245@opindex mcpu 14246Generate code for the specified architecture. The choices for 14247@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 14248respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 14249Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 14250@samp{v10}. 14251 14252@item -mtune=@var{architecture-type} 14253@opindex mtune 14254Tune to @var{architecture-type} everything applicable about the generated 14255code, except for the ABI and the set of available instructions. The 14256choices for @var{architecture-type} are the same as for 14257@option{-march=@var{architecture-type}}. 14258 14259@item -mmax-stack-frame=@var{n} 14260@opindex mmax-stack-frame 14261Warn when the stack frame of a function exceeds @var{n} bytes. 14262 14263@item -metrax4 14264@itemx -metrax100 14265@opindex metrax4 14266@opindex metrax100 14267The options @option{-metrax4} and @option{-metrax100} are synonyms for 14268@option{-march=v3} and @option{-march=v8} respectively. 14269 14270@item -mmul-bug-workaround 14271@itemx -mno-mul-bug-workaround 14272@opindex mmul-bug-workaround 14273@opindex mno-mul-bug-workaround 14274Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 14275models where it applies. This option is active by default. 14276 14277@item -mpdebug 14278@opindex mpdebug 14279Enable CRIS-specific verbose debug-related information in the assembly 14280code. This option also has the effect of turning off the @samp{#NO_APP} 14281formatted-code indicator to the assembler at the beginning of the 14282assembly file. 14283 14284@item -mcc-init 14285@opindex mcc-init 14286Do not use condition-code results from previous instruction; always emit 14287compare and test instructions before use of condition codes. 14288 14289@item -mno-side-effects 14290@opindex mno-side-effects 14291Do not emit instructions with side effects in addressing modes other than 14292post-increment. 14293 14294@item -mstack-align 14295@itemx -mno-stack-align 14296@itemx -mdata-align 14297@itemx -mno-data-align 14298@itemx -mconst-align 14299@itemx -mno-const-align 14300@opindex mstack-align 14301@opindex mno-stack-align 14302@opindex mdata-align 14303@opindex mno-data-align 14304@opindex mconst-align 14305@opindex mno-const-align 14306These options (@samp{no-} options) arrange (eliminate arrangements) for the 14307stack frame, individual data and constants to be aligned for the maximum 14308single data access size for the chosen CPU model. The default is to 14309arrange for 32-bit alignment. ABI details such as structure layout are 14310not affected by these options. 14311 14312@item -m32-bit 14313@itemx -m16-bit 14314@itemx -m8-bit 14315@opindex m32-bit 14316@opindex m16-bit 14317@opindex m8-bit 14318Similar to the stack- data- and const-align options above, these options 14319arrange for stack frame, writable data and constants to all be 32-bit, 1432016-bit or 8-bit aligned. The default is 32-bit alignment. 14321 14322@item -mno-prologue-epilogue 14323@itemx -mprologue-epilogue 14324@opindex mno-prologue-epilogue 14325@opindex mprologue-epilogue 14326With @option{-mno-prologue-epilogue}, the normal function prologue and 14327epilogue which set up the stack frame are omitted and no return 14328instructions or return sequences are generated in the code. Use this 14329option only together with visual inspection of the compiled code: no 14330warnings or errors are generated when call-saved registers must be saved, 14331or storage for local variables needs to be allocated. 14332 14333@item -mno-gotplt 14334@itemx -mgotplt 14335@opindex mno-gotplt 14336@opindex mgotplt 14337With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 14338instruction sequences that load addresses for functions from the PLT part 14339of the GOT rather than (traditional on other architectures) calls to the 14340PLT@. The default is @option{-mgotplt}. 14341 14342@item -melf 14343@opindex melf 14344Legacy no-op option only recognized with the cris-axis-elf and 14345cris-axis-linux-gnu targets. 14346 14347@item -mlinux 14348@opindex mlinux 14349Legacy no-op option only recognized with the cris-axis-linux-gnu target. 14350 14351@item -sim 14352@opindex sim 14353This option, recognized for the cris-axis-elf, arranges 14354to link with input-output functions from a simulator library. Code, 14355initialized data and zero-initialized data are allocated consecutively. 14356 14357@item -sim2 14358@opindex sim2 14359Like @option{-sim}, but pass linker options to locate initialized data at 143600x40000000 and zero-initialized data at 0x80000000. 14361@end table 14362 14363@node CR16 Options 14364@subsection CR16 Options 14365@cindex CR16 Options 14366 14367These options are defined specifically for the CR16 ports. 14368 14369@table @gcctabopt 14370 14371@item -mmac 14372@opindex mmac 14373Enable the use of multiply-accumulate instructions. Disabled by default. 14374 14375@item -mcr16cplus 14376@itemx -mcr16c 14377@opindex mcr16cplus 14378@opindex mcr16c 14379Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 14380is default. 14381 14382@item -msim 14383@opindex msim 14384Links the library libsim.a which is in compatible with simulator. Applicable 14385to ELF compiler only. 14386 14387@item -mint32 14388@opindex mint32 14389Choose integer type as 32-bit wide. 14390 14391@item -mbit-ops 14392@opindex mbit-ops 14393Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 14394 14395@item -mdata-model=@var{model} 14396@opindex mdata-model 14397Choose a data model. The choices for @var{model} are @samp{near}, 14398@samp{far} or @samp{medium}. @samp{medium} is default. 14399However, @samp{far} is not valid with @option{-mcr16c}, as the 14400CR16C architecture does not support the far data model. 14401@end table 14402 14403@node Darwin Options 14404@subsection Darwin Options 14405@cindex Darwin options 14406 14407These options are defined for all architectures running the Darwin operating 14408system. 14409 14410FSF GCC on Darwin does not create ``fat'' object files; it creates 14411an object file for the single architecture that GCC was built to 14412target. Apple's GCC on Darwin does create ``fat'' files if multiple 14413@option{-arch} options are used; it does so by running the compiler or 14414linker multiple times and joining the results together with 14415@file{lipo}. 14416 14417The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 14418@samp{i686}) is determined by the flags that specify the ISA 14419that GCC is targeting, like @option{-mcpu} or @option{-march}. The 14420@option{-force_cpusubtype_ALL} option can be used to override this. 14421 14422The Darwin tools vary in their behavior when presented with an ISA 14423mismatch. The assembler, @file{as}, only permits instructions to 14424be used that are valid for the subtype of the file it is generating, 14425so you cannot put 64-bit instructions in a @samp{ppc750} object file. 14426The linker for shared libraries, @file{/usr/bin/libtool}, fails 14427and prints an error if asked to create a shared library with a less 14428restrictive subtype than its input files (for instance, trying to put 14429a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 14430for executables, @command{ld}, quietly gives the executable the most 14431restrictive subtype of any of its input files. 14432 14433@table @gcctabopt 14434@item -F@var{dir} 14435@opindex F 14436Add the framework directory @var{dir} to the head of the list of 14437directories to be searched for header files. These directories are 14438interleaved with those specified by @option{-I} options and are 14439scanned in a left-to-right order. 14440 14441A framework directory is a directory with frameworks in it. A 14442framework is a directory with a @file{Headers} and/or 14443@file{PrivateHeaders} directory contained directly in it that ends 14444in @file{.framework}. The name of a framework is the name of this 14445directory excluding the @file{.framework}. Headers associated with 14446the framework are found in one of those two directories, with 14447@file{Headers} being searched first. A subframework is a framework 14448directory that is in a framework's @file{Frameworks} directory. 14449Includes of subframework headers can only appear in a header of a 14450framework that contains the subframework, or in a sibling subframework 14451header. Two subframeworks are siblings if they occur in the same 14452framework. A subframework should not have the same name as a 14453framework; a warning is issued if this is violated. Currently a 14454subframework cannot have subframeworks; in the future, the mechanism 14455may be extended to support this. The standard frameworks can be found 14456in @file{/System/Library/Frameworks} and 14457@file{/Library/Frameworks}. An example include looks like 14458@code{#include <Framework/header.h>}, where @file{Framework} denotes 14459the name of the framework and @file{header.h} is found in the 14460@file{PrivateHeaders} or @file{Headers} directory. 14461 14462@item -iframework@var{dir} 14463@opindex iframework 14464Like @option{-F} except the directory is a treated as a system 14465directory. The main difference between this @option{-iframework} and 14466@option{-F} is that with @option{-iframework} the compiler does not 14467warn about constructs contained within header files found via 14468@var{dir}. This option is valid only for the C family of languages. 14469 14470@item -gused 14471@opindex gused 14472Emit debugging information for symbols that are used. For stabs 14473debugging format, this enables @option{-feliminate-unused-debug-symbols}. 14474This is by default ON@. 14475 14476@item -gfull 14477@opindex gfull 14478Emit debugging information for all symbols and types. 14479 14480@item -mmacosx-version-min=@var{version} 14481The earliest version of MacOS X that this executable will run on 14482is @var{version}. Typical values of @var{version} include @code{10.1}, 14483@code{10.2}, and @code{10.3.9}. 14484 14485If the compiler was built to use the system's headers by default, 14486then the default for this option is the system version on which the 14487compiler is running, otherwise the default is to make choices that 14488are compatible with as many systems and code bases as possible. 14489 14490@item -mkernel 14491@opindex mkernel 14492Enable kernel development mode. The @option{-mkernel} option sets 14493@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 14494@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 14495@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 14496applicable. This mode also sets @option{-mno-altivec}, 14497@option{-msoft-float}, @option{-fno-builtin} and 14498@option{-mlong-branch} for PowerPC targets. 14499 14500@item -mone-byte-bool 14501@opindex mone-byte-bool 14502Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 14503By default @code{sizeof(bool)} is @code{4} when compiling for 14504Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 14505option has no effect on x86. 14506 14507@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 14508to generate code that is not binary compatible with code generated 14509without that switch. Using this switch may require recompiling all 14510other modules in a program, including system libraries. Use this 14511switch to conform to a non-default data model. 14512 14513@item -mfix-and-continue 14514@itemx -ffix-and-continue 14515@itemx -findirect-data 14516@opindex mfix-and-continue 14517@opindex ffix-and-continue 14518@opindex findirect-data 14519Generate code suitable for fast turnaround development, such as to 14520allow GDB to dynamically load @file{.o} files into already-running 14521programs. @option{-findirect-data} and @option{-ffix-and-continue} 14522are provided for backwards compatibility. 14523 14524@item -all_load 14525@opindex all_load 14526Loads all members of static archive libraries. 14527See man ld(1) for more information. 14528 14529@item -arch_errors_fatal 14530@opindex arch_errors_fatal 14531Cause the errors having to do with files that have the wrong architecture 14532to be fatal. 14533 14534@item -bind_at_load 14535@opindex bind_at_load 14536Causes the output file to be marked such that the dynamic linker will 14537bind all undefined references when the file is loaded or launched. 14538 14539@item -bundle 14540@opindex bundle 14541Produce a Mach-o bundle format file. 14542See man ld(1) for more information. 14543 14544@item -bundle_loader @var{executable} 14545@opindex bundle_loader 14546This option specifies the @var{executable} that will load the build 14547output file being linked. See man ld(1) for more information. 14548 14549@item -dynamiclib 14550@opindex dynamiclib 14551When passed this option, GCC produces a dynamic library instead of 14552an executable when linking, using the Darwin @file{libtool} command. 14553 14554@item -force_cpusubtype_ALL 14555@opindex force_cpusubtype_ALL 14556This causes GCC's output file to have the @samp{ALL} subtype, instead of 14557one controlled by the @option{-mcpu} or @option{-march} option. 14558 14559@item -allowable_client @var{client_name} 14560@itemx -client_name 14561@itemx -compatibility_version 14562@itemx -current_version 14563@itemx -dead_strip 14564@itemx -dependency-file 14565@itemx -dylib_file 14566@itemx -dylinker_install_name 14567@itemx -dynamic 14568@itemx -exported_symbols_list 14569@itemx -filelist 14570@need 800 14571@itemx -flat_namespace 14572@itemx -force_flat_namespace 14573@itemx -headerpad_max_install_names 14574@itemx -image_base 14575@itemx -init 14576@itemx -install_name 14577@itemx -keep_private_externs 14578@itemx -multi_module 14579@itemx -multiply_defined 14580@itemx -multiply_defined_unused 14581@need 800 14582@itemx -noall_load 14583@itemx -no_dead_strip_inits_and_terms 14584@itemx -nofixprebinding 14585@itemx -nomultidefs 14586@itemx -noprebind 14587@itemx -noseglinkedit 14588@itemx -pagezero_size 14589@itemx -prebind 14590@itemx -prebind_all_twolevel_modules 14591@itemx -private_bundle 14592@need 800 14593@itemx -read_only_relocs 14594@itemx -sectalign 14595@itemx -sectobjectsymbols 14596@itemx -whyload 14597@itemx -seg1addr 14598@itemx -sectcreate 14599@itemx -sectobjectsymbols 14600@itemx -sectorder 14601@itemx -segaddr 14602@itemx -segs_read_only_addr 14603@need 800 14604@itemx -segs_read_write_addr 14605@itemx -seg_addr_table 14606@itemx -seg_addr_table_filename 14607@itemx -seglinkedit 14608@itemx -segprot 14609@itemx -segs_read_only_addr 14610@itemx -segs_read_write_addr 14611@itemx -single_module 14612@itemx -static 14613@itemx -sub_library 14614@need 800 14615@itemx -sub_umbrella 14616@itemx -twolevel_namespace 14617@itemx -umbrella 14618@itemx -undefined 14619@itemx -unexported_symbols_list 14620@itemx -weak_reference_mismatches 14621@itemx -whatsloaded 14622@opindex allowable_client 14623@opindex client_name 14624@opindex compatibility_version 14625@opindex current_version 14626@opindex dead_strip 14627@opindex dependency-file 14628@opindex dylib_file 14629@opindex dylinker_install_name 14630@opindex dynamic 14631@opindex exported_symbols_list 14632@opindex filelist 14633@opindex flat_namespace 14634@opindex force_flat_namespace 14635@opindex headerpad_max_install_names 14636@opindex image_base 14637@opindex init 14638@opindex install_name 14639@opindex keep_private_externs 14640@opindex multi_module 14641@opindex multiply_defined 14642@opindex multiply_defined_unused 14643@opindex noall_load 14644@opindex no_dead_strip_inits_and_terms 14645@opindex nofixprebinding 14646@opindex nomultidefs 14647@opindex noprebind 14648@opindex noseglinkedit 14649@opindex pagezero_size 14650@opindex prebind 14651@opindex prebind_all_twolevel_modules 14652@opindex private_bundle 14653@opindex read_only_relocs 14654@opindex sectalign 14655@opindex sectobjectsymbols 14656@opindex whyload 14657@opindex seg1addr 14658@opindex sectcreate 14659@opindex sectobjectsymbols 14660@opindex sectorder 14661@opindex segaddr 14662@opindex segs_read_only_addr 14663@opindex segs_read_write_addr 14664@opindex seg_addr_table 14665@opindex seg_addr_table_filename 14666@opindex seglinkedit 14667@opindex segprot 14668@opindex segs_read_only_addr 14669@opindex segs_read_write_addr 14670@opindex single_module 14671@opindex static 14672@opindex sub_library 14673@opindex sub_umbrella 14674@opindex twolevel_namespace 14675@opindex umbrella 14676@opindex undefined 14677@opindex unexported_symbols_list 14678@opindex weak_reference_mismatches 14679@opindex whatsloaded 14680These options are passed to the Darwin linker. The Darwin linker man page 14681describes them in detail. 14682@end table 14683 14684@node DEC Alpha Options 14685@subsection DEC Alpha Options 14686 14687These @samp{-m} options are defined for the DEC Alpha implementations: 14688 14689@table @gcctabopt 14690@item -mno-soft-float 14691@itemx -msoft-float 14692@opindex mno-soft-float 14693@opindex msoft-float 14694Use (do not use) the hardware floating-point instructions for 14695floating-point operations. When @option{-msoft-float} is specified, 14696functions in @file{libgcc.a} are used to perform floating-point 14697operations. Unless they are replaced by routines that emulate the 14698floating-point operations, or compiled in such a way as to call such 14699emulations routines, these routines issue floating-point 14700operations. If you are compiling for an Alpha without floating-point 14701operations, you must ensure that the library is built so as not to call 14702them. 14703 14704Note that Alpha implementations without floating-point operations are 14705required to have floating-point registers. 14706 14707@item -mfp-reg 14708@itemx -mno-fp-regs 14709@opindex mfp-reg 14710@opindex mno-fp-regs 14711Generate code that uses (does not use) the floating-point register set. 14712@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 14713register set is not used, floating-point operands are passed in integer 14714registers as if they were integers and floating-point results are passed 14715in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 14716so any function with a floating-point argument or return value called by code 14717compiled with @option{-mno-fp-regs} must also be compiled with that 14718option. 14719 14720A typical use of this option is building a kernel that does not use, 14721and hence need not save and restore, any floating-point registers. 14722 14723@item -mieee 14724@opindex mieee 14725The Alpha architecture implements floating-point hardware optimized for 14726maximum performance. It is mostly compliant with the IEEE floating-point 14727standard. However, for full compliance, software assistance is 14728required. This option generates code fully IEEE-compliant code 14729@emph{except} that the @var{inexact-flag} is not maintained (see below). 14730If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 14731defined during compilation. The resulting code is less efficient but is 14732able to correctly support denormalized numbers and exceptional IEEE 14733values such as not-a-number and plus/minus infinity. Other Alpha 14734compilers call this option @option{-ieee_with_no_inexact}. 14735 14736@item -mieee-with-inexact 14737@opindex mieee-with-inexact 14738This is like @option{-mieee} except the generated code also maintains 14739the IEEE @var{inexact-flag}. Turning on this option causes the 14740generated code to implement fully-compliant IEEE math. In addition to 14741@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 14742macro. On some Alpha implementations the resulting code may execute 14743significantly slower than the code generated by default. Since there is 14744very little code that depends on the @var{inexact-flag}, you should 14745normally not specify this option. Other Alpha compilers call this 14746option @option{-ieee_with_inexact}. 14747 14748@item -mfp-trap-mode=@var{trap-mode} 14749@opindex mfp-trap-mode 14750This option controls what floating-point related traps are enabled. 14751Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 14752The trap mode can be set to one of four values: 14753 14754@table @samp 14755@item n 14756This is the default (normal) setting. The only traps that are enabled 14757are the ones that cannot be disabled in software (e.g., division by zero 14758trap). 14759 14760@item u 14761In addition to the traps enabled by @samp{n}, underflow traps are enabled 14762as well. 14763 14764@item su 14765Like @samp{u}, but the instructions are marked to be safe for software 14766completion (see Alpha architecture manual for details). 14767 14768@item sui 14769Like @samp{su}, but inexact traps are enabled as well. 14770@end table 14771 14772@item -mfp-rounding-mode=@var{rounding-mode} 14773@opindex mfp-rounding-mode 14774Selects the IEEE rounding mode. Other Alpha compilers call this option 14775@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 14776of: 14777 14778@table @samp 14779@item n 14780Normal IEEE rounding mode. Floating-point numbers are rounded towards 14781the nearest machine number or towards the even machine number in case 14782of a tie. 14783 14784@item m 14785Round towards minus infinity. 14786 14787@item c 14788Chopped rounding mode. Floating-point numbers are rounded towards zero. 14789 14790@item d 14791Dynamic rounding mode. A field in the floating-point control register 14792(@var{fpcr}, see Alpha architecture reference manual) controls the 14793rounding mode in effect. The C library initializes this register for 14794rounding towards plus infinity. Thus, unless your program modifies the 14795@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 14796@end table 14797 14798@item -mtrap-precision=@var{trap-precision} 14799@opindex mtrap-precision 14800In the Alpha architecture, floating-point traps are imprecise. This 14801means without software assistance it is impossible to recover from a 14802floating trap and program execution normally needs to be terminated. 14803GCC can generate code that can assist operating system trap handlers 14804in determining the exact location that caused a floating-point trap. 14805Depending on the requirements of an application, different levels of 14806precisions can be selected: 14807 14808@table @samp 14809@item p 14810Program precision. This option is the default and means a trap handler 14811can only identify which program caused a floating-point exception. 14812 14813@item f 14814Function precision. The trap handler can determine the function that 14815caused a floating-point exception. 14816 14817@item i 14818Instruction precision. The trap handler can determine the exact 14819instruction that caused a floating-point exception. 14820@end table 14821 14822Other Alpha compilers provide the equivalent options called 14823@option{-scope_safe} and @option{-resumption_safe}. 14824 14825@item -mieee-conformant 14826@opindex mieee-conformant 14827This option marks the generated code as IEEE conformant. You must not 14828use this option unless you also specify @option{-mtrap-precision=i} and either 14829@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 14830is to emit the line @samp{.eflag 48} in the function prologue of the 14831generated assembly file. 14832 14833@item -mbuild-constants 14834@opindex mbuild-constants 14835Normally GCC examines a 32- or 64-bit integer constant to 14836see if it can construct it from smaller constants in two or three 14837instructions. If it cannot, it outputs the constant as a literal and 14838generates code to load it from the data segment at run time. 14839 14840Use this option to require GCC to construct @emph{all} integer constants 14841using code, even if it takes more instructions (the maximum is six). 14842 14843You typically use this option to build a shared library dynamic 14844loader. Itself a shared library, it must relocate itself in memory 14845before it can find the variables and constants in its own data segment. 14846 14847@item -mbwx 14848@itemx -mno-bwx 14849@itemx -mcix 14850@itemx -mno-cix 14851@itemx -mfix 14852@itemx -mno-fix 14853@itemx -mmax 14854@itemx -mno-max 14855@opindex mbwx 14856@opindex mno-bwx 14857@opindex mcix 14858@opindex mno-cix 14859@opindex mfix 14860@opindex mno-fix 14861@opindex mmax 14862@opindex mno-max 14863Indicate whether GCC should generate code to use the optional BWX, 14864CIX, FIX and MAX instruction sets. The default is to use the instruction 14865sets supported by the CPU type specified via @option{-mcpu=} option or that 14866of the CPU on which GCC was built if none is specified. 14867 14868@item -mfloat-vax 14869@itemx -mfloat-ieee 14870@opindex mfloat-vax 14871@opindex mfloat-ieee 14872Generate code that uses (does not use) VAX F and G floating-point 14873arithmetic instead of IEEE single and double precision. 14874 14875@item -mexplicit-relocs 14876@itemx -mno-explicit-relocs 14877@opindex mexplicit-relocs 14878@opindex mno-explicit-relocs 14879Older Alpha assemblers provided no way to generate symbol relocations 14880except via assembler macros. Use of these macros does not allow 14881optimal instruction scheduling. GNU binutils as of version 2.12 14882supports a new syntax that allows the compiler to explicitly mark 14883which relocations should apply to which instructions. This option 14884is mostly useful for debugging, as GCC detects the capabilities of 14885the assembler when it is built and sets the default accordingly. 14886 14887@item -msmall-data 14888@itemx -mlarge-data 14889@opindex msmall-data 14890@opindex mlarge-data 14891When @option{-mexplicit-relocs} is in effect, static data is 14892accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 14893is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 14894(the @code{.sdata} and @code{.sbss} sections) and are accessed via 1489516-bit relocations off of the @code{$gp} register. This limits the 14896size of the small data area to 64KB, but allows the variables to be 14897directly accessed via a single instruction. 14898 14899The default is @option{-mlarge-data}. With this option the data area 14900is limited to just below 2GB@. Programs that require more than 2GB of 14901data must use @code{malloc} or @code{mmap} to allocate the data in the 14902heap instead of in the program's data segment. 14903 14904When generating code for shared libraries, @option{-fpic} implies 14905@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 14906 14907@item -msmall-text 14908@itemx -mlarge-text 14909@opindex msmall-text 14910@opindex mlarge-text 14911When @option{-msmall-text} is used, the compiler assumes that the 14912code of the entire program (or shared library) fits in 4MB, and is 14913thus reachable with a branch instruction. When @option{-msmall-data} 14914is used, the compiler can assume that all local symbols share the 14915same @code{$gp} value, and thus reduce the number of instructions 14916required for a function call from 4 to 1. 14917 14918The default is @option{-mlarge-text}. 14919 14920@item -mcpu=@var{cpu_type} 14921@opindex mcpu 14922Set the instruction set and instruction scheduling parameters for 14923machine type @var{cpu_type}. You can specify either the @samp{EV} 14924style name or the corresponding chip number. GCC supports scheduling 14925parameters for the EV4, EV5 and EV6 family of processors and 14926chooses the default values for the instruction set from the processor 14927you specify. If you do not specify a processor type, GCC defaults 14928to the processor on which the compiler was built. 14929 14930Supported values for @var{cpu_type} are 14931 14932@table @samp 14933@item ev4 14934@itemx ev45 14935@itemx 21064 14936Schedules as an EV4 and has no instruction set extensions. 14937 14938@item ev5 14939@itemx 21164 14940Schedules as an EV5 and has no instruction set extensions. 14941 14942@item ev56 14943@itemx 21164a 14944Schedules as an EV5 and supports the BWX extension. 14945 14946@item pca56 14947@itemx 21164pc 14948@itemx 21164PC 14949Schedules as an EV5 and supports the BWX and MAX extensions. 14950 14951@item ev6 14952@itemx 21264 14953Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 14954 14955@item ev67 14956@itemx 21264a 14957Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 14958@end table 14959 14960Native toolchains also support the value @samp{native}, 14961which selects the best architecture option for the host processor. 14962@option{-mcpu=native} has no effect if GCC does not recognize 14963the processor. 14964 14965@item -mtune=@var{cpu_type} 14966@opindex mtune 14967Set only the instruction scheduling parameters for machine type 14968@var{cpu_type}. The instruction set is not changed. 14969 14970Native toolchains also support the value @samp{native}, 14971which selects the best architecture option for the host processor. 14972@option{-mtune=native} has no effect if GCC does not recognize 14973the processor. 14974 14975@item -mmemory-latency=@var{time} 14976@opindex mmemory-latency 14977Sets the latency the scheduler should assume for typical memory 14978references as seen by the application. This number is highly 14979dependent on the memory access patterns used by the application 14980and the size of the external cache on the machine. 14981 14982Valid options for @var{time} are 14983 14984@table @samp 14985@item @var{number} 14986A decimal number representing clock cycles. 14987 14988@item L1 14989@itemx L2 14990@itemx L3 14991@itemx main 14992The compiler contains estimates of the number of clock cycles for 14993``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 14994(also called Dcache, Scache, and Bcache), as well as to main memory. 14995Note that L3 is only valid for EV5. 14996 14997@end table 14998@end table 14999 15000@node FR30 Options 15001@subsection FR30 Options 15002@cindex FR30 Options 15003 15004These options are defined specifically for the FR30 port. 15005 15006@table @gcctabopt 15007 15008@item -msmall-model 15009@opindex msmall-model 15010Use the small address space model. This can produce smaller code, but 15011it does assume that all symbolic values and addresses fit into a 1501220-bit range. 15013 15014@item -mno-lsim 15015@opindex mno-lsim 15016Assume that runtime support has been provided and so there is no need 15017to include the simulator library (@file{libsim.a}) on the linker 15018command line. 15019 15020@end table 15021 15022@node FRV Options 15023@subsection FRV Options 15024@cindex FRV Options 15025 15026@table @gcctabopt 15027@item -mgpr-32 15028@opindex mgpr-32 15029 15030Only use the first 32 general-purpose registers. 15031 15032@item -mgpr-64 15033@opindex mgpr-64 15034 15035Use all 64 general-purpose registers. 15036 15037@item -mfpr-32 15038@opindex mfpr-32 15039 15040Use only the first 32 floating-point registers. 15041 15042@item -mfpr-64 15043@opindex mfpr-64 15044 15045Use all 64 floating-point registers. 15046 15047@item -mhard-float 15048@opindex mhard-float 15049 15050Use hardware instructions for floating-point operations. 15051 15052@item -msoft-float 15053@opindex msoft-float 15054 15055Use library routines for floating-point operations. 15056 15057@item -malloc-cc 15058@opindex malloc-cc 15059 15060Dynamically allocate condition code registers. 15061 15062@item -mfixed-cc 15063@opindex mfixed-cc 15064 15065Do not try to dynamically allocate condition code registers, only 15066use @code{icc0} and @code{fcc0}. 15067 15068@item -mdword 15069@opindex mdword 15070 15071Change ABI to use double word insns. 15072 15073@item -mno-dword 15074@opindex mno-dword 15075 15076Do not use double word instructions. 15077 15078@item -mdouble 15079@opindex mdouble 15080 15081Use floating-point double instructions. 15082 15083@item -mno-double 15084@opindex mno-double 15085 15086Do not use floating-point double instructions. 15087 15088@item -mmedia 15089@opindex mmedia 15090 15091Use media instructions. 15092 15093@item -mno-media 15094@opindex mno-media 15095 15096Do not use media instructions. 15097 15098@item -mmuladd 15099@opindex mmuladd 15100 15101Use multiply and add/subtract instructions. 15102 15103@item -mno-muladd 15104@opindex mno-muladd 15105 15106Do not use multiply and add/subtract instructions. 15107 15108@item -mfdpic 15109@opindex mfdpic 15110 15111Select the FDPIC ABI, which uses function descriptors to represent 15112pointers to functions. Without any PIC/PIE-related options, it 15113implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 15114assumes GOT entries and small data are within a 12-bit range from the 15115GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 15116are computed with 32 bits. 15117With a @samp{bfin-elf} target, this option implies @option{-msim}. 15118 15119@item -minline-plt 15120@opindex minline-plt 15121 15122Enable inlining of PLT entries in function calls to functions that are 15123not known to bind locally. It has no effect without @option{-mfdpic}. 15124It's enabled by default if optimizing for speed and compiling for 15125shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 15126optimization option such as @option{-O3} or above is present in the 15127command line. 15128 15129@item -mTLS 15130@opindex mTLS 15131 15132Assume a large TLS segment when generating thread-local code. 15133 15134@item -mtls 15135@opindex mtls 15136 15137Do not assume a large TLS segment when generating thread-local code. 15138 15139@item -mgprel-ro 15140@opindex mgprel-ro 15141 15142Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 15143that is known to be in read-only sections. It's enabled by default, 15144except for @option{-fpic} or @option{-fpie}: even though it may help 15145make the global offset table smaller, it trades 1 instruction for 4. 15146With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 15147one of which may be shared by multiple symbols, and it avoids the need 15148for a GOT entry for the referenced symbol, so it's more likely to be a 15149win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 15150 15151@item -multilib-library-pic 15152@opindex multilib-library-pic 15153 15154Link with the (library, not FD) pic libraries. It's implied by 15155@option{-mlibrary-pic}, as well as by @option{-fPIC} and 15156@option{-fpic} without @option{-mfdpic}. You should never have to use 15157it explicitly. 15158 15159@item -mlinked-fp 15160@opindex mlinked-fp 15161 15162Follow the EABI requirement of always creating a frame pointer whenever 15163a stack frame is allocated. This option is enabled by default and can 15164be disabled with @option{-mno-linked-fp}. 15165 15166@item -mlong-calls 15167@opindex mlong-calls 15168 15169Use indirect addressing to call functions outside the current 15170compilation unit. This allows the functions to be placed anywhere 15171within the 32-bit address space. 15172 15173@item -malign-labels 15174@opindex malign-labels 15175 15176Try to align labels to an 8-byte boundary by inserting NOPs into the 15177previous packet. This option only has an effect when VLIW packing 15178is enabled. It doesn't create new packets; it merely adds NOPs to 15179existing ones. 15180 15181@item -mlibrary-pic 15182@opindex mlibrary-pic 15183 15184Generate position-independent EABI code. 15185 15186@item -macc-4 15187@opindex macc-4 15188 15189Use only the first four media accumulator registers. 15190 15191@item -macc-8 15192@opindex macc-8 15193 15194Use all eight media accumulator registers. 15195 15196@item -mpack 15197@opindex mpack 15198 15199Pack VLIW instructions. 15200 15201@item -mno-pack 15202@opindex mno-pack 15203 15204Do not pack VLIW instructions. 15205 15206@item -mno-eflags 15207@opindex mno-eflags 15208 15209Do not mark ABI switches in e_flags. 15210 15211@item -mcond-move 15212@opindex mcond-move 15213 15214Enable the use of conditional-move instructions (default). 15215 15216This switch is mainly for debugging the compiler and will likely be removed 15217in a future version. 15218 15219@item -mno-cond-move 15220@opindex mno-cond-move 15221 15222Disable the use of conditional-move instructions. 15223 15224This switch is mainly for debugging the compiler and will likely be removed 15225in a future version. 15226 15227@item -mscc 15228@opindex mscc 15229 15230Enable the use of conditional set instructions (default). 15231 15232This switch is mainly for debugging the compiler and will likely be removed 15233in a future version. 15234 15235@item -mno-scc 15236@opindex mno-scc 15237 15238Disable the use of conditional set instructions. 15239 15240This switch is mainly for debugging the compiler and will likely be removed 15241in a future version. 15242 15243@item -mcond-exec 15244@opindex mcond-exec 15245 15246Enable the use of conditional execution (default). 15247 15248This switch is mainly for debugging the compiler and will likely be removed 15249in a future version. 15250 15251@item -mno-cond-exec 15252@opindex mno-cond-exec 15253 15254Disable the use of conditional execution. 15255 15256This switch is mainly for debugging the compiler and will likely be removed 15257in a future version. 15258 15259@item -mvliw-branch 15260@opindex mvliw-branch 15261 15262Run a pass to pack branches into VLIW instructions (default). 15263 15264This switch is mainly for debugging the compiler and will likely be removed 15265in a future version. 15266 15267@item -mno-vliw-branch 15268@opindex mno-vliw-branch 15269 15270Do not run a pass to pack branches into VLIW instructions. 15271 15272This switch is mainly for debugging the compiler and will likely be removed 15273in a future version. 15274 15275@item -mmulti-cond-exec 15276@opindex mmulti-cond-exec 15277 15278Enable optimization of @code{&&} and @code{||} in conditional execution 15279(default). 15280 15281This switch is mainly for debugging the compiler and will likely be removed 15282in a future version. 15283 15284@item -mno-multi-cond-exec 15285@opindex mno-multi-cond-exec 15286 15287Disable optimization of @code{&&} and @code{||} in conditional execution. 15288 15289This switch is mainly for debugging the compiler and will likely be removed 15290in a future version. 15291 15292@item -mnested-cond-exec 15293@opindex mnested-cond-exec 15294 15295Enable nested conditional execution optimizations (default). 15296 15297This switch is mainly for debugging the compiler and will likely be removed 15298in a future version. 15299 15300@item -mno-nested-cond-exec 15301@opindex mno-nested-cond-exec 15302 15303Disable nested conditional execution optimizations. 15304 15305This switch is mainly for debugging the compiler and will likely be removed 15306in a future version. 15307 15308@item -moptimize-membar 15309@opindex moptimize-membar 15310 15311This switch removes redundant @code{membar} instructions from the 15312compiler-generated code. It is enabled by default. 15313 15314@item -mno-optimize-membar 15315@opindex mno-optimize-membar 15316 15317This switch disables the automatic removal of redundant @code{membar} 15318instructions from the generated code. 15319 15320@item -mtomcat-stats 15321@opindex mtomcat-stats 15322 15323Cause gas to print out tomcat statistics. 15324 15325@item -mcpu=@var{cpu} 15326@opindex mcpu 15327 15328Select the processor type for which to generate code. Possible values are 15329@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 15330@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 15331 15332@end table 15333 15334@node GNU/Linux Options 15335@subsection GNU/Linux Options 15336 15337These @samp{-m} options are defined for GNU/Linux targets: 15338 15339@table @gcctabopt 15340@item -mglibc 15341@opindex mglibc 15342Use the GNU C library. This is the default except 15343on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. 15344 15345@item -muclibc 15346@opindex muclibc 15347Use uClibc C library. This is the default on 15348@samp{*-*-linux-*uclibc*} targets. 15349 15350@item -mbionic 15351@opindex mbionic 15352Use Bionic C library. This is the default on 15353@samp{*-*-linux-*android*} targets. 15354 15355@item -mandroid 15356@opindex mandroid 15357Compile code compatible with Android platform. This is the default on 15358@samp{*-*-linux-*android*} targets. 15359 15360When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 15361@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 15362this option makes the GCC driver pass Android-specific options to the linker. 15363Finally, this option causes the preprocessor macro @code{__ANDROID__} 15364to be defined. 15365 15366@item -tno-android-cc 15367@opindex tno-android-cc 15368Disable compilation effects of @option{-mandroid}, i.e., do not enable 15369@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 15370@option{-fno-rtti} by default. 15371 15372@item -tno-android-ld 15373@opindex tno-android-ld 15374Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 15375linking options to the linker. 15376 15377@end table 15378 15379@node H8/300 Options 15380@subsection H8/300 Options 15381 15382These @samp{-m} options are defined for the H8/300 implementations: 15383 15384@table @gcctabopt 15385@item -mrelax 15386@opindex mrelax 15387Shorten some address references at link time, when possible; uses the 15388linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 15389ld, Using ld}, for a fuller description. 15390 15391@item -mh 15392@opindex mh 15393Generate code for the H8/300H@. 15394 15395@item -ms 15396@opindex ms 15397Generate code for the H8S@. 15398 15399@item -mn 15400@opindex mn 15401Generate code for the H8S and H8/300H in the normal mode. This switch 15402must be used either with @option{-mh} or @option{-ms}. 15403 15404@item -ms2600 15405@opindex ms2600 15406Generate code for the H8S/2600. This switch must be used with @option{-ms}. 15407 15408@item -mexr 15409@opindex mexr 15410Extended registers are stored on stack before execution of function 15411with monitor attribute. Default option is @option{-mexr}. 15412This option is valid only for H8S targets. 15413 15414@item -mno-exr 15415@opindex mno-exr 15416Extended registers are not stored on stack before execution of function 15417with monitor attribute. Default option is @option{-mno-exr}. 15418This option is valid only for H8S targets. 15419 15420@item -mint32 15421@opindex mint32 15422Make @code{int} data 32 bits by default. 15423 15424@item -malign-300 15425@opindex malign-300 15426On the H8/300H and H8S, use the same alignment rules as for the H8/300. 15427The default for the H8/300H and H8S is to align longs and floats on 154284-byte boundaries. 15429@option{-malign-300} causes them to be aligned on 2-byte boundaries. 15430This option has no effect on the H8/300. 15431@end table 15432 15433@node HPPA Options 15434@subsection HPPA Options 15435@cindex HPPA Options 15436 15437These @samp{-m} options are defined for the HPPA family of computers: 15438 15439@table @gcctabopt 15440@item -march=@var{architecture-type} 15441@opindex march 15442Generate code for the specified architecture. The choices for 15443@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 154441.1, and @samp{2.0} for PA 2.0 processors. Refer to 15445@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 15446architecture option for your machine. Code compiled for lower numbered 15447architectures runs on higher numbered architectures, but not the 15448other way around. 15449 15450@item -mpa-risc-1-0 15451@itemx -mpa-risc-1-1 15452@itemx -mpa-risc-2-0 15453@opindex mpa-risc-1-0 15454@opindex mpa-risc-1-1 15455@opindex mpa-risc-2-0 15456Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 15457 15458@item -mjump-in-delay 15459@opindex mjump-in-delay 15460This option is ignored and provided for compatibility purposes only. 15461 15462@item -mdisable-fpregs 15463@opindex mdisable-fpregs 15464Prevent floating-point registers from being used in any manner. This is 15465necessary for compiling kernels that perform lazy context switching of 15466floating-point registers. If you use this option and attempt to perform 15467floating-point operations, the compiler aborts. 15468 15469@item -mdisable-indexing 15470@opindex mdisable-indexing 15471Prevent the compiler from using indexing address modes. This avoids some 15472rather obscure problems when compiling MIG generated code under MACH@. 15473 15474@item -mno-space-regs 15475@opindex mno-space-regs 15476Generate code that assumes the target has no space registers. This allows 15477GCC to generate faster indirect calls and use unscaled index address modes. 15478 15479Such code is suitable for level 0 PA systems and kernels. 15480 15481@item -mfast-indirect-calls 15482@opindex mfast-indirect-calls 15483Generate code that assumes calls never cross space boundaries. This 15484allows GCC to emit code that performs faster indirect calls. 15485 15486This option does not work in the presence of shared libraries or nested 15487functions. 15488 15489@item -mfixed-range=@var{register-range} 15490@opindex mfixed-range 15491Generate code treating the given register range as fixed registers. 15492A fixed register is one that the register allocator cannot use. This is 15493useful when compiling kernel code. A register range is specified as 15494two registers separated by a dash. Multiple register ranges can be 15495specified separated by a comma. 15496 15497@item -mlong-load-store 15498@opindex mlong-load-store 15499Generate 3-instruction load and store sequences as sometimes required by 15500the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 15501the HP compilers. 15502 15503@item -mportable-runtime 15504@opindex mportable-runtime 15505Use the portable calling conventions proposed by HP for ELF systems. 15506 15507@item -mgas 15508@opindex mgas 15509Enable the use of assembler directives only GAS understands. 15510 15511@item -mschedule=@var{cpu-type} 15512@opindex mschedule 15513Schedule code according to the constraints for the machine type 15514@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 15515@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 15516to @file{/usr/lib/sched.models} on an HP-UX system to determine the 15517proper scheduling option for your machine. The default scheduling is 15518@samp{8000}. 15519 15520@item -mlinker-opt 15521@opindex mlinker-opt 15522Enable the optimization pass in the HP-UX linker. Note this makes symbolic 15523debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 15524linkers in which they give bogus error messages when linking some programs. 15525 15526@item -msoft-float 15527@opindex msoft-float 15528Generate output containing library calls for floating point. 15529@strong{Warning:} the requisite libraries are not available for all HPPA 15530targets. Normally the facilities of the machine's usual C compiler are 15531used, but this cannot be done directly in cross-compilation. You must make 15532your own arrangements to provide suitable library functions for 15533cross-compilation. 15534 15535@option{-msoft-float} changes the calling convention in the output file; 15536therefore, it is only useful if you compile @emph{all} of a program with 15537this option. In particular, you need to compile @file{libgcc.a}, the 15538library that comes with GCC, with @option{-msoft-float} in order for 15539this to work. 15540 15541@item -msio 15542@opindex msio 15543Generate the predefine, @code{_SIO}, for server IO@. The default is 15544@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 15545@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 15546options are available under HP-UX and HI-UX@. 15547 15548@item -mgnu-ld 15549@opindex mgnu-ld 15550Use options specific to GNU @command{ld}. 15551This passes @option{-shared} to @command{ld} when 15552building a shared library. It is the default when GCC is configured, 15553explicitly or implicitly, with the GNU linker. This option does not 15554affect which @command{ld} is called; it only changes what parameters 15555are passed to that @command{ld}. 15556The @command{ld} that is called is determined by the 15557@option{--with-ld} configure option, GCC's program search path, and 15558finally by the user's @env{PATH}. The linker used by GCC can be printed 15559using @samp{which `gcc -print-prog-name=ld`}. This option is only available 15560on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 15561 15562@item -mhp-ld 15563@opindex mhp-ld 15564Use options specific to HP @command{ld}. 15565This passes @option{-b} to @command{ld} when building 15566a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 15567links. It is the default when GCC is configured, explicitly or 15568implicitly, with the HP linker. This option does not affect 15569which @command{ld} is called; it only changes what parameters are passed to that 15570@command{ld}. 15571The @command{ld} that is called is determined by the @option{--with-ld} 15572configure option, GCC's program search path, and finally by the user's 15573@env{PATH}. The linker used by GCC can be printed using @samp{which 15574`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 15575HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 15576 15577@item -mlong-calls 15578@opindex mno-long-calls 15579Generate code that uses long call sequences. This ensures that a call 15580is always able to reach linker generated stubs. The default is to generate 15581long calls only when the distance from the call site to the beginning 15582of the function or translation unit, as the case may be, exceeds a 15583predefined limit set by the branch type being used. The limits for 15584normal calls are 7,600,000 and 240,000 bytes, respectively for the 15585PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 15586240,000 bytes. 15587 15588Distances are measured from the beginning of functions when using the 15589@option{-ffunction-sections} option, or when using the @option{-mgas} 15590and @option{-mno-portable-runtime} options together under HP-UX with 15591the SOM linker. 15592 15593It is normally not desirable to use this option as it degrades 15594performance. However, it may be useful in large applications, 15595particularly when partial linking is used to build the application. 15596 15597The types of long calls used depends on the capabilities of the 15598assembler and linker, and the type of code being generated. The 15599impact on systems that support long absolute calls, and long pic 15600symbol-difference or pc-relative calls should be relatively small. 15601However, an indirect call is used on 32-bit ELF systems in pic code 15602and it is quite long. 15603 15604@item -munix=@var{unix-std} 15605@opindex march 15606Generate compiler predefines and select a startfile for the specified 15607UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 15608and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 15609is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 1561011.11 and later. The default values are @samp{93} for HP-UX 10.00, 15611@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 15612and later. 15613 15614@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 15615@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 15616and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 15617@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 15618@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 15619@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 15620 15621It is @emph{important} to note that this option changes the interfaces 15622for various library routines. It also affects the operational behavior 15623of the C library. Thus, @emph{extreme} care is needed in using this 15624option. 15625 15626Library code that is intended to operate with more than one UNIX 15627standard must test, set and restore the variable @code{__xpg4_extended_mask} 15628as appropriate. Most GNU software doesn't provide this capability. 15629 15630@item -nolibdld 15631@opindex nolibdld 15632Suppress the generation of link options to search libdld.sl when the 15633@option{-static} option is specified on HP-UX 10 and later. 15634 15635@item -static 15636@opindex static 15637The HP-UX implementation of setlocale in libc has a dependency on 15638libdld.sl. There isn't an archive version of libdld.sl. Thus, 15639when the @option{-static} option is specified, special link options 15640are needed to resolve this dependency. 15641 15642On HP-UX 10 and later, the GCC driver adds the necessary options to 15643link with libdld.sl when the @option{-static} option is specified. 15644This causes the resulting binary to be dynamic. On the 64-bit port, 15645the linkers generate dynamic binaries by default in any case. The 15646@option{-nolibdld} option can be used to prevent the GCC driver from 15647adding these link options. 15648 15649@item -threads 15650@opindex threads 15651Add support for multithreading with the @dfn{dce thread} library 15652under HP-UX@. This option sets flags for both the preprocessor and 15653linker. 15654@end table 15655 15656@node IA-64 Options 15657@subsection IA-64 Options 15658@cindex IA-64 Options 15659 15660These are the @samp{-m} options defined for the Intel IA-64 architecture. 15661 15662@table @gcctabopt 15663@item -mbig-endian 15664@opindex mbig-endian 15665Generate code for a big-endian target. This is the default for HP-UX@. 15666 15667@item -mlittle-endian 15668@opindex mlittle-endian 15669Generate code for a little-endian target. This is the default for AIX5 15670and GNU/Linux. 15671 15672@item -mgnu-as 15673@itemx -mno-gnu-as 15674@opindex mgnu-as 15675@opindex mno-gnu-as 15676Generate (or don't) code for the GNU assembler. This is the default. 15677@c Also, this is the default if the configure option @option{--with-gnu-as} 15678@c is used. 15679 15680@item -mgnu-ld 15681@itemx -mno-gnu-ld 15682@opindex mgnu-ld 15683@opindex mno-gnu-ld 15684Generate (or don't) code for the GNU linker. This is the default. 15685@c Also, this is the default if the configure option @option{--with-gnu-ld} 15686@c is used. 15687 15688@item -mno-pic 15689@opindex mno-pic 15690Generate code that does not use a global pointer register. The result 15691is not position independent code, and violates the IA-64 ABI@. 15692 15693@item -mvolatile-asm-stop 15694@itemx -mno-volatile-asm-stop 15695@opindex mvolatile-asm-stop 15696@opindex mno-volatile-asm-stop 15697Generate (or don't) a stop bit immediately before and after volatile asm 15698statements. 15699 15700@item -mregister-names 15701@itemx -mno-register-names 15702@opindex mregister-names 15703@opindex mno-register-names 15704Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 15705the stacked registers. This may make assembler output more readable. 15706 15707@item -mno-sdata 15708@itemx -msdata 15709@opindex mno-sdata 15710@opindex msdata 15711Disable (or enable) optimizations that use the small data section. This may 15712be useful for working around optimizer bugs. 15713 15714@item -mconstant-gp 15715@opindex mconstant-gp 15716Generate code that uses a single constant global pointer value. This is 15717useful when compiling kernel code. 15718 15719@item -mauto-pic 15720@opindex mauto-pic 15721Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 15722This is useful when compiling firmware code. 15723 15724@item -minline-float-divide-min-latency 15725@opindex minline-float-divide-min-latency 15726Generate code for inline divides of floating-point values 15727using the minimum latency algorithm. 15728 15729@item -minline-float-divide-max-throughput 15730@opindex minline-float-divide-max-throughput 15731Generate code for inline divides of floating-point values 15732using the maximum throughput algorithm. 15733 15734@item -mno-inline-float-divide 15735@opindex mno-inline-float-divide 15736Do not generate inline code for divides of floating-point values. 15737 15738@item -minline-int-divide-min-latency 15739@opindex minline-int-divide-min-latency 15740Generate code for inline divides of integer values 15741using the minimum latency algorithm. 15742 15743@item -minline-int-divide-max-throughput 15744@opindex minline-int-divide-max-throughput 15745Generate code for inline divides of integer values 15746using the maximum throughput algorithm. 15747 15748@item -mno-inline-int-divide 15749@opindex mno-inline-int-divide 15750Do not generate inline code for divides of integer values. 15751 15752@item -minline-sqrt-min-latency 15753@opindex minline-sqrt-min-latency 15754Generate code for inline square roots 15755using the minimum latency algorithm. 15756 15757@item -minline-sqrt-max-throughput 15758@opindex minline-sqrt-max-throughput 15759Generate code for inline square roots 15760using the maximum throughput algorithm. 15761 15762@item -mno-inline-sqrt 15763@opindex mno-inline-sqrt 15764Do not generate inline code for @code{sqrt}. 15765 15766@item -mfused-madd 15767@itemx -mno-fused-madd 15768@opindex mfused-madd 15769@opindex mno-fused-madd 15770Do (don't) generate code that uses the fused multiply/add or multiply/subtract 15771instructions. The default is to use these instructions. 15772 15773@item -mno-dwarf2-asm 15774@itemx -mdwarf2-asm 15775@opindex mno-dwarf2-asm 15776@opindex mdwarf2-asm 15777Don't (or do) generate assembler code for the DWARF 2 line number debugging 15778info. This may be useful when not using the GNU assembler. 15779 15780@item -mearly-stop-bits 15781@itemx -mno-early-stop-bits 15782@opindex mearly-stop-bits 15783@opindex mno-early-stop-bits 15784Allow stop bits to be placed earlier than immediately preceding the 15785instruction that triggered the stop bit. This can improve instruction 15786scheduling, but does not always do so. 15787 15788@item -mfixed-range=@var{register-range} 15789@opindex mfixed-range 15790Generate code treating the given register range as fixed registers. 15791A fixed register is one that the register allocator cannot use. This is 15792useful when compiling kernel code. A register range is specified as 15793two registers separated by a dash. Multiple register ranges can be 15794specified separated by a comma. 15795 15796@item -mtls-size=@var{tls-size} 15797@opindex mtls-size 15798Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 1579964. 15800 15801@item -mtune=@var{cpu-type} 15802@opindex mtune 15803Tune the instruction scheduling for a particular CPU, Valid values are 15804@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 15805and @samp{mckinley}. 15806 15807@item -milp32 15808@itemx -mlp64 15809@opindex milp32 15810@opindex mlp64 15811Generate code for a 32-bit or 64-bit environment. 15812The 32-bit environment sets int, long and pointer to 32 bits. 15813The 64-bit environment sets int to 32 bits and long and pointer 15814to 64 bits. These are HP-UX specific flags. 15815 15816@item -mno-sched-br-data-spec 15817@itemx -msched-br-data-spec 15818@opindex mno-sched-br-data-spec 15819@opindex msched-br-data-spec 15820(Dis/En)able data speculative scheduling before reload. 15821This results in generation of @code{ld.a} instructions and 15822the corresponding check instructions (@code{ld.c} / @code{chk.a}). 15823The default is 'disable'. 15824 15825@item -msched-ar-data-spec 15826@itemx -mno-sched-ar-data-spec 15827@opindex msched-ar-data-spec 15828@opindex mno-sched-ar-data-spec 15829(En/Dis)able data speculative scheduling after reload. 15830This results in generation of @code{ld.a} instructions and 15831the corresponding check instructions (@code{ld.c} / @code{chk.a}). 15832The default is 'enable'. 15833 15834@item -mno-sched-control-spec 15835@itemx -msched-control-spec 15836@opindex mno-sched-control-spec 15837@opindex msched-control-spec 15838(Dis/En)able control speculative scheduling. This feature is 15839available only during region scheduling (i.e.@: before reload). 15840This results in generation of the @code{ld.s} instructions and 15841the corresponding check instructions @code{chk.s}. 15842The default is 'disable'. 15843 15844@item -msched-br-in-data-spec 15845@itemx -mno-sched-br-in-data-spec 15846@opindex msched-br-in-data-spec 15847@opindex mno-sched-br-in-data-spec 15848(En/Dis)able speculative scheduling of the instructions that 15849are dependent on the data speculative loads before reload. 15850This is effective only with @option{-msched-br-data-spec} enabled. 15851The default is 'enable'. 15852 15853@item -msched-ar-in-data-spec 15854@itemx -mno-sched-ar-in-data-spec 15855@opindex msched-ar-in-data-spec 15856@opindex mno-sched-ar-in-data-spec 15857(En/Dis)able speculative scheduling of the instructions that 15858are dependent on the data speculative loads after reload. 15859This is effective only with @option{-msched-ar-data-spec} enabled. 15860The default is 'enable'. 15861 15862@item -msched-in-control-spec 15863@itemx -mno-sched-in-control-spec 15864@opindex msched-in-control-spec 15865@opindex mno-sched-in-control-spec 15866(En/Dis)able speculative scheduling of the instructions that 15867are dependent on the control speculative loads. 15868This is effective only with @option{-msched-control-spec} enabled. 15869The default is 'enable'. 15870 15871@item -mno-sched-prefer-non-data-spec-insns 15872@itemx -msched-prefer-non-data-spec-insns 15873@opindex mno-sched-prefer-non-data-spec-insns 15874@opindex msched-prefer-non-data-spec-insns 15875If enabled, data-speculative instructions are chosen for schedule 15876only if there are no other choices at the moment. This makes 15877the use of the data speculation much more conservative. 15878The default is 'disable'. 15879 15880@item -mno-sched-prefer-non-control-spec-insns 15881@itemx -msched-prefer-non-control-spec-insns 15882@opindex mno-sched-prefer-non-control-spec-insns 15883@opindex msched-prefer-non-control-spec-insns 15884If enabled, control-speculative instructions are chosen for schedule 15885only if there are no other choices at the moment. This makes 15886the use of the control speculation much more conservative. 15887The default is 'disable'. 15888 15889@item -mno-sched-count-spec-in-critical-path 15890@itemx -msched-count-spec-in-critical-path 15891@opindex mno-sched-count-spec-in-critical-path 15892@opindex msched-count-spec-in-critical-path 15893If enabled, speculative dependencies are considered during 15894computation of the instructions priorities. This makes the use of the 15895speculation a bit more conservative. 15896The default is 'disable'. 15897 15898@item -msched-spec-ldc 15899@opindex msched-spec-ldc 15900Use a simple data speculation check. This option is on by default. 15901 15902@item -msched-control-spec-ldc 15903@opindex msched-spec-ldc 15904Use a simple check for control speculation. This option is on by default. 15905 15906@item -msched-stop-bits-after-every-cycle 15907@opindex msched-stop-bits-after-every-cycle 15908Place a stop bit after every cycle when scheduling. This option is on 15909by default. 15910 15911@item -msched-fp-mem-deps-zero-cost 15912@opindex msched-fp-mem-deps-zero-cost 15913Assume that floating-point stores and loads are not likely to cause a conflict 15914when placed into the same instruction group. This option is disabled by 15915default. 15916 15917@item -msel-sched-dont-check-control-spec 15918@opindex msel-sched-dont-check-control-spec 15919Generate checks for control speculation in selective scheduling. 15920This flag is disabled by default. 15921 15922@item -msched-max-memory-insns=@var{max-insns} 15923@opindex msched-max-memory-insns 15924Limit on the number of memory insns per instruction group, giving lower 15925priority to subsequent memory insns attempting to schedule in the same 15926instruction group. Frequently useful to prevent cache bank conflicts. 15927The default value is 1. 15928 15929@item -msched-max-memory-insns-hard-limit 15930@opindex msched-max-memory-insns-hard-limit 15931Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 15932disallowing more than that number in an instruction group. 15933Otherwise, the limit is ``soft'', meaning that non-memory operations 15934are preferred when the limit is reached, but memory operations may still 15935be scheduled. 15936 15937@end table 15938 15939@node LM32 Options 15940@subsection LM32 Options 15941@cindex LM32 options 15942 15943These @option{-m} options are defined for the LatticeMico32 architecture: 15944 15945@table @gcctabopt 15946@item -mbarrel-shift-enabled 15947@opindex mbarrel-shift-enabled 15948Enable barrel-shift instructions. 15949 15950@item -mdivide-enabled 15951@opindex mdivide-enabled 15952Enable divide and modulus instructions. 15953 15954@item -mmultiply-enabled 15955@opindex multiply-enabled 15956Enable multiply instructions. 15957 15958@item -msign-extend-enabled 15959@opindex msign-extend-enabled 15960Enable sign extend instructions. 15961 15962@item -muser-enabled 15963@opindex muser-enabled 15964Enable user-defined instructions. 15965 15966@end table 15967 15968@node M32C Options 15969@subsection M32C Options 15970@cindex M32C options 15971 15972@table @gcctabopt 15973@item -mcpu=@var{name} 15974@opindex mcpu= 15975Select the CPU for which code is generated. @var{name} may be one of 15976@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 15977/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 15978the M32C/80 series. 15979 15980@item -msim 15981@opindex msim 15982Specifies that the program will be run on the simulator. This causes 15983an alternate runtime library to be linked in which supports, for 15984example, file I/O@. You must not use this option when generating 15985programs that will run on real hardware; you must provide your own 15986runtime library for whatever I/O functions are needed. 15987 15988@item -memregs=@var{number} 15989@opindex memregs= 15990Specifies the number of memory-based pseudo-registers GCC uses 15991during code generation. These pseudo-registers are used like real 15992registers, so there is a tradeoff between GCC's ability to fit the 15993code into available registers, and the performance penalty of using 15994memory instead of registers. Note that all modules in a program must 15995be compiled with the same value for this option. Because of that, you 15996must not use this option with GCC's default runtime libraries. 15997 15998@end table 15999 16000@node M32R/D Options 16001@subsection M32R/D Options 16002@cindex M32R/D options 16003 16004These @option{-m} options are defined for Renesas M32R/D architectures: 16005 16006@table @gcctabopt 16007@item -m32r2 16008@opindex m32r2 16009Generate code for the M32R/2@. 16010 16011@item -m32rx 16012@opindex m32rx 16013Generate code for the M32R/X@. 16014 16015@item -m32r 16016@opindex m32r 16017Generate code for the M32R@. This is the default. 16018 16019@item -mmodel=small 16020@opindex mmodel=small 16021Assume all objects live in the lower 16MB of memory (so that their addresses 16022can be loaded with the @code{ld24} instruction), and assume all subroutines 16023are reachable with the @code{bl} instruction. 16024This is the default. 16025 16026The addressability of a particular object can be set with the 16027@code{model} attribute. 16028 16029@item -mmodel=medium 16030@opindex mmodel=medium 16031Assume objects may be anywhere in the 32-bit address space (the compiler 16032generates @code{seth/add3} instructions to load their addresses), and 16033assume all subroutines are reachable with the @code{bl} instruction. 16034 16035@item -mmodel=large 16036@opindex mmodel=large 16037Assume objects may be anywhere in the 32-bit address space (the compiler 16038generates @code{seth/add3} instructions to load their addresses), and 16039assume subroutines may not be reachable with the @code{bl} instruction 16040(the compiler generates the much slower @code{seth/add3/jl} 16041instruction sequence). 16042 16043@item -msdata=none 16044@opindex msdata=none 16045Disable use of the small data area. Variables are put into 16046one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 16047@code{section} attribute has been specified). 16048This is the default. 16049 16050The small data area consists of sections @code{.sdata} and @code{.sbss}. 16051Objects may be explicitly put in the small data area with the 16052@code{section} attribute using one of these sections. 16053 16054@item -msdata=sdata 16055@opindex msdata=sdata 16056Put small global and static data in the small data area, but do not 16057generate special code to reference them. 16058 16059@item -msdata=use 16060@opindex msdata=use 16061Put small global and static data in the small data area, and generate 16062special instructions to reference them. 16063 16064@item -G @var{num} 16065@opindex G 16066@cindex smaller data references 16067Put global and static objects less than or equal to @var{num} bytes 16068into the small data or BSS sections instead of the normal data or BSS 16069sections. The default value of @var{num} is 8. 16070The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 16071for this option to have any effect. 16072 16073All modules should be compiled with the same @option{-G @var{num}} value. 16074Compiling with different values of @var{num} may or may not work; if it 16075doesn't the linker gives an error message---incorrect code is not 16076generated. 16077 16078@item -mdebug 16079@opindex mdebug 16080Makes the M32R-specific code in the compiler display some statistics 16081that might help in debugging programs. 16082 16083@item -malign-loops 16084@opindex malign-loops 16085Align all loops to a 32-byte boundary. 16086 16087@item -mno-align-loops 16088@opindex mno-align-loops 16089Do not enforce a 32-byte alignment for loops. This is the default. 16090 16091@item -missue-rate=@var{number} 16092@opindex missue-rate=@var{number} 16093Issue @var{number} instructions per cycle. @var{number} can only be 1 16094or 2. 16095 16096@item -mbranch-cost=@var{number} 16097@opindex mbranch-cost=@var{number} 16098@var{number} can only be 1 or 2. If it is 1 then branches are 16099preferred over conditional code, if it is 2, then the opposite applies. 16100 16101@item -mflush-trap=@var{number} 16102@opindex mflush-trap=@var{number} 16103Specifies the trap number to use to flush the cache. The default is 1610412. Valid numbers are between 0 and 15 inclusive. 16105 16106@item -mno-flush-trap 16107@opindex mno-flush-trap 16108Specifies that the cache cannot be flushed by using a trap. 16109 16110@item -mflush-func=@var{name} 16111@opindex mflush-func=@var{name} 16112Specifies the name of the operating system function to call to flush 16113the cache. The default is @samp{_flush_cache}, but a function call 16114is only used if a trap is not available. 16115 16116@item -mno-flush-func 16117@opindex mno-flush-func 16118Indicates that there is no OS function for flushing the cache. 16119 16120@end table 16121 16122@node M680x0 Options 16123@subsection M680x0 Options 16124@cindex M680x0 options 16125 16126These are the @samp{-m} options defined for M680x0 and ColdFire processors. 16127The default settings depend on which architecture was selected when 16128the compiler was configured; the defaults for the most common choices 16129are given below. 16130 16131@table @gcctabopt 16132@item -march=@var{arch} 16133@opindex march 16134Generate code for a specific M680x0 or ColdFire instruction set 16135architecture. Permissible values of @var{arch} for M680x0 16136architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 16137@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 16138architectures are selected according to Freescale's ISA classification 16139and the permissible values are: @samp{isaa}, @samp{isaaplus}, 16140@samp{isab} and @samp{isac}. 16141 16142GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 16143code for a ColdFire target. The @var{arch} in this macro is one of the 16144@option{-march} arguments given above. 16145 16146When used together, @option{-march} and @option{-mtune} select code 16147that runs on a family of similar processors but that is optimized 16148for a particular microarchitecture. 16149 16150@item -mcpu=@var{cpu} 16151@opindex mcpu 16152Generate code for a specific M680x0 or ColdFire processor. 16153The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 16154@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 16155and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 16156below, which also classifies the CPUs into families: 16157 16158@multitable @columnfractions 0.20 0.80 16159@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 16160@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} 16161@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 16162@item @samp{5206e} @tab @samp{5206e} 16163@item @samp{5208} @tab @samp{5207} @samp{5208} 16164@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 16165@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 16166@item @samp{5216} @tab @samp{5214} @samp{5216} 16167@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 16168@item @samp{5225} @tab @samp{5224} @samp{5225} 16169@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 16170@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 16171@item @samp{5249} @tab @samp{5249} 16172@item @samp{5250} @tab @samp{5250} 16173@item @samp{5271} @tab @samp{5270} @samp{5271} 16174@item @samp{5272} @tab @samp{5272} 16175@item @samp{5275} @tab @samp{5274} @samp{5275} 16176@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 16177@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 16178@item @samp{5307} @tab @samp{5307} 16179@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 16180@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 16181@item @samp{5407} @tab @samp{5407} 16182@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} 16183@end multitable 16184 16185@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 16186@var{arch} is compatible with @var{cpu}. Other combinations of 16187@option{-mcpu} and @option{-march} are rejected. 16188 16189GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 16190@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 16191where the value of @var{family} is given by the table above. 16192 16193@item -mtune=@var{tune} 16194@opindex mtune 16195Tune the code for a particular microarchitecture within the 16196constraints set by @option{-march} and @option{-mcpu}. 16197The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 16198@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 16199and @samp{cpu32}. The ColdFire microarchitectures 16200are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 16201 16202You can also use @option{-mtune=68020-40} for code that needs 16203to run relatively well on 68020, 68030 and 68040 targets. 16204@option{-mtune=68020-60} is similar but includes 68060 targets 16205as well. These two options select the same tuning decisions as 16206@option{-m68020-40} and @option{-m68020-60} respectively. 16207 16208GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 16209when tuning for 680x0 architecture @var{arch}. It also defines 16210@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 16211option is used. If GCC is tuning for a range of architectures, 16212as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 16213it defines the macros for every architecture in the range. 16214 16215GCC also defines the macro @code{__m@var{uarch}__} when tuning for 16216ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 16217of the arguments given above. 16218 16219@item -m68000 16220@itemx -mc68000 16221@opindex m68000 16222@opindex mc68000 16223Generate output for a 68000. This is the default 16224when the compiler is configured for 68000-based systems. 16225It is equivalent to @option{-march=68000}. 16226 16227Use this option for microcontrollers with a 68000 or EC000 core, 16228including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 16229 16230@item -m68010 16231@opindex m68010 16232Generate output for a 68010. This is the default 16233when the compiler is configured for 68010-based systems. 16234It is equivalent to @option{-march=68010}. 16235 16236@item -m68020 16237@itemx -mc68020 16238@opindex m68020 16239@opindex mc68020 16240Generate output for a 68020. This is the default 16241when the compiler is configured for 68020-based systems. 16242It is equivalent to @option{-march=68020}. 16243 16244@item -m68030 16245@opindex m68030 16246Generate output for a 68030. This is the default when the compiler is 16247configured for 68030-based systems. It is equivalent to 16248@option{-march=68030}. 16249 16250@item -m68040 16251@opindex m68040 16252Generate output for a 68040. This is the default when the compiler is 16253configured for 68040-based systems. It is equivalent to 16254@option{-march=68040}. 16255 16256This option inhibits the use of 68881/68882 instructions that have to be 16257emulated by software on the 68040. Use this option if your 68040 does not 16258have code to emulate those instructions. 16259 16260@item -m68060 16261@opindex m68060 16262Generate output for a 68060. This is the default when the compiler is 16263configured for 68060-based systems. It is equivalent to 16264@option{-march=68060}. 16265 16266This option inhibits the use of 68020 and 68881/68882 instructions that 16267have to be emulated by software on the 68060. Use this option if your 68060 16268does not have code to emulate those instructions. 16269 16270@item -mcpu32 16271@opindex mcpu32 16272Generate output for a CPU32. This is the default 16273when the compiler is configured for CPU32-based systems. 16274It is equivalent to @option{-march=cpu32}. 16275 16276Use this option for microcontrollers with a 16277CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1627868336, 68340, 68341, 68349 and 68360. 16279 16280@item -m5200 16281@opindex m5200 16282Generate output for a 520X ColdFire CPU@. This is the default 16283when the compiler is configured for 520X-based systems. 16284It is equivalent to @option{-mcpu=5206}, and is now deprecated 16285in favor of that option. 16286 16287Use this option for microcontroller with a 5200 core, including 16288the MCF5202, MCF5203, MCF5204 and MCF5206. 16289 16290@item -m5206e 16291@opindex m5206e 16292Generate output for a 5206e ColdFire CPU@. The option is now 16293deprecated in favor of the equivalent @option{-mcpu=5206e}. 16294 16295@item -m528x 16296@opindex m528x 16297Generate output for a member of the ColdFire 528X family. 16298The option is now deprecated in favor of the equivalent 16299@option{-mcpu=528x}. 16300 16301@item -m5307 16302@opindex m5307 16303Generate output for a ColdFire 5307 CPU@. The option is now deprecated 16304in favor of the equivalent @option{-mcpu=5307}. 16305 16306@item -m5407 16307@opindex m5407 16308Generate output for a ColdFire 5407 CPU@. The option is now deprecated 16309in favor of the equivalent @option{-mcpu=5407}. 16310 16311@item -mcfv4e 16312@opindex mcfv4e 16313Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 16314This includes use of hardware floating-point instructions. 16315The option is equivalent to @option{-mcpu=547x}, and is now 16316deprecated in favor of that option. 16317 16318@item -m68020-40 16319@opindex m68020-40 16320Generate output for a 68040, without using any of the new instructions. 16321This results in code that can run relatively efficiently on either a 1632268020/68881 or a 68030 or a 68040. The generated code does use the 1632368881 instructions that are emulated on the 68040. 16324 16325The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 16326 16327@item -m68020-60 16328@opindex m68020-60 16329Generate output for a 68060, without using any of the new instructions. 16330This results in code that can run relatively efficiently on either a 1633168020/68881 or a 68030 or a 68040. The generated code does use the 1633268881 instructions that are emulated on the 68060. 16333 16334The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 16335 16336@item -mhard-float 16337@itemx -m68881 16338@opindex mhard-float 16339@opindex m68881 16340Generate floating-point instructions. This is the default for 68020 16341and above, and for ColdFire devices that have an FPU@. It defines the 16342macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 16343on ColdFire targets. 16344 16345@item -msoft-float 16346@opindex msoft-float 16347Do not generate floating-point instructions; use library calls instead. 16348This is the default for 68000, 68010, and 68832 targets. It is also 16349the default for ColdFire devices that have no FPU. 16350 16351@item -mdiv 16352@itemx -mno-div 16353@opindex mdiv 16354@opindex mno-div 16355Generate (do not generate) ColdFire hardware divide and remainder 16356instructions. If @option{-march} is used without @option{-mcpu}, 16357the default is ``on'' for ColdFire architectures and ``off'' for M680x0 16358architectures. Otherwise, the default is taken from the target CPU 16359(either the default CPU, or the one specified by @option{-mcpu}). For 16360example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 16361@option{-mcpu=5206e}. 16362 16363GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 16364 16365@item -mshort 16366@opindex mshort 16367Consider type @code{int} to be 16 bits wide, like @code{short int}. 16368Additionally, parameters passed on the stack are also aligned to a 1636916-bit boundary even on targets whose API mandates promotion to 32-bit. 16370 16371@item -mno-short 16372@opindex mno-short 16373Do not consider type @code{int} to be 16 bits wide. This is the default. 16374 16375@item -mnobitfield 16376@itemx -mno-bitfield 16377@opindex mnobitfield 16378@opindex mno-bitfield 16379Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 16380and @option{-m5200} options imply @w{@option{-mnobitfield}}. 16381 16382@item -mbitfield 16383@opindex mbitfield 16384Do use the bit-field instructions. The @option{-m68020} option implies 16385@option{-mbitfield}. This is the default if you use a configuration 16386designed for a 68020. 16387 16388@item -mrtd 16389@opindex mrtd 16390Use a different function-calling convention, in which functions 16391that take a fixed number of arguments return with the @code{rtd} 16392instruction, which pops their arguments while returning. This 16393saves one instruction in the caller since there is no need to pop 16394the arguments there. 16395 16396This calling convention is incompatible with the one normally 16397used on Unix, so you cannot use it if you need to call libraries 16398compiled with the Unix compiler. 16399 16400Also, you must provide function prototypes for all functions that 16401take variable numbers of arguments (including @code{printf}); 16402otherwise incorrect code is generated for calls to those 16403functions. 16404 16405In addition, seriously incorrect code results if you call a 16406function with too many arguments. (Normally, extra arguments are 16407harmlessly ignored.) 16408 16409The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1641068040, 68060 and CPU32 processors, but not by the 68000 or 5200. 16411 16412@item -mno-rtd 16413@opindex mno-rtd 16414Do not use the calling conventions selected by @option{-mrtd}. 16415This is the default. 16416 16417@item -malign-int 16418@itemx -mno-align-int 16419@opindex malign-int 16420@opindex mno-align-int 16421Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 16422@code{float}, @code{double}, and @code{long double} variables on a 32-bit 16423boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 16424Aligning variables on 32-bit boundaries produces code that runs somewhat 16425faster on processors with 32-bit busses at the expense of more memory. 16426 16427@strong{Warning:} if you use the @option{-malign-int} switch, GCC 16428aligns structures containing the above types differently than 16429most published application binary interface specifications for the m68k. 16430 16431@item -mpcrel 16432@opindex mpcrel 16433Use the pc-relative addressing mode of the 68000 directly, instead of 16434using a global offset table. At present, this option implies @option{-fpic}, 16435allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 16436not presently supported with @option{-mpcrel}, though this could be supported for 1643768020 and higher processors. 16438 16439@item -mno-strict-align 16440@itemx -mstrict-align 16441@opindex mno-strict-align 16442@opindex mstrict-align 16443Do not (do) assume that unaligned memory references are handled by 16444the system. 16445 16446@item -msep-data 16447Generate code that allows the data segment to be located in a different 16448area of memory from the text segment. This allows for execute-in-place in 16449an environment without virtual memory management. This option implies 16450@option{-fPIC}. 16451 16452@item -mno-sep-data 16453Generate code that assumes that the data segment follows the text segment. 16454This is the default. 16455 16456@item -mid-shared-library 16457Generate code that supports shared libraries via the library ID method. 16458This allows for execute-in-place and shared libraries in an environment 16459without virtual memory management. This option implies @option{-fPIC}. 16460 16461@item -mno-id-shared-library 16462Generate code that doesn't assume ID-based shared libraries are being used. 16463This is the default. 16464 16465@item -mshared-library-id=n 16466Specifies the identification number of the ID-based shared library being 16467compiled. Specifying a value of 0 generates more compact code; specifying 16468other values forces the allocation of that number to the current 16469library, but is no more space- or time-efficient than omitting this option. 16470 16471@item -mxgot 16472@itemx -mno-xgot 16473@opindex mxgot 16474@opindex mno-xgot 16475When generating position-independent code for ColdFire, generate code 16476that works if the GOT has more than 8192 entries. This code is 16477larger and slower than code generated without this option. On M680x0 16478processors, this option is not needed; @option{-fPIC} suffices. 16479 16480GCC normally uses a single instruction to load values from the GOT@. 16481While this is relatively efficient, it only works if the GOT 16482is smaller than about 64k. Anything larger causes the linker 16483to report an error such as: 16484 16485@cindex relocation truncated to fit (ColdFire) 16486@smallexample 16487relocation truncated to fit: R_68K_GOT16O foobar 16488@end smallexample 16489 16490If this happens, you should recompile your code with @option{-mxgot}. 16491It should then work with very large GOTs. However, code generated with 16492@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 16493the value of a global symbol. 16494 16495Note that some linkers, including newer versions of the GNU linker, 16496can create multiple GOTs and sort GOT entries. If you have such a linker, 16497you should only need to use @option{-mxgot} when compiling a single 16498object file that accesses more than 8192 GOT entries. Very few do. 16499 16500These options have no effect unless GCC is generating 16501position-independent code. 16502 16503@end table 16504 16505@node MCore Options 16506@subsection MCore Options 16507@cindex MCore options 16508 16509These are the @samp{-m} options defined for the Motorola M*Core 16510processors. 16511 16512@table @gcctabopt 16513 16514@item -mhardlit 16515@itemx -mno-hardlit 16516@opindex mhardlit 16517@opindex mno-hardlit 16518Inline constants into the code stream if it can be done in two 16519instructions or less. 16520 16521@item -mdiv 16522@itemx -mno-div 16523@opindex mdiv 16524@opindex mno-div 16525Use the divide instruction. (Enabled by default). 16526 16527@item -mrelax-immediate 16528@itemx -mno-relax-immediate 16529@opindex mrelax-immediate 16530@opindex mno-relax-immediate 16531Allow arbitrary-sized immediates in bit operations. 16532 16533@item -mwide-bitfields 16534@itemx -mno-wide-bitfields 16535@opindex mwide-bitfields 16536@opindex mno-wide-bitfields 16537Always treat bit-fields as @code{int}-sized. 16538 16539@item -m4byte-functions 16540@itemx -mno-4byte-functions 16541@opindex m4byte-functions 16542@opindex mno-4byte-functions 16543Force all functions to be aligned to a 4-byte boundary. 16544 16545@item -mcallgraph-data 16546@itemx -mno-callgraph-data 16547@opindex mcallgraph-data 16548@opindex mno-callgraph-data 16549Emit callgraph information. 16550 16551@item -mslow-bytes 16552@itemx -mno-slow-bytes 16553@opindex mslow-bytes 16554@opindex mno-slow-bytes 16555Prefer word access when reading byte quantities. 16556 16557@item -mlittle-endian 16558@itemx -mbig-endian 16559@opindex mlittle-endian 16560@opindex mbig-endian 16561Generate code for a little-endian target. 16562 16563@item -m210 16564@itemx -m340 16565@opindex m210 16566@opindex m340 16567Generate code for the 210 processor. 16568 16569@item -mno-lsim 16570@opindex mno-lsim 16571Assume that runtime support has been provided and so omit the 16572simulator library (@file{libsim.a)} from the linker command line. 16573 16574@item -mstack-increment=@var{size} 16575@opindex mstack-increment 16576Set the maximum amount for a single stack increment operation. Large 16577values can increase the speed of programs that contain functions 16578that need a large amount of stack space, but they can also trigger a 16579segmentation fault if the stack is extended too much. The default 16580value is 0x1000. 16581 16582@end table 16583 16584@node MeP Options 16585@subsection MeP Options 16586@cindex MeP options 16587 16588@table @gcctabopt 16589 16590@item -mabsdiff 16591@opindex mabsdiff 16592Enables the @code{abs} instruction, which is the absolute difference 16593between two registers. 16594 16595@item -mall-opts 16596@opindex mall-opts 16597Enables all the optional instructions---average, multiply, divide, bit 16598operations, leading zero, absolute difference, min/max, clip, and 16599saturation. 16600 16601 16602@item -maverage 16603@opindex maverage 16604Enables the @code{ave} instruction, which computes the average of two 16605registers. 16606 16607@item -mbased=@var{n} 16608@opindex mbased= 16609Variables of size @var{n} bytes or smaller are placed in the 16610@code{.based} section by default. Based variables use the @code{$tp} 16611register as a base register, and there is a 128-byte limit to the 16612@code{.based} section. 16613 16614@item -mbitops 16615@opindex mbitops 16616Enables the bit operation instructions---bit test (@code{btstm}), set 16617(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 16618test-and-set (@code{tas}). 16619 16620@item -mc=@var{name} 16621@opindex mc= 16622Selects which section constant data is placed in. @var{name} may 16623be @samp{tiny}, @samp{near}, or @samp{far}. 16624 16625@item -mclip 16626@opindex mclip 16627Enables the @code{clip} instruction. Note that @option{-mclip} is not 16628useful unless you also provide @option{-mminmax}. 16629 16630@item -mconfig=@var{name} 16631@opindex mconfig= 16632Selects one of the built-in core configurations. Each MeP chip has 16633one or more modules in it; each module has a core CPU and a variety of 16634coprocessors, optional instructions, and peripherals. The 16635@code{MeP-Integrator} tool, not part of GCC, provides these 16636configurations through this option; using this option is the same as 16637using all the corresponding command-line options. The default 16638configuration is @samp{default}. 16639 16640@item -mcop 16641@opindex mcop 16642Enables the coprocessor instructions. By default, this is a 32-bit 16643coprocessor. Note that the coprocessor is normally enabled via the 16644@option{-mconfig=} option. 16645 16646@item -mcop32 16647@opindex mcop32 16648Enables the 32-bit coprocessor's instructions. 16649 16650@item -mcop64 16651@opindex mcop64 16652Enables the 64-bit coprocessor's instructions. 16653 16654@item -mivc2 16655@opindex mivc2 16656Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 16657 16658@item -mdc 16659@opindex mdc 16660Causes constant variables to be placed in the @code{.near} section. 16661 16662@item -mdiv 16663@opindex mdiv 16664Enables the @code{div} and @code{divu} instructions. 16665 16666@item -meb 16667@opindex meb 16668Generate big-endian code. 16669 16670@item -mel 16671@opindex mel 16672Generate little-endian code. 16673 16674@item -mio-volatile 16675@opindex mio-volatile 16676Tells the compiler that any variable marked with the @code{io} 16677attribute is to be considered volatile. 16678 16679@item -ml 16680@opindex ml 16681Causes variables to be assigned to the @code{.far} section by default. 16682 16683@item -mleadz 16684@opindex mleadz 16685Enables the @code{leadz} (leading zero) instruction. 16686 16687@item -mm 16688@opindex mm 16689Causes variables to be assigned to the @code{.near} section by default. 16690 16691@item -mminmax 16692@opindex mminmax 16693Enables the @code{min} and @code{max} instructions. 16694 16695@item -mmult 16696@opindex mmult 16697Enables the multiplication and multiply-accumulate instructions. 16698 16699@item -mno-opts 16700@opindex mno-opts 16701Disables all the optional instructions enabled by @option{-mall-opts}. 16702 16703@item -mrepeat 16704@opindex mrepeat 16705Enables the @code{repeat} and @code{erepeat} instructions, used for 16706low-overhead looping. 16707 16708@item -ms 16709@opindex ms 16710Causes all variables to default to the @code{.tiny} section. Note 16711that there is a 65536-byte limit to this section. Accesses to these 16712variables use the @code{%gp} base register. 16713 16714@item -msatur 16715@opindex msatur 16716Enables the saturation instructions. Note that the compiler does not 16717currently generate these itself, but this option is included for 16718compatibility with other tools, like @code{as}. 16719 16720@item -msdram 16721@opindex msdram 16722Link the SDRAM-based runtime instead of the default ROM-based runtime. 16723 16724@item -msim 16725@opindex msim 16726Link the simulator run-time libraries. 16727 16728@item -msimnovec 16729@opindex msimnovec 16730Link the simulator runtime libraries, excluding built-in support 16731for reset and exception vectors and tables. 16732 16733@item -mtf 16734@opindex mtf 16735Causes all functions to default to the @code{.far} section. Without 16736this option, functions default to the @code{.near} section. 16737 16738@item -mtiny=@var{n} 16739@opindex mtiny= 16740Variables that are @var{n} bytes or smaller are allocated to the 16741@code{.tiny} section. These variables use the @code{$gp} base 16742register. The default for this option is 4, but note that there's a 1674365536-byte limit to the @code{.tiny} section. 16744 16745@end table 16746 16747@node MicroBlaze Options 16748@subsection MicroBlaze Options 16749@cindex MicroBlaze Options 16750 16751@table @gcctabopt 16752 16753@item -msoft-float 16754@opindex msoft-float 16755Use software emulation for floating point (default). 16756 16757@item -mhard-float 16758@opindex mhard-float 16759Use hardware floating-point instructions. 16760 16761@item -mmemcpy 16762@opindex mmemcpy 16763Do not optimize block moves, use @code{memcpy}. 16764 16765@item -mno-clearbss 16766@opindex mno-clearbss 16767This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 16768 16769@item -mcpu=@var{cpu-type} 16770@opindex mcpu= 16771Use features of, and schedule code for, the given CPU. 16772Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 16773where @var{X} is a major version, @var{YY} is the minor version, and 16774@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 16775@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}. 16776 16777@item -mxl-soft-mul 16778@opindex mxl-soft-mul 16779Use software multiply emulation (default). 16780 16781@item -mxl-soft-div 16782@opindex mxl-soft-div 16783Use software emulation for divides (default). 16784 16785@item -mxl-barrel-shift 16786@opindex mxl-barrel-shift 16787Use the hardware barrel shifter. 16788 16789@item -mxl-pattern-compare 16790@opindex mxl-pattern-compare 16791Use pattern compare instructions. 16792 16793@item -msmall-divides 16794@opindex msmall-divides 16795Use table lookup optimization for small signed integer divisions. 16796 16797@item -mxl-stack-check 16798@opindex mxl-stack-check 16799This option is deprecated. Use @option{-fstack-check} instead. 16800 16801@item -mxl-gp-opt 16802@opindex mxl-gp-opt 16803Use GP-relative @code{.sdata}/@code{.sbss} sections. 16804 16805@item -mxl-multiply-high 16806@opindex mxl-multiply-high 16807Use multiply high instructions for high part of 32x32 multiply. 16808 16809@item -mxl-float-convert 16810@opindex mxl-float-convert 16811Use hardware floating-point conversion instructions. 16812 16813@item -mxl-float-sqrt 16814@opindex mxl-float-sqrt 16815Use hardware floating-point square root instruction. 16816 16817@item -mbig-endian 16818@opindex mbig-endian 16819Generate code for a big-endian target. 16820 16821@item -mlittle-endian 16822@opindex mlittle-endian 16823Generate code for a little-endian target. 16824 16825@item -mxl-reorder 16826@opindex mxl-reorder 16827Use reorder instructions (swap and byte reversed load/store). 16828 16829@item -mxl-mode-@var{app-model} 16830Select application model @var{app-model}. Valid models are 16831@table @samp 16832@item executable 16833normal executable (default), uses startup code @file{crt0.o}. 16834 16835@item xmdstub 16836for use with Xilinx Microprocessor Debugger (XMD) based 16837software intrusive debug agent called xmdstub. This uses startup file 16838@file{crt1.o} and sets the start address of the program to 0x800. 16839 16840@item bootstrap 16841for applications that are loaded using a bootloader. 16842This model uses startup file @file{crt2.o} which does not contain a processor 16843reset vector handler. This is suitable for transferring control on a 16844processor reset to the bootloader rather than the application. 16845 16846@item novectors 16847for applications that do not require any of the 16848MicroBlaze vectors. This option may be useful for applications running 16849within a monitoring application. This model uses @file{crt3.o} as a startup file. 16850@end table 16851 16852Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 16853@option{-mxl-mode-@var{app-model}}. 16854 16855@end table 16856 16857@node MIPS Options 16858@subsection MIPS Options 16859@cindex MIPS options 16860 16861@table @gcctabopt 16862 16863@item -EB 16864@opindex EB 16865Generate big-endian code. 16866 16867@item -EL 16868@opindex EL 16869Generate little-endian code. This is the default for @samp{mips*el-*-*} 16870configurations. 16871 16872@item -march=@var{arch} 16873@opindex march 16874Generate code that runs on @var{arch}, which can be the name of a 16875generic MIPS ISA, or the name of a particular processor. 16876The ISA names are: 16877@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 16878@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 16879@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 16880@samp{mips64r5} and @samp{mips64r6}. 16881The processor names are: 16882@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 16883@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 16884@samp{5kc}, @samp{5kf}, 16885@samp{20kc}, 16886@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 16887@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 16888@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 16889@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 16890@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 16891@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, 16892@samp{m4k}, 16893@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 16894@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 16895@samp{orion}, 16896@samp{p5600}, 16897@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 16898@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000}, 16899@samp{rm7000}, @samp{rm9000}, 16900@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 16901@samp{sb1}, 16902@samp{sr71000}, 16903@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 16904@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 16905@samp{xlr} and @samp{xlp}. 16906The special value @samp{from-abi} selects the 16907most compatible architecture for the selected ABI (that is, 16908@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 16909 16910The native Linux/GNU toolchain also supports the value @samp{native}, 16911which selects the best architecture option for the host processor. 16912@option{-march=native} has no effect if GCC does not recognize 16913the processor. 16914 16915In processor names, a final @samp{000} can be abbreviated as @samp{k} 16916(for example, @option{-march=r2k}). Prefixes are optional, and 16917@samp{vr} may be written @samp{r}. 16918 16919Names of the form @samp{@var{n}f2_1} refer to processors with 16920FPUs clocked at half the rate of the core, names of the form 16921@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 16922rate as the core, and names of the form @samp{@var{n}f3_2} refer to 16923processors with FPUs clocked a ratio of 3:2 with respect to the core. 16924For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 16925for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 16926accepted as synonyms for @samp{@var{n}f1_1}. 16927 16928GCC defines two macros based on the value of this option. The first 16929is @code{_MIPS_ARCH}, which gives the name of target architecture, as 16930a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 16931where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 16932For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 16933to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 16934 16935Note that the @code{_MIPS_ARCH} macro uses the processor names given 16936above. In other words, it has the full prefix and does not 16937abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 16938the macro names the resolved architecture (either @code{"mips1"} or 16939@code{"mips3"}). It names the default architecture when no 16940@option{-march} option is given. 16941 16942@item -mtune=@var{arch} 16943@opindex mtune 16944Optimize for @var{arch}. Among other things, this option controls 16945the way instructions are scheduled, and the perceived cost of arithmetic 16946operations. The list of @var{arch} values is the same as for 16947@option{-march}. 16948 16949When this option is not used, GCC optimizes for the processor 16950specified by @option{-march}. By using @option{-march} and 16951@option{-mtune} together, it is possible to generate code that 16952runs on a family of processors, but optimize the code for one 16953particular member of that family. 16954 16955@option{-mtune} defines the macros @code{_MIPS_TUNE} and 16956@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 16957@option{-march} ones described above. 16958 16959@item -mips1 16960@opindex mips1 16961Equivalent to @option{-march=mips1}. 16962 16963@item -mips2 16964@opindex mips2 16965Equivalent to @option{-march=mips2}. 16966 16967@item -mips3 16968@opindex mips3 16969Equivalent to @option{-march=mips3}. 16970 16971@item -mips4 16972@opindex mips4 16973Equivalent to @option{-march=mips4}. 16974 16975@item -mips32 16976@opindex mips32 16977Equivalent to @option{-march=mips32}. 16978 16979@item -mips32r3 16980@opindex mips32r3 16981Equivalent to @option{-march=mips32r3}. 16982 16983@item -mips32r5 16984@opindex mips32r5 16985Equivalent to @option{-march=mips32r5}. 16986 16987@item -mips32r6 16988@opindex mips32r6 16989Equivalent to @option{-march=mips32r6}. 16990 16991@item -mips64 16992@opindex mips64 16993Equivalent to @option{-march=mips64}. 16994 16995@item -mips64r2 16996@opindex mips64r2 16997Equivalent to @option{-march=mips64r2}. 16998 16999@item -mips64r3 17000@opindex mips64r3 17001Equivalent to @option{-march=mips64r3}. 17002 17003@item -mips64r5 17004@opindex mips64r5 17005Equivalent to @option{-march=mips64r5}. 17006 17007@item -mips64r6 17008@opindex mips64r6 17009Equivalent to @option{-march=mips64r6}. 17010 17011@item -mips16 17012@itemx -mno-mips16 17013@opindex mips16 17014@opindex mno-mips16 17015Generate (do not generate) MIPS16 code. If GCC is targeting a 17016MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 17017 17018MIPS16 code generation can also be controlled on a per-function basis 17019by means of @code{mips16} and @code{nomips16} attributes. 17020@xref{Function Attributes}, for more information. 17021 17022@item -mflip-mips16 17023@opindex mflip-mips16 17024Generate MIPS16 code on alternating functions. This option is provided 17025for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 17026not intended for ordinary use in compiling user code. 17027 17028@item -minterlink-compressed 17029@item -mno-interlink-compressed 17030@opindex minterlink-compressed 17031@opindex mno-interlink-compressed 17032Require (do not require) that code using the standard (uncompressed) MIPS ISA 17033be link-compatible with MIPS16 and microMIPS code, and vice versa. 17034 17035For example, code using the standard ISA encoding cannot jump directly 17036to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 17037@option{-minterlink-compressed} therefore disables direct jumps unless GCC 17038knows that the target of the jump is not compressed. 17039 17040@item -minterlink-mips16 17041@itemx -mno-interlink-mips16 17042@opindex minterlink-mips16 17043@opindex mno-interlink-mips16 17044Aliases of @option{-minterlink-compressed} and 17045@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 17046and are retained for backwards compatibility. 17047 17048@item -mabi=32 17049@itemx -mabi=o64 17050@itemx -mabi=n32 17051@itemx -mabi=64 17052@itemx -mabi=eabi 17053@opindex mabi=32 17054@opindex mabi=o64 17055@opindex mabi=n32 17056@opindex mabi=64 17057@opindex mabi=eabi 17058Generate code for the given ABI@. 17059 17060Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 17061generates 64-bit code when you select a 64-bit architecture, but you 17062can use @option{-mgp32} to get 32-bit code instead. 17063 17064For information about the O64 ABI, see 17065@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 17066 17067GCC supports a variant of the o32 ABI in which floating-point registers 17068are 64 rather than 32 bits wide. You can select this combination with 17069@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 17070and @code{mfhc1} instructions and is therefore only supported for 17071MIPS32R2, MIPS32R3 and MIPS32R5 processors. 17072 17073The register assignments for arguments and return values remain the 17074same, but each scalar value is passed in a single 64-bit register 17075rather than a pair of 32-bit registers. For example, scalar 17076floating-point values are returned in @samp{$f0} only, not a 17077@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 17078remains the same in that the even-numbered double-precision registers 17079are saved. 17080 17081Two additional variants of the o32 ABI are supported to enable 17082a transition from 32-bit to 64-bit registers. These are FPXX 17083(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 17084The FPXX extension mandates that all code must execute correctly 17085when run using 32-bit or 64-bit registers. The code can be interlinked 17086with either FP32 or FP64, but not both. 17087The FP64A extension is similar to the FP64 extension but forbids the 17088use of odd-numbered single-precision registers. This can be used 17089in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 17090processors and allows both FP32 and FP64A code to interlink and 17091run in the same process without changing FPU modes. 17092 17093@item -mabicalls 17094@itemx -mno-abicalls 17095@opindex mabicalls 17096@opindex mno-abicalls 17097Generate (do not generate) code that is suitable for SVR4-style 17098dynamic objects. @option{-mabicalls} is the default for SVR4-based 17099systems. 17100 17101@item -mshared 17102@itemx -mno-shared 17103Generate (do not generate) code that is fully position-independent, 17104and that can therefore be linked into shared libraries. This option 17105only affects @option{-mabicalls}. 17106 17107All @option{-mabicalls} code has traditionally been position-independent, 17108regardless of options like @option{-fPIC} and @option{-fpic}. However, 17109as an extension, the GNU toolchain allows executables to use absolute 17110accesses for locally-binding symbols. It can also use shorter GP 17111initialization sequences and generate direct calls to locally-defined 17112functions. This mode is selected by @option{-mno-shared}. 17113 17114@option{-mno-shared} depends on binutils 2.16 or higher and generates 17115objects that can only be linked by the GNU linker. However, the option 17116does not affect the ABI of the final executable; it only affects the ABI 17117of relocatable objects. Using @option{-mno-shared} generally makes 17118executables both smaller and quicker. 17119 17120@option{-mshared} is the default. 17121 17122@item -mplt 17123@itemx -mno-plt 17124@opindex mplt 17125@opindex mno-plt 17126Assume (do not assume) that the static and dynamic linkers 17127support PLTs and copy relocations. This option only affects 17128@option{-mno-shared -mabicalls}. For the n64 ABI, this option 17129has no effect without @option{-msym32}. 17130 17131You can make @option{-mplt} the default by configuring 17132GCC with @option{--with-mips-plt}. The default is 17133@option{-mno-plt} otherwise. 17134 17135@item -mxgot 17136@itemx -mno-xgot 17137@opindex mxgot 17138@opindex mno-xgot 17139Lift (do not lift) the usual restrictions on the size of the global 17140offset table. 17141 17142GCC normally uses a single instruction to load values from the GOT@. 17143While this is relatively efficient, it only works if the GOT 17144is smaller than about 64k. Anything larger causes the linker 17145to report an error such as: 17146 17147@cindex relocation truncated to fit (MIPS) 17148@smallexample 17149relocation truncated to fit: R_MIPS_GOT16 foobar 17150@end smallexample 17151 17152If this happens, you should recompile your code with @option{-mxgot}. 17153This works with very large GOTs, although the code is also 17154less efficient, since it takes three instructions to fetch the 17155value of a global symbol. 17156 17157Note that some linkers can create multiple GOTs. If you have such a 17158linker, you should only need to use @option{-mxgot} when a single object 17159file accesses more than 64k's worth of GOT entries. Very few do. 17160 17161These options have no effect unless GCC is generating position 17162independent code. 17163 17164@item -mgp32 17165@opindex mgp32 17166Assume that general-purpose registers are 32 bits wide. 17167 17168@item -mgp64 17169@opindex mgp64 17170Assume that general-purpose registers are 64 bits wide. 17171 17172@item -mfp32 17173@opindex mfp32 17174Assume that floating-point registers are 32 bits wide. 17175 17176@item -mfp64 17177@opindex mfp64 17178Assume that floating-point registers are 64 bits wide. 17179 17180@item -mfpxx 17181@opindex mfpxx 17182Do not assume the width of floating-point registers. 17183 17184@item -mhard-float 17185@opindex mhard-float 17186Use floating-point coprocessor instructions. 17187 17188@item -msoft-float 17189@opindex msoft-float 17190Do not use floating-point coprocessor instructions. Implement 17191floating-point calculations using library calls instead. 17192 17193@item -mno-float 17194@opindex mno-float 17195Equivalent to @option{-msoft-float}, but additionally asserts that the 17196program being compiled does not perform any floating-point operations. 17197This option is presently supported only by some bare-metal MIPS 17198configurations, where it may select a special set of libraries 17199that lack all floating-point support (including, for example, the 17200floating-point @code{printf} formats). 17201If code compiled with @option{-mno-float} accidentally contains 17202floating-point operations, it is likely to suffer a link-time 17203or run-time failure. 17204 17205@item -msingle-float 17206@opindex msingle-float 17207Assume that the floating-point coprocessor only supports single-precision 17208operations. 17209 17210@item -mdouble-float 17211@opindex mdouble-float 17212Assume that the floating-point coprocessor supports double-precision 17213operations. This is the default. 17214 17215@item -modd-spreg 17216@itemx -mno-odd-spreg 17217@opindex modd-spreg 17218@opindex mno-odd-spreg 17219Enable the use of odd-numbered single-precision floating-point registers 17220for the o32 ABI. This is the default for processors that are known to 17221support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 17222is set by default. 17223 17224@item -mabs=2008 17225@itemx -mabs=legacy 17226@opindex mabs=2008 17227@opindex mabs=legacy 17228These options control the treatment of the special not-a-number (NaN) 17229IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 17230@code{neg.@i{fmt}} machine instructions. 17231 17232By default or when @option{-mabs=legacy} is used the legacy 17233treatment is selected. In this case these instructions are considered 17234arithmetic and avoided where correct operation is required and the 17235input operand might be a NaN. A longer sequence of instructions that 17236manipulate the sign bit of floating-point datum manually is used 17237instead unless the @option{-ffinite-math-only} option has also been 17238specified. 17239 17240The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 17241this case these instructions are considered non-arithmetic and therefore 17242operating correctly in all cases, including in particular where the 17243input operand is a NaN. These instructions are therefore always used 17244for the respective operations. 17245 17246@item -mnan=2008 17247@itemx -mnan=legacy 17248@opindex mnan=2008 17249@opindex mnan=legacy 17250These options control the encoding of the special not-a-number (NaN) 17251IEEE 754 floating-point data. 17252 17253The @option{-mnan=legacy} option selects the legacy encoding. In this 17254case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 17255significand field being 0, whereas signalling NaNs (sNaNs) are denoted 17256by the first bit of their trailing significand field being 1. 17257 17258The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 17259this case qNaNs are denoted by the first bit of their trailing 17260significand field being 1, whereas sNaNs are denoted by the first bit of 17261their trailing significand field being 0. 17262 17263The default is @option{-mnan=legacy} unless GCC has been configured with 17264@option{--with-nan=2008}. 17265 17266@item -mllsc 17267@itemx -mno-llsc 17268@opindex mllsc 17269@opindex mno-llsc 17270Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 17271implement atomic memory built-in functions. When neither option is 17272specified, GCC uses the instructions if the target architecture 17273supports them. 17274 17275@option{-mllsc} is useful if the runtime environment can emulate the 17276instructions and @option{-mno-llsc} can be useful when compiling for 17277nonstandard ISAs. You can make either option the default by 17278configuring GCC with @option{--with-llsc} and @option{--without-llsc} 17279respectively. @option{--with-llsc} is the default for some 17280configurations; see the installation documentation for details. 17281 17282@item -mdsp 17283@itemx -mno-dsp 17284@opindex mdsp 17285@opindex mno-dsp 17286Use (do not use) revision 1 of the MIPS DSP ASE@. 17287@xref{MIPS DSP Built-in Functions}. This option defines the 17288preprocessor macro @code{__mips_dsp}. It also defines 17289@code{__mips_dsp_rev} to 1. 17290 17291@item -mdspr2 17292@itemx -mno-dspr2 17293@opindex mdspr2 17294@opindex mno-dspr2 17295Use (do not use) revision 2 of the MIPS DSP ASE@. 17296@xref{MIPS DSP Built-in Functions}. This option defines the 17297preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 17298It also defines @code{__mips_dsp_rev} to 2. 17299 17300@item -msmartmips 17301@itemx -mno-smartmips 17302@opindex msmartmips 17303@opindex mno-smartmips 17304Use (do not use) the MIPS SmartMIPS ASE. 17305 17306@item -mpaired-single 17307@itemx -mno-paired-single 17308@opindex mpaired-single 17309@opindex mno-paired-single 17310Use (do not use) paired-single floating-point instructions. 17311@xref{MIPS Paired-Single Support}. This option requires 17312hardware floating-point support to be enabled. 17313 17314@item -mdmx 17315@itemx -mno-mdmx 17316@opindex mdmx 17317@opindex mno-mdmx 17318Use (do not use) MIPS Digital Media Extension instructions. 17319This option can only be used when generating 64-bit code and requires 17320hardware floating-point support to be enabled. 17321 17322@item -mips3d 17323@itemx -mno-mips3d 17324@opindex mips3d 17325@opindex mno-mips3d 17326Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 17327The option @option{-mips3d} implies @option{-mpaired-single}. 17328 17329@item -mmicromips 17330@itemx -mno-micromips 17331@opindex mmicromips 17332@opindex mno-mmicromips 17333Generate (do not generate) microMIPS code. 17334 17335MicroMIPS code generation can also be controlled on a per-function basis 17336by means of @code{micromips} and @code{nomicromips} attributes. 17337@xref{Function Attributes}, for more information. 17338 17339@item -mmt 17340@itemx -mno-mt 17341@opindex mmt 17342@opindex mno-mt 17343Use (do not use) MT Multithreading instructions. 17344 17345@item -mmcu 17346@itemx -mno-mcu 17347@opindex mmcu 17348@opindex mno-mcu 17349Use (do not use) the MIPS MCU ASE instructions. 17350 17351@item -meva 17352@itemx -mno-eva 17353@opindex meva 17354@opindex mno-eva 17355Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 17356 17357@item -mvirt 17358@itemx -mno-virt 17359@opindex mvirt 17360@opindex mno-virt 17361Use (do not use) the MIPS Virtualization Application Specific instructions. 17362 17363@item -mxpa 17364@itemx -mno-xpa 17365@opindex mxpa 17366@opindex mno-xpa 17367Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 17368 17369@item -mlong64 17370@opindex mlong64 17371Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 17372an explanation of the default and the way that the pointer size is 17373determined. 17374 17375@item -mlong32 17376@opindex mlong32 17377Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 17378 17379The default size of @code{int}s, @code{long}s and pointers depends on 17380the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 17381uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1738232-bit @code{long}s. Pointers are the same size as @code{long}s, 17383or the same size as integer registers, whichever is smaller. 17384 17385@item -msym32 17386@itemx -mno-sym32 17387@opindex msym32 17388@opindex mno-sym32 17389Assume (do not assume) that all symbols have 32-bit values, regardless 17390of the selected ABI@. This option is useful in combination with 17391@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 17392to generate shorter and faster references to symbolic addresses. 17393 17394@item -G @var{num} 17395@opindex G 17396Put definitions of externally-visible data in a small data section 17397if that data is no bigger than @var{num} bytes. GCC can then generate 17398more efficient accesses to the data; see @option{-mgpopt} for details. 17399 17400The default @option{-G} option depends on the configuration. 17401 17402@item -mlocal-sdata 17403@itemx -mno-local-sdata 17404@opindex mlocal-sdata 17405@opindex mno-local-sdata 17406Extend (do not extend) the @option{-G} behavior to local data too, 17407such as to static variables in C@. @option{-mlocal-sdata} is the 17408default for all configurations. 17409 17410If the linker complains that an application is using too much small data, 17411you might want to try rebuilding the less performance-critical parts with 17412@option{-mno-local-sdata}. You might also want to build large 17413libraries with @option{-mno-local-sdata}, so that the libraries leave 17414more room for the main program. 17415 17416@item -mextern-sdata 17417@itemx -mno-extern-sdata 17418@opindex mextern-sdata 17419@opindex mno-extern-sdata 17420Assume (do not assume) that externally-defined data is in 17421a small data section if the size of that data is within the @option{-G} limit. 17422@option{-mextern-sdata} is the default for all configurations. 17423 17424If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 17425@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 17426that is no bigger than @var{num} bytes, you must make sure that @var{Var} 17427is placed in a small data section. If @var{Var} is defined by another 17428module, you must either compile that module with a high-enough 17429@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 17430definition. If @var{Var} is common, you must link the application 17431with a high-enough @option{-G} setting. 17432 17433The easiest way of satisfying these restrictions is to compile 17434and link every module with the same @option{-G} option. However, 17435you may wish to build a library that supports several different 17436small data limits. You can do this by compiling the library with 17437the highest supported @option{-G} setting and additionally using 17438@option{-mno-extern-sdata} to stop the library from making assumptions 17439about externally-defined data. 17440 17441@item -mgpopt 17442@itemx -mno-gpopt 17443@opindex mgpopt 17444@opindex mno-gpopt 17445Use (do not use) GP-relative accesses for symbols that are known to be 17446in a small data section; see @option{-G}, @option{-mlocal-sdata} and 17447@option{-mextern-sdata}. @option{-mgpopt} is the default for all 17448configurations. 17449 17450@option{-mno-gpopt} is useful for cases where the @code{$gp} register 17451might not hold the value of @code{_gp}. For example, if the code is 17452part of a library that might be used in a boot monitor, programs that 17453call boot monitor routines pass an unknown value in @code{$gp}. 17454(In such situations, the boot monitor itself is usually compiled 17455with @option{-G0}.) 17456 17457@option{-mno-gpopt} implies @option{-mno-local-sdata} and 17458@option{-mno-extern-sdata}. 17459 17460@item -membedded-data 17461@itemx -mno-embedded-data 17462@opindex membedded-data 17463@opindex mno-embedded-data 17464Allocate variables to the read-only data section first if possible, then 17465next in the small data section if possible, otherwise in data. This gives 17466slightly slower code than the default, but reduces the amount of RAM required 17467when executing, and thus may be preferred for some embedded systems. 17468 17469@item -muninit-const-in-rodata 17470@itemx -mno-uninit-const-in-rodata 17471@opindex muninit-const-in-rodata 17472@opindex mno-uninit-const-in-rodata 17473Put uninitialized @code{const} variables in the read-only data section. 17474This option is only meaningful in conjunction with @option{-membedded-data}. 17475 17476@item -mcode-readable=@var{setting} 17477@opindex mcode-readable 17478Specify whether GCC may generate code that reads from executable sections. 17479There are three possible settings: 17480 17481@table @gcctabopt 17482@item -mcode-readable=yes 17483Instructions may freely access executable sections. This is the 17484default setting. 17485 17486@item -mcode-readable=pcrel 17487MIPS16 PC-relative load instructions can access executable sections, 17488but other instructions must not do so. This option is useful on 4KSc 17489and 4KSd processors when the code TLBs have the Read Inhibit bit set. 17490It is also useful on processors that can be configured to have a dual 17491instruction/data SRAM interface and that, like the M4K, automatically 17492redirect PC-relative loads to the instruction RAM. 17493 17494@item -mcode-readable=no 17495Instructions must not access executable sections. This option can be 17496useful on targets that are configured to have a dual instruction/data 17497SRAM interface but that (unlike the M4K) do not automatically redirect 17498PC-relative loads to the instruction RAM. 17499@end table 17500 17501@item -msplit-addresses 17502@itemx -mno-split-addresses 17503@opindex msplit-addresses 17504@opindex mno-split-addresses 17505Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 17506relocation operators. This option has been superseded by 17507@option{-mexplicit-relocs} but is retained for backwards compatibility. 17508 17509@item -mexplicit-relocs 17510@itemx -mno-explicit-relocs 17511@opindex mexplicit-relocs 17512@opindex mno-explicit-relocs 17513Use (do not use) assembler relocation operators when dealing with symbolic 17514addresses. The alternative, selected by @option{-mno-explicit-relocs}, 17515is to use assembler macros instead. 17516 17517@option{-mexplicit-relocs} is the default if GCC was configured 17518to use an assembler that supports relocation operators. 17519 17520@item -mcheck-zero-division 17521@itemx -mno-check-zero-division 17522@opindex mcheck-zero-division 17523@opindex mno-check-zero-division 17524Trap (do not trap) on integer division by zero. 17525 17526The default is @option{-mcheck-zero-division}. 17527 17528@item -mdivide-traps 17529@itemx -mdivide-breaks 17530@opindex mdivide-traps 17531@opindex mdivide-breaks 17532MIPS systems check for division by zero by generating either a 17533conditional trap or a break instruction. Using traps results in 17534smaller code, but is only supported on MIPS II and later. Also, some 17535versions of the Linux kernel have a bug that prevents trap from 17536generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 17537allow conditional traps on architectures that support them and 17538@option{-mdivide-breaks} to force the use of breaks. 17539 17540The default is usually @option{-mdivide-traps}, but this can be 17541overridden at configure time using @option{--with-divide=breaks}. 17542Divide-by-zero checks can be completely disabled using 17543@option{-mno-check-zero-division}. 17544 17545@item -mmemcpy 17546@itemx -mno-memcpy 17547@opindex mmemcpy 17548@opindex mno-memcpy 17549Force (do not force) the use of @code{memcpy} for non-trivial block 17550moves. The default is @option{-mno-memcpy}, which allows GCC to inline 17551most constant-sized copies. 17552 17553@item -mlong-calls 17554@itemx -mno-long-calls 17555@opindex mlong-calls 17556@opindex mno-long-calls 17557Disable (do not disable) use of the @code{jal} instruction. Calling 17558functions using @code{jal} is more efficient but requires the caller 17559and callee to be in the same 256 megabyte segment. 17560 17561This option has no effect on abicalls code. The default is 17562@option{-mno-long-calls}. 17563 17564@item -mmad 17565@itemx -mno-mad 17566@opindex mmad 17567@opindex mno-mad 17568Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 17569instructions, as provided by the R4650 ISA@. 17570 17571@item -mimadd 17572@itemx -mno-imadd 17573@opindex mimadd 17574@opindex mno-imadd 17575Enable (disable) use of the @code{madd} and @code{msub} integer 17576instructions. The default is @option{-mimadd} on architectures 17577that support @code{madd} and @code{msub} except for the 74k 17578architecture where it was found to generate slower code. 17579 17580@item -mfused-madd 17581@itemx -mno-fused-madd 17582@opindex mfused-madd 17583@opindex mno-fused-madd 17584Enable (disable) use of the floating-point multiply-accumulate 17585instructions, when they are available. The default is 17586@option{-mfused-madd}. 17587 17588On the R8000 CPU when multiply-accumulate instructions are used, 17589the intermediate product is calculated to infinite precision 17590and is not subject to the FCSR Flush to Zero bit. This may be 17591undesirable in some circumstances. On other processors the result 17592is numerically identical to the equivalent computation using 17593separate multiply, add, subtract and negate instructions. 17594 17595@item -nocpp 17596@opindex nocpp 17597Tell the MIPS assembler to not run its preprocessor over user 17598assembler files (with a @samp{.s} suffix) when assembling them. 17599 17600@item -mfix-24k 17601@item -mno-fix-24k 17602@opindex mfix-24k 17603@opindex mno-fix-24k 17604Work around the 24K E48 (lost data on stores during refill) errata. 17605The workarounds are implemented by the assembler rather than by GCC@. 17606 17607@item -mfix-r4000 17608@itemx -mno-fix-r4000 17609@opindex mfix-r4000 17610@opindex mno-fix-r4000 17611Work around certain R4000 CPU errata: 17612@itemize @minus 17613@item 17614A double-word or a variable shift may give an incorrect result if executed 17615immediately after starting an integer division. 17616@item 17617A double-word or a variable shift may give an incorrect result if executed 17618while an integer multiplication is in progress. 17619@item 17620An integer division may give an incorrect result if started in a delay slot 17621of a taken branch or a jump. 17622@end itemize 17623 17624@item -mfix-r4400 17625@itemx -mno-fix-r4400 17626@opindex mfix-r4400 17627@opindex mno-fix-r4400 17628Work around certain R4400 CPU errata: 17629@itemize @minus 17630@item 17631A double-word or a variable shift may give an incorrect result if executed 17632immediately after starting an integer division. 17633@end itemize 17634 17635@item -mfix-r10000 17636@itemx -mno-fix-r10000 17637@opindex mfix-r10000 17638@opindex mno-fix-r10000 17639Work around certain R10000 errata: 17640@itemize @minus 17641@item 17642@code{ll}/@code{sc} sequences may not behave atomically on revisions 17643prior to 3.0. They may deadlock on revisions 2.6 and earlier. 17644@end itemize 17645 17646This option can only be used if the target architecture supports 17647branch-likely instructions. @option{-mfix-r10000} is the default when 17648@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 17649otherwise. 17650 17651@item -mfix-rm7000 17652@itemx -mno-fix-rm7000 17653@opindex mfix-rm7000 17654Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 17655workarounds are implemented by the assembler rather than by GCC@. 17656 17657@item -mfix-vr4120 17658@itemx -mno-fix-vr4120 17659@opindex mfix-vr4120 17660Work around certain VR4120 errata: 17661@itemize @minus 17662@item 17663@code{dmultu} does not always produce the correct result. 17664@item 17665@code{div} and @code{ddiv} do not always produce the correct result if one 17666of the operands is negative. 17667@end itemize 17668The workarounds for the division errata rely on special functions in 17669@file{libgcc.a}. At present, these functions are only provided by 17670the @code{mips64vr*-elf} configurations. 17671 17672Other VR4120 errata require a NOP to be inserted between certain pairs of 17673instructions. These errata are handled by the assembler, not by GCC itself. 17674 17675@item -mfix-vr4130 17676@opindex mfix-vr4130 17677Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 17678workarounds are implemented by the assembler rather than by GCC, 17679although GCC avoids using @code{mflo} and @code{mfhi} if the 17680VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 17681instructions are available instead. 17682 17683@item -mfix-sb1 17684@itemx -mno-fix-sb1 17685@opindex mfix-sb1 17686Work around certain SB-1 CPU core errata. 17687(This flag currently works around the SB-1 revision 2 17688``F1'' and ``F2'' floating-point errata.) 17689 17690@item -mr10k-cache-barrier=@var{setting} 17691@opindex mr10k-cache-barrier 17692Specify whether GCC should insert cache barriers to avoid the 17693side-effects of speculation on R10K processors. 17694 17695In common with many processors, the R10K tries to predict the outcome 17696of a conditional branch and speculatively executes instructions from 17697the ``taken'' branch. It later aborts these instructions if the 17698predicted outcome is wrong. However, on the R10K, even aborted 17699instructions can have side effects. 17700 17701This problem only affects kernel stores and, depending on the system, 17702kernel loads. As an example, a speculatively-executed store may load 17703the target memory into cache and mark the cache line as dirty, even if 17704the store itself is later aborted. If a DMA operation writes to the 17705same area of memory before the ``dirty'' line is flushed, the cached 17706data overwrites the DMA-ed data. See the R10K processor manual 17707for a full description, including other potential problems. 17708 17709One workaround is to insert cache barrier instructions before every memory 17710access that might be speculatively executed and that might have side 17711effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 17712controls GCC's implementation of this workaround. It assumes that 17713aborted accesses to any byte in the following regions does not have 17714side effects: 17715 17716@enumerate 17717@item 17718the memory occupied by the current function's stack frame; 17719 17720@item 17721the memory occupied by an incoming stack argument; 17722 17723@item 17724the memory occupied by an object with a link-time-constant address. 17725@end enumerate 17726 17727It is the kernel's responsibility to ensure that speculative 17728accesses to these regions are indeed safe. 17729 17730If the input program contains a function declaration such as: 17731 17732@smallexample 17733void foo (void); 17734@end smallexample 17735 17736then the implementation of @code{foo} must allow @code{j foo} and 17737@code{jal foo} to be executed speculatively. GCC honors this 17738restriction for functions it compiles itself. It expects non-GCC 17739functions (such as hand-written assembly code) to do the same. 17740 17741The option has three forms: 17742 17743@table @gcctabopt 17744@item -mr10k-cache-barrier=load-store 17745Insert a cache barrier before a load or store that might be 17746speculatively executed and that might have side effects even 17747if aborted. 17748 17749@item -mr10k-cache-barrier=store 17750Insert a cache barrier before a store that might be speculatively 17751executed and that might have side effects even if aborted. 17752 17753@item -mr10k-cache-barrier=none 17754Disable the insertion of cache barriers. This is the default setting. 17755@end table 17756 17757@item -mflush-func=@var{func} 17758@itemx -mno-flush-func 17759@opindex mflush-func 17760Specifies the function to call to flush the I and D caches, or to not 17761call any such function. If called, the function must take the same 17762arguments as the common @code{_flush_func}, that is, the address of the 17763memory range for which the cache is being flushed, the size of the 17764memory range, and the number 3 (to flush both caches). The default 17765depends on the target GCC was configured for, but commonly is either 17766@code{_flush_func} or @code{__cpu_flush}. 17767 17768@item mbranch-cost=@var{num} 17769@opindex mbranch-cost 17770Set the cost of branches to roughly @var{num} ``simple'' instructions. 17771This cost is only a heuristic and is not guaranteed to produce 17772consistent results across releases. A zero cost redundantly selects 17773the default, which is based on the @option{-mtune} setting. 17774 17775@item -mbranch-likely 17776@itemx -mno-branch-likely 17777@opindex mbranch-likely 17778@opindex mno-branch-likely 17779Enable or disable use of Branch Likely instructions, regardless of the 17780default for the selected architecture. By default, Branch Likely 17781instructions may be generated if they are supported by the selected 17782architecture. An exception is for the MIPS32 and MIPS64 architectures 17783and processors that implement those architectures; for those, Branch 17784Likely instructions are not be generated by default because the MIPS32 17785and MIPS64 architectures specifically deprecate their use. 17786 17787@item -mfp-exceptions 17788@itemx -mno-fp-exceptions 17789@opindex mfp-exceptions 17790Specifies whether FP exceptions are enabled. This affects how 17791FP instructions are scheduled for some processors. 17792The default is that FP exceptions are 17793enabled. 17794 17795For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1779664-bit code, then we can use both FP pipes. Otherwise, we can only use one 17797FP pipe. 17798 17799@item -mvr4130-align 17800@itemx -mno-vr4130-align 17801@opindex mvr4130-align 17802The VR4130 pipeline is two-way superscalar, but can only issue two 17803instructions together if the first one is 8-byte aligned. When this 17804option is enabled, GCC aligns pairs of instructions that it 17805thinks should execute in parallel. 17806 17807This option only has an effect when optimizing for the VR4130. 17808It normally makes code faster, but at the expense of making it bigger. 17809It is enabled by default at optimization level @option{-O3}. 17810 17811@item -msynci 17812@itemx -mno-synci 17813@opindex msynci 17814Enable (disable) generation of @code{synci} instructions on 17815architectures that support it. The @code{synci} instructions (if 17816enabled) are generated when @code{__builtin___clear_cache} is 17817compiled. 17818 17819This option defaults to @option{-mno-synci}, but the default can be 17820overridden by configuring GCC with @option{--with-synci}. 17821 17822When compiling code for single processor systems, it is generally safe 17823to use @code{synci}. However, on many multi-core (SMP) systems, it 17824does not invalidate the instruction caches on all cores and may lead 17825to undefined behavior. 17826 17827@item -mrelax-pic-calls 17828@itemx -mno-relax-pic-calls 17829@opindex mrelax-pic-calls 17830Try to turn PIC calls that are normally dispatched via register 17831@code{$25} into direct calls. This is only possible if the linker can 17832resolve the destination at link-time and if the destination is within 17833range for a direct call. 17834 17835@option{-mrelax-pic-calls} is the default if GCC was configured to use 17836an assembler and a linker that support the @code{.reloc} assembly 17837directive and @option{-mexplicit-relocs} is in effect. With 17838@option{-mno-explicit-relocs}, this optimization can be performed by the 17839assembler and the linker alone without help from the compiler. 17840 17841@item -mmcount-ra-address 17842@itemx -mno-mcount-ra-address 17843@opindex mmcount-ra-address 17844@opindex mno-mcount-ra-address 17845Emit (do not emit) code that allows @code{_mcount} to modify the 17846calling function's return address. When enabled, this option extends 17847the usual @code{_mcount} interface with a new @var{ra-address} 17848parameter, which has type @code{intptr_t *} and is passed in register 17849@code{$12}. @code{_mcount} can then modify the return address by 17850doing both of the following: 17851@itemize 17852@item 17853Returning the new address in register @code{$31}. 17854@item 17855Storing the new address in @code{*@var{ra-address}}, 17856if @var{ra-address} is nonnull. 17857@end itemize 17858 17859The default is @option{-mno-mcount-ra-address}. 17860 17861@end table 17862 17863@node MMIX Options 17864@subsection MMIX Options 17865@cindex MMIX Options 17866 17867These options are defined for the MMIX: 17868 17869@table @gcctabopt 17870@item -mlibfuncs 17871@itemx -mno-libfuncs 17872@opindex mlibfuncs 17873@opindex mno-libfuncs 17874Specify that intrinsic library functions are being compiled, passing all 17875values in registers, no matter the size. 17876 17877@item -mepsilon 17878@itemx -mno-epsilon 17879@opindex mepsilon 17880@opindex mno-epsilon 17881Generate floating-point comparison instructions that compare with respect 17882to the @code{rE} epsilon register. 17883 17884@item -mabi=mmixware 17885@itemx -mabi=gnu 17886@opindex mabi=mmixware 17887@opindex mabi=gnu 17888Generate code that passes function parameters and return values that (in 17889the called function) are seen as registers @code{$0} and up, as opposed to 17890the GNU ABI which uses global registers @code{$231} and up. 17891 17892@item -mzero-extend 17893@itemx -mno-zero-extend 17894@opindex mzero-extend 17895@opindex mno-zero-extend 17896When reading data from memory in sizes shorter than 64 bits, use (do not 17897use) zero-extending load instructions by default, rather than 17898sign-extending ones. 17899 17900@item -mknuthdiv 17901@itemx -mno-knuthdiv 17902@opindex mknuthdiv 17903@opindex mno-knuthdiv 17904Make the result of a division yielding a remainder have the same sign as 17905the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 17906remainder follows the sign of the dividend. Both methods are 17907arithmetically valid, the latter being almost exclusively used. 17908 17909@item -mtoplevel-symbols 17910@itemx -mno-toplevel-symbols 17911@opindex mtoplevel-symbols 17912@opindex mno-toplevel-symbols 17913Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 17914code can be used with the @code{PREFIX} assembly directive. 17915 17916@item -melf 17917@opindex melf 17918Generate an executable in the ELF format, rather than the default 17919@samp{mmo} format used by the @command{mmix} simulator. 17920 17921@item -mbranch-predict 17922@itemx -mno-branch-predict 17923@opindex mbranch-predict 17924@opindex mno-branch-predict 17925Use (do not use) the probable-branch instructions, when static branch 17926prediction indicates a probable branch. 17927 17928@item -mbase-addresses 17929@itemx -mno-base-addresses 17930@opindex mbase-addresses 17931@opindex mno-base-addresses 17932Generate (do not generate) code that uses @emph{base addresses}. Using a 17933base address automatically generates a request (handled by the assembler 17934and the linker) for a constant to be set up in a global register. The 17935register is used for one or more base address requests within the range 0 17936to 255 from the value held in the register. The generally leads to short 17937and fast code, but the number of different data items that can be 17938addressed is limited. This means that a program that uses lots of static 17939data may require @option{-mno-base-addresses}. 17940 17941@item -msingle-exit 17942@itemx -mno-single-exit 17943@opindex msingle-exit 17944@opindex mno-single-exit 17945Force (do not force) generated code to have a single exit point in each 17946function. 17947@end table 17948 17949@node MN10300 Options 17950@subsection MN10300 Options 17951@cindex MN10300 options 17952 17953These @option{-m} options are defined for Matsushita MN10300 architectures: 17954 17955@table @gcctabopt 17956@item -mmult-bug 17957@opindex mmult-bug 17958Generate code to avoid bugs in the multiply instructions for the MN10300 17959processors. This is the default. 17960 17961@item -mno-mult-bug 17962@opindex mno-mult-bug 17963Do not generate code to avoid bugs in the multiply instructions for the 17964MN10300 processors. 17965 17966@item -mam33 17967@opindex mam33 17968Generate code using features specific to the AM33 processor. 17969 17970@item -mno-am33 17971@opindex mno-am33 17972Do not generate code using features specific to the AM33 processor. This 17973is the default. 17974 17975@item -mam33-2 17976@opindex mam33-2 17977Generate code using features specific to the AM33/2.0 processor. 17978 17979@item -mam34 17980@opindex mam34 17981Generate code using features specific to the AM34 processor. 17982 17983@item -mtune=@var{cpu-type} 17984@opindex mtune 17985Use the timing characteristics of the indicated CPU type when 17986scheduling instructions. This does not change the targeted processor 17987type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 17988@samp{am33-2} or @samp{am34}. 17989 17990@item -mreturn-pointer-on-d0 17991@opindex mreturn-pointer-on-d0 17992When generating a function that returns a pointer, return the pointer 17993in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 17994only in @code{a0}, and attempts to call such functions without a prototype 17995result in errors. Note that this option is on by default; use 17996@option{-mno-return-pointer-on-d0} to disable it. 17997 17998@item -mno-crt0 17999@opindex mno-crt0 18000Do not link in the C run-time initialization object file. 18001 18002@item -mrelax 18003@opindex mrelax 18004Indicate to the linker that it should perform a relaxation optimization pass 18005to shorten branches, calls and absolute memory addresses. This option only 18006has an effect when used on the command line for the final link step. 18007 18008This option makes symbolic debugging impossible. 18009 18010@item -mliw 18011@opindex mliw 18012Allow the compiler to generate @emph{Long Instruction Word} 18013instructions if the target is the @samp{AM33} or later. This is the 18014default. This option defines the preprocessor macro @code{__LIW__}. 18015 18016@item -mnoliw 18017@opindex mnoliw 18018Do not allow the compiler to generate @emph{Long Instruction Word} 18019instructions. This option defines the preprocessor macro 18020@code{__NO_LIW__}. 18021 18022@item -msetlb 18023@opindex msetlb 18024Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 18025instructions if the target is the @samp{AM33} or later. This is the 18026default. This option defines the preprocessor macro @code{__SETLB__}. 18027 18028@item -mnosetlb 18029@opindex mnosetlb 18030Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 18031instructions. This option defines the preprocessor macro 18032@code{__NO_SETLB__}. 18033 18034@end table 18035 18036@node Moxie Options 18037@subsection Moxie Options 18038@cindex Moxie Options 18039 18040@table @gcctabopt 18041 18042@item -meb 18043@opindex meb 18044Generate big-endian code. This is the default for @samp{moxie-*-*} 18045configurations. 18046 18047@item -mel 18048@opindex mel 18049Generate little-endian code. 18050 18051@item -mmul.x 18052@opindex mmul.x 18053Generate mul.x and umul.x instructions. This is the default for 18054@samp{moxiebox-*-*} configurations. 18055 18056@item -mno-crt0 18057@opindex mno-crt0 18058Do not link in the C run-time initialization object file. 18059 18060@end table 18061 18062@node MSP430 Options 18063@subsection MSP430 Options 18064@cindex MSP430 Options 18065 18066These options are defined for the MSP430: 18067 18068@table @gcctabopt 18069 18070@item -masm-hex 18071@opindex masm-hex 18072Force assembly output to always use hex constants. Normally such 18073constants are signed decimals, but this option is available for 18074testsuite and/or aesthetic purposes. 18075 18076@item -mmcu= 18077@opindex mmcu= 18078Select the MCU to target. This is used to create a C preprocessor 18079symbol based upon the MCU name, converted to upper case and pre- and 18080post-fixed with @samp{__}. This in turn is used by the 18081@file{msp430.h} header file to select an MCU-specific supplementary 18082header file. 18083 18084The option also sets the ISA to use. If the MCU name is one that is 18085known to only support the 430 ISA then that is selected, otherwise the 18086430X ISA is selected. A generic MCU name of @samp{msp430} can also be 18087used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 18088name selects the 430X ISA. 18089 18090In addition an MCU-specific linker script is added to the linker 18091command line. The script's name is the name of the MCU with 18092@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 18093command line defines the C preprocessor symbol @code{__XXX__} and 18094cause the linker to search for a script called @file{xxx.ld}. 18095 18096This option is also passed on to the assembler. 18097 18098@item -mcpu= 18099@opindex mcpu= 18100Specifies the ISA to use. Accepted values are @samp{msp430}, 18101@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 18102@option{-mmcu=} option should be used to select the ISA. 18103 18104@item -msim 18105@opindex msim 18106Link to the simulator runtime libraries and linker script. Overrides 18107any scripts that would be selected by the @option{-mmcu=} option. 18108 18109@item -mlarge 18110@opindex mlarge 18111Use large-model addressing (20-bit pointers, 32-bit @code{size_t}). 18112 18113@item -msmall 18114@opindex msmall 18115Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 18116 18117@item -mrelax 18118@opindex mrelax 18119This option is passed to the assembler and linker, and allows the 18120linker to perform certain optimizations that cannot be done until 18121the final link. 18122 18123@item mhwmult= 18124@opindex mhwmult= 18125Describes the type of hardware multiply supported by the target. 18126Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 18127for the original 16-bit-only multiply supported by early MCUs. 18128@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 18129@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 18130A value of @samp{auto} can also be given. This tells GCC to deduce 18131the hardware multiply support based upon the MCU name provided by the 18132@option{-mmcu} option. If no @option{-mmcu} option is specified then 18133@samp{32bit} hardware multiply support is assumed. @samp{auto} is the 18134default setting. 18135 18136Hardware multiplies are normally performed by calling a library 18137routine. This saves space in the generated code. When compiling at 18138@option{-O3} or higher however the hardware multiplier is invoked 18139inline. This makes for bigger, but faster code. 18140 18141The hardware multiply routines disable interrupts whilst running and 18142restore the previous interrupt state when they finish. This makes 18143them safe to use inside interrupt handlers as well as in normal code. 18144 18145@item -minrt 18146@opindex minrt 18147Enable the use of a minimum runtime environment - no static 18148initializers or constructors. This is intended for memory-constrained 18149devices. The compiler includes special symbols in some objects 18150that tell the linker and runtime which code fragments are required. 18151 18152@end table 18153 18154@node NDS32 Options 18155@subsection NDS32 Options 18156@cindex NDS32 Options 18157 18158These options are defined for NDS32 implementations: 18159 18160@table @gcctabopt 18161 18162@item -mbig-endian 18163@opindex mbig-endian 18164Generate code in big-endian mode. 18165 18166@item -mlittle-endian 18167@opindex mlittle-endian 18168Generate code in little-endian mode. 18169 18170@item -mreduced-regs 18171@opindex mreduced-regs 18172Use reduced-set registers for register allocation. 18173 18174@item -mfull-regs 18175@opindex mfull-regs 18176Use full-set registers for register allocation. 18177 18178@item -mcmov 18179@opindex mcmov 18180Generate conditional move instructions. 18181 18182@item -mno-cmov 18183@opindex mno-cmov 18184Do not generate conditional move instructions. 18185 18186@item -mperf-ext 18187@opindex mperf-ext 18188Generate performance extension instructions. 18189 18190@item -mno-perf-ext 18191@opindex mno-perf-ext 18192Do not generate performance extension instructions. 18193 18194@item -mv3push 18195@opindex mv3push 18196Generate v3 push25/pop25 instructions. 18197 18198@item -mno-v3push 18199@opindex mno-v3push 18200Do not generate v3 push25/pop25 instructions. 18201 18202@item -m16-bit 18203@opindex m16-bit 18204Generate 16-bit instructions. 18205 18206@item -mno-16-bit 18207@opindex mno-16-bit 18208Do not generate 16-bit instructions. 18209 18210@item -misr-vector-size=@var{num} 18211@opindex misr-vector-size 18212Specify the size of each interrupt vector, which must be 4 or 16. 18213 18214@item -mcache-block-size=@var{num} 18215@opindex mcache-block-size 18216Specify the size of each cache block, 18217which must be a power of 2 between 4 and 512. 18218 18219@item -march=@var{arch} 18220@opindex march 18221Specify the name of the target architecture. 18222 18223@item -mcmodel=@var{code-model} 18224@opindex mcmodel 18225Set the code model to one of 18226@table @asis 18227@item @samp{small} 18228All the data and read-only data segments must be within 512KB addressing space. 18229The text segment must be within 16MB addressing space. 18230@item @samp{medium} 18231The data segment must be within 512KB while the read-only data segment can be 18232within 4GB addressing space. The text segment should be still within 16MB 18233addressing space. 18234@item @samp{large} 18235All the text and data segments can be within 4GB addressing space. 18236@end table 18237 18238@item -mctor-dtor 18239@opindex mctor-dtor 18240Enable constructor/destructor feature. 18241 18242@item -mrelax 18243@opindex mrelax 18244Guide linker to relax instructions. 18245 18246@end table 18247 18248@node Nios II Options 18249@subsection Nios II Options 18250@cindex Nios II options 18251@cindex Altera Nios II options 18252 18253These are the options defined for the Altera Nios II processor. 18254 18255@table @gcctabopt 18256 18257@item -G @var{num} 18258@opindex G 18259@cindex smaller data references 18260Put global and static objects less than or equal to @var{num} bytes 18261into the small data or BSS sections instead of the normal data or BSS 18262sections. The default value of @var{num} is 8. 18263 18264@item -mgpopt=@var{option} 18265@item -mgpopt 18266@itemx -mno-gpopt 18267@opindex mgpopt 18268@opindex mno-gpopt 18269Generate (do not generate) GP-relative accesses. The following 18270@var{option} names are recognized: 18271 18272@table @samp 18273 18274@item none 18275Do not generate GP-relative accesses. 18276 18277@item local 18278Generate GP-relative accesses for small data objects that are not 18279external or weak. Also use GP-relative addressing for objects that 18280have been explicitly placed in a small data section via a @code{section} 18281attribute. 18282 18283@item global 18284As for @samp{local}, but also generate GP-relative accesses for 18285small data objects that are external or weak. If you use this option, 18286you must ensure that all parts of your program (including libraries) are 18287compiled with the same @option{-G} setting. 18288 18289@item data 18290Generate GP-relative accesses for all data objects in the program. If you 18291use this option, the entire data and BSS segments 18292of your program must fit in 64K of memory and you must use an appropriate 18293linker script to allocate them within the addressible range of the 18294global pointer. 18295 18296@item all 18297Generate GP-relative addresses for function pointers as well as data 18298pointers. If you use this option, the entire text, data, and BSS segments 18299of your program must fit in 64K of memory and you must use an appropriate 18300linker script to allocate them within the addressible range of the 18301global pointer. 18302 18303@end table 18304 18305@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 18306@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 18307 18308The default is @option{-mgpopt} except when @option{-fpic} or 18309@option{-fPIC} is specified to generate position-independent code. 18310Note that the Nios II ABI does not permit GP-relative accesses from 18311shared libraries. 18312 18313You may need to specify @option{-mno-gpopt} explicitly when building 18314programs that include large amounts of small data, including large 18315GOT data sections. In this case, the 16-bit offset for GP-relative 18316addressing may not be large enough to allow access to the entire 18317small data section. 18318 18319@item -mel 18320@itemx -meb 18321@opindex mel 18322@opindex meb 18323Generate little-endian (default) or big-endian (experimental) code, 18324respectively. 18325 18326@item -mbypass-cache 18327@itemx -mno-bypass-cache 18328@opindex mno-bypass-cache 18329@opindex mbypass-cache 18330Force all load and store instructions to always bypass cache by 18331using I/O variants of the instructions. The default is not to 18332bypass the cache. 18333 18334@item -mno-cache-volatile 18335@itemx -mcache-volatile 18336@opindex mcache-volatile 18337@opindex mno-cache-volatile 18338Volatile memory access bypass the cache using the I/O variants of 18339the load and store instructions. The default is not to bypass the cache. 18340 18341@item -mno-fast-sw-div 18342@itemx -mfast-sw-div 18343@opindex mno-fast-sw-div 18344@opindex mfast-sw-div 18345Do not use table-based fast divide for small numbers. The default 18346is to use the fast divide at @option{-O3} and above. 18347 18348@item -mno-hw-mul 18349@itemx -mhw-mul 18350@itemx -mno-hw-mulx 18351@itemx -mhw-mulx 18352@itemx -mno-hw-div 18353@itemx -mhw-div 18354@opindex mno-hw-mul 18355@opindex mhw-mul 18356@opindex mno-hw-mulx 18357@opindex mhw-mulx 18358@opindex mno-hw-div 18359@opindex mhw-div 18360Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 18361instructions by the compiler. The default is to emit @code{mul} 18362and not emit @code{div} and @code{mulx}. 18363 18364@item -mcustom-@var{insn}=@var{N} 18365@itemx -mno-custom-@var{insn} 18366@opindex mcustom-@var{insn} 18367@opindex mno-custom-@var{insn} 18368Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 18369custom instruction with encoding @var{N} when generating code that uses 18370@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 18371instruction 253 for single-precision floating-point add operations instead 18372of the default behavior of using a library call. 18373 18374The following values of @var{insn} are supported. Except as otherwise 18375noted, floating-point operations are expected to be implemented with 18376normal IEEE 754 semantics and correspond directly to the C operators or the 18377equivalent GCC built-in functions (@pxref{Other Builtins}). 18378 18379Single-precision floating point: 18380@table @asis 18381 18382@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 18383Binary arithmetic operations. 18384 18385@item @samp{fnegs} 18386Unary negation. 18387 18388@item @samp{fabss} 18389Unary absolute value. 18390 18391@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 18392Comparison operations. 18393 18394@item @samp{fmins}, @samp{fmaxs} 18395Floating-point minimum and maximum. These instructions are only 18396generated if @option{-ffinite-math-only} is specified. 18397 18398@item @samp{fsqrts} 18399Unary square root operation. 18400 18401@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 18402Floating-point trigonometric and exponential functions. These instructions 18403are only generated if @option{-funsafe-math-optimizations} is also specified. 18404 18405@end table 18406 18407Double-precision floating point: 18408@table @asis 18409 18410@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 18411Binary arithmetic operations. 18412 18413@item @samp{fnegd} 18414Unary negation. 18415 18416@item @samp{fabsd} 18417Unary absolute value. 18418 18419@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 18420Comparison operations. 18421 18422@item @samp{fmind}, @samp{fmaxd} 18423Double-precision minimum and maximum. These instructions are only 18424generated if @option{-ffinite-math-only} is specified. 18425 18426@item @samp{fsqrtd} 18427Unary square root operation. 18428 18429@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 18430Double-precision trigonometric and exponential functions. These instructions 18431are only generated if @option{-funsafe-math-optimizations} is also specified. 18432 18433@end table 18434 18435Conversions: 18436@table @asis 18437@item @samp{fextsd} 18438Conversion from single precision to double precision. 18439 18440@item @samp{ftruncds} 18441Conversion from double precision to single precision. 18442 18443@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 18444Conversion from floating point to signed or unsigned integer types, with 18445truncation towards zero. 18446 18447@item @samp{round} 18448Conversion from single-precision floating point to signed integer, 18449rounding to the nearest integer and ties away from zero. 18450This corresponds to the @code{__builtin_lroundf} function when 18451@option{-fno-math-errno} is used. 18452 18453@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 18454Conversion from signed or unsigned integer types to floating-point types. 18455 18456@end table 18457 18458In addition, all of the following transfer instructions for internal 18459registers X and Y must be provided to use any of the double-precision 18460floating-point instructions. Custom instructions taking two 18461double-precision source operands expect the first operand in the 1846264-bit register X. The other operand (or only operand of a unary 18463operation) is given to the custom arithmetic instruction with the 18464least significant half in source register @var{src1} and the most 18465significant half in @var{src2}. A custom instruction that returns a 18466double-precision result returns the most significant 32 bits in the 18467destination register and the other half in 32-bit register Y. 18468GCC automatically generates the necessary code sequences to write 18469register X and/or read register Y when double-precision floating-point 18470instructions are used. 18471 18472@table @asis 18473 18474@item @samp{fwrx} 18475Write @var{src1} into the least significant half of X and @var{src2} into 18476the most significant half of X. 18477 18478@item @samp{fwry} 18479Write @var{src1} into Y. 18480 18481@item @samp{frdxhi}, @samp{frdxlo} 18482Read the most or least (respectively) significant half of X and store it in 18483@var{dest}. 18484 18485@item @samp{frdy} 18486Read the value of Y and store it into @var{dest}. 18487@end table 18488 18489Note that you can gain more local control over generation of Nios II custom 18490instructions by using the @code{target("custom-@var{insn}=@var{N}")} 18491and @code{target("no-custom-@var{insn}")} function attributes 18492(@pxref{Function Attributes}) 18493or pragmas (@pxref{Function Specific Option Pragmas}). 18494 18495@item -mcustom-fpu-cfg=@var{name} 18496@opindex mcustom-fpu-cfg 18497 18498This option enables a predefined, named set of custom instruction encodings 18499(see @option{-mcustom-@var{insn}} above). 18500Currently, the following sets are defined: 18501 18502@option{-mcustom-fpu-cfg=60-1} is equivalent to: 18503@gccoptlist{-mcustom-fmuls=252 @gol 18504-mcustom-fadds=253 @gol 18505-mcustom-fsubs=254 @gol 18506-fsingle-precision-constant} 18507 18508@option{-mcustom-fpu-cfg=60-2} is equivalent to: 18509@gccoptlist{-mcustom-fmuls=252 @gol 18510-mcustom-fadds=253 @gol 18511-mcustom-fsubs=254 @gol 18512-mcustom-fdivs=255 @gol 18513-fsingle-precision-constant} 18514 18515@option{-mcustom-fpu-cfg=72-3} is equivalent to: 18516@gccoptlist{-mcustom-floatus=243 @gol 18517-mcustom-fixsi=244 @gol 18518-mcustom-floatis=245 @gol 18519-mcustom-fcmpgts=246 @gol 18520-mcustom-fcmples=249 @gol 18521-mcustom-fcmpeqs=250 @gol 18522-mcustom-fcmpnes=251 @gol 18523-mcustom-fmuls=252 @gol 18524-mcustom-fadds=253 @gol 18525-mcustom-fsubs=254 @gol 18526-mcustom-fdivs=255 @gol 18527-fsingle-precision-constant} 18528 18529Custom instruction assignments given by individual 18530@option{-mcustom-@var{insn}=} options override those given by 18531@option{-mcustom-fpu-cfg=}, regardless of the 18532order of the options on the command line. 18533 18534Note that you can gain more local control over selection of a FPU 18535configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 18536function attribute (@pxref{Function Attributes}) 18537or pragma (@pxref{Function Specific Option Pragmas}). 18538 18539@end table 18540 18541These additional @samp{-m} options are available for the Altera Nios II 18542ELF (bare-metal) target: 18543 18544@table @gcctabopt 18545 18546@item -mhal 18547@opindex mhal 18548Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 18549startup and termination code, and is typically used in conjunction with 18550@option{-msys-crt0=} to specify the location of the alternate startup code 18551provided by the HAL BSP. 18552 18553@item -msmallc 18554@opindex msmallc 18555Link with a limited version of the C library, @option{-lsmallc}, rather than 18556Newlib. 18557 18558@item -msys-crt0=@var{startfile} 18559@opindex msys-crt0 18560@var{startfile} is the file name of the startfile (crt0) to use 18561when linking. This option is only useful in conjunction with @option{-mhal}. 18562 18563@item -msys-lib=@var{systemlib} 18564@opindex msys-lib 18565@var{systemlib} is the library name of the library that provides 18566low-level system calls required by the C library, 18567e.g. @code{read} and @code{write}. 18568This option is typically used to link with a library provided by a HAL BSP. 18569 18570@end table 18571 18572@node Nvidia PTX Options 18573@subsection Nvidia PTX Options 18574@cindex Nvidia PTX options 18575@cindex nvptx options 18576 18577These options are defined for Nvidia PTX: 18578 18579@table @gcctabopt 18580 18581@item -m32 18582@itemx -m64 18583@opindex m32 18584@opindex m64 18585Generate code for 32-bit or 64-bit ABI. 18586 18587@item -mmainkernel 18588@opindex mmainkernel 18589Link in code for a __main kernel. This is for stand-alone instead of 18590offloading execution. 18591 18592@end table 18593 18594@node PDP-11 Options 18595@subsection PDP-11 Options 18596@cindex PDP-11 Options 18597 18598These options are defined for the PDP-11: 18599 18600@table @gcctabopt 18601@item -mfpu 18602@opindex mfpu 18603Use hardware FPP floating point. This is the default. (FIS floating 18604point on the PDP-11/40 is not supported.) 18605 18606@item -msoft-float 18607@opindex msoft-float 18608Do not use hardware floating point. 18609 18610@item -mac0 18611@opindex mac0 18612Return floating-point results in ac0 (fr0 in Unix assembler syntax). 18613 18614@item -mno-ac0 18615@opindex mno-ac0 18616Return floating-point results in memory. This is the default. 18617 18618@item -m40 18619@opindex m40 18620Generate code for a PDP-11/40. 18621 18622@item -m45 18623@opindex m45 18624Generate code for a PDP-11/45. This is the default. 18625 18626@item -m10 18627@opindex m10 18628Generate code for a PDP-11/10. 18629 18630@item -mbcopy-builtin 18631@opindex mbcopy-builtin 18632Use inline @code{movmemhi} patterns for copying memory. This is the 18633default. 18634 18635@item -mbcopy 18636@opindex mbcopy 18637Do not use inline @code{movmemhi} patterns for copying memory. 18638 18639@item -mint16 18640@itemx -mno-int32 18641@opindex mint16 18642@opindex mno-int32 18643Use 16-bit @code{int}. This is the default. 18644 18645@item -mint32 18646@itemx -mno-int16 18647@opindex mint32 18648@opindex mno-int16 18649Use 32-bit @code{int}. 18650 18651@item -mfloat64 18652@itemx -mno-float32 18653@opindex mfloat64 18654@opindex mno-float32 18655Use 64-bit @code{float}. This is the default. 18656 18657@item -mfloat32 18658@itemx -mno-float64 18659@opindex mfloat32 18660@opindex mno-float64 18661Use 32-bit @code{float}. 18662 18663@item -mabshi 18664@opindex mabshi 18665Use @code{abshi2} pattern. This is the default. 18666 18667@item -mno-abshi 18668@opindex mno-abshi 18669Do not use @code{abshi2} pattern. 18670 18671@item -mbranch-expensive 18672@opindex mbranch-expensive 18673Pretend that branches are expensive. This is for experimenting with 18674code generation only. 18675 18676@item -mbranch-cheap 18677@opindex mbranch-cheap 18678Do not pretend that branches are expensive. This is the default. 18679 18680@item -munix-asm 18681@opindex munix-asm 18682Use Unix assembler syntax. This is the default when configured for 18683@samp{pdp11-*-bsd}. 18684 18685@item -mdec-asm 18686@opindex mdec-asm 18687Use DEC assembler syntax. This is the default when configured for any 18688PDP-11 target other than @samp{pdp11-*-bsd}. 18689@end table 18690 18691@node picoChip Options 18692@subsection picoChip Options 18693@cindex picoChip options 18694 18695These @samp{-m} options are defined for picoChip implementations: 18696 18697@table @gcctabopt 18698 18699@item -mae=@var{ae_type} 18700@opindex mcpu 18701Set the instruction set, register set, and instruction scheduling 18702parameters for array element type @var{ae_type}. Supported values 18703for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 18704 18705@option{-mae=ANY} selects a completely generic AE type. Code 18706generated with this option runs on any of the other AE types. The 18707code is not as efficient as it would be if compiled for a specific 18708AE type, and some types of operation (e.g., multiplication) do not 18709work properly on all types of AE. 18710 18711@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 18712for compiled code, and is the default. 18713 18714@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 18715option may suffer from poor performance of byte (char) manipulation, 18716since the DSP AE does not provide hardware support for byte load/stores. 18717 18718@item -msymbol-as-address 18719Enable the compiler to directly use a symbol name as an address in a 18720load/store instruction, without first loading it into a 18721register. Typically, the use of this option generates larger 18722programs, which run faster than when the option isn't used. However, the 18723results vary from program to program, so it is left as a user option, 18724rather than being permanently enabled. 18725 18726@item -mno-inefficient-warnings 18727Disables warnings about the generation of inefficient code. These 18728warnings can be generated, for example, when compiling code that 18729performs byte-level memory operations on the MAC AE type. The MAC AE has 18730no hardware support for byte-level memory operations, so all byte 18731load/stores must be synthesized from word load/store operations. This is 18732inefficient and a warning is generated to indicate 18733that you should rewrite the code to avoid byte operations, or to target 18734an AE type that has the necessary hardware support. This option disables 18735these warnings. 18736 18737@end table 18738 18739@node PowerPC Options 18740@subsection PowerPC Options 18741@cindex PowerPC options 18742 18743These are listed under @xref{RS/6000 and PowerPC Options}. 18744 18745@node RL78 Options 18746@subsection RL78 Options 18747@cindex RL78 Options 18748 18749@table @gcctabopt 18750 18751@item -msim 18752@opindex msim 18753Links in additional target libraries to support operation within a 18754simulator. 18755 18756@item -mmul=none 18757@itemx -mmul=g13 18758@itemx -mmul=rl78 18759@opindex mmul 18760Specifies the type of hardware multiplication support to be used. The 18761default is @samp{none}, which uses software multiplication functions. 18762The @samp{g13} option is for the hardware multiply/divide peripheral 18763only on the RL78/G13 targets. The @samp{rl78} option is for the 18764standard hardware multiplication defined in the RL78 software manual. 18765 18766@item -m64bit-doubles 18767@itemx -m32bit-doubles 18768@opindex m64bit-doubles 18769@opindex m32bit-doubles 18770Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 18771or 32 bits (@option{-m32bit-doubles}) in size. The default is 18772@option{-m32bit-doubles}. 18773 18774@end table 18775 18776@node RS/6000 and PowerPC Options 18777@subsection IBM RS/6000 and PowerPC Options 18778@cindex RS/6000 and PowerPC Options 18779@cindex IBM RS/6000 and PowerPC Options 18780 18781These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 18782@table @gcctabopt 18783@item -mpowerpc-gpopt 18784@itemx -mno-powerpc-gpopt 18785@itemx -mpowerpc-gfxopt 18786@itemx -mno-powerpc-gfxopt 18787@need 800 18788@itemx -mpowerpc64 18789@itemx -mno-powerpc64 18790@itemx -mmfcrf 18791@itemx -mno-mfcrf 18792@itemx -mpopcntb 18793@itemx -mno-popcntb 18794@itemx -mpopcntd 18795@itemx -mno-popcntd 18796@itemx -mfprnd 18797@itemx -mno-fprnd 18798@need 800 18799@itemx -mcmpb 18800@itemx -mno-cmpb 18801@itemx -mmfpgpr 18802@itemx -mno-mfpgpr 18803@itemx -mhard-dfp 18804@itemx -mno-hard-dfp 18805@opindex mpowerpc-gpopt 18806@opindex mno-powerpc-gpopt 18807@opindex mpowerpc-gfxopt 18808@opindex mno-powerpc-gfxopt 18809@opindex mpowerpc64 18810@opindex mno-powerpc64 18811@opindex mmfcrf 18812@opindex mno-mfcrf 18813@opindex mpopcntb 18814@opindex mno-popcntb 18815@opindex mpopcntd 18816@opindex mno-popcntd 18817@opindex mfprnd 18818@opindex mno-fprnd 18819@opindex mcmpb 18820@opindex mno-cmpb 18821@opindex mmfpgpr 18822@opindex mno-mfpgpr 18823@opindex mhard-dfp 18824@opindex mno-hard-dfp 18825You use these options to specify which instructions are available on the 18826processor you are using. The default value of these options is 18827determined when configuring GCC@. Specifying the 18828@option{-mcpu=@var{cpu_type}} overrides the specification of these 18829options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 18830rather than the options listed above. 18831 18832Specifying @option{-mpowerpc-gpopt} allows 18833GCC to use the optional PowerPC architecture instructions in the 18834General Purpose group, including floating-point square root. Specifying 18835@option{-mpowerpc-gfxopt} allows GCC to 18836use the optional PowerPC architecture instructions in the Graphics 18837group, including floating-point select. 18838 18839The @option{-mmfcrf} option allows GCC to generate the move from 18840condition register field instruction implemented on the POWER4 18841processor and other processors that support the PowerPC V2.01 18842architecture. 18843The @option{-mpopcntb} option allows GCC to generate the popcount and 18844double-precision FP reciprocal estimate instruction implemented on the 18845POWER5 processor and other processors that support the PowerPC V2.02 18846architecture. 18847The @option{-mpopcntd} option allows GCC to generate the popcount 18848instruction implemented on the POWER7 processor and other processors 18849that support the PowerPC V2.06 architecture. 18850The @option{-mfprnd} option allows GCC to generate the FP round to 18851integer instructions implemented on the POWER5+ processor and other 18852processors that support the PowerPC V2.03 architecture. 18853The @option{-mcmpb} option allows GCC to generate the compare bytes 18854instruction implemented on the POWER6 processor and other processors 18855that support the PowerPC V2.05 architecture. 18856The @option{-mmfpgpr} option allows GCC to generate the FP move to/from 18857general-purpose register instructions implemented on the POWER6X 18858processor and other processors that support the extended PowerPC V2.05 18859architecture. 18860The @option{-mhard-dfp} option allows GCC to generate the decimal 18861floating-point instructions implemented on some POWER processors. 18862 18863The @option{-mpowerpc64} option allows GCC to generate the additional 1886464-bit instructions that are found in the full PowerPC64 architecture 18865and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 18866@option{-mno-powerpc64}. 18867 18868@item -mcpu=@var{cpu_type} 18869@opindex mcpu 18870Set architecture type, register usage, and 18871instruction scheduling parameters for machine type @var{cpu_type}. 18872Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 18873@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 18874@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 18875@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 18876@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 18877@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 18878@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 18879@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 18880@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 18881@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc}, 18882@samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}. 18883 18884@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 18885@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 18886endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 18887architecture machine types, with an appropriate, generic processor 18888model assumed for scheduling purposes. 18889 18890The other options specify a specific processor. Code generated under 18891those options runs best on that processor, and may not run at all on 18892others. 18893 18894The @option{-mcpu} options automatically enable or disable the 18895following options: 18896 18897@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 18898-mpopcntb -mpopcntd -mpowerpc64 @gol 18899-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol 18900-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol 18901-mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol 18902-mquad-memory -mquad-memory-atomic} 18903 18904The particular options set for any particular CPU varies between 18905compiler versions, depending on what setting seems to produce optimal 18906code for that CPU; it doesn't necessarily reflect the actual hardware's 18907capabilities. If you wish to set an individual option to a particular 18908value, you may specify it after the @option{-mcpu} option, like 18909@option{-mcpu=970 -mno-altivec}. 18910 18911On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 18912not enabled or disabled by the @option{-mcpu} option at present because 18913AIX does not have full support for these options. You may still 18914enable or disable them individually if you're sure it'll work in your 18915environment. 18916 18917@item -mtune=@var{cpu_type} 18918@opindex mtune 18919Set the instruction scheduling parameters for machine type 18920@var{cpu_type}, but do not set the architecture type or register usage, 18921as @option{-mcpu=@var{cpu_type}} does. The same 18922values for @var{cpu_type} are used for @option{-mtune} as for 18923@option{-mcpu}. If both are specified, the code generated uses the 18924architecture and registers set by @option{-mcpu}, but the 18925scheduling parameters set by @option{-mtune}. 18926 18927@item -mcmodel=small 18928@opindex mcmodel=small 18929Generate PowerPC64 code for the small model: The TOC is limited to 1893064k. 18931 18932@item -mcmodel=medium 18933@opindex mcmodel=medium 18934Generate PowerPC64 code for the medium model: The TOC and other static 18935data may be up to a total of 4G in size. 18936 18937@item -mcmodel=large 18938@opindex mcmodel=large 18939Generate PowerPC64 code for the large model: The TOC may be up to 4G 18940in size. Other data and code is only limited by the 64-bit address 18941space. 18942 18943@item -maltivec 18944@itemx -mno-altivec 18945@opindex maltivec 18946@opindex mno-altivec 18947Generate code that uses (does not use) AltiVec instructions, and also 18948enable the use of built-in functions that allow more direct access to 18949the AltiVec instruction set. You may also need to set 18950@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 18951enhancements. 18952 18953When @option{-maltivec} is used, rather than @option{-maltivec=le} or 18954@option{-maltivec=be}, the element order for Altivec intrinsics such 18955as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 18956match array element order corresponding to the endianness of the 18957target. That is, element zero identifies the leftmost element in a 18958vector register when targeting a big-endian platform, and identifies 18959the rightmost element in a vector register when targeting a 18960little-endian platform. 18961 18962@item -maltivec=be 18963@opindex maltivec=be 18964Generate Altivec instructions using big-endian element order, 18965regardless of whether the target is big- or little-endian. This is 18966the default when targeting a big-endian platform. 18967 18968The element order is used to interpret element numbers in Altivec 18969intrinsics such as @code{vec_splat}, @code{vec_extract}, and 18970@code{vec_insert}. By default, these match array element order 18971corresponding to the endianness for the target. 18972 18973@item -maltivec=le 18974@opindex maltivec=le 18975Generate Altivec instructions using little-endian element order, 18976regardless of whether the target is big- or little-endian. This is 18977the default when targeting a little-endian platform. This option is 18978currently ignored when targeting a big-endian platform. 18979 18980The element order is used to interpret element numbers in Altivec 18981intrinsics such as @code{vec_splat}, @code{vec_extract}, and 18982@code{vec_insert}. By default, these match array element order 18983corresponding to the endianness for the target. 18984 18985@item -mvrsave 18986@itemx -mno-vrsave 18987@opindex mvrsave 18988@opindex mno-vrsave 18989Generate VRSAVE instructions when generating AltiVec code. 18990 18991@item -mgen-cell-microcode 18992@opindex mgen-cell-microcode 18993Generate Cell microcode instructions. 18994 18995@item -mwarn-cell-microcode 18996@opindex mwarn-cell-microcode 18997Warn when a Cell microcode instruction is emitted. An example 18998of a Cell microcode instruction is a variable shift. 18999 19000@item -msecure-plt 19001@opindex msecure-plt 19002Generate code that allows @command{ld} and @command{ld.so} 19003to build executables and shared 19004libraries with non-executable @code{.plt} and @code{.got} sections. 19005This is a PowerPC 1900632-bit SYSV ABI option. 19007 19008@item -mbss-plt 19009@opindex mbss-plt 19010Generate code that uses a BSS @code{.plt} section that @command{ld.so} 19011fills in, and 19012requires @code{.plt} and @code{.got} 19013sections that are both writable and executable. 19014This is a PowerPC 32-bit SYSV ABI option. 19015 19016@item -misel 19017@itemx -mno-isel 19018@opindex misel 19019@opindex mno-isel 19020This switch enables or disables the generation of ISEL instructions. 19021 19022@item -misel=@var{yes/no} 19023This switch has been deprecated. Use @option{-misel} and 19024@option{-mno-isel} instead. 19025 19026@item -mspe 19027@itemx -mno-spe 19028@opindex mspe 19029@opindex mno-spe 19030This switch enables or disables the generation of SPE simd 19031instructions. 19032 19033@item -mpaired 19034@itemx -mno-paired 19035@opindex mpaired 19036@opindex mno-paired 19037This switch enables or disables the generation of PAIRED simd 19038instructions. 19039 19040@item -mspe=@var{yes/no} 19041This option has been deprecated. Use @option{-mspe} and 19042@option{-mno-spe} instead. 19043 19044@item -mvsx 19045@itemx -mno-vsx 19046@opindex mvsx 19047@opindex mno-vsx 19048Generate code that uses (does not use) vector/scalar (VSX) 19049instructions, and also enable the use of built-in functions that allow 19050more direct access to the VSX instruction set. 19051 19052@item -mcrypto 19053@itemx -mno-crypto 19054@opindex mcrypto 19055@opindex mno-crypto 19056Enable the use (disable) of the built-in functions that allow direct 19057access to the cryptographic instructions that were added in version 190582.07 of the PowerPC ISA. 19059 19060@item -mdirect-move 19061@itemx -mno-direct-move 19062@opindex mdirect-move 19063@opindex mno-direct-move 19064Generate code that uses (does not use) the instructions to move data 19065between the general purpose registers and the vector/scalar (VSX) 19066registers that were added in version 2.07 of the PowerPC ISA. 19067 19068@item -mpower8-fusion 19069@itemx -mno-power8-fusion 19070@opindex mpower8-fusion 19071@opindex mno-power8-fusion 19072Generate code that keeps (does not keeps) some integer operations 19073adjacent so that the instructions can be fused together on power8 and 19074later processors. 19075 19076@item -mpower8-vector 19077@itemx -mno-power8-vector 19078@opindex mpower8-vector 19079@opindex mno-power8-vector 19080Generate code that uses (does not use) the vector and scalar 19081instructions that were added in version 2.07 of the PowerPC ISA. Also 19082enable the use of built-in functions that allow more direct access to 19083the vector instructions. 19084 19085@item -mquad-memory 19086@itemx -mno-quad-memory 19087@opindex mquad-memory 19088@opindex mno-quad-memory 19089Generate code that uses (does not use) the non-atomic quad word memory 19090instructions. The @option{-mquad-memory} option requires use of 1909164-bit mode. 19092 19093@item -mquad-memory-atomic 19094@itemx -mno-quad-memory-atomic 19095@opindex mquad-memory-atomic 19096@opindex mno-quad-memory-atomic 19097Generate code that uses (does not use) the atomic quad word memory 19098instructions. The @option{-mquad-memory-atomic} option requires use of 1909964-bit mode. 19100 19101@item -mupper-regs-df 19102@itemx -mno-upper-regs-df 19103@opindex mupper-regs-df 19104@opindex mno-upper-regs-df 19105Generate code that uses (does not use) the scalar double precision 19106instructions that target all 64 registers in the vector/scalar 19107floating point register set that were added in version 2.06 of the 19108PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you 19109use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or 19110@option{-mvsx} options. 19111 19112@item -mupper-regs-sf 19113@itemx -mno-upper-regs-sf 19114@opindex mupper-regs-sf 19115@opindex mno-upper-regs-sf 19116Generate code that uses (does not use) the scalar single precision 19117instructions that target all 64 registers in the vector/scalar 19118floating point register set that were added in version 2.07 of the 19119PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you 19120use either of the @option{-mcpu=power8} or @option{-mpower8-vector} 19121options. 19122 19123@item -mupper-regs 19124@itemx -mno-upper-regs 19125@opindex mupper-regs 19126@opindex mno-upper-regs 19127Generate code that uses (does not use) the scalar 19128instructions that target all 64 registers in the vector/scalar 19129floating point register set, depending on the model of the machine. 19130 19131If the @option{-mno-upper-regs} option is used, it turns off both 19132@option{-mupper-regs-sf} and @option{-mupper-regs-df} options. 19133 19134@item -mfloat-gprs=@var{yes/single/double/no} 19135@itemx -mfloat-gprs 19136@opindex mfloat-gprs 19137This switch enables or disables the generation of floating-point 19138operations on the general-purpose registers for architectures that 19139support it. 19140 19141The argument @samp{yes} or @samp{single} enables the use of 19142single-precision floating-point operations. 19143 19144The argument @samp{double} enables the use of single and 19145double-precision floating-point operations. 19146 19147The argument @samp{no} disables floating-point operations on the 19148general-purpose registers. 19149 19150This option is currently only available on the MPC854x. 19151 19152@item -m32 19153@itemx -m64 19154@opindex m32 19155@opindex m64 19156Generate code for 32-bit or 64-bit environments of Darwin and SVR4 19157targets (including GNU/Linux). The 32-bit environment sets int, long 19158and pointer to 32 bits and generates code that runs on any PowerPC 19159variant. The 64-bit environment sets int to 32 bits and long and 19160pointer to 64 bits, and generates code for PowerPC64, as for 19161@option{-mpowerpc64}. 19162 19163@item -mfull-toc 19164@itemx -mno-fp-in-toc 19165@itemx -mno-sum-in-toc 19166@itemx -mminimal-toc 19167@opindex mfull-toc 19168@opindex mno-fp-in-toc 19169@opindex mno-sum-in-toc 19170@opindex mminimal-toc 19171Modify generation of the TOC (Table Of Contents), which is created for 19172every executable file. The @option{-mfull-toc} option is selected by 19173default. In that case, GCC allocates at least one TOC entry for 19174each unique non-automatic variable reference in your program. GCC 19175also places floating-point constants in the TOC@. However, only 1917616,384 entries are available in the TOC@. 19177 19178If you receive a linker error message that saying you have overflowed 19179the available TOC space, you can reduce the amount of TOC space used 19180with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 19181@option{-mno-fp-in-toc} prevents GCC from putting floating-point 19182constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 19183generate code to calculate the sum of an address and a constant at 19184run time instead of putting that sum into the TOC@. You may specify one 19185or both of these options. Each causes GCC to produce very slightly 19186slower and larger code at the expense of conserving TOC space. 19187 19188If you still run out of space in the TOC even when you specify both of 19189these options, specify @option{-mminimal-toc} instead. This option causes 19190GCC to make only one TOC entry for every file. When you specify this 19191option, GCC produces code that is slower and larger but which 19192uses extremely little TOC space. You may wish to use this option 19193only on files that contain less frequently-executed code. 19194 19195@item -maix64 19196@itemx -maix32 19197@opindex maix64 19198@opindex maix32 19199Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 19200@code{long} type, and the infrastructure needed to support them. 19201Specifying @option{-maix64} implies @option{-mpowerpc64}, 19202while @option{-maix32} disables the 64-bit ABI and 19203implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 19204 19205@item -mxl-compat 19206@itemx -mno-xl-compat 19207@opindex mxl-compat 19208@opindex mno-xl-compat 19209Produce code that conforms more closely to IBM XL compiler semantics 19210when using AIX-compatible ABI@. Pass floating-point arguments to 19211prototyped functions beyond the register save area (RSA) on the stack 19212in addition to argument FPRs. Do not assume that most significant 19213double in 128-bit long double value is properly rounded when comparing 19214values and converting to double. Use XL symbol names for long double 19215support routines. 19216 19217The AIX calling convention was extended but not initially documented to 19218handle an obscure K&R C case of calling a function that takes the 19219address of its arguments with fewer arguments than declared. IBM XL 19220compilers access floating-point arguments that do not fit in the 19221RSA from the stack when a subroutine is compiled without 19222optimization. Because always storing floating-point arguments on the 19223stack is inefficient and rarely needed, this option is not enabled by 19224default and only is necessary when calling subroutines compiled by IBM 19225XL compilers without optimization. 19226 19227@item -mpe 19228@opindex mpe 19229Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 19230application written to use message passing with special startup code to 19231enable the application to run. The system must have PE installed in the 19232standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 19233must be overridden with the @option{-specs=} option to specify the 19234appropriate directory location. The Parallel Environment does not 19235support threads, so the @option{-mpe} option and the @option{-pthread} 19236option are incompatible. 19237 19238@item -malign-natural 19239@itemx -malign-power 19240@opindex malign-natural 19241@opindex malign-power 19242On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 19243@option{-malign-natural} overrides the ABI-defined alignment of larger 19244types, such as floating-point doubles, on their natural size-based boundary. 19245The option @option{-malign-power} instructs GCC to follow the ABI-specified 19246alignment rules. GCC defaults to the standard alignment defined in the ABI@. 19247 19248On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 19249is not supported. 19250 19251@item -msoft-float 19252@itemx -mhard-float 19253@opindex msoft-float 19254@opindex mhard-float 19255Generate code that does not use (uses) the floating-point register set. 19256Software floating-point emulation is provided if you use the 19257@option{-msoft-float} option, and pass the option to GCC when linking. 19258 19259@item -msingle-float 19260@itemx -mdouble-float 19261@opindex msingle-float 19262@opindex mdouble-float 19263Generate code for single- or double-precision floating-point operations. 19264@option{-mdouble-float} implies @option{-msingle-float}. 19265 19266@item -msimple-fpu 19267@opindex msimple-fpu 19268Do not generate @code{sqrt} and @code{div} instructions for hardware 19269floating-point unit. 19270 19271@item -mfpu=@var{name} 19272@opindex mfpu 19273Specify type of floating-point unit. Valid values for @var{name} are 19274@samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}), 19275@samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}), 19276@samp{sp_full} (equivalent to @option{-msingle-float}), 19277and @samp{dp_full} (equivalent to @option{-mdouble-float}). 19278 19279@item -mxilinx-fpu 19280@opindex mxilinx-fpu 19281Perform optimizations for the floating-point unit on Xilinx PPC 405/440. 19282 19283@item -mmultiple 19284@itemx -mno-multiple 19285@opindex mmultiple 19286@opindex mno-multiple 19287Generate code that uses (does not use) the load multiple word 19288instructions and the store multiple word instructions. These 19289instructions are generated by default on POWER systems, and not 19290generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 19291PowerPC systems, since those instructions do not work when the 19292processor is in little-endian mode. The exceptions are PPC740 and 19293PPC750 which permit these instructions in little-endian mode. 19294 19295@item -mstring 19296@itemx -mno-string 19297@opindex mstring 19298@opindex mno-string 19299Generate code that uses (does not use) the load string instructions 19300and the store string word instructions to save multiple registers and 19301do small block moves. These instructions are generated by default on 19302POWER systems, and not generated on PowerPC systems. Do not use 19303@option{-mstring} on little-endian PowerPC systems, since those 19304instructions do not work when the processor is in little-endian mode. 19305The exceptions are PPC740 and PPC750 which permit these instructions 19306in little-endian mode. 19307 19308@item -mupdate 19309@itemx -mno-update 19310@opindex mupdate 19311@opindex mno-update 19312Generate code that uses (does not use) the load or store instructions 19313that update the base register to the address of the calculated memory 19314location. These instructions are generated by default. If you use 19315@option{-mno-update}, there is a small window between the time that the 19316stack pointer is updated and the address of the previous frame is 19317stored, which means code that walks the stack frame across interrupts or 19318signals may get corrupted data. 19319 19320@item -mavoid-indexed-addresses 19321@itemx -mno-avoid-indexed-addresses 19322@opindex mavoid-indexed-addresses 19323@opindex mno-avoid-indexed-addresses 19324Generate code that tries to avoid (not avoid) the use of indexed load 19325or store instructions. These instructions can incur a performance 19326penalty on Power6 processors in certain situations, such as when 19327stepping through large arrays that cross a 16M boundary. This option 19328is enabled by default when targeting Power6 and disabled otherwise. 19329 19330@item -mfused-madd 19331@itemx -mno-fused-madd 19332@opindex mfused-madd 19333@opindex mno-fused-madd 19334Generate code that uses (does not use) the floating-point multiply and 19335accumulate instructions. These instructions are generated by default 19336if hardware floating point is used. The machine-dependent 19337@option{-mfused-madd} option is now mapped to the machine-independent 19338@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 19339mapped to @option{-ffp-contract=off}. 19340 19341@item -mmulhw 19342@itemx -mno-mulhw 19343@opindex mmulhw 19344@opindex mno-mulhw 19345Generate code that uses (does not use) the half-word multiply and 19346multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 19347These instructions are generated by default when targeting those 19348processors. 19349 19350@item -mdlmzb 19351@itemx -mno-dlmzb 19352@opindex mdlmzb 19353@opindex mno-dlmzb 19354Generate code that uses (does not use) the string-search @samp{dlmzb} 19355instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 19356generated by default when targeting those processors. 19357 19358@item -mno-bit-align 19359@itemx -mbit-align 19360@opindex mno-bit-align 19361@opindex mbit-align 19362On System V.4 and embedded PowerPC systems do not (do) force structures 19363and unions that contain bit-fields to be aligned to the base type of the 19364bit-field. 19365 19366For example, by default a structure containing nothing but 8 19367@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 19368boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 19369the structure is aligned to a 1-byte boundary and is 1 byte in 19370size. 19371 19372@item -mno-strict-align 19373@itemx -mstrict-align 19374@opindex mno-strict-align 19375@opindex mstrict-align 19376On System V.4 and embedded PowerPC systems do not (do) assume that 19377unaligned memory references are handled by the system. 19378 19379@item -mrelocatable 19380@itemx -mno-relocatable 19381@opindex mrelocatable 19382@opindex mno-relocatable 19383Generate code that allows (does not allow) a static executable to be 19384relocated to a different address at run time. A simple embedded 19385PowerPC system loader should relocate the entire contents of 19386@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 19387a table of 32-bit addresses generated by this option. For this to 19388work, all objects linked together must be compiled with 19389@option{-mrelocatable} or @option{-mrelocatable-lib}. 19390@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 19391 19392@item -mrelocatable-lib 19393@itemx -mno-relocatable-lib 19394@opindex mrelocatable-lib 19395@opindex mno-relocatable-lib 19396Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 19397@code{.fixup} section to allow static executables to be relocated at 19398run time, but @option{-mrelocatable-lib} does not use the smaller stack 19399alignment of @option{-mrelocatable}. Objects compiled with 19400@option{-mrelocatable-lib} may be linked with objects compiled with 19401any combination of the @option{-mrelocatable} options. 19402 19403@item -mno-toc 19404@itemx -mtoc 19405@opindex mno-toc 19406@opindex mtoc 19407On System V.4 and embedded PowerPC systems do not (do) assume that 19408register 2 contains a pointer to a global area pointing to the addresses 19409used in the program. 19410 19411@item -mlittle 19412@itemx -mlittle-endian 19413@opindex mlittle 19414@opindex mlittle-endian 19415On System V.4 and embedded PowerPC systems compile code for the 19416processor in little-endian mode. The @option{-mlittle-endian} option is 19417the same as @option{-mlittle}. 19418 19419@item -mbig 19420@itemx -mbig-endian 19421@opindex mbig 19422@opindex mbig-endian 19423On System V.4 and embedded PowerPC systems compile code for the 19424processor in big-endian mode. The @option{-mbig-endian} option is 19425the same as @option{-mbig}. 19426 19427@item -mdynamic-no-pic 19428@opindex mdynamic-no-pic 19429On Darwin and Mac OS X systems, compile code so that it is not 19430relocatable, but that its external references are relocatable. The 19431resulting code is suitable for applications, but not shared 19432libraries. 19433 19434@item -msingle-pic-base 19435@opindex msingle-pic-base 19436Treat the register used for PIC addressing as read-only, rather than 19437loading it in the prologue for each function. The runtime system is 19438responsible for initializing this register with an appropriate value 19439before execution begins. 19440 19441@item -mprioritize-restricted-insns=@var{priority} 19442@opindex mprioritize-restricted-insns 19443This option controls the priority that is assigned to 19444dispatch-slot restricted instructions during the second scheduling 19445pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 19446or @samp{2} to assign no, highest, or second-highest (respectively) 19447priority to dispatch-slot restricted 19448instructions. 19449 19450@item -msched-costly-dep=@var{dependence_type} 19451@opindex msched-costly-dep 19452This option controls which dependences are considered costly 19453by the target during instruction scheduling. The argument 19454@var{dependence_type} takes one of the following values: 19455 19456@table @asis 19457@item @samp{no} 19458No dependence is costly. 19459 19460@item @samp{all} 19461All dependences are costly. 19462 19463@item @samp{true_store_to_load} 19464A true dependence from store to load is costly. 19465 19466@item @samp{store_to_load} 19467Any dependence from store to load is costly. 19468 19469@item @var{number} 19470Any dependence for which the latency is greater than or equal to 19471@var{number} is costly. 19472@end table 19473 19474@item -minsert-sched-nops=@var{scheme} 19475@opindex minsert-sched-nops 19476This option controls which NOP insertion scheme is used during 19477the second scheduling pass. The argument @var{scheme} takes one of the 19478following values: 19479 19480@table @asis 19481@item @samp{no} 19482Don't insert NOPs. 19483 19484@item @samp{pad} 19485Pad with NOPs any dispatch group that has vacant issue slots, 19486according to the scheduler's grouping. 19487 19488@item @samp{regroup_exact} 19489Insert NOPs to force costly dependent insns into 19490separate groups. Insert exactly as many NOPs as needed to force an insn 19491to a new group, according to the estimated processor grouping. 19492 19493@item @var{number} 19494Insert NOPs to force costly dependent insns into 19495separate groups. Insert @var{number} NOPs to force an insn to a new group. 19496@end table 19497 19498@item -mcall-sysv 19499@opindex mcall-sysv 19500On System V.4 and embedded PowerPC systems compile code using calling 19501conventions that adhere to the March 1995 draft of the System V 19502Application Binary Interface, PowerPC processor supplement. This is the 19503default unless you configured GCC using @samp{powerpc-*-eabiaix}. 19504 19505@item -mcall-sysv-eabi 19506@itemx -mcall-eabi 19507@opindex mcall-sysv-eabi 19508@opindex mcall-eabi 19509Specify both @option{-mcall-sysv} and @option{-meabi} options. 19510 19511@item -mcall-sysv-noeabi 19512@opindex mcall-sysv-noeabi 19513Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 19514 19515@item -mcall-aixdesc 19516@opindex m 19517On System V.4 and embedded PowerPC systems compile code for the AIX 19518operating system. 19519 19520@item -mcall-linux 19521@opindex mcall-linux 19522On System V.4 and embedded PowerPC systems compile code for the 19523Linux-based GNU system. 19524 19525@item -mcall-freebsd 19526@opindex mcall-freebsd 19527On System V.4 and embedded PowerPC systems compile code for the 19528FreeBSD operating system. 19529 19530@item -mcall-netbsd 19531@opindex mcall-netbsd 19532On System V.4 and embedded PowerPC systems compile code for the 19533NetBSD operating system. 19534 19535@item -mcall-openbsd 19536@opindex mcall-netbsd 19537On System V.4 and embedded PowerPC systems compile code for the 19538OpenBSD operating system. 19539 19540@item -maix-struct-return 19541@opindex maix-struct-return 19542Return all structures in memory (as specified by the AIX ABI)@. 19543 19544@item -msvr4-struct-return 19545@opindex msvr4-struct-return 19546Return structures smaller than 8 bytes in registers (as specified by the 19547SVR4 ABI)@. 19548 19549@item -mabi=@var{abi-type} 19550@opindex mabi 19551Extend the current ABI with a particular extension, or remove such extension. 19552Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe}, 19553@samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble}, 19554@samp{elfv1}, @samp{elfv2}@. 19555 19556@item -mabi=spe 19557@opindex mabi=spe 19558Extend the current ABI with SPE ABI extensions. This does not change 19559the default ABI, instead it adds the SPE ABI extensions to the current 19560ABI@. 19561 19562@item -mabi=no-spe 19563@opindex mabi=no-spe 19564Disable Book-E SPE ABI extensions for the current ABI@. 19565 19566@item -mabi=ibmlongdouble 19567@opindex mabi=ibmlongdouble 19568Change the current ABI to use IBM extended-precision long double. 19569This is a PowerPC 32-bit SYSV ABI option. 19570 19571@item -mabi=ieeelongdouble 19572@opindex mabi=ieeelongdouble 19573Change the current ABI to use IEEE extended-precision long double. 19574This is a PowerPC 32-bit Linux ABI option. 19575 19576@item -mabi=elfv1 19577@opindex mabi=elfv1 19578Change the current ABI to use the ELFv1 ABI. 19579This is the default ABI for big-endian PowerPC 64-bit Linux. 19580Overriding the default ABI requires special system support and is 19581likely to fail in spectacular ways. 19582 19583@item -mabi=elfv2 19584@opindex mabi=elfv2 19585Change the current ABI to use the ELFv2 ABI. 19586This is the default ABI for little-endian PowerPC 64-bit Linux. 19587Overriding the default ABI requires special system support and is 19588likely to fail in spectacular ways. 19589 19590@item -mprototype 19591@itemx -mno-prototype 19592@opindex mprototype 19593@opindex mno-prototype 19594On System V.4 and embedded PowerPC systems assume that all calls to 19595variable argument functions are properly prototyped. Otherwise, the 19596compiler must insert an instruction before every non-prototyped call to 19597set or clear bit 6 of the condition code register (@code{CR}) to 19598indicate whether floating-point values are passed in the floating-point 19599registers in case the function takes variable arguments. With 19600@option{-mprototype}, only calls to prototyped variable argument functions 19601set or clear the bit. 19602 19603@item -msim 19604@opindex msim 19605On embedded PowerPC systems, assume that the startup module is called 19606@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 19607@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 19608configurations. 19609 19610@item -mmvme 19611@opindex mmvme 19612On embedded PowerPC systems, assume that the startup module is called 19613@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 19614@file{libc.a}. 19615 19616@item -mads 19617@opindex mads 19618On embedded PowerPC systems, assume that the startup module is called 19619@file{crt0.o} and the standard C libraries are @file{libads.a} and 19620@file{libc.a}. 19621 19622@item -myellowknife 19623@opindex myellowknife 19624On embedded PowerPC systems, assume that the startup module is called 19625@file{crt0.o} and the standard C libraries are @file{libyk.a} and 19626@file{libc.a}. 19627 19628@item -mvxworks 19629@opindex mvxworks 19630On System V.4 and embedded PowerPC systems, specify that you are 19631compiling for a VxWorks system. 19632 19633@item -memb 19634@opindex memb 19635On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 19636header to indicate that @samp{eabi} extended relocations are used. 19637 19638@item -meabi 19639@itemx -mno-eabi 19640@opindex meabi 19641@opindex mno-eabi 19642On System V.4 and embedded PowerPC systems do (do not) adhere to the 19643Embedded Applications Binary Interface (EABI), which is a set of 19644modifications to the System V.4 specifications. Selecting @option{-meabi} 19645means that the stack is aligned to an 8-byte boundary, a function 19646@code{__eabi} is called from @code{main} to set up the EABI 19647environment, and the @option{-msdata} option can use both @code{r2} and 19648@code{r13} to point to two separate small data areas. Selecting 19649@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 19650no EABI initialization function is called from @code{main}, and the 19651@option{-msdata} option only uses @code{r13} to point to a single 19652small data area. The @option{-meabi} option is on by default if you 19653configured GCC using one of the @samp{powerpc*-*-eabi*} options. 19654 19655@item -msdata=eabi 19656@opindex msdata=eabi 19657On System V.4 and embedded PowerPC systems, put small initialized 19658@code{const} global and static data in the @code{.sdata2} section, which 19659is pointed to by register @code{r2}. Put small initialized 19660non-@code{const} global and static data in the @code{.sdata} section, 19661which is pointed to by register @code{r13}. Put small uninitialized 19662global and static data in the @code{.sbss} section, which is adjacent to 19663the @code{.sdata} section. The @option{-msdata=eabi} option is 19664incompatible with the @option{-mrelocatable} option. The 19665@option{-msdata=eabi} option also sets the @option{-memb} option. 19666 19667@item -msdata=sysv 19668@opindex msdata=sysv 19669On System V.4 and embedded PowerPC systems, put small global and static 19670data in the @code{.sdata} section, which is pointed to by register 19671@code{r13}. Put small uninitialized global and static data in the 19672@code{.sbss} section, which is adjacent to the @code{.sdata} section. 19673The @option{-msdata=sysv} option is incompatible with the 19674@option{-mrelocatable} option. 19675 19676@item -msdata=default 19677@itemx -msdata 19678@opindex msdata=default 19679@opindex msdata 19680On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 19681compile code the same as @option{-msdata=eabi}, otherwise compile code the 19682same as @option{-msdata=sysv}. 19683 19684@item -msdata=data 19685@opindex msdata=data 19686On System V.4 and embedded PowerPC systems, put small global 19687data in the @code{.sdata} section. Put small uninitialized global 19688data in the @code{.sbss} section. Do not use register @code{r13} 19689to address small data however. This is the default behavior unless 19690other @option{-msdata} options are used. 19691 19692@item -msdata=none 19693@itemx -mno-sdata 19694@opindex msdata=none 19695@opindex mno-sdata 19696On embedded PowerPC systems, put all initialized global and static data 19697in the @code{.data} section, and all uninitialized data in the 19698@code{.bss} section. 19699 19700@item -mblock-move-inline-limit=@var{num} 19701@opindex mblock-move-inline-limit 19702Inline all block moves (such as calls to @code{memcpy} or structure 19703copies) less than or equal to @var{num} bytes. The minimum value for 19704@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 19705targets. The default value is target-specific. 19706 19707@item -G @var{num} 19708@opindex G 19709@cindex smaller data references (PowerPC) 19710@cindex .sdata/.sdata2 references (PowerPC) 19711On embedded PowerPC systems, put global and static items less than or 19712equal to @var{num} bytes into the small data or BSS sections instead of 19713the normal data or BSS section. By default, @var{num} is 8. The 19714@option{-G @var{num}} switch is also passed to the linker. 19715All modules should be compiled with the same @option{-G @var{num}} value. 19716 19717@item -mregnames 19718@itemx -mno-regnames 19719@opindex mregnames 19720@opindex mno-regnames 19721On System V.4 and embedded PowerPC systems do (do not) emit register 19722names in the assembly language output using symbolic forms. 19723 19724@item -mlongcall 19725@itemx -mno-longcall 19726@opindex mlongcall 19727@opindex mno-longcall 19728By default assume that all calls are far away so that a longer and more 19729expensive calling sequence is required. This is required for calls 19730farther than 32 megabytes (33,554,432 bytes) from the current location. 19731A short call is generated if the compiler knows 19732the call cannot be that far away. This setting can be overridden by 19733the @code{shortcall} function attribute, or by @code{#pragma 19734longcall(0)}. 19735 19736Some linkers are capable of detecting out-of-range calls and generating 19737glue code on the fly. On these systems, long calls are unnecessary and 19738generate slower code. As of this writing, the AIX linker can do this, 19739as can the GNU linker for PowerPC/64. It is planned to add this feature 19740to the GNU linker for 32-bit PowerPC systems as well. 19741 19742On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 19743callee, L42}, plus a @dfn{branch island} (glue code). The two target 19744addresses represent the callee and the branch island. The 19745Darwin/PPC linker prefers the first address and generates a @code{bl 19746callee} if the PPC @code{bl} instruction reaches the callee directly; 19747otherwise, the linker generates @code{bl L42} to call the branch 19748island. The branch island is appended to the body of the 19749calling function; it computes the full 32-bit address of the callee 19750and jumps to it. 19751 19752On Mach-O (Darwin) systems, this option directs the compiler emit to 19753the glue for every direct call, and the Darwin linker decides whether 19754to use or discard it. 19755 19756In the future, GCC may ignore all longcall specifications 19757when the linker is known to generate glue. 19758 19759@item -mtls-markers 19760@itemx -mno-tls-markers 19761@opindex mtls-markers 19762@opindex mno-tls-markers 19763Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 19764specifying the function argument. The relocation allows the linker to 19765reliably associate function call with argument setup instructions for 19766TLS optimization, which in turn allows GCC to better schedule the 19767sequence. 19768 19769@item -pthread 19770@opindex pthread 19771Adds support for multithreading with the @dfn{pthreads} library. 19772This option sets flags for both the preprocessor and linker. 19773 19774@item -mrecip 19775@itemx -mno-recip 19776@opindex mrecip 19777This option enables use of the reciprocal estimate and 19778reciprocal square root estimate instructions with additional 19779Newton-Raphson steps to increase precision instead of doing a divide or 19780square root and divide for floating-point arguments. You should use 19781the @option{-ffast-math} option when using @option{-mrecip} (or at 19782least @option{-funsafe-math-optimizations}, 19783@option{-finite-math-only}, @option{-freciprocal-math} and 19784@option{-fno-trapping-math}). Note that while the throughput of the 19785sequence is generally higher than the throughput of the non-reciprocal 19786instruction, the precision of the sequence can be decreased by up to 2 19787ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 19788roots. 19789 19790@item -mrecip=@var{opt} 19791@opindex mrecip=opt 19792This option controls which reciprocal estimate instructions 19793may be used. @var{opt} is a comma-separated list of options, which may 19794be preceded by a @code{!} to invert the option: 19795 19796@table @samp 19797 19798@item all 19799Enable all estimate instructions. 19800 19801@item default 19802Enable the default instructions, equivalent to @option{-mrecip}. 19803 19804@item none 19805Disable all estimate instructions, equivalent to @option{-mno-recip}. 19806 19807@item div 19808Enable the reciprocal approximation instructions for both 19809single and double precision. 19810 19811@item divf 19812Enable the single-precision reciprocal approximation instructions. 19813 19814@item divd 19815Enable the double-precision reciprocal approximation instructions. 19816 19817@item rsqrt 19818Enable the reciprocal square root approximation instructions for both 19819single and double precision. 19820 19821@item rsqrtf 19822Enable the single-precision reciprocal square root approximation instructions. 19823 19824@item rsqrtd 19825Enable the double-precision reciprocal square root approximation instructions. 19826 19827@end table 19828 19829So, for example, @option{-mrecip=all,!rsqrtd} enables 19830all of the reciprocal estimate instructions, except for the 19831@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 19832which handle the double-precision reciprocal square root calculations. 19833 19834@item -mrecip-precision 19835@itemx -mno-recip-precision 19836@opindex mrecip-precision 19837Assume (do not assume) that the reciprocal estimate instructions 19838provide higher-precision estimates than is mandated by the PowerPC 19839ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 19840@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 19841The double-precision square root estimate instructions are not generated by 19842default on low-precision machines, since they do not provide an 19843estimate that converges after three steps. 19844 19845@item -mveclibabi=@var{type} 19846@opindex mveclibabi 19847Specifies the ABI type to use for vectorizing intrinsics using an 19848external library. The only type supported at present is @samp{mass}, 19849which specifies to use IBM's Mathematical Acceleration Subsystem 19850(MASS) libraries for vectorizing intrinsics using external libraries. 19851GCC currently emits calls to @code{acosd2}, @code{acosf4}, 19852@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 19853@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 19854@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 19855@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 19856@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 19857@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 19858@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 19859@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 19860@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 19861@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 19862@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 19863@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 19864@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 19865for power7. Both @option{-ftree-vectorize} and 19866@option{-funsafe-math-optimizations} must also be enabled. The MASS 19867libraries must be specified at link time. 19868 19869@item -mfriz 19870@itemx -mno-friz 19871@opindex mfriz 19872Generate (do not generate) the @code{friz} instruction when the 19873@option{-funsafe-math-optimizations} option is used to optimize 19874rounding of floating-point values to 64-bit integer and back to floating 19875point. The @code{friz} instruction does not return the same value if 19876the floating-point number is too large to fit in an integer. 19877 19878@item -mpointers-to-nested-functions 19879@itemx -mno-pointers-to-nested-functions 19880@opindex mpointers-to-nested-functions 19881Generate (do not generate) code to load up the static chain register 19882(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 19883systems where a function pointer points to a 3-word descriptor giving 19884the function address, TOC value to be loaded in register @code{r2}, and 19885static chain value to be loaded in register @code{r11}. The 19886@option{-mpointers-to-nested-functions} is on by default. You cannot 19887call through pointers to nested functions or pointers 19888to functions compiled in other languages that use the static chain if 19889you use @option{-mno-pointers-to-nested-functions}. 19890 19891@item -msave-toc-indirect 19892@itemx -mno-save-toc-indirect 19893@opindex msave-toc-indirect 19894Generate (do not generate) code to save the TOC value in the reserved 19895stack location in the function prologue if the function calls through 19896a pointer on AIX and 64-bit Linux systems. If the TOC value is not 19897saved in the prologue, it is saved just before the call through the 19898pointer. The @option{-mno-save-toc-indirect} option is the default. 19899 19900@item -mcompat-align-parm 19901@itemx -mno-compat-align-parm 19902@opindex mcompat-align-parm 19903Generate (do not generate) code to pass structure parameters with a 19904maximum alignment of 64 bits, for compatibility with older versions 19905of GCC. 19906 19907Older versions of GCC (prior to 4.9.0) incorrectly did not align a 19908structure parameter on a 128-bit boundary when that structure contained 19909a member requiring 128-bit alignment. This is corrected in more 19910recent versions of GCC. This option may be used to generate code 19911that is compatible with functions compiled with older versions of 19912GCC. 19913 19914The @option{-mno-compat-align-parm} option is the default. 19915@end table 19916 19917@node RX Options 19918@subsection RX Options 19919@cindex RX Options 19920 19921These command-line options are defined for RX targets: 19922 19923@table @gcctabopt 19924@item -m64bit-doubles 19925@itemx -m32bit-doubles 19926@opindex m64bit-doubles 19927@opindex m32bit-doubles 19928Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 19929or 32 bits (@option{-m32bit-doubles}) in size. The default is 19930@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 19931works on 32-bit values, which is why the default is 19932@option{-m32bit-doubles}. 19933 19934@item -fpu 19935@itemx -nofpu 19936@opindex fpu 19937@opindex nofpu 19938Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 19939floating-point hardware. The default is enabled for the RX600 19940series and disabled for the RX200 series. 19941 19942Floating-point instructions are only generated for 32-bit floating-point 19943values, however, so the FPU hardware is not used for doubles if the 19944@option{-m64bit-doubles} option is used. 19945 19946@emph{Note} If the @option{-fpu} option is enabled then 19947@option{-funsafe-math-optimizations} is also enabled automatically. 19948This is because the RX FPU instructions are themselves unsafe. 19949 19950@item -mcpu=@var{name} 19951@opindex mcpu 19952Selects the type of RX CPU to be targeted. Currently three types are 19953supported, the generic @samp{RX600} and @samp{RX200} series hardware and 19954the specific @samp{RX610} CPU. The default is @samp{RX600}. 19955 19956The only difference between @samp{RX600} and @samp{RX610} is that the 19957@samp{RX610} does not support the @code{MVTIPL} instruction. 19958 19959The @samp{RX200} series does not have a hardware floating-point unit 19960and so @option{-nofpu} is enabled by default when this type is 19961selected. 19962 19963@item -mbig-endian-data 19964@itemx -mlittle-endian-data 19965@opindex mbig-endian-data 19966@opindex mlittle-endian-data 19967Store data (but not code) in the big-endian format. The default is 19968@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 19969format. 19970 19971@item -msmall-data-limit=@var{N} 19972@opindex msmall-data-limit 19973Specifies the maximum size in bytes of global and static variables 19974which can be placed into the small data area. Using the small data 19975area can lead to smaller and faster code, but the size of area is 19976limited and it is up to the programmer to ensure that the area does 19977not overflow. Also when the small data area is used one of the RX's 19978registers (usually @code{r13}) is reserved for use pointing to this 19979area, so it is no longer available for use by the compiler. This 19980could result in slower and/or larger code if variables are pushed onto 19981the stack instead of being held in this register. 19982 19983Note, common variables (variables that have not been initialized) and 19984constants are not placed into the small data area as they are assigned 19985to other sections in the output executable. 19986 19987The default value is zero, which disables this feature. Note, this 19988feature is not enabled by default with higher optimization levels 19989(@option{-O2} etc) because of the potentially detrimental effects of 19990reserving a register. It is up to the programmer to experiment and 19991discover whether this feature is of benefit to their program. See the 19992description of the @option{-mpid} option for a description of how the 19993actual register to hold the small data area pointer is chosen. 19994 19995@item -msim 19996@itemx -mno-sim 19997@opindex msim 19998@opindex mno-sim 19999Use the simulator runtime. The default is to use the libgloss 20000board-specific runtime. 20001 20002@item -mas100-syntax 20003@itemx -mno-as100-syntax 20004@opindex mas100-syntax 20005@opindex mno-as100-syntax 20006When generating assembler output use a syntax that is compatible with 20007Renesas's AS100 assembler. This syntax can also be handled by the GAS 20008assembler, but it has some restrictions so it is not generated by default. 20009 20010@item -mmax-constant-size=@var{N} 20011@opindex mmax-constant-size 20012Specifies the maximum size, in bytes, of a constant that can be used as 20013an operand in a RX instruction. Although the RX instruction set does 20014allow constants of up to 4 bytes in length to be used in instructions, 20015a longer value equates to a longer instruction. Thus in some 20016circumstances it can be beneficial to restrict the size of constants 20017that are used in instructions. Constants that are too big are instead 20018placed into a constant pool and referenced via register indirection. 20019 20020The value @var{N} can be between 0 and 4. A value of 0 (the default) 20021or 4 means that constants of any size are allowed. 20022 20023@item -mrelax 20024@opindex mrelax 20025Enable linker relaxation. Linker relaxation is a process whereby the 20026linker attempts to reduce the size of a program by finding shorter 20027versions of various instructions. Disabled by default. 20028 20029@item -mint-register=@var{N} 20030@opindex mint-register 20031Specify the number of registers to reserve for fast interrupt handler 20032functions. The value @var{N} can be between 0 and 4. A value of 1 20033means that register @code{r13} is reserved for the exclusive use 20034of fast interrupt handlers. A value of 2 reserves @code{r13} and 20035@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 20036@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 20037A value of 0, the default, does not reserve any registers. 20038 20039@item -msave-acc-in-interrupts 20040@opindex msave-acc-in-interrupts 20041Specifies that interrupt handler functions should preserve the 20042accumulator register. This is only necessary if normal code might use 20043the accumulator register, for example because it performs 64-bit 20044multiplications. The default is to ignore the accumulator as this 20045makes the interrupt handlers faster. 20046 20047@item -mpid 20048@itemx -mno-pid 20049@opindex mpid 20050@opindex mno-pid 20051Enables the generation of position independent data. When enabled any 20052access to constant data is done via an offset from a base address 20053held in a register. This allows the location of constant data to be 20054determined at run time without requiring the executable to be 20055relocated, which is a benefit to embedded applications with tight 20056memory constraints. Data that can be modified is not affected by this 20057option. 20058 20059Note, using this feature reserves a register, usually @code{r13}, for 20060the constant data base address. This can result in slower and/or 20061larger code, especially in complicated functions. 20062 20063The actual register chosen to hold the constant data base address 20064depends upon whether the @option{-msmall-data-limit} and/or the 20065@option{-mint-register} command-line options are enabled. Starting 20066with register @code{r13} and proceeding downwards, registers are 20067allocated first to satisfy the requirements of @option{-mint-register}, 20068then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 20069is possible for the small data area register to be @code{r8} if both 20070@option{-mint-register=4} and @option{-mpid} are specified on the 20071command line. 20072 20073By default this feature is not enabled. The default can be restored 20074via the @option{-mno-pid} command-line option. 20075 20076@item -mno-warn-multiple-fast-interrupts 20077@itemx -mwarn-multiple-fast-interrupts 20078@opindex mno-warn-multiple-fast-interrupts 20079@opindex mwarn-multiple-fast-interrupts 20080Prevents GCC from issuing a warning message if it finds more than one 20081fast interrupt handler when it is compiling a file. The default is to 20082issue a warning for each extra fast interrupt handler found, as the RX 20083only supports one such interrupt. 20084 20085@end table 20086 20087@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 20088has special significance to the RX port when used with the 20089@code{interrupt} function attribute. This attribute indicates a 20090function intended to process fast interrupts. GCC ensures 20091that it only uses the registers @code{r10}, @code{r11}, @code{r12} 20092and/or @code{r13} and only provided that the normal use of the 20093corresponding registers have been restricted via the 20094@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 20095options. 20096 20097@node S/390 and zSeries Options 20098@subsection S/390 and zSeries Options 20099@cindex S/390 and zSeries Options 20100 20101These are the @samp{-m} options defined for the S/390 and zSeries architecture. 20102 20103@table @gcctabopt 20104@item -mhard-float 20105@itemx -msoft-float 20106@opindex mhard-float 20107@opindex msoft-float 20108Use (do not use) the hardware floating-point instructions and registers 20109for floating-point operations. When @option{-msoft-float} is specified, 20110functions in @file{libgcc.a} are used to perform floating-point 20111operations. When @option{-mhard-float} is specified, the compiler 20112generates IEEE floating-point instructions. This is the default. 20113 20114@item -mhard-dfp 20115@itemx -mno-hard-dfp 20116@opindex mhard-dfp 20117@opindex mno-hard-dfp 20118Use (do not use) the hardware decimal-floating-point instructions for 20119decimal-floating-point operations. When @option{-mno-hard-dfp} is 20120specified, functions in @file{libgcc.a} are used to perform 20121decimal-floating-point operations. When @option{-mhard-dfp} is 20122specified, the compiler generates decimal-floating-point hardware 20123instructions. This is the default for @option{-march=z9-ec} or higher. 20124 20125@item -mlong-double-64 20126@itemx -mlong-double-128 20127@opindex mlong-double-64 20128@opindex mlong-double-128 20129These switches control the size of @code{long double} type. A size 20130of 64 bits makes the @code{long double} type equivalent to the @code{double} 20131type. This is the default. 20132 20133@item -mbackchain 20134@itemx -mno-backchain 20135@opindex mbackchain 20136@opindex mno-backchain 20137Store (do not store) the address of the caller's frame as backchain pointer 20138into the callee's stack frame. 20139A backchain may be needed to allow debugging using tools that do not understand 20140DWARF 2 call frame information. 20141When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 20142at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 20143the backchain is placed into the topmost word of the 96/160 byte register 20144save area. 20145 20146In general, code compiled with @option{-mbackchain} is call-compatible with 20147code compiled with @option{-mmo-backchain}; however, use of the backchain 20148for debugging purposes usually requires that the whole binary is built with 20149@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 20150@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 20151to build a linux kernel use @option{-msoft-float}. 20152 20153The default is to not maintain the backchain. 20154 20155@item -mpacked-stack 20156@itemx -mno-packed-stack 20157@opindex mpacked-stack 20158@opindex mno-packed-stack 20159Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 20160specified, the compiler uses the all fields of the 96/160 byte register save 20161area only for their default purpose; unused fields still take up stack space. 20162When @option{-mpacked-stack} is specified, register save slots are densely 20163packed at the top of the register save area; unused space is reused for other 20164purposes, allowing for more efficient use of the available stack space. 20165However, when @option{-mbackchain} is also in effect, the topmost word of 20166the save area is always used to store the backchain, and the return address 20167register is always saved two words below the backchain. 20168 20169As long as the stack frame backchain is not used, code generated with 20170@option{-mpacked-stack} is call-compatible with code generated with 20171@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 20172S/390 or zSeries generated code that uses the stack frame backchain at run 20173time, not just for debugging purposes. Such code is not call-compatible 20174with code compiled with @option{-mpacked-stack}. Also, note that the 20175combination of @option{-mbackchain}, 20176@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 20177to build a linux kernel use @option{-msoft-float}. 20178 20179The default is to not use the packed stack layout. 20180 20181@item -msmall-exec 20182@itemx -mno-small-exec 20183@opindex msmall-exec 20184@opindex mno-small-exec 20185Generate (or do not generate) code using the @code{bras} instruction 20186to do subroutine calls. 20187This only works reliably if the total executable size does not 20188exceed 64k. The default is to use the @code{basr} instruction instead, 20189which does not have this limitation. 20190 20191@item -m64 20192@itemx -m31 20193@opindex m64 20194@opindex m31 20195When @option{-m31} is specified, generate code compliant to the 20196GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 20197code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 20198particular to generate 64-bit instructions. For the @samp{s390} 20199targets, the default is @option{-m31}, while the @samp{s390x} 20200targets default to @option{-m64}. 20201 20202@item -mzarch 20203@itemx -mesa 20204@opindex mzarch 20205@opindex mesa 20206When @option{-mzarch} is specified, generate code using the 20207instructions available on z/Architecture. 20208When @option{-mesa} is specified, generate code using the 20209instructions available on ESA/390. Note that @option{-mesa} is 20210not possible with @option{-m64}. 20211When generating code compliant to the GNU/Linux for S/390 ABI, 20212the default is @option{-mesa}. When generating code compliant 20213to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 20214 20215@item -mmvcle 20216@itemx -mno-mvcle 20217@opindex mmvcle 20218@opindex mno-mvcle 20219Generate (or do not generate) code using the @code{mvcle} instruction 20220to perform block moves. When @option{-mno-mvcle} is specified, 20221use a @code{mvc} loop instead. This is the default unless optimizing for 20222size. 20223 20224@item -mdebug 20225@itemx -mno-debug 20226@opindex mdebug 20227@opindex mno-debug 20228Print (or do not print) additional debug information when compiling. 20229The default is to not print debug information. 20230 20231@item -march=@var{cpu-type} 20232@opindex march 20233Generate code that runs on @var{cpu-type}, which is the name of a system 20234representing a certain processor type. Possible values for 20235@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990}, 20236@samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, 20237and @samp{z13}. 20238When generating code using the instructions available on z/Architecture, 20239the default is @option{-march=z900}. Otherwise, the default is 20240@option{-march=g5}. 20241 20242@item -mtune=@var{cpu-type} 20243@opindex mtune 20244Tune to @var{cpu-type} everything applicable about the generated code, 20245except for the ABI and the set of available instructions. 20246The list of @var{cpu-type} values is the same as for @option{-march}. 20247The default is the value used for @option{-march}. 20248 20249@item -mtpf-trace 20250@itemx -mno-tpf-trace 20251@opindex mtpf-trace 20252@opindex mno-tpf-trace 20253Generate code that adds (does not add) in TPF OS specific branches to trace 20254routines in the operating system. This option is off by default, even 20255when compiling for the TPF OS@. 20256 20257@item -mfused-madd 20258@itemx -mno-fused-madd 20259@opindex mfused-madd 20260@opindex mno-fused-madd 20261Generate code that uses (does not use) the floating-point multiply and 20262accumulate instructions. These instructions are generated by default if 20263hardware floating point is used. 20264 20265@item -mwarn-framesize=@var{framesize} 20266@opindex mwarn-framesize 20267Emit a warning if the current function exceeds the given frame size. Because 20268this is a compile-time check it doesn't need to be a real problem when the program 20269runs. It is intended to identify functions that most probably cause 20270a stack overflow. It is useful to be used in an environment with limited stack 20271size e.g.@: the linux kernel. 20272 20273@item -mwarn-dynamicstack 20274@opindex mwarn-dynamicstack 20275Emit a warning if the function calls @code{alloca} or uses dynamically-sized 20276arrays. This is generally a bad idea with a limited stack size. 20277 20278@item -mstack-guard=@var{stack-guard} 20279@itemx -mstack-size=@var{stack-size} 20280@opindex mstack-guard 20281@opindex mstack-size 20282If these options are provided the S/390 back end emits additional instructions in 20283the function prologue that trigger a trap if the stack size is @var{stack-guard} 20284bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 20285If the @var{stack-guard} option is omitted the smallest power of 2 larger than 20286the frame size of the compiled function is chosen. 20287These options are intended to be used to help debugging stack overflow problems. 20288The additionally emitted code causes only little overhead and hence can also be 20289used in production-like systems without greater performance degradation. The given 20290values have to be exact powers of 2 and @var{stack-size} has to be greater than 20291@var{stack-guard} without exceeding 64k. 20292In order to be efficient the extra code makes the assumption that the stack starts 20293at an address aligned to the value given by @var{stack-size}. 20294The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 20295 20296@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 20297@opindex mhotpatch 20298If the hotpatch option is enabled, a ``hot-patching'' function 20299prologue is generated for all functions in the compilation unit. 20300The funtion label is prepended with the given number of two-byte 20301NOP instructions (@var{pre-halfwords}, maximum 1000000). After 20302the label, 2 * @var{post-halfwords} bytes are appended, using the 20303largest NOP like instructions the architecture allows (maximum 203041000000). 20305 20306If both arguments are zero, hotpatching is disabled. 20307 20308This option can be overridden for individual functions with the 20309@code{hotpatch} attribute. 20310@end table 20311 20312@node Score Options 20313@subsection Score Options 20314@cindex Score Options 20315 20316These options are defined for Score implementations: 20317 20318@table @gcctabopt 20319@item -meb 20320@opindex meb 20321Compile code for big-endian mode. This is the default. 20322 20323@item -mel 20324@opindex mel 20325Compile code for little-endian mode. 20326 20327@item -mnhwloop 20328@opindex mnhwloop 20329Disable generation of @code{bcnz} instructions. 20330 20331@item -muls 20332@opindex muls 20333Enable generation of unaligned load and store instructions. 20334 20335@item -mmac 20336@opindex mmac 20337Enable the use of multiply-accumulate instructions. Disabled by default. 20338 20339@item -mscore5 20340@opindex mscore5 20341Specify the SCORE5 as the target architecture. 20342 20343@item -mscore5u 20344@opindex mscore5u 20345Specify the SCORE5U of the target architecture. 20346 20347@item -mscore7 20348@opindex mscore7 20349Specify the SCORE7 as the target architecture. This is the default. 20350 20351@item -mscore7d 20352@opindex mscore7d 20353Specify the SCORE7D as the target architecture. 20354@end table 20355 20356@node SH Options 20357@subsection SH Options 20358 20359These @samp{-m} options are defined for the SH implementations: 20360 20361@table @gcctabopt 20362@item -m1 20363@opindex m1 20364Generate code for the SH1. 20365 20366@item -m2 20367@opindex m2 20368Generate code for the SH2. 20369 20370@item -m2e 20371Generate code for the SH2e. 20372 20373@item -m2a-nofpu 20374@opindex m2a-nofpu 20375Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 20376that the floating-point unit is not used. 20377 20378@item -m2a-single-only 20379@opindex m2a-single-only 20380Generate code for the SH2a-FPU, in such a way that no double-precision 20381floating-point operations are used. 20382 20383@item -m2a-single 20384@opindex m2a-single 20385Generate code for the SH2a-FPU assuming the floating-point unit is in 20386single-precision mode by default. 20387 20388@item -m2a 20389@opindex m2a 20390Generate code for the SH2a-FPU assuming the floating-point unit is in 20391double-precision mode by default. 20392 20393@item -m3 20394@opindex m3 20395Generate code for the SH3. 20396 20397@item -m3e 20398@opindex m3e 20399Generate code for the SH3e. 20400 20401@item -m4-nofpu 20402@opindex m4-nofpu 20403Generate code for the SH4 without a floating-point unit. 20404 20405@item -m4-single-only 20406@opindex m4-single-only 20407Generate code for the SH4 with a floating-point unit that only 20408supports single-precision arithmetic. 20409 20410@item -m4-single 20411@opindex m4-single 20412Generate code for the SH4 assuming the floating-point unit is in 20413single-precision mode by default. 20414 20415@item -m4 20416@opindex m4 20417Generate code for the SH4. 20418 20419@item -m4-100 20420@opindex m4-100 20421Generate code for SH4-100. 20422 20423@item -m4-100-nofpu 20424@opindex m4-100-nofpu 20425Generate code for SH4-100 in such a way that the 20426floating-point unit is not used. 20427 20428@item -m4-100-single 20429@opindex m4-100-single 20430Generate code for SH4-100 assuming the floating-point unit is in 20431single-precision mode by default. 20432 20433@item -m4-100-single-only 20434@opindex m4-100-single-only 20435Generate code for SH4-100 in such a way that no double-precision 20436floating-point operations are used. 20437 20438@item -m4-200 20439@opindex m4-200 20440Generate code for SH4-200. 20441 20442@item -m4-200-nofpu 20443@opindex m4-200-nofpu 20444Generate code for SH4-200 without in such a way that the 20445floating-point unit is not used. 20446 20447@item -m4-200-single 20448@opindex m4-200-single 20449Generate code for SH4-200 assuming the floating-point unit is in 20450single-precision mode by default. 20451 20452@item -m4-200-single-only 20453@opindex m4-200-single-only 20454Generate code for SH4-200 in such a way that no double-precision 20455floating-point operations are used. 20456 20457@item -m4-300 20458@opindex m4-300 20459Generate code for SH4-300. 20460 20461@item -m4-300-nofpu 20462@opindex m4-300-nofpu 20463Generate code for SH4-300 without in such a way that the 20464floating-point unit is not used. 20465 20466@item -m4-300-single 20467@opindex m4-300-single 20468Generate code for SH4-300 in such a way that no double-precision 20469floating-point operations are used. 20470 20471@item -m4-300-single-only 20472@opindex m4-300-single-only 20473Generate code for SH4-300 in such a way that no double-precision 20474floating-point operations are used. 20475 20476@item -m4-340 20477@opindex m4-340 20478Generate code for SH4-340 (no MMU, no FPU). 20479 20480@item -m4-500 20481@opindex m4-500 20482Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 20483assembler. 20484 20485@item -m4a-nofpu 20486@opindex m4a-nofpu 20487Generate code for the SH4al-dsp, or for a SH4a in such a way that the 20488floating-point unit is not used. 20489 20490@item -m4a-single-only 20491@opindex m4a-single-only 20492Generate code for the SH4a, in such a way that no double-precision 20493floating-point operations are used. 20494 20495@item -m4a-single 20496@opindex m4a-single 20497Generate code for the SH4a assuming the floating-point unit is in 20498single-precision mode by default. 20499 20500@item -m4a 20501@opindex m4a 20502Generate code for the SH4a. 20503 20504@item -m4al 20505@opindex m4al 20506Same as @option{-m4a-nofpu}, except that it implicitly passes 20507@option{-dsp} to the assembler. GCC doesn't generate any DSP 20508instructions at the moment. 20509 20510@item -m5-32media 20511@opindex m5-32media 20512Generate 32-bit code for SHmedia. 20513 20514@item -m5-32media-nofpu 20515@opindex m5-32media-nofpu 20516Generate 32-bit code for SHmedia in such a way that the 20517floating-point unit is not used. 20518 20519@item -m5-64media 20520@opindex m5-64media 20521Generate 64-bit code for SHmedia. 20522 20523@item -m5-64media-nofpu 20524@opindex m5-64media-nofpu 20525Generate 64-bit code for SHmedia in such a way that the 20526floating-point unit is not used. 20527 20528@item -m5-compact 20529@opindex m5-compact 20530Generate code for SHcompact. 20531 20532@item -m5-compact-nofpu 20533@opindex m5-compact-nofpu 20534Generate code for SHcompact in such a way that the 20535floating-point unit is not used. 20536 20537@item -mb 20538@opindex mb 20539Compile code for the processor in big-endian mode. 20540 20541@item -ml 20542@opindex ml 20543Compile code for the processor in little-endian mode. 20544 20545@item -mdalign 20546@opindex mdalign 20547Align doubles at 64-bit boundaries. Note that this changes the calling 20548conventions, and thus some functions from the standard C library do 20549not work unless you recompile it first with @option{-mdalign}. 20550 20551@item -mrelax 20552@opindex mrelax 20553Shorten some address references at link time, when possible; uses the 20554linker option @option{-relax}. 20555 20556@item -mbigtable 20557@opindex mbigtable 20558Use 32-bit offsets in @code{switch} tables. The default is to use 2055916-bit offsets. 20560 20561@item -mbitops 20562@opindex mbitops 20563Enable the use of bit manipulation instructions on SH2A. 20564 20565@item -mfmovd 20566@opindex mfmovd 20567Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 20568alignment constraints. 20569 20570@item -mrenesas 20571@opindex mrenesas 20572Comply with the calling conventions defined by Renesas. 20573 20574@item -mno-renesas 20575@opindex mno-renesas 20576Comply with the calling conventions defined for GCC before the Renesas 20577conventions were available. This option is the default for all 20578targets of the SH toolchain. 20579 20580@item -mnomacsave 20581@opindex mnomacsave 20582Mark the @code{MAC} register as call-clobbered, even if 20583@option{-mrenesas} is given. 20584 20585@item -mieee 20586@itemx -mno-ieee 20587@opindex mieee 20588@opindex mno-ieee 20589Control the IEEE compliance of floating-point comparisons, which affects the 20590handling of cases where the result of a comparison is unordered. By default 20591@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 20592enabled @option{-mno-ieee} is implicitly set, which results in faster 20593floating-point greater-equal and less-equal comparisons. The implcit settings 20594can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 20595 20596@item -minline-ic_invalidate 20597@opindex minline-ic_invalidate 20598Inline code to invalidate instruction cache entries after setting up 20599nested function trampolines. 20600This option has no effect if @option{-musermode} is in effect and the selected 20601code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi} 20602instruction. 20603If the selected code generation option does not allow the use of the @code{icbi} 20604instruction, and @option{-musermode} is not in effect, the inlined code 20605manipulates the instruction cache address array directly with an associative 20606write. This not only requires privileged mode at run time, but it also 20607fails if the cache line had been mapped via the TLB and has become unmapped. 20608 20609@item -misize 20610@opindex misize 20611Dump instruction size and location in the assembly code. 20612 20613@item -mpadstruct 20614@opindex mpadstruct 20615This option is deprecated. It pads structures to multiple of 4 bytes, 20616which is incompatible with the SH ABI@. 20617 20618@item -matomic-model=@var{model} 20619@opindex matomic-model=@var{model} 20620Sets the model of atomic operations and additional parameters as a comma 20621separated list. For details on the atomic built-in functions see 20622@ref{__atomic Builtins}. The following models and parameters are supported: 20623 20624@table @samp 20625 20626@item none 20627Disable compiler generated atomic sequences and emit library calls for atomic 20628operations. This is the default if the target is not @code{sh*-*-linux*}. 20629 20630@item soft-gusa 20631Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 20632built-in functions. The generated atomic sequences require additional support 20633from the interrupt/exception handling code of the system and are only suitable 20634for SH3* and SH4* single-core systems. This option is enabled by default when 20635the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 20636this option also partially utilizes the hardware atomic instructions 20637@code{movli.l} and @code{movco.l} to create more efficient code, unless 20638@samp{strict} is specified. 20639 20640@item soft-tcb 20641Generate software atomic sequences that use a variable in the thread control 20642block. This is a variation of the gUSA sequences which can also be used on 20643SH1* and SH2* targets. The generated atomic sequences require additional 20644support from the interrupt/exception handling code of the system and are only 20645suitable for single-core systems. When using this model, the @samp{gbr-offset=} 20646parameter has to be specified as well. 20647 20648@item soft-imask 20649Generate software atomic sequences that temporarily disable interrupts by 20650setting @code{SR.IMASK = 1111}. This model works only when the program runs 20651in privileged mode and is only suitable for single-core systems. Additional 20652support from the interrupt/exception handling code of the system is not 20653required. This model is enabled by default when the target is 20654@code{sh*-*-linux*} and SH1* or SH2*. 20655 20656@item hard-llcs 20657Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 20658instructions only. This is only available on SH4A and is suitable for 20659multi-core systems. Since the hardware instructions support only 32 bit atomic 20660variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 20661Code compiled with this option is also compatible with other software 20662atomic model interrupt/exception handling systems if executed on an SH4A 20663system. Additional support from the interrupt/exception handling code of the 20664system is not required for this model. 20665 20666@item gbr-offset= 20667This parameter specifies the offset in bytes of the variable in the thread 20668control block structure that should be used by the generated atomic sequences 20669when the @samp{soft-tcb} model has been selected. For other models this 20670parameter is ignored. The specified value must be an integer multiple of four 20671and in the range 0-1020. 20672 20673@item strict 20674This parameter prevents mixed usage of multiple atomic models, even if they 20675are compatible, and makes the compiler generate atomic sequences of the 20676specified model only. 20677 20678@end table 20679 20680@item -mtas 20681@opindex mtas 20682Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 20683Notice that depending on the particular hardware and software configuration 20684this can degrade overall performance due to the operand cache line flushes 20685that are implied by the @code{tas.b} instruction. On multi-core SH4A 20686processors the @code{tas.b} instruction must be used with caution since it 20687can result in data corruption for certain cache configurations. 20688 20689@item -mprefergot 20690@opindex mprefergot 20691When generating position-independent code, emit function calls using 20692the Global Offset Table instead of the Procedure Linkage Table. 20693 20694@item -musermode 20695@itemx -mno-usermode 20696@opindex musermode 20697@opindex mno-usermode 20698Don't allow (allow) the compiler generating privileged mode code. Specifying 20699@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 20700inlined code would not work in user mode. @option{-musermode} is the default 20701when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 20702@option{-musermode} has no effect, since there is no user mode. 20703 20704@item -multcost=@var{number} 20705@opindex multcost=@var{number} 20706Set the cost to assume for a multiply insn. 20707 20708@item -mdiv=@var{strategy} 20709@opindex mdiv=@var{strategy} 20710Set the division strategy to be used for integer division operations. 20711For SHmedia @var{strategy} can be one of: 20712 20713@table @samp 20714 20715@item fp 20716Performs the operation in floating point. This has a very high latency, 20717but needs only a few instructions, so it might be a good choice if 20718your code has enough easily-exploitable ILP to allow the compiler to 20719schedule the floating-point instructions together with other instructions. 20720Division by zero causes a floating-point exception. 20721 20722@item inv 20723Uses integer operations to calculate the inverse of the divisor, 20724and then multiplies the dividend with the inverse. This strategy allows 20725CSE and hoisting of the inverse calculation. Division by zero calculates 20726an unspecified result, but does not trap. 20727 20728@item inv:minlat 20729A variant of @samp{inv} where, if no CSE or hoisting opportunities 20730have been found, or if the entire operation has been hoisted to the same 20731place, the last stages of the inverse calculation are intertwined with the 20732final multiply to reduce the overall latency, at the expense of using a few 20733more instructions, and thus offering fewer scheduling opportunities with 20734other code. 20735 20736@item call 20737Calls a library function that usually implements the @samp{inv:minlat} 20738strategy. 20739This gives high code density for @code{m5-*media-nofpu} compilations. 20740 20741@item call2 20742Uses a different entry point of the same library function, where it 20743assumes that a pointer to a lookup table has already been set up, which 20744exposes the pointer load to CSE and code hoisting optimizations. 20745 20746@item inv:call 20747@itemx inv:call2 20748@itemx inv:fp 20749Use the @samp{inv} algorithm for initial 20750code generation, but if the code stays unoptimized, revert to the @samp{call}, 20751@samp{call2}, or @samp{fp} strategies, respectively. Note that the 20752potentially-trapping side effect of division by zero is carried by a 20753separate instruction, so it is possible that all the integer instructions 20754are hoisted out, but the marker for the side effect stays where it is. 20755A recombination to floating-point operations or a call is not possible 20756in that case. 20757 20758@item inv20u 20759@itemx inv20l 20760Variants of the @samp{inv:minlat} strategy. In the case 20761that the inverse calculation is not separated from the multiply, they speed 20762up division where the dividend fits into 20 bits (plus sign where applicable) 20763by inserting a test to skip a number of operations in this case; this test 20764slows down the case of larger dividends. @samp{inv20u} assumes the case of a such 20765a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely. 20766 20767@end table 20768 20769For targets other than SHmedia @var{strategy} can be one of: 20770 20771@table @samp 20772 20773@item call-div1 20774Calls a library function that uses the single-step division instruction 20775@code{div1} to perform the operation. Division by zero calculates an 20776unspecified result and does not trap. This is the default except for SH4, 20777SH2A and SHcompact. 20778 20779@item call-fp 20780Calls a library function that performs the operation in double precision 20781floating point. Division by zero causes a floating-point exception. This is 20782the default for SHcompact with FPU. Specifying this for targets that do not 20783have a double precision FPU defaults to @code{call-div1}. 20784 20785@item call-table 20786Calls a library function that uses a lookup table for small divisors and 20787the @code{div1} instruction with case distinction for larger divisors. Division 20788by zero calculates an unspecified result and does not trap. This is the default 20789for SH4. Specifying this for targets that do not have dynamic shift 20790instructions defaults to @code{call-div1}. 20791 20792@end table 20793 20794When a division strategy has not been specified the default strategy is 20795selected based on the current target. For SH2A the default strategy is to 20796use the @code{divs} and @code{divu} instructions instead of library function 20797calls. 20798 20799@item -maccumulate-outgoing-args 20800@opindex maccumulate-outgoing-args 20801Reserve space once for outgoing arguments in the function prologue rather 20802than around each call. Generally beneficial for performance and size. Also 20803needed for unwinding to avoid changing the stack frame around conditional code. 20804 20805@item -mdivsi3_libfunc=@var{name} 20806@opindex mdivsi3_libfunc=@var{name} 20807Set the name of the library function used for 32-bit signed division to 20808@var{name}. 20809This only affects the name used in the @samp{call} and @samp{inv:call} 20810division strategies, and the compiler still expects the same 20811sets of input/output/clobbered registers as if this option were not present. 20812 20813@item -mfixed-range=@var{register-range} 20814@opindex mfixed-range 20815Generate code treating the given register range as fixed registers. 20816A fixed register is one that the register allocator can not use. This is 20817useful when compiling kernel code. A register range is specified as 20818two registers separated by a dash. Multiple register ranges can be 20819specified separated by a comma. 20820 20821@item -mindexed-addressing 20822@opindex mindexed-addressing 20823Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 20824This is only safe if the hardware and/or OS implement 32-bit wrap-around 20825semantics for the indexed addressing mode. The architecture allows the 20826implementation of processors with 64-bit MMU, which the OS could use to 20827get 32-bit addressing, but since no current hardware implementation supports 20828this or any other way to make the indexed addressing mode safe to use in 20829the 32-bit ABI, the default is @option{-mno-indexed-addressing}. 20830 20831@item -mgettrcost=@var{number} 20832@opindex mgettrcost=@var{number} 20833Set the cost assumed for the @code{gettr} instruction to @var{number}. 20834The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 20835 20836@item -mpt-fixed 20837@opindex mpt-fixed 20838Assume @code{pt*} instructions won't trap. This generally generates 20839better-scheduled code, but is unsafe on current hardware. 20840The current architecture 20841definition says that @code{ptabs} and @code{ptrel} trap when the target 20842anded with 3 is 3. 20843This has the unintentional effect of making it unsafe to schedule these 20844instructions before a branch, or hoist them out of a loop. For example, 20845@code{__do_global_ctors}, a part of @file{libgcc} 20846that runs constructors at program 20847startup, calls functions in a list which is delimited by @minus{}1. With the 20848@option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1. 20849That means that all the constructors run a bit more quickly, but when 20850the loop comes to the end of the list, the program crashes because @code{ptabs} 20851loads @minus{}1 into a target register. 20852 20853Since this option is unsafe for any 20854hardware implementing the current architecture specification, the default 20855is @option{-mno-pt-fixed}. Unless specified explicitly with 20856@option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100}; 20857this deters register allocation from using target registers for storing 20858ordinary integers. 20859 20860@item -minvalid-symbols 20861@opindex minvalid-symbols 20862Assume symbols might be invalid. Ordinary function symbols generated by 20863the compiler are always valid to load with 20864@code{movi}/@code{shori}/@code{ptabs} or 20865@code{movi}/@code{shori}/@code{ptrel}, 20866but with assembler and/or linker tricks it is possible 20867to generate symbols that cause @code{ptabs} or @code{ptrel} to trap. 20868This option is only meaningful when @option{-mno-pt-fixed} is in effect. 20869It prevents cross-basic-block CSE, hoisting and most scheduling 20870of symbol loads. The default is @option{-mno-invalid-symbols}. 20871 20872@item -mbranch-cost=@var{num} 20873@opindex mbranch-cost=@var{num} 20874Assume @var{num} to be the cost for a branch instruction. Higher numbers 20875make the compiler try to generate more branch-free code if possible. 20876If not specified the value is selected depending on the processor type that 20877is being compiled for. 20878 20879@item -mzdcbranch 20880@itemx -mno-zdcbranch 20881@opindex mzdcbranch 20882@opindex mno-zdcbranch 20883Assume (do not assume) that zero displacement conditional branch instructions 20884@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 20885compiler prefers zero displacement branch code sequences. This is 20886enabled by default when generating code for SH4 and SH4A. It can be explicitly 20887disabled by specifying @option{-mno-zdcbranch}. 20888 20889@item -mcbranch-force-delay-slot 20890@opindex mcbranch-force-delay-slot 20891Force the usage of delay slots for conditional branches, which stuffs the delay 20892slot with a @code{nop} if a suitable instruction can't be found. By default 20893this option is disabled. It can be enabled to work around hardware bugs as 20894found in the original SH7055. 20895 20896@item -mfused-madd 20897@itemx -mno-fused-madd 20898@opindex mfused-madd 20899@opindex mno-fused-madd 20900Generate code that uses (does not use) the floating-point multiply and 20901accumulate instructions. These instructions are generated by default 20902if hardware floating point is used. The machine-dependent 20903@option{-mfused-madd} option is now mapped to the machine-independent 20904@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 20905mapped to @option{-ffp-contract=off}. 20906 20907@item -mfsca 20908@itemx -mno-fsca 20909@opindex mfsca 20910@opindex mno-fsca 20911Allow or disallow the compiler to emit the @code{fsca} instruction for sine 20912and cosine approximations. The option @option{-mfsca} must be used in 20913combination with @option{-funsafe-math-optimizations}. It is enabled by default 20914when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 20915approximations even if @option{-funsafe-math-optimizations} is in effect. 20916 20917@item -mfsrra 20918@itemx -mno-fsrra 20919@opindex mfsrra 20920@opindex mno-fsrra 20921Allow or disallow the compiler to emit the @code{fsrra} instruction for 20922reciprocal square root approximations. The option @option{-mfsrra} must be used 20923in combination with @option{-funsafe-math-optimizations} and 20924@option{-ffinite-math-only}. It is enabled by default when generating code for 20925SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 20926even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 20927in effect. 20928 20929@item -mpretend-cmove 20930@opindex mpretend-cmove 20931Prefer zero-displacement conditional branches for conditional move instruction 20932patterns. This can result in faster code on the SH4 processor. 20933 20934@end table 20935 20936@node Solaris 2 Options 20937@subsection Solaris 2 Options 20938@cindex Solaris 2 options 20939 20940These @samp{-m} options are supported on Solaris 2: 20941 20942@table @gcctabopt 20943@item -mclear-hwcap 20944@opindex mclear-hwcap 20945@option{-mclear-hwcap} tells the compiler to remove the hardware 20946capabilities generated by the Solaris assembler. This is only necessary 20947when object files use ISA extensions not supported by the current 20948machine, but check at runtime whether or not to use them. 20949 20950@item -mimpure-text 20951@opindex mimpure-text 20952@option{-mimpure-text}, used in addition to @option{-shared}, tells 20953the compiler to not pass @option{-z text} to the linker when linking a 20954shared object. Using this option, you can link position-dependent 20955code into a shared object. 20956 20957@option{-mimpure-text} suppresses the ``relocations remain against 20958allocatable but non-writable sections'' linker error message. 20959However, the necessary relocations trigger copy-on-write, and the 20960shared object is not actually shared across processes. Instead of 20961using @option{-mimpure-text}, you should compile all source code with 20962@option{-fpic} or @option{-fPIC}. 20963 20964@end table 20965 20966These switches are supported in addition to the above on Solaris 2: 20967 20968@table @gcctabopt 20969@item -pthreads 20970@opindex pthreads 20971Add support for multithreading using the POSIX threads library. This 20972option sets flags for both the preprocessor and linker. This option does 20973not affect the thread safety of object code produced by the compiler or 20974that of libraries supplied with it. 20975 20976@item -pthread 20977@opindex pthread 20978This is a synonym for @option{-pthreads}. 20979@end table 20980 20981@node SPARC Options 20982@subsection SPARC Options 20983@cindex SPARC options 20984 20985These @samp{-m} options are supported on the SPARC: 20986 20987@table @gcctabopt 20988@item -mno-app-regs 20989@itemx -mapp-regs 20990@opindex mno-app-regs 20991@opindex mapp-regs 20992Specify @option{-mapp-regs} to generate output using the global registers 209932 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 20994global register 1, each global register 2 through 4 is then treated as an 20995allocable register that is clobbered by function calls. This is the default. 20996 20997To be fully SVR4 ABI-compliant at the cost of some performance loss, 20998specify @option{-mno-app-regs}. You should compile libraries and system 20999software with this option. 21000 21001@item -mflat 21002@itemx -mno-flat 21003@opindex mflat 21004@opindex mno-flat 21005With @option{-mflat}, the compiler does not generate save/restore instructions 21006and uses a ``flat'' or single register window model. This model is compatible 21007with the regular register window model. The local registers and the input 21008registers (0--5) are still treated as ``call-saved'' registers and are 21009saved on the stack as needed. 21010 21011With @option{-mno-flat} (the default), the compiler generates save/restore 21012instructions (except for leaf functions). This is the normal operating mode. 21013 21014@item -mfpu 21015@itemx -mhard-float 21016@opindex mfpu 21017@opindex mhard-float 21018Generate output containing floating-point instructions. This is the 21019default. 21020 21021@item -mno-fpu 21022@itemx -msoft-float 21023@opindex mno-fpu 21024@opindex msoft-float 21025Generate output containing library calls for floating point. 21026@strong{Warning:} the requisite libraries are not available for all SPARC 21027targets. Normally the facilities of the machine's usual C compiler are 21028used, but this cannot be done directly in cross-compilation. You must make 21029your own arrangements to provide suitable library functions for 21030cross-compilation. The embedded targets @samp{sparc-*-aout} and 21031@samp{sparclite-*-*} do provide software floating-point support. 21032 21033@option{-msoft-float} changes the calling convention in the output file; 21034therefore, it is only useful if you compile @emph{all} of a program with 21035this option. In particular, you need to compile @file{libgcc.a}, the 21036library that comes with GCC, with @option{-msoft-float} in order for 21037this to work. 21038 21039@item -mhard-quad-float 21040@opindex mhard-quad-float 21041Generate output containing quad-word (long double) floating-point 21042instructions. 21043 21044@item -msoft-quad-float 21045@opindex msoft-quad-float 21046Generate output containing library calls for quad-word (long double) 21047floating-point instructions. The functions called are those specified 21048in the SPARC ABI@. This is the default. 21049 21050As of this writing, there are no SPARC implementations that have hardware 21051support for the quad-word floating-point instructions. They all invoke 21052a trap handler for one of these instructions, and then the trap handler 21053emulates the effect of the instruction. Because of the trap handler overhead, 21054this is much slower than calling the ABI library routines. Thus the 21055@option{-msoft-quad-float} option is the default. 21056 21057@item -mno-unaligned-doubles 21058@itemx -munaligned-doubles 21059@opindex mno-unaligned-doubles 21060@opindex munaligned-doubles 21061Assume that doubles have 8-byte alignment. This is the default. 21062 21063With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 21064alignment only if they are contained in another type, or if they have an 21065absolute address. Otherwise, it assumes they have 4-byte alignment. 21066Specifying this option avoids some rare compatibility problems with code 21067generated by other compilers. It is not the default because it results 21068in a performance loss, especially for floating-point code. 21069 21070@item -muser-mode 21071@itemx -mno-user-mode 21072@opindex muser-mode 21073@opindex mno-user-mode 21074Do not generate code that can only run in supervisor mode. This is relevant 21075only for the @code{casa} instruction emitted for the LEON3 processor. This 21076is the default. 21077 21078@item -mno-faster-structs 21079@itemx -mfaster-structs 21080@opindex mno-faster-structs 21081@opindex mfaster-structs 21082With @option{-mfaster-structs}, the compiler assumes that structures 21083should have 8-byte alignment. This enables the use of pairs of 21084@code{ldd} and @code{std} instructions for copies in structure 21085assignment, in place of twice as many @code{ld} and @code{st} pairs. 21086However, the use of this changed alignment directly violates the SPARC 21087ABI@. Thus, it's intended only for use on targets where the developer 21088acknowledges that their resulting code is not directly in line with 21089the rules of the ABI@. 21090 21091@item -mcpu=@var{cpu_type} 21092@opindex mcpu 21093Set the instruction set, register set, and instruction scheduling parameters 21094for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 21095@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 21096@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 21097@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 21098@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 21099@samp{niagara3} and @samp{niagara4}. 21100 21101Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 21102which selects the best architecture option for the host processor. 21103@option{-mcpu=native} has no effect if GCC does not recognize 21104the processor. 21105 21106Default instruction scheduling parameters are used for values that select 21107an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 21108@samp{sparclite}, @samp{sparclet}, @samp{v9}. 21109 21110Here is a list of each supported architecture and their supported 21111implementations. 21112 21113@table @asis 21114@item v7 21115cypress, leon3v7 21116 21117@item v8 21118supersparc, hypersparc, leon, leon3 21119 21120@item sparclite 21121f930, f934, sparclite86x 21122 21123@item sparclet 21124tsc701 21125 21126@item v9 21127ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4 21128@end table 21129 21130By default (unless configured otherwise), GCC generates code for the V7 21131variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 21132additionally optimizes it for the Cypress CY7C602 chip, as used in the 21133SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 21134SPARCStation 1, 2, IPX etc. 21135 21136With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 21137architecture. The only difference from V7 code is that the compiler emits 21138the integer multiply and integer divide instructions which exist in SPARC-V8 21139but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 21140optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 211412000 series. 21142 21143With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 21144the SPARC architecture. This adds the integer multiply, integer divide step 21145and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 21146With @option{-mcpu=f930}, the compiler additionally optimizes it for the 21147Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 21148@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 21149MB86934 chip, which is the more recent SPARClite with FPU@. 21150 21151With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 21152the SPARC architecture. This adds the integer multiply, multiply/accumulate, 21153integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 21154but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 21155optimizes it for the TEMIC SPARClet chip. 21156 21157With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 21158architecture. This adds 64-bit integer and floating-point move instructions, 211593 additional floating-point condition code registers and conditional move 21160instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 21161optimizes it for the Sun UltraSPARC I/II/IIi chips. With 21162@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 21163Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 21164@option{-mcpu=niagara}, the compiler additionally optimizes it for 21165Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 21166additionally optimizes it for Sun UltraSPARC T2 chips. With 21167@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 21168UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 21169additionally optimizes it for Sun UltraSPARC T4 chips. 21170 21171@item -mtune=@var{cpu_type} 21172@opindex mtune 21173Set the instruction scheduling parameters for machine type 21174@var{cpu_type}, but do not set the instruction set or register set that the 21175option @option{-mcpu=@var{cpu_type}} does. 21176 21177The same values for @option{-mcpu=@var{cpu_type}} can be used for 21178@option{-mtune=@var{cpu_type}}, but the only useful values are those 21179that select a particular CPU implementation. Those are @samp{cypress}, 21180@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3}, 21181@samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701}, 21182@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 21183@samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux 21184toolchains, @samp{native} can also be used. 21185 21186@item -mv8plus 21187@itemx -mno-v8plus 21188@opindex mv8plus 21189@opindex mno-v8plus 21190With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 21191difference from the V8 ABI is that the global and out registers are 21192considered 64 bits wide. This is enabled by default on Solaris in 32-bit 21193mode for all SPARC-V9 processors. 21194 21195@item -mvis 21196@itemx -mno-vis 21197@opindex mvis 21198@opindex mno-vis 21199With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 21200Visual Instruction Set extensions. The default is @option{-mno-vis}. 21201 21202@item -mvis2 21203@itemx -mno-vis2 21204@opindex mvis2 21205@opindex mno-vis2 21206With @option{-mvis2}, GCC generates code that takes advantage of 21207version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 21208default is @option{-mvis2} when targeting a cpu that supports such 21209instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 21210also sets @option{-mvis}. 21211 21212@item -mvis3 21213@itemx -mno-vis3 21214@opindex mvis3 21215@opindex mno-vis3 21216With @option{-mvis3}, GCC generates code that takes advantage of 21217version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 21218default is @option{-mvis3} when targeting a cpu that supports such 21219instructions, such as niagara-3 and later. Setting @option{-mvis3} 21220also sets @option{-mvis2} and @option{-mvis}. 21221 21222@item -mcbcond 21223@itemx -mno-cbcond 21224@opindex mcbcond 21225@opindex mno-cbcond 21226With @option{-mcbcond}, GCC generates code that takes advantage of 21227compare-and-branch instructions, as defined in the Sparc Architecture 2011. 21228The default is @option{-mcbcond} when targeting a cpu that supports such 21229instructions, such as niagara-4 and later. 21230 21231@item -mpopc 21232@itemx -mno-popc 21233@opindex mpopc 21234@opindex mno-popc 21235With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 21236population count instruction. The default is @option{-mpopc} 21237when targeting a cpu that supports such instructions, such as Niagara-2 and 21238later. 21239 21240@item -mfmaf 21241@itemx -mno-fmaf 21242@opindex mfmaf 21243@opindex mno-fmaf 21244With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 21245Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf} 21246when targeting a cpu that supports such instructions, such as Niagara-3 and 21247later. 21248 21249@item -mfix-at697f 21250@opindex mfix-at697f 21251Enable the documented workaround for the single erratum of the Atmel AT697F 21252processor (which corresponds to erratum #13 of the AT697E processor). 21253 21254@item -mfix-ut699 21255@opindex mfix-ut699 21256Enable the documented workarounds for the floating-point errata and the data 21257cache nullify errata of the UT699 processor. 21258@end table 21259 21260These @samp{-m} options are supported in addition to the above 21261on SPARC-V9 processors in 64-bit environments: 21262 21263@table @gcctabopt 21264@item -m32 21265@itemx -m64 21266@opindex m32 21267@opindex m64 21268Generate code for a 32-bit or 64-bit environment. 21269The 32-bit environment sets int, long and pointer to 32 bits. 21270The 64-bit environment sets int to 32 bits and long and pointer 21271to 64 bits. 21272 21273@item -mcmodel=@var{which} 21274@opindex mcmodel 21275Set the code model to one of 21276 21277@table @samp 21278@item medlow 21279The Medium/Low code model: 64-bit addresses, programs 21280must be linked in the low 32 bits of memory. Programs can be statically 21281or dynamically linked. 21282 21283@item medmid 21284The Medium/Middle code model: 64-bit addresses, programs 21285must be linked in the low 44 bits of memory, the text and data segments must 21286be less than 2GB in size and the data segment must be located within 2GB of 21287the text segment. 21288 21289@item medany 21290The Medium/Anywhere code model: 64-bit addresses, programs 21291may be linked anywhere in memory, the text and data segments must be less 21292than 2GB in size and the data segment must be located within 2GB of the 21293text segment. 21294 21295@item embmedany 21296The Medium/Anywhere code model for embedded systems: 2129764-bit addresses, the text and data segments must be less than 2GB in 21298size, both starting anywhere in memory (determined at link time). The 21299global register %g4 points to the base of the data segment. Programs 21300are statically linked and PIC is not supported. 21301@end table 21302 21303@item -mmemory-model=@var{mem-model} 21304@opindex mmemory-model 21305Set the memory model in force on the processor to one of 21306 21307@table @samp 21308@item default 21309The default memory model for the processor and operating system. 21310 21311@item rmo 21312Relaxed Memory Order 21313 21314@item pso 21315Partial Store Order 21316 21317@item tso 21318Total Store Order 21319 21320@item sc 21321Sequential Consistency 21322@end table 21323 21324These memory models are formally defined in Appendix D of the Sparc V9 21325architecture manual, as set in the processor's @code{PSTATE.MM} field. 21326 21327@item -mstack-bias 21328@itemx -mno-stack-bias 21329@opindex mstack-bias 21330@opindex mno-stack-bias 21331With @option{-mstack-bias}, GCC assumes that the stack pointer, and 21332frame pointer if present, are offset by @minus{}2047 which must be added back 21333when making stack frame references. This is the default in 64-bit mode. 21334Otherwise, assume no such offset is present. 21335@end table 21336 21337@node SPU Options 21338@subsection SPU Options 21339@cindex SPU options 21340 21341These @samp{-m} options are supported on the SPU: 21342 21343@table @gcctabopt 21344@item -mwarn-reloc 21345@itemx -merror-reloc 21346@opindex mwarn-reloc 21347@opindex merror-reloc 21348 21349The loader for SPU does not handle dynamic relocations. By default, GCC 21350gives an error when it generates code that requires a dynamic 21351relocation. @option{-mno-error-reloc} disables the error, 21352@option{-mwarn-reloc} generates a warning instead. 21353 21354@item -msafe-dma 21355@itemx -munsafe-dma 21356@opindex msafe-dma 21357@opindex munsafe-dma 21358 21359Instructions that initiate or test completion of DMA must not be 21360reordered with respect to loads and stores of the memory that is being 21361accessed. 21362With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect 21363memory accesses, but that can lead to inefficient code in places where the 21364memory is known to not change. Rather than mark the memory as volatile, 21365you can use @option{-msafe-dma} to tell the compiler to treat 21366the DMA instructions as potentially affecting all memory. 21367 21368@item -mbranch-hints 21369@opindex mbranch-hints 21370 21371By default, GCC generates a branch hint instruction to avoid 21372pipeline stalls for always-taken or probably-taken branches. A hint 21373is not generated closer than 8 instructions away from its branch. 21374There is little reason to disable them, except for debugging purposes, 21375or to make an object a little bit smaller. 21376 21377@item -msmall-mem 21378@itemx -mlarge-mem 21379@opindex msmall-mem 21380@opindex mlarge-mem 21381 21382By default, GCC generates code assuming that addresses are never larger 21383than 18 bits. With @option{-mlarge-mem} code is generated that assumes 21384a full 32-bit address. 21385 21386@item -mstdmain 21387@opindex mstdmain 21388 21389By default, GCC links against startup code that assumes the SPU-style 21390main function interface (which has an unconventional parameter list). 21391With @option{-mstdmain}, GCC links your program against startup 21392code that assumes a C99-style interface to @code{main}, including a 21393local copy of @code{argv} strings. 21394 21395@item -mfixed-range=@var{register-range} 21396@opindex mfixed-range 21397Generate code treating the given register range as fixed registers. 21398A fixed register is one that the register allocator cannot use. This is 21399useful when compiling kernel code. A register range is specified as 21400two registers separated by a dash. Multiple register ranges can be 21401specified separated by a comma. 21402 21403@item -mea32 21404@itemx -mea64 21405@opindex mea32 21406@opindex mea64 21407Compile code assuming that pointers to the PPU address space accessed 21408via the @code{__ea} named address space qualifier are either 32 or 64 21409bits wide. The default is 32 bits. As this is an ABI-changing option, 21410all object code in an executable must be compiled with the same setting. 21411 21412@item -maddress-space-conversion 21413@itemx -mno-address-space-conversion 21414@opindex maddress-space-conversion 21415@opindex mno-address-space-conversion 21416Allow/disallow treating the @code{__ea} address space as superset 21417of the generic address space. This enables explicit type casts 21418between @code{__ea} and generic pointer as well as implicit 21419conversions of generic pointers to @code{__ea} pointers. The 21420default is to allow address space pointer conversions. 21421 21422@item -mcache-size=@var{cache-size} 21423@opindex mcache-size 21424This option controls the version of libgcc that the compiler links to an 21425executable and selects a software-managed cache for accessing variables 21426in the @code{__ea} address space with a particular cache size. Possible 21427options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} 21428and @samp{128}. The default cache size is 64KB. 21429 21430@item -matomic-updates 21431@itemx -mno-atomic-updates 21432@opindex matomic-updates 21433@opindex mno-atomic-updates 21434This option controls the version of libgcc that the compiler links to an 21435executable and selects whether atomic updates to the software-managed 21436cache of PPU-side variables are used. If you use atomic updates, changes 21437to a PPU variable from SPU code using the @code{__ea} named address space 21438qualifier do not interfere with changes to other PPU variables residing 21439in the same cache line from PPU code. If you do not use atomic updates, 21440such interference may occur; however, writing back cache lines is 21441more efficient. The default behavior is to use atomic updates. 21442 21443@item -mdual-nops 21444@itemx -mdual-nops=@var{n} 21445@opindex mdual-nops 21446By default, GCC inserts nops to increase dual issue when it expects 21447it to increase performance. @var{n} can be a value from 0 to 10. A 21448smaller @var{n} inserts fewer nops. 10 is the default, 0 is the 21449same as @option{-mno-dual-nops}. Disabled with @option{-Os}. 21450 21451@item -mhint-max-nops=@var{n} 21452@opindex mhint-max-nops 21453Maximum number of nops to insert for a branch hint. A branch hint must 21454be at least 8 instructions away from the branch it is affecting. GCC 21455inserts up to @var{n} nops to enforce this, otherwise it does not 21456generate the branch hint. 21457 21458@item -mhint-max-distance=@var{n} 21459@opindex mhint-max-distance 21460The encoding of the branch hint instruction limits the hint to be within 21461256 instructions of the branch it is affecting. By default, GCC makes 21462sure it is within 125. 21463 21464@item -msafe-hints 21465@opindex msafe-hints 21466Work around a hardware bug that causes the SPU to stall indefinitely. 21467By default, GCC inserts the @code{hbrp} instruction to make sure 21468this stall won't happen. 21469 21470@end table 21471 21472@node System V Options 21473@subsection Options for System V 21474 21475These additional options are available on System V Release 4 for 21476compatibility with other compilers on those systems: 21477 21478@table @gcctabopt 21479@item -G 21480@opindex G 21481Create a shared object. 21482It is recommended that @option{-symbolic} or @option{-shared} be used instead. 21483 21484@item -Qy 21485@opindex Qy 21486Identify the versions of each tool used by the compiler, in a 21487@code{.ident} assembler directive in the output. 21488 21489@item -Qn 21490@opindex Qn 21491Refrain from adding @code{.ident} directives to the output file (this is 21492the default). 21493 21494@item -YP,@var{dirs} 21495@opindex YP 21496Search the directories @var{dirs}, and no others, for libraries 21497specified with @option{-l}. 21498 21499@item -Ym,@var{dir} 21500@opindex Ym 21501Look in the directory @var{dir} to find the M4 preprocessor. 21502The assembler uses this option. 21503@c This is supposed to go with a -Yd for predefined M4 macro files, but 21504@c the generic assembler that comes with Solaris takes just -Ym. 21505@end table 21506 21507@node TILE-Gx Options 21508@subsection TILE-Gx Options 21509@cindex TILE-Gx options 21510 21511These @samp{-m} options are supported on the TILE-Gx: 21512 21513@table @gcctabopt 21514@item -mcmodel=small 21515@opindex mcmodel=small 21516Generate code for the small model. The distance for direct calls is 21517limited to 500M in either direction. PC-relative addresses are 32 21518bits. Absolute addresses support the full address range. 21519 21520@item -mcmodel=large 21521@opindex mcmodel=large 21522Generate code for the large model. There is no limitation on call 21523distance, pc-relative addresses, or absolute addresses. 21524 21525@item -mcpu=@var{name} 21526@opindex mcpu 21527Selects the type of CPU to be targeted. Currently the only supported 21528type is @samp{tilegx}. 21529 21530@item -m32 21531@itemx -m64 21532@opindex m32 21533@opindex m64 21534Generate code for a 32-bit or 64-bit environment. The 32-bit 21535environment sets int, long, and pointer to 32 bits. The 64-bit 21536environment sets int to 32 bits and long and pointer to 64 bits. 21537 21538@item -mbig-endian 21539@itemx -mlittle-endian 21540@opindex mbig-endian 21541@opindex mlittle-endian 21542Generate code in big/little endian mode, respectively. 21543@end table 21544 21545@node TILEPro Options 21546@subsection TILEPro Options 21547@cindex TILEPro options 21548 21549These @samp{-m} options are supported on the TILEPro: 21550 21551@table @gcctabopt 21552@item -mcpu=@var{name} 21553@opindex mcpu 21554Selects the type of CPU to be targeted. Currently the only supported 21555type is @samp{tilepro}. 21556 21557@item -m32 21558@opindex m32 21559Generate code for a 32-bit environment, which sets int, long, and 21560pointer to 32 bits. This is the only supported behavior so the flag 21561is essentially ignored. 21562@end table 21563 21564@node V850 Options 21565@subsection V850 Options 21566@cindex V850 Options 21567 21568These @samp{-m} options are defined for V850 implementations: 21569 21570@table @gcctabopt 21571@item -mlong-calls 21572@itemx -mno-long-calls 21573@opindex mlong-calls 21574@opindex mno-long-calls 21575Treat all calls as being far away (near). If calls are assumed to be 21576far away, the compiler always loads the function's address into a 21577register, and calls indirect through the pointer. 21578 21579@item -mno-ep 21580@itemx -mep 21581@opindex mno-ep 21582@opindex mep 21583Do not optimize (do optimize) basic blocks that use the same index 21584pointer 4 or more times to copy pointer into the @code{ep} register, and 21585use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 21586option is on by default if you optimize. 21587 21588@item -mno-prolog-function 21589@itemx -mprolog-function 21590@opindex mno-prolog-function 21591@opindex mprolog-function 21592Do not use (do use) external functions to save and restore registers 21593at the prologue and epilogue of a function. The external functions 21594are slower, but use less code space if more than one function saves 21595the same number of registers. The @option{-mprolog-function} option 21596is on by default if you optimize. 21597 21598@item -mspace 21599@opindex mspace 21600Try to make the code as small as possible. At present, this just turns 21601on the @option{-mep} and @option{-mprolog-function} options. 21602 21603@item -mtda=@var{n} 21604@opindex mtda 21605Put static or global variables whose size is @var{n} bytes or less into 21606the tiny data area that register @code{ep} points to. The tiny data 21607area can hold up to 256 bytes in total (128 bytes for byte references). 21608 21609@item -msda=@var{n} 21610@opindex msda 21611Put static or global variables whose size is @var{n} bytes or less into 21612the small data area that register @code{gp} points to. The small data 21613area can hold up to 64 kilobytes. 21614 21615@item -mzda=@var{n} 21616@opindex mzda 21617Put static or global variables whose size is @var{n} bytes or less into 21618the first 32 kilobytes of memory. 21619 21620@item -mv850 21621@opindex mv850 21622Specify that the target processor is the V850. 21623 21624@item -mv850e3v5 21625@opindex mv850e3v5 21626Specify that the target processor is the V850E3V5. The preprocessor 21627constant @code{__v850e3v5__} is defined if this option is used. 21628 21629@item -mv850e2v4 21630@opindex mv850e2v4 21631Specify that the target processor is the V850E3V5. This is an alias for 21632the @option{-mv850e3v5} option. 21633 21634@item -mv850e2v3 21635@opindex mv850e2v3 21636Specify that the target processor is the V850E2V3. The preprocessor 21637constant @code{__v850e2v3__} is defined if this option is used. 21638 21639@item -mv850e2 21640@opindex mv850e2 21641Specify that the target processor is the V850E2. The preprocessor 21642constant @code{__v850e2__} is defined if this option is used. 21643 21644@item -mv850e1 21645@opindex mv850e1 21646Specify that the target processor is the V850E1. The preprocessor 21647constants @code{__v850e1__} and @code{__v850e__} are defined if 21648this option is used. 21649 21650@item -mv850es 21651@opindex mv850es 21652Specify that the target processor is the V850ES. This is an alias for 21653the @option{-mv850e1} option. 21654 21655@item -mv850e 21656@opindex mv850e 21657Specify that the target processor is the V850E@. The preprocessor 21658constant @code{__v850e__} is defined if this option is used. 21659 21660If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 21661nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 21662are defined then a default target processor is chosen and the 21663relevant @samp{__v850*__} preprocessor constant is defined. 21664 21665The preprocessor constants @code{__v850} and @code{__v851__} are always 21666defined, regardless of which processor variant is the target. 21667 21668@item -mdisable-callt 21669@itemx -mno-disable-callt 21670@opindex mdisable-callt 21671@opindex mno-disable-callt 21672This option suppresses generation of the @code{CALLT} instruction for the 21673v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 21674architecture. 21675 21676This option is enabled by default when the RH850 ABI is 21677in use (see @option{-mrh850-abi}), and disabled by default when the 21678GCC ABI is in use. If @code{CALLT} instructions are being generated 21679then the C preprocessor symbol @code{__V850_CALLT__} is defined. 21680 21681@item -mrelax 21682@itemx -mno-relax 21683@opindex mrelax 21684@opindex mno-relax 21685Pass on (or do not pass on) the @option{-mrelax} command-line option 21686to the assembler. 21687 21688@item -mlong-jumps 21689@itemx -mno-long-jumps 21690@opindex mlong-jumps 21691@opindex mno-long-jumps 21692Disable (or re-enable) the generation of PC-relative jump instructions. 21693 21694@item -msoft-float 21695@itemx -mhard-float 21696@opindex msoft-float 21697@opindex mhard-float 21698Disable (or re-enable) the generation of hardware floating point 21699instructions. This option is only significant when the target 21700architecture is @samp{V850E2V3} or higher. If hardware floating point 21701instructions are being generated then the C preprocessor symbol 21702@code{__FPU_OK__} is defined, otherwise the symbol 21703@code{__NO_FPU__} is defined. 21704 21705@item -mloop 21706@opindex mloop 21707Enables the use of the e3v5 LOOP instruction. The use of this 21708instruction is not enabled by default when the e3v5 architecture is 21709selected because its use is still experimental. 21710 21711@item -mrh850-abi 21712@itemx -mghs 21713@opindex mrh850-abi 21714@opindex mghs 21715Enables support for the RH850 version of the V850 ABI. This is the 21716default. With this version of the ABI the following rules apply: 21717 21718@itemize 21719@item 21720Integer sized structures and unions are returned via a memory pointer 21721rather than a register. 21722 21723@item 21724Large structures and unions (more than 8 bytes in size) are passed by 21725value. 21726 21727@item 21728Functions are aligned to 16-bit boundaries. 21729 21730@item 21731The @option{-m8byte-align} command-line option is supported. 21732 21733@item 21734The @option{-mdisable-callt} command-line option is enabled by 21735default. The @option{-mno-disable-callt} command-line option is not 21736supported. 21737@end itemize 21738 21739When this version of the ABI is enabled the C preprocessor symbol 21740@code{__V850_RH850_ABI__} is defined. 21741 21742@item -mgcc-abi 21743@opindex mgcc-abi 21744Enables support for the old GCC version of the V850 ABI. With this 21745version of the ABI the following rules apply: 21746 21747@itemize 21748@item 21749Integer sized structures and unions are returned in register @code{r10}. 21750 21751@item 21752Large structures and unions (more than 8 bytes in size) are passed by 21753reference. 21754 21755@item 21756Functions are aligned to 32-bit boundaries, unless optimizing for 21757size. 21758 21759@item 21760The @option{-m8byte-align} command-line option is not supported. 21761 21762@item 21763The @option{-mdisable-callt} command-line option is supported but not 21764enabled by default. 21765@end itemize 21766 21767When this version of the ABI is enabled the C preprocessor symbol 21768@code{__V850_GCC_ABI__} is defined. 21769 21770@item -m8byte-align 21771@itemx -mno-8byte-align 21772@opindex m8byte-align 21773@opindex mno-8byte-align 21774Enables support for @code{double} and @code{long long} types to be 21775aligned on 8-byte boundaries. The default is to restrict the 21776alignment of all objects to at most 4-bytes. When 21777@option{-m8byte-align} is in effect the C preprocessor symbol 21778@code{__V850_8BYTE_ALIGN__} is defined. 21779 21780@item -mbig-switch 21781@opindex mbig-switch 21782Generate code suitable for big switch tables. Use this option only if 21783the assembler/linker complain about out of range branches within a switch 21784table. 21785 21786@item -mapp-regs 21787@opindex mapp-regs 21788This option causes r2 and r5 to be used in the code generated by 21789the compiler. This setting is the default. 21790 21791@item -mno-app-regs 21792@opindex mno-app-regs 21793This option causes r2 and r5 to be treated as fixed registers. 21794 21795@end table 21796 21797@node VAX Options 21798@subsection VAX Options 21799@cindex VAX options 21800 21801These @samp{-m} options are defined for the VAX: 21802 21803@table @gcctabopt 21804@item -munix 21805@opindex munix 21806Do not output certain jump instructions (@code{aobleq} and so on) 21807that the Unix assembler for the VAX cannot handle across long 21808ranges. 21809 21810@item -mgnu 21811@opindex mgnu 21812Do output those jump instructions, on the assumption that the 21813GNU assembler is being used. 21814 21815@item -mg 21816@opindex mg 21817Output code for G-format floating-point numbers instead of D-format. 21818@end table 21819 21820@node Visium Options 21821@subsection Visium Options 21822@cindex Visium options 21823 21824@table @gcctabopt 21825 21826@item -mdebug 21827@opindex mdebug 21828A program which performs file I/O and is destined to run on an MCM target 21829should be linked with this option. It causes the libraries libc.a and 21830libdebug.a to be linked. The program should be run on the target under 21831the control of the GDB remote debugging stub. 21832 21833@item -msim 21834@opindex msim 21835A program which performs file I/O and is destined to run on the simulator 21836should be linked with option. This causes libraries libc.a and libsim.a to 21837be linked. 21838 21839@item -mfpu 21840@itemx -mhard-float 21841@opindex mfpu 21842@opindex mhard-float 21843Generate code containing floating-point instructions. This is the 21844default. 21845 21846@item -mno-fpu 21847@itemx -msoft-float 21848@opindex mno-fpu 21849@opindex msoft-float 21850Generate code containing library calls for floating-point. 21851 21852@option{-msoft-float} changes the calling convention in the output file; 21853therefore, it is only useful if you compile @emph{all} of a program with 21854this option. In particular, you need to compile @file{libgcc.a}, the 21855library that comes with GCC, with @option{-msoft-float} in order for 21856this to work. 21857 21858@item -mcpu=@var{cpu_type} 21859@opindex mcpu 21860Set the instruction set, register set, and instruction scheduling parameters 21861for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 21862@samp{mcm}, @samp{gr5} and @samp{gr6}. 21863 21864@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 21865 21866By default (unless configured otherwise), GCC generates code for the GR5 21867variant of the Visium architecture. 21868 21869With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 21870architecture. The only difference from GR5 code is that the compiler will 21871generate block move instructions. 21872 21873@item -mtune=@var{cpu_type} 21874@opindex mtune 21875Set the instruction scheduling parameters for machine type @var{cpu_type}, 21876but do not set the instruction set or register set that the option 21877@option{-mcpu=@var{cpu_type}} would. 21878 21879@item -msv-mode 21880@opindex msv-mode 21881Generate code for the supervisor mode, where there are no restrictions on 21882the access to general registers. This is the default. 21883 21884@item -muser-mode 21885@opindex muser-mode 21886Generate code for the user mode, where the access to some general registers 21887is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 21888mode; on the GR6, only registers r29 to r31 are affected. 21889@end table 21890 21891@node VMS Options 21892@subsection VMS Options 21893 21894These @samp{-m} options are defined for the VMS implementations: 21895 21896@table @gcctabopt 21897@item -mvms-return-codes 21898@opindex mvms-return-codes 21899Return VMS condition codes from @code{main}. The default is to return POSIX-style 21900condition (e.g.@ error) codes. 21901 21902@item -mdebug-main=@var{prefix} 21903@opindex mdebug-main=@var{prefix} 21904Flag the first routine whose name starts with @var{prefix} as the main 21905routine for the debugger. 21906 21907@item -mmalloc64 21908@opindex mmalloc64 21909Default to 64-bit memory allocation routines. 21910 21911@item -mpointer-size=@var{size} 21912@opindex mpointer-size=@var{size} 21913Set the default size of pointers. Possible options for @var{size} are 21914@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 21915for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 21916The later option disables @code{pragma pointer_size}. 21917@end table 21918 21919@node VxWorks Options 21920@subsection VxWorks Options 21921@cindex VxWorks Options 21922 21923The options in this section are defined for all VxWorks targets. 21924Options specific to the target hardware are listed with the other 21925options for that target. 21926 21927@table @gcctabopt 21928@item -mrtp 21929@opindex mrtp 21930GCC can generate code for both VxWorks kernels and real time processes 21931(RTPs). This option switches from the former to the latter. It also 21932defines the preprocessor macro @code{__RTP__}. 21933 21934@item -non-static 21935@opindex non-static 21936Link an RTP executable against shared libraries rather than static 21937libraries. The options @option{-static} and @option{-shared} can 21938also be used for RTPs (@pxref{Link Options}); @option{-static} 21939is the default. 21940 21941@item -Bstatic 21942@itemx -Bdynamic 21943@opindex Bstatic 21944@opindex Bdynamic 21945These options are passed down to the linker. They are defined for 21946compatibility with Diab. 21947 21948@item -Xbind-lazy 21949@opindex Xbind-lazy 21950Enable lazy binding of function calls. This option is equivalent to 21951@option{-Wl,-z,now} and is defined for compatibility with Diab. 21952 21953@item -Xbind-now 21954@opindex Xbind-now 21955Disable lazy binding of function calls. This option is the default and 21956is defined for compatibility with Diab. 21957@end table 21958 21959@node x86 Options 21960@subsection x86 Options 21961@cindex x86 Options 21962 21963These @samp{-m} options are defined for the x86 family of computers. 21964 21965@table @gcctabopt 21966 21967@item -march=@var{cpu-type} 21968@opindex march 21969Generate instructions for the machine type @var{cpu-type}. In contrast to 21970@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 21971for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 21972to generate code that may not run at all on processors other than the one 21973indicated. Specifying @option{-march=@var{cpu-type}} implies 21974@option{-mtune=@var{cpu-type}}. 21975 21976The choices for @var{cpu-type} are: 21977 21978@table @samp 21979@item native 21980This selects the CPU to generate code for at compilation time by determining 21981the processor type of the compiling machine. Using @option{-march=native} 21982enables all instruction subsets supported by the local machine (hence 21983the result might not run on different machines). Using @option{-mtune=native} 21984produces code optimized for the local machine under the constraints 21985of the selected instruction set. 21986 21987@item i386 21988Original Intel i386 CPU@. 21989 21990@item i486 21991Intel i486 CPU@. (No scheduling is implemented for this chip.) 21992 21993@item i586 21994@itemx pentium 21995Intel Pentium CPU with no MMX support. 21996 21997@item pentium-mmx 21998Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 21999 22000@item pentiumpro 22001Intel Pentium Pro CPU@. 22002 22003@item i686 22004When used with @option{-march}, the Pentium Pro 22005instruction set is used, so the code runs on all i686 family chips. 22006When used with @option{-mtune}, it has the same meaning as @samp{generic}. 22007 22008@item pentium2 22009Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 22010support. 22011 22012@item pentium3 22013@itemx pentium3m 22014Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 22015set support. 22016 22017@item pentium-m 22018Intel Pentium M; low-power version of Intel Pentium III CPU 22019with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 22020 22021@item pentium4 22022@itemx pentium4m 22023Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 22024 22025@item prescott 22026Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 22027set support. 22028 22029@item nocona 22030Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 22031SSE2 and SSE3 instruction set support. 22032 22033@item core2 22034Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 22035instruction set support. 22036 22037@item nehalem 22038Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22039SSE4.1, SSE4.2 and POPCNT instruction set support. 22040 22041@item westmere 22042Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22043SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. 22044 22045@item sandybridge 22046Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22047SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. 22048 22049@item ivybridge 22050Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22051SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C 22052instruction set support. 22053 22054@item haswell 22055Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 22056SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 22057BMI, BMI2 and F16C instruction set support. 22058 22059@item broadwell 22060Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 22061SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 22062BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support. 22063 22064@item bonnell 22065Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 22066instruction set support. 22067 22068@item silvermont 22069Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 22070SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support. 22071 22072@item knl 22073Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 22074SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 22075BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and 22076AVX512CD instruction set support. 22077 22078@item k6 22079AMD K6 CPU with MMX instruction set support. 22080 22081@item k6-2 22082@itemx k6-3 22083Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 22084 22085@item athlon 22086@itemx athlon-tbird 22087AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 22088support. 22089 22090@item athlon-4 22091@itemx athlon-xp 22092@itemx athlon-mp 22093Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 22094instruction set support. 22095 22096@item k8 22097@itemx opteron 22098@itemx athlon64 22099@itemx athlon-fx 22100Processors based on the AMD K8 core with x86-64 instruction set support, 22101including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 22102(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 22103instruction set extensions.) 22104 22105@item k8-sse3 22106@itemx opteron-sse3 22107@itemx athlon64-sse3 22108Improved versions of AMD K8 cores with SSE3 instruction set support. 22109 22110@item amdfam10 22111@itemx barcelona 22112CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 22113supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 22114instruction set extensions.) 22115 22116@item bdver1 22117CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 22118supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 22119SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 22120@item bdver2 22121AMD Family 15h core based CPUs with x86-64 instruction set support. (This 22122supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, 22123SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 22124extensions.) 22125@item bdver3 22126AMD Family 15h core based CPUs with x86-64 instruction set support. (This 22127supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 22128PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 2212964-bit instruction set extensions. 22130@item bdver4 22131AMD Family 15h core based CPUs with x86-64 instruction set support. (This 22132supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 22133AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 22134SSE4.2, ABM and 64-bit instruction set extensions. 22135 22136@item btver1 22137CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 22138supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 22139instruction set extensions.) 22140 22141@item btver2 22142CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 22143includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, 22144SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 22145 22146@item winchip-c6 22147IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 22148set support. 22149 22150@item winchip2 22151IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 22152instruction set support. 22153 22154@item c3 22155VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is 22156implemented for this chip.) 22157 22158@item c3-2 22159VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 22160(No scheduling is 22161implemented for this chip.) 22162 22163@item geode 22164AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 22165@end table 22166 22167@item -mtune=@var{cpu-type} 22168@opindex mtune 22169Tune to @var{cpu-type} everything applicable about the generated code, except 22170for the ABI and the set of available instructions. 22171While picking a specific @var{cpu-type} schedules things appropriately 22172for that particular chip, the compiler does not generate any code that 22173cannot run on the default machine type unless you use a 22174@option{-march=@var{cpu-type}} option. 22175For example, if GCC is configured for i686-pc-linux-gnu 22176then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 22177but still runs on i686 machines. 22178 22179The choices for @var{cpu-type} are the same as for @option{-march}. 22180In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 22181 22182@table @samp 22183@item generic 22184Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 22185If you know the CPU on which your code will run, then you should use 22186the corresponding @option{-mtune} or @option{-march} option instead of 22187@option{-mtune=generic}. But, if you do not know exactly what CPU users 22188of your application will have, then you should use this option. 22189 22190As new processors are deployed in the marketplace, the behavior of this 22191option will change. Therefore, if you upgrade to a newer version of 22192GCC, code generation controlled by this option will change to reflect 22193the processors 22194that are most common at the time that version of GCC is released. 22195 22196There is no @option{-march=generic} option because @option{-march} 22197indicates the instruction set the compiler can use, and there is no 22198generic instruction set applicable to all processors. In contrast, 22199@option{-mtune} indicates the processor (or, in this case, collection of 22200processors) for which the code is optimized. 22201 22202@item intel 22203Produce code optimized for the most current Intel processors, which are 22204Haswell and Silvermont for this version of GCC. If you know the CPU 22205on which your code will run, then you should use the corresponding 22206@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 22207But, if you want your application performs better on both Haswell and 22208Silvermont, then you should use this option. 22209 22210As new Intel processors are deployed in the marketplace, the behavior of 22211this option will change. Therefore, if you upgrade to a newer version of 22212GCC, code generation controlled by this option will change to reflect 22213the most current Intel processors at the time that version of GCC is 22214released. 22215 22216There is no @option{-march=intel} option because @option{-march} indicates 22217the instruction set the compiler can use, and there is no common 22218instruction set applicable to all processors. In contrast, 22219@option{-mtune} indicates the processor (or, in this case, collection of 22220processors) for which the code is optimized. 22221@end table 22222 22223@item -mcpu=@var{cpu-type} 22224@opindex mcpu 22225A deprecated synonym for @option{-mtune}. 22226 22227@item -mfpmath=@var{unit} 22228@opindex mfpmath 22229Generate floating-point arithmetic for selected unit @var{unit}. The choices 22230for @var{unit} are: 22231 22232@table @samp 22233@item 387 22234Use the standard 387 floating-point coprocessor present on the majority of chips and 22235emulated otherwise. Code compiled with this option runs almost everywhere. 22236The temporary results are computed in 80-bit precision instead of the precision 22237specified by the type, resulting in slightly different results compared to most 22238of other chips. See @option{-ffloat-store} for more detailed description. 22239 22240This is the default choice for x86-32 targets. 22241 22242@item sse 22243Use scalar floating-point instructions present in the SSE instruction set. 22244This instruction set is supported by Pentium III and newer chips, 22245and in the AMD line 22246by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 22247instruction set supports only single-precision arithmetic, thus the double and 22248extended-precision arithmetic are still done using 387. A later version, present 22249only in Pentium 4 and AMD x86-64 chips, supports double-precision 22250arithmetic too. 22251 22252For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 22253or @option{-msse2} switches to enable SSE extensions and make this option 22254effective. For the x86-64 compiler, these extensions are enabled by default. 22255 22256The resulting code should be considerably faster in the majority of cases and avoid 22257the numerical instability problems of 387 code, but may break some existing 22258code that expects temporaries to be 80 bits. 22259 22260This is the default choice for the x86-64 compiler. 22261 22262@item sse,387 22263@itemx sse+387 22264@itemx both 22265Attempt to utilize both instruction sets at once. This effectively doubles the 22266amount of available registers, and on chips with separate execution units for 22267387 and SSE the execution resources too. Use this option with care, as it is 22268still experimental, because the GCC register allocator does not model separate 22269functional units well, resulting in unstable performance. 22270@end table 22271 22272@item -masm=@var{dialect} 22273@opindex masm=@var{dialect} 22274Output assembly instructions using selected @var{dialect}. Also affects 22275which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 22276extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 22277order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 22278not support @samp{intel}. 22279 22280@item -mieee-fp 22281@itemx -mno-ieee-fp 22282@opindex mieee-fp 22283@opindex mno-ieee-fp 22284Control whether or not the compiler uses IEEE floating-point 22285comparisons. These correctly handle the case where the result of a 22286comparison is unordered. 22287 22288@item -msoft-float 22289@opindex msoft-float 22290Generate output containing library calls for floating point. 22291 22292@strong{Warning:} the requisite libraries are not part of GCC@. 22293Normally the facilities of the machine's usual C compiler are used, but 22294this can't be done directly in cross-compilation. You must make your 22295own arrangements to provide suitable library functions for 22296cross-compilation. 22297 22298On machines where a function returns floating-point results in the 80387 22299register stack, some floating-point opcodes may be emitted even if 22300@option{-msoft-float} is used. 22301 22302@item -mno-fp-ret-in-387 22303@opindex mno-fp-ret-in-387 22304Do not use the FPU registers for return values of functions. 22305 22306The usual calling convention has functions return values of types 22307@code{float} and @code{double} in an FPU register, even if there 22308is no FPU@. The idea is that the operating system should emulate 22309an FPU@. 22310 22311The option @option{-mno-fp-ret-in-387} causes such values to be returned 22312in ordinary CPU registers instead. 22313 22314@item -mno-fancy-math-387 22315@opindex mno-fancy-math-387 22316Some 387 emulators do not support the @code{sin}, @code{cos} and 22317@code{sqrt} instructions for the 387. Specify this option to avoid 22318generating those instructions. This option is the default on 22319OpenBSD and NetBSD@. This option is overridden when @option{-march} 22320indicates that the target CPU always has an FPU and so the 22321instruction does not need emulation. These 22322instructions are not generated unless you also use the 22323@option{-funsafe-math-optimizations} switch. 22324 22325@item -malign-double 22326@itemx -mno-align-double 22327@opindex malign-double 22328@opindex mno-align-double 22329Control whether GCC aligns @code{double}, @code{long double}, and 22330@code{long long} variables on a two-word boundary or a one-word 22331boundary. Aligning @code{double} variables on a two-word boundary 22332produces code that runs somewhat faster on a Pentium at the 22333expense of more memory. 22334 22335On x86-64, @option{-malign-double} is enabled by default. 22336 22337@strong{Warning:} if you use the @option{-malign-double} switch, 22338structures containing the above types are aligned differently than 22339the published application binary interface specifications for the x86-32 22340and are not binary compatible with structures in code compiled 22341without that switch. 22342 22343@item -m96bit-long-double 22344@itemx -m128bit-long-double 22345@opindex m96bit-long-double 22346@opindex m128bit-long-double 22347These switches control the size of @code{long double} type. The x86-32 22348application binary interface specifies the size to be 96 bits, 22349so @option{-m96bit-long-double} is the default in 32-bit mode. 22350 22351Modern architectures (Pentium and newer) prefer @code{long double} 22352to be aligned to an 8- or 16-byte boundary. In arrays or structures 22353conforming to the ABI, this is not possible. So specifying 22354@option{-m128bit-long-double} aligns @code{long double} 22355to a 16-byte boundary by padding the @code{long double} with an additional 2235632-bit zero. 22357 22358In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 22359its ABI specifies that @code{long double} is aligned on 16-byte boundary. 22360 22361Notice that neither of these options enable any extra precision over the x87 22362standard of 80 bits for a @code{long double}. 22363 22364@strong{Warning:} if you override the default value for your target ABI, this 22365changes the size of 22366structures and arrays containing @code{long double} variables, 22367as well as modifying the function calling convention for functions taking 22368@code{long double}. Hence they are not binary-compatible 22369with code compiled without that switch. 22370 22371@item -mlong-double-64 22372@itemx -mlong-double-80 22373@itemx -mlong-double-128 22374@opindex mlong-double-64 22375@opindex mlong-double-80 22376@opindex mlong-double-128 22377These switches control the size of @code{long double} type. A size 22378of 64 bits makes the @code{long double} type equivalent to the @code{double} 22379type. This is the default for 32-bit Bionic C library. A size 22380of 128 bits makes the @code{long double} type equivalent to the 22381@code{__float128} type. This is the default for 64-bit Bionic C library. 22382 22383@strong{Warning:} if you override the default value for your target ABI, this 22384changes the size of 22385structures and arrays containing @code{long double} variables, 22386as well as modifying the function calling convention for functions taking 22387@code{long double}. Hence they are not binary-compatible 22388with code compiled without that switch. 22389 22390@item -malign-data=@var{type} 22391@opindex malign-data 22392Control how GCC aligns variables. Supported values for @var{type} are 22393@samp{compat} uses increased alignment value compatible uses GCC 4.8 22394and earlier, @samp{abi} uses alignment value as specified by the 22395psABI, and @samp{cacheline} uses increased alignment value to match 22396the cache line size. @samp{compat} is the default. 22397 22398@item -mlarge-data-threshold=@var{threshold} 22399@opindex mlarge-data-threshold 22400When @option{-mcmodel=medium} is specified, data objects larger than 22401@var{threshold} are placed in the large data section. This value must be the 22402same across all objects linked into the binary, and defaults to 65535. 22403 22404@item -mrtd 22405@opindex mrtd 22406Use a different function-calling convention, in which functions that 22407take a fixed number of arguments return with the @code{ret @var{num}} 22408instruction, which pops their arguments while returning. This saves one 22409instruction in the caller since there is no need to pop the arguments 22410there. 22411 22412You can specify that an individual function is called with this calling 22413sequence with the function attribute @code{stdcall}. You can also 22414override the @option{-mrtd} option by using the function attribute 22415@code{cdecl}. @xref{Function Attributes}. 22416 22417@strong{Warning:} this calling convention is incompatible with the one 22418normally used on Unix, so you cannot use it if you need to call 22419libraries compiled with the Unix compiler. 22420 22421Also, you must provide function prototypes for all functions that 22422take variable numbers of arguments (including @code{printf}); 22423otherwise incorrect code is generated for calls to those 22424functions. 22425 22426In addition, seriously incorrect code results if you call a 22427function with too many arguments. (Normally, extra arguments are 22428harmlessly ignored.) 22429 22430@item -mregparm=@var{num} 22431@opindex mregparm 22432Control how many registers are used to pass integer arguments. By 22433default, no registers are used to pass arguments, and at most 3 22434registers can be used. You can control this behavior for a specific 22435function by using the function attribute @code{regparm}. 22436@xref{Function Attributes}. 22437 22438@strong{Warning:} if you use this switch, and 22439@var{num} is nonzero, then you must build all modules with the same 22440value, including any libraries. This includes the system libraries and 22441startup modules. 22442 22443@item -msseregparm 22444@opindex msseregparm 22445Use SSE register passing conventions for float and double arguments 22446and return values. You can control this behavior for a specific 22447function by using the function attribute @code{sseregparm}. 22448@xref{Function Attributes}. 22449 22450@strong{Warning:} if you use this switch then you must build all 22451modules with the same value, including any libraries. This includes 22452the system libraries and startup modules. 22453 22454@item -mvect8-ret-in-mem 22455@opindex mvect8-ret-in-mem 22456Return 8-byte vectors in memory instead of MMX registers. This is the 22457default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun 22458Studio compilers until version 12. Later compiler versions (starting 22459with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which 22460is the default on Solaris@tie{}10 and later. @emph{Only} use this option if 22461you need to remain compatible with existing code produced by those 22462previous compiler versions or older versions of GCC@. 22463 22464@item -mpc32 22465@itemx -mpc64 22466@itemx -mpc80 22467@opindex mpc32 22468@opindex mpc64 22469@opindex mpc80 22470 22471Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 22472is specified, the significands of results of floating-point operations are 22473rounded to 24 bits (single precision); @option{-mpc64} rounds the 22474significands of results of floating-point operations to 53 bits (double 22475precision) and @option{-mpc80} rounds the significands of results of 22476floating-point operations to 64 bits (extended double precision), which is 22477the default. When this option is used, floating-point operations in higher 22478precisions are not available to the programmer without setting the FPU 22479control word explicitly. 22480 22481Setting the rounding of floating-point operations to less than the default 2248280 bits can speed some programs by 2% or more. Note that some mathematical 22483libraries assume that extended-precision (80-bit) floating-point operations 22484are enabled by default; routines in such libraries could suffer significant 22485loss of accuracy, typically through so-called ``catastrophic cancellation'', 22486when this option is used to set the precision to less than extended precision. 22487 22488@item -mstackrealign 22489@opindex mstackrealign 22490Realign the stack at entry. On the x86, the @option{-mstackrealign} 22491option generates an alternate prologue and epilogue that realigns the 22492run-time stack if necessary. This supports mixing legacy codes that keep 224934-byte stack alignment with modern codes that keep 16-byte stack alignment for 22494SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 22495applicable to individual functions. 22496 22497@item -mpreferred-stack-boundary=@var{num} 22498@opindex mpreferred-stack-boundary 22499Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 22500byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 22501the default is 4 (16 bytes or 128 bits). 22502 22503@strong{Warning:} When generating code for the x86-64 architecture with 22504SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 22505used to keep the stack boundary aligned to 8 byte boundary. Since 22506x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 22507intended to be used in controlled environment where stack space is 22508important limitation. This option leads to wrong code when functions 22509compiled with 16 byte stack alignment (such as functions from a standard 22510library) are called with misaligned stack. In this case, SSE 22511instructions may lead to misaligned memory access traps. In addition, 22512variable arguments are handled incorrectly for 16 byte aligned 22513objects (including x87 long double and __int128), leading to wrong 22514results. You must build all modules with 22515@option{-mpreferred-stack-boundary=3}, including any libraries. This 22516includes the system libraries and startup modules. 22517 22518@item -mincoming-stack-boundary=@var{num} 22519@opindex mincoming-stack-boundary 22520Assume the incoming stack is aligned to a 2 raised to @var{num} byte 22521boundary. If @option{-mincoming-stack-boundary} is not specified, 22522the one specified by @option{-mpreferred-stack-boundary} is used. 22523 22524On Pentium and Pentium Pro, @code{double} and @code{long double} values 22525should be aligned to an 8-byte boundary (see @option{-malign-double}) or 22526suffer significant run time performance penalties. On Pentium III, the 22527Streaming SIMD Extension (SSE) data type @code{__m128} may not work 22528properly if it is not 16-byte aligned. 22529 22530To ensure proper alignment of this values on the stack, the stack boundary 22531must be as aligned as that required by any value stored on the stack. 22532Further, every function must be generated such that it keeps the stack 22533aligned. Thus calling a function compiled with a higher preferred 22534stack boundary from a function compiled with a lower preferred stack 22535boundary most likely misaligns the stack. It is recommended that 22536libraries that use callbacks always use the default setting. 22537 22538This extra alignment does consume extra stack space, and generally 22539increases code size. Code that is sensitive to stack space usage, such 22540as embedded systems and operating system kernels, may want to reduce the 22541preferred alignment to @option{-mpreferred-stack-boundary=2}. 22542 22543@need 200 22544@item -mmmx 22545@opindex mmmx 22546@need 200 22547@itemx -msse 22548@opindex msse 22549@need 200 22550@itemx -msse2 22551@need 200 22552@itemx -msse3 22553@need 200 22554@itemx -mssse3 22555@need 200 22556@itemx -msse4 22557@need 200 22558@itemx -msse4a 22559@need 200 22560@itemx -msse4.1 22561@need 200 22562@itemx -msse4.2 22563@need 200 22564@itemx -mavx 22565@opindex mavx 22566@need 200 22567@itemx -mavx2 22568@need 200 22569@itemx -mavx512f 22570@need 200 22571@itemx -mavx512pf 22572@need 200 22573@itemx -mavx512er 22574@need 200 22575@itemx -mavx512cd 22576@need 200 22577@itemx -msha 22578@opindex msha 22579@need 200 22580@itemx -maes 22581@opindex maes 22582@need 200 22583@itemx -mpclmul 22584@opindex mpclmul 22585@need 200 22586@itemx -mclfushopt 22587@opindex mclfushopt 22588@need 200 22589@itemx -mfsgsbase 22590@opindex mfsgsbase 22591@need 200 22592@itemx -mrdrnd 22593@opindex mrdrnd 22594@need 200 22595@itemx -mf16c 22596@opindex mf16c 22597@need 200 22598@itemx -mfma 22599@opindex mfma 22600@need 200 22601@itemx -mfma4 22602@need 200 22603@itemx -mno-fma4 22604@need 200 22605@itemx -mprefetchwt1 22606@opindex mprefetchwt1 22607@need 200 22608@itemx -mxop 22609@opindex mxop 22610@need 200 22611@itemx -mlwp 22612@opindex mlwp 22613@need 200 22614@itemx -m3dnow 22615@opindex m3dnow 22616@need 200 22617@itemx -mpopcnt 22618@opindex mpopcnt 22619@need 200 22620@itemx -mabm 22621@opindex mabm 22622@need 200 22623@itemx -mbmi 22624@opindex mbmi 22625@need 200 22626@itemx -mbmi2 22627@need 200 22628@itemx -mlzcnt 22629@opindex mlzcnt 22630@need 200 22631@itemx -mfxsr 22632@opindex mfxsr 22633@need 200 22634@itemx -mxsave 22635@opindex mxsave 22636@need 200 22637@itemx -mxsaveopt 22638@opindex mxsaveopt 22639@need 200 22640@itemx -mxsavec 22641@opindex mxsavec 22642@need 200 22643@itemx -mxsaves 22644@opindex mxsaves 22645@need 200 22646@itemx -mrtm 22647@opindex mrtm 22648@need 200 22649@itemx -mtbm 22650@opindex mtbm 22651@need 200 22652@itemx -mmpx 22653@opindex mmpx 22654@need 200 22655@itemx -mmwaitx 22656@opindex mmwaitx 22657These switches enable the use of instructions in the MMX, SSE, 22658SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD, 22659SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, 22660BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX or 3DNow!@: 22661extended instruction sets. Each has a corresponding @option{-mno-} option 22662to disable use of these instructions. 22663 22664These extensions are also available as built-in functions: see 22665@ref{x86 Built-in Functions}, for details of the functions enabled and 22666disabled by these switches. 22667 22668To generate SSE/SSE2 instructions automatically from floating-point 22669code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 22670 22671GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 22672generates new AVX instructions or AVX equivalence for all SSEx instructions 22673when needed. 22674 22675These options enable GCC to use these extended instructions in 22676generated code, even without @option{-mfpmath=sse}. Applications that 22677perform run-time CPU detection must compile separate files for each 22678supported architecture, using the appropriate flags. In particular, 22679the file containing the CPU detection code should be compiled without 22680these options. 22681 22682@item -mdump-tune-features 22683@opindex mdump-tune-features 22684This option instructs GCC to dump the names of the x86 performance 22685tuning features and default settings. The names can be used in 22686@option{-mtune-ctrl=@var{feature-list}}. 22687 22688@item -mtune-ctrl=@var{feature-list} 22689@opindex mtune-ctrl=@var{feature-list} 22690This option is used to do fine grain control of x86 code generation features. 22691@var{feature-list} is a comma separated list of @var{feature} names. See also 22692@option{-mdump-tune-features}. When specified, the @var{feature} is turned 22693on if it is not preceded with @samp{^}, otherwise, it is turned off. 22694@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 22695developers. Using it may lead to code paths not covered by testing and can 22696potentially result in compiler ICEs or runtime errors. 22697 22698@item -mno-default 22699@opindex mno-default 22700This option instructs GCC to turn off all tunable features. See also 22701@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 22702 22703@item -mcld 22704@opindex mcld 22705This option instructs GCC to emit a @code{cld} instruction in the prologue 22706of functions that use string instructions. String instructions depend on 22707the DF flag to select between autoincrement or autodecrement mode. While the 22708ABI specifies the DF flag to be cleared on function entry, some operating 22709systems violate this specification by not clearing the DF flag in their 22710exception dispatchers. The exception handler can be invoked with the DF flag 22711set, which leads to wrong direction mode when string instructions are used. 22712This option can be enabled by default on 32-bit x86 targets by configuring 22713GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 22714instructions can be suppressed with the @option{-mno-cld} compiler option 22715in this case. 22716 22717@item -mvzeroupper 22718@opindex mvzeroupper 22719This option instructs GCC to emit a @code{vzeroupper} instruction 22720before a transfer of control flow out of the function to minimize 22721the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 22722intrinsics. 22723 22724@item -mprefer-avx128 22725@opindex mprefer-avx128 22726This option instructs GCC to use 128-bit AVX instructions instead of 22727256-bit AVX instructions in the auto-vectorizer. 22728 22729@item -mcx16 22730@opindex mcx16 22731This option enables GCC to generate @code{CMPXCHG16B} instructions. 22732@code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword 22733(or oword) data types. 22734This is useful for high-resolution counters that can be updated 22735by multiple processors (or cores). This instruction is generated as part of 22736atomic built-in functions: see @ref{__sync Builtins} or 22737@ref{__atomic Builtins} for details. 22738 22739@item -msahf 22740@opindex msahf 22741This option enables generation of @code{SAHF} instructions in 64-bit code. 22742Early Intel Pentium 4 CPUs with Intel 64 support, 22743prior to the introduction of Pentium 4 G1 step in December 2005, 22744lacked the @code{LAHF} and @code{SAHF} instructions 22745which are supported by AMD64. 22746These are load and store instructions, respectively, for certain status flags. 22747In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 22748@code{drem}, and @code{remainder} built-in functions; 22749see @ref{Other Builtins} for details. 22750 22751@item -mmovbe 22752@opindex mmovbe 22753This option enables use of the @code{movbe} instruction to implement 22754@code{__builtin_bswap32} and @code{__builtin_bswap64}. 22755 22756@item -mcrc32 22757@opindex mcrc32 22758This option enables built-in functions @code{__builtin_ia32_crc32qi}, 22759@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 22760@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 22761 22762@item -mrecip 22763@opindex mrecip 22764This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 22765(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 22766with an additional Newton-Raphson step 22767to increase precision instead of @code{DIVSS} and @code{SQRTSS} 22768(and their vectorized 22769variants) for single-precision floating-point arguments. These instructions 22770are generated only when @option{-funsafe-math-optimizations} is enabled 22771together with @option{-finite-math-only} and @option{-fno-trapping-math}. 22772Note that while the throughput of the sequence is higher than the throughput 22773of the non-reciprocal instruction, the precision of the sequence can be 22774decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994). 22775 22776Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 22777(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 22778combination), and doesn't need @option{-mrecip}. 22779 22780Also note that GCC emits the above sequence with additional Newton-Raphson step 22781for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 22782already with @option{-ffast-math} (or the above option combination), and 22783doesn't need @option{-mrecip}. 22784 22785@item -mrecip=@var{opt} 22786@opindex mrecip=opt 22787This option controls which reciprocal estimate instructions 22788may be used. @var{opt} is a comma-separated list of options, which may 22789be preceded by a @samp{!} to invert the option: 22790 22791@table @samp 22792@item all 22793Enable all estimate instructions. 22794 22795@item default 22796Enable the default instructions, equivalent to @option{-mrecip}. 22797 22798@item none 22799Disable all estimate instructions, equivalent to @option{-mno-recip}. 22800 22801@item div 22802Enable the approximation for scalar division. 22803 22804@item vec-div 22805Enable the approximation for vectorized division. 22806 22807@item sqrt 22808Enable the approximation for scalar square root. 22809 22810@item vec-sqrt 22811Enable the approximation for vectorized square root. 22812@end table 22813 22814So, for example, @option{-mrecip=all,!sqrt} enables 22815all of the reciprocal approximations, except for square root. 22816 22817@item -mveclibabi=@var{type} 22818@opindex mveclibabi 22819Specifies the ABI type to use for vectorizing intrinsics using an 22820external library. Supported values for @var{type} are @samp{svml} 22821for the Intel short 22822vector math library and @samp{acml} for the AMD math core library. 22823To use this option, both @option{-ftree-vectorize} and 22824@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 22825ABI-compatible library must be specified at link time. 22826 22827GCC currently emits calls to @code{vmldExp2}, 22828@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2}, 22829@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 22830@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 22831@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 22832@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104}, 22833@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 22834@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 22835@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 22836@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 22837function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 22838@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 22839@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 22840@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 22841@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 22842when @option{-mveclibabi=acml} is used. 22843 22844@item -mabi=@var{name} 22845@opindex mabi 22846Generate code for the specified calling convention. Permissible values 22847are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 22848@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 22849ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 22850You can control this behavior for specific functions by 22851using the function attributes @code{ms_abi} and @code{sysv_abi}. 22852@xref{Function Attributes}. 22853 22854@item -mtls-dialect=@var{type} 22855@opindex mtls-dialect 22856Generate code to access thread-local storage using the @samp{gnu} or 22857@samp{gnu2} conventions. @samp{gnu} is the conservative default; 22858@samp{gnu2} is more efficient, but it may add compile- and run-time 22859requirements that cannot be satisfied on all systems. 22860 22861@item -mpush-args 22862@itemx -mno-push-args 22863@opindex mpush-args 22864@opindex mno-push-args 22865Use PUSH operations to store outgoing parameters. This method is shorter 22866and usually equally fast as method using SUB/MOV operations and is enabled 22867by default. In some cases disabling it may improve performance because of 22868improved scheduling and reduced dependencies. 22869 22870@item -maccumulate-outgoing-args 22871@opindex maccumulate-outgoing-args 22872If enabled, the maximum amount of space required for outgoing arguments is 22873computed in the function prologue. This is faster on most modern CPUs 22874because of reduced dependencies, improved scheduling and reduced stack usage 22875when the preferred stack boundary is not equal to 2. The drawback is a notable 22876increase in code size. This switch implies @option{-mno-push-args}. 22877 22878@item -mthreads 22879@opindex mthreads 22880Support thread-safe exception handling on MinGW. Programs that rely 22881on thread-safe exception handling must compile and link all code with the 22882@option{-mthreads} option. When compiling, @option{-mthreads} defines 22883@option{-D_MT}; when linking, it links in a special thread helper library 22884@option{-lmingwthrd} which cleans up per-thread exception-handling data. 22885 22886@item -mno-align-stringops 22887@opindex mno-align-stringops 22888Do not align the destination of inlined string operations. This switch reduces 22889code size and improves performance in case the destination is already aligned, 22890but GCC doesn't know about it. 22891 22892@item -minline-all-stringops 22893@opindex minline-all-stringops 22894By default GCC inlines string operations only when the destination is 22895known to be aligned to least a 4-byte boundary. 22896This enables more inlining and increases code 22897size, but may improve performance of code that depends on fast 22898@code{memcpy}, @code{strlen}, 22899and @code{memset} for short lengths. 22900 22901@item -minline-stringops-dynamically 22902@opindex minline-stringops-dynamically 22903For string operations of unknown size, use run-time checks with 22904inline code for small blocks and a library call for large blocks. 22905 22906@item -mstringop-strategy=@var{alg} 22907@opindex mstringop-strategy=@var{alg} 22908Override the internal decision heuristic for the particular algorithm to use 22909for inlining string operations. The allowed values for @var{alg} are: 22910 22911@table @samp 22912@item rep_byte 22913@itemx rep_4byte 22914@itemx rep_8byte 22915Expand using i386 @code{rep} prefix of the specified size. 22916 22917@item byte_loop 22918@itemx loop 22919@itemx unrolled_loop 22920Expand into an inline loop. 22921 22922@item libcall 22923Always use a library call. 22924@end table 22925 22926@item -mmemcpy-strategy=@var{strategy} 22927@opindex mmemcpy-strategy=@var{strategy} 22928Override the internal decision heuristic to decide if @code{__builtin_memcpy} 22929should be inlined and what inline algorithm to use when the expected size 22930of the copy operation is known. @var{strategy} 22931is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 22932@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 22933the max byte size with which inline algorithm @var{alg} is allowed. For the last 22934triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 22935in the list must be specified in increasing order. The minimal byte size for 22936@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 22937preceding range. 22938 22939@item -mmemset-strategy=@var{strategy} 22940@opindex mmemset-strategy=@var{strategy} 22941The option is similar to @option{-mmemcpy-strategy=} except that it is to control 22942@code{__builtin_memset} expansion. 22943 22944@item -momit-leaf-frame-pointer 22945@opindex momit-leaf-frame-pointer 22946Don't keep the frame pointer in a register for leaf functions. This 22947avoids the instructions to save, set up, and restore frame pointers and 22948makes an extra register available in leaf functions. The option 22949@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 22950which might make debugging harder. 22951 22952@item -mtls-direct-seg-refs 22953@itemx -mno-tls-direct-seg-refs 22954@opindex mtls-direct-seg-refs 22955Controls whether TLS variables may be accessed with offsets from the 22956TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 22957or whether the thread base pointer must be added. Whether or not this 22958is valid depends on the operating system, and whether it maps the 22959segment to cover the entire TLS area. 22960 22961For systems that use the GNU C Library, the default is on. 22962 22963@item -msse2avx 22964@itemx -mno-sse2avx 22965@opindex msse2avx 22966Specify that the assembler should encode SSE instructions with VEX 22967prefix. The option @option{-mavx} turns this on by default. 22968 22969@item -mfentry 22970@itemx -mno-fentry 22971@opindex mfentry 22972If profiling is active (@option{-pg}), put the profiling 22973counter call before the prologue. 22974Note: On x86 architectures the attribute @code{ms_hook_prologue} 22975isn't possible at the moment for @option{-mfentry} and @option{-pg}. 22976 22977@item -mrecord-mcount 22978@itemx -mno-record-mcount 22979@opindex mrecord-mcount 22980If profiling is active (@option{-pg}), generate a __mcount_loc section 22981that contains pointers to each profiling call. This is useful for 22982automatically patching and out calls. 22983 22984@item -mnop-mcount 22985@itemx -mno-nop-mcount 22986@opindex mnop-mcount 22987If profiling is active (@option{-pg}), generate the calls to 22988the profiling functions as nops. This is useful when they 22989should be patched in later dynamically. This is likely only 22990useful together with @option{-mrecord-mcount}. 22991 22992@item -mskip-rax-setup 22993@itemx -mno-skip-rax-setup 22994@opindex mskip-rax-setup 22995When generating code for the x86-64 architecture with SSE extensions 22996disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 22997register when there are no variable arguments passed in vector registers. 22998 22999@strong{Warning:} Since RAX register is used to avoid unnecessarily 23000saving vector registers on stack when passing variable arguments, the 23001impacts of this option are callees may waste some stack space, 23002misbehave or jump to a random location. GCC 4.4 or newer don't have 23003those issues, regardless the RAX register value. 23004 23005@item -m8bit-idiv 23006@itemx -mno-8bit-idiv 23007@opindex m8bit-idiv 23008On some processors, like Intel Atom, 8-bit unsigned integer divide is 23009much faster than 32-bit/64-bit integer divide. This option generates a 23010run-time check. If both dividend and divisor are within range of 0 23011to 255, 8-bit unsigned integer divide is used instead of 2301232-bit/64-bit integer divide. 23013 23014@item -mavx256-split-unaligned-load 23015@itemx -mavx256-split-unaligned-store 23016@opindex mavx256-split-unaligned-load 23017@opindex mavx256-split-unaligned-store 23018Split 32-byte AVX unaligned load and store. 23019 23020@item -mstack-protector-guard=@var{guard} 23021@opindex mstack-protector-guard=@var{guard} 23022Generate stack protection code using canary at @var{guard}. Supported 23023locations are @samp{global} for global canary or @samp{tls} for per-thread 23024canary in the TLS block (the default). This option has effect only when 23025@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 23026 23027@end table 23028 23029These @samp{-m} switches are supported in addition to the above 23030on x86-64 processors in 64-bit environments. 23031 23032@table @gcctabopt 23033@item -m32 23034@itemx -m64 23035@itemx -mx32 23036@itemx -m16 23037@opindex m32 23038@opindex m64 23039@opindex mx32 23040@opindex m16 23041Generate code for a 16-bit, 32-bit or 64-bit environment. 23042The @option{-m32} option sets @code{int}, @code{long}, and pointer types 23043to 32 bits, and 23044generates code that runs on any i386 system. 23045 23046The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 23047types to 64 bits, and generates code for the x86-64 architecture. 23048For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 23049and @option{-mdynamic-no-pic} options. 23050 23051The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 23052to 32 bits, and 23053generates code for the x86-64 architecture. 23054 23055The @option{-m16} option is the same as @option{-m32}, except for that 23056it outputs the @code{.code16gcc} assembly directive at the beginning of 23057the assembly output so that the binary can run in 16-bit mode. 23058 23059@item -mno-red-zone 23060@opindex mno-red-zone 23061Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 23062by the x86-64 ABI; it is a 128-byte area beyond the location of the 23063stack pointer that is not modified by signal or interrupt handlers 23064and therefore can be used for temporary data without adjusting the stack 23065pointer. The flag @option{-mno-red-zone} disables this red zone. 23066 23067@item -mcmodel=small 23068@opindex mcmodel=small 23069Generate code for the small code model: the program and its symbols must 23070be linked in the lower 2 GB of the address space. Pointers are 64 bits. 23071Programs can be statically or dynamically linked. This is the default 23072code model. 23073 23074@item -mcmodel=kernel 23075@opindex mcmodel=kernel 23076Generate code for the kernel code model. The kernel runs in the 23077negative 2 GB of the address space. 23078This model has to be used for Linux kernel code. 23079 23080@item -mcmodel=medium 23081@opindex mcmodel=medium 23082Generate code for the medium model: the program is linked in the lower 2 23083GB of the address space. Small symbols are also placed there. Symbols 23084with sizes larger than @option{-mlarge-data-threshold} are put into 23085large data or BSS sections and can be located above 2GB. Programs can 23086be statically or dynamically linked. 23087 23088@item -mcmodel=large 23089@opindex mcmodel=large 23090Generate code for the large model. This model makes no assumptions 23091about addresses and sizes of sections. 23092 23093@item -maddress-mode=long 23094@opindex maddress-mode=long 23095Generate code for long address mode. This is only supported for 64-bit 23096and x32 environments. It is the default address mode for 64-bit 23097environments. 23098 23099@item -maddress-mode=short 23100@opindex maddress-mode=short 23101Generate code for short address mode. This is only supported for 32-bit 23102and x32 environments. It is the default address mode for 32-bit and 23103x32 environments. 23104@end table 23105 23106@node x86 Windows Options 23107@subsection x86 Windows Options 23108@cindex x86 Windows Options 23109@cindex Windows Options for x86 23110 23111These additional options are available for Microsoft Windows targets: 23112 23113@table @gcctabopt 23114@item -mconsole 23115@opindex mconsole 23116This option 23117specifies that a console application is to be generated, by 23118instructing the linker to set the PE header subsystem type 23119required for console applications. 23120This option is available for Cygwin and MinGW targets and is 23121enabled by default on those targets. 23122 23123@item -mdll 23124@opindex mdll 23125This option is available for Cygwin and MinGW targets. It 23126specifies that a DLL---a dynamic link library---is to be 23127generated, enabling the selection of the required runtime 23128startup object and entry point. 23129 23130@item -mnop-fun-dllimport 23131@opindex mnop-fun-dllimport 23132This option is available for Cygwin and MinGW targets. It 23133specifies that the @code{dllimport} attribute should be ignored. 23134 23135@item -mthread 23136@opindex mthread 23137This option is available for MinGW targets. It specifies 23138that MinGW-specific thread support is to be used. 23139 23140@item -municode 23141@opindex municode 23142This option is available for MinGW-w64 targets. It causes 23143the @code{UNICODE} preprocessor macro to be predefined, and 23144chooses Unicode-capable runtime startup code. 23145 23146@item -mwin32 23147@opindex mwin32 23148This option is available for Cygwin and MinGW targets. It 23149specifies that the typical Microsoft Windows predefined macros are to 23150be set in the pre-processor, but does not influence the choice 23151of runtime library/startup code. 23152 23153@item -mwindows 23154@opindex mwindows 23155This option is available for Cygwin and MinGW targets. It 23156specifies that a GUI application is to be generated by 23157instructing the linker to set the PE header subsystem type 23158appropriately. 23159 23160@item -fno-set-stack-executable 23161@opindex fno-set-stack-executable 23162This option is available for MinGW targets. It specifies that 23163the executable flag for the stack used by nested functions isn't 23164set. This is necessary for binaries running in kernel mode of 23165Microsoft Windows, as there the User32 API, which is used to set executable 23166privileges, isn't available. 23167 23168@item -fwritable-relocated-rdata 23169@opindex fno-writable-relocated-rdata 23170This option is available for MinGW and Cygwin targets. It specifies 23171that relocated-data in read-only section is put into .data 23172section. This is a necessary for older runtimes not supporting 23173modification of .rdata sections for pseudo-relocation. 23174 23175@item -mpe-aligned-commons 23176@opindex mpe-aligned-commons 23177This option is available for Cygwin and MinGW targets. It 23178specifies that the GNU extension to the PE file format that 23179permits the correct alignment of COMMON variables should be 23180used when generating code. It is enabled by default if 23181GCC detects that the target assembler found during configuration 23182supports the feature. 23183@end table 23184 23185See also under @ref{x86 Options} for standard options. 23186 23187@node Xstormy16 Options 23188@subsection Xstormy16 Options 23189@cindex Xstormy16 Options 23190 23191These options are defined for Xstormy16: 23192 23193@table @gcctabopt 23194@item -msim 23195@opindex msim 23196Choose startup files and linker script suitable for the simulator. 23197@end table 23198 23199@node Xtensa Options 23200@subsection Xtensa Options 23201@cindex Xtensa Options 23202 23203These options are supported for Xtensa targets: 23204 23205@table @gcctabopt 23206@item -mconst16 23207@itemx -mno-const16 23208@opindex mconst16 23209@opindex mno-const16 23210Enable or disable use of @code{CONST16} instructions for loading 23211constant values. The @code{CONST16} instruction is currently not a 23212standard option from Tensilica. When enabled, @code{CONST16} 23213instructions are always used in place of the standard @code{L32R} 23214instructions. The use of @code{CONST16} is enabled by default only if 23215the @code{L32R} instruction is not available. 23216 23217@item -mfused-madd 23218@itemx -mno-fused-madd 23219@opindex mfused-madd 23220@opindex mno-fused-madd 23221Enable or disable use of fused multiply/add and multiply/subtract 23222instructions in the floating-point option. This has no effect if the 23223floating-point option is not also enabled. Disabling fused multiply/add 23224and multiply/subtract instructions forces the compiler to use separate 23225instructions for the multiply and add/subtract operations. This may be 23226desirable in some cases where strict IEEE 754-compliant results are 23227required: the fused multiply add/subtract instructions do not round the 23228intermediate result, thereby producing results with @emph{more} bits of 23229precision than specified by the IEEE standard. Disabling fused multiply 23230add/subtract instructions also ensures that the program output is not 23231sensitive to the compiler's ability to combine multiply and add/subtract 23232operations. 23233 23234@item -mserialize-volatile 23235@itemx -mno-serialize-volatile 23236@opindex mserialize-volatile 23237@opindex mno-serialize-volatile 23238When this option is enabled, GCC inserts @code{MEMW} instructions before 23239@code{volatile} memory references to guarantee sequential consistency. 23240The default is @option{-mserialize-volatile}. Use 23241@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 23242 23243@item -mforce-no-pic 23244@opindex mforce-no-pic 23245For targets, like GNU/Linux, where all user-mode Xtensa code must be 23246position-independent code (PIC), this option disables PIC for compiling 23247kernel code. 23248 23249@item -mtext-section-literals 23250@itemx -mno-text-section-literals 23251@opindex mtext-section-literals 23252@opindex mno-text-section-literals 23253These options control the treatment of literal pools. The default is 23254@option{-mno-text-section-literals}, which places literals in a separate 23255section in the output file. This allows the literal pool to be placed 23256in a data RAM/ROM, and it also allows the linker to combine literal 23257pools from separate object files to remove redundant literals and 23258improve code size. With @option{-mtext-section-literals}, the literals 23259are interspersed in the text section in order to keep them as close as 23260possible to their references. This may be necessary for large assembly 23261files. 23262 23263@item -mtarget-align 23264@itemx -mno-target-align 23265@opindex mtarget-align 23266@opindex mno-target-align 23267When this option is enabled, GCC instructs the assembler to 23268automatically align instructions to reduce branch penalties at the 23269expense of some code density. The assembler attempts to widen density 23270instructions to align branch targets and the instructions following call 23271instructions. If there are not enough preceding safe density 23272instructions to align a target, no widening is performed. The 23273default is @option{-mtarget-align}. These options do not affect the 23274treatment of auto-aligned instructions like @code{LOOP}, which the 23275assembler always aligns, either by widening density instructions or 23276by inserting NOP instructions. 23277 23278@item -mlongcalls 23279@itemx -mno-longcalls 23280@opindex mlongcalls 23281@opindex mno-longcalls 23282When this option is enabled, GCC instructs the assembler to translate 23283direct calls to indirect calls unless it can determine that the target 23284of a direct call is in the range allowed by the call instruction. This 23285translation typically occurs for calls to functions in other source 23286files. Specifically, the assembler translates a direct @code{CALL} 23287instruction into an @code{L32R} followed by a @code{CALLX} instruction. 23288The default is @option{-mno-longcalls}. This option should be used in 23289programs where the call target can potentially be out of range. This 23290option is implemented in the assembler, not the compiler, so the 23291assembly code generated by GCC still shows direct call 23292instructions---look at the disassembled object code to see the actual 23293instructions. Note that the assembler uses an indirect call for 23294every cross-file call, not just those that really are out of range. 23295@end table 23296 23297@node zSeries Options 23298@subsection zSeries Options 23299@cindex zSeries options 23300 23301These are listed under @xref{S/390 and zSeries Options}. 23302 23303@node Code Gen Options 23304@section Options for Code Generation Conventions 23305@cindex code generation conventions 23306@cindex options, code generation 23307@cindex run-time options 23308 23309These machine-independent options control the interface conventions 23310used in code generation. 23311 23312Most of them have both positive and negative forms; the negative form 23313of @option{-ffoo} is @option{-fno-foo}. In the table below, only 23314one of the forms is listed---the one that is not the default. You 23315can figure out the other form by either removing @samp{no-} or adding 23316it. 23317 23318@table @gcctabopt 23319@item -fbounds-check 23320@opindex fbounds-check 23321For front ends that support it, generate additional code to check that 23322indices used to access arrays are within the declared range. This is 23323currently only supported by the Java and Fortran front ends, where 23324this option defaults to true and false respectively. 23325 23326@item -fstack-reuse=@var{reuse-level} 23327@opindex fstack_reuse 23328This option controls stack space reuse for user declared local/auto variables 23329and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 23330@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 23331local variables and temporaries, @samp{named_vars} enables the reuse only for 23332user defined local variables with names, and @samp{none} disables stack reuse 23333completely. The default value is @samp{all}. The option is needed when the 23334program extends the lifetime of a scoped local variable or a compiler generated 23335temporary beyond the end point defined by the language. When a lifetime of 23336a variable ends, and if the variable lives in memory, the optimizing compiler 23337has the freedom to reuse its stack space with other temporaries or scoped 23338local variables whose live range does not overlap with it. Legacy code extending 23339local lifetime is likely to break with the stack reuse optimization. 23340 23341For example, 23342 23343@smallexample 23344 int *p; 23345 @{ 23346 int local1; 23347 23348 p = &local1; 23349 local1 = 10; 23350 .... 23351 @} 23352 @{ 23353 int local2; 23354 local2 = 20; 23355 ... 23356 @} 23357 23358 if (*p == 10) // out of scope use of local1 23359 @{ 23360 23361 @} 23362@end smallexample 23363 23364Another example: 23365@smallexample 23366 23367 struct A 23368 @{ 23369 A(int k) : i(k), j(k) @{ @} 23370 int i; 23371 int j; 23372 @}; 23373 23374 A *ap; 23375 23376 void foo(const A& ar) 23377 @{ 23378 ap = &ar; 23379 @} 23380 23381 void bar() 23382 @{ 23383 foo(A(10)); // temp object's lifetime ends when foo returns 23384 23385 @{ 23386 A a(20); 23387 .... 23388 @} 23389 ap->i+= 10; // ap references out of scope temp whose space 23390 // is reused with a. What is the value of ap->i? 23391 @} 23392 23393@end smallexample 23394 23395The lifetime of a compiler generated temporary is well defined by the C++ 23396standard. When a lifetime of a temporary ends, and if the temporary lives 23397in memory, the optimizing compiler has the freedom to reuse its stack 23398space with other temporaries or scoped local variables whose live range 23399does not overlap with it. However some of the legacy code relies on 23400the behavior of older compilers in which temporaries' stack space is 23401not reused, the aggressive stack reuse can lead to runtime errors. This 23402option is used to control the temporary stack reuse optimization. 23403 23404@item -ftrapv 23405@opindex ftrapv 23406This option generates traps for signed overflow on addition, subtraction, 23407multiplication operations. 23408 23409@item -fwrapv 23410@opindex fwrapv 23411This option instructs the compiler to assume that signed arithmetic 23412overflow of addition, subtraction and multiplication wraps around 23413using twos-complement representation. This flag enables some optimizations 23414and disables others. This option is enabled by default for the Java 23415front end, as required by the Java language specification. 23416 23417@item -fexceptions 23418@opindex fexceptions 23419Enable exception handling. Generates extra code needed to propagate 23420exceptions. For some targets, this implies GCC generates frame 23421unwind information for all functions, which can produce significant data 23422size overhead, although it does not affect execution. If you do not 23423specify this option, GCC enables it by default for languages like 23424C++ that normally require exception handling, and disables it for 23425languages like C that do not normally require it. However, you may need 23426to enable this option when compiling C code that needs to interoperate 23427properly with exception handlers written in C++. You may also wish to 23428disable this option if you are compiling older C++ programs that don't 23429use exception handling. 23430 23431@item -fnon-call-exceptions 23432@opindex fnon-call-exceptions 23433Generate code that allows trapping instructions to throw exceptions. 23434Note that this requires platform-specific runtime support that does 23435not exist everywhere. Moreover, it only allows @emph{trapping} 23436instructions to throw exceptions, i.e.@: memory references or floating-point 23437instructions. It does not allow exceptions to be thrown from 23438arbitrary signal handlers such as @code{SIGALRM}. 23439 23440@item -fdelete-dead-exceptions 23441@opindex fdelete-dead-exceptions 23442Consider that instructions that may throw exceptions but don't otherwise 23443contribute to the execution of the program can be optimized away. 23444This option is enabled by default for the Ada front end, as permitted by 23445the Ada language specification. 23446Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 23447 23448@item -funwind-tables 23449@opindex funwind-tables 23450Similar to @option{-fexceptions}, except that it just generates any needed 23451static data, but does not affect the generated code in any other way. 23452You normally do not need to enable this option; instead, a language processor 23453that needs this handling enables it on your behalf. 23454 23455@item -fasynchronous-unwind-tables 23456@opindex fasynchronous-unwind-tables 23457Generate unwind table in DWARF 2 format, if supported by target machine. The 23458table is exact at each instruction boundary, so it can be used for stack 23459unwinding from asynchronous events (such as debugger or garbage collector). 23460 23461@item -fno-gnu-unique 23462@opindex fno-gnu-unique 23463On systems with recent GNU assembler and C library, the C++ compiler 23464uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 23465of template static data members and static local variables in inline 23466functions are unique even in the presence of @code{RTLD_LOCAL}; this 23467is necessary to avoid problems with a library used by two different 23468@code{RTLD_LOCAL} plugins depending on a definition in one of them and 23469therefore disagreeing with the other one about the binding of the 23470symbol. But this causes @code{dlclose} to be ignored for affected 23471DSOs; if your program relies on reinitialization of a DSO via 23472@code{dlclose} and @code{dlopen}, you can use 23473@option{-fno-gnu-unique}. 23474 23475@item -fpcc-struct-return 23476@opindex fpcc-struct-return 23477Return ``short'' @code{struct} and @code{union} values in memory like 23478longer ones, rather than in registers. This convention is less 23479efficient, but it has the advantage of allowing intercallability between 23480GCC-compiled files and files compiled with other compilers, particularly 23481the Portable C Compiler (pcc). 23482 23483The precise convention for returning structures in memory depends 23484on the target configuration macros. 23485 23486Short structures and unions are those whose size and alignment match 23487that of some integer type. 23488 23489@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 23490switch is not binary compatible with code compiled with the 23491@option{-freg-struct-return} switch. 23492Use it to conform to a non-default application binary interface. 23493 23494@item -freg-struct-return 23495@opindex freg-struct-return 23496Return @code{struct} and @code{union} values in registers when possible. 23497This is more efficient for small structures than 23498@option{-fpcc-struct-return}. 23499 23500If you specify neither @option{-fpcc-struct-return} nor 23501@option{-freg-struct-return}, GCC defaults to whichever convention is 23502standard for the target. If there is no standard convention, GCC 23503defaults to @option{-fpcc-struct-return}, except on targets where GCC is 23504the principal compiler. In those cases, we can choose the standard, and 23505we chose the more efficient register return alternative. 23506 23507@strong{Warning:} code compiled with the @option{-freg-struct-return} 23508switch is not binary compatible with code compiled with the 23509@option{-fpcc-struct-return} switch. 23510Use it to conform to a non-default application binary interface. 23511 23512@item -fshort-enums 23513@opindex fshort-enums 23514Allocate to an @code{enum} type only as many bytes as it needs for the 23515declared range of possible values. Specifically, the @code{enum} type 23516is equivalent to the smallest integer type that has enough room. 23517 23518@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 23519code that is not binary compatible with code generated without that switch. 23520Use it to conform to a non-default application binary interface. 23521 23522@item -fshort-double 23523@opindex fshort-double 23524Use the same size for @code{double} as for @code{float}. 23525 23526@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 23527code that is not binary compatible with code generated without that switch. 23528Use it to conform to a non-default application binary interface. 23529 23530@item -fshort-wchar 23531@opindex fshort-wchar 23532Override the underlying type for @code{wchar_t} to be @code{short 23533unsigned int} instead of the default for the target. This option is 23534useful for building programs to run under WINE@. 23535 23536@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 23537code that is not binary compatible with code generated without that switch. 23538Use it to conform to a non-default application binary interface. 23539 23540@item -fno-common 23541@opindex fno-common 23542In C code, controls the placement of uninitialized global variables. 23543Unix C compilers have traditionally permitted multiple definitions of 23544such variables in different compilation units by placing the variables 23545in a common block. 23546This is the behavior specified by @option{-fcommon}, and is the default 23547for GCC on most targets. 23548On the other hand, this behavior is not required by ISO C, and on some 23549targets may carry a speed or code size penalty on variable references. 23550The @option{-fno-common} option specifies that the compiler should place 23551uninitialized global variables in the data section of the object file, 23552rather than generating them as common blocks. 23553This has the effect that if the same variable is declared 23554(without @code{extern}) in two different compilations, 23555you get a multiple-definition error when you link them. 23556In this case, you must compile with @option{-fcommon} instead. 23557Compiling with @option{-fno-common} is useful on targets for which 23558it provides better performance, or if you wish to verify that the 23559program will work on other systems that always treat uninitialized 23560variable declarations this way. 23561 23562@item -fno-ident 23563@opindex fno-ident 23564Ignore the @code{#ident} directive. 23565 23566@item -finhibit-size-directive 23567@opindex finhibit-size-directive 23568Don't output a @code{.size} assembler directive, or anything else that 23569would cause trouble if the function is split in the middle, and the 23570two halves are placed at locations far apart in memory. This option is 23571used when compiling @file{crtstuff.c}; you should not need to use it 23572for anything else. 23573 23574@item -fverbose-asm 23575@opindex fverbose-asm 23576Put extra commentary information in the generated assembly code to 23577make it more readable. This option is generally only of use to those 23578who actually need to read the generated assembly code (perhaps while 23579debugging the compiler itself). 23580 23581@option{-fno-verbose-asm}, the default, causes the 23582extra information to be omitted and is useful when comparing two assembler 23583files. 23584 23585@item -frecord-gcc-switches 23586@opindex frecord-gcc-switches 23587This switch causes the command line used to invoke the 23588compiler to be recorded into the object file that is being created. 23589This switch is only implemented on some targets and the exact format 23590of the recording is target and binary file format dependent, but it 23591usually takes the form of a section containing ASCII text. This 23592switch is related to the @option{-fverbose-asm} switch, but that 23593switch only records information in the assembler output file as 23594comments, so it never reaches the object file. 23595See also @option{-grecord-gcc-switches} for another 23596way of storing compiler options into the object file. 23597 23598@item -fpic 23599@opindex fpic 23600@cindex global offset table 23601@cindex PIC 23602Generate position-independent code (PIC) suitable for use in a shared 23603library, if supported for the target machine. Such code accesses all 23604constant addresses through a global offset table (GOT)@. The dynamic 23605loader resolves the GOT entries when the program starts (the dynamic 23606loader is not part of GCC; it is part of the operating system). If 23607the GOT size for the linked executable exceeds a machine-specific 23608maximum size, you get an error message from the linker indicating that 23609@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 23610instead. (These maximums are 8k on the SPARC and 32k 23611on the m68k and RS/6000. The x86 has no such limit.) 23612 23613Position-independent code requires special support, and therefore works 23614only on certain machines. For the x86, GCC supports PIC for System V 23615but not for the Sun 386i. Code generated for the IBM RS/6000 is always 23616position-independent. 23617 23618When this flag is set, the macros @code{__pic__} and @code{__PIC__} 23619are defined to 1. 23620 23621@item -fPIC 23622@opindex fPIC 23623If supported for the target machine, emit position-independent code, 23624suitable for dynamic linking and avoiding any limit on the size of the 23625global offset table. This option makes a difference on the m68k, 23626PowerPC and SPARC@. 23627 23628Position-independent code requires special support, and therefore works 23629only on certain machines. 23630 23631When this flag is set, the macros @code{__pic__} and @code{__PIC__} 23632are defined to 2. 23633 23634@item -fpie 23635@itemx -fPIE 23636@opindex fpie 23637@opindex fPIE 23638These options are similar to @option{-fpic} and @option{-fPIC}, but 23639generated position independent code can be only linked into executables. 23640Usually these options are used when @option{-pie} GCC option is 23641used during linking. 23642 23643@option{-fpie} and @option{-fPIE} both define the macros 23644@code{__pie__} and @code{__PIE__}. The macros have the value 1 23645for @option{-fpie} and 2 for @option{-fPIE}. 23646 23647@item -fno-jump-tables 23648@opindex fno-jump-tables 23649Do not use jump tables for switch statements even where it would be 23650more efficient than other code generation strategies. This option is 23651of use in conjunction with @option{-fpic} or @option{-fPIC} for 23652building code that forms part of a dynamic linker and cannot 23653reference the address of a jump table. On some targets, jump tables 23654do not require a GOT and this option is not needed. 23655 23656@item -ffixed-@var{reg} 23657@opindex ffixed 23658Treat the register named @var{reg} as a fixed register; generated code 23659should never refer to it (except perhaps as a stack pointer, frame 23660pointer or in some other fixed role). 23661 23662@var{reg} must be the name of a register. The register names accepted 23663are machine-specific and are defined in the @code{REGISTER_NAMES} 23664macro in the machine description macro file. 23665 23666This flag does not have a negative form, because it specifies a 23667three-way choice. 23668 23669@item -fcall-used-@var{reg} 23670@opindex fcall-used 23671Treat the register named @var{reg} as an allocable register that is 23672clobbered by function calls. It may be allocated for temporaries or 23673variables that do not live across a call. Functions compiled this way 23674do not save and restore the register @var{reg}. 23675 23676It is an error to use this flag with the frame pointer or stack pointer. 23677Use of this flag for other registers that have fixed pervasive roles in 23678the machine's execution model produces disastrous results. 23679 23680This flag does not have a negative form, because it specifies a 23681three-way choice. 23682 23683@item -fcall-saved-@var{reg} 23684@opindex fcall-saved 23685Treat the register named @var{reg} as an allocable register saved by 23686functions. It may be allocated even for temporaries or variables that 23687live across a call. Functions compiled this way save and restore 23688the register @var{reg} if they use it. 23689 23690It is an error to use this flag with the frame pointer or stack pointer. 23691Use of this flag for other registers that have fixed pervasive roles in 23692the machine's execution model produces disastrous results. 23693 23694A different sort of disaster results from the use of this flag for 23695a register in which function values may be returned. 23696 23697This flag does not have a negative form, because it specifies a 23698three-way choice. 23699 23700@item -fpack-struct[=@var{n}] 23701@opindex fpack-struct 23702Without a value specified, pack all structure members together without 23703holes. When a value is specified (which must be a small power of two), pack 23704structure members according to this value, representing the maximum 23705alignment (that is, objects with default alignment requirements larger than 23706this are output potentially unaligned at the next fitting location. 23707 23708@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 23709code that is not binary compatible with code generated without that switch. 23710Additionally, it makes the code suboptimal. 23711Use it to conform to a non-default application binary interface. 23712 23713@item -finstrument-functions 23714@opindex finstrument-functions 23715Generate instrumentation calls for entry and exit to functions. Just 23716after function entry and just before function exit, the following 23717profiling functions are called with the address of the current 23718function and its call site. (On some platforms, 23719@code{__builtin_return_address} does not work beyond the current 23720function, so the call site information may not be available to the 23721profiling functions otherwise.) 23722 23723@smallexample 23724void __cyg_profile_func_enter (void *this_fn, 23725 void *call_site); 23726void __cyg_profile_func_exit (void *this_fn, 23727 void *call_site); 23728@end smallexample 23729 23730The first argument is the address of the start of the current function, 23731which may be looked up exactly in the symbol table. 23732 23733This instrumentation is also done for functions expanded inline in other 23734functions. The profiling calls indicate where, conceptually, the 23735inline function is entered and exited. This means that addressable 23736versions of such functions must be available. If all your uses of a 23737function are expanded inline, this may mean an additional expansion of 23738code size. If you use @code{extern inline} in your C code, an 23739addressable version of such functions must be provided. (This is 23740normally the case anyway, but if you get lucky and the optimizer always 23741expands the functions inline, you might have gotten away without 23742providing static copies.) 23743 23744A function may be given the attribute @code{no_instrument_function}, in 23745which case this instrumentation is not done. This can be used, for 23746example, for the profiling functions listed above, high-priority 23747interrupt routines, and any functions from which the profiling functions 23748cannot safely be called (perhaps signal handlers, if the profiling 23749routines generate output or allocate memory). 23750 23751@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 23752@opindex finstrument-functions-exclude-file-list 23753 23754Set the list of functions that are excluded from instrumentation (see 23755the description of @option{-finstrument-functions}). If the file that 23756contains a function definition matches with one of @var{file}, then 23757that function is not instrumented. The match is done on substrings: 23758if the @var{file} parameter is a substring of the file name, it is 23759considered to be a match. 23760 23761For example: 23762 23763@smallexample 23764-finstrument-functions-exclude-file-list=/bits/stl,include/sys 23765@end smallexample 23766 23767@noindent 23768excludes any inline function defined in files whose pathnames 23769contain @file{/bits/stl} or @file{include/sys}. 23770 23771If, for some reason, you want to include letter @samp{,} in one of 23772@var{sym}, write @samp{\,}. For example, 23773@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 23774(note the single quote surrounding the option). 23775 23776@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 23777@opindex finstrument-functions-exclude-function-list 23778 23779This is similar to @option{-finstrument-functions-exclude-file-list}, 23780but this option sets the list of function names to be excluded from 23781instrumentation. The function name to be matched is its user-visible 23782name, such as @code{vector<int> blah(const vector<int> &)}, not the 23783internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 23784match is done on substrings: if the @var{sym} parameter is a substring 23785of the function name, it is considered to be a match. For C99 and C++ 23786extended identifiers, the function name must be given in UTF-8, not 23787using universal character names. 23788 23789@item -fstack-check 23790@opindex fstack-check 23791Generate code to verify that you do not go beyond the boundary of the 23792stack. You should specify this flag if you are running in an 23793environment with multiple threads, but you only rarely need to specify it in 23794a single-threaded environment since stack overflow is automatically 23795detected on nearly all systems if there is only one stack. 23796 23797Note that this switch does not actually cause checking to be done; the 23798operating system or the language runtime must do that. The switch causes 23799generation of code to ensure that they see the stack being extended. 23800 23801You can additionally specify a string parameter: @samp{no} means no 23802checking, @samp{generic} means force the use of old-style checking, 23803@samp{specific} means use the best checking method and is equivalent 23804to bare @option{-fstack-check}. 23805 23806Old-style checking is a generic mechanism that requires no specific 23807target support in the compiler but comes with the following drawbacks: 23808 23809@enumerate 23810@item 23811Modified allocation strategy for large objects: they are always 23812allocated dynamically if their size exceeds a fixed threshold. 23813 23814@item 23815Fixed limit on the size of the static frame of functions: when it is 23816topped by a particular function, stack checking is not reliable and 23817a warning is issued by the compiler. 23818 23819@item 23820Inefficiency: because of both the modified allocation strategy and the 23821generic implementation, code performance is hampered. 23822@end enumerate 23823 23824Note that old-style stack checking is also the fallback method for 23825@samp{specific} if no target support has been added in the compiler. 23826 23827@item -fstack-limit-register=@var{reg} 23828@itemx -fstack-limit-symbol=@var{sym} 23829@itemx -fno-stack-limit 23830@opindex fstack-limit-register 23831@opindex fstack-limit-symbol 23832@opindex fno-stack-limit 23833Generate code to ensure that the stack does not grow beyond a certain value, 23834either the value of a register or the address of a symbol. If a larger 23835stack is required, a signal is raised at run time. For most targets, 23836the signal is raised before the stack overruns the boundary, so 23837it is possible to catch the signal without taking special precautions. 23838 23839For instance, if the stack starts at absolute address @samp{0x80000000} 23840and grows downwards, you can use the flags 23841@option{-fstack-limit-symbol=__stack_limit} and 23842@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 23843of 128KB@. Note that this may only work with the GNU linker. 23844 23845@item -fsplit-stack 23846@opindex fsplit-stack 23847Generate code to automatically split the stack before it overflows. 23848The resulting program has a discontiguous stack which can only 23849overflow if the program is unable to allocate any more memory. This 23850is most useful when running threaded programs, as it is no longer 23851necessary to calculate a good stack size to use for each thread. This 23852is currently only implemented for the x86 targets running 23853GNU/Linux. 23854 23855When code compiled with @option{-fsplit-stack} calls code compiled 23856without @option{-fsplit-stack}, there may not be much stack space 23857available for the latter code to run. If compiling all code, 23858including library code, with @option{-fsplit-stack} is not an option, 23859then the linker can fix up these calls so that the code compiled 23860without @option{-fsplit-stack} always has a large stack. Support for 23861this is implemented in the gold linker in GNU binutils release 2.21 23862and later. 23863 23864@item -fleading-underscore 23865@opindex fleading-underscore 23866This option and its counterpart, @option{-fno-leading-underscore}, forcibly 23867change the way C symbols are represented in the object file. One use 23868is to help link with legacy assembly code. 23869 23870@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 23871generate code that is not binary compatible with code generated without that 23872switch. Use it to conform to a non-default application binary interface. 23873Not all targets provide complete support for this switch. 23874 23875@item -ftls-model=@var{model} 23876@opindex ftls-model 23877Alter the thread-local storage model to be used (@pxref{Thread-Local}). 23878The @var{model} argument should be one of @samp{global-dynamic}, 23879@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 23880Note that the choice is subject to optimization: the compiler may use 23881a more efficient model for symbols not visible outside of the translation 23882unit, or if @option{-fpic} is not given on the command line. 23883 23884The default without @option{-fpic} is @samp{initial-exec}; with 23885@option{-fpic} the default is @samp{global-dynamic}. 23886 23887@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 23888@opindex fvisibility 23889Set the default ELF image symbol visibility to the specified option---all 23890symbols are marked with this unless overridden within the code. 23891Using this feature can very substantially improve linking and 23892load times of shared object libraries, produce more optimized 23893code, provide near-perfect API export and prevent symbol clashes. 23894It is @strong{strongly} recommended that you use this in any shared objects 23895you distribute. 23896 23897Despite the nomenclature, @samp{default} always means public; i.e., 23898available to be linked against from outside the shared object. 23899@samp{protected} and @samp{internal} are pretty useless in real-world 23900usage so the only other commonly used option is @samp{hidden}. 23901The default if @option{-fvisibility} isn't specified is 23902@samp{default}, i.e., make every symbol public. 23903 23904A good explanation of the benefits offered by ensuring ELF 23905symbols have the correct visibility is given by ``How To Write 23906Shared Libraries'' by Ulrich Drepper (which can be found at 23907@w{@uref{http://www.akkadia.org/drepper/}})---however a superior 23908solution made possible by this option to marking things hidden when 23909the default is public is to make the default hidden and mark things 23910public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 23911and @code{__attribute__ ((visibility("default")))} instead of 23912@code{__declspec(dllexport)} you get almost identical semantics with 23913identical syntax. This is a great boon to those working with 23914cross-platform projects. 23915 23916For those adding visibility support to existing code, you may find 23917@code{#pragma GCC visibility} of use. This works by you enclosing 23918the declarations you wish to set visibility for with (for example) 23919@code{#pragma GCC visibility push(hidden)} and 23920@code{#pragma GCC visibility pop}. 23921Bear in mind that symbol visibility should be viewed @strong{as 23922part of the API interface contract} and thus all new code should 23923always specify visibility when it is not the default; i.e., declarations 23924only for use within the local DSO should @strong{always} be marked explicitly 23925as hidden as so to avoid PLT indirection overheads---making this 23926abundantly clear also aids readability and self-documentation of the code. 23927Note that due to ISO C++ specification requirements, @code{operator new} and 23928@code{operator delete} must always be of default visibility. 23929 23930Be aware that headers from outside your project, in particular system 23931headers and headers from any other library you use, may not be 23932expecting to be compiled with visibility other than the default. You 23933may need to explicitly say @code{#pragma GCC visibility push(default)} 23934before including any such headers. 23935 23936@code{extern} declarations are not affected by @option{-fvisibility}, so 23937a lot of code can be recompiled with @option{-fvisibility=hidden} with 23938no modifications. However, this means that calls to @code{extern} 23939functions with no explicit visibility use the PLT, so it is more 23940effective to use @code{__attribute ((visibility))} and/or 23941@code{#pragma GCC visibility} to tell the compiler which @code{extern} 23942declarations should be treated as hidden. 23943 23944Note that @option{-fvisibility} does affect C++ vague linkage 23945entities. This means that, for instance, an exception class that is 23946be thrown between DSOs must be explicitly marked with default 23947visibility so that the @samp{type_info} nodes are unified between 23948the DSOs. 23949 23950An overview of these techniques, their benefits and how to use them 23951is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 23952 23953@item -fstrict-volatile-bitfields 23954@opindex fstrict-volatile-bitfields 23955This option should be used if accesses to volatile bit-fields (or other 23956structure fields, although the compiler usually honors those types 23957anyway) should use a single access of the width of the 23958field's type, aligned to a natural alignment if possible. For 23959example, targets with memory-mapped peripheral registers might require 23960all such accesses to be 16 bits wide; with this flag you can 23961declare all peripheral bit-fields as @code{unsigned short} (assuming short 23962is 16 bits on these targets) to force GCC to use 16-bit accesses 23963instead of, perhaps, a more efficient 32-bit access. 23964 23965If this option is disabled, the compiler uses the most efficient 23966instruction. In the previous example, that might be a 32-bit load 23967instruction, even though that accesses bytes that do not contain 23968any portion of the bit-field, or memory-mapped registers unrelated to 23969the one being updated. 23970 23971In some cases, such as when the @code{packed} attribute is applied to a 23972structure field, it may not be possible to access the field with a single 23973read or write that is correctly aligned for the target machine. In this 23974case GCC falls back to generating multiple accesses rather than code that 23975will fault or truncate the result at run time. 23976 23977Note: Due to restrictions of the C/C++11 memory model, write accesses are 23978not allowed to touch non bit-field members. It is therefore recommended 23979to define all bits of the field's type as bit-field members. 23980 23981The default value of this option is determined by the application binary 23982interface for the target processor. 23983 23984@item -fsync-libcalls 23985@opindex fsync-libcalls 23986This option controls whether any out-of-line instance of the @code{__sync} 23987family of functions may be used to implement the C++11 @code{__atomic} 23988family of functions. 23989 23990The default value of this option is enabled, thus the only useful form 23991of the option is @option{-fno-sync-libcalls}. This option is used in 23992the implementation of the @file{libatomic} runtime library. 23993 23994@end table 23995 23996@c man end 23997 23998@node Environment Variables 23999@section Environment Variables Affecting GCC 24000@cindex environment variables 24001 24002@c man begin ENVIRONMENT 24003This section describes several environment variables that affect how GCC 24004operates. Some of them work by specifying directories or prefixes to use 24005when searching for various kinds of files. Some are used to specify other 24006aspects of the compilation environment. 24007 24008Note that you can also specify places to search using options such as 24009@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 24010take precedence over places specified using environment variables, which 24011in turn take precedence over those specified by the configuration of GCC@. 24012@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 24013GNU Compiler Collection (GCC) Internals}. 24014 24015@table @env 24016@item LANG 24017@itemx LC_CTYPE 24018@c @itemx LC_COLLATE 24019@itemx LC_MESSAGES 24020@c @itemx LC_MONETARY 24021@c @itemx LC_NUMERIC 24022@c @itemx LC_TIME 24023@itemx LC_ALL 24024@findex LANG 24025@findex LC_CTYPE 24026@c @findex LC_COLLATE 24027@findex LC_MESSAGES 24028@c @findex LC_MONETARY 24029@c @findex LC_NUMERIC 24030@c @findex LC_TIME 24031@findex LC_ALL 24032@cindex locale 24033These environment variables control the way that GCC uses 24034localization information which allows GCC to work with different 24035national conventions. GCC inspects the locale categories 24036@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 24037so. These locale categories can be set to any value supported by your 24038installation. A typical value is @samp{en_GB.UTF-8} for English in the United 24039Kingdom encoded in UTF-8. 24040 24041The @env{LC_CTYPE} environment variable specifies character 24042classification. GCC uses it to determine the character boundaries in 24043a string; this is needed for some multibyte encodings that contain quote 24044and escape characters that are otherwise interpreted as a string 24045end or escape. 24046 24047The @env{LC_MESSAGES} environment variable specifies the language to 24048use in diagnostic messages. 24049 24050If the @env{LC_ALL} environment variable is set, it overrides the value 24051of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 24052and @env{LC_MESSAGES} default to the value of the @env{LANG} 24053environment variable. If none of these variables are set, GCC 24054defaults to traditional C English behavior. 24055 24056@item TMPDIR 24057@findex TMPDIR 24058If @env{TMPDIR} is set, it specifies the directory to use for temporary 24059files. GCC uses temporary files to hold the output of one stage of 24060compilation which is to be used as input to the next stage: for example, 24061the output of the preprocessor, which is the input to the compiler 24062proper. 24063 24064@item GCC_COMPARE_DEBUG 24065@findex GCC_COMPARE_DEBUG 24066Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 24067@option{-fcompare-debug} to the compiler driver. See the documentation 24068of this option for more details. 24069 24070@item GCC_EXEC_PREFIX 24071@findex GCC_EXEC_PREFIX 24072If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 24073names of the subprograms executed by the compiler. No slash is added 24074when this prefix is combined with the name of a subprogram, but you can 24075specify a prefix that ends with a slash if you wish. 24076 24077If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 24078an appropriate prefix to use based on the pathname it is invoked with. 24079 24080If GCC cannot find the subprogram using the specified prefix, it 24081tries looking in the usual places for the subprogram. 24082 24083The default value of @env{GCC_EXEC_PREFIX} is 24084@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 24085the installed compiler. In many cases @var{prefix} is the value 24086of @code{prefix} when you ran the @file{configure} script. 24087 24088Other prefixes specified with @option{-B} take precedence over this prefix. 24089 24090This prefix is also used for finding files such as @file{crt0.o} that are 24091used for linking. 24092 24093In addition, the prefix is used in an unusual way in finding the 24094directories to search for header files. For each of the standard 24095directories whose name normally begins with @samp{/usr/local/lib/gcc} 24096(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 24097replacing that beginning with the specified prefix to produce an 24098alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 24099@file{foo/bar} just before it searches the standard directory 24100@file{/usr/local/lib/bar}. 24101If a standard directory begins with the configured 24102@var{prefix} then the value of @var{prefix} is replaced by 24103@env{GCC_EXEC_PREFIX} when looking for header files. 24104 24105@item COMPILER_PATH 24106@findex COMPILER_PATH 24107The value of @env{COMPILER_PATH} is a colon-separated list of 24108directories, much like @env{PATH}. GCC tries the directories thus 24109specified when searching for subprograms, if it can't find the 24110subprograms using @env{GCC_EXEC_PREFIX}. 24111 24112@item LIBRARY_PATH 24113@findex LIBRARY_PATH 24114The value of @env{LIBRARY_PATH} is a colon-separated list of 24115directories, much like @env{PATH}. When configured as a native compiler, 24116GCC tries the directories thus specified when searching for special 24117linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 24118using GCC also uses these directories when searching for ordinary 24119libraries for the @option{-l} option (but directories specified with 24120@option{-L} come first). 24121 24122@item LANG 24123@findex LANG 24124@cindex locale definition 24125This variable is used to pass locale information to the compiler. One way in 24126which this information is used is to determine the character set to be used 24127when character literals, string literals and comments are parsed in C and C++. 24128When the compiler is configured to allow multibyte characters, 24129the following values for @env{LANG} are recognized: 24130 24131@table @samp 24132@item C-JIS 24133Recognize JIS characters. 24134@item C-SJIS 24135Recognize SJIS characters. 24136@item C-EUCJP 24137Recognize EUCJP characters. 24138@end table 24139 24140If @env{LANG} is not defined, or if it has some other value, then the 24141compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 24142recognize and translate multibyte characters. 24143@end table 24144 24145@noindent 24146Some additional environment variables affect the behavior of the 24147preprocessor. 24148 24149@include cppenv.texi 24150 24151@c man end 24152 24153@node Precompiled Headers 24154@section Using Precompiled Headers 24155@cindex precompiled headers 24156@cindex speed of compilation 24157 24158Often large projects have many header files that are included in every 24159source file. The time the compiler takes to process these header files 24160over and over again can account for nearly all of the time required to 24161build the project. To make builds faster, GCC allows you to 24162@dfn{precompile} a header file. 24163 24164To create a precompiled header file, simply compile it as you would any 24165other file, if necessary using the @option{-x} option to make the driver 24166treat it as a C or C++ header file. You may want to use a 24167tool like @command{make} to keep the precompiled header up-to-date when 24168the headers it contains change. 24169 24170A precompiled header file is searched for when @code{#include} is 24171seen in the compilation. As it searches for the included file 24172(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 24173compiler looks for a precompiled header in each directory just before it 24174looks for the include file in that directory. The name searched for is 24175the name specified in the @code{#include} with @samp{.gch} appended. If 24176the precompiled header file can't be used, it is ignored. 24177 24178For instance, if you have @code{#include "all.h"}, and you have 24179@file{all.h.gch} in the same directory as @file{all.h}, then the 24180precompiled header file is used if possible, and the original 24181header is used otherwise. 24182 24183Alternatively, you might decide to put the precompiled header file in a 24184directory and use @option{-I} to ensure that directory is searched 24185before (or instead of) the directory containing the original header. 24186Then, if you want to check that the precompiled header file is always 24187used, you can put a file of the same name as the original header in this 24188directory containing an @code{#error} command. 24189 24190This also works with @option{-include}. So yet another way to use 24191precompiled headers, good for projects not designed with precompiled 24192header files in mind, is to simply take most of the header files used by 24193a project, include them from another header file, precompile that header 24194file, and @option{-include} the precompiled header. If the header files 24195have guards against multiple inclusion, they are skipped because 24196they've already been included (in the precompiled header). 24197 24198If you need to precompile the same header file for different 24199languages, targets, or compiler options, you can instead make a 24200@emph{directory} named like @file{all.h.gch}, and put each precompiled 24201header in the directory, perhaps using @option{-o}. It doesn't matter 24202what you call the files in the directory; every precompiled header in 24203the directory is considered. The first precompiled header 24204encountered in the directory that is valid for this compilation is 24205used; they're searched in no particular order. 24206 24207There are many other possibilities, limited only by your imagination, 24208good sense, and the constraints of your build system. 24209 24210A precompiled header file can be used only when these conditions apply: 24211 24212@itemize 24213@item 24214Only one precompiled header can be used in a particular compilation. 24215 24216@item 24217A precompiled header can't be used once the first C token is seen. You 24218can have preprocessor directives before a precompiled header; you cannot 24219include a precompiled header from inside another header. 24220 24221@item 24222The precompiled header file must be produced for the same language as 24223the current compilation. You can't use a C precompiled header for a C++ 24224compilation. 24225 24226@item 24227The precompiled header file must have been produced by the same compiler 24228binary as the current compilation is using. 24229 24230@item 24231Any macros defined before the precompiled header is included must 24232either be defined in the same way as when the precompiled header was 24233generated, or must not affect the precompiled header, which usually 24234means that they don't appear in the precompiled header at all. 24235 24236The @option{-D} option is one way to define a macro before a 24237precompiled header is included; using a @code{#define} can also do it. 24238There are also some options that define macros implicitly, like 24239@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 24240defined this way. 24241 24242@item If debugging information is output when using the precompiled 24243header, using @option{-g} or similar, the same kind of debugging information 24244must have been output when building the precompiled header. However, 24245a precompiled header built using @option{-g} can be used in a compilation 24246when no debugging information is being output. 24247 24248@item The same @option{-m} options must generally be used when building 24249and using the precompiled header. @xref{Submodel Options}, 24250for any cases where this rule is relaxed. 24251 24252@item Each of the following options must be the same when building and using 24253the precompiled header: 24254 24255@gccoptlist{-fexceptions} 24256 24257@item 24258Some other command-line options starting with @option{-f}, 24259@option{-p}, or @option{-O} must be defined in the same way as when 24260the precompiled header was generated. At present, it's not clear 24261which options are safe to change and which are not; the safest choice 24262is to use exactly the same options when generating and using the 24263precompiled header. The following are known to be safe: 24264 24265@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 24266-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 24267-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 24268-pedantic-errors} 24269 24270@end itemize 24271 24272For all of these except the last, the compiler automatically 24273ignores the precompiled header if the conditions aren't met. If you 24274find an option combination that doesn't work and doesn't cause the 24275precompiled header to be ignored, please consider filing a bug report, 24276see @ref{Bugs}. 24277 24278If you do use differing options when generating and using the 24279precompiled header, the actual behavior is a mixture of the 24280behavior for the options. For instance, if you use @option{-g} to 24281generate the precompiled header but not when using it, you may or may 24282not get debugging information for routines in the precompiled header. 24283