1@c Copyright (C) 1988-2019 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-2019 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), dbx(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@xref{Overall Options,,Options Controlling the Kind of Output}. 76 77Other options are passed on to one or more stages of processing. Some options 78control the preprocessor and others the compiler itself. Yet other 79options control the assembler and linker; most of these are not 80documented here, since you rarely need to use any of them. 81 82@cindex C compilation options 83Most of the command-line options that you can use with GCC are useful 84for C programs; when an option is only useful with another language 85(usually C++), the explanation says so explicitly. If the description 86for a particular option does not mention a source language, you can use 87that option with all supported languages. 88 89@cindex cross compiling 90@cindex specifying machine version 91@cindex specifying compiler version and target machine 92@cindex compiler version, specifying 93@cindex target machine, specifying 94The usual way to run GCC is to run the executable called @command{gcc}, or 95@command{@var{machine}-gcc} when cross-compiling, or 96@command{@var{machine}-gcc-@var{version}} to run a specific version of GCC. 97When you compile C++ programs, you should invoke GCC as @command{g++} 98instead. @xref{Invoking G++,,Compiling C++ Programs}, 99for information about the differences in behavior between @command{gcc} 100and @code{g++} when compiling C++ programs. 101 102@cindex grouping options 103@cindex options, grouping 104The @command{gcc} program accepts options and file names as operands. Many 105options have multi-letter names; therefore multiple single-letter options 106may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d 107-v}}. 108 109@cindex order of options 110@cindex options, order 111You can mix options and other arguments. For the most part, the order 112you use doesn't matter. Order does matter when you use several 113options of the same kind; for example, if you specify @option{-L} more 114than once, the directories are searched in the order specified. Also, 115the placement of the @option{-l} option is significant. 116 117Many options have long names starting with @samp{-f} or with 118@samp{-W}---for example, 119@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of 120these have both positive and negative forms; the negative form of 121@option{-ffoo} is @option{-fno-foo}. This manual documents 122only one of these two forms, whichever one is not the default. 123 124Some options take one or more arguments typically separated either 125by a space or by the equals sign (@samp{=}) from the option name. 126Unless documented otherwise, an argument can be either numeric or 127a string. Numeric arguments must typically be small unsigned decimal 128or hexadecimal integers. Hexadecimal arguments must begin with 129the @samp{0x} prefix. Arguments to options that specify a size 130threshold of some sort may be arbitrarily large decimal or hexadecimal 131integers followed by a byte size suffix designating a multiple of bytes 132such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively, 133@code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and 134@code{GiB} for gigabyte and gigibyte, and so on. Such arguments are 135designated by @var{byte-size} in the following text. Refer to the NIST, 136IEC, and other relevant national and international standards for the full 137listing and explanation of the binary and decimal byte size prefixes. 138 139@c man end 140 141@xref{Option Index}, for an index to GCC's options. 142 143@menu 144* Option Summary:: Brief list of all options, without explanations. 145* Overall Options:: Controlling the kind of output: 146 an executable, object files, assembler files, 147 or preprocessed source. 148* Invoking G++:: Compiling C++ programs. 149* C Dialect Options:: Controlling the variant of C language compiled. 150* C++ Dialect Options:: Variations on C++. 151* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C 152 and Objective-C++. 153* Diagnostic Message Formatting Options:: Controlling how diagnostics should 154 be formatted. 155* Warning Options:: How picky should the compiler be? 156* Debugging Options:: Producing debuggable code. 157* Optimize Options:: How much optimization? 158* Instrumentation Options:: Enabling profiling and extra run-time error checking. 159* Preprocessor Options:: Controlling header files and macro definitions. 160 Also, getting dependency information for Make. 161* Assembler Options:: Passing options to the assembler. 162* Link Options:: Specifying libraries and so on. 163* Directory Options:: Where to find header files and libraries. 164 Where to find the compiler executable files. 165* Code Gen Options:: Specifying conventions for function calls, data layout 166 and register usage. 167* Developer Options:: Printing GCC configuration info, statistics, and 168 debugging dumps. 169* Submodel Options:: Target-specific options, such as compiling for a 170 specific processor variant. 171* Spec Files:: How to pass switches to sub-processes. 172* Environment Variables:: Env vars that affect GCC. 173* Precompiled Headers:: Compiling a header once, and using it many times. 174@end menu 175 176@c man begin OPTIONS 177 178@node Option Summary 179@section Option Summary 180 181Here is a summary of all the options, grouped by type. Explanations are 182in the following sections. 183 184@table @emph 185@item Overall Options 186@xref{Overall Options,,Options Controlling the Kind of Output}. 187@gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol 188-v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol 189-pass-exit-codes -pipe -specs=@var{file} -wrapper @gol 190@@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol 191-fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol 192-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}} 193 194@item C Language Options 195@xref{C Dialect Options,,Options Controlling C Dialect}. 196@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 197-fpermitted-flt-eval-methods=@var{standard} @gol 198-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol 199-fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol 200-fhosted -ffreestanding @gol 201-fopenacc -fopenacc-dim=@var{geom} @gol 202-fopenmp -fopenmp-simd @gol 203-fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol 204-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 205-fsigned-bitfields -fsigned-char @gol 206-funsigned-bitfields -funsigned-char} 207 208@item C++ Language Options 209@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 210@gccoptlist{-fabi-version=@var{n} -fno-access-control @gol 211-faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol 212-fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol 213-fconstexpr-ops-limit=@var{n} -fno-elide-constructors @gol 214-fno-enforce-eh-specs @gol 215-fno-gnu-keywords @gol 216-fno-implicit-templates @gol 217-fno-implicit-inline-templates @gol 218-fno-implement-inlines -fms-extensions @gol 219-fnew-inheriting-ctors @gol 220-fnew-ttp-matching @gol 221-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol 222-fno-optional-diags -fpermissive @gol 223-fno-pretty-templates @gol 224-frepo -fno-rtti -fsized-deallocation @gol 225-ftemplate-backtrace-limit=@var{n} @gol 226-ftemplate-depth=@var{n} @gol 227-fno-threadsafe-statics -fuse-cxa-atexit @gol 228-fno-weak -nostdinc++ @gol 229-fvisibility-inlines-hidden @gol 230-fvisibility-ms-compat @gol 231-fext-numeric-literals @gol 232-Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol 233-Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol 234-Wliteral-suffix @gol 235-Wmultiple-inheritance -Wno-init-list-lifetime @gol 236-Wnamespaces -Wnarrowing @gol 237-Wpessimizing-move -Wredundant-move @gol 238-Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol 239-Wnon-virtual-dtor -Wreorder -Wregister @gol 240-Weffc++ -Wstrict-null-sentinel -Wtemplates @gol 241-Wno-non-template-friend -Wold-style-cast @gol 242-Woverloaded-virtual -Wno-pmf-conversions @gol 243-Wno-class-conversion -Wno-terminate @gol 244-Wsign-promo -Wvirtual-inheritance} 245 246@item Objective-C and Objective-C++ Language Options 247@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling 248Objective-C and Objective-C++ Dialects}. 249@gccoptlist{-fconstant-string-class=@var{class-name} @gol 250-fgnu-runtime -fnext-runtime @gol 251-fno-nil-receivers @gol 252-fobjc-abi-version=@var{n} @gol 253-fobjc-call-cxx-cdtors @gol 254-fobjc-direct-dispatch @gol 255-fobjc-exceptions @gol 256-fobjc-gc @gol 257-fobjc-nilcheck @gol 258-fobjc-std=objc1 @gol 259-fno-local-ivars @gol 260-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol 261-freplace-objc-classes @gol 262-fzero-link @gol 263-gen-decls @gol 264-Wassign-intercept @gol 265-Wno-protocol -Wselector @gol 266-Wstrict-selector-match @gol 267-Wundeclared-selector} 268 269@item Diagnostic Message Formatting Options 270@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}. 271@gccoptlist{-fmessage-length=@var{n} @gol 272-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 273-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol 274-fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol 275-fno-diagnostics-show-option -fno-diagnostics-show-caret @gol 276-fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol 277-fdiagnostics-minimum-margin-width=@var{width} @gol 278-fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol 279-fdiagnostics-show-template-tree -fno-elide-type @gol 280-fno-show-column} 281 282@item Warning Options 283@xref{Warning Options,,Options to Request or Suppress Warnings}. 284@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol 285-pedantic-errors @gol 286-w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol 287-Waggregate-return -Waligned-new @gol 288-Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol 289-Walloca -Walloca-larger-than=@var{byte-size} @gol 290-Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol 291-Wno-attributes -Wattribute-alias=@var{n} @gol 292-Wbool-compare -Wbool-operation @gol 293-Wno-builtin-declaration-mismatch @gol 294-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol 295-Wc11-c2x-compat @gol 296-Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol 297-Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol 298-Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol 299-Wclobbered -Wcomment -Wconditionally-supported @gol 300-Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol 301-Wdelete-incomplete @gol 302-Wno-attribute-warning @gol 303-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol 304-Wdisabled-optimization @gol 305-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol 306-Wno-div-by-zero -Wdouble-promotion @gol 307-Wduplicated-branches -Wduplicated-cond @gol 308-Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol 309-Werror -Werror=* -Wextra-semi -Wfatal-errors @gol 310-Wfloat-equal -Wformat -Wformat=2 @gol 311-Wno-format-contains-nul -Wno-format-extra-args @gol 312-Wformat-nonliteral -Wformat-overflow=@var{n} @gol 313-Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol 314-Wformat-y2k -Wframe-address @gol 315-Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol 316-Wjump-misses-init @gol 317-Whsa -Wif-not-aligned @gol 318-Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol 319-Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol 320-Wimplicit-function-declaration -Wimplicit-int @gol 321-Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol 322-Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol 323-Winvalid-pch -Wlarger-than=@var{byte-size} @gol 324-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol 325-Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol 326-Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol 327-Wmissing-field-initializers -Wmissing-format-attribute @gol 328-Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol 329-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol 330-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol 331-Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol 332-Woverride-init-side-effects -Woverlength-strings @gol 333-Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol 334-Wparentheses -Wno-pedantic-ms-format @gol 335-Wplacement-new -Wplacement-new=@var{n} @gol 336-Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol 337-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol 338-Wrestrict -Wno-return-local-addr @gol 339-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol 340-Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol 341-Wshift-overflow -Wshift-overflow=@var{n} @gol 342-Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol 343-Wsign-compare -Wsign-conversion -Wfloat-conversion @gol 344-Wno-scalar-storage-order -Wsizeof-pointer-div @gol 345-Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol 346-Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol 347-Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol 348-Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol 349-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol 350-Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol 351-Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol 352-Wswitch-unreachable -Wsync-nand @gol 353-Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol 354-Wtype-limits -Wundef @gol 355-Wuninitialized -Wunknown-pragmas @gol 356-Wunsuffixed-float-constants -Wunused -Wunused-function @gol 357-Wunused-label -Wunused-local-typedefs -Wunused-macros @gol 358-Wunused-parameter -Wno-unused-result @gol 359-Wunused-value -Wunused-variable @gol 360-Wunused-const-variable -Wunused-const-variable=@var{n} @gol 361-Wunused-but-set-parameter -Wunused-but-set-variable @gol 362-Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol 363-Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol 364-Wwrite-strings @gol 365-Wzero-as-null-pointer-constant} 366 367@item C and Objective-C-only Warning Options 368@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 369-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol 370-Wold-style-declaration -Wold-style-definition @gol 371-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol 372-Wdeclaration-after-statement -Wpointer-sign} 373 374@item Debugging Options 375@xref{Debugging Options,,Options for Debugging Your Program}. 376@gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol 377-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol 378-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol 379-gas-loc-support -gno-as-loc-support @gol 380-gas-locview-support -gno-as-locview-support @gol 381-gcolumn-info -gno-column-info @gol 382-gstatement-frontiers -gno-statement-frontiers @gol 383-gvariable-location-views -gno-variable-location-views @gol 384-ginternal-reset-location-views -gno-internal-reset-location-views @gol 385-ginline-points -gno-inline-points @gol 386-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol 387-gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol 388-fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol 389-fno-eliminate-unused-debug-types @gol 390-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 391-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 392-feliminate-unused-debug-symbols -femit-class-debug-always @gol 393-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol 394-fvar-tracking -fvar-tracking-assignments} 395 396@item Optimization Options 397@xref{Optimize Options,,Options that Control Optimization}. 398@gccoptlist{-faggressive-loop-optimizations @gol 399-falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 400-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 401-falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 402-falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 403-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol 404-fauto-inc-dec -fbranch-probabilities @gol 405-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol 406-fbtr-bb-exclusive -fcaller-saves @gol 407-fcombine-stack-adjustments -fconserve-stack @gol 408-fcompare-elim -fcprop-registers -fcrossjumping @gol 409-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol 410-fcx-limited-range @gol 411-fdata-sections -fdce -fdelayed-branch @gol 412-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol 413-fdevirtualize-at-ltrans -fdse @gol 414-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol 415-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol 416-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol 417-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol 418-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol 419-fif-conversion2 -findirect-inlining @gol 420-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol 421-finline-small-functions -fipa-cp -fipa-cp-clone @gol 422-fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol 423-fipa-reference -fipa-reference-addressable @gol 424-fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol 425-flive-patching=@var{level} @gol 426-fira-region=@var{region} -fira-hoist-pressure @gol 427-fira-loop-pressure -fno-ira-share-save-slots @gol 428-fno-ira-share-spill-slots @gol 429-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol 430-fivopts -fkeep-inline-functions -fkeep-static-functions @gol 431-fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol 432-floop-block -floop-interchange -floop-strip-mine @gol 433-floop-unroll-and-jam -floop-nest-optimize @gol 434-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol 435-flto-partition=@var{alg} -fmerge-all-constants @gol 436-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol 437-fmove-loop-invariants -fno-branch-count-reg @gol 438-fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol 439-fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol 440-fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol 441-fno-sched-spec -fno-signed-zeros @gol 442-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 443-fomit-frame-pointer -foptimize-sibling-calls @gol 444-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol 445-fprefetch-loop-arrays @gol 446-fprofile-correction @gol 447-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol 448-fprofile-reorder-functions @gol 449-freciprocal-math -free -frename-registers -freorder-blocks @gol 450-freorder-blocks-algorithm=@var{algorithm} @gol 451-freorder-blocks-and-partition -freorder-functions @gol 452-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol 453-frounding-math -fsave-optimization-record @gol 454-fsched2-use-superblocks -fsched-pressure @gol 455-fsched-spec-load -fsched-spec-load-dangerous @gol 456-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol 457-fsched-group-heuristic -fsched-critical-path-heuristic @gol 458-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol 459-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol 460-fschedule-fusion @gol 461-fschedule-insns -fschedule-insns2 -fsection-anchors @gol 462-fselective-scheduling -fselective-scheduling2 @gol 463-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol 464-fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol 465-fsignaling-nans @gol 466-fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol 467-fsplit-paths @gol 468-fsplit-wide-types -fssa-backprop -fssa-phiopt @gol 469-fstdarg-opt -fstore-merging -fstrict-aliasing @gol 470-fthread-jumps -ftracer -ftree-bit-ccp @gol 471-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol 472-ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol 473-ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol 474-ftree-loop-if-convert -ftree-loop-im @gol 475-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol 476-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol 477-ftree-loop-vectorize @gol 478-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol 479-ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol 480-ftree-switch-conversion -ftree-tail-merge @gol 481-ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol 482-funit-at-a-time -funroll-all-loops -funroll-loops @gol 483-funsafe-math-optimizations -funswitch-loops @gol 484-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol 485-fweb -fwhole-program -fwpa -fuse-linker-plugin @gol 486--param @var{name}=@var{value} 487-O -O0 -O1 -O2 -O3 -Os -Ofast -Og} 488 489@item Program Instrumentation Options 490@xref{Instrumentation Options,,Program Instrumentation Options}. 491@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol 492-fprofile-abs-path @gol 493-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol 494-fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol 495-fprofile-exclude-files=@var{regex} @gol 496-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol 497-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol 498-fsanitize-undefined-trap-on-error -fbounds-check @gol 499-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol 500-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 501-fstack-protector-explicit -fstack-check @gol 502-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 503-fno-stack-limit -fsplit-stack @gol 504-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol 505-fvtv-counts -fvtv-debug @gol 506-finstrument-functions @gol 507-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 508-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} 509 510@item Preprocessor Options 511@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 512@gccoptlist{-A@var{question}=@var{answer} @gol 513-A-@var{question}@r{[}=@var{answer}@r{]} @gol 514-C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol 515-dD -dI -dM -dN -dU @gol 516-fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol 517-fexec-charset=@var{charset} -fextended-identifiers @gol 518-finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol 519-fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol 520-fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol 521-fwide-exec-charset=@var{charset} -fworking-directory @gol 522-H -imacros @var{file} -include @var{file} @gol 523-M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol 524-no-integrated-cpp -P -pthread -remap @gol 525-iprefix @var{file} -iwithprefix @var{dir} @gol 526-traditional -traditional-cpp -trigraphs @gol 527-U@var{macro} -undef @gol 528-Wp,@var{option} -Xpreprocessor @var{option}} 529 530@item Assembler Options 531@xref{Assembler Options,,Passing Options to the Assembler}. 532@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 533 534@item Linker Options 535@xref{Link Options,,Options for Linking}. 536@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 537-nostartfiles -nodefaultlibs -nolibc -nostdlib @gol 538-e @var{entry} --entry=@var{entry} @gol 539-pie -pthread -r -rdynamic @gol 540-s -static -static-pie -static-libgcc -static-libstdc++ @gol 541-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 542-shared -shared-libgcc -symbolic @gol 543-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 544-u @var{symbol} -z @var{keyword}} 545 546@item Directory Options 547@xref{Directory Options,,Options for Directory Search}. 548@gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol 549-idirafter @var{dir} @gol 550-imacros @var{file} -imultilib @var{dir} @gol 551-iplugindir=@var{dir} @gol 552-iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol 553-iremap@var{src}:@var{dst} -cxx-isystem=@var{dir} @gol 554-iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol 555-L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol 556-nostdinc -nostdinc++ --sysroot=@var{dir}} 557 558@item Code Generation Options 559@xref{Code Gen Options,,Options for Code Generation Conventions}. 560@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 561-ffixed-@var{reg} -fexceptions @gol 562-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 563-fasynchronous-unwind-tables @gol 564-fno-gnu-unique @gol 565-finhibit-size-directive -fno-common -fno-ident @gol 566-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol 567-fno-jump-tables @gol 568-frecord-gcc-switches @gol 569-freg-struct-return -fshort-enums -fshort-wchar @gol 570-fverbose-asm -fpack-struct[=@var{n}] @gol 571-fleading-underscore -ftls-model=@var{model} @gol 572-fstack-reuse=@var{reuse_level} @gol 573-ftrampolines -ftrapv -fwrapv @gol 574-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 575-fstrict-volatile-bitfields -fsync-libcalls} 576 577@item Developer Options 578@xref{Developer Options,,GCC Developer Options}. 579@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 580-dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol 581-fdbg-cnt=@var{counter-value-list} @gol 582-fdisable-ipa-@var{pass_name} @gol 583-fdisable-rtl-@var{pass_name} @gol 584-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 585-fdisable-tree-@var{pass_name} @gol 586-fdisable-tree-@var{pass-name}=@var{range-list} @gol 587-fdump-debug -fdump-earlydebug @gol 588-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 589-fdump-final-insns@r{[}=@var{file}@r{]} @gol 590-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 591-fdump-lang-all @gol 592-fdump-lang-@var{switch} @gol 593-fdump-lang-@var{switch}-@var{options} @gol 594-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol 595-fdump-passes @gol 596-fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol 597-fdump-statistics @gol 598-fdump-tree-all @gol 599-fdump-tree-@var{switch} @gol 600-fdump-tree-@var{switch}-@var{options} @gol 601-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol 602-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 603-fenable-@var{kind}-@var{pass} @gol 604-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 605-fira-verbose=@var{n} @gol 606-flto-report -flto-report-wpa -fmem-report-wpa @gol 607-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol 608-fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 609-fprofile-report @gol 610-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 611-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 612-fstats -fstack-usage -ftime-report -ftime-report-details @gol 613-fvar-tracking-assignments-toggle -gtoggle @gol 614-print-file-name=@var{library} -print-libgcc-file-name @gol 615-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 616-print-prog-name=@var{program} -print-search-dirs -Q @gol 617-print-sysroot -print-sysroot-headers-suffix @gol 618-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 619 620@item Machine-Dependent Options 621@xref{Submodel Options,,Machine-Dependent Options}. 622@c This list is ordered alphanumerically by subsection name. 623@c Try and put the significant identifier (CPU or system) first, 624@c so users have a clue at guessing where the ones they want will be. 625 626@emph{AArch64 Options} 627@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 628-mgeneral-regs-only @gol 629-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 630-mstrict-align -mno-strict-align @gol 631-momit-leaf-frame-pointer @gol 632-mtls-dialect=desc -mtls-dialect=traditional @gol 633-mtls-size=@var{size} @gol 634-mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol 635-mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol 636-mpc-relative-literal-loads @gol 637-msign-return-address=@var{scope} @gol 638-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti} @gol 639-march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol 640-moverride=@var{string} -mverbose-cost-dump @gol 641-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol 642-mstack-protector-guard-offset=@var{offset} -mtrack-speculation } 643 644@emph{Adapteva Epiphany Options} 645@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 646-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 647-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 648-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 649-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 650-msplit-vecmove-early -m1reg-@var{reg}} 651 652@emph{AMD GCN Options} 653@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}} 654 655@emph{ARC Options} 656@gccoptlist{-mbarrel-shifter -mjli-always @gol 657-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol 658-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol 659-mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol 660-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol 661-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol 662-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol 663-mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol 664-mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol 665-mvolatile-cache -mtp-regno=@var{regno} @gol 666-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol 667-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol 668-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol 669-mlra-priority-compact mlra-priority-noncompact -mmillicode @gol 670-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol 671-mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol 672-munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol 673-mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index} 674 675@emph{ARM Options} 676@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 677-mabi=@var{name} @gol 678-mapcs-stack-check -mno-apcs-stack-check @gol 679-mapcs-reentrant -mno-apcs-reentrant @gol 680-mgeneral-regs-only @gol 681-msched-prolog -mno-sched-prolog @gol 682-mlittle-endian -mbig-endian @gol 683-mbe8 -mbe32 @gol 684-mfloat-abi=@var{name} @gol 685-mfp16-format=@var{name} 686-mthumb-interwork -mno-thumb-interwork @gol 687-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 688-mtune=@var{name} -mprint-tune-info @gol 689-mstructure-size-boundary=@var{n} @gol 690-mabort-on-noreturn @gol 691-mlong-calls -mno-long-calls @gol 692-msingle-pic-base -mno-single-pic-base @gol 693-mpic-register=@var{reg} @gol 694-mnop-fun-dllimport @gol 695-mpoke-function-name @gol 696-mthumb -marm -mflip-thumb @gol 697-mtpcs-frame -mtpcs-leaf-frame @gol 698-mcaller-super-interworking -mcallee-super-interworking @gol 699-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 700-mword-relocations @gol 701-mfix-cortex-m3-ldrd @gol 702-munaligned-access @gol 703-mneon-for-64bits @gol 704-mslow-flash-data @gol 705-masm-syntax-unified @gol 706-mrestrict-it @gol 707-mverbose-cost-dump @gol 708-mpure-code @gol 709-mcmse} 710 711@emph{AVR Options} 712@gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol 713-mbranch-cost=@var{cost} @gol 714-mcall-prologues -mgas-isr-prologues -mint8 @gol 715-mn_flash=@var{size} -mno-interrupts @gol 716-mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol 717-mfract-convert-truncate @gol 718-mshort-calls -nodevicelib -nodevicespecs @gol 719-Waddr-space-convert -Wmisspelled-isr} 720 721@emph{Blackfin Options} 722@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 723-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 724-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 725-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 726-mno-id-shared-library -mshared-library-id=@var{n} @gol 727-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 728-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 729-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 730-micplb} 731 732@emph{C6X Options} 733@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 734-msim -msdata=@var{sdata-type}} 735 736@emph{CRIS Options} 737@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 738-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 739-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 740-mstack-align -mdata-align -mconst-align @gol 741-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 742-melf -maout -melinux -mlinux -sim -sim2 @gol 743-mmul-bug-workaround -mno-mul-bug-workaround} 744 745@emph{CR16 Options} 746@gccoptlist{-mmac @gol 747-mcr16cplus -mcr16c @gol 748-msim -mint32 -mbit-ops 749-mdata-model=@var{model}} 750 751@emph{C-SKY Options} 752@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol 753-mbig-endian -EB -mlittle-endian -EL @gol 754-mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol 755-melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol 756-mdsp -medsp -mvdsp @gol 757-mdiv -msmart -mhigh-registers -manchor @gol 758-mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol 759-mbranch-cost=@var{n} -mcse-cc -msched-prolog} 760 761@emph{Darwin Options} 762@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 763-arch_only -bind_at_load -bundle -bundle_loader @gol 764-client_name -compatibility_version -current_version @gol 765-dead_strip @gol 766-dependency-file -dylib_file -dylinker_install_name @gol 767-dynamic -dynamiclib -exported_symbols_list @gol 768-filelist -flat_namespace -force_cpusubtype_ALL @gol 769-force_flat_namespace -headerpad_max_install_names @gol 770-iframework @gol 771-image_base -init -install_name -keep_private_externs @gol 772-multi_module -multiply_defined -multiply_defined_unused @gol 773-noall_load -no_dead_strip_inits_and_terms @gol 774-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 775-pagezero_size -prebind -prebind_all_twolevel_modules @gol 776-private_bundle -read_only_relocs -sectalign @gol 777-sectobjectsymbols -whyload -seg1addr @gol 778-sectcreate -sectobjectsymbols -sectorder @gol 779-segaddr -segs_read_only_addr -segs_read_write_addr @gol 780-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 781-segprot -segs_read_only_addr -segs_read_write_addr @gol 782-single_module -static -sub_library -sub_umbrella @gol 783-twolevel_namespace -umbrella -undefined @gol 784-unexported_symbols_list -weak_reference_mismatches @gol 785-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 786-mkernel -mone-byte-bool} 787 788@emph{DEC Alpha Options} 789@gccoptlist{-mno-fp-regs -msoft-float @gol 790-mieee -mieee-with-inexact -mieee-conformant @gol 791-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 792-mtrap-precision=@var{mode} -mbuild-constants @gol 793-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 794-mbwx -mmax -mfix -mcix @gol 795-mfloat-vax -mfloat-ieee @gol 796-mexplicit-relocs -msmall-data -mlarge-data @gol 797-msmall-text -mlarge-text @gol 798-mmemory-latency=@var{time}} 799 800@emph{FR30 Options} 801@gccoptlist{-msmall-model -mno-lsim} 802 803@emph{FT32 Options} 804@gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm} 805 806@emph{FRV Options} 807@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 808-mhard-float -msoft-float @gol 809-malloc-cc -mfixed-cc -mdword -mno-dword @gol 810-mdouble -mno-double @gol 811-mmedia -mno-media -mmuladd -mno-muladd @gol 812-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 813-mlinked-fp -mlong-calls -malign-labels @gol 814-mlibrary-pic -macc-4 -macc-8 @gol 815-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 816-moptimize-membar -mno-optimize-membar @gol 817-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 818-mvliw-branch -mno-vliw-branch @gol 819-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 820-mno-nested-cond-exec -mtomcat-stats @gol 821-mTLS -mtls @gol 822-mcpu=@var{cpu}} 823 824@emph{GNU/Linux Options} 825@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol 826-tno-android-cc -tno-android-ld} 827 828@emph{H8/300 Options} 829@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 830 831@emph{HPPA Options} 832@gccoptlist{-march=@var{architecture-type} @gol 833-mcaller-copies -mdisable-fpregs -mdisable-indexing @gol 834-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 835-mfixed-range=@var{register-range} @gol 836-mjump-in-delay -mlinker-opt -mlong-calls @gol 837-mlong-load-store -mno-disable-fpregs @gol 838-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 839-mno-jump-in-delay -mno-long-load-store @gol 840-mno-portable-runtime -mno-soft-float @gol 841-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 842-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 843-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 844-munix=@var{unix-std} -nolibdld -static -threads} 845 846@emph{IA-64 Options} 847@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 848-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 849-mconstant-gp -mauto-pic -mfused-madd @gol 850-minline-float-divide-min-latency @gol 851-minline-float-divide-max-throughput @gol 852-mno-inline-float-divide @gol 853-minline-int-divide-min-latency @gol 854-minline-int-divide-max-throughput @gol 855-mno-inline-int-divide @gol 856-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 857-mno-inline-sqrt @gol 858-mdwarf2-asm -mearly-stop-bits @gol 859-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 860-mtune=@var{cpu-type} -milp32 -mlp64 @gol 861-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 862-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 863-msched-spec-ldc -msched-spec-control-ldc @gol 864-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 865-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 866-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 867-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 868 869@emph{LM32 Options} 870@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 871-msign-extend-enabled -muser-enabled} 872 873@emph{M32R/D Options} 874@gccoptlist{-m32r2 -m32rx -m32r @gol 875-mdebug @gol 876-malign-loops -mno-align-loops @gol 877-missue-rate=@var{number} @gol 878-mbranch-cost=@var{number} @gol 879-mmodel=@var{code-size-model-type} @gol 880-msdata=@var{sdata-type} @gol 881-mno-flush-func -mflush-func=@var{name} @gol 882-mno-flush-trap -mflush-trap=@var{number} @gol 883-G @var{num}} 884 885@emph{M32C Options} 886@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 887 888@emph{M680x0 Options} 889@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol 890-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 891-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 892-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 893-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 894-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 895-malign-int -mstrict-align -msep-data -mno-sep-data @gol 896-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 897-mxgot -mno-xgot -mlong-jump-table-offsets} 898 899@emph{MCore Options} 900@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 901-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 902-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 903-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 904-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 905 906@emph{MeP Options} 907@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 908-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 909-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 910-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 911-mtiny=@var{n}} 912 913@emph{MicroBlaze Options} 914@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 915-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 916-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 917-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 918-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol 919-mpic-data-is-text-relative} 920 921@emph{MIPS Options} 922@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 923-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol 924-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol 925-mips16 -mno-mips16 -mflip-mips16 @gol 926-minterlink-compressed -mno-interlink-compressed @gol 927-minterlink-mips16 -mno-interlink-mips16 @gol 928-mabi=@var{abi} -mabicalls -mno-abicalls @gol 929-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 930-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol 931-mno-float -msingle-float -mdouble-float @gol 932-modd-spreg -mno-odd-spreg @gol 933-mabs=@var{mode} -mnan=@var{encoding} @gol 934-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 935-mmcu -mmno-mcu @gol 936-meva -mno-eva @gol 937-mvirt -mno-virt @gol 938-mxpa -mno-xpa @gol 939-mcrc -mno-crc @gol 940-mginv -mno-ginv @gol 941-mmicromips -mno-micromips @gol 942-mmsa -mno-msa @gol 943-mloongson-mmi -mno-loongson-mmi @gol 944-mloongson-ext -mno-loongson-ext @gol 945-mloongson-ext2 -mno-loongson-ext2 @gol 946-mfpu=@var{fpu-type} @gol 947-msmartmips -mno-smartmips @gol 948-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 949-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 950-mlong64 -mlong32 -msym32 -mno-sym32 @gol 951-G@var{num} -mlocal-sdata -mno-local-sdata @gol 952-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 953-membedded-data -mno-embedded-data @gol 954-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 955-mcode-readable=@var{setting} @gol 956-msplit-addresses -mno-split-addresses @gol 957-mexplicit-relocs -mno-explicit-relocs @gol 958-mcheck-zero-division -mno-check-zero-division @gol 959-mdivide-traps -mdivide-breaks @gol 960-mload-store-pairs -mno-load-store-pairs @gol 961-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 962-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol 963-mfix-24k -mno-fix-24k @gol 964-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 965-mfix-r5900 -mno-fix-r5900 @gol 966-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol 967-mfix-vr4120 -mno-fix-vr4120 @gol 968-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 969-mflush-func=@var{func} -mno-flush-func @gol 970-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 971-mcompact-branches=@var{policy} @gol 972-mfp-exceptions -mno-fp-exceptions @gol 973-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 974-mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol 975-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol 976-mframe-header-opt -mno-frame-header-opt} 977 978@emph{MMIX Options} 979@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 980-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 981-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 982-mno-base-addresses -msingle-exit -mno-single-exit} 983 984@emph{MN10300 Options} 985@gccoptlist{-mmult-bug -mno-mult-bug @gol 986-mno-am33 -mam33 -mam33-2 -mam34 @gol 987-mtune=@var{cpu-type} @gol 988-mreturn-pointer-on-d0 @gol 989-mno-crt0 -mrelax -mliw -msetlb} 990 991@emph{Moxie Options} 992@gccoptlist{-meb -mel -mmul.x -mno-crt0} 993 994@emph{MSP430 Options} 995@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol 996-mwarn-mcu @gol 997-mcode-region= -mdata-region= @gol 998-msilicon-errata= -msilicon-errata-warn= @gol 999-mhwmult= -minrt} 1000 1001@emph{NDS32 Options} 1002@gccoptlist{-mbig-endian -mlittle-endian @gol 1003-mreduced-regs -mfull-regs @gol 1004-mcmov -mno-cmov @gol 1005-mext-perf -mno-ext-perf @gol 1006-mext-perf2 -mno-ext-perf2 @gol 1007-mext-string -mno-ext-string @gol 1008-mv3push -mno-v3push @gol 1009-m16bit -mno-16bit @gol 1010-misr-vector-size=@var{num} @gol 1011-mcache-block-size=@var{num} @gol 1012-march=@var{arch} @gol 1013-mcmodel=@var{code-model} @gol 1014-mctor-dtor -mrelax} 1015 1016@emph{Nios II Options} 1017@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol 1018-mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol 1019-mel -meb @gol 1020-mno-bypass-cache -mbypass-cache @gol 1021-mno-cache-volatile -mcache-volatile @gol 1022-mno-fast-sw-div -mfast-sw-div @gol 1023-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol 1024-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol 1025-mcustom-fpu-cfg=@var{name} @gol 1026-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol 1027-march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx} 1028 1029@emph{Nvidia PTX Options} 1030@gccoptlist{-m32 -m64 -mmainkernel -moptimize} 1031 1032@emph{OpenRISC Options} 1033@gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol 1034-msoft-mul -msoft-div @gol 1035-mcmov -mror -msext -msfimm -mshftimm} 1036 1037@emph{PDP-11 Options} 1038@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 1039-mint32 -mno-int16 -mint16 -mno-int32 @gol 1040-msplit -munix-asm -mdec-asm -mgnu-asm -mlra} 1041 1042@emph{picoChip Options} 1043@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 1044-msymbol-as-address -mno-inefficient-warnings} 1045 1046@emph{PowerPC Options} 1047See RS/6000 and PowerPC Options. 1048 1049@emph{RISC-V Options} 1050@gccoptlist{-mbranch-cost=@var{N-instruction} @gol 1051-mplt -mno-plt @gol 1052-mabi=@var{ABI-string} @gol 1053-mfdiv -mno-fdiv @gol 1054-mdiv -mno-div @gol 1055-march=@var{ISA-string} @gol 1056-mtune=@var{processor-string} @gol 1057-mpreferred-stack-boundary=@var{num} @gol 1058-msmall-data-limit=@var{N-bytes} @gol 1059-msave-restore -mno-save-restore @gol 1060-mstrict-align -mno-strict-align @gol 1061-mcmodel=medlow -mcmodel=medany @gol 1062-mexplicit-relocs -mno-explicit-relocs @gol 1063-mrelax -mno-relax @gol 1064-mriscv-attribute -mmo-riscv-attribute} 1065 1066@emph{RL78 Options} 1067@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol 1068-mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol 1069-m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts} 1070 1071@emph{RS/6000 and PowerPC Options} 1072@gccoptlist{-mcpu=@var{cpu-type} @gol 1073-mtune=@var{cpu-type} @gol 1074-mcmodel=@var{code-model} @gol 1075-mpowerpc64 @gol 1076-maltivec -mno-altivec @gol 1077-mpowerpc-gpopt -mno-powerpc-gpopt @gol 1078-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 1079-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 1080-mfprnd -mno-fprnd @gol 1081-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol 1082-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 1083-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 1084-malign-power -malign-natural @gol 1085-msoft-float -mhard-float -mmultiple -mno-multiple @gol 1086-mupdate -mno-update @gol 1087-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 1088-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 1089-mstrict-align -mno-strict-align -mrelocatable @gol 1090-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 1091-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 1092-mdynamic-no-pic -mswdiv -msingle-pic-base @gol 1093-mprioritize-restricted-insns=@var{priority} @gol 1094-msched-costly-dep=@var{dependence_type} @gol 1095-minsert-sched-nops=@var{scheme} @gol 1096-mcall-aixdesc -mcall-eabi -mcall-freebsd @gol 1097-mcall-linux -mcall-netbsd -mcall-openbsd @gol 1098-mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol 1099-mtraceback=@var{traceback_type} @gol 1100-maix-struct-return -msvr4-struct-return @gol 1101-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 1102-mlongcall -mno-longcall -mpltseq -mno-pltseq @gol 1103-mblock-move-inline-limit=@var{num} @gol 1104-mblock-compare-inline-limit=@var{num} @gol 1105-mblock-compare-inline-loop-limit=@var{num} @gol 1106-mstring-compare-inline-limit=@var{num} @gol 1107-misel -mno-isel @gol 1108-mvrsave -mno-vrsave @gol 1109-mmulhw -mno-mulhw @gol 1110-mdlmzb -mno-dlmzb @gol 1111-mprototype -mno-prototype @gol 1112-msim -mmvme -mads -myellowknife -memb -msdata @gol 1113-msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol 1114-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 1115-mno-recip-precision @gol 1116-mveclibabi=@var{type} -mfriz -mno-friz @gol 1117-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 1118-msave-toc-indirect -mno-save-toc-indirect @gol 1119-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 1120-mcrypto -mno-crypto -mhtm -mno-htm @gol 1121-mquad-memory -mno-quad-memory @gol 1122-mquad-memory-atomic -mno-quad-memory-atomic @gol 1123-mcompat-align-parm -mno-compat-align-parm @gol 1124-mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol 1125-mgnu-attribute -mno-gnu-attribute @gol 1126-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1127-mstack-protector-guard-offset=@var{offset}} 1128 1129@emph{RX Options} 1130@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 1131-mcpu=@gol 1132-mbig-endian-data -mlittle-endian-data @gol 1133-msmall-data @gol 1134-msim -mno-sim@gol 1135-mas100-syntax -mno-as100-syntax@gol 1136-mrelax@gol 1137-mmax-constant-size=@gol 1138-mint-register=@gol 1139-mpid@gol 1140-mallow-string-insns -mno-allow-string-insns@gol 1141-mjsr@gol 1142-mno-warn-multiple-fast-interrupts@gol 1143-msave-acc-in-interrupts} 1144 1145@emph{S/390 and zSeries Options} 1146@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1147-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 1148-mlong-double-64 -mlong-double-128 @gol 1149-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 1150-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 1151-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 1152-mhtm -mvx -mzvector @gol 1153-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 1154-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 1155-mhotpatch=@var{halfwords},@var{halfwords}} 1156 1157@emph{Score Options} 1158@gccoptlist{-meb -mel @gol 1159-mnhwloop @gol 1160-muls @gol 1161-mmac @gol 1162-mscore5 -mscore5u -mscore7 -mscore7d} 1163 1164@emph{SH Options} 1165@gccoptlist{-m1 -m2 -m2e @gol 1166-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 1167-m3 -m3e @gol 1168-m4-nofpu -m4-single-only -m4-single -m4 @gol 1169-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 1170-mb -ml -mdalign -mrelax @gol 1171-mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol 1172-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 1173-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 1174-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 1175-maccumulate-outgoing-args @gol 1176-matomic-model=@var{atomic-model} @gol 1177-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol 1178-mcbranch-force-delay-slot @gol 1179-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 1180-mpretend-cmove -mtas} 1181 1182@emph{Solaris 2 Options} 1183@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol 1184-pthreads} 1185 1186@emph{SPARC Options} 1187@gccoptlist{-mcpu=@var{cpu-type} @gol 1188-mtune=@var{cpu-type} @gol 1189-mcmodel=@var{code-model} @gol 1190-mmemory-model=@var{mem-model} @gol 1191-m32 -m64 -mapp-regs -mno-app-regs @gol 1192-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 1193-mfpu -mno-fpu -mhard-float -msoft-float @gol 1194-mhard-quad-float -msoft-quad-float @gol 1195-mstack-bias -mno-stack-bias @gol 1196-mstd-struct-return -mno-std-struct-return @gol 1197-munaligned-doubles -mno-unaligned-doubles @gol 1198-muser-mode -mno-user-mode @gol 1199-mv8plus -mno-v8plus -mvis -mno-vis @gol 1200-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 1201-mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol 1202-mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol 1203-mpopc -mno-popc -msubxc -mno-subxc @gol 1204-mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol 1205-mlra -mno-lra} 1206 1207@emph{SPU Options} 1208@gccoptlist{-mwarn-reloc -merror-reloc @gol 1209-msafe-dma -munsafe-dma @gol 1210-mbranch-hints @gol 1211-msmall-mem -mlarge-mem -mstdmain @gol 1212-mfixed-range=@var{register-range} @gol 1213-mea32 -mea64 @gol 1214-maddress-space-conversion -mno-address-space-conversion @gol 1215-mcache-size=@var{cache-size} @gol 1216-matomic-updates -mno-atomic-updates} 1217 1218@emph{System V Options} 1219@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 1220 1221@emph{TILE-Gx Options} 1222@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol 1223-mcmodel=@var{code-model}} 1224 1225@emph{TILEPro Options} 1226@gccoptlist{-mcpu=@var{cpu} -m32} 1227 1228@emph{V850 Options} 1229@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 1230-mprolog-function -mno-prolog-function -mspace @gol 1231-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 1232-mapp-regs -mno-app-regs @gol 1233-mdisable-callt -mno-disable-callt @gol 1234-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 1235-mv850e -mv850 -mv850e3v5 @gol 1236-mloop @gol 1237-mrelax @gol 1238-mlong-jumps @gol 1239-msoft-float @gol 1240-mhard-float @gol 1241-mgcc-abi @gol 1242-mrh850-abi @gol 1243-mbig-switch} 1244 1245@emph{VAX Options} 1246@gccoptlist{-mg -mgnu -munix} 1247 1248@emph{Visium Options} 1249@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol 1250-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} 1251 1252@emph{VMS Options} 1253@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 1254-mpointer-size=@var{size}} 1255 1256@emph{VxWorks Options} 1257@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 1258-Xbind-lazy -Xbind-now} 1259 1260@emph{x86 Options} 1261@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1262-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol 1263-mfpmath=@var{unit} @gol 1264-masm=@var{dialect} -mno-fancy-math-387 @gol 1265-mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol 1266-mno-wide-multiply -mrtd -malign-double @gol 1267-mpreferred-stack-boundary=@var{num} @gol 1268-mincoming-stack-boundary=@var{num} @gol 1269-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol 1270-mrecip -mrecip=@var{opt} @gol 1271-mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol 1272-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 1273-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol 1274-mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol 1275-mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol 1276-mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol 1277-msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol 1278-madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol 1279-mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol 1280-mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 @gol 1281-mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol 1282-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol 1283-mrdseed -msgx @gol 1284-mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol 1285-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 1286-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol 1287-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 1288-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol 1289-mregparm=@var{num} -msseregparm @gol 1290-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 1291-mpc32 -mpc64 -mpc80 -mstackrealign @gol 1292-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 1293-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 1294-m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol 1295-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol 1296-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol 1297-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol 1298-malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol 1299-mstack-protector-guard-reg=@var{reg} @gol 1300-mstack-protector-guard-offset=@var{offset} @gol 1301-mstack-protector-guard-symbol=@var{symbol} @gol 1302-mgeneral-regs-only -mcall-ms2sysv-xlogues @gol 1303-mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol 1304-mindirect-branch-register} 1305 1306@emph{x86 Windows Options} 1307@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 1308-mnop-fun-dllimport -mthread @gol 1309-municode -mwin32 -mwindows -fno-set-stack-executable} 1310 1311@emph{Xstormy16 Options} 1312@gccoptlist{-msim} 1313 1314@emph{Xtensa Options} 1315@gccoptlist{-mconst16 -mno-const16 @gol 1316-mfused-madd -mno-fused-madd @gol 1317-mforce-no-pic @gol 1318-mserialize-volatile -mno-serialize-volatile @gol 1319-mtext-section-literals -mno-text-section-literals @gol 1320-mauto-litpools -mno-auto-litpools @gol 1321-mtarget-align -mno-target-align @gol 1322-mlongcalls -mno-longcalls} 1323 1324@emph{zSeries Options} 1325See S/390 and zSeries Options. 1326@end table 1327 1328 1329@node Overall Options 1330@section Options Controlling the Kind of Output 1331 1332Compilation can involve up to four stages: preprocessing, compilation 1333proper, assembly and linking, always in that order. GCC is capable of 1334preprocessing and compiling several files either into several 1335assembler input files, or into one assembler input file; then each 1336assembler input file produces an object file, and linking combines all 1337the object files (those newly compiled, and those specified as input) 1338into an executable file. 1339 1340@cindex file name suffix 1341For any given input file, the file name suffix determines what kind of 1342compilation is done: 1343 1344@table @gcctabopt 1345@item @var{file}.c 1346C source code that must be preprocessed. 1347 1348@item @var{file}.i 1349C source code that should not be preprocessed. 1350 1351@item @var{file}.ii 1352C++ source code that should not be preprocessed. 1353 1354@item @var{file}.m 1355Objective-C source code. Note that you must link with the @file{libobjc} 1356library to make an Objective-C program work. 1357 1358@item @var{file}.mi 1359Objective-C source code that should not be preprocessed. 1360 1361@item @var{file}.mm 1362@itemx @var{file}.M 1363Objective-C++ source code. Note that you must link with the @file{libobjc} 1364library to make an Objective-C++ program work. Note that @samp{.M} refers 1365to a literal capital M@. 1366 1367@item @var{file}.mii 1368Objective-C++ source code that should not be preprocessed. 1369 1370@item @var{file}.h 1371C, C++, Objective-C or Objective-C++ header file to be turned into a 1372precompiled header (default), or C, C++ header file to be turned into an 1373Ada spec (via the @option{-fdump-ada-spec} switch). 1374 1375@item @var{file}.cc 1376@itemx @var{file}.cp 1377@itemx @var{file}.cxx 1378@itemx @var{file}.cpp 1379@itemx @var{file}.CPP 1380@itemx @var{file}.c++ 1381@itemx @var{file}.C 1382C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1383the last two letters must both be literally @samp{x}. Likewise, 1384@samp{.C} refers to a literal capital C@. 1385 1386@item @var{file}.mm 1387@itemx @var{file}.M 1388Objective-C++ source code that must be preprocessed. 1389 1390@item @var{file}.mii 1391Objective-C++ source code that should not be preprocessed. 1392 1393@item @var{file}.hh 1394@itemx @var{file}.H 1395@itemx @var{file}.hp 1396@itemx @var{file}.hxx 1397@itemx @var{file}.hpp 1398@itemx @var{file}.HPP 1399@itemx @var{file}.h++ 1400@itemx @var{file}.tcc 1401C++ header file to be turned into a precompiled header or Ada spec. 1402 1403@item @var{file}.f 1404@itemx @var{file}.for 1405@itemx @var{file}.ftn 1406Fixed form Fortran source code that should not be preprocessed. 1407 1408@item @var{file}.F 1409@itemx @var{file}.FOR 1410@itemx @var{file}.fpp 1411@itemx @var{file}.FPP 1412@itemx @var{file}.FTN 1413Fixed form Fortran source code that must be preprocessed (with the traditional 1414preprocessor). 1415 1416@item @var{file}.f90 1417@itemx @var{file}.f95 1418@itemx @var{file}.f03 1419@itemx @var{file}.f08 1420Free form Fortran source code that should not be preprocessed. 1421 1422@item @var{file}.F90 1423@itemx @var{file}.F95 1424@itemx @var{file}.F03 1425@itemx @var{file}.F08 1426Free form Fortran source code that must be preprocessed (with the 1427traditional preprocessor). 1428 1429@item @var{file}.go 1430Go source code. 1431 1432@item @var{file}.brig 1433BRIG files (binary representation of HSAIL). 1434 1435@item @var{file}.d 1436D source code. 1437 1438@item @var{file}.di 1439D interface file. 1440 1441@item @var{file}.dd 1442D documentation code (Ddoc). 1443 1444@item @var{file}.ads 1445Ada source code file that contains a library unit declaration (a 1446declaration of a package, subprogram, or generic, or a generic 1447instantiation), or a library unit renaming declaration (a package, 1448generic, or subprogram renaming declaration). Such files are also 1449called @dfn{specs}. 1450 1451@item @var{file}.adb 1452Ada source code file containing a library unit body (a subprogram or 1453package body). Such files are also called @dfn{bodies}. 1454 1455@c GCC also knows about some suffixes for languages not yet included: 1456@c Ratfor: 1457@c @var{file}.r 1458 1459@item @var{file}.s 1460Assembler code. 1461 1462@item @var{file}.S 1463@itemx @var{file}.sx 1464Assembler code that must be preprocessed. 1465 1466@item @var{other} 1467An object file to be fed straight into linking. 1468Any file name with no recognized suffix is treated this way. 1469@end table 1470 1471@opindex x 1472You can specify the input language explicitly with the @option{-x} option: 1473 1474@table @gcctabopt 1475@item -x @var{language} 1476Specify explicitly the @var{language} for the following input files 1477(rather than letting the compiler choose a default based on the file 1478name suffix). This option applies to all following input files until 1479the next @option{-x} option. Possible values for @var{language} are: 1480@smallexample 1481c c-header cpp-output 1482c++ c++-header c++-cpp-output 1483objective-c objective-c-header objective-c-cpp-output 1484objective-c++ objective-c++-header objective-c++-cpp-output 1485assembler assembler-with-cpp 1486ada 1487d 1488f77 f77-cpp-input f95 f95-cpp-input 1489go 1490brig 1491@end smallexample 1492 1493@item -x none 1494Turn off any specification of a language, so that subsequent files are 1495handled according to their file name suffixes (as they are if @option{-x} 1496has not been used at all). 1497@end table 1498 1499If you only want some of the stages of compilation, you can use 1500@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1501one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1502@command{gcc} is to stop. Note that some combinations (for example, 1503@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1504 1505@table @gcctabopt 1506@item -c 1507@opindex c 1508Compile or assemble the source files, but do not link. The linking 1509stage simply is not done. The ultimate output is in the form of an 1510object file for each source file. 1511 1512By default, the object file name for a source file is made by replacing 1513the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1514 1515Unrecognized input files, not requiring compilation or assembly, are 1516ignored. 1517 1518@item -S 1519@opindex S 1520Stop after the stage of compilation proper; do not assemble. The output 1521is in the form of an assembler code file for each non-assembler input 1522file specified. 1523 1524By default, the assembler file name for a source file is made by 1525replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1526 1527Input files that don't require compilation are ignored. 1528 1529@item -E 1530@opindex E 1531Stop after the preprocessing stage; do not run the compiler proper. The 1532output is in the form of preprocessed source code, which is sent to the 1533standard output. 1534 1535Input files that don't require preprocessing are ignored. 1536 1537@cindex output file option 1538@item -o @var{file} 1539@opindex o 1540Place output in file @var{file}. This applies to whatever 1541sort of output is being produced, whether it be an executable file, 1542an object file, an assembler file or preprocessed C code. 1543 1544If @option{-o} is not specified, the default is to put an executable 1545file in @file{a.out}, the object file for 1546@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1547assembler file in @file{@var{source}.s}, a precompiled header file in 1548@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1549standard output. 1550 1551@item -v 1552@opindex v 1553Print (on standard error output) the commands executed to run the stages 1554of compilation. Also print the version number of the compiler driver 1555program and of the preprocessor and the compiler proper. 1556 1557@item -### 1558@opindex ### 1559Like @option{-v} except the commands are not executed and arguments 1560are quoted unless they contain only alphanumeric characters or @code{./-_}. 1561This is useful for shell scripts to capture the driver-generated command lines. 1562 1563@item --help 1564@opindex help 1565Print (on the standard output) a description of the command-line options 1566understood by @command{gcc}. If the @option{-v} option is also specified 1567then @option{--help} is also passed on to the various processes 1568invoked by @command{gcc}, so that they can display the command-line options 1569they accept. If the @option{-Wextra} option has also been specified 1570(prior to the @option{--help} option), then command-line options that 1571have no documentation associated with them are also displayed. 1572 1573@item --target-help 1574@opindex target-help 1575Print (on the standard output) a description of target-specific command-line 1576options for each tool. For some targets extra target-specific 1577information may also be printed. 1578 1579@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 1580Print (on the standard output) a description of the command-line 1581options understood by the compiler that fit into all specified classes 1582and qualifiers. These are the supported classes: 1583 1584@table @asis 1585@item @samp{optimizers} 1586Display all of the optimization options supported by the 1587compiler. 1588 1589@item @samp{warnings} 1590Display all of the options controlling warning messages 1591produced by the compiler. 1592 1593@item @samp{target} 1594Display target-specific options. Unlike the 1595@option{--target-help} option however, target-specific options of the 1596linker and assembler are not displayed. This is because those 1597tools do not currently support the extended @option{--help=} syntax. 1598 1599@item @samp{params} 1600Display the values recognized by the @option{--param} 1601option. 1602 1603@item @var{language} 1604Display the options supported for @var{language}, where 1605@var{language} is the name of one of the languages supported in this 1606version of GCC@. 1607 1608@item @samp{common} 1609Display the options that are common to all languages. 1610@end table 1611 1612These are the supported qualifiers: 1613 1614@table @asis 1615@item @samp{undocumented} 1616Display only those options that are undocumented. 1617 1618@item @samp{joined} 1619Display options taking an argument that appears after an equal 1620sign in the same continuous piece of text, such as: 1621@samp{--help=target}. 1622 1623@item @samp{separate} 1624Display options taking an argument that appears as a separate word 1625following the original option, such as: @samp{-o output-file}. 1626@end table 1627 1628Thus for example to display all the undocumented target-specific 1629switches supported by the compiler, use: 1630 1631@smallexample 1632--help=target,undocumented 1633@end smallexample 1634 1635The sense of a qualifier can be inverted by prefixing it with the 1636@samp{^} character, so for example to display all binary warning 1637options (i.e., ones that are either on or off and that do not take an 1638argument) that have a description, use: 1639 1640@smallexample 1641--help=warnings,^joined,^undocumented 1642@end smallexample 1643 1644The argument to @option{--help=} should not consist solely of inverted 1645qualifiers. 1646 1647Combining several classes is possible, although this usually 1648restricts the output so much that there is nothing to display. One 1649case where it does work, however, is when one of the classes is 1650@var{target}. For example, to display all the target-specific 1651optimization options, use: 1652 1653@smallexample 1654--help=target,optimizers 1655@end smallexample 1656 1657The @option{--help=} option can be repeated on the command line. Each 1658successive use displays its requested class of options, skipping 1659those that have already been displayed. If @option{--help} is also 1660specified anywhere on the command line then this takes precedence 1661over any @option{--help=} option. 1662 1663If the @option{-Q} option appears on the command line before the 1664@option{--help=} option, then the descriptive text displayed by 1665@option{--help=} is changed. Instead of describing the displayed 1666options, an indication is given as to whether the option is enabled, 1667disabled or set to a specific value (assuming that the compiler 1668knows this at the point where the @option{--help=} option is used). 1669 1670Here is a truncated example from the ARM port of @command{gcc}: 1671 1672@smallexample 1673 % gcc -Q -mabi=2 --help=target -c 1674 The following options are target specific: 1675 -mabi= 2 1676 -mabort-on-noreturn [disabled] 1677 -mapcs [disabled] 1678@end smallexample 1679 1680The output is sensitive to the effects of previous command-line 1681options, so for example it is possible to find out which optimizations 1682are enabled at @option{-O2} by using: 1683 1684@smallexample 1685-Q -O2 --help=optimizers 1686@end smallexample 1687 1688Alternatively you can discover which binary optimizations are enabled 1689by @option{-O3} by using: 1690 1691@smallexample 1692gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 1693gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 1694diff /tmp/O2-opts /tmp/O3-opts | grep enabled 1695@end smallexample 1696 1697@item --version 1698@opindex version 1699Display the version number and copyrights of the invoked GCC@. 1700 1701@item -pass-exit-codes 1702@opindex pass-exit-codes 1703Normally the @command{gcc} program exits with the code of 1 if any 1704phase of the compiler returns a non-success return code. If you specify 1705@option{-pass-exit-codes}, the @command{gcc} program instead returns with 1706the numerically highest error produced by any phase returning an error 1707indication. The C, C++, and Fortran front ends return 4 if an internal 1708compiler error is encountered. 1709 1710@item -pipe 1711@opindex pipe 1712Use pipes rather than temporary files for communication between the 1713various stages of compilation. This fails to work on some systems where 1714the assembler is unable to read from a pipe; but the GNU assembler has 1715no trouble. 1716 1717@item -specs=@var{file} 1718@opindex specs 1719Process @var{file} after the compiler reads in the standard @file{specs} 1720file, in order to override the defaults which the @command{gcc} driver 1721program uses when determining what switches to pass to @command{cc1}, 1722@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 1723@option{-specs=@var{file}} can be specified on the command line, and they 1724are processed in order, from left to right. @xref{Spec Files}, for 1725information about the format of the @var{file}. 1726 1727@item -wrapper 1728@opindex wrapper 1729Invoke all subcommands under a wrapper program. The name of the 1730wrapper program and its parameters are passed as a comma separated 1731list. 1732 1733@smallexample 1734gcc -c t.c -wrapper gdb,--args 1735@end smallexample 1736 1737@noindent 1738This invokes all subprograms of @command{gcc} under 1739@samp{gdb --args}, thus the invocation of @command{cc1} is 1740@samp{gdb --args cc1 @dots{}}. 1741 1742@item -ffile-prefix-map=@var{old}=@var{new} 1743@opindex ffile-prefix-map 1744When compiling files residing in directory @file{@var{old}}, record 1745any references to them in the result of the compilation as if the 1746files resided in directory @file{@var{new}} instead. Specifying this 1747option is equivalent to specifying all the individual 1748@option{-f*-prefix-map} options. This can be used to make reproducible 1749builds that are location independent. See also 1750@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}. 1751 1752@item -fplugin=@var{name}.so 1753@opindex fplugin 1754Load the plugin code in file @var{name}.so, assumed to be a 1755shared object to be dlopen'd by the compiler. The base name of 1756the shared object file is used to identify the plugin for the 1757purposes of argument parsing (See 1758@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 1759Each plugin should define the callback functions specified in the 1760Plugins API. 1761 1762@item -fplugin-arg-@var{name}-@var{key}=@var{value} 1763@opindex fplugin-arg 1764Define an argument called @var{key} with a value of @var{value} 1765for the plugin called @var{name}. 1766 1767@item -fdump-ada-spec@r{[}-slim@r{]} 1768@opindex fdump-ada-spec 1769For C and C++ source and include files, generate corresponding Ada specs. 1770@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 1771GNAT User's Guide}, which provides detailed documentation on this feature. 1772 1773@item -fada-spec-parent=@var{unit} 1774@opindex fada-spec-parent 1775In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 1776Ada specs as child units of parent @var{unit}. 1777 1778@item -fdump-go-spec=@var{file} 1779@opindex fdump-go-spec 1780For input files in any language, generate corresponding Go 1781declarations in @var{file}. This generates Go @code{const}, 1782@code{type}, @code{var}, and @code{func} declarations which may be a 1783useful way to start writing a Go interface to code written in some 1784other language. 1785 1786@include @value{srcdir}/../libiberty/at-file.texi 1787@end table 1788 1789@node Invoking G++ 1790@section Compiling C++ Programs 1791 1792@cindex suffixes for C++ source 1793@cindex C++ source file suffixes 1794C++ source files conventionally use one of the suffixes @samp{.C}, 1795@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1796@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 1797@samp{.H}, or (for shared template code) @samp{.tcc}; and 1798preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1799files with these names and compiles them as C++ programs even if you 1800call the compiler the same way as for compiling C programs (usually 1801with the name @command{gcc}). 1802 1803@findex g++ 1804@findex c++ 1805However, the use of @command{gcc} does not add the C++ library. 1806@command{g++} is a program that calls GCC and automatically specifies linking 1807against the C++ library. It treats @samp{.c}, 1808@samp{.h} and @samp{.i} files as C++ source files instead of C source 1809files unless @option{-x} is used. This program is also useful when 1810precompiling a C header file with a @samp{.h} extension for use in C++ 1811compilations. On many systems, @command{g++} is also installed with 1812the name @command{c++}. 1813 1814@cindex invoking @command{g++} 1815When you compile C++ programs, you may specify many of the same 1816command-line options that you use for compiling programs in any 1817language; or command-line options meaningful for C and related 1818languages; or options that are meaningful only for C++ programs. 1819@xref{C Dialect Options,,Options Controlling C Dialect}, for 1820explanations of options for languages related to C@. 1821@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1822explanations of options that are meaningful only for C++ programs. 1823 1824@node C Dialect Options 1825@section Options Controlling C Dialect 1826@cindex dialect options 1827@cindex language dialect options 1828@cindex options, dialect 1829 1830The following options control the dialect of C (or languages derived 1831from C, such as C++, Objective-C and Objective-C++) that the compiler 1832accepts: 1833 1834@table @gcctabopt 1835@cindex ANSI support 1836@cindex ISO support 1837@item -ansi 1838@opindex ansi 1839In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 1840equivalent to @option{-std=c++98}. 1841 1842This turns off certain features of GCC that are incompatible with ISO 1843C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1844such as the @code{asm} and @code{typeof} keywords, and 1845predefined macros such as @code{unix} and @code{vax} that identify the 1846type of system you are using. It also enables the undesirable and 1847rarely used ISO trigraph feature. For the C compiler, 1848it disables recognition of C++ style @samp{//} comments as well as 1849the @code{inline} keyword. 1850 1851The alternate keywords @code{__asm__}, @code{__extension__}, 1852@code{__inline__} and @code{__typeof__} continue to work despite 1853@option{-ansi}. You would not want to use them in an ISO C program, of 1854course, but it is useful to put them in header files that might be included 1855in compilations done with @option{-ansi}. Alternate predefined macros 1856such as @code{__unix__} and @code{__vax__} are also available, with or 1857without @option{-ansi}. 1858 1859The @option{-ansi} option does not cause non-ISO programs to be 1860rejected gratuitously. For that, @option{-Wpedantic} is required in 1861addition to @option{-ansi}. @xref{Warning Options}. 1862 1863The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1864option is used. Some header files may notice this macro and refrain 1865from declaring certain functions or defining certain macros that the 1866ISO standard doesn't call for; this is to avoid interfering with any 1867programs that might use these names for other things. 1868 1869Functions that are normally built in but do not have semantics 1870defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1871functions when @option{-ansi} is used. @xref{Other Builtins,,Other 1872built-in functions provided by GCC}, for details of the functions 1873affected. 1874 1875@item -std= 1876@opindex std 1877Determine the language standard. @xref{Standards,,Language Standards 1878Supported by GCC}, for details of these standard versions. This option 1879is currently only supported when compiling C or C++. 1880 1881The compiler can accept several base standards, such as @samp{c90} or 1882@samp{c++98}, and GNU dialects of those standards, such as 1883@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 1884compiler accepts all programs following that standard plus those 1885using GNU extensions that do not contradict it. For example, 1886@option{-std=c90} turns off certain features of GCC that are 1887incompatible with ISO C90, such as the @code{asm} and @code{typeof} 1888keywords, but not other GNU extensions that do not have a meaning in 1889ISO C90, such as omitting the middle term of a @code{?:} 1890expression. On the other hand, when a GNU dialect of a standard is 1891specified, all features supported by the compiler are enabled, even when 1892those features change the meaning of the base standard. As a result, some 1893strict-conforming programs may be rejected. The particular standard 1894is used by @option{-Wpedantic} to identify which features are GNU 1895extensions given that version of the standard. For example 1896@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 1897comments, while @option{-std=gnu99 -Wpedantic} does not. 1898 1899A value for this option must be provided; possible values are 1900 1901@table @samp 1902@item c90 1903@itemx c89 1904@itemx iso9899:1990 1905Support all ISO C90 programs (certain GNU extensions that conflict 1906with ISO C90 are disabled). Same as @option{-ansi} for C code. 1907 1908@item iso9899:199409 1909ISO C90 as modified in amendment 1. 1910 1911@item c99 1912@itemx c9x 1913@itemx iso9899:1999 1914@itemx iso9899:199x 1915ISO C99. This standard is substantially completely supported, modulo 1916bugs and floating-point issues 1917(mainly but not entirely relating to optional C99 features from 1918Annexes F and G). See 1919@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The 1920names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1921 1922@item c11 1923@itemx c1x 1924@itemx iso9899:2011 1925ISO C11, the 2011 revision of the ISO C standard. This standard is 1926substantially completely supported, modulo bugs, floating-point issues 1927(mainly but not entirely relating to optional C11 features from 1928Annexes F and G) and the optional Annexes K (Bounds-checking 1929interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. 1930 1931@item c17 1932@itemx c18 1933@itemx iso9899:2017 1934@itemx iso9899:2018 1935ISO C17, the 2017 revision of the ISO C standard 1936(published in 2018). This standard is 1937same as C11 except for corrections of defects (all of which are also 1938applied with @option{-std=c11}) and a new value of 1939@code{__STDC_VERSION__}, and so is supported to the same extent as C11. 1940 1941@item c2x 1942The next version of the ISO C standard, still under development. The 1943support for this version is experimental and incomplete. 1944 1945@item gnu90 1946@itemx gnu89 1947GNU dialect of ISO C90 (including some C99 features). 1948 1949@item gnu99 1950@itemx gnu9x 1951GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. 1952 1953@item gnu11 1954@itemx gnu1x 1955GNU dialect of ISO C11. 1956The name @samp{gnu1x} is deprecated. 1957 1958@item gnu17 1959@itemx gnu18 1960GNU dialect of ISO C17. This is the default for C code. 1961 1962@item gnu2x 1963The next version of the ISO C standard, still under development, plus 1964GNU extensions. The support for this version is experimental and 1965incomplete. 1966 1967@item c++98 1968@itemx c++03 1969The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 1970additional defect reports. Same as @option{-ansi} for C++ code. 1971 1972@item gnu++98 1973@itemx gnu++03 1974GNU dialect of @option{-std=c++98}. 1975 1976@item c++11 1977@itemx c++0x 1978The 2011 ISO C++ standard plus amendments. 1979The name @samp{c++0x} is deprecated. 1980 1981@item gnu++11 1982@itemx gnu++0x 1983GNU dialect of @option{-std=c++11}. 1984The name @samp{gnu++0x} is deprecated. 1985 1986@item c++14 1987@itemx c++1y 1988The 2014 ISO C++ standard plus amendments. 1989The name @samp{c++1y} is deprecated. 1990 1991@item gnu++14 1992@itemx gnu++1y 1993GNU dialect of @option{-std=c++14}. 1994This is the default for C++ code. 1995The name @samp{gnu++1y} is deprecated. 1996 1997@item c++17 1998@itemx c++1z 1999The 2017 ISO C++ standard plus amendments. 2000The name @samp{c++1z} is deprecated. 2001 2002@item gnu++17 2003@itemx gnu++1z 2004GNU dialect of @option{-std=c++17}. 2005The name @samp{gnu++1z} is deprecated. 2006 2007@item c++2a 2008The next revision of the ISO C++ standard, tentatively planned for 20092020. Support is highly experimental, and will almost certainly 2010change in incompatible ways in future releases. 2011 2012@item gnu++2a 2013GNU dialect of @option{-std=c++2a}. Support is highly experimental, 2014and will almost certainly change in incompatible ways in future 2015releases. 2016@end table 2017 2018@item -fgnu89-inline 2019@opindex fgnu89-inline 2020The option @option{-fgnu89-inline} tells GCC to use the traditional 2021GNU semantics for @code{inline} functions when in C99 mode. 2022@xref{Inline,,An Inline Function is As Fast As a Macro}. 2023Using this option is roughly equivalent to adding the 2024@code{gnu_inline} function attribute to all inline functions 2025(@pxref{Function Attributes}). 2026 2027The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 2028C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 2029specifies the default behavior). 2030This option is not supported in @option{-std=c90} or 2031@option{-std=gnu90} mode. 2032 2033The preprocessor macros @code{__GNUC_GNU_INLINE__} and 2034@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 2035in effect for @code{inline} functions. @xref{Common Predefined 2036Macros,,,cpp,The C Preprocessor}. 2037 2038@item -fpermitted-flt-eval-methods=@var{style} 2039@opindex fpermitted-flt-eval-methods 2040@opindex fpermitted-flt-eval-methods=c11 2041@opindex fpermitted-flt-eval-methods=ts-18661-3 2042ISO/IEC TS 18661-3 defines new permissible values for 2043@code{FLT_EVAL_METHOD} that indicate that operations and constants with 2044a semantic type that is an interchange or extended format should be 2045evaluated to the precision and range of that type. These new values are 2046a superset of those permitted under C99/C11, which does not specify the 2047meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code 2048conforming to C11 may not have been written expecting the possibility of 2049the new values. 2050 2051@option{-fpermitted-flt-eval-methods} specifies whether the compiler 2052should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11, 2053or the extended set of values specified in ISO/IEC TS 18661-3. 2054 2055@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate. 2056 2057The default when in a standards compliant mode (@option{-std=c11} or similar) 2058is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU 2059dialect (@option{-std=gnu11} or similar) is 2060@option{-fpermitted-flt-eval-methods=ts-18661-3}. 2061 2062@item -aux-info @var{filename} 2063@opindex aux-info 2064Output to the given filename prototyped declarations for all functions 2065declared and/or defined in a translation unit, including those in header 2066files. This option is silently ignored in any language other than C@. 2067 2068Besides declarations, the file indicates, in comments, the origin of 2069each declaration (source file and line), whether the declaration was 2070implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 2071@samp{O} for old, respectively, in the first character after the line 2072number and the colon), and whether it came from a declaration or a 2073definition (@samp{C} or @samp{F}, respectively, in the following 2074character). In the case of function definitions, a K&R-style list of 2075arguments followed by their declarations is also provided, inside 2076comments, after the declaration. 2077 2078@item -fallow-parameterless-variadic-functions 2079@opindex fallow-parameterless-variadic-functions 2080Accept variadic functions without named parameters. 2081 2082Although it is possible to define such a function, this is not very 2083useful as it is not possible to read the arguments. This is only 2084supported for C as this construct is allowed by C++. 2085 2086@item -fno-asm 2087@opindex fno-asm 2088@opindex fasm 2089Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 2090keyword, so that code can use these words as identifiers. You can use 2091the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 2092instead. @option{-ansi} implies @option{-fno-asm}. 2093 2094In C++, this switch only affects the @code{typeof} keyword, since 2095@code{asm} and @code{inline} are standard keywords. You may want to 2096use the @option{-fno-gnu-keywords} flag instead, which has the same 2097effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 2098switch only affects the @code{asm} and @code{typeof} keywords, since 2099@code{inline} is a standard keyword in ISO C99. 2100 2101@item -fno-builtin 2102@itemx -fno-builtin-@var{function} 2103@opindex fno-builtin 2104@opindex fbuiltin 2105@cindex built-in functions 2106Don't recognize built-in functions that do not begin with 2107@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 2108functions provided by GCC}, for details of the functions affected, 2109including those which are not built-in functions when @option{-ansi} or 2110@option{-std} options for strict ISO C conformance are used because they 2111do not have an ISO standard meaning. 2112 2113GCC normally generates special code to handle certain built-in functions 2114more efficiently; for instance, calls to @code{alloca} may become single 2115instructions which adjust the stack directly, and calls to @code{memcpy} 2116may become inline copy loops. The resulting code is often both smaller 2117and faster, but since the function calls no longer appear as such, you 2118cannot set a breakpoint on those calls, nor can you change the behavior 2119of the functions by linking with a different library. In addition, 2120when a function is recognized as a built-in function, GCC may use 2121information about that function to warn about problems with calls to 2122that function, or to generate more efficient code, even if the 2123resulting code still contains calls to that function. For example, 2124warnings are given with @option{-Wformat} for bad calls to 2125@code{printf} when @code{printf} is built in and @code{strlen} is 2126known not to modify global memory. 2127 2128With the @option{-fno-builtin-@var{function}} option 2129only the built-in function @var{function} is 2130disabled. @var{function} must not begin with @samp{__builtin_}. If a 2131function is named that is not built-in in this version of GCC, this 2132option is ignored. There is no corresponding 2133@option{-fbuiltin-@var{function}} option; if you wish to enable 2134built-in functions selectively when using @option{-fno-builtin} or 2135@option{-ffreestanding}, you may define macros such as: 2136 2137@smallexample 2138#define abs(n) __builtin_abs ((n)) 2139#define strcpy(d, s) __builtin_strcpy ((d), (s)) 2140@end smallexample 2141 2142@item -fgimple 2143@opindex fgimple 2144 2145Enable parsing of function definitions marked with @code{__GIMPLE}. 2146This is an experimental feature that allows unit testing of GIMPLE 2147passes. 2148 2149@item -fhosted 2150@opindex fhosted 2151@cindex hosted environment 2152 2153Assert that compilation targets a hosted environment. This implies 2154@option{-fbuiltin}. A hosted environment is one in which the 2155entire standard library is available, and in which @code{main} has a return 2156type of @code{int}. Examples are nearly everything except a kernel. 2157This is equivalent to @option{-fno-freestanding}. 2158 2159@item -ffreestanding 2160@opindex ffreestanding 2161@cindex hosted environment 2162 2163Assert that compilation targets a freestanding environment. This 2164implies @option{-fno-builtin}. A freestanding environment 2165is one in which the standard library may not exist, and program startup may 2166not necessarily be at @code{main}. The most obvious example is an OS kernel. 2167This is equivalent to @option{-fno-hosted}. 2168 2169@xref{Standards,,Language Standards Supported by GCC}, for details of 2170freestanding and hosted environments. 2171 2172@item -fopenacc 2173@opindex fopenacc 2174@cindex OpenACC accelerator programming 2175Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and 2176@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the 2177compiler generates accelerated code according to the OpenACC Application 2178Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option 2179implies @option{-pthread}, and thus is only supported on targets that 2180have support for @option{-pthread}. 2181 2182@item -fopenacc-dim=@var{geom} 2183@opindex fopenacc-dim 2184@cindex OpenACC accelerator programming 2185Specify default compute dimensions for parallel offload regions that do 2186not explicitly specify. The @var{geom} value is a triple of 2187':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size 2188can be omitted, to use a target-specific default value. 2189 2190@item -fopenmp 2191@opindex fopenmp 2192@cindex OpenMP parallel 2193Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 2194@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 2195compiler generates parallel code according to the OpenMP Application 2196Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option 2197implies @option{-pthread}, and thus is only supported on targets that 2198have support for @option{-pthread}. @option{-fopenmp} implies 2199@option{-fopenmp-simd}. 2200 2201@item -fopenmp-simd 2202@opindex fopenmp-simd 2203@cindex OpenMP SIMD 2204@cindex SIMD 2205Enable handling of OpenMP's SIMD directives with @code{#pragma omp} 2206in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives 2207are ignored. 2208 2209@item -fgnu-tm 2210@opindex fgnu-tm 2211When the option @option{-fgnu-tm} is specified, the compiler 2212generates code for the Linux variant of Intel's current Transactional 2213Memory ABI specification document (Revision 1.1, May 6 2009). This is 2214an experimental feature whose interface may change in future versions 2215of GCC, as the official specification changes. Please note that not 2216all architectures are supported for this feature. 2217 2218For more information on GCC's support for transactional memory, 2219@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 2220Transactional Memory Library}. 2221 2222Note that the transactional memory feature is not supported with 2223non-call exceptions (@option{-fnon-call-exceptions}). 2224 2225@item -fms-extensions 2226@opindex fms-extensions 2227Accept some non-standard constructs used in Microsoft header files. 2228 2229In C++ code, this allows member names in structures to be similar 2230to previous types declarations. 2231 2232@smallexample 2233typedef int UOW; 2234struct ABC @{ 2235 UOW UOW; 2236@}; 2237@end smallexample 2238 2239Some cases of unnamed fields in structures and unions are only 2240accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 2241fields within structs/unions}, for details. 2242 2243Note that this option is off for all targets but x86 2244targets using ms-abi. 2245 2246@item -fplan9-extensions 2247@opindex fplan9-extensions 2248Accept some non-standard constructs used in Plan 9 code. 2249 2250This enables @option{-fms-extensions}, permits passing pointers to 2251structures with anonymous fields to functions that expect pointers to 2252elements of the type of the field, and permits referring to anonymous 2253fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 2254struct/union fields within structs/unions}, for details. This is only 2255supported for C, not C++. 2256 2257@item -fcond-mismatch 2258@opindex fcond-mismatch 2259Allow conditional expressions with mismatched types in the second and 2260third arguments. The value of such an expression is void. This option 2261is not supported for C++. 2262 2263@item -flax-vector-conversions 2264@opindex flax-vector-conversions 2265Allow implicit conversions between vectors with differing numbers of 2266elements and/or incompatible element types. This option should not be 2267used for new code. 2268 2269@item -funsigned-char 2270@opindex funsigned-char 2271Let the type @code{char} be unsigned, like @code{unsigned char}. 2272 2273Each kind of machine has a default for what @code{char} should 2274be. It is either like @code{unsigned char} by default or like 2275@code{signed char} by default. 2276 2277Ideally, a portable program should always use @code{signed char} or 2278@code{unsigned char} when it depends on the signedness of an object. 2279But many programs have been written to use plain @code{char} and 2280expect it to be signed, or expect it to be unsigned, depending on the 2281machines they were written for. This option, and its inverse, let you 2282make such a program work with the opposite default. 2283 2284The type @code{char} is always a distinct type from each of 2285@code{signed char} or @code{unsigned char}, even though its behavior 2286is always just like one of those two. 2287 2288@item -fsigned-char 2289@opindex fsigned-char 2290Let the type @code{char} be signed, like @code{signed char}. 2291 2292Note that this is equivalent to @option{-fno-unsigned-char}, which is 2293the negative form of @option{-funsigned-char}. Likewise, the option 2294@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 2295 2296@item -fsigned-bitfields 2297@itemx -funsigned-bitfields 2298@itemx -fno-signed-bitfields 2299@itemx -fno-unsigned-bitfields 2300@opindex fsigned-bitfields 2301@opindex funsigned-bitfields 2302@opindex fno-signed-bitfields 2303@opindex fno-unsigned-bitfields 2304These options control whether a bit-field is signed or unsigned, when the 2305declaration does not use either @code{signed} or @code{unsigned}. By 2306default, such a bit-field is signed, because this is consistent: the 2307basic integer types such as @code{int} are signed types. 2308 2309@item -fsso-struct=@var{endianness} 2310@opindex fsso-struct 2311Set the default scalar storage order of structures and unions to the 2312specified endianness. The accepted values are @samp{big-endian}, 2313@samp{little-endian} and @samp{native} for the native endianness of 2314the target (the default). This option is not supported for C++. 2315 2316@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate 2317code that is not binary compatible with code generated without it if the 2318specified endianness is not the native endianness of the target. 2319@end table 2320 2321@node C++ Dialect Options 2322@section Options Controlling C++ Dialect 2323 2324@cindex compiler options, C++ 2325@cindex C++ options, command-line 2326@cindex options, C++ 2327This section describes the command-line options that are only meaningful 2328for C++ programs. You can also use most of the GNU compiler options 2329regardless of what language your program is in. For example, you 2330might compile a file @file{firstClass.C} like this: 2331 2332@smallexample 2333g++ -g -fstrict-enums -O -c firstClass.C 2334@end smallexample 2335 2336@noindent 2337In this example, only @option{-fstrict-enums} is an option meant 2338only for C++ programs; you can use the other options with any 2339language supported by GCC@. 2340 2341Some options for compiling C programs, such as @option{-std}, are also 2342relevant for C++ programs. 2343@xref{C Dialect Options,,Options Controlling C Dialect}. 2344 2345Here is a list of options that are @emph{only} for compiling C++ programs: 2346 2347@table @gcctabopt 2348 2349@item -fabi-version=@var{n} 2350@opindex fabi-version 2351Use version @var{n} of the C++ ABI@. The default is version 0. 2352 2353Version 0 refers to the version conforming most closely to 2354the C++ ABI specification. Therefore, the ABI obtained using version 0 2355will change in different versions of G++ as ABI bugs are fixed. 2356 2357Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 2358 2359Version 2 is the version of the C++ ABI that first appeared in G++ 23603.4, and was the default through G++ 4.9. 2361 2362Version 3 corrects an error in mangling a constant address as a 2363template argument. 2364 2365Version 4, which first appeared in G++ 4.5, implements a standard 2366mangling for vector types. 2367 2368Version 5, which first appeared in G++ 4.6, corrects the mangling of 2369attribute const/volatile on function pointer types, decltype of a 2370plain decl, and use of a function parameter in the declaration of 2371another parameter. 2372 2373Version 6, which first appeared in G++ 4.7, corrects the promotion 2374behavior of C++11 scoped enums and the mangling of template argument 2375packs, const/static_cast, prefix ++ and --, and a class scope function 2376used as a template argument. 2377 2378Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a 2379builtin type and corrects the mangling of lambdas in default argument 2380scope. 2381 2382Version 8, which first appeared in G++ 4.9, corrects the substitution 2383behavior of function types with function-cv-qualifiers. 2384 2385Version 9, which first appeared in G++ 5.2, corrects the alignment of 2386@code{nullptr_t}. 2387 2388Version 10, which first appeared in G++ 6.1, adds mangling of 2389attributes that affect type identity, such as ia32 calling convention 2390attributes (e.g.@: @samp{stdcall}). 2391 2392Version 11, which first appeared in G++ 7, corrects the mangling of 2393sizeof... expressions and operator names. For multiple entities with 2394the same name within a function, that are declared in different scopes, 2395the mangling now changes starting with the twelfth occurrence. It also 2396implies @option{-fnew-inheriting-ctors}. 2397 2398Version 12, which first appeared in G++ 8, corrects the calling 2399conventions for empty classes on the x86_64 target and for classes 2400with only deleted copy/move constructors. It accidentally changes the 2401calling convention for classes with a deleted copy constructor and a 2402trivial move constructor. 2403 2404Version 13, which first appeared in G++ 8.2, fixes the accidental 2405change in version 12. 2406 2407See also @option{-Wabi}. 2408 2409@item -fabi-compat-version=@var{n} 2410@opindex fabi-compat-version 2411On targets that support strong aliases, G++ 2412works around mangling changes by creating an alias with the correct 2413mangled name when defining a symbol with an incorrect mangled name. 2414This switch specifies which ABI version to use for the alias. 2415 2416With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7 2417compatibility). If another ABI version is explicitly selected, this 2418defaults to 0. For compatibility with GCC versions 3.2 through 4.9, 2419use @option{-fabi-compat-version=2}. 2420 2421If this option is not provided but @option{-Wabi=@var{n}} is, that 2422version is used for compatibility aliases. If this option is provided 2423along with @option{-Wabi} (without the version), the version from this 2424option is used for the warning. 2425 2426@item -fno-access-control 2427@opindex fno-access-control 2428@opindex faccess-control 2429Turn off all access checking. This switch is mainly useful for working 2430around bugs in the access control code. 2431 2432@item -faligned-new 2433@opindex faligned-new 2434Enable support for C++17 @code{new} of types that require more 2435alignment than @code{void* ::operator new(std::size_t)} provides. A 2436numeric argument such as @code{-faligned-new=32} can be used to 2437specify how much alignment (in bytes) is provided by that function, 2438but few users will need to override the default of 2439@code{alignof(std::max_align_t)}. 2440 2441This flag is enabled by default for @option{-std=c++17}. 2442 2443@item -fchar8_t 2444@itemx -fno-char8_t 2445@opindex fchar8_t 2446@opindex fno-char8_t 2447Enable support for @code{char8_t} as adopted for C++2a. This includes 2448the addition of a new @code{char8_t} fundamental type, changes to the 2449types of UTF-8 string and character literals, new signatures for 2450user-defined literals, associated standard library updates, and new 2451@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros. 2452 2453This option enables functions to be overloaded for ordinary and UTF-8 2454strings: 2455 2456@smallexample 2457int f(const char *); // #1 2458int f(const char8_t *); // #2 2459int v1 = f("text"); // Calls #1 2460int v2 = f(u8"text"); // Calls #2 2461@end smallexample 2462 2463@noindent 2464and introduces new signatures for user-defined literals: 2465 2466@smallexample 2467int operator""_udl1(char8_t); 2468int v3 = u8'x'_udl1; 2469int operator""_udl2(const char8_t*, std::size_t); 2470int v4 = u8"text"_udl2; 2471template<typename T, T...> int operator""_udl3(); 2472int v5 = u8"text"_udl3; 2473@end smallexample 2474 2475@noindent 2476The change to the types of UTF-8 string and character literals introduces 2477incompatibilities with ISO C++11 and later standards. For example, the 2478following code is well-formed under ISO C++11, but is ill-formed when 2479@option{-fchar8_t} is specified. 2480 2481@smallexample 2482char ca[] = u8"xx"; // error: char-array initialized from wide 2483 // string 2484const char *cp = u8"xx";// error: invalid conversion from 2485 // `const char8_t*' to `const char*' 2486int f(const char*); 2487auto v = f(u8"xx"); // error: invalid conversion from 2488 // `const char8_t*' to `const char*' 2489std::string s@{u8"xx"@}; // error: no matching function for call to 2490 // `std::basic_string<char>::basic_string()' 2491using namespace std::literals; 2492s = u8"xx"s; // error: conversion from 2493 // `basic_string<char8_t>' to non-scalar 2494 // type `basic_string<char>' requested 2495@end smallexample 2496 2497@item -fcheck-new 2498@opindex fcheck-new 2499Check that the pointer returned by @code{operator new} is non-null 2500before attempting to modify the storage allocated. This check is 2501normally unnecessary because the C++ standard specifies that 2502@code{operator new} only returns @code{0} if it is declared 2503@code{throw()}, in which case the compiler always checks the 2504return value even without this option. In all other cases, when 2505@code{operator new} has a non-empty exception specification, memory 2506exhaustion is signalled by throwing @code{std::bad_alloc}. See also 2507@samp{new (nothrow)}. 2508 2509@item -fconcepts 2510@opindex fconcepts 2511Enable support for the C++ Extensions for Concepts Technical 2512Specification, ISO 19217 (2015), which allows code like 2513 2514@smallexample 2515template <class T> concept bool Addable = requires (T t) @{ t + t; @}; 2516template <Addable T> T add (T a, T b) @{ return a + b; @} 2517@end smallexample 2518 2519@item -fconstexpr-depth=@var{n} 2520@opindex fconstexpr-depth 2521Set the maximum nested evaluation depth for C++11 constexpr functions 2522to @var{n}. A limit is needed to detect endless recursion during 2523constant expression evaluation. The minimum specified by the standard 2524is 512. 2525 2526@item -fconstexpr-loop-limit=@var{n} 2527@opindex fconstexpr-loop-limit 2528Set the maximum number of iterations for a loop in C++14 constexpr functions 2529to @var{n}. A limit is needed to detect infinite loops during 2530constant expression evaluation. The default is 262144 (1<<18). 2531 2532@item -fconstexpr-ops-limit=@var{n} 2533@opindex fconstexpr-ops-limit 2534Set the maximum number of operations during a single constexpr evaluation. 2535Even when number of iterations of a single loop is limited with the above limit, 2536if there are several nested loops and each of them has many iterations but still 2537smaller than the above limit, or if in a body of some loop or even outside 2538of a loop too many expressions need to be evaluated, the resulting constexpr 2539evaluation might take too long. 2540The default is 33554432 (1<<25). 2541 2542@item -fdeduce-init-list 2543@opindex fdeduce-init-list 2544Enable deduction of a template type parameter as 2545@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@: 2546 2547@smallexample 2548template <class T> auto forward(T t) -> decltype (realfn (t)) 2549@{ 2550 return realfn (t); 2551@} 2552 2553void f() 2554@{ 2555 forward(@{1,2@}); // call forward<std::initializer_list<int>> 2556@} 2557@end smallexample 2558 2559This deduction was implemented as a possible extension to the 2560originally proposed semantics for the C++11 standard, but was not part 2561of the final standard, so it is disabled by default. This option is 2562deprecated, and may be removed in a future version of G++. 2563 2564@item -fno-elide-constructors 2565@opindex fno-elide-constructors 2566@opindex felide-constructors 2567The C++ standard allows an implementation to omit creating a temporary 2568that is only used to initialize another object of the same type. 2569Specifying this option disables that optimization, and forces G++ to 2570call the copy constructor in all cases. This option also causes G++ 2571to call trivial member functions which otherwise would be expanded inline. 2572 2573In C++17, the compiler is required to omit these temporaries, but this 2574option still affects trivial member functions. 2575 2576@item -fno-enforce-eh-specs 2577@opindex fno-enforce-eh-specs 2578@opindex fenforce-eh-specs 2579Don't generate code to check for violation of exception specifications 2580at run time. This option violates the C++ standard, but may be useful 2581for reducing code size in production builds, much like defining 2582@code{NDEBUG}. This does not give user code permission to throw 2583exceptions in violation of the exception specifications; the compiler 2584still optimizes based on the specifications, so throwing an 2585unexpected exception results in undefined behavior at run time. 2586 2587@item -fextern-tls-init 2588@itemx -fno-extern-tls-init 2589@opindex fextern-tls-init 2590@opindex fno-extern-tls-init 2591The C++11 and OpenMP standards allow @code{thread_local} and 2592@code{threadprivate} variables to have dynamic (runtime) 2593initialization. To support this, any use of such a variable goes 2594through a wrapper function that performs any necessary initialization. 2595When the use and definition of the variable are in the same 2596translation unit, this overhead can be optimized away, but when the 2597use is in a different translation unit there is significant overhead 2598even if the variable doesn't actually need dynamic initialization. If 2599the programmer can be sure that no use of the variable in a 2600non-defining TU needs to trigger dynamic initialization (either 2601because the variable is statically initialized, or a use of the 2602variable in the defining TU will be executed before any uses in 2603another TU), they can avoid this overhead with the 2604@option{-fno-extern-tls-init} option. 2605 2606On targets that support symbol aliases, the default is 2607@option{-fextern-tls-init}. On targets that do not support symbol 2608aliases, the default is @option{-fno-extern-tls-init}. 2609 2610@item -fno-gnu-keywords 2611@opindex fno-gnu-keywords 2612@opindex fgnu-keywords 2613Do not recognize @code{typeof} as a keyword, so that code can use this 2614word as an identifier. You can use the keyword @code{__typeof__} instead. 2615This option is implied by the strict ISO C++ dialects: @option{-ansi}, 2616@option{-std=c++98}, @option{-std=c++11}, etc. 2617 2618@item -fno-implicit-templates 2619@opindex fno-implicit-templates 2620@opindex fimplicit-templates 2621Never emit code for non-inline templates that are instantiated 2622implicitly (i.e.@: by use); only emit code for explicit instantiations. 2623If you use this option, you must take care to structure your code to 2624include all the necessary explicit instantiations to avoid getting 2625undefined symbols at link time. 2626@xref{Template Instantiation}, for more information. 2627 2628@item -fno-implicit-inline-templates 2629@opindex fno-implicit-inline-templates 2630@opindex fimplicit-inline-templates 2631Don't emit code for implicit instantiations of inline templates, either. 2632The default is to handle inlines differently so that compiles with and 2633without optimization need the same set of explicit instantiations. 2634 2635@item -fno-implement-inlines 2636@opindex fno-implement-inlines 2637@opindex fimplement-inlines 2638To save space, do not emit out-of-line copies of inline functions 2639controlled by @code{#pragma implementation}. This causes linker 2640errors if these functions are not inlined everywhere they are called. 2641 2642@item -fms-extensions 2643@opindex fms-extensions 2644Disable Wpedantic warnings about constructs used in MFC, such as implicit 2645int and getting a pointer to member function via non-standard syntax. 2646 2647@item -fnew-inheriting-ctors 2648@opindex fnew-inheriting-ctors 2649Enable the P0136 adjustment to the semantics of C++11 constructor 2650inheritance. This is part of C++17 but also considered to be a Defect 2651Report against C++11 and C++14. This flag is enabled by default 2652unless @option{-fabi-version=10} or lower is specified. 2653 2654@item -fnew-ttp-matching 2655@opindex fnew-ttp-matching 2656Enable the P0522 resolution to Core issue 150, template template 2657parameters and default arguments: this allows a template with default 2658template arguments as an argument for a template template parameter 2659with fewer template parameters. This flag is enabled by default for 2660@option{-std=c++17}. 2661 2662@item -fno-nonansi-builtins 2663@opindex fno-nonansi-builtins 2664@opindex fnonansi-builtins 2665Disable built-in declarations of functions that are not mandated by 2666ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 2667@code{index}, @code{bzero}, @code{conjf}, and other related functions. 2668 2669@item -fnothrow-opt 2670@opindex fnothrow-opt 2671Treat a @code{throw()} exception specification as if it were a 2672@code{noexcept} specification to reduce or eliminate the text size 2673overhead relative to a function with no exception specification. If 2674the function has local variables of types with non-trivial 2675destructors, the exception specification actually makes the 2676function smaller because the EH cleanups for those variables can be 2677optimized away. The semantic effect is that an exception thrown out of 2678a function with such an exception specification results in a call 2679to @code{terminate} rather than @code{unexpected}. 2680 2681@item -fno-operator-names 2682@opindex fno-operator-names 2683@opindex foperator-names 2684Do not treat the operator name keywords @code{and}, @code{bitand}, 2685@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 2686synonyms as keywords. 2687 2688@item -fno-optional-diags 2689@opindex fno-optional-diags 2690@opindex foptional-diags 2691Disable diagnostics that the standard says a compiler does not need to 2692issue. Currently, the only such diagnostic issued by G++ is the one for 2693a name having multiple meanings within a class. 2694 2695@item -fpermissive 2696@opindex fpermissive 2697Downgrade some diagnostics about nonconformant code from errors to 2698warnings. Thus, using @option{-fpermissive} allows some 2699nonconforming code to compile. 2700 2701@item -fno-pretty-templates 2702@opindex fno-pretty-templates 2703@opindex fpretty-templates 2704When an error message refers to a specialization of a function 2705template, the compiler normally prints the signature of the 2706template followed by the template arguments and any typedefs or 2707typenames in the signature (e.g.@: @code{void f(T) [with T = int]} 2708rather than @code{void f(int)}) so that it's clear which template is 2709involved. When an error message refers to a specialization of a class 2710template, the compiler omits any template arguments that match 2711the default template arguments for that template. If either of these 2712behaviors make it harder to understand the error message rather than 2713easier, you can use @option{-fno-pretty-templates} to disable them. 2714 2715@item -frepo 2716@opindex frepo 2717Enable automatic template instantiation at link time. This option also 2718implies @option{-fno-implicit-templates}. @xref{Template 2719Instantiation}, for more information. 2720 2721@item -fno-rtti 2722@opindex fno-rtti 2723@opindex frtti 2724Disable generation of information about every class with virtual 2725functions for use by the C++ run-time type identification features 2726(@code{dynamic_cast} and @code{typeid}). If you don't use those parts 2727of the language, you can save some space by using this flag. Note that 2728exception handling uses the same information, but G++ generates it as 2729needed. The @code{dynamic_cast} operator can still be used for casts that 2730do not require run-time type information, i.e.@: casts to @code{void *} or to 2731unambiguous base classes. 2732 2733Mixing code compiled with @option{-frtti} with that compiled with 2734@option{-fno-rtti} may not work. For example, programs may 2735fail to link if a class compiled with @option{-fno-rtti} is used as a base 2736for a class compiled with @option{-frtti}. 2737 2738@item -fsized-deallocation 2739@opindex fsized-deallocation 2740Enable the built-in global declarations 2741@smallexample 2742void operator delete (void *, std::size_t) noexcept; 2743void operator delete[] (void *, std::size_t) noexcept; 2744@end smallexample 2745as introduced in C++14. This is useful for user-defined replacement 2746deallocation functions that, for example, use the size of the object 2747to make deallocation faster. Enabled by default under 2748@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} 2749warns about places that might want to add a definition. 2750 2751@item -fstrict-enums 2752@opindex fstrict-enums 2753Allow the compiler to optimize using the assumption that a value of 2754enumerated type can only be one of the values of the enumeration (as 2755defined in the C++ standard; basically, a value that can be 2756represented in the minimum number of bits needed to represent all the 2757enumerators). This assumption may not be valid if the program uses a 2758cast to convert an arbitrary integer value to the enumerated type. 2759 2760@item -fstrong-eval-order 2761@opindex fstrong-eval-order 2762Evaluate member access, array subscripting, and shift expressions in 2763left-to-right order, and evaluate assignment in right-to-left order, 2764as adopted for C++17. Enabled by default with @option{-std=c++17}. 2765@option{-fstrong-eval-order=some} enables just the ordering of member 2766access and shift expressions, and is the default without 2767@option{-std=c++17}. 2768 2769@item -ftemplate-backtrace-limit=@var{n} 2770@opindex ftemplate-backtrace-limit 2771Set the maximum number of template instantiation notes for a single 2772warning or error to @var{n}. The default value is 10. 2773 2774@item -ftemplate-depth=@var{n} 2775@opindex ftemplate-depth 2776Set the maximum instantiation depth for template classes to @var{n}. 2777A limit on the template instantiation depth is needed to detect 2778endless recursions during template class instantiation. ANSI/ISO C++ 2779conforming programs must not rely on a maximum depth greater than 17 2780(changed to 1024 in C++11). The default value is 900, as the compiler 2781can run out of stack space before hitting 1024 in some situations. 2782 2783@item -fno-threadsafe-statics 2784@opindex fno-threadsafe-statics 2785@opindex fthreadsafe-statics 2786Do not emit the extra code to use the routines specified in the C++ 2787ABI for thread-safe initialization of local statics. You can use this 2788option to reduce code size slightly in code that doesn't need to be 2789thread-safe. 2790 2791@item -fuse-cxa-atexit 2792@opindex fuse-cxa-atexit 2793Register destructors for objects with static storage duration with the 2794@code{__cxa_atexit} function rather than the @code{atexit} function. 2795This option is required for fully standards-compliant handling of static 2796destructors, but only works if your C library supports 2797@code{__cxa_atexit}. 2798 2799@item -fno-use-cxa-get-exception-ptr 2800@opindex fno-use-cxa-get-exception-ptr 2801@opindex fuse-cxa-get-exception-ptr 2802Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 2803causes @code{std::uncaught_exception} to be incorrect, but is necessary 2804if the runtime routine is not available. 2805 2806@item -fvisibility-inlines-hidden 2807@opindex fvisibility-inlines-hidden 2808This switch declares that the user does not attempt to compare 2809pointers to inline functions or methods where the addresses of the two functions 2810are taken in different shared objects. 2811 2812The effect of this is that GCC may, effectively, mark inline methods with 2813@code{__attribute__ ((visibility ("hidden")))} so that they do not 2814appear in the export table of a DSO and do not require a PLT indirection 2815when used within the DSO@. Enabling this option can have a dramatic effect 2816on load and link times of a DSO as it massively reduces the size of the 2817dynamic export table when the library makes heavy use of templates. 2818 2819The behavior of this switch is not quite the same as marking the 2820methods as hidden directly, because it does not affect static variables 2821local to the function or cause the compiler to deduce that 2822the function is defined in only one shared object. 2823 2824You may mark a method as having a visibility explicitly to negate the 2825effect of the switch for that method. For example, if you do want to 2826compare pointers to a particular inline method, you might mark it as 2827having default visibility. Marking the enclosing class with explicit 2828visibility has no effect. 2829 2830Explicitly instantiated inline methods are unaffected by this option 2831as their linkage might otherwise cross a shared library boundary. 2832@xref{Template Instantiation}. 2833 2834@item -fvisibility-ms-compat 2835@opindex fvisibility-ms-compat 2836This flag attempts to use visibility settings to make GCC's C++ 2837linkage model compatible with that of Microsoft Visual Studio. 2838 2839The flag makes these changes to GCC's linkage model: 2840 2841@enumerate 2842@item 2843It sets the default visibility to @code{hidden}, like 2844@option{-fvisibility=hidden}. 2845 2846@item 2847Types, but not their members, are not hidden by default. 2848 2849@item 2850The One Definition Rule is relaxed for types without explicit 2851visibility specifications that are defined in more than one 2852shared object: those declarations are permitted if they are 2853permitted when this option is not used. 2854@end enumerate 2855 2856In new code it is better to use @option{-fvisibility=hidden} and 2857export those classes that are intended to be externally visible. 2858Unfortunately it is possible for code to rely, perhaps accidentally, 2859on the Visual Studio behavior. 2860 2861Among the consequences of these changes are that static data members 2862of the same type with the same name but defined in different shared 2863objects are different, so changing one does not change the other; 2864and that pointers to function members defined in different shared 2865objects may not compare equal. When this flag is given, it is a 2866violation of the ODR to define types with the same name differently. 2867 2868@item -fno-weak 2869@opindex fno-weak 2870@opindex fweak 2871Do not use weak symbol support, even if it is provided by the linker. 2872By default, G++ uses weak symbols if they are available. This 2873option exists only for testing, and should not be used by end-users; 2874it results in inferior code and has no benefits. This option may 2875be removed in a future release of G++. 2876 2877@item -nostdinc++ 2878@opindex nostdinc++ 2879Do not search for header files in the standard directories specific to 2880C++, but do still search the other standard directories. (This option 2881is used when building the C++ library.) 2882@end table 2883 2884In addition, these optimization, warning, and code generation options 2885have meanings only for C++ programs: 2886 2887@table @gcctabopt 2888@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 2889@opindex Wabi 2890@opindex Wno-abi 2891Warn when G++ it generates code that is probably not compatible with 2892the vendor-neutral C++ ABI@. Since G++ now defaults to updating the 2893ABI with each major release, normally @option{-Wabi} will warn only if 2894there is a check added later in a release series for an ABI issue 2895discovered since the initial release. @option{-Wabi} will warn about 2896more things if an older ABI version is selected (with 2897@option{-fabi-version=@var{n}}). 2898 2899@option{-Wabi} can also be used with an explicit version number to 2900warn about compatibility with a particular @option{-fabi-version} 2901level, e.g.@: @option{-Wabi=2} to warn about changes relative to 2902@option{-fabi-version=2}. 2903 2904If an explicit version number is provided and 2905@option{-fabi-compat-version} is not specified, the version number 2906from this option is used for compatibility aliases. If no explicit 2907version number is provided with this option, but 2908@option{-fabi-compat-version} is specified, that version number is 2909used for ABI warnings. 2910 2911Although an effort has been made to warn about 2912all such cases, there are probably some cases that are not warned about, 2913even though G++ is generating incompatible code. There may also be 2914cases where warnings are emitted even though the code that is generated 2915is compatible. 2916 2917You should rewrite your code to avoid these warnings if you are 2918concerned about the fact that code generated by G++ may not be binary 2919compatible with code generated by other compilers. 2920 2921Known incompatibilities in @option{-fabi-version=2} (which was the 2922default from GCC 3.4 to 4.9) include: 2923 2924@itemize @bullet 2925 2926@item 2927A template with a non-type template parameter of reference type was 2928mangled incorrectly: 2929@smallexample 2930extern int N; 2931template <int &> struct S @{@}; 2932void n (S<N>) @{2@} 2933@end smallexample 2934 2935This was fixed in @option{-fabi-version=3}. 2936 2937@item 2938SIMD vector types declared using @code{__attribute ((vector_size))} were 2939mangled in a non-standard way that does not allow for overloading of 2940functions taking vectors of different sizes. 2941 2942The mangling was changed in @option{-fabi-version=4}. 2943 2944@item 2945@code{__attribute ((const))} and @code{noreturn} were mangled as type 2946qualifiers, and @code{decltype} of a plain declaration was folded away. 2947 2948These mangling issues were fixed in @option{-fabi-version=5}. 2949 2950@item 2951Scoped enumerators passed as arguments to a variadic function are 2952promoted like unscoped enumerators, causing @code{va_arg} to complain. 2953On most targets this does not actually affect the parameter passing 2954ABI, as there is no way to pass an argument smaller than @code{int}. 2955 2956Also, the ABI changed the mangling of template argument packs, 2957@code{const_cast}, @code{static_cast}, prefix increment/decrement, and 2958a class scope function used as a template argument. 2959 2960These issues were corrected in @option{-fabi-version=6}. 2961 2962@item 2963Lambdas in default argument scope were mangled incorrectly, and the 2964ABI changed the mangling of @code{nullptr_t}. 2965 2966These issues were corrected in @option{-fabi-version=7}. 2967 2968@item 2969When mangling a function type with function-cv-qualifiers, the 2970un-qualified function type was incorrectly treated as a substitution 2971candidate. 2972 2973This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. 2974 2975@item 2976@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to 2977unaligned accesses. Note that this did not affect the ABI of a 2978function with a @code{nullptr_t} parameter, as parameters have a 2979minimum alignment. 2980 2981This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. 2982 2983@item 2984Target-specific attributes that affect the identity of a type, such as 2985ia32 calling conventions on a function type (stdcall, regparm, etc.), 2986did not affect the mangled name, leading to name collisions when 2987function pointers were used as template arguments. 2988 2989This was fixed in @option{-fabi-version=10}, the default for GCC 6.1. 2990 2991@end itemize 2992 2993It also warns about psABI-related changes. The known psABI changes at this 2994point include: 2995 2996@itemize @bullet 2997 2998@item 2999For SysV/x86-64, unions with @code{long double} members are 3000passed in memory as specified in psABI. For example: 3001 3002@smallexample 3003union U @{ 3004 long double ld; 3005 int i; 3006@}; 3007@end smallexample 3008 3009@noindent 3010@code{union U} is always passed in memory. 3011 3012@end itemize 3013 3014@item -Wabi-tag @r{(C++ and Objective-C++ only)} 3015@opindex Wabi-tag 3016@opindex Wabi-tag 3017Warn when a type with an ABI tag is used in a context that does not 3018have that ABI tag. See @ref{C++ Attributes} for more information 3019about ABI tags. 3020 3021@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 3022@opindex Wctor-dtor-privacy 3023@opindex Wno-ctor-dtor-privacy 3024Warn when a class seems unusable because all the constructors or 3025destructors in that class are private, and it has neither friends nor 3026public static member functions. Also warn if there are no non-private 3027methods, and there's at least one private member function that isn't 3028a constructor or destructor. 3029 3030@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 3031@opindex Wdelete-non-virtual-dtor 3032@opindex Wno-delete-non-virtual-dtor 3033Warn when @code{delete} is used to destroy an instance of a class that 3034has virtual functions and non-virtual destructor. It is unsafe to delete 3035an instance of a derived class through a pointer to a base class if the 3036base class does not have a virtual destructor. This warning is enabled 3037by @option{-Wall}. 3038 3039@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)} 3040@opindex Wdeprecated-copy 3041@opindex Wno-deprecated-copy 3042Warn that the implicit declaration of a copy constructor or copy 3043assignment operator is deprecated if the class has a user-provided 3044copy constructor or copy assignment operator, in C++11 and up. This 3045warning is enabled by @option{-Wextra}. With 3046@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a 3047user-provided destructor. 3048 3049@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)} 3050@opindex Winit-list-lifetime 3051@opindex Wno-init-list-lifetime 3052Do not warn about uses of @code{std::initializer_list} that are likely 3053to result in dangling pointers. Since the underlying array for an 3054@code{initializer_list} is handled like a normal C++ temporary object, 3055it is easy to inadvertently keep a pointer to the array past the end 3056of the array's lifetime. For example: 3057 3058@itemize @bullet 3059@item 3060If a function returns a temporary @code{initializer_list}, or a local 3061@code{initializer_list} variable, the array's lifetime ends at the end 3062of the return statement, so the value returned has a dangling pointer. 3063 3064@item 3065If a new-expression creates an @code{initializer_list}, the array only 3066lives until the end of the enclosing full-expression, so the 3067@code{initializer_list} in the heap has a dangling pointer. 3068 3069@item 3070When an @code{initializer_list} variable is assigned from a 3071brace-enclosed initializer list, the temporary array created for the 3072right side of the assignment only lives until the end of the 3073full-expression, so at the next statement the @code{initializer_list} 3074variable has a dangling pointer. 3075 3076@smallexample 3077// li's initial underlying array lives as long as li 3078std::initializer_list<int> li = @{ 1,2,3 @}; 3079// assignment changes li to point to a temporary array 3080li = @{ 4, 5 @}; 3081// now the temporary is gone and li has a dangling pointer 3082int i = li.begin()[0] // undefined behavior 3083@end smallexample 3084 3085@item 3086When a list constructor stores the @code{begin} pointer from the 3087@code{initializer_list} argument, this doesn't extend the lifetime of 3088the array, so if a class variable is constructed from a temporary 3089@code{initializer_list}, the pointer is left dangling by the end of 3090the variable declaration statement. 3091 3092@end itemize 3093 3094@item -Wliteral-suffix @r{(C++ and Objective-C++ only)} 3095@opindex Wliteral-suffix 3096@opindex Wno-literal-suffix 3097Warn when a string or character literal is followed by a ud-suffix which does 3098not begin with an underscore. As a conforming extension, GCC treats such 3099suffixes as separate preprocessing tokens in order to maintain backwards 3100compatibility with code that uses formatting macros from @code{<inttypes.h>}. 3101For example: 3102 3103@smallexample 3104#define __STDC_FORMAT_MACROS 3105#include <inttypes.h> 3106#include <stdio.h> 3107 3108int main() @{ 3109 int64_t i64 = 123; 3110 printf("My int64: %" PRId64"\n", i64); 3111@} 3112@end smallexample 3113 3114In this case, @code{PRId64} is treated as a separate preprocessing token. 3115 3116Additionally, warn when a user-defined literal operator is declared with 3117a literal suffix identifier that doesn't begin with an underscore. Literal 3118suffix identifiers that don't begin with an underscore are reserved for 3119future standardization. 3120 3121This warning is enabled by default. 3122 3123@item -Wlto-type-mismatch 3124@opindex Wlto-type-mismatch 3125@opindex Wno-lto-type-mismatch 3126 3127During the link-time optimization warn about type mismatches in 3128global declarations from different compilation units. 3129Requires @option{-flto} to be enabled. Enabled by default. 3130 3131@item -Wno-narrowing @r{(C++ and Objective-C++ only)} 3132@opindex Wnarrowing 3133@opindex Wno-narrowing 3134For C++11 and later standards, narrowing conversions are diagnosed by default, 3135as required by the standard. A narrowing conversion from a constant produces 3136an error, and a narrowing conversion from a non-constant produces a warning, 3137but @option{-Wno-narrowing} suppresses the diagnostic. 3138Note that this does not affect the meaning of well-formed code; 3139narrowing conversions are still considered ill-formed in SFINAE contexts. 3140 3141With @option{-Wnarrowing} in C++98, warn when a narrowing 3142conversion prohibited by C++11 occurs within 3143@samp{@{ @}}, e.g. 3144 3145@smallexample 3146int i = @{ 2.2 @}; // error: narrowing from double to int 3147@end smallexample 3148 3149This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 3150 3151@item -Wnoexcept @r{(C++ and Objective-C++ only)} 3152@opindex Wnoexcept 3153@opindex Wno-noexcept 3154Warn when a noexcept-expression evaluates to false because of a call 3155to a function that does not have a non-throwing exception 3156specification (i.e. @code{throw()} or @code{noexcept}) but is known by 3157the compiler to never throw an exception. 3158 3159@item -Wnoexcept-type @r{(C++ and Objective-C++ only)} 3160@opindex Wnoexcept-type 3161@opindex Wno-noexcept-type 3162Warn if the C++17 feature making @code{noexcept} part of a function 3163type changes the mangled name of a symbol relative to C++14. Enabled 3164by @option{-Wabi} and @option{-Wc++17-compat}. 3165 3166As an example: 3167 3168@smallexample 3169template <class T> void f(T t) @{ t(); @}; 3170void g() noexcept; 3171void h() @{ f(g); @} 3172@end smallexample 3173 3174@noindent 3175In C++14, @code{f} calls @code{f<void(*)()>}, but in 3176C++17 it calls @code{f<void(*)()noexcept>}. 3177 3178@item -Wclass-memaccess @r{(C++ and Objective-C++ only)} 3179@opindex Wclass-memaccess 3180@opindex Wno-class-memaccess 3181Warn when the destination of a call to a raw memory function such as 3182@code{memset} or @code{memcpy} is an object of class type, and when writing 3183into such an object might bypass the class non-trivial or deleted constructor 3184or copy assignment, violate const-correctness or encapsulation, or corrupt 3185virtual table pointers. Modifying the representation of such objects may 3186violate invariants maintained by member functions of the class. For example, 3187the call to @code{memset} below is undefined because it modifies a non-trivial 3188class object and is, therefore, diagnosed. The safe way to either initialize 3189or clear the storage of objects of such types is by using the appropriate 3190constructor or assignment operator, if one is available. 3191@smallexample 3192std::string str = "abc"; 3193memset (&str, 0, sizeof str); 3194@end smallexample 3195The @option{-Wclass-memaccess} option is enabled by @option{-Wall}. 3196Explicitly casting the pointer to the class object to @code{void *} or 3197to a type that can be safely accessed by the raw memory function suppresses 3198the warning. 3199 3200@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 3201@opindex Wnon-virtual-dtor 3202@opindex Wno-non-virtual-dtor 3203Warn when a class has virtual functions and an accessible non-virtual 3204destructor itself or in an accessible polymorphic base class, in which 3205case it is possible but unsafe to delete an instance of a derived 3206class through a pointer to the class itself or base class. This 3207warning is automatically enabled if @option{-Weffc++} is specified. 3208 3209@item -Wregister @r{(C++ and Objective-C++ only)} 3210@opindex Wregister 3211@opindex Wno-register 3212Warn on uses of the @code{register} storage class specifier, except 3213when it is part of the GNU @ref{Explicit Register Variables} extension. 3214The use of the @code{register} keyword as storage class specifier has 3215been deprecated in C++11 and removed in C++17. 3216Enabled by default with @option{-std=c++17}. 3217 3218@item -Wreorder @r{(C++ and Objective-C++ only)} 3219@opindex Wreorder 3220@opindex Wno-reorder 3221@cindex reordering, warning 3222@cindex warning for reordering of member initializers 3223Warn when the order of member initializers given in the code does not 3224match the order in which they must be executed. For instance: 3225 3226@smallexample 3227struct A @{ 3228 int i; 3229 int j; 3230 A(): j (0), i (1) @{ @} 3231@}; 3232@end smallexample 3233 3234@noindent 3235The compiler rearranges the member initializers for @code{i} 3236and @code{j} to match the declaration order of the members, emitting 3237a warning to that effect. This warning is enabled by @option{-Wall}. 3238 3239@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)} 3240@opindex Wpessimizing-move 3241@opindex Wno-pessimizing-move 3242This warning warns when a call to @code{std::move} prevents copy 3243elision. A typical scenario when copy elision can occur is when returning in 3244a function with a class return type, when the expression being returned is the 3245name of a non-volatile automatic object, and is not a function parameter, and 3246has the same type as the function return type. 3247 3248@smallexample 3249struct T @{ 3250@dots{} 3251@}; 3252T fn() 3253@{ 3254 T t; 3255 @dots{} 3256 return std::move (t); 3257@} 3258@end smallexample 3259 3260But in this example, the @code{std::move} call prevents copy elision. 3261 3262This warning is enabled by @option{-Wall}. 3263 3264@item -Wno-redundant-move @r{(C++ and Objective-C++ only)} 3265@opindex Wredundant-move 3266@opindex Wno-redundant-move 3267This warning warns about redundant calls to @code{std::move}; that is, when 3268a move operation would have been performed even without the @code{std::move} 3269call. This happens because the compiler is forced to treat the object as if 3270it were an rvalue in certain situations such as returning a local variable, 3271where copy elision isn't applicable. Consider: 3272 3273@smallexample 3274struct T @{ 3275@dots{} 3276@}; 3277T fn(T t) 3278@{ 3279 @dots{} 3280 return std::move (t); 3281@} 3282@end smallexample 3283 3284Here, the @code{std::move} call is redundant. Because G++ implements Core 3285Issue 1579, another example is: 3286 3287@smallexample 3288struct T @{ // convertible to U 3289@dots{} 3290@}; 3291struct U @{ 3292@dots{} 3293@}; 3294U fn() 3295@{ 3296 T t; 3297 @dots{} 3298 return std::move (t); 3299@} 3300@end smallexample 3301In this example, copy elision isn't applicable because the type of the 3302expression being returned and the function return type differ, yet G++ 3303treats the return value as if it were designated by an rvalue. 3304 3305This warning is enabled by @option{-Wextra}. 3306 3307@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 3308@opindex fext-numeric-literals 3309@opindex fno-ext-numeric-literals 3310Accept imaginary, fixed-point, or machine-defined 3311literal number suffixes as GNU extensions. 3312When this option is turned off these suffixes are treated 3313as C++11 user-defined literal numeric suffixes. 3314This is on by default for all pre-C++11 dialects and all GNU dialects: 3315@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 3316@option{-std=gnu++14}. 3317This option is off by default 3318for ISO C++11 onwards (@option{-std=c++11}, ...). 3319@end table 3320 3321The following @option{-W@dots{}} options are not affected by @option{-Wall}. 3322 3323@table @gcctabopt 3324@item -Weffc++ @r{(C++ and Objective-C++ only)} 3325@opindex Weffc++ 3326@opindex Wno-effc++ 3327Warn about violations of the following style guidelines from Scott Meyers' 3328@cite{Effective C++} series of books: 3329 3330@itemize @bullet 3331@item 3332Define a copy constructor and an assignment operator for classes 3333with dynamically-allocated memory. 3334 3335@item 3336Prefer initialization to assignment in constructors. 3337 3338@item 3339Have @code{operator=} return a reference to @code{*this}. 3340 3341@item 3342Don't try to return a reference when you must return an object. 3343 3344@item 3345Distinguish between prefix and postfix forms of increment and 3346decrement operators. 3347 3348@item 3349Never overload @code{&&}, @code{||}, or @code{,}. 3350 3351@end itemize 3352 3353This option also enables @option{-Wnon-virtual-dtor}, which is also 3354one of the effective C++ recommendations. However, the check is 3355extended to warn about the lack of virtual destructor in accessible 3356non-polymorphic bases classes too. 3357 3358When selecting this option, be aware that the standard library 3359headers do not obey all of these guidelines; use @samp{grep -v} 3360to filter out those warnings. 3361 3362@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 3363@opindex Wstrict-null-sentinel 3364@opindex Wno-strict-null-sentinel 3365Warn about the use of an uncasted @code{NULL} as sentinel. When 3366compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 3367to @code{__null}. Although it is a null pointer constant rather than a 3368null pointer, it is guaranteed to be of the same size as a pointer. 3369But this use is not portable across different compilers. 3370 3371@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 3372@opindex Wno-non-template-friend 3373@opindex Wnon-template-friend 3374Disable warnings when non-template friend functions are declared 3375within a template. In very old versions of GCC that predate implementation 3376of the ISO standard, declarations such as 3377@samp{friend int foo(int)}, where the name of the friend is an unqualified-id, 3378could be interpreted as a particular specialization of a template 3379function; the warning exists to diagnose compatibility problems, 3380and is enabled by default. 3381 3382@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 3383@opindex Wold-style-cast 3384@opindex Wno-old-style-cast 3385Warn if an old-style (C-style) cast to a non-void type is used within 3386a C++ program. The new-style casts (@code{dynamic_cast}, 3387@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are 3388less vulnerable to unintended effects and much easier to search for. 3389 3390@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 3391@opindex Woverloaded-virtual 3392@opindex Wno-overloaded-virtual 3393@cindex overloaded virtual function, warning 3394@cindex warning for overloaded virtual function 3395Warn when a function declaration hides virtual functions from a 3396base class. For example, in: 3397 3398@smallexample 3399struct A @{ 3400 virtual void f(); 3401@}; 3402 3403struct B: public A @{ 3404 void f(int); 3405@}; 3406@end smallexample 3407 3408the @code{A} class version of @code{f} is hidden in @code{B}, and code 3409like: 3410 3411@smallexample 3412B* b; 3413b->f(); 3414@end smallexample 3415 3416@noindent 3417fails to compile. 3418 3419@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 3420@opindex Wno-pmf-conversions 3421@opindex Wpmf-conversions 3422Disable the diagnostic for converting a bound pointer to member function 3423to a plain pointer. 3424 3425@item -Wsign-promo @r{(C++ and Objective-C++ only)} 3426@opindex Wsign-promo 3427@opindex Wno-sign-promo 3428Warn when overload resolution chooses a promotion from unsigned or 3429enumerated type to a signed type, over a conversion to an unsigned type of 3430the same size. Previous versions of G++ tried to preserve 3431unsignedness, but the standard mandates the current behavior. 3432 3433@item -Wtemplates @r{(C++ and Objective-C++ only)} 3434@opindex Wtemplates 3435@opindex Wno-templates 3436Warn when a primary template declaration is encountered. Some coding 3437rules disallow templates, and this may be used to enforce that rule. 3438The warning is inactive inside a system header file, such as the STL, so 3439one can still use the STL. One may also instantiate or specialize 3440templates. 3441 3442@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)} 3443@opindex Wmultiple-inheritance 3444@opindex Wno-multiple-inheritance 3445Warn when a class is defined with multiple direct base classes. Some 3446coding rules disallow multiple inheritance, and this may be used to 3447enforce that rule. The warning is inactive inside a system header file, 3448such as the STL, so one can still use the STL. One may also define 3449classes that indirectly use multiple inheritance. 3450 3451@item -Wvirtual-inheritance 3452@opindex Wvirtual-inheritance 3453@opindex Wno-virtual-inheritance 3454Warn when a class is defined with a virtual direct base class. Some 3455coding rules disallow multiple inheritance, and this may be used to 3456enforce that rule. The warning is inactive inside a system header file, 3457such as the STL, so one can still use the STL. One may also define 3458classes that indirectly use virtual inheritance. 3459 3460@item -Wnamespaces 3461@opindex Wnamespaces 3462@opindex Wno-namespaces 3463Warn when a namespace definition is opened. Some coding rules disallow 3464namespaces, and this may be used to enforce that rule. The warning is 3465inactive inside a system header file, such as the STL, so one can still 3466use the STL. One may also use using directives and qualified names. 3467 3468@item -Wno-terminate @r{(C++ and Objective-C++ only)} 3469@opindex Wterminate 3470@opindex Wno-terminate 3471Disable the warning about a throw-expression that will immediately 3472result in a call to @code{terminate}. 3473 3474@item -Wno-class-conversion @r{(C++ and Objective-C++ only)} 3475@opindex Wno-class-conversion 3476@opindex Wclass-conversion 3477Disable the warning about the case when a conversion function converts an 3478object to the same type, to a base class of that type, or to void; such 3479a conversion function will never be called. 3480@end table 3481 3482@node Objective-C and Objective-C++ Dialect Options 3483@section Options Controlling Objective-C and Objective-C++ Dialects 3484 3485@cindex compiler options, Objective-C and Objective-C++ 3486@cindex Objective-C and Objective-C++ options, command-line 3487@cindex options, Objective-C and Objective-C++ 3488(NOTE: This manual does not describe the Objective-C and Objective-C++ 3489languages themselves. @xref{Standards,,Language Standards 3490Supported by GCC}, for references.) 3491 3492This section describes the command-line options that are only meaningful 3493for Objective-C and Objective-C++ programs. You can also use most of 3494the language-independent GNU compiler options. 3495For example, you might compile a file @file{some_class.m} like this: 3496 3497@smallexample 3498gcc -g -fgnu-runtime -O -c some_class.m 3499@end smallexample 3500 3501@noindent 3502In this example, @option{-fgnu-runtime} is an option meant only for 3503Objective-C and Objective-C++ programs; you can use the other options with 3504any language supported by GCC@. 3505 3506Note that since Objective-C is an extension of the C language, Objective-C 3507compilations may also use options specific to the C front-end (e.g., 3508@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 3509C++-specific options (e.g., @option{-Wabi}). 3510 3511Here is a list of options that are @emph{only} for compiling Objective-C 3512and Objective-C++ programs: 3513 3514@table @gcctabopt 3515@item -fconstant-string-class=@var{class-name} 3516@opindex fconstant-string-class 3517Use @var{class-name} as the name of the class to instantiate for each 3518literal string specified with the syntax @code{@@"@dots{}"}. The default 3519class name is @code{NXConstantString} if the GNU runtime is being used, and 3520@code{NSConstantString} if the NeXT runtime is being used (see below). The 3521@option{-fconstant-cfstrings} option, if also present, overrides the 3522@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals 3523to be laid out as constant CoreFoundation strings. 3524 3525@item -fgnu-runtime 3526@opindex fgnu-runtime 3527Generate object code compatible with the standard GNU Objective-C 3528runtime. This is the default for most types of systems. 3529 3530@item -fnext-runtime 3531@opindex fnext-runtime 3532Generate output compatible with the NeXT runtime. This is the default 3533for NeXT-based systems, including Darwin and Mac OS X@. The macro 3534@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 3535used. 3536 3537@item -fno-nil-receivers 3538@opindex fno-nil-receivers 3539@opindex fnil-receivers 3540Assume that all Objective-C message dispatches (@code{[receiver 3541message:arg]}) in this translation unit ensure that the receiver is 3542not @code{nil}. This allows for more efficient entry points in the 3543runtime to be used. This option is only available in conjunction with 3544the NeXT runtime and ABI version 0 or 1. 3545 3546@item -fobjc-abi-version=@var{n} 3547@opindex fobjc-abi-version 3548Use version @var{n} of the Objective-C ABI for the selected runtime. 3549This option is currently supported only for the NeXT runtime. In that 3550case, Version 0 is the traditional (32-bit) ABI without support for 3551properties and other Objective-C 2.0 additions. Version 1 is the 3552traditional (32-bit) ABI with support for properties and other 3553Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 3554nothing is specified, the default is Version 0 on 32-bit target 3555machines, and Version 2 on 64-bit target machines. 3556 3557@item -fobjc-call-cxx-cdtors 3558@opindex fobjc-call-cxx-cdtors 3559For each Objective-C class, check if any of its instance variables is a 3560C++ object with a non-trivial default constructor. If so, synthesize a 3561special @code{- (id) .cxx_construct} instance method which runs 3562non-trivial default constructors on any such instance variables, in order, 3563and then return @code{self}. Similarly, check if any instance variable 3564is a C++ object with a non-trivial destructor, and if so, synthesize a 3565special @code{- (void) .cxx_destruct} method which runs 3566all such default destructors, in reverse order. 3567 3568The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 3569methods thusly generated only operate on instance variables 3570declared in the current Objective-C class, and not those inherited 3571from superclasses. It is the responsibility of the Objective-C 3572runtime to invoke all such methods in an object's inheritance 3573hierarchy. The @code{- (id) .cxx_construct} methods are invoked 3574by the runtime immediately after a new object instance is allocated; 3575the @code{- (void) .cxx_destruct} methods are invoked immediately 3576before the runtime deallocates an object instance. 3577 3578As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 3579support for invoking the @code{- (id) .cxx_construct} and 3580@code{- (void) .cxx_destruct} methods. 3581 3582@item -fobjc-direct-dispatch 3583@opindex fobjc-direct-dispatch 3584Allow fast jumps to the message dispatcher. On Darwin this is 3585accomplished via the comm page. 3586 3587@item -fobjc-exceptions 3588@opindex fobjc-exceptions 3589Enable syntactic support for structured exception handling in 3590Objective-C, similar to what is offered by C++. This option 3591is required to use the Objective-C keywords @code{@@try}, 3592@code{@@throw}, @code{@@catch}, @code{@@finally} and 3593@code{@@synchronized}. This option is available with both the GNU 3594runtime and the NeXT runtime (but not available in conjunction with 3595the NeXT runtime on Mac OS X 10.2 and earlier). 3596 3597@item -fobjc-gc 3598@opindex fobjc-gc 3599Enable garbage collection (GC) in Objective-C and Objective-C++ 3600programs. This option is only available with the NeXT runtime; the 3601GNU runtime has a different garbage collection implementation that 3602does not require special compiler flags. 3603 3604@item -fobjc-nilcheck 3605@opindex fobjc-nilcheck 3606For the NeXT runtime with version 2 of the ABI, check for a nil 3607receiver in method invocations before doing the actual method call. 3608This is the default and can be disabled using 3609@option{-fno-objc-nilcheck}. Class methods and super calls are never 3610checked for nil in this way no matter what this flag is set to. 3611Currently this flag does nothing when the GNU runtime, or an older 3612version of the NeXT runtime ABI, is used. 3613 3614@item -fobjc-std=objc1 3615@opindex fobjc-std 3616Conform to the language syntax of Objective-C 1.0, the language 3617recognized by GCC 4.0. This only affects the Objective-C additions to 3618the C/C++ language; it does not affect conformance to C/C++ standards, 3619which is controlled by the separate C/C++ dialect option flags. When 3620this option is used with the Objective-C or Objective-C++ compiler, 3621any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 3622This is useful if you need to make sure that your Objective-C code can 3623be compiled with older versions of GCC@. 3624 3625@item -freplace-objc-classes 3626@opindex freplace-objc-classes 3627Emit a special marker instructing @command{ld(1)} not to statically link in 3628the resulting object file, and allow @command{dyld(1)} to load it in at 3629run time instead. This is used in conjunction with the Fix-and-Continue 3630debugging mode, where the object file in question may be recompiled and 3631dynamically reloaded in the course of program execution, without the need 3632to restart the program itself. Currently, Fix-and-Continue functionality 3633is only available in conjunction with the NeXT runtime on Mac OS X 10.3 3634and later. 3635 3636@item -fzero-link 3637@opindex fzero-link 3638When compiling for the NeXT runtime, the compiler ordinarily replaces calls 3639to @code{objc_getClass("@dots{}")} (when the name of the class is known at 3640compile time) with static class references that get initialized at load time, 3641which improves run-time performance. Specifying the @option{-fzero-link} flag 3642suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 3643to be retained. This is useful in Zero-Link debugging mode, since it allows 3644for individual class implementations to be modified during program execution. 3645The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 3646regardless of command-line options. 3647 3648@item -fno-local-ivars 3649@opindex fno-local-ivars 3650@opindex flocal-ivars 3651By default instance variables in Objective-C can be accessed as if 3652they were local variables from within the methods of the class they're 3653declared in. This can lead to shadowing between instance variables 3654and other variables declared either locally inside a class method or 3655globally with the same name. Specifying the @option{-fno-local-ivars} 3656flag disables this behavior thus avoiding variable shadowing issues. 3657 3658@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} 3659@opindex fivar-visibility 3660Set the default instance variable visibility to the specified option 3661so that instance variables declared outside the scope of any access 3662modifier directives default to the specified visibility. 3663 3664@item -gen-decls 3665@opindex gen-decls 3666Dump interface declarations for all classes seen in the source file to a 3667file named @file{@var{sourcename}.decl}. 3668 3669@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 3670@opindex Wassign-intercept 3671@opindex Wno-assign-intercept 3672Warn whenever an Objective-C assignment is being intercepted by the 3673garbage collector. 3674 3675@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 3676@opindex Wno-protocol 3677@opindex Wprotocol 3678If a class is declared to implement a protocol, a warning is issued for 3679every method in the protocol that is not implemented by the class. The 3680default behavior is to issue a warning for every method not explicitly 3681implemented in the class, even if a method implementation is inherited 3682from the superclass. If you use the @option{-Wno-protocol} option, then 3683methods inherited from the superclass are considered to be implemented, 3684and no warning is issued for them. 3685 3686@item -Wselector @r{(Objective-C and Objective-C++ only)} 3687@opindex Wselector 3688@opindex Wno-selector 3689Warn if multiple methods of different types for the same selector are 3690found during compilation. The check is performed on the list of methods 3691in the final stage of compilation. Additionally, a check is performed 3692for each selector appearing in a @code{@@selector(@dots{})} 3693expression, and a corresponding method for that selector has been found 3694during compilation. Because these checks scan the method table only at 3695the end of compilation, these warnings are not produced if the final 3696stage of compilation is not reached, for example because an error is 3697found during compilation, or because the @option{-fsyntax-only} option is 3698being used. 3699 3700@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 3701@opindex Wstrict-selector-match 3702@opindex Wno-strict-selector-match 3703Warn if multiple methods with differing argument and/or return types are 3704found for a given selector when attempting to send a message using this 3705selector to a receiver of type @code{id} or @code{Class}. When this flag 3706is off (which is the default behavior), the compiler omits such warnings 3707if any differences found are confined to types that share the same size 3708and alignment. 3709 3710@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 3711@opindex Wundeclared-selector 3712@opindex Wno-undeclared-selector 3713Warn if a @code{@@selector(@dots{})} expression referring to an 3714undeclared selector is found. A selector is considered undeclared if no 3715method with that name has been declared before the 3716@code{@@selector(@dots{})} expression, either explicitly in an 3717@code{@@interface} or @code{@@protocol} declaration, or implicitly in 3718an @code{@@implementation} section. This option always performs its 3719checks as soon as a @code{@@selector(@dots{})} expression is found, 3720while @option{-Wselector} only performs its checks in the final stage of 3721compilation. This also enforces the coding style convention 3722that methods and selectors must be declared before being used. 3723 3724@item -print-objc-runtime-info 3725@opindex print-objc-runtime-info 3726Generate C header describing the largest structure that is passed by 3727value, if any. 3728 3729@end table 3730 3731@node Diagnostic Message Formatting Options 3732@section Options to Control Diagnostic Messages Formatting 3733@cindex options to control diagnostics formatting 3734@cindex diagnostic messages 3735@cindex message formatting 3736 3737Traditionally, diagnostic messages have been formatted irrespective of 3738the output device's aspect (e.g.@: its width, @dots{}). You can use the 3739options described below 3740to control the formatting algorithm for diagnostic messages, 3741e.g.@: how many characters per line, how often source location 3742information should be reported. Note that some language front ends may not 3743honor these options. 3744 3745@table @gcctabopt 3746@item -fmessage-length=@var{n} 3747@opindex fmessage-length 3748Try to format error messages so that they fit on lines of about 3749@var{n} characters. If @var{n} is zero, then no line-wrapping is 3750done; each error message appears on a single line. This is the 3751default for all front ends. 3752 3753Note - this option also affects the display of the @samp{#error} and 3754@samp{#warning} pre-processor directives, and the @samp{deprecated} 3755function/type/variable attribute. It does not however affect the 3756@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas. 3757 3758@item -fdiagnostics-show-location=once 3759@opindex fdiagnostics-show-location 3760Only meaningful in line-wrapping mode. Instructs the diagnostic messages 3761reporter to emit source location information @emph{once}; that is, in 3762case the message is too long to fit on a single physical line and has to 3763be wrapped, the source location won't be emitted (as prefix) again, 3764over and over, in subsequent continuation lines. This is the default 3765behavior. 3766 3767@item -fdiagnostics-show-location=every-line 3768Only meaningful in line-wrapping mode. Instructs the diagnostic 3769messages reporter to emit the same source location information (as 3770prefix) for physical lines that result from the process of breaking 3771a message which is too long to fit on a single line. 3772 3773@item -fdiagnostics-color[=@var{WHEN}] 3774@itemx -fno-diagnostics-color 3775@opindex fdiagnostics-color 3776@cindex highlight, color 3777@vindex GCC_COLORS @r{environment variable} 3778Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, 3779or @samp{auto}. The default depends on how the compiler has been configured, 3780it can be any of the above @var{WHEN} options or also @samp{never} 3781if @env{GCC_COLORS} environment variable isn't present in the environment, 3782and @samp{auto} otherwise. 3783@samp{auto} means to use color only when the standard error is a terminal. 3784The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are 3785aliases for @option{-fdiagnostics-color=always} and 3786@option{-fdiagnostics-color=never}, respectively. 3787 3788The colors are defined by the environment variable @env{GCC_COLORS}. 3789Its value is a colon-separated list of capabilities and Select Graphic 3790Rendition (SGR) substrings. SGR commands are interpreted by the 3791terminal or terminal emulator. (See the section in the documentation 3792of your text terminal for permitted values and their meanings as 3793character attributes.) These substring values are integers in decimal 3794representation and can be concatenated with semicolons. 3795Common values to concatenate include 3796@samp{1} for bold, 3797@samp{4} for underline, 3798@samp{5} for blink, 3799@samp{7} for inverse, 3800@samp{39} for default foreground color, 3801@samp{30} to @samp{37} for foreground colors, 3802@samp{90} to @samp{97} for 16-color mode foreground colors, 3803@samp{38;5;0} to @samp{38;5;255} 3804for 88-color and 256-color modes foreground colors, 3805@samp{49} for default background color, 3806@samp{40} to @samp{47} for background colors, 3807@samp{100} to @samp{107} for 16-color mode background colors, 3808and @samp{48;5;0} to @samp{48;5;255} 3809for 88-color and 256-color modes background colors. 3810 3811The default @env{GCC_COLORS} is 3812@smallexample 3813error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\ 3814quote=01:fixit-insert=32:fixit-delete=31:\ 3815diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ 3816type-diff=01;32 3817@end smallexample 3818@noindent 3819where @samp{01;31} is bold red, @samp{01;35} is bold magenta, 3820@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue, 3821@samp{01} is bold, and @samp{31} is red. 3822Setting @env{GCC_COLORS} to the empty string disables colors. 3823Supported capabilities are as follows. 3824 3825@table @code 3826@item error= 3827@vindex error GCC_COLORS @r{capability} 3828SGR substring for error: markers. 3829 3830@item warning= 3831@vindex warning GCC_COLORS @r{capability} 3832SGR substring for warning: markers. 3833 3834@item note= 3835@vindex note GCC_COLORS @r{capability} 3836SGR substring for note: markers. 3837 3838@item range1= 3839@vindex range1 GCC_COLORS @r{capability} 3840SGR substring for first additional range. 3841 3842@item range2= 3843@vindex range2 GCC_COLORS @r{capability} 3844SGR substring for second additional range. 3845 3846@item locus= 3847@vindex locus GCC_COLORS @r{capability} 3848SGR substring for location information, @samp{file:line} or 3849@samp{file:line:column} etc. 3850 3851@item quote= 3852@vindex quote GCC_COLORS @r{capability} 3853SGR substring for information printed within quotes. 3854 3855@item fixit-insert= 3856@vindex fixit-insert GCC_COLORS @r{capability} 3857SGR substring for fix-it hints suggesting text to 3858be inserted or replaced. 3859 3860@item fixit-delete= 3861@vindex fixit-delete GCC_COLORS @r{capability} 3862SGR substring for fix-it hints suggesting text to 3863be deleted. 3864 3865@item diff-filename= 3866@vindex diff-filename GCC_COLORS @r{capability} 3867SGR substring for filename headers within generated patches. 3868 3869@item diff-hunk= 3870@vindex diff-hunk GCC_COLORS @r{capability} 3871SGR substring for the starts of hunks within generated patches. 3872 3873@item diff-delete= 3874@vindex diff-delete GCC_COLORS @r{capability} 3875SGR substring for deleted lines within generated patches. 3876 3877@item diff-insert= 3878@vindex diff-insert GCC_COLORS @r{capability} 3879SGR substring for inserted lines within generated patches. 3880 3881@item type-diff= 3882@vindex type-diff GCC_COLORS @r{capability} 3883SGR substring for highlighting mismatching types within template 3884arguments in the C++ frontend. 3885@end table 3886 3887@item -fno-diagnostics-show-option 3888@opindex fno-diagnostics-show-option 3889@opindex fdiagnostics-show-option 3890By default, each diagnostic emitted includes text indicating the 3891command-line option that directly controls the diagnostic (if such an 3892option is known to the diagnostic machinery). Specifying the 3893@option{-fno-diagnostics-show-option} flag suppresses that behavior. 3894 3895@item -fno-diagnostics-show-caret 3896@opindex fno-diagnostics-show-caret 3897@opindex fdiagnostics-show-caret 3898By default, each diagnostic emitted includes the original source line 3899and a caret @samp{^} indicating the column. This option suppresses this 3900information. The source line is truncated to @var{n} characters, if 3901the @option{-fmessage-length=n} option is given. When the output is done 3902to the terminal, the width is limited to the width given by the 3903@env{COLUMNS} environment variable or, if not set, to the terminal width. 3904 3905@item -fno-diagnostics-show-labels 3906@opindex fno-diagnostics-show-labels 3907@opindex fdiagnostics-show-labels 3908By default, when printing source code (via @option{-fdiagnostics-show-caret}), 3909diagnostics can label ranges of source code with pertinent information, such 3910as the types of expressions: 3911 3912@smallexample 3913 printf ("foo %s bar", long_i + long_j); 3914 ~^ ~~~~~~~~~~~~~~~ 3915 | | 3916 char * long int 3917@end smallexample 3918 3919This option suppresses the printing of these labels (in the example above, 3920the vertical bars and the ``char *'' and ``long int'' text). 3921 3922@item -fno-diagnostics-show-line-numbers 3923@opindex fno-diagnostics-show-line-numbers 3924@opindex fdiagnostics-show-line-numbers 3925By default, when printing source code (via @option{-fdiagnostics-show-caret}), 3926a left margin is printed, showing line numbers. This option suppresses this 3927left margin. 3928 3929@item -fdiagnostics-minimum-margin-width=@var{width} 3930@opindex fdiagnostics-minimum-margin-width 3931This option controls the minimum width of the left margin printed by 3932@option{-fdiagnostics-show-line-numbers}. It defaults to 6. 3933 3934@item -fdiagnostics-parseable-fixits 3935@opindex fdiagnostics-parseable-fixits 3936Emit fix-it hints in a machine-parseable format, suitable for consumption 3937by IDEs. For each fix-it, a line will be printed after the relevant 3938diagnostic, starting with the string ``fix-it:''. For example: 3939 3940@smallexample 3941fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all" 3942@end smallexample 3943 3944The location is expressed as a half-open range, expressed as a count of 3945bytes, starting at byte 1 for the initial column. In the above example, 3946bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the 3947given string: 3948 3949@smallexample 395000000000011111111112222222222 395112345678901234567890123456789 3952 gtk_widget_showall (dlg); 3953 ^^^^^^^^^^^^^^^^^^ 3954 gtk_widget_show_all 3955@end smallexample 3956 3957The filename and replacement string escape backslash as ``\\", tab as ``\t'', 3958newline as ``\n'', double quotes as ``\"'', non-printable characters as octal 3959(e.g. vertical tab as ``\013''). 3960 3961An empty replacement string indicates that the given range is to be removed. 3962An empty range (e.g. ``45:3-45:3'') indicates that the string is to 3963be inserted at the given position. 3964 3965@item -fdiagnostics-generate-patch 3966@opindex fdiagnostics-generate-patch 3967Print fix-it hints to stderr in unified diff format, after any diagnostics 3968are printed. For example: 3969 3970@smallexample 3971--- test.c 3972+++ test.c 3973@@ -42,5 +42,5 @@ 3974 3975 void show_cb(GtkDialog *dlg) 3976 @{ 3977- gtk_widget_showall(dlg); 3978+ gtk_widget_show_all(dlg); 3979 @} 3980 3981@end smallexample 3982 3983The diff may or may not be colorized, following the same rules 3984as for diagnostics (see @option{-fdiagnostics-color}). 3985 3986@item -fdiagnostics-show-template-tree 3987@opindex fdiagnostics-show-template-tree 3988 3989In the C++ frontend, when printing diagnostics showing mismatching 3990template types, such as: 3991 3992@smallexample 3993 could not convert 'std::map<int, std::vector<double> >()' 3994 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 3995@end smallexample 3996 3997the @option{-fdiagnostics-show-template-tree} flag enables printing a 3998tree-like structure showing the common and differing parts of the types, 3999such as: 4000 4001@smallexample 4002 map< 4003 [...], 4004 vector< 4005 [double != float]>> 4006@end smallexample 4007 4008The parts that differ are highlighted with color (``double'' and 4009``float'' in this case). 4010 4011@item -fno-elide-type 4012@opindex fno-elide-type 4013@opindex felide-type 4014By default when the C++ frontend prints diagnostics showing mismatching 4015template types, common parts of the types are printed as ``[...]'' to 4016simplify the error message. For example: 4017 4018@smallexample 4019 could not convert 'std::map<int, std::vector<double> >()' 4020 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 4021@end smallexample 4022 4023Specifying the @option{-fno-elide-type} flag suppresses that behavior. 4024This flag also affects the output of the 4025@option{-fdiagnostics-show-template-tree} flag. 4026 4027@item -fno-show-column 4028@opindex fno-show-column 4029@opindex fshow-column 4030Do not print column numbers in diagnostics. This may be necessary if 4031diagnostics are being scanned by a program that does not understand the 4032column numbers, such as @command{dejagnu}. 4033 4034@item -fdiagnostics-format=@var{FORMAT} 4035@opindex fdiagnostics-format 4036Select a different format for printing diagnostics. 4037@var{FORMAT} is @samp{text} or @samp{json}. 4038The default is @samp{text}. 4039 4040The @samp{json} format consists of a top-level JSON array containing JSON 4041objects representing the diagnostics. 4042 4043The JSON is emitted as one line, without formatting; the examples below 4044have been formatted for clarity. 4045 4046Diagnostics can have child diagnostics. For example, this error and note: 4047 4048@smallexample 4049misleading-indentation.c:15:3: warning: this 'if' clause does not 4050 guard... [-Wmisleading-indentation] 4051 15 | if (flag) 4052 | ^~ 4053misleading-indentation.c:17:5: note: ...this statement, but the latter 4054 is misleadingly indented as if it were guarded by the 'if' 4055 17 | y = 2; 4056 | ^ 4057@end smallexample 4058 4059@noindent 4060might be printed in JSON form (after formatting) like this: 4061 4062@smallexample 4063[ 4064 @{ 4065 "kind": "warning", 4066 "locations": [ 4067 @{ 4068 "caret": @{ 4069 "column": 3, 4070 "file": "misleading-indentation.c", 4071 "line": 15 4072 @}, 4073 "finish": @{ 4074 "column": 4, 4075 "file": "misleading-indentation.c", 4076 "line": 15 4077 @} 4078 @} 4079 ], 4080 "message": "this \u2018if\u2019 clause does not guard...", 4081 "option": "-Wmisleading-indentation", 4082 "children": [ 4083 @{ 4084 "kind": "note", 4085 "locations": [ 4086 @{ 4087 "caret": @{ 4088 "column": 5, 4089 "file": "misleading-indentation.c", 4090 "line": 17 4091 @} 4092 @} 4093 ], 4094 "message": "...this statement, but the latter is @dots{}" 4095 @} 4096 ] 4097 @}, 4098 @dots{} 4099] 4100@end smallexample 4101 4102@noindent 4103where the @code{note} is a child of the @code{warning}. 4104 4105A diagnostic has a @code{kind}. If this is @code{warning}, then there is 4106an @code{option} key describing the command-line option controlling the 4107warning. 4108 4109A diagnostic can contain zero or more locations. Each location has up 4110to three positions within it: a @code{caret} position and optional 4111@code{start} and @code{finish} positions. A location can also have 4112an optional @code{label} string. For example, this error: 4113 4114@smallexample 4115bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka 4116 'struct s'@} and 'T' @{aka 'struct t'@}) 4117 64 | return callee_4a () + callee_4b (); 4118 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ 4119 | | | 4120 | | T @{aka struct t@} 4121 | S @{aka struct s@} 4122@end smallexample 4123 4124@noindent 4125has three locations. Its primary location is at the ``+'' token at column 412623. It has two secondary locations, describing the left and right-hand sides 4127of the expression, which have labels. It might be printed in JSON form as: 4128 4129@smallexample 4130 @{ 4131 "children": [], 4132 "kind": "error", 4133 "locations": [ 4134 @{ 4135 "caret": @{ 4136 "column": 23, "file": "bad-binary-ops.c", "line": 64 4137 @} 4138 @}, 4139 @{ 4140 "caret": @{ 4141 "column": 10, "file": "bad-binary-ops.c", "line": 64 4142 @}, 4143 "finish": @{ 4144 "column": 21, "file": "bad-binary-ops.c", "line": 64 4145 @}, 4146 "label": "S @{aka struct s@}" 4147 @}, 4148 @{ 4149 "caret": @{ 4150 "column": 25, "file": "bad-binary-ops.c", "line": 64 4151 @}, 4152 "finish": @{ 4153 "column": 36, "file": "bad-binary-ops.c", "line": 64 4154 @}, 4155 "label": "T @{aka struct t@}" 4156 @} 4157 ], 4158 "message": "invalid operands to binary + @dots{}" 4159 @} 4160@end smallexample 4161 4162If a diagnostic contains fix-it hints, it has a @code{fixits} array, 4163consisting of half-open intervals, similar to the output of 4164@option{-fdiagnostics-parseable-fixits}. For example, this diagnostic 4165with a replacement fix-it hint: 4166 4167@smallexample 4168demo.c:8:15: error: 'struct s' has no member named 'colour'; did you 4169 mean 'color'? 4170 8 | return ptr->colour; 4171 | ^~~~~~ 4172 | color 4173@end smallexample 4174 4175@noindent 4176might be printed in JSON form as: 4177 4178@smallexample 4179 @{ 4180 "children": [], 4181 "fixits": [ 4182 @{ 4183 "next": @{ 4184 "column": 21, 4185 "file": "demo.c", 4186 "line": 8 4187 @}, 4188 "start": @{ 4189 "column": 15, 4190 "file": "demo.c", 4191 "line": 8 4192 @}, 4193 "string": "color" 4194 @} 4195 ], 4196 "kind": "error", 4197 "locations": [ 4198 @{ 4199 "caret": @{ 4200 "column": 15, 4201 "file": "demo.c", 4202 "line": 8 4203 @}, 4204 "finish": @{ 4205 "column": 20, 4206 "file": "demo.c", 4207 "line": 8 4208 @} 4209 @} 4210 ], 4211 "message": "\u2018struct s\u2019 has no member named @dots{}" 4212 @} 4213@end smallexample 4214 4215@noindent 4216where the fix-it hint suggests replacing the text from @code{start} up 4217to but not including @code{next} with @code{string}'s value. Deletions 4218are expressed via an empty value for @code{string}, insertions by 4219having @code{start} equal @code{next}. 4220 4221@end table 4222 4223@node Warning Options 4224@section Options to Request or Suppress Warnings 4225@cindex options to control warnings 4226@cindex warning messages 4227@cindex messages, warning 4228@cindex suppressing warnings 4229 4230Warnings are diagnostic messages that report constructions that 4231are not inherently erroneous but that are risky or suggest there 4232may have been an error. 4233 4234The following language-independent options do not enable specific 4235warnings but control the kinds of diagnostics produced by GCC@. 4236 4237@table @gcctabopt 4238@cindex syntax checking 4239@item -fsyntax-only 4240@opindex fsyntax-only 4241Check the code for syntax errors, but don't do anything beyond that. 4242 4243@item -fmax-errors=@var{n} 4244@opindex fmax-errors 4245Limits the maximum number of error messages to @var{n}, at which point 4246GCC bails out rather than attempting to continue processing the source 4247code. If @var{n} is 0 (the default), there is no limit on the number 4248of error messages produced. If @option{-Wfatal-errors} is also 4249specified, then @option{-Wfatal-errors} takes precedence over this 4250option. 4251 4252@item -w 4253@opindex w 4254Inhibit all warning messages. 4255 4256@item -Werror 4257@opindex Werror 4258@opindex Wno-error 4259Make all warnings into errors. 4260 4261@item -Werror= 4262@opindex Werror= 4263@opindex Wno-error= 4264Make the specified warning into an error. The specifier for a warning 4265is appended; for example @option{-Werror=switch} turns the warnings 4266controlled by @option{-Wswitch} into errors. This switch takes a 4267negative form, to be used to negate @option{-Werror} for specific 4268warnings; for example @option{-Wno-error=switch} makes 4269@option{-Wswitch} warnings not be errors, even when @option{-Werror} 4270is in effect. 4271 4272The warning message for each controllable warning includes the 4273option that controls the warning. That option can then be used with 4274@option{-Werror=} and @option{-Wno-error=} as described above. 4275(Printing of the option in the warning message can be disabled using the 4276@option{-fno-diagnostics-show-option} flag.) 4277 4278Note that specifying @option{-Werror=}@var{foo} automatically implies 4279@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 4280imply anything. 4281 4282@item -Wfatal-errors 4283@opindex Wfatal-errors 4284@opindex Wno-fatal-errors 4285This option causes the compiler to abort compilation on the first error 4286occurred rather than trying to keep going and printing further error 4287messages. 4288 4289@end table 4290 4291You can request many specific warnings with options beginning with 4292@samp{-W}, for example @option{-Wimplicit} to request warnings on 4293implicit declarations. Each of these specific warning options also 4294has a negative form beginning @samp{-Wno-} to turn off warnings; for 4295example, @option{-Wno-implicit}. This manual lists only one of the 4296two forms, whichever is not the default. For further 4297language-specific options also refer to @ref{C++ Dialect Options} and 4298@ref{Objective-C and Objective-C++ Dialect Options}. 4299 4300Some options, such as @option{-Wall} and @option{-Wextra}, turn on other 4301options, such as @option{-Wunused}, which may turn on further options, 4302such as @option{-Wunused-value}. The combined effect of positive and 4303negative forms is that more specific options have priority over less 4304specific ones, independently of their position in the command-line. For 4305options of the same specificity, the last one takes effect. Options 4306enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect 4307as if they appeared at the end of the command-line. 4308 4309When an unrecognized warning option is requested (e.g., 4310@option{-Wunknown-warning}), GCC emits a diagnostic stating 4311that the option is not recognized. However, if the @option{-Wno-} form 4312is used, the behavior is slightly different: no diagnostic is 4313produced for @option{-Wno-unknown-warning} unless other diagnostics 4314are being produced. This allows the use of new @option{-Wno-} options 4315with old compilers, but if something goes wrong, the compiler 4316warns that an unrecognized option is present. 4317 4318@table @gcctabopt 4319@item -Wpedantic 4320@itemx -pedantic 4321@opindex pedantic 4322@opindex Wpedantic 4323@opindex Wno-pedantic 4324Issue all the warnings demanded by strict ISO C and ISO C++; 4325reject all programs that use forbidden extensions, and some other 4326programs that do not follow ISO C and ISO C++. For ISO C, follows the 4327version of the ISO C standard specified by any @option{-std} option used. 4328 4329Valid ISO C and ISO C++ programs should compile properly with or without 4330this option (though a rare few require @option{-ansi} or a 4331@option{-std} option specifying the required version of ISO C)@. However, 4332without this option, certain GNU extensions and traditional C and C++ 4333features are supported as well. With this option, they are rejected. 4334 4335@option{-Wpedantic} does not cause warning messages for use of the 4336alternate keywords whose names begin and end with @samp{__}. Pedantic 4337warnings are also disabled in the expression that follows 4338@code{__extension__}. However, only system header files should use 4339these escape routes; application programs should avoid them. 4340@xref{Alternate Keywords}. 4341 4342Some users try to use @option{-Wpedantic} to check programs for strict ISO 4343C conformance. They soon find that it does not do quite what they want: 4344it finds some non-ISO practices, but not all---only those for which 4345ISO C @emph{requires} a diagnostic, and some others for which 4346diagnostics have been added. 4347 4348A feature to report any failure to conform to ISO C might be useful in 4349some instances, but would require considerable additional work and would 4350be quite different from @option{-Wpedantic}. We don't have plans to 4351support such a feature in the near future. 4352 4353Where the standard specified with @option{-std} represents a GNU 4354extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 4355corresponding @dfn{base standard}, the version of ISO C on which the GNU 4356extended dialect is based. Warnings from @option{-Wpedantic} are given 4357where they are required by the base standard. (It does not make sense 4358for such warnings to be given only for features not in the specified GNU 4359C dialect, since by definition the GNU dialects of C include all 4360features the compiler supports with the given option, and there would be 4361nothing to warn about.) 4362 4363@item -pedantic-errors 4364@opindex pedantic-errors 4365Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 4366requires a diagnostic, in some cases where there is undefined behavior 4367at compile-time and in some other cases that do not prevent compilation 4368of programs that are valid according to the standard. This is not 4369equivalent to @option{-Werror=pedantic}, since there are errors enabled 4370by this option and not enabled by the latter and vice versa. 4371 4372@item -Wall 4373@opindex Wall 4374@opindex Wno-all 4375This enables all the warnings about constructions that some users 4376consider questionable, and that are easy to avoid (or modify to 4377prevent the warning), even in conjunction with macros. This also 4378enables some language-specific warnings described in @ref{C++ Dialect 4379Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 4380 4381@option{-Wall} turns on the following warning flags: 4382 4383@gccoptlist{-Waddress @gol 4384-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 4385-Wbool-compare @gol 4386-Wbool-operation @gol 4387-Wc++11-compat -Wc++14-compat @gol 4388-Wcatch-value @r{(C++ and Objective-C++ only)} @gol 4389-Wchar-subscripts @gol 4390-Wcomment @gol 4391-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol 4392-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 4393-Wformat @gol 4394-Wint-in-bool-context @gol 4395-Wimplicit @r{(C and Objective-C only)} @gol 4396-Wimplicit-int @r{(C and Objective-C only)} @gol 4397-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 4398-Winit-self @r{(only for C++)} @gol 4399-Wlogical-not-parentheses @gol 4400-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 4401-Wmaybe-uninitialized @gol 4402-Wmemset-elt-size @gol 4403-Wmemset-transposed-args @gol 4404-Wmisleading-indentation @r{(only for C/C++)} @gol 4405-Wmissing-attributes @gol 4406-Wmissing-braces @r{(only for C/ObjC)} @gol 4407-Wmultistatement-macros @gol 4408-Wnarrowing @r{(only for C++)} @gol 4409-Wnonnull @gol 4410-Wnonnull-compare @gol 4411-Wopenmp-simd @gol 4412-Wparentheses @gol 4413-Wpessimizing-move @r{(only for C++)} @gol 4414-Wpointer-sign @gol 4415-Wreorder @gol 4416-Wrestrict @gol 4417-Wreturn-type @gol 4418-Wsequence-point @gol 4419-Wsign-compare @r{(only in C++)} @gol 4420-Wsizeof-pointer-div @gol 4421-Wsizeof-pointer-memaccess @gol 4422-Wstrict-aliasing @gol 4423-Wstrict-overflow=1 @gol 4424-Wswitch @gol 4425-Wtautological-compare @gol 4426-Wtrigraphs @gol 4427-Wuninitialized @gol 4428-Wunknown-pragmas @gol 4429-Wunused-function @gol 4430-Wunused-label @gol 4431-Wunused-value @gol 4432-Wunused-variable @gol 4433-Wvolatile-register-var} 4434 4435Note that some warning flags are not implied by @option{-Wall}. Some of 4436them warn about constructions that users generally do not consider 4437questionable, but which occasionally you might wish to check for; 4438others warn about constructions that are necessary or hard to avoid in 4439some cases, and there is no simple way to modify the code to suppress 4440the warning. Some of them are enabled by @option{-Wextra} but many of 4441them must be enabled individually. 4442 4443@item -Wextra 4444@opindex W 4445@opindex Wextra 4446@opindex Wno-extra 4447This enables some extra warning flags that are not enabled by 4448@option{-Wall}. (This option used to be called @option{-W}. The older 4449name is still supported, but the newer name is more descriptive.) 4450 4451@gccoptlist{-Wclobbered @gol 4452-Wcast-function-type @gol 4453-Wdeprecated-copy @r{(C++ only)} @gol 4454-Wempty-body @gol 4455-Wignored-qualifiers @gol 4456-Wimplicit-fallthrough=3 @gol 4457-Wmissing-field-initializers @gol 4458-Wmissing-parameter-type @r{(C only)} @gol 4459-Wold-style-declaration @r{(C only)} @gol 4460-Woverride-init @gol 4461-Wsign-compare @r{(C only)} @gol 4462-Wredundant-move @r{(only for C++)} @gol 4463-Wtype-limits @gol 4464-Wuninitialized @gol 4465-Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol 4466-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 4467-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}} 4468 4469 4470The option @option{-Wextra} also prints warning messages for the 4471following cases: 4472 4473@itemize @bullet 4474 4475@item 4476A pointer is compared against integer zero with @code{<}, @code{<=}, 4477@code{>}, or @code{>=}. 4478 4479@item 4480(C++ only) An enumerator and a non-enumerator both appear in a 4481conditional expression. 4482 4483@item 4484(C++ only) Ambiguous virtual bases. 4485 4486@item 4487(C++ only) Subscripting an array that has been declared @code{register}. 4488 4489@item 4490(C++ only) Taking the address of a variable that has been declared 4491@code{register}. 4492 4493@item 4494(C++ only) A base class is not initialized in the copy constructor 4495of a derived class. 4496 4497@end itemize 4498 4499@item -Wchar-subscripts 4500@opindex Wchar-subscripts 4501@opindex Wno-char-subscripts 4502Warn if an array subscript has type @code{char}. This is a common cause 4503of error, as programmers often forget that this type is signed on some 4504machines. 4505This warning is enabled by @option{-Wall}. 4506 4507@item -Wno-coverage-mismatch 4508@opindex Wno-coverage-mismatch 4509@opindex Wcoverage-mismatch 4510Warn if feedback profiles do not match when using the 4511@option{-fprofile-use} option. 4512If a source file is changed between compiling with @option{-fprofile-generate} 4513and with @option{-fprofile-use}, the files with the profile feedback can fail 4514to match the source file and GCC cannot use the profile feedback 4515information. By default, this warning is enabled and is treated as an 4516error. @option{-Wno-coverage-mismatch} can be used to disable the 4517warning or @option{-Wno-error=coverage-mismatch} can be used to 4518disable the error. Disabling the error for this warning can result in 4519poorly optimized code and is useful only in the 4520case of very minor changes such as bug fixes to an existing code-base. 4521Completely disabling the warning is not recommended. 4522 4523@item -Wno-cpp 4524@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 4525 4526Suppress warning messages emitted by @code{#warning} directives. 4527 4528@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 4529@opindex Wdouble-promotion 4530@opindex Wno-double-promotion 4531Give a warning when a value of type @code{float} is implicitly 4532promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 4533floating-point unit implement @code{float} in hardware, but emulate 4534@code{double} in software. On such a machine, doing computations 4535using @code{double} values is much more expensive because of the 4536overhead required for software emulation. 4537 4538It is easy to accidentally do computations with @code{double} because 4539floating-point literals are implicitly of type @code{double}. For 4540example, in: 4541@smallexample 4542@group 4543float area(float radius) 4544@{ 4545 return 3.14159 * radius * radius; 4546@} 4547@end group 4548@end smallexample 4549the compiler performs the entire computation with @code{double} 4550because the floating-point literal is a @code{double}. 4551 4552@item -Wduplicate-decl-specifier @r{(C and Objective-C only)} 4553@opindex Wduplicate-decl-specifier 4554@opindex Wno-duplicate-decl-specifier 4555Warn if a declaration has duplicate @code{const}, @code{volatile}, 4556@code{restrict} or @code{_Atomic} specifier. This warning is enabled by 4557@option{-Wall}. 4558 4559@item -Wformat 4560@itemx -Wformat=@var{n} 4561@opindex Wformat 4562@opindex Wno-format 4563@opindex ffreestanding 4564@opindex fno-builtin 4565@opindex Wformat= 4566Check calls to @code{printf} and @code{scanf}, etc., to make sure that 4567the arguments supplied have types appropriate to the format string 4568specified, and that the conversions specified in the format string make 4569sense. This includes standard functions, and others specified by format 4570attributes (@pxref{Function Attributes}), in the @code{printf}, 4571@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 4572not in the C standard) families (or other target-specific families). 4573Which functions are checked without format attributes having been 4574specified depends on the standard version selected, and such checks of 4575functions without the attribute specified are disabled by 4576@option{-ffreestanding} or @option{-fno-builtin}. 4577 4578The formats are checked against the format features supported by GNU 4579libc version 2.2. These include all ISO C90 and C99 features, as well 4580as features from the Single Unix Specification and some BSD and GNU 4581extensions. Other library implementations may not support all these 4582features; GCC does not support warning about features that go beyond a 4583particular library's limitations. However, if @option{-Wpedantic} is used 4584with @option{-Wformat}, warnings are given about format features not 4585in the selected standard version (but not for @code{strfmon} formats, 4586since those are not in any version of the C standard). @xref{C Dialect 4587Options,,Options Controlling C Dialect}. 4588 4589@table @gcctabopt 4590@item -Wformat=1 4591@itemx -Wformat 4592@opindex Wformat 4593@opindex Wformat=1 4594Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 4595@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 4596@option{-Wformat} also checks for null format arguments for several 4597functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 4598aspects of this level of format checking can be disabled by the 4599options: @option{-Wno-format-contains-nul}, 4600@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 4601@option{-Wformat} is enabled by @option{-Wall}. 4602 4603@item -Wno-format-contains-nul 4604@opindex Wno-format-contains-nul 4605@opindex Wformat-contains-nul 4606If @option{-Wformat} is specified, do not warn about format strings that 4607contain NUL bytes. 4608 4609@item -Wno-format-extra-args 4610@opindex Wno-format-extra-args 4611@opindex Wformat-extra-args 4612If @option{-Wformat} is specified, do not warn about excess arguments to a 4613@code{printf} or @code{scanf} format function. The C standard specifies 4614that such arguments are ignored. 4615 4616Where the unused arguments lie between used arguments that are 4617specified with @samp{$} operand number specifications, normally 4618warnings are still given, since the implementation could not know what 4619type to pass to @code{va_arg} to skip the unused arguments. However, 4620in the case of @code{scanf} formats, this option suppresses the 4621warning if the unused arguments are all pointers, since the Single 4622Unix Specification says that such unused arguments are allowed. 4623 4624@item -Wformat-overflow 4625@itemx -Wformat-overflow=@var{level} 4626@opindex Wformat-overflow 4627@opindex Wno-format-overflow 4628Warn about calls to formatted input/output functions such as @code{sprintf} 4629and @code{vsprintf} that might overflow the destination buffer. When the 4630exact number of bytes written by a format directive cannot be determined 4631at compile-time it is estimated based on heuristics that depend on the 4632@var{level} argument and on optimization. While enabling optimization 4633will in most cases improve the accuracy of the warning, it may also 4634result in false positives. 4635 4636@table @gcctabopt 4637@item -Wformat-overflow 4638@itemx -Wformat-overflow=1 4639@opindex Wformat-overflow 4640@opindex Wno-format-overflow 4641Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat} 4642employs a conservative approach that warns only about calls that most 4643likely overflow the buffer. At this level, numeric arguments to format 4644directives with unknown values are assumed to have the value of one, and 4645strings of unknown length to be empty. Numeric arguments that are known 4646to be bounded to a subrange of their type, or string arguments whose output 4647is bounded either by their directive's precision or by a finite set of 4648string literals, are assumed to take on the value within the range that 4649results in the most bytes on output. For example, the call to @code{sprintf} 4650below is diagnosed because even with both @var{a} and @var{b} equal to zero, 4651the terminating NUL character (@code{'\0'}) appended by the function 4652to the destination buffer will be written past its end. Increasing 4653the size of the buffer by a single byte is sufficient to avoid the 4654warning, though it may not be sufficient to avoid the overflow. 4655 4656@smallexample 4657void f (int a, int b) 4658@{ 4659 char buf [13]; 4660 sprintf (buf, "a = %i, b = %i\n", a, b); 4661@} 4662@end smallexample 4663 4664@item -Wformat-overflow=2 4665Level @var{2} warns also about calls that might overflow the destination 4666buffer given an argument of sufficient length or magnitude. At level 4667@var{2}, unknown numeric arguments are assumed to have the minimum 4668representable value for signed types with a precision greater than 1, and 4669the maximum representable value otherwise. Unknown string arguments whose 4670length cannot be assumed to be bounded either by the directive's precision, 4671or by a finite set of string literals they may evaluate to, or the character 4672array they may point to, are assumed to be 1 character long. 4673 4674At level @var{2}, the call in the example above is again diagnosed, but 4675this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first 4676@code{%i} directive will write some of its digits beyond the end of 4677the destination buffer. To make the call safe regardless of the values 4678of the two variables, the size of the destination buffer must be increased 4679to at least 34 bytes. GCC includes the minimum size of the buffer in 4680an informational note following the warning. 4681 4682An alternative to increasing the size of the destination buffer is to 4683constrain the range of formatted values. The maximum length of string 4684arguments can be bounded by specifying the precision in the format 4685directive. When numeric arguments of format directives can be assumed 4686to be bounded by less than the precision of their type, choosing 4687an appropriate length modifier to the format specifier will reduce 4688the required buffer size. For example, if @var{a} and @var{b} in the 4689example above can be assumed to be within the precision of 4690the @code{short int} type then using either the @code{%hi} format 4691directive or casting the argument to @code{short} reduces the maximum 4692required size of the buffer to 24 bytes. 4693 4694@smallexample 4695void f (int a, int b) 4696@{ 4697 char buf [23]; 4698 sprintf (buf, "a = %hi, b = %i\n", a, (short)b); 4699@} 4700@end smallexample 4701@end table 4702 4703@item -Wno-format-zero-length 4704@opindex Wno-format-zero-length 4705@opindex Wformat-zero-length 4706If @option{-Wformat} is specified, do not warn about zero-length formats. 4707The C standard specifies that zero-length formats are allowed. 4708 4709 4710@item -Wformat=2 4711@opindex Wformat=2 4712Enable @option{-Wformat} plus additional format checks. Currently 4713equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 4714-Wformat-y2k}. 4715 4716@item -Wformat-nonliteral 4717@opindex Wformat-nonliteral 4718@opindex Wno-format-nonliteral 4719If @option{-Wformat} is specified, also warn if the format string is not a 4720string literal and so cannot be checked, unless the format function 4721takes its format arguments as a @code{va_list}. 4722 4723@item -Wformat-security 4724@opindex Wformat-security 4725@opindex Wno-format-security 4726If @option{-Wformat} is specified, also warn about uses of format 4727functions that represent possible security problems. At present, this 4728warns about calls to @code{printf} and @code{scanf} functions where the 4729format string is not a string literal and there are no format arguments, 4730as in @code{printf (foo);}. This may be a security hole if the format 4731string came from untrusted input and contains @samp{%n}. (This is 4732currently a subset of what @option{-Wformat-nonliteral} warns about, but 4733in future warnings may be added to @option{-Wformat-security} that are not 4734included in @option{-Wformat-nonliteral}.) 4735 4736@item -Wformat-signedness 4737@opindex Wformat-signedness 4738@opindex Wno-format-signedness 4739If @option{-Wformat} is specified, also warn if the format string 4740requires an unsigned argument and the argument is signed and vice versa. 4741 4742@item -Wformat-truncation 4743@itemx -Wformat-truncation=@var{level} 4744@opindex Wformat-truncation 4745@opindex Wno-format-truncation 4746Warn about calls to formatted input/output functions such as @code{snprintf} 4747and @code{vsnprintf} that might result in output truncation. When the exact 4748number of bytes written by a format directive cannot be determined at 4749compile-time it is estimated based on heuristics that depend on 4750the @var{level} argument and on optimization. While enabling optimization 4751will in most cases improve the accuracy of the warning, it may also result 4752in false positives. Except as noted otherwise, the option uses the same 4753logic @option{-Wformat-overflow}. 4754 4755@table @gcctabopt 4756@item -Wformat-truncation 4757@itemx -Wformat-truncation=1 4758@opindex Wformat-truncation 4759@opindex Wno-format-truncation 4760Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat} 4761employs a conservative approach that warns only about calls to bounded 4762functions whose return value is unused and that will most likely result 4763in output truncation. 4764 4765@item -Wformat-truncation=2 4766Level @var{2} warns also about calls to bounded functions whose return 4767value is used and that might result in truncation given an argument of 4768sufficient length or magnitude. 4769@end table 4770 4771@item -Wformat-y2k 4772@opindex Wformat-y2k 4773@opindex Wno-format-y2k 4774If @option{-Wformat} is specified, also warn about @code{strftime} 4775formats that may yield only a two-digit year. 4776@end table 4777 4778@item -Wnonnull 4779@opindex Wnonnull 4780@opindex Wno-nonnull 4781Warn about passing a null pointer for arguments marked as 4782requiring a non-null value by the @code{nonnull} function attribute. 4783 4784@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 4785can be disabled with the @option{-Wno-nonnull} option. 4786 4787@item -Wnonnull-compare 4788@opindex Wnonnull-compare 4789@opindex Wno-nonnull-compare 4790Warn when comparing an argument marked with the @code{nonnull} 4791function attribute against null inside the function. 4792 4793@option{-Wnonnull-compare} is included in @option{-Wall}. It 4794can be disabled with the @option{-Wno-nonnull-compare} option. 4795 4796@item -Wnull-dereference 4797@opindex Wnull-dereference 4798@opindex Wno-null-dereference 4799Warn if the compiler detects paths that trigger erroneous or 4800undefined behavior due to dereferencing a null pointer. This option 4801is only active when @option{-fdelete-null-pointer-checks} is active, 4802which is enabled by optimizations in most targets. The precision of 4803the warnings depends on the optimization options used. 4804 4805@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 4806@opindex Winit-self 4807@opindex Wno-init-self 4808Warn about uninitialized variables that are initialized with themselves. 4809Note this option can only be used with the @option{-Wuninitialized} option. 4810 4811For example, GCC warns about @code{i} being uninitialized in the 4812following snippet only when @option{-Winit-self} has been specified: 4813@smallexample 4814@group 4815int f() 4816@{ 4817 int i = i; 4818 return i; 4819@} 4820@end group 4821@end smallexample 4822 4823This warning is enabled by @option{-Wall} in C++. 4824 4825@item -Wimplicit-int @r{(C and Objective-C only)} 4826@opindex Wimplicit-int 4827@opindex Wno-implicit-int 4828Warn when a declaration does not specify a type. 4829This warning is enabled by @option{-Wall}. 4830 4831@item -Wimplicit-function-declaration @r{(C and Objective-C only)} 4832@opindex Wimplicit-function-declaration 4833@opindex Wno-implicit-function-declaration 4834Give a warning whenever a function is used before being declared. In 4835C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is 4836enabled by default and it is made into an error by 4837@option{-pedantic-errors}. This warning is also enabled by 4838@option{-Wall}. 4839 4840@item -Wimplicit @r{(C and Objective-C only)} 4841@opindex Wimplicit 4842@opindex Wno-implicit 4843Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 4844This warning is enabled by @option{-Wall}. 4845 4846@item -Wimplicit-fallthrough 4847@opindex Wimplicit-fallthrough 4848@opindex Wno-implicit-fallthrough 4849@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3} 4850and @option{-Wno-implicit-fallthrough} is the same as 4851@option{-Wimplicit-fallthrough=0}. 4852 4853@item -Wimplicit-fallthrough=@var{n} 4854@opindex Wimplicit-fallthrough= 4855Warn when a switch case falls through. For example: 4856 4857@smallexample 4858@group 4859switch (cond) 4860 @{ 4861 case 1: 4862 a = 1; 4863 break; 4864 case 2: 4865 a = 2; 4866 case 3: 4867 a = 3; 4868 break; 4869 @} 4870@end group 4871@end smallexample 4872 4873This warning does not warn when the last statement of a case cannot 4874fall through, e.g. when there is a return statement or a call to function 4875declared with the noreturn attribute. @option{-Wimplicit-fallthrough=} 4876also takes into account control flow statements, such as ifs, and only 4877warns when appropriate. E.g.@: 4878 4879@smallexample 4880@group 4881switch (cond) 4882 @{ 4883 case 1: 4884 if (i > 3) @{ 4885 bar (5); 4886 break; 4887 @} else if (i < 1) @{ 4888 bar (0); 4889 @} else 4890 return; 4891 default: 4892 @dots{} 4893 @} 4894@end group 4895@end smallexample 4896 4897Since there are occasions where a switch case fall through is desirable, 4898GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is 4899to be used along with a null statement to suppress this warning that 4900would normally occur: 4901 4902@smallexample 4903@group 4904switch (cond) 4905 @{ 4906 case 1: 4907 bar (0); 4908 __attribute__ ((fallthrough)); 4909 default: 4910 @dots{} 4911 @} 4912@end group 4913@end smallexample 4914 4915C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough} 4916warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11 4917or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension. 4918Instead of these attributes, it is also possible to add a fallthrough comment 4919to silence the warning. The whole body of the C or C++ style comment should 4920match the given regular expressions listed below. The option argument @var{n} 4921specifies what kind of comments are accepted: 4922 4923@itemize @bullet 4924 4925@item @option{-Wimplicit-fallthrough=0} disables the warning altogether. 4926 4927@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular 4928expression, any comment is used as fallthrough comment. 4929 4930@item @option{-Wimplicit-fallthrough=2} case insensitively matches 4931@code{.*falls?[ \t-]*thr(ough|u).*} regular expression. 4932 4933@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the 4934following regular expressions: 4935 4936@itemize @bullet 4937 4938@item @code{-fallthrough} 4939 4940@item @code{@@fallthrough@@} 4941 4942@item @code{lint -fallthrough[ \t]*} 4943 4944@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?} 4945 4946@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?} 4947 4948@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?} 4949 4950@end itemize 4951 4952@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the 4953following regular expressions: 4954 4955@itemize @bullet 4956 4957@item @code{-fallthrough} 4958 4959@item @code{@@fallthrough@@} 4960 4961@item @code{lint -fallthrough[ \t]*} 4962 4963@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*} 4964 4965@end itemize 4966 4967@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as 4968fallthrough comments, only attributes disable the warning. 4969 4970@end itemize 4971 4972The comment needs to be followed after optional whitespace and other comments 4973by @code{case} or @code{default} keywords or by a user label that precedes some 4974@code{case} or @code{default} label. 4975 4976@smallexample 4977@group 4978switch (cond) 4979 @{ 4980 case 1: 4981 bar (0); 4982 /* FALLTHRU */ 4983 default: 4984 @dots{} 4985 @} 4986@end group 4987@end smallexample 4988 4989The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}. 4990 4991@item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 4992@opindex Wif-not-aligned 4993@opindex Wno-if-not-aligned 4994Control if warning triggered by the @code{warn_if_not_aligned} attribute 4995should be issued. This is enabled by default. 4996Use @option{-Wno-if-not-aligned} to disable it. 4997 4998@item -Wignored-qualifiers @r{(C and C++ only)} 4999@opindex Wignored-qualifiers 5000@opindex Wno-ignored-qualifiers 5001Warn if the return type of a function has a type qualifier 5002such as @code{const}. For ISO C such a type qualifier has no effect, 5003since the value returned by a function is not an lvalue. 5004For C++, the warning is only emitted for scalar types or @code{void}. 5005ISO C prohibits qualified @code{void} return types on function 5006definitions, so such return types always receive a warning 5007even without this option. 5008 5009This warning is also enabled by @option{-Wextra}. 5010 5011@item -Wignored-attributes @r{(C and C++ only)} 5012@opindex Wignored-attributes 5013@opindex Wno-ignored-attributes 5014Warn when an attribute is ignored. This is different from the 5015@option{-Wattributes} option in that it warns whenever the compiler decides 5016to drop an attribute, not that the attribute is either unknown, used in a 5017wrong place, etc. This warning is enabled by default. 5018 5019@item -Wmain 5020@opindex Wmain 5021@opindex Wno-main 5022Warn if the type of @code{main} is suspicious. @code{main} should be 5023a function with external linkage, returning int, taking either zero 5024arguments, two, or three arguments of appropriate types. This warning 5025is enabled by default in C++ and is enabled by either @option{-Wall} 5026or @option{-Wpedantic}. 5027 5028@item -Wmisleading-indentation @r{(C and C++ only)} 5029@opindex Wmisleading-indentation 5030@opindex Wno-misleading-indentation 5031Warn when the indentation of the code does not reflect the block structure. 5032Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and 5033@code{for} clauses with a guarded statement that does not use braces, 5034followed by an unguarded statement with the same indentation. 5035 5036In the following example, the call to ``bar'' is misleadingly indented as 5037if it were guarded by the ``if'' conditional. 5038 5039@smallexample 5040 if (some_condition ()) 5041 foo (); 5042 bar (); /* Gotcha: this is not guarded by the "if". */ 5043@end smallexample 5044 5045In the case of mixed tabs and spaces, the warning uses the 5046@option{-ftabstop=} option to determine if the statements line up 5047(defaulting to 8). 5048 5049The warning is not issued for code involving multiline preprocessor logic 5050such as the following example. 5051 5052@smallexample 5053 if (flagA) 5054 foo (0); 5055#if SOME_CONDITION_THAT_DOES_NOT_HOLD 5056 if (flagB) 5057#endif 5058 foo (1); 5059@end smallexample 5060 5061The warning is not issued after a @code{#line} directive, since this 5062typically indicates autogenerated code, and no assumptions can be made 5063about the layout of the file that the directive references. 5064 5065This warning is enabled by @option{-Wall} in C and C++. 5066 5067@item -Wmissing-attributes 5068@opindex Wmissing-attributes 5069@opindex Wno-missing-attributes 5070Warn when a declaration of a function is missing one or more attributes 5071that a related function is declared with and whose absence may adversely 5072affect the correctness or efficiency of generated code. For example, 5073the warning is issued for declarations of aliases that use attributes 5074to specify less restrictive requirements than those of their targets. 5075This typically represents a potential optimization opportunity. 5076By contrast, the @option{-Wattribute-alias=2} option controls warnings 5077issued when the alias is more restrictive than the target, which could 5078lead to incorrect code generation. 5079Attributes considered include @code{alloc_align}, @code{alloc_size}, 5080@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 5081@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 5082@code{returns_nonnull}, and @code{returns_twice}. 5083 5084In C++, the warning is issued when an explicit specialization of a primary 5085template declared with attribute @code{alloc_align}, @code{alloc_size}, 5086@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc}, 5087or @code{nonnull} is declared without it. Attributes @code{deprecated}, 5088@code{error}, and @code{warning} suppress the warning. 5089(@pxref{Function Attributes}). 5090 5091You can use the @code{copy} attribute to apply the same 5092set of attributes to a declaration as that on another declaration without 5093explicitly enumerating the attributes. This attribute can be applied 5094to declarations of functions (@pxref{Common Function Attributes}), 5095variables (@pxref{Common Variable Attributes}), or types 5096(@pxref{Common Type Attributes}). 5097 5098@option{-Wmissing-attributes} is enabled by @option{-Wall}. 5099 5100For example, since the declaration of the primary function template 5101below makes use of both attribute @code{malloc} and @code{alloc_size} 5102the declaration of the explicit specialization of the template is 5103diagnosed because it is missing one of the attributes. 5104 5105@smallexample 5106template <class T> 5107T* __attribute__ ((malloc, alloc_size (1))) 5108allocate (size_t); 5109 5110template <> 5111void* __attribute__ ((malloc)) // missing alloc_size 5112allocate<void> (size_t); 5113@end smallexample 5114 5115@item -Wmissing-braces 5116@opindex Wmissing-braces 5117@opindex Wno-missing-braces 5118Warn if an aggregate or union initializer is not fully bracketed. In 5119the following example, the initializer for @code{a} is not fully 5120bracketed, but that for @code{b} is fully bracketed. This warning is 5121enabled by @option{-Wall} in C. 5122 5123@smallexample 5124int a[2][2] = @{ 0, 1, 2, 3 @}; 5125int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 5126@end smallexample 5127 5128This warning is enabled by @option{-Wall}. 5129 5130@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 5131@opindex Wmissing-include-dirs 5132@opindex Wno-missing-include-dirs 5133Warn if a user-supplied include directory does not exist. 5134 5135@item -Wmissing-profile 5136@opindex Wmissing-profile 5137@opindex Wno-missing-profile 5138Warn if feedback profiles are missing when using the 5139@option{-fprofile-use} option. 5140This option diagnoses those cases where a new function or a new file is added 5141to the user code between compiling with @option{-fprofile-generate} and with 5142@option{-fprofile-use}, without regenerating the profiles. In these cases, the 5143profile feedback data files do not contain any profile feedback information for 5144the newly added function or file respectively. Also, in the case when profile 5145count data (.gcda) files are removed, GCC cannot use any profile feedback 5146information. In all these cases, warnings are issued to inform the user that a 5147profile generation step is due. @option{-Wno-missing-profile} can be used to 5148disable the warning. Ignoring the warning can result in poorly optimized code. 5149Completely disabling the warning is not recommended and should be done only 5150when non-existent profile data is justified. 5151 5152@item -Wmultistatement-macros 5153@opindex Wmultistatement-macros 5154@opindex Wno-multistatement-macros 5155Warn about unsafe multiple statement macros that appear to be guarded 5156by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or 5157@code{while}, in which only the first statement is actually guarded after 5158the macro is expanded. 5159 5160For example: 5161 5162@smallexample 5163#define DOIT x++; y++ 5164if (c) 5165 DOIT; 5166@end smallexample 5167 5168will increment @code{y} unconditionally, not just when @code{c} holds. 5169The can usually be fixed by wrapping the macro in a do-while loop: 5170@smallexample 5171#define DOIT do @{ x++; y++; @} while (0) 5172if (c) 5173 DOIT; 5174@end smallexample 5175 5176This warning is enabled by @option{-Wall} in C and C++. 5177 5178@item -Wparentheses 5179@opindex Wparentheses 5180@opindex Wno-parentheses 5181Warn if parentheses are omitted in certain contexts, such 5182as when there is an assignment in a context where a truth value 5183is expected, or when operators are nested whose precedence people 5184often get confused about. 5185 5186Also warn if a comparison like @code{x<=y<=z} appears; this is 5187equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 5188interpretation from that of ordinary mathematical notation. 5189 5190Also warn for dangerous uses of the GNU extension to 5191@code{?:} with omitted middle operand. When the condition 5192in the @code{?}: operator is a boolean expression, the omitted value is 5193always 1. Often programmers expect it to be a value computed 5194inside the conditional expression instead. 5195 5196For C++ this also warns for some cases of unnecessary parentheses in 5197declarations, which can indicate an attempt at a function call instead 5198of a declaration: 5199@smallexample 5200@{ 5201 // Declares a local variable called mymutex. 5202 std::unique_lock<std::mutex> (mymutex); 5203 // User meant std::unique_lock<std::mutex> lock (mymutex); 5204@} 5205@end smallexample 5206 5207This warning is enabled by @option{-Wall}. 5208 5209@item -Wsequence-point 5210@opindex Wsequence-point 5211@opindex Wno-sequence-point 5212Warn about code that may have undefined semantics because of violations 5213of sequence point rules in the C and C++ standards. 5214 5215The C and C++ standards define the order in which expressions in a C/C++ 5216program are evaluated in terms of @dfn{sequence points}, which represent 5217a partial ordering between the execution of parts of the program: those 5218executed before the sequence point, and those executed after it. These 5219occur after the evaluation of a full expression (one which is not part 5220of a larger expression), after the evaluation of the first operand of a 5221@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 5222function is called (but after the evaluation of its arguments and the 5223expression denoting the called function), and in certain other places. 5224Other than as expressed by the sequence point rules, the order of 5225evaluation of subexpressions of an expression is not specified. All 5226these rules describe only a partial order rather than a total order, 5227since, for example, if two functions are called within one expression 5228with no sequence point between them, the order in which the functions 5229are called is not specified. However, the standards committee have 5230ruled that function calls do not overlap. 5231 5232It is not specified when between sequence points modifications to the 5233values of objects take effect. Programs whose behavior depends on this 5234have undefined behavior; the C and C++ standards specify that ``Between 5235the previous and next sequence point an object shall have its stored 5236value modified at most once by the evaluation of an expression. 5237Furthermore, the prior value shall be read only to determine the value 5238to be stored.''. If a program breaks these rules, the results on any 5239particular implementation are entirely unpredictable. 5240 5241Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 5242= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 5243diagnosed by this option, and it may give an occasional false positive 5244result, but in general it has been found fairly effective at detecting 5245this sort of problem in programs. 5246 5247The C++17 standard will define the order of evaluation of operands in 5248more cases: in particular it requires that the right-hand side of an 5249assignment be evaluated before the left-hand side, so the above 5250examples are no longer undefined. But this warning will still warn 5251about them, to help people avoid writing code that is undefined in C 5252and earlier revisions of C++. 5253 5254The standard is worded confusingly, therefore there is some debate 5255over the precise meaning of the sequence point rules in subtle cases. 5256Links to discussions of the problem, including proposed formal 5257definitions, may be found on the GCC readings page, at 5258@uref{http://gcc.gnu.org/@/readings.html}. 5259 5260This warning is enabled by @option{-Wall} for C and C++. 5261 5262@item -Wno-return-local-addr 5263@opindex Wno-return-local-addr 5264@opindex Wreturn-local-addr 5265Do not warn about returning a pointer (or in C++, a reference) to a 5266variable that goes out of scope after the function returns. 5267 5268@item -Wreturn-type 5269@opindex Wreturn-type 5270@opindex Wno-return-type 5271Warn whenever a function is defined with a return type that defaults 5272to @code{int}. Also warn about any @code{return} statement with no 5273return value in a function whose return type is not @code{void} 5274(falling off the end of the function body is considered returning 5275without a value). 5276 5277For C only, warn about a @code{return} statement with an expression in a 5278function whose return type is @code{void}, unless the expression type is 5279also @code{void}. As a GNU extension, the latter case is accepted 5280without a warning unless @option{-Wpedantic} is used. Attempting 5281to use the return value of a non-@code{void} function other than @code{main} 5282that flows off the end by reaching the closing curly brace that terminates 5283the function is undefined. 5284 5285Unlike in C, in C++, flowing off the end of a non-@code{void} function other 5286than @code{main} results in undefined behavior even when the value of 5287the function is not used. 5288 5289This warning is enabled by default in C++ and by @option{-Wall} otherwise. 5290 5291@item -Wshift-count-negative 5292@opindex Wshift-count-negative 5293@opindex Wno-shift-count-negative 5294Warn if shift count is negative. This warning is enabled by default. 5295 5296@item -Wshift-count-overflow 5297@opindex Wshift-count-overflow 5298@opindex Wno-shift-count-overflow 5299Warn if shift count >= width of type. This warning is enabled by default. 5300 5301@item -Wshift-negative-value 5302@opindex Wshift-negative-value 5303@opindex Wno-shift-negative-value 5304Warn if left shifting a negative value. This warning is enabled by 5305@option{-Wextra} in C99 and C++11 modes (and newer). 5306 5307@item -Wshift-overflow 5308@itemx -Wshift-overflow=@var{n} 5309@opindex Wshift-overflow 5310@opindex Wno-shift-overflow 5311Warn about left shift overflows. This warning is enabled by 5312default in C99 and C++11 modes (and newer). 5313 5314@table @gcctabopt 5315@item -Wshift-overflow=1 5316This is the warning level of @option{-Wshift-overflow} and is enabled 5317by default in C99 and C++11 modes (and newer). This warning level does 5318not warn about left-shifting 1 into the sign bit. (However, in C, such 5319an overflow is still rejected in contexts where an integer constant expression 5320is required.) No warning is emitted in C++2A mode (and newer), as signed left 5321shifts always wrap. 5322 5323@item -Wshift-overflow=2 5324This warning level also warns about left-shifting 1 into the sign bit, 5325unless C++14 mode (or newer) is active. 5326@end table 5327 5328@item -Wswitch 5329@opindex Wswitch 5330@opindex Wno-switch 5331Warn whenever a @code{switch} statement has an index of enumerated type 5332and lacks a @code{case} for one or more of the named codes of that 5333enumeration. (The presence of a @code{default} label prevents this 5334warning.) @code{case} labels outside the enumeration range also 5335provoke warnings when this option is used (even if there is a 5336@code{default} label). 5337This warning is enabled by @option{-Wall}. 5338 5339@item -Wswitch-default 5340@opindex Wswitch-default 5341@opindex Wno-switch-default 5342Warn whenever a @code{switch} statement does not have a @code{default} 5343case. 5344 5345@item -Wswitch-enum 5346@opindex Wswitch-enum 5347@opindex Wno-switch-enum 5348Warn whenever a @code{switch} statement has an index of enumerated type 5349and lacks a @code{case} for one or more of the named codes of that 5350enumeration. @code{case} labels outside the enumeration range also 5351provoke warnings when this option is used. The only difference 5352between @option{-Wswitch} and this option is that this option gives a 5353warning about an omitted enumeration code even if there is a 5354@code{default} label. 5355 5356@item -Wswitch-bool 5357@opindex Wswitch-bool 5358@opindex Wno-switch-bool 5359Warn whenever a @code{switch} statement has an index of boolean type 5360and the case values are outside the range of a boolean type. 5361It is possible to suppress this warning by casting the controlling 5362expression to a type other than @code{bool}. For example: 5363@smallexample 5364@group 5365switch ((int) (a == 4)) 5366 @{ 5367 @dots{} 5368 @} 5369@end group 5370@end smallexample 5371This warning is enabled by default for C and C++ programs. 5372 5373@item -Wswitch-unreachable 5374@opindex Wswitch-unreachable 5375@opindex Wno-switch-unreachable 5376Warn whenever a @code{switch} statement contains statements between the 5377controlling expression and the first case label, which will never be 5378executed. For example: 5379@smallexample 5380@group 5381switch (cond) 5382 @{ 5383 i = 15; 5384 @dots{} 5385 case 5: 5386 @dots{} 5387 @} 5388@end group 5389@end smallexample 5390@option{-Wswitch-unreachable} does not warn if the statement between the 5391controlling expression and the first case label is just a declaration: 5392@smallexample 5393@group 5394switch (cond) 5395 @{ 5396 int i; 5397 @dots{} 5398 case 5: 5399 i = 5; 5400 @dots{} 5401 @} 5402@end group 5403@end smallexample 5404This warning is enabled by default for C and C++ programs. 5405 5406@item -Wsync-nand @r{(C and C++ only)} 5407@opindex Wsync-nand 5408@opindex Wno-sync-nand 5409Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 5410built-in functions are used. These functions changed semantics in GCC 4.4. 5411 5412@item -Wunused-but-set-parameter 5413@opindex Wunused-but-set-parameter 5414@opindex Wno-unused-but-set-parameter 5415Warn whenever a function parameter is assigned to, but otherwise unused 5416(aside from its declaration). 5417 5418To suppress this warning use the @code{unused} attribute 5419(@pxref{Variable Attributes}). 5420 5421This warning is also enabled by @option{-Wunused} together with 5422@option{-Wextra}. 5423 5424@item -Wunused-but-set-variable 5425@opindex Wunused-but-set-variable 5426@opindex Wno-unused-but-set-variable 5427Warn whenever a local variable is assigned to, but otherwise unused 5428(aside from its declaration). 5429This warning is enabled by @option{-Wall}. 5430 5431To suppress this warning use the @code{unused} attribute 5432(@pxref{Variable Attributes}). 5433 5434This warning is also enabled by @option{-Wunused}, which is enabled 5435by @option{-Wall}. 5436 5437@item -Wunused-function 5438@opindex Wunused-function 5439@opindex Wno-unused-function 5440Warn whenever a static function is declared but not defined or a 5441non-inline static function is unused. 5442This warning is enabled by @option{-Wall}. 5443 5444@item -Wunused-label 5445@opindex Wunused-label 5446@opindex Wno-unused-label 5447Warn whenever a label is declared but not used. 5448This warning is enabled by @option{-Wall}. 5449 5450To suppress this warning use the @code{unused} attribute 5451(@pxref{Variable Attributes}). 5452 5453@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 5454@opindex Wunused-local-typedefs 5455@opindex Wno-unused-local-typedefs 5456Warn when a typedef locally defined in a function is not used. 5457This warning is enabled by @option{-Wall}. 5458 5459@item -Wunused-parameter 5460@opindex Wunused-parameter 5461@opindex Wno-unused-parameter 5462Warn whenever a function parameter is unused aside from its declaration. 5463 5464To suppress this warning use the @code{unused} attribute 5465(@pxref{Variable Attributes}). 5466 5467@item -Wno-unused-result 5468@opindex Wunused-result 5469@opindex Wno-unused-result 5470Do not warn if a caller of a function marked with attribute 5471@code{warn_unused_result} (@pxref{Function Attributes}) does not use 5472its return value. The default is @option{-Wunused-result}. 5473 5474@item -Wunused-variable 5475@opindex Wunused-variable 5476@opindex Wno-unused-variable 5477Warn whenever a local or static variable is unused aside from its 5478declaration. This option implies @option{-Wunused-const-variable=1} for C, 5479but not for C++. This warning is enabled by @option{-Wall}. 5480 5481To suppress this warning use the @code{unused} attribute 5482(@pxref{Variable Attributes}). 5483 5484@item -Wunused-const-variable 5485@itemx -Wunused-const-variable=@var{n} 5486@opindex Wunused-const-variable 5487@opindex Wno-unused-const-variable 5488Warn whenever a constant static variable is unused aside from its declaration. 5489@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable} 5490for C, but not for C++. In C this declares variable storage, but in C++ this 5491is not an error since const variables take the place of @code{#define}s. 5492 5493To suppress this warning use the @code{unused} attribute 5494(@pxref{Variable Attributes}). 5495 5496@table @gcctabopt 5497@item -Wunused-const-variable=1 5498This is the warning level that is enabled by @option{-Wunused-variable} for 5499C. It warns only about unused static const variables defined in the main 5500compilation unit, but not about static const variables declared in any 5501header included. 5502 5503@item -Wunused-const-variable=2 5504This warning level also warns for unused constant static variables in 5505headers (excluding system headers). This is the warning level of 5506@option{-Wunused-const-variable} and must be explicitly requested since 5507in C++ this isn't an error and in C it might be harder to clean up all 5508headers included. 5509@end table 5510 5511@item -Wunused-value 5512@opindex Wunused-value 5513@opindex Wno-unused-value 5514Warn whenever a statement computes a result that is explicitly not 5515used. To suppress this warning cast the unused expression to 5516@code{void}. This includes an expression-statement or the left-hand 5517side of a comma expression that contains no side effects. For example, 5518an expression such as @code{x[i,j]} causes a warning, while 5519@code{x[(void)i,j]} does not. 5520 5521This warning is enabled by @option{-Wall}. 5522 5523@item -Wunused 5524@opindex Wunused 5525@opindex Wno-unused 5526All the above @option{-Wunused} options combined. 5527 5528In order to get a warning about an unused function parameter, you must 5529either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 5530@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 5531 5532@item -Wuninitialized 5533@opindex Wuninitialized 5534@opindex Wno-uninitialized 5535Warn if an automatic variable is used without first being initialized 5536or if a variable may be clobbered by a @code{setjmp} call. In C++, 5537warn if a non-static reference or non-static @code{const} member 5538appears in a class without constructors. 5539 5540If you want to warn about code that uses the uninitialized value of the 5541variable in its own initializer, use the @option{-Winit-self} option. 5542 5543These warnings occur for individual uninitialized or clobbered 5544elements of structure, union or array variables as well as for 5545variables that are uninitialized or clobbered as a whole. They do 5546not occur for variables or elements declared @code{volatile}. Because 5547these warnings depend on optimization, the exact variables or elements 5548for which there are warnings depends on the precise optimization 5549options and version of GCC used. 5550 5551Note that there may be no warning about a variable that is used only 5552to compute a value that itself is never used, because such 5553computations may be deleted by data flow analysis before the warnings 5554are printed. 5555 5556@item -Winvalid-memory-model 5557@opindex Winvalid-memory-model 5558@opindex Wno-invalid-memory-model 5559Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, 5560and the C11 atomic generic functions with a memory consistency argument 5561that is either invalid for the operation or outside the range of values 5562of the @code{memory_order} enumeration. For example, since the 5563@code{__atomic_store} and @code{__atomic_store_n} built-ins are only 5564defined for the relaxed, release, and sequentially consistent memory 5565orders the following code is diagnosed: 5566 5567@smallexample 5568void store (int *i) 5569@{ 5570 __atomic_store_n (i, 0, memory_order_consume); 5571@} 5572@end smallexample 5573 5574@option{-Winvalid-memory-model} is enabled by default. 5575 5576@item -Wmaybe-uninitialized 5577@opindex Wmaybe-uninitialized 5578@opindex Wno-maybe-uninitialized 5579For an automatic (i.e.@: local) variable, if there exists a path from the 5580function entry to a use of the variable that is initialized, but there exist 5581some other paths for which the variable is not initialized, the compiler 5582emits a warning if it cannot prove the uninitialized paths are not 5583executed at run time. 5584 5585These warnings are only possible in optimizing compilation, because otherwise 5586GCC does not keep track of the state of variables. 5587 5588These warnings are made optional because GCC may not be able to determine when 5589the code is correct in spite of appearing to have an error. Here is one 5590example of how this can happen: 5591 5592@smallexample 5593@group 5594@{ 5595 int x; 5596 switch (y) 5597 @{ 5598 case 1: x = 1; 5599 break; 5600 case 2: x = 4; 5601 break; 5602 case 3: x = 5; 5603 @} 5604 foo (x); 5605@} 5606@end group 5607@end smallexample 5608 5609@noindent 5610If the value of @code{y} is always 1, 2 or 3, then @code{x} is 5611always initialized, but GCC doesn't know this. To suppress the 5612warning, you need to provide a default case with assert(0) or 5613similar code. 5614 5615@cindex @code{longjmp} warnings 5616This option also warns when a non-volatile automatic variable might be 5617changed by a call to @code{longjmp}. 5618The compiler sees only the calls to @code{setjmp}. It cannot know 5619where @code{longjmp} will be called; in fact, a signal handler could 5620call it at any point in the code. As a result, you may get a warning 5621even when there is in fact no problem because @code{longjmp} cannot 5622in fact be called at the place that would cause a problem. 5623 5624Some spurious warnings can be avoided if you declare all the functions 5625you use that never return as @code{noreturn}. @xref{Function 5626Attributes}. 5627 5628This warning is enabled by @option{-Wall} or @option{-Wextra}. 5629 5630@item -Wunknown-pragmas 5631@opindex Wunknown-pragmas 5632@opindex Wno-unknown-pragmas 5633@cindex warning for unknown pragmas 5634@cindex unknown pragmas, warning 5635@cindex pragmas, warning of unknown 5636Warn when a @code{#pragma} directive is encountered that is not understood by 5637GCC@. If this command-line option is used, warnings are even issued 5638for unknown pragmas in system header files. This is not the case if 5639the warnings are only enabled by the @option{-Wall} command-line option. 5640 5641@item -Wno-pragmas 5642@opindex Wno-pragmas 5643@opindex Wpragmas 5644Do not warn about misuses of pragmas, such as incorrect parameters, 5645invalid syntax, or conflicts between pragmas. See also 5646@option{-Wunknown-pragmas}. 5647 5648@item -Wno-prio-ctor-dtor 5649@opindex Wno-prio-ctor-dtor 5650@opindex Wprio-ctor-dtor 5651Do not warn if a priority from 0 to 100 is used for constructor or destructor. 5652The use of constructor and destructor attributes allow you to assign a 5653priority to the constructor/destructor to control its order of execution 5654before @code{main} is called or after it returns. The priority values must be 5655greater than 100 as the compiler reserves priority values between 0--100 for 5656the implementation. 5657 5658@item -Wstrict-aliasing 5659@opindex Wstrict-aliasing 5660@opindex Wno-strict-aliasing 5661This option is only active when @option{-fstrict-aliasing} is active. 5662It warns about code that might break the strict aliasing rules that the 5663compiler is using for optimization. The warning does not catch all 5664cases, but does attempt to catch the more common pitfalls. It is 5665included in @option{-Wall}. 5666It is equivalent to @option{-Wstrict-aliasing=3} 5667 5668@item -Wstrict-aliasing=n 5669@opindex Wstrict-aliasing=n 5670This option is only active when @option{-fstrict-aliasing} is active. 5671It warns about code that might break the strict aliasing rules that the 5672compiler is using for optimization. 5673Higher levels correspond to higher accuracy (fewer false positives). 5674Higher levels also correspond to more effort, similar to the way @option{-O} 5675works. 5676@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 5677 5678Level 1: Most aggressive, quick, least accurate. 5679Possibly useful when higher levels 5680do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 5681false negatives. However, it has many false positives. 5682Warns for all pointer conversions between possibly incompatible types, 5683even if never dereferenced. Runs in the front end only. 5684 5685Level 2: Aggressive, quick, not too precise. 5686May still have many false positives (not as many as level 1 though), 5687and few false negatives (but possibly more than level 1). 5688Unlike level 1, it only warns when an address is taken. Warns about 5689incomplete types. Runs in the front end only. 5690 5691Level 3 (default for @option{-Wstrict-aliasing}): 5692Should have very few false positives and few false 5693negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 5694Takes care of the common pun+dereference pattern in the front end: 5695@code{*(int*)&some_float}. 5696If optimization is enabled, it also runs in the back end, where it deals 5697with multiple statement cases using flow-sensitive points-to information. 5698Only warns when the converted pointer is dereferenced. 5699Does not warn about incomplete types. 5700 5701@item -Wstrict-overflow 5702@itemx -Wstrict-overflow=@var{n} 5703@opindex Wstrict-overflow 5704@opindex Wno-strict-overflow 5705This option is only active when signed overflow is undefined. 5706It warns about cases where the compiler optimizes based on the 5707assumption that signed overflow does not occur. Note that it does not 5708warn about all cases where the code might overflow: it only warns 5709about cases where the compiler implements some optimization. Thus 5710this warning depends on the optimization level. 5711 5712An optimization that assumes that signed overflow does not occur is 5713perfectly safe if the values of the variables involved are such that 5714overflow never does, in fact, occur. Therefore this warning can 5715easily give a false positive: a warning about code that is not 5716actually a problem. To help focus on important issues, several 5717warning levels are defined. No warnings are issued for the use of 5718undefined signed overflow when estimating how many iterations a loop 5719requires, in particular when determining whether a loop will be 5720executed at all. 5721 5722@table @gcctabopt 5723@item -Wstrict-overflow=1 5724Warn about cases that are both questionable and easy to avoid. For 5725example the compiler simplifies 5726@code{x + 1 > x} to @code{1}. This level of 5727@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 5728are not, and must be explicitly requested. 5729 5730@item -Wstrict-overflow=2 5731Also warn about other cases where a comparison is simplified to a 5732constant. For example: @code{abs (x) >= 0}. This can only be 5733simplified when signed integer overflow is undefined, because 5734@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 5735zero. @option{-Wstrict-overflow} (with no level) is the same as 5736@option{-Wstrict-overflow=2}. 5737 5738@item -Wstrict-overflow=3 5739Also warn about other cases where a comparison is simplified. For 5740example: @code{x + 1 > 1} is simplified to @code{x > 0}. 5741 5742@item -Wstrict-overflow=4 5743Also warn about other simplifications not covered by the above cases. 5744For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 5745 5746@item -Wstrict-overflow=5 5747Also warn about cases where the compiler reduces the magnitude of a 5748constant involved in a comparison. For example: @code{x + 2 > y} is 5749simplified to @code{x + 1 >= y}. This is reported only at the 5750highest warning level because this simplification applies to many 5751comparisons, so this warning level gives a very large number of 5752false positives. 5753@end table 5754 5755@item -Wstringop-overflow 5756@itemx -Wstringop-overflow=@var{type} 5757@opindex Wstringop-overflow 5758@opindex Wno-stringop-overflow 5759Warn for calls to string manipulation functions such as @code{memcpy} and 5760@code{strcpy} that are determined to overflow the destination buffer. The 5761optional argument is one greater than the type of Object Size Checking to 5762perform to determine the size of the destination. @xref{Object Size Checking}. 5763The argument is meaningful only for functions that operate on character arrays 5764but not for raw memory functions like @code{memcpy} which always make use 5765of Object Size type-0. The option also warns for calls that specify a size 5766in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes. 5767The option produces the best results with optimization enabled but can detect 5768a small subset of simple buffer overflows even without optimization in 5769calls to the GCC built-in functions like @code{__builtin_memcpy} that 5770correspond to the standard functions. In any case, the option warns about 5771just a subset of buffer overflows detected by the corresponding overflow 5772checking built-ins. For example, the option will issue a warning for 5773the @code{strcpy} call below because it copies at least 5 characters 5774(the string @code{"blue"} including the terminating NUL) into the buffer 5775of size 4. 5776 5777@smallexample 5778enum Color @{ blue, purple, yellow @}; 5779const char* f (enum Color clr) 5780@{ 5781 static char buf [4]; 5782 const char *str; 5783 switch (clr) 5784 @{ 5785 case blue: str = "blue"; break; 5786 case purple: str = "purple"; break; 5787 case yellow: str = "yellow"; break; 5788 @} 5789 5790 return strcpy (buf, str); // warning here 5791@} 5792@end smallexample 5793 5794Option @option{-Wstringop-overflow=2} is enabled by default. 5795 5796@table @gcctabopt 5797@item -Wstringop-overflow 5798@itemx -Wstringop-overflow=1 5799@opindex Wstringop-overflow 5800@opindex Wno-stringop-overflow 5801The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking 5802to determine the sizes of destination objects. This is the default setting 5803of the option. At this setting the option will not warn for writes past 5804the end of subobjects of larger objects accessed by pointers unless the 5805size of the largest surrounding object is known. When the destination may 5806be one of several objects it is assumed to be the largest one of them. On 5807Linux systems, when optimization is enabled at this setting the option warns 5808for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to 5809a non-zero value. 5810 5811@item -Wstringop-overflow=2 5812The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking 5813to determine the sizes of destination objects. At this setting the option 5814will warn about overflows when writing to members of the largest complete 5815objects whose exact size is known. It will, however, not warn for excessive 5816writes to the same members of unknown objects referenced by pointers since 5817they may point to arrays containing unknown numbers of elements. 5818 5819@item -Wstringop-overflow=3 5820The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking 5821to determine the sizes of destination objects. At this setting the option 5822warns about overflowing the smallest object or data member. This is the 5823most restrictive setting of the option that may result in warnings for safe 5824code. 5825 5826@item -Wstringop-overflow=4 5827The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking 5828to determine the sizes of destination objects. At this setting the option 5829will warn about overflowing any data members, and when the destination is 5830one of several objects it uses the size of the largest of them to decide 5831whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this 5832setting of the option may result in warnings for benign code. 5833@end table 5834 5835@item -Wstringop-truncation 5836@opindex Wstringop-truncation 5837@opindex Wno-stringop-truncation 5838Warn for calls to bounded string manipulation functions such as @code{strncat}, 5839@code{strncpy}, and @code{stpncpy} that may either truncate the copied string 5840or leave the destination unchanged. 5841 5842In the following example, the call to @code{strncat} specifies a bound that 5843is less than the length of the source string. As a result, the copy of 5844the source will be truncated and so the call is diagnosed. To avoid the 5845warning use @code{bufsize - strlen (buf) - 1)} as the bound. 5846 5847@smallexample 5848void append (char *buf, size_t bufsize) 5849@{ 5850 strncat (buf, ".txt", 3); 5851@} 5852@end smallexample 5853 5854As another example, the following call to @code{strncpy} results in copying 5855to @code{d} just the characters preceding the terminating NUL, without 5856appending the NUL to the end. Assuming the result of @code{strncpy} is 5857necessarily a NUL-terminated string is a common mistake, and so the call 5858is diagnosed. To avoid the warning when the result is not expected to be 5859NUL-terminated, call @code{memcpy} instead. 5860 5861@smallexample 5862void copy (char *d, const char *s) 5863@{ 5864 strncpy (d, s, strlen (s)); 5865@} 5866@end smallexample 5867 5868In the following example, the call to @code{strncpy} specifies the size 5869of the destination buffer as the bound. If the length of the source 5870string is equal to or greater than this size the result of the copy will 5871not be NUL-terminated. Therefore, the call is also diagnosed. To avoid 5872the warning, specify @code{sizeof buf - 1} as the bound and set the last 5873element of the buffer to @code{NUL}. 5874 5875@smallexample 5876void copy (const char *s) 5877@{ 5878 char buf[80]; 5879 strncpy (buf, s, sizeof buf); 5880 @dots{} 5881@} 5882@end smallexample 5883 5884In situations where a character array is intended to store a sequence 5885of bytes with no terminating @code{NUL} such an array may be annotated 5886with attribute @code{nonstring} to avoid this warning. Such arrays, 5887however, are not suitable arguments to functions that expect 5888@code{NUL}-terminated strings. To help detect accidental misuses of 5889such arrays GCC issues warnings unless it can prove that the use is 5890safe. @xref{Common Variable Attributes}. 5891 5892@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]} 5893@opindex Wsuggest-attribute= 5894@opindex Wno-suggest-attribute= 5895Warn for cases where adding an attribute may be beneficial. The 5896attributes currently supported are listed below. 5897 5898@table @gcctabopt 5899@item -Wsuggest-attribute=pure 5900@itemx -Wsuggest-attribute=const 5901@itemx -Wsuggest-attribute=noreturn 5902@itemx -Wmissing-noreturn 5903@itemx -Wsuggest-attribute=malloc 5904@opindex Wsuggest-attribute=pure 5905@opindex Wno-suggest-attribute=pure 5906@opindex Wsuggest-attribute=const 5907@opindex Wno-suggest-attribute=const 5908@opindex Wsuggest-attribute=noreturn 5909@opindex Wno-suggest-attribute=noreturn 5910@opindex Wmissing-noreturn 5911@opindex Wno-missing-noreturn 5912@opindex Wsuggest-attribute=malloc 5913@opindex Wno-suggest-attribute=malloc 5914 5915Warn about functions that might be candidates for attributes 5916@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler 5917only warns for functions visible in other compilation units or (in the case of 5918@code{pure} and @code{const}) if it cannot prove that the function returns 5919normally. A function returns normally if it doesn't contain an infinite loop or 5920return abnormally by throwing, calling @code{abort} or trapping. This analysis 5921requires option @option{-fipa-pure-const}, which is enabled by default at 5922@option{-O} and higher. Higher optimization levels improve the accuracy 5923of the analysis. 5924 5925@item -Wsuggest-attribute=format 5926@itemx -Wmissing-format-attribute 5927@opindex Wsuggest-attribute=format 5928@opindex Wmissing-format-attribute 5929@opindex Wno-suggest-attribute=format 5930@opindex Wno-missing-format-attribute 5931@opindex Wformat 5932@opindex Wno-format 5933 5934Warn about function pointers that might be candidates for @code{format} 5935attributes. Note these are only possible candidates, not absolute ones. 5936GCC guesses that function pointers with @code{format} attributes that 5937are used in assignment, initialization, parameter passing or return 5938statements should have a corresponding @code{format} attribute in the 5939resulting type. I.e.@: the left-hand side of the assignment or 5940initialization, the type of the parameter variable, or the return type 5941of the containing function respectively should also have a @code{format} 5942attribute to avoid the warning. 5943 5944GCC also warns about function definitions that might be 5945candidates for @code{format} attributes. Again, these are only 5946possible candidates. GCC guesses that @code{format} attributes 5947might be appropriate for any function that calls a function like 5948@code{vprintf} or @code{vscanf}, but this might not always be the 5949case, and some functions for which @code{format} attributes are 5950appropriate may not be detected. 5951 5952@item -Wsuggest-attribute=cold 5953@opindex Wsuggest-attribute=cold 5954@opindex Wno-suggest-attribute=cold 5955 5956Warn about functions that might be candidates for @code{cold} attribute. This 5957is based on static detection and generally will only warn about functions which 5958always leads to a call to another @code{cold} function such as wrappers of 5959C++ @code{throw} or fatal error reporting functions leading to @code{abort}. 5960@end table 5961 5962@item -Wsuggest-final-types 5963@opindex Wno-suggest-final-types 5964@opindex Wsuggest-final-types 5965Warn about types with virtual methods where code quality would be improved 5966if the type were declared with the C++11 @code{final} specifier, 5967or, if possible, 5968declared in an anonymous namespace. This allows GCC to more aggressively 5969devirtualize the polymorphic calls. This warning is more effective with link 5970time optimization, where the information about the class hierarchy graph is 5971more complete. 5972 5973@item -Wsuggest-final-methods 5974@opindex Wno-suggest-final-methods 5975@opindex Wsuggest-final-methods 5976Warn about virtual methods where code quality would be improved if the method 5977were declared with the C++11 @code{final} specifier, 5978or, if possible, its type were 5979declared in an anonymous namespace or with the @code{final} specifier. 5980This warning is 5981more effective with link-time optimization, where the information about the 5982class hierarchy graph is more complete. It is recommended to first consider 5983suggestions of @option{-Wsuggest-final-types} and then rebuild with new 5984annotations. 5985 5986@item -Wsuggest-override 5987Warn about overriding virtual functions that are not marked with the override 5988keyword. 5989 5990@item -Walloc-zero 5991@opindex Wno-alloc-zero 5992@opindex Walloc-zero 5993Warn about calls to allocation functions decorated with attribute 5994@code{alloc_size} that specify zero bytes, including those to the built-in 5995forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc}, 5996@code{malloc}, and @code{realloc}. Because the behavior of these functions 5997when called with a zero size differs among implementations (and in the case 5998of @code{realloc} has been deprecated) relying on it may result in subtle 5999portability bugs and should be avoided. 6000 6001@item -Walloc-size-larger-than=@var{byte-size} 6002@opindex Walloc-size-larger-than= 6003@opindex Wno-alloc-size-larger-than 6004Warn about calls to functions decorated with attribute @code{alloc_size} 6005that attempt to allocate objects larger than the specified number of bytes, 6006or where the result of the size computation in an integer type with infinite 6007precision would exceed the value of @samp{PTRDIFF_MAX} on the target. 6008@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 6009Warnings controlled by the option can be disabled either by specifying 6010@var{byte-size} of @samp{SIZE_MAX} or more or by 6011@option{-Wno-alloc-size-larger-than}. 6012@xref{Function Attributes}. 6013 6014@item -Wno-alloc-size-larger-than 6015@opindex Wno-alloc-size-larger-than 6016Disable @option{-Walloc-size-larger-than=} warnings. The option is 6017equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or 6018larger. 6019 6020@item -Walloca 6021@opindex Wno-alloca 6022@opindex Walloca 6023This option warns on all uses of @code{alloca} in the source. 6024 6025@item -Walloca-larger-than=@var{byte-size} 6026@opindex Walloca-larger-than= 6027@opindex Wno-alloca-larger-than 6028This option warns on calls to @code{alloca} with an integer argument whose 6029value is either zero, or that is not bounded by a controlling predicate 6030that limits its value to at most @var{byte-size}. It also warns for calls 6031to @code{alloca} where the bound value is unknown. Arguments of non-integer 6032types are considered unbounded even if they appear to be constrained to 6033the expected range. 6034 6035For example, a bounded case of @code{alloca} could be: 6036 6037@smallexample 6038void func (size_t n) 6039@{ 6040 void *p; 6041 if (n <= 1000) 6042 p = alloca (n); 6043 else 6044 p = malloc (n); 6045 f (p); 6046@} 6047@end smallexample 6048 6049In the above example, passing @code{-Walloca-larger-than=1000} would not 6050issue a warning because the call to @code{alloca} is known to be at most 60511000 bytes. However, if @code{-Walloca-larger-than=500} were passed, 6052the compiler would emit a warning. 6053 6054Unbounded uses, on the other hand, are uses of @code{alloca} with no 6055controlling predicate constraining its integer argument. For example: 6056 6057@smallexample 6058void func () 6059@{ 6060 void *p = alloca (n); 6061 f (p); 6062@} 6063@end smallexample 6064 6065If @code{-Walloca-larger-than=500} were passed, the above would trigger 6066a warning, but this time because of the lack of bounds checking. 6067 6068Note, that even seemingly correct code involving signed integers could 6069cause a warning: 6070 6071@smallexample 6072void func (signed int n) 6073@{ 6074 if (n < 500) 6075 @{ 6076 p = alloca (n); 6077 f (p); 6078 @} 6079@} 6080@end smallexample 6081 6082In the above example, @var{n} could be negative, causing a larger than 6083expected argument to be implicitly cast into the @code{alloca} call. 6084 6085This option also warns when @code{alloca} is used in a loop. 6086 6087@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default 6088but is usually only effective when @option{-ftree-vrp} is active (default 6089for @option{-O2} and above). 6090 6091See also @option{-Wvla-larger-than=}@samp{byte-size}. 6092 6093@item -Wno-alloca-larger-than 6094@opindex Wno-alloca-larger-than 6095Disable @option{-Walloca-larger-than=} warnings. The option is 6096equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger. 6097 6098@item -Warray-bounds 6099@itemx -Warray-bounds=@var{n} 6100@opindex Wno-array-bounds 6101@opindex Warray-bounds 6102This option is only active when @option{-ftree-vrp} is active 6103(default for @option{-O2} and above). It warns about subscripts to arrays 6104that are always out of bounds. This warning is enabled by @option{-Wall}. 6105 6106@table @gcctabopt 6107@item -Warray-bounds=1 6108This is the warning level of @option{-Warray-bounds} and is enabled 6109by @option{-Wall}; higher levels are not, and must be explicitly requested. 6110 6111@item -Warray-bounds=2 6112This warning level also warns about out of bounds access for 6113arrays at the end of a struct and for arrays accessed through 6114pointers. This warning level may give a larger number of 6115false positives and is deactivated by default. 6116@end table 6117 6118@item -Wattribute-alias=@var{n} 6119@itemx -Wno-attribute-alias 6120@opindex -Wattribute-alias 6121@opindex -Wno-attribute-alias 6122Warn about declarations using the @code{alias} and similar attributes whose 6123target is incompatible with the type of the alias. 6124@xref{Function Attributes,,Declaring Attributes of Functions}. 6125 6126@table @gcctabopt 6127@item -Wattribute-alias=1 6128The default warning level of the @option{-Wattribute-alias} option diagnoses 6129incompatibilities between the type of the alias declaration and that of its 6130target. Such incompatibilities are typically indicative of bugs. 6131 6132@item -Wattribute-alias=2 6133 6134At this level @option{-Wattribute-alias} also diagnoses cases where 6135the attributes of the alias declaration are more restrictive than the 6136attributes applied to its target. These mismatches can potentially 6137result in incorrect code generation. In other cases they may be 6138benign and could be resolved simply by adding the missing attribute to 6139the target. For comparison, see the @option{-Wmissing-attributes} 6140option, which controls diagnostics when the alias declaration is less 6141restrictive than the target, rather than more restrictive. 6142 6143Attributes considered include @code{alloc_align}, @code{alloc_size}, 6144@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 6145@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 6146@code{returns_nonnull}, and @code{returns_twice}. 6147@end table 6148 6149@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}. 6150This is the default. You can disable these warnings with either 6151@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}. 6152 6153@item -Wbool-compare 6154@opindex Wno-bool-compare 6155@opindex Wbool-compare 6156Warn about boolean expression compared with an integer value different from 6157@code{true}/@code{false}. For instance, the following comparison is 6158always false: 6159@smallexample 6160int n = 5; 6161@dots{} 6162if ((n > 1) == 2) @{ @dots{} @} 6163@end smallexample 6164This warning is enabled by @option{-Wall}. 6165 6166@item -Wbool-operation 6167@opindex Wno-bool-operation 6168@opindex Wbool-operation 6169Warn about suspicious operations on expressions of a boolean type. For 6170instance, bitwise negation of a boolean is very likely a bug in the program. 6171For C, this warning also warns about incrementing or decrementing a boolean, 6172which rarely makes sense. (In C++, decrementing a boolean is always invalid. 6173Incrementing a boolean is invalid in C++17, and deprecated otherwise.) 6174 6175This warning is enabled by @option{-Wall}. 6176 6177@item -Wduplicated-branches 6178@opindex Wno-duplicated-branches 6179@opindex Wduplicated-branches 6180Warn when an if-else has identical branches. This warning detects cases like 6181@smallexample 6182if (p != NULL) 6183 return 0; 6184else 6185 return 0; 6186@end smallexample 6187It doesn't warn when both branches contain just a null statement. This warning 6188also warn for conditional operators: 6189@smallexample 6190 int i = x ? *p : *p; 6191@end smallexample 6192 6193@item -Wduplicated-cond 6194@opindex Wno-duplicated-cond 6195@opindex Wduplicated-cond 6196Warn about duplicated conditions in an if-else-if chain. For instance, 6197warn for the following code: 6198@smallexample 6199if (p->q != NULL) @{ @dots{} @} 6200else if (p->q != NULL) @{ @dots{} @} 6201@end smallexample 6202 6203@item -Wframe-address 6204@opindex Wno-frame-address 6205@opindex Wframe-address 6206Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address} 6207is called with an argument greater than 0. Such calls may return indeterminate 6208values or crash the program. The warning is included in @option{-Wall}. 6209 6210@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 6211@opindex Wno-discarded-qualifiers 6212@opindex Wdiscarded-qualifiers 6213Do not warn if type qualifiers on pointers are being discarded. 6214Typically, the compiler warns if a @code{const char *} variable is 6215passed to a function that takes a @code{char *} parameter. This option 6216can be used to suppress such a warning. 6217 6218@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 6219@opindex Wno-discarded-array-qualifiers 6220@opindex Wdiscarded-array-qualifiers 6221Do not warn if type qualifiers on arrays which are pointer targets 6222are being discarded. Typically, the compiler warns if a 6223@code{const int (*)[]} variable is passed to a function that 6224takes a @code{int (*)[]} parameter. This option can be used to 6225suppress such a warning. 6226 6227@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 6228@opindex Wno-incompatible-pointer-types 6229@opindex Wincompatible-pointer-types 6230Do not warn when there is a conversion between pointers that have incompatible 6231types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 6232which warns for pointer argument passing or assignment with different 6233signedness. 6234 6235@item -Wno-int-conversion @r{(C and Objective-C only)} 6236@opindex Wno-int-conversion 6237@opindex Wint-conversion 6238Do not warn about incompatible integer to pointer and pointer to integer 6239conversions. This warning is about implicit conversions; for explicit 6240conversions the warnings @option{-Wno-int-to-pointer-cast} and 6241@option{-Wno-pointer-to-int-cast} may be used. 6242 6243@item -Wno-div-by-zero 6244@opindex Wno-div-by-zero 6245@opindex Wdiv-by-zero 6246Do not warn about compile-time integer division by zero. Floating-point 6247division by zero is not warned about, as it can be a legitimate way of 6248obtaining infinities and NaNs. 6249 6250@item -Wsystem-headers 6251@opindex Wsystem-headers 6252@opindex Wno-system-headers 6253@cindex warnings from system headers 6254@cindex system headers, warnings from 6255Print warning messages for constructs found in system header files. 6256Warnings from system headers are normally suppressed, on the assumption 6257that they usually do not indicate real problems and would only make the 6258compiler output harder to read. Using this command-line option tells 6259GCC to emit warnings from system headers as if they occurred in user 6260code. However, note that using @option{-Wall} in conjunction with this 6261option does @emph{not} warn about unknown pragmas in system 6262headers---for that, @option{-Wunknown-pragmas} must also be used. 6263 6264@item -Wtautological-compare 6265@opindex Wtautological-compare 6266@opindex Wno-tautological-compare 6267Warn if a self-comparison always evaluates to true or false. This 6268warning detects various mistakes such as: 6269@smallexample 6270int i = 1; 6271@dots{} 6272if (i > i) @{ @dots{} @} 6273@end smallexample 6274 6275This warning also warns about bitwise comparisons that always evaluate 6276to true or false, for instance: 6277@smallexample 6278if ((a & 16) == 10) @{ @dots{} @} 6279@end smallexample 6280will always be false. 6281 6282This warning is enabled by @option{-Wall}. 6283 6284@item -Wtrampolines 6285@opindex Wtrampolines 6286@opindex Wno-trampolines 6287Warn about trampolines generated for pointers to nested functions. 6288A trampoline is a small piece of data or code that is created at run 6289time on the stack when the address of a nested function is taken, and is 6290used to call the nested function indirectly. For some targets, it is 6291made up of data only and thus requires no special treatment. But, for 6292most targets, it is made up of code and thus requires the stack to be 6293made executable in order for the program to work properly. 6294 6295@item -Wfloat-equal 6296@opindex Wfloat-equal 6297@opindex Wno-float-equal 6298Warn if floating-point values are used in equality comparisons. 6299 6300The idea behind this is that sometimes it is convenient (for the 6301programmer) to consider floating-point values as approximations to 6302infinitely precise real numbers. If you are doing this, then you need 6303to compute (by analyzing the code, or in some other way) the maximum or 6304likely maximum error that the computation introduces, and allow for it 6305when performing comparisons (and when producing output, but that's a 6306different problem). In particular, instead of testing for equality, you 6307should check to see whether the two values have ranges that overlap; and 6308this is done with the relational operators, so equality comparisons are 6309probably mistaken. 6310 6311@item -Wtraditional @r{(C and Objective-C only)} 6312@opindex Wtraditional 6313@opindex Wno-traditional 6314Warn about certain constructs that behave differently in traditional and 6315ISO C@. Also warn about ISO C constructs that have no traditional C 6316equivalent, and/or problematic constructs that should be avoided. 6317 6318@itemize @bullet 6319@item 6320Macro parameters that appear within string literals in the macro body. 6321In traditional C macro replacement takes place within string literals, 6322but in ISO C it does not. 6323 6324@item 6325In traditional C, some preprocessor directives did not exist. 6326Traditional preprocessors only considered a line to be a directive 6327if the @samp{#} appeared in column 1 on the line. Therefore 6328@option{-Wtraditional} warns about directives that traditional C 6329understands but ignores because the @samp{#} does not appear as the 6330first character on the line. It also suggests you hide directives like 6331@code{#pragma} not understood by traditional C by indenting them. Some 6332traditional implementations do not recognize @code{#elif}, so this option 6333suggests avoiding it altogether. 6334 6335@item 6336A function-like macro that appears without arguments. 6337 6338@item 6339The unary plus operator. 6340 6341@item 6342The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 6343constant suffixes. (Traditional C does support the @samp{L} suffix on integer 6344constants.) Note, these suffixes appear in macros defined in the system 6345headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 6346Use of these macros in user code might normally lead to spurious 6347warnings, however GCC's integrated preprocessor has enough context to 6348avoid warning in these cases. 6349 6350@item 6351A function declared external in one block and then used after the end of 6352the block. 6353 6354@item 6355A @code{switch} statement has an operand of type @code{long}. 6356 6357@item 6358A non-@code{static} function declaration follows a @code{static} one. 6359This construct is not accepted by some traditional C compilers. 6360 6361@item 6362The ISO type of an integer constant has a different width or 6363signedness from its traditional type. This warning is only issued if 6364the base of the constant is ten. I.e.@: hexadecimal or octal values, which 6365typically represent bit patterns, are not warned about. 6366 6367@item 6368Usage of ISO string concatenation is detected. 6369 6370@item 6371Initialization of automatic aggregates. 6372 6373@item 6374Identifier conflicts with labels. Traditional C lacks a separate 6375namespace for labels. 6376 6377@item 6378Initialization of unions. If the initializer is zero, the warning is 6379omitted. This is done under the assumption that the zero initializer in 6380user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 6381initializer warnings and relies on default initialization to zero in the 6382traditional C case. 6383 6384@item 6385Conversions by prototypes between fixed/floating-point values and vice 6386versa. The absence of these prototypes when compiling with traditional 6387C causes serious problems. This is a subset of the possible 6388conversion warnings; for the full set use @option{-Wtraditional-conversion}. 6389 6390@item 6391Use of ISO C style function definitions. This warning intentionally is 6392@emph{not} issued for prototype declarations or variadic functions 6393because these ISO C features appear in your code when using 6394libiberty's traditional C compatibility macros, @code{PARAMS} and 6395@code{VPARAMS}. This warning is also bypassed for nested functions 6396because that feature is already a GCC extension and thus not relevant to 6397traditional C compatibility. 6398@end itemize 6399 6400@item -Wtraditional-conversion @r{(C and Objective-C only)} 6401@opindex Wtraditional-conversion 6402@opindex Wno-traditional-conversion 6403Warn if a prototype causes a type conversion that is different from what 6404would happen to the same argument in the absence of a prototype. This 6405includes conversions of fixed point to floating and vice versa, and 6406conversions changing the width or signedness of a fixed-point argument 6407except when the same as the default promotion. 6408 6409@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 6410@opindex Wdeclaration-after-statement 6411@opindex Wno-declaration-after-statement 6412Warn when a declaration is found after a statement in a block. This 6413construct, known from C++, was introduced with ISO C99 and is by default 6414allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}. 6415 6416@item -Wshadow 6417@opindex Wshadow 6418@opindex Wno-shadow 6419Warn whenever a local variable or type declaration shadows another 6420variable, parameter, type, class member (in C++), or instance variable 6421(in Objective-C) or whenever a built-in function is shadowed. Note 6422that in C++, the compiler warns if a local variable shadows an 6423explicit typedef, but not if it shadows a struct/class/enum. 6424Same as @option{-Wshadow=global}. 6425 6426@item -Wno-shadow-ivar @r{(Objective-C only)} 6427@opindex Wno-shadow-ivar 6428@opindex Wshadow-ivar 6429Do not warn whenever a local variable shadows an instance variable in an 6430Objective-C method. 6431 6432@item -Wshadow=global 6433@opindex Wshadow=local 6434The default for @option{-Wshadow}. Warns for any (global) shadowing. 6435 6436@item -Wshadow=local 6437@opindex Wshadow=local 6438Warn when a local variable shadows another local variable or parameter. 6439This warning is enabled by @option{-Wshadow=global}. 6440 6441@item -Wshadow=compatible-local 6442@opindex Wshadow=compatible-local 6443Warn when a local variable shadows another local variable or parameter 6444whose type is compatible with that of the shadowing variable. In C++, 6445type compatibility here means the type of the shadowing variable can be 6446converted to that of the shadowed variable. The creation of this flag 6447(in addition to @option{-Wshadow=local}) is based on the idea that when 6448a local variable shadows another one of incompatible type, it is most 6449likely intentional, not a bug or typo, as shown in the following example: 6450 6451@smallexample 6452@group 6453for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) 6454@{ 6455 for (int i = 0; i < N; ++i) 6456 @{ 6457 ... 6458 @} 6459 ... 6460@} 6461@end group 6462@end smallexample 6463 6464Since the two variable @code{i} in the example above have incompatible types, 6465enabling only @option{-Wshadow=compatible-local} will not emit a warning. 6466Because their types are incompatible, if a programmer accidentally uses one 6467in place of the other, type checking will catch that and emit an error or 6468warning. So not warning (about shadowing) in this case will not lead to 6469undetected bugs. Use of this flag instead of @option{-Wshadow=local} can 6470possibly reduce the number of warnings triggered by intentional shadowing. 6471 6472This warning is enabled by @option{-Wshadow=local}. 6473 6474@item -Wlarger-than=@var{byte-size} 6475@opindex Wlarger-than= 6476@opindex Wlarger-than-@var{byte-size} 6477Warn whenever an object is defined whose size exceeds @var{byte-size}. 6478@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default. 6479Warnings controlled by the option can be disabled either by specifying 6480@var{byte-size} of @samp{SIZE_MAX} or more or by 6481@option{-Wno-larger-than}. 6482 6483@item -Wno-larger-than 6484@opindex Wno-larger-than 6485Disable @option{-Wlarger-than=} warnings. The option is equivalent 6486to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger. 6487 6488@item -Wframe-larger-than=@var{byte-size} 6489@opindex Wframe-larger-than= 6490@opindex Wno-frame-larger-than 6491Warn if the size of a function frame exceeds @var{byte-size}. 6492The computation done to determine the stack frame size is approximate 6493and not conservative. 6494The actual requirements may be somewhat greater than @var{byte-size} 6495even if you do not get a warning. In addition, any space allocated 6496via @code{alloca}, variable-length arrays, or related constructs 6497is not included by the compiler when determining 6498whether or not to issue a warning. 6499@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 6500Warnings controlled by the option can be disabled either by specifying 6501@var{byte-size} of @samp{SIZE_MAX} or more or by 6502@option{-Wno-frame-larger-than}. 6503 6504@item -Wno-frame-larger-than 6505@opindex Wno-frame-larger-than 6506Disable @option{-Wframe-larger-than=} warnings. The option is equivalent 6507to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger. 6508 6509@item -Wno-free-nonheap-object 6510@opindex Wno-free-nonheap-object 6511@opindex Wfree-nonheap-object 6512Do not warn when attempting to free an object that was not allocated 6513on the heap. 6514 6515@item -Wstack-usage=@var{byte-size} 6516@opindex Wstack-usage 6517@opindex Wno-stack-usage 6518Warn if the stack usage of a function might exceed @var{byte-size}. 6519The computation done to determine the stack usage is conservative. 6520Any space allocated via @code{alloca}, variable-length arrays, or related 6521constructs is included by the compiler when determining whether or not to 6522issue a warning. 6523 6524The message is in keeping with the output of @option{-fstack-usage}. 6525 6526@itemize 6527@item 6528If the stack usage is fully static but exceeds the specified amount, it's: 6529 6530@smallexample 6531 warning: stack usage is 1120 bytes 6532@end smallexample 6533@item 6534If the stack usage is (partly) dynamic but bounded, it's: 6535 6536@smallexample 6537 warning: stack usage might be 1648 bytes 6538@end smallexample 6539@item 6540If the stack usage is (partly) dynamic and not bounded, it's: 6541 6542@smallexample 6543 warning: stack usage might be unbounded 6544@end smallexample 6545@end itemize 6546 6547@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default. 6548Warnings controlled by the option can be disabled either by specifying 6549@var{byte-size} of @samp{SIZE_MAX} or more or by 6550@option{-Wno-stack-usage}. 6551 6552@item -Wno-stack-usage 6553@opindex Wno-stack-usage 6554Disable @option{-Wstack-usage=} warnings. The option is equivalent 6555to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger. 6556 6557@item -Wunsafe-loop-optimizations 6558@opindex Wunsafe-loop-optimizations 6559@opindex Wno-unsafe-loop-optimizations 6560Warn if the loop cannot be optimized because the compiler cannot 6561assume anything on the bounds of the loop indices. With 6562@option{-funsafe-loop-optimizations} warn if the compiler makes 6563such assumptions. 6564 6565@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 6566@opindex Wno-pedantic-ms-format 6567@opindex Wpedantic-ms-format 6568When used in combination with @option{-Wformat} 6569and @option{-pedantic} without GNU extensions, this option 6570disables the warnings about non-ISO @code{printf} / @code{scanf} format 6571width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 6572which depend on the MS runtime. 6573 6574@item -Waligned-new 6575@opindex Waligned-new 6576@opindex Wno-aligned-new 6577Warn about a new-expression of a type that requires greater alignment 6578than the @code{alignof(std::max_align_t)} but uses an allocation 6579function without an explicit alignment parameter. This option is 6580enabled by @option{-Wall}. 6581 6582Normally this only warns about global allocation functions, but 6583@option{-Waligned-new=all} also warns about class member allocation 6584functions. 6585 6586@item -Wplacement-new 6587@itemx -Wplacement-new=@var{n} 6588@opindex Wplacement-new 6589@opindex Wno-placement-new 6590Warn about placement new expressions with undefined behavior, such as 6591constructing an object in a buffer that is smaller than the type of 6592the object. For example, the placement new expression below is diagnosed 6593because it attempts to construct an array of 64 integers in a buffer only 659464 bytes large. 6595@smallexample 6596char buf [64]; 6597new (buf) int[64]; 6598@end smallexample 6599This warning is enabled by default. 6600 6601@table @gcctabopt 6602@item -Wplacement-new=1 6603This is the default warning level of @option{-Wplacement-new}. At this 6604level the warning is not issued for some strictly undefined constructs that 6605GCC allows as extensions for compatibility with legacy code. For example, 6606the following @code{new} expression is not diagnosed at this level even 6607though it has undefined behavior according to the C++ standard because 6608it writes past the end of the one-element array. 6609@smallexample 6610struct S @{ int n, a[1]; @}; 6611S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]); 6612new (s->a)int [32](); 6613@end smallexample 6614 6615@item -Wplacement-new=2 6616At this level, in addition to diagnosing all the same constructs as at level 66171, a diagnostic is also issued for placement new expressions that construct 6618an object in the last member of structure whose type is an array of a single 6619element and whose size is less than the size of the object being constructed. 6620While the previous example would be diagnosed, the following construct makes 6621use of the flexible member array extension to avoid the warning at level 2. 6622@smallexample 6623struct S @{ int n, a[]; @}; 6624S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]); 6625new (s->a)int [32](); 6626@end smallexample 6627 6628@end table 6629 6630@item -Wpointer-arith 6631@opindex Wpointer-arith 6632@opindex Wno-pointer-arith 6633Warn about anything that depends on the ``size of'' a function type or 6634of @code{void}. GNU C assigns these types a size of 1, for 6635convenience in calculations with @code{void *} pointers and pointers 6636to functions. In C++, warn also when an arithmetic operation involves 6637@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 6638 6639@item -Wpointer-compare 6640@opindex Wpointer-compare 6641@opindex Wno-pointer-compare 6642Warn if a pointer is compared with a zero character constant. This usually 6643means that the pointer was meant to be dereferenced. For example: 6644 6645@smallexample 6646const char *p = foo (); 6647if (p == '\0') 6648 return 42; 6649@end smallexample 6650 6651Note that the code above is invalid in C++11. 6652 6653This warning is enabled by default. 6654 6655@item -Wtype-limits 6656@opindex Wtype-limits 6657@opindex Wno-type-limits 6658Warn if a comparison is always true or always false due to the limited 6659range of the data type, but do not warn for constant expressions. For 6660example, warn if an unsigned variable is compared against zero with 6661@code{<} or @code{>=}. This warning is also enabled by 6662@option{-Wextra}. 6663 6664@item -Wabsolute-value @r{(C and Objective-C only)} 6665@opindex Wabsolute-value 6666@opindex Wno-absolute-value 6667Warn for calls to standard functions that compute the absolute value 6668of an argument when a more appropriate standard function is available. 6669For example, calling @code{abs(3.14)} triggers the warning because the 6670appropriate function to call to compute the absolute value of a double 6671argument is @code{fabs}. The option also triggers warnings when the 6672argument in a call to such a function has an unsigned type. This 6673warning can be suppressed with an explicit type cast and it is also 6674enabled by @option{-Wextra}. 6675 6676@include cppwarnopts.texi 6677 6678@item -Wbad-function-cast @r{(C and Objective-C only)} 6679@opindex Wbad-function-cast 6680@opindex Wno-bad-function-cast 6681Warn when a function call is cast to a non-matching type. 6682For example, warn if a call to a function returning an integer type 6683is cast to a pointer type. 6684 6685@item -Wc90-c99-compat @r{(C and Objective-C only)} 6686@opindex Wc90-c99-compat 6687@opindex Wno-c90-c99-compat 6688Warn about features not present in ISO C90, but present in ISO C99. 6689For instance, warn about use of variable length arrays, @code{long long} 6690type, @code{bool} type, compound literals, designated initializers, and so 6691on. This option is independent of the standards mode. Warnings are disabled 6692in the expression that follows @code{__extension__}. 6693 6694@item -Wc99-c11-compat @r{(C and Objective-C only)} 6695@opindex Wc99-c11-compat 6696@opindex Wno-c99-c11-compat 6697Warn about features not present in ISO C99, but present in ISO C11. 6698For instance, warn about use of anonymous structures and unions, 6699@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 6700@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 6701and so on. This option is independent of the standards mode. Warnings are 6702disabled in the expression that follows @code{__extension__}. 6703 6704@item -Wc11-c2x-compat @r{(C and Objective-C only)} 6705@opindex Wc11-c2x-compat 6706@opindex Wno-c11-c2x-compat 6707Warn about features not present in ISO C11, but present in ISO C2X. 6708For instance, warn about omitting the string in @code{_Static_assert}. 6709This option is independent of the standards mode. Warnings are 6710disabled in the expression that follows @code{__extension__}. 6711 6712@item -Wc++-compat @r{(C and Objective-C only)} 6713@opindex Wc++-compat 6714@opindex Wno-c++-compat 6715Warn about ISO C constructs that are outside of the common subset of 6716ISO C and ISO C++, e.g.@: request for implicit conversion from 6717@code{void *} to a pointer to non-@code{void} type. 6718 6719@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 6720@opindex Wc++11-compat 6721@opindex Wno-c++11-compat 6722Warn about C++ constructs whose meaning differs between ISO C++ 1998 6723and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 6724in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 6725enabled by @option{-Wall}. 6726 6727@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 6728@opindex Wc++14-compat 6729@opindex Wno-c++14-compat 6730Warn about C++ constructs whose meaning differs between ISO C++ 2011 6731and ISO C++ 2014. This warning is enabled by @option{-Wall}. 6732 6733@item -Wc++17-compat @r{(C++ and Objective-C++ only)} 6734@opindex Wc++17-compat 6735@opindex Wno-c++17-compat 6736Warn about C++ constructs whose meaning differs between ISO C++ 2014 6737and ISO C++ 2017. This warning is enabled by @option{-Wall}. 6738 6739@item -Wcast-qual 6740@opindex Wcast-qual 6741@opindex Wno-cast-qual 6742Warn whenever a pointer is cast so as to remove a type qualifier from 6743the target type. For example, warn if a @code{const char *} is cast 6744to an ordinary @code{char *}. 6745 6746Also warn when making a cast that introduces a type qualifier in an 6747unsafe way. For example, casting @code{char **} to @code{const char **} 6748is unsafe, as in this example: 6749 6750@smallexample 6751 /* p is char ** value. */ 6752 const char **q = (const char **) p; 6753 /* Assignment of readonly string to const char * is OK. */ 6754 *q = "string"; 6755 /* Now char** pointer points to read-only memory. */ 6756 **p = 'b'; 6757@end smallexample 6758 6759@item -Wcast-align 6760@opindex Wcast-align 6761@opindex Wno-cast-align 6762Warn whenever a pointer is cast such that the required alignment of the 6763target is increased. For example, warn if a @code{char *} is cast to 6764an @code{int *} on machines where integers can only be accessed at 6765two- or four-byte boundaries. 6766 6767@item -Wcast-align=strict 6768@opindex Wcast-align=strict 6769Warn whenever a pointer is cast such that the required alignment of the 6770target is increased. For example, warn if a @code{char *} is cast to 6771an @code{int *} regardless of the target machine. 6772 6773@item -Wcast-function-type 6774@opindex Wcast-function-type 6775@opindex Wno-cast-function-type 6776Warn when a function pointer is cast to an incompatible function pointer. 6777In a cast involving function types with a variable argument list only 6778the types of initial arguments that are provided are considered. 6779Any parameter of pointer-type matches any other pointer-type. Any benign 6780differences in integral types are ignored, like @code{int} vs.@: @code{long} 6781on ILP32 targets. Likewise type qualifiers are ignored. The function 6782type @code{void (*) (void)} is special and matches everything, which can 6783be used to suppress this warning. 6784In a cast involving pointer to member types this warning warns whenever 6785the type cast is changing the pointer to member type. 6786This warning is enabled by @option{-Wextra}. 6787 6788@item -Wwrite-strings 6789@opindex Wwrite-strings 6790@opindex Wno-write-strings 6791When compiling C, give string constants the type @code{const 6792char[@var{length}]} so that copying the address of one into a 6793non-@code{const} @code{char *} pointer produces a warning. These 6794warnings help you find at compile time code that can try to write 6795into a string constant, but only if you have been very careful about 6796using @code{const} in declarations and prototypes. Otherwise, it is 6797just a nuisance. This is why we did not make @option{-Wall} request 6798these warnings. 6799 6800When compiling C++, warn about the deprecated conversion from string 6801literals to @code{char *}. This warning is enabled by default for C++ 6802programs. 6803 6804@item -Wcatch-value 6805@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)} 6806@opindex Wcatch-value 6807@opindex Wno-catch-value 6808Warn about catch handlers that do not catch via reference. 6809With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short) 6810warn about polymorphic class types that are caught by value. 6811With @option{-Wcatch-value=2} warn about all class types that are caught 6812by value. With @option{-Wcatch-value=3} warn about all types that are 6813not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}. 6814 6815@item -Wclobbered 6816@opindex Wclobbered 6817@opindex Wno-clobbered 6818Warn for variables that might be changed by @code{longjmp} or 6819@code{vfork}. This warning is also enabled by @option{-Wextra}. 6820 6821@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 6822@opindex Wconditionally-supported 6823@opindex Wno-conditionally-supported 6824Warn for conditionally-supported (C++11 [intro.defs]) constructs. 6825 6826@item -Wconversion 6827@opindex Wconversion 6828@opindex Wno-conversion 6829Warn for implicit conversions that may alter a value. This includes 6830conversions between real and integer, like @code{abs (x)} when 6831@code{x} is @code{double}; conversions between signed and unsigned, 6832like @code{unsigned ui = -1}; and conversions to smaller types, like 6833@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 6834((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 6835changed by the conversion like in @code{abs (2.0)}. Warnings about 6836conversions between signed and unsigned integers can be disabled by 6837using @option{-Wno-sign-conversion}. 6838 6839For C++, also warn for confusing overload resolution for user-defined 6840conversions; and conversions that never use a type conversion 6841operator: conversions to @code{void}, the same type, a base class or a 6842reference to them. Warnings about conversions between signed and 6843unsigned integers are disabled by default in C++ unless 6844@option{-Wsign-conversion} is explicitly enabled. 6845 6846@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 6847@opindex Wconversion-null 6848@opindex Wno-conversion-null 6849Do not warn for conversions between @code{NULL} and non-pointer 6850types. @option{-Wconversion-null} is enabled by default. 6851 6852@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 6853@opindex Wzero-as-null-pointer-constant 6854@opindex Wno-zero-as-null-pointer-constant 6855Warn when a literal @samp{0} is used as null pointer constant. This can 6856be useful to facilitate the conversion to @code{nullptr} in C++11. 6857 6858@item -Wsubobject-linkage @r{(C++ and Objective-C++ only)} 6859@opindex Wsubobject-linkage 6860@opindex Wno-subobject-linkage 6861Warn if a class type has a base or a field whose type uses the anonymous 6862namespace or depends on a type with no linkage. If a type A depends on 6863a type B with no or internal linkage, defining it in multiple 6864translation units would be an ODR violation because the meaning of B 6865is different in each translation unit. If A only appears in a single 6866translation unit, the best way to silence the warning is to give it 6867internal linkage by putting it in an anonymous namespace as well. The 6868compiler doesn't give this warning for types defined in the main .C 6869file, as those are unlikely to have multiple definitions. 6870@option{-Wsubobject-linkage} is enabled by default. 6871 6872@item -Wdangling-else 6873@opindex Wdangling-else 6874@opindex Wno-dangling-else 6875Warn about constructions where there may be confusion to which 6876@code{if} statement an @code{else} branch belongs. Here is an example of 6877such a case: 6878 6879@smallexample 6880@group 6881@{ 6882 if (a) 6883 if (b) 6884 foo (); 6885 else 6886 bar (); 6887@} 6888@end group 6889@end smallexample 6890 6891In C/C++, every @code{else} branch belongs to the innermost possible 6892@code{if} statement, which in this example is @code{if (b)}. This is 6893often not what the programmer expected, as illustrated in the above 6894example by indentation the programmer chose. When there is the 6895potential for this confusion, GCC issues a warning when this flag 6896is specified. To eliminate the warning, add explicit braces around 6897the innermost @code{if} statement so there is no way the @code{else} 6898can belong to the enclosing @code{if}. The resulting code 6899looks like this: 6900 6901@smallexample 6902@group 6903@{ 6904 if (a) 6905 @{ 6906 if (b) 6907 foo (); 6908 else 6909 bar (); 6910 @} 6911@} 6912@end group 6913@end smallexample 6914 6915This warning is enabled by @option{-Wparentheses}. 6916 6917@item -Wdate-time 6918@opindex Wdate-time 6919@opindex Wno-date-time 6920Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 6921are encountered as they might prevent bit-wise-identical reproducible 6922compilations. 6923 6924@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)} 6925@opindex Wdelete-incomplete 6926@opindex Wno-delete-incomplete 6927Warn when deleting a pointer to incomplete type, which may cause 6928undefined behavior at runtime. This warning is enabled by default. 6929 6930@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 6931@opindex Wuseless-cast 6932@opindex Wno-useless-cast 6933Warn when an expression is casted to its own type. 6934 6935@item -Wempty-body 6936@opindex Wempty-body 6937@opindex Wno-empty-body 6938Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 6939while} statement. This warning is also enabled by @option{-Wextra}. 6940 6941@item -Wenum-compare 6942@opindex Wenum-compare 6943@opindex Wno-enum-compare 6944Warn about a comparison between values of different enumerated types. 6945In C++ enumerated type mismatches in conditional expressions are also 6946diagnosed and the warning is enabled by default. In C this warning is 6947enabled by @option{-Wall}. 6948 6949@item -Wextra-semi @r{(C++, Objective-C++ only)} 6950@opindex Wextra-semi 6951@opindex Wno-extra-semi 6952Warn about redundant semicolon after in-class function definition. 6953 6954@item -Wjump-misses-init @r{(C, Objective-C only)} 6955@opindex Wjump-misses-init 6956@opindex Wno-jump-misses-init 6957Warn if a @code{goto} statement or a @code{switch} statement jumps 6958forward across the initialization of a variable, or jumps backward to a 6959label after the variable has been initialized. This only warns about 6960variables that are initialized when they are declared. This warning is 6961only supported for C and Objective-C; in C++ this sort of branch is an 6962error in any case. 6963 6964@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 6965can be disabled with the @option{-Wno-jump-misses-init} option. 6966 6967@item -Wsign-compare 6968@opindex Wsign-compare 6969@opindex Wno-sign-compare 6970@cindex warning for comparison of signed and unsigned values 6971@cindex comparison of signed and unsigned values, warning 6972@cindex signed and unsigned values, comparison warning 6973Warn when a comparison between signed and unsigned values could produce 6974an incorrect result when the signed value is converted to unsigned. 6975In C++, this warning is also enabled by @option{-Wall}. In C, it is 6976also enabled by @option{-Wextra}. 6977 6978@item -Wsign-conversion 6979@opindex Wsign-conversion 6980@opindex Wno-sign-conversion 6981Warn for implicit conversions that may change the sign of an integer 6982value, like assigning a signed integer expression to an unsigned 6983integer variable. An explicit cast silences the warning. In C, this 6984option is enabled also by @option{-Wconversion}. 6985 6986@item -Wfloat-conversion 6987@opindex Wfloat-conversion 6988@opindex Wno-float-conversion 6989Warn for implicit conversions that reduce the precision of a real value. 6990This includes conversions from real to integer, and from higher precision 6991real to lower precision real values. This option is also enabled by 6992@option{-Wconversion}. 6993 6994@item -Wno-scalar-storage-order 6995@opindex Wno-scalar-storage-order 6996@opindex Wscalar-storage-order 6997Do not warn on suspicious constructs involving reverse scalar storage order. 6998 6999@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 7000@opindex Wsized-deallocation 7001@opindex Wno-sized-deallocation 7002Warn about a definition of an unsized deallocation function 7003@smallexample 7004void operator delete (void *) noexcept; 7005void operator delete[] (void *) noexcept; 7006@end smallexample 7007without a definition of the corresponding sized deallocation function 7008@smallexample 7009void operator delete (void *, std::size_t) noexcept; 7010void operator delete[] (void *, std::size_t) noexcept; 7011@end smallexample 7012or vice versa. Enabled by @option{-Wextra} along with 7013@option{-fsized-deallocation}. 7014 7015@item -Wsizeof-pointer-div 7016@opindex Wsizeof-pointer-div 7017@opindex Wno-sizeof-pointer-div 7018Warn for suspicious divisions of two sizeof expressions that divide 7019the pointer size by the element size, which is the usual way to compute 7020the array size but won't work out correctly with pointers. This warning 7021warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is 7022not an array, but a pointer. This warning is enabled by @option{-Wall}. 7023 7024@item -Wsizeof-pointer-memaccess 7025@opindex Wsizeof-pointer-memaccess 7026@opindex Wno-sizeof-pointer-memaccess 7027Warn for suspicious length parameters to certain string and memory built-in 7028functions if the argument uses @code{sizeof}. This warning triggers for 7029example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not 7030an array, but a pointer, and suggests a possible fix, or about 7031@code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess} 7032also warns about calls to bounded string copy functions like @code{strncat} 7033or @code{strncpy} that specify as the bound a @code{sizeof} expression of 7034the source array. For example, in the following function the call to 7035@code{strncat} specifies the size of the source string as the bound. That 7036is almost certainly a mistake and so the call is diagnosed. 7037@smallexample 7038void make_file (const char *name) 7039@{ 7040 char path[PATH_MAX]; 7041 strncpy (path, name, sizeof path - 1); 7042 strncat (path, ".text", sizeof ".text"); 7043 @dots{} 7044@} 7045@end smallexample 7046 7047The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}. 7048 7049@item -Wsizeof-array-argument 7050@opindex Wsizeof-array-argument 7051@opindex Wno-sizeof-array-argument 7052Warn when the @code{sizeof} operator is applied to a parameter that is 7053declared as an array in a function definition. This warning is enabled by 7054default for C and C++ programs. 7055 7056@item -Wmemset-elt-size 7057@opindex Wmemset-elt-size 7058@opindex Wno-memset-elt-size 7059Warn for suspicious calls to the @code{memset} built-in function, if the 7060first argument references an array, and the third argument is a number 7061equal to the number of elements, but not equal to the size of the array 7062in memory. This indicates that the user has omitted a multiplication by 7063the element size. This warning is enabled by @option{-Wall}. 7064 7065@item -Wmemset-transposed-args 7066@opindex Wmemset-transposed-args 7067@opindex Wno-memset-transposed-args 7068Warn for suspicious calls to the @code{memset} built-in function where 7069the second argument is not zero and the third argument is zero. For 7070example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because 7071@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic 7072is only emitted if the third argument is a literal zero. Otherwise, if 7073it is an expression that is folded to zero, or a cast of zero to some 7074type, it is far less likely that the arguments have been mistakenly 7075transposed and no warning is emitted. This warning is enabled 7076by @option{-Wall}. 7077 7078@item -Waddress 7079@opindex Waddress 7080@opindex Wno-address 7081Warn about suspicious uses of memory addresses. These include using 7082the address of a function in a conditional expression, such as 7083@code{void func(void); if (func)}, and comparisons against the memory 7084address of a string literal, such as @code{if (x == "abc")}. Such 7085uses typically indicate a programmer error: the address of a function 7086always evaluates to true, so their use in a conditional usually 7087indicate that the programmer forgot the parentheses in a function 7088call; and comparisons against string literals result in unspecified 7089behavior and are not portable in C, so they usually indicate that the 7090programmer intended to use @code{strcmp}. This warning is enabled by 7091@option{-Wall}. 7092 7093@item -Waddress-of-packed-member 7094@opindex Waddress-of-packed-member 7095@opindex Wno-address-of-packed-member 7096Warn when the address of packed member of struct or union is taken, 7097which usually results in an unaligned pointer value. This is 7098enabled by default. 7099 7100@item -Wlogical-op 7101@opindex Wlogical-op 7102@opindex Wno-logical-op 7103Warn about suspicious uses of logical operators in expressions. 7104This includes using logical operators in contexts where a 7105bit-wise operator is likely to be expected. Also warns when 7106the operands of a logical operator are the same: 7107@smallexample 7108extern int a; 7109if (a < 0 && a < 0) @{ @dots{} @} 7110@end smallexample 7111 7112@item -Wlogical-not-parentheses 7113@opindex Wlogical-not-parentheses 7114@opindex Wno-logical-not-parentheses 7115Warn about logical not used on the left hand side operand of a comparison. 7116This option does not warn if the right operand is considered to be a boolean 7117expression. Its purpose is to detect suspicious code like the following: 7118@smallexample 7119int a; 7120@dots{} 7121if (!a > 1) @{ @dots{} @} 7122@end smallexample 7123 7124It is possible to suppress the warning by wrapping the LHS into 7125parentheses: 7126@smallexample 7127if ((!a) > 1) @{ @dots{} @} 7128@end smallexample 7129 7130This warning is enabled by @option{-Wall}. 7131 7132@item -Waggregate-return 7133@opindex Waggregate-return 7134@opindex Wno-aggregate-return 7135Warn if any functions that return structures or unions are defined or 7136called. (In languages where you can return an array, this also elicits 7137a warning.) 7138 7139@item -Wno-aggressive-loop-optimizations 7140@opindex Wno-aggressive-loop-optimizations 7141@opindex Waggressive-loop-optimizations 7142Warn if in a loop with constant number of iterations the compiler detects 7143undefined behavior in some statement during one or more of the iterations. 7144 7145@item -Wno-attributes 7146@opindex Wno-attributes 7147@opindex Wattributes 7148Do not warn if an unexpected @code{__attribute__} is used, such as 7149unrecognized attributes, function attributes applied to variables, 7150etc. This does not stop errors for incorrect use of supported 7151attributes. 7152 7153@item -Wno-builtin-declaration-mismatch 7154@opindex Wno-builtin-declaration-mismatch 7155@opindex Wbuiltin-declaration-mismatch 7156Warn if a built-in function is declared with an incompatible signature 7157or as a non-function, or when a built-in function declared with a type 7158that does not include a prototype is called with arguments whose promoted 7159types do not match those expected by the function. When @option{-Wextra} 7160is specified, also warn when a built-in function that takes arguments is 7161declared without a prototype. The @option{-Wno-builtin-declaration-mismatch} 7162warning is enabled by default. To avoid the warning include the appropriate 7163header to bring the prototypes of built-in functions into scope. 7164 7165For example, the call to @code{memset} below is diagnosed by the warning 7166because the function expects a value of type @code{size_t} as its argument 7167but the type of @code{32} is @code{int}. With @option{-Wextra}, 7168the declaration of the function is diagnosed as well. 7169@smallexample 7170extern void* memset (); 7171void f (void *d) 7172@{ 7173 memset (d, '\0', 32); 7174@} 7175@end smallexample 7176 7177@item -Wno-builtin-macro-redefined 7178@opindex Wno-builtin-macro-redefined 7179@opindex Wbuiltin-macro-redefined 7180Do not warn if certain built-in macros are redefined. This suppresses 7181warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 7182@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 7183 7184@item -Wstrict-prototypes @r{(C and Objective-C only)} 7185@opindex Wstrict-prototypes 7186@opindex Wno-strict-prototypes 7187Warn if a function is declared or defined without specifying the 7188argument types. (An old-style function definition is permitted without 7189a warning if preceded by a declaration that specifies the argument 7190types.) 7191 7192@item -Wold-style-declaration @r{(C and Objective-C only)} 7193@opindex Wold-style-declaration 7194@opindex Wno-old-style-declaration 7195Warn for obsolescent usages, according to the C Standard, in a 7196declaration. For example, warn if storage-class specifiers like 7197@code{static} are not the first things in a declaration. This warning 7198is also enabled by @option{-Wextra}. 7199 7200@item -Wold-style-definition @r{(C and Objective-C only)} 7201@opindex Wold-style-definition 7202@opindex Wno-old-style-definition 7203Warn if an old-style function definition is used. A warning is given 7204even if there is a previous prototype. 7205 7206@item -Wmissing-parameter-type @r{(C and Objective-C only)} 7207@opindex Wmissing-parameter-type 7208@opindex Wno-missing-parameter-type 7209A function parameter is declared without a type specifier in K&R-style 7210functions: 7211 7212@smallexample 7213void foo(bar) @{ @} 7214@end smallexample 7215 7216This warning is also enabled by @option{-Wextra}. 7217 7218@item -Wmissing-prototypes @r{(C and Objective-C only)} 7219@opindex Wmissing-prototypes 7220@opindex Wno-missing-prototypes 7221Warn if a global function is defined without a previous prototype 7222declaration. This warning is issued even if the definition itself 7223provides a prototype. Use this option to detect global functions 7224that do not have a matching prototype declaration in a header file. 7225This option is not valid for C++ because all function declarations 7226provide prototypes and a non-matching declaration declares an 7227overload rather than conflict with an earlier declaration. 7228Use @option{-Wmissing-declarations} to detect missing declarations in C++. 7229 7230@item -Wmissing-declarations 7231@opindex Wmissing-declarations 7232@opindex Wno-missing-declarations 7233Warn if a global function is defined without a previous declaration. 7234Do so even if the definition itself provides a prototype. 7235Use this option to detect global functions that are not declared in 7236header files. In C, no warnings are issued for functions with previous 7237non-prototype declarations; use @option{-Wmissing-prototypes} to detect 7238missing prototypes. In C++, no warnings are issued for function templates, 7239or for inline functions, or for functions in anonymous namespaces. 7240 7241@item -Wmissing-field-initializers 7242@opindex Wmissing-field-initializers 7243@opindex Wno-missing-field-initializers 7244@opindex W 7245@opindex Wextra 7246@opindex Wno-extra 7247Warn if a structure's initializer has some fields missing. For 7248example, the following code causes such a warning, because 7249@code{x.h} is implicitly zero: 7250 7251@smallexample 7252struct s @{ int f, g, h; @}; 7253struct s x = @{ 3, 4 @}; 7254@end smallexample 7255 7256This option does not warn about designated initializers, so the following 7257modification does not trigger a warning: 7258 7259@smallexample 7260struct s @{ int f, g, h; @}; 7261struct s x = @{ .f = 3, .g = 4 @}; 7262@end smallexample 7263 7264In C this option does not warn about the universal zero initializer 7265@samp{@{ 0 @}}: 7266 7267@smallexample 7268struct s @{ int f, g, h; @}; 7269struct s x = @{ 0 @}; 7270@end smallexample 7271 7272Likewise, in C++ this option does not warn about the empty @{ @} 7273initializer, for example: 7274 7275@smallexample 7276struct s @{ int f, g, h; @}; 7277s x = @{ @}; 7278@end smallexample 7279 7280This warning is included in @option{-Wextra}. To get other @option{-Wextra} 7281warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 7282 7283@item -Wno-multichar 7284@opindex Wno-multichar 7285@opindex Wmultichar 7286Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 7287Usually they indicate a typo in the user's code, as they have 7288implementation-defined values, and should not be used in portable code. 7289 7290@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} 7291@opindex Wnormalized= 7292@opindex Wnormalized 7293@opindex Wno-normalized 7294@cindex NFC 7295@cindex NFKC 7296@cindex character set, input normalization 7297In ISO C and ISO C++, two identifiers are different if they are 7298different sequences of characters. However, sometimes when characters 7299outside the basic ASCII character set are used, you can have two 7300different character sequences that look the same. To avoid confusion, 7301the ISO 10646 standard sets out some @dfn{normalization rules} which 7302when applied ensure that two sequences that look the same are turned into 7303the same sequence. GCC can warn you if you are using identifiers that 7304have not been normalized; this option controls that warning. 7305 7306There are four levels of warning supported by GCC@. The default is 7307@option{-Wnormalized=nfc}, which warns about any identifier that is 7308not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 7309recommended form for most uses. It is equivalent to 7310@option{-Wnormalized}. 7311 7312Unfortunately, there are some characters allowed in identifiers by 7313ISO C and ISO C++ that, when turned into NFC, are not allowed in 7314identifiers. That is, there's no way to use these symbols in portable 7315ISO C or C++ and have all your identifiers in NFC@. 7316@option{-Wnormalized=id} suppresses the warning for these characters. 7317It is hoped that future versions of the standards involved will correct 7318this, which is why this option is not the default. 7319 7320You can switch the warning off for all characters by writing 7321@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 7322only do this if you are using some other normalization scheme (like 7323``D''), because otherwise you can easily create bugs that are 7324literally impossible to see. 7325 7326Some characters in ISO 10646 have distinct meanings but look identical 7327in some fonts or display methodologies, especially once formatting has 7328been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 7329LETTER N'', displays just like a regular @code{n} that has been 7330placed in a superscript. ISO 10646 defines the @dfn{NFKC} 7331normalization scheme to convert all these into a standard form as 7332well, and GCC warns if your code is not in NFKC if you use 7333@option{-Wnormalized=nfkc}. This warning is comparable to warning 7334about every identifier that contains the letter O because it might be 7335confused with the digit 0, and so is not the default, but may be 7336useful as a local coding convention if the programming environment 7337cannot be fixed to display these characters distinctly. 7338 7339@item -Wno-attribute-warning 7340@opindex Wno-attribute-warning 7341@opindex Wattribute-warning 7342Do not warn about usage of functions (@pxref{Function Attributes}) 7343declared with @code{warning} attribute. By default, this warning is 7344enabled. @option{-Wno-attribute-warning} can be used to disable the 7345warning or @option{-Wno-error=attribute-warning} can be used to 7346disable the error when compiled with @option{-Werror} flag. 7347 7348@item -Wno-deprecated 7349@opindex Wno-deprecated 7350@opindex Wdeprecated 7351Do not warn about usage of deprecated features. @xref{Deprecated Features}. 7352 7353@item -Wno-deprecated-declarations 7354@opindex Wno-deprecated-declarations 7355@opindex Wdeprecated-declarations 7356Do not warn about uses of functions (@pxref{Function Attributes}), 7357variables (@pxref{Variable Attributes}), and types (@pxref{Type 7358Attributes}) marked as deprecated by using the @code{deprecated} 7359attribute. 7360 7361@item -Wno-overflow 7362@opindex Wno-overflow 7363@opindex Woverflow 7364Do not warn about compile-time overflow in constant expressions. 7365 7366@item -Wno-odr 7367@opindex Wno-odr 7368@opindex Wodr 7369Warn about One Definition Rule violations during link-time optimization. 7370Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default. 7371 7372@item -Wopenmp-simd 7373@opindex Wopenmp-simd 7374@opindex Wno-openmp-simd 7375Warn if the vectorizer cost model overrides the OpenMP 7376simd directive set by user. The @option{-fsimd-cost-model=unlimited} 7377option can be used to relax the cost model. 7378 7379@item -Woverride-init @r{(C and Objective-C only)} 7380@opindex Woverride-init 7381@opindex Wno-override-init 7382@opindex W 7383@opindex Wextra 7384@opindex Wno-extra 7385Warn if an initialized field without side effects is overridden when 7386using designated initializers (@pxref{Designated Inits, , Designated 7387Initializers}). 7388 7389This warning is included in @option{-Wextra}. To get other 7390@option{-Wextra} warnings without this one, use @option{-Wextra 7391-Wno-override-init}. 7392 7393@item -Woverride-init-side-effects @r{(C and Objective-C only)} 7394@opindex Woverride-init-side-effects 7395@opindex Wno-override-init-side-effects 7396Warn if an initialized field with side effects is overridden when 7397using designated initializers (@pxref{Designated Inits, , Designated 7398Initializers}). This warning is enabled by default. 7399 7400@item -Wpacked 7401@opindex Wpacked 7402@opindex Wno-packed 7403Warn if a structure is given the packed attribute, but the packed 7404attribute has no effect on the layout or size of the structure. 7405Such structures may be mis-aligned for little benefit. For 7406instance, in this code, the variable @code{f.x} in @code{struct bar} 7407is misaligned even though @code{struct bar} does not itself 7408have the packed attribute: 7409 7410@smallexample 7411@group 7412struct foo @{ 7413 int x; 7414 char a, b, c, d; 7415@} __attribute__((packed)); 7416struct bar @{ 7417 char z; 7418 struct foo f; 7419@}; 7420@end group 7421@end smallexample 7422 7423@item -Wpacked-bitfield-compat 7424@opindex Wpacked-bitfield-compat 7425@opindex Wno-packed-bitfield-compat 7426The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 7427on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but 7428the change can lead to differences in the structure layout. GCC 7429informs you when the offset of such a field has changed in GCC 4.4. 7430For example there is no longer a 4-bit padding between field @code{a} 7431and @code{b} in this structure: 7432 7433@smallexample 7434struct foo 7435@{ 7436 char a:4; 7437 char b:8; 7438@} __attribute__ ((packed)); 7439@end smallexample 7440 7441This warning is enabled by default. Use 7442@option{-Wno-packed-bitfield-compat} to disable this warning. 7443 7444@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 7445@opindex Wpacked-not-aligned 7446@opindex Wno-packed-not-aligned 7447Warn if a structure field with explicitly specified alignment in a 7448packed struct or union is misaligned. For example, a warning will 7449be issued on @code{struct S}, like, @code{warning: alignment 1 of 7450'struct S' is less than 8}, in this code: 7451 7452@smallexample 7453@group 7454struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @}; 7455struct __attribute__ ((packed)) S @{ 7456 struct S8 s8; 7457@}; 7458@end group 7459@end smallexample 7460 7461This warning is enabled by @option{-Wall}. 7462 7463@item -Wpadded 7464@opindex Wpadded 7465@opindex Wno-padded 7466Warn if padding is included in a structure, either to align an element 7467of the structure or to align the whole structure. Sometimes when this 7468happens it is possible to rearrange the fields of the structure to 7469reduce the padding and so make the structure smaller. 7470 7471@item -Wredundant-decls 7472@opindex Wredundant-decls 7473@opindex Wno-redundant-decls 7474Warn if anything is declared more than once in the same scope, even in 7475cases where multiple declaration is valid and changes nothing. 7476 7477@item -Wno-restrict 7478@opindex Wrestrict 7479@opindex Wno-restrict 7480Warn when an object referenced by a @code{restrict}-qualified parameter 7481(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another 7482argument, or when copies between such objects overlap. For example, 7483the call to the @code{strcpy} function below attempts to truncate the string 7484by replacing its initial characters with the last four. However, because 7485the call writes the terminating NUL into @code{a[4]}, the copies overlap and 7486the call is diagnosed. 7487 7488@smallexample 7489void foo (void) 7490@{ 7491 char a[] = "abcd1234"; 7492 strcpy (a, a + 4); 7493 @dots{} 7494@} 7495@end smallexample 7496The @option{-Wrestrict} option detects some instances of simple overlap 7497even without optimization but works best at @option{-O2} and above. It 7498is included in @option{-Wall}. 7499 7500@item -Wnested-externs @r{(C and Objective-C only)} 7501@opindex Wnested-externs 7502@opindex Wno-nested-externs 7503Warn if an @code{extern} declaration is encountered within a function. 7504 7505@item -Wno-inherited-variadic-ctor 7506@opindex Winherited-variadic-ctor 7507@opindex Wno-inherited-variadic-ctor 7508Suppress warnings about use of C++11 inheriting constructors when the 7509base class inherited from has a C variadic constructor; the warning is 7510on by default because the ellipsis is not inherited. 7511 7512@item -Winline 7513@opindex Winline 7514@opindex Wno-inline 7515Warn if a function that is declared as inline cannot be inlined. 7516Even with this option, the compiler does not warn about failures to 7517inline functions declared in system headers. 7518 7519The compiler uses a variety of heuristics to determine whether or not 7520to inline a function. For example, the compiler takes into account 7521the size of the function being inlined and the amount of inlining 7522that has already been done in the current function. Therefore, 7523seemingly insignificant changes in the source program can cause the 7524warnings produced by @option{-Winline} to appear or disappear. 7525 7526@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 7527@opindex Wno-invalid-offsetof 7528@opindex Winvalid-offsetof 7529Suppress warnings from applying the @code{offsetof} macro to a non-POD 7530type. According to the 2014 ISO C++ standard, applying @code{offsetof} 7531to a non-standard-layout type is undefined. In existing C++ implementations, 7532however, @code{offsetof} typically gives meaningful results. 7533This flag is for users who are aware that they are 7534writing nonportable code and who have deliberately chosen to ignore the 7535warning about it. 7536 7537The restrictions on @code{offsetof} may be relaxed in a future version 7538of the C++ standard. 7539 7540@item -Wint-in-bool-context 7541@opindex Wint-in-bool-context 7542@opindex Wno-int-in-bool-context 7543Warn for suspicious use of integer values where boolean values are expected, 7544such as conditional expressions (?:) using non-boolean integer constants in 7545boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed 7546integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise 7547for all kinds of multiplications regardless of the data type. 7548This warning is enabled by @option{-Wall}. 7549 7550@item -Wno-int-to-pointer-cast 7551@opindex Wno-int-to-pointer-cast 7552@opindex Wint-to-pointer-cast 7553Suppress warnings from casts to pointer type of an integer of a 7554different size. In C++, casting to a pointer type of smaller size is 7555an error. @option{Wint-to-pointer-cast} is enabled by default. 7556 7557 7558@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 7559@opindex Wno-pointer-to-int-cast 7560@opindex Wpointer-to-int-cast 7561Suppress warnings from casts from a pointer to an integer type of a 7562different size. 7563 7564@item -Winvalid-pch 7565@opindex Winvalid-pch 7566@opindex Wno-invalid-pch 7567Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 7568the search path but cannot be used. 7569 7570@item -Wlong-long 7571@opindex Wlong-long 7572@opindex Wno-long-long 7573Warn if @code{long long} type is used. This is enabled by either 7574@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 7575modes. To inhibit the warning messages, use @option{-Wno-long-long}. 7576 7577@item -Wvariadic-macros 7578@opindex Wvariadic-macros 7579@opindex Wno-variadic-macros 7580Warn if variadic macros are used in ISO C90 mode, or if the GNU 7581alternate syntax is used in ISO C99 mode. This is enabled by either 7582@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 7583messages, use @option{-Wno-variadic-macros}. 7584 7585@item -Wvarargs 7586@opindex Wvarargs 7587@opindex Wno-varargs 7588Warn upon questionable usage of the macros used to handle variable 7589arguments like @code{va_start}. This is default. To inhibit the 7590warning messages, use @option{-Wno-varargs}. 7591 7592@item -Wvector-operation-performance 7593@opindex Wvector-operation-performance 7594@opindex Wno-vector-operation-performance 7595Warn if vector operation is not implemented via SIMD capabilities of the 7596architecture. Mainly useful for the performance tuning. 7597Vector operation can be implemented @code{piecewise}, which means that the 7598scalar operation is performed on every vector element; 7599@code{in parallel}, which means that the vector operation is implemented 7600using scalars of wider type, which normally is more performance efficient; 7601and @code{as a single scalar}, which means that vector fits into a 7602scalar type. 7603 7604@item -Wno-virtual-move-assign 7605@opindex Wvirtual-move-assign 7606@opindex Wno-virtual-move-assign 7607Suppress warnings about inheriting from a virtual base with a 7608non-trivial C++11 move assignment operator. This is dangerous because 7609if the virtual base is reachable along more than one path, it is 7610moved multiple times, which can mean both objects end up in the 7611moved-from state. If the move assignment operator is written to avoid 7612moving from a moved-from object, this warning can be disabled. 7613 7614@item -Wvla 7615@opindex Wvla 7616@opindex Wno-vla 7617Warn if a variable-length array is used in the code. 7618@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 7619the variable-length array. 7620 7621@item -Wvla-larger-than=@var{byte-size} 7622@opindex Wvla-larger-than= 7623@opindex Wno-vla-larger-than 7624If this option is used, the compiler will warn for declarations of 7625variable-length arrays whose size is either unbounded, or bounded 7626by an argument that allows the array size to exceed @var{byte-size} 7627bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size} 7628works, but with variable-length arrays. 7629 7630Note that GCC may optimize small variable-length arrays of a known 7631value into plain arrays, so this warning may not get triggered for 7632such arrays. 7633 7634@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but 7635is typically only effective when @option{-ftree-vrp} is active (default 7636for @option{-O2} and above). 7637 7638See also @option{-Walloca-larger-than=@var{byte-size}}. 7639 7640@item -Wno-vla-larger-than 7641@opindex Wno-vla-larger-than 7642Disable @option{-Wvla-larger-than=} warnings. The option is equivalent 7643to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger. 7644 7645@item -Wvolatile-register-var 7646@opindex Wvolatile-register-var 7647@opindex Wno-volatile-register-var 7648Warn if a register variable is declared volatile. The volatile 7649modifier does not inhibit all optimizations that may eliminate reads 7650and/or writes to register variables. This warning is enabled by 7651@option{-Wall}. 7652 7653@item -Wdisabled-optimization 7654@opindex Wdisabled-optimization 7655@opindex Wno-disabled-optimization 7656Warn if a requested optimization pass is disabled. This warning does 7657not generally indicate that there is anything wrong with your code; it 7658merely indicates that GCC's optimizers are unable to handle the code 7659effectively. Often, the problem is that your code is too big or too 7660complex; GCC refuses to optimize programs when the optimization 7661itself is likely to take inordinate amounts of time. 7662 7663@item -Wpointer-sign @r{(C and Objective-C only)} 7664@opindex Wpointer-sign 7665@opindex Wno-pointer-sign 7666Warn for pointer argument passing or assignment with different signedness. 7667This option is only supported for C and Objective-C@. It is implied by 7668@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 7669@option{-Wno-pointer-sign}. 7670 7671@item -Wstack-protector 7672@opindex Wstack-protector 7673@opindex Wno-stack-protector 7674This option is only active when @option{-fstack-protector} is active. It 7675warns about functions that are not protected against stack smashing. 7676 7677@item -Woverlength-strings 7678@opindex Woverlength-strings 7679@opindex Wno-overlength-strings 7680Warn about string constants that are longer than the ``minimum 7681maximum'' length specified in the C standard. Modern compilers 7682generally allow string constants that are much longer than the 7683standard's minimum limit, but very portable programs should avoid 7684using longer strings. 7685 7686The limit applies @emph{after} string constant concatenation, and does 7687not count the trailing NUL@. In C90, the limit was 509 characters; in 7688C99, it was raised to 4095. C++98 does not specify a normative 7689minimum maximum, so we do not diagnose overlength strings in C++@. 7690 7691This option is implied by @option{-Wpedantic}, and can be disabled with 7692@option{-Wno-overlength-strings}. 7693 7694@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 7695@opindex Wunsuffixed-float-constants 7696@opindex Wno-unsuffixed-float-constants 7697 7698Issue a warning for any floating constant that does not have 7699a suffix. When used together with @option{-Wsystem-headers} it 7700warns about such constants in system header files. This can be useful 7701when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 7702from the decimal floating-point extension to C99. 7703 7704@item -Wno-designated-init @r{(C and Objective-C only)} 7705Suppress warnings when a positional initializer is used to initialize 7706a structure that has been marked with the @code{designated_init} 7707attribute. 7708 7709@item -Whsa 7710Issue a warning when HSAIL cannot be emitted for the compiled function or 7711OpenMP construct. 7712 7713@end table 7714 7715@node Debugging Options 7716@section Options for Debugging Your Program 7717@cindex options, debugging 7718@cindex debugging information options 7719 7720To tell GCC to emit extra information for use by a debugger, in almost 7721all cases you need only to add @option{-g} to your other options. 7722 7723GCC allows you to use @option{-g} with 7724@option{-O}. The shortcuts taken by optimized code may occasionally 7725be surprising: some variables you declared may not exist 7726at all; flow of control may briefly move where you did not expect it; 7727some statements may not be executed because they compute constant 7728results or their values are already at hand; some statements may 7729execute in different places because they have been moved out of loops. 7730Nevertheless it is possible to debug optimized output. This makes 7731it reasonable to use the optimizer for programs that might have bugs. 7732 7733If you are not using some other optimization option, consider 7734using @option{-Og} (@pxref{Optimize Options}) with @option{-g}. 7735With no @option{-O} option at all, some compiler passes that collect 7736information useful for debugging do not run at all, so that 7737@option{-Og} may result in a better debugging experience. 7738 7739@table @gcctabopt 7740@item -g 7741@opindex g 7742Produce debugging information in the operating system's native format 7743(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 7744information. 7745 7746On most systems that use stabs format, @option{-g} enables use of extra 7747debugging information that only GDB can use; this extra information 7748makes debugging work better in GDB but probably makes other debuggers 7749crash or 7750refuse to read the program. If you want to control for certain whether 7751to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 7752@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 7753 7754@item -ggdb 7755@opindex ggdb 7756Produce debugging information for use by GDB@. This means to use the 7757most expressive format available (DWARF, stabs, or the native format 7758if neither of those are supported), including GDB extensions if at all 7759possible. 7760 7761@item -gdwarf 7762@itemx -gdwarf-@var{version} 7763@opindex gdwarf 7764Produce debugging information in DWARF format (if that is supported). 7765The value of @var{version} may be either 2, 3, 4 or 5; the default version 7766for most targets is 4. DWARF Version 5 is only experimental. 7767 7768Note that with DWARF Version 2, some ports require and always 7769use some non-conflicting DWARF 3 extensions in the unwind tables. 7770 7771Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 7772for maximum benefit. 7773 7774GCC no longer supports DWARF Version 1, which is substantially 7775different than Version 2 and later. For historical reasons, some 7776other DWARF-related options such as 7777@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2 7778in their names, but apply to all currently-supported versions of DWARF. 7779 7780@item -gstabs 7781@opindex gstabs 7782Produce debugging information in stabs format (if that is supported), 7783without GDB extensions. This is the format used by DBX on most BSD 7784systems. On MIPS, Alpha and System V Release 4 systems this option 7785produces stabs debugging output that is not understood by DBX@. 7786On System V Release 4 systems this option requires the GNU assembler. 7787 7788@item -gstabs+ 7789@opindex gstabs+ 7790Produce debugging information in stabs format (if that is supported), 7791using GNU extensions understood only by the GNU debugger (GDB)@. The 7792use of these extensions is likely to make other debuggers crash or 7793refuse to read the program. 7794 7795@item -gxcoff 7796@opindex gxcoff 7797Produce debugging information in XCOFF format (if that is supported). 7798This is the format used by the DBX debugger on IBM RS/6000 systems. 7799 7800@item -gxcoff+ 7801@opindex gxcoff+ 7802Produce debugging information in XCOFF format (if that is supported), 7803using GNU extensions understood only by the GNU debugger (GDB)@. The 7804use of these extensions is likely to make other debuggers crash or 7805refuse to read the program, and may cause assemblers other than the GNU 7806assembler (GAS) to fail with an error. 7807 7808@item -gvms 7809@opindex gvms 7810Produce debugging information in Alpha/VMS debug format (if that is 7811supported). This is the format used by DEBUG on Alpha/VMS systems. 7812 7813@item -g@var{level} 7814@itemx -ggdb@var{level} 7815@itemx -gstabs@var{level} 7816@itemx -gxcoff@var{level} 7817@itemx -gvms@var{level} 7818Request debugging information and also use @var{level} to specify how 7819much information. The default level is 2. 7820 7821Level 0 produces no debug information at all. Thus, @option{-g0} negates 7822@option{-g}. 7823 7824Level 1 produces minimal information, enough for making backtraces in 7825parts of the program that you don't plan to debug. This includes 7826descriptions of functions and external variables, and line number 7827tables, but no information about local variables. 7828 7829Level 3 includes extra information, such as all the macro definitions 7830present in the program. Some debuggers support macro expansion when 7831you use @option{-g3}. 7832 7833If you use multiple @option{-g} options, with or without level numbers, 7834the last such option is the one that is effective. 7835 7836@option{-gdwarf} does not accept a concatenated debug level, to avoid 7837confusion with @option{-gdwarf-@var{level}}. 7838Instead use an additional @option{-g@var{level}} option to change the 7839debug level for DWARF. 7840 7841@item -feliminate-unused-debug-symbols 7842@opindex feliminate-unused-debug-symbols 7843Produce debugging information in stabs format (if that is supported), 7844for only symbols that are actually used. 7845 7846@item -femit-class-debug-always 7847@opindex femit-class-debug-always 7848Instead of emitting debugging information for a C++ class in only one 7849object file, emit it in all object files using the class. This option 7850should be used only with debuggers that are unable to handle the way GCC 7851normally emits debugging information for classes because using this 7852option increases the size of debugging information by as much as a 7853factor of two. 7854 7855@item -fno-merge-debug-strings 7856@opindex fmerge-debug-strings 7857@opindex fno-merge-debug-strings 7858Direct the linker to not merge together strings in the debugging 7859information that are identical in different object files. Merging is 7860not supported by all assemblers or linkers. Merging decreases the size 7861of the debug information in the output file at the cost of increasing 7862link processing time. Merging is enabled by default. 7863 7864@item -fdebug-prefix-map=@var{old}=@var{new} 7865@opindex fdebug-prefix-map 7866When compiling files residing in directory @file{@var{old}}, record 7867debugging information describing them as if the files resided in 7868directory @file{@var{new}} instead. This can be used to replace a 7869build-time path with an install-time path in the debug info. It can 7870also be used to change an absolute path to a relative path by using 7871@file{.} for @var{new}. This can give more reproducible builds, which 7872are location independent, but may require an extra command to tell GDB 7873where to find the source files. See also @option{-ffile-prefix-map}. 7874 7875@item -fvar-tracking 7876@opindex fvar-tracking 7877Run variable tracking pass. It computes where variables are stored at each 7878position in code. Better debugging information is then generated 7879(if the debugging information format supports this information). 7880 7881It is enabled by default when compiling with optimization (@option{-Os}, 7882@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 7883the debug info format supports it. 7884 7885@item -fvar-tracking-assignments 7886@opindex fvar-tracking-assignments 7887@opindex fno-var-tracking-assignments 7888Annotate assignments to user variables early in the compilation and 7889attempt to carry the annotations over throughout the compilation all the 7890way to the end, in an attempt to improve debug information while 7891optimizing. Use of @option{-gdwarf-4} is recommended along with it. 7892 7893It can be enabled even if var-tracking is disabled, in which case 7894annotations are created and maintained, but discarded at the end. 7895By default, this flag is enabled together with @option{-fvar-tracking}, 7896except when selective scheduling is enabled. 7897 7898@item -gsplit-dwarf 7899@opindex gsplit-dwarf 7900Separate as much DWARF debugging information as possible into a 7901separate output file with the extension @file{.dwo}. This option allows 7902the build system to avoid linking files with debug information. To 7903be useful, this option requires a debugger capable of reading @file{.dwo} 7904files. 7905 7906@item -gdescribe-dies 7907@opindex gdescribe-dies 7908Add description attributes to some DWARF DIEs that have no name attribute, 7909such as artificial variables, external references and call site 7910parameter DIEs. 7911 7912@item -gpubnames 7913@opindex gpubnames 7914Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections. 7915 7916@item -ggnu-pubnames 7917@opindex ggnu-pubnames 7918Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format 7919suitable for conversion into a GDB@ index. This option is only useful 7920with a linker that can produce GDB@ index version 7. 7921 7922@item -fdebug-types-section 7923@opindex fdebug-types-section 7924@opindex fno-debug-types-section 7925When using DWARF Version 4 or higher, type DIEs can be put into 7926their own @code{.debug_types} section instead of making them part of the 7927@code{.debug_info} section. It is more efficient to put them in a separate 7928comdat section since the linker can then remove duplicates. 7929But not all DWARF consumers support @code{.debug_types} sections yet 7930and on some objects @code{.debug_types} produces larger instead of smaller 7931debugging information. 7932 7933@item -grecord-gcc-switches 7934@itemx -gno-record-gcc-switches 7935@opindex grecord-gcc-switches 7936@opindex gno-record-gcc-switches 7937This switch causes the command-line options used to invoke the 7938compiler that may affect code generation to be appended to the 7939DW_AT_producer attribute in DWARF debugging information. The options 7940are concatenated with spaces separating them from each other and from 7941the compiler version. 7942It is enabled by default. 7943See also @option{-frecord-gcc-switches} for another 7944way of storing compiler options into the object file. 7945 7946@item -gstrict-dwarf 7947@opindex gstrict-dwarf 7948Disallow using extensions of later DWARF standard version than selected 7949with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 7950DWARF extensions from later standard versions is allowed. 7951 7952@item -gno-strict-dwarf 7953@opindex gno-strict-dwarf 7954Allow using extensions of later DWARF standard version than selected with 7955@option{-gdwarf-@var{version}}. 7956 7957@item -gas-loc-support 7958@opindex gas-loc-support 7959Inform the compiler that the assembler supports @code{.loc} directives. 7960It may then use them for the assembler to generate DWARF2+ line number 7961tables. 7962 7963This is generally desirable, because assembler-generated line-number 7964tables are a lot more compact than those the compiler can generate 7965itself. 7966 7967This option will be enabled by default if, at GCC configure time, the 7968assembler was found to support such directives. 7969 7970@item -gno-as-loc-support 7971@opindex gno-as-loc-support 7972Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ 7973line number tables are to be generated. 7974 7975@item gas-locview-support 7976@opindex gas-locview-support 7977Inform the compiler that the assembler supports @code{view} assignment 7978and reset assertion checking in @code{.loc} directives. 7979 7980This option will be enabled by default if, at GCC configure time, the 7981assembler was found to support them. 7982 7983@item gno-as-locview-support 7984Force GCC to assign view numbers internally, if 7985@option{-gvariable-location-views} are explicitly requested. 7986 7987@item -gcolumn-info 7988@itemx -gno-column-info 7989@opindex gcolumn-info 7990@opindex gno-column-info 7991Emit location column information into DWARF debugging information, rather 7992than just file and line. 7993This option is enabled by default. 7994 7995@item -gstatement-frontiers 7996@itemx -gno-statement-frontiers 7997@opindex gstatement-frontiers 7998@opindex gno-statement-frontiers 7999This option causes GCC to create markers in the internal representation 8000at the beginning of statements, and to keep them roughly in place 8001throughout compilation, using them to guide the output of @code{is_stmt} 8002markers in the line number table. This is enabled by default when 8003compiling with optimization (@option{-Os}, @option{-O}, @option{-O2}, 8004@dots{}), and outputting DWARF 2 debug information at the normal level. 8005 8006@item -gvariable-location-views 8007@itemx -gvariable-location-views=incompat5 8008@itemx -gno-variable-location-views 8009@opindex gvariable-location-views 8010@opindex gvariable-location-views=incompat5 8011@opindex gno-variable-location-views 8012Augment variable location lists with progressive view numbers implied 8013from the line number table. This enables debug information consumers to 8014inspect state at certain points of the program, even if no instructions 8015associated with the corresponding source locations are present at that 8016point. If the assembler lacks support for view numbers in line number 8017tables, this will cause the compiler to emit the line number table, 8018which generally makes them somewhat less compact. The augmented line 8019number tables and location lists are fully backward-compatible, so they 8020can be consumed by debug information consumers that are not aware of 8021these augmentations, but they won't derive any benefit from them either. 8022 8023This is enabled by default when outputting DWARF 2 debug information at 8024the normal level, as long as there is assembler support, 8025@option{-fvar-tracking-assignments} is enabled and 8026@option{-gstrict-dwarf} is not. When assembler support is not 8027available, this may still be enabled, but it will force GCC to output 8028internal line number tables, and if 8029@option{-ginternal-reset-location-views} is not enabled, that will most 8030certainly lead to silently mismatching location views. 8031 8032There is a proposed representation for view numbers that is not backward 8033compatible with the location list format introduced in DWARF 5, that can 8034be enabled with @option{-gvariable-location-views=incompat5}. This 8035option may be removed in the future, is only provided as a reference 8036implementation of the proposed representation. Debug information 8037consumers are not expected to support this extended format, and they 8038would be rendered unable to decode location lists using it. 8039 8040@item -ginternal-reset-location-views 8041@itemx -gno-internal-reset-location-views 8042@opindex ginternal-reset-location-views 8043@opindex gno-internal-reset-location-views 8044Attempt to determine location views that can be omitted from location 8045view lists. This requires the compiler to have very accurate insn 8046length estimates, which isn't always the case, and it may cause 8047incorrect view lists to be generated silently when using an assembler 8048that does not support location view lists. The GNU assembler will flag 8049any such error as a @code{view number mismatch}. This is only enabled 8050on ports that define a reliable estimation function. 8051 8052@item -ginline-points 8053@itemx -gno-inline-points 8054@opindex ginline-points 8055@opindex gno-inline-points 8056Generate extended debug information for inlined functions. Location 8057view tracking markers are inserted at inlined entry points, so that 8058address and view numbers can be computed and output in debug 8059information. This can be enabled independently of location views, in 8060which case the view numbers won't be output, but it can only be enabled 8061along with statement frontiers, and it is only enabled by default if 8062location views are enabled. 8063 8064@item -gz@r{[}=@var{type}@r{]} 8065@opindex gz 8066Produce compressed debug sections in DWARF format, if that is supported. 8067If @var{type} is not given, the default type depends on the capabilities 8068of the assembler and linker used. @var{type} may be one of 8069@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 8070compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 8071compression in traditional GNU format). If the linker doesn't support 8072writing compressed debug sections, the option is rejected. Otherwise, 8073if the assembler does not support them, @option{-gz} is silently ignored 8074when producing object files. 8075 8076@item -femit-struct-debug-baseonly 8077@opindex femit-struct-debug-baseonly 8078Emit debug information for struct-like types 8079only when the base name of the compilation source file 8080matches the base name of file in which the struct is defined. 8081 8082This option substantially reduces the size of debugging information, 8083but at significant potential loss in type information to the debugger. 8084See @option{-femit-struct-debug-reduced} for a less aggressive option. 8085See @option{-femit-struct-debug-detailed} for more detailed control. 8086 8087This option works only with DWARF debug output. 8088 8089@item -femit-struct-debug-reduced 8090@opindex femit-struct-debug-reduced 8091Emit debug information for struct-like types 8092only when the base name of the compilation source file 8093matches the base name of file in which the type is defined, 8094unless the struct is a template or defined in a system header. 8095 8096This option significantly reduces the size of debugging information, 8097with some potential loss in type information to the debugger. 8098See @option{-femit-struct-debug-baseonly} for a more aggressive option. 8099See @option{-femit-struct-debug-detailed} for more detailed control. 8100 8101This option works only with DWARF debug output. 8102 8103@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 8104@opindex femit-struct-debug-detailed 8105Specify the struct-like types 8106for which the compiler generates debug information. 8107The intent is to reduce duplicate struct debug information 8108between different object files within the same program. 8109 8110This option is a detailed version of 8111@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 8112which serves for most needs. 8113 8114A specification has the syntax@* 8115[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 8116 8117The optional first word limits the specification to 8118structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 8119A struct type is used directly when it is the type of a variable, member. 8120Indirect uses arise through pointers to structs. 8121That is, when use of an incomplete struct is valid, the use is indirect. 8122An example is 8123@samp{struct one direct; struct two * indirect;}. 8124 8125The optional second word limits the specification to 8126ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 8127Generic structs are a bit complicated to explain. 8128For C++, these are non-explicit specializations of template classes, 8129or non-template classes within the above. 8130Other programming languages have generics, 8131but @option{-femit-struct-debug-detailed} does not yet implement them. 8132 8133The third word specifies the source files for those 8134structs for which the compiler should emit debug information. 8135The values @samp{none} and @samp{any} have the normal meaning. 8136The value @samp{base} means that 8137the base of name of the file in which the type declaration appears 8138must match the base of the name of the main compilation file. 8139In practice, this means that when compiling @file{foo.c}, debug information 8140is generated for types declared in that file and @file{foo.h}, 8141but not other header files. 8142The value @samp{sys} means those types satisfying @samp{base} 8143or declared in system or compiler headers. 8144 8145You may need to experiment to determine the best settings for your application. 8146 8147The default is @option{-femit-struct-debug-detailed=all}. 8148 8149This option works only with DWARF debug output. 8150 8151@item -fno-dwarf2-cfi-asm 8152@opindex fdwarf2-cfi-asm 8153@opindex fno-dwarf2-cfi-asm 8154Emit DWARF unwind info as compiler generated @code{.eh_frame} section 8155instead of using GAS @code{.cfi_*} directives. 8156 8157@item -fno-eliminate-unused-debug-types 8158@opindex feliminate-unused-debug-types 8159@opindex fno-eliminate-unused-debug-types 8160Normally, when producing DWARF output, GCC avoids producing debug symbol 8161output for types that are nowhere used in the source file being compiled. 8162Sometimes it is useful to have GCC emit debugging 8163information for all types declared in a compilation 8164unit, regardless of whether or not they are actually used 8165in that compilation unit, for example 8166if, in the debugger, you want to cast a value to a type that is 8167not actually used in your program (but is declared). More often, 8168however, this results in a significant amount of wasted space. 8169@end table 8170 8171@node Optimize Options 8172@section Options That Control Optimization 8173@cindex optimize options 8174@cindex options, optimization 8175 8176These options control various sorts of optimizations. 8177 8178Without any optimization option, the compiler's goal is to reduce the 8179cost of compilation and to make debugging produce the expected 8180results. Statements are independent: if you stop the program with a 8181breakpoint between statements, you can then assign a new value to any 8182variable or change the program counter to any other statement in the 8183function and get exactly the results you expect from the source 8184code. 8185 8186Turning on optimization flags makes the compiler attempt to improve 8187the performance and/or code size at the expense of compilation time 8188and possibly the ability to debug the program. 8189 8190The compiler performs optimization based on the knowledge it has of the 8191program. Compiling multiple files at once to a single output file mode allows 8192the compiler to use information gained from all of the files when compiling 8193each of them. 8194 8195Not all optimizations are controlled directly by a flag. Only 8196optimizations that have a flag are listed in this section. 8197 8198Most optimizations are completely disabled at @option{-O0} or if an 8199@option{-O} level is not set on the command line, even if individual 8200optimization flags are specified. Similarly, @option{-Og} suppresses 8201many optimization passes. 8202 8203Depending on the target and how GCC was configured, a slightly different 8204set of optimizations may be enabled at each @option{-O} level than 8205those listed here. You can invoke GCC with @option{-Q --help=optimizers} 8206to find out the exact set of optimizations that are enabled at each level. 8207@xref{Overall Options}, for examples. 8208 8209@table @gcctabopt 8210@item -O 8211@itemx -O1 8212@opindex O 8213@opindex O1 8214Optimize. Optimizing compilation takes somewhat more time, and a lot 8215more memory for a large function. 8216 8217With @option{-O}, the compiler tries to reduce code size and execution 8218time, without performing any optimizations that take a great deal of 8219compilation time. 8220 8221@c Note that in addition to the default_options_table list in opts.c, 8222@c several optimization flags default to true but control optimization 8223@c passes that are explicitly disabled at -O0. 8224 8225@option{-O} turns on the following optimization flags: 8226 8227@c Please keep the following list alphabetized. 8228@gccoptlist{-fauto-inc-dec @gol 8229-fbranch-count-reg @gol 8230-fcombine-stack-adjustments @gol 8231-fcompare-elim @gol 8232-fcprop-registers @gol 8233-fdce @gol 8234-fdefer-pop @gol 8235-fdelayed-branch @gol 8236-fdse @gol 8237-fforward-propagate @gol 8238-fguess-branch-probability @gol 8239-fif-conversion @gol 8240-fif-conversion2 @gol 8241-finline-functions-called-once @gol 8242-fipa-profile @gol 8243-fipa-pure-const @gol 8244-fipa-reference @gol 8245-fipa-reference-addressable @gol 8246-fmerge-constants @gol 8247-fmove-loop-invariants @gol 8248-fomit-frame-pointer @gol 8249-freorder-blocks @gol 8250-fshrink-wrap @gol 8251-fshrink-wrap-separate @gol 8252-fsplit-wide-types @gol 8253-fssa-backprop @gol 8254-fssa-phiopt @gol 8255-ftree-bit-ccp @gol 8256-ftree-ccp @gol 8257-ftree-ch @gol 8258-ftree-coalesce-vars @gol 8259-ftree-copy-prop @gol 8260-ftree-dce @gol 8261-ftree-dominator-opts @gol 8262-ftree-dse @gol 8263-ftree-forwprop @gol 8264-ftree-fre @gol 8265-ftree-phiprop @gol 8266-ftree-pta @gol 8267-ftree-scev-cprop @gol 8268-ftree-sink @gol 8269-ftree-slsr @gol 8270-ftree-sra @gol 8271-ftree-ter @gol 8272-funit-at-a-time} 8273 8274@item -O2 8275@opindex O2 8276Optimize even more. GCC performs nearly all supported optimizations 8277that do not involve a space-speed tradeoff. 8278As compared to @option{-O}, this option increases both compilation time 8279and the performance of the generated code. 8280 8281@option{-O2} turns on all optimization flags specified by @option{-O}. It 8282also turns on the following optimization flags: 8283 8284@c Please keep the following list alphabetized! 8285@gccoptlist{-falign-functions -falign-jumps @gol 8286-falign-labels -falign-loops @gol 8287-fcaller-saves @gol 8288-fcode-hoisting @gol 8289-fcrossjumping @gol 8290-fcse-follow-jumps -fcse-skip-blocks @gol 8291-fdelete-null-pointer-checks @gol 8292-fdevirtualize -fdevirtualize-speculatively @gol 8293-fexpensive-optimizations @gol 8294-fgcse -fgcse-lm @gol 8295-fhoist-adjacent-loads @gol 8296-finline-small-functions @gol 8297-findirect-inlining @gol 8298-fipa-bit-cp -fipa-cp -fipa-icf @gol 8299-fipa-ra -fipa-sra -fipa-vrp @gol 8300-fisolate-erroneous-paths-dereference @gol 8301-flra-remat @gol 8302-foptimize-sibling-calls @gol 8303-foptimize-strlen @gol 8304-fpartial-inlining @gol 8305-fpeephole2 @gol 8306-freorder-blocks-algorithm=stc @gol 8307-freorder-blocks-and-partition -freorder-functions @gol 8308-frerun-cse-after-loop @gol 8309-fschedule-insns -fschedule-insns2 @gol 8310-fsched-interblock -fsched-spec @gol 8311-fstore-merging @gol 8312-fstrict-aliasing @gol 8313-fthread-jumps @gol 8314-ftree-builtin-call-dce @gol 8315-ftree-pre @gol 8316-ftree-switch-conversion -ftree-tail-merge @gol 8317-ftree-vrp} 8318 8319Please note the warning under @option{-fgcse} about 8320invoking @option{-O2} on programs that use computed gotos. 8321 8322@item -O3 8323@opindex O3 8324Optimize yet more. @option{-O3} turns on all optimizations specified 8325by @option{-O2} and also turns on the following optimization flags: 8326 8327@c Please keep the following list alphabetized! 8328@gccoptlist{-fgcse-after-reload @gol 8329-finline-functions @gol 8330-fipa-cp-clone 8331-floop-interchange @gol 8332-floop-unroll-and-jam @gol 8333-fpeel-loops @gol 8334-fpredictive-commoning @gol 8335-fsplit-paths @gol 8336-ftree-loop-distribute-patterns @gol 8337-ftree-loop-distribution @gol 8338-ftree-loop-vectorize @gol 8339-ftree-partial-pre @gol 8340-ftree-slp-vectorize @gol 8341-funswitch-loops @gol 8342-fvect-cost-model @gol 8343-fversion-loops-for-strides} 8344 8345@item -O0 8346@opindex O0 8347Reduce compilation time and make debugging produce the expected 8348results. This is the default. 8349 8350@item -Os 8351@opindex Os 8352Optimize for size. @option{-Os} enables all @option{-O2} optimizations 8353except those that often increase code size: 8354 8355@gccoptlist{-falign-functions -falign-jumps @gol 8356-falign-labels -falign-loops @gol 8357-fprefetch-loop-arrays -freorder-blocks-algorithm=stc} 8358 8359It also enables @option{-finline-functions}, causes the compiler to tune for 8360code size rather than execution speed, and performs further optimizations 8361designed to reduce code size. 8362 8363@item -Ofast 8364@opindex Ofast 8365Disregard strict standards compliance. @option{-Ofast} enables all 8366@option{-O3} optimizations. It also enables optimizations that are not 8367valid for all standard-compliant programs. 8368It turns on @option{-ffast-math} and the Fortran-specific 8369@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is 8370specified, and @option{-fno-protect-parens}. 8371 8372@item -Og 8373@opindex Og 8374Optimize debugging experience. @option{-Og} should be the optimization 8375level of choice for the standard edit-compile-debug cycle, offering 8376a reasonable level of optimization while maintaining fast compilation 8377and a good debugging experience. It is a better choice than @option{-O0} 8378for producing debuggable code because some compiler passes 8379that collect debug information are disabled at @option{-O0}. 8380 8381Like @option{-O0}, @option{-Og} completely disables a number of 8382optimization passes so that individual options controlling them have 8383no effect. Otherwise @option{-Og} enables all @option{-O1} 8384optimization flags except for those that may interfere with debugging: 8385 8386@gccoptlist{-fbranch-count-reg -fdelayed-branch @gol 8387-fif-conversion -fif-conversion2 @gol 8388-finline-functions-called-once @gol 8389-fmove-loop-invariants -fssa-phiopt @gol 8390-ftree-bit-ccp -ftree-pta -ftree-sra} 8391 8392@end table 8393 8394If you use multiple @option{-O} options, with or without level numbers, 8395the last such option is the one that is effective. 8396 8397Options of the form @option{-f@var{flag}} specify machine-independent 8398flags. Most flags have both positive and negative forms; the negative 8399form of @option{-ffoo} is @option{-fno-foo}. In the table 8400below, only one of the forms is listed---the one you typically 8401use. You can figure out the other form by either removing @samp{no-} 8402or adding it. 8403 8404The following options control specific optimizations. They are either 8405activated by @option{-O} options or are related to ones that are. You 8406can use the following flags in the rare cases when ``fine-tuning'' of 8407optimizations to be performed is desired. 8408 8409@table @gcctabopt 8410@item -fno-defer-pop 8411@opindex fno-defer-pop 8412@opindex fdefer-pop 8413For machines that must pop arguments after a function call, always pop 8414the arguments as soon as each function returns. 8415At levels @option{-O1} and higher, @option{-fdefer-pop} is the default; 8416this allows the compiler to let arguments accumulate on the stack for several 8417function calls and pop them all at once. 8418 8419@item -fforward-propagate 8420@opindex fforward-propagate 8421Perform a forward propagation pass on RTL@. The pass tries to combine two 8422instructions and checks if the result can be simplified. If loop unrolling 8423is active, two passes are performed and the second is scheduled after 8424loop unrolling. 8425 8426This option is enabled by default at optimization levels @option{-O}, 8427@option{-O2}, @option{-O3}, @option{-Os}. 8428 8429@item -ffp-contract=@var{style} 8430@opindex ffp-contract 8431@option{-ffp-contract=off} disables floating-point expression contraction. 8432@option{-ffp-contract=fast} enables floating-point expression contraction 8433such as forming of fused multiply-add operations if the target has 8434native support for them. 8435@option{-ffp-contract=on} enables floating-point expression contraction 8436if allowed by the language standard. This is currently not implemented 8437and treated equal to @option{-ffp-contract=off}. 8438 8439The default is @option{-ffp-contract=fast}. 8440 8441@item -fomit-frame-pointer 8442@opindex fomit-frame-pointer 8443Omit the frame pointer in functions that don't need one. This avoids the 8444instructions to save, set up and restore the frame pointer; on many targets 8445it also makes an extra register available. 8446 8447On some targets this flag has no effect because the standard calling sequence 8448always uses a frame pointer, so it cannot be omitted. 8449 8450Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer 8451is used in all functions. Several targets always omit the frame pointer in 8452leaf functions. 8453 8454Enabled by default at @option{-O} and higher. 8455 8456@item -foptimize-sibling-calls 8457@opindex foptimize-sibling-calls 8458Optimize sibling and tail recursive calls. 8459 8460Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8461 8462@item -foptimize-strlen 8463@opindex foptimize-strlen 8464Optimize various standard C string functions (e.g.@: @code{strlen}, 8465@code{strchr} or @code{strcpy}) and 8466their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 8467 8468Enabled at levels @option{-O2}, @option{-O3}. 8469 8470@item -fno-inline 8471@opindex fno-inline 8472@opindex finline 8473Do not expand any functions inline apart from those marked with 8474the @code{always_inline} attribute. This is the default when not 8475optimizing. 8476 8477Single functions can be exempted from inlining by marking them 8478with the @code{noinline} attribute. 8479 8480@item -finline-small-functions 8481@opindex finline-small-functions 8482Integrate functions into their callers when their body is smaller than expected 8483function call code (so overall size of program gets smaller). The compiler 8484heuristically decides which functions are simple enough to be worth integrating 8485in this way. This inlining applies to all functions, even those not declared 8486inline. 8487 8488Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8489 8490@item -findirect-inlining 8491@opindex findirect-inlining 8492Inline also indirect calls that are discovered to be known at compile 8493time thanks to previous inlining. This option has any effect only 8494when inlining itself is turned on by the @option{-finline-functions} 8495or @option{-finline-small-functions} options. 8496 8497Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8498 8499@item -finline-functions 8500@opindex finline-functions 8501Consider all functions for inlining, even if they are not declared inline. 8502The compiler heuristically decides which functions are worth integrating 8503in this way. 8504 8505If all calls to a given function are integrated, and the function is 8506declared @code{static}, then the function is normally not output as 8507assembler code in its own right. 8508 8509Enabled at levels @option{-O3}, @option{-Os}. Also enabled 8510by @option{-fprofile-use} and @option{-fauto-profile}. 8511 8512@item -finline-functions-called-once 8513@opindex finline-functions-called-once 8514Consider all @code{static} functions called once for inlining into their 8515caller even if they are not marked @code{inline}. If a call to a given 8516function is integrated, then the function is not output as assembler code 8517in its own right. 8518 8519Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}, 8520but not @option{-Og}. 8521 8522@item -fearly-inlining 8523@opindex fearly-inlining 8524Inline functions marked by @code{always_inline} and functions whose body seems 8525smaller than the function call overhead early before doing 8526@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 8527makes profiling significantly cheaper and usually inlining faster on programs 8528having large chains of nested wrapper functions. 8529 8530Enabled by default. 8531 8532@item -fipa-sra 8533@opindex fipa-sra 8534Perform interprocedural scalar replacement of aggregates, removal of 8535unused parameters and replacement of parameters passed by reference 8536by parameters passed by value. 8537 8538Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 8539 8540@item -finline-limit=@var{n} 8541@opindex finline-limit 8542By default, GCC limits the size of functions that can be inlined. This flag 8543allows coarse control of this limit. @var{n} is the size of functions that 8544can be inlined in number of pseudo instructions. 8545 8546Inlining is actually controlled by a number of parameters, which may be 8547specified individually by using @option{--param @var{name}=@var{value}}. 8548The @option{-finline-limit=@var{n}} option sets some of these parameters 8549as follows: 8550 8551@table @gcctabopt 8552@item max-inline-insns-single 8553is set to @var{n}/2. 8554@item max-inline-insns-auto 8555is set to @var{n}/2. 8556@end table 8557 8558See below for a documentation of the individual 8559parameters controlling inlining and for the defaults of these parameters. 8560 8561@emph{Note:} there may be no value to @option{-finline-limit} that results 8562in default behavior. 8563 8564@emph{Note:} pseudo instruction represents, in this particular context, an 8565abstract measurement of function's size. In no way does it represent a count 8566of assembly instructions and as such its exact meaning might change from one 8567release to an another. 8568 8569@item -fno-keep-inline-dllexport 8570@opindex fno-keep-inline-dllexport 8571@opindex fkeep-inline-dllexport 8572This is a more fine-grained version of @option{-fkeep-inline-functions}, 8573which applies only to functions that are declared using the @code{dllexport} 8574attribute or declspec. @xref{Function Attributes,,Declaring Attributes of 8575Functions}. 8576 8577@item -fkeep-inline-functions 8578@opindex fkeep-inline-functions 8579In C, emit @code{static} functions that are declared @code{inline} 8580into the object file, even if the function has been inlined into all 8581of its callers. This switch does not affect functions using the 8582@code{extern inline} extension in GNU C90@. In C++, emit any and all 8583inline functions into the object file. 8584 8585@item -fkeep-static-functions 8586@opindex fkeep-static-functions 8587Emit @code{static} functions into the object file, even if the function 8588is never used. 8589 8590@item -fkeep-static-consts 8591@opindex fkeep-static-consts 8592Emit variables declared @code{static const} when optimization isn't turned 8593on, even if the variables aren't referenced. 8594 8595GCC enables this option by default. If you want to force the compiler to 8596check if a variable is referenced, regardless of whether or not 8597optimization is turned on, use the @option{-fno-keep-static-consts} option. 8598 8599@item -fmerge-constants 8600@opindex fmerge-constants 8601Attempt to merge identical constants (string constants and floating-point 8602constants) across compilation units. 8603 8604This option is the default for optimized compilation if the assembler and 8605linker support it. Use @option{-fno-merge-constants} to inhibit this 8606behavior. 8607 8608Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8609 8610@item -fmerge-all-constants 8611@opindex fmerge-all-constants 8612Attempt to merge identical constants and identical variables. 8613 8614This option implies @option{-fmerge-constants}. In addition to 8615@option{-fmerge-constants} this considers e.g.@: even constant initialized 8616arrays or initialized constant variables with integral or floating-point 8617types. Languages like C or C++ require each variable, including multiple 8618instances of the same variable in recursive calls, to have distinct locations, 8619so using this option results in non-conforming 8620behavior. 8621 8622@item -fmodulo-sched 8623@opindex fmodulo-sched 8624Perform swing modulo scheduling immediately before the first scheduling 8625pass. This pass looks at innermost loops and reorders their 8626instructions by overlapping different iterations. 8627 8628@item -fmodulo-sched-allow-regmoves 8629@opindex fmodulo-sched-allow-regmoves 8630Perform more aggressive SMS-based modulo scheduling with register moves 8631allowed. By setting this flag certain anti-dependences edges are 8632deleted, which triggers the generation of reg-moves based on the 8633life-range analysis. This option is effective only with 8634@option{-fmodulo-sched} enabled. 8635 8636@item -fno-branch-count-reg 8637@opindex fno-branch-count-reg 8638@opindex fbranch-count-reg 8639Disable the optimization pass that scans for opportunities to use 8640``decrement and branch'' instructions on a count register instead of 8641instruction sequences that decrement a register, compare it against zero, and 8642then branch based upon the result. This option is only meaningful on 8643architectures that support such instructions, which include x86, PowerPC, 8644IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option 8645doesn't remove the decrement and branch instructions from the generated 8646instruction stream introduced by other optimization passes. 8647 8648The default is @option{-fbranch-count-reg} at @option{-O1} and higher, 8649except for @option{-Og}. 8650 8651@item -fno-function-cse 8652@opindex fno-function-cse 8653@opindex ffunction-cse 8654Do not put function addresses in registers; make each instruction that 8655calls a constant function contain the function's address explicitly. 8656 8657This option results in less efficient code, but some strange hacks 8658that alter the assembler output may be confused by the optimizations 8659performed when this option is not used. 8660 8661The default is @option{-ffunction-cse} 8662 8663@item -fno-zero-initialized-in-bss 8664@opindex fno-zero-initialized-in-bss 8665@opindex fzero-initialized-in-bss 8666If the target supports a BSS section, GCC by default puts variables that 8667are initialized to zero into BSS@. This can save space in the resulting 8668code. 8669 8670This option turns off this behavior because some programs explicitly 8671rely on variables going to the data section---e.g., so that the 8672resulting executable can find the beginning of that section and/or make 8673assumptions based on that. 8674 8675The default is @option{-fzero-initialized-in-bss}. 8676 8677@item -fthread-jumps 8678@opindex fthread-jumps 8679Perform optimizations that check to see if a jump branches to a 8680location where another comparison subsumed by the first is found. If 8681so, the first branch is redirected to either the destination of the 8682second branch or a point immediately following it, depending on whether 8683the condition is known to be true or false. 8684 8685Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8686 8687@item -fsplit-wide-types 8688@opindex fsplit-wide-types 8689When using a type that occupies multiple registers, such as @code{long 8690long} on a 32-bit system, split the registers apart and allocate them 8691independently. This normally generates better code for those types, 8692but may make debugging more difficult. 8693 8694Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 8695@option{-Os}. 8696 8697@item -fcse-follow-jumps 8698@opindex fcse-follow-jumps 8699In common subexpression elimination (CSE), scan through jump instructions 8700when the target of the jump is not reached by any other path. For 8701example, when CSE encounters an @code{if} statement with an 8702@code{else} clause, CSE follows the jump when the condition 8703tested is false. 8704 8705Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8706 8707@item -fcse-skip-blocks 8708@opindex fcse-skip-blocks 8709This is similar to @option{-fcse-follow-jumps}, but causes CSE to 8710follow jumps that conditionally skip over blocks. When CSE 8711encounters a simple @code{if} statement with no else clause, 8712@option{-fcse-skip-blocks} causes CSE to follow the jump around the 8713body of the @code{if}. 8714 8715Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8716 8717@item -frerun-cse-after-loop 8718@opindex frerun-cse-after-loop 8719Re-run common subexpression elimination after loop optimizations are 8720performed. 8721 8722Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8723 8724@item -fgcse 8725@opindex fgcse 8726Perform a global common subexpression elimination pass. 8727This pass also performs global constant and copy propagation. 8728 8729@emph{Note:} When compiling a program using computed gotos, a GCC 8730extension, you may get better run-time performance if you disable 8731the global common subexpression elimination pass by adding 8732@option{-fno-gcse} to the command line. 8733 8734Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8735 8736@item -fgcse-lm 8737@opindex fgcse-lm 8738When @option{-fgcse-lm} is enabled, global common subexpression elimination 8739attempts to move loads that are only killed by stores into themselves. This 8740allows a loop containing a load/store sequence to be changed to a load outside 8741the loop, and a copy/store within the loop. 8742 8743Enabled by default when @option{-fgcse} is enabled. 8744 8745@item -fgcse-sm 8746@opindex fgcse-sm 8747When @option{-fgcse-sm} is enabled, a store motion pass is run after 8748global common subexpression elimination. This pass attempts to move 8749stores out of loops. When used in conjunction with @option{-fgcse-lm}, 8750loops containing a load/store sequence can be changed to a load before 8751the loop and a store after the loop. 8752 8753Not enabled at any optimization level. 8754 8755@item -fgcse-las 8756@opindex fgcse-las 8757When @option{-fgcse-las} is enabled, the global common subexpression 8758elimination pass eliminates redundant loads that come after stores to the 8759same memory location (both partial and full redundancies). 8760 8761Not enabled at any optimization level. 8762 8763@item -fgcse-after-reload 8764@opindex fgcse-after-reload 8765When @option{-fgcse-after-reload} is enabled, a redundant load elimination 8766pass is performed after reload. The purpose of this pass is to clean up 8767redundant spilling. 8768 8769Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 8770 8771@item -faggressive-loop-optimizations 8772@opindex faggressive-loop-optimizations 8773This option tells the loop optimizer to use language constraints to 8774derive bounds for the number of iterations of a loop. This assumes that 8775loop code does not invoke undefined behavior by for example causing signed 8776integer overflows or out-of-bound array accesses. The bounds for the 8777number of iterations of a loop are used to guide loop unrolling and peeling 8778and loop exit test optimizations. 8779This option is enabled by default. 8780 8781@item -funconstrained-commons 8782@opindex funconstrained-commons 8783This option tells the compiler that variables declared in common blocks 8784(e.g.@: Fortran) may later be overridden with longer trailing arrays. This 8785prevents certain optimizations that depend on knowing the array bounds. 8786 8787@item -fcrossjumping 8788@opindex fcrossjumping 8789Perform cross-jumping transformation. 8790This transformation unifies equivalent code and saves code size. The 8791resulting code may or may not perform better than without cross-jumping. 8792 8793Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8794 8795@item -fauto-inc-dec 8796@opindex fauto-inc-dec 8797Combine increments or decrements of addresses with memory accesses. 8798This pass is always skipped on architectures that do not have 8799instructions to support this. Enabled by default at @option{-O} and 8800higher on architectures that support this. 8801 8802@item -fdce 8803@opindex fdce 8804Perform dead code elimination (DCE) on RTL@. 8805Enabled by default at @option{-O} and higher. 8806 8807@item -fdse 8808@opindex fdse 8809Perform dead store elimination (DSE) on RTL@. 8810Enabled by default at @option{-O} and higher. 8811 8812@item -fif-conversion 8813@opindex fif-conversion 8814Attempt to transform conditional jumps into branch-less equivalents. This 8815includes use of conditional moves, min, max, set flags and abs instructions, and 8816some tricks doable by standard arithmetics. The use of conditional execution 8817on chips where it is available is controlled by @option{-fif-conversion2}. 8818 8819Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but 8820not with @option{-Og}. 8821 8822@item -fif-conversion2 8823@opindex fif-conversion2 8824Use conditional execution (where available) to transform conditional jumps into 8825branch-less equivalents. 8826 8827Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but 8828not with @option{-Og}. 8829 8830@item -fdeclone-ctor-dtor 8831@opindex fdeclone-ctor-dtor 8832The C++ ABI requires multiple entry points for constructors and 8833destructors: one for a base subobject, one for a complete object, and 8834one for a virtual destructor that calls operator delete afterwards. 8835For a hierarchy with virtual bases, the base and complete variants are 8836clones, which means two copies of the function. With this option, the 8837base and complete variants are changed to be thunks that call a common 8838implementation. 8839 8840Enabled by @option{-Os}. 8841 8842@item -fdelete-null-pointer-checks 8843@opindex fdelete-null-pointer-checks 8844Assume that programs cannot safely dereference null pointers, and that 8845no code or data element resides at address zero. 8846This option enables simple constant 8847folding optimizations at all optimization levels. In addition, other 8848optimization passes in GCC use this flag to control global dataflow 8849analyses that eliminate useless checks for null pointers; these assume 8850that a memory access to address zero always results in a trap, so 8851that if a pointer is checked after it has already been dereferenced, 8852it cannot be null. 8853 8854Note however that in some environments this assumption is not true. 8855Use @option{-fno-delete-null-pointer-checks} to disable this optimization 8856for programs that depend on that behavior. 8857 8858This option is enabled by default on most targets. On Nios II ELF, it 8859defaults to off. On AVR, CR16, and MSP430, this option is completely disabled. 8860 8861Passes that use the dataflow information 8862are enabled independently at different optimization levels. 8863 8864@item -fdevirtualize 8865@opindex fdevirtualize 8866Attempt to convert calls to virtual functions to direct calls. This 8867is done both within a procedure and interprocedurally as part of 8868indirect inlining (@option{-findirect-inlining}) and interprocedural constant 8869propagation (@option{-fipa-cp}). 8870Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8871 8872@item -fdevirtualize-speculatively 8873@opindex fdevirtualize-speculatively 8874Attempt to convert calls to virtual functions to speculative direct calls. 8875Based on the analysis of the type inheritance graph, determine for a given call 8876the set of likely targets. If the set is small, preferably of size 1, change 8877the call into a conditional deciding between direct and indirect calls. The 8878speculative calls enable more optimizations, such as inlining. When they seem 8879useless after further optimization, they are converted back into original form. 8880 8881@item -fdevirtualize-at-ltrans 8882@opindex fdevirtualize-at-ltrans 8883Stream extra information needed for aggressive devirtualization when running 8884the link-time optimizer in local transformation mode. 8885This option enables more devirtualization but 8886significantly increases the size of streamed data. For this reason it is 8887disabled by default. 8888 8889@item -fexpensive-optimizations 8890@opindex fexpensive-optimizations 8891Perform a number of minor optimizations that are relatively expensive. 8892 8893Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8894 8895@item -free 8896@opindex free 8897Attempt to remove redundant extension instructions. This is especially 8898helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 8899registers after writing to their lower 32-bit half. 8900 8901Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 8902@option{-O3}, @option{-Os}. 8903 8904@item -fno-lifetime-dse 8905@opindex fno-lifetime-dse 8906@opindex flifetime-dse 8907In C++ the value of an object is only affected by changes within its 8908lifetime: when the constructor begins, the object has an indeterminate 8909value, and any changes during the lifetime of the object are dead when 8910the object is destroyed. Normally dead store elimination will take 8911advantage of this; if your code relies on the value of the object 8912storage persisting beyond the lifetime of the object, you can use this 8913flag to disable this optimization. To preserve stores before the 8914constructor starts (e.g.@: because your operator new clears the object 8915storage) but still treat the object as dead after the destructor you, 8916can use @option{-flifetime-dse=1}. The default behavior can be 8917explicitly selected with @option{-flifetime-dse=2}. 8918@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}. 8919 8920@item -flive-range-shrinkage 8921@opindex flive-range-shrinkage 8922Attempt to decrease register pressure through register live range 8923shrinkage. This is helpful for fast processors with small or moderate 8924size register sets. 8925 8926@item -fira-algorithm=@var{algorithm} 8927@opindex fira-algorithm 8928Use the specified coloring algorithm for the integrated register 8929allocator. The @var{algorithm} argument can be @samp{priority}, which 8930specifies Chow's priority coloring, or @samp{CB}, which specifies 8931Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 8932for all architectures, but for those targets that do support it, it is 8933the default because it generates better code. 8934 8935@item -fira-region=@var{region} 8936@opindex fira-region 8937Use specified regions for the integrated register allocator. The 8938@var{region} argument should be one of the following: 8939 8940@table @samp 8941 8942@item all 8943Use all loops as register allocation regions. 8944This can give the best results for machines with a small and/or 8945irregular register set. 8946 8947@item mixed 8948Use all loops except for loops with small register pressure 8949as the regions. This value usually gives 8950the best results in most cases and for most architectures, 8951and is enabled by default when compiling with optimization for speed 8952(@option{-O}, @option{-O2}, @dots{}). 8953 8954@item one 8955Use all functions as a single region. 8956This typically results in the smallest code size, and is enabled by default for 8957@option{-Os} or @option{-O0}. 8958 8959@end table 8960 8961@item -fira-hoist-pressure 8962@opindex fira-hoist-pressure 8963Use IRA to evaluate register pressure in the code hoisting pass for 8964decisions to hoist expressions. This option usually results in smaller 8965code, but it can slow the compiler down. 8966 8967This option is enabled at level @option{-Os} for all targets. 8968 8969@item -fira-loop-pressure 8970@opindex fira-loop-pressure 8971Use IRA to evaluate register pressure in loops for decisions to move 8972loop invariants. This option usually results in generation 8973of faster and smaller code on machines with large register files (>= 32 8974registers), but it can slow the compiler down. 8975 8976This option is enabled at level @option{-O3} for some targets. 8977 8978@item -fno-ira-share-save-slots 8979@opindex fno-ira-share-save-slots 8980@opindex fira-share-save-slots 8981Disable sharing of stack slots used for saving call-used hard 8982registers living through a call. Each hard register gets a 8983separate stack slot, and as a result function stack frames are 8984larger. 8985 8986@item -fno-ira-share-spill-slots 8987@opindex fno-ira-share-spill-slots 8988@opindex fira-share-spill-slots 8989Disable sharing of stack slots allocated for pseudo-registers. Each 8990pseudo-register that does not get a hard register gets a separate 8991stack slot, and as a result function stack frames are larger. 8992 8993@item -flra-remat 8994@opindex flra-remat 8995Enable CFG-sensitive rematerialization in LRA. Instead of loading 8996values of spilled pseudos, LRA tries to rematerialize (recalculate) 8997values if it is profitable. 8998 8999Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9000 9001@item -fdelayed-branch 9002@opindex fdelayed-branch 9003If supported for the target machine, attempt to reorder instructions 9004to exploit instruction slots available after delayed branch 9005instructions. 9006 9007Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, 9008but not at @option{-Og}. 9009 9010@item -fschedule-insns 9011@opindex fschedule-insns 9012If supported for the target machine, attempt to reorder instructions to 9013eliminate execution stalls due to required data being unavailable. This 9014helps machines that have slow floating point or memory load instructions 9015by allowing other instructions to be issued until the result of the load 9016or floating-point instruction is required. 9017 9018Enabled at levels @option{-O2}, @option{-O3}. 9019 9020@item -fschedule-insns2 9021@opindex fschedule-insns2 9022Similar to @option{-fschedule-insns}, but requests an additional pass of 9023instruction scheduling after register allocation has been done. This is 9024especially useful on machines with a relatively small number of 9025registers and where memory load instructions take more than one cycle. 9026 9027Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9028 9029@item -fno-sched-interblock 9030@opindex fno-sched-interblock 9031@opindex fsched-interblock 9032Disable instruction scheduling across basic blocks, which 9033is normally enabled when scheduling before register allocation, i.e.@: 9034with @option{-fschedule-insns} or at @option{-O2} or higher. 9035 9036@item -fno-sched-spec 9037@opindex fno-sched-spec 9038@opindex fsched-spec 9039Disable speculative motion of non-load instructions, which 9040is normally enabled when scheduling before register allocation, i.e.@: 9041with @option{-fschedule-insns} or at @option{-O2} or higher. 9042 9043@item -fsched-pressure 9044@opindex fsched-pressure 9045Enable register pressure sensitive insn scheduling before register 9046allocation. This only makes sense when scheduling before register 9047allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 9048@option{-O2} or higher. Usage of this option can improve the 9049generated code and decrease its size by preventing register pressure 9050increase above the number of available hard registers and subsequent 9051spills in register allocation. 9052 9053@item -fsched-spec-load 9054@opindex fsched-spec-load 9055Allow speculative motion of some load instructions. This only makes 9056sense when scheduling before register allocation, i.e.@: with 9057@option{-fschedule-insns} or at @option{-O2} or higher. 9058 9059@item -fsched-spec-load-dangerous 9060@opindex fsched-spec-load-dangerous 9061Allow speculative motion of more load instructions. This only makes 9062sense when scheduling before register allocation, i.e.@: with 9063@option{-fschedule-insns} or at @option{-O2} or higher. 9064 9065@item -fsched-stalled-insns 9066@itemx -fsched-stalled-insns=@var{n} 9067@opindex fsched-stalled-insns 9068Define how many insns (if any) can be moved prematurely from the queue 9069of stalled insns into the ready list during the second scheduling pass. 9070@option{-fno-sched-stalled-insns} means that no insns are moved 9071prematurely, @option{-fsched-stalled-insns=0} means there is no limit 9072on how many queued insns can be moved prematurely. 9073@option{-fsched-stalled-insns} without a value is equivalent to 9074@option{-fsched-stalled-insns=1}. 9075 9076@item -fsched-stalled-insns-dep 9077@itemx -fsched-stalled-insns-dep=@var{n} 9078@opindex fsched-stalled-insns-dep 9079Define how many insn groups (cycles) are examined for a dependency 9080on a stalled insn that is a candidate for premature removal from the queue 9081of stalled insns. This has an effect only during the second scheduling pass, 9082and only if @option{-fsched-stalled-insns} is used. 9083@option{-fno-sched-stalled-insns-dep} is equivalent to 9084@option{-fsched-stalled-insns-dep=0}. 9085@option{-fsched-stalled-insns-dep} without a value is equivalent to 9086@option{-fsched-stalled-insns-dep=1}. 9087 9088@item -fsched2-use-superblocks 9089@opindex fsched2-use-superblocks 9090When scheduling after register allocation, use superblock scheduling. 9091This allows motion across basic block boundaries, 9092resulting in faster schedules. This option is experimental, as not all machine 9093descriptions used by GCC model the CPU closely enough to avoid unreliable 9094results from the algorithm. 9095 9096This only makes sense when scheduling after register allocation, i.e.@: with 9097@option{-fschedule-insns2} or at @option{-O2} or higher. 9098 9099@item -fsched-group-heuristic 9100@opindex fsched-group-heuristic 9101Enable the group heuristic in the scheduler. This heuristic favors 9102the instruction that belongs to a schedule group. This is enabled 9103by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 9104or @option{-fschedule-insns2} or at @option{-O2} or higher. 9105 9106@item -fsched-critical-path-heuristic 9107@opindex fsched-critical-path-heuristic 9108Enable the critical-path heuristic in the scheduler. This heuristic favors 9109instructions on the critical path. This is enabled by default when 9110scheduling is enabled, i.e.@: with @option{-fschedule-insns} 9111or @option{-fschedule-insns2} or at @option{-O2} or higher. 9112 9113@item -fsched-spec-insn-heuristic 9114@opindex fsched-spec-insn-heuristic 9115Enable the speculative instruction heuristic in the scheduler. This 9116heuristic favors speculative instructions with greater dependency weakness. 9117This is enabled by default when scheduling is enabled, i.e.@: 9118with @option{-fschedule-insns} or @option{-fschedule-insns2} 9119or at @option{-O2} or higher. 9120 9121@item -fsched-rank-heuristic 9122@opindex fsched-rank-heuristic 9123Enable the rank heuristic in the scheduler. This heuristic favors 9124the instruction belonging to a basic block with greater size or frequency. 9125This is enabled by default when scheduling is enabled, i.e.@: 9126with @option{-fschedule-insns} or @option{-fschedule-insns2} or 9127at @option{-O2} or higher. 9128 9129@item -fsched-last-insn-heuristic 9130@opindex fsched-last-insn-heuristic 9131Enable the last-instruction heuristic in the scheduler. This heuristic 9132favors the instruction that is less dependent on the last instruction 9133scheduled. This is enabled by default when scheduling is enabled, 9134i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 9135at @option{-O2} or higher. 9136 9137@item -fsched-dep-count-heuristic 9138@opindex fsched-dep-count-heuristic 9139Enable the dependent-count heuristic in the scheduler. This heuristic 9140favors the instruction that has more instructions depending on it. 9141This is enabled by default when scheduling is enabled, i.e.@: 9142with @option{-fschedule-insns} or @option{-fschedule-insns2} or 9143at @option{-O2} or higher. 9144 9145@item -freschedule-modulo-scheduled-loops 9146@opindex freschedule-modulo-scheduled-loops 9147Modulo scheduling is performed before traditional scheduling. If a loop 9148is modulo scheduled, later scheduling passes may change its schedule. 9149Use this option to control that behavior. 9150 9151@item -fselective-scheduling 9152@opindex fselective-scheduling 9153Schedule instructions using selective scheduling algorithm. Selective 9154scheduling runs instead of the first scheduler pass. 9155 9156@item -fselective-scheduling2 9157@opindex fselective-scheduling2 9158Schedule instructions using selective scheduling algorithm. Selective 9159scheduling runs instead of the second scheduler pass. 9160 9161@item -fsel-sched-pipelining 9162@opindex fsel-sched-pipelining 9163Enable software pipelining of innermost loops during selective scheduling. 9164This option has no effect unless one of @option{-fselective-scheduling} or 9165@option{-fselective-scheduling2} is turned on. 9166 9167@item -fsel-sched-pipelining-outer-loops 9168@opindex fsel-sched-pipelining-outer-loops 9169When pipelining loops during selective scheduling, also pipeline outer loops. 9170This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 9171 9172@item -fsemantic-interposition 9173@opindex fsemantic-interposition 9174Some object formats, like ELF, allow interposing of symbols by the 9175dynamic linker. 9176This means that for symbols exported from the DSO, the compiler cannot perform 9177interprocedural propagation, inlining and other optimizations in anticipation 9178that the function or variable in question may change. While this feature is 9179useful, for example, to rewrite memory allocation functions by a debugging 9180implementation, it is expensive in the terms of code quality. 9181With @option{-fno-semantic-interposition} the compiler assumes that 9182if interposition happens for functions the overwriting function will have 9183precisely the same semantics (and side effects). 9184Similarly if interposition happens 9185for variables, the constructor of the variable will be the same. The flag 9186has no effect for functions explicitly declared inline 9187(where it is never allowed for interposition to change semantics) 9188and for symbols explicitly declared weak. 9189 9190@item -fshrink-wrap 9191@opindex fshrink-wrap 9192Emit function prologues only before parts of the function that need it, 9193rather than at the top of the function. This flag is enabled by default at 9194@option{-O} and higher. 9195 9196@item -fshrink-wrap-separate 9197@opindex fshrink-wrap-separate 9198Shrink-wrap separate parts of the prologue and epilogue separately, so that 9199those parts are only executed when needed. 9200This option is on by default, but has no effect unless @option{-fshrink-wrap} 9201is also turned on and the target supports this. 9202 9203@item -fcaller-saves 9204@opindex fcaller-saves 9205Enable allocation of values to registers that are clobbered by 9206function calls, by emitting extra instructions to save and restore the 9207registers around such calls. Such allocation is done only when it 9208seems to result in better code. 9209 9210This option is always enabled by default on certain machines, usually 9211those which have no call-preserved registers to use instead. 9212 9213Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9214 9215@item -fcombine-stack-adjustments 9216@opindex fcombine-stack-adjustments 9217Tracks stack adjustments (pushes and pops) and stack memory references 9218and then tries to find ways to combine them. 9219 9220Enabled by default at @option{-O1} and higher. 9221 9222@item -fipa-ra 9223@opindex fipa-ra 9224Use caller save registers for allocation if those registers are not used by 9225any called function. In that case it is not necessary to save and restore 9226them around calls. This is only possible if called functions are part of 9227same compilation unit as current function and they are compiled before it. 9228 9229Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option 9230is disabled if generated code will be instrumented for profiling 9231(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known 9232exactly (this happens on targets that do not expose prologues 9233and epilogues in RTL). 9234 9235@item -fconserve-stack 9236@opindex fconserve-stack 9237Attempt to minimize stack usage. The compiler attempts to use less 9238stack space, even if that makes the program slower. This option 9239implies setting the @option{large-stack-frame} parameter to 100 9240and the @option{large-stack-frame-growth} parameter to 400. 9241 9242@item -ftree-reassoc 9243@opindex ftree-reassoc 9244Perform reassociation on trees. This flag is enabled by default 9245at @option{-O} and higher. 9246 9247@item -fcode-hoisting 9248@opindex fcode-hoisting 9249Perform code hoisting. Code hoisting tries to move the 9250evaluation of expressions executed on all paths to the function exit 9251as early as possible. This is especially useful as a code size 9252optimization, but it often helps for code speed as well. 9253This flag is enabled by default at @option{-O2} and higher. 9254 9255@item -ftree-pre 9256@opindex ftree-pre 9257Perform partial redundancy elimination (PRE) on trees. This flag is 9258enabled by default at @option{-O2} and @option{-O3}. 9259 9260@item -ftree-partial-pre 9261@opindex ftree-partial-pre 9262Make partial redundancy elimination (PRE) more aggressive. This flag is 9263enabled by default at @option{-O3}. 9264 9265@item -ftree-forwprop 9266@opindex ftree-forwprop 9267Perform forward propagation on trees. This flag is enabled by default 9268at @option{-O} and higher. 9269 9270@item -ftree-fre 9271@opindex ftree-fre 9272Perform full redundancy elimination (FRE) on trees. The difference 9273between FRE and PRE is that FRE only considers expressions 9274that are computed on all paths leading to the redundant computation. 9275This analysis is faster than PRE, though it exposes fewer redundancies. 9276This flag is enabled by default at @option{-O} and higher. 9277 9278@item -ftree-phiprop 9279@opindex ftree-phiprop 9280Perform hoisting of loads from conditional pointers on trees. This 9281pass is enabled by default at @option{-O} and higher. 9282 9283@item -fhoist-adjacent-loads 9284@opindex fhoist-adjacent-loads 9285Speculatively hoist loads from both branches of an if-then-else if the 9286loads are from adjacent locations in the same structure and the target 9287architecture has a conditional move instruction. This flag is enabled 9288by default at @option{-O2} and higher. 9289 9290@item -ftree-copy-prop 9291@opindex ftree-copy-prop 9292Perform copy propagation on trees. This pass eliminates unnecessary 9293copy operations. This flag is enabled by default at @option{-O} and 9294higher. 9295 9296@item -fipa-pure-const 9297@opindex fipa-pure-const 9298Discover which functions are pure or constant. 9299Enabled by default at @option{-O} and higher. 9300 9301@item -fipa-reference 9302@opindex fipa-reference 9303Discover which static variables do not escape the 9304compilation unit. 9305Enabled by default at @option{-O} and higher. 9306 9307@item -fipa-reference-addressable 9308@opindex fipa-reference-addressable 9309Discover read-only, write-only and non-addressable static variables. 9310Enabled by default at @option{-O} and higher. 9311 9312@item -fipa-stack-alignment 9313@opindex fipa-stack-alignment 9314Reduce stack alignment on call sites if possible. 9315Enabled by default. 9316 9317@item -fipa-pta 9318@opindex fipa-pta 9319Perform interprocedural pointer analysis and interprocedural modification 9320and reference analysis. This option can cause excessive memory and 9321compile-time usage on large compilation units. It is not enabled by 9322default at any optimization level. 9323 9324@item -fipa-profile 9325@opindex fipa-profile 9326Perform interprocedural profile propagation. The functions called only from 9327cold functions are marked as cold. Also functions executed once (such as 9328@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold 9329functions and loop less parts of functions executed once are then optimized for 9330size. 9331Enabled by default at @option{-O} and higher. 9332 9333@item -fipa-cp 9334@opindex fipa-cp 9335Perform interprocedural constant propagation. 9336This optimization analyzes the program to determine when values passed 9337to functions are constants and then optimizes accordingly. 9338This optimization can substantially increase performance 9339if the application has constants passed to functions. 9340This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 9341It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9342 9343@item -fipa-cp-clone 9344@opindex fipa-cp-clone 9345Perform function cloning to make interprocedural constant propagation stronger. 9346When enabled, interprocedural constant propagation performs function cloning 9347when externally visible function can be called with constant arguments. 9348Because this optimization can create multiple copies of functions, 9349it may significantly increase code size 9350(see @option{--param ipcp-unit-growth=@var{value}}). 9351This flag is enabled by default at @option{-O3}. 9352It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9353 9354@item -fipa-bit-cp 9355@opindex fipa-bit-cp 9356When enabled, perform interprocedural bitwise constant 9357propagation. This flag is enabled by default at @option{-O2} and 9358by @option{-fprofile-use} and @option{-fauto-profile}. 9359It requires that @option{-fipa-cp} is enabled. 9360 9361@item -fipa-vrp 9362@opindex fipa-vrp 9363When enabled, perform interprocedural propagation of value 9364ranges. This flag is enabled by default at @option{-O2}. It requires 9365that @option{-fipa-cp} is enabled. 9366 9367@item -fipa-icf 9368@opindex fipa-icf 9369Perform Identical Code Folding for functions and read-only variables. 9370The optimization reduces code size and may disturb unwind stacks by replacing 9371a function by equivalent one with a different name. The optimization works 9372more effectively with link-time optimization enabled. 9373 9374Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF 9375works on different levels and thus the optimizations are not same - there are 9376equivalences that are found only by GCC and equivalences found only by Gold. 9377 9378This flag is enabled by default at @option{-O2} and @option{-Os}. 9379 9380@item -flive-patching=@var{level} 9381@opindex flive-patching 9382Control GCC's optimizations to produce output suitable for live-patching. 9383 9384If the compiler's optimization uses a function's body or information extracted 9385from its body to optimize/change another function, the latter is called an 9386impacted function of the former. If a function is patched, its impacted 9387functions should be patched too. 9388 9389The impacted functions are determined by the compiler's interprocedural 9390optimizations. For example, a caller is impacted when inlining a function 9391into its caller, 9392cloning a function and changing its caller to call this new clone, 9393or extracting a function's pureness/constness information to optimize 9394its direct or indirect callers, etc. 9395 9396Usually, the more IPA optimizations enabled, the larger the number of 9397impacted functions for each function. In order to control the number of 9398impacted functions and more easily compute the list of impacted function, 9399IPA optimizations can be partially enabled at two different levels. 9400 9401The @var{level} argument should be one of the following: 9402 9403@table @samp 9404 9405@item inline-clone 9406 9407Only enable inlining and cloning optimizations, which includes inlining, 9408cloning, interprocedural scalar replacement of aggregates and partial inlining. 9409As a result, when patching a function, all its callers and its clones' 9410callers are impacted, therefore need to be patched as well. 9411 9412@option{-flive-patching=inline-clone} disables the following optimization flags: 9413@gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol 9414-fipa-icf -fipa-icf-functions -fipa-icf-variables @gol 9415-fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol 9416-fipa-stack-alignment} 9417 9418@item inline-only-static 9419 9420Only enable inlining of static functions. 9421As a result, when patching a static function, all its callers are impacted 9422and so need to be patched as well. 9423 9424In addition to all the flags that @option{-flive-patching=inline-clone} 9425disables, 9426@option{-flive-patching=inline-only-static} disables the following additional 9427optimization flags: 9428@gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp} 9429 9430@end table 9431 9432When @option{-flive-patching} is specified without any value, the default value 9433is @var{inline-clone}. 9434 9435This flag is disabled by default. 9436 9437Note that @option{-flive-patching} is not supported with link-time optimization 9438(@option{-flto}). 9439 9440@item -fisolate-erroneous-paths-dereference 9441@opindex fisolate-erroneous-paths-dereference 9442Detect paths that trigger erroneous or undefined behavior due to 9443dereferencing a null pointer. Isolate those paths from the main control 9444flow and turn the statement with erroneous or undefined behavior into a trap. 9445This flag is enabled by default at @option{-O2} and higher and depends on 9446@option{-fdelete-null-pointer-checks} also being enabled. 9447 9448@item -fisolate-erroneous-paths-attribute 9449@opindex fisolate-erroneous-paths-attribute 9450Detect paths that trigger erroneous or undefined behavior due to a null value 9451being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 9452attribute. Isolate those paths from the main control flow and turn the 9453statement with erroneous or undefined behavior into a trap. This is not 9454currently enabled, but may be enabled by @option{-O2} in the future. 9455 9456@item -ftree-sink 9457@opindex ftree-sink 9458Perform forward store motion on trees. This flag is 9459enabled by default at @option{-O} and higher. 9460 9461@item -ftree-bit-ccp 9462@opindex ftree-bit-ccp 9463Perform sparse conditional bit constant propagation on trees and propagate 9464pointer alignment information. 9465This pass only operates on local scalar variables and is enabled by default 9466at @option{-O1} and higher, except for @option{-Og}. 9467It requires that @option{-ftree-ccp} is enabled. 9468 9469@item -ftree-ccp 9470@opindex ftree-ccp 9471Perform sparse conditional constant propagation (CCP) on trees. This 9472pass only operates on local scalar variables and is enabled by default 9473at @option{-O} and higher. 9474 9475@item -fssa-backprop 9476@opindex fssa-backprop 9477Propagate information about uses of a value up the definition chain 9478in order to simplify the definitions. For example, this pass strips 9479sign operations if the sign of a value never matters. The flag is 9480enabled by default at @option{-O} and higher. 9481 9482@item -fssa-phiopt 9483@opindex fssa-phiopt 9484Perform pattern matching on SSA PHI nodes to optimize conditional 9485code. This pass is enabled by default at @option{-O1} and higher, 9486except for @option{-Og}. 9487 9488@item -ftree-switch-conversion 9489@opindex ftree-switch-conversion 9490Perform conversion of simple initializations in a switch to 9491initializations from a scalar array. This flag is enabled by default 9492at @option{-O2} and higher. 9493 9494@item -ftree-tail-merge 9495@opindex ftree-tail-merge 9496Look for identical code sequences. When found, replace one with a jump to the 9497other. This optimization is known as tail merging or cross jumping. This flag 9498is enabled by default at @option{-O2} and higher. The compilation time 9499in this pass can 9500be limited using @option{max-tail-merge-comparisons} parameter and 9501@option{max-tail-merge-iterations} parameter. 9502 9503@item -ftree-dce 9504@opindex ftree-dce 9505Perform dead code elimination (DCE) on trees. This flag is enabled by 9506default at @option{-O} and higher. 9507 9508@item -ftree-builtin-call-dce 9509@opindex ftree-builtin-call-dce 9510Perform conditional dead code elimination (DCE) for calls to built-in functions 9511that may set @code{errno} but are otherwise free of side effects. This flag is 9512enabled by default at @option{-O2} and higher if @option{-Os} is not also 9513specified. 9514 9515@item -ftree-dominator-opts 9516@opindex ftree-dominator-opts 9517Perform a variety of simple scalar cleanups (constant/copy 9518propagation, redundancy elimination, range propagation and expression 9519simplification) based on a dominator tree traversal. This also 9520performs jump threading (to reduce jumps to jumps). This flag is 9521enabled by default at @option{-O} and higher. 9522 9523@item -ftree-dse 9524@opindex ftree-dse 9525Perform dead store elimination (DSE) on trees. A dead store is a store into 9526a memory location that is later overwritten by another store without 9527any intervening loads. In this case the earlier store can be deleted. This 9528flag is enabled by default at @option{-O} and higher. 9529 9530@item -ftree-ch 9531@opindex ftree-ch 9532Perform loop header copying on trees. This is beneficial since it increases 9533effectiveness of code motion optimizations. It also saves one jump. This flag 9534is enabled by default at @option{-O} and higher. It is not enabled 9535for @option{-Os}, since it usually increases code size. 9536 9537@item -ftree-loop-optimize 9538@opindex ftree-loop-optimize 9539Perform loop optimizations on trees. This flag is enabled by default 9540at @option{-O} and higher. 9541 9542@item -ftree-loop-linear 9543@itemx -floop-strip-mine 9544@itemx -floop-block 9545@opindex ftree-loop-linear 9546@opindex floop-strip-mine 9547@opindex floop-block 9548Perform loop nest optimizations. Same as 9549@option{-floop-nest-optimize}. To use this code transformation, GCC has 9550to be configured with @option{--with-isl} to enable the Graphite loop 9551transformation infrastructure. 9552 9553@item -fgraphite-identity 9554@opindex fgraphite-identity 9555Enable the identity transformation for graphite. For every SCoP we generate 9556the polyhedral representation and transform it back to gimple. Using 9557@option{-fgraphite-identity} we can check the costs or benefits of the 9558GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 9559are also performed by the code generator isl, like index splitting and 9560dead code elimination in loops. 9561 9562@item -floop-nest-optimize 9563@opindex floop-nest-optimize 9564Enable the isl based loop nest optimizer. This is a generic loop nest 9565optimizer based on the Pluto optimization algorithms. It calculates a loop 9566structure optimized for data-locality and parallelism. This option 9567is experimental. 9568 9569@item -floop-parallelize-all 9570@opindex floop-parallelize-all 9571Use the Graphite data dependence analysis to identify loops that can 9572be parallelized. Parallelize all the loops that can be analyzed to 9573not contain loop carried dependences without checking that it is 9574profitable to parallelize the loops. 9575 9576@item -ftree-coalesce-vars 9577@opindex ftree-coalesce-vars 9578While transforming the program out of the SSA representation, attempt to 9579reduce copying by coalescing versions of different user-defined 9580variables, instead of just compiler temporaries. This may severely 9581limit the ability to debug an optimized program compiled with 9582@option{-fno-var-tracking-assignments}. In the negated form, this flag 9583prevents SSA coalescing of user variables. This option is enabled by 9584default if optimization is enabled, and it does very little otherwise. 9585 9586@item -ftree-loop-if-convert 9587@opindex ftree-loop-if-convert 9588Attempt to transform conditional jumps in the innermost loops to 9589branch-less equivalents. The intent is to remove control-flow from 9590the innermost loops in order to improve the ability of the 9591vectorization pass to handle these loops. This is enabled by default 9592if vectorization is enabled. 9593 9594@item -ftree-loop-distribution 9595@opindex ftree-loop-distribution 9596Perform loop distribution. This flag can improve cache performance on 9597big loop bodies and allow further loop optimizations, like 9598parallelization or vectorization, to take place. For example, the loop 9599@smallexample 9600DO I = 1, N 9601 A(I) = B(I) + C 9602 D(I) = E(I) * F 9603ENDDO 9604@end smallexample 9605is transformed to 9606@smallexample 9607DO I = 1, N 9608 A(I) = B(I) + C 9609ENDDO 9610DO I = 1, N 9611 D(I) = E(I) * F 9612ENDDO 9613@end smallexample 9614This flag is enabled by default at @option{-O3}. 9615It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9616 9617@item -ftree-loop-distribute-patterns 9618@opindex ftree-loop-distribute-patterns 9619Perform loop distribution of patterns that can be code generated with 9620calls to a library. This flag is enabled by default at @option{-O3}, and 9621by @option{-fprofile-use} and @option{-fauto-profile}. 9622 9623This pass distributes the initialization loops and generates a call to 9624memset zero. For example, the loop 9625@smallexample 9626DO I = 1, N 9627 A(I) = 0 9628 B(I) = A(I) + I 9629ENDDO 9630@end smallexample 9631is transformed to 9632@smallexample 9633DO I = 1, N 9634 A(I) = 0 9635ENDDO 9636DO I = 1, N 9637 B(I) = A(I) + I 9638ENDDO 9639@end smallexample 9640and the initialization loop is transformed into a call to memset zero. 9641This flag is enabled by default at @option{-O3}. 9642It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9643 9644@item -floop-interchange 9645@opindex floop-interchange 9646Perform loop interchange outside of graphite. This flag can improve cache 9647performance on loop nest and allow further loop optimizations, like 9648vectorization, to take place. For example, the loop 9649@smallexample 9650for (int i = 0; i < N; i++) 9651 for (int j = 0; j < N; j++) 9652 for (int k = 0; k < N; k++) 9653 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 9654@end smallexample 9655is transformed to 9656@smallexample 9657for (int i = 0; i < N; i++) 9658 for (int k = 0; k < N; k++) 9659 for (int j = 0; j < N; j++) 9660 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 9661@end smallexample 9662This flag is enabled by default at @option{-O3}. 9663It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9664 9665@item -floop-unroll-and-jam 9666@opindex floop-unroll-and-jam 9667Apply unroll and jam transformations on feasible loops. In a loop 9668nest this unrolls the outer loop by some factor and fuses the resulting 9669multiple inner loops. This flag is enabled by default at @option{-O3}. 9670It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9671 9672@item -ftree-loop-im 9673@opindex ftree-loop-im 9674Perform loop invariant motion on trees. This pass moves only invariants that 9675are hard to handle at RTL level (function calls, operations that expand to 9676nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 9677operands of conditions that are invariant out of the loop, so that we can use 9678just trivial invariantness analysis in loop unswitching. The pass also includes 9679store motion. 9680 9681@item -ftree-loop-ivcanon 9682@opindex ftree-loop-ivcanon 9683Create a canonical counter for number of iterations in loops for which 9684determining number of iterations requires complicated analysis. Later 9685optimizations then may determine the number easily. Useful especially 9686in connection with unrolling. 9687 9688@item -ftree-scev-cprop 9689@opindex ftree-scev-cprop 9690Perform final value replacement. If a variable is modified in a loop 9691in such a way that its value when exiting the loop can be determined using 9692only its initial value and the number of loop iterations, replace uses of 9693the final value by such a computation, provided it is sufficiently cheap. 9694This reduces data dependencies and may allow further simplifications. 9695Enabled by default at @option{-O} and higher. 9696 9697@item -fivopts 9698@opindex fivopts 9699Perform induction variable optimizations (strength reduction, induction 9700variable merging and induction variable elimination) on trees. 9701 9702@item -ftree-parallelize-loops=n 9703@opindex ftree-parallelize-loops 9704Parallelize loops, i.e., split their iteration space to run in n threads. 9705This is only possible for loops whose iterations are independent 9706and can be arbitrarily reordered. The optimization is only 9707profitable on multiprocessor machines, for loops that are CPU-intensive, 9708rather than constrained e.g.@: by memory bandwidth. This option 9709implies @option{-pthread}, and thus is only supported on targets 9710that have support for @option{-pthread}. 9711 9712@item -ftree-pta 9713@opindex ftree-pta 9714Perform function-local points-to analysis on trees. This flag is 9715enabled by default at @option{-O1} and higher, except for @option{-Og}. 9716 9717@item -ftree-sra 9718@opindex ftree-sra 9719Perform scalar replacement of aggregates. This pass replaces structure 9720references with scalars to prevent committing structures to memory too 9721early. This flag is enabled by default at @option{-O1} and higher, 9722except for @option{-Og}. 9723 9724@item -fstore-merging 9725@opindex fstore-merging 9726Perform merging of narrow stores to consecutive memory addresses. This pass 9727merges contiguous stores of immediate values narrower than a word into fewer 9728wider stores to reduce the number of instructions. This is enabled by default 9729at @option{-O2} and higher as well as @option{-Os}. 9730 9731@item -ftree-ter 9732@opindex ftree-ter 9733Perform temporary expression replacement during the SSA->normal phase. Single 9734use/single def temporaries are replaced at their use location with their 9735defining expression. This results in non-GIMPLE code, but gives the expanders 9736much more complex trees to work on resulting in better RTL generation. This is 9737enabled by default at @option{-O} and higher. 9738 9739@item -ftree-slsr 9740@opindex ftree-slsr 9741Perform straight-line strength reduction on trees. This recognizes related 9742expressions involving multiplications and replaces them by less expensive 9743calculations when possible. This is enabled by default at @option{-O} and 9744higher. 9745 9746@item -ftree-vectorize 9747@opindex ftree-vectorize 9748Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 9749and @option{-ftree-slp-vectorize} if not explicitly specified. 9750 9751@item -ftree-loop-vectorize 9752@opindex ftree-loop-vectorize 9753Perform loop vectorization on trees. This flag is enabled by default at 9754@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 9755and @option{-fauto-profile}. 9756 9757@item -ftree-slp-vectorize 9758@opindex ftree-slp-vectorize 9759Perform basic block vectorization on trees. This flag is enabled by default at 9760@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 9761and @option{-fauto-profile}. 9762 9763@item -fvect-cost-model=@var{model} 9764@opindex fvect-cost-model 9765Alter the cost model used for vectorization. The @var{model} argument 9766should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}. 9767With the @samp{unlimited} model the vectorized code-path is assumed 9768to be profitable while with the @samp{dynamic} model a runtime check 9769guards the vectorized code-path to enable it only for iteration 9770counts that will likely execute faster than when executing the original 9771scalar loop. The @samp{cheap} model disables vectorization of 9772loops where doing so would be cost prohibitive for example due to 9773required runtime checks for data dependence or alignment but otherwise 9774is equal to the @samp{dynamic} model. 9775The default cost model depends on other optimization flags and is 9776either @samp{dynamic} or @samp{cheap}. 9777 9778@item -fsimd-cost-model=@var{model} 9779@opindex fsimd-cost-model 9780Alter the cost model used for vectorization of loops marked with the OpenMP 9781simd directive. The @var{model} argument should be one of 9782@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 9783have the same meaning as described in @option{-fvect-cost-model} and by 9784default a cost model defined with @option{-fvect-cost-model} is used. 9785 9786@item -ftree-vrp 9787@opindex ftree-vrp 9788Perform Value Range Propagation on trees. This is similar to the 9789constant propagation pass, but instead of values, ranges of values are 9790propagated. This allows the optimizers to remove unnecessary range 9791checks like array bound checks and null pointer checks. This is 9792enabled by default at @option{-O2} and higher. Null pointer check 9793elimination is only done if @option{-fdelete-null-pointer-checks} is 9794enabled. 9795 9796@item -fsplit-paths 9797@opindex fsplit-paths 9798Split paths leading to loop backedges. This can improve dead code 9799elimination and common subexpression elimination. This is enabled by 9800default at @option{-O3} and above. 9801 9802@item -fsplit-ivs-in-unroller 9803@opindex fsplit-ivs-in-unroller 9804Enables expression of values of induction variables in later iterations 9805of the unrolled loop using the value in the first iteration. This breaks 9806long dependency chains, thus improving efficiency of the scheduling passes. 9807 9808A combination of @option{-fweb} and CSE is often sufficient to obtain the 9809same effect. However, that is not reliable in cases where the loop body 9810is more complicated than a single basic block. It also does not work at all 9811on some architectures due to restrictions in the CSE pass. 9812 9813This optimization is enabled by default. 9814 9815@item -fvariable-expansion-in-unroller 9816@opindex fvariable-expansion-in-unroller 9817With this option, the compiler creates multiple copies of some 9818local variables when unrolling a loop, which can result in superior code. 9819 9820@item -fpartial-inlining 9821@opindex fpartial-inlining 9822Inline parts of functions. This option has any effect only 9823when inlining itself is turned on by the @option{-finline-functions} 9824or @option{-finline-small-functions} options. 9825 9826Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9827 9828@item -fpredictive-commoning 9829@opindex fpredictive-commoning 9830Perform predictive commoning optimization, i.e., reusing computations 9831(especially memory loads and stores) performed in previous 9832iterations of loops. 9833 9834This option is enabled at level @option{-O3}. 9835It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9836 9837@item -fprefetch-loop-arrays 9838@opindex fprefetch-loop-arrays 9839If supported by the target machine, generate instructions to prefetch 9840memory to improve the performance of loops that access large arrays. 9841 9842This option may generate better or worse code; results are highly 9843dependent on the structure of loops within the source code. 9844 9845Disabled at level @option{-Os}. 9846 9847@item -fno-printf-return-value 9848@opindex fno-printf-return-value 9849@opindex fprintf-return-value 9850Do not substitute constants for known return value of formatted output 9851functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and 9852@code{vsnprintf} (but not @code{printf} of @code{fprintf}). This 9853transformation allows GCC to optimize or even eliminate branches based 9854on the known return value of these functions called with arguments that 9855are either constant, or whose values are known to be in a range that 9856makes determining the exact return value possible. For example, when 9857@option{-fprintf-return-value} is in effect, both the branch and the 9858body of the @code{if} statement (but not the call to @code{snprint}) 9859can be optimized away when @code{i} is a 32-bit or smaller integer 9860because the return value is guaranteed to be at most 8. 9861 9862@smallexample 9863char buf[9]; 9864if (snprintf (buf, "%08x", i) >= sizeof buf) 9865 @dots{} 9866@end smallexample 9867 9868The @option{-fprintf-return-value} option relies on other optimizations 9869and yields best results with @option{-O2} and above. It works in tandem 9870with the @option{-Wformat-overflow} and @option{-Wformat-truncation} 9871options. The @option{-fprintf-return-value} option is enabled by default. 9872 9873@item -fno-peephole 9874@itemx -fno-peephole2 9875@opindex fno-peephole 9876@opindex fpeephole 9877@opindex fno-peephole2 9878@opindex fpeephole2 9879Disable any machine-specific peephole optimizations. The difference 9880between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 9881are implemented in the compiler; some targets use one, some use the 9882other, a few use both. 9883 9884@option{-fpeephole} is enabled by default. 9885@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9886 9887@item -fno-guess-branch-probability 9888@opindex fno-guess-branch-probability 9889@opindex fguess-branch-probability 9890Do not guess branch probabilities using heuristics. 9891 9892GCC uses heuristics to guess branch probabilities if they are 9893not provided by profiling feedback (@option{-fprofile-arcs}). These 9894heuristics are based on the control flow graph. If some branch probabilities 9895are specified by @code{__builtin_expect}, then the heuristics are 9896used to guess branch probabilities for the rest of the control flow graph, 9897taking the @code{__builtin_expect} info into account. The interactions 9898between the heuristics and @code{__builtin_expect} can be complex, and in 9899some cases, it may be useful to disable the heuristics so that the effects 9900of @code{__builtin_expect} are easier to understand. 9901 9902It is also possible to specify expected probability of the expression 9903with @code{__builtin_expect_with_probability} built-in function. 9904 9905The default is @option{-fguess-branch-probability} at levels 9906@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9907 9908@item -freorder-blocks 9909@opindex freorder-blocks 9910Reorder basic blocks in the compiled function in order to reduce number of 9911taken branches and improve code locality. 9912 9913Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9914 9915@item -freorder-blocks-algorithm=@var{algorithm} 9916@opindex freorder-blocks-algorithm 9917Use the specified algorithm for basic block reordering. The 9918@var{algorithm} argument can be @samp{simple}, which does not increase 9919code size (except sometimes due to secondary effects like alignment), 9920or @samp{stc}, the ``software trace cache'' algorithm, which tries to 9921put all often executed code together, minimizing the number of branches 9922executed by making extra copies of code. 9923 9924The default is @samp{simple} at levels @option{-O}, @option{-Os}, and 9925@samp{stc} at levels @option{-O2}, @option{-O3}. 9926 9927@item -freorder-blocks-and-partition 9928@opindex freorder-blocks-and-partition 9929In addition to reordering basic blocks in the compiled function, in order 9930to reduce number of taken branches, partitions hot and cold basic blocks 9931into separate sections of the assembly and @file{.o} files, to improve 9932paging and cache locality performance. 9933 9934This optimization is automatically turned off in the presence of 9935exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined 9936section attribute and on any architecture that does not support named 9937sections. When @option{-fsplit-stack} is used this option is not 9938enabled by default (to avoid linker errors), but may be enabled 9939explicitly (if using a working linker). 9940 9941Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}. 9942 9943@item -freorder-functions 9944@opindex freorder-functions 9945Reorder functions in the object file in order to 9946improve code locality. This is implemented by using special 9947subsections @code{.text.hot} for most frequently executed functions and 9948@code{.text.unlikely} for unlikely executed functions. Reordering is done by 9949the linker so object file format must support named sections and linker must 9950place them in a reasonable way. 9951 9952This option isn't effective unless you either provide profile feedback 9953(see @option{-fprofile-arcs} for details) or manually annotate functions with 9954@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}). 9955 9956Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9957 9958@item -fstrict-aliasing 9959@opindex fstrict-aliasing 9960Allow the compiler to assume the strictest aliasing rules applicable to 9961the language being compiled. For C (and C++), this activates 9962optimizations based on the type of expressions. In particular, an 9963object of one type is assumed never to reside at the same address as an 9964object of a different type, unless the types are almost the same. For 9965example, an @code{unsigned int} can alias an @code{int}, but not a 9966@code{void*} or a @code{double}. A character type may alias any other 9967type. 9968 9969@anchor{Type-punning}Pay special attention to code like this: 9970@smallexample 9971union a_union @{ 9972 int i; 9973 double d; 9974@}; 9975 9976int f() @{ 9977 union a_union t; 9978 t.d = 3.0; 9979 return t.i; 9980@} 9981@end smallexample 9982The practice of reading from a different union member than the one most 9983recently written to (called ``type-punning'') is common. Even with 9984@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 9985is accessed through the union type. So, the code above works as 9986expected. @xref{Structures unions enumerations and bit-fields 9987implementation}. However, this code might not: 9988@smallexample 9989int f() @{ 9990 union a_union t; 9991 int* ip; 9992 t.d = 3.0; 9993 ip = &t.i; 9994 return *ip; 9995@} 9996@end smallexample 9997 9998Similarly, access by taking the address, casting the resulting pointer 9999and dereferencing the result has undefined behavior, even if the cast 10000uses a union type, e.g.: 10001@smallexample 10002int f() @{ 10003 double d = 3.0; 10004 return ((union a_union *) &d)->i; 10005@} 10006@end smallexample 10007 10008The @option{-fstrict-aliasing} option is enabled at levels 10009@option{-O2}, @option{-O3}, @option{-Os}. 10010 10011@item -falign-functions 10012@itemx -falign-functions=@var{n} 10013@itemx -falign-functions=@var{n}:@var{m} 10014@itemx -falign-functions=@var{n}:@var{m}:@var{n2} 10015@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2} 10016@opindex falign-functions 10017Align the start of functions to the next power-of-two greater than 10018@var{n}, skipping up to @var{m}-1 bytes. This ensures that at least 10019the first @var{m} bytes of the function can be fetched by the CPU 10020without crossing an @var{n}-byte alignment boundary. 10021 10022If @var{m} is not specified, it defaults to @var{n}. 10023 10024Examples: @option{-falign-functions=32} aligns functions to the next 1002532-byte boundary, @option{-falign-functions=24} aligns to the next 1002632-byte boundary only if this can be done by skipping 23 bytes or less, 10027@option{-falign-functions=32:7} aligns to the next 1002832-byte boundary only if this can be done by skipping 6 bytes or less. 10029 10030The second pair of @var{n2}:@var{m2} values allows you to specify 10031a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to 10032the next 64-byte boundary if this can be done by skipping 6 bytes or less, 10033otherwise aligns to the next 32-byte boundary if this can be done 10034by skipping 2 bytes or less. 10035If @var{m2} is not specified, it defaults to @var{n2}. 10036 10037Some assemblers only support this flag when @var{n} is a power of two; 10038in that case, it is rounded up. 10039 10040@option{-fno-align-functions} and @option{-falign-functions=1} are 10041equivalent and mean that functions are not aligned. 10042 10043If @var{n} is not specified or is zero, use a machine-dependent default. 10044The maximum allowed @var{n} option value is 65536. 10045 10046Enabled at levels @option{-O2}, @option{-O3}. 10047 10048@item -flimit-function-alignment 10049If this option is enabled, the compiler tries to avoid unnecessarily 10050overaligning functions. It attempts to instruct the assembler to align 10051by the amount specified by @option{-falign-functions}, but not to 10052skip more bytes than the size of the function. 10053 10054@item -falign-labels 10055@itemx -falign-labels=@var{n} 10056@itemx -falign-labels=@var{n}:@var{m} 10057@itemx -falign-labels=@var{n}:@var{m}:@var{n2} 10058@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2} 10059@opindex falign-labels 10060Align all branch targets to a power-of-two boundary. 10061 10062Parameters of this option are analogous to the @option{-falign-functions} option. 10063@option{-fno-align-labels} and @option{-falign-labels=1} are 10064equivalent and mean that labels are not aligned. 10065 10066If @option{-falign-loops} or @option{-falign-jumps} are applicable and 10067are greater than this value, then their values are used instead. 10068 10069If @var{n} is not specified or is zero, use a machine-dependent default 10070which is very likely to be @samp{1}, meaning no alignment. 10071The maximum allowed @var{n} option value is 65536. 10072 10073Enabled at levels @option{-O2}, @option{-O3}. 10074 10075@item -falign-loops 10076@itemx -falign-loops=@var{n} 10077@itemx -falign-loops=@var{n}:@var{m} 10078@itemx -falign-loops=@var{n}:@var{m}:@var{n2} 10079@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2} 10080@opindex falign-loops 10081Align loops to a power-of-two boundary. If the loops are executed 10082many times, this makes up for any execution of the dummy padding 10083instructions. 10084 10085Parameters of this option are analogous to the @option{-falign-functions} option. 10086@option{-fno-align-loops} and @option{-falign-loops=1} are 10087equivalent and mean that loops are not aligned. 10088The maximum allowed @var{n} option value is 65536. 10089 10090If @var{n} is not specified or is zero, use a machine-dependent default. 10091 10092Enabled at levels @option{-O2}, @option{-O3}. 10093 10094@item -falign-jumps 10095@itemx -falign-jumps=@var{n} 10096@itemx -falign-jumps=@var{n}:@var{m} 10097@itemx -falign-jumps=@var{n}:@var{m}:@var{n2} 10098@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2} 10099@opindex falign-jumps 10100Align branch targets to a power-of-two boundary, for branch targets 10101where the targets can only be reached by jumping. In this case, 10102no dummy operations need be executed. 10103 10104Parameters of this option are analogous to the @option{-falign-functions} option. 10105@option{-fno-align-jumps} and @option{-falign-jumps=1} are 10106equivalent and mean that loops are not aligned. 10107 10108If @var{n} is not specified or is zero, use a machine-dependent default. 10109The maximum allowed @var{n} option value is 65536. 10110 10111Enabled at levels @option{-O2}, @option{-O3}. 10112 10113@item -funit-at-a-time 10114@opindex funit-at-a-time 10115This option is left for compatibility reasons. @option{-funit-at-a-time} 10116has no effect, while @option{-fno-unit-at-a-time} implies 10117@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 10118 10119Enabled by default. 10120 10121@item -fno-toplevel-reorder 10122@opindex fno-toplevel-reorder 10123@opindex ftoplevel-reorder 10124Do not reorder top-level functions, variables, and @code{asm} 10125statements. Output them in the same order that they appear in the 10126input file. When this option is used, unreferenced static variables 10127are not removed. This option is intended to support existing code 10128that relies on a particular ordering. For new code, it is better to 10129use attributes when possible. 10130 10131@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and 10132also at @option{-O0} if @option{-fsection-anchors} is explicitly requested. 10133Additionally @option{-fno-toplevel-reorder} implies 10134@option{-fno-section-anchors}. 10135 10136@item -fweb 10137@opindex fweb 10138Constructs webs as commonly used for register allocation purposes and assign 10139each web individual pseudo register. This allows the register allocation pass 10140to operate on pseudos directly, but also strengthens several other optimization 10141passes, such as CSE, loop optimizer and trivial dead code remover. It can, 10142however, make debugging impossible, since variables no longer stay in a 10143``home register''. 10144 10145Enabled by default with @option{-funroll-loops}. 10146 10147@item -fwhole-program 10148@opindex fwhole-program 10149Assume that the current compilation unit represents the whole program being 10150compiled. All public functions and variables with the exception of @code{main} 10151and those merged by attribute @code{externally_visible} become static functions 10152and in effect are optimized more aggressively by interprocedural optimizers. 10153 10154This option should not be used in combination with @option{-flto}. 10155Instead relying on a linker plugin should provide safer and more precise 10156information. 10157 10158@item -flto[=@var{n}] 10159@opindex flto 10160This option runs the standard link-time optimizer. When invoked 10161with source code, it generates GIMPLE (one of GCC's internal 10162representations) and writes it to special ELF sections in the object 10163file. When the object files are linked together, all the function 10164bodies are read from these ELF sections and instantiated as if they 10165had been part of the same translation unit. 10166 10167To use the link-time optimizer, @option{-flto} and optimization 10168options should be specified at compile time and during the final link. 10169It is recommended that you compile all the files participating in the 10170same link with the same options and also specify those options at 10171link time. 10172For example: 10173 10174@smallexample 10175gcc -c -O2 -flto foo.c 10176gcc -c -O2 -flto bar.c 10177gcc -o myprog -flto -O2 foo.o bar.o 10178@end smallexample 10179 10180The first two invocations to GCC save a bytecode representation 10181of GIMPLE into special ELF sections inside @file{foo.o} and 10182@file{bar.o}. The final invocation reads the GIMPLE bytecode from 10183@file{foo.o} and @file{bar.o}, merges the two files into a single 10184internal image, and compiles the result as usual. Since both 10185@file{foo.o} and @file{bar.o} are merged into a single image, this 10186causes all the interprocedural analyses and optimizations in GCC to 10187work across the two files as if they were a single one. This means, 10188for example, that the inliner is able to inline functions in 10189@file{bar.o} into functions in @file{foo.o} and vice-versa. 10190 10191Another (simpler) way to enable link-time optimization is: 10192 10193@smallexample 10194gcc -o myprog -flto -O2 foo.c bar.c 10195@end smallexample 10196 10197The above generates bytecode for @file{foo.c} and @file{bar.c}, 10198merges them together into a single GIMPLE representation and optimizes 10199them as usual to produce @file{myprog}. 10200 10201The important thing to keep in mind is that to enable link-time 10202optimizations you need to use the GCC driver to perform the link step. 10203GCC automatically performs link-time optimization if any of the 10204objects involved were compiled with the @option{-flto} command-line option. 10205You can always override 10206the automatic decision to do link-time optimization 10207by passing @option{-fno-lto} to the link command. 10208 10209To make whole program optimization effective, it is necessary to make 10210certain whole program assumptions. The compiler needs to know 10211what functions and variables can be accessed by libraries and runtime 10212outside of the link-time optimized unit. When supported by the linker, 10213the linker plugin (see @option{-fuse-linker-plugin}) passes information 10214to the compiler about used and externally visible symbols. When 10215the linker plugin is not available, @option{-fwhole-program} should be 10216used to allow the compiler to make these assumptions, which leads 10217to more aggressive optimization decisions. 10218 10219When a file is compiled with @option{-flto} without 10220@option{-fuse-linker-plugin}, the generated object file is larger than 10221a regular object file because it contains GIMPLE bytecodes and the usual 10222final code (see @option{-ffat-lto-objects}. This means that 10223object files with LTO information can be linked as normal object 10224files; if @option{-fno-lto} is passed to the linker, no 10225interprocedural optimizations are applied. Note that when 10226@option{-fno-fat-lto-objects} is enabled the compile stage is faster 10227but you cannot perform a regular, non-LTO link on them. 10228 10229When producing the final binary, GCC only 10230applies link-time optimizations to those files that contain bytecode. 10231Therefore, you can mix and match object files and libraries with 10232GIMPLE bytecodes and final object code. GCC automatically selects 10233which files to optimize in LTO mode and which files to link without 10234further processing. 10235 10236Generally, options specified at link time override those 10237specified at compile time, although in some cases GCC attempts to infer 10238link-time options from the settings used to compile the input files. 10239 10240If you do not specify an optimization level option @option{-O} at 10241link time, then GCC uses the highest optimization level 10242used when compiling the object files. Note that it is generally 10243ineffective to specify an optimization level option only at link time and 10244not at compile time, for two reasons. First, compiling without 10245optimization suppresses compiler passes that gather information 10246needed for effective optimization at link time. Second, some early 10247optimization passes can be performed only at compile time and 10248not at link time. 10249 10250There are some code generation flags preserved by GCC when 10251generating bytecodes, as they need to be used during the final link. 10252Currently, the following options and their settings are taken from 10253the first object file that explicitly specifies them: 10254@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon}, 10255@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm} 10256and all the @option{-m} target flags. 10257 10258Certain ABI-changing flags are required to match in all compilation units, 10259and trying to override this at link time with a conflicting value 10260is ignored. This includes options such as @option{-freg-struct-return} 10261and @option{-fpcc-struct-return}. 10262 10263Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 10264@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 10265are passed through to the link stage and merged conservatively for 10266conflicting translation units. Specifically 10267@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 10268precedence; and for example @option{-ffp-contract=off} takes precedence 10269over @option{-ffp-contract=fast}. You can override them at link time. 10270 10271If LTO encounters objects with C linkage declared with incompatible 10272types in separate translation units to be linked together (undefined 10273behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 10274issued. The behavior is still undefined at run time. Similar 10275diagnostics may be raised for other languages. 10276 10277Another feature of LTO is that it is possible to apply interprocedural 10278optimizations on files written in different languages: 10279 10280@smallexample 10281gcc -c -flto foo.c 10282g++ -c -flto bar.cc 10283gfortran -c -flto baz.f90 10284g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 10285@end smallexample 10286 10287Notice that the final link is done with @command{g++} to get the C++ 10288runtime libraries and @option{-lgfortran} is added to get the Fortran 10289runtime libraries. In general, when mixing languages in LTO mode, you 10290should use the same link command options as when mixing languages in a 10291regular (non-LTO) compilation. 10292 10293If object files containing GIMPLE bytecode are stored in a library archive, say 10294@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 10295are using a linker with plugin support. To create static libraries suitable 10296for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 10297and @command{ranlib}; 10298to show the symbols of object files with GIMPLE bytecode, use 10299@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 10300and @command{nm} have been compiled with plugin support. At link time, use the 10301flag @option{-fuse-linker-plugin} to ensure that the library participates in 10302the LTO optimization process: 10303 10304@smallexample 10305gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 10306@end smallexample 10307 10308With the linker plugin enabled, the linker extracts the needed 10309GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 10310to make them part of the aggregated GIMPLE image to be optimized. 10311 10312If you are not using a linker with plugin support and/or do not 10313enable the linker plugin, then the objects inside @file{libfoo.a} 10314are extracted and linked as usual, but they do not participate 10315in the LTO optimization process. In order to make a static library suitable 10316for both LTO optimization and usual linkage, compile its object files with 10317@option{-flto} @option{-ffat-lto-objects}. 10318 10319Link-time optimizations do not require the presence of the whole program to 10320operate. If the program does not require any symbols to be exported, it is 10321possible to combine @option{-flto} and @option{-fwhole-program} to allow 10322the interprocedural optimizers to use more aggressive assumptions which may 10323lead to improved optimization opportunities. 10324Use of @option{-fwhole-program} is not needed when linker plugin is 10325active (see @option{-fuse-linker-plugin}). 10326 10327The current implementation of LTO makes no 10328attempt to generate bytecode that is portable between different 10329types of hosts. The bytecode files are versioned and there is a 10330strict version check, so bytecode files generated in one version of 10331GCC do not work with an older or newer version of GCC. 10332 10333Link-time optimization does not work well with generation of debugging 10334information on systems other than those using a combination of ELF and 10335DWARF. 10336 10337If you specify the optional @var{n}, the optimization and code 10338generation done at link time is executed in parallel using @var{n} 10339parallel jobs by utilizing an installed @command{make} program. The 10340environment variable @env{MAKE} may be used to override the program 10341used. The default value for @var{n} is 1. 10342 10343You can also specify @option{-flto=jobserver} to use GNU make's 10344job server mode to determine the number of parallel jobs. This 10345is useful when the Makefile calling GCC is already executing in parallel. 10346You must prepend a @samp{+} to the command recipe in the parent Makefile 10347for this to work. This option likely only works if @env{MAKE} is 10348GNU make. 10349 10350@item -flto-partition=@var{alg} 10351@opindex flto-partition 10352Specify the partitioning algorithm used by the link-time optimizer. 10353The value is either @samp{1to1} to specify a partitioning mirroring 10354the original source files or @samp{balanced} to specify partitioning 10355into equally sized chunks (whenever possible) or @samp{max} to create 10356new partition for every symbol where possible. Specifying @samp{none} 10357as an algorithm disables partitioning and streaming completely. 10358The default value is @samp{balanced}. While @samp{1to1} can be used 10359as an workaround for various code ordering issues, the @samp{max} 10360partitioning is intended for internal testing only. 10361The value @samp{one} specifies that exactly one partition should be 10362used while the value @samp{none} bypasses partitioning and executes 10363the link-time optimization step directly from the WPA phase. 10364 10365@item -flto-odr-type-merging 10366@opindex flto-odr-type-merging 10367Enable streaming of mangled types names of C++ types and their unification 10368at link time. This increases size of LTO object files, but enables 10369diagnostics about One Definition Rule violations. 10370 10371@item -flto-compression-level=@var{n} 10372@opindex flto-compression-level 10373This option specifies the level of compression used for intermediate 10374language written to LTO object files, and is only meaningful in 10375conjunction with LTO mode (@option{-flto}). Valid 10376values are 0 (no compression) to 9 (maximum compression). Values 10377outside this range are clamped to either 0 or 9. If the option is not 10378given, a default balanced compression setting is used. 10379 10380@item -fuse-linker-plugin 10381@opindex fuse-linker-plugin 10382Enables the use of a linker plugin during link-time optimization. This 10383option relies on plugin support in the linker, which is available in gold 10384or in GNU ld 2.21 or newer. 10385 10386This option enables the extraction of object files with GIMPLE bytecode out 10387of library archives. This improves the quality of optimization by exposing 10388more code to the link-time optimizer. This information specifies what 10389symbols can be accessed externally (by non-LTO object or during dynamic 10390linking). Resulting code quality improvements on binaries (and shared 10391libraries that use hidden visibility) are similar to @option{-fwhole-program}. 10392See @option{-flto} for a description of the effect of this flag and how to 10393use it. 10394 10395This option is enabled by default when LTO support in GCC is enabled 10396and GCC was configured for use with 10397a linker supporting plugins (GNU ld 2.21 or newer or gold). 10398 10399@item -ffat-lto-objects 10400@opindex ffat-lto-objects 10401Fat LTO objects are object files that contain both the intermediate language 10402and the object code. This makes them usable for both LTO linking and normal 10403linking. This option is effective only when compiling with @option{-flto} 10404and is ignored at link time. 10405 10406@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 10407requires the complete toolchain to be aware of LTO. It requires a linker with 10408linker plugin support for basic functionality. Additionally, 10409@command{nm}, @command{ar} and @command{ranlib} 10410need to support linker plugins to allow a full-featured build environment 10411(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 10412@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 10413to these tools. With non fat LTO makefiles need to be modified to use them. 10414 10415Note that modern binutils provide plugin auto-load mechanism. 10416Installing the linker plugin into @file{$libdir/bfd-plugins} has the same 10417effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and 10418@command{gcc-ranlib}). 10419 10420The default is @option{-fno-fat-lto-objects} on targets with linker plugin 10421support. 10422 10423@item -fcompare-elim 10424@opindex fcompare-elim 10425After register allocation and post-register allocation instruction splitting, 10426identify arithmetic instructions that compute processor flags similar to a 10427comparison operation based on that arithmetic. If possible, eliminate the 10428explicit comparison operation. 10429 10430This pass only applies to certain targets that cannot explicitly represent 10431the comparison operation before register allocation is complete. 10432 10433Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 10434 10435@item -fcprop-registers 10436@opindex fcprop-registers 10437After register allocation and post-register allocation instruction splitting, 10438perform a copy-propagation pass to try to reduce scheduling dependencies 10439and occasionally eliminate the copy. 10440 10441Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 10442 10443@item -fprofile-correction 10444@opindex fprofile-correction 10445Profiles collected using an instrumented binary for multi-threaded programs may 10446be inconsistent due to missed counter updates. When this option is specified, 10447GCC uses heuristics to correct or smooth out such inconsistencies. By 10448default, GCC emits an error message when an inconsistent profile is detected. 10449 10450This option is enabled by @option{-fauto-profile}. 10451 10452@item -fprofile-use 10453@itemx -fprofile-use=@var{path} 10454@opindex fprofile-use 10455Enable profile feedback-directed optimizations, 10456and the following optimizations, many of which 10457are generally profitable only with profile feedback available: 10458 10459@gccoptlist{-fbranch-probabilities -fprofile-values @gol 10460-funroll-loops -fpeel-loops -ftracer -fvpt @gol 10461-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 10462-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 10463-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 10464-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 10465-fprofile-reorder-functions} 10466 10467Before you can use this option, you must first generate profiling information. 10468@xref{Instrumentation Options}, for information about the 10469@option{-fprofile-generate} option. 10470 10471By default, GCC emits an error message if the feedback profiles do not 10472match the source code. This error can be turned into a warning by using 10473@option{-Wno-error=coverage-mismatch}. Note this may result in poorly 10474optimized code. Additionally, by default, GCC also emits a warning message if 10475the feedback profiles do not exist (see @option{-Wmissing-profile}). 10476 10477If @var{path} is specified, GCC looks at the @var{path} to find 10478the profile feedback data files. See @option{-fprofile-dir}. 10479 10480@item -fauto-profile 10481@itemx -fauto-profile=@var{path} 10482@opindex fauto-profile 10483Enable sampling-based feedback-directed optimizations, 10484and the following optimizations, 10485many of which are generally profitable only with profile feedback available: 10486 10487@gccoptlist{-fbranch-probabilities -fprofile-values @gol 10488-funroll-loops -fpeel-loops -ftracer -fvpt @gol 10489-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 10490-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 10491-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 10492-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 10493-fprofile-correction} 10494 10495@var{path} is the name of a file containing AutoFDO profile information. 10496If omitted, it defaults to @file{fbdata.afdo} in the current directory. 10497 10498Producing an AutoFDO profile data file requires running your program 10499with the @command{perf} utility on a supported GNU/Linux target system. 10500For more information, see @uref{https://perf.wiki.kernel.org/}. 10501 10502E.g. 10503@smallexample 10504perf record -e br_inst_retired:near_taken -b -o perf.data \ 10505 -- your_program 10506@end smallexample 10507 10508Then use the @command{create_gcov} tool to convert the raw profile data 10509to a format that can be used by GCC.@ You must also supply the 10510unstripped binary for your program to this tool. 10511See @uref{https://github.com/google/autofdo}. 10512 10513E.g. 10514@smallexample 10515create_gcov --binary=your_program.unstripped --profile=perf.data \ 10516 --gcov=profile.afdo 10517@end smallexample 10518@end table 10519 10520The following options control compiler behavior regarding floating-point 10521arithmetic. These options trade off between speed and 10522correctness. All must be specifically enabled. 10523 10524@table @gcctabopt 10525@item -ffloat-store 10526@opindex ffloat-store 10527Do not store floating-point variables in registers, and inhibit other 10528options that might change whether a floating-point value is taken from a 10529register or memory. 10530 10531@cindex floating-point precision 10532This option prevents undesirable excess precision on machines such as 10533the 68000 where the floating registers (of the 68881) keep more 10534precision than a @code{double} is supposed to have. Similarly for the 10535x86 architecture. For most programs, the excess precision does only 10536good, but a few programs rely on the precise definition of IEEE floating 10537point. Use @option{-ffloat-store} for such programs, after modifying 10538them to store all pertinent intermediate computations into variables. 10539 10540@item -fexcess-precision=@var{style} 10541@opindex fexcess-precision 10542This option allows further control over excess precision on machines 10543where floating-point operations occur in a format with more precision or 10544range than the IEEE standard and interchange floating-point types. By 10545default, @option{-fexcess-precision=fast} is in effect; this means that 10546operations may be carried out in a wider precision than the types specified 10547in the source if that would result in faster code, and it is unpredictable 10548when rounding to the types specified in the source code takes place. 10549When compiling C, if @option{-fexcess-precision=standard} is specified then 10550excess precision follows the rules specified in ISO C99; in particular, 10551both casts and assignments cause values to be rounded to their 10552semantic types (whereas @option{-ffloat-store} only affects 10553assignments). This option is enabled by default for C if a strict 10554conformance option such as @option{-std=c99} is used. 10555@option{-ffast-math} enables @option{-fexcess-precision=fast} by default 10556regardless of whether a strict conformance option is used. 10557 10558@opindex mfpmath 10559@option{-fexcess-precision=standard} is not implemented for languages 10560other than C. On the x86, it has no effect if @option{-mfpmath=sse} 10561or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 10562semantics apply without excess precision, and in the latter, rounding 10563is unpredictable. 10564 10565@item -ffast-math 10566@opindex ffast-math 10567Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 10568@option{-ffinite-math-only}, @option{-fno-rounding-math}, 10569@option{-fno-signaling-nans}, @option{-fcx-limited-range} and 10570@option{-fexcess-precision=fast}. 10571 10572This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 10573 10574This option is not turned on by any @option{-O} option besides 10575@option{-Ofast} since it can result in incorrect output for programs 10576that depend on an exact implementation of IEEE or ISO rules/specifications 10577for math functions. It may, however, yield faster code for programs 10578that do not require the guarantees of these specifications. 10579 10580@item -fno-math-errno 10581@opindex fno-math-errno 10582@opindex fmath-errno 10583Do not set @code{errno} after calling math functions that are executed 10584with a single instruction, e.g., @code{sqrt}. A program that relies on 10585IEEE exceptions for math error handling may want to use this flag 10586for speed while maintaining IEEE arithmetic compatibility. 10587 10588This option is not turned on by any @option{-O} option since 10589it can result in incorrect output for programs that depend on 10590an exact implementation of IEEE or ISO rules/specifications for 10591math functions. It may, however, yield faster code for programs 10592that do not require the guarantees of these specifications. 10593 10594The default is @option{-fmath-errno}. 10595 10596On Darwin systems, the math library never sets @code{errno}. There is 10597therefore no reason for the compiler to consider the possibility that 10598it might, and @option{-fno-math-errno} is the default. 10599 10600@item -funsafe-math-optimizations 10601@opindex funsafe-math-optimizations 10602 10603Allow optimizations for floating-point arithmetic that (a) assume 10604that arguments and results are valid and (b) may violate IEEE or 10605ANSI standards. When used at link time, it may include libraries 10606or startup files that change the default FPU control word or other 10607similar optimizations. 10608 10609This option is not turned on by any @option{-O} option since 10610it can result in incorrect output for programs that depend on 10611an exact implementation of IEEE or ISO rules/specifications for 10612math functions. It may, however, yield faster code for programs 10613that do not require the guarantees of these specifications. 10614Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 10615@option{-fassociative-math} and @option{-freciprocal-math}. 10616 10617The default is @option{-fno-unsafe-math-optimizations}. 10618 10619@item -fassociative-math 10620@opindex fassociative-math 10621 10622Allow re-association of operands in series of floating-point operations. 10623This violates the ISO C and C++ language standard by possibly changing 10624computation result. NOTE: re-ordering may change the sign of zero as 10625well as ignore NaNs and inhibit or create underflow or overflow (and 10626thus cannot be used on code that relies on rounding behavior like 10627@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 10628and thus may not be used when ordered comparisons are required. 10629This option requires that both @option{-fno-signed-zeros} and 10630@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 10631much sense with @option{-frounding-math}. For Fortran the option 10632is automatically enabled when both @option{-fno-signed-zeros} and 10633@option{-fno-trapping-math} are in effect. 10634 10635The default is @option{-fno-associative-math}. 10636 10637@item -freciprocal-math 10638@opindex freciprocal-math 10639 10640Allow the reciprocal of a value to be used instead of dividing by 10641the value if this enables optimizations. For example @code{x / y} 10642can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 10643is subject to common subexpression elimination. Note that this loses 10644precision and increases the number of flops operating on the value. 10645 10646The default is @option{-fno-reciprocal-math}. 10647 10648@item -ffinite-math-only 10649@opindex ffinite-math-only 10650Allow optimizations for floating-point arithmetic that assume 10651that arguments and results are not NaNs or +-Infs. 10652 10653This option is not turned on by any @option{-O} option since 10654it can result in incorrect output for programs that depend on 10655an exact implementation of IEEE or ISO rules/specifications for 10656math functions. It may, however, yield faster code for programs 10657that do not require the guarantees of these specifications. 10658 10659The default is @option{-fno-finite-math-only}. 10660 10661@item -fno-signed-zeros 10662@opindex fno-signed-zeros 10663@opindex fsigned-zeros 10664Allow optimizations for floating-point arithmetic that ignore the 10665signedness of zero. IEEE arithmetic specifies the behavior of 10666distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 10667of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 10668This option implies that the sign of a zero result isn't significant. 10669 10670The default is @option{-fsigned-zeros}. 10671 10672@item -fno-trapping-math 10673@opindex fno-trapping-math 10674@opindex ftrapping-math 10675Compile code assuming that floating-point operations cannot generate 10676user-visible traps. These traps include division by zero, overflow, 10677underflow, inexact result and invalid operation. This option requires 10678that @option{-fno-signaling-nans} be in effect. Setting this option may 10679allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 10680 10681This option should never be turned on by any @option{-O} option since 10682it can result in incorrect output for programs that depend on 10683an exact implementation of IEEE or ISO rules/specifications for 10684math functions. 10685 10686The default is @option{-ftrapping-math}. 10687 10688@item -frounding-math 10689@opindex frounding-math 10690Disable transformations and optimizations that assume default floating-point 10691rounding behavior. This is round-to-zero for all floating point 10692to integer conversions, and round-to-nearest for all other arithmetic 10693truncations. This option should be specified for programs that change 10694the FP rounding mode dynamically, or that may be executed with a 10695non-default rounding mode. This option disables constant folding of 10696floating-point expressions at compile time (which may be affected by 10697rounding mode) and arithmetic transformations that are unsafe in the 10698presence of sign-dependent rounding modes. 10699 10700The default is @option{-fno-rounding-math}. 10701 10702This option is experimental and does not currently guarantee to 10703disable all GCC optimizations that are affected by rounding mode. 10704Future versions of GCC may provide finer control of this setting 10705using C99's @code{FENV_ACCESS} pragma. This command-line option 10706will be used to specify the default state for @code{FENV_ACCESS}. 10707 10708@item -fsignaling-nans 10709@opindex fsignaling-nans 10710Compile code assuming that IEEE signaling NaNs may generate user-visible 10711traps during floating-point operations. Setting this option disables 10712optimizations that may change the number of exceptions visible with 10713signaling NaNs. This option implies @option{-ftrapping-math}. 10714 10715This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 10716be defined. 10717 10718The default is @option{-fno-signaling-nans}. 10719 10720This option is experimental and does not currently guarantee to 10721disable all GCC optimizations that affect signaling NaN behavior. 10722 10723@item -fno-fp-int-builtin-inexact 10724@opindex fno-fp-int-builtin-inexact 10725@opindex ffp-int-builtin-inexact 10726Do not allow the built-in functions @code{ceil}, @code{floor}, 10727@code{round} and @code{trunc}, and their @code{float} and @code{long 10728double} variants, to generate code that raises the ``inexact'' 10729floating-point exception for noninteger arguments. ISO C99 and C11 10730allow these functions to raise the ``inexact'' exception, but ISO/IEC 10731TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these 10732functions to do so. 10733 10734The default is @option{-ffp-int-builtin-inexact}, allowing the 10735exception to be raised. This option does nothing unless 10736@option{-ftrapping-math} is in effect. 10737 10738Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions 10739generate a call to a library function then the ``inexact'' exception 10740may be raised if the library implementation does not follow TS 18661. 10741 10742@item -fsingle-precision-constant 10743@opindex fsingle-precision-constant 10744Treat floating-point constants as single precision instead of 10745implicitly converting them to double-precision constants. 10746 10747@item -fcx-limited-range 10748@opindex fcx-limited-range 10749When enabled, this option states that a range reduction step is not 10750needed when performing complex division. Also, there is no checking 10751whether the result of a complex multiplication or division is @code{NaN 10752+ I*NaN}, with an attempt to rescue the situation in that case. The 10753default is @option{-fno-cx-limited-range}, but is enabled by 10754@option{-ffast-math}. 10755 10756This option controls the default setting of the ISO C99 10757@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 10758all languages. 10759 10760@item -fcx-fortran-rules 10761@opindex fcx-fortran-rules 10762Complex multiplication and division follow Fortran rules. Range 10763reduction is done as part of complex division, but there is no checking 10764whether the result of a complex multiplication or division is @code{NaN 10765+ I*NaN}, with an attempt to rescue the situation in that case. 10766 10767The default is @option{-fno-cx-fortran-rules}. 10768 10769@end table 10770 10771The following options control optimizations that may improve 10772performance, but are not enabled by any @option{-O} options. This 10773section includes experimental options that may produce broken code. 10774 10775@table @gcctabopt 10776@item -fbranch-probabilities 10777@opindex fbranch-probabilities 10778After running a program compiled with @option{-fprofile-arcs} 10779(@pxref{Instrumentation Options}), 10780you can compile it a second time using 10781@option{-fbranch-probabilities}, to improve optimizations based on 10782the number of times each branch was taken. When a program 10783compiled with @option{-fprofile-arcs} exits, it saves arc execution 10784counts to a file called @file{@var{sourcename}.gcda} for each source 10785file. The information in this data file is very dependent on the 10786structure of the generated code, so you must use the same source code 10787and the same optimization options for both compilations. 10788 10789With @option{-fbranch-probabilities}, GCC puts a 10790@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 10791These can be used to improve optimization. Currently, they are only 10792used in one place: in @file{reorg.c}, instead of guessing which path a 10793branch is most likely to take, the @samp{REG_BR_PROB} values are used to 10794exactly determine which path is taken more often. 10795 10796Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10797 10798@item -fprofile-values 10799@opindex fprofile-values 10800If combined with @option{-fprofile-arcs}, it adds code so that some 10801data about values of expressions in the program is gathered. 10802 10803With @option{-fbranch-probabilities}, it reads back the data gathered 10804from profiling values of expressions for usage in optimizations. 10805 10806Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and 10807@option{-fauto-profile}. 10808 10809@item -fprofile-reorder-functions 10810@opindex fprofile-reorder-functions 10811Function reordering based on profile instrumentation collects 10812first time of execution of a function and orders these functions 10813in ascending order. 10814 10815Enabled with @option{-fprofile-use}. 10816 10817@item -fvpt 10818@opindex fvpt 10819If combined with @option{-fprofile-arcs}, this option instructs the compiler 10820to add code to gather information about values of expressions. 10821 10822With @option{-fbranch-probabilities}, it reads back the data gathered 10823and actually performs the optimizations based on them. 10824Currently the optimizations include specialization of division operations 10825using the knowledge about the value of the denominator. 10826 10827Enabled with @option{-fprofile-use} and @option{-fauto-profile}. 10828 10829@item -frename-registers 10830@opindex frename-registers 10831Attempt to avoid false dependencies in scheduled code by making use 10832of registers left over after register allocation. This optimization 10833most benefits processors with lots of registers. Depending on the 10834debug information format adopted by the target, however, it can 10835make debugging impossible, since variables no longer stay in 10836a ``home register''. 10837 10838Enabled by default with @option{-funroll-loops}. 10839 10840@item -fschedule-fusion 10841@opindex fschedule-fusion 10842Performs a target dependent pass over the instruction stream to schedule 10843instructions of same type together because target machine can execute them 10844more efficiently if they are adjacent to each other in the instruction flow. 10845 10846Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10847 10848@item -ftracer 10849@opindex ftracer 10850Perform tail duplication to enlarge superblock size. This transformation 10851simplifies the control flow of the function allowing other optimizations to do 10852a better job. 10853 10854Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10855 10856@item -funroll-loops 10857@opindex funroll-loops 10858Unroll loops whose number of iterations can be determined at compile time or 10859upon entry to the loop. @option{-funroll-loops} implies 10860@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 10861It also turns on complete loop peeling (i.e.@: complete removal of loops with 10862a small constant number of iterations). This option makes code larger, and may 10863or may not make it run faster. 10864 10865Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10866 10867@item -funroll-all-loops 10868@opindex funroll-all-loops 10869Unroll all loops, even if their number of iterations is uncertain when 10870the loop is entered. This usually makes programs run more slowly. 10871@option{-funroll-all-loops} implies the same options as 10872@option{-funroll-loops}. 10873 10874@item -fpeel-loops 10875@opindex fpeel-loops 10876Peels loops for which there is enough information that they do not 10877roll much (from profile feedback or static analysis). It also turns on 10878complete loop peeling (i.e.@: complete removal of loops with small constant 10879number of iterations). 10880 10881Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}. 10882 10883@item -fmove-loop-invariants 10884@opindex fmove-loop-invariants 10885Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 10886at level @option{-O1} and higher, except for @option{-Og}. 10887 10888@item -fsplit-loops 10889@opindex fsplit-loops 10890Split a loop into two if it contains a condition that's always true 10891for one side of the iteration space and false for the other. 10892 10893Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10894 10895@item -funswitch-loops 10896@opindex funswitch-loops 10897Move branches with loop invariant conditions out of the loop, with duplicates 10898of the loop on both branches (modified according to result of the condition). 10899 10900Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10901 10902@item -fversion-loops-for-strides 10903@opindex fversion-loops-for-strides 10904If a loop iterates over an array with a variable stride, create another 10905version of the loop that assumes the stride is always one. For example: 10906 10907@smallexample 10908for (int i = 0; i < n; ++i) 10909 x[i * stride] = @dots{}; 10910@end smallexample 10911 10912becomes: 10913 10914@smallexample 10915if (stride == 1) 10916 for (int i = 0; i < n; ++i) 10917 x[i] = @dots{}; 10918else 10919 for (int i = 0; i < n; ++i) 10920 x[i * stride] = @dots{}; 10921@end smallexample 10922 10923This is particularly useful for assumed-shape arrays in Fortran where 10924(for example) it allows better vectorization assuming contiguous accesses. 10925This flag is enabled by default at @option{-O3}. 10926It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10927 10928@item -ffunction-sections 10929@itemx -fdata-sections 10930@opindex ffunction-sections 10931@opindex fdata-sections 10932Place each function or data item into its own section in the output 10933file if the target supports arbitrary sections. The name of the 10934function or the name of the data item determines the section's name 10935in the output file. 10936 10937Use these options on systems where the linker can perform optimizations to 10938improve locality of reference in the instruction space. Most systems using the 10939ELF object format have linkers with such optimizations. On AIX, the linker 10940rearranges sections (CSECTs) based on the call graph. The performance impact 10941varies. 10942 10943Together with a linker garbage collection (linker @option{--gc-sections} 10944option) these options may lead to smaller statically-linked executables (after 10945stripping). 10946 10947On ELF/DWARF systems these options do not degenerate the quality of the debug 10948information. There could be issues with other object files/debug info formats. 10949 10950Only use these options when there are significant benefits from doing so. When 10951you specify these options, the assembler and linker create larger object and 10952executable files and are also slower. These options affect code generation. 10953They prevent optimizations by the compiler and assembler using relative 10954locations inside a translation unit since the locations are unknown until 10955link time. An example of such an optimization is relaxing calls to short call 10956instructions. 10957 10958@item -fbranch-target-load-optimize 10959@opindex fbranch-target-load-optimize 10960Perform branch target register load optimization before prologue / epilogue 10961threading. 10962The use of target registers can typically be exposed only during reload, 10963thus hoisting loads out of loops and doing inter-block scheduling needs 10964a separate optimization pass. 10965 10966@item -fbranch-target-load-optimize2 10967@opindex fbranch-target-load-optimize2 10968Perform branch target register load optimization after prologue / epilogue 10969threading. 10970 10971@item -fbtr-bb-exclusive 10972@opindex fbtr-bb-exclusive 10973When performing branch target register load optimization, don't reuse 10974branch target registers within any basic block. 10975 10976@item -fstdarg-opt 10977@opindex fstdarg-opt 10978Optimize the prologue of variadic argument functions with respect to usage of 10979those arguments. 10980 10981@item -fsection-anchors 10982@opindex fsection-anchors 10983Try to reduce the number of symbolic address calculations by using 10984shared ``anchor'' symbols to address nearby objects. This transformation 10985can help to reduce the number of GOT entries and GOT accesses on some 10986targets. 10987 10988For example, the implementation of the following function @code{foo}: 10989 10990@smallexample 10991static int a, b, c; 10992int foo (void) @{ return a + b + c; @} 10993@end smallexample 10994 10995@noindent 10996usually calculates the addresses of all three variables, but if you 10997compile it with @option{-fsection-anchors}, it accesses the variables 10998from a common anchor point instead. The effect is similar to the 10999following pseudocode (which isn't valid C): 11000 11001@smallexample 11002int foo (void) 11003@{ 11004 register int *xr = &x; 11005 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 11006@} 11007@end smallexample 11008 11009Not all targets support this option. 11010 11011@item --param @var{name}=@var{value} 11012@opindex param 11013In some places, GCC uses various constants to control the amount of 11014optimization that is done. For example, GCC does not inline functions 11015that contain more than a certain number of instructions. You can 11016control some of these constants on the command line using the 11017@option{--param} option. 11018 11019The names of specific parameters, and the meaning of the values, are 11020tied to the internals of the compiler, and are subject to change 11021without notice in future releases. 11022 11023In order to get minimal, maximal and default value of a parameter, 11024one can use @option{--help=param -Q} options. 11025 11026In each case, the @var{value} is an integer. The allowable choices for 11027@var{name} are: 11028 11029@table @gcctabopt 11030@item predictable-branch-outcome 11031When branch is predicted to be taken with probability lower than this threshold 11032(in percent), then it is considered well predictable. 11033 11034@item max-rtl-if-conversion-insns 11035RTL if-conversion tries to remove conditional branches around a block and 11036replace them with conditionally executed instructions. This parameter 11037gives the maximum number of instructions in a block which should be 11038considered for if-conversion. The compiler will 11039also use other heuristics to decide whether if-conversion is likely to be 11040profitable. 11041 11042@item max-rtl-if-conversion-predictable-cost 11043@itemx max-rtl-if-conversion-unpredictable-cost 11044RTL if-conversion will try to remove conditional branches around a block 11045and replace them with conditionally executed instructions. These parameters 11046give the maximum permissible cost for the sequence that would be generated 11047by if-conversion depending on whether the branch is statically determined 11048to be predictable or not. The units for this parameter are the same as 11049those for the GCC internal seq_cost metric. The compiler will try to 11050provide a reasonable default for this parameter using the BRANCH_COST 11051target macro. 11052 11053@item max-crossjump-edges 11054The maximum number of incoming edges to consider for cross-jumping. 11055The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 11056the number of edges incoming to each block. Increasing values mean 11057more aggressive optimization, making the compilation time increase with 11058probably small improvement in executable size. 11059 11060@item min-crossjump-insns 11061The minimum number of instructions that must be matched at the end 11062of two blocks before cross-jumping is performed on them. This 11063value is ignored in the case where all instructions in the block being 11064cross-jumped from are matched. 11065 11066@item max-grow-copy-bb-insns 11067The maximum code size expansion factor when copying basic blocks 11068instead of jumping. The expansion is relative to a jump instruction. 11069 11070@item max-goto-duplication-insns 11071The maximum number of instructions to duplicate to a block that jumps 11072to a computed goto. To avoid @math{O(N^2)} behavior in a number of 11073passes, GCC factors computed gotos early in the compilation process, 11074and unfactors them as late as possible. Only computed jumps at the 11075end of a basic blocks with no more than max-goto-duplication-insns are 11076unfactored. 11077 11078@item max-delay-slot-insn-search 11079The maximum number of instructions to consider when looking for an 11080instruction to fill a delay slot. If more than this arbitrary number of 11081instructions are searched, the time savings from filling the delay slot 11082are minimal, so stop searching. Increasing values mean more 11083aggressive optimization, making the compilation time increase with probably 11084small improvement in execution time. 11085 11086@item max-delay-slot-live-search 11087When trying to fill delay slots, the maximum number of instructions to 11088consider when searching for a block with valid live register 11089information. Increasing this arbitrarily chosen value means more 11090aggressive optimization, increasing the compilation time. This parameter 11091should be removed when the delay slot code is rewritten to maintain the 11092control-flow graph. 11093 11094@item max-gcse-memory 11095The approximate maximum amount of memory that can be allocated in 11096order to perform the global common subexpression elimination 11097optimization. If more memory than specified is required, the 11098optimization is not done. 11099 11100@item max-gcse-insertion-ratio 11101If the ratio of expression insertions to deletions is larger than this value 11102for any expression, then RTL PRE inserts or removes the expression and thus 11103leaves partially redundant computations in the instruction stream. 11104 11105@item max-pending-list-length 11106The maximum number of pending dependencies scheduling allows 11107before flushing the current state and starting over. Large functions 11108with few branches or calls can create excessively large lists which 11109needlessly consume memory and resources. 11110 11111@item max-modulo-backtrack-attempts 11112The maximum number of backtrack attempts the scheduler should make 11113when modulo scheduling a loop. Larger values can exponentially increase 11114compilation time. 11115 11116@item max-inline-insns-single 11117Several parameters control the tree inliner used in GCC@. 11118This number sets the maximum number of instructions (counted in GCC's 11119internal representation) in a single function that the tree inliner 11120considers for inlining. This only affects functions declared 11121inline and methods implemented in a class declaration (C++). 11122 11123@item max-inline-insns-auto 11124When you use @option{-finline-functions} (included in @option{-O3}), 11125a lot of functions that would otherwise not be considered for inlining 11126by the compiler are investigated. To those functions, a different 11127(more restrictive) limit compared to functions declared inline can 11128be applied. 11129 11130@item max-inline-insns-small 11131This is bound applied to calls which are considered relevant with 11132@option{-finline-small-functions}. 11133 11134@item max-inline-insns-size 11135This is bound applied to calls which are optimized for size. Small growth 11136may be desirable to anticipate optimization oppurtunities exposed by inlining. 11137 11138@item uninlined-function-insns 11139Number of instructions accounted by inliner for function overhead such as 11140function prologue and epilogue. 11141 11142@item uninlined-function-time 11143Extra time accounted by inliner for function overhead such as time needed to 11144execute function prologue and epilogue 11145 11146@item uninlined-thunk-insns 11147@item uninlined-thunk-time 11148Same as @option{--param uninlined-function-insns} and 11149@option{--param uninlined-function-time} but applied to function thunks 11150 11151@item inline-min-speedup 11152When estimated performance improvement of caller + callee runtime exceeds this 11153threshold (in percent), the function can be inlined regardless of the limit on 11154@option{--param max-inline-insns-single} and @option{--param 11155max-inline-insns-auto}. 11156 11157@item large-function-insns 11158The limit specifying really large functions. For functions larger than this 11159limit after inlining, inlining is constrained by 11160@option{--param large-function-growth}. This parameter is useful primarily 11161to avoid extreme compilation time caused by non-linear algorithms used by the 11162back end. 11163 11164@item large-function-growth 11165Specifies maximal growth of large function caused by inlining in percents. 11166For example, parameter value 100 limits large function growth to 2.0 times 11167the original size. 11168 11169@item large-unit-insns 11170The limit specifying large translation unit. Growth caused by inlining of 11171units larger than this limit is limited by @option{--param inline-unit-growth}. 11172For small units this might be too tight. 11173For example, consider a unit consisting of function A 11174that is inline and B that just calls A three times. If B is small relative to 11175A, the growth of unit is 300\% and yet such inlining is very sane. For very 11176large units consisting of small inlineable functions, however, the overall unit 11177growth limit is needed to avoid exponential explosion of code size. Thus for 11178smaller units, the size is increased to @option{--param large-unit-insns} 11179before applying @option{--param inline-unit-growth}. 11180 11181@item inline-unit-growth 11182Specifies maximal overall growth of the compilation unit caused by inlining. 11183For example, parameter value 20 limits unit growth to 1.2 times the original 11184size. Cold functions (either marked cold via an attribute or by profile 11185feedback) are not accounted into the unit size. 11186 11187@item ipcp-unit-growth 11188Specifies maximal overall growth of the compilation unit caused by 11189interprocedural constant propagation. For example, parameter value 10 limits 11190unit growth to 1.1 times the original size. 11191 11192@item large-stack-frame 11193The limit specifying large stack frames. While inlining the algorithm is trying 11194to not grow past this limit too much. 11195 11196@item large-stack-frame-growth 11197Specifies maximal growth of large stack frames caused by inlining in percents. 11198For example, parameter value 1000 limits large stack frame growth to 11 times 11199the original size. 11200 11201@item max-inline-insns-recursive 11202@itemx max-inline-insns-recursive-auto 11203Specifies the maximum number of instructions an out-of-line copy of a 11204self-recursive inline 11205function can grow into by performing recursive inlining. 11206 11207@option{--param max-inline-insns-recursive} applies to functions 11208declared inline. 11209For functions not declared inline, recursive inlining 11210happens only when @option{-finline-functions} (included in @option{-O3}) is 11211enabled; @option{--param max-inline-insns-recursive-auto} applies instead. 11212 11213@item max-inline-recursive-depth 11214@itemx max-inline-recursive-depth-auto 11215Specifies the maximum recursion depth used for recursive inlining. 11216 11217@option{--param max-inline-recursive-depth} applies to functions 11218declared inline. For functions not declared inline, recursive inlining 11219happens only when @option{-finline-functions} (included in @option{-O3}) is 11220enabled; @option{--param max-inline-recursive-depth-auto} applies instead. 11221 11222@item min-inline-recursive-probability 11223Recursive inlining is profitable only for function having deep recursion 11224in average and can hurt for function having little recursion depth by 11225increasing the prologue size or complexity of function body to other 11226optimizers. 11227 11228When profile feedback is available (see @option{-fprofile-generate}) the actual 11229recursion depth can be guessed from the probability that function recurses 11230via a given call expression. This parameter limits inlining only to call 11231expressions whose probability exceeds the given threshold (in percents). 11232 11233@item early-inlining-insns 11234Specify growth that the early inliner can make. In effect it increases 11235the amount of inlining for code having a large abstraction penalty. 11236 11237@item max-early-inliner-iterations 11238Limit of iterations of the early inliner. This basically bounds 11239the number of nested indirect calls the early inliner can resolve. 11240Deeper chains are still handled by late inlining. 11241 11242@item comdat-sharing-probability 11243Probability (in percent) that C++ inline function with comdat visibility 11244are shared across multiple compilation units. 11245 11246@item profile-func-internal-id 11247A parameter to control whether to use function internal id in profile 11248database lookup. If the value is 0, the compiler uses an id that 11249is based on function assembler name and filename, which makes old profile 11250data more tolerant to source changes such as function reordering etc. 11251 11252@item min-vect-loop-bound 11253The minimum number of iterations under which loops are not vectorized 11254when @option{-ftree-vectorize} is used. The number of iterations after 11255vectorization needs to be greater than the value specified by this option 11256to allow vectorization. 11257 11258@item gcse-cost-distance-ratio 11259Scaling factor in calculation of maximum distance an expression 11260can be moved by GCSE optimizations. This is currently supported only in the 11261code hoisting pass. The bigger the ratio, the more aggressive code hoisting 11262is with simple expressions, i.e., the expressions that have cost 11263less than @option{gcse-unrestricted-cost}. Specifying 0 disables 11264hoisting of simple expressions. 11265 11266@item gcse-unrestricted-cost 11267Cost, roughly measured as the cost of a single typical machine 11268instruction, at which GCSE optimizations do not constrain 11269the distance an expression can travel. This is currently 11270supported only in the code hoisting pass. The lesser the cost, 11271the more aggressive code hoisting is. Specifying 0 11272allows all expressions to travel unrestricted distances. 11273 11274@item max-hoist-depth 11275The depth of search in the dominator tree for expressions to hoist. 11276This is used to avoid quadratic behavior in hoisting algorithm. 11277The value of 0 does not limit on the search, but may slow down compilation 11278of huge functions. 11279 11280@item max-tail-merge-comparisons 11281The maximum amount of similar bbs to compare a bb with. This is used to 11282avoid quadratic behavior in tree tail merging. 11283 11284@item max-tail-merge-iterations 11285The maximum amount of iterations of the pass over the function. This is used to 11286limit compilation time in tree tail merging. 11287 11288@item store-merging-allow-unaligned 11289Allow the store merging pass to introduce unaligned stores if it is legal to 11290do so. 11291 11292@item max-stores-to-merge 11293The maximum number of stores to attempt to merge into wider stores in the store 11294merging pass. 11295 11296@item max-unrolled-insns 11297The maximum number of instructions that a loop may have to be unrolled. 11298If a loop is unrolled, this parameter also determines how many times 11299the loop code is unrolled. 11300 11301@item max-average-unrolled-insns 11302The maximum number of instructions biased by probabilities of their execution 11303that a loop may have to be unrolled. If a loop is unrolled, 11304this parameter also determines how many times the loop code is unrolled. 11305 11306@item max-unroll-times 11307The maximum number of unrollings of a single loop. 11308 11309@item max-peeled-insns 11310The maximum number of instructions that a loop may have to be peeled. 11311If a loop is peeled, this parameter also determines how many times 11312the loop code is peeled. 11313 11314@item max-peel-times 11315The maximum number of peelings of a single loop. 11316 11317@item max-peel-branches 11318The maximum number of branches on the hot path through the peeled sequence. 11319 11320@item max-completely-peeled-insns 11321The maximum number of insns of a completely peeled loop. 11322 11323@item max-completely-peel-times 11324The maximum number of iterations of a loop to be suitable for complete peeling. 11325 11326@item max-completely-peel-loop-nest-depth 11327The maximum depth of a loop nest suitable for complete peeling. 11328 11329@item max-unswitch-insns 11330The maximum number of insns of an unswitched loop. 11331 11332@item max-unswitch-level 11333The maximum number of branches unswitched in a single loop. 11334 11335@item lim-expensive 11336The minimum cost of an expensive expression in the loop invariant motion. 11337 11338@item iv-consider-all-candidates-bound 11339Bound on number of candidates for induction variables, below which 11340all candidates are considered for each use in induction variable 11341optimizations. If there are more candidates than this, 11342only the most relevant ones are considered to avoid quadratic time complexity. 11343 11344@item iv-max-considered-uses 11345The induction variable optimizations give up on loops that contain more 11346induction variable uses. 11347 11348@item iv-always-prune-cand-set-bound 11349If the number of candidates in the set is smaller than this value, 11350always try to remove unnecessary ivs from the set 11351when adding a new one. 11352 11353@item avg-loop-niter 11354Average number of iterations of a loop. 11355 11356@item dse-max-object-size 11357Maximum size (in bytes) of objects tracked bytewise by dead store elimination. 11358Larger values may result in larger compilation times. 11359 11360@item dse-max-alias-queries-per-store 11361Maximum number of queries into the alias oracle per store. 11362Larger values result in larger compilation times and may result in more 11363removed dead stores. 11364 11365@item scev-max-expr-size 11366Bound on size of expressions used in the scalar evolutions analyzer. 11367Large expressions slow the analyzer. 11368 11369@item scev-max-expr-complexity 11370Bound on the complexity of the expressions in the scalar evolutions analyzer. 11371Complex expressions slow the analyzer. 11372 11373@item max-tree-if-conversion-phi-args 11374Maximum number of arguments in a PHI supported by TREE if conversion 11375unless the loop is marked with simd pragma. 11376 11377@item vect-max-version-for-alignment-checks 11378The maximum number of run-time checks that can be performed when 11379doing loop versioning for alignment in the vectorizer. 11380 11381@item vect-max-version-for-alias-checks 11382The maximum number of run-time checks that can be performed when 11383doing loop versioning for alias in the vectorizer. 11384 11385@item vect-max-peeling-for-alignment 11386The maximum number of loop peels to enhance access alignment 11387for vectorizer. Value -1 means no limit. 11388 11389@item max-iterations-to-track 11390The maximum number of iterations of a loop the brute-force algorithm 11391for analysis of the number of iterations of the loop tries to evaluate. 11392 11393@item hot-bb-count-ws-permille 11394A basic block profile count is considered hot if it contributes to 11395the given permillage (i.e.@: 0...1000) of the entire profiled execution. 11396 11397@item hot-bb-frequency-fraction 11398Select fraction of the entry block frequency of executions of basic block in 11399function given basic block needs to have to be considered hot. 11400 11401@item max-predicted-iterations 11402The maximum number of loop iterations we predict statically. This is useful 11403in cases where a function contains a single loop with known bound and 11404another loop with unknown bound. 11405The known number of iterations is predicted correctly, while 11406the unknown number of iterations average to roughly 10. This means that the 11407loop without bounds appears artificially cold relative to the other one. 11408 11409@item builtin-expect-probability 11410Control the probability of the expression having the specified value. This 11411parameter takes a percentage (i.e.@: 0 ... 100) as input. 11412 11413@item builtin-string-cmp-inline-length 11414The maximum length of a constant string for a builtin string cmp call 11415eligible for inlining. 11416 11417@item align-threshold 11418 11419Select fraction of the maximal frequency of executions of a basic block in 11420a function to align the basic block. 11421 11422@item align-loop-iterations 11423 11424A loop expected to iterate at least the selected number of iterations is 11425aligned. 11426 11427@item tracer-dynamic-coverage 11428@itemx tracer-dynamic-coverage-feedback 11429 11430This value is used to limit superblock formation once the given percentage of 11431executed instructions is covered. This limits unnecessary code size 11432expansion. 11433 11434The @option{tracer-dynamic-coverage-feedback} parameter 11435is used only when profile 11436feedback is available. The real profiles (as opposed to statically estimated 11437ones) are much less balanced allowing the threshold to be larger value. 11438 11439@item tracer-max-code-growth 11440Stop tail duplication once code growth has reached given percentage. This is 11441a rather artificial limit, as most of the duplicates are eliminated later in 11442cross jumping, so it may be set to much higher values than is the desired code 11443growth. 11444 11445@item tracer-min-branch-ratio 11446 11447Stop reverse growth when the reverse probability of best edge is less than this 11448threshold (in percent). 11449 11450@item tracer-min-branch-probability 11451@itemx tracer-min-branch-probability-feedback 11452 11453Stop forward growth if the best edge has probability lower than this 11454threshold. 11455 11456Similarly to @option{tracer-dynamic-coverage} two parameters are 11457provided. @option{tracer-min-branch-probability-feedback} is used for 11458compilation with profile feedback and @option{tracer-min-branch-probability} 11459compilation without. The value for compilation with profile feedback 11460needs to be more conservative (higher) in order to make tracer 11461effective. 11462 11463@item stack-clash-protection-guard-size 11464Specify the size of the operating system provided stack guard as 114652 raised to @var{num} bytes. Higher values may reduce the 11466number of explicit probes, but a value larger than the operating system 11467provided guard will leave code vulnerable to stack clash style attacks. 11468 11469@item stack-clash-protection-probe-interval 11470Stack clash protection involves probing stack space as it is allocated. This 11471param controls the maximum distance between probes into the stack as 2 raised 11472to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value 11473larger than the operating system provided guard will leave code vulnerable to 11474stack clash style attacks. 11475 11476@item max-cse-path-length 11477 11478The maximum number of basic blocks on path that CSE considers. 11479 11480@item max-cse-insns 11481The maximum number of instructions CSE processes before flushing. 11482 11483@item ggc-min-expand 11484 11485GCC uses a garbage collector to manage its own memory allocation. This 11486parameter specifies the minimum percentage by which the garbage 11487collector's heap should be allowed to expand between collections. 11488Tuning this may improve compilation speed; it has no effect on code 11489generation. 11490 11491The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 11492RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 11493the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 11494GCC is not able to calculate RAM on a particular platform, the lower 11495bound of 30% is used. Setting this parameter and 11496@option{ggc-min-heapsize} to zero causes a full collection to occur at 11497every opportunity. This is extremely slow, but can be useful for 11498debugging. 11499 11500@item ggc-min-heapsize 11501 11502Minimum size of the garbage collector's heap before it begins bothering 11503to collect garbage. The first collection occurs after the heap expands 11504by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 11505tuning this may improve compilation speed, and has no effect on code 11506generation. 11507 11508The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 11509tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 11510with a lower bound of 4096 (four megabytes) and an upper bound of 11511131072 (128 megabytes). If GCC is not able to calculate RAM on a 11512particular platform, the lower bound is used. Setting this parameter 11513very large effectively disables garbage collection. Setting this 11514parameter and @option{ggc-min-expand} to zero causes a full collection 11515to occur at every opportunity. 11516 11517@item max-reload-search-insns 11518The maximum number of instruction reload should look backward for equivalent 11519register. Increasing values mean more aggressive optimization, making the 11520compilation time increase with probably slightly better performance. 11521 11522@item max-cselib-memory-locations 11523The maximum number of memory locations cselib should take into account. 11524Increasing values mean more aggressive optimization, making the compilation time 11525increase with probably slightly better performance. 11526 11527@item max-sched-ready-insns 11528The maximum number of instructions ready to be issued the scheduler should 11529consider at any given time during the first scheduling pass. Increasing 11530values mean more thorough searches, making the compilation time increase 11531with probably little benefit. 11532 11533@item max-sched-region-blocks 11534The maximum number of blocks in a region to be considered for 11535interblock scheduling. 11536 11537@item max-pipeline-region-blocks 11538The maximum number of blocks in a region to be considered for 11539pipelining in the selective scheduler. 11540 11541@item max-sched-region-insns 11542The maximum number of insns in a region to be considered for 11543interblock scheduling. 11544 11545@item max-pipeline-region-insns 11546The maximum number of insns in a region to be considered for 11547pipelining in the selective scheduler. 11548 11549@item min-spec-prob 11550The minimum probability (in percents) of reaching a source block 11551for interblock speculative scheduling. 11552 11553@item max-sched-extend-regions-iters 11554The maximum number of iterations through CFG to extend regions. 11555A value of 0 disables region extensions. 11556 11557@item max-sched-insn-conflict-delay 11558The maximum conflict delay for an insn to be considered for speculative motion. 11559 11560@item sched-spec-prob-cutoff 11561The minimal probability of speculation success (in percents), so that 11562speculative insns are scheduled. 11563 11564@item sched-state-edge-prob-cutoff 11565The minimum probability an edge must have for the scheduler to save its 11566state across it. 11567 11568@item sched-mem-true-dep-cost 11569Minimal distance (in CPU cycles) between store and load targeting same 11570memory locations. 11571 11572@item selsched-max-lookahead 11573The maximum size of the lookahead window of selective scheduling. It is a 11574depth of search for available instructions. 11575 11576@item selsched-max-sched-times 11577The maximum number of times that an instruction is scheduled during 11578selective scheduling. This is the limit on the number of iterations 11579through which the instruction may be pipelined. 11580 11581@item selsched-insns-to-rename 11582The maximum number of best instructions in the ready list that are considered 11583for renaming in the selective scheduler. 11584 11585@item sms-min-sc 11586The minimum value of stage count that swing modulo scheduler 11587generates. 11588 11589@item max-last-value-rtl 11590The maximum size measured as number of RTLs that can be recorded in an expression 11591in combiner for a pseudo register as last known value of that register. 11592 11593@item max-combine-insns 11594The maximum number of instructions the RTL combiner tries to combine. 11595 11596@item integer-share-limit 11597Small integer constants can use a shared data structure, reducing the 11598compiler's memory usage and increasing its speed. This sets the maximum 11599value of a shared integer constant. 11600 11601@item ssp-buffer-size 11602The minimum size of buffers (i.e.@: arrays) that receive stack smashing 11603protection when @option{-fstack-protection} is used. 11604 11605@item min-size-for-stack-sharing 11606The minimum size of variables taking part in stack slot sharing when not 11607optimizing. 11608 11609@item max-jump-thread-duplication-stmts 11610Maximum number of statements allowed in a block that needs to be 11611duplicated when threading jumps. 11612 11613@item max-fields-for-field-sensitive 11614Maximum number of fields in a structure treated in 11615a field sensitive manner during pointer analysis. 11616 11617@item prefetch-latency 11618Estimate on average number of instructions that are executed before 11619prefetch finishes. The distance prefetched ahead is proportional 11620to this constant. Increasing this number may also lead to less 11621streams being prefetched (see @option{simultaneous-prefetches}). 11622 11623@item simultaneous-prefetches 11624Maximum number of prefetches that can run at the same time. 11625 11626@item l1-cache-line-size 11627The size of cache line in L1 data cache, in bytes. 11628 11629@item l1-cache-size 11630The size of L1 data cache, in kilobytes. 11631 11632@item l2-cache-size 11633The size of L2 data cache, in kilobytes. 11634 11635@item prefetch-dynamic-strides 11636Whether the loop array prefetch pass should issue software prefetch hints 11637for strides that are non-constant. In some cases this may be 11638beneficial, though the fact the stride is non-constant may make it 11639hard to predict when there is clear benefit to issuing these hints. 11640 11641Set to 1 if the prefetch hints should be issued for non-constant 11642strides. Set to 0 if prefetch hints should be issued only for strides that 11643are known to be constant and below @option{prefetch-minimum-stride}. 11644 11645@item prefetch-minimum-stride 11646Minimum constant stride, in bytes, to start using prefetch hints for. If 11647the stride is less than this threshold, prefetch hints will not be issued. 11648 11649This setting is useful for processors that have hardware prefetchers, in 11650which case there may be conflicts between the hardware prefetchers and 11651the software prefetchers. If the hardware prefetchers have a maximum 11652stride they can handle, it should be used here to improve the use of 11653software prefetchers. 11654 11655A value of -1 means we don't have a threshold and therefore 11656prefetch hints can be issued for any constant stride. 11657 11658This setting is only useful for strides that are known and constant. 11659 11660@item loop-interchange-max-num-stmts 11661The maximum number of stmts in a loop to be interchanged. 11662 11663@item loop-interchange-stride-ratio 11664The minimum ratio between stride of two loops for interchange to be profitable. 11665 11666@item min-insn-to-prefetch-ratio 11667The minimum ratio between the number of instructions and the 11668number of prefetches to enable prefetching in a loop. 11669 11670@item prefetch-min-insn-to-mem-ratio 11671The minimum ratio between the number of instructions and the 11672number of memory references to enable prefetching in a loop. 11673 11674@item use-canonical-types 11675Whether the compiler should use the ``canonical'' type system. 11676Should always be 1, which uses a more efficient internal 11677mechanism for comparing types in C++ and Objective-C++. However, if 11678bugs in the canonical type system are causing compilation failures, 11679set this value to 0 to disable canonical types. 11680 11681@item switch-conversion-max-branch-ratio 11682Switch initialization conversion refuses to create arrays that are 11683bigger than @option{switch-conversion-max-branch-ratio} times the number of 11684branches in the switch. 11685 11686@item max-partial-antic-length 11687Maximum length of the partial antic set computed during the tree 11688partial redundancy elimination optimization (@option{-ftree-pre}) when 11689optimizing at @option{-O3} and above. For some sorts of source code 11690the enhanced partial redundancy elimination optimization can run away, 11691consuming all of the memory available on the host machine. This 11692parameter sets a limit on the length of the sets that are computed, 11693which prevents the runaway behavior. Setting a value of 0 for 11694this parameter allows an unlimited set length. 11695 11696@item rpo-vn-max-loop-depth 11697Maximum loop depth that is value-numbered optimistically. 11698When the limit hits the innermost 11699@var{rpo-vn-max-loop-depth} loops and the outermost loop in the 11700loop nest are value-numbered optimistically and the remaining ones not. 11701 11702@item sccvn-max-alias-queries-per-access 11703Maximum number of alias-oracle queries we perform when looking for 11704redundancies for loads and stores. If this limit is hit the search 11705is aborted and the load or store is not considered redundant. The 11706number of queries is algorithmically limited to the number of 11707stores on all paths from the load to the function entry. 11708 11709@item ira-max-loops-num 11710IRA uses regional register allocation by default. If a function 11711contains more loops than the number given by this parameter, only at most 11712the given number of the most frequently-executed loops form regions 11713for regional register allocation. 11714 11715@item ira-max-conflict-table-size 11716Although IRA uses a sophisticated algorithm to compress the conflict 11717table, the table can still require excessive amounts of memory for 11718huge functions. If the conflict table for a function could be more 11719than the size in MB given by this parameter, the register allocator 11720instead uses a faster, simpler, and lower-quality 11721algorithm that does not require building a pseudo-register conflict table. 11722 11723@item ira-loop-reserved-regs 11724IRA can be used to evaluate more accurate register pressure in loops 11725for decisions to move loop invariants (see @option{-O3}). The number 11726of available registers reserved for some other purposes is given 11727by this parameter. Default of the parameter 11728is the best found from numerous experiments. 11729 11730@item lra-inheritance-ebb-probability-cutoff 11731LRA tries to reuse values reloaded in registers in subsequent insns. 11732This optimization is called inheritance. EBB is used as a region to 11733do this optimization. The parameter defines a minimal fall-through 11734edge probability in percentage used to add BB to inheritance EBB in 11735LRA. The default value was chosen 11736from numerous runs of SPEC2000 on x86-64. 11737 11738@item loop-invariant-max-bbs-in-loop 11739Loop invariant motion can be very expensive, both in compilation time and 11740in amount of needed compile-time memory, with very large loops. Loops 11741with more basic blocks than this parameter won't have loop invariant 11742motion optimization performed on them. 11743 11744@item loop-max-datarefs-for-datadeps 11745Building data dependencies is expensive for very large loops. This 11746parameter limits the number of data references in loops that are 11747considered for data dependence analysis. These large loops are no 11748handled by the optimizations using loop data dependencies. 11749 11750@item max-vartrack-size 11751Sets a maximum number of hash table slots to use during variable 11752tracking dataflow analysis of any function. If this limit is exceeded 11753with variable tracking at assignments enabled, analysis for that 11754function is retried without it, after removing all debug insns from 11755the function. If the limit is exceeded even without debug insns, var 11756tracking analysis is completely disabled for the function. Setting 11757the parameter to zero makes it unlimited. 11758 11759@item max-vartrack-expr-depth 11760Sets a maximum number of recursion levels when attempting to map 11761variable names or debug temporaries to value expressions. This trades 11762compilation time for more complete debug information. If this is set too 11763low, value expressions that are available and could be represented in 11764debug information may end up not being used; setting this higher may 11765enable the compiler to find more complex debug expressions, but compile 11766time and memory use may grow. 11767 11768@item max-debug-marker-count 11769Sets a threshold on the number of debug markers (e.g.@: begin stmt 11770markers) to avoid complexity explosion at inlining or expanding to RTL. 11771If a function has more such gimple stmts than the set limit, such stmts 11772will be dropped from the inlined copy of a function, and from its RTL 11773expansion. 11774 11775@item min-nondebug-insn-uid 11776Use uids starting at this parameter for nondebug insns. The range below 11777the parameter is reserved exclusively for debug insns created by 11778@option{-fvar-tracking-assignments}, but debug insns may get 11779(non-overlapping) uids above it if the reserved range is exhausted. 11780 11781@item ipa-sra-ptr-growth-factor 11782IPA-SRA replaces a pointer to an aggregate with one or more new 11783parameters only when their cumulative size is less or equal to 11784@option{ipa-sra-ptr-growth-factor} times the size of the original 11785pointer parameter. 11786 11787@item sra-max-scalarization-size-Ospeed 11788@itemx sra-max-scalarization-size-Osize 11789The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 11790replace scalar parts of aggregates with uses of independent scalar 11791variables. These parameters control the maximum size, in storage units, 11792of aggregate which is considered for replacement when compiling for 11793speed 11794(@option{sra-max-scalarization-size-Ospeed}) or size 11795(@option{sra-max-scalarization-size-Osize}) respectively. 11796 11797@item tm-max-aggregate-size 11798When making copies of thread-local variables in a transaction, this 11799parameter specifies the size in bytes after which variables are 11800saved with the logging functions as opposed to save/restore code 11801sequence pairs. This option only applies when using 11802@option{-fgnu-tm}. 11803 11804@item graphite-max-nb-scop-params 11805To avoid exponential effects in the Graphite loop transforms, the 11806number of parameters in a Static Control Part (SCoP) is bounded. 11807A value of zero can be used to lift 11808the bound. A variable whose value is unknown at compilation time and 11809defined outside a SCoP is a parameter of the SCoP. 11810 11811@item loop-block-tile-size 11812Loop blocking or strip mining transforms, enabled with 11813@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 11814loop in the loop nest by a given number of iterations. The strip 11815length can be changed using the @option{loop-block-tile-size} 11816parameter. 11817 11818@item ipa-cp-value-list-size 11819IPA-CP attempts to track all possible values and types passed to a function's 11820parameter in order to propagate them and perform devirtualization. 11821@option{ipa-cp-value-list-size} is the maximum number of values and types it 11822stores per one formal parameter of a function. 11823 11824@item ipa-cp-eval-threshold 11825IPA-CP calculates its own score of cloning profitability heuristics 11826and performs those cloning opportunities with scores that exceed 11827@option{ipa-cp-eval-threshold}. 11828 11829@item ipa-cp-recursion-penalty 11830Percentage penalty the recursive functions will receive when they 11831are evaluated for cloning. 11832 11833@item ipa-cp-single-call-penalty 11834Percentage penalty functions containing a single call to another 11835function will receive when they are evaluated for cloning. 11836 11837@item ipa-max-agg-items 11838IPA-CP is also capable to propagate a number of scalar values passed 11839in an aggregate. @option{ipa-max-agg-items} controls the maximum 11840number of such values per one parameter. 11841 11842@item ipa-cp-loop-hint-bonus 11843When IPA-CP determines that a cloning candidate would make the number 11844of iterations of a loop known, it adds a bonus of 11845@option{ipa-cp-loop-hint-bonus} to the profitability score of 11846the candidate. 11847 11848@item ipa-cp-array-index-hint-bonus 11849When IPA-CP determines that a cloning candidate would make the index of 11850an array access known, it adds a bonus of 11851@option{ipa-cp-array-index-hint-bonus} to the profitability 11852score of the candidate. 11853 11854@item ipa-max-aa-steps 11855During its analysis of function bodies, IPA-CP employs alias analysis 11856in order to track values pointed to by function parameters. In order 11857not spend too much time analyzing huge functions, it gives up and 11858consider all memory clobbered after examining 11859@option{ipa-max-aa-steps} statements modifying memory. 11860 11861@item lto-partitions 11862Specify desired number of partitions produced during WHOPR compilation. 11863The number of partitions should exceed the number of CPUs used for compilation. 11864 11865@item lto-min-partition 11866Size of minimal partition for WHOPR (in estimated instructions). 11867This prevents expenses of splitting very small programs into too many 11868partitions. 11869 11870@item lto-max-partition 11871Size of max partition for WHOPR (in estimated instructions). 11872to provide an upper bound for individual size of partition. 11873Meant to be used only with balanced partitioning. 11874 11875@item lto-max-streaming-parallelism 11876Maximal number of parallel processes used for LTO streaming. 11877 11878@item cxx-max-namespaces-for-diagnostic-help 11879The maximum number of namespaces to consult for suggestions when C++ 11880name lookup fails for an identifier. 11881 11882@item sink-frequency-threshold 11883The maximum relative execution frequency (in percents) of the target block 11884relative to a statement's original block to allow statement sinking of a 11885statement. Larger numbers result in more aggressive statement sinking. 11886A small positive adjustment is applied for 11887statements with memory operands as those are even more profitable so sink. 11888 11889@item max-stores-to-sink 11890The maximum number of conditional store pairs that can be sunk. Set to 0 11891if either vectorization (@option{-ftree-vectorize}) or if-conversion 11892(@option{-ftree-loop-if-convert}) is disabled. 11893 11894@item allow-store-data-races 11895Allow optimizers to introduce new data races on stores. 11896Set to 1 to allow, otherwise to 0. 11897 11898@item case-values-threshold 11899The smallest number of different values for which it is best to use a 11900jump-table instead of a tree of conditional branches. If the value is 119010, use the default for the machine. 11902 11903@item tree-reassoc-width 11904Set the maximum number of instructions executed in parallel in 11905reassociated tree. This parameter overrides target dependent 11906heuristics used by default if has non zero value. 11907 11908@item sched-pressure-algorithm 11909Choose between the two available implementations of 11910@option{-fsched-pressure}. Algorithm 1 is the original implementation 11911and is the more likely to prevent instructions from being reordered. 11912Algorithm 2 was designed to be a compromise between the relatively 11913conservative approach taken by algorithm 1 and the rather aggressive 11914approach taken by the default scheduler. It relies more heavily on 11915having a regular register file and accurate register pressure classes. 11916See @file{haifa-sched.c} in the GCC sources for more details. 11917 11918The default choice depends on the target. 11919 11920@item max-slsr-cand-scan 11921Set the maximum number of existing candidates that are considered when 11922seeking a basis for a new straight-line strength reduction candidate. 11923 11924@item asan-globals 11925Enable buffer overflow detection for global objects. This kind 11926of protection is enabled by default if you are using 11927@option{-fsanitize=address} option. 11928To disable global objects protection use @option{--param asan-globals=0}. 11929 11930@item asan-stack 11931Enable buffer overflow detection for stack objects. This kind of 11932protection is enabled by default when using @option{-fsanitize=address}. 11933To disable stack protection use @option{--param asan-stack=0} option. 11934 11935@item asan-instrument-reads 11936Enable buffer overflow detection for memory reads. This kind of 11937protection is enabled by default when using @option{-fsanitize=address}. 11938To disable memory reads protection use 11939@option{--param asan-instrument-reads=0}. 11940 11941@item asan-instrument-writes 11942Enable buffer overflow detection for memory writes. This kind of 11943protection is enabled by default when using @option{-fsanitize=address}. 11944To disable memory writes protection use 11945@option{--param asan-instrument-writes=0} option. 11946 11947@item asan-memintrin 11948Enable detection for built-in functions. This kind of protection 11949is enabled by default when using @option{-fsanitize=address}. 11950To disable built-in functions protection use 11951@option{--param asan-memintrin=0}. 11952 11953@item asan-use-after-return 11954Enable detection of use-after-return. This kind of protection 11955is enabled by default when using the @option{-fsanitize=address} option. 11956To disable it use @option{--param asan-use-after-return=0}. 11957 11958Note: By default the check is disabled at run time. To enable it, 11959add @code{detect_stack_use_after_return=1} to the environment variable 11960@env{ASAN_OPTIONS}. 11961 11962@item asan-instrumentation-with-call-threshold 11963If number of memory accesses in function being instrumented 11964is greater or equal to this number, use callbacks instead of inline checks. 11965E.g. to disable inline code use 11966@option{--param asan-instrumentation-with-call-threshold=0}. 11967 11968@item use-after-scope-direct-emission-threshold 11969If the size of a local variable in bytes is smaller or equal to this 11970number, directly poison (or unpoison) shadow memory instead of using 11971run-time callbacks. 11972 11973@item max-fsm-thread-path-insns 11974Maximum number of instructions to copy when duplicating blocks on a 11975finite state automaton jump thread path. 11976 11977@item max-fsm-thread-length 11978Maximum number of basic blocks on a finite state automaton jump thread 11979path. 11980 11981@item max-fsm-thread-paths 11982Maximum number of new jump thread paths to create for a finite state 11983automaton. 11984 11985@item parloops-chunk-size 11986Chunk size of omp schedule for loops parallelized by parloops. 11987 11988@item parloops-schedule 11989Schedule type of omp schedule for loops parallelized by parloops (static, 11990dynamic, guided, auto, runtime). 11991 11992@item parloops-min-per-thread 11993The minimum number of iterations per thread of an innermost parallelized 11994loop for which the parallelized variant is preferred over the single threaded 11995one. Note that for a parallelized loop nest the 11996minimum number of iterations of the outermost loop per thread is two. 11997 11998@item max-ssa-name-query-depth 11999Maximum depth of recursion when querying properties of SSA names in things 12000like fold routines. One level of recursion corresponds to following a 12001use-def chain. 12002 12003@item hsa-gen-debug-stores 12004Enable emission of special debug stores within HSA kernels which are 12005then read and reported by libgomp plugin. Generation of these stores 12006is disabled by default, use @option{--param hsa-gen-debug-stores=1} to 12007enable it. 12008 12009@item max-speculative-devirt-maydefs 12010The maximum number of may-defs we analyze when looking for a must-def 12011specifying the dynamic type of an object that invokes a virtual call 12012we may be able to devirtualize speculatively. 12013 12014@item max-vrp-switch-assertions 12015The maximum number of assertions to add along the default edge of a switch 12016statement during VRP. 12017 12018@item unroll-jam-min-percent 12019The minimum percentage of memory references that must be optimized 12020away for the unroll-and-jam transformation to be considered profitable. 12021 12022@item unroll-jam-max-unroll 12023The maximum number of times the outer loop should be unrolled by 12024the unroll-and-jam transformation. 12025 12026@item max-rtl-if-conversion-unpredictable-cost 12027Maximum permissible cost for the sequence that would be generated 12028by the RTL if-conversion pass for a branch that is considered unpredictable. 12029 12030@item max-variable-expansions-in-unroller 12031If @option{-fvariable-expansion-in-unroller} is used, the maximum number 12032of times that an individual variable will be expanded during loop unrolling. 12033 12034@item tracer-min-branch-probability-feedback 12035Stop forward growth if the probability of best edge is less than 12036this threshold (in percent). Used when profile feedback is available. 12037 12038@item partial-inlining-entry-probability 12039Maximum probability of the entry BB of split region 12040(in percent relative to entry BB of the function) 12041to make partial inlining happen. 12042 12043@item max-tracked-strlens 12044Maximum number of strings for which strlen optimization pass will 12045track string lengths. 12046 12047@item gcse-after-reload-partial-fraction 12048The threshold ratio for performing partial redundancy 12049elimination after reload. 12050 12051@item gcse-after-reload-critical-fraction 12052The threshold ratio of critical edges execution count that 12053permit performing redundancy elimination after reload. 12054 12055@item max-loop-header-insns 12056The maximum number of insns in loop header duplicated 12057by the copy loop headers pass. 12058 12059@item vect-epilogues-nomask 12060Enable loop epilogue vectorization using smaller vector size. 12061 12062@item slp-max-insns-in-bb 12063Maximum number of instructions in basic block to be 12064considered for SLP vectorization. 12065 12066@item avoid-fma-max-bits 12067Maximum number of bits for which we avoid creating FMAs. 12068 12069@item sms-loop-average-count-threshold 12070A threshold on the average loop count considered by the swing modulo scheduler. 12071 12072@item sms-dfa-history 12073The number of cycles the swing modulo scheduler considers when checking 12074conflicts using DFA. 12075 12076@item hot-bb-count-fraction 12077Select fraction of the maximal count of repetitions of basic block 12078in program given basic block needs 12079to have to be considered hot (used in non-LTO mode) 12080 12081@item max-inline-insns-recursive-auto 12082The maximum number of instructions non-inline function 12083can grow to via recursive inlining. 12084 12085@item graphite-allow-codegen-errors 12086Whether codegen errors should be ICEs when @option{-fchecking}. 12087 12088@item sms-max-ii-factor 12089A factor for tuning the upper bound that swing modulo scheduler 12090uses for scheduling a loop. 12091 12092@item lra-max-considered-reload-pseudos 12093The max number of reload pseudos which are considered during 12094spilling a non-reload pseudo. 12095 12096@item max-pow-sqrt-depth 12097Maximum depth of sqrt chains to use when synthesizing exponentiation 12098by a real constant. 12099 12100@item max-dse-active-local-stores 12101Maximum number of active local stores in RTL dead store elimination. 12102 12103@item asan-instrument-allocas 12104Enable asan allocas/VLAs protection. 12105 12106@item max-iterations-computation-cost 12107Bound on the cost of an expression to compute the number of iterations. 12108 12109@item max-isl-operations 12110Maximum number of isl operations, 0 means unlimited. 12111 12112@item graphite-max-arrays-per-scop 12113Maximum number of arrays per scop. 12114 12115@item max-vartrack-reverse-op-size 12116Max. size of loc list for which reverse ops should be added. 12117 12118@item unlikely-bb-count-fraction 12119The minimum fraction of profile runs a given basic block execution count 12120must be not to be considered unlikely. 12121 12122@item tracer-dynamic-coverage-feedback 12123The percentage of function, weighted by execution frequency, 12124that must be covered by trace formation. 12125Used when profile feedback is available. 12126 12127@item max-inline-recursive-depth-auto 12128The maximum depth of recursive inlining for non-inline functions. 12129 12130@item fsm-scale-path-stmts 12131Scale factor to apply to the number of statements in a threading path 12132when comparing to the number of (scaled) blocks. 12133 12134@item fsm-maximum-phi-arguments 12135Maximum number of arguments a PHI may have before the FSM threader 12136will not try to thread through its block. 12137 12138@item uninit-control-dep-attempts 12139Maximum number of nested calls to search for control dependencies 12140during uninitialized variable analysis. 12141 12142@item indir-call-topn-profile 12143Track top N target addresses in indirect-call profile. 12144 12145@item max-once-peeled-insns 12146The maximum number of insns of a peeled loop that rolls only once. 12147 12148@item sra-max-scalarization-size-Osize 12149Maximum size, in storage units, of an aggregate 12150which should be considered for scalarization when compiling for size. 12151 12152@item fsm-scale-path-blocks 12153Scale factor to apply to the number of blocks in a threading path 12154when comparing to the number of (scaled) statements. 12155 12156@item sched-autopref-queue-depth 12157Hardware autoprefetcher scheduler model control flag. 12158Number of lookahead cycles the model looks into; at ' 12159' only enable instruction sorting heuristic. 12160 12161@item loop-versioning-max-inner-insns 12162The maximum number of instructions that an inner loop can have 12163before the loop versioning pass considers it too big to copy. 12164 12165@item loop-versioning-max-outer-insns 12166The maximum number of instructions that an outer loop can have 12167before the loop versioning pass considers it too big to copy, 12168discounting any instructions in inner loops that directly benefit 12169from versioning. 12170 12171@item ssa-name-def-chain-limit 12172The maximum number of SSA_NAME assignments to follow in determining 12173a property of a variable such as its value. This limits the number 12174of iterations or recursive calls GCC performs when optimizing certain 12175statements or when determining their validity prior to issuing 12176diagnostics. 12177 12178@end table 12179@end table 12180 12181@node Instrumentation Options 12182@section Program Instrumentation Options 12183@cindex instrumentation options 12184@cindex program instrumentation options 12185@cindex run-time error checking options 12186@cindex profiling options 12187@cindex options, program instrumentation 12188@cindex options, run-time error checking 12189@cindex options, profiling 12190 12191GCC supports a number of command-line options that control adding 12192run-time instrumentation to the code it normally generates. 12193For example, one purpose of instrumentation is collect profiling 12194statistics for use in finding program hot spots, code coverage 12195analysis, or profile-guided optimizations. 12196Another class of program instrumentation is adding run-time checking 12197to detect programming errors like invalid pointer 12198dereferences or out-of-bounds array accesses, as well as deliberately 12199hostile attacks such as stack smashing or C++ vtable hijacking. 12200There is also a general hook which can be used to implement other 12201forms of tracing or function-level instrumentation for debug or 12202program analysis purposes. 12203 12204@table @gcctabopt 12205@cindex @command{prof} 12206@cindex @command{gprof} 12207@item -p 12208@itemx -pg 12209@opindex p 12210@opindex pg 12211Generate extra code to write profile information suitable for the 12212analysis program @command{prof} (for @option{-p}) or @command{gprof} 12213(for @option{-pg}). You must use this option when compiling 12214the source files you want data about, and you must also use it when 12215linking. 12216 12217You can use the function attribute @code{no_instrument_function} to 12218suppress profiling of individual functions when compiling with these options. 12219@xref{Common Function Attributes}. 12220 12221@item -fprofile-arcs 12222@opindex fprofile-arcs 12223Add code so that program flow @dfn{arcs} are instrumented. During 12224execution the program records how many times each branch and call is 12225executed and how many times it is taken or returns. On targets that support 12226constructors with priority support, profiling properly handles constructors, 12227destructors and C++ constructors (and destructors) of classes which are used 12228as a type of a global variable. 12229 12230When the compiled 12231program exits it saves this data to a file called 12232@file{@var{auxname}.gcda} for each source file. The data may be used for 12233profile-directed optimizations (@option{-fbranch-probabilities}), or for 12234test coverage analysis (@option{-ftest-coverage}). Each object file's 12235@var{auxname} is generated from the name of the output file, if 12236explicitly specified and it is not the final executable, otherwise it is 12237the basename of the source file. In both cases any suffix is removed 12238(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 12239@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 12240@xref{Cross-profiling}. 12241 12242@cindex @command{gcov} 12243@item --coverage 12244@opindex coverage 12245 12246This option is used to compile and link code instrumented for coverage 12247analysis. The option is a synonym for @option{-fprofile-arcs} 12248@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 12249linking). See the documentation for those options for more details. 12250 12251@itemize 12252 12253@item 12254Compile the source files with @option{-fprofile-arcs} plus optimization 12255and code generation options. For test coverage analysis, use the 12256additional @option{-ftest-coverage} option. You do not need to profile 12257every source file in a program. 12258 12259@item 12260Compile the source files additionally with @option{-fprofile-abs-path} 12261to create absolute path names in the @file{.gcno} files. This allows 12262@command{gcov} to find the correct sources in projects where compilations 12263occur with different working directories. 12264 12265@item 12266Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 12267(the latter implies the former). 12268 12269@item 12270Run the program on a representative workload to generate the arc profile 12271information. This may be repeated any number of times. You can run 12272concurrent instances of your program, and provided that the file system 12273supports locking, the data files will be correctly updated. Unless 12274a strict ISO C dialect option is in effect, @code{fork} calls are 12275detected and correctly handled without double counting. 12276 12277@item 12278For profile-directed optimizations, compile the source files again with 12279the same optimization and code generation options plus 12280@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 12281Control Optimization}). 12282 12283@item 12284For test coverage analysis, use @command{gcov} to produce human readable 12285information from the @file{.gcno} and @file{.gcda} files. Refer to the 12286@command{gcov} documentation for further information. 12287 12288@end itemize 12289 12290With @option{-fprofile-arcs}, for each function of your program GCC 12291creates a program flow graph, then finds a spanning tree for the graph. 12292Only arcs that are not on the spanning tree have to be instrumented: the 12293compiler adds code to count the number of times that these arcs are 12294executed. When an arc is the only exit or only entrance to a block, the 12295instrumentation code can be added to the block; otherwise, a new basic 12296block must be created to hold the instrumentation code. 12297 12298@need 2000 12299@item -ftest-coverage 12300@opindex ftest-coverage 12301Produce a notes file that the @command{gcov} code-coverage utility 12302(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 12303show program coverage. Each source file's note file is called 12304@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 12305above for a description of @var{auxname} and instructions on how to 12306generate test coverage data. Coverage data matches the source files 12307more closely if you do not optimize. 12308 12309@item -fprofile-abs-path 12310@opindex fprofile-abs-path 12311Automatically convert relative source file names to absolute path names 12312in the @file{.gcno} files. This allows @command{gcov} to find the correct 12313sources in projects where compilations occur with different working 12314directories. 12315 12316@item -fprofile-dir=@var{path} 12317@opindex fprofile-dir 12318 12319Set the directory to search for the profile data files in to @var{path}. 12320This option affects only the profile data generated by 12321@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 12322and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 12323and its related options. Both absolute and relative paths can be used. 12324By default, GCC uses the current directory as @var{path}, thus the 12325profile data file appears in the same directory as the object file. 12326In order to prevent the file name clashing, if the object file name is 12327not an absolute path, we mangle the absolute path of the 12328@file{@var{sourcename}.gcda} file and use it as the file name of a 12329@file{.gcda} file. 12330 12331When an executable is run in a massive parallel environment, it is recommended 12332to save profile to different folders. That can be done with variables 12333in @var{path} that are exported during run-time: 12334 12335@table @gcctabopt 12336 12337@item %p 12338process ID. 12339 12340@item %q@{VAR@} 12341value of environment variable @var{VAR} 12342 12343@end table 12344 12345@item -fprofile-generate 12346@itemx -fprofile-generate=@var{path} 12347@opindex fprofile-generate 12348 12349Enable options usually used for instrumenting application to produce 12350profile useful for later recompilation with profile feedback based 12351optimization. You must use @option{-fprofile-generate} both when 12352compiling and when linking your program. 12353 12354The following options are enabled: 12355@option{-fprofile-arcs}, @option{-fprofile-values}, 12356@option{-finline-functions}, and @option{-fipa-bit-cp}. 12357 12358If @var{path} is specified, GCC looks at the @var{path} to find 12359the profile feedback data files. See @option{-fprofile-dir}. 12360 12361To optimize the program based on the collected profile information, use 12362@option{-fprofile-use}. @xref{Optimize Options}, for more information. 12363 12364@item -fprofile-update=@var{method} 12365@opindex fprofile-update 12366 12367Alter the update method for an application instrumented for profile 12368feedback based optimization. The @var{method} argument should be one of 12369@samp{single}, @samp{atomic} or @samp{prefer-atomic}. 12370The first one is useful for single-threaded applications, 12371while the second one prevents profile corruption by emitting thread-safe code. 12372 12373@strong{Warning:} When an application does not properly join all threads 12374(or creates an detached thread), a profile file can be still corrupted. 12375 12376Using @samp{prefer-atomic} would be transformed either to @samp{atomic}, 12377when supported by a target, or to @samp{single} otherwise. The GCC driver 12378automatically selects @samp{prefer-atomic} when @option{-pthread} 12379is present in the command line. 12380 12381@item -fprofile-filter-files=@var{regex} 12382@opindex fprofile-filter-files 12383 12384Instrument only functions from files where names match 12385any regular expression (separated by a semi-colon). 12386 12387For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument 12388only @file{main.c} and all C files starting with 'module'. 12389 12390@item -fprofile-exclude-files=@var{regex} 12391@opindex fprofile-exclude-files 12392 12393Instrument only functions from files where names do not match 12394all the regular expressions (separated by a semi-colon). 12395 12396For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation 12397of all files that are located in @file{/usr/} folder. 12398 12399@item -fsanitize=address 12400@opindex fsanitize=address 12401Enable AddressSanitizer, a fast memory error detector. 12402Memory access instructions are instrumented to detect 12403out-of-bounds and use-after-free bugs. 12404The option enables @option{-fsanitize-address-use-after-scope}. 12405See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 12406more details. The run-time behavior can be influenced using the 12407@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 12408the available options are shown at startup of the instrumented program. See 12409@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 12410for a list of supported options. 12411The option cannot be combined with @option{-fsanitize=thread}. 12412 12413@item -fsanitize=kernel-address 12414@opindex fsanitize=kernel-address 12415Enable AddressSanitizer for Linux kernel. 12416See @uref{https://github.com/google/kasan/wiki} for more details. 12417 12418@item -fsanitize=pointer-compare 12419@opindex fsanitize=pointer-compare 12420Instrument comparison operation (<, <=, >, >=) with pointer operands. 12421The option must be combined with either @option{-fsanitize=kernel-address} or 12422@option{-fsanitize=address} 12423The option cannot be combined with @option{-fsanitize=thread}. 12424Note: By default the check is disabled at run time. To enable it, 12425add @code{detect_invalid_pointer_pairs=2} to the environment variable 12426@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 12427invalid operation only when both pointers are non-null. 12428 12429@item -fsanitize=pointer-subtract 12430@opindex fsanitize=pointer-subtract 12431Instrument subtraction with pointer operands. 12432The option must be combined with either @option{-fsanitize=kernel-address} or 12433@option{-fsanitize=address} 12434The option cannot be combined with @option{-fsanitize=thread}. 12435Note: By default the check is disabled at run time. To enable it, 12436add @code{detect_invalid_pointer_pairs=2} to the environment variable 12437@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 12438invalid operation only when both pointers are non-null. 12439 12440@item -fsanitize=thread 12441@opindex fsanitize=thread 12442Enable ThreadSanitizer, a fast data race detector. 12443Memory access instructions are instrumented to detect 12444data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 12445details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 12446environment variable; see 12447@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 12448supported options. 12449The option cannot be combined with @option{-fsanitize=address}, 12450@option{-fsanitize=leak}. 12451 12452Note that sanitized atomic builtins cannot throw exceptions when 12453operating on invalid memory addresses with non-call exceptions 12454(@option{-fnon-call-exceptions}). 12455 12456@item -fsanitize=leak 12457@opindex fsanitize=leak 12458Enable LeakSanitizer, a memory leak detector. 12459This option only matters for linking of executables and 12460the executable is linked against a library that overrides @code{malloc} 12461and other allocator functions. See 12462@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 12463details. The run-time behavior can be influenced using the 12464@env{LSAN_OPTIONS} environment variable. 12465The option cannot be combined with @option{-fsanitize=thread}. 12466 12467@item -fsanitize=undefined 12468@opindex fsanitize=undefined 12469Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 12470Various computations are instrumented to detect undefined behavior 12471at runtime. Current suboptions are: 12472 12473@table @gcctabopt 12474 12475@item -fsanitize=shift 12476@opindex fsanitize=shift 12477This option enables checking that the result of a shift operation is 12478not undefined. Note that what exactly is considered undefined differs 12479slightly between C and C++, as well as between ISO C90 and C99, etc. 12480This option has two suboptions, @option{-fsanitize=shift-base} and 12481@option{-fsanitize=shift-exponent}. 12482 12483@item -fsanitize=shift-exponent 12484@opindex fsanitize=shift-exponent 12485This option enables checking that the second argument of a shift operation 12486is not negative and is smaller than the precision of the promoted first 12487argument. 12488 12489@item -fsanitize=shift-base 12490@opindex fsanitize=shift-base 12491If the second argument of a shift operation is within range, check that the 12492result of a shift operation is not undefined. Note that what exactly is 12493considered undefined differs slightly between C and C++, as well as between 12494ISO C90 and C99, etc. 12495 12496@item -fsanitize=integer-divide-by-zero 12497@opindex fsanitize=integer-divide-by-zero 12498Detect integer division by zero as well as @code{INT_MIN / -1} division. 12499 12500@item -fsanitize=unreachable 12501@opindex fsanitize=unreachable 12502With this option, the compiler turns the @code{__builtin_unreachable} 12503call into a diagnostics message call instead. When reaching the 12504@code{__builtin_unreachable} call, the behavior is undefined. 12505 12506@item -fsanitize=vla-bound 12507@opindex fsanitize=vla-bound 12508This option instructs the compiler to check that the size of a variable 12509length array is positive. 12510 12511@item -fsanitize=null 12512@opindex fsanitize=null 12513This option enables pointer checking. Particularly, the application 12514built with this option turned on will issue an error message when it 12515tries to dereference a NULL pointer, or if a reference (possibly an 12516rvalue reference) is bound to a NULL pointer, or if a method is invoked 12517on an object pointed by a NULL pointer. 12518 12519@item -fsanitize=return 12520@opindex fsanitize=return 12521This option enables return statement checking. Programs 12522built with this option turned on will issue an error message 12523when the end of a non-void function is reached without actually 12524returning a value. This option works in C++ only. 12525 12526@item -fsanitize=signed-integer-overflow 12527@opindex fsanitize=signed-integer-overflow 12528This option enables signed integer overflow checking. We check that 12529the result of @code{+}, @code{*}, and both unary and binary @code{-} 12530does not overflow in the signed arithmetics. Note, integer promotion 12531rules must be taken into account. That is, the following is not an 12532overflow: 12533@smallexample 12534signed char a = SCHAR_MAX; 12535a++; 12536@end smallexample 12537 12538@item -fsanitize=bounds 12539@opindex fsanitize=bounds 12540This option enables instrumentation of array bounds. Various out of bounds 12541accesses are detected. Flexible array members, flexible array member-like 12542arrays, and initializers of variables with static storage are not instrumented. 12543 12544@item -fsanitize=bounds-strict 12545@opindex fsanitize=bounds-strict 12546This option enables strict instrumentation of array bounds. Most out of bounds 12547accesses are detected, including flexible array members and flexible array 12548member-like arrays. Initializers of variables with static storage are not 12549instrumented. 12550 12551@item -fsanitize=alignment 12552@opindex fsanitize=alignment 12553 12554This option enables checking of alignment of pointers when they are 12555dereferenced, or when a reference is bound to insufficiently aligned target, 12556or when a method or constructor is invoked on insufficiently aligned object. 12557 12558@item -fsanitize=object-size 12559@opindex fsanitize=object-size 12560This option enables instrumentation of memory references using the 12561@code{__builtin_object_size} function. Various out of bounds pointer 12562accesses are detected. 12563 12564@item -fsanitize=float-divide-by-zero 12565@opindex fsanitize=float-divide-by-zero 12566Detect floating-point division by zero. Unlike other similar options, 12567@option{-fsanitize=float-divide-by-zero} is not enabled by 12568@option{-fsanitize=undefined}, since floating-point division by zero can 12569be a legitimate way of obtaining infinities and NaNs. 12570 12571@item -fsanitize=float-cast-overflow 12572@opindex fsanitize=float-cast-overflow 12573This option enables floating-point type to integer conversion checking. 12574We check that the result of the conversion does not overflow. 12575Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 12576not enabled by @option{-fsanitize=undefined}. 12577This option does not work well with @code{FE_INVALID} exceptions enabled. 12578 12579@item -fsanitize=nonnull-attribute 12580@opindex fsanitize=nonnull-attribute 12581 12582This option enables instrumentation of calls, checking whether null values 12583are not passed to arguments marked as requiring a non-null value by the 12584@code{nonnull} function attribute. 12585 12586@item -fsanitize=returns-nonnull-attribute 12587@opindex fsanitize=returns-nonnull-attribute 12588 12589This option enables instrumentation of return statements in functions 12590marked with @code{returns_nonnull} function attribute, to detect returning 12591of null values from such functions. 12592 12593@item -fsanitize=bool 12594@opindex fsanitize=bool 12595 12596This option enables instrumentation of loads from bool. If a value other 12597than 0/1 is loaded, a run-time error is issued. 12598 12599@item -fsanitize=enum 12600@opindex fsanitize=enum 12601 12602This option enables instrumentation of loads from an enum type. If 12603a value outside the range of values for the enum type is loaded, 12604a run-time error is issued. 12605 12606@item -fsanitize=vptr 12607@opindex fsanitize=vptr 12608 12609This option enables instrumentation of C++ member function calls, member 12610accesses and some conversions between pointers to base and derived classes, 12611to verify the referenced object has the correct dynamic type. 12612 12613@item -fsanitize=pointer-overflow 12614@opindex fsanitize=pointer-overflow 12615 12616This option enables instrumentation of pointer arithmetics. If the pointer 12617arithmetics overflows, a run-time error is issued. 12618 12619@item -fsanitize=builtin 12620@opindex fsanitize=builtin 12621 12622This option enables instrumentation of arguments to selected builtin 12623functions. If an invalid value is passed to such arguments, a run-time 12624error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz} 12625or @code{__builtin_clz} invokes undefined behavior and is diagnosed 12626by this option. 12627 12628@end table 12629 12630While @option{-ftrapv} causes traps for signed overflows to be emitted, 12631@option{-fsanitize=undefined} gives a diagnostic message. 12632This currently works only for the C family of languages. 12633 12634@item -fno-sanitize=all 12635@opindex fno-sanitize=all 12636 12637This option disables all previously enabled sanitizers. 12638@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 12639together. 12640 12641@item -fasan-shadow-offset=@var{number} 12642@opindex fasan-shadow-offset 12643This option forces GCC to use custom shadow offset in AddressSanitizer checks. 12644It is useful for experimenting with different shadow memory layouts in 12645Kernel AddressSanitizer. 12646 12647@item -fsanitize-sections=@var{s1},@var{s2},... 12648@opindex fsanitize-sections 12649Sanitize global variables in selected user-defined sections. @var{si} may 12650contain wildcards. 12651 12652@item -fsanitize-recover@r{[}=@var{opts}@r{]} 12653@opindex fsanitize-recover 12654@opindex fno-sanitize-recover 12655@option{-fsanitize-recover=} controls error recovery mode for sanitizers 12656mentioned in comma-separated list of @var{opts}. Enabling this option 12657for a sanitizer component causes it to attempt to continue 12658running the program as if no error happened. This means multiple 12659runtime errors can be reported in a single program run, and the exit 12660code of the program may indicate success even when errors 12661have been reported. The @option{-fno-sanitize-recover=} option 12662can be used to alter 12663this behavior: only the first detected error is reported 12664and program then exits with a non-zero exit code. 12665 12666Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 12667except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 12668@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero}, 12669@option{-fsanitize=bounds-strict}, 12670@option{-fsanitize=kernel-address} and @option{-fsanitize=address}. 12671For these sanitizers error recovery is turned on by default, 12672except @option{-fsanitize=address}, for which this feature is experimental. 12673@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 12674accepted, the former enables recovery for all sanitizers that support it, 12675the latter disables recovery for all sanitizers that support it. 12676 12677Even if a recovery mode is turned on the compiler side, it needs to be also 12678enabled on the runtime library side, otherwise the failures are still fatal. 12679The runtime library defaults to @code{halt_on_error=0} for 12680ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for 12681AddressSanitizer is @code{halt_on_error=1}. This can be overridden through 12682setting the @code{halt_on_error} flag in the corresponding environment variable. 12683 12684Syntax without an explicit @var{opts} parameter is deprecated. It is 12685equivalent to specifying an @var{opts} list of: 12686 12687@smallexample 12688undefined,float-cast-overflow,float-divide-by-zero,bounds-strict 12689@end smallexample 12690 12691@item -fsanitize-address-use-after-scope 12692@opindex fsanitize-address-use-after-scope 12693Enable sanitization of local variables to detect use-after-scope bugs. 12694The option sets @option{-fstack-reuse} to @samp{none}. 12695 12696@item -fsanitize-undefined-trap-on-error 12697@opindex fsanitize-undefined-trap-on-error 12698The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 12699report undefined behavior using @code{__builtin_trap} rather than 12700a @code{libubsan} library routine. The advantage of this is that the 12701@code{libubsan} library is not needed and is not linked in, so this 12702is usable even in freestanding environments. 12703 12704@item -fsanitize-coverage=trace-pc 12705@opindex fsanitize-coverage=trace-pc 12706Enable coverage-guided fuzzing code instrumentation. 12707Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block. 12708 12709@item -fsanitize-coverage=trace-cmp 12710@opindex fsanitize-coverage=trace-cmp 12711Enable dataflow guided fuzzing code instrumentation. 12712Inserts a call to @code{__sanitizer_cov_trace_cmp1}, 12713@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or 12714@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands 12715variable or @code{__sanitizer_cov_trace_const_cmp1}, 12716@code{__sanitizer_cov_trace_const_cmp2}, 12717@code{__sanitizer_cov_trace_const_cmp4} or 12718@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one 12719operand constant, @code{__sanitizer_cov_trace_cmpf} or 12720@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and 12721@code{__sanitizer_cov_trace_switch} for switch statements. 12722 12723@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} 12724@opindex fcf-protection 12725Enable code instrumentation of control-flow transfers to increase 12726program security by checking that target addresses of control-flow 12727transfer instructions (such as indirect function call, function return, 12728indirect jump) are valid. This prevents diverting the flow of control 12729to an unexpected target. This is intended to protect against such 12730threats as Return-oriented Programming (ROP), and similarly 12731call/jmp-oriented programming (COP/JOP). 12732 12733The value @code{branch} tells the compiler to implement checking of 12734validity of control-flow transfer at the point of indirect branch 12735instructions, i.e.@: call/jmp instructions. The value @code{return} 12736implements checking of validity at the point of returning from a 12737function. The value @code{full} is an alias for specifying both 12738@code{branch} and @code{return}. The value @code{none} turns off 12739instrumentation. 12740 12741The macro @code{__CET__} is defined when @option{-fcf-protection} is 12742used. The first bit of @code{__CET__} is set to 1 for the value 12743@code{branch} and the second bit of @code{__CET__} is set to 1 for 12744the @code{return}. 12745 12746You can also use the @code{nocf_check} attribute to identify 12747which functions and calls should be skipped from instrumentation 12748(@pxref{Function Attributes}). 12749 12750Currently the x86 GNU/Linux target provides an implementation based 12751on Intel Control-flow Enforcement Technology (CET). 12752 12753@item -fstack-protector 12754@opindex fstack-protector 12755Emit extra code to check for buffer overflows, such as stack smashing 12756attacks. This is done by adding a guard variable to functions with 12757vulnerable objects. This includes functions that call @code{alloca}, and 12758functions with buffers larger than 8 bytes. The guards are initialized 12759when a function is entered and then checked when the function exits. 12760If a guard check fails, an error message is printed and the program exits. 12761 12762@item -fstack-protector-all 12763@opindex fstack-protector-all 12764Like @option{-fstack-protector} except that all functions are protected. 12765 12766@item -fstack-protector-strong 12767@opindex fstack-protector-strong 12768Like @option{-fstack-protector} but includes additional functions to 12769be protected --- those that have local array definitions, or have 12770references to local frame addresses. 12771 12772@item -fstack-protector-explicit 12773@opindex fstack-protector-explicit 12774Like @option{-fstack-protector} but only protects those functions which 12775have the @code{stack_protect} attribute. 12776 12777@item -fstack-check 12778@opindex fstack-check 12779Generate code to verify that you do not go beyond the boundary of the 12780stack. You should specify this flag if you are running in an 12781environment with multiple threads, but you only rarely need to specify it in 12782a single-threaded environment since stack overflow is automatically 12783detected on nearly all systems if there is only one stack. 12784 12785Note that this switch does not actually cause checking to be done; the 12786operating system or the language runtime must do that. The switch causes 12787generation of code to ensure that they see the stack being extended. 12788 12789You can additionally specify a string parameter: @samp{no} means no 12790checking, @samp{generic} means force the use of old-style checking, 12791@samp{specific} means use the best checking method and is equivalent 12792to bare @option{-fstack-check}. 12793 12794Old-style checking is a generic mechanism that requires no specific 12795target support in the compiler but comes with the following drawbacks: 12796 12797@enumerate 12798@item 12799Modified allocation strategy for large objects: they are always 12800allocated dynamically if their size exceeds a fixed threshold. Note this 12801may change the semantics of some code. 12802 12803@item 12804Fixed limit on the size of the static frame of functions: when it is 12805topped by a particular function, stack checking is not reliable and 12806a warning is issued by the compiler. 12807 12808@item 12809Inefficiency: because of both the modified allocation strategy and the 12810generic implementation, code performance is hampered. 12811@end enumerate 12812 12813Note that old-style stack checking is also the fallback method for 12814@samp{specific} if no target support has been added in the compiler. 12815 12816@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion 12817and stack overflows. @samp{specific} is an excellent choice when compiling 12818Ada code. It is not generally sufficient to protect against stack-clash 12819attacks. To protect against those you want @samp{-fstack-clash-protection}. 12820 12821@item -fstack-clash-protection 12822@opindex fstack-clash-protection 12823Generate code to prevent stack clash style attacks. When this option is 12824enabled, the compiler will only allocate one page of stack space at a time 12825and each page is accessed immediately after allocation. Thus, it prevents 12826allocations from jumping over any stack guard page provided by the 12827operating system. 12828 12829Most targets do not fully support stack clash protection. However, on 12830those targets @option{-fstack-clash-protection} will protect dynamic stack 12831allocations. @option{-fstack-clash-protection} may also provide limited 12832protection for static stack allocations if the target supports 12833@option{-fstack-check=specific}. 12834 12835@item -fstack-limit-register=@var{reg} 12836@itemx -fstack-limit-symbol=@var{sym} 12837@itemx -fno-stack-limit 12838@opindex fstack-limit-register 12839@opindex fstack-limit-symbol 12840@opindex fno-stack-limit 12841Generate code to ensure that the stack does not grow beyond a certain value, 12842either the value of a register or the address of a symbol. If a larger 12843stack is required, a signal is raised at run time. For most targets, 12844the signal is raised before the stack overruns the boundary, so 12845it is possible to catch the signal without taking special precautions. 12846 12847For instance, if the stack starts at absolute address @samp{0x80000000} 12848and grows downwards, you can use the flags 12849@option{-fstack-limit-symbol=__stack_limit} and 12850@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 12851of 128KB@. Note that this may only work with the GNU linker. 12852 12853You can locally override stack limit checking by using the 12854@code{no_stack_limit} function attribute (@pxref{Function Attributes}). 12855 12856@item -fsplit-stack 12857@opindex fsplit-stack 12858Generate code to automatically split the stack before it overflows. 12859The resulting program has a discontiguous stack which can only 12860overflow if the program is unable to allocate any more memory. This 12861is most useful when running threaded programs, as it is no longer 12862necessary to calculate a good stack size to use for each thread. This 12863is currently only implemented for the x86 targets running 12864GNU/Linux. 12865 12866When code compiled with @option{-fsplit-stack} calls code compiled 12867without @option{-fsplit-stack}, there may not be much stack space 12868available for the latter code to run. If compiling all code, 12869including library code, with @option{-fsplit-stack} is not an option, 12870then the linker can fix up these calls so that the code compiled 12871without @option{-fsplit-stack} always has a large stack. Support for 12872this is implemented in the gold linker in GNU binutils release 2.21 12873and later. 12874 12875@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 12876@opindex fvtable-verify 12877This option is only available when compiling C++ code. 12878It turns on (or off, if using @option{-fvtable-verify=none}) the security 12879feature that verifies at run time, for every virtual call, that 12880the vtable pointer through which the call is made is valid for the type of 12881the object, and has not been corrupted or overwritten. If an invalid vtable 12882pointer is detected at run time, an error is reported and execution of the 12883program is immediately halted. 12884 12885This option causes run-time data structures to be built at program startup, 12886which are used for verifying the vtable pointers. 12887The options @samp{std} and @samp{preinit} 12888control the timing of when these data structures are built. In both cases the 12889data structures are built before execution reaches @code{main}. Using 12890@option{-fvtable-verify=std} causes the data structures to be built after 12891shared libraries have been loaded and initialized. 12892@option{-fvtable-verify=preinit} causes them to be built before shared 12893libraries have been loaded and initialized. 12894 12895If this option appears multiple times in the command line with different 12896values specified, @samp{none} takes highest priority over both @samp{std} and 12897@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 12898 12899@item -fvtv-debug 12900@opindex fvtv-debug 12901When used in conjunction with @option{-fvtable-verify=std} or 12902@option{-fvtable-verify=preinit}, causes debug versions of the 12903runtime functions for the vtable verification feature to be called. 12904This flag also causes the compiler to log information about which 12905vtable pointers it finds for each class. 12906This information is written to a file named @file{vtv_set_ptr_data.log} 12907in the directory named by the environment variable @env{VTV_LOGS_DIR} 12908if that is defined or the current working directory otherwise. 12909 12910Note: This feature @emph{appends} data to the log file. If you want a fresh log 12911file, be sure to delete any existing one. 12912 12913@item -fvtv-counts 12914@opindex fvtv-counts 12915This is a debugging flag. When used in conjunction with 12916@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 12917causes the compiler to keep track of the total number of virtual calls 12918it encounters and the number of verifications it inserts. It also 12919counts the number of calls to certain run-time library functions 12920that it inserts and logs this information for each compilation unit. 12921The compiler writes this information to a file named 12922@file{vtv_count_data.log} in the directory named by the environment 12923variable @env{VTV_LOGS_DIR} if that is defined or the current working 12924directory otherwise. It also counts the size of the vtable pointer sets 12925for each class, and writes this information to @file{vtv_class_set_sizes.log} 12926in the same directory. 12927 12928Note: This feature @emph{appends} data to the log files. To get fresh log 12929files, be sure to delete any existing ones. 12930 12931@item -finstrument-functions 12932@opindex finstrument-functions 12933Generate instrumentation calls for entry and exit to functions. Just 12934after function entry and just before function exit, the following 12935profiling functions are called with the address of the current 12936function and its call site. (On some platforms, 12937@code{__builtin_return_address} does not work beyond the current 12938function, so the call site information may not be available to the 12939profiling functions otherwise.) 12940 12941@smallexample 12942void __cyg_profile_func_enter (void *this_fn, 12943 void *call_site); 12944void __cyg_profile_func_exit (void *this_fn, 12945 void *call_site); 12946@end smallexample 12947 12948The first argument is the address of the start of the current function, 12949which may be looked up exactly in the symbol table. 12950 12951This instrumentation is also done for functions expanded inline in other 12952functions. The profiling calls indicate where, conceptually, the 12953inline function is entered and exited. This means that addressable 12954versions of such functions must be available. If all your uses of a 12955function are expanded inline, this may mean an additional expansion of 12956code size. If you use @code{extern inline} in your C code, an 12957addressable version of such functions must be provided. (This is 12958normally the case anyway, but if you get lucky and the optimizer always 12959expands the functions inline, you might have gotten away without 12960providing static copies.) 12961 12962A function may be given the attribute @code{no_instrument_function}, in 12963which case this instrumentation is not done. This can be used, for 12964example, for the profiling functions listed above, high-priority 12965interrupt routines, and any functions from which the profiling functions 12966cannot safely be called (perhaps signal handlers, if the profiling 12967routines generate output or allocate memory). 12968@xref{Common Function Attributes}. 12969 12970@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 12971@opindex finstrument-functions-exclude-file-list 12972 12973Set the list of functions that are excluded from instrumentation (see 12974the description of @option{-finstrument-functions}). If the file that 12975contains a function definition matches with one of @var{file}, then 12976that function is not instrumented. The match is done on substrings: 12977if the @var{file} parameter is a substring of the file name, it is 12978considered to be a match. 12979 12980For example: 12981 12982@smallexample 12983-finstrument-functions-exclude-file-list=/bits/stl,include/sys 12984@end smallexample 12985 12986@noindent 12987excludes any inline function defined in files whose pathnames 12988contain @file{/bits/stl} or @file{include/sys}. 12989 12990If, for some reason, you want to include letter @samp{,} in one of 12991@var{sym}, write @samp{\,}. For example, 12992@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 12993(note the single quote surrounding the option). 12994 12995@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 12996@opindex finstrument-functions-exclude-function-list 12997 12998This is similar to @option{-finstrument-functions-exclude-file-list}, 12999but this option sets the list of function names to be excluded from 13000instrumentation. The function name to be matched is its user-visible 13001name, such as @code{vector<int> blah(const vector<int> &)}, not the 13002internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 13003match is done on substrings: if the @var{sym} parameter is a substring 13004of the function name, it is considered to be a match. For C99 and C++ 13005extended identifiers, the function name must be given in UTF-8, not 13006using universal character names. 13007 13008@item -fpatchable-function-entry=@var{N}[,@var{M}] 13009@opindex fpatchable-function-entry 13010Generate @var{N} NOPs right at the beginning 13011of each function, with the function entry point before the @var{M}th NOP. 13012If @var{M} is omitted, it defaults to @code{0} so the 13013function entry points to the address just at the first NOP. 13014The NOP instructions reserve extra space which can be used to patch in 13015any desired instrumentation at run time, provided that the code segment 13016is writable. The amount of space is controllable indirectly via 13017the number of NOPs; the NOP instruction used corresponds to the instruction 13018emitted by the internal GCC back-end interface @code{gen_nop}. This behavior 13019is target-specific and may also depend on the architecture variant and/or 13020other compilation options. 13021 13022For run-time identification, the starting addresses of these areas, 13023which correspond to their respective function entries minus @var{M}, 13024are additionally collected in the @code{__patchable_function_entries} 13025section of the resulting binary. 13026 13027Note that the value of @code{__attribute__ ((patchable_function_entry 13028(N,M)))} takes precedence over command-line option 13029@option{-fpatchable-function-entry=N,M}. This can be used to increase 13030the area size or to remove it completely on a single function. 13031If @code{N=0}, no pad location is recorded. 13032 13033The NOP instructions are inserted at---and maybe before, depending on 13034@var{M}---the function entry address, even before the prologue. 13035 13036@end table 13037 13038 13039@node Preprocessor Options 13040@section Options Controlling the Preprocessor 13041@cindex preprocessor options 13042@cindex options, preprocessor 13043 13044These options control the C preprocessor, which is run on each C source 13045file before actual compilation. 13046 13047If you use the @option{-E} option, nothing is done except preprocessing. 13048Some of these options make sense only together with @option{-E} because 13049they cause the preprocessor output to be unsuitable for actual 13050compilation. 13051 13052In addition to the options listed here, there are a number of options 13053to control search paths for include files documented in 13054@ref{Directory Options}. 13055Options to control preprocessor diagnostics are listed in 13056@ref{Warning Options}. 13057 13058@table @gcctabopt 13059@include cppopts.texi 13060 13061@item -Wp,@var{option} 13062@opindex Wp 13063You can use @option{-Wp,@var{option}} to bypass the compiler driver 13064and pass @var{option} directly through to the preprocessor. If 13065@var{option} contains commas, it is split into multiple options at the 13066commas. However, many options are modified, translated or interpreted 13067by the compiler driver before being passed to the preprocessor, and 13068@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 13069interface is undocumented and subject to change, so whenever possible 13070you should avoid using @option{-Wp} and let the driver handle the 13071options instead. 13072 13073@item -Xpreprocessor @var{option} 13074@opindex Xpreprocessor 13075Pass @var{option} as an option to the preprocessor. You can use this to 13076supply system-specific preprocessor options that GCC does not 13077recognize. 13078 13079If you want to pass an option that takes an argument, you must use 13080@option{-Xpreprocessor} twice, once for the option and once for the argument. 13081 13082@item -no-integrated-cpp 13083@opindex no-integrated-cpp 13084Perform preprocessing as a separate pass before compilation. 13085By default, GCC performs preprocessing as an integrated part of 13086input tokenization and parsing. 13087If this option is provided, the appropriate language front end 13088(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 13089and Objective-C, respectively) is instead invoked twice, 13090once for preprocessing only and once for actual compilation 13091of the preprocessed input. 13092This option may be useful in conjunction with the @option{-B} or 13093@option{-wrapper} options to specify an alternate preprocessor or 13094perform additional processing of the program source between 13095normal preprocessing and compilation. 13096 13097@end table 13098 13099@node Assembler Options 13100@section Passing Options to the Assembler 13101 13102@c prevent bad page break with this line 13103You can pass options to the assembler. 13104 13105@table @gcctabopt 13106@item -Wa,@var{option} 13107@opindex Wa 13108Pass @var{option} as an option to the assembler. If @var{option} 13109contains commas, it is split into multiple options at the commas. 13110 13111@item -Xassembler @var{option} 13112@opindex Xassembler 13113Pass @var{option} as an option to the assembler. You can use this to 13114supply system-specific assembler options that GCC does not 13115recognize. 13116 13117If you want to pass an option that takes an argument, you must use 13118@option{-Xassembler} twice, once for the option and once for the argument. 13119 13120@end table 13121 13122@node Link Options 13123@section Options for Linking 13124@cindex link options 13125@cindex options, linking 13126 13127These options come into play when the compiler links object files into 13128an executable output file. They are meaningless if the compiler is 13129not doing a link step. 13130 13131@table @gcctabopt 13132@cindex file names 13133@item @var{object-file-name} 13134A file name that does not end in a special recognized suffix is 13135considered to name an object file or library. (Object files are 13136distinguished from libraries by the linker according to the file 13137contents.) If linking is done, these object files are used as input 13138to the linker. 13139 13140@item -c 13141@itemx -S 13142@itemx -E 13143@opindex c 13144@opindex S 13145@opindex E 13146If any of these options is used, then the linker is not run, and 13147object file names should not be used as arguments. @xref{Overall 13148Options}. 13149 13150@item -flinker-output=@var{type} 13151@opindex flinker-output 13152This option controls the code generation of the link time optimizer. By 13153default the linker output is determined by the linker plugin automatically. For 13154debugging the compiler and in the case of incremental linking to non-lto object 13155file is desired, it may be useful to control the type manually. 13156 13157If @var{type} is @samp{exec} the code generation is configured to produce static 13158binary. In this case @option{-fpic} and @option{-fpie} are both disabled. 13159 13160If @var{type} is @samp{dyn} the code generation is configured to produce shared 13161library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not 13162enabled automatically. This makes it possible to build shared libraries without 13163position independent code on architectures this is possible, i.e.@: on x86. 13164 13165If @var{type} is @samp{pie} the code generation is configured to produce 13166@option{-fpie} executable. This result in similar optimizations as @samp{exec} 13167except that @option{-fpie} is not disabled if specified at compilation time. 13168 13169If @var{type} is @samp{rel} the compiler assumes that incremental linking is 13170done. The sections containing intermediate code for link-time optimization are 13171merged, pre-optimized, and output to the resulting object file. In addition, if 13172@option{-ffat-lto-objects} is specified the binary code is produced for future 13173non-lto linking. The object file produced by incremental linking will be smaller 13174than a static library produced from the same object files. At link-time the 13175result of incremental linking will also load faster to compiler than a static 13176library assuming that majority of objects in the library are used. 13177 13178Finally @samp{nolto-rel} configure compiler to for incremental linking where 13179code generation is forced, final binary is produced and the intermediate code 13180for later link-time optimization is stripped. When multiple object files are 13181linked together the resulting code will be optimized better than with link time 13182optimizations disabled (for example, the cross-module inlining will happen), 13183most of benefits of whole program optimizations are however lost. 13184 13185During the incremental link (by @option{-r}) the linker plugin will default to 13186@option{rel}. With current interfaces to GNU Binutils it is however not 13187possible to link incrementally LTO objects and non-LTO objects into a single 13188mixed object file. In the case any of object files in incremental link cannot 13189be used for link-time optimization the linker plugin will output warning and 13190use @samp{nolto-rel}. To maintain the whole program optimization it is 13191recommended to link such objects into static library instead. Alternatively it 13192is possible to use H.J. Lu's binutils with support for mixed objects. 13193 13194@item -fuse-ld=bfd 13195@opindex fuse-ld=bfd 13196Use the @command{bfd} linker instead of the default linker. 13197 13198@item -fuse-ld=gold 13199@opindex fuse-ld=gold 13200Use the @command{gold} linker instead of the default linker. 13201 13202@item -fuse-ld=lld 13203@opindex fuse-ld=lld 13204Use the LLVM @command{lld} linker instead of the default linker. 13205 13206@cindex Libraries 13207@item -l@var{library} 13208@itemx -l @var{library} 13209@opindex l 13210Search the library named @var{library} when linking. (The second 13211alternative with the library as a separate argument is only for 13212POSIX compliance and is not recommended.) 13213 13214The @option{-l} option is passed directly to the linker by GCC. Refer 13215to your linker documentation for exact details. The general 13216description below applies to the GNU linker. 13217 13218The linker searches a standard list of directories for the library. 13219The directories searched include several standard system directories 13220plus any that you specify with @option{-L}. 13221 13222Static libraries are archives of object files, and have file names 13223like @file{lib@var{library}.a}. Some targets also support shared 13224libraries, which typically have names like @file{lib@var{library}.so}. 13225If both static and shared libraries are found, the linker gives 13226preference to linking with the shared library unless the 13227@option{-static} option is used. 13228 13229It makes a difference where in the command you write this option; the 13230linker searches and processes libraries and object files in the order they 13231are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 13232after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 13233to functions in @samp{z}, those functions may not be loaded. 13234 13235@item -lobjc 13236@opindex lobjc 13237You need this special case of the @option{-l} option in order to 13238link an Objective-C or Objective-C++ program. 13239 13240@item -nostartfiles 13241@opindex nostartfiles 13242Do not use the standard system startup files when linking. 13243The standard system libraries are used normally, unless @option{-nostdlib}, 13244@option{-nolibc}, or @option{-nodefaultlibs} is used. 13245 13246@item -nodefaultlibs 13247@opindex nodefaultlibs 13248Do not use the standard system libraries when linking. 13249Only the libraries you specify are passed to the linker, and options 13250specifying linkage of the system libraries, such as @option{-static-libgcc} 13251or @option{-shared-libgcc}, are ignored. 13252The standard startup files are used normally, unless @option{-nostartfiles} 13253is used. 13254 13255The compiler may generate calls to @code{memcmp}, 13256@code{memset}, @code{memcpy} and @code{memmove}. 13257These entries are usually resolved by entries in 13258libc. These entry points should be supplied through some other 13259mechanism when this option is specified. 13260 13261@item -nolibc 13262@opindex nolibc 13263Do not use the C library or system libraries tightly coupled with it when 13264linking. Still link with the startup files, @file{libgcc} or toolchain 13265provided language support libraries such as @file{libgnat}, @file{libgfortran} 13266or @file{libstdc++} unless options preventing their inclusion are used as 13267well. This typically removes @option{-lc} from the link command line, as well 13268as system libraries that normally go with it and become meaningless when 13269absence of a C library is assumed, for example @option{-lpthread} or 13270@option{-lm} in some configurations. This is intended for bare-board 13271targets when there is indeed no C library available. 13272 13273@item -nostdlib 13274@opindex nostdlib 13275Do not use the standard system startup files or libraries when linking. 13276No startup files and only the libraries you specify are passed to 13277the linker, and options specifying linkage of the system libraries, such as 13278@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 13279 13280The compiler may generate calls to @code{memcmp}, @code{memset}, 13281@code{memcpy} and @code{memmove}. 13282These entries are usually resolved by entries in 13283libc. These entry points should be supplied through some other 13284mechanism when this option is specified. 13285 13286@cindex @option{-lgcc}, use with @option{-nostdlib} 13287@cindex @option{-nostdlib} and unresolved references 13288@cindex unresolved references and @option{-nostdlib} 13289@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 13290@cindex @option{-nodefaultlibs} and unresolved references 13291@cindex unresolved references and @option{-nodefaultlibs} 13292One of the standard libraries bypassed by @option{-nostdlib} and 13293@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 13294which GCC uses to overcome shortcomings of particular machines, or special 13295needs for some languages. 13296(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 13297Collection (GCC) Internals}, 13298for more discussion of @file{libgcc.a}.) 13299In most cases, you need @file{libgcc.a} even when you want to avoid 13300other standard libraries. In other words, when you specify @option{-nostdlib} 13301or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 13302This ensures that you have no unresolved references to internal GCC 13303library subroutines. 13304(An example of such an internal subroutine is @code{__main}, used to ensure C++ 13305constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 13306GNU Compiler Collection (GCC) Internals}.) 13307 13308@item -e @var{entry} 13309@itemx --entry=@var{entry} 13310@opindex e 13311@opindex entry 13312 13313Specify that the program entry point is @var{entry}. The argument is 13314interpreted by the linker; the GNU linker accepts either a symbol name 13315or an address. 13316 13317@item -pie 13318@opindex pie 13319Produce a dynamically linked position independent executable on targets 13320that support it. For predictable results, you must also specify the same 13321set of options used for compilation (@option{-fpie}, @option{-fPIE}, 13322or model suboptions) when you specify this linker option. 13323 13324@item -no-pie 13325@opindex no-pie 13326Don't produce a dynamically linked position independent executable. 13327 13328@item -static-pie 13329@opindex static-pie 13330Produce a static position independent executable on targets that support 13331it. A static position independent executable is similar to a static 13332executable, but can be loaded at any address without a dynamic linker. 13333For predictable results, you must also specify the same set of options 13334used for compilation (@option{-fpie}, @option{-fPIE}, or model 13335suboptions) when you specify this linker option. 13336 13337@item -pthread 13338@opindex pthread 13339Link with the POSIX threads library. This option is supported on 13340GNU/Linux targets, most other Unix derivatives, and also on 13341x86 Cygwin and MinGW targets. On some targets this option also sets 13342flags for the preprocessor, so it should be used consistently for both 13343compilation and linking. 13344 13345@item -r 13346@opindex r 13347Produce a relocatable object as output. This is also known as partial 13348linking. 13349 13350@item -rdynamic 13351@opindex rdynamic 13352Pass the flag @option{-export-dynamic} to the ELF linker, on targets 13353that support it. This instructs the linker to add all symbols, not 13354only used ones, to the dynamic symbol table. This option is needed 13355for some uses of @code{dlopen} or to allow obtaining backtraces 13356from within a program. 13357 13358@item -s 13359@opindex s 13360Remove all symbol table and relocation information from the executable. 13361 13362@item -static 13363@opindex static 13364On systems that support dynamic linking, this overrides @option{-pie} 13365and prevents linking with the shared libraries. On other systems, this 13366option has no effect. 13367 13368@item -shared 13369@opindex shared 13370Produce a shared object which can then be linked with other objects to 13371form an executable. Not all systems support this option. For predictable 13372results, you must also specify the same set of options used for compilation 13373(@option{-fpic}, @option{-fPIC}, or model suboptions) when 13374you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 13375needs to build supplementary stub code for constructors to work. On 13376multi-libbed systems, @samp{gcc -shared} must select the correct support 13377libraries to link against. Failing to supply the correct flags may lead 13378to subtle defects. Supplying them in cases where they are not necessary 13379is innocuous.} 13380 13381@item -shared-libgcc 13382@itemx -static-libgcc 13383@opindex shared-libgcc 13384@opindex static-libgcc 13385On systems that provide @file{libgcc} as a shared library, these options 13386force the use of either the shared or static version, respectively. 13387If no shared version of @file{libgcc} was built when the compiler was 13388configured, these options have no effect. 13389 13390There are several situations in which an application should use the 13391shared @file{libgcc} instead of the static version. The most common 13392of these is when the application wishes to throw and catch exceptions 13393across different shared libraries. In that case, each of the libraries 13394as well as the application itself should use the shared @file{libgcc}. 13395 13396Therefore, the G++ driver automatically adds @option{-shared-libgcc} 13397whenever you build a shared library or a main executable, because C++ 13398programs typically use exceptions, so this is the right thing to do. 13399 13400If, instead, you use the GCC driver to create shared libraries, you may 13401find that they are not always linked with the shared @file{libgcc}. 13402If GCC finds, at its configuration time, that you have a non-GNU linker 13403or a GNU linker that does not support option @option{--eh-frame-hdr}, 13404it links the shared version of @file{libgcc} into shared libraries 13405by default. Otherwise, it takes advantage of the linker and optimizes 13406away the linking with the shared version of @file{libgcc}, linking with 13407the static version of libgcc by default. This allows exceptions to 13408propagate through such shared libraries, without incurring relocation 13409costs at library load time. 13410 13411However, if a library or main executable is supposed to throw or catch 13412exceptions, you must link it using the G++ driver, or using the option 13413@option{-shared-libgcc}, such that it is linked with the shared 13414@file{libgcc}. 13415 13416@item -static-libasan 13417@opindex static-libasan 13418When the @option{-fsanitize=address} option is used to link a program, 13419the GCC driver automatically links against @option{libasan}. If 13420@file{libasan} is available as a shared library, and the @option{-static} 13421option is not used, then this links against the shared version of 13422@file{libasan}. The @option{-static-libasan} option directs the GCC 13423driver to link @file{libasan} statically, without necessarily linking 13424other libraries statically. 13425 13426@item -static-libtsan 13427@opindex static-libtsan 13428When the @option{-fsanitize=thread} option is used to link a program, 13429the GCC driver automatically links against @option{libtsan}. If 13430@file{libtsan} is available as a shared library, and the @option{-static} 13431option is not used, then this links against the shared version of 13432@file{libtsan}. The @option{-static-libtsan} option directs the GCC 13433driver to link @file{libtsan} statically, without necessarily linking 13434other libraries statically. 13435 13436@item -static-liblsan 13437@opindex static-liblsan 13438When the @option{-fsanitize=leak} option is used to link a program, 13439the GCC driver automatically links against @option{liblsan}. If 13440@file{liblsan} is available as a shared library, and the @option{-static} 13441option is not used, then this links against the shared version of 13442@file{liblsan}. The @option{-static-liblsan} option directs the GCC 13443driver to link @file{liblsan} statically, without necessarily linking 13444other libraries statically. 13445 13446@item -static-libubsan 13447@opindex static-libubsan 13448When the @option{-fsanitize=undefined} option is used to link a program, 13449the GCC driver automatically links against @option{libubsan}. If 13450@file{libubsan} is available as a shared library, and the @option{-static} 13451option is not used, then this links against the shared version of 13452@file{libubsan}. The @option{-static-libubsan} option directs the GCC 13453driver to link @file{libubsan} statically, without necessarily linking 13454other libraries statically. 13455 13456@item -static-libstdc++ 13457@opindex static-libstdc++ 13458When the @command{g++} program is used to link a C++ program, it 13459normally automatically links against @option{libstdc++}. If 13460@file{libstdc++} is available as a shared library, and the 13461@option{-static} option is not used, then this links against the 13462shared version of @file{libstdc++}. That is normally fine. However, it 13463is sometimes useful to freeze the version of @file{libstdc++} used by 13464the program without going all the way to a fully static link. The 13465@option{-static-libstdc++} option directs the @command{g++} driver to 13466link @file{libstdc++} statically, without necessarily linking other 13467libraries statically. 13468 13469@item -symbolic 13470@opindex symbolic 13471Bind references to global symbols when building a shared object. Warn 13472about any unresolved references (unless overridden by the link editor 13473option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 13474this option. 13475 13476@item -T @var{script} 13477@opindex T 13478@cindex linker script 13479Use @var{script} as the linker script. This option is supported by most 13480systems using the GNU linker. On some targets, such as bare-board 13481targets without an operating system, the @option{-T} option may be required 13482when linking to avoid references to undefined symbols. 13483 13484@item -Xlinker @var{option} 13485@opindex Xlinker 13486Pass @var{option} as an option to the linker. You can use this to 13487supply system-specific linker options that GCC does not recognize. 13488 13489If you want to pass an option that takes a separate argument, you must use 13490@option{-Xlinker} twice, once for the option and once for the argument. 13491For example, to pass @option{-assert definitions}, you must write 13492@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 13493@option{-Xlinker "-assert definitions"}, because this passes the entire 13494string as a single argument, which is not what the linker expects. 13495 13496When using the GNU linker, it is usually more convenient to pass 13497arguments to linker options using the @option{@var{option}=@var{value}} 13498syntax than as separate arguments. For example, you can specify 13499@option{-Xlinker -Map=output.map} rather than 13500@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 13501this syntax for command-line options. 13502 13503@item -Wl,@var{option} 13504@opindex Wl 13505Pass @var{option} as an option to the linker. If @var{option} contains 13506commas, it is split into multiple options at the commas. You can use this 13507syntax to pass an argument to the option. 13508For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 13509linker. When using the GNU linker, you can also get the same effect with 13510@option{-Wl,-Map=output.map}. 13511 13512@item -u @var{symbol} 13513@opindex u 13514Pretend the symbol @var{symbol} is undefined, to force linking of 13515library modules to define it. You can use @option{-u} multiple times with 13516different symbols to force loading of additional library modules. 13517 13518@item -z @var{keyword} 13519@opindex z 13520@option{-z} is passed directly on to the linker along with the keyword 13521@var{keyword}. See the section in the documentation of your linker for 13522permitted values and their meanings. 13523@end table 13524 13525@node Directory Options 13526@section Options for Directory Search 13527@cindex directory options 13528@cindex options, directory search 13529@cindex search path 13530 13531These options specify directories to search for header files, for 13532libraries and for parts of the compiler: 13533 13534@table @gcctabopt 13535@include cppdiropts.texi 13536 13537@item -iplugindir=@var{dir} 13538@opindex iplugindir= 13539Set the directory to search for plugins that are passed 13540by @option{-fplugin=@var{name}} instead of 13541@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 13542to be used by the user, but only passed by the driver. 13543 13544@item -L@var{dir} 13545@opindex L 13546Add directory @var{dir} to the list of directories to be searched 13547for @option{-l}. 13548 13549@item -B@var{prefix} 13550@opindex B 13551This option specifies where to find the executables, libraries, 13552include files, and data files of the compiler itself. 13553 13554The compiler driver program runs one or more of the subprograms 13555@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 13556@var{prefix} as a prefix for each program it tries to run, both with and 13557without @samp{@var{machine}/@var{version}/} for the corresponding target 13558machine and compiler version. 13559 13560For each subprogram to be run, the compiler driver first tries the 13561@option{-B} prefix, if any. If that name is not found, or if @option{-B} 13562is not specified, the driver tries two standard prefixes, 13563@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 13564those results in a file name that is found, the unmodified program 13565name is searched for using the directories specified in your 13566@env{PATH} environment variable. 13567 13568The compiler checks to see if the path provided by @option{-B} 13569refers to a directory, and if necessary it adds a directory 13570separator character at the end of the path. 13571 13572@option{-B} prefixes that effectively specify directory names also apply 13573to libraries in the linker, because the compiler translates these 13574options into @option{-L} options for the linker. They also apply to 13575include files in the preprocessor, because the compiler translates these 13576options into @option{-isystem} options for the preprocessor. In this case, 13577the compiler appends @samp{include} to the prefix. 13578 13579The runtime support file @file{libgcc.a} can also be searched for using 13580the @option{-B} prefix, if needed. If it is not found there, the two 13581standard prefixes above are tried, and that is all. The file is left 13582out of the link if it is not found by those means. 13583 13584Another way to specify a prefix much like the @option{-B} prefix is to use 13585the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 13586Variables}. 13587 13588As a special kludge, if the path provided by @option{-B} is 13589@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 135909, then it is replaced by @file{[dir/]include}. This is to help 13591with boot-strapping the compiler. 13592 13593@item -no-canonical-prefixes 13594@opindex no-canonical-prefixes 13595Do not expand any symbolic links, resolve references to @samp{/../} 13596or @samp{/./}, or make the path absolute when generating a relative 13597prefix. 13598 13599@item --sysroot=@var{dir} 13600@opindex sysroot 13601Use @var{dir} as the logical root directory for headers and libraries. 13602For example, if the compiler normally searches for headers in 13603@file{/usr/include} and libraries in @file{/usr/lib}, it instead 13604searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 13605 13606If you use both this option and the @option{-isysroot} option, then 13607the @option{--sysroot} option applies to libraries, but the 13608@option{-isysroot} option applies to header files. 13609 13610The GNU linker (beginning with version 2.16) has the necessary support 13611for this option. If your linker does not support this option, the 13612header file aspect of @option{--sysroot} still works, but the 13613library aspect does not. 13614 13615@item --no-sysroot-suffix 13616@opindex no-sysroot-suffix 13617For some targets, a suffix is added to the root directory specified 13618with @option{--sysroot}, depending on the other options used, so that 13619headers may for example be found in 13620@file{@var{dir}/@var{suffix}/usr/include} instead of 13621@file{@var{dir}/usr/include}. This option disables the addition of 13622such a suffix. 13623 13624@end table 13625 13626@node Code Gen Options 13627@section Options for Code Generation Conventions 13628@cindex code generation conventions 13629@cindex options, code generation 13630@cindex run-time options 13631 13632These machine-independent options control the interface conventions 13633used in code generation. 13634 13635Most of them have both positive and negative forms; the negative form 13636of @option{-ffoo} is @option{-fno-foo}. In the table below, only 13637one of the forms is listed---the one that is not the default. You 13638can figure out the other form by either removing @samp{no-} or adding 13639it. 13640 13641@table @gcctabopt 13642@item -fstack-reuse=@var{reuse-level} 13643@opindex fstack_reuse 13644This option controls stack space reuse for user declared local/auto variables 13645and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 13646@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 13647local variables and temporaries, @samp{named_vars} enables the reuse only for 13648user defined local variables with names, and @samp{none} disables stack reuse 13649completely. The default value is @samp{all}. The option is needed when the 13650program extends the lifetime of a scoped local variable or a compiler generated 13651temporary beyond the end point defined by the language. When a lifetime of 13652a variable ends, and if the variable lives in memory, the optimizing compiler 13653has the freedom to reuse its stack space with other temporaries or scoped 13654local variables whose live range does not overlap with it. Legacy code extending 13655local lifetime is likely to break with the stack reuse optimization. 13656 13657For example, 13658 13659@smallexample 13660 int *p; 13661 @{ 13662 int local1; 13663 13664 p = &local1; 13665 local1 = 10; 13666 .... 13667 @} 13668 @{ 13669 int local2; 13670 local2 = 20; 13671 ... 13672 @} 13673 13674 if (*p == 10) // out of scope use of local1 13675 @{ 13676 13677 @} 13678@end smallexample 13679 13680Another example: 13681@smallexample 13682 13683 struct A 13684 @{ 13685 A(int k) : i(k), j(k) @{ @} 13686 int i; 13687 int j; 13688 @}; 13689 13690 A *ap; 13691 13692 void foo(const A& ar) 13693 @{ 13694 ap = &ar; 13695 @} 13696 13697 void bar() 13698 @{ 13699 foo(A(10)); // temp object's lifetime ends when foo returns 13700 13701 @{ 13702 A a(20); 13703 .... 13704 @} 13705 ap->i+= 10; // ap references out of scope temp whose space 13706 // is reused with a. What is the value of ap->i? 13707 @} 13708 13709@end smallexample 13710 13711The lifetime of a compiler generated temporary is well defined by the C++ 13712standard. When a lifetime of a temporary ends, and if the temporary lives 13713in memory, the optimizing compiler has the freedom to reuse its stack 13714space with other temporaries or scoped local variables whose live range 13715does not overlap with it. However some of the legacy code relies on 13716the behavior of older compilers in which temporaries' stack space is 13717not reused, the aggressive stack reuse can lead to runtime errors. This 13718option is used to control the temporary stack reuse optimization. 13719 13720@item -ftrapv 13721@opindex ftrapv 13722This option generates traps for signed overflow on addition, subtraction, 13723multiplication operations. 13724The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 13725@option{-ftrapv} @option{-fwrapv} on the command-line results in 13726@option{-fwrapv} being effective. Note that only active options override, so 13727using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 13728results in @option{-ftrapv} being effective. 13729 13730@item -fwrapv 13731@opindex fwrapv 13732This option instructs the compiler to assume that signed arithmetic 13733overflow of addition, subtraction and multiplication wraps around 13734using twos-complement representation. This flag enables some optimizations 13735and disables others. 13736The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 13737@option{-ftrapv} @option{-fwrapv} on the command-line results in 13738@option{-fwrapv} being effective. Note that only active options override, so 13739using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 13740results in @option{-ftrapv} being effective. 13741 13742@item -fwrapv-pointer 13743@opindex fwrapv-pointer 13744This option instructs the compiler to assume that pointer arithmetic 13745overflow on addition and subtraction wraps around using twos-complement 13746representation. This flag disables some optimizations which assume 13747pointer overflow is invalid. 13748 13749@item -fstrict-overflow 13750@opindex fstrict-overflow 13751This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when 13752negated implies @option{-fwrapv} @option{-fwrapv-pointer}. 13753 13754@item -fexceptions 13755@opindex fexceptions 13756Enable exception handling. Generates extra code needed to propagate 13757exceptions. For some targets, this implies GCC generates frame 13758unwind information for all functions, which can produce significant data 13759size overhead, although it does not affect execution. If you do not 13760specify this option, GCC enables it by default for languages like 13761C++ that normally require exception handling, and disables it for 13762languages like C that do not normally require it. However, you may need 13763to enable this option when compiling C code that needs to interoperate 13764properly with exception handlers written in C++. You may also wish to 13765disable this option if you are compiling older C++ programs that don't 13766use exception handling. 13767 13768@item -fnon-call-exceptions 13769@opindex fnon-call-exceptions 13770Generate code that allows trapping instructions to throw exceptions. 13771Note that this requires platform-specific runtime support that does 13772not exist everywhere. Moreover, it only allows @emph{trapping} 13773instructions to throw exceptions, i.e.@: memory references or floating-point 13774instructions. It does not allow exceptions to be thrown from 13775arbitrary signal handlers such as @code{SIGALRM}. 13776 13777@item -fdelete-dead-exceptions 13778@opindex fdelete-dead-exceptions 13779Consider that instructions that may throw exceptions but don't otherwise 13780contribute to the execution of the program can be optimized away. 13781This option is enabled by default for the Ada front end, as permitted by 13782the Ada language specification. 13783Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 13784 13785@item -funwind-tables 13786@opindex funwind-tables 13787Similar to @option{-fexceptions}, except that it just generates any needed 13788static data, but does not affect the generated code in any other way. 13789You normally do not need to enable this option; instead, a language processor 13790that needs this handling enables it on your behalf. 13791 13792@item -fasynchronous-unwind-tables 13793@opindex fasynchronous-unwind-tables 13794Generate unwind table in DWARF format, if supported by target machine. The 13795table is exact at each instruction boundary, so it can be used for stack 13796unwinding from asynchronous events (such as debugger or garbage collector). 13797 13798@item -fno-gnu-unique 13799@opindex fno-gnu-unique 13800@opindex fgnu-unique 13801On systems with recent GNU assembler and C library, the C++ compiler 13802uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 13803of template static data members and static local variables in inline 13804functions are unique even in the presence of @code{RTLD_LOCAL}; this 13805is necessary to avoid problems with a library used by two different 13806@code{RTLD_LOCAL} plugins depending on a definition in one of them and 13807therefore disagreeing with the other one about the binding of the 13808symbol. But this causes @code{dlclose} to be ignored for affected 13809DSOs; if your program relies on reinitialization of a DSO via 13810@code{dlclose} and @code{dlopen}, you can use 13811@option{-fno-gnu-unique}. 13812 13813@item -fpcc-struct-return 13814@opindex fpcc-struct-return 13815Return ``short'' @code{struct} and @code{union} values in memory like 13816longer ones, rather than in registers. This convention is less 13817efficient, but it has the advantage of allowing intercallability between 13818GCC-compiled files and files compiled with other compilers, particularly 13819the Portable C Compiler (pcc). 13820 13821The precise convention for returning structures in memory depends 13822on the target configuration macros. 13823 13824Short structures and unions are those whose size and alignment match 13825that of some integer type. 13826 13827@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13828switch is not binary compatible with code compiled with the 13829@option{-freg-struct-return} switch. 13830Use it to conform to a non-default application binary interface. 13831 13832@item -freg-struct-return 13833@opindex freg-struct-return 13834Return @code{struct} and @code{union} values in registers when possible. 13835This is more efficient for small structures than 13836@option{-fpcc-struct-return}. 13837 13838If you specify neither @option{-fpcc-struct-return} nor 13839@option{-freg-struct-return}, GCC defaults to whichever convention is 13840standard for the target. If there is no standard convention, GCC 13841defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13842the principal compiler. In those cases, we can choose the standard, and 13843we chose the more efficient register return alternative. 13844 13845@strong{Warning:} code compiled with the @option{-freg-struct-return} 13846switch is not binary compatible with code compiled with the 13847@option{-fpcc-struct-return} switch. 13848Use it to conform to a non-default application binary interface. 13849 13850@item -fshort-enums 13851@opindex fshort-enums 13852Allocate to an @code{enum} type only as many bytes as it needs for the 13853declared range of possible values. Specifically, the @code{enum} type 13854is equivalent to the smallest integer type that has enough room. 13855 13856@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13857code that is not binary compatible with code generated without that switch. 13858Use it to conform to a non-default application binary interface. 13859 13860@item -fshort-wchar 13861@opindex fshort-wchar 13862Override the underlying type for @code{wchar_t} to be @code{short 13863unsigned int} instead of the default for the target. This option is 13864useful for building programs to run under WINE@. 13865 13866@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13867code that is not binary compatible with code generated without that switch. 13868Use it to conform to a non-default application binary interface. 13869 13870@item -fno-common 13871@opindex fno-common 13872@opindex fcommon 13873@cindex tentative definitions 13874In C code, this option controls the placement of global variables 13875defined without an initializer, known as @dfn{tentative definitions} 13876in the C standard. Tentative definitions are distinct from declarations 13877of a variable with the @code{extern} keyword, which do not allocate storage. 13878 13879Unix C compilers have traditionally allocated storage for 13880uninitialized global variables in a common block. This allows the 13881linker to resolve all tentative definitions of the same variable 13882in different compilation units to the same object, or to a non-tentative 13883definition. 13884This is the behavior specified by @option{-fcommon}, and is the default for 13885GCC on most targets. 13886On the other hand, this behavior is not required by ISO 13887C, and on some targets may carry a speed or code size penalty on 13888variable references. 13889 13890The @option{-fno-common} option specifies that the compiler should instead 13891place uninitialized global variables in the BSS section of the object file. 13892This inhibits the merging of tentative definitions by the linker so 13893you get a multiple-definition error if the same 13894variable is defined in more than one compilation unit. 13895Compiling with @option{-fno-common} is useful on targets for which 13896it provides better performance, or if you wish to verify that the 13897program will work on other systems that always treat uninitialized 13898variable definitions this way. 13899 13900@item -fno-ident 13901@opindex fno-ident 13902@opindex fident 13903Ignore the @code{#ident} directive. 13904 13905@item -finhibit-size-directive 13906@opindex finhibit-size-directive 13907Don't output a @code{.size} assembler directive, or anything else that 13908would cause trouble if the function is split in the middle, and the 13909two halves are placed at locations far apart in memory. This option is 13910used when compiling @file{crtstuff.c}; you should not need to use it 13911for anything else. 13912 13913@item -fverbose-asm 13914@opindex fverbose-asm 13915Put extra commentary information in the generated assembly code to 13916make it more readable. This option is generally only of use to those 13917who actually need to read the generated assembly code (perhaps while 13918debugging the compiler itself). 13919 13920@option{-fno-verbose-asm}, the default, causes the 13921extra information to be omitted and is useful when comparing two assembler 13922files. 13923 13924The added comments include: 13925 13926@itemize @bullet 13927 13928@item 13929information on the compiler version and command-line options, 13930 13931@item 13932the source code lines associated with the assembly instructions, 13933in the form FILENAME:LINENUMBER:CONTENT OF LINE, 13934 13935@item 13936hints on which high-level expressions correspond to 13937the various assembly instruction operands. 13938 13939@end itemize 13940 13941For example, given this C source file: 13942 13943@smallexample 13944int test (int n) 13945@{ 13946 int i; 13947 int total = 0; 13948 13949 for (i = 0; i < n; i++) 13950 total += i * i; 13951 13952 return total; 13953@} 13954@end smallexample 13955 13956compiling to (x86_64) assembly via @option{-S} and emitting the result 13957direct to stdout via @option{-o} @option{-} 13958 13959@smallexample 13960gcc -S test.c -fverbose-asm -Os -o - 13961@end smallexample 13962 13963gives output similar to this: 13964 13965@smallexample 13966 .file "test.c" 13967# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu) 13968 [...snip...] 13969# options passed: 13970 [...snip...] 13971 13972 .text 13973 .globl test 13974 .type test, @@function 13975test: 13976.LFB0: 13977 .cfi_startproc 13978# test.c:4: int total = 0; 13979 xorl %eax, %eax # <retval> 13980# test.c:6: for (i = 0; i < n; i++) 13981 xorl %edx, %edx # i 13982.L2: 13983# test.c:6: for (i = 0; i < n; i++) 13984 cmpl %edi, %edx # n, i 13985 jge .L5 #, 13986# test.c:7: total += i * i; 13987 movl %edx, %ecx # i, tmp92 13988 imull %edx, %ecx # i, tmp92 13989# test.c:6: for (i = 0; i < n; i++) 13990 incl %edx # i 13991# test.c:7: total += i * i; 13992 addl %ecx, %eax # tmp92, <retval> 13993 jmp .L2 # 13994.L5: 13995# test.c:10: @} 13996 ret 13997 .cfi_endproc 13998.LFE0: 13999 .size test, .-test 14000 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)" 14001 .section .note.GNU-stack,"",@@progbits 14002@end smallexample 14003 14004The comments are intended for humans rather than machines and hence the 14005precise format of the comments is subject to change. 14006 14007@item -frecord-gcc-switches 14008@opindex frecord-gcc-switches 14009This switch causes the command line used to invoke the 14010compiler to be recorded into the object file that is being created. 14011This switch is only implemented on some targets and the exact format 14012of the recording is target and binary file format dependent, but it 14013usually takes the form of a section containing ASCII text. This 14014switch is related to the @option{-fverbose-asm} switch, but that 14015switch only records information in the assembler output file as 14016comments, so it never reaches the object file. 14017See also @option{-grecord-gcc-switches} for another 14018way of storing compiler options into the object file. 14019 14020@item -fpic 14021@opindex fpic 14022@cindex global offset table 14023@cindex PIC 14024Generate position-independent code (PIC) suitable for use in a shared 14025library, if supported for the target machine. Such code accesses all 14026constant addresses through a global offset table (GOT)@. The dynamic 14027loader resolves the GOT entries when the program starts (the dynamic 14028loader is not part of GCC; it is part of the operating system). If 14029the GOT size for the linked executable exceeds a machine-specific 14030maximum size, you get an error message from the linker indicating that 14031@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 14032instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k 14033on the m68k and RS/6000. The x86 has no such limit.) 14034 14035Position-independent code requires special support, and therefore works 14036only on certain machines. For the x86, GCC supports PIC for System V 14037but not for the Sun 386i. Code generated for the IBM RS/6000 is always 14038position-independent. 14039 14040When this flag is set, the macros @code{__pic__} and @code{__PIC__} 14041are defined to 1. 14042 14043@item -fPIC 14044@opindex fPIC 14045If supported for the target machine, emit position-independent code, 14046suitable for dynamic linking and avoiding any limit on the size of the 14047global offset table. This option makes a difference on AArch64, m68k, 14048PowerPC and SPARC@. 14049 14050Position-independent code requires special support, and therefore works 14051only on certain machines. 14052 14053When this flag is set, the macros @code{__pic__} and @code{__PIC__} 14054are defined to 2. 14055 14056@item -fpie 14057@itemx -fPIE 14058@opindex fpie 14059@opindex fPIE 14060These options are similar to @option{-fpic} and @option{-fPIC}, but the 14061generated position-independent code can be only linked into executables. 14062Usually these options are used to compile code that will be linked using 14063the @option{-pie} GCC option. 14064 14065@option{-fpie} and @option{-fPIE} both define the macros 14066@code{__pie__} and @code{__PIE__}. The macros have the value 1 14067for @option{-fpie} and 2 for @option{-fPIE}. 14068 14069@item -fno-plt 14070@opindex fno-plt 14071@opindex fplt 14072Do not use the PLT for external function calls in position-independent code. 14073Instead, load the callee address at call sites from the GOT and branch to it. 14074This leads to more efficient code by eliminating PLT stubs and exposing 14075GOT loads to optimizations. On architectures such as 32-bit x86 where 14076PLT stubs expect the GOT pointer in a specific register, this gives more 14077register allocation freedom to the compiler. 14078Lazy binding requires use of the PLT; 14079with @option{-fno-plt} all external symbols are resolved at load time. 14080 14081Alternatively, the function attribute @code{noplt} can be used to avoid calls 14082through the PLT for specific external functions. 14083 14084In position-dependent code, a few targets also convert calls to 14085functions that are marked to not use the PLT to use the GOT instead. 14086 14087@item -fno-jump-tables 14088@opindex fno-jump-tables 14089@opindex fjump-tables 14090Do not use jump tables for switch statements even where it would be 14091more efficient than other code generation strategies. This option is 14092of use in conjunction with @option{-fpic} or @option{-fPIC} for 14093building code that forms part of a dynamic linker and cannot 14094reference the address of a jump table. On some targets, jump tables 14095do not require a GOT and this option is not needed. 14096 14097@item -ffixed-@var{reg} 14098@opindex ffixed 14099Treat the register named @var{reg} as a fixed register; generated code 14100should never refer to it (except perhaps as a stack pointer, frame 14101pointer or in some other fixed role). 14102 14103@var{reg} must be the name of a register. The register names accepted 14104are machine-specific and are defined in the @code{REGISTER_NAMES} 14105macro in the machine description macro file. 14106 14107This flag does not have a negative form, because it specifies a 14108three-way choice. 14109 14110@item -fcall-used-@var{reg} 14111@opindex fcall-used 14112Treat the register named @var{reg} as an allocable register that is 14113clobbered by function calls. It may be allocated for temporaries or 14114variables that do not live across a call. Functions compiled this way 14115do not save and restore the register @var{reg}. 14116 14117It is an error to use this flag with the frame pointer or stack pointer. 14118Use of this flag for other registers that have fixed pervasive roles in 14119the machine's execution model produces disastrous results. 14120 14121This flag does not have a negative form, because it specifies a 14122three-way choice. 14123 14124@item -fcall-saved-@var{reg} 14125@opindex fcall-saved 14126Treat the register named @var{reg} as an allocable register saved by 14127functions. It may be allocated even for temporaries or variables that 14128live across a call. Functions compiled this way save and restore 14129the register @var{reg} if they use it. 14130 14131It is an error to use this flag with the frame pointer or stack pointer. 14132Use of this flag for other registers that have fixed pervasive roles in 14133the machine's execution model produces disastrous results. 14134 14135A different sort of disaster results from the use of this flag for 14136a register in which function values may be returned. 14137 14138This flag does not have a negative form, because it specifies a 14139three-way choice. 14140 14141@item -fpack-struct[=@var{n}] 14142@opindex fpack-struct 14143Without a value specified, pack all structure members together without 14144holes. When a value is specified (which must be a small power of two), pack 14145structure members according to this value, representing the maximum 14146alignment (that is, objects with default alignment requirements larger than 14147this are output potentially unaligned at the next fitting location. 14148 14149@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 14150code that is not binary compatible with code generated without that switch. 14151Additionally, it makes the code suboptimal. 14152Use it to conform to a non-default application binary interface. 14153 14154@item -fleading-underscore 14155@opindex fleading-underscore 14156This option and its counterpart, @option{-fno-leading-underscore}, forcibly 14157change the way C symbols are represented in the object file. One use 14158is to help link with legacy assembly code. 14159 14160@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 14161generate code that is not binary compatible with code generated without that 14162switch. Use it to conform to a non-default application binary interface. 14163Not all targets provide complete support for this switch. 14164 14165@item -ftls-model=@var{model} 14166@opindex ftls-model 14167Alter the thread-local storage model to be used (@pxref{Thread-Local}). 14168The @var{model} argument should be one of @samp{global-dynamic}, 14169@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 14170Note that the choice is subject to optimization: the compiler may use 14171a more efficient model for symbols not visible outside of the translation 14172unit, or if @option{-fpic} is not given on the command line. 14173 14174The default without @option{-fpic} is @samp{initial-exec}; with 14175@option{-fpic} the default is @samp{global-dynamic}. 14176 14177@item -ftrampolines 14178@opindex ftrampolines 14179For targets that normally need trampolines for nested functions, always 14180generate them instead of using descriptors. Otherwise, for targets that 14181do not need them, like for example HP-PA or IA-64, do nothing. 14182 14183A trampoline is a small piece of code that is created at run time on the 14184stack when the address of a nested function is taken, and is used to call 14185the nested function indirectly. Therefore, it requires the stack to be 14186made executable in order for the program to work properly. 14187 14188@option{-fno-trampolines} is enabled by default on a language by language 14189basis to let the compiler avoid generating them, if it computes that this 14190is safe, and replace them with descriptors. Descriptors are made up of data 14191only, but the generated code must be prepared to deal with them. As of this 14192writing, @option{-fno-trampolines} is enabled by default only for Ada. 14193 14194Moreover, code compiled with @option{-ftrampolines} and code compiled with 14195@option{-fno-trampolines} are not binary compatible if nested functions are 14196present. This option must therefore be used on a program-wide basis and be 14197manipulated with extreme care. 14198 14199@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 14200@opindex fvisibility 14201Set the default ELF image symbol visibility to the specified option---all 14202symbols are marked with this unless overridden within the code. 14203Using this feature can very substantially improve linking and 14204load times of shared object libraries, produce more optimized 14205code, provide near-perfect API export and prevent symbol clashes. 14206It is @strong{strongly} recommended that you use this in any shared objects 14207you distribute. 14208 14209Despite the nomenclature, @samp{default} always means public; i.e., 14210available to be linked against from outside the shared object. 14211@samp{protected} and @samp{internal} are pretty useless in real-world 14212usage so the only other commonly used option is @samp{hidden}. 14213The default if @option{-fvisibility} isn't specified is 14214@samp{default}, i.e., make every symbol public. 14215 14216A good explanation of the benefits offered by ensuring ELF 14217symbols have the correct visibility is given by ``How To Write 14218Shared Libraries'' by Ulrich Drepper (which can be found at 14219@w{@uref{https://www.akkadia.org/drepper/}})---however a superior 14220solution made possible by this option to marking things hidden when 14221the default is public is to make the default hidden and mark things 14222public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 14223and @code{__attribute__ ((visibility("default")))} instead of 14224@code{__declspec(dllexport)} you get almost identical semantics with 14225identical syntax. This is a great boon to those working with 14226cross-platform projects. 14227 14228For those adding visibility support to existing code, you may find 14229@code{#pragma GCC visibility} of use. This works by you enclosing 14230the declarations you wish to set visibility for with (for example) 14231@code{#pragma GCC visibility push(hidden)} and 14232@code{#pragma GCC visibility pop}. 14233Bear in mind that symbol visibility should be viewed @strong{as 14234part of the API interface contract} and thus all new code should 14235always specify visibility when it is not the default; i.e., declarations 14236only for use within the local DSO should @strong{always} be marked explicitly 14237as hidden as so to avoid PLT indirection overheads---making this 14238abundantly clear also aids readability and self-documentation of the code. 14239Note that due to ISO C++ specification requirements, @code{operator new} and 14240@code{operator delete} must always be of default visibility. 14241 14242Be aware that headers from outside your project, in particular system 14243headers and headers from any other library you use, may not be 14244expecting to be compiled with visibility other than the default. You 14245may need to explicitly say @code{#pragma GCC visibility push(default)} 14246before including any such headers. 14247 14248@code{extern} declarations are not affected by @option{-fvisibility}, so 14249a lot of code can be recompiled with @option{-fvisibility=hidden} with 14250no modifications. However, this means that calls to @code{extern} 14251functions with no explicit visibility use the PLT, so it is more 14252effective to use @code{__attribute ((visibility))} and/or 14253@code{#pragma GCC visibility} to tell the compiler which @code{extern} 14254declarations should be treated as hidden. 14255 14256Note that @option{-fvisibility} does affect C++ vague linkage 14257entities. This means that, for instance, an exception class that is 14258be thrown between DSOs must be explicitly marked with default 14259visibility so that the @samp{type_info} nodes are unified between 14260the DSOs. 14261 14262An overview of these techniques, their benefits and how to use them 14263is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 14264 14265@item -fstrict-volatile-bitfields 14266@opindex fstrict-volatile-bitfields 14267This option should be used if accesses to volatile bit-fields (or other 14268structure fields, although the compiler usually honors those types 14269anyway) should use a single access of the width of the 14270field's type, aligned to a natural alignment if possible. For 14271example, targets with memory-mapped peripheral registers might require 14272all such accesses to be 16 bits wide; with this flag you can 14273declare all peripheral bit-fields as @code{unsigned short} (assuming short 14274is 16 bits on these targets) to force GCC to use 16-bit accesses 14275instead of, perhaps, a more efficient 32-bit access. 14276 14277If this option is disabled, the compiler uses the most efficient 14278instruction. In the previous example, that might be a 32-bit load 14279instruction, even though that accesses bytes that do not contain 14280any portion of the bit-field, or memory-mapped registers unrelated to 14281the one being updated. 14282 14283In some cases, such as when the @code{packed} attribute is applied to a 14284structure field, it may not be possible to access the field with a single 14285read or write that is correctly aligned for the target machine. In this 14286case GCC falls back to generating multiple accesses rather than code that 14287will fault or truncate the result at run time. 14288 14289Note: Due to restrictions of the C/C++11 memory model, write accesses are 14290not allowed to touch non bit-field members. It is therefore recommended 14291to define all bits of the field's type as bit-field members. 14292 14293The default value of this option is determined by the application binary 14294interface for the target processor. 14295 14296@item -fsync-libcalls 14297@opindex fsync-libcalls 14298This option controls whether any out-of-line instance of the @code{__sync} 14299family of functions may be used to implement the C++11 @code{__atomic} 14300family of functions. 14301 14302The default value of this option is enabled, thus the only useful form 14303of the option is @option{-fno-sync-libcalls}. This option is used in 14304the implementation of the @file{libatomic} runtime library. 14305 14306@end table 14307 14308@node Developer Options 14309@section GCC Developer Options 14310@cindex developer options 14311@cindex debugging GCC 14312@cindex debug dump options 14313@cindex dump options 14314@cindex compilation statistics 14315 14316This section describes command-line options that are primarily of 14317interest to GCC developers, including options to support compiler 14318testing and investigation of compiler bugs and compile-time 14319performance problems. This includes options that produce debug dumps 14320at various points in the compilation; that print statistics such as 14321memory use and execution time; and that print information about GCC's 14322configuration, such as where it searches for libraries. You should 14323rarely need to use any of these options for ordinary compilation and 14324linking tasks. 14325 14326Many developer options that cause GCC to dump output to a file take an 14327optional @samp{=@var{filename}} suffix. You can specify @samp{stdout} 14328or @samp{-} to dump to standard output, and @samp{stderr} for standard 14329error. 14330 14331If @samp{=@var{filename}} is omitted, a default dump file name is 14332constructed by concatenating the base dump file name, a pass number, 14333phase letter, and pass name. The base dump file name is the name of 14334output file produced by the compiler if explicitly specified and not 14335an executable; otherwise it is the source file name. 14336The pass number is determined by the order passes are registered with 14337the compiler's pass manager. 14338This is generally the same as the order of execution, but passes 14339registered by plugins, target-specific passes, or passes that are 14340otherwise registered late are numbered higher than the pass named 14341@samp{final}, even if they are executed earlier. The phase letter is 14342one of @samp{i} (inter-procedural analysis), @samp{l} 14343(language-specific), @samp{r} (RTL), or @samp{t} (tree). 14344The files are created in the directory of the output file. 14345 14346@table @gcctabopt 14347 14348@item -d@var{letters} 14349@itemx -fdump-rtl-@var{pass} 14350@itemx -fdump-rtl-@var{pass}=@var{filename} 14351@opindex d 14352@opindex fdump-rtl-@var{pass} 14353Says to make debugging dumps during compilation at times specified by 14354@var{letters}. This is used for debugging the RTL-based passes of the 14355compiler. 14356 14357Some @option{-d@var{letters}} switches have different meaning when 14358@option{-E} is used for preprocessing. @xref{Preprocessor Options}, 14359for information about preprocessor-specific dump options. 14360 14361Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 14362@option{-d} option @var{letters}. Here are the possible 14363letters for use in @var{pass} and @var{letters}, and their meanings: 14364 14365@table @gcctabopt 14366 14367@item -fdump-rtl-alignments 14368@opindex fdump-rtl-alignments 14369Dump after branch alignments have been computed. 14370 14371@item -fdump-rtl-asmcons 14372@opindex fdump-rtl-asmcons 14373Dump after fixing rtl statements that have unsatisfied in/out constraints. 14374 14375@item -fdump-rtl-auto_inc_dec 14376@opindex fdump-rtl-auto_inc_dec 14377Dump after auto-inc-dec discovery. This pass is only run on 14378architectures that have auto inc or auto dec instructions. 14379 14380@item -fdump-rtl-barriers 14381@opindex fdump-rtl-barriers 14382Dump after cleaning up the barrier instructions. 14383 14384@item -fdump-rtl-bbpart 14385@opindex fdump-rtl-bbpart 14386Dump after partitioning hot and cold basic blocks. 14387 14388@item -fdump-rtl-bbro 14389@opindex fdump-rtl-bbro 14390Dump after block reordering. 14391 14392@item -fdump-rtl-btl1 14393@itemx -fdump-rtl-btl2 14394@opindex fdump-rtl-btl2 14395@opindex fdump-rtl-btl2 14396@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 14397after the two branch 14398target load optimization passes. 14399 14400@item -fdump-rtl-bypass 14401@opindex fdump-rtl-bypass 14402Dump after jump bypassing and control flow optimizations. 14403 14404@item -fdump-rtl-combine 14405@opindex fdump-rtl-combine 14406Dump after the RTL instruction combination pass. 14407 14408@item -fdump-rtl-compgotos 14409@opindex fdump-rtl-compgotos 14410Dump after duplicating the computed gotos. 14411 14412@item -fdump-rtl-ce1 14413@itemx -fdump-rtl-ce2 14414@itemx -fdump-rtl-ce3 14415@opindex fdump-rtl-ce1 14416@opindex fdump-rtl-ce2 14417@opindex fdump-rtl-ce3 14418@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 14419@option{-fdump-rtl-ce3} enable dumping after the three 14420if conversion passes. 14421 14422@item -fdump-rtl-cprop_hardreg 14423@opindex fdump-rtl-cprop_hardreg 14424Dump after hard register copy propagation. 14425 14426@item -fdump-rtl-csa 14427@opindex fdump-rtl-csa 14428Dump after combining stack adjustments. 14429 14430@item -fdump-rtl-cse1 14431@itemx -fdump-rtl-cse2 14432@opindex fdump-rtl-cse1 14433@opindex fdump-rtl-cse2 14434@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 14435the two common subexpression elimination passes. 14436 14437@item -fdump-rtl-dce 14438@opindex fdump-rtl-dce 14439Dump after the standalone dead code elimination passes. 14440 14441@item -fdump-rtl-dbr 14442@opindex fdump-rtl-dbr 14443Dump after delayed branch scheduling. 14444 14445@item -fdump-rtl-dce1 14446@itemx -fdump-rtl-dce2 14447@opindex fdump-rtl-dce1 14448@opindex fdump-rtl-dce2 14449@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 14450the two dead store elimination passes. 14451 14452@item -fdump-rtl-eh 14453@opindex fdump-rtl-eh 14454Dump after finalization of EH handling code. 14455 14456@item -fdump-rtl-eh_ranges 14457@opindex fdump-rtl-eh_ranges 14458Dump after conversion of EH handling range regions. 14459 14460@item -fdump-rtl-expand 14461@opindex fdump-rtl-expand 14462Dump after RTL generation. 14463 14464@item -fdump-rtl-fwprop1 14465@itemx -fdump-rtl-fwprop2 14466@opindex fdump-rtl-fwprop1 14467@opindex fdump-rtl-fwprop2 14468@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 14469dumping after the two forward propagation passes. 14470 14471@item -fdump-rtl-gcse1 14472@itemx -fdump-rtl-gcse2 14473@opindex fdump-rtl-gcse1 14474@opindex fdump-rtl-gcse2 14475@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 14476after global common subexpression elimination. 14477 14478@item -fdump-rtl-init-regs 14479@opindex fdump-rtl-init-regs 14480Dump after the initialization of the registers. 14481 14482@item -fdump-rtl-initvals 14483@opindex fdump-rtl-initvals 14484Dump after the computation of the initial value sets. 14485 14486@item -fdump-rtl-into_cfglayout 14487@opindex fdump-rtl-into_cfglayout 14488Dump after converting to cfglayout mode. 14489 14490@item -fdump-rtl-ira 14491@opindex fdump-rtl-ira 14492Dump after iterated register allocation. 14493 14494@item -fdump-rtl-jump 14495@opindex fdump-rtl-jump 14496Dump after the second jump optimization. 14497 14498@item -fdump-rtl-loop2 14499@opindex fdump-rtl-loop2 14500@option{-fdump-rtl-loop2} enables dumping after the rtl 14501loop optimization passes. 14502 14503@item -fdump-rtl-mach 14504@opindex fdump-rtl-mach 14505Dump after performing the machine dependent reorganization pass, if that 14506pass exists. 14507 14508@item -fdump-rtl-mode_sw 14509@opindex fdump-rtl-mode_sw 14510Dump after removing redundant mode switches. 14511 14512@item -fdump-rtl-rnreg 14513@opindex fdump-rtl-rnreg 14514Dump after register renumbering. 14515 14516@item -fdump-rtl-outof_cfglayout 14517@opindex fdump-rtl-outof_cfglayout 14518Dump after converting from cfglayout mode. 14519 14520@item -fdump-rtl-peephole2 14521@opindex fdump-rtl-peephole2 14522Dump after the peephole pass. 14523 14524@item -fdump-rtl-postreload 14525@opindex fdump-rtl-postreload 14526Dump after post-reload optimizations. 14527 14528@item -fdump-rtl-pro_and_epilogue 14529@opindex fdump-rtl-pro_and_epilogue 14530Dump after generating the function prologues and epilogues. 14531 14532@item -fdump-rtl-sched1 14533@itemx -fdump-rtl-sched2 14534@opindex fdump-rtl-sched1 14535@opindex fdump-rtl-sched2 14536@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 14537after the basic block scheduling passes. 14538 14539@item -fdump-rtl-ree 14540@opindex fdump-rtl-ree 14541Dump after sign/zero extension elimination. 14542 14543@item -fdump-rtl-seqabstr 14544@opindex fdump-rtl-seqabstr 14545Dump after common sequence discovery. 14546 14547@item -fdump-rtl-shorten 14548@opindex fdump-rtl-shorten 14549Dump after shortening branches. 14550 14551@item -fdump-rtl-sibling 14552@opindex fdump-rtl-sibling 14553Dump after sibling call optimizations. 14554 14555@item -fdump-rtl-split1 14556@itemx -fdump-rtl-split2 14557@itemx -fdump-rtl-split3 14558@itemx -fdump-rtl-split4 14559@itemx -fdump-rtl-split5 14560@opindex fdump-rtl-split1 14561@opindex fdump-rtl-split2 14562@opindex fdump-rtl-split3 14563@opindex fdump-rtl-split4 14564@opindex fdump-rtl-split5 14565These options enable dumping after five rounds of 14566instruction splitting. 14567 14568@item -fdump-rtl-sms 14569@opindex fdump-rtl-sms 14570Dump after modulo scheduling. This pass is only run on some 14571architectures. 14572 14573@item -fdump-rtl-stack 14574@opindex fdump-rtl-stack 14575Dump after conversion from GCC's ``flat register file'' registers to the 14576x87's stack-like registers. This pass is only run on x86 variants. 14577 14578@item -fdump-rtl-subreg1 14579@itemx -fdump-rtl-subreg2 14580@opindex fdump-rtl-subreg1 14581@opindex fdump-rtl-subreg2 14582@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 14583the two subreg expansion passes. 14584 14585@item -fdump-rtl-unshare 14586@opindex fdump-rtl-unshare 14587Dump after all rtl has been unshared. 14588 14589@item -fdump-rtl-vartrack 14590@opindex fdump-rtl-vartrack 14591Dump after variable tracking. 14592 14593@item -fdump-rtl-vregs 14594@opindex fdump-rtl-vregs 14595Dump after converting virtual registers to hard registers. 14596 14597@item -fdump-rtl-web 14598@opindex fdump-rtl-web 14599Dump after live range splitting. 14600 14601@item -fdump-rtl-regclass 14602@itemx -fdump-rtl-subregs_of_mode_init 14603@itemx -fdump-rtl-subregs_of_mode_finish 14604@itemx -fdump-rtl-dfinit 14605@itemx -fdump-rtl-dfinish 14606@opindex fdump-rtl-regclass 14607@opindex fdump-rtl-subregs_of_mode_init 14608@opindex fdump-rtl-subregs_of_mode_finish 14609@opindex fdump-rtl-dfinit 14610@opindex fdump-rtl-dfinish 14611These dumps are defined but always produce empty files. 14612 14613@item -da 14614@itemx -fdump-rtl-all 14615@opindex da 14616@opindex fdump-rtl-all 14617Produce all the dumps listed above. 14618 14619@item -dA 14620@opindex dA 14621Annotate the assembler output with miscellaneous debugging information. 14622 14623@item -dD 14624@opindex dD 14625Dump all macro definitions, at the end of preprocessing, in addition to 14626normal output. 14627 14628@item -dH 14629@opindex dH 14630Produce a core dump whenever an error occurs. 14631 14632@item -dp 14633@opindex dp 14634Annotate the assembler output with a comment indicating which 14635pattern and alternative is used. The length and cost of each instruction are 14636also printed. 14637 14638@item -dP 14639@opindex dP 14640Dump the RTL in the assembler output as a comment before each instruction. 14641Also turns on @option{-dp} annotation. 14642 14643@item -dx 14644@opindex dx 14645Just generate RTL for a function instead of compiling it. Usually used 14646with @option{-fdump-rtl-expand}. 14647@end table 14648 14649@item -fdump-debug 14650@opindex fdump-debug 14651Dump debugging information generated during the debug 14652generation phase. 14653 14654@item -fdump-earlydebug 14655@opindex fdump-earlydebug 14656Dump debugging information generated during the early debug 14657generation phase. 14658 14659@item -fdump-noaddr 14660@opindex fdump-noaddr 14661When doing debugging dumps, suppress address output. This makes it more 14662feasible to use diff on debugging dumps for compiler invocations with 14663different compiler binaries and/or different 14664text / bss / data / heap / stack / dso start locations. 14665 14666@item -freport-bug 14667@opindex freport-bug 14668Collect and dump debug information into a temporary file if an 14669internal compiler error (ICE) occurs. 14670 14671@item -fdump-unnumbered 14672@opindex fdump-unnumbered 14673When doing debugging dumps, suppress instruction numbers and address output. 14674This makes it more feasible to use diff on debugging dumps for compiler 14675invocations with different options, in particular with and without 14676@option{-g}. 14677 14678@item -fdump-unnumbered-links 14679@opindex fdump-unnumbered-links 14680When doing debugging dumps (see @option{-d} option above), suppress 14681instruction numbers for the links to the previous and next instructions 14682in a sequence. 14683 14684@item -fdump-ipa-@var{switch} 14685@itemx -fdump-ipa-@var{switch}-@var{options} 14686@opindex fdump-ipa 14687Control the dumping at various stages of inter-procedural analysis 14688language tree to a file. The file name is generated by appending a 14689switch specific suffix to the source file name, and the file is created 14690in the same directory as the output file. The following dumps are 14691possible: 14692 14693@table @samp 14694@item all 14695Enables all inter-procedural analysis dumps. 14696 14697@item cgraph 14698Dumps information about call-graph optimization, unused function removal, 14699and inlining decisions. 14700 14701@item inline 14702Dump after function inlining. 14703 14704@end table 14705 14706Additionally, the options @option{-optimized}, @option{-missed}, 14707@option{-note}, and @option{-all} can be provided, with the same meaning 14708as for @option{-fopt-info}, defaulting to @option{-optimized}. 14709 14710For example, @option{-fdump-ipa-inline-optimized-missed} will emit 14711information on callsites that were inlined, along with callsites 14712that were not inlined. 14713 14714By default, the dump will contain messages about successful 14715optimizations (equivalent to @option{-optimized}) together with 14716low-level details about the analysis. 14717 14718@item -fdump-lang-all 14719@itemx -fdump-lang-@var{switch} 14720@itemx -fdump-lang-@var{switch}-@var{options} 14721@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename} 14722@opindex fdump-lang-all 14723@opindex fdump-lang 14724Control the dumping of language-specific information. The @var{options} 14725and @var{filename} portions behave as described in the 14726@option{-fdump-tree} option. The following @var{switch} values are 14727accepted: 14728 14729@table @samp 14730@item all 14731 14732Enable all language-specific dumps. 14733 14734@item class 14735Dump class hierarchy information. Virtual table information is emitted 14736unless '@option{slim}' is specified. This option is applicable to C++ only. 14737 14738@item raw 14739Dump the raw internal tree data. This option is applicable to C++ only. 14740 14741@end table 14742 14743@item -fdump-passes 14744@opindex fdump-passes 14745Print on @file{stderr} the list of optimization passes that are turned 14746on and off by the current command-line options. 14747 14748@item -fdump-statistics-@var{option} 14749@opindex fdump-statistics 14750Enable and control dumping of pass statistics in a separate file. The 14751file name is generated by appending a suffix ending in 14752@samp{.statistics} to the source file name, and the file is created in 14753the same directory as the output file. If the @samp{-@var{option}} 14754form is used, @samp{-stats} causes counters to be summed over the 14755whole compilation unit while @samp{-details} dumps every event as 14756the passes generate them. The default with no option is to sum 14757counters for each function compiled. 14758 14759@item -fdump-tree-all 14760@itemx -fdump-tree-@var{switch} 14761@itemx -fdump-tree-@var{switch}-@var{options} 14762@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 14763@opindex fdump-tree-all 14764@opindex fdump-tree 14765Control the dumping at various stages of processing the intermediate 14766language tree to a file. If the @samp{-@var{options}} 14767form is used, @var{options} is a list of @samp{-} separated options 14768which control the details of the dump. Not all options are applicable 14769to all dumps; those that are not meaningful are ignored. The 14770following options are available 14771 14772@table @samp 14773@item address 14774Print the address of each node. Usually this is not meaningful as it 14775changes according to the environment and source file. Its primary use 14776is for tying up a dump file with a debug environment. 14777@item asmname 14778If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 14779in the dump instead of @code{DECL_NAME}. Its primary use is ease of 14780use working backward from mangled names in the assembly file. 14781@item slim 14782When dumping front-end intermediate representations, inhibit dumping 14783of members of a scope or body of a function merely because that scope 14784has been reached. Only dump such items when they are directly reachable 14785by some other path. 14786 14787When dumping pretty-printed trees, this option inhibits dumping the 14788bodies of control structures. 14789 14790When dumping RTL, print the RTL in slim (condensed) form instead of 14791the default LISP-like representation. 14792@item raw 14793Print a raw representation of the tree. By default, trees are 14794pretty-printed into a C-like representation. 14795@item details 14796Enable more detailed dumps (not honored by every dump option). Also 14797include information from the optimization passes. 14798@item stats 14799Enable dumping various statistics about the pass (not honored by every dump 14800option). 14801@item blocks 14802Enable showing basic block boundaries (disabled in raw dumps). 14803@item graph 14804For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 14805dump a representation of the control flow graph suitable for viewing with 14806GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 14807the file is pretty-printed as a subgraph, so that GraphViz can render them 14808all in a single plot. 14809 14810This option currently only works for RTL dumps, and the RTL is always 14811dumped in slim form. 14812@item vops 14813Enable showing virtual operands for every statement. 14814@item lineno 14815Enable showing line numbers for statements. 14816@item uid 14817Enable showing the unique ID (@code{DECL_UID}) for each variable. 14818@item verbose 14819Enable showing the tree dump for each statement. 14820@item eh 14821Enable showing the EH region number holding each statement. 14822@item scev 14823Enable showing scalar evolution analysis details. 14824@item optimized 14825Enable showing optimization information (only available in certain 14826passes). 14827@item missed 14828Enable showing missed optimization information (only available in certain 14829passes). 14830@item note 14831Enable other detailed optimization information (only available in 14832certain passes). 14833@item all 14834Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 14835and @option{lineno}. 14836@item optall 14837Turn on all optimization options, i.e., @option{optimized}, 14838@option{missed}, and @option{note}. 14839@end table 14840 14841To determine what tree dumps are available or find the dump for a pass 14842of interest follow the steps below. 14843 14844@enumerate 14845@item 14846Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output 14847look for a code that corresponds to the pass you are interested in. 14848For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and 14849@code{tree-vrp2} correspond to the three Value Range Propagation passes. 14850The number at the end distinguishes distinct invocations of the same pass. 14851@item 14852To enable the creation of the dump file, append the pass code to 14853the @option{-fdump-} option prefix and invoke GCC with it. For example, 14854to enable the dump from the Early Value Range Propagation pass, invoke 14855GCC with the @option{-fdump-tree-evrp} option. Optionally, you may 14856specify the name of the dump file. If you don't specify one, GCC 14857creates as described below. 14858@item 14859Find the pass dump in a file whose name is composed of three components 14860separated by a period: the name of the source file GCC was invoked to 14861compile, a numeric suffix indicating the pass number followed by the 14862letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes), 14863and finally the pass code. For example, the Early VRP pass dump might 14864be in a file named @file{myfile.c.038t.evrp} in the current working 14865directory. Note that the numeric codes are not stable and may change 14866from one version of GCC to another. 14867@end enumerate 14868 14869@item -fopt-info 14870@itemx -fopt-info-@var{options} 14871@itemx -fopt-info-@var{options}=@var{filename} 14872@opindex fopt-info 14873Controls optimization dumps from various optimization passes. If the 14874@samp{-@var{options}} form is used, @var{options} is a list of 14875@samp{-} separated option keywords to select the dump details and 14876optimizations. 14877 14878The @var{options} can be divided into three groups: 14879@enumerate 14880@item 14881options describing what kinds of messages should be emitted, 14882@item 14883options describing the verbosity of the dump, and 14884@item 14885options describing which optimizations should be included. 14886@end enumerate 14887The options from each group can be freely mixed as they are 14888non-overlapping. However, in case of any conflicts, 14889the later options override the earlier options on the command 14890line. 14891 14892The following options control which kinds of messages should be emitted: 14893 14894@table @samp 14895@item optimized 14896Print information when an optimization is successfully applied. It is 14897up to a pass to decide which information is relevant. For example, the 14898vectorizer passes print the source location of loops which are 14899successfully vectorized. 14900@item missed 14901Print information about missed optimizations. Individual passes 14902control which information to include in the output. 14903@item note 14904Print verbose information about optimizations, such as certain 14905transformations, more detailed messages about decisions etc. 14906@item all 14907Print detailed optimization information. This includes 14908@samp{optimized}, @samp{missed}, and @samp{note}. 14909@end table 14910 14911The following option controls the dump verbosity: 14912 14913@table @samp 14914@item internals 14915By default, only ``high-level'' messages are emitted. This option enables 14916additional, more detailed, messages, which are likely to only be of interest 14917to GCC developers. 14918@end table 14919 14920One or more of the following option keywords can be used to describe a 14921group of optimizations: 14922 14923@table @samp 14924@item ipa 14925Enable dumps from all interprocedural optimizations. 14926@item loop 14927Enable dumps from all loop optimizations. 14928@item inline 14929Enable dumps from all inlining optimizations. 14930@item omp 14931Enable dumps from all OMP (Offloading and Multi Processing) optimizations. 14932@item vec 14933Enable dumps from all vectorization optimizations. 14934@item optall 14935Enable dumps from all optimizations. This is a superset of 14936the optimization groups listed above. 14937@end table 14938 14939If @var{options} is 14940omitted, it defaults to @samp{optimized-optall}, which means to dump messages 14941about successful optimizations from all the passes, omitting messages 14942that are treated as ``internals''. 14943 14944If the @var{filename} is provided, then the dumps from all the 14945applicable optimizations are concatenated into the @var{filename}. 14946Otherwise the dump is output onto @file{stderr}. Though multiple 14947@option{-fopt-info} options are accepted, only one of them can include 14948a @var{filename}. If other filenames are provided then all but the 14949first such option are ignored. 14950 14951Note that the output @var{filename} is overwritten 14952in case of multiple translation units. If a combined output from 14953multiple translation units is desired, @file{stderr} should be used 14954instead. 14955 14956In the following example, the optimization info is output to 14957@file{stderr}: 14958 14959@smallexample 14960gcc -O3 -fopt-info 14961@end smallexample 14962 14963This example: 14964@smallexample 14965gcc -O3 -fopt-info-missed=missed.all 14966@end smallexample 14967 14968@noindent 14969outputs missed optimization report from all the passes into 14970@file{missed.all}, and this one: 14971 14972@smallexample 14973gcc -O2 -ftree-vectorize -fopt-info-vec-missed 14974@end smallexample 14975 14976@noindent 14977prints information about missed optimization opportunities from 14978vectorization passes on @file{stderr}. 14979Note that @option{-fopt-info-vec-missed} is equivalent to 14980@option{-fopt-info-missed-vec}. The order of the optimization group 14981names and message types listed after @option{-fopt-info} does not matter. 14982 14983As another example, 14984@smallexample 14985gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 14986@end smallexample 14987 14988@noindent 14989outputs information about missed optimizations as well as 14990optimized locations from all the inlining passes into 14991@file{inline.txt}. 14992 14993Finally, consider: 14994 14995@smallexample 14996gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 14997@end smallexample 14998 14999@noindent 15000Here the two output filenames @file{vec.miss} and @file{loop.opt} are 15001in conflict since only one output file is allowed. In this case, only 15002the first option takes effect and the subsequent options are 15003ignored. Thus only @file{vec.miss} is produced which contains 15004dumps from the vectorizer about missed opportunities. 15005 15006@item -fsave-optimization-record 15007@opindex fsave-optimization-record 15008Write a SRCFILE.opt-record.json.gz file detailing what optimizations 15009were performed, for those optimizations that support @option{-fopt-info}. 15010 15011This option is experimental and the format of the data within the 15012compressed JSON file is subject to change. 15013 15014It is roughly equivalent to a machine-readable version of 15015@option{-fopt-info-all}, as a collection of messages with source file, 15016line number and column number, with the following additional data for 15017each message: 15018 15019@itemize @bullet 15020 15021@item 15022the execution count of the code being optimized, along with metadata about 15023whether this was from actual profile data, or just an estimate, allowing 15024consumers to prioritize messages by code hotness, 15025 15026@item 15027the function name of the code being optimized, where applicable, 15028 15029@item 15030the ``inlining chain'' for the code being optimized, so that when 15031a function is inlined into several different places (which might 15032themselves be inlined), the reader can distinguish between the copies, 15033 15034@item 15035objects identifying those parts of the message that refer to expressions, 15036statements or symbol-table nodes, which of these categories they are, and, 15037when available, their source code location, 15038 15039@item 15040the GCC pass that emitted the message, and 15041 15042@item 15043the location in GCC's own code from which the message was emitted 15044 15045@end itemize 15046 15047Additionally, some messages are logically nested within other 15048messages, reflecting implementation details of the optimization 15049passes. 15050 15051@item -fsched-verbose=@var{n} 15052@opindex fsched-verbose 15053On targets that use instruction scheduling, this option controls the 15054amount of debugging output the scheduler prints to the dump files. 15055 15056For @var{n} greater than zero, @option{-fsched-verbose} outputs the 15057same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 15058For @var{n} greater than one, it also output basic block probabilities, 15059detailed ready list information and unit/insn info. For @var{n} greater 15060than two, it includes RTL at abort point, control-flow and regions info. 15061And for @var{n} over four, @option{-fsched-verbose} also includes 15062dependence info. 15063 15064 15065 15066@item -fenable-@var{kind}-@var{pass} 15067@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 15068@opindex fdisable- 15069@opindex fenable- 15070 15071This is a set of options that are used to explicitly disable/enable 15072optimization passes. These options are intended for use for debugging GCC. 15073Compiler users should use regular options for enabling/disabling 15074passes instead. 15075 15076@table @gcctabopt 15077 15078@item -fdisable-ipa-@var{pass} 15079Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 15080statically invoked in the compiler multiple times, the pass name should be 15081appended with a sequential number starting from 1. 15082 15083@item -fdisable-rtl-@var{pass} 15084@itemx -fdisable-rtl-@var{pass}=@var{range-list} 15085Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 15086statically invoked in the compiler multiple times, the pass name should be 15087appended with a sequential number starting from 1. @var{range-list} is a 15088comma-separated list of function ranges or assembler names. Each range is a number 15089pair separated by a colon. The range is inclusive in both ends. If the range 15090is trivial, the number pair can be simplified as a single number. If the 15091function's call graph node's @var{uid} falls within one of the specified ranges, 15092the @var{pass} is disabled for that function. The @var{uid} is shown in the 15093function header of a dump file, and the pass names can be dumped by using 15094option @option{-fdump-passes}. 15095 15096@item -fdisable-tree-@var{pass} 15097@itemx -fdisable-tree-@var{pass}=@var{range-list} 15098Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 15099option arguments. 15100 15101@item -fenable-ipa-@var{pass} 15102Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 15103statically invoked in the compiler multiple times, the pass name should be 15104appended with a sequential number starting from 1. 15105 15106@item -fenable-rtl-@var{pass} 15107@itemx -fenable-rtl-@var{pass}=@var{range-list} 15108Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 15109description and examples. 15110 15111@item -fenable-tree-@var{pass} 15112@itemx -fenable-tree-@var{pass}=@var{range-list} 15113Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 15114of option arguments. 15115 15116@end table 15117 15118Here are some examples showing uses of these options. 15119 15120@smallexample 15121 15122# disable ccp1 for all functions 15123 -fdisable-tree-ccp1 15124# disable complete unroll for function whose cgraph node uid is 1 15125 -fenable-tree-cunroll=1 15126# disable gcse2 for functions at the following ranges [1,1], 15127# [300,400], and [400,1000] 15128# disable gcse2 for functions foo and foo2 15129 -fdisable-rtl-gcse2=foo,foo2 15130# disable early inlining 15131 -fdisable-tree-einline 15132# disable ipa inlining 15133 -fdisable-ipa-inline 15134# enable tree full unroll 15135 -fenable-tree-unroll 15136 15137@end smallexample 15138 15139@item -fchecking 15140@itemx -fchecking=@var{n} 15141@opindex fchecking 15142@opindex fno-checking 15143Enable internal consistency checking. The default depends on 15144the compiler configuration. @option{-fchecking=2} enables further 15145internal consistency checking that might affect code generation. 15146 15147@item -frandom-seed=@var{string} 15148@opindex frandom-seed 15149This option provides a seed that GCC uses in place of 15150random numbers in generating certain symbol names 15151that have to be different in every compiled file. It is also used to 15152place unique stamps in coverage data files and the object files that 15153produce them. You can use the @option{-frandom-seed} option to produce 15154reproducibly identical object files. 15155 15156The @var{string} can either be a number (decimal, octal or hex) or an 15157arbitrary string (in which case it's converted to a number by 15158computing CRC32). 15159 15160The @var{string} should be different for every file you compile. 15161 15162@item -save-temps 15163@itemx -save-temps=cwd 15164@opindex save-temps 15165Store the usual ``temporary'' intermediate files permanently; place them 15166in the current directory and name them based on the source file. Thus, 15167compiling @file{foo.c} with @option{-c -save-temps} produces files 15168@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 15169preprocessed @file{foo.i} output file even though the compiler now 15170normally uses an integrated preprocessor. 15171 15172When used in combination with the @option{-x} command-line option, 15173@option{-save-temps} is sensible enough to avoid over writing an 15174input source file with the same extension as an intermediate file. 15175The corresponding intermediate file may be obtained by renaming the 15176source file before using @option{-save-temps}. 15177 15178If you invoke GCC in parallel, compiling several different source 15179files that share a common base name in different subdirectories or the 15180same source file compiled for multiple output destinations, it is 15181likely that the different parallel compilers will interfere with each 15182other, and overwrite the temporary files. For instance: 15183 15184@smallexample 15185gcc -save-temps -o outdir1/foo.o indir1/foo.c& 15186gcc -save-temps -o outdir2/foo.o indir2/foo.c& 15187@end smallexample 15188 15189may result in @file{foo.i} and @file{foo.o} being written to 15190simultaneously by both compilers. 15191 15192@item -save-temps=obj 15193@opindex save-temps=obj 15194Store the usual ``temporary'' intermediate files permanently. If the 15195@option{-o} option is used, the temporary files are based on the 15196object file. If the @option{-o} option is not used, the 15197@option{-save-temps=obj} switch behaves like @option{-save-temps}. 15198 15199For example: 15200 15201@smallexample 15202gcc -save-temps=obj -c foo.c 15203gcc -save-temps=obj -c bar.c -o dir/xbar.o 15204gcc -save-temps=obj foobar.c -o dir2/yfoobar 15205@end smallexample 15206 15207@noindent 15208creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, 15209@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and 15210@file{dir2/yfoobar.o}. 15211 15212@item -time@r{[}=@var{file}@r{]} 15213@opindex time 15214Report the CPU time taken by each subprocess in the compilation 15215sequence. For C source files, this is the compiler proper and assembler 15216(plus the linker if linking is done). 15217 15218Without the specification of an output file, the output looks like this: 15219 15220@smallexample 15221# cc1 0.12 0.01 15222# as 0.00 0.01 15223@end smallexample 15224 15225The first number on each line is the ``user time'', that is time spent 15226executing the program itself. The second number is ``system time'', 15227time spent executing operating system routines on behalf of the program. 15228Both numbers are in seconds. 15229 15230With the specification of an output file, the output is appended to the 15231named file, and it looks like this: 15232 15233@smallexample 152340.12 0.01 cc1 @var{options} 152350.00 0.01 as @var{options} 15236@end smallexample 15237 15238The ``user time'' and the ``system time'' are moved before the program 15239name, and the options passed to the program are displayed, so that one 15240can later tell what file was being compiled, and with which options. 15241 15242@item -fdump-final-insns@r{[}=@var{file}@r{]} 15243@opindex fdump-final-insns 15244Dump the final internal representation (RTL) to @var{file}. If the 15245optional argument is omitted (or if @var{file} is @code{.}), the name 15246of the dump file is determined by appending @code{.gkd} to the 15247compilation output file name. 15248 15249@item -fcompare-debug@r{[}=@var{opts}@r{]} 15250@opindex fcompare-debug 15251@opindex fno-compare-debug 15252If no error occurs during compilation, run the compiler a second time, 15253adding @var{opts} and @option{-fcompare-debug-second} to the arguments 15254passed to the second compilation. Dump the final internal 15255representation in both compilations, and print an error if they differ. 15256 15257If the equal sign is omitted, the default @option{-gtoggle} is used. 15258 15259The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 15260and nonzero, implicitly enables @option{-fcompare-debug}. If 15261@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 15262then it is used for @var{opts}, otherwise the default @option{-gtoggle} 15263is used. 15264 15265@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 15266is equivalent to @option{-fno-compare-debug}, which disables the dumping 15267of the final representation and the second compilation, preventing even 15268@env{GCC_COMPARE_DEBUG} from taking effect. 15269 15270To verify full coverage during @option{-fcompare-debug} testing, set 15271@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 15272which GCC rejects as an invalid option in any actual compilation 15273(rather than preprocessing, assembly or linking). To get just a 15274warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 15275not overridden} will do. 15276 15277@item -fcompare-debug-second 15278@opindex fcompare-debug-second 15279This option is implicitly passed to the compiler for the second 15280compilation requested by @option{-fcompare-debug}, along with options to 15281silence warnings, and omitting other options that would cause the compiler 15282to produce output to files or to standard output as a side effect. Dump 15283files and preserved temporary files are renamed so as to contain the 15284@code{.gk} additional extension during the second compilation, to avoid 15285overwriting those generated by the first. 15286 15287When this option is passed to the compiler driver, it causes the 15288@emph{first} compilation to be skipped, which makes it useful for little 15289other than debugging the compiler proper. 15290 15291@item -gtoggle 15292@opindex gtoggle 15293Turn off generation of debug info, if leaving out this option 15294generates it, or turn it on at level 2 otherwise. The position of this 15295argument in the command line does not matter; it takes effect after all 15296other options are processed, and it does so only once, no matter how 15297many times it is given. This is mainly intended to be used with 15298@option{-fcompare-debug}. 15299 15300@item -fvar-tracking-assignments-toggle 15301@opindex fvar-tracking-assignments-toggle 15302@opindex fno-var-tracking-assignments-toggle 15303Toggle @option{-fvar-tracking-assignments}, in the same way that 15304@option{-gtoggle} toggles @option{-g}. 15305 15306@item -Q 15307@opindex Q 15308Makes the compiler print out each function name as it is compiled, and 15309print some statistics about each pass when it finishes. 15310 15311@item -ftime-report 15312@opindex ftime-report 15313Makes the compiler print some statistics about the time consumed by each 15314pass when it finishes. 15315 15316@item -ftime-report-details 15317@opindex ftime-report-details 15318Record the time consumed by infrastructure parts separately for each pass. 15319 15320@item -fira-verbose=@var{n} 15321@opindex fira-verbose 15322Control the verbosity of the dump file for the integrated register allocator. 15323The default value is 5. If the value @var{n} is greater or equal to 10, 15324the dump output is sent to stderr using the same format as @var{n} minus 10. 15325 15326@item -flto-report 15327@opindex flto-report 15328Prints a report with internal details on the workings of the link-time 15329optimizer. The contents of this report vary from version to version. 15330It is meant to be useful to GCC developers when processing object 15331files in LTO mode (via @option{-flto}). 15332 15333Disabled by default. 15334 15335@item -flto-report-wpa 15336@opindex flto-report-wpa 15337Like @option{-flto-report}, but only print for the WPA phase of Link 15338Time Optimization. 15339 15340@item -fmem-report 15341@opindex fmem-report 15342Makes the compiler print some statistics about permanent memory 15343allocation when it finishes. 15344 15345@item -fmem-report-wpa 15346@opindex fmem-report-wpa 15347Makes the compiler print some statistics about permanent memory 15348allocation for the WPA phase only. 15349 15350@item -fpre-ipa-mem-report 15351@opindex fpre-ipa-mem-report 15352@item -fpost-ipa-mem-report 15353@opindex fpost-ipa-mem-report 15354Makes the compiler print some statistics about permanent memory 15355allocation before or after interprocedural optimization. 15356 15357@item -fprofile-report 15358@opindex fprofile-report 15359Makes the compiler print some statistics about consistency of the 15360(estimated) profile and effect of individual passes. 15361 15362@item -fstack-usage 15363@opindex fstack-usage 15364Makes the compiler output stack usage information for the program, on a 15365per-function basis. The filename for the dump is made by appending 15366@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 15367the output file, if explicitly specified and it is not an executable, 15368otherwise it is the basename of the source file. An entry is made up 15369of three fields: 15370 15371@itemize 15372@item 15373The name of the function. 15374@item 15375A number of bytes. 15376@item 15377One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 15378@end itemize 15379 15380The qualifier @code{static} means that the function manipulates the stack 15381statically: a fixed number of bytes are allocated for the frame on function 15382entry and released on function exit; no stack adjustments are otherwise made 15383in the function. The second field is this fixed number of bytes. 15384 15385The qualifier @code{dynamic} means that the function manipulates the stack 15386dynamically: in addition to the static allocation described above, stack 15387adjustments are made in the body of the function, for example to push/pop 15388arguments around function calls. If the qualifier @code{bounded} is also 15389present, the amount of these adjustments is bounded at compile time and 15390the second field is an upper bound of the total amount of stack used by 15391the function. If it is not present, the amount of these adjustments is 15392not bounded at compile time and the second field only represents the 15393bounded part. 15394 15395@item -fstats 15396@opindex fstats 15397Emit statistics about front-end processing at the end of the compilation. 15398This option is supported only by the C++ front end, and 15399the information is generally only useful to the G++ development team. 15400 15401@item -fdbg-cnt-list 15402@opindex fdbg-cnt-list 15403Print the name and the counter upper bound for all debug counters. 15404 15405 15406@item -fdbg-cnt=@var{counter-value-list} 15407@opindex fdbg-cnt 15408Set the internal debug counter lower and upper bound. @var{counter-value-list} 15409is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound} 15410tuples which sets the lower and the upper bound of each debug 15411counter @var{name}. The @var{lower_bound} is optional and is zero 15412initialized if not set. 15413All debug counters have the initial upper bound of @code{UINT_MAX}; 15414thus @code{dbg_cnt} returns true always unless the upper bound 15415is set by this option. 15416For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10}, 15417@code{dbg_cnt(dce)} returns true only for third and fourth invocation. 15418For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations. 15419 15420@item -print-file-name=@var{library} 15421@opindex print-file-name 15422Print the full absolute name of the library file @var{library} that 15423would be used when linking---and don't do anything else. With this 15424option, GCC does not compile or link anything; it just prints the 15425file name. 15426 15427@item -print-multi-directory 15428@opindex print-multi-directory 15429Print the directory name corresponding to the multilib selected by any 15430other switches present in the command line. This directory is supposed 15431to exist in @env{GCC_EXEC_PREFIX}. 15432 15433@item -print-multi-lib 15434@opindex print-multi-lib 15435Print the mapping from multilib directory names to compiler switches 15436that enable them. The directory name is separated from the switches by 15437@samp{;}, and each switch starts with an @samp{@@} instead of the 15438@samp{-}, without spaces between multiple switches. This is supposed to 15439ease shell processing. 15440 15441@item -print-multi-os-directory 15442@opindex print-multi-os-directory 15443Print the path to OS libraries for the selected 15444multilib, relative to some @file{lib} subdirectory. If OS libraries are 15445present in the @file{lib} subdirectory and no multilibs are used, this is 15446usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 15447sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 15448@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 15449subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 15450 15451@item -print-multiarch 15452@opindex print-multiarch 15453Print the path to OS libraries for the selected multiarch, 15454relative to some @file{lib} subdirectory. 15455 15456@item -print-prog-name=@var{program} 15457@opindex print-prog-name 15458Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 15459 15460@item -print-libgcc-file-name 15461@opindex print-libgcc-file-name 15462Same as @option{-print-file-name=libgcc.a}. 15463 15464This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 15465but you do want to link with @file{libgcc.a}. You can do: 15466 15467@smallexample 15468gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 15469@end smallexample 15470 15471@item -print-search-dirs 15472@opindex print-search-dirs 15473Print the name of the configured installation directory and a list of 15474program and library directories @command{gcc} searches---and don't do anything else. 15475 15476This is useful when @command{gcc} prints the error message 15477@samp{installation problem, cannot exec cpp0: No such file or directory}. 15478To resolve this you either need to put @file{cpp0} and the other compiler 15479components where @command{gcc} expects to find them, or you can set the environment 15480variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 15481Don't forget the trailing @samp{/}. 15482@xref{Environment Variables}. 15483 15484@item -print-sysroot 15485@opindex print-sysroot 15486Print the target sysroot directory that is used during 15487compilation. This is the target sysroot specified either at configure 15488time or using the @option{--sysroot} option, possibly with an extra 15489suffix that depends on compilation options. If no target sysroot is 15490specified, the option prints nothing. 15491 15492@item -print-sysroot-headers-suffix 15493@opindex print-sysroot-headers-suffix 15494Print the suffix added to the target sysroot when searching for 15495headers, or give an error if the compiler is not configured with such 15496a suffix---and don't do anything else. 15497 15498@item -dumpmachine 15499@opindex dumpmachine 15500Print the compiler's target machine (for example, 15501@samp{i686-pc-linux-gnu})---and don't do anything else. 15502 15503@item -dumpversion 15504@opindex dumpversion 15505Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do 15506anything else. This is the compiler version used in filesystem paths and 15507specs. Depending on how the compiler has been configured it can be just 15508a single number (major version), two numbers separated by a dot (major and 15509minor version) or three numbers separated by dots (major, minor and patchlevel 15510version). 15511 15512@item -dumpfullversion 15513@opindex dumpfullversion 15514Print the full compiler version---and don't do anything else. The output is 15515always three numbers separated by dots, major, minor and patchlevel version. 15516 15517@item -dumpspecs 15518@opindex dumpspecs 15519Print the compiler's built-in specs---and don't do anything else. (This 15520is used when GCC itself is being built.) @xref{Spec Files}. 15521@end table 15522 15523@node Submodel Options 15524@section Machine-Dependent Options 15525@cindex submodel options 15526@cindex specifying hardware config 15527@cindex hardware models and configurations, specifying 15528@cindex target-dependent options 15529@cindex machine-dependent options 15530 15531Each target machine supported by GCC can have its own options---for 15532example, to allow you to compile for a particular processor variant or 15533ABI, or to control optimizations specific to that machine. By 15534convention, the names of machine-specific options start with 15535@samp{-m}. 15536 15537Some configurations of the compiler also support additional target-specific 15538options, usually for compatibility with other compilers on the same 15539platform. 15540 15541@c This list is ordered alphanumerically by subsection name. 15542@c It should be the same order and spelling as these options are listed 15543@c in Machine Dependent Options 15544 15545@menu 15546* AArch64 Options:: 15547* Adapteva Epiphany Options:: 15548* AMD GCN Options:: 15549* ARC Options:: 15550* ARM Options:: 15551* AVR Options:: 15552* Blackfin Options:: 15553* C6X Options:: 15554* CRIS Options:: 15555* CR16 Options:: 15556* C-SKY Options:: 15557* Darwin Options:: 15558* DEC Alpha Options:: 15559* FR30 Options:: 15560* FT32 Options:: 15561* FRV Options:: 15562* GNU/Linux Options:: 15563* H8/300 Options:: 15564* HPPA Options:: 15565* IA-64 Options:: 15566* LM32 Options:: 15567* M32C Options:: 15568* M32R/D Options:: 15569* M680x0 Options:: 15570* MCore Options:: 15571* MeP Options:: 15572* MicroBlaze Options:: 15573* MIPS Options:: 15574* MMIX Options:: 15575* MN10300 Options:: 15576* Moxie Options:: 15577* MSP430 Options:: 15578* NDS32 Options:: 15579* Nios II Options:: 15580* Nvidia PTX Options:: 15581* OpenRISC Options:: 15582* PDP-11 Options:: 15583* picoChip Options:: 15584* PowerPC Options:: 15585* RISC-V Options:: 15586* RL78 Options:: 15587* RS/6000 and PowerPC Options:: 15588* RX Options:: 15589* S/390 and zSeries Options:: 15590* Score Options:: 15591* SH Options:: 15592* Solaris 2 Options:: 15593* SPARC Options:: 15594* SPU Options:: 15595* System V Options:: 15596* TILE-Gx Options:: 15597* TILEPro Options:: 15598* V850 Options:: 15599* VAX Options:: 15600* Visium Options:: 15601* VMS Options:: 15602* VxWorks Options:: 15603* x86 Options:: 15604* x86 Windows Options:: 15605* Xstormy16 Options:: 15606* Xtensa Options:: 15607* zSeries Options:: 15608@end menu 15609 15610@node AArch64 Options 15611@subsection AArch64 Options 15612@cindex AArch64 Options 15613 15614These options are defined for AArch64 implementations: 15615 15616@table @gcctabopt 15617 15618@item -mabi=@var{name} 15619@opindex mabi 15620Generate code for the specified data model. Permissible values 15621are @samp{ilp32} for SysV-like data model where int, long int and pointers 15622are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits, 15623but long int and pointers are 64 bits. 15624 15625The default depends on the specific target configuration. Note that 15626the LP64 and ILP32 ABIs are not link-compatible; you must compile your 15627entire program with the same ABI, and link with a compatible set of libraries. 15628 15629@item -mbig-endian 15630@opindex mbig-endian 15631Generate big-endian code. This is the default when GCC is configured for an 15632@samp{aarch64_be-*-*} target. 15633 15634@item -mgeneral-regs-only 15635@opindex mgeneral-regs-only 15636Generate code which uses only the general-purpose registers. This will prevent 15637the compiler from using floating-point and Advanced SIMD registers but will not 15638impose any restrictions on the assembler. 15639 15640@item -mlittle-endian 15641@opindex mlittle-endian 15642Generate little-endian code. This is the default when GCC is configured for an 15643@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 15644 15645@item -mcmodel=tiny 15646@opindex mcmodel=tiny 15647Generate code for the tiny code model. The program and its statically defined 15648symbols must be within 1MB of each other. Programs can be statically or 15649dynamically linked. 15650 15651@item -mcmodel=small 15652@opindex mcmodel=small 15653Generate code for the small code model. The program and its statically defined 15654symbols must be within 4GB of each other. Programs can be statically or 15655dynamically linked. This is the default code model. 15656 15657@item -mcmodel=large 15658@opindex mcmodel=large 15659Generate code for the large code model. This makes no assumptions about 15660addresses and sizes of sections. Programs can be statically linked only. 15661 15662@item -mstrict-align 15663@itemx -mno-strict-align 15664@opindex mstrict-align 15665@opindex mno-strict-align 15666Avoid or allow generating memory accesses that may not be aligned on a natural 15667object boundary as described in the architecture specification. 15668 15669@item -momit-leaf-frame-pointer 15670@itemx -mno-omit-leaf-frame-pointer 15671@opindex momit-leaf-frame-pointer 15672@opindex mno-omit-leaf-frame-pointer 15673Omit or keep the frame pointer in leaf functions. The former behavior is the 15674default. 15675 15676@item -mstack-protector-guard=@var{guard} 15677@itemx -mstack-protector-guard-reg=@var{reg} 15678@itemx -mstack-protector-guard-offset=@var{offset} 15679@opindex mstack-protector-guard 15680@opindex mstack-protector-guard-reg 15681@opindex mstack-protector-guard-offset 15682Generate stack protection code using canary at @var{guard}. Supported 15683locations are @samp{global} for a global canary or @samp{sysreg} for a 15684canary in an appropriate system register. 15685 15686With the latter choice the options 15687@option{-mstack-protector-guard-reg=@var{reg}} and 15688@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 15689which system register to use as base register for reading the canary, 15690and from what offset from that base register. There is no default 15691register or offset as this is entirely for use within the Linux 15692kernel. 15693 15694@item -mstack-protector-guard=@var{guard} 15695@itemx -mstack-protector-guard-reg=@var{reg} 15696@itemx -mstack-protector-guard-offset=@var{offset} 15697@opindex mstack-protector-guard 15698@opindex mstack-protector-guard-reg 15699@opindex mstack-protector-guard-offset 15700Generate stack protection code using canary at @var{guard}. Supported 15701locations are @samp{global} for a global canary or @samp{sysreg} for a 15702canary in an appropriate system register. 15703 15704With the latter choice the options 15705@option{-mstack-protector-guard-reg=@var{reg}} and 15706@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 15707which system register to use as base register for reading the canary, 15708and from what offset from that base register. There is no default 15709register or offset as this is entirely for use within the Linux 15710kernel. 15711 15712@item -mtls-dialect=desc 15713@opindex mtls-dialect=desc 15714Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 15715of TLS variables. This is the default. 15716 15717@item -mtls-dialect=traditional 15718@opindex mtls-dialect=traditional 15719Use traditional TLS as the thread-local storage mechanism for dynamic accesses 15720of TLS variables. 15721 15722@item -mtls-size=@var{size} 15723@opindex mtls-size 15724Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48. 15725This option requires binutils 2.26 or newer. 15726 15727@item -mfix-cortex-a53-835769 15728@itemx -mno-fix-cortex-a53-835769 15729@opindex mfix-cortex-a53-835769 15730@opindex mno-fix-cortex-a53-835769 15731Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 15732This involves inserting a NOP instruction between memory instructions and 1573364-bit integer multiply-accumulate instructions. 15734 15735@item -mfix-cortex-a53-843419 15736@itemx -mno-fix-cortex-a53-843419 15737@opindex mfix-cortex-a53-843419 15738@opindex mno-fix-cortex-a53-843419 15739Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 15740This erratum workaround is made at link time and this will only pass the 15741corresponding flag to the linker. 15742 15743@item -mlow-precision-recip-sqrt 15744@itemx -mno-low-precision-recip-sqrt 15745@opindex mlow-precision-recip-sqrt 15746@opindex mno-low-precision-recip-sqrt 15747Enable or disable the reciprocal square root approximation. 15748This option only has an effect if @option{-ffast-math} or 15749@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 15750precision of reciprocal square root results to about 16 bits for 15751single precision and to 32 bits for double precision. 15752 15753@item -mlow-precision-sqrt 15754@itemx -mno-low-precision-sqrt 15755@opindex mlow-precision-sqrt 15756@opindex mno-low-precision-sqrt 15757Enable or disable the square root approximation. 15758This option only has an effect if @option{-ffast-math} or 15759@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 15760precision of square root results to about 16 bits for 15761single precision and to 32 bits for double precision. 15762If enabled, it implies @option{-mlow-precision-recip-sqrt}. 15763 15764@item -mlow-precision-div 15765@itemx -mno-low-precision-div 15766@opindex mlow-precision-div 15767@opindex mno-low-precision-div 15768Enable or disable the division approximation. 15769This option only has an effect if @option{-ffast-math} or 15770@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 15771precision of division results to about 16 bits for 15772single precision and to 32 bits for double precision. 15773 15774@item -mtrack-speculation 15775@itemx -mno-track-speculation 15776Enable or disable generation of additional code to track speculative 15777execution through conditional branches. The tracking state can then 15778be used by the compiler when expanding calls to 15779@code{__builtin_speculation_safe_copy} to permit a more efficient code 15780sequence to be generated. 15781 15782@item -march=@var{name} 15783@opindex march 15784Specify the name of the target architecture and, optionally, one or 15785more feature modifiers. This option has the form 15786@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}. 15787 15788The permissible values for @var{arch} are @samp{armv8-a}, 15789@samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a}, 15790@samp{armv8.5-a} or @var{native}. 15791 15792The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler 15793support for the ARMv8.5-A architecture extensions. 15794 15795The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler 15796support for the ARMv8.4-A architecture extensions. 15797 15798The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler 15799support for the ARMv8.3-A architecture extensions. 15800 15801The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler 15802support for the ARMv8.2-A architecture extensions. 15803 15804The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler 15805support for the ARMv8.1-A architecture extension. In particular, it 15806enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features. 15807 15808The value @samp{native} is available on native AArch64 GNU/Linux and 15809causes the compiler to pick the architecture of the host system. This 15810option has no effect if the compiler is unable to recognize the 15811architecture of the host system, 15812 15813The permissible values for @var{feature} are listed in the sub-section 15814on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 15815Feature Modifiers}. Where conflicting feature modifiers are 15816specified, the right-most feature is used. 15817 15818GCC uses @var{name} to determine what kind of instructions it can emit 15819when generating assembly code. If @option{-march} is specified 15820without either of @option{-mtune} or @option{-mcpu} also being 15821specified, the code is tuned to perform well across a range of target 15822processors implementing the target architecture. 15823 15824@item -mtune=@var{name} 15825@opindex mtune 15826Specify the name of the target processor for which GCC should tune the 15827performance of the code. Permissible values for this option are: 15828@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 15829@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 15830@samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor}, 15831@samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira}, 15832@samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx}, 15833@samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88}, 15834@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110}, 15835@samp{thunderxt83}, @samp{thunderx2t99}, 15836@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 15837@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 15838@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} 15839@samp{native}. 15840 15841The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 15842@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 15843@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC 15844should tune for a big.LITTLE system. 15845 15846Additionally on native AArch64 GNU/Linux systems the value 15847@samp{native} tunes performance to the host system. This option has no effect 15848if the compiler is unable to recognize the processor of the host system. 15849 15850Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 15851are specified, the code is tuned to perform well across a range 15852of target processors. 15853 15854This option cannot be suffixed by feature modifiers. 15855 15856@item -mcpu=@var{name} 15857@opindex mcpu 15858Specify the name of the target processor, optionally suffixed by one 15859or more feature modifiers. This option has the form 15860@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where 15861the permissible values for @var{cpu} are the same as those available 15862for @option{-mtune}. The permissible values for @var{feature} are 15863documented in the sub-section on 15864@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 15865Feature Modifiers}. Where conflicting feature modifiers are 15866specified, the right-most feature is used. 15867 15868GCC uses @var{name} to determine what kind of instructions it can emit when 15869generating assembly code (as if by @option{-march}) and to determine 15870the target processor for which to tune for performance (as if 15871by @option{-mtune}). Where this option is used in conjunction 15872with @option{-march} or @option{-mtune}, those options take precedence 15873over the appropriate part of this option. 15874 15875@item -moverride=@var{string} 15876@opindex moverride 15877Override tuning decisions made by the back-end in response to a 15878@option{-mtune=} switch. The syntax, semantics, and accepted values 15879for @var{string} in this option are not guaranteed to be consistent 15880across releases. 15881 15882This option is only intended to be useful when developing GCC. 15883 15884@item -mverbose-cost-dump 15885@opindex mverbose-cost-dump 15886Enable verbose cost model dumping in the debug dump files. This option is 15887provided for use in debugging the compiler. 15888 15889@item -mpc-relative-literal-loads 15890@itemx -mno-pc-relative-literal-loads 15891@opindex mpc-relative-literal-loads 15892@opindex mno-pc-relative-literal-loads 15893Enable or disable PC-relative literal loads. With this option literal pools are 15894accessed using a single instruction and emitted after each function. This 15895limits the maximum size of functions to 1MB. This is enabled by default for 15896@option{-mcmodel=tiny}. 15897 15898@item -msign-return-address=@var{scope} 15899@opindex msign-return-address 15900Select the function scope on which return address signing will be applied. 15901Permissible values are @samp{none}, which disables return address signing, 15902@samp{non-leaf}, which enables pointer signing for functions which are not leaf 15903functions, and @samp{all}, which enables pointer signing for all functions. The 15904default value is @samp{none}. This option has been deprecated by 15905-mbranch-protection. 15906 15907@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti} 15908@opindex mbranch-protection 15909Select the branch protection features to use. 15910@samp{none} is the default and turns off all types of branch protection. 15911@samp{standard} turns on all types of branch protection features. If a feature 15912has additional tuning options, then @samp{standard} sets it to its standard 15913level. 15914@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard 15915level: signing functions that save the return address to memory (non-leaf 15916functions will practically always do this) using the a-key. The optional 15917argument @samp{leaf} can be used to extend the signing to include leaf 15918functions. 15919@samp{bti} turns on branch target identification mechanism. 15920 15921@item -msve-vector-bits=@var{bits} 15922@opindex msve-vector-bits 15923Specify the number of bits in an SVE vector register. This option only has 15924an effect when SVE is enabled. 15925 15926GCC supports two forms of SVE code generation: ``vector-length 15927agnostic'' output that works with any size of vector register and 15928``vector-length specific'' output that allows GCC to make assumptions 15929about the vector length when it is useful for optimization reasons. 15930The possible values of @samp{bits} are: @samp{scalable}, @samp{128}, 15931@samp{256}, @samp{512}, @samp{1024} and @samp{2048}. 15932Specifying @samp{scalable} selects vector-length agnostic 15933output. At present @samp{-msve-vector-bits=128} also generates vector-length 15934agnostic output. All other values generate vector-length specific code. 15935The behavior of these values may change in future releases and no value except 15936@samp{scalable} should be relied on for producing code that is portable across 15937different hardware SVE vector lengths. 15938 15939The default is @samp{-msve-vector-bits=scalable}, which produces 15940vector-length agnostic code. 15941@end table 15942 15943@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 15944@anchor{aarch64-feature-modifiers} 15945@cindex @option{-march} feature modifiers 15946@cindex @option{-mcpu} feature modifiers 15947Feature modifiers used with @option{-march} and @option{-mcpu} can be any of 15948the following and their inverses @option{no@var{feature}}: 15949 15950@table @samp 15951@item crc 15952Enable CRC extension. This is on by default for 15953@option{-march=armv8.1-a}. 15954@item crypto 15955Enable Crypto extension. This also enables Advanced SIMD and floating-point 15956instructions. 15957@item fp 15958Enable floating-point instructions. This is on by default for all possible 15959values for options @option{-march} and @option{-mcpu}. 15960@item simd 15961Enable Advanced SIMD instructions. This also enables floating-point 15962instructions. This is on by default for all possible values for options 15963@option{-march} and @option{-mcpu}. 15964@item sve 15965Enable Scalable Vector Extension instructions. This also enables Advanced 15966SIMD and floating-point instructions. 15967@item lse 15968Enable Large System Extension instructions. This is on by default for 15969@option{-march=armv8.1-a}. 15970@item rdma 15971Enable Round Double Multiply Accumulate instructions. This is on by default 15972for @option{-march=armv8.1-a}. 15973@item fp16 15974Enable FP16 extension. This also enables floating-point instructions. 15975@item fp16fml 15976Enable FP16 fmla extension. This also enables FP16 extensions and 15977floating-point instructions. This option is enabled by default for @option{-march=armv8.4-a}. Use of this option with architectures prior to Armv8.2-A is not supported. 15978 15979@item rcpc 15980Enable the RcPc extension. This does not change code generation from GCC, 15981but is passed on to the assembler, enabling inline asm statements to use 15982instructions from the RcPc extension. 15983@item dotprod 15984Enable the Dot Product extension. This also enables Advanced SIMD instructions. 15985@item aes 15986Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced 15987SIMD instructions. 15988@item sha2 15989Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions. 15990@item sha3 15991Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD 15992instructions. Use of this option with architectures prior to Armv8.2-A is not supported. 15993@item sm4 15994Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. 15995Use of this option with architectures prior to Armv8.2-A is not supported. 15996@item profile 15997Enable the Statistical Profiling extension. This option is only to enable the 15998extension at the assembler level and does not affect code generation. 15999@item rng 16000Enable the Armv8.5-a Random Number instructions. This option is only to 16001enable the extension at the assembler level and does not affect code 16002generation. 16003@item memtag 16004Enable the Armv8.5-a Memory Tagging Extensions. This option is only to 16005enable the extension at the assembler level and does not affect code 16006generation. 16007@item sb 16008Enable the Armv8-a Speculation Barrier instruction. This option is only to 16009enable the extension at the assembler level and does not affect code 16010generation. This option is enabled by default for @option{-march=armv8.5-a}. 16011@item ssbs 16012Enable the Armv8-a Speculative Store Bypass Safe instruction. This option 16013is only to enable the extension at the assembler level and does not affect code 16014generation. This option is enabled by default for @option{-march=armv8.5-a}. 16015@item predres 16016Enable the Armv8-a Execution and Data Prediction Restriction instructions. 16017This option is only to enable the extension at the assembler level and does 16018not affect code generation. This option is enabled by default for 16019@option{-march=armv8.5-a}. 16020 16021@end table 16022 16023Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd}, 16024which implies @option{fp}. 16025Conversely, @option{nofp} implies @option{nosimd}, which implies 16026@option{nocrypto}, @option{noaes} and @option{nosha2}. 16027 16028@node Adapteva Epiphany Options 16029@subsection Adapteva Epiphany Options 16030 16031These @samp{-m} options are defined for Adapteva Epiphany: 16032 16033@table @gcctabopt 16034@item -mhalf-reg-file 16035@opindex mhalf-reg-file 16036Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 16037That allows code to run on hardware variants that lack these registers. 16038 16039@item -mprefer-short-insn-regs 16040@opindex mprefer-short-insn-regs 16041Preferentially allocate registers that allow short instruction generation. 16042This can result in increased instruction count, so this may either reduce or 16043increase overall code size. 16044 16045@item -mbranch-cost=@var{num} 16046@opindex mbranch-cost 16047Set the cost of branches to roughly @var{num} ``simple'' instructions. 16048This cost is only a heuristic and is not guaranteed to produce 16049consistent results across releases. 16050 16051@item -mcmove 16052@opindex mcmove 16053Enable the generation of conditional moves. 16054 16055@item -mnops=@var{num} 16056@opindex mnops 16057Emit @var{num} NOPs before every other generated instruction. 16058 16059@item -mno-soft-cmpsf 16060@opindex mno-soft-cmpsf 16061@opindex msoft-cmpsf 16062For single-precision floating-point comparisons, emit an @code{fsub} instruction 16063and test the flags. This is faster than a software comparison, but can 16064get incorrect results in the presence of NaNs, or when two different small 16065numbers are compared such that their difference is calculated as zero. 16066The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 16067software comparisons. 16068 16069@item -mstack-offset=@var{num} 16070@opindex mstack-offset 16071Set the offset between the top of the stack and the stack pointer. 16072E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 16073can be used by leaf functions without stack allocation. 16074Values other than @samp{8} or @samp{16} are untested and unlikely to work. 16075Note also that this option changes the ABI; compiling a program with a 16076different stack offset than the libraries have been compiled with 16077generally does not work. 16078This option can be useful if you want to evaluate if a different stack 16079offset would give you better code, but to actually use a different stack 16080offset to build working programs, it is recommended to configure the 16081toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 16082 16083@item -mno-round-nearest 16084@opindex mno-round-nearest 16085@opindex mround-nearest 16086Make the scheduler assume that the rounding mode has been set to 16087truncating. The default is @option{-mround-nearest}. 16088 16089@item -mlong-calls 16090@opindex mlong-calls 16091If not otherwise specified by an attribute, assume all calls might be beyond 16092the offset range of the @code{b} / @code{bl} instructions, and therefore load the 16093function address into a register before performing a (otherwise direct) call. 16094This is the default. 16095 16096@item -mshort-calls 16097@opindex short-calls 16098If not otherwise specified by an attribute, assume all direct calls are 16099in the range of the @code{b} / @code{bl} instructions, so use these instructions 16100for direct calls. The default is @option{-mlong-calls}. 16101 16102@item -msmall16 16103@opindex msmall16 16104Assume addresses can be loaded as 16-bit unsigned values. This does not 16105apply to function addresses for which @option{-mlong-calls} semantics 16106are in effect. 16107 16108@item -mfp-mode=@var{mode} 16109@opindex mfp-mode 16110Set the prevailing mode of the floating-point unit. 16111This determines the floating-point mode that is provided and expected 16112at function call and return time. Making this mode match the mode you 16113predominantly need at function start can make your programs smaller and 16114faster by avoiding unnecessary mode switches. 16115 16116@var{mode} can be set to one the following values: 16117 16118@table @samp 16119@item caller 16120Any mode at function entry is valid, and retained or restored when 16121the function returns, and when it calls other functions. 16122This mode is useful for compiling libraries or other compilation units 16123you might want to incorporate into different programs with different 16124prevailing FPU modes, and the convenience of being able to use a single 16125object file outweighs the size and speed overhead for any extra 16126mode switching that might be needed, compared with what would be needed 16127with a more specific choice of prevailing FPU mode. 16128 16129@item truncate 16130This is the mode used for floating-point calculations with 16131truncating (i.e.@: round towards zero) rounding mode. That includes 16132conversion from floating point to integer. 16133 16134@item round-nearest 16135This is the mode used for floating-point calculations with 16136round-to-nearest-or-even rounding mode. 16137 16138@item int 16139This is the mode used to perform integer calculations in the FPU, e.g.@: 16140integer multiply, or integer multiply-and-accumulate. 16141@end table 16142 16143The default is @option{-mfp-mode=caller} 16144 16145@item -mno-split-lohi 16146@itemx -mno-postinc 16147@itemx -mno-postmodify 16148@opindex mno-split-lohi 16149@opindex msplit-lohi 16150@opindex mno-postinc 16151@opindex mpostinc 16152@opindex mno-postmodify 16153@opindex mpostmodify 16154Code generation tweaks that disable, respectively, splitting of 32-bit 16155loads, generation of post-increment addresses, and generation of 16156post-modify addresses. The defaults are @option{msplit-lohi}, 16157@option{-mpost-inc}, and @option{-mpost-modify}. 16158 16159@item -mnovect-double 16160@opindex mno-vect-double 16161@opindex mvect-double 16162Change the preferred SIMD mode to SImode. The default is 16163@option{-mvect-double}, which uses DImode as preferred SIMD mode. 16164 16165@item -max-vect-align=@var{num} 16166@opindex max-vect-align 16167The maximum alignment for SIMD vector mode types. 16168@var{num} may be 4 or 8. The default is 8. 16169Note that this is an ABI change, even though many library function 16170interfaces are unaffected if they don't use SIMD vector modes 16171in places that affect size and/or alignment of relevant types. 16172 16173@item -msplit-vecmove-early 16174@opindex msplit-vecmove-early 16175Split vector moves into single word moves before reload. In theory this 16176can give better register allocation, but so far the reverse seems to be 16177generally the case. 16178 16179@item -m1reg-@var{reg} 16180@opindex m1reg- 16181Specify a register to hold the constant @minus{}1, which makes loading small negative 16182constants and certain bitmasks faster. 16183Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 16184which specify use of that register as a fixed register, 16185and @samp{none}, which means that no register is used for this 16186purpose. The default is @option{-m1reg-none}. 16187 16188@end table 16189 16190@node AMD GCN Options 16191@subsection AMD GCN Options 16192@cindex AMD GCN Options 16193 16194These options are defined specifically for the AMD GCN port. 16195 16196@table @gcctabopt 16197 16198@item -march=@var{gpu} 16199@opindex march 16200@itemx -mtune=@var{gpu} 16201@opindex mtune 16202Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu} 16203are 16204 16205@table @samp 16206@opindex fiji 16207@item fiji 16208Compile for GCN3 Fiji devices (gfx803). 16209 16210@item gfx900 16211Compile for GCN5 Vega 10 devices (gfx900). 16212 16213@end table 16214 16215@item -mstack-size=@var{bytes} 16216@opindex mstack-size 16217Specify how many @var{bytes} of stack space will be requested for each GPU 16218thread (wave-front). Beware that there may be many threads and limited memory 16219available. The size of the stack allocation may also have an impact on 16220run-time performance. The default is 32KB when using OpenACC or OpenMP, and 162211MB otherwise. 16222 16223@end table 16224 16225@node ARC Options 16226@subsection ARC Options 16227@cindex ARC options 16228 16229The following options control the architecture variant for which code 16230is being compiled: 16231 16232@c architecture variants 16233@table @gcctabopt 16234 16235@item -mbarrel-shifter 16236@opindex mbarrel-shifter 16237Generate instructions supported by barrel shifter. This is the default 16238unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect. 16239 16240@item -mjli-always 16241@opindex mjli-alawys 16242Force to call a function using jli_s instruction. This option is 16243valid only for ARCv2 architecture. 16244 16245@item -mcpu=@var{cpu} 16246@opindex mcpu 16247Set architecture type, register usage, and instruction scheduling 16248parameters for @var{cpu}. There are also shortcut alias options 16249available for backward compatibility and convenience. Supported 16250values for @var{cpu} are 16251 16252@table @samp 16253@opindex mA6 16254@opindex mARC600 16255@item arc600 16256Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 16257 16258@item arc601 16259@opindex mARC601 16260Compile for ARC601. Alias: @option{-mARC601}. 16261 16262@item arc700 16263@opindex mA7 16264@opindex mARC700 16265Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 16266This is the default when configured with @option{--with-cpu=arc700}@. 16267 16268@item arcem 16269Compile for ARC EM. 16270 16271@item archs 16272Compile for ARC HS. 16273 16274@item em 16275Compile for ARC EM CPU with no hardware extensions. 16276 16277@item em4 16278Compile for ARC EM4 CPU. 16279 16280@item em4_dmips 16281Compile for ARC EM4 DMIPS CPU. 16282 16283@item em4_fpus 16284Compile for ARC EM4 DMIPS CPU with the single-precision floating-point 16285extension. 16286 16287@item em4_fpuda 16288Compile for ARC EM4 DMIPS CPU with single-precision floating-point and 16289double assist instructions. 16290 16291@item hs 16292Compile for ARC HS CPU with no hardware extensions except the atomic 16293instructions. 16294 16295@item hs34 16296Compile for ARC HS34 CPU. 16297 16298@item hs38 16299Compile for ARC HS38 CPU. 16300 16301@item hs38_linux 16302Compile for ARC HS38 CPU with all hardware extensions on. 16303 16304@item arc600_norm 16305Compile for ARC 600 CPU with @code{norm} instructions enabled. 16306 16307@item arc600_mul32x16 16308Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 16309instructions enabled. 16310 16311@item arc600_mul64 16312Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 16313instructions enabled. 16314 16315@item arc601_norm 16316Compile for ARC 601 CPU with @code{norm} instructions enabled. 16317 16318@item arc601_mul32x16 16319Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply 16320instructions enabled. 16321 16322@item arc601_mul64 16323Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family 16324instructions enabled. 16325 16326@item nps400 16327Compile for ARC 700 on NPS400 chip. 16328 16329@item em_mini 16330Compile for ARC EM minimalist configuration featuring reduced register 16331set. 16332 16333@end table 16334 16335@item -mdpfp 16336@opindex mdpfp 16337@itemx -mdpfp-compact 16338@opindex mdpfp-compact 16339Generate double-precision FPX instructions, tuned for the compact 16340implementation. 16341 16342@item -mdpfp-fast 16343@opindex mdpfp-fast 16344Generate double-precision FPX instructions, tuned for the fast 16345implementation. 16346 16347@item -mno-dpfp-lrsr 16348@opindex mno-dpfp-lrsr 16349Disable @code{lr} and @code{sr} instructions from using FPX extension 16350aux registers. 16351 16352@item -mea 16353@opindex mea 16354Generate extended arithmetic instructions. Currently only 16355@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 16356supported. This is always enabled for @option{-mcpu=ARC700}. 16357 16358@item -mno-mpy 16359@opindex mno-mpy 16360@opindex mmpy 16361Do not generate @code{mpy}-family instructions for ARC700. This option is 16362deprecated. 16363 16364@item -mmul32x16 16365@opindex mmul32x16 16366Generate 32x16-bit multiply and multiply-accumulate instructions. 16367 16368@item -mmul64 16369@opindex mmul64 16370Generate @code{mul64} and @code{mulu64} instructions. 16371Only valid for @option{-mcpu=ARC600}. 16372 16373@item -mnorm 16374@opindex mnorm 16375Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700} 16376is in effect. 16377 16378@item -mspfp 16379@opindex mspfp 16380@itemx -mspfp-compact 16381@opindex mspfp-compact 16382Generate single-precision FPX instructions, tuned for the compact 16383implementation. 16384 16385@item -mspfp-fast 16386@opindex mspfp-fast 16387Generate single-precision FPX instructions, tuned for the fast 16388implementation. 16389 16390@item -msimd 16391@opindex msimd 16392Enable generation of ARC SIMD instructions via target-specific 16393builtins. Only valid for @option{-mcpu=ARC700}. 16394 16395@item -msoft-float 16396@opindex msoft-float 16397This option ignored; it is provided for compatibility purposes only. 16398Software floating-point code is emitted by default, and this default 16399can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or 16400@option{-mspfp-fast} for single precision, and @option{-mdpfp}, 16401@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision. 16402 16403@item -mswap 16404@opindex mswap 16405Generate @code{swap} instructions. 16406 16407@item -matomic 16408@opindex matomic 16409This enables use of the locked load/store conditional extension to implement 16410atomic memory built-in functions. Not available for ARC 6xx or ARC 16411EM cores. 16412 16413@item -mdiv-rem 16414@opindex mdiv-rem 16415Enable @code{div} and @code{rem} instructions for ARCv2 cores. 16416 16417@item -mcode-density 16418@opindex mcode-density 16419Enable code density instructions for ARC EM. 16420This option is on by default for ARC HS. 16421 16422@item -mll64 16423@opindex mll64 16424Enable double load/store operations for ARC HS cores. 16425 16426@item -mtp-regno=@var{regno} 16427@opindex mtp-regno 16428Specify thread pointer register number. 16429 16430@item -mmpy-option=@var{multo} 16431@opindex mmpy-option 16432Compile ARCv2 code with a multiplier design option. You can specify 16433the option using either a string or numeric value for @var{multo}. 16434@samp{wlh1} is the default value. The recognized values are: 16435 16436@table @samp 16437@item 0 16438@itemx none 16439No multiplier available. 16440 16441@item 1 16442@itemx w 1644316x16 multiplier, fully pipelined. 16444The following instructions are enabled: @code{mpyw} and @code{mpyuw}. 16445 16446@item 2 16447@itemx wlh1 1644832x32 multiplier, fully 16449pipelined (1 stage). The following instructions are additionally 16450enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16451 16452@item 3 16453@itemx wlh2 1645432x32 multiplier, fully pipelined 16455(2 stages). The following instructions are additionally enabled: @code{mpy}, 16456@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16457 16458@item 4 16459@itemx wlh3 16460Two 16x16 multipliers, blocking, 16461sequential. The following instructions are additionally enabled: @code{mpy}, 16462@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16463 16464@item 5 16465@itemx wlh4 16466One 16x16 multiplier, blocking, 16467sequential. The following instructions are additionally enabled: @code{mpy}, 16468@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16469 16470@item 6 16471@itemx wlh5 16472One 32x4 multiplier, blocking, 16473sequential. The following instructions are additionally enabled: @code{mpy}, 16474@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16475 16476@item 7 16477@itemx plus_dmpy 16478ARC HS SIMD support. 16479 16480@item 8 16481@itemx plus_macd 16482ARC HS SIMD support. 16483 16484@item 9 16485@itemx plus_qmacw 16486ARC HS SIMD support. 16487 16488@end table 16489 16490This option is only available for ARCv2 cores@. 16491 16492@item -mfpu=@var{fpu} 16493@opindex mfpu 16494Enables support for specific floating-point hardware extensions for ARCv2 16495cores. Supported values for @var{fpu} are: 16496 16497@table @samp 16498 16499@item fpus 16500Enables support for single-precision floating-point hardware 16501extensions@. 16502 16503@item fpud 16504Enables support for double-precision floating-point hardware 16505extensions. The single-precision floating-point extension is also 16506enabled. Not available for ARC EM@. 16507 16508@item fpuda 16509Enables support for double-precision floating-point hardware 16510extensions using double-precision assist instructions. The single-precision 16511floating-point extension is also enabled. This option is 16512only available for ARC EM@. 16513 16514@item fpuda_div 16515Enables support for double-precision floating-point hardware 16516extensions using double-precision assist instructions. 16517The single-precision floating-point, square-root, and divide 16518extensions are also enabled. This option is 16519only available for ARC EM@. 16520 16521@item fpuda_fma 16522Enables support for double-precision floating-point hardware 16523extensions using double-precision assist instructions. 16524The single-precision floating-point and fused multiply and add 16525hardware extensions are also enabled. This option is 16526only available for ARC EM@. 16527 16528@item fpuda_all 16529Enables support for double-precision floating-point hardware 16530extensions using double-precision assist instructions. 16531All single-precision floating-point hardware extensions are also 16532enabled. This option is only available for ARC EM@. 16533 16534@item fpus_div 16535Enables support for single-precision floating-point, square-root and divide 16536hardware extensions@. 16537 16538@item fpud_div 16539Enables support for double-precision floating-point, square-root and divide 16540hardware extensions. This option 16541includes option @samp{fpus_div}. Not available for ARC EM@. 16542 16543@item fpus_fma 16544Enables support for single-precision floating-point and 16545fused multiply and add hardware extensions@. 16546 16547@item fpud_fma 16548Enables support for double-precision floating-point and 16549fused multiply and add hardware extensions. This option 16550includes option @samp{fpus_fma}. Not available for ARC EM@. 16551 16552@item fpus_all 16553Enables support for all single-precision floating-point hardware 16554extensions@. 16555 16556@item fpud_all 16557Enables support for all single- and double-precision floating-point 16558hardware extensions. Not available for ARC EM@. 16559 16560@end table 16561 16562@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count} 16563@opindex mirq-ctrl-saved 16564Specifies general-purposes registers that the processor automatically 16565saves/restores on interrupt entry and exit. @var{register-range} is 16566specified as two registers separated by a dash. The register range 16567always starts with @code{r0}, the upper limit is @code{fp} register. 16568@var{blink} and @var{lp_count} are optional. This option is only 16569valid for ARC EM and ARC HS cores. 16570 16571@item -mrgf-banked-regs=@var{number} 16572@opindex mrgf-banked-regs 16573Specifies the number of registers replicated in second register bank 16574on entry to fast interrupt. Fast interrupts are interrupts with the 16575highest priority level P0. These interrupts save only PC and STATUS32 16576registers to avoid memory transactions during interrupt entry and exit 16577sequences. Use this option when you are using fast interrupts in an 16578ARC V2 family processor. Permitted values are 4, 8, 16, and 32. 16579 16580@item -mlpc-width=@var{width} 16581@opindex mlpc-width 16582Specify the width of the @code{lp_count} register. Valid values for 16583@var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is 16584fixed to 32 bits. If the width is less than 32, the compiler does not 16585attempt to transform loops in your program to use the zero-delay loop 16586mechanism unless it is known that the @code{lp_count} register can 16587hold the required loop-counter value. Depending on the width 16588specified, the compiler and run-time library might continue to use the 16589loop mechanism for various needs. This option defines macro 16590@code{__ARC_LPC_WIDTH__} with the value of @var{width}. 16591 16592@item -mrf16 16593@opindex mrf16 16594This option instructs the compiler to generate code for a 16-entry 16595register file. This option defines the @code{__ARC_RF16__} 16596preprocessor macro. 16597 16598@item -mbranch-index 16599@opindex mbranch-index 16600Enable use of @code{bi} or @code{bih} instructions to implement jump 16601tables. 16602 16603@end table 16604 16605The following options are passed through to the assembler, and also 16606define preprocessor macro symbols. 16607 16608@c Flags used by the assembler, but for which we define preprocessor 16609@c macro symbols as well. 16610@table @gcctabopt 16611@item -mdsp-packa 16612@opindex mdsp-packa 16613Passed down to the assembler to enable the DSP Pack A extensions. 16614Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is 16615deprecated. 16616 16617@item -mdvbf 16618@opindex mdvbf 16619Passed down to the assembler to enable the dual Viterbi butterfly 16620extension. Also sets the preprocessor symbol @code{__Xdvbf}. This 16621option is deprecated. 16622 16623@c ARC700 4.10 extension instruction 16624@item -mlock 16625@opindex mlock 16626Passed down to the assembler to enable the locked load/store 16627conditional extension. Also sets the preprocessor symbol 16628@code{__Xlock}. 16629 16630@item -mmac-d16 16631@opindex mmac-d16 16632Passed down to the assembler. Also sets the preprocessor symbol 16633@code{__Xxmac_d16}. This option is deprecated. 16634 16635@item -mmac-24 16636@opindex mmac-24 16637Passed down to the assembler. Also sets the preprocessor symbol 16638@code{__Xxmac_24}. This option is deprecated. 16639 16640@c ARC700 4.10 extension instruction 16641@item -mrtsc 16642@opindex mrtsc 16643Passed down to the assembler to enable the 64-bit time-stamp counter 16644extension instruction. Also sets the preprocessor symbol 16645@code{__Xrtsc}. This option is deprecated. 16646 16647@c ARC700 4.10 extension instruction 16648@item -mswape 16649@opindex mswape 16650Passed down to the assembler to enable the swap byte ordering 16651extension instruction. Also sets the preprocessor symbol 16652@code{__Xswape}. 16653 16654@item -mtelephony 16655@opindex mtelephony 16656Passed down to the assembler to enable dual- and single-operand 16657instructions for telephony. Also sets the preprocessor symbol 16658@code{__Xtelephony}. This option is deprecated. 16659 16660@item -mxy 16661@opindex mxy 16662Passed down to the assembler to enable the XY memory extension. Also 16663sets the preprocessor symbol @code{__Xxy}. 16664 16665@end table 16666 16667The following options control how the assembly code is annotated: 16668 16669@c Assembly annotation options 16670@table @gcctabopt 16671@item -misize 16672@opindex misize 16673Annotate assembler instructions with estimated addresses. 16674 16675@item -mannotate-align 16676@opindex mannotate-align 16677Explain what alignment considerations lead to the decision to make an 16678instruction short or long. 16679 16680@end table 16681 16682The following options are passed through to the linker: 16683 16684@c options passed through to the linker 16685@table @gcctabopt 16686@item -marclinux 16687@opindex marclinux 16688Passed through to the linker, to specify use of the @code{arclinux} emulation. 16689This option is enabled by default in tool chains built for 16690@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 16691when profiling is not requested. 16692 16693@item -marclinux_prof 16694@opindex marclinux_prof 16695Passed through to the linker, to specify use of the 16696@code{arclinux_prof} emulation. This option is enabled by default in 16697tool chains built for @w{@code{arc-linux-uclibc}} and 16698@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 16699 16700@end table 16701 16702The following options control the semantics of generated code: 16703 16704@c semantically relevant code generation options 16705@table @gcctabopt 16706@item -mlong-calls 16707@opindex mlong-calls 16708Generate calls as register indirect calls, thus providing access 16709to the full 32-bit address range. 16710 16711@item -mmedium-calls 16712@opindex mmedium-calls 16713Don't use less than 25-bit addressing range for calls, which is the 16714offset available for an unconditional branch-and-link 16715instruction. Conditional execution of function calls is suppressed, to 16716allow use of the 25-bit range, rather than the 21-bit range with 16717conditional branch-and-link. This is the default for tool chains built 16718for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 16719 16720@item -G @var{num} 16721@opindex G 16722Put definitions of externally-visible data in a small data section if 16723that data is no bigger than @var{num} bytes. The default value of 16724@var{num} is 4 for any ARC configuration, or 8 when we have double 16725load/store operations. 16726 16727@item -mno-sdata 16728@opindex mno-sdata 16729@opindex msdata 16730Do not generate sdata references. This is the default for tool chains 16731built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 16732targets. 16733 16734@item -mvolatile-cache 16735@opindex mvolatile-cache 16736Use ordinarily cached memory accesses for volatile references. This is the 16737default. 16738 16739@item -mno-volatile-cache 16740@opindex mno-volatile-cache 16741@opindex mvolatile-cache 16742Enable cache bypass for volatile references. 16743 16744@end table 16745 16746The following options fine tune code generation: 16747@c code generation tuning options 16748@table @gcctabopt 16749@item -malign-call 16750@opindex malign-call 16751Do alignment optimizations for call instructions. 16752 16753@item -mauto-modify-reg 16754@opindex mauto-modify-reg 16755Enable the use of pre/post modify with register displacement. 16756 16757@item -mbbit-peephole 16758@opindex mbbit-peephole 16759Enable bbit peephole2. 16760 16761@item -mno-brcc 16762@opindex mno-brcc 16763This option disables a target-specific pass in @file{arc_reorg} to 16764generate compare-and-branch (@code{br@var{cc}}) instructions. 16765It has no effect on 16766generation of these instructions driven by the combiner pass. 16767 16768@item -mcase-vector-pcrel 16769@opindex mcase-vector-pcrel 16770Use PC-relative switch case tables to enable case table shortening. 16771This is the default for @option{-Os}. 16772 16773@item -mcompact-casesi 16774@opindex mcompact-casesi 16775Enable compact @code{casesi} pattern. This is the default for @option{-Os}, 16776and only available for ARCv1 cores. This option is deprecated. 16777 16778@item -mno-cond-exec 16779@opindex mno-cond-exec 16780Disable the ARCompact-specific pass to generate conditional 16781execution instructions. 16782 16783Due to delay slot scheduling and interactions between operand numbers, 16784literal sizes, instruction lengths, and the support for conditional execution, 16785the target-independent pass to generate conditional execution is often lacking, 16786so the ARC port has kept a special pass around that tries to find more 16787conditional execution generation opportunities after register allocation, 16788branch shortening, and delay slot scheduling have been done. This pass 16789generally, but not always, improves performance and code size, at the cost of 16790extra compilation time, which is why there is an option to switch it off. 16791If you have a problem with call instructions exceeding their allowable 16792offset range because they are conditionalized, you should consider using 16793@option{-mmedium-calls} instead. 16794 16795@item -mearly-cbranchsi 16796@opindex mearly-cbranchsi 16797Enable pre-reload use of the @code{cbranchsi} pattern. 16798 16799@item -mexpand-adddi 16800@opindex mexpand-adddi 16801Expand @code{adddi3} and @code{subdi3} at RTL generation time into 16802@code{add.f}, @code{adc} etc. This option is deprecated. 16803 16804@item -mindexed-loads 16805@opindex mindexed-loads 16806Enable the use of indexed loads. This can be problematic because some 16807optimizers then assume that indexed stores exist, which is not 16808the case. 16809 16810@item -mlra 16811@opindex mlra 16812Enable Local Register Allocation. This is still experimental for ARC, 16813so by default the compiler uses standard reload 16814(i.e.@: @option{-mno-lra}). 16815 16816@item -mlra-priority-none 16817@opindex mlra-priority-none 16818Don't indicate any priority for target registers. 16819 16820@item -mlra-priority-compact 16821@opindex mlra-priority-compact 16822Indicate target register priority for r0..r3 / r12..r15. 16823 16824@item -mlra-priority-noncompact 16825@opindex mlra-priority-noncompact 16826Reduce target register priority for r0..r3 / r12..r15. 16827 16828@item -mmillicode 16829@opindex mmillicode 16830When optimizing for size (using @option{-Os}), prologues and epilogues 16831that have to save or restore a large number of registers are often 16832shortened by using call to a special function in libgcc; this is 16833referred to as a @emph{millicode} call. As these calls can pose 16834performance issues, and/or cause linking issues when linking in a 16835nonstandard way, this option is provided to turn on or off millicode 16836call generation. 16837 16838@item -mcode-density-frame 16839@opindex mcode-density-frame 16840This option enable the compiler to emit @code{enter} and @code{leave} 16841instructions. These instructions are only valid for CPUs with 16842code-density feature. 16843 16844@item -mmixed-code 16845@opindex mmixed-code 16846Tweak register allocation to help 16-bit instruction generation. 16847This generally has the effect of decreasing the average instruction size 16848while increasing the instruction count. 16849 16850@item -mq-class 16851@opindex mq-class 16852Enable @samp{q} instruction alternatives. 16853This is the default for @option{-Os}. 16854 16855@item -mRcq 16856@opindex mRcq 16857Enable @samp{Rcq} constraint handling. 16858Most short code generation depends on this. 16859This is the default. 16860 16861@item -mRcw 16862@opindex mRcw 16863Enable @samp{Rcw} constraint handling. 16864Most ccfsm condexec mostly depends on this. 16865This is the default. 16866 16867@item -msize-level=@var{level} 16868@opindex msize-level 16869Fine-tune size optimization with regards to instruction lengths and alignment. 16870The recognized values for @var{level} are: 16871@table @samp 16872@item 0 16873No size optimization. This level is deprecated and treated like @samp{1}. 16874 16875@item 1 16876Short instructions are used opportunistically. 16877 16878@item 2 16879In addition, alignment of loops and of code after barriers are dropped. 16880 16881@item 3 16882In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 16883 16884@end table 16885 16886This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 16887the behavior when this is not set is equivalent to level @samp{1}. 16888 16889@item -mtune=@var{cpu} 16890@opindex mtune 16891Set instruction scheduling parameters for @var{cpu}, overriding any implied 16892by @option{-mcpu=}. 16893 16894Supported values for @var{cpu} are 16895 16896@table @samp 16897@item ARC600 16898Tune for ARC600 CPU. 16899 16900@item ARC601 16901Tune for ARC601 CPU. 16902 16903@item ARC700 16904Tune for ARC700 CPU with standard multiplier block. 16905 16906@item ARC700-xmac 16907Tune for ARC700 CPU with XMAC block. 16908 16909@item ARC725D 16910Tune for ARC725D CPU. 16911 16912@item ARC750D 16913Tune for ARC750D CPU. 16914 16915@end table 16916 16917@item -mmultcost=@var{num} 16918@opindex mmultcost 16919Cost to assume for a multiply instruction, with @samp{4} being equal to a 16920normal instruction. 16921 16922@item -munalign-prob-threshold=@var{probability} 16923@opindex munalign-prob-threshold 16924Set probability threshold for unaligning branches. 16925When tuning for @samp{ARC700} and optimizing for speed, branches without 16926filled delay slot are preferably emitted unaligned and long, unless 16927profiling indicates that the probability for the branch to be taken 16928is below @var{probability}. @xref{Cross-profiling}. 16929The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. 16930 16931@end table 16932 16933The following options are maintained for backward compatibility, but 16934are now deprecated and will be removed in a future release: 16935 16936@c Deprecated options 16937@table @gcctabopt 16938 16939@item -margonaut 16940@opindex margonaut 16941Obsolete FPX. 16942 16943@item -mbig-endian 16944@opindex mbig-endian 16945@itemx -EB 16946@opindex EB 16947Compile code for big-endian targets. Use of these options is now 16948deprecated. Big-endian code is supported by configuring GCC to build 16949@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets, 16950for which big endian is the default. 16951 16952@item -mlittle-endian 16953@opindex mlittle-endian 16954@itemx -EL 16955@opindex EL 16956Compile code for little-endian targets. Use of these options is now 16957deprecated. Little-endian code is supported by configuring GCC to build 16958@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets, 16959for which little endian is the default. 16960 16961@item -mbarrel_shifter 16962@opindex mbarrel_shifter 16963Replaced by @option{-mbarrel-shifter}. 16964 16965@item -mdpfp_compact 16966@opindex mdpfp_compact 16967Replaced by @option{-mdpfp-compact}. 16968 16969@item -mdpfp_fast 16970@opindex mdpfp_fast 16971Replaced by @option{-mdpfp-fast}. 16972 16973@item -mdsp_packa 16974@opindex mdsp_packa 16975Replaced by @option{-mdsp-packa}. 16976 16977@item -mEA 16978@opindex mEA 16979Replaced by @option{-mea}. 16980 16981@item -mmac_24 16982@opindex mmac_24 16983Replaced by @option{-mmac-24}. 16984 16985@item -mmac_d16 16986@opindex mmac_d16 16987Replaced by @option{-mmac-d16}. 16988 16989@item -mspfp_compact 16990@opindex mspfp_compact 16991Replaced by @option{-mspfp-compact}. 16992 16993@item -mspfp_fast 16994@opindex mspfp_fast 16995Replaced by @option{-mspfp-fast}. 16996 16997@item -mtune=@var{cpu} 16998@opindex mtune 16999Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 17000@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 17001@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively. 17002 17003@item -multcost=@var{num} 17004@opindex multcost 17005Replaced by @option{-mmultcost}. 17006 17007@end table 17008 17009@node ARM Options 17010@subsection ARM Options 17011@cindex ARM options 17012 17013These @samp{-m} options are defined for the ARM port: 17014 17015@table @gcctabopt 17016@item -mabi=@var{name} 17017@opindex mabi 17018Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 17019@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 17020 17021@item -mapcs-frame 17022@opindex mapcs-frame 17023Generate a stack frame that is compliant with the ARM Procedure Call 17024Standard for all functions, even if this is not strictly necessary for 17025correct execution of the code. Specifying @option{-fomit-frame-pointer} 17026with this option causes the stack frames not to be generated for 17027leaf functions. The default is @option{-mno-apcs-frame}. 17028This option is deprecated. 17029 17030@item -mapcs 17031@opindex mapcs 17032This is a synonym for @option{-mapcs-frame} and is deprecated. 17033 17034@ignore 17035@c not currently implemented 17036@item -mapcs-stack-check 17037@opindex mapcs-stack-check 17038Generate code to check the amount of stack space available upon entry to 17039every function (that actually uses some stack space). If there is 17040insufficient space available then either the function 17041@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 17042called, depending upon the amount of stack space required. The runtime 17043system is required to provide these functions. The default is 17044@option{-mno-apcs-stack-check}, since this produces smaller code. 17045 17046@c not currently implemented 17047@item -mapcs-reentrant 17048@opindex mapcs-reentrant 17049Generate reentrant, position-independent code. The default is 17050@option{-mno-apcs-reentrant}. 17051@end ignore 17052 17053@item -mthumb-interwork 17054@opindex mthumb-interwork 17055Generate code that supports calling between the ARM and Thumb 17056instruction sets. Without this option, on pre-v5 architectures, the 17057two instruction sets cannot be reliably used inside one program. The 17058default is @option{-mno-thumb-interwork}, since slightly larger code 17059is generated when @option{-mthumb-interwork} is specified. In AAPCS 17060configurations this option is meaningless. 17061 17062@item -mno-sched-prolog 17063@opindex mno-sched-prolog 17064@opindex msched-prolog 17065Prevent the reordering of instructions in the function prologue, or the 17066merging of those instruction with the instructions in the function's 17067body. This means that all functions start with a recognizable set 17068of instructions (or in fact one of a choice from a small set of 17069different function prologues), and this information can be used to 17070locate the start of functions inside an executable piece of code. The 17071default is @option{-msched-prolog}. 17072 17073@item -mfloat-abi=@var{name} 17074@opindex mfloat-abi 17075Specifies which floating-point ABI to use. Permissible values 17076are: @samp{soft}, @samp{softfp} and @samp{hard}. 17077 17078Specifying @samp{soft} causes GCC to generate output containing 17079library calls for floating-point operations. 17080@samp{softfp} allows the generation of code using hardware floating-point 17081instructions, but still uses the soft-float calling conventions. 17082@samp{hard} allows generation of floating-point instructions 17083and uses FPU-specific calling conventions. 17084 17085The default depends on the specific target configuration. Note that 17086the hard-float and soft-float ABIs are not link-compatible; you must 17087compile your entire program with the same ABI, and link with a 17088compatible set of libraries. 17089 17090@item -mgeneral-regs-only 17091@opindex mgeneral-regs-only 17092Generate code which uses only the general-purpose registers. This will prevent 17093the compiler from using floating-point and Advanced SIMD registers but will not 17094impose any restrictions on the assembler. 17095 17096@item -mlittle-endian 17097@opindex mlittle-endian 17098Generate code for a processor running in little-endian mode. This is 17099the default for all standard configurations. 17100 17101@item -mbig-endian 17102@opindex mbig-endian 17103Generate code for a processor running in big-endian mode; the default is 17104to compile code for a little-endian processor. 17105 17106@item -mbe8 17107@itemx -mbe32 17108@opindex mbe8 17109When linking a big-endian image select between BE8 and BE32 formats. 17110The option has no effect for little-endian images and is ignored. The 17111default is dependent on the selected target architecture. For ARMv6 17112and later architectures the default is BE8, for older architectures 17113the default is BE32. BE32 format has been deprecated by ARM. 17114 17115@item -march=@var{name}@r{[}+extension@dots{}@r{]} 17116@opindex march 17117This specifies the name of the target ARM architecture. GCC uses this 17118name to determine what kind of instructions it can emit when generating 17119assembly code. This option can be used in conjunction with or instead 17120of the @option{-mcpu=} option. 17121 17122Permissible names are: 17123@samp{armv4t}, 17124@samp{armv5t}, @samp{armv5te}, 17125@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2}, 17126@samp{armv6z}, @samp{armv6zk}, 17127@samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 17128@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, 17129@samp{armv8.4-a}, 17130@samp{armv8.5-a}, 17131@samp{armv7-r}, 17132@samp{armv8-r}, 17133@samp{armv6-m}, @samp{armv6s-m}, 17134@samp{armv7-m}, @samp{armv7e-m}, 17135@samp{armv8-m.base}, @samp{armv8-m.main}, 17136@samp{iwmmxt} and @samp{iwmmxt2}. 17137 17138Additionally, the following architectures, which lack support for the 17139Thumb execution state, are recognized but support is deprecated: @samp{armv4}. 17140 17141Many of the architectures support extensions. These can be added by 17142appending @samp{+@var{extension}} to the architecture name. Extension 17143options are processed in order and capabilities accumulate. An extension 17144will also enable any necessary base extensions 17145upon which it depends. For example, the @samp{+crypto} extension 17146will always enable the @samp{+simd} extension. The exception to the 17147additive construction is for extensions that are prefixed with 17148@samp{+no@dots{}}: these extensions disable the specified option and 17149any other extensions that may depend on the presence of that 17150extension. 17151 17152For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to 17153writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is 17154entirely disabled by the @samp{+nofp} option that follows it. 17155 17156Most extension names are generically named, but have an effect that is 17157dependent upon the architecture to which it is applied. For example, 17158the @samp{+simd} option can be applied to both @samp{armv7-a} and 17159@samp{armv8-a} architectures, but will enable the original ARMv7-A 17160Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A 17161variant for @samp{armv8-a}. 17162 17163The table below lists the supported extensions for each architecture. 17164Architectures not mentioned do not support any extensions. 17165 17166@table @samp 17167@item armv5te 17168@itemx armv6 17169@itemx armv6j 17170@itemx armv6k 17171@itemx armv6kz 17172@itemx armv6t2 17173@itemx armv6z 17174@itemx armv6zk 17175@table @samp 17176@item +fp 17177The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be 17178used as an alias for this extension. 17179 17180@item +nofp 17181Disable the floating-point instructions. 17182@end table 17183 17184@item armv7 17185The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures. 17186@table @samp 17187@item +fp 17188The VFPv3 floating-point instructions, with 16 double-precision 17189registers. The extension @samp{+vfpv3-d16} can be used as an alias 17190for this extension. Note that floating-point is not supported by the 17191base ARMv7-M architecture, but is compatible with both the ARMv7-A and 17192ARMv7-R architectures. 17193 17194@item +nofp 17195Disable the floating-point instructions. 17196@end table 17197 17198@item armv7-a 17199@table @samp 17200@item +mp 17201The multiprocessing extension. 17202 17203@item +sec 17204The security extension. 17205 17206@item +fp 17207The VFPv3 floating-point instructions, with 16 double-precision 17208registers. The extension @samp{+vfpv3-d16} can be used as an alias 17209for this extension. 17210 17211@item +simd 17212The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 17213The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases 17214for this extension. 17215 17216@item +vfpv3 17217The VFPv3 floating-point instructions, with 32 double-precision 17218registers. 17219 17220@item +vfpv3-d16-fp16 17221The VFPv3 floating-point instructions, with 16 double-precision 17222registers and the half-precision floating-point conversion operations. 17223 17224@item +vfpv3-fp16 17225The VFPv3 floating-point instructions, with 32 double-precision 17226registers and the half-precision floating-point conversion operations. 17227 17228@item +vfpv4-d16 17229The VFPv4 floating-point instructions, with 16 double-precision 17230registers. 17231 17232@item +vfpv4 17233The VFPv4 floating-point instructions, with 32 double-precision 17234registers. 17235 17236@item +neon-fp16 17237The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 17238the half-precision floating-point conversion operations. 17239 17240@item +neon-vfpv4 17241The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. 17242 17243@item +nosimd 17244Disable the Advanced SIMD instructions (does not disable floating point). 17245 17246@item +nofp 17247Disable the floating-point and Advanced SIMD instructions. 17248@end table 17249 17250@item armv7ve 17251The extended version of the ARMv7-A architecture with support for 17252virtualization. 17253@table @samp 17254@item +fp 17255The VFPv4 floating-point instructions, with 16 double-precision registers. 17256The extension @samp{+vfpv4-d16} can be used as an alias for this extension. 17257 17258@item +simd 17259The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The 17260extension @samp{+neon-vfpv4} can be used as an alias for this extension. 17261 17262@item +vfpv3-d16 17263The VFPv3 floating-point instructions, with 16 double-precision 17264registers. 17265 17266@item +vfpv3 17267The VFPv3 floating-point instructions, with 32 double-precision 17268registers. 17269 17270@item +vfpv3-d16-fp16 17271The VFPv3 floating-point instructions, with 16 double-precision 17272registers and the half-precision floating-point conversion operations. 17273 17274@item +vfpv3-fp16 17275The VFPv3 floating-point instructions, with 32 double-precision 17276registers and the half-precision floating-point conversion operations. 17277 17278@item +vfpv4-d16 17279The VFPv4 floating-point instructions, with 16 double-precision 17280registers. 17281 17282@item +vfpv4 17283The VFPv4 floating-point instructions, with 32 double-precision 17284registers. 17285 17286@item +neon 17287The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 17288The extension @samp{+neon-vfpv3} can be used as an alias for this extension. 17289 17290@item +neon-fp16 17291The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 17292the half-precision floating-point conversion operations. 17293 17294@item +nosimd 17295Disable the Advanced SIMD instructions (does not disable floating point). 17296 17297@item +nofp 17298Disable the floating-point and Advanced SIMD instructions. 17299@end table 17300 17301@item armv8-a 17302@table @samp 17303@item +crc 17304The Cyclic Redundancy Check (CRC) instructions. 17305@item +simd 17306The ARMv8-A Advanced SIMD and floating-point instructions. 17307@item +crypto 17308The cryptographic instructions. 17309@item +nocrypto 17310Disable the cryptographic instructions. 17311@item +nofp 17312Disable the floating-point, Advanced SIMD and cryptographic instructions. 17313@item +sb 17314Speculation Barrier Instruction. 17315@item +predres 17316Execution and Data Prediction Restriction Instructions. 17317@end table 17318 17319@item armv8.1-a 17320@table @samp 17321@item +simd 17322The ARMv8.1-A Advanced SIMD and floating-point instructions. 17323 17324@item +crypto 17325The cryptographic instructions. This also enables the Advanced SIMD and 17326floating-point instructions. 17327 17328@item +nocrypto 17329Disable the cryptographic instructions. 17330 17331@item +nofp 17332Disable the floating-point, Advanced SIMD and cryptographic instructions. 17333 17334@item +sb 17335Speculation Barrier Instruction. 17336 17337@item +predres 17338Execution and Data Prediction Restriction Instructions. 17339@end table 17340 17341@item armv8.2-a 17342@itemx armv8.3-a 17343@table @samp 17344@item +fp16 17345The half-precision floating-point data processing instructions. 17346This also enables the Advanced SIMD and floating-point instructions. 17347 17348@item +fp16fml 17349The half-precision floating-point fmla extension. This also enables 17350the half-precision floating-point extension and Advanced SIMD and 17351floating-point instructions. 17352 17353@item +simd 17354The ARMv8.1-A Advanced SIMD and floating-point instructions. 17355 17356@item +crypto 17357The cryptographic instructions. This also enables the Advanced SIMD and 17358floating-point instructions. 17359 17360@item +dotprod 17361Enable the Dot Product extension. This also enables Advanced SIMD instructions. 17362 17363@item +nocrypto 17364Disable the cryptographic extension. 17365 17366@item +nofp 17367Disable the floating-point, Advanced SIMD and cryptographic instructions. 17368 17369@item +sb 17370Speculation Barrier Instruction. 17371 17372@item +predres 17373Execution and Data Prediction Restriction Instructions. 17374@end table 17375 17376@item armv8.4-a 17377@table @samp 17378@item +fp16 17379The half-precision floating-point data processing instructions. 17380This also enables the Advanced SIMD and floating-point instructions as well 17381as the Dot Product extension and the half-precision floating-point fmla 17382extension. 17383 17384@item +simd 17385The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 17386Dot Product extension. 17387 17388@item +crypto 17389The cryptographic instructions. This also enables the Advanced SIMD and 17390floating-point instructions as well as the Dot Product extension. 17391 17392@item +nocrypto 17393Disable the cryptographic extension. 17394 17395@item +nofp 17396Disable the floating-point, Advanced SIMD and cryptographic instructions. 17397 17398@item +sb 17399Speculation Barrier Instruction. 17400 17401@item +predres 17402Execution and Data Prediction Restriction Instructions. 17403@end table 17404 17405@item armv8.5-a 17406@table @samp 17407@item +fp16 17408The half-precision floating-point data processing instructions. 17409This also enables the Advanced SIMD and floating-point instructions as well 17410as the Dot Product extension and the half-precision floating-point fmla 17411extension. 17412 17413@item +simd 17414The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 17415Dot Product extension. 17416 17417@item +crypto 17418The cryptographic instructions. This also enables the Advanced SIMD and 17419floating-point instructions as well as the Dot Product extension. 17420 17421@item +nocrypto 17422Disable the cryptographic extension. 17423 17424@item +nofp 17425Disable the floating-point, Advanced SIMD and cryptographic instructions. 17426@end table 17427 17428@item armv7-r 17429@table @samp 17430@item +fp.sp 17431The single-precision VFPv3 floating-point instructions. The extension 17432@samp{+vfpv3xd} can be used as an alias for this extension. 17433 17434@item +fp 17435The VFPv3 floating-point instructions with 16 double-precision registers. 17436The extension +vfpv3-d16 can be used as an alias for this extension. 17437 17438@item +vfpv3xd-d16-fp16 17439The single-precision VFPv3 floating-point instructions with 16 double-precision 17440registers and the half-precision floating-point conversion operations. 17441 17442@item +vfpv3-d16-fp16 17443The VFPv3 floating-point instructions with 16 double-precision 17444registers and the half-precision floating-point conversion operations. 17445 17446@item +nofp 17447Disable the floating-point extension. 17448 17449@item +idiv 17450The ARM-state integer division instructions. 17451 17452@item +noidiv 17453Disable the ARM-state integer division extension. 17454@end table 17455 17456@item armv7e-m 17457@table @samp 17458@item +fp 17459The single-precision VFPv4 floating-point instructions. 17460 17461@item +fpv5 17462The single-precision FPv5 floating-point instructions. 17463 17464@item +fp.dp 17465The single- and double-precision FPv5 floating-point instructions. 17466 17467@item +nofp 17468Disable the floating-point extensions. 17469@end table 17470 17471@item armv8-m.main 17472@table @samp 17473@item +dsp 17474The DSP instructions. 17475 17476@item +nodsp 17477Disable the DSP extension. 17478 17479@item +fp 17480The single-precision floating-point instructions. 17481 17482@item +fp.dp 17483The single- and double-precision floating-point instructions. 17484 17485@item +nofp 17486Disable the floating-point extension. 17487@end table 17488 17489@item armv8-r 17490@table @samp 17491@item +crc 17492The Cyclic Redundancy Check (CRC) instructions. 17493@item +fp.sp 17494The single-precision FPv5 floating-point instructions. 17495@item +simd 17496The ARMv8-A Advanced SIMD and floating-point instructions. 17497@item +crypto 17498The cryptographic instructions. 17499@item +nocrypto 17500Disable the cryptographic instructions. 17501@item +nofp 17502Disable the floating-point, Advanced SIMD and cryptographic instructions. 17503@end table 17504 17505@end table 17506 17507@option{-march=native} causes the compiler to auto-detect the architecture 17508of the build computer. At present, this feature is only supported on 17509GNU/Linux, and not all architectures are recognized. If the auto-detect 17510is unsuccessful the option has no effect. 17511 17512@item -mtune=@var{name} 17513@opindex mtune 17514This option specifies the name of the target ARM processor for 17515which GCC should tune the performance of the code. 17516For some ARM implementations better performance can be obtained by using 17517this option. 17518Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t}, 17519@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110}, 17520@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810}, 17521@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t}, 17522@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s}, 17523@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t}, 17524@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 17525@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 17526@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 17527@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, 17528@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17}, 17529@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 17530@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 17531@samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, 17532@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, 17533@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3}, 17534@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33}, 17535@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply}, 17536@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4}, 17537@samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, 17538@samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te}, 17539@samp{fmp626}, @samp{fa726te}, @samp{xgene1}. 17540 17541Additionally, this option can specify that GCC should tune the performance 17542of the code for a big.LITTLE system. Permissible names are: 17543@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7}, 17544@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 17545@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}, 17546@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}. 17547 17548@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 17549performance for a blend of processors within architecture @var{arch}. 17550The aim is to generate code that run well on the current most popular 17551processors, balancing between optimizations that benefit some CPUs in the 17552range, and avoiding performance pitfalls of other CPUs. The effects of 17553this option may change in future GCC versions as CPU models come and go. 17554 17555@option{-mtune} permits the same extension options as @option{-mcpu}, but 17556the extension options do not affect the tuning of the generated code. 17557 17558@option{-mtune=native} causes the compiler to auto-detect the CPU 17559of the build computer. At present, this feature is only supported on 17560GNU/Linux, and not all architectures are recognized. If the auto-detect is 17561unsuccessful the option has no effect. 17562 17563@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]} 17564@opindex mcpu 17565This specifies the name of the target ARM processor. GCC uses this name 17566to derive the name of the target ARM architecture (as if specified 17567by @option{-march}) and the ARM processor type for which to tune for 17568performance (as if specified by @option{-mtune}). Where this option 17569is used in conjunction with @option{-march} or @option{-mtune}, 17570those options take precedence over the appropriate part of this option. 17571 17572Many of the supported CPUs implement optional architectural 17573extensions. Where this is so the architectural extensions are 17574normally enabled by default. If implementations that lack the 17575extension exist, then the extension syntax can be used to disable 17576those extensions that have been omitted. For floating-point and 17577Advanced SIMD (Neon) instructions, the settings of the options 17578@option{-mfloat-abi} and @option{-mfpu} must also be considered: 17579floating-point and Advanced SIMD instructions will only be used if 17580@option{-mfloat-abi} is not set to @samp{soft}; and any setting of 17581@option{-mfpu} other than @samp{auto} will override the available 17582floating-point and SIMD extension instructions. 17583 17584For example, @samp{cortex-a9} can be found in three major 17585configurations: integer only, with just a floating-point unit or with 17586floating-point and Advanced SIMD. The default is to enable all the 17587instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can 17588be used to disable just the SIMD or both the SIMD and floating-point 17589instructions respectively. 17590 17591Permissible names for this option are the same as those for 17592@option{-mtune}. 17593 17594The following extension options are common to the listed CPUs: 17595 17596@table @samp 17597@item +nodsp 17598Disable the DSP instructions on @samp{cortex-m33}. 17599 17600@item +nofp 17601Disables the floating-point instructions on @samp{arm9e}, 17602@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e}, 17603@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s}, 17604@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, 17605@samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}. 17606Disables the floating-point and SIMD instructions on 17607@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, 17608@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12}, 17609@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7}, 17610@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35}, 17611@samp{cortex-a53} and @samp{cortex-a55}. 17612 17613@item +nofp.dp 17614Disables the double-precision component of the floating-point instructions 17615on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and 17616@samp{cortex-m7}. 17617 17618@item +nosimd 17619Disables the SIMD (but not floating-point) instructions on 17620@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7} 17621and @samp{cortex-a9}. 17622 17623@item +crypto 17624Enables the cryptographic instructions on @samp{cortex-a32}, 17625@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57}, 17626@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1}, 17627@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 17628@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and 17629@samp{cortex-a75.cortex-a55}. 17630@end table 17631 17632Additionally the @samp{generic-armv7-a} pseudo target defaults to 17633VFPv3 with 16 double-precision registers. It supports the following 17634extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16}, 17635@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, 17636@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, 17637@samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for 17638the extensions to @option{-march=armv7-a}. 17639 17640@option{-mcpu=generic-@var{arch}} is also permissible, and is 17641equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 17642See @option{-mtune} for more information. 17643 17644@option{-mcpu=native} causes the compiler to auto-detect the CPU 17645of the build computer. At present, this feature is only supported on 17646GNU/Linux, and not all architectures are recognized. If the auto-detect 17647is unsuccessful the option has no effect. 17648 17649@item -mfpu=@var{name} 17650@opindex mfpu 17651This specifies what floating-point hardware (or hardware emulation) is 17652available on the target. Permissible names are: @samp{auto}, @samp{vfpv2}, 17653@samp{vfpv3}, 17654@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 17655@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4}, 17656@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 17657@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 17658@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}. 17659Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp} 17660is an alias for @samp{vfpv2}. 17661 17662The setting @samp{auto} is the default and is special. It causes the 17663compiler to select the floating-point and Advanced SIMD instructions 17664based on the settings of @option{-mcpu} and @option{-march}. 17665 17666If the selected floating-point hardware includes the NEON extension 17667(e.g.@: @option{-mfpu=neon}), note that floating-point 17668operations are not generated by GCC's auto-vectorization pass unless 17669@option{-funsafe-math-optimizations} is also specified. This is 17670because NEON hardware does not fully implement the IEEE 754 standard for 17671floating-point arithmetic (in particular denormal values are treated as 17672zero), so the use of NEON instructions may lead to a loss of precision. 17673 17674You can also set the fpu name at function level by using the @code{target("fpu=")} function attributes (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}). 17675 17676@item -mfp16-format=@var{name} 17677@opindex mfp16-format 17678Specify the format of the @code{__fp16} half-precision floating-point type. 17679Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 17680the default is @samp{none}, in which case the @code{__fp16} type is not 17681defined. @xref{Half-Precision}, for more information. 17682 17683@item -mstructure-size-boundary=@var{n} 17684@opindex mstructure-size-boundary 17685The sizes of all structures and unions are rounded up to a multiple 17686of the number of bits set by this option. Permissible values are 8, 32 17687and 64. The default value varies for different toolchains. For the COFF 17688targeted toolchain the default value is 8. A value of 64 is only allowed 17689if the underlying ABI supports it. 17690 17691Specifying a larger number can produce faster, more efficient code, but 17692can also increase the size of the program. Different values are potentially 17693incompatible. Code compiled with one value cannot necessarily expect to 17694work with code or libraries compiled with another value, if they exchange 17695information using structures or unions. 17696 17697This option is deprecated. 17698 17699@item -mabort-on-noreturn 17700@opindex mabort-on-noreturn 17701Generate a call to the function @code{abort} at the end of a 17702@code{noreturn} function. It is executed if the function tries to 17703return. 17704 17705@item -mlong-calls 17706@itemx -mno-long-calls 17707@opindex mlong-calls 17708@opindex mno-long-calls 17709Tells the compiler to perform function calls by first loading the 17710address of the function into a register and then performing a subroutine 17711call on this register. This switch is needed if the target function 17712lies outside of the 64-megabyte addressing range of the offset-based 17713version of subroutine call instruction. 17714 17715Even if this switch is enabled, not all function calls are turned 17716into long calls. The heuristic is that static functions, functions 17717that have the @code{short_call} attribute, functions that are inside 17718the scope of a @code{#pragma no_long_calls} directive, and functions whose 17719definitions have already been compiled within the current compilation 17720unit are not turned into long calls. The exceptions to this rule are 17721that weak function definitions, functions with the @code{long_call} 17722attribute or the @code{section} attribute, and functions that are within 17723the scope of a @code{#pragma long_calls} directive are always 17724turned into long calls. 17725 17726This feature is not enabled by default. Specifying 17727@option{-mno-long-calls} restores the default behavior, as does 17728placing the function calls within the scope of a @code{#pragma 17729long_calls_off} directive. Note these switches have no effect on how 17730the compiler generates code to handle function calls via function 17731pointers. 17732 17733@item -msingle-pic-base 17734@opindex msingle-pic-base 17735Treat the register used for PIC addressing as read-only, rather than 17736loading it in the prologue for each function. The runtime system is 17737responsible for initializing this register with an appropriate value 17738before execution begins. 17739 17740@item -mpic-register=@var{reg} 17741@opindex mpic-register 17742Specify the register to be used for PIC addressing. 17743For standard PIC base case, the default is any suitable register 17744determined by compiler. For single PIC base case, the default is 17745@samp{R9} if target is EABI based or stack-checking is enabled, 17746otherwise the default is @samp{R10}. 17747 17748@item -mpic-data-is-text-relative 17749@opindex mpic-data-is-text-relative 17750Assume that the displacement between the text and data segments is fixed 17751at static link time. This permits using PC-relative addressing 17752operations to access data known to be in the data segment. For 17753non-VxWorks RTP targets, this option is enabled by default. When 17754disabled on such targets, it will enable @option{-msingle-pic-base} by 17755default. 17756 17757@item -mpoke-function-name 17758@opindex mpoke-function-name 17759Write the name of each function into the text section, directly 17760preceding the function prologue. The generated code is similar to this: 17761 17762@smallexample 17763 t0 17764 .ascii "arm_poke_function_name", 0 17765 .align 17766 t1 17767 .word 0xff000000 + (t1 - t0) 17768 arm_poke_function_name 17769 mov ip, sp 17770 stmfd sp!, @{fp, ip, lr, pc@} 17771 sub fp, ip, #4 17772@end smallexample 17773 17774When performing a stack backtrace, code can inspect the value of 17775@code{pc} stored at @code{fp + 0}. If the trace function then looks at 17776location @code{pc - 12} and the top 8 bits are set, then we know that 17777there is a function name embedded immediately preceding this location 17778and has length @code{((pc[-3]) & 0xff000000)}. 17779 17780@item -mthumb 17781@itemx -marm 17782@opindex marm 17783@opindex mthumb 17784 17785Select between generating code that executes in ARM and Thumb 17786states. The default for most configurations is to generate code 17787that executes in ARM state, but the default can be changed by 17788configuring GCC with the @option{--with-mode=}@var{state} 17789configure option. 17790 17791You can also override the ARM and Thumb mode for each function 17792by using the @code{target("thumb")} and @code{target("arm")} function attributes 17793(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}). 17794 17795@item -mflip-thumb 17796@opindex mflip-thumb 17797Switch ARM/Thumb modes on alternating functions. 17798This option is provided for regression testing of mixed Thumb/ARM code 17799generation, and is not intended for ordinary use in compiling code. 17800 17801@item -mtpcs-frame 17802@opindex mtpcs-frame 17803Generate a stack frame that is compliant with the Thumb Procedure Call 17804Standard for all non-leaf functions. (A leaf function is one that does 17805not call any other functions.) The default is @option{-mno-tpcs-frame}. 17806 17807@item -mtpcs-leaf-frame 17808@opindex mtpcs-leaf-frame 17809Generate a stack frame that is compliant with the Thumb Procedure Call 17810Standard for all leaf functions. (A leaf function is one that does 17811not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 17812 17813@item -mcallee-super-interworking 17814@opindex mcallee-super-interworking 17815Gives all externally visible functions in the file being compiled an ARM 17816instruction set header which switches to Thumb mode before executing the 17817rest of the function. This allows these functions to be called from 17818non-interworking code. This option is not valid in AAPCS configurations 17819because interworking is enabled by default. 17820 17821@item -mcaller-super-interworking 17822@opindex mcaller-super-interworking 17823Allows calls via function pointers (including virtual functions) to 17824execute correctly regardless of whether the target code has been 17825compiled for interworking or not. There is a small overhead in the cost 17826of executing a function pointer if this option is enabled. This option 17827is not valid in AAPCS configurations because interworking is enabled 17828by default. 17829 17830@item -mtp=@var{name} 17831@opindex mtp 17832Specify the access model for the thread local storage pointer. The valid 17833models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 17834@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 17835(supported in the arm6k architecture), and @samp{auto}, which uses the 17836best available method for the selected processor. The default setting is 17837@samp{auto}. 17838 17839@item -mtls-dialect=@var{dialect} 17840@opindex mtls-dialect 17841Specify the dialect to use for accessing thread local storage. Two 17842@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 17843@samp{gnu} dialect selects the original GNU scheme for supporting 17844local and global dynamic TLS models. The @samp{gnu2} dialect 17845selects the GNU descriptor scheme, which provides better performance 17846for shared libraries. The GNU descriptor scheme is compatible with 17847the original scheme, but does require new assembler, linker and 17848library support. Initial and local exec TLS models are unaffected by 17849this option and always use the original scheme. 17850 17851@item -mword-relocations 17852@opindex mword-relocations 17853Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32). 17854This is enabled by default on targets (uClinux, SymbianOS) where the runtime 17855loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 17856is specified. This option conflicts with @option{-mslow-flash-data}. 17857 17858@item -mfix-cortex-m3-ldrd 17859@opindex mfix-cortex-m3-ldrd 17860Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 17861with overlapping destination and base registers are used. This option avoids 17862generating these instructions. This option is enabled by default when 17863@option{-mcpu=cortex-m3} is specified. 17864 17865@item -munaligned-access 17866@itemx -mno-unaligned-access 17867@opindex munaligned-access 17868@opindex mno-unaligned-access 17869Enables (or disables) reading and writing of 16- and 32- bit values 17870from addresses that are not 16- or 32- bit aligned. By default 17871unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for 17872ARMv8-M Baseline architectures, and enabled for all other 17873architectures. If unaligned access is not enabled then words in packed 17874data structures are accessed a byte at a time. 17875 17876The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 17877generated object file to either true or false, depending upon the 17878setting of this option. If unaligned access is enabled then the 17879preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 17880defined. 17881 17882@item -mneon-for-64bits 17883@opindex mneon-for-64bits 17884Enables using Neon to handle scalar 64-bits operations. This is 17885disabled by default since the cost of moving data from core registers 17886to Neon is high. 17887 17888@item -mslow-flash-data 17889@opindex mslow-flash-data 17890Assume loading data from flash is slower than fetching instruction. 17891Therefore literal load is minimized for better performance. 17892This option is only supported when compiling for ARMv7 M-profile and 17893off by default. It conflicts with @option{-mword-relocations}. 17894 17895@item -masm-syntax-unified 17896@opindex masm-syntax-unified 17897Assume inline assembler is using unified asm syntax. The default is 17898currently off which implies divided syntax. This option has no impact 17899on Thumb2. However, this may change in future releases of GCC. 17900Divided syntax should be considered deprecated. 17901 17902@item -mrestrict-it 17903@opindex mrestrict-it 17904Restricts generation of IT blocks to conform to the rules of ARMv8-A. 17905IT blocks can only contain a single 16-bit instruction from a select 17906set of instructions. This option is on by default for ARMv8-A Thumb mode. 17907 17908@item -mprint-tune-info 17909@opindex mprint-tune-info 17910Print CPU tuning information as comment in assembler file. This is 17911an option used only for regression testing of the compiler and not 17912intended for ordinary use in compiling code. This option is disabled 17913by default. 17914 17915@item -mverbose-cost-dump 17916@opindex mverbose-cost-dump 17917Enable verbose cost model dumping in the debug dump files. This option is 17918provided for use in debugging the compiler. 17919 17920@item -mpure-code 17921@opindex mpure-code 17922Do not allow constant data to be placed in code sections. 17923Additionally, when compiling for ELF object format give all text sections the 17924ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option 17925is only available when generating non-pic code for M-profile targets. 17926 17927@item -mcmse 17928@opindex mcmse 17929Generate secure code as per the "ARMv8-M Security Extensions: Requirements on 17930Development Tools Engineering Specification", which can be found on 17931@url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}. 17932@end table 17933 17934@node AVR Options 17935@subsection AVR Options 17936@cindex AVR Options 17937 17938These options are defined for AVR implementations: 17939 17940@table @gcctabopt 17941@item -mmcu=@var{mcu} 17942@opindex mmcu 17943Specify Atmel AVR instruction set architectures (ISA) or MCU type. 17944 17945The default for this option is@tie{}@samp{avr2}. 17946 17947GCC supports the following AVR devices and ISAs: 17948 17949@include avr-mmcu.texi 17950 17951@item -mabsdata 17952@opindex mabsdata 17953 17954Assume that all data in static storage can be accessed by LDS / STS 17955instructions. This option has only an effect on reduced Tiny devices like 17956ATtiny40. See also the @code{absdata} 17957@ref{AVR Variable Attributes,variable attribute}. 17958 17959@item -maccumulate-args 17960@opindex maccumulate-args 17961Accumulate outgoing function arguments and acquire/release the needed 17962stack space for outgoing function arguments once in function 17963prologue/epilogue. Without this option, outgoing arguments are pushed 17964before calling a function and popped afterwards. 17965 17966Popping the arguments after the function call can be expensive on 17967AVR so that accumulating the stack space might lead to smaller 17968executables because arguments need not be removed from the 17969stack after such a function call. 17970 17971This option can lead to reduced code size for functions that perform 17972several calls to functions that get their arguments on the stack like 17973calls to printf-like functions. 17974 17975@item -mbranch-cost=@var{cost} 17976@opindex mbranch-cost 17977Set the branch costs for conditional branch instructions to 17978@var{cost}. Reasonable values for @var{cost} are small, non-negative 17979integers. The default branch cost is 0. 17980 17981@item -mcall-prologues 17982@opindex mcall-prologues 17983Functions prologues/epilogues are expanded as calls to appropriate 17984subroutines. Code size is smaller. 17985 17986@item -mgas-isr-prologues 17987@opindex mgas-isr-prologues 17988Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo 17989instruction supported by GNU Binutils. 17990If this option is on, the feature can still be disabled for individual 17991ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}} 17992function attribute. This feature is activated per default 17993if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}), 17994and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}. 17995 17996@item -mint8 17997@opindex mint8 17998Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 17999@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 18000and @code{long long} is 4 bytes. Please note that this option does not 18001conform to the C standards, but it results in smaller code 18002size. 18003 18004@item -mmain-is-OS_task 18005@opindex mmain-is-OS_task 18006Do not save registers in @code{main}. The effect is the same like 18007attaching attribute @ref{AVR Function Attributes,,@code{OS_task}} 18008to @code{main}. It is activated per default if optimization is on. 18009 18010@item -mn-flash=@var{num} 18011@opindex mn-flash 18012Assume that the flash memory has a size of 18013@var{num} times 64@tie{}KiB. 18014 18015@item -mno-interrupts 18016@opindex mno-interrupts 18017Generated code is not compatible with hardware interrupts. 18018Code size is smaller. 18019 18020@item -mrelax 18021@opindex mrelax 18022Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 18023@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 18024Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 18025the assembler's command line and the @option{--relax} option to the 18026linker's command line. 18027 18028Jump relaxing is performed by the linker because jump offsets are not 18029known before code is located. Therefore, the assembler code generated by the 18030compiler is the same, but the instructions in the executable may 18031differ from instructions in the assembler code. 18032 18033Relaxing must be turned on if linker stubs are needed, see the 18034section on @code{EIND} and linker stubs below. 18035 18036@item -mrmw 18037@opindex mrmw 18038Assume that the device supports the Read-Modify-Write 18039instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 18040 18041@item -mshort-calls 18042@opindex mshort-calls 18043 18044Assume that @code{RJMP} and @code{RCALL} can target the whole 18045program memory. 18046 18047This option is used internally for multilib selection. It is 18048not an optimization option, and you don't need to set it by hand. 18049 18050@item -msp8 18051@opindex msp8 18052Treat the stack pointer register as an 8-bit register, 18053i.e.@: assume the high byte of the stack pointer is zero. 18054In general, you don't need to set this option by hand. 18055 18056This option is used internally by the compiler to select and 18057build multilibs for architectures @code{avr2} and @code{avr25}. 18058These architectures mix devices with and without @code{SPH}. 18059For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 18060the compiler driver adds or removes this option from the compiler 18061proper's command line, because the compiler then knows if the device 18062or architecture has an 8-bit stack pointer and thus no @code{SPH} 18063register or not. 18064 18065@item -mstrict-X 18066@opindex mstrict-X 18067Use address register @code{X} in a way proposed by the hardware. This means 18068that @code{X} is only used in indirect, post-increment or 18069pre-decrement addressing. 18070 18071Without this option, the @code{X} register may be used in the same way 18072as @code{Y} or @code{Z} which then is emulated by additional 18073instructions. 18074For example, loading a value with @code{X+const} addressing with a 18075small non-negative @code{const < 64} to a register @var{Rn} is 18076performed as 18077 18078@example 18079adiw r26, const ; X += const 18080ld @var{Rn}, X ; @var{Rn} = *X 18081sbiw r26, const ; X -= const 18082@end example 18083 18084@item -mtiny-stack 18085@opindex mtiny-stack 18086Only change the lower 8@tie{}bits of the stack pointer. 18087 18088@item -mfract-convert-truncate 18089@opindex mfract-convert-truncate 18090Allow to use truncation instead of rounding towards zero for fractional fixed-point types. 18091 18092@item -nodevicelib 18093@opindex nodevicelib 18094Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. 18095 18096@item -nodevicespecs 18097@opindex nodevicespecs 18098Don't add @option{-specs=device-specs/specs-<mcu>} to the compiler driver's 18099command line. The user takes responsibility for supplying the sub-processes 18100like compiler proper, assembler and linker with appropriate command line 18101options. 18102 18103@item -Waddr-space-convert 18104@opindex Waddr-space-convert 18105@opindex Wno-addr-space-convert 18106Warn about conversions between address spaces in the case where the 18107resulting address space is not contained in the incoming address space. 18108 18109@item -Wmisspelled-isr 18110@opindex Wmisspelled-isr 18111@opindex Wno-misspelled-isr 18112Warn if the ISR is misspelled, i.e.@: without __vector prefix. 18113Enabled by default. 18114@end table 18115 18116@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 18117@cindex @code{EIND} 18118Pointers in the implementation are 16@tie{}bits wide. 18119The address of a function or label is represented as word address so 18120that indirect jumps and calls can target any code address in the 18121range of 64@tie{}Ki words. 18122 18123In order to facilitate indirect jump on devices with more than 128@tie{}Ki 18124bytes of program memory space, there is a special function register called 18125@code{EIND} that serves as most significant part of the target address 18126when @code{EICALL} or @code{EIJMP} instructions are used. 18127 18128Indirect jumps and calls on these devices are handled as follows by 18129the compiler and are subject to some limitations: 18130 18131@itemize @bullet 18132 18133@item 18134The compiler never sets @code{EIND}. 18135 18136@item 18137The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP} 18138instructions or might read @code{EIND} directly in order to emulate an 18139indirect call/jump by means of a @code{RET} instruction. 18140 18141@item 18142The compiler assumes that @code{EIND} never changes during the startup 18143code or during the application. In particular, @code{EIND} is not 18144saved/restored in function or interrupt service routine 18145prologue/epilogue. 18146 18147@item 18148For indirect calls to functions and computed goto, the linker 18149generates @emph{stubs}. Stubs are jump pads sometimes also called 18150@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 18151The stub contains a direct jump to the desired address. 18152 18153@item 18154Linker relaxation must be turned on so that the linker generates 18155the stubs correctly in all situations. See the compiler option 18156@option{-mrelax} and the linker option @option{--relax}. 18157There are corner cases where the linker is supposed to generate stubs 18158but aborts without relaxation and without a helpful error message. 18159 18160@item 18161The default linker script is arranged for code with @code{EIND = 0}. 18162If code is supposed to work for a setup with @code{EIND != 0}, a custom 18163linker script has to be used in order to place the sections whose 18164name start with @code{.trampolines} into the segment where @code{EIND} 18165points to. 18166 18167@item 18168The startup code from libgcc never sets @code{EIND}. 18169Notice that startup code is a blend of code from libgcc and AVR-LibC. 18170For the impact of AVR-LibC on @code{EIND}, see the 18171@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 18172 18173@item 18174It is legitimate for user-specific startup code to set up @code{EIND} 18175early, for example by means of initialization code located in 18176section @code{.init3}. Such code runs prior to general startup code 18177that initializes RAM and calls constructors, but after the bit 18178of startup code from AVR-LibC that sets @code{EIND} to the segment 18179where the vector table is located. 18180@example 18181#include <avr/io.h> 18182 18183static void 18184__attribute__((section(".init3"),naked,used,no_instrument_function)) 18185init3_set_eind (void) 18186@{ 18187 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 18188 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 18189@} 18190@end example 18191 18192@noindent 18193The @code{__trampolines_start} symbol is defined in the linker script. 18194 18195@item 18196Stubs are generated automatically by the linker if 18197the following two conditions are met: 18198@itemize @minus 18199 18200@item The address of a label is taken by means of the @code{gs} modifier 18201(short for @emph{generate stubs}) like so: 18202@example 18203LDI r24, lo8(gs(@var{func})) 18204LDI r25, hi8(gs(@var{func})) 18205@end example 18206@item The final location of that label is in a code segment 18207@emph{outside} the segment where the stubs are located. 18208@end itemize 18209 18210@item 18211The compiler emits such @code{gs} modifiers for code labels in the 18212following situations: 18213@itemize @minus 18214@item Taking address of a function or code label. 18215@item Computed goto. 18216@item If prologue-save function is used, see @option{-mcall-prologues} 18217command-line option. 18218@item Switch/case dispatch tables. If you do not want such dispatch 18219tables you can specify the @option{-fno-jump-tables} command-line option. 18220@item C and C++ constructors/destructors called during startup/shutdown. 18221@item If the tools hit a @code{gs()} modifier explained above. 18222@end itemize 18223 18224@item 18225Jumping to non-symbolic addresses like so is @emph{not} supported: 18226 18227@example 18228int main (void) 18229@{ 18230 /* Call function at word address 0x2 */ 18231 return ((int(*)(void)) 0x2)(); 18232@} 18233@end example 18234 18235Instead, a stub has to be set up, i.e.@: the function has to be called 18236through a symbol (@code{func_4} in the example): 18237 18238@example 18239int main (void) 18240@{ 18241 extern int func_4 (void); 18242 18243 /* Call function at byte address 0x4 */ 18244 return func_4(); 18245@} 18246@end example 18247 18248and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 18249Alternatively, @code{func_4} can be defined in the linker script. 18250@end itemize 18251 18252@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 18253@cindex @code{RAMPD} 18254@cindex @code{RAMPX} 18255@cindex @code{RAMPY} 18256@cindex @code{RAMPZ} 18257Some AVR devices support memories larger than the 64@tie{}KiB range 18258that can be accessed with 16-bit pointers. To access memory locations 18259outside this 64@tie{}KiB range, the content of a @code{RAMP} 18260register is used as high part of the address: 18261The @code{X}, @code{Y}, @code{Z} address register is concatenated 18262with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 18263register, respectively, to get a wide address. Similarly, 18264@code{RAMPD} is used together with direct addressing. 18265 18266@itemize 18267@item 18268The startup code initializes the @code{RAMP} special function 18269registers with zero. 18270 18271@item 18272If a @ref{AVR Named Address Spaces,named address space} other than 18273generic or @code{__flash} is used, then @code{RAMPZ} is set 18274as needed before the operation. 18275 18276@item 18277If the device supports RAM larger than 64@tie{}KiB and the compiler 18278needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 18279is reset to zero after the operation. 18280 18281@item 18282If the device comes with a specific @code{RAMP} register, the ISR 18283prologue/epilogue saves/restores that SFR and initializes it with 18284zero in case the ISR code might (implicitly) use it. 18285 18286@item 18287RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 18288If you use inline assembler to read from locations outside the 1828916-bit address range and change one of the @code{RAMP} registers, 18290you must reset it to zero after the access. 18291 18292@end itemize 18293 18294@subsubsection AVR Built-in Macros 18295 18296GCC defines several built-in macros so that the user code can test 18297for the presence or absence of features. Almost any of the following 18298built-in macros are deduced from device capabilities and thus 18299triggered by the @option{-mmcu=} command-line option. 18300 18301For even more AVR-specific built-in macros see 18302@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 18303 18304@table @code 18305 18306@item __AVR_ARCH__ 18307Build-in macro that resolves to a decimal number that identifies the 18308architecture and depends on the @option{-mmcu=@var{mcu}} option. 18309Possible values are: 18310 18311@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 18312@code{4}, @code{5}, @code{51}, @code{6} 18313 18314for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 18315@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 18316 18317respectively and 18318 18319@code{100}, 18320@code{102}, @code{103}, @code{104}, 18321@code{105}, @code{106}, @code{107} 18322 18323for @var{mcu}=@code{avrtiny}, 18324@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4}, 18325@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 18326If @var{mcu} specifies a device, this built-in macro is set 18327accordingly. For example, with @option{-mmcu=atmega8} the macro is 18328defined to @code{4}. 18329 18330@item __AVR_@var{Device}__ 18331Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 18332the device's name. For example, @option{-mmcu=atmega8} defines the 18333built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 18334@code{__AVR_ATtiny261A__}, etc. 18335 18336The built-in macros' names follow 18337the scheme @code{__AVR_@var{Device}__} where @var{Device} is 18338the device name as from the AVR user manual. The difference between 18339@var{Device} in the built-in macro and @var{device} in 18340@option{-mmcu=@var{device}} is that the latter is always lowercase. 18341 18342If @var{device} is not a device but only a core architecture like 18343@samp{avr51}, this macro is not defined. 18344 18345@item __AVR_DEVICE_NAME__ 18346Setting @option{-mmcu=@var{device}} defines this built-in macro to 18347the device's name. For example, with @option{-mmcu=atmega8} the macro 18348is defined to @code{atmega8}. 18349 18350If @var{device} is not a device but only a core architecture like 18351@samp{avr51}, this macro is not defined. 18352 18353@item __AVR_XMEGA__ 18354The device / architecture belongs to the XMEGA family of devices. 18355 18356@item __AVR_HAVE_ELPM__ 18357The device has the @code{ELPM} instruction. 18358 18359@item __AVR_HAVE_ELPMX__ 18360The device has the @code{ELPM R@var{n},Z} and @code{ELPM 18361R@var{n},Z+} instructions. 18362 18363@item __AVR_HAVE_MOVW__ 18364The device has the @code{MOVW} instruction to perform 16-bit 18365register-register moves. 18366 18367@item __AVR_HAVE_LPMX__ 18368The device has the @code{LPM R@var{n},Z} and 18369@code{LPM R@var{n},Z+} instructions. 18370 18371@item __AVR_HAVE_MUL__ 18372The device has a hardware multiplier. 18373 18374@item __AVR_HAVE_JMP_CALL__ 18375The device has the @code{JMP} and @code{CALL} instructions. 18376This is the case for devices with more than 8@tie{}KiB of program 18377memory. 18378 18379@item __AVR_HAVE_EIJMP_EICALL__ 18380@itemx __AVR_3_BYTE_PC__ 18381The device has the @code{EIJMP} and @code{EICALL} instructions. 18382This is the case for devices with more than 128@tie{}KiB of program memory. 18383This also means that the program counter 18384(PC) is 3@tie{}bytes wide. 18385 18386@item __AVR_2_BYTE_PC__ 18387The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 18388with up to 128@tie{}KiB of program memory. 18389 18390@item __AVR_HAVE_8BIT_SP__ 18391@itemx __AVR_HAVE_16BIT_SP__ 18392The stack pointer (SP) register is treated as 8-bit respectively 1839316-bit register by the compiler. 18394The definition of these macros is affected by @option{-mtiny-stack}. 18395 18396@item __AVR_HAVE_SPH__ 18397@itemx __AVR_SP8__ 18398The device has the SPH (high part of stack pointer) special function 18399register or has an 8-bit stack pointer, respectively. 18400The definition of these macros is affected by @option{-mmcu=} and 18401in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 18402by @option{-msp8}. 18403 18404@item __AVR_HAVE_RAMPD__ 18405@itemx __AVR_HAVE_RAMPX__ 18406@itemx __AVR_HAVE_RAMPY__ 18407@itemx __AVR_HAVE_RAMPZ__ 18408The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 18409@code{RAMPZ} special function register, respectively. 18410 18411@item __NO_INTERRUPTS__ 18412This macro reflects the @option{-mno-interrupts} command-line option. 18413 18414@item __AVR_ERRATA_SKIP__ 18415@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 18416Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 18417instructions because of a hardware erratum. Skip instructions are 18418@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 18419The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 18420set. 18421 18422@item __AVR_ISA_RMW__ 18423The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 18424 18425@item __AVR_SFR_OFFSET__=@var{offset} 18426Instructions that can address I/O special function registers directly 18427like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 18428address as if addressed by an instruction to access RAM like @code{LD} 18429or @code{STS}. This offset depends on the device architecture and has 18430to be subtracted from the RAM address in order to get the 18431respective I/O@tie{}address. 18432 18433@item __AVR_SHORT_CALLS__ 18434The @option{-mshort-calls} command line option is set. 18435 18436@item __AVR_PM_BASE_ADDRESS__=@var{addr} 18437Some devices support reading from flash memory by means of @code{LD*} 18438instructions. The flash memory is seen in the data address space 18439at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro 18440is not defined, this feature is not available. If defined, 18441the address space is linear and there is no need to put 18442@code{.rodata} into RAM. This is handled by the default linker 18443description file, and is currently available for 18444@code{avrtiny} and @code{avrxmega3}. Even more convenient, 18445there is no need to use address spaces like @code{__flash} or 18446features like attribute @code{progmem} and @code{pgm_read_*}. 18447 18448@item __WITH_AVRLIBC__ 18449The compiler is configured to be used together with AVR-Libc. 18450See the @option{--with-avrlibc} configure option. 18451 18452@end table 18453 18454@node Blackfin Options 18455@subsection Blackfin Options 18456@cindex Blackfin Options 18457 18458@table @gcctabopt 18459@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 18460@opindex mcpu= 18461Specifies the name of the target Blackfin processor. Currently, @var{cpu} 18462can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 18463@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 18464@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 18465@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 18466@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 18467@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 18468@samp{bf561}, @samp{bf592}. 18469 18470The optional @var{sirevision} specifies the silicon revision of the target 18471Blackfin processor. Any workarounds available for the targeted silicon revision 18472are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 18473If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 18474are enabled. The @code{__SILICON_REVISION__} macro is defined to two 18475hexadecimal digits representing the major and minor numbers in the silicon 18476revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 18477is not defined. If @var{sirevision} is @samp{any}, the 18478@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 18479If this optional @var{sirevision} is not used, GCC assumes the latest known 18480silicon revision of the targeted Blackfin processor. 18481 18482GCC defines a preprocessor macro for the specified @var{cpu}. 18483For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 18484provided by libgloss to be linked in if @option{-msim} is not given. 18485 18486Without this option, @samp{bf532} is used as the processor by default. 18487 18488Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 18489only the preprocessor macro is defined. 18490 18491@item -msim 18492@opindex msim 18493Specifies that the program will be run on the simulator. This causes 18494the simulator BSP provided by libgloss to be linked in. This option 18495has effect only for @samp{bfin-elf} toolchain. 18496Certain other options, such as @option{-mid-shared-library} and 18497@option{-mfdpic}, imply @option{-msim}. 18498 18499@item -momit-leaf-frame-pointer 18500@opindex momit-leaf-frame-pointer 18501Don't keep the frame pointer in a register for leaf functions. This 18502avoids the instructions to save, set up and restore frame pointers and 18503makes an extra register available in leaf functions. 18504 18505@item -mspecld-anomaly 18506@opindex mspecld-anomaly 18507When enabled, the compiler ensures that the generated code does not 18508contain speculative loads after jump instructions. If this option is used, 18509@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 18510 18511@item -mno-specld-anomaly 18512@opindex mno-specld-anomaly 18513@opindex mspecld-anomaly 18514Don't generate extra code to prevent speculative loads from occurring. 18515 18516@item -mcsync-anomaly 18517@opindex mcsync-anomaly 18518When enabled, the compiler ensures that the generated code does not 18519contain CSYNC or SSYNC instructions too soon after conditional branches. 18520If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 18521 18522@item -mno-csync-anomaly 18523@opindex mno-csync-anomaly 18524@opindex mcsync-anomaly 18525Don't generate extra code to prevent CSYNC or SSYNC instructions from 18526occurring too soon after a conditional branch. 18527 18528@item -mlow64k 18529@opindex mlow64k 18530When enabled, the compiler is free to take advantage of the knowledge that 18531the entire program fits into the low 64k of memory. 18532 18533@item -mno-low64k 18534@opindex mno-low64k 18535Assume that the program is arbitrarily large. This is the default. 18536 18537@item -mstack-check-l1 18538@opindex mstack-check-l1 18539Do stack checking using information placed into L1 scratchpad memory by the 18540uClinux kernel. 18541 18542@item -mid-shared-library 18543@opindex mid-shared-library 18544Generate code that supports shared libraries via the library ID method. 18545This allows for execute in place and shared libraries in an environment 18546without virtual memory management. This option implies @option{-fPIC}. 18547With a @samp{bfin-elf} target, this option implies @option{-msim}. 18548 18549@item -mno-id-shared-library 18550@opindex mno-id-shared-library 18551@opindex mid-shared-library 18552Generate code that doesn't assume ID-based shared libraries are being used. 18553This is the default. 18554 18555@item -mleaf-id-shared-library 18556@opindex mleaf-id-shared-library 18557Generate code that supports shared libraries via the library ID method, 18558but assumes that this library or executable won't link against any other 18559ID shared libraries. That allows the compiler to use faster code for jumps 18560and calls. 18561 18562@item -mno-leaf-id-shared-library 18563@opindex mno-leaf-id-shared-library 18564@opindex mleaf-id-shared-library 18565Do not assume that the code being compiled won't link against any ID shared 18566libraries. Slower code is generated for jump and call insns. 18567 18568@item -mshared-library-id=n 18569@opindex mshared-library-id 18570Specifies the identification number of the ID-based shared library being 18571compiled. Specifying a value of 0 generates more compact code; specifying 18572other values forces the allocation of that number to the current 18573library but is no more space- or time-efficient than omitting this option. 18574 18575@item -msep-data 18576@opindex msep-data 18577Generate code that allows the data segment to be located in a different 18578area of memory from the text segment. This allows for execute in place in 18579an environment without virtual memory management by eliminating relocations 18580against the text section. 18581 18582@item -mno-sep-data 18583@opindex mno-sep-data 18584@opindex msep-data 18585Generate code that assumes that the data segment follows the text segment. 18586This is the default. 18587 18588@item -mlong-calls 18589@itemx -mno-long-calls 18590@opindex mlong-calls 18591@opindex mno-long-calls 18592Tells the compiler to perform function calls by first loading the 18593address of the function into a register and then performing a subroutine 18594call on this register. This switch is needed if the target function 18595lies outside of the 24-bit addressing range of the offset-based 18596version of subroutine call instruction. 18597 18598This feature is not enabled by default. Specifying 18599@option{-mno-long-calls} restores the default behavior. Note these 18600switches have no effect on how the compiler generates code to handle 18601function calls via function pointers. 18602 18603@item -mfast-fp 18604@opindex mfast-fp 18605Link with the fast floating-point library. This library relaxes some of 18606the IEEE floating-point standard's rules for checking inputs against 18607Not-a-Number (NAN), in the interest of performance. 18608 18609@item -minline-plt 18610@opindex minline-plt 18611Enable inlining of PLT entries in function calls to functions that are 18612not known to bind locally. It has no effect without @option{-mfdpic}. 18613 18614@item -mmulticore 18615@opindex mmulticore 18616Build a standalone application for multicore Blackfin processors. 18617This option causes proper start files and link scripts supporting 18618multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 18619It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 18620 18621This option can be used with @option{-mcorea} or @option{-mcoreb}, which 18622selects the one-application-per-core programming model. Without 18623@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 18624programming model is used. In this model, the main function of Core B 18625should be named as @code{coreb_main}. 18626 18627If this option is not used, the single-core application programming 18628model is used. 18629 18630@item -mcorea 18631@opindex mcorea 18632Build a standalone application for Core A of BF561 when using 18633the one-application-per-core programming model. Proper start files 18634and link scripts are used to support Core A, and the macro 18635@code{__BFIN_COREA} is defined. 18636This option can only be used in conjunction with @option{-mmulticore}. 18637 18638@item -mcoreb 18639@opindex mcoreb 18640Build a standalone application for Core B of BF561 when using 18641the one-application-per-core programming model. Proper start files 18642and link scripts are used to support Core B, and the macro 18643@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 18644should be used instead of @code{main}. 18645This option can only be used in conjunction with @option{-mmulticore}. 18646 18647@item -msdram 18648@opindex msdram 18649Build a standalone application for SDRAM. Proper start files and 18650link scripts are used to put the application into SDRAM, and the macro 18651@code{__BFIN_SDRAM} is defined. 18652The loader should initialize SDRAM before loading the application. 18653 18654@item -micplb 18655@opindex micplb 18656Assume that ICPLBs are enabled at run time. This has an effect on certain 18657anomaly workarounds. For Linux targets, the default is to assume ICPLBs 18658are enabled; for standalone applications the default is off. 18659@end table 18660 18661@node C6X Options 18662@subsection C6X Options 18663@cindex C6X Options 18664 18665@table @gcctabopt 18666@item -march=@var{name} 18667@opindex march 18668This specifies the name of the target architecture. GCC uses this 18669name to determine what kind of instructions it can emit when generating 18670assembly code. Permissible names are: @samp{c62x}, 18671@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 18672 18673@item -mbig-endian 18674@opindex mbig-endian 18675Generate code for a big-endian target. 18676 18677@item -mlittle-endian 18678@opindex mlittle-endian 18679Generate code for a little-endian target. This is the default. 18680 18681@item -msim 18682@opindex msim 18683Choose startup files and linker script suitable for the simulator. 18684 18685@item -msdata=default 18686@opindex msdata=default 18687Put small global and static data in the @code{.neardata} section, 18688which is pointed to by register @code{B14}. Put small uninitialized 18689global and static data in the @code{.bss} section, which is adjacent 18690to the @code{.neardata} section. Put small read-only data into the 18691@code{.rodata} section. The corresponding sections used for large 18692pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 18693 18694@item -msdata=all 18695@opindex msdata=all 18696Put all data, not just small objects, into the sections reserved for 18697small data, and use addressing relative to the @code{B14} register to 18698access them. 18699 18700@item -msdata=none 18701@opindex msdata=none 18702Make no use of the sections reserved for small data, and use absolute 18703addresses to access all data. Put all initialized global and static 18704data in the @code{.fardata} section, and all uninitialized data in the 18705@code{.far} section. Put all constant data into the @code{.const} 18706section. 18707@end table 18708 18709@node CRIS Options 18710@subsection CRIS Options 18711@cindex CRIS Options 18712 18713These options are defined specifically for the CRIS ports. 18714 18715@table @gcctabopt 18716@item -march=@var{architecture-type} 18717@itemx -mcpu=@var{architecture-type} 18718@opindex march 18719@opindex mcpu 18720Generate code for the specified architecture. The choices for 18721@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 18722respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 18723Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 18724@samp{v10}. 18725 18726@item -mtune=@var{architecture-type} 18727@opindex mtune 18728Tune to @var{architecture-type} everything applicable about the generated 18729code, except for the ABI and the set of available instructions. The 18730choices for @var{architecture-type} are the same as for 18731@option{-march=@var{architecture-type}}. 18732 18733@item -mmax-stack-frame=@var{n} 18734@opindex mmax-stack-frame 18735Warn when the stack frame of a function exceeds @var{n} bytes. 18736 18737@item -metrax4 18738@itemx -metrax100 18739@opindex metrax4 18740@opindex metrax100 18741The options @option{-metrax4} and @option{-metrax100} are synonyms for 18742@option{-march=v3} and @option{-march=v8} respectively. 18743 18744@item -mmul-bug-workaround 18745@itemx -mno-mul-bug-workaround 18746@opindex mmul-bug-workaround 18747@opindex mno-mul-bug-workaround 18748Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 18749models where it applies. This option is active by default. 18750 18751@item -mpdebug 18752@opindex mpdebug 18753Enable CRIS-specific verbose debug-related information in the assembly 18754code. This option also has the effect of turning off the @samp{#NO_APP} 18755formatted-code indicator to the assembler at the beginning of the 18756assembly file. 18757 18758@item -mcc-init 18759@opindex mcc-init 18760Do not use condition-code results from previous instruction; always emit 18761compare and test instructions before use of condition codes. 18762 18763@item -mno-side-effects 18764@opindex mno-side-effects 18765@opindex mside-effects 18766Do not emit instructions with side effects in addressing modes other than 18767post-increment. 18768 18769@item -mstack-align 18770@itemx -mno-stack-align 18771@itemx -mdata-align 18772@itemx -mno-data-align 18773@itemx -mconst-align 18774@itemx -mno-const-align 18775@opindex mstack-align 18776@opindex mno-stack-align 18777@opindex mdata-align 18778@opindex mno-data-align 18779@opindex mconst-align 18780@opindex mno-const-align 18781These options (@samp{no-} options) arrange (eliminate arrangements) for the 18782stack frame, individual data and constants to be aligned for the maximum 18783single data access size for the chosen CPU model. The default is to 18784arrange for 32-bit alignment. ABI details such as structure layout are 18785not affected by these options. 18786 18787@item -m32-bit 18788@itemx -m16-bit 18789@itemx -m8-bit 18790@opindex m32-bit 18791@opindex m16-bit 18792@opindex m8-bit 18793Similar to the stack- data- and const-align options above, these options 18794arrange for stack frame, writable data and constants to all be 32-bit, 1879516-bit or 8-bit aligned. The default is 32-bit alignment. 18796 18797@item -mno-prologue-epilogue 18798@itemx -mprologue-epilogue 18799@opindex mno-prologue-epilogue 18800@opindex mprologue-epilogue 18801With @option{-mno-prologue-epilogue}, the normal function prologue and 18802epilogue which set up the stack frame are omitted and no return 18803instructions or return sequences are generated in the code. Use this 18804option only together with visual inspection of the compiled code: no 18805warnings or errors are generated when call-saved registers must be saved, 18806or storage for local variables needs to be allocated. 18807 18808@item -mno-gotplt 18809@itemx -mgotplt 18810@opindex mno-gotplt 18811@opindex mgotplt 18812With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 18813instruction sequences that load addresses for functions from the PLT part 18814of the GOT rather than (traditional on other architectures) calls to the 18815PLT@. The default is @option{-mgotplt}. 18816 18817@item -melf 18818@opindex melf 18819Legacy no-op option only recognized with the cris-axis-elf and 18820cris-axis-linux-gnu targets. 18821 18822@item -mlinux 18823@opindex mlinux 18824Legacy no-op option only recognized with the cris-axis-linux-gnu target. 18825 18826@item -sim 18827@opindex sim 18828This option, recognized for the cris-axis-elf, arranges 18829to link with input-output functions from a simulator library. Code, 18830initialized data and zero-initialized data are allocated consecutively. 18831 18832@item -sim2 18833@opindex sim2 18834Like @option{-sim}, but pass linker options to locate initialized data at 188350x40000000 and zero-initialized data at 0x80000000. 18836@end table 18837 18838@node CR16 Options 18839@subsection CR16 Options 18840@cindex CR16 Options 18841 18842These options are defined specifically for the CR16 ports. 18843 18844@table @gcctabopt 18845 18846@item -mmac 18847@opindex mmac 18848Enable the use of multiply-accumulate instructions. Disabled by default. 18849 18850@item -mcr16cplus 18851@itemx -mcr16c 18852@opindex mcr16cplus 18853@opindex mcr16c 18854Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 18855is default. 18856 18857@item -msim 18858@opindex msim 18859Links the library libsim.a which is in compatible with simulator. Applicable 18860to ELF compiler only. 18861 18862@item -mint32 18863@opindex mint32 18864Choose integer type as 32-bit wide. 18865 18866@item -mbit-ops 18867@opindex mbit-ops 18868Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 18869 18870@item -mdata-model=@var{model} 18871@opindex mdata-model 18872Choose a data model. The choices for @var{model} are @samp{near}, 18873@samp{far} or @samp{medium}. @samp{medium} is default. 18874However, @samp{far} is not valid with @option{-mcr16c}, as the 18875CR16C architecture does not support the far data model. 18876@end table 18877 18878@node C-SKY Options 18879@subsection C-SKY Options 18880@cindex C-SKY Options 18881 18882GCC supports these options when compiling for C-SKY V2 processors. 18883 18884@table @gcctabopt 18885 18886@item -march=@var{arch} 18887@opindex march= 18888Specify the C-SKY target architecture. Valid values for @var{arch} are: 18889@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}. 18890The default is @samp{ck810}. 18891 18892@item -mcpu=@var{cpu} 18893@opindex mcpu= 18894Specify the C-SKY target processor. Valid values for @var{cpu} are: 18895@samp{ck801}, @samp{ck801t}, 18896@samp{ck802}, @samp{ck802t}, @samp{ck802j}, 18897@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht}, 18898@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh}, 18899@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh}, 18900@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1}, 18901@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1}, 18902@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1}, 18903@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1}, 18904@samp{ck803eftr1}, @samp{ck803efhtr1}, 18905@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf}, 18906@samp{ck803sef}, @samp{ck803seft}, 18907@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f}, 18908@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft}, 18909@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv}, 18910@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}. 18911 18912@item -mbig-endian 18913@opindex mbig-endian 18914@itemx -EB 18915@opindex EB 18916@itemx -mlittle-endian 18917@opindex mlittle-endian 18918@itemx -EL 18919@opindex EL 18920 18921Select big- or little-endian code. The default is little-endian. 18922 18923@item -mhard-float 18924@opindex mhard-float 18925@itemx -msoft-float 18926@opindex msoft-float 18927 18928Select hardware or software floating-point implementations. 18929The default is soft float. 18930 18931@item -mdouble-float 18932@itemx -mno-double-float 18933@opindex mdouble-float 18934When @option{-mhard-float} is in effect, enable generation of 18935double-precision float instructions. This is the default except 18936when compiling for CK803. 18937 18938@item -mfdivdu 18939@itemx -mno-fdivdu 18940@opindex mfdivdu 18941When @option{-mhard-float} is in effect, enable generation of 18942@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions. 18943This is the default except when compiling for CK803. 18944 18945@item -mfpu=@var{fpu} 18946@opindex mfpu= 18947Select the floating-point processor. This option can only be used with 18948@option{-mhard-float}. 18949Values for @var{fpu} are 18950@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}), 18951@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and 18952@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}). 18953 18954@item -melrw 18955@itemx -mno-elrw 18956@opindex melrw 18957Enable the extended @code{lrw} instruction. This option defaults to on 18958for CK801 and off otherwise. 18959 18960@item -mistack 18961@itemx -mno-istack 18962@opindex mistack 18963Enable interrupt stack instructions; the default is off. 18964 18965The @option{-mistack} option is required to handle the 18966@code{interrupt} and @code{isr} function attributes 18967(@pxref{C-SKY Function Attributes}). 18968 18969@item -mmp 18970@opindex mmp 18971Enable multiprocessor instructions; the default is off. 18972 18973@item -mcp 18974@opindex mcp 18975Enable coprocessor instructions; the default is off. 18976 18977@item -mcache 18978@opindex mcache 18979Enable coprocessor instructions; the default is off. 18980 18981@item -msecurity 18982@opindex msecurity 18983Enable C-SKY security instructions; the default is off. 18984 18985@item -mtrust 18986@opindex mtrust 18987Enable C-SKY trust instructions; the default is off. 18988 18989@item -mdsp 18990@opindex mdsp 18991@itemx -medsp 18992@opindex medsp 18993@itemx -mvdsp 18994@opindex mvdsp 18995Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively. 18996All of these options default to off. 18997 18998@item -mdiv 18999@itemx -mno-div 19000@opindex mdiv 19001Generate divide instructions. Default is off. 19002 19003@item -msmart 19004@itemx -mno-smart 19005@opindex msmart 19006Generate code for Smart Mode, using only registers numbered 0-7 to allow 19007use of 16-bit instructions. This option is ignored for CK801 where this 19008is the required behavior, and it defaults to on for CK802. 19009For other targets, the default is off. 19010 19011@item -mhigh-registers 19012@itemx -mno-high-registers 19013@opindex mhigh-registers 19014Generate code using the high registers numbered 16-31. This option 19015is not supported on CK801, CK802, or CK803, and is enabled by default 19016for other processors. 19017 19018@item -manchor 19019@itemx -mno-anchor 19020@opindex manchor 19021Generate code using global anchor symbol addresses. 19022 19023@item -mpushpop 19024@itemx -mno-pushpop 19025@opindex mpushpop 19026Generate code using @code{push} and @code{pop} instructions. This option 19027defaults to on. 19028 19029@item -mmultiple-stld 19030@itemx -mstm 19031@itemx -mno-multiple-stld 19032@itemx -mno-stm 19033@opindex mmultiple-stld 19034Generate code using @code{stm} and @code{ldm} instructions. This option 19035isn't supported on CK801 but is enabled by default on other processors. 19036 19037@item -mconstpool 19038@itemx -mno-constpool 19039@opindex mconstpool 19040Create constant pools in the compiler instead of deferring it to the 19041assembler. This option is the default and required for correct code 19042generation on CK801 and CK802, and is optional on other processors. 19043 19044@item -mstack-size 19045@item -mno-stack-size 19046@opindex mstack-size 19047Emit @code{.stack_size} directives for each function in the assembly 19048output. This option defaults to off. 19049 19050@item -mccrt 19051@itemx -mno-ccrt 19052@opindex mccrt 19053Generate code for the C-SKY compiler runtime instead of libgcc. This 19054option defaults to off. 19055 19056@item -mbranch-cost=@var{n} 19057@opindex mbranch-cost= 19058Set the branch costs to roughly @code{n} instructions. The default is 1. 19059 19060@item -msched-prolog 19061@itemx -mno-sched-prolog 19062@opindex msched-prolog 19063Permit scheduling of function prologue and epilogue sequences. Using 19064this option can result in code that is not compliant with the C-SKY V2 ABI 19065prologue requirements and that cannot be debugged or backtraced. 19066It is disabled by default. 19067 19068@end table 19069 19070@node Darwin Options 19071@subsection Darwin Options 19072@cindex Darwin options 19073 19074These options are defined for all architectures running the Darwin operating 19075system. 19076 19077FSF GCC on Darwin does not create ``fat'' object files; it creates 19078an object file for the single architecture that GCC was built to 19079target. Apple's GCC on Darwin does create ``fat'' files if multiple 19080@option{-arch} options are used; it does so by running the compiler or 19081linker multiple times and joining the results together with 19082@file{lipo}. 19083 19084The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 19085@samp{i686}) is determined by the flags that specify the ISA 19086that GCC is targeting, like @option{-mcpu} or @option{-march}. The 19087@option{-force_cpusubtype_ALL} option can be used to override this. 19088 19089The Darwin tools vary in their behavior when presented with an ISA 19090mismatch. The assembler, @file{as}, only permits instructions to 19091be used that are valid for the subtype of the file it is generating, 19092so you cannot put 64-bit instructions in a @samp{ppc750} object file. 19093The linker for shared libraries, @file{/usr/bin/libtool}, fails 19094and prints an error if asked to create a shared library with a less 19095restrictive subtype than its input files (for instance, trying to put 19096a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 19097for executables, @command{ld}, quietly gives the executable the most 19098restrictive subtype of any of its input files. 19099 19100@table @gcctabopt 19101@item -F@var{dir} 19102@opindex F 19103Add the framework directory @var{dir} to the head of the list of 19104directories to be searched for header files. These directories are 19105interleaved with those specified by @option{-I} options and are 19106scanned in a left-to-right order. 19107 19108A framework directory is a directory with frameworks in it. A 19109framework is a directory with a @file{Headers} and/or 19110@file{PrivateHeaders} directory contained directly in it that ends 19111in @file{.framework}. The name of a framework is the name of this 19112directory excluding the @file{.framework}. Headers associated with 19113the framework are found in one of those two directories, with 19114@file{Headers} being searched first. A subframework is a framework 19115directory that is in a framework's @file{Frameworks} directory. 19116Includes of subframework headers can only appear in a header of a 19117framework that contains the subframework, or in a sibling subframework 19118header. Two subframeworks are siblings if they occur in the same 19119framework. A subframework should not have the same name as a 19120framework; a warning is issued if this is violated. Currently a 19121subframework cannot have subframeworks; in the future, the mechanism 19122may be extended to support this. The standard frameworks can be found 19123in @file{/System/Library/Frameworks} and 19124@file{/Library/Frameworks}. An example include looks like 19125@code{#include <Framework/header.h>}, where @file{Framework} denotes 19126the name of the framework and @file{header.h} is found in the 19127@file{PrivateHeaders} or @file{Headers} directory. 19128 19129@item -iframework@var{dir} 19130@opindex iframework 19131Like @option{-F} except the directory is a treated as a system 19132directory. The main difference between this @option{-iframework} and 19133@option{-F} is that with @option{-iframework} the compiler does not 19134warn about constructs contained within header files found via 19135@var{dir}. This option is valid only for the C family of languages. 19136 19137@item -gused 19138@opindex gused 19139Emit debugging information for symbols that are used. For stabs 19140debugging format, this enables @option{-feliminate-unused-debug-symbols}. 19141This is by default ON@. 19142 19143@item -gfull 19144@opindex gfull 19145Emit debugging information for all symbols and types. 19146 19147@item -mmacosx-version-min=@var{version} 19148The earliest version of MacOS X that this executable will run on 19149is @var{version}. Typical values of @var{version} include @code{10.1}, 19150@code{10.2}, and @code{10.3.9}. 19151 19152If the compiler was built to use the system's headers by default, 19153then the default for this option is the system version on which the 19154compiler is running, otherwise the default is to make choices that 19155are compatible with as many systems and code bases as possible. 19156 19157@item -mkernel 19158@opindex mkernel 19159Enable kernel development mode. The @option{-mkernel} option sets 19160@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 19161@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 19162@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 19163applicable. This mode also sets @option{-mno-altivec}, 19164@option{-msoft-float}, @option{-fno-builtin} and 19165@option{-mlong-branch} for PowerPC targets. 19166 19167@item -mone-byte-bool 19168@opindex mone-byte-bool 19169Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 19170By default @code{sizeof(bool)} is @code{4} when compiling for 19171Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 19172option has no effect on x86. 19173 19174@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 19175to generate code that is not binary compatible with code generated 19176without that switch. Using this switch may require recompiling all 19177other modules in a program, including system libraries. Use this 19178switch to conform to a non-default data model. 19179 19180@item -mfix-and-continue 19181@itemx -ffix-and-continue 19182@itemx -findirect-data 19183@opindex mfix-and-continue 19184@opindex ffix-and-continue 19185@opindex findirect-data 19186Generate code suitable for fast turnaround development, such as to 19187allow GDB to dynamically load @file{.o} files into already-running 19188programs. @option{-findirect-data} and @option{-ffix-and-continue} 19189are provided for backwards compatibility. 19190 19191@item -all_load 19192@opindex all_load 19193Loads all members of static archive libraries. 19194See man ld(1) for more information. 19195 19196@item -arch_errors_fatal 19197@opindex arch_errors_fatal 19198Cause the errors having to do with files that have the wrong architecture 19199to be fatal. 19200 19201@item -bind_at_load 19202@opindex bind_at_load 19203Causes the output file to be marked such that the dynamic linker will 19204bind all undefined references when the file is loaded or launched. 19205 19206@item -bundle 19207@opindex bundle 19208Produce a Mach-o bundle format file. 19209See man ld(1) for more information. 19210 19211@item -bundle_loader @var{executable} 19212@opindex bundle_loader 19213This option specifies the @var{executable} that will load the build 19214output file being linked. See man ld(1) for more information. 19215 19216@item -dynamiclib 19217@opindex dynamiclib 19218When passed this option, GCC produces a dynamic library instead of 19219an executable when linking, using the Darwin @file{libtool} command. 19220 19221@item -force_cpusubtype_ALL 19222@opindex force_cpusubtype_ALL 19223This causes GCC's output file to have the @samp{ALL} subtype, instead of 19224one controlled by the @option{-mcpu} or @option{-march} option. 19225 19226@item -allowable_client @var{client_name} 19227@itemx -client_name 19228@itemx -compatibility_version 19229@itemx -current_version 19230@itemx -dead_strip 19231@itemx -dependency-file 19232@itemx -dylib_file 19233@itemx -dylinker_install_name 19234@itemx -dynamic 19235@itemx -exported_symbols_list 19236@itemx -filelist 19237@need 800 19238@itemx -flat_namespace 19239@itemx -force_flat_namespace 19240@itemx -headerpad_max_install_names 19241@itemx -image_base 19242@itemx -init 19243@itemx -install_name 19244@itemx -keep_private_externs 19245@itemx -multi_module 19246@itemx -multiply_defined 19247@itemx -multiply_defined_unused 19248@need 800 19249@itemx -noall_load 19250@itemx -no_dead_strip_inits_and_terms 19251@itemx -nofixprebinding 19252@itemx -nomultidefs 19253@itemx -noprebind 19254@itemx -noseglinkedit 19255@itemx -pagezero_size 19256@itemx -prebind 19257@itemx -prebind_all_twolevel_modules 19258@itemx -private_bundle 19259@need 800 19260@itemx -read_only_relocs 19261@itemx -sectalign 19262@itemx -sectobjectsymbols 19263@itemx -whyload 19264@itemx -seg1addr 19265@itemx -sectcreate 19266@itemx -sectobjectsymbols 19267@itemx -sectorder 19268@itemx -segaddr 19269@itemx -segs_read_only_addr 19270@need 800 19271@itemx -segs_read_write_addr 19272@itemx -seg_addr_table 19273@itemx -seg_addr_table_filename 19274@itemx -seglinkedit 19275@itemx -segprot 19276@itemx -segs_read_only_addr 19277@itemx -segs_read_write_addr 19278@itemx -single_module 19279@itemx -static 19280@itemx -sub_library 19281@need 800 19282@itemx -sub_umbrella 19283@itemx -twolevel_namespace 19284@itemx -umbrella 19285@itemx -undefined 19286@itemx -unexported_symbols_list 19287@itemx -weak_reference_mismatches 19288@itemx -whatsloaded 19289@opindex allowable_client 19290@opindex client_name 19291@opindex compatibility_version 19292@opindex current_version 19293@opindex dead_strip 19294@opindex dependency-file 19295@opindex dylib_file 19296@opindex dylinker_install_name 19297@opindex dynamic 19298@opindex exported_symbols_list 19299@opindex filelist 19300@opindex flat_namespace 19301@opindex force_flat_namespace 19302@opindex headerpad_max_install_names 19303@opindex image_base 19304@opindex init 19305@opindex install_name 19306@opindex keep_private_externs 19307@opindex multi_module 19308@opindex multiply_defined 19309@opindex multiply_defined_unused 19310@opindex noall_load 19311@opindex no_dead_strip_inits_and_terms 19312@opindex nofixprebinding 19313@opindex nomultidefs 19314@opindex noprebind 19315@opindex noseglinkedit 19316@opindex pagezero_size 19317@opindex prebind 19318@opindex prebind_all_twolevel_modules 19319@opindex private_bundle 19320@opindex read_only_relocs 19321@opindex sectalign 19322@opindex sectobjectsymbols 19323@opindex whyload 19324@opindex seg1addr 19325@opindex sectcreate 19326@opindex sectobjectsymbols 19327@opindex sectorder 19328@opindex segaddr 19329@opindex segs_read_only_addr 19330@opindex segs_read_write_addr 19331@opindex seg_addr_table 19332@opindex seg_addr_table_filename 19333@opindex seglinkedit 19334@opindex segprot 19335@opindex segs_read_only_addr 19336@opindex segs_read_write_addr 19337@opindex single_module 19338@opindex static 19339@opindex sub_library 19340@opindex sub_umbrella 19341@opindex twolevel_namespace 19342@opindex umbrella 19343@opindex undefined 19344@opindex unexported_symbols_list 19345@opindex weak_reference_mismatches 19346@opindex whatsloaded 19347These options are passed to the Darwin linker. The Darwin linker man page 19348describes them in detail. 19349@end table 19350 19351@node DEC Alpha Options 19352@subsection DEC Alpha Options 19353 19354These @samp{-m} options are defined for the DEC Alpha implementations: 19355 19356@table @gcctabopt 19357@item -mno-soft-float 19358@itemx -msoft-float 19359@opindex mno-soft-float 19360@opindex msoft-float 19361Use (do not use) the hardware floating-point instructions for 19362floating-point operations. When @option{-msoft-float} is specified, 19363functions in @file{libgcc.a} are used to perform floating-point 19364operations. Unless they are replaced by routines that emulate the 19365floating-point operations, or compiled in such a way as to call such 19366emulations routines, these routines issue floating-point 19367operations. If you are compiling for an Alpha without floating-point 19368operations, you must ensure that the library is built so as not to call 19369them. 19370 19371Note that Alpha implementations without floating-point operations are 19372required to have floating-point registers. 19373 19374@item -mfp-reg 19375@itemx -mno-fp-regs 19376@opindex mfp-reg 19377@opindex mno-fp-regs 19378Generate code that uses (does not use) the floating-point register set. 19379@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 19380register set is not used, floating-point operands are passed in integer 19381registers as if they were integers and floating-point results are passed 19382in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 19383so any function with a floating-point argument or return value called by code 19384compiled with @option{-mno-fp-regs} must also be compiled with that 19385option. 19386 19387A typical use of this option is building a kernel that does not use, 19388and hence need not save and restore, any floating-point registers. 19389 19390@item -mieee 19391@opindex mieee 19392The Alpha architecture implements floating-point hardware optimized for 19393maximum performance. It is mostly compliant with the IEEE floating-point 19394standard. However, for full compliance, software assistance is 19395required. This option generates code fully IEEE-compliant code 19396@emph{except} that the @var{inexact-flag} is not maintained (see below). 19397If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 19398defined during compilation. The resulting code is less efficient but is 19399able to correctly support denormalized numbers and exceptional IEEE 19400values such as not-a-number and plus/minus infinity. Other Alpha 19401compilers call this option @option{-ieee_with_no_inexact}. 19402 19403@item -mieee-with-inexact 19404@opindex mieee-with-inexact 19405This is like @option{-mieee} except the generated code also maintains 19406the IEEE @var{inexact-flag}. Turning on this option causes the 19407generated code to implement fully-compliant IEEE math. In addition to 19408@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 19409macro. On some Alpha implementations the resulting code may execute 19410significantly slower than the code generated by default. Since there is 19411very little code that depends on the @var{inexact-flag}, you should 19412normally not specify this option. Other Alpha compilers call this 19413option @option{-ieee_with_inexact}. 19414 19415@item -mfp-trap-mode=@var{trap-mode} 19416@opindex mfp-trap-mode 19417This option controls what floating-point related traps are enabled. 19418Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 19419The trap mode can be set to one of four values: 19420 19421@table @samp 19422@item n 19423This is the default (normal) setting. The only traps that are enabled 19424are the ones that cannot be disabled in software (e.g., division by zero 19425trap). 19426 19427@item u 19428In addition to the traps enabled by @samp{n}, underflow traps are enabled 19429as well. 19430 19431@item su 19432Like @samp{u}, but the instructions are marked to be safe for software 19433completion (see Alpha architecture manual for details). 19434 19435@item sui 19436Like @samp{su}, but inexact traps are enabled as well. 19437@end table 19438 19439@item -mfp-rounding-mode=@var{rounding-mode} 19440@opindex mfp-rounding-mode 19441Selects the IEEE rounding mode. Other Alpha compilers call this option 19442@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 19443of: 19444 19445@table @samp 19446@item n 19447Normal IEEE rounding mode. Floating-point numbers are rounded towards 19448the nearest machine number or towards the even machine number in case 19449of a tie. 19450 19451@item m 19452Round towards minus infinity. 19453 19454@item c 19455Chopped rounding mode. Floating-point numbers are rounded towards zero. 19456 19457@item d 19458Dynamic rounding mode. A field in the floating-point control register 19459(@var{fpcr}, see Alpha architecture reference manual) controls the 19460rounding mode in effect. The C library initializes this register for 19461rounding towards plus infinity. Thus, unless your program modifies the 19462@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 19463@end table 19464 19465@item -mtrap-precision=@var{trap-precision} 19466@opindex mtrap-precision 19467In the Alpha architecture, floating-point traps are imprecise. This 19468means without software assistance it is impossible to recover from a 19469floating trap and program execution normally needs to be terminated. 19470GCC can generate code that can assist operating system trap handlers 19471in determining the exact location that caused a floating-point trap. 19472Depending on the requirements of an application, different levels of 19473precisions can be selected: 19474 19475@table @samp 19476@item p 19477Program precision. This option is the default and means a trap handler 19478can only identify which program caused a floating-point exception. 19479 19480@item f 19481Function precision. The trap handler can determine the function that 19482caused a floating-point exception. 19483 19484@item i 19485Instruction precision. The trap handler can determine the exact 19486instruction that caused a floating-point exception. 19487@end table 19488 19489Other Alpha compilers provide the equivalent options called 19490@option{-scope_safe} and @option{-resumption_safe}. 19491 19492@item -mieee-conformant 19493@opindex mieee-conformant 19494This option marks the generated code as IEEE conformant. You must not 19495use this option unless you also specify @option{-mtrap-precision=i} and either 19496@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 19497is to emit the line @samp{.eflag 48} in the function prologue of the 19498generated assembly file. 19499 19500@item -mbuild-constants 19501@opindex mbuild-constants 19502Normally GCC examines a 32- or 64-bit integer constant to 19503see if it can construct it from smaller constants in two or three 19504instructions. If it cannot, it outputs the constant as a literal and 19505generates code to load it from the data segment at run time. 19506 19507Use this option to require GCC to construct @emph{all} integer constants 19508using code, even if it takes more instructions (the maximum is six). 19509 19510You typically use this option to build a shared library dynamic 19511loader. Itself a shared library, it must relocate itself in memory 19512before it can find the variables and constants in its own data segment. 19513 19514@item -mbwx 19515@itemx -mno-bwx 19516@itemx -mcix 19517@itemx -mno-cix 19518@itemx -mfix 19519@itemx -mno-fix 19520@itemx -mmax 19521@itemx -mno-max 19522@opindex mbwx 19523@opindex mno-bwx 19524@opindex mcix 19525@opindex mno-cix 19526@opindex mfix 19527@opindex mno-fix 19528@opindex mmax 19529@opindex mno-max 19530Indicate whether GCC should generate code to use the optional BWX, 19531CIX, FIX and MAX instruction sets. The default is to use the instruction 19532sets supported by the CPU type specified via @option{-mcpu=} option or that 19533of the CPU on which GCC was built if none is specified. 19534 19535@item -mfloat-vax 19536@itemx -mfloat-ieee 19537@opindex mfloat-vax 19538@opindex mfloat-ieee 19539Generate code that uses (does not use) VAX F and G floating-point 19540arithmetic instead of IEEE single and double precision. 19541 19542@item -mexplicit-relocs 19543@itemx -mno-explicit-relocs 19544@opindex mexplicit-relocs 19545@opindex mno-explicit-relocs 19546Older Alpha assemblers provided no way to generate symbol relocations 19547except via assembler macros. Use of these macros does not allow 19548optimal instruction scheduling. GNU binutils as of version 2.12 19549supports a new syntax that allows the compiler to explicitly mark 19550which relocations should apply to which instructions. This option 19551is mostly useful for debugging, as GCC detects the capabilities of 19552the assembler when it is built and sets the default accordingly. 19553 19554@item -msmall-data 19555@itemx -mlarge-data 19556@opindex msmall-data 19557@opindex mlarge-data 19558When @option{-mexplicit-relocs} is in effect, static data is 19559accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 19560is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 19561(the @code{.sdata} and @code{.sbss} sections) and are accessed via 1956216-bit relocations off of the @code{$gp} register. This limits the 19563size of the small data area to 64KB, but allows the variables to be 19564directly accessed via a single instruction. 19565 19566The default is @option{-mlarge-data}. With this option the data area 19567is limited to just below 2GB@. Programs that require more than 2GB of 19568data must use @code{malloc} or @code{mmap} to allocate the data in the 19569heap instead of in the program's data segment. 19570 19571When generating code for shared libraries, @option{-fpic} implies 19572@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 19573 19574@item -msmall-text 19575@itemx -mlarge-text 19576@opindex msmall-text 19577@opindex mlarge-text 19578When @option{-msmall-text} is used, the compiler assumes that the 19579code of the entire program (or shared library) fits in 4MB, and is 19580thus reachable with a branch instruction. When @option{-msmall-data} 19581is used, the compiler can assume that all local symbols share the 19582same @code{$gp} value, and thus reduce the number of instructions 19583required for a function call from 4 to 1. 19584 19585The default is @option{-mlarge-text}. 19586 19587@item -mcpu=@var{cpu_type} 19588@opindex mcpu 19589Set the instruction set and instruction scheduling parameters for 19590machine type @var{cpu_type}. You can specify either the @samp{EV} 19591style name or the corresponding chip number. GCC supports scheduling 19592parameters for the EV4, EV5 and EV6 family of processors and 19593chooses the default values for the instruction set from the processor 19594you specify. If you do not specify a processor type, GCC defaults 19595to the processor on which the compiler was built. 19596 19597Supported values for @var{cpu_type} are 19598 19599@table @samp 19600@item ev4 19601@itemx ev45 19602@itemx 21064 19603Schedules as an EV4 and has no instruction set extensions. 19604 19605@item ev5 19606@itemx 21164 19607Schedules as an EV5 and has no instruction set extensions. 19608 19609@item ev56 19610@itemx 21164a 19611Schedules as an EV5 and supports the BWX extension. 19612 19613@item pca56 19614@itemx 21164pc 19615@itemx 21164PC 19616Schedules as an EV5 and supports the BWX and MAX extensions. 19617 19618@item ev6 19619@itemx 21264 19620Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 19621 19622@item ev67 19623@itemx 21264a 19624Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 19625@end table 19626 19627Native toolchains also support the value @samp{native}, 19628which selects the best architecture option for the host processor. 19629@option{-mcpu=native} has no effect if GCC does not recognize 19630the processor. 19631 19632@item -mtune=@var{cpu_type} 19633@opindex mtune 19634Set only the instruction scheduling parameters for machine type 19635@var{cpu_type}. The instruction set is not changed. 19636 19637Native toolchains also support the value @samp{native}, 19638which selects the best architecture option for the host processor. 19639@option{-mtune=native} has no effect if GCC does not recognize 19640the processor. 19641 19642@item -mmemory-latency=@var{time} 19643@opindex mmemory-latency 19644Sets the latency the scheduler should assume for typical memory 19645references as seen by the application. This number is highly 19646dependent on the memory access patterns used by the application 19647and the size of the external cache on the machine. 19648 19649Valid options for @var{time} are 19650 19651@table @samp 19652@item @var{number} 19653A decimal number representing clock cycles. 19654 19655@item L1 19656@itemx L2 19657@itemx L3 19658@itemx main 19659The compiler contains estimates of the number of clock cycles for 19660``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 19661(also called Dcache, Scache, and Bcache), as well as to main memory. 19662Note that L3 is only valid for EV5. 19663 19664@end table 19665@end table 19666 19667@node FR30 Options 19668@subsection FR30 Options 19669@cindex FR30 Options 19670 19671These options are defined specifically for the FR30 port. 19672 19673@table @gcctabopt 19674 19675@item -msmall-model 19676@opindex msmall-model 19677Use the small address space model. This can produce smaller code, but 19678it does assume that all symbolic values and addresses fit into a 1967920-bit range. 19680 19681@item -mno-lsim 19682@opindex mno-lsim 19683Assume that runtime support has been provided and so there is no need 19684to include the simulator library (@file{libsim.a}) on the linker 19685command line. 19686 19687@end table 19688 19689@node FT32 Options 19690@subsection FT32 Options 19691@cindex FT32 Options 19692 19693These options are defined specifically for the FT32 port. 19694 19695@table @gcctabopt 19696 19697@item -msim 19698@opindex msim 19699Specifies that the program will be run on the simulator. This causes 19700an alternate runtime startup and library to be linked. 19701You must not use this option when generating programs that will run on 19702real hardware; you must provide your own runtime library for whatever 19703I/O functions are needed. 19704 19705@item -mlra 19706@opindex mlra 19707Enable Local Register Allocation. This is still experimental for FT32, 19708so by default the compiler uses standard reload. 19709 19710@item -mnodiv 19711@opindex mnodiv 19712Do not use div and mod instructions. 19713 19714@item -mft32b 19715@opindex mft32b 19716Enable use of the extended instructions of the FT32B processor. 19717 19718@item -mcompress 19719@opindex mcompress 19720Compress all code using the Ft32B code compression scheme. 19721 19722@item -mnopm 19723@opindex mnopm 19724Do not generate code that reads program memory. 19725 19726@end table 19727 19728@node FRV Options 19729@subsection FRV Options 19730@cindex FRV Options 19731 19732@table @gcctabopt 19733@item -mgpr-32 19734@opindex mgpr-32 19735 19736Only use the first 32 general-purpose registers. 19737 19738@item -mgpr-64 19739@opindex mgpr-64 19740 19741Use all 64 general-purpose registers. 19742 19743@item -mfpr-32 19744@opindex mfpr-32 19745 19746Use only the first 32 floating-point registers. 19747 19748@item -mfpr-64 19749@opindex mfpr-64 19750 19751Use all 64 floating-point registers. 19752 19753@item -mhard-float 19754@opindex mhard-float 19755 19756Use hardware instructions for floating-point operations. 19757 19758@item -msoft-float 19759@opindex msoft-float 19760 19761Use library routines for floating-point operations. 19762 19763@item -malloc-cc 19764@opindex malloc-cc 19765 19766Dynamically allocate condition code registers. 19767 19768@item -mfixed-cc 19769@opindex mfixed-cc 19770 19771Do not try to dynamically allocate condition code registers, only 19772use @code{icc0} and @code{fcc0}. 19773 19774@item -mdword 19775@opindex mdword 19776 19777Change ABI to use double word insns. 19778 19779@item -mno-dword 19780@opindex mno-dword 19781@opindex mdword 19782 19783Do not use double word instructions. 19784 19785@item -mdouble 19786@opindex mdouble 19787 19788Use floating-point double instructions. 19789 19790@item -mno-double 19791@opindex mno-double 19792 19793Do not use floating-point double instructions. 19794 19795@item -mmedia 19796@opindex mmedia 19797 19798Use media instructions. 19799 19800@item -mno-media 19801@opindex mno-media 19802 19803Do not use media instructions. 19804 19805@item -mmuladd 19806@opindex mmuladd 19807 19808Use multiply and add/subtract instructions. 19809 19810@item -mno-muladd 19811@opindex mno-muladd 19812 19813Do not use multiply and add/subtract instructions. 19814 19815@item -mfdpic 19816@opindex mfdpic 19817 19818Select the FDPIC ABI, which uses function descriptors to represent 19819pointers to functions. Without any PIC/PIE-related options, it 19820implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 19821assumes GOT entries and small data are within a 12-bit range from the 19822GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 19823are computed with 32 bits. 19824With a @samp{bfin-elf} target, this option implies @option{-msim}. 19825 19826@item -minline-plt 19827@opindex minline-plt 19828 19829Enable inlining of PLT entries in function calls to functions that are 19830not known to bind locally. It has no effect without @option{-mfdpic}. 19831It's enabled by default if optimizing for speed and compiling for 19832shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 19833optimization option such as @option{-O3} or above is present in the 19834command line. 19835 19836@item -mTLS 19837@opindex mTLS 19838 19839Assume a large TLS segment when generating thread-local code. 19840 19841@item -mtls 19842@opindex mtls 19843 19844Do not assume a large TLS segment when generating thread-local code. 19845 19846@item -mgprel-ro 19847@opindex mgprel-ro 19848 19849Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 19850that is known to be in read-only sections. It's enabled by default, 19851except for @option{-fpic} or @option{-fpie}: even though it may help 19852make the global offset table smaller, it trades 1 instruction for 4. 19853With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 19854one of which may be shared by multiple symbols, and it avoids the need 19855for a GOT entry for the referenced symbol, so it's more likely to be a 19856win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 19857 19858@item -multilib-library-pic 19859@opindex multilib-library-pic 19860 19861Link with the (library, not FD) pic libraries. It's implied by 19862@option{-mlibrary-pic}, as well as by @option{-fPIC} and 19863@option{-fpic} without @option{-mfdpic}. You should never have to use 19864it explicitly. 19865 19866@item -mlinked-fp 19867@opindex mlinked-fp 19868 19869Follow the EABI requirement of always creating a frame pointer whenever 19870a stack frame is allocated. This option is enabled by default and can 19871be disabled with @option{-mno-linked-fp}. 19872 19873@item -mlong-calls 19874@opindex mlong-calls 19875 19876Use indirect addressing to call functions outside the current 19877compilation unit. This allows the functions to be placed anywhere 19878within the 32-bit address space. 19879 19880@item -malign-labels 19881@opindex malign-labels 19882 19883Try to align labels to an 8-byte boundary by inserting NOPs into the 19884previous packet. This option only has an effect when VLIW packing 19885is enabled. It doesn't create new packets; it merely adds NOPs to 19886existing ones. 19887 19888@item -mlibrary-pic 19889@opindex mlibrary-pic 19890 19891Generate position-independent EABI code. 19892 19893@item -macc-4 19894@opindex macc-4 19895 19896Use only the first four media accumulator registers. 19897 19898@item -macc-8 19899@opindex macc-8 19900 19901Use all eight media accumulator registers. 19902 19903@item -mpack 19904@opindex mpack 19905 19906Pack VLIW instructions. 19907 19908@item -mno-pack 19909@opindex mno-pack 19910 19911Do not pack VLIW instructions. 19912 19913@item -mno-eflags 19914@opindex mno-eflags 19915 19916Do not mark ABI switches in e_flags. 19917 19918@item -mcond-move 19919@opindex mcond-move 19920 19921Enable the use of conditional-move instructions (default). 19922 19923This switch is mainly for debugging the compiler and will likely be removed 19924in a future version. 19925 19926@item -mno-cond-move 19927@opindex mno-cond-move 19928 19929Disable the use of conditional-move instructions. 19930 19931This switch is mainly for debugging the compiler and will likely be removed 19932in a future version. 19933 19934@item -mscc 19935@opindex mscc 19936 19937Enable the use of conditional set instructions (default). 19938 19939This switch is mainly for debugging the compiler and will likely be removed 19940in a future version. 19941 19942@item -mno-scc 19943@opindex mno-scc 19944 19945Disable the use of conditional set instructions. 19946 19947This switch is mainly for debugging the compiler and will likely be removed 19948in a future version. 19949 19950@item -mcond-exec 19951@opindex mcond-exec 19952 19953Enable the use of conditional execution (default). 19954 19955This switch is mainly for debugging the compiler and will likely be removed 19956in a future version. 19957 19958@item -mno-cond-exec 19959@opindex mno-cond-exec 19960 19961Disable the use of conditional execution. 19962 19963This switch is mainly for debugging the compiler and will likely be removed 19964in a future version. 19965 19966@item -mvliw-branch 19967@opindex mvliw-branch 19968 19969Run a pass to pack branches into VLIW instructions (default). 19970 19971This switch is mainly for debugging the compiler and will likely be removed 19972in a future version. 19973 19974@item -mno-vliw-branch 19975@opindex mno-vliw-branch 19976 19977Do not run a pass to pack branches into VLIW instructions. 19978 19979This switch is mainly for debugging the compiler and will likely be removed 19980in a future version. 19981 19982@item -mmulti-cond-exec 19983@opindex mmulti-cond-exec 19984 19985Enable optimization of @code{&&} and @code{||} in conditional execution 19986(default). 19987 19988This switch is mainly for debugging the compiler and will likely be removed 19989in a future version. 19990 19991@item -mno-multi-cond-exec 19992@opindex mno-multi-cond-exec 19993 19994Disable optimization of @code{&&} and @code{||} in conditional execution. 19995 19996This switch is mainly for debugging the compiler and will likely be removed 19997in a future version. 19998 19999@item -mnested-cond-exec 20000@opindex mnested-cond-exec 20001 20002Enable nested conditional execution optimizations (default). 20003 20004This switch is mainly for debugging the compiler and will likely be removed 20005in a future version. 20006 20007@item -mno-nested-cond-exec 20008@opindex mno-nested-cond-exec 20009 20010Disable nested conditional execution optimizations. 20011 20012This switch is mainly for debugging the compiler and will likely be removed 20013in a future version. 20014 20015@item -moptimize-membar 20016@opindex moptimize-membar 20017 20018This switch removes redundant @code{membar} instructions from the 20019compiler-generated code. It is enabled by default. 20020 20021@item -mno-optimize-membar 20022@opindex mno-optimize-membar 20023@opindex moptimize-membar 20024 20025This switch disables the automatic removal of redundant @code{membar} 20026instructions from the generated code. 20027 20028@item -mtomcat-stats 20029@opindex mtomcat-stats 20030 20031Cause gas to print out tomcat statistics. 20032 20033@item -mcpu=@var{cpu} 20034@opindex mcpu 20035 20036Select the processor type for which to generate code. Possible values are 20037@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 20038@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 20039 20040@end table 20041 20042@node GNU/Linux Options 20043@subsection GNU/Linux Options 20044 20045These @samp{-m} options are defined for GNU/Linux targets: 20046 20047@table @gcctabopt 20048@item -mglibc 20049@opindex mglibc 20050Use the GNU C library. This is the default except 20051on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and 20052@samp{*-*-linux-*android*} targets. 20053 20054@item -muclibc 20055@opindex muclibc 20056Use uClibc C library. This is the default on 20057@samp{*-*-linux-*uclibc*} targets. 20058 20059@item -mmusl 20060@opindex mmusl 20061Use the musl C library. This is the default on 20062@samp{*-*-linux-*musl*} targets. 20063 20064@item -mbionic 20065@opindex mbionic 20066Use Bionic C library. This is the default on 20067@samp{*-*-linux-*android*} targets. 20068 20069@item -mandroid 20070@opindex mandroid 20071Compile code compatible with Android platform. This is the default on 20072@samp{*-*-linux-*android*} targets. 20073 20074When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 20075@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 20076this option makes the GCC driver pass Android-specific options to the linker. 20077Finally, this option causes the preprocessor macro @code{__ANDROID__} 20078to be defined. 20079 20080@item -tno-android-cc 20081@opindex tno-android-cc 20082Disable compilation effects of @option{-mandroid}, i.e., do not enable 20083@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 20084@option{-fno-rtti} by default. 20085 20086@item -tno-android-ld 20087@opindex tno-android-ld 20088Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 20089linking options to the linker. 20090 20091@end table 20092 20093@node H8/300 Options 20094@subsection H8/300 Options 20095 20096These @samp{-m} options are defined for the H8/300 implementations: 20097 20098@table @gcctabopt 20099@item -mrelax 20100@opindex mrelax 20101Shorten some address references at link time, when possible; uses the 20102linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 20103ld, Using ld}, for a fuller description. 20104 20105@item -mh 20106@opindex mh 20107Generate code for the H8/300H@. 20108 20109@item -ms 20110@opindex ms 20111Generate code for the H8S@. 20112 20113@item -mn 20114@opindex mn 20115Generate code for the H8S and H8/300H in the normal mode. This switch 20116must be used either with @option{-mh} or @option{-ms}. 20117 20118@item -ms2600 20119@opindex ms2600 20120Generate code for the H8S/2600. This switch must be used with @option{-ms}. 20121 20122@item -mexr 20123@opindex mexr 20124Extended registers are stored on stack before execution of function 20125with monitor attribute. Default option is @option{-mexr}. 20126This option is valid only for H8S targets. 20127 20128@item -mno-exr 20129@opindex mno-exr 20130@opindex mexr 20131Extended registers are not stored on stack before execution of function 20132with monitor attribute. Default option is @option{-mno-exr}. 20133This option is valid only for H8S targets. 20134 20135@item -mint32 20136@opindex mint32 20137Make @code{int} data 32 bits by default. 20138 20139@item -malign-300 20140@opindex malign-300 20141On the H8/300H and H8S, use the same alignment rules as for the H8/300. 20142The default for the H8/300H and H8S is to align longs and floats on 201434-byte boundaries. 20144@option{-malign-300} causes them to be aligned on 2-byte boundaries. 20145This option has no effect on the H8/300. 20146@end table 20147 20148@node HPPA Options 20149@subsection HPPA Options 20150@cindex HPPA Options 20151 20152These @samp{-m} options are defined for the HPPA family of computers: 20153 20154@table @gcctabopt 20155@item -march=@var{architecture-type} 20156@opindex march 20157Generate code for the specified architecture. The choices for 20158@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 201591.1, and @samp{2.0} for PA 2.0 processors. Refer to 20160@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 20161architecture option for your machine. Code compiled for lower numbered 20162architectures runs on higher numbered architectures, but not the 20163other way around. 20164 20165@item -mpa-risc-1-0 20166@itemx -mpa-risc-1-1 20167@itemx -mpa-risc-2-0 20168@opindex mpa-risc-1-0 20169@opindex mpa-risc-1-1 20170@opindex mpa-risc-2-0 20171Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 20172 20173@item -mcaller-copies 20174@opindex mcaller-copies 20175The caller copies function arguments passed by hidden reference. This 20176option should be used with care as it is not compatible with the default 2017732-bit runtime. However, only aggregates larger than eight bytes are 20178passed by hidden reference and the option provides better compatibility 20179with OpenMP. 20180 20181@item -mjump-in-delay 20182@opindex mjump-in-delay 20183This option is ignored and provided for compatibility purposes only. 20184 20185@item -mdisable-fpregs 20186@opindex mdisable-fpregs 20187Prevent floating-point registers from being used in any manner. This is 20188necessary for compiling kernels that perform lazy context switching of 20189floating-point registers. If you use this option and attempt to perform 20190floating-point operations, the compiler aborts. 20191 20192@item -mdisable-indexing 20193@opindex mdisable-indexing 20194Prevent the compiler from using indexing address modes. This avoids some 20195rather obscure problems when compiling MIG generated code under MACH@. 20196 20197@item -mno-space-regs 20198@opindex mno-space-regs 20199@opindex mspace-regs 20200Generate code that assumes the target has no space registers. This allows 20201GCC to generate faster indirect calls and use unscaled index address modes. 20202 20203Such code is suitable for level 0 PA systems and kernels. 20204 20205@item -mfast-indirect-calls 20206@opindex mfast-indirect-calls 20207Generate code that assumes calls never cross space boundaries. This 20208allows GCC to emit code that performs faster indirect calls. 20209 20210This option does not work in the presence of shared libraries or nested 20211functions. 20212 20213@item -mfixed-range=@var{register-range} 20214@opindex mfixed-range 20215Generate code treating the given register range as fixed registers. 20216A fixed register is one that the register allocator cannot use. This is 20217useful when compiling kernel code. A register range is specified as 20218two registers separated by a dash. Multiple register ranges can be 20219specified separated by a comma. 20220 20221@item -mlong-load-store 20222@opindex mlong-load-store 20223Generate 3-instruction load and store sequences as sometimes required by 20224the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 20225the HP compilers. 20226 20227@item -mportable-runtime 20228@opindex mportable-runtime 20229Use the portable calling conventions proposed by HP for ELF systems. 20230 20231@item -mgas 20232@opindex mgas 20233Enable the use of assembler directives only GAS understands. 20234 20235@item -mschedule=@var{cpu-type} 20236@opindex mschedule 20237Schedule code according to the constraints for the machine type 20238@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 20239@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 20240to @file{/usr/lib/sched.models} on an HP-UX system to determine the 20241proper scheduling option for your machine. The default scheduling is 20242@samp{8000}. 20243 20244@item -mlinker-opt 20245@opindex mlinker-opt 20246Enable the optimization pass in the HP-UX linker. Note this makes symbolic 20247debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 20248linkers in which they give bogus error messages when linking some programs. 20249 20250@item -msoft-float 20251@opindex msoft-float 20252Generate output containing library calls for floating point. 20253@strong{Warning:} the requisite libraries are not available for all HPPA 20254targets. Normally the facilities of the machine's usual C compiler are 20255used, but this cannot be done directly in cross-compilation. You must make 20256your own arrangements to provide suitable library functions for 20257cross-compilation. 20258 20259@option{-msoft-float} changes the calling convention in the output file; 20260therefore, it is only useful if you compile @emph{all} of a program with 20261this option. In particular, you need to compile @file{libgcc.a}, the 20262library that comes with GCC, with @option{-msoft-float} in order for 20263this to work. 20264 20265@item -msio 20266@opindex msio 20267Generate the predefine, @code{_SIO}, for server IO@. The default is 20268@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 20269@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 20270options are available under HP-UX and HI-UX@. 20271 20272@item -mgnu-ld 20273@opindex mgnu-ld 20274Use options specific to GNU @command{ld}. 20275This passes @option{-shared} to @command{ld} when 20276building a shared library. It is the default when GCC is configured, 20277explicitly or implicitly, with the GNU linker. This option does not 20278affect which @command{ld} is called; it only changes what parameters 20279are passed to that @command{ld}. 20280The @command{ld} that is called is determined by the 20281@option{--with-ld} configure option, GCC's program search path, and 20282finally by the user's @env{PATH}. The linker used by GCC can be printed 20283using @samp{which `gcc -print-prog-name=ld`}. This option is only available 20284on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 20285 20286@item -mhp-ld 20287@opindex mhp-ld 20288Use options specific to HP @command{ld}. 20289This passes @option{-b} to @command{ld} when building 20290a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 20291links. It is the default when GCC is configured, explicitly or 20292implicitly, with the HP linker. This option does not affect 20293which @command{ld} is called; it only changes what parameters are passed to that 20294@command{ld}. 20295The @command{ld} that is called is determined by the @option{--with-ld} 20296configure option, GCC's program search path, and finally by the user's 20297@env{PATH}. The linker used by GCC can be printed using @samp{which 20298`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 20299HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 20300 20301@item -mlong-calls 20302@opindex mno-long-calls 20303@opindex mlong-calls 20304Generate code that uses long call sequences. This ensures that a call 20305is always able to reach linker generated stubs. The default is to generate 20306long calls only when the distance from the call site to the beginning 20307of the function or translation unit, as the case may be, exceeds a 20308predefined limit set by the branch type being used. The limits for 20309normal calls are 7,600,000 and 240,000 bytes, respectively for the 20310PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 20311240,000 bytes. 20312 20313Distances are measured from the beginning of functions when using the 20314@option{-ffunction-sections} option, or when using the @option{-mgas} 20315and @option{-mno-portable-runtime} options together under HP-UX with 20316the SOM linker. 20317 20318It is normally not desirable to use this option as it degrades 20319performance. However, it may be useful in large applications, 20320particularly when partial linking is used to build the application. 20321 20322The types of long calls used depends on the capabilities of the 20323assembler and linker, and the type of code being generated. The 20324impact on systems that support long absolute calls, and long pic 20325symbol-difference or pc-relative calls should be relatively small. 20326However, an indirect call is used on 32-bit ELF systems in pic code 20327and it is quite long. 20328 20329@item -munix=@var{unix-std} 20330@opindex march 20331Generate compiler predefines and select a startfile for the specified 20332UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 20333and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 20334is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 2033511.11 and later. The default values are @samp{93} for HP-UX 10.00, 20336@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 20337and later. 20338 20339@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 20340@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 20341and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 20342@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 20343@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 20344@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 20345 20346It is @emph{important} to note that this option changes the interfaces 20347for various library routines. It also affects the operational behavior 20348of the C library. Thus, @emph{extreme} care is needed in using this 20349option. 20350 20351Library code that is intended to operate with more than one UNIX 20352standard must test, set and restore the variable @code{__xpg4_extended_mask} 20353as appropriate. Most GNU software doesn't provide this capability. 20354 20355@item -nolibdld 20356@opindex nolibdld 20357Suppress the generation of link options to search libdld.sl when the 20358@option{-static} option is specified on HP-UX 10 and later. 20359 20360@item -static 20361@opindex static 20362The HP-UX implementation of setlocale in libc has a dependency on 20363libdld.sl. There isn't an archive version of libdld.sl. Thus, 20364when the @option{-static} option is specified, special link options 20365are needed to resolve this dependency. 20366 20367On HP-UX 10 and later, the GCC driver adds the necessary options to 20368link with libdld.sl when the @option{-static} option is specified. 20369This causes the resulting binary to be dynamic. On the 64-bit port, 20370the linkers generate dynamic binaries by default in any case. The 20371@option{-nolibdld} option can be used to prevent the GCC driver from 20372adding these link options. 20373 20374@item -threads 20375@opindex threads 20376Add support for multithreading with the @dfn{dce thread} library 20377under HP-UX@. This option sets flags for both the preprocessor and 20378linker. 20379@end table 20380 20381@node IA-64 Options 20382@subsection IA-64 Options 20383@cindex IA-64 Options 20384 20385These are the @samp{-m} options defined for the Intel IA-64 architecture. 20386 20387@table @gcctabopt 20388@item -mbig-endian 20389@opindex mbig-endian 20390Generate code for a big-endian target. This is the default for HP-UX@. 20391 20392@item -mlittle-endian 20393@opindex mlittle-endian 20394Generate code for a little-endian target. This is the default for AIX5 20395and GNU/Linux. 20396 20397@item -mgnu-as 20398@itemx -mno-gnu-as 20399@opindex mgnu-as 20400@opindex mno-gnu-as 20401Generate (or don't) code for the GNU assembler. This is the default. 20402@c Also, this is the default if the configure option @option{--with-gnu-as} 20403@c is used. 20404 20405@item -mgnu-ld 20406@itemx -mno-gnu-ld 20407@opindex mgnu-ld 20408@opindex mno-gnu-ld 20409Generate (or don't) code for the GNU linker. This is the default. 20410@c Also, this is the default if the configure option @option{--with-gnu-ld} 20411@c is used. 20412 20413@item -mno-pic 20414@opindex mno-pic 20415Generate code that does not use a global pointer register. The result 20416is not position independent code, and violates the IA-64 ABI@. 20417 20418@item -mvolatile-asm-stop 20419@itemx -mno-volatile-asm-stop 20420@opindex mvolatile-asm-stop 20421@opindex mno-volatile-asm-stop 20422Generate (or don't) a stop bit immediately before and after volatile asm 20423statements. 20424 20425@item -mregister-names 20426@itemx -mno-register-names 20427@opindex mregister-names 20428@opindex mno-register-names 20429Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 20430the stacked registers. This may make assembler output more readable. 20431 20432@item -mno-sdata 20433@itemx -msdata 20434@opindex mno-sdata 20435@opindex msdata 20436Disable (or enable) optimizations that use the small data section. This may 20437be useful for working around optimizer bugs. 20438 20439@item -mconstant-gp 20440@opindex mconstant-gp 20441Generate code that uses a single constant global pointer value. This is 20442useful when compiling kernel code. 20443 20444@item -mauto-pic 20445@opindex mauto-pic 20446Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 20447This is useful when compiling firmware code. 20448 20449@item -minline-float-divide-min-latency 20450@opindex minline-float-divide-min-latency 20451Generate code for inline divides of floating-point values 20452using the minimum latency algorithm. 20453 20454@item -minline-float-divide-max-throughput 20455@opindex minline-float-divide-max-throughput 20456Generate code for inline divides of floating-point values 20457using the maximum throughput algorithm. 20458 20459@item -mno-inline-float-divide 20460@opindex mno-inline-float-divide 20461Do not generate inline code for divides of floating-point values. 20462 20463@item -minline-int-divide-min-latency 20464@opindex minline-int-divide-min-latency 20465Generate code for inline divides of integer values 20466using the minimum latency algorithm. 20467 20468@item -minline-int-divide-max-throughput 20469@opindex minline-int-divide-max-throughput 20470Generate code for inline divides of integer values 20471using the maximum throughput algorithm. 20472 20473@item -mno-inline-int-divide 20474@opindex mno-inline-int-divide 20475@opindex minline-int-divide 20476Do not generate inline code for divides of integer values. 20477 20478@item -minline-sqrt-min-latency 20479@opindex minline-sqrt-min-latency 20480Generate code for inline square roots 20481using the minimum latency algorithm. 20482 20483@item -minline-sqrt-max-throughput 20484@opindex minline-sqrt-max-throughput 20485Generate code for inline square roots 20486using the maximum throughput algorithm. 20487 20488@item -mno-inline-sqrt 20489@opindex mno-inline-sqrt 20490Do not generate inline code for @code{sqrt}. 20491 20492@item -mfused-madd 20493@itemx -mno-fused-madd 20494@opindex mfused-madd 20495@opindex mno-fused-madd 20496Do (don't) generate code that uses the fused multiply/add or multiply/subtract 20497instructions. The default is to use these instructions. 20498 20499@item -mno-dwarf2-asm 20500@itemx -mdwarf2-asm 20501@opindex mno-dwarf2-asm 20502@opindex mdwarf2-asm 20503Don't (or do) generate assembler code for the DWARF line number debugging 20504info. This may be useful when not using the GNU assembler. 20505 20506@item -mearly-stop-bits 20507@itemx -mno-early-stop-bits 20508@opindex mearly-stop-bits 20509@opindex mno-early-stop-bits 20510Allow stop bits to be placed earlier than immediately preceding the 20511instruction that triggered the stop bit. This can improve instruction 20512scheduling, but does not always do so. 20513 20514@item -mfixed-range=@var{register-range} 20515@opindex mfixed-range 20516Generate code treating the given register range as fixed registers. 20517A fixed register is one that the register allocator cannot use. This is 20518useful when compiling kernel code. A register range is specified as 20519two registers separated by a dash. Multiple register ranges can be 20520specified separated by a comma. 20521 20522@item -mtls-size=@var{tls-size} 20523@opindex mtls-size 20524Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 2052564. 20526 20527@item -mtune=@var{cpu-type} 20528@opindex mtune 20529Tune the instruction scheduling for a particular CPU, Valid values are 20530@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 20531and @samp{mckinley}. 20532 20533@item -milp32 20534@itemx -mlp64 20535@opindex milp32 20536@opindex mlp64 20537Generate code for a 32-bit or 64-bit environment. 20538The 32-bit environment sets int, long and pointer to 32 bits. 20539The 64-bit environment sets int to 32 bits and long and pointer 20540to 64 bits. These are HP-UX specific flags. 20541 20542@item -mno-sched-br-data-spec 20543@itemx -msched-br-data-spec 20544@opindex mno-sched-br-data-spec 20545@opindex msched-br-data-spec 20546(Dis/En)able data speculative scheduling before reload. 20547This results in generation of @code{ld.a} instructions and 20548the corresponding check instructions (@code{ld.c} / @code{chk.a}). 20549The default setting is disabled. 20550 20551@item -msched-ar-data-spec 20552@itemx -mno-sched-ar-data-spec 20553@opindex msched-ar-data-spec 20554@opindex mno-sched-ar-data-spec 20555(En/Dis)able data speculative scheduling after reload. 20556This results in generation of @code{ld.a} instructions and 20557the corresponding check instructions (@code{ld.c} / @code{chk.a}). 20558The default setting is enabled. 20559 20560@item -mno-sched-control-spec 20561@itemx -msched-control-spec 20562@opindex mno-sched-control-spec 20563@opindex msched-control-spec 20564(Dis/En)able control speculative scheduling. This feature is 20565available only during region scheduling (i.e.@: before reload). 20566This results in generation of the @code{ld.s} instructions and 20567the corresponding check instructions @code{chk.s}. 20568The default setting is disabled. 20569 20570@item -msched-br-in-data-spec 20571@itemx -mno-sched-br-in-data-spec 20572@opindex msched-br-in-data-spec 20573@opindex mno-sched-br-in-data-spec 20574(En/Dis)able speculative scheduling of the instructions that 20575are dependent on the data speculative loads before reload. 20576This is effective only with @option{-msched-br-data-spec} enabled. 20577The default setting is enabled. 20578 20579@item -msched-ar-in-data-spec 20580@itemx -mno-sched-ar-in-data-spec 20581@opindex msched-ar-in-data-spec 20582@opindex mno-sched-ar-in-data-spec 20583(En/Dis)able speculative scheduling of the instructions that 20584are dependent on the data speculative loads after reload. 20585This is effective only with @option{-msched-ar-data-spec} enabled. 20586The default setting is enabled. 20587 20588@item -msched-in-control-spec 20589@itemx -mno-sched-in-control-spec 20590@opindex msched-in-control-spec 20591@opindex mno-sched-in-control-spec 20592(En/Dis)able speculative scheduling of the instructions that 20593are dependent on the control speculative loads. 20594This is effective only with @option{-msched-control-spec} enabled. 20595The default setting is enabled. 20596 20597@item -mno-sched-prefer-non-data-spec-insns 20598@itemx -msched-prefer-non-data-spec-insns 20599@opindex mno-sched-prefer-non-data-spec-insns 20600@opindex msched-prefer-non-data-spec-insns 20601If enabled, data-speculative instructions are chosen for schedule 20602only if there are no other choices at the moment. This makes 20603the use of the data speculation much more conservative. 20604The default setting is disabled. 20605 20606@item -mno-sched-prefer-non-control-spec-insns 20607@itemx -msched-prefer-non-control-spec-insns 20608@opindex mno-sched-prefer-non-control-spec-insns 20609@opindex msched-prefer-non-control-spec-insns 20610If enabled, control-speculative instructions are chosen for schedule 20611only if there are no other choices at the moment. This makes 20612the use of the control speculation much more conservative. 20613The default setting is disabled. 20614 20615@item -mno-sched-count-spec-in-critical-path 20616@itemx -msched-count-spec-in-critical-path 20617@opindex mno-sched-count-spec-in-critical-path 20618@opindex msched-count-spec-in-critical-path 20619If enabled, speculative dependencies are considered during 20620computation of the instructions priorities. This makes the use of the 20621speculation a bit more conservative. 20622The default setting is disabled. 20623 20624@item -msched-spec-ldc 20625@opindex msched-spec-ldc 20626Use a simple data speculation check. This option is on by default. 20627 20628@item -msched-control-spec-ldc 20629@opindex msched-spec-ldc 20630Use a simple check for control speculation. This option is on by default. 20631 20632@item -msched-stop-bits-after-every-cycle 20633@opindex msched-stop-bits-after-every-cycle 20634Place a stop bit after every cycle when scheduling. This option is on 20635by default. 20636 20637@item -msched-fp-mem-deps-zero-cost 20638@opindex msched-fp-mem-deps-zero-cost 20639Assume that floating-point stores and loads are not likely to cause a conflict 20640when placed into the same instruction group. This option is disabled by 20641default. 20642 20643@item -msel-sched-dont-check-control-spec 20644@opindex msel-sched-dont-check-control-spec 20645Generate checks for control speculation in selective scheduling. 20646This flag is disabled by default. 20647 20648@item -msched-max-memory-insns=@var{max-insns} 20649@opindex msched-max-memory-insns 20650Limit on the number of memory insns per instruction group, giving lower 20651priority to subsequent memory insns attempting to schedule in the same 20652instruction group. Frequently useful to prevent cache bank conflicts. 20653The default value is 1. 20654 20655@item -msched-max-memory-insns-hard-limit 20656@opindex msched-max-memory-insns-hard-limit 20657Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 20658disallowing more than that number in an instruction group. 20659Otherwise, the limit is ``soft'', meaning that non-memory operations 20660are preferred when the limit is reached, but memory operations may still 20661be scheduled. 20662 20663@end table 20664 20665@node LM32 Options 20666@subsection LM32 Options 20667@cindex LM32 options 20668 20669These @option{-m} options are defined for the LatticeMico32 architecture: 20670 20671@table @gcctabopt 20672@item -mbarrel-shift-enabled 20673@opindex mbarrel-shift-enabled 20674Enable barrel-shift instructions. 20675 20676@item -mdivide-enabled 20677@opindex mdivide-enabled 20678Enable divide and modulus instructions. 20679 20680@item -mmultiply-enabled 20681@opindex multiply-enabled 20682Enable multiply instructions. 20683 20684@item -msign-extend-enabled 20685@opindex msign-extend-enabled 20686Enable sign extend instructions. 20687 20688@item -muser-enabled 20689@opindex muser-enabled 20690Enable user-defined instructions. 20691 20692@end table 20693 20694@node M32C Options 20695@subsection M32C Options 20696@cindex M32C options 20697 20698@table @gcctabopt 20699@item -mcpu=@var{name} 20700@opindex mcpu= 20701Select the CPU for which code is generated. @var{name} may be one of 20702@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 20703/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 20704the M32C/80 series. 20705 20706@item -msim 20707@opindex msim 20708Specifies that the program will be run on the simulator. This causes 20709an alternate runtime library to be linked in which supports, for 20710example, file I/O@. You must not use this option when generating 20711programs that will run on real hardware; you must provide your own 20712runtime library for whatever I/O functions are needed. 20713 20714@item -memregs=@var{number} 20715@opindex memregs= 20716Specifies the number of memory-based pseudo-registers GCC uses 20717during code generation. These pseudo-registers are used like real 20718registers, so there is a tradeoff between GCC's ability to fit the 20719code into available registers, and the performance penalty of using 20720memory instead of registers. Note that all modules in a program must 20721be compiled with the same value for this option. Because of that, you 20722must not use this option with GCC's default runtime libraries. 20723 20724@end table 20725 20726@node M32R/D Options 20727@subsection M32R/D Options 20728@cindex M32R/D options 20729 20730These @option{-m} options are defined for Renesas M32R/D architectures: 20731 20732@table @gcctabopt 20733@item -m32r2 20734@opindex m32r2 20735Generate code for the M32R/2@. 20736 20737@item -m32rx 20738@opindex m32rx 20739Generate code for the M32R/X@. 20740 20741@item -m32r 20742@opindex m32r 20743Generate code for the M32R@. This is the default. 20744 20745@item -mmodel=small 20746@opindex mmodel=small 20747Assume all objects live in the lower 16MB of memory (so that their addresses 20748can be loaded with the @code{ld24} instruction), and assume all subroutines 20749are reachable with the @code{bl} instruction. 20750This is the default. 20751 20752The addressability of a particular object can be set with the 20753@code{model} attribute. 20754 20755@item -mmodel=medium 20756@opindex mmodel=medium 20757Assume objects may be anywhere in the 32-bit address space (the compiler 20758generates @code{seth/add3} instructions to load their addresses), and 20759assume all subroutines are reachable with the @code{bl} instruction. 20760 20761@item -mmodel=large 20762@opindex mmodel=large 20763Assume objects may be anywhere in the 32-bit address space (the compiler 20764generates @code{seth/add3} instructions to load their addresses), and 20765assume subroutines may not be reachable with the @code{bl} instruction 20766(the compiler generates the much slower @code{seth/add3/jl} 20767instruction sequence). 20768 20769@item -msdata=none 20770@opindex msdata=none 20771Disable use of the small data area. Variables are put into 20772one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 20773@code{section} attribute has been specified). 20774This is the default. 20775 20776The small data area consists of sections @code{.sdata} and @code{.sbss}. 20777Objects may be explicitly put in the small data area with the 20778@code{section} attribute using one of these sections. 20779 20780@item -msdata=sdata 20781@opindex msdata=sdata 20782Put small global and static data in the small data area, but do not 20783generate special code to reference them. 20784 20785@item -msdata=use 20786@opindex msdata=use 20787Put small global and static data in the small data area, and generate 20788special instructions to reference them. 20789 20790@item -G @var{num} 20791@opindex G 20792@cindex smaller data references 20793Put global and static objects less than or equal to @var{num} bytes 20794into the small data or BSS sections instead of the normal data or BSS 20795sections. The default value of @var{num} is 8. 20796The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 20797for this option to have any effect. 20798 20799All modules should be compiled with the same @option{-G @var{num}} value. 20800Compiling with different values of @var{num} may or may not work; if it 20801doesn't the linker gives an error message---incorrect code is not 20802generated. 20803 20804@item -mdebug 20805@opindex mdebug 20806Makes the M32R-specific code in the compiler display some statistics 20807that might help in debugging programs. 20808 20809@item -malign-loops 20810@opindex malign-loops 20811Align all loops to a 32-byte boundary. 20812 20813@item -mno-align-loops 20814@opindex mno-align-loops 20815Do not enforce a 32-byte alignment for loops. This is the default. 20816 20817@item -missue-rate=@var{number} 20818@opindex missue-rate=@var{number} 20819Issue @var{number} instructions per cycle. @var{number} can only be 1 20820or 2. 20821 20822@item -mbranch-cost=@var{number} 20823@opindex mbranch-cost=@var{number} 20824@var{number} can only be 1 or 2. If it is 1 then branches are 20825preferred over conditional code, if it is 2, then the opposite applies. 20826 20827@item -mflush-trap=@var{number} 20828@opindex mflush-trap=@var{number} 20829Specifies the trap number to use to flush the cache. The default is 2083012. Valid numbers are between 0 and 15 inclusive. 20831 20832@item -mno-flush-trap 20833@opindex mno-flush-trap 20834Specifies that the cache cannot be flushed by using a trap. 20835 20836@item -mflush-func=@var{name} 20837@opindex mflush-func=@var{name} 20838Specifies the name of the operating system function to call to flush 20839the cache. The default is @samp{_flush_cache}, but a function call 20840is only used if a trap is not available. 20841 20842@item -mno-flush-func 20843@opindex mno-flush-func 20844Indicates that there is no OS function for flushing the cache. 20845 20846@end table 20847 20848@node M680x0 Options 20849@subsection M680x0 Options 20850@cindex M680x0 options 20851 20852These are the @samp{-m} options defined for M680x0 and ColdFire processors. 20853The default settings depend on which architecture was selected when 20854the compiler was configured; the defaults for the most common choices 20855are given below. 20856 20857@table @gcctabopt 20858@item -march=@var{arch} 20859@opindex march 20860Generate code for a specific M680x0 or ColdFire instruction set 20861architecture. Permissible values of @var{arch} for M680x0 20862architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 20863@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 20864architectures are selected according to Freescale's ISA classification 20865and the permissible values are: @samp{isaa}, @samp{isaaplus}, 20866@samp{isab} and @samp{isac}. 20867 20868GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 20869code for a ColdFire target. The @var{arch} in this macro is one of the 20870@option{-march} arguments given above. 20871 20872When used together, @option{-march} and @option{-mtune} select code 20873that runs on a family of similar processors but that is optimized 20874for a particular microarchitecture. 20875 20876@item -mcpu=@var{cpu} 20877@opindex mcpu 20878Generate code for a specific M680x0 or ColdFire processor. 20879The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 20880@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 20881and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 20882below, which also classifies the CPUs into families: 20883 20884@multitable @columnfractions 0.20 0.80 20885@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 20886@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} 20887@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 20888@item @samp{5206e} @tab @samp{5206e} 20889@item @samp{5208} @tab @samp{5207} @samp{5208} 20890@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 20891@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 20892@item @samp{5216} @tab @samp{5214} @samp{5216} 20893@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 20894@item @samp{5225} @tab @samp{5224} @samp{5225} 20895@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 20896@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 20897@item @samp{5249} @tab @samp{5249} 20898@item @samp{5250} @tab @samp{5250} 20899@item @samp{5271} @tab @samp{5270} @samp{5271} 20900@item @samp{5272} @tab @samp{5272} 20901@item @samp{5275} @tab @samp{5274} @samp{5275} 20902@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 20903@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 20904@item @samp{5307} @tab @samp{5307} 20905@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 20906@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 20907@item @samp{5407} @tab @samp{5407} 20908@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} 20909@end multitable 20910 20911@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 20912@var{arch} is compatible with @var{cpu}. Other combinations of 20913@option{-mcpu} and @option{-march} are rejected. 20914 20915GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 20916@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 20917where the value of @var{family} is given by the table above. 20918 20919@item -mtune=@var{tune} 20920@opindex mtune 20921Tune the code for a particular microarchitecture within the 20922constraints set by @option{-march} and @option{-mcpu}. 20923The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 20924@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 20925and @samp{cpu32}. The ColdFire microarchitectures 20926are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 20927 20928You can also use @option{-mtune=68020-40} for code that needs 20929to run relatively well on 68020, 68030 and 68040 targets. 20930@option{-mtune=68020-60} is similar but includes 68060 targets 20931as well. These two options select the same tuning decisions as 20932@option{-m68020-40} and @option{-m68020-60} respectively. 20933 20934GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 20935when tuning for 680x0 architecture @var{arch}. It also defines 20936@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 20937option is used. If GCC is tuning for a range of architectures, 20938as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 20939it defines the macros for every architecture in the range. 20940 20941GCC also defines the macro @code{__m@var{uarch}__} when tuning for 20942ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 20943of the arguments given above. 20944 20945@item -m68000 20946@itemx -mc68000 20947@opindex m68000 20948@opindex mc68000 20949Generate output for a 68000. This is the default 20950when the compiler is configured for 68000-based systems. 20951It is equivalent to @option{-march=68000}. 20952 20953Use this option for microcontrollers with a 68000 or EC000 core, 20954including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 20955 20956@item -m68010 20957@opindex m68010 20958Generate output for a 68010. This is the default 20959when the compiler is configured for 68010-based systems. 20960It is equivalent to @option{-march=68010}. 20961 20962@item -m68020 20963@itemx -mc68020 20964@opindex m68020 20965@opindex mc68020 20966Generate output for a 68020. This is the default 20967when the compiler is configured for 68020-based systems. 20968It is equivalent to @option{-march=68020}. 20969 20970@item -m68030 20971@opindex m68030 20972Generate output for a 68030. This is the default when the compiler is 20973configured for 68030-based systems. It is equivalent to 20974@option{-march=68030}. 20975 20976@item -m68040 20977@opindex m68040 20978Generate output for a 68040. This is the default when the compiler is 20979configured for 68040-based systems. It is equivalent to 20980@option{-march=68040}. 20981 20982This option inhibits the use of 68881/68882 instructions that have to be 20983emulated by software on the 68040. Use this option if your 68040 does not 20984have code to emulate those instructions. 20985 20986@item -m68060 20987@opindex m68060 20988Generate output for a 68060. This is the default when the compiler is 20989configured for 68060-based systems. It is equivalent to 20990@option{-march=68060}. 20991 20992This option inhibits the use of 68020 and 68881/68882 instructions that 20993have to be emulated by software on the 68060. Use this option if your 68060 20994does not have code to emulate those instructions. 20995 20996@item -mcpu32 20997@opindex mcpu32 20998Generate output for a CPU32. This is the default 20999when the compiler is configured for CPU32-based systems. 21000It is equivalent to @option{-march=cpu32}. 21001 21002Use this option for microcontrollers with a 21003CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 2100468336, 68340, 68341, 68349 and 68360. 21005 21006@item -m5200 21007@opindex m5200 21008Generate output for a 520X ColdFire CPU@. This is the default 21009when the compiler is configured for 520X-based systems. 21010It is equivalent to @option{-mcpu=5206}, and is now deprecated 21011in favor of that option. 21012 21013Use this option for microcontroller with a 5200 core, including 21014the MCF5202, MCF5203, MCF5204 and MCF5206. 21015 21016@item -m5206e 21017@opindex m5206e 21018Generate output for a 5206e ColdFire CPU@. The option is now 21019deprecated in favor of the equivalent @option{-mcpu=5206e}. 21020 21021@item -m528x 21022@opindex m528x 21023Generate output for a member of the ColdFire 528X family. 21024The option is now deprecated in favor of the equivalent 21025@option{-mcpu=528x}. 21026 21027@item -m5307 21028@opindex m5307 21029Generate output for a ColdFire 5307 CPU@. The option is now deprecated 21030in favor of the equivalent @option{-mcpu=5307}. 21031 21032@item -m5407 21033@opindex m5407 21034Generate output for a ColdFire 5407 CPU@. The option is now deprecated 21035in favor of the equivalent @option{-mcpu=5407}. 21036 21037@item -mcfv4e 21038@opindex mcfv4e 21039Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 21040This includes use of hardware floating-point instructions. 21041The option is equivalent to @option{-mcpu=547x}, and is now 21042deprecated in favor of that option. 21043 21044@item -m68020-40 21045@opindex m68020-40 21046Generate output for a 68040, without using any of the new instructions. 21047This results in code that can run relatively efficiently on either a 2104868020/68881 or a 68030 or a 68040. The generated code does use the 2104968881 instructions that are emulated on the 68040. 21050 21051The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 21052 21053@item -m68020-60 21054@opindex m68020-60 21055Generate output for a 68060, without using any of the new instructions. 21056This results in code that can run relatively efficiently on either a 2105768020/68881 or a 68030 or a 68040. The generated code does use the 2105868881 instructions that are emulated on the 68060. 21059 21060The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 21061 21062@item -mhard-float 21063@itemx -m68881 21064@opindex mhard-float 21065@opindex m68881 21066Generate floating-point instructions. This is the default for 68020 21067and above, and for ColdFire devices that have an FPU@. It defines the 21068macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 21069on ColdFire targets. 21070 21071@item -msoft-float 21072@opindex msoft-float 21073Do not generate floating-point instructions; use library calls instead. 21074This is the default for 68000, 68010, and 68832 targets. It is also 21075the default for ColdFire devices that have no FPU. 21076 21077@item -mdiv 21078@itemx -mno-div 21079@opindex mdiv 21080@opindex mno-div 21081Generate (do not generate) ColdFire hardware divide and remainder 21082instructions. If @option{-march} is used without @option{-mcpu}, 21083the default is ``on'' for ColdFire architectures and ``off'' for M680x0 21084architectures. Otherwise, the default is taken from the target CPU 21085(either the default CPU, or the one specified by @option{-mcpu}). For 21086example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 21087@option{-mcpu=5206e}. 21088 21089GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 21090 21091@item -mshort 21092@opindex mshort 21093Consider type @code{int} to be 16 bits wide, like @code{short int}. 21094Additionally, parameters passed on the stack are also aligned to a 2109516-bit boundary even on targets whose API mandates promotion to 32-bit. 21096 21097@item -mno-short 21098@opindex mno-short 21099Do not consider type @code{int} to be 16 bits wide. This is the default. 21100 21101@item -mnobitfield 21102@itemx -mno-bitfield 21103@opindex mnobitfield 21104@opindex mno-bitfield 21105Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 21106and @option{-m5200} options imply @w{@option{-mnobitfield}}. 21107 21108@item -mbitfield 21109@opindex mbitfield 21110Do use the bit-field instructions. The @option{-m68020} option implies 21111@option{-mbitfield}. This is the default if you use a configuration 21112designed for a 68020. 21113 21114@item -mrtd 21115@opindex mrtd 21116Use a different function-calling convention, in which functions 21117that take a fixed number of arguments return with the @code{rtd} 21118instruction, which pops their arguments while returning. This 21119saves one instruction in the caller since there is no need to pop 21120the arguments there. 21121 21122This calling convention is incompatible with the one normally 21123used on Unix, so you cannot use it if you need to call libraries 21124compiled with the Unix compiler. 21125 21126Also, you must provide function prototypes for all functions that 21127take variable numbers of arguments (including @code{printf}); 21128otherwise incorrect code is generated for calls to those 21129functions. 21130 21131In addition, seriously incorrect code results if you call a 21132function with too many arguments. (Normally, extra arguments are 21133harmlessly ignored.) 21134 21135The @code{rtd} instruction is supported by the 68010, 68020, 68030, 2113668040, 68060 and CPU32 processors, but not by the 68000 or 5200. 21137 21138The default is @option{-mno-rtd}. 21139 21140@item -malign-int 21141@itemx -mno-align-int 21142@opindex malign-int 21143@opindex mno-align-int 21144Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 21145@code{float}, @code{double}, and @code{long double} variables on a 32-bit 21146boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 21147Aligning variables on 32-bit boundaries produces code that runs somewhat 21148faster on processors with 32-bit busses at the expense of more memory. 21149 21150@strong{Warning:} if you use the @option{-malign-int} switch, GCC 21151aligns structures containing the above types differently than 21152most published application binary interface specifications for the m68k. 21153 21154@item -mpcrel 21155@opindex mpcrel 21156Use the pc-relative addressing mode of the 68000 directly, instead of 21157using a global offset table. At present, this option implies @option{-fpic}, 21158allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 21159not presently supported with @option{-mpcrel}, though this could be supported for 2116068020 and higher processors. 21161 21162@item -mno-strict-align 21163@itemx -mstrict-align 21164@opindex mno-strict-align 21165@opindex mstrict-align 21166Do not (do) assume that unaligned memory references are handled by 21167the system. 21168 21169@item -msep-data 21170Generate code that allows the data segment to be located in a different 21171area of memory from the text segment. This allows for execute-in-place in 21172an environment without virtual memory management. This option implies 21173@option{-fPIC}. 21174 21175@item -mno-sep-data 21176Generate code that assumes that the data segment follows the text segment. 21177This is the default. 21178 21179@item -mid-shared-library 21180Generate code that supports shared libraries via the library ID method. 21181This allows for execute-in-place and shared libraries in an environment 21182without virtual memory management. This option implies @option{-fPIC}. 21183 21184@item -mno-id-shared-library 21185Generate code that doesn't assume ID-based shared libraries are being used. 21186This is the default. 21187 21188@item -mshared-library-id=n 21189Specifies the identification number of the ID-based shared library being 21190compiled. Specifying a value of 0 generates more compact code; specifying 21191other values forces the allocation of that number to the current 21192library, but is no more space- or time-efficient than omitting this option. 21193 21194@item -mxgot 21195@itemx -mno-xgot 21196@opindex mxgot 21197@opindex mno-xgot 21198When generating position-independent code for ColdFire, generate code 21199that works if the GOT has more than 8192 entries. This code is 21200larger and slower than code generated without this option. On M680x0 21201processors, this option is not needed; @option{-fPIC} suffices. 21202 21203GCC normally uses a single instruction to load values from the GOT@. 21204While this is relatively efficient, it only works if the GOT 21205is smaller than about 64k. Anything larger causes the linker 21206to report an error such as: 21207 21208@cindex relocation truncated to fit (ColdFire) 21209@smallexample 21210relocation truncated to fit: R_68K_GOT16O foobar 21211@end smallexample 21212 21213If this happens, you should recompile your code with @option{-mxgot}. 21214It should then work with very large GOTs. However, code generated with 21215@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 21216the value of a global symbol. 21217 21218Note that some linkers, including newer versions of the GNU linker, 21219can create multiple GOTs and sort GOT entries. If you have such a linker, 21220you should only need to use @option{-mxgot} when compiling a single 21221object file that accesses more than 8192 GOT entries. Very few do. 21222 21223These options have no effect unless GCC is generating 21224position-independent code. 21225 21226@item -mlong-jump-table-offsets 21227@opindex mlong-jump-table-offsets 21228Use 32-bit offsets in @code{switch} tables. The default is to use 2122916-bit offsets. 21230 21231@end table 21232 21233@node MCore Options 21234@subsection MCore Options 21235@cindex MCore options 21236 21237These are the @samp{-m} options defined for the Motorola M*Core 21238processors. 21239 21240@table @gcctabopt 21241 21242@item -mhardlit 21243@itemx -mno-hardlit 21244@opindex mhardlit 21245@opindex mno-hardlit 21246Inline constants into the code stream if it can be done in two 21247instructions or less. 21248 21249@item -mdiv 21250@itemx -mno-div 21251@opindex mdiv 21252@opindex mno-div 21253Use the divide instruction. (Enabled by default). 21254 21255@item -mrelax-immediate 21256@itemx -mno-relax-immediate 21257@opindex mrelax-immediate 21258@opindex mno-relax-immediate 21259Allow arbitrary-sized immediates in bit operations. 21260 21261@item -mwide-bitfields 21262@itemx -mno-wide-bitfields 21263@opindex mwide-bitfields 21264@opindex mno-wide-bitfields 21265Always treat bit-fields as @code{int}-sized. 21266 21267@item -m4byte-functions 21268@itemx -mno-4byte-functions 21269@opindex m4byte-functions 21270@opindex mno-4byte-functions 21271Force all functions to be aligned to a 4-byte boundary. 21272 21273@item -mcallgraph-data 21274@itemx -mno-callgraph-data 21275@opindex mcallgraph-data 21276@opindex mno-callgraph-data 21277Emit callgraph information. 21278 21279@item -mslow-bytes 21280@itemx -mno-slow-bytes 21281@opindex mslow-bytes 21282@opindex mno-slow-bytes 21283Prefer word access when reading byte quantities. 21284 21285@item -mlittle-endian 21286@itemx -mbig-endian 21287@opindex mlittle-endian 21288@opindex mbig-endian 21289Generate code for a little-endian target. 21290 21291@item -m210 21292@itemx -m340 21293@opindex m210 21294@opindex m340 21295Generate code for the 210 processor. 21296 21297@item -mno-lsim 21298@opindex mno-lsim 21299Assume that runtime support has been provided and so omit the 21300simulator library (@file{libsim.a)} from the linker command line. 21301 21302@item -mstack-increment=@var{size} 21303@opindex mstack-increment 21304Set the maximum amount for a single stack increment operation. Large 21305values can increase the speed of programs that contain functions 21306that need a large amount of stack space, but they can also trigger a 21307segmentation fault if the stack is extended too much. The default 21308value is 0x1000. 21309 21310@end table 21311 21312@node MeP Options 21313@subsection MeP Options 21314@cindex MeP options 21315 21316@table @gcctabopt 21317 21318@item -mabsdiff 21319@opindex mabsdiff 21320Enables the @code{abs} instruction, which is the absolute difference 21321between two registers. 21322 21323@item -mall-opts 21324@opindex mall-opts 21325Enables all the optional instructions---average, multiply, divide, bit 21326operations, leading zero, absolute difference, min/max, clip, and 21327saturation. 21328 21329 21330@item -maverage 21331@opindex maverage 21332Enables the @code{ave} instruction, which computes the average of two 21333registers. 21334 21335@item -mbased=@var{n} 21336@opindex mbased= 21337Variables of size @var{n} bytes or smaller are placed in the 21338@code{.based} section by default. Based variables use the @code{$tp} 21339register as a base register, and there is a 128-byte limit to the 21340@code{.based} section. 21341 21342@item -mbitops 21343@opindex mbitops 21344Enables the bit operation instructions---bit test (@code{btstm}), set 21345(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 21346test-and-set (@code{tas}). 21347 21348@item -mc=@var{name} 21349@opindex mc= 21350Selects which section constant data is placed in. @var{name} may 21351be @samp{tiny}, @samp{near}, or @samp{far}. 21352 21353@item -mclip 21354@opindex mclip 21355Enables the @code{clip} instruction. Note that @option{-mclip} is not 21356useful unless you also provide @option{-mminmax}. 21357 21358@item -mconfig=@var{name} 21359@opindex mconfig= 21360Selects one of the built-in core configurations. Each MeP chip has 21361one or more modules in it; each module has a core CPU and a variety of 21362coprocessors, optional instructions, and peripherals. The 21363@code{MeP-Integrator} tool, not part of GCC, provides these 21364configurations through this option; using this option is the same as 21365using all the corresponding command-line options. The default 21366configuration is @samp{default}. 21367 21368@item -mcop 21369@opindex mcop 21370Enables the coprocessor instructions. By default, this is a 32-bit 21371coprocessor. Note that the coprocessor is normally enabled via the 21372@option{-mconfig=} option. 21373 21374@item -mcop32 21375@opindex mcop32 21376Enables the 32-bit coprocessor's instructions. 21377 21378@item -mcop64 21379@opindex mcop64 21380Enables the 64-bit coprocessor's instructions. 21381 21382@item -mivc2 21383@opindex mivc2 21384Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 21385 21386@item -mdc 21387@opindex mdc 21388Causes constant variables to be placed in the @code{.near} section. 21389 21390@item -mdiv 21391@opindex mdiv 21392Enables the @code{div} and @code{divu} instructions. 21393 21394@item -meb 21395@opindex meb 21396Generate big-endian code. 21397 21398@item -mel 21399@opindex mel 21400Generate little-endian code. 21401 21402@item -mio-volatile 21403@opindex mio-volatile 21404Tells the compiler that any variable marked with the @code{io} 21405attribute is to be considered volatile. 21406 21407@item -ml 21408@opindex ml 21409Causes variables to be assigned to the @code{.far} section by default. 21410 21411@item -mleadz 21412@opindex mleadz 21413Enables the @code{leadz} (leading zero) instruction. 21414 21415@item -mm 21416@opindex mm 21417Causes variables to be assigned to the @code{.near} section by default. 21418 21419@item -mminmax 21420@opindex mminmax 21421Enables the @code{min} and @code{max} instructions. 21422 21423@item -mmult 21424@opindex mmult 21425Enables the multiplication and multiply-accumulate instructions. 21426 21427@item -mno-opts 21428@opindex mno-opts 21429Disables all the optional instructions enabled by @option{-mall-opts}. 21430 21431@item -mrepeat 21432@opindex mrepeat 21433Enables the @code{repeat} and @code{erepeat} instructions, used for 21434low-overhead looping. 21435 21436@item -ms 21437@opindex ms 21438Causes all variables to default to the @code{.tiny} section. Note 21439that there is a 65536-byte limit to this section. Accesses to these 21440variables use the @code{%gp} base register. 21441 21442@item -msatur 21443@opindex msatur 21444Enables the saturation instructions. Note that the compiler does not 21445currently generate these itself, but this option is included for 21446compatibility with other tools, like @code{as}. 21447 21448@item -msdram 21449@opindex msdram 21450Link the SDRAM-based runtime instead of the default ROM-based runtime. 21451 21452@item -msim 21453@opindex msim 21454Link the simulator run-time libraries. 21455 21456@item -msimnovec 21457@opindex msimnovec 21458Link the simulator runtime libraries, excluding built-in support 21459for reset and exception vectors and tables. 21460 21461@item -mtf 21462@opindex mtf 21463Causes all functions to default to the @code{.far} section. Without 21464this option, functions default to the @code{.near} section. 21465 21466@item -mtiny=@var{n} 21467@opindex mtiny= 21468Variables that are @var{n} bytes or smaller are allocated to the 21469@code{.tiny} section. These variables use the @code{$gp} base 21470register. The default for this option is 4, but note that there's a 2147165536-byte limit to the @code{.tiny} section. 21472 21473@end table 21474 21475@node MicroBlaze Options 21476@subsection MicroBlaze Options 21477@cindex MicroBlaze Options 21478 21479@table @gcctabopt 21480 21481@item -msoft-float 21482@opindex msoft-float 21483Use software emulation for floating point (default). 21484 21485@item -mhard-float 21486@opindex mhard-float 21487Use hardware floating-point instructions. 21488 21489@item -mmemcpy 21490@opindex mmemcpy 21491Do not optimize block moves, use @code{memcpy}. 21492 21493@item -mno-clearbss 21494@opindex mno-clearbss 21495This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 21496 21497@item -mcpu=@var{cpu-type} 21498@opindex mcpu= 21499Use features of, and schedule code for, the given CPU. 21500Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 21501where @var{X} is a major version, @var{YY} is the minor version, and 21502@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 21503@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}. 21504 21505@item -mxl-soft-mul 21506@opindex mxl-soft-mul 21507Use software multiply emulation (default). 21508 21509@item -mxl-soft-div 21510@opindex mxl-soft-div 21511Use software emulation for divides (default). 21512 21513@item -mxl-barrel-shift 21514@opindex mxl-barrel-shift 21515Use the hardware barrel shifter. 21516 21517@item -mxl-pattern-compare 21518@opindex mxl-pattern-compare 21519Use pattern compare instructions. 21520 21521@item -msmall-divides 21522@opindex msmall-divides 21523Use table lookup optimization for small signed integer divisions. 21524 21525@item -mxl-stack-check 21526@opindex mxl-stack-check 21527This option is deprecated. Use @option{-fstack-check} instead. 21528 21529@item -mxl-gp-opt 21530@opindex mxl-gp-opt 21531Use GP-relative @code{.sdata}/@code{.sbss} sections. 21532 21533@item -mxl-multiply-high 21534@opindex mxl-multiply-high 21535Use multiply high instructions for high part of 32x32 multiply. 21536 21537@item -mxl-float-convert 21538@opindex mxl-float-convert 21539Use hardware floating-point conversion instructions. 21540 21541@item -mxl-float-sqrt 21542@opindex mxl-float-sqrt 21543Use hardware floating-point square root instruction. 21544 21545@item -mbig-endian 21546@opindex mbig-endian 21547Generate code for a big-endian target. 21548 21549@item -mlittle-endian 21550@opindex mlittle-endian 21551Generate code for a little-endian target. 21552 21553@item -mxl-reorder 21554@opindex mxl-reorder 21555Use reorder instructions (swap and byte reversed load/store). 21556 21557@item -mxl-mode-@var{app-model} 21558Select application model @var{app-model}. Valid models are 21559@table @samp 21560@item executable 21561normal executable (default), uses startup code @file{crt0.o}. 21562 21563@item -mpic-data-is-text-relative 21564@opindex mpic-data-is-text-relative 21565Assume that the displacement between the text and data segments is fixed 21566at static link time. This allows data to be referenced by offset from start of 21567text address instead of GOT since PC-relative addressing is not supported. 21568 21569@item xmdstub 21570for use with Xilinx Microprocessor Debugger (XMD) based 21571software intrusive debug agent called xmdstub. This uses startup file 21572@file{crt1.o} and sets the start address of the program to 0x800. 21573 21574@item bootstrap 21575for applications that are loaded using a bootloader. 21576This model uses startup file @file{crt2.o} which does not contain a processor 21577reset vector handler. This is suitable for transferring control on a 21578processor reset to the bootloader rather than the application. 21579 21580@item novectors 21581for applications that do not require any of the 21582MicroBlaze vectors. This option may be useful for applications running 21583within a monitoring application. This model uses @file{crt3.o} as a startup file. 21584@end table 21585 21586Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 21587@option{-mxl-mode-@var{app-model}}. 21588 21589@end table 21590 21591@node MIPS Options 21592@subsection MIPS Options 21593@cindex MIPS options 21594 21595@table @gcctabopt 21596 21597@item -EB 21598@opindex EB 21599Generate big-endian code. 21600 21601@item -EL 21602@opindex EL 21603Generate little-endian code. This is the default for @samp{mips*el-*-*} 21604configurations. 21605 21606@item -march=@var{arch} 21607@opindex march 21608Generate code that runs on @var{arch}, which can be the name of a 21609generic MIPS ISA, or the name of a particular processor. 21610The ISA names are: 21611@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 21612@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 21613@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 21614@samp{mips64r5} and @samp{mips64r6}. 21615The processor names are: 21616@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 21617@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 21618@samp{5kc}, @samp{5kf}, 21619@samp{20kc}, 21620@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 21621@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 21622@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 21623@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 21624@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 21625@samp{i6400}, @samp{i6500}, 21626@samp{interaptiv}, 21627@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464}, 21628@samp{gs464e}, @samp{gs264e}, 21629@samp{m4k}, 21630@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 21631@samp{m5100}, @samp{m5101}, 21632@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 21633@samp{orion}, 21634@samp{p5600}, @samp{p6600}, 21635@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 21636@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900}, 21637@samp{r6000}, @samp{r8000}, 21638@samp{rm7000}, @samp{rm9000}, 21639@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 21640@samp{sb1}, 21641@samp{sr71000}, 21642@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 21643@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 21644@samp{xlr} and @samp{xlp}. 21645The special value @samp{from-abi} selects the 21646most compatible architecture for the selected ABI (that is, 21647@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 21648 21649The native Linux/GNU toolchain also supports the value @samp{native}, 21650which selects the best architecture option for the host processor. 21651@option{-march=native} has no effect if GCC does not recognize 21652the processor. 21653 21654In processor names, a final @samp{000} can be abbreviated as @samp{k} 21655(for example, @option{-march=r2k}). Prefixes are optional, and 21656@samp{vr} may be written @samp{r}. 21657 21658Names of the form @samp{@var{n}f2_1} refer to processors with 21659FPUs clocked at half the rate of the core, names of the form 21660@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 21661rate as the core, and names of the form @samp{@var{n}f3_2} refer to 21662processors with FPUs clocked a ratio of 3:2 with respect to the core. 21663For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 21664for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 21665accepted as synonyms for @samp{@var{n}f1_1}. 21666 21667GCC defines two macros based on the value of this option. The first 21668is @code{_MIPS_ARCH}, which gives the name of target architecture, as 21669a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 21670where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 21671For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 21672to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 21673 21674Note that the @code{_MIPS_ARCH} macro uses the processor names given 21675above. In other words, it has the full prefix and does not 21676abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 21677the macro names the resolved architecture (either @code{"mips1"} or 21678@code{"mips3"}). It names the default architecture when no 21679@option{-march} option is given. 21680 21681@item -mtune=@var{arch} 21682@opindex mtune 21683Optimize for @var{arch}. Among other things, this option controls 21684the way instructions are scheduled, and the perceived cost of arithmetic 21685operations. The list of @var{arch} values is the same as for 21686@option{-march}. 21687 21688When this option is not used, GCC optimizes for the processor 21689specified by @option{-march}. By using @option{-march} and 21690@option{-mtune} together, it is possible to generate code that 21691runs on a family of processors, but optimize the code for one 21692particular member of that family. 21693 21694@option{-mtune} defines the macros @code{_MIPS_TUNE} and 21695@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 21696@option{-march} ones described above. 21697 21698@item -mips1 21699@opindex mips1 21700Equivalent to @option{-march=mips1}. 21701 21702@item -mips2 21703@opindex mips2 21704Equivalent to @option{-march=mips2}. 21705 21706@item -mips3 21707@opindex mips3 21708Equivalent to @option{-march=mips3}. 21709 21710@item -mips4 21711@opindex mips4 21712Equivalent to @option{-march=mips4}. 21713 21714@item -mips32 21715@opindex mips32 21716Equivalent to @option{-march=mips32}. 21717 21718@item -mips32r3 21719@opindex mips32r3 21720Equivalent to @option{-march=mips32r3}. 21721 21722@item -mips32r5 21723@opindex mips32r5 21724Equivalent to @option{-march=mips32r5}. 21725 21726@item -mips32r6 21727@opindex mips32r6 21728Equivalent to @option{-march=mips32r6}. 21729 21730@item -mips64 21731@opindex mips64 21732Equivalent to @option{-march=mips64}. 21733 21734@item -mips64r2 21735@opindex mips64r2 21736Equivalent to @option{-march=mips64r2}. 21737 21738@item -mips64r3 21739@opindex mips64r3 21740Equivalent to @option{-march=mips64r3}. 21741 21742@item -mips64r5 21743@opindex mips64r5 21744Equivalent to @option{-march=mips64r5}. 21745 21746@item -mips64r6 21747@opindex mips64r6 21748Equivalent to @option{-march=mips64r6}. 21749 21750@item -mips16 21751@itemx -mno-mips16 21752@opindex mips16 21753@opindex mno-mips16 21754Generate (do not generate) MIPS16 code. If GCC is targeting a 21755MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 21756 21757MIPS16 code generation can also be controlled on a per-function basis 21758by means of @code{mips16} and @code{nomips16} attributes. 21759@xref{Function Attributes}, for more information. 21760 21761@item -mflip-mips16 21762@opindex mflip-mips16 21763Generate MIPS16 code on alternating functions. This option is provided 21764for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 21765not intended for ordinary use in compiling user code. 21766 21767@item -minterlink-compressed 21768@itemx -mno-interlink-compressed 21769@opindex minterlink-compressed 21770@opindex mno-interlink-compressed 21771Require (do not require) that code using the standard (uncompressed) MIPS ISA 21772be link-compatible with MIPS16 and microMIPS code, and vice versa. 21773 21774For example, code using the standard ISA encoding cannot jump directly 21775to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 21776@option{-minterlink-compressed} therefore disables direct jumps unless GCC 21777knows that the target of the jump is not compressed. 21778 21779@item -minterlink-mips16 21780@itemx -mno-interlink-mips16 21781@opindex minterlink-mips16 21782@opindex mno-interlink-mips16 21783Aliases of @option{-minterlink-compressed} and 21784@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 21785and are retained for backwards compatibility. 21786 21787@item -mabi=32 21788@itemx -mabi=o64 21789@itemx -mabi=n32 21790@itemx -mabi=64 21791@itemx -mabi=eabi 21792@opindex mabi=32 21793@opindex mabi=o64 21794@opindex mabi=n32 21795@opindex mabi=64 21796@opindex mabi=eabi 21797Generate code for the given ABI@. 21798 21799Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 21800generates 64-bit code when you select a 64-bit architecture, but you 21801can use @option{-mgp32} to get 32-bit code instead. 21802 21803For information about the O64 ABI, see 21804@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 21805 21806GCC supports a variant of the o32 ABI in which floating-point registers 21807are 64 rather than 32 bits wide. You can select this combination with 21808@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 21809and @code{mfhc1} instructions and is therefore only supported for 21810MIPS32R2, MIPS32R3 and MIPS32R5 processors. 21811 21812The register assignments for arguments and return values remain the 21813same, but each scalar value is passed in a single 64-bit register 21814rather than a pair of 32-bit registers. For example, scalar 21815floating-point values are returned in @samp{$f0} only, not a 21816@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 21817remains the same in that the even-numbered double-precision registers 21818are saved. 21819 21820Two additional variants of the o32 ABI are supported to enable 21821a transition from 32-bit to 64-bit registers. These are FPXX 21822(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 21823The FPXX extension mandates that all code must execute correctly 21824when run using 32-bit or 64-bit registers. The code can be interlinked 21825with either FP32 or FP64, but not both. 21826The FP64A extension is similar to the FP64 extension but forbids the 21827use of odd-numbered single-precision registers. This can be used 21828in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 21829processors and allows both FP32 and FP64A code to interlink and 21830run in the same process without changing FPU modes. 21831 21832@item -mabicalls 21833@itemx -mno-abicalls 21834@opindex mabicalls 21835@opindex mno-abicalls 21836Generate (do not generate) code that is suitable for SVR4-style 21837dynamic objects. @option{-mabicalls} is the default for SVR4-based 21838systems. 21839 21840@item -mshared 21841@itemx -mno-shared 21842Generate (do not generate) code that is fully position-independent, 21843and that can therefore be linked into shared libraries. This option 21844only affects @option{-mabicalls}. 21845 21846All @option{-mabicalls} code has traditionally been position-independent, 21847regardless of options like @option{-fPIC} and @option{-fpic}. However, 21848as an extension, the GNU toolchain allows executables to use absolute 21849accesses for locally-binding symbols. It can also use shorter GP 21850initialization sequences and generate direct calls to locally-defined 21851functions. This mode is selected by @option{-mno-shared}. 21852 21853@option{-mno-shared} depends on binutils 2.16 or higher and generates 21854objects that can only be linked by the GNU linker. However, the option 21855does not affect the ABI of the final executable; it only affects the ABI 21856of relocatable objects. Using @option{-mno-shared} generally makes 21857executables both smaller and quicker. 21858 21859@option{-mshared} is the default. 21860 21861@item -mplt 21862@itemx -mno-plt 21863@opindex mplt 21864@opindex mno-plt 21865Assume (do not assume) that the static and dynamic linkers 21866support PLTs and copy relocations. This option only affects 21867@option{-mno-shared -mabicalls}. For the n64 ABI, this option 21868has no effect without @option{-msym32}. 21869 21870You can make @option{-mplt} the default by configuring 21871GCC with @option{--with-mips-plt}. The default is 21872@option{-mno-plt} otherwise. 21873 21874@item -mxgot 21875@itemx -mno-xgot 21876@opindex mxgot 21877@opindex mno-xgot 21878Lift (do not lift) the usual restrictions on the size of the global 21879offset table. 21880 21881GCC normally uses a single instruction to load values from the GOT@. 21882While this is relatively efficient, it only works if the GOT 21883is smaller than about 64k. Anything larger causes the linker 21884to report an error such as: 21885 21886@cindex relocation truncated to fit (MIPS) 21887@smallexample 21888relocation truncated to fit: R_MIPS_GOT16 foobar 21889@end smallexample 21890 21891If this happens, you should recompile your code with @option{-mxgot}. 21892This works with very large GOTs, although the code is also 21893less efficient, since it takes three instructions to fetch the 21894value of a global symbol. 21895 21896Note that some linkers can create multiple GOTs. If you have such a 21897linker, you should only need to use @option{-mxgot} when a single object 21898file accesses more than 64k's worth of GOT entries. Very few do. 21899 21900These options have no effect unless GCC is generating position 21901independent code. 21902 21903@item -mgp32 21904@opindex mgp32 21905Assume that general-purpose registers are 32 bits wide. 21906 21907@item -mgp64 21908@opindex mgp64 21909Assume that general-purpose registers are 64 bits wide. 21910 21911@item -mfp32 21912@opindex mfp32 21913Assume that floating-point registers are 32 bits wide. 21914 21915@item -mfp64 21916@opindex mfp64 21917Assume that floating-point registers are 64 bits wide. 21918 21919@item -mfpxx 21920@opindex mfpxx 21921Do not assume the width of floating-point registers. 21922 21923@item -mhard-float 21924@opindex mhard-float 21925Use floating-point coprocessor instructions. 21926 21927@item -msoft-float 21928@opindex msoft-float 21929Do not use floating-point coprocessor instructions. Implement 21930floating-point calculations using library calls instead. 21931 21932@item -mno-float 21933@opindex mno-float 21934Equivalent to @option{-msoft-float}, but additionally asserts that the 21935program being compiled does not perform any floating-point operations. 21936This option is presently supported only by some bare-metal MIPS 21937configurations, where it may select a special set of libraries 21938that lack all floating-point support (including, for example, the 21939floating-point @code{printf} formats). 21940If code compiled with @option{-mno-float} accidentally contains 21941floating-point operations, it is likely to suffer a link-time 21942or run-time failure. 21943 21944@item -msingle-float 21945@opindex msingle-float 21946Assume that the floating-point coprocessor only supports single-precision 21947operations. 21948 21949@item -mdouble-float 21950@opindex mdouble-float 21951Assume that the floating-point coprocessor supports double-precision 21952operations. This is the default. 21953 21954@item -modd-spreg 21955@itemx -mno-odd-spreg 21956@opindex modd-spreg 21957@opindex mno-odd-spreg 21958Enable the use of odd-numbered single-precision floating-point registers 21959for the o32 ABI. This is the default for processors that are known to 21960support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 21961is set by default. 21962 21963@item -mabs=2008 21964@itemx -mabs=legacy 21965@opindex mabs=2008 21966@opindex mabs=legacy 21967These options control the treatment of the special not-a-number (NaN) 21968IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 21969@code{neg.@i{fmt}} machine instructions. 21970 21971By default or when @option{-mabs=legacy} is used the legacy 21972treatment is selected. In this case these instructions are considered 21973arithmetic and avoided where correct operation is required and the 21974input operand might be a NaN. A longer sequence of instructions that 21975manipulate the sign bit of floating-point datum manually is used 21976instead unless the @option{-ffinite-math-only} option has also been 21977specified. 21978 21979The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 21980this case these instructions are considered non-arithmetic and therefore 21981operating correctly in all cases, including in particular where the 21982input operand is a NaN. These instructions are therefore always used 21983for the respective operations. 21984 21985@item -mnan=2008 21986@itemx -mnan=legacy 21987@opindex mnan=2008 21988@opindex mnan=legacy 21989These options control the encoding of the special not-a-number (NaN) 21990IEEE 754 floating-point data. 21991 21992The @option{-mnan=legacy} option selects the legacy encoding. In this 21993case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 21994significand field being 0, whereas signaling NaNs (sNaNs) are denoted 21995by the first bit of their trailing significand field being 1. 21996 21997The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 21998this case qNaNs are denoted by the first bit of their trailing 21999significand field being 1, whereas sNaNs are denoted by the first bit of 22000their trailing significand field being 0. 22001 22002The default is @option{-mnan=legacy} unless GCC has been configured with 22003@option{--with-nan=2008}. 22004 22005@item -mllsc 22006@itemx -mno-llsc 22007@opindex mllsc 22008@opindex mno-llsc 22009Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 22010implement atomic memory built-in functions. When neither option is 22011specified, GCC uses the instructions if the target architecture 22012supports them. 22013 22014@option{-mllsc} is useful if the runtime environment can emulate the 22015instructions and @option{-mno-llsc} can be useful when compiling for 22016nonstandard ISAs. You can make either option the default by 22017configuring GCC with @option{--with-llsc} and @option{--without-llsc} 22018respectively. @option{--with-llsc} is the default for some 22019configurations; see the installation documentation for details. 22020 22021@item -mdsp 22022@itemx -mno-dsp 22023@opindex mdsp 22024@opindex mno-dsp 22025Use (do not use) revision 1 of the MIPS DSP ASE@. 22026@xref{MIPS DSP Built-in Functions}. This option defines the 22027preprocessor macro @code{__mips_dsp}. It also defines 22028@code{__mips_dsp_rev} to 1. 22029 22030@item -mdspr2 22031@itemx -mno-dspr2 22032@opindex mdspr2 22033@opindex mno-dspr2 22034Use (do not use) revision 2 of the MIPS DSP ASE@. 22035@xref{MIPS DSP Built-in Functions}. This option defines the 22036preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 22037It also defines @code{__mips_dsp_rev} to 2. 22038 22039@item -msmartmips 22040@itemx -mno-smartmips 22041@opindex msmartmips 22042@opindex mno-smartmips 22043Use (do not use) the MIPS SmartMIPS ASE. 22044 22045@item -mpaired-single 22046@itemx -mno-paired-single 22047@opindex mpaired-single 22048@opindex mno-paired-single 22049Use (do not use) paired-single floating-point instructions. 22050@xref{MIPS Paired-Single Support}. This option requires 22051hardware floating-point support to be enabled. 22052 22053@item -mdmx 22054@itemx -mno-mdmx 22055@opindex mdmx 22056@opindex mno-mdmx 22057Use (do not use) MIPS Digital Media Extension instructions. 22058This option can only be used when generating 64-bit code and requires 22059hardware floating-point support to be enabled. 22060 22061@item -mips3d 22062@itemx -mno-mips3d 22063@opindex mips3d 22064@opindex mno-mips3d 22065Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 22066The option @option{-mips3d} implies @option{-mpaired-single}. 22067 22068@item -mmicromips 22069@itemx -mno-micromips 22070@opindex mmicromips 22071@opindex mno-mmicromips 22072Generate (do not generate) microMIPS code. 22073 22074MicroMIPS code generation can also be controlled on a per-function basis 22075by means of @code{micromips} and @code{nomicromips} attributes. 22076@xref{Function Attributes}, for more information. 22077 22078@item -mmt 22079@itemx -mno-mt 22080@opindex mmt 22081@opindex mno-mt 22082Use (do not use) MT Multithreading instructions. 22083 22084@item -mmcu 22085@itemx -mno-mcu 22086@opindex mmcu 22087@opindex mno-mcu 22088Use (do not use) the MIPS MCU ASE instructions. 22089 22090@item -meva 22091@itemx -mno-eva 22092@opindex meva 22093@opindex mno-eva 22094Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 22095 22096@item -mvirt 22097@itemx -mno-virt 22098@opindex mvirt 22099@opindex mno-virt 22100Use (do not use) the MIPS Virtualization (VZ) instructions. 22101 22102@item -mxpa 22103@itemx -mno-xpa 22104@opindex mxpa 22105@opindex mno-xpa 22106Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 22107 22108@item -mcrc 22109@itemx -mno-crc 22110@opindex mcrc 22111@opindex mno-crc 22112Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions. 22113 22114@item -mginv 22115@itemx -mno-ginv 22116@opindex mginv 22117@opindex mno-ginv 22118Use (do not use) the MIPS Global INValidate (GINV) instructions. 22119 22120@item -mloongson-mmi 22121@itemx -mno-loongson-mmi 22122@opindex mloongson-mmi 22123@opindex mno-loongson-mmi 22124Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI). 22125 22126@item -mloongson-ext 22127@itemx -mno-loongson-ext 22128@opindex mloongson-ext 22129@opindex mno-loongson-ext 22130Use (do not use) the MIPS Loongson EXTensions (EXT) instructions. 22131 22132@item -mloongson-ext2 22133@itemx -mno-loongson-ext2 22134@opindex mloongson-ext2 22135@opindex mno-loongson-ext2 22136Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions. 22137 22138@item -mlong64 22139@opindex mlong64 22140Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 22141an explanation of the default and the way that the pointer size is 22142determined. 22143 22144@item -mlong32 22145@opindex mlong32 22146Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 22147 22148The default size of @code{int}s, @code{long}s and pointers depends on 22149the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 22150uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 2215132-bit @code{long}s. Pointers are the same size as @code{long}s, 22152or the same size as integer registers, whichever is smaller. 22153 22154@item -msym32 22155@itemx -mno-sym32 22156@opindex msym32 22157@opindex mno-sym32 22158Assume (do not assume) that all symbols have 32-bit values, regardless 22159of the selected ABI@. This option is useful in combination with 22160@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 22161to generate shorter and faster references to symbolic addresses. 22162 22163@item -G @var{num} 22164@opindex G 22165Put definitions of externally-visible data in a small data section 22166if that data is no bigger than @var{num} bytes. GCC can then generate 22167more efficient accesses to the data; see @option{-mgpopt} for details. 22168 22169The default @option{-G} option depends on the configuration. 22170 22171@item -mlocal-sdata 22172@itemx -mno-local-sdata 22173@opindex mlocal-sdata 22174@opindex mno-local-sdata 22175Extend (do not extend) the @option{-G} behavior to local data too, 22176such as to static variables in C@. @option{-mlocal-sdata} is the 22177default for all configurations. 22178 22179If the linker complains that an application is using too much small data, 22180you might want to try rebuilding the less performance-critical parts with 22181@option{-mno-local-sdata}. You might also want to build large 22182libraries with @option{-mno-local-sdata}, so that the libraries leave 22183more room for the main program. 22184 22185@item -mextern-sdata 22186@itemx -mno-extern-sdata 22187@opindex mextern-sdata 22188@opindex mno-extern-sdata 22189Assume (do not assume) that externally-defined data is in 22190a small data section if the size of that data is within the @option{-G} limit. 22191@option{-mextern-sdata} is the default for all configurations. 22192 22193If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 22194@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 22195that is no bigger than @var{num} bytes, you must make sure that @var{Var} 22196is placed in a small data section. If @var{Var} is defined by another 22197module, you must either compile that module with a high-enough 22198@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 22199definition. If @var{Var} is common, you must link the application 22200with a high-enough @option{-G} setting. 22201 22202The easiest way of satisfying these restrictions is to compile 22203and link every module with the same @option{-G} option. However, 22204you may wish to build a library that supports several different 22205small data limits. You can do this by compiling the library with 22206the highest supported @option{-G} setting and additionally using 22207@option{-mno-extern-sdata} to stop the library from making assumptions 22208about externally-defined data. 22209 22210@item -mgpopt 22211@itemx -mno-gpopt 22212@opindex mgpopt 22213@opindex mno-gpopt 22214Use (do not use) GP-relative accesses for symbols that are known to be 22215in a small data section; see @option{-G}, @option{-mlocal-sdata} and 22216@option{-mextern-sdata}. @option{-mgpopt} is the default for all 22217configurations. 22218 22219@option{-mno-gpopt} is useful for cases where the @code{$gp} register 22220might not hold the value of @code{_gp}. For example, if the code is 22221part of a library that might be used in a boot monitor, programs that 22222call boot monitor routines pass an unknown value in @code{$gp}. 22223(In such situations, the boot monitor itself is usually compiled 22224with @option{-G0}.) 22225 22226@option{-mno-gpopt} implies @option{-mno-local-sdata} and 22227@option{-mno-extern-sdata}. 22228 22229@item -membedded-data 22230@itemx -mno-embedded-data 22231@opindex membedded-data 22232@opindex mno-embedded-data 22233Allocate variables to the read-only data section first if possible, then 22234next in the small data section if possible, otherwise in data. This gives 22235slightly slower code than the default, but reduces the amount of RAM required 22236when executing, and thus may be preferred for some embedded systems. 22237 22238@item -muninit-const-in-rodata 22239@itemx -mno-uninit-const-in-rodata 22240@opindex muninit-const-in-rodata 22241@opindex mno-uninit-const-in-rodata 22242Put uninitialized @code{const} variables in the read-only data section. 22243This option is only meaningful in conjunction with @option{-membedded-data}. 22244 22245@item -mcode-readable=@var{setting} 22246@opindex mcode-readable 22247Specify whether GCC may generate code that reads from executable sections. 22248There are three possible settings: 22249 22250@table @gcctabopt 22251@item -mcode-readable=yes 22252Instructions may freely access executable sections. This is the 22253default setting. 22254 22255@item -mcode-readable=pcrel 22256MIPS16 PC-relative load instructions can access executable sections, 22257but other instructions must not do so. This option is useful on 4KSc 22258and 4KSd processors when the code TLBs have the Read Inhibit bit set. 22259It is also useful on processors that can be configured to have a dual 22260instruction/data SRAM interface and that, like the M4K, automatically 22261redirect PC-relative loads to the instruction RAM. 22262 22263@item -mcode-readable=no 22264Instructions must not access executable sections. This option can be 22265useful on targets that are configured to have a dual instruction/data 22266SRAM interface but that (unlike the M4K) do not automatically redirect 22267PC-relative loads to the instruction RAM. 22268@end table 22269 22270@item -msplit-addresses 22271@itemx -mno-split-addresses 22272@opindex msplit-addresses 22273@opindex mno-split-addresses 22274Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 22275relocation operators. This option has been superseded by 22276@option{-mexplicit-relocs} but is retained for backwards compatibility. 22277 22278@item -mexplicit-relocs 22279@itemx -mno-explicit-relocs 22280@opindex mexplicit-relocs 22281@opindex mno-explicit-relocs 22282Use (do not use) assembler relocation operators when dealing with symbolic 22283addresses. The alternative, selected by @option{-mno-explicit-relocs}, 22284is to use assembler macros instead. 22285 22286@option{-mexplicit-relocs} is the default if GCC was configured 22287to use an assembler that supports relocation operators. 22288 22289@item -mcheck-zero-division 22290@itemx -mno-check-zero-division 22291@opindex mcheck-zero-division 22292@opindex mno-check-zero-division 22293Trap (do not trap) on integer division by zero. 22294 22295The default is @option{-mcheck-zero-division}. 22296 22297@item -mdivide-traps 22298@itemx -mdivide-breaks 22299@opindex mdivide-traps 22300@opindex mdivide-breaks 22301MIPS systems check for division by zero by generating either a 22302conditional trap or a break instruction. Using traps results in 22303smaller code, but is only supported on MIPS II and later. Also, some 22304versions of the Linux kernel have a bug that prevents trap from 22305generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 22306allow conditional traps on architectures that support them and 22307@option{-mdivide-breaks} to force the use of breaks. 22308 22309The default is usually @option{-mdivide-traps}, but this can be 22310overridden at configure time using @option{--with-divide=breaks}. 22311Divide-by-zero checks can be completely disabled using 22312@option{-mno-check-zero-division}. 22313 22314@item -mload-store-pairs 22315@itemx -mno-load-store-pairs 22316@opindex mload-store-pairs 22317@opindex mno-load-store-pairs 22318Enable (disable) an optimization that pairs consecutive load or store 22319instructions to enable load/store bonding. This option is enabled by 22320default but only takes effect when the selected architecture is known 22321to support bonding. 22322 22323@item -mmemcpy 22324@itemx -mno-memcpy 22325@opindex mmemcpy 22326@opindex mno-memcpy 22327Force (do not force) the use of @code{memcpy} for non-trivial block 22328moves. The default is @option{-mno-memcpy}, which allows GCC to inline 22329most constant-sized copies. 22330 22331@item -mlong-calls 22332@itemx -mno-long-calls 22333@opindex mlong-calls 22334@opindex mno-long-calls 22335Disable (do not disable) use of the @code{jal} instruction. Calling 22336functions using @code{jal} is more efficient but requires the caller 22337and callee to be in the same 256 megabyte segment. 22338 22339This option has no effect on abicalls code. The default is 22340@option{-mno-long-calls}. 22341 22342@item -mmad 22343@itemx -mno-mad 22344@opindex mmad 22345@opindex mno-mad 22346Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 22347instructions, as provided by the R4650 ISA@. 22348 22349@item -mimadd 22350@itemx -mno-imadd 22351@opindex mimadd 22352@opindex mno-imadd 22353Enable (disable) use of the @code{madd} and @code{msub} integer 22354instructions. The default is @option{-mimadd} on architectures 22355that support @code{madd} and @code{msub} except for the 74k 22356architecture where it was found to generate slower code. 22357 22358@item -mfused-madd 22359@itemx -mno-fused-madd 22360@opindex mfused-madd 22361@opindex mno-fused-madd 22362Enable (disable) use of the floating-point multiply-accumulate 22363instructions, when they are available. The default is 22364@option{-mfused-madd}. 22365 22366On the R8000 CPU when multiply-accumulate instructions are used, 22367the intermediate product is calculated to infinite precision 22368and is not subject to the FCSR Flush to Zero bit. This may be 22369undesirable in some circumstances. On other processors the result 22370is numerically identical to the equivalent computation using 22371separate multiply, add, subtract and negate instructions. 22372 22373@item -nocpp 22374@opindex nocpp 22375Tell the MIPS assembler to not run its preprocessor over user 22376assembler files (with a @samp{.s} suffix) when assembling them. 22377 22378@item -mfix-24k 22379@itemx -mno-fix-24k 22380@opindex mfix-24k 22381@opindex mno-fix-24k 22382Work around the 24K E48 (lost data on stores during refill) errata. 22383The workarounds are implemented by the assembler rather than by GCC@. 22384 22385@item -mfix-r4000 22386@itemx -mno-fix-r4000 22387@opindex mfix-r4000 22388@opindex mno-fix-r4000 22389Work around certain R4000 CPU errata: 22390@itemize @minus 22391@item 22392A double-word or a variable shift may give an incorrect result if executed 22393immediately after starting an integer division. 22394@item 22395A double-word or a variable shift may give an incorrect result if executed 22396while an integer multiplication is in progress. 22397@item 22398An integer division may give an incorrect result if started in a delay slot 22399of a taken branch or a jump. 22400@end itemize 22401 22402@item -mfix-r4400 22403@itemx -mno-fix-r4400 22404@opindex mfix-r4400 22405@opindex mno-fix-r4400 22406Work around certain R4400 CPU errata: 22407@itemize @minus 22408@item 22409A double-word or a variable shift may give an incorrect result if executed 22410immediately after starting an integer division. 22411@end itemize 22412 22413@item -mfix-r10000 22414@itemx -mno-fix-r10000 22415@opindex mfix-r10000 22416@opindex mno-fix-r10000 22417Work around certain R10000 errata: 22418@itemize @minus 22419@item 22420@code{ll}/@code{sc} sequences may not behave atomically on revisions 22421prior to 3.0. They may deadlock on revisions 2.6 and earlier. 22422@end itemize 22423 22424This option can only be used if the target architecture supports 22425branch-likely instructions. @option{-mfix-r10000} is the default when 22426@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 22427otherwise. 22428 22429@item -mfix-r5900 22430@itemx -mno-fix-r5900 22431@opindex mfix-r5900 22432Do not attempt to schedule the preceding instruction into the delay slot 22433of a branch instruction placed at the end of a short loop of six 22434instructions or fewer and always schedule a @code{nop} instruction there 22435instead. The short loop bug under certain conditions causes loops to 22436execute only once or twice, due to a hardware bug in the R5900 chip. The 22437workaround is implemented by the assembler rather than by GCC@. 22438 22439@item -mfix-rm7000 22440@itemx -mno-fix-rm7000 22441@opindex mfix-rm7000 22442Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 22443workarounds are implemented by the assembler rather than by GCC@. 22444 22445@item -mfix-vr4120 22446@itemx -mno-fix-vr4120 22447@opindex mfix-vr4120 22448Work around certain VR4120 errata: 22449@itemize @minus 22450@item 22451@code{dmultu} does not always produce the correct result. 22452@item 22453@code{div} and @code{ddiv} do not always produce the correct result if one 22454of the operands is negative. 22455@end itemize 22456The workarounds for the division errata rely on special functions in 22457@file{libgcc.a}. At present, these functions are only provided by 22458the @code{mips64vr*-elf} configurations. 22459 22460Other VR4120 errata require a NOP to be inserted between certain pairs of 22461instructions. These errata are handled by the assembler, not by GCC itself. 22462 22463@item -mfix-vr4130 22464@opindex mfix-vr4130 22465Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 22466workarounds are implemented by the assembler rather than by GCC, 22467although GCC avoids using @code{mflo} and @code{mfhi} if the 22468VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 22469instructions are available instead. 22470 22471@item -mfix-sb1 22472@itemx -mno-fix-sb1 22473@opindex mfix-sb1 22474Work around certain SB-1 CPU core errata. 22475(This flag currently works around the SB-1 revision 2 22476``F1'' and ``F2'' floating-point errata.) 22477 22478@item -mr10k-cache-barrier=@var{setting} 22479@opindex mr10k-cache-barrier 22480Specify whether GCC should insert cache barriers to avoid the 22481side effects of speculation on R10K processors. 22482 22483In common with many processors, the R10K tries to predict the outcome 22484of a conditional branch and speculatively executes instructions from 22485the ``taken'' branch. It later aborts these instructions if the 22486predicted outcome is wrong. However, on the R10K, even aborted 22487instructions can have side effects. 22488 22489This problem only affects kernel stores and, depending on the system, 22490kernel loads. As an example, a speculatively-executed store may load 22491the target memory into cache and mark the cache line as dirty, even if 22492the store itself is later aborted. If a DMA operation writes to the 22493same area of memory before the ``dirty'' line is flushed, the cached 22494data overwrites the DMA-ed data. See the R10K processor manual 22495for a full description, including other potential problems. 22496 22497One workaround is to insert cache barrier instructions before every memory 22498access that might be speculatively executed and that might have side 22499effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 22500controls GCC's implementation of this workaround. It assumes that 22501aborted accesses to any byte in the following regions does not have 22502side effects: 22503 22504@enumerate 22505@item 22506the memory occupied by the current function's stack frame; 22507 22508@item 22509the memory occupied by an incoming stack argument; 22510 22511@item 22512the memory occupied by an object with a link-time-constant address. 22513@end enumerate 22514 22515It is the kernel's responsibility to ensure that speculative 22516accesses to these regions are indeed safe. 22517 22518If the input program contains a function declaration such as: 22519 22520@smallexample 22521void foo (void); 22522@end smallexample 22523 22524then the implementation of @code{foo} must allow @code{j foo} and 22525@code{jal foo} to be executed speculatively. GCC honors this 22526restriction for functions it compiles itself. It expects non-GCC 22527functions (such as hand-written assembly code) to do the same. 22528 22529The option has three forms: 22530 22531@table @gcctabopt 22532@item -mr10k-cache-barrier=load-store 22533Insert a cache barrier before a load or store that might be 22534speculatively executed and that might have side effects even 22535if aborted. 22536 22537@item -mr10k-cache-barrier=store 22538Insert a cache barrier before a store that might be speculatively 22539executed and that might have side effects even if aborted. 22540 22541@item -mr10k-cache-barrier=none 22542Disable the insertion of cache barriers. This is the default setting. 22543@end table 22544 22545@item -mflush-func=@var{func} 22546@itemx -mno-flush-func 22547@opindex mflush-func 22548Specifies the function to call to flush the I and D caches, or to not 22549call any such function. If called, the function must take the same 22550arguments as the common @code{_flush_func}, that is, the address of the 22551memory range for which the cache is being flushed, the size of the 22552memory range, and the number 3 (to flush both caches). The default 22553depends on the target GCC was configured for, but commonly is either 22554@code{_flush_func} or @code{__cpu_flush}. 22555 22556@item mbranch-cost=@var{num} 22557@opindex mbranch-cost 22558Set the cost of branches to roughly @var{num} ``simple'' instructions. 22559This cost is only a heuristic and is not guaranteed to produce 22560consistent results across releases. A zero cost redundantly selects 22561the default, which is based on the @option{-mtune} setting. 22562 22563@item -mbranch-likely 22564@itemx -mno-branch-likely 22565@opindex mbranch-likely 22566@opindex mno-branch-likely 22567Enable or disable use of Branch Likely instructions, regardless of the 22568default for the selected architecture. By default, Branch Likely 22569instructions may be generated if they are supported by the selected 22570architecture. An exception is for the MIPS32 and MIPS64 architectures 22571and processors that implement those architectures; for those, Branch 22572Likely instructions are not be generated by default because the MIPS32 22573and MIPS64 architectures specifically deprecate their use. 22574 22575@item -mcompact-branches=never 22576@itemx -mcompact-branches=optimal 22577@itemx -mcompact-branches=always 22578@opindex mcompact-branches=never 22579@opindex mcompact-branches=optimal 22580@opindex mcompact-branches=always 22581These options control which form of branches will be generated. The 22582default is @option{-mcompact-branches=optimal}. 22583 22584The @option{-mcompact-branches=never} option ensures that compact branch 22585instructions will never be generated. 22586 22587The @option{-mcompact-branches=always} option ensures that a compact 22588branch instruction will be generated if available. If a compact branch 22589instruction is not available, a delay slot form of the branch will be 22590used instead. 22591 22592This option is supported from MIPS Release 6 onwards. 22593 22594The @option{-mcompact-branches=optimal} option will cause a delay slot 22595branch to be used if one is available in the current ISA and the delay 22596slot is successfully filled. If the delay slot is not filled, a compact 22597branch will be chosen if one is available. 22598 22599@item -mfp-exceptions 22600@itemx -mno-fp-exceptions 22601@opindex mfp-exceptions 22602Specifies whether FP exceptions are enabled. This affects how 22603FP instructions are scheduled for some processors. 22604The default is that FP exceptions are 22605enabled. 22606 22607For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 2260864-bit code, then we can use both FP pipes. Otherwise, we can only use one 22609FP pipe. 22610 22611@item -mvr4130-align 22612@itemx -mno-vr4130-align 22613@opindex mvr4130-align 22614The VR4130 pipeline is two-way superscalar, but can only issue two 22615instructions together if the first one is 8-byte aligned. When this 22616option is enabled, GCC aligns pairs of instructions that it 22617thinks should execute in parallel. 22618 22619This option only has an effect when optimizing for the VR4130. 22620It normally makes code faster, but at the expense of making it bigger. 22621It is enabled by default at optimization level @option{-O3}. 22622 22623@item -msynci 22624@itemx -mno-synci 22625@opindex msynci 22626Enable (disable) generation of @code{synci} instructions on 22627architectures that support it. The @code{synci} instructions (if 22628enabled) are generated when @code{__builtin___clear_cache} is 22629compiled. 22630 22631This option defaults to @option{-mno-synci}, but the default can be 22632overridden by configuring GCC with @option{--with-synci}. 22633 22634When compiling code for single processor systems, it is generally safe 22635to use @code{synci}. However, on many multi-core (SMP) systems, it 22636does not invalidate the instruction caches on all cores and may lead 22637to undefined behavior. 22638 22639@item -mrelax-pic-calls 22640@itemx -mno-relax-pic-calls 22641@opindex mrelax-pic-calls 22642Try to turn PIC calls that are normally dispatched via register 22643@code{$25} into direct calls. This is only possible if the linker can 22644resolve the destination at link time and if the destination is within 22645range for a direct call. 22646 22647@option{-mrelax-pic-calls} is the default if GCC was configured to use 22648an assembler and a linker that support the @code{.reloc} assembly 22649directive and @option{-mexplicit-relocs} is in effect. With 22650@option{-mno-explicit-relocs}, this optimization can be performed by the 22651assembler and the linker alone without help from the compiler. 22652 22653@item -mmcount-ra-address 22654@itemx -mno-mcount-ra-address 22655@opindex mmcount-ra-address 22656@opindex mno-mcount-ra-address 22657Emit (do not emit) code that allows @code{_mcount} to modify the 22658calling function's return address. When enabled, this option extends 22659the usual @code{_mcount} interface with a new @var{ra-address} 22660parameter, which has type @code{intptr_t *} and is passed in register 22661@code{$12}. @code{_mcount} can then modify the return address by 22662doing both of the following: 22663@itemize 22664@item 22665Returning the new address in register @code{$31}. 22666@item 22667Storing the new address in @code{*@var{ra-address}}, 22668if @var{ra-address} is nonnull. 22669@end itemize 22670 22671The default is @option{-mno-mcount-ra-address}. 22672 22673@item -mframe-header-opt 22674@itemx -mno-frame-header-opt 22675@opindex mframe-header-opt 22676Enable (disable) frame header optimization in the o32 ABI. When using the 22677o32 ABI, calling functions will allocate 16 bytes on the stack for the called 22678function to write out register arguments. When enabled, this optimization 22679will suppress the allocation of the frame header if it can be determined that 22680it is unused. 22681 22682This optimization is off by default at all optimization levels. 22683 22684@item -mlxc1-sxc1 22685@itemx -mno-lxc1-sxc1 22686@opindex mlxc1-sxc1 22687When applicable, enable (disable) the generation of @code{lwxc1}, 22688@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default. 22689 22690@item -mmadd4 22691@itemx -mno-madd4 22692@opindex mmadd4 22693When applicable, enable (disable) the generation of 4-operand @code{madd.s}, 22694@code{madd.d} and related instructions. Enabled by default. 22695 22696@end table 22697 22698@node MMIX Options 22699@subsection MMIX Options 22700@cindex MMIX Options 22701 22702These options are defined for the MMIX: 22703 22704@table @gcctabopt 22705@item -mlibfuncs 22706@itemx -mno-libfuncs 22707@opindex mlibfuncs 22708@opindex mno-libfuncs 22709Specify that intrinsic library functions are being compiled, passing all 22710values in registers, no matter the size. 22711 22712@item -mepsilon 22713@itemx -mno-epsilon 22714@opindex mepsilon 22715@opindex mno-epsilon 22716Generate floating-point comparison instructions that compare with respect 22717to the @code{rE} epsilon register. 22718 22719@item -mabi=mmixware 22720@itemx -mabi=gnu 22721@opindex mabi=mmixware 22722@opindex mabi=gnu 22723Generate code that passes function parameters and return values that (in 22724the called function) are seen as registers @code{$0} and up, as opposed to 22725the GNU ABI which uses global registers @code{$231} and up. 22726 22727@item -mzero-extend 22728@itemx -mno-zero-extend 22729@opindex mzero-extend 22730@opindex mno-zero-extend 22731When reading data from memory in sizes shorter than 64 bits, use (do not 22732use) zero-extending load instructions by default, rather than 22733sign-extending ones. 22734 22735@item -mknuthdiv 22736@itemx -mno-knuthdiv 22737@opindex mknuthdiv 22738@opindex mno-knuthdiv 22739Make the result of a division yielding a remainder have the same sign as 22740the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 22741remainder follows the sign of the dividend. Both methods are 22742arithmetically valid, the latter being almost exclusively used. 22743 22744@item -mtoplevel-symbols 22745@itemx -mno-toplevel-symbols 22746@opindex mtoplevel-symbols 22747@opindex mno-toplevel-symbols 22748Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 22749code can be used with the @code{PREFIX} assembly directive. 22750 22751@item -melf 22752@opindex melf 22753Generate an executable in the ELF format, rather than the default 22754@samp{mmo} format used by the @command{mmix} simulator. 22755 22756@item -mbranch-predict 22757@itemx -mno-branch-predict 22758@opindex mbranch-predict 22759@opindex mno-branch-predict 22760Use (do not use) the probable-branch instructions, when static branch 22761prediction indicates a probable branch. 22762 22763@item -mbase-addresses 22764@itemx -mno-base-addresses 22765@opindex mbase-addresses 22766@opindex mno-base-addresses 22767Generate (do not generate) code that uses @emph{base addresses}. Using a 22768base address automatically generates a request (handled by the assembler 22769and the linker) for a constant to be set up in a global register. The 22770register is used for one or more base address requests within the range 0 22771to 255 from the value held in the register. The generally leads to short 22772and fast code, but the number of different data items that can be 22773addressed is limited. This means that a program that uses lots of static 22774data may require @option{-mno-base-addresses}. 22775 22776@item -msingle-exit 22777@itemx -mno-single-exit 22778@opindex msingle-exit 22779@opindex mno-single-exit 22780Force (do not force) generated code to have a single exit point in each 22781function. 22782@end table 22783 22784@node MN10300 Options 22785@subsection MN10300 Options 22786@cindex MN10300 options 22787 22788These @option{-m} options are defined for Matsushita MN10300 architectures: 22789 22790@table @gcctabopt 22791@item -mmult-bug 22792@opindex mmult-bug 22793Generate code to avoid bugs in the multiply instructions for the MN10300 22794processors. This is the default. 22795 22796@item -mno-mult-bug 22797@opindex mno-mult-bug 22798Do not generate code to avoid bugs in the multiply instructions for the 22799MN10300 processors. 22800 22801@item -mam33 22802@opindex mam33 22803Generate code using features specific to the AM33 processor. 22804 22805@item -mno-am33 22806@opindex mno-am33 22807Do not generate code using features specific to the AM33 processor. This 22808is the default. 22809 22810@item -mam33-2 22811@opindex mam33-2 22812Generate code using features specific to the AM33/2.0 processor. 22813 22814@item -mam34 22815@opindex mam34 22816Generate code using features specific to the AM34 processor. 22817 22818@item -mtune=@var{cpu-type} 22819@opindex mtune 22820Use the timing characteristics of the indicated CPU type when 22821scheduling instructions. This does not change the targeted processor 22822type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 22823@samp{am33-2} or @samp{am34}. 22824 22825@item -mreturn-pointer-on-d0 22826@opindex mreturn-pointer-on-d0 22827When generating a function that returns a pointer, return the pointer 22828in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 22829only in @code{a0}, and attempts to call such functions without a prototype 22830result in errors. Note that this option is on by default; use 22831@option{-mno-return-pointer-on-d0} to disable it. 22832 22833@item -mno-crt0 22834@opindex mno-crt0 22835Do not link in the C run-time initialization object file. 22836 22837@item -mrelax 22838@opindex mrelax 22839Indicate to the linker that it should perform a relaxation optimization pass 22840to shorten branches, calls and absolute memory addresses. This option only 22841has an effect when used on the command line for the final link step. 22842 22843This option makes symbolic debugging impossible. 22844 22845@item -mliw 22846@opindex mliw 22847Allow the compiler to generate @emph{Long Instruction Word} 22848instructions if the target is the @samp{AM33} or later. This is the 22849default. This option defines the preprocessor macro @code{__LIW__}. 22850 22851@item -mno-liw 22852@opindex mno-liw 22853Do not allow the compiler to generate @emph{Long Instruction Word} 22854instructions. This option defines the preprocessor macro 22855@code{__NO_LIW__}. 22856 22857@item -msetlb 22858@opindex msetlb 22859Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 22860instructions if the target is the @samp{AM33} or later. This is the 22861default. This option defines the preprocessor macro @code{__SETLB__}. 22862 22863@item -mno-setlb 22864@opindex mno-setlb 22865Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 22866instructions. This option defines the preprocessor macro 22867@code{__NO_SETLB__}. 22868 22869@end table 22870 22871@node Moxie Options 22872@subsection Moxie Options 22873@cindex Moxie Options 22874 22875@table @gcctabopt 22876 22877@item -meb 22878@opindex meb 22879Generate big-endian code. This is the default for @samp{moxie-*-*} 22880configurations. 22881 22882@item -mel 22883@opindex mel 22884Generate little-endian code. 22885 22886@item -mmul.x 22887@opindex mmul.x 22888Generate mul.x and umul.x instructions. This is the default for 22889@samp{moxiebox-*-*} configurations. 22890 22891@item -mno-crt0 22892@opindex mno-crt0 22893Do not link in the C run-time initialization object file. 22894 22895@end table 22896 22897@node MSP430 Options 22898@subsection MSP430 Options 22899@cindex MSP430 Options 22900 22901These options are defined for the MSP430: 22902 22903@table @gcctabopt 22904 22905@item -masm-hex 22906@opindex masm-hex 22907Force assembly output to always use hex constants. Normally such 22908constants are signed decimals, but this option is available for 22909testsuite and/or aesthetic purposes. 22910 22911@item -mmcu= 22912@opindex mmcu= 22913Select the MCU to target. This is used to create a C preprocessor 22914symbol based upon the MCU name, converted to upper case and pre- and 22915post-fixed with @samp{__}. This in turn is used by the 22916@file{msp430.h} header file to select an MCU-specific supplementary 22917header file. 22918 22919The option also sets the ISA to use. If the MCU name is one that is 22920known to only support the 430 ISA then that is selected, otherwise the 22921430X ISA is selected. A generic MCU name of @samp{msp430} can also be 22922used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 22923name selects the 430X ISA. 22924 22925In addition an MCU-specific linker script is added to the linker 22926command line. The script's name is the name of the MCU with 22927@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 22928command line defines the C preprocessor symbol @code{__XXX__} and 22929cause the linker to search for a script called @file{xxx.ld}. 22930 22931This option is also passed on to the assembler. 22932 22933@item -mwarn-mcu 22934@itemx -mno-warn-mcu 22935@opindex mwarn-mcu 22936@opindex mno-warn-mcu 22937This option enables or disables warnings about conflicts between the 22938MCU name specified by the @option{-mmcu} option and the ISA set by the 22939@option{-mcpu} option and/or the hardware multiply support set by the 22940@option{-mhwmult} option. It also toggles warnings about unrecognized 22941MCU names. This option is on by default. 22942 22943@item -mcpu= 22944@opindex mcpu= 22945Specifies the ISA to use. Accepted values are @samp{msp430}, 22946@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 22947@option{-mmcu=} option should be used to select the ISA. 22948 22949@item -msim 22950@opindex msim 22951Link to the simulator runtime libraries and linker script. Overrides 22952any scripts that would be selected by the @option{-mmcu=} option. 22953 22954@item -mlarge 22955@opindex mlarge 22956Use large-model addressing (20-bit pointers, 32-bit @code{size_t}). 22957 22958@item -msmall 22959@opindex msmall 22960Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 22961 22962@item -mrelax 22963@opindex mrelax 22964This option is passed to the assembler and linker, and allows the 22965linker to perform certain optimizations that cannot be done until 22966the final link. 22967 22968@item mhwmult= 22969@opindex mhwmult= 22970Describes the type of hardware multiply supported by the target. 22971Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 22972for the original 16-bit-only multiply supported by early MCUs. 22973@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 22974@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 22975A value of @samp{auto} can also be given. This tells GCC to deduce 22976the hardware multiply support based upon the MCU name provided by the 22977@option{-mmcu} option. If no @option{-mmcu} option is specified or if 22978the MCU name is not recognized then no hardware multiply support is 22979assumed. @code{auto} is the default setting. 22980 22981Hardware multiplies are normally performed by calling a library 22982routine. This saves space in the generated code. When compiling at 22983@option{-O3} or higher however the hardware multiplier is invoked 22984inline. This makes for bigger, but faster code. 22985 22986The hardware multiply routines disable interrupts whilst running and 22987restore the previous interrupt state when they finish. This makes 22988them safe to use inside interrupt handlers as well as in normal code. 22989 22990@item -minrt 22991@opindex minrt 22992Enable the use of a minimum runtime environment - no static 22993initializers or constructors. This is intended for memory-constrained 22994devices. The compiler includes special symbols in some objects 22995that tell the linker and runtime which code fragments are required. 22996 22997@item -mcode-region= 22998@itemx -mdata-region= 22999@opindex mcode-region 23000@opindex mdata-region 23001These options tell the compiler where to place functions and data that 23002do not have one of the @code{lower}, @code{upper}, @code{either} or 23003@code{section} attributes. Possible values are @code{lower}, 23004@code{upper}, @code{either} or @code{any}. The first three behave 23005like the corresponding attribute. The fourth possible value - 23006@code{any} - is the default. It leaves placement entirely up to the 23007linker script and how it assigns the standard sections 23008(@code{.text}, @code{.data}, etc) to the memory regions. 23009 23010@item -msilicon-errata= 23011@opindex msilicon-errata 23012This option passes on a request to assembler to enable the fixes for 23013the named silicon errata. 23014 23015@item -msilicon-errata-warn= 23016@opindex msilicon-errata-warn 23017This option passes on a request to the assembler to enable warning 23018messages when a silicon errata might need to be applied. 23019 23020@end table 23021 23022@node NDS32 Options 23023@subsection NDS32 Options 23024@cindex NDS32 Options 23025 23026These options are defined for NDS32 implementations: 23027 23028@table @gcctabopt 23029 23030@item -mbig-endian 23031@opindex mbig-endian 23032Generate code in big-endian mode. 23033 23034@item -mlittle-endian 23035@opindex mlittle-endian 23036Generate code in little-endian mode. 23037 23038@item -mreduced-regs 23039@opindex mreduced-regs 23040Use reduced-set registers for register allocation. 23041 23042@item -mfull-regs 23043@opindex mfull-regs 23044Use full-set registers for register allocation. 23045 23046@item -mcmov 23047@opindex mcmov 23048Generate conditional move instructions. 23049 23050@item -mno-cmov 23051@opindex mno-cmov 23052Do not generate conditional move instructions. 23053 23054@item -mext-perf 23055@opindex mext-perf 23056Generate performance extension instructions. 23057 23058@item -mno-ext-perf 23059@opindex mno-ext-perf 23060Do not generate performance extension instructions. 23061 23062@item -mext-perf2 23063@opindex mext-perf2 23064Generate performance extension 2 instructions. 23065 23066@item -mno-ext-perf2 23067@opindex mno-ext-perf2 23068Do not generate performance extension 2 instructions. 23069 23070@item -mext-string 23071@opindex mext-string 23072Generate string extension instructions. 23073 23074@item -mno-ext-string 23075@opindex mno-ext-string 23076Do not generate string extension instructions. 23077 23078@item -mv3push 23079@opindex mv3push 23080Generate v3 push25/pop25 instructions. 23081 23082@item -mno-v3push 23083@opindex mno-v3push 23084Do not generate v3 push25/pop25 instructions. 23085 23086@item -m16-bit 23087@opindex m16-bit 23088Generate 16-bit instructions. 23089 23090@item -mno-16-bit 23091@opindex mno-16-bit 23092Do not generate 16-bit instructions. 23093 23094@item -misr-vector-size=@var{num} 23095@opindex misr-vector-size 23096Specify the size of each interrupt vector, which must be 4 or 16. 23097 23098@item -mcache-block-size=@var{num} 23099@opindex mcache-block-size 23100Specify the size of each cache block, 23101which must be a power of 2 between 4 and 512. 23102 23103@item -march=@var{arch} 23104@opindex march 23105Specify the name of the target architecture. 23106 23107@item -mcmodel=@var{code-model} 23108@opindex mcmodel 23109Set the code model to one of 23110@table @asis 23111@item @samp{small} 23112All the data and read-only data segments must be within 512KB addressing space. 23113The text segment must be within 16MB addressing space. 23114@item @samp{medium} 23115The data segment must be within 512KB while the read-only data segment can be 23116within 4GB addressing space. The text segment should be still within 16MB 23117addressing space. 23118@item @samp{large} 23119All the text and data segments can be within 4GB addressing space. 23120@end table 23121 23122@item -mctor-dtor 23123@opindex mctor-dtor 23124Enable constructor/destructor feature. 23125 23126@item -mrelax 23127@opindex mrelax 23128Guide linker to relax instructions. 23129 23130@end table 23131 23132@node Nios II Options 23133@subsection Nios II Options 23134@cindex Nios II options 23135@cindex Altera Nios II options 23136 23137These are the options defined for the Altera Nios II processor. 23138 23139@table @gcctabopt 23140 23141@item -G @var{num} 23142@opindex G 23143@cindex smaller data references 23144Put global and static objects less than or equal to @var{num} bytes 23145into the small data or BSS sections instead of the normal data or BSS 23146sections. The default value of @var{num} is 8. 23147 23148@item -mgpopt=@var{option} 23149@itemx -mgpopt 23150@itemx -mno-gpopt 23151@opindex mgpopt 23152@opindex mno-gpopt 23153Generate (do not generate) GP-relative accesses. The following 23154@var{option} names are recognized: 23155 23156@table @samp 23157 23158@item none 23159Do not generate GP-relative accesses. 23160 23161@item local 23162Generate GP-relative accesses for small data objects that are not 23163external, weak, or uninitialized common symbols. 23164Also use GP-relative addressing for objects that 23165have been explicitly placed in a small data section via a @code{section} 23166attribute. 23167 23168@item global 23169As for @samp{local}, but also generate GP-relative accesses for 23170small data objects that are external, weak, or common. If you use this option, 23171you must ensure that all parts of your program (including libraries) are 23172compiled with the same @option{-G} setting. 23173 23174@item data 23175Generate GP-relative accesses for all data objects in the program. If you 23176use this option, the entire data and BSS segments 23177of your program must fit in 64K of memory and you must use an appropriate 23178linker script to allocate them within the addressable range of the 23179global pointer. 23180 23181@item all 23182Generate GP-relative addresses for function pointers as well as data 23183pointers. If you use this option, the entire text, data, and BSS segments 23184of your program must fit in 64K of memory and you must use an appropriate 23185linker script to allocate them within the addressable range of the 23186global pointer. 23187 23188@end table 23189 23190@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 23191@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 23192 23193The default is @option{-mgpopt} except when @option{-fpic} or 23194@option{-fPIC} is specified to generate position-independent code. 23195Note that the Nios II ABI does not permit GP-relative accesses from 23196shared libraries. 23197 23198You may need to specify @option{-mno-gpopt} explicitly when building 23199programs that include large amounts of small data, including large 23200GOT data sections. In this case, the 16-bit offset for GP-relative 23201addressing may not be large enough to allow access to the entire 23202small data section. 23203 23204@item -mgprel-sec=@var{regexp} 23205@opindex mgprel-sec 23206This option specifies additional section names that can be accessed via 23207GP-relative addressing. It is most useful in conjunction with 23208@code{section} attributes on variable declarations 23209(@pxref{Common Variable Attributes}) and a custom linker script. 23210The @var{regexp} is a POSIX Extended Regular Expression. 23211 23212This option does not affect the behavior of the @option{-G} option, and 23213the specified sections are in addition to the standard @code{.sdata} 23214and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}. 23215 23216@item -mr0rel-sec=@var{regexp} 23217@opindex mr0rel-sec 23218This option specifies names of sections that can be accessed via a 2321916-bit offset from @code{r0}; that is, in the low 32K or high 32K 23220of the 32-bit address space. It is most useful in conjunction with 23221@code{section} attributes on variable declarations 23222(@pxref{Common Variable Attributes}) and a custom linker script. 23223The @var{regexp} is a POSIX Extended Regular Expression. 23224 23225In contrast to the use of GP-relative addressing for small data, 23226zero-based addressing is never generated by default and there are no 23227conventional section names used in standard linker scripts for sections 23228in the low or high areas of memory. 23229 23230@item -mel 23231@itemx -meb 23232@opindex mel 23233@opindex meb 23234Generate little-endian (default) or big-endian (experimental) code, 23235respectively. 23236 23237@item -march=@var{arch} 23238@opindex march 23239This specifies the name of the target Nios II architecture. GCC uses this 23240name to determine what kind of instructions it can emit when generating 23241assembly code. Permissible names are: @samp{r1}, @samp{r2}. 23242 23243The preprocessor macro @code{__nios2_arch__} is available to programs, 23244with value 1 or 2, indicating the targeted ISA level. 23245 23246@item -mbypass-cache 23247@itemx -mno-bypass-cache 23248@opindex mno-bypass-cache 23249@opindex mbypass-cache 23250Force all load and store instructions to always bypass cache by 23251using I/O variants of the instructions. The default is not to 23252bypass the cache. 23253 23254@item -mno-cache-volatile 23255@itemx -mcache-volatile 23256@opindex mcache-volatile 23257@opindex mno-cache-volatile 23258Volatile memory access bypass the cache using the I/O variants of 23259the load and store instructions. The default is not to bypass the cache. 23260 23261@item -mno-fast-sw-div 23262@itemx -mfast-sw-div 23263@opindex mno-fast-sw-div 23264@opindex mfast-sw-div 23265Do not use table-based fast divide for small numbers. The default 23266is to use the fast divide at @option{-O3} and above. 23267 23268@item -mno-hw-mul 23269@itemx -mhw-mul 23270@itemx -mno-hw-mulx 23271@itemx -mhw-mulx 23272@itemx -mno-hw-div 23273@itemx -mhw-div 23274@opindex mno-hw-mul 23275@opindex mhw-mul 23276@opindex mno-hw-mulx 23277@opindex mhw-mulx 23278@opindex mno-hw-div 23279@opindex mhw-div 23280Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 23281instructions by the compiler. The default is to emit @code{mul} 23282and not emit @code{div} and @code{mulx}. 23283 23284@item -mbmx 23285@itemx -mno-bmx 23286@itemx -mcdx 23287@itemx -mno-cdx 23288Enable or disable generation of Nios II R2 BMX (bit manipulation) and 23289CDX (code density) instructions. Enabling these instructions also 23290requires @option{-march=r2}. Since these instructions are optional 23291extensions to the R2 architecture, the default is not to emit them. 23292 23293@item -mcustom-@var{insn}=@var{N} 23294@itemx -mno-custom-@var{insn} 23295@opindex mcustom-@var{insn} 23296@opindex mno-custom-@var{insn} 23297Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 23298custom instruction with encoding @var{N} when generating code that uses 23299@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 23300instruction 253 for single-precision floating-point add operations instead 23301of the default behavior of using a library call. 23302 23303The following values of @var{insn} are supported. Except as otherwise 23304noted, floating-point operations are expected to be implemented with 23305normal IEEE 754 semantics and correspond directly to the C operators or the 23306equivalent GCC built-in functions (@pxref{Other Builtins}). 23307 23308Single-precision floating point: 23309@table @asis 23310 23311@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 23312Binary arithmetic operations. 23313 23314@item @samp{fnegs} 23315Unary negation. 23316 23317@item @samp{fabss} 23318Unary absolute value. 23319 23320@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 23321Comparison operations. 23322 23323@item @samp{fmins}, @samp{fmaxs} 23324Floating-point minimum and maximum. These instructions are only 23325generated if @option{-ffinite-math-only} is specified. 23326 23327@item @samp{fsqrts} 23328Unary square root operation. 23329 23330@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 23331Floating-point trigonometric and exponential functions. These instructions 23332are only generated if @option{-funsafe-math-optimizations} is also specified. 23333 23334@end table 23335 23336Double-precision floating point: 23337@table @asis 23338 23339@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 23340Binary arithmetic operations. 23341 23342@item @samp{fnegd} 23343Unary negation. 23344 23345@item @samp{fabsd} 23346Unary absolute value. 23347 23348@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 23349Comparison operations. 23350 23351@item @samp{fmind}, @samp{fmaxd} 23352Double-precision minimum and maximum. These instructions are only 23353generated if @option{-ffinite-math-only} is specified. 23354 23355@item @samp{fsqrtd} 23356Unary square root operation. 23357 23358@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 23359Double-precision trigonometric and exponential functions. These instructions 23360are only generated if @option{-funsafe-math-optimizations} is also specified. 23361 23362@end table 23363 23364Conversions: 23365@table @asis 23366@item @samp{fextsd} 23367Conversion from single precision to double precision. 23368 23369@item @samp{ftruncds} 23370Conversion from double precision to single precision. 23371 23372@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 23373Conversion from floating point to signed or unsigned integer types, with 23374truncation towards zero. 23375 23376@item @samp{round} 23377Conversion from single-precision floating point to signed integer, 23378rounding to the nearest integer and ties away from zero. 23379This corresponds to the @code{__builtin_lroundf} function when 23380@option{-fno-math-errno} is used. 23381 23382@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 23383Conversion from signed or unsigned integer types to floating-point types. 23384 23385@end table 23386 23387In addition, all of the following transfer instructions for internal 23388registers X and Y must be provided to use any of the double-precision 23389floating-point instructions. Custom instructions taking two 23390double-precision source operands expect the first operand in the 2339164-bit register X. The other operand (or only operand of a unary 23392operation) is given to the custom arithmetic instruction with the 23393least significant half in source register @var{src1} and the most 23394significant half in @var{src2}. A custom instruction that returns a 23395double-precision result returns the most significant 32 bits in the 23396destination register and the other half in 32-bit register Y. 23397GCC automatically generates the necessary code sequences to write 23398register X and/or read register Y when double-precision floating-point 23399instructions are used. 23400 23401@table @asis 23402 23403@item @samp{fwrx} 23404Write @var{src1} into the least significant half of X and @var{src2} into 23405the most significant half of X. 23406 23407@item @samp{fwry} 23408Write @var{src1} into Y. 23409 23410@item @samp{frdxhi}, @samp{frdxlo} 23411Read the most or least (respectively) significant half of X and store it in 23412@var{dest}. 23413 23414@item @samp{frdy} 23415Read the value of Y and store it into @var{dest}. 23416@end table 23417 23418Note that you can gain more local control over generation of Nios II custom 23419instructions by using the @code{target("custom-@var{insn}=@var{N}")} 23420and @code{target("no-custom-@var{insn}")} function attributes 23421(@pxref{Function Attributes}) 23422or pragmas (@pxref{Function Specific Option Pragmas}). 23423 23424@item -mcustom-fpu-cfg=@var{name} 23425@opindex mcustom-fpu-cfg 23426 23427This option enables a predefined, named set of custom instruction encodings 23428(see @option{-mcustom-@var{insn}} above). 23429Currently, the following sets are defined: 23430 23431@option{-mcustom-fpu-cfg=60-1} is equivalent to: 23432@gccoptlist{-mcustom-fmuls=252 @gol 23433-mcustom-fadds=253 @gol 23434-mcustom-fsubs=254 @gol 23435-fsingle-precision-constant} 23436 23437@option{-mcustom-fpu-cfg=60-2} is equivalent to: 23438@gccoptlist{-mcustom-fmuls=252 @gol 23439-mcustom-fadds=253 @gol 23440-mcustom-fsubs=254 @gol 23441-mcustom-fdivs=255 @gol 23442-fsingle-precision-constant} 23443 23444@option{-mcustom-fpu-cfg=72-3} is equivalent to: 23445@gccoptlist{-mcustom-floatus=243 @gol 23446-mcustom-fixsi=244 @gol 23447-mcustom-floatis=245 @gol 23448-mcustom-fcmpgts=246 @gol 23449-mcustom-fcmples=249 @gol 23450-mcustom-fcmpeqs=250 @gol 23451-mcustom-fcmpnes=251 @gol 23452-mcustom-fmuls=252 @gol 23453-mcustom-fadds=253 @gol 23454-mcustom-fsubs=254 @gol 23455-mcustom-fdivs=255 @gol 23456-fsingle-precision-constant} 23457 23458Custom instruction assignments given by individual 23459@option{-mcustom-@var{insn}=} options override those given by 23460@option{-mcustom-fpu-cfg=}, regardless of the 23461order of the options on the command line. 23462 23463Note that you can gain more local control over selection of a FPU 23464configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 23465function attribute (@pxref{Function Attributes}) 23466or pragma (@pxref{Function Specific Option Pragmas}). 23467 23468@end table 23469 23470These additional @samp{-m} options are available for the Altera Nios II 23471ELF (bare-metal) target: 23472 23473@table @gcctabopt 23474 23475@item -mhal 23476@opindex mhal 23477Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 23478startup and termination code, and is typically used in conjunction with 23479@option{-msys-crt0=} to specify the location of the alternate startup code 23480provided by the HAL BSP. 23481 23482@item -msmallc 23483@opindex msmallc 23484Link with a limited version of the C library, @option{-lsmallc}, rather than 23485Newlib. 23486 23487@item -msys-crt0=@var{startfile} 23488@opindex msys-crt0 23489@var{startfile} is the file name of the startfile (crt0) to use 23490when linking. This option is only useful in conjunction with @option{-mhal}. 23491 23492@item -msys-lib=@var{systemlib} 23493@opindex msys-lib 23494@var{systemlib} is the library name of the library that provides 23495low-level system calls required by the C library, 23496e.g.@: @code{read} and @code{write}. 23497This option is typically used to link with a library provided by a HAL BSP. 23498 23499@end table 23500 23501@node Nvidia PTX Options 23502@subsection Nvidia PTX Options 23503@cindex Nvidia PTX options 23504@cindex nvptx options 23505 23506These options are defined for Nvidia PTX: 23507 23508@table @gcctabopt 23509 23510@item -m32 23511@itemx -m64 23512@opindex m32 23513@opindex m64 23514Generate code for 32-bit or 64-bit ABI. 23515 23516@item -misa=@var{ISA-string} 23517@opindex march 23518Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA 23519strings must be lower-case. Valid ISA strings include @samp{sm_30} and 23520@samp{sm_35}. The default ISA is sm_30. 23521 23522@item -mmainkernel 23523@opindex mmainkernel 23524Link in code for a __main kernel. This is for stand-alone instead of 23525offloading execution. 23526 23527@item -moptimize 23528@opindex moptimize 23529Apply partitioned execution optimizations. This is the default when any 23530level of optimization is selected. 23531 23532@item -msoft-stack 23533@opindex msoft-stack 23534Generate code that does not use @code{.local} memory 23535directly for stack storage. Instead, a per-warp stack pointer is 23536maintained explicitly. This enables variable-length stack allocation (with 23537variable-length arrays or @code{alloca}), and when global memory is used for 23538underlying storage, makes it possible to access automatic variables from other 23539threads, or with atomic instructions. This code generation variant is used 23540for OpenMP offloading, but the option is exposed on its own for the purpose 23541of testing the compiler; to generate code suitable for linking into programs 23542using OpenMP offloading, use option @option{-mgomp}. 23543 23544@item -muniform-simt 23545@opindex muniform-simt 23546Switch to code generation variant that allows to execute all threads in each 23547warp, while maintaining memory state and side effects as if only one thread 23548in each warp was active outside of OpenMP SIMD regions. All atomic operations 23549and calls to runtime (malloc, free, vprintf) are conditionally executed (iff 23550current lane index equals the master lane index), and the register being 23551assigned is copied via a shuffle instruction from the master lane. Outside of 23552SIMD regions lane 0 is the master; inside, each thread sees itself as the 23553master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or 23554all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD 23555regions). Each thread can bitwise-and the bitmask at position @code{tid.y} 23556with current lane index to compute the master lane index. 23557 23558@item -mgomp 23559@opindex mgomp 23560Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and 23561@option{-muniform-simt} options, and selects corresponding multilib variant. 23562 23563@end table 23564 23565@node OpenRISC Options 23566@subsection OpenRISC Options 23567@cindex OpenRISC Options 23568 23569These options are defined for OpenRISC: 23570 23571@table @gcctabopt 23572 23573@item -mboard=@var{name} 23574@opindex mboard 23575Configure a board specific runtime. This will be passed to the linker for 23576newlib board library linking. The default is @code{or1ksim}. 23577 23578@item -mnewlib 23579@opindex mnewlib 23580For compatibility, it's always newlib for elf now. 23581 23582@item -mhard-div 23583@opindex mhard-div 23584Generate code for hardware which supports divide instructions. This is the 23585default. 23586 23587@item -mhard-mul 23588@opindex mhard-mul 23589Generate code for hardware which supports multiply instructions. This is the 23590default. 23591 23592@item -mcmov 23593@opindex mcmov 23594Generate code for hardware which supports the conditional move (@code{l.cmov}) 23595instruction. 23596 23597@item -mror 23598@opindex mror 23599Generate code for hardware which supports rotate right instructions. 23600 23601@item -msext 23602@opindex msext 23603Generate code for hardware which supports sign-extension instructions. 23604 23605@item -msfimm 23606@opindex msfimm 23607Generate code for hardware which supports set flag immediate (@code{l.sf*i}) 23608instructions. 23609 23610@item -mshftimm 23611@opindex mshftimm 23612Generate code for hardware which supports shift immediate related instructions 23613(i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to 23614enable generation of the @code{l.rori} instruction the @option{-mror} flag must 23615also be specified. 23616 23617@item -msoft-div 23618@opindex msoft-div 23619Generate code for hardware which requires divide instruction emulation. 23620 23621@item -msoft-mul 23622@opindex msoft-mul 23623Generate code for hardware which requires multiply instruction emulation. 23624 23625@end table 23626 23627@node PDP-11 Options 23628@subsection PDP-11 Options 23629@cindex PDP-11 Options 23630 23631These options are defined for the PDP-11: 23632 23633@table @gcctabopt 23634@item -mfpu 23635@opindex mfpu 23636Use hardware FPP floating point. This is the default. (FIS floating 23637point on the PDP-11/40 is not supported.) Implies -m45. 23638 23639@item -msoft-float 23640@opindex msoft-float 23641Do not use hardware floating point. 23642 23643@item -mac0 23644@opindex mac0 23645Return floating-point results in ac0 (fr0 in Unix assembler syntax). 23646 23647@item -mno-ac0 23648@opindex mno-ac0 23649Return floating-point results in memory. This is the default. 23650 23651@item -m40 23652@opindex m40 23653Generate code for a PDP-11/40. Implies -msoft-float -mno-split. 23654 23655@item -m45 23656@opindex m45 23657Generate code for a PDP-11/45. This is the default. 23658 23659@item -m10 23660@opindex m10 23661Generate code for a PDP-11/10. Implies -msoft-float -mno-split. 23662 23663@item -mint16 23664@itemx -mno-int32 23665@opindex mint16 23666@opindex mno-int32 23667Use 16-bit @code{int}. This is the default. 23668 23669@item -mint32 23670@itemx -mno-int16 23671@opindex mint32 23672@opindex mno-int16 23673Use 32-bit @code{int}. 23674 23675@item -msplit 23676@opindex msplit 23677Target has split instruction and data space. Implies -m45. 23678 23679@item -munix-asm 23680@opindex munix-asm 23681Use Unix assembler syntax. 23682 23683@item -mdec-asm 23684@opindex mdec-asm 23685Use DEC assembler syntax. 23686 23687@item -mgnu-asm 23688@opindex mgnu-asm 23689Use GNU assembler syntax. This is the default. 23690 23691@item -mlra 23692@opindex mlra 23693Use the new LRA register allocator. By default, the old ``reload'' 23694allocator is used. 23695@end table 23696 23697@node picoChip Options 23698@subsection picoChip Options 23699@cindex picoChip options 23700 23701These @samp{-m} options are defined for picoChip implementations: 23702 23703@table @gcctabopt 23704 23705@item -mae=@var{ae_type} 23706@opindex mcpu 23707Set the instruction set, register set, and instruction scheduling 23708parameters for array element type @var{ae_type}. Supported values 23709for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 23710 23711@option{-mae=ANY} selects a completely generic AE type. Code 23712generated with this option runs on any of the other AE types. The 23713code is not as efficient as it would be if compiled for a specific 23714AE type, and some types of operation (e.g., multiplication) do not 23715work properly on all types of AE. 23716 23717@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 23718for compiled code, and is the default. 23719 23720@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 23721option may suffer from poor performance of byte (char) manipulation, 23722since the DSP AE does not provide hardware support for byte load/stores. 23723 23724@item -msymbol-as-address 23725Enable the compiler to directly use a symbol name as an address in a 23726load/store instruction, without first loading it into a 23727register. Typically, the use of this option generates larger 23728programs, which run faster than when the option isn't used. However, the 23729results vary from program to program, so it is left as a user option, 23730rather than being permanently enabled. 23731 23732@item -mno-inefficient-warnings 23733Disables warnings about the generation of inefficient code. These 23734warnings can be generated, for example, when compiling code that 23735performs byte-level memory operations on the MAC AE type. The MAC AE has 23736no hardware support for byte-level memory operations, so all byte 23737load/stores must be synthesized from word load/store operations. This is 23738inefficient and a warning is generated to indicate 23739that you should rewrite the code to avoid byte operations, or to target 23740an AE type that has the necessary hardware support. This option disables 23741these warnings. 23742 23743@end table 23744 23745@node PowerPC Options 23746@subsection PowerPC Options 23747@cindex PowerPC options 23748 23749These are listed under @xref{RS/6000 and PowerPC Options}. 23750 23751@node RISC-V Options 23752@subsection RISC-V Options 23753@cindex RISC-V Options 23754 23755These command-line options are defined for RISC-V targets: 23756 23757@table @gcctabopt 23758@item -mbranch-cost=@var{n} 23759@opindex mbranch-cost 23760Set the cost of branches to roughly @var{n} instructions. 23761 23762@item -mplt 23763@itemx -mno-plt 23764@opindex plt 23765When generating PIC code, do or don't allow the use of PLTs. Ignored for 23766non-PIC. The default is @option{-mplt}. 23767 23768@item -mabi=@var{ABI-string} 23769@opindex mabi 23770Specify integer and floating-point calling convention. @var{ABI-string} 23771contains two parts: the size of integer types and the registers used for 23772floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that 23773@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be 2377432-bit), and that floating-point values up to 64 bits wide are passed in F 23775registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still 23776allows the compiler to generate code that uses the F and D extensions but only 23777allows floating-point values up to 32 bits long to be passed in registers; or 23778@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be 23779passed in registers. 23780 23781The default for this argument is system dependent, users who want a specific 23782calling convention should specify one explicitly. The valid calling 23783conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64}, 23784@samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to 23785implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is 23786invalid because the ABI requires 64-bit values be passed in F registers, but F 23787registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can 23788only be used with the @samp{rv32e} architecture. This ABI is not well 23789specified at present, and is subject to change. 23790 23791@item -mfdiv 23792@itemx -mno-fdiv 23793@opindex mfdiv 23794Do or don't use hardware floating-point divide and square root instructions. 23795This requires the F or D extensions for floating-point registers. The default 23796is to use them if the specified architecture has these instructions. 23797 23798@item -mdiv 23799@itemx -mno-div 23800@opindex mdiv 23801Do or don't use hardware instructions for integer division. This requires the 23802M extension. The default is to use them if the specified architecture has 23803these instructions. 23804 23805@item -march=@var{ISA-string} 23806@opindex march 23807Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be 23808lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and 23809@samp{rv32imaf}. 23810 23811@item -mtune=@var{processor-string} 23812@opindex mtune 23813Optimize the output for the given processor, specified by microarchitecture 23814name. Permissible values for this option are: @samp{rocket}, 23815@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series}, 23816and @samp{size}. 23817 23818When @option{-mtune=} is not specified, the default is @samp{rocket}. 23819 23820The @samp{size} choice is not intended for use by end-users. This is used 23821when @option{-Os} is specified. It overrides the instruction cost info 23822provided by @option{-mtune=}, but does not override the pipeline info. This 23823helps reduce code size while still giving good performance. 23824 23825@item -mpreferred-stack-boundary=@var{num} 23826@opindex mpreferred-stack-boundary 23827Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 23828byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 23829the default is 4 (16 bytes or 128-bits). 23830 23831@strong{Warning:} If you use this switch, then you must build all modules with 23832the same value, including any libraries. This includes the system libraries 23833and startup modules. 23834 23835@item -msmall-data-limit=@var{n} 23836@opindex msmall-data-limit 23837Put global and static data smaller than @var{n} bytes into a special section 23838(on some targets). 23839 23840@item -msave-restore 23841@itemx -mno-save-restore 23842@opindex msave-restore 23843Do or don't use smaller but slower prologue and epilogue code that uses 23844library function calls. The default is to use fast inline prologues and 23845epilogues. 23846 23847@item -mstrict-align 23848@itemx -mno-strict-align 23849@opindex mstrict-align 23850Do not or do generate unaligned memory accesses. The default is set depending 23851on whether the processor we are optimizing for supports fast unaligned access 23852or not. 23853 23854@item -mcmodel=medlow 23855@opindex mcmodel=medlow 23856Generate code for the medium-low code model. The program and its statically 23857defined symbols must lie within a single 2 GiB address range and must lie 23858between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be 23859statically or dynamically linked. This is the default code model. 23860 23861@item -mcmodel=medany 23862@opindex mcmodel=medany 23863Generate code for the medium-any code model. The program and its statically 23864defined symbols must be within any single 2 GiB address range. Programs can be 23865statically or dynamically linked. 23866 23867@item -mexplicit-relocs 23868@itemx -mno-exlicit-relocs 23869Use or do not use assembler relocation operators when dealing with symbolic 23870addresses. The alternative is to use assembler macros instead, which may 23871limit optimization. 23872 23873@item -mrelax 23874@itemx -mno-relax 23875Take advantage of linker relaxations to reduce the number of instructions 23876required to materialize symbol addresses. The default is to take advantage of 23877linker relaxations. 23878 23879@item -memit-attribute 23880@itemx -mno-emit-attribute 23881Emit (do not emit) RISC-V attribute to record extra information into ELF 23882objects. This feature requires at least binutils 2.32. 23883@end table 23884 23885@node RL78 Options 23886@subsection RL78 Options 23887@cindex RL78 Options 23888 23889@table @gcctabopt 23890 23891@item -msim 23892@opindex msim 23893Links in additional target libraries to support operation within a 23894simulator. 23895 23896@item -mmul=none 23897@itemx -mmul=g10 23898@itemx -mmul=g13 23899@itemx -mmul=g14 23900@itemx -mmul=rl78 23901@opindex mmul 23902Specifies the type of hardware multiplication and division support to 23903be used. The simplest is @code{none}, which uses software for both 23904multiplication and division. This is the default. The @code{g13} 23905value is for the hardware multiply/divide peripheral found on the 23906RL78/G13 (S2 core) targets. The @code{g14} value selects the use of 23907the multiplication and division instructions supported by the RL78/G14 23908(S3 core) parts. The value @code{rl78} is an alias for @code{g14} and 23909the value @code{mg10} is an alias for @code{none}. 23910 23911In addition a C preprocessor macro is defined, based upon the setting 23912of this option. Possible values are: @code{__RL78_MUL_NONE__}, 23913@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}. 23914 23915@item -mcpu=g10 23916@itemx -mcpu=g13 23917@itemx -mcpu=g14 23918@itemx -mcpu=rl78 23919@opindex mcpu 23920Specifies the RL78 core to target. The default is the G14 core, also 23921known as an S3 core or just RL78. The G13 or S2 core does not have 23922multiply or divide instructions, instead it uses a hardware peripheral 23923for these operations. The G10 or S1 core does not have register 23924banks, so it uses a different calling convention. 23925 23926If this option is set it also selects the type of hardware multiply 23927support to use, unless this is overridden by an explicit 23928@option{-mmul=none} option on the command line. Thus specifying 23929@option{-mcpu=g13} enables the use of the G13 hardware multiply 23930peripheral and specifying @option{-mcpu=g10} disables the use of 23931hardware multiplications altogether. 23932 23933Note, although the RL78/G14 core is the default target, specifying 23934@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does 23935change the behavior of the toolchain since it also enables G14 23936hardware multiply support. If these options are not specified on the 23937command line then software multiplication routines will be used even 23938though the code targets the RL78 core. This is for backwards 23939compatibility with older toolchains which did not have hardware 23940multiply and divide support. 23941 23942In addition a C preprocessor macro is defined, based upon the setting 23943of this option. Possible values are: @code{__RL78_G10__}, 23944@code{__RL78_G13__} or @code{__RL78_G14__}. 23945 23946@item -mg10 23947@itemx -mg13 23948@itemx -mg14 23949@itemx -mrl78 23950@opindex mg10 23951@opindex mg13 23952@opindex mg14 23953@opindex mrl78 23954These are aliases for the corresponding @option{-mcpu=} option. They 23955are provided for backwards compatibility. 23956 23957@item -mallregs 23958@opindex mallregs 23959Allow the compiler to use all of the available registers. By default 23960registers @code{r24..r31} are reserved for use in interrupt handlers. 23961With this option enabled these registers can be used in ordinary 23962functions as well. 23963 23964@item -m64bit-doubles 23965@itemx -m32bit-doubles 23966@opindex m64bit-doubles 23967@opindex m32bit-doubles 23968Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 23969or 32 bits (@option{-m32bit-doubles}) in size. The default is 23970@option{-m32bit-doubles}. 23971 23972@item -msave-mduc-in-interrupts 23973@itemx -mno-save-mduc-in-interrupts 23974@opindex msave-mduc-in-interrupts 23975@opindex mno-save-mduc-in-interrupts 23976Specifies that interrupt handler functions should preserve the 23977MDUC registers. This is only necessary if normal code might use 23978the MDUC registers, for example because it performs multiplication 23979and division operations. The default is to ignore the MDUC registers 23980as this makes the interrupt handlers faster. The target option -mg13 23981needs to be passed for this to work as this feature is only available 23982on the G13 target (S2 core). The MDUC registers will only be saved 23983if the interrupt handler performs a multiplication or division 23984operation or it calls another function. 23985 23986@end table 23987 23988@node RS/6000 and PowerPC Options 23989@subsection IBM RS/6000 and PowerPC Options 23990@cindex RS/6000 and PowerPC Options 23991@cindex IBM RS/6000 and PowerPC Options 23992 23993These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 23994@table @gcctabopt 23995@item -mpowerpc-gpopt 23996@itemx -mno-powerpc-gpopt 23997@itemx -mpowerpc-gfxopt 23998@itemx -mno-powerpc-gfxopt 23999@need 800 24000@itemx -mpowerpc64 24001@itemx -mno-powerpc64 24002@itemx -mmfcrf 24003@itemx -mno-mfcrf 24004@itemx -mpopcntb 24005@itemx -mno-popcntb 24006@itemx -mpopcntd 24007@itemx -mno-popcntd 24008@itemx -mfprnd 24009@itemx -mno-fprnd 24010@need 800 24011@itemx -mcmpb 24012@itemx -mno-cmpb 24013@itemx -mmfpgpr 24014@itemx -mno-mfpgpr 24015@itemx -mhard-dfp 24016@itemx -mno-hard-dfp 24017@opindex mpowerpc-gpopt 24018@opindex mno-powerpc-gpopt 24019@opindex mpowerpc-gfxopt 24020@opindex mno-powerpc-gfxopt 24021@opindex mpowerpc64 24022@opindex mno-powerpc64 24023@opindex mmfcrf 24024@opindex mno-mfcrf 24025@opindex mpopcntb 24026@opindex mno-popcntb 24027@opindex mpopcntd 24028@opindex mno-popcntd 24029@opindex mfprnd 24030@opindex mno-fprnd 24031@opindex mcmpb 24032@opindex mno-cmpb 24033@opindex mmfpgpr 24034@opindex mno-mfpgpr 24035@opindex mhard-dfp 24036@opindex mno-hard-dfp 24037You use these options to specify which instructions are available on the 24038processor you are using. The default value of these options is 24039determined when configuring GCC@. Specifying the 24040@option{-mcpu=@var{cpu_type}} overrides the specification of these 24041options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 24042rather than the options listed above. 24043 24044Specifying @option{-mpowerpc-gpopt} allows 24045GCC to use the optional PowerPC architecture instructions in the 24046General Purpose group, including floating-point square root. Specifying 24047@option{-mpowerpc-gfxopt} allows GCC to 24048use the optional PowerPC architecture instructions in the Graphics 24049group, including floating-point select. 24050 24051The @option{-mmfcrf} option allows GCC to generate the move from 24052condition register field instruction implemented on the POWER4 24053processor and other processors that support the PowerPC V2.01 24054architecture. 24055The @option{-mpopcntb} option allows GCC to generate the popcount and 24056double-precision FP reciprocal estimate instruction implemented on the 24057POWER5 processor and other processors that support the PowerPC V2.02 24058architecture. 24059The @option{-mpopcntd} option allows GCC to generate the popcount 24060instruction implemented on the POWER7 processor and other processors 24061that support the PowerPC V2.06 architecture. 24062The @option{-mfprnd} option allows GCC to generate the FP round to 24063integer instructions implemented on the POWER5+ processor and other 24064processors that support the PowerPC V2.03 architecture. 24065The @option{-mcmpb} option allows GCC to generate the compare bytes 24066instruction implemented on the POWER6 processor and other processors 24067that support the PowerPC V2.05 architecture. 24068The @option{-mmfpgpr} option allows GCC to generate the FP move to/from 24069general-purpose register instructions implemented on the POWER6X 24070processor and other processors that support the extended PowerPC V2.05 24071architecture. 24072The @option{-mhard-dfp} option allows GCC to generate the decimal 24073floating-point instructions implemented on some POWER processors. 24074 24075The @option{-mpowerpc64} option allows GCC to generate the additional 2407664-bit instructions that are found in the full PowerPC64 architecture 24077and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 24078@option{-mno-powerpc64}. 24079 24080@item -mcpu=@var{cpu_type} 24081@opindex mcpu 24082Set architecture type, register usage, and 24083instruction scheduling parameters for machine type @var{cpu_type}. 24084Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 24085@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 24086@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 24087@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 24088@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 24089@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 24090@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 24091@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 24092@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 24093@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, 24094@samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le}, 24095@samp{rs64}, and @samp{native}. 24096 24097@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 24098@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 24099endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 24100architecture machine types, with an appropriate, generic processor 24101model assumed for scheduling purposes. 24102 24103Specifying @samp{native} as cpu type detects and selects the 24104architecture option that corresponds to the host processor of the 24105system performing the compilation. 24106@option{-mcpu=native} has no effect if GCC does not recognize the 24107processor. 24108 24109The other options specify a specific processor. Code generated under 24110those options runs best on that processor, and may not run at all on 24111others. 24112 24113The @option{-mcpu} options automatically enable or disable the 24114following options: 24115 24116@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 24117-mpopcntb -mpopcntd -mpowerpc64 @gol 24118-mpowerpc-gpopt -mpowerpc-gfxopt @gol 24119-mmulhw -mdlmzb -mmfpgpr -mvsx @gol 24120-mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol 24121-mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware} 24122 24123The particular options set for any particular CPU varies between 24124compiler versions, depending on what setting seems to produce optimal 24125code for that CPU; it doesn't necessarily reflect the actual hardware's 24126capabilities. If you wish to set an individual option to a particular 24127value, you may specify it after the @option{-mcpu} option, like 24128@option{-mcpu=970 -mno-altivec}. 24129 24130On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 24131not enabled or disabled by the @option{-mcpu} option at present because 24132AIX does not have full support for these options. You may still 24133enable or disable them individually if you're sure it'll work in your 24134environment. 24135 24136@item -mtune=@var{cpu_type} 24137@opindex mtune 24138Set the instruction scheduling parameters for machine type 24139@var{cpu_type}, but do not set the architecture type or register usage, 24140as @option{-mcpu=@var{cpu_type}} does. The same 24141values for @var{cpu_type} are used for @option{-mtune} as for 24142@option{-mcpu}. If both are specified, the code generated uses the 24143architecture and registers set by @option{-mcpu}, but the 24144scheduling parameters set by @option{-mtune}. 24145 24146@item -mcmodel=small 24147@opindex mcmodel=small 24148Generate PowerPC64 code for the small model: The TOC is limited to 2414964k. 24150 24151@item -mcmodel=medium 24152@opindex mcmodel=medium 24153Generate PowerPC64 code for the medium model: The TOC and other static 24154data may be up to a total of 4G in size. This is the default for 64-bit 24155Linux. 24156 24157@item -mcmodel=large 24158@opindex mcmodel=large 24159Generate PowerPC64 code for the large model: The TOC may be up to 4G 24160in size. Other data and code is only limited by the 64-bit address 24161space. 24162 24163@item -maltivec 24164@itemx -mno-altivec 24165@opindex maltivec 24166@opindex mno-altivec 24167Generate code that uses (does not use) AltiVec instructions, and also 24168enable the use of built-in functions that allow more direct access to 24169the AltiVec instruction set. You may also need to set 24170@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 24171enhancements. 24172 24173When @option{-maltivec} is used, the element order for AltiVec intrinsics 24174such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 24175match array element order corresponding to the endianness of the 24176target. That is, element zero identifies the leftmost element in a 24177vector register when targeting a big-endian platform, and identifies 24178the rightmost element in a vector register when targeting a 24179little-endian platform. 24180 24181@item -mvrsave 24182@itemx -mno-vrsave 24183@opindex mvrsave 24184@opindex mno-vrsave 24185Generate VRSAVE instructions when generating AltiVec code. 24186 24187@item -msecure-plt 24188@opindex msecure-plt 24189Generate code that allows @command{ld} and @command{ld.so} 24190to build executables and shared 24191libraries with non-executable @code{.plt} and @code{.got} sections. 24192This is a PowerPC 2419332-bit SYSV ABI option. 24194 24195@item -mbss-plt 24196@opindex mbss-plt 24197Generate code that uses a BSS @code{.plt} section that @command{ld.so} 24198fills in, and 24199requires @code{.plt} and @code{.got} 24200sections that are both writable and executable. 24201This is a PowerPC 32-bit SYSV ABI option. 24202 24203@item -misel 24204@itemx -mno-isel 24205@opindex misel 24206@opindex mno-isel 24207This switch enables or disables the generation of ISEL instructions. 24208 24209@item -mvsx 24210@itemx -mno-vsx 24211@opindex mvsx 24212@opindex mno-vsx 24213Generate code that uses (does not use) vector/scalar (VSX) 24214instructions, and also enable the use of built-in functions that allow 24215more direct access to the VSX instruction set. 24216 24217@item -mcrypto 24218@itemx -mno-crypto 24219@opindex mcrypto 24220@opindex mno-crypto 24221Enable the use (disable) of the built-in functions that allow direct 24222access to the cryptographic instructions that were added in version 242232.07 of the PowerPC ISA. 24224 24225@item -mhtm 24226@itemx -mno-htm 24227@opindex mhtm 24228@opindex mno-htm 24229Enable (disable) the use of the built-in functions that allow direct 24230access to the Hardware Transactional Memory (HTM) instructions that 24231were added in version 2.07 of the PowerPC ISA. 24232 24233@item -mpower8-fusion 24234@itemx -mno-power8-fusion 24235@opindex mpower8-fusion 24236@opindex mno-power8-fusion 24237Generate code that keeps (does not keeps) some integer operations 24238adjacent so that the instructions can be fused together on power8 and 24239later processors. 24240 24241@item -mpower8-vector 24242@itemx -mno-power8-vector 24243@opindex mpower8-vector 24244@opindex mno-power8-vector 24245Generate code that uses (does not use) the vector and scalar 24246instructions that were added in version 2.07 of the PowerPC ISA. Also 24247enable the use of built-in functions that allow more direct access to 24248the vector instructions. 24249 24250@item -mquad-memory 24251@itemx -mno-quad-memory 24252@opindex mquad-memory 24253@opindex mno-quad-memory 24254Generate code that uses (does not use) the non-atomic quad word memory 24255instructions. The @option{-mquad-memory} option requires use of 2425664-bit mode. 24257 24258@item -mquad-memory-atomic 24259@itemx -mno-quad-memory-atomic 24260@opindex mquad-memory-atomic 24261@opindex mno-quad-memory-atomic 24262Generate code that uses (does not use) the atomic quad word memory 24263instructions. The @option{-mquad-memory-atomic} option requires use of 2426464-bit mode. 24265 24266@item -mfloat128 24267@itemx -mno-float128 24268@opindex mfloat128 24269@opindex mno-float128 24270Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point 24271and use either software emulation for IEEE 128-bit floating point or 24272hardware instructions. 24273 24274The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, 24275@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to 24276use the IEEE 128-bit floating point support. The IEEE 128-bit 24277floating point support only works on PowerPC Linux systems. 24278 24279The default for @option{-mfloat128} is enabled on PowerPC Linux 24280systems using the VSX instruction set, and disabled on other systems. 24281 24282If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or 24283@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating 24284point support will also enable the generation of ISA 3.0 IEEE 128-bit 24285floating point instructions. Otherwise, if you do not specify to 24286generate ISA 3.0 instructions or you are targeting a 32-bit big endian 24287system, IEEE 128-bit floating point will be done with software 24288emulation. 24289 24290@item -mfloat128-hardware 24291@itemx -mno-float128-hardware 24292@opindex mfloat128-hardware 24293@opindex mno-float128-hardware 24294Enable/disable using ISA 3.0 hardware instructions to support the 24295@var{__float128} data type. 24296 24297The default for @option{-mfloat128-hardware} is enabled on PowerPC 24298Linux systems using the ISA 3.0 instruction set, and disabled on other 24299systems. 24300 24301@item -m32 24302@itemx -m64 24303@opindex m32 24304@opindex m64 24305Generate code for 32-bit or 64-bit environments of Darwin and SVR4 24306targets (including GNU/Linux). The 32-bit environment sets int, long 24307and pointer to 32 bits and generates code that runs on any PowerPC 24308variant. The 64-bit environment sets int to 32 bits and long and 24309pointer to 64 bits, and generates code for PowerPC64, as for 24310@option{-mpowerpc64}. 24311 24312@item -mfull-toc 24313@itemx -mno-fp-in-toc 24314@itemx -mno-sum-in-toc 24315@itemx -mminimal-toc 24316@opindex mfull-toc 24317@opindex mno-fp-in-toc 24318@opindex mno-sum-in-toc 24319@opindex mminimal-toc 24320Modify generation of the TOC (Table Of Contents), which is created for 24321every executable file. The @option{-mfull-toc} option is selected by 24322default. In that case, GCC allocates at least one TOC entry for 24323each unique non-automatic variable reference in your program. GCC 24324also places floating-point constants in the TOC@. However, only 2432516,384 entries are available in the TOC@. 24326 24327If you receive a linker error message that saying you have overflowed 24328the available TOC space, you can reduce the amount of TOC space used 24329with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 24330@option{-mno-fp-in-toc} prevents GCC from putting floating-point 24331constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 24332generate code to calculate the sum of an address and a constant at 24333run time instead of putting that sum into the TOC@. You may specify one 24334or both of these options. Each causes GCC to produce very slightly 24335slower and larger code at the expense of conserving TOC space. 24336 24337If you still run out of space in the TOC even when you specify both of 24338these options, specify @option{-mminimal-toc} instead. This option causes 24339GCC to make only one TOC entry for every file. When you specify this 24340option, GCC produces code that is slower and larger but which 24341uses extremely little TOC space. You may wish to use this option 24342only on files that contain less frequently-executed code. 24343 24344@item -maix64 24345@itemx -maix32 24346@opindex maix64 24347@opindex maix32 24348Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 24349@code{long} type, and the infrastructure needed to support them. 24350Specifying @option{-maix64} implies @option{-mpowerpc64}, 24351while @option{-maix32} disables the 64-bit ABI and 24352implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 24353 24354@item -mxl-compat 24355@itemx -mno-xl-compat 24356@opindex mxl-compat 24357@opindex mno-xl-compat 24358Produce code that conforms more closely to IBM XL compiler semantics 24359when using AIX-compatible ABI@. Pass floating-point arguments to 24360prototyped functions beyond the register save area (RSA) on the stack 24361in addition to argument FPRs. Do not assume that most significant 24362double in 128-bit long double value is properly rounded when comparing 24363values and converting to double. Use XL symbol names for long double 24364support routines. 24365 24366The AIX calling convention was extended but not initially documented to 24367handle an obscure K&R C case of calling a function that takes the 24368address of its arguments with fewer arguments than declared. IBM XL 24369compilers access floating-point arguments that do not fit in the 24370RSA from the stack when a subroutine is compiled without 24371optimization. Because always storing floating-point arguments on the 24372stack is inefficient and rarely needed, this option is not enabled by 24373default and only is necessary when calling subroutines compiled by IBM 24374XL compilers without optimization. 24375 24376@item -mpe 24377@opindex mpe 24378Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 24379application written to use message passing with special startup code to 24380enable the application to run. The system must have PE installed in the 24381standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 24382must be overridden with the @option{-specs=} option to specify the 24383appropriate directory location. The Parallel Environment does not 24384support threads, so the @option{-mpe} option and the @option{-pthread} 24385option are incompatible. 24386 24387@item -malign-natural 24388@itemx -malign-power 24389@opindex malign-natural 24390@opindex malign-power 24391On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 24392@option{-malign-natural} overrides the ABI-defined alignment of larger 24393types, such as floating-point doubles, on their natural size-based boundary. 24394The option @option{-malign-power} instructs GCC to follow the ABI-specified 24395alignment rules. GCC defaults to the standard alignment defined in the ABI@. 24396 24397On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 24398is not supported. 24399 24400@item -msoft-float 24401@itemx -mhard-float 24402@opindex msoft-float 24403@opindex mhard-float 24404Generate code that does not use (uses) the floating-point register set. 24405Software floating-point emulation is provided if you use the 24406@option{-msoft-float} option, and pass the option to GCC when linking. 24407 24408@item -mmultiple 24409@itemx -mno-multiple 24410@opindex mmultiple 24411@opindex mno-multiple 24412Generate code that uses (does not use) the load multiple word 24413instructions and the store multiple word instructions. These 24414instructions are generated by default on POWER systems, and not 24415generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 24416PowerPC systems, since those instructions do not work when the 24417processor is in little-endian mode. The exceptions are PPC740 and 24418PPC750 which permit these instructions in little-endian mode. 24419 24420@item -mupdate 24421@itemx -mno-update 24422@opindex mupdate 24423@opindex mno-update 24424Generate code that uses (does not use) the load or store instructions 24425that update the base register to the address of the calculated memory 24426location. These instructions are generated by default. If you use 24427@option{-mno-update}, there is a small window between the time that the 24428stack pointer is updated and the address of the previous frame is 24429stored, which means code that walks the stack frame across interrupts or 24430signals may get corrupted data. 24431 24432@item -mavoid-indexed-addresses 24433@itemx -mno-avoid-indexed-addresses 24434@opindex mavoid-indexed-addresses 24435@opindex mno-avoid-indexed-addresses 24436Generate code that tries to avoid (not avoid) the use of indexed load 24437or store instructions. These instructions can incur a performance 24438penalty on Power6 processors in certain situations, such as when 24439stepping through large arrays that cross a 16M boundary. This option 24440is enabled by default when targeting Power6 and disabled otherwise. 24441 24442@item -mfused-madd 24443@itemx -mno-fused-madd 24444@opindex mfused-madd 24445@opindex mno-fused-madd 24446Generate code that uses (does not use) the floating-point multiply and 24447accumulate instructions. These instructions are generated by default 24448if hardware floating point is used. The machine-dependent 24449@option{-mfused-madd} option is now mapped to the machine-independent 24450@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 24451mapped to @option{-ffp-contract=off}. 24452 24453@item -mmulhw 24454@itemx -mno-mulhw 24455@opindex mmulhw 24456@opindex mno-mulhw 24457Generate code that uses (does not use) the half-word multiply and 24458multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 24459These instructions are generated by default when targeting those 24460processors. 24461 24462@item -mdlmzb 24463@itemx -mno-dlmzb 24464@opindex mdlmzb 24465@opindex mno-dlmzb 24466Generate code that uses (does not use) the string-search @samp{dlmzb} 24467instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 24468generated by default when targeting those processors. 24469 24470@item -mno-bit-align 24471@itemx -mbit-align 24472@opindex mno-bit-align 24473@opindex mbit-align 24474On System V.4 and embedded PowerPC systems do not (do) force structures 24475and unions that contain bit-fields to be aligned to the base type of the 24476bit-field. 24477 24478For example, by default a structure containing nothing but 8 24479@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 24480boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 24481the structure is aligned to a 1-byte boundary and is 1 byte in 24482size. 24483 24484@item -mno-strict-align 24485@itemx -mstrict-align 24486@opindex mno-strict-align 24487@opindex mstrict-align 24488On System V.4 and embedded PowerPC systems do not (do) assume that 24489unaligned memory references are handled by the system. 24490 24491@item -mrelocatable 24492@itemx -mno-relocatable 24493@opindex mrelocatable 24494@opindex mno-relocatable 24495Generate code that allows (does not allow) a static executable to be 24496relocated to a different address at run time. A simple embedded 24497PowerPC system loader should relocate the entire contents of 24498@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 24499a table of 32-bit addresses generated by this option. For this to 24500work, all objects linked together must be compiled with 24501@option{-mrelocatable} or @option{-mrelocatable-lib}. 24502@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 24503 24504@item -mrelocatable-lib 24505@itemx -mno-relocatable-lib 24506@opindex mrelocatable-lib 24507@opindex mno-relocatable-lib 24508Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 24509@code{.fixup} section to allow static executables to be relocated at 24510run time, but @option{-mrelocatable-lib} does not use the smaller stack 24511alignment of @option{-mrelocatable}. Objects compiled with 24512@option{-mrelocatable-lib} may be linked with objects compiled with 24513any combination of the @option{-mrelocatable} options. 24514 24515@item -mno-toc 24516@itemx -mtoc 24517@opindex mno-toc 24518@opindex mtoc 24519On System V.4 and embedded PowerPC systems do not (do) assume that 24520register 2 contains a pointer to a global area pointing to the addresses 24521used in the program. 24522 24523@item -mlittle 24524@itemx -mlittle-endian 24525@opindex mlittle 24526@opindex mlittle-endian 24527On System V.4 and embedded PowerPC systems compile code for the 24528processor in little-endian mode. The @option{-mlittle-endian} option is 24529the same as @option{-mlittle}. 24530 24531@item -mbig 24532@itemx -mbig-endian 24533@opindex mbig 24534@opindex mbig-endian 24535On System V.4 and embedded PowerPC systems compile code for the 24536processor in big-endian mode. The @option{-mbig-endian} option is 24537the same as @option{-mbig}. 24538 24539@item -mdynamic-no-pic 24540@opindex mdynamic-no-pic 24541On Darwin and Mac OS X systems, compile code so that it is not 24542relocatable, but that its external references are relocatable. The 24543resulting code is suitable for applications, but not shared 24544libraries. 24545 24546@item -msingle-pic-base 24547@opindex msingle-pic-base 24548Treat the register used for PIC addressing as read-only, rather than 24549loading it in the prologue for each function. The runtime system is 24550responsible for initializing this register with an appropriate value 24551before execution begins. 24552 24553@item -mprioritize-restricted-insns=@var{priority} 24554@opindex mprioritize-restricted-insns 24555This option controls the priority that is assigned to 24556dispatch-slot restricted instructions during the second scheduling 24557pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 24558or @samp{2} to assign no, highest, or second-highest (respectively) 24559priority to dispatch-slot restricted 24560instructions. 24561 24562@item -msched-costly-dep=@var{dependence_type} 24563@opindex msched-costly-dep 24564This option controls which dependences are considered costly 24565by the target during instruction scheduling. The argument 24566@var{dependence_type} takes one of the following values: 24567 24568@table @asis 24569@item @samp{no} 24570No dependence is costly. 24571 24572@item @samp{all} 24573All dependences are costly. 24574 24575@item @samp{true_store_to_load} 24576A true dependence from store to load is costly. 24577 24578@item @samp{store_to_load} 24579Any dependence from store to load is costly. 24580 24581@item @var{number} 24582Any dependence for which the latency is greater than or equal to 24583@var{number} is costly. 24584@end table 24585 24586@item -minsert-sched-nops=@var{scheme} 24587@opindex minsert-sched-nops 24588This option controls which NOP insertion scheme is used during 24589the second scheduling pass. The argument @var{scheme} takes one of the 24590following values: 24591 24592@table @asis 24593@item @samp{no} 24594Don't insert NOPs. 24595 24596@item @samp{pad} 24597Pad with NOPs any dispatch group that has vacant issue slots, 24598according to the scheduler's grouping. 24599 24600@item @samp{regroup_exact} 24601Insert NOPs to force costly dependent insns into 24602separate groups. Insert exactly as many NOPs as needed to force an insn 24603to a new group, according to the estimated processor grouping. 24604 24605@item @var{number} 24606Insert NOPs to force costly dependent insns into 24607separate groups. Insert @var{number} NOPs to force an insn to a new group. 24608@end table 24609 24610@item -mcall-sysv 24611@opindex mcall-sysv 24612On System V.4 and embedded PowerPC systems compile code using calling 24613conventions that adhere to the March 1995 draft of the System V 24614Application Binary Interface, PowerPC processor supplement. This is the 24615default unless you configured GCC using @samp{powerpc-*-eabiaix}. 24616 24617@item -mcall-sysv-eabi 24618@itemx -mcall-eabi 24619@opindex mcall-sysv-eabi 24620@opindex mcall-eabi 24621Specify both @option{-mcall-sysv} and @option{-meabi} options. 24622 24623@item -mcall-sysv-noeabi 24624@opindex mcall-sysv-noeabi 24625Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 24626 24627@item -mcall-aixdesc 24628@opindex m 24629On System V.4 and embedded PowerPC systems compile code for the AIX 24630operating system. 24631 24632@item -mcall-linux 24633@opindex mcall-linux 24634On System V.4 and embedded PowerPC systems compile code for the 24635Linux-based GNU system. 24636 24637@item -mcall-freebsd 24638@opindex mcall-freebsd 24639On System V.4 and embedded PowerPC systems compile code for the 24640FreeBSD operating system. 24641 24642@item -mcall-netbsd 24643@opindex mcall-netbsd 24644On System V.4 and embedded PowerPC systems compile code for the 24645NetBSD operating system. 24646 24647@item -mcall-openbsd 24648@opindex mcall-netbsd 24649On System V.4 and embedded PowerPC systems compile code for the 24650OpenBSD operating system. 24651 24652@item -mtraceback=@var{traceback_type} 24653@opindex mtraceback 24654Select the type of traceback table. Valid values for @var{traceback_type} 24655are @samp{full}, @samp{part}, and @samp{no}. 24656 24657@item -maix-struct-return 24658@opindex maix-struct-return 24659Return all structures in memory (as specified by the AIX ABI)@. 24660 24661@item -msvr4-struct-return 24662@opindex msvr4-struct-return 24663Return structures smaller than 8 bytes in registers (as specified by the 24664SVR4 ABI)@. 24665 24666@item -mabi=@var{abi-type} 24667@opindex mabi 24668Extend the current ABI with a particular extension, or remove such extension. 24669Valid values are @samp{altivec}, @samp{no-altivec}, 24670@samp{ibmlongdouble}, @samp{ieeelongdouble}, 24671@samp{elfv1}, @samp{elfv2}@. 24672 24673@item -mabi=ibmlongdouble 24674@opindex mabi=ibmlongdouble 24675Change the current ABI to use IBM extended-precision long double. 24676This is not likely to work if your system defaults to using IEEE 24677extended-precision long double. If you change the long double type 24678from IEEE extended-precision, the compiler will issue a warning unless 24679you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 24680to be enabled. 24681 24682@item -mabi=ieeelongdouble 24683@opindex mabi=ieeelongdouble 24684Change the current ABI to use IEEE extended-precision long double. 24685This is not likely to work if your system defaults to using IBM 24686extended-precision long double. If you change the long double type 24687from IBM extended-precision, the compiler will issue a warning unless 24688you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 24689to be enabled. 24690 24691@item -mabi=elfv1 24692@opindex mabi=elfv1 24693Change the current ABI to use the ELFv1 ABI. 24694This is the default ABI for big-endian PowerPC 64-bit Linux. 24695Overriding the default ABI requires special system support and is 24696likely to fail in spectacular ways. 24697 24698@item -mabi=elfv2 24699@opindex mabi=elfv2 24700Change the current ABI to use the ELFv2 ABI. 24701This is the default ABI for little-endian PowerPC 64-bit Linux. 24702Overriding the default ABI requires special system support and is 24703likely to fail in spectacular ways. 24704 24705@item -mgnu-attribute 24706@itemx -mno-gnu-attribute 24707@opindex mgnu-attribute 24708@opindex mno-gnu-attribute 24709Emit .gnu_attribute assembly directives to set tag/value pairs in a 24710.gnu.attributes section that specify ABI variations in function 24711parameters or return values. 24712 24713@item -mprototype 24714@itemx -mno-prototype 24715@opindex mprototype 24716@opindex mno-prototype 24717On System V.4 and embedded PowerPC systems assume that all calls to 24718variable argument functions are properly prototyped. Otherwise, the 24719compiler must insert an instruction before every non-prototyped call to 24720set or clear bit 6 of the condition code register (@code{CR}) to 24721indicate whether floating-point values are passed in the floating-point 24722registers in case the function takes variable arguments. With 24723@option{-mprototype}, only calls to prototyped variable argument functions 24724set or clear the bit. 24725 24726@item -msim 24727@opindex msim 24728On embedded PowerPC systems, assume that the startup module is called 24729@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 24730@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 24731configurations. 24732 24733@item -mmvme 24734@opindex mmvme 24735On embedded PowerPC systems, assume that the startup module is called 24736@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 24737@file{libc.a}. 24738 24739@item -mads 24740@opindex mads 24741On embedded PowerPC systems, assume that the startup module is called 24742@file{crt0.o} and the standard C libraries are @file{libads.a} and 24743@file{libc.a}. 24744 24745@item -myellowknife 24746@opindex myellowknife 24747On embedded PowerPC systems, assume that the startup module is called 24748@file{crt0.o} and the standard C libraries are @file{libyk.a} and 24749@file{libc.a}. 24750 24751@item -mvxworks 24752@opindex mvxworks 24753On System V.4 and embedded PowerPC systems, specify that you are 24754compiling for a VxWorks system. 24755 24756@item -memb 24757@opindex memb 24758On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 24759header to indicate that @samp{eabi} extended relocations are used. 24760 24761@item -meabi 24762@itemx -mno-eabi 24763@opindex meabi 24764@opindex mno-eabi 24765On System V.4 and embedded PowerPC systems do (do not) adhere to the 24766Embedded Applications Binary Interface (EABI), which is a set of 24767modifications to the System V.4 specifications. Selecting @option{-meabi} 24768means that the stack is aligned to an 8-byte boundary, a function 24769@code{__eabi} is called from @code{main} to set up the EABI 24770environment, and the @option{-msdata} option can use both @code{r2} and 24771@code{r13} to point to two separate small data areas. Selecting 24772@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 24773no EABI initialization function is called from @code{main}, and the 24774@option{-msdata} option only uses @code{r13} to point to a single 24775small data area. The @option{-meabi} option is on by default if you 24776configured GCC using one of the @samp{powerpc*-*-eabi*} options. 24777 24778@item -msdata=eabi 24779@opindex msdata=eabi 24780On System V.4 and embedded PowerPC systems, put small initialized 24781@code{const} global and static data in the @code{.sdata2} section, which 24782is pointed to by register @code{r2}. Put small initialized 24783non-@code{const} global and static data in the @code{.sdata} section, 24784which is pointed to by register @code{r13}. Put small uninitialized 24785global and static data in the @code{.sbss} section, which is adjacent to 24786the @code{.sdata} section. The @option{-msdata=eabi} option is 24787incompatible with the @option{-mrelocatable} option. The 24788@option{-msdata=eabi} option also sets the @option{-memb} option. 24789 24790@item -msdata=sysv 24791@opindex msdata=sysv 24792On System V.4 and embedded PowerPC systems, put small global and static 24793data in the @code{.sdata} section, which is pointed to by register 24794@code{r13}. Put small uninitialized global and static data in the 24795@code{.sbss} section, which is adjacent to the @code{.sdata} section. 24796The @option{-msdata=sysv} option is incompatible with the 24797@option{-mrelocatable} option. 24798 24799@item -msdata=default 24800@itemx -msdata 24801@opindex msdata=default 24802@opindex msdata 24803On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 24804compile code the same as @option{-msdata=eabi}, otherwise compile code the 24805same as @option{-msdata=sysv}. 24806 24807@item -msdata=data 24808@opindex msdata=data 24809On System V.4 and embedded PowerPC systems, put small global 24810data in the @code{.sdata} section. Put small uninitialized global 24811data in the @code{.sbss} section. Do not use register @code{r13} 24812to address small data however. This is the default behavior unless 24813other @option{-msdata} options are used. 24814 24815@item -msdata=none 24816@itemx -mno-sdata 24817@opindex msdata=none 24818@opindex mno-sdata 24819On embedded PowerPC systems, put all initialized global and static data 24820in the @code{.data} section, and all uninitialized data in the 24821@code{.bss} section. 24822 24823@item -mreadonly-in-sdata 24824@opindex mreadonly-in-sdata 24825@opindex mno-readonly-in-sdata 24826Put read-only objects in the @code{.sdata} section as well. This is the 24827default. 24828 24829@item -mblock-move-inline-limit=@var{num} 24830@opindex mblock-move-inline-limit 24831Inline all block moves (such as calls to @code{memcpy} or structure 24832copies) less than or equal to @var{num} bytes. The minimum value for 24833@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 24834targets. The default value is target-specific. 24835 24836@item -mblock-compare-inline-limit=@var{num} 24837@opindex mblock-compare-inline-limit 24838Generate non-looping inline code for all block compares (such as calls 24839to @code{memcmp} or structure compares) less than or equal to @var{num} 24840bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of 24841block compare is disabled. The default value is target-specific. 24842 24843@item -mblock-compare-inline-loop-limit=@var{num} 24844@opindex mblock-compare-inline-loop-limit 24845Generate an inline expansion using loop code for all block compares that 24846are less than or equal to @var{num} bytes, but greater than the limit 24847for non-loop inline block compare expansion. If the block length is not 24848constant, at most @var{num} bytes will be compared before @code{memcmp} 24849is called to compare the remainder of the block. The default value is 24850target-specific. 24851 24852@item -mstring-compare-inline-limit=@var{num} 24853@opindex mstring-compare-inline-limit 24854Compare at most @var{num} string bytes with inline code. 24855If the difference or end of string is not found at the 24856end of the inline compare a call to @code{strcmp} or @code{strncmp} will 24857take care of the rest of the comparison. The default is 64 bytes. 24858 24859@item -G @var{num} 24860@opindex G 24861@cindex smaller data references (PowerPC) 24862@cindex .sdata/.sdata2 references (PowerPC) 24863On embedded PowerPC systems, put global and static items less than or 24864equal to @var{num} bytes into the small data or BSS sections instead of 24865the normal data or BSS section. By default, @var{num} is 8. The 24866@option{-G @var{num}} switch is also passed to the linker. 24867All modules should be compiled with the same @option{-G @var{num}} value. 24868 24869@item -mregnames 24870@itemx -mno-regnames 24871@opindex mregnames 24872@opindex mno-regnames 24873On System V.4 and embedded PowerPC systems do (do not) emit register 24874names in the assembly language output using symbolic forms. 24875 24876@item -mlongcall 24877@itemx -mno-longcall 24878@opindex mlongcall 24879@opindex mno-longcall 24880By default assume that all calls are far away so that a longer and more 24881expensive calling sequence is required. This is required for calls 24882farther than 32 megabytes (33,554,432 bytes) from the current location. 24883A short call is generated if the compiler knows 24884the call cannot be that far away. This setting can be overridden by 24885the @code{shortcall} function attribute, or by @code{#pragma 24886longcall(0)}. 24887 24888Some linkers are capable of detecting out-of-range calls and generating 24889glue code on the fly. On these systems, long calls are unnecessary and 24890generate slower code. As of this writing, the AIX linker can do this, 24891as can the GNU linker for PowerPC/64. It is planned to add this feature 24892to the GNU linker for 32-bit PowerPC systems as well. 24893 24894On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers, 24895GCC can generate long calls using an inline PLT call sequence (see 24896@option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64 24897ELFv1 (big-endian) do not support inline PLT calls. 24898 24899On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 24900callee, L42}, plus a @dfn{branch island} (glue code). The two target 24901addresses represent the callee and the branch island. The 24902Darwin/PPC linker prefers the first address and generates a @code{bl 24903callee} if the PPC @code{bl} instruction reaches the callee directly; 24904otherwise, the linker generates @code{bl L42} to call the branch 24905island. The branch island is appended to the body of the 24906calling function; it computes the full 32-bit address of the callee 24907and jumps to it. 24908 24909On Mach-O (Darwin) systems, this option directs the compiler emit to 24910the glue for every direct call, and the Darwin linker decides whether 24911to use or discard it. 24912 24913In the future, GCC may ignore all longcall specifications 24914when the linker is known to generate glue. 24915 24916@item -mpltseq 24917@itemx -mno-pltseq 24918@opindex mpltseq 24919@opindex mno-pltseq 24920Implement (do not implement) -fno-plt and long calls using an inline 24921PLT call sequence that supports lazy linking and long calls to 24922functions in dlopen'd shared libraries. Inline PLT calls are only 24923supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU 24924linkers, and are enabled by default if the support is detected when 24925configuring GCC, and, in the case of 32-bit PowerPC, if GCC is 24926configured with @option{--enable-secureplt}. @option{-mpltseq} code 24927and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be 24928linked together. 24929 24930@item -mtls-markers 24931@itemx -mno-tls-markers 24932@opindex mtls-markers 24933@opindex mno-tls-markers 24934Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 24935specifying the function argument. The relocation allows the linker to 24936reliably associate function call with argument setup instructions for 24937TLS optimization, which in turn allows GCC to better schedule the 24938sequence. 24939 24940@item -mrecip 24941@itemx -mno-recip 24942@opindex mrecip 24943This option enables use of the reciprocal estimate and 24944reciprocal square root estimate instructions with additional 24945Newton-Raphson steps to increase precision instead of doing a divide or 24946square root and divide for floating-point arguments. You should use 24947the @option{-ffast-math} option when using @option{-mrecip} (or at 24948least @option{-funsafe-math-optimizations}, 24949@option{-ffinite-math-only}, @option{-freciprocal-math} and 24950@option{-fno-trapping-math}). Note that while the throughput of the 24951sequence is generally higher than the throughput of the non-reciprocal 24952instruction, the precision of the sequence can be decreased by up to 2 24953ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 24954roots. 24955 24956@item -mrecip=@var{opt} 24957@opindex mrecip=opt 24958This option controls which reciprocal estimate instructions 24959may be used. @var{opt} is a comma-separated list of options, which may 24960be preceded by a @code{!} to invert the option: 24961 24962@table @samp 24963 24964@item all 24965Enable all estimate instructions. 24966 24967@item default 24968Enable the default instructions, equivalent to @option{-mrecip}. 24969 24970@item none 24971Disable all estimate instructions, equivalent to @option{-mno-recip}. 24972 24973@item div 24974Enable the reciprocal approximation instructions for both 24975single and double precision. 24976 24977@item divf 24978Enable the single-precision reciprocal approximation instructions. 24979 24980@item divd 24981Enable the double-precision reciprocal approximation instructions. 24982 24983@item rsqrt 24984Enable the reciprocal square root approximation instructions for both 24985single and double precision. 24986 24987@item rsqrtf 24988Enable the single-precision reciprocal square root approximation instructions. 24989 24990@item rsqrtd 24991Enable the double-precision reciprocal square root approximation instructions. 24992 24993@end table 24994 24995So, for example, @option{-mrecip=all,!rsqrtd} enables 24996all of the reciprocal estimate instructions, except for the 24997@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 24998which handle the double-precision reciprocal square root calculations. 24999 25000@item -mrecip-precision 25001@itemx -mno-recip-precision 25002@opindex mrecip-precision 25003Assume (do not assume) that the reciprocal estimate instructions 25004provide higher-precision estimates than is mandated by the PowerPC 25005ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 25006@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 25007The double-precision square root estimate instructions are not generated by 25008default on low-precision machines, since they do not provide an 25009estimate that converges after three steps. 25010 25011@item -mveclibabi=@var{type} 25012@opindex mveclibabi 25013Specifies the ABI type to use for vectorizing intrinsics using an 25014external library. The only type supported at present is @samp{mass}, 25015which specifies to use IBM's Mathematical Acceleration Subsystem 25016(MASS) libraries for vectorizing intrinsics using external libraries. 25017GCC currently emits calls to @code{acosd2}, @code{acosf4}, 25018@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 25019@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 25020@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 25021@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 25022@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 25023@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 25024@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 25025@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 25026@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 25027@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 25028@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 25029@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 25030@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 25031for power7. Both @option{-ftree-vectorize} and 25032@option{-funsafe-math-optimizations} must also be enabled. The MASS 25033libraries must be specified at link time. 25034 25035@item -mfriz 25036@itemx -mno-friz 25037@opindex mfriz 25038Generate (do not generate) the @code{friz} instruction when the 25039@option{-funsafe-math-optimizations} option is used to optimize 25040rounding of floating-point values to 64-bit integer and back to floating 25041point. The @code{friz} instruction does not return the same value if 25042the floating-point number is too large to fit in an integer. 25043 25044@item -mpointers-to-nested-functions 25045@itemx -mno-pointers-to-nested-functions 25046@opindex mpointers-to-nested-functions 25047Generate (do not generate) code to load up the static chain register 25048(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 25049systems where a function pointer points to a 3-word descriptor giving 25050the function address, TOC value to be loaded in register @code{r2}, and 25051static chain value to be loaded in register @code{r11}. The 25052@option{-mpointers-to-nested-functions} is on by default. You cannot 25053call through pointers to nested functions or pointers 25054to functions compiled in other languages that use the static chain if 25055you use @option{-mno-pointers-to-nested-functions}. 25056 25057@item -msave-toc-indirect 25058@itemx -mno-save-toc-indirect 25059@opindex msave-toc-indirect 25060Generate (do not generate) code to save the TOC value in the reserved 25061stack location in the function prologue if the function calls through 25062a pointer on AIX and 64-bit Linux systems. If the TOC value is not 25063saved in the prologue, it is saved just before the call through the 25064pointer. The @option{-mno-save-toc-indirect} option is the default. 25065 25066@item -mcompat-align-parm 25067@itemx -mno-compat-align-parm 25068@opindex mcompat-align-parm 25069Generate (do not generate) code to pass structure parameters with a 25070maximum alignment of 64 bits, for compatibility with older versions 25071of GCC. 25072 25073Older versions of GCC (prior to 4.9.0) incorrectly did not align a 25074structure parameter on a 128-bit boundary when that structure contained 25075a member requiring 128-bit alignment. This is corrected in more 25076recent versions of GCC. This option may be used to generate code 25077that is compatible with functions compiled with older versions of 25078GCC. 25079 25080The @option{-mno-compat-align-parm} option is the default. 25081 25082@item -mstack-protector-guard=@var{guard} 25083@itemx -mstack-protector-guard-reg=@var{reg} 25084@itemx -mstack-protector-guard-offset=@var{offset} 25085@itemx -mstack-protector-guard-symbol=@var{symbol} 25086@opindex mstack-protector-guard 25087@opindex mstack-protector-guard-reg 25088@opindex mstack-protector-guard-offset 25089@opindex mstack-protector-guard-symbol 25090Generate stack protection code using canary at @var{guard}. Supported 25091locations are @samp{global} for global canary or @samp{tls} for per-thread 25092canary in the TLS block (the default with GNU libc version 2.4 or later). 25093 25094With the latter choice the options 25095@option{-mstack-protector-guard-reg=@var{reg}} and 25096@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 25097which register to use as base register for reading the canary, and from what 25098offset from that base register. The default for those is as specified in the 25099relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides 25100the offset with a symbol reference to a canary in the TLS block. 25101@end table 25102 25103@node RX Options 25104@subsection RX Options 25105@cindex RX Options 25106 25107These command-line options are defined for RX targets: 25108 25109@table @gcctabopt 25110@item -m64bit-doubles 25111@itemx -m32bit-doubles 25112@opindex m64bit-doubles 25113@opindex m32bit-doubles 25114Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 25115or 32 bits (@option{-m32bit-doubles}) in size. The default is 25116@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 25117works on 32-bit values, which is why the default is 25118@option{-m32bit-doubles}. 25119 25120@item -fpu 25121@itemx -nofpu 25122@opindex fpu 25123@opindex nofpu 25124Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 25125floating-point hardware. The default is enabled for the RX600 25126series and disabled for the RX200 series. 25127 25128Floating-point instructions are only generated for 32-bit floating-point 25129values, however, so the FPU hardware is not used for doubles if the 25130@option{-m64bit-doubles} option is used. 25131 25132@emph{Note} If the @option{-fpu} option is enabled then 25133@option{-funsafe-math-optimizations} is also enabled automatically. 25134This is because the RX FPU instructions are themselves unsafe. 25135 25136@item -mcpu=@var{name} 25137@opindex mcpu 25138Selects the type of RX CPU to be targeted. Currently three types are 25139supported, the generic @samp{RX600} and @samp{RX200} series hardware and 25140the specific @samp{RX610} CPU. The default is @samp{RX600}. 25141 25142The only difference between @samp{RX600} and @samp{RX610} is that the 25143@samp{RX610} does not support the @code{MVTIPL} instruction. 25144 25145The @samp{RX200} series does not have a hardware floating-point unit 25146and so @option{-nofpu} is enabled by default when this type is 25147selected. 25148 25149@item -mbig-endian-data 25150@itemx -mlittle-endian-data 25151@opindex mbig-endian-data 25152@opindex mlittle-endian-data 25153Store data (but not code) in the big-endian format. The default is 25154@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 25155format. 25156 25157@item -msmall-data-limit=@var{N} 25158@opindex msmall-data-limit 25159Specifies the maximum size in bytes of global and static variables 25160which can be placed into the small data area. Using the small data 25161area can lead to smaller and faster code, but the size of area is 25162limited and it is up to the programmer to ensure that the area does 25163not overflow. Also when the small data area is used one of the RX's 25164registers (usually @code{r13}) is reserved for use pointing to this 25165area, so it is no longer available for use by the compiler. This 25166could result in slower and/or larger code if variables are pushed onto 25167the stack instead of being held in this register. 25168 25169Note, common variables (variables that have not been initialized) and 25170constants are not placed into the small data area as they are assigned 25171to other sections in the output executable. 25172 25173The default value is zero, which disables this feature. Note, this 25174feature is not enabled by default with higher optimization levels 25175(@option{-O2} etc) because of the potentially detrimental effects of 25176reserving a register. It is up to the programmer to experiment and 25177discover whether this feature is of benefit to their program. See the 25178description of the @option{-mpid} option for a description of how the 25179actual register to hold the small data area pointer is chosen. 25180 25181@item -msim 25182@itemx -mno-sim 25183@opindex msim 25184@opindex mno-sim 25185Use the simulator runtime. The default is to use the libgloss 25186board-specific runtime. 25187 25188@item -mas100-syntax 25189@itemx -mno-as100-syntax 25190@opindex mas100-syntax 25191@opindex mno-as100-syntax 25192When generating assembler output use a syntax that is compatible with 25193Renesas's AS100 assembler. This syntax can also be handled by the GAS 25194assembler, but it has some restrictions so it is not generated by default. 25195 25196@item -mmax-constant-size=@var{N} 25197@opindex mmax-constant-size 25198Specifies the maximum size, in bytes, of a constant that can be used as 25199an operand in a RX instruction. Although the RX instruction set does 25200allow constants of up to 4 bytes in length to be used in instructions, 25201a longer value equates to a longer instruction. Thus in some 25202circumstances it can be beneficial to restrict the size of constants 25203that are used in instructions. Constants that are too big are instead 25204placed into a constant pool and referenced via register indirection. 25205 25206The value @var{N} can be between 0 and 4. A value of 0 (the default) 25207or 4 means that constants of any size are allowed. 25208 25209@item -mrelax 25210@opindex mrelax 25211Enable linker relaxation. Linker relaxation is a process whereby the 25212linker attempts to reduce the size of a program by finding shorter 25213versions of various instructions. Disabled by default. 25214 25215@item -mint-register=@var{N} 25216@opindex mint-register 25217Specify the number of registers to reserve for fast interrupt handler 25218functions. The value @var{N} can be between 0 and 4. A value of 1 25219means that register @code{r13} is reserved for the exclusive use 25220of fast interrupt handlers. A value of 2 reserves @code{r13} and 25221@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 25222@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 25223A value of 0, the default, does not reserve any registers. 25224 25225@item -msave-acc-in-interrupts 25226@opindex msave-acc-in-interrupts 25227Specifies that interrupt handler functions should preserve the 25228accumulator register. This is only necessary if normal code might use 25229the accumulator register, for example because it performs 64-bit 25230multiplications. The default is to ignore the accumulator as this 25231makes the interrupt handlers faster. 25232 25233@item -mpid 25234@itemx -mno-pid 25235@opindex mpid 25236@opindex mno-pid 25237Enables the generation of position independent data. When enabled any 25238access to constant data is done via an offset from a base address 25239held in a register. This allows the location of constant data to be 25240determined at run time without requiring the executable to be 25241relocated, which is a benefit to embedded applications with tight 25242memory constraints. Data that can be modified is not affected by this 25243option. 25244 25245Note, using this feature reserves a register, usually @code{r13}, for 25246the constant data base address. This can result in slower and/or 25247larger code, especially in complicated functions. 25248 25249The actual register chosen to hold the constant data base address 25250depends upon whether the @option{-msmall-data-limit} and/or the 25251@option{-mint-register} command-line options are enabled. Starting 25252with register @code{r13} and proceeding downwards, registers are 25253allocated first to satisfy the requirements of @option{-mint-register}, 25254then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 25255is possible for the small data area register to be @code{r8} if both 25256@option{-mint-register=4} and @option{-mpid} are specified on the 25257command line. 25258 25259By default this feature is not enabled. The default can be restored 25260via the @option{-mno-pid} command-line option. 25261 25262@item -mno-warn-multiple-fast-interrupts 25263@itemx -mwarn-multiple-fast-interrupts 25264@opindex mno-warn-multiple-fast-interrupts 25265@opindex mwarn-multiple-fast-interrupts 25266Prevents GCC from issuing a warning message if it finds more than one 25267fast interrupt handler when it is compiling a file. The default is to 25268issue a warning for each extra fast interrupt handler found, as the RX 25269only supports one such interrupt. 25270 25271@item -mallow-string-insns 25272@itemx -mno-allow-string-insns 25273@opindex mallow-string-insns 25274@opindex mno-allow-string-insns 25275Enables or disables the use of the string manipulation instructions 25276@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL} 25277@code{SWHILE} and also the @code{RMPA} instruction. These 25278instructions may prefetch data, which is not safe to do if accessing 25279an I/O register. (See section 12.2.7 of the RX62N Group User's Manual 25280for more information). 25281 25282The default is to allow these instructions, but it is not possible for 25283GCC to reliably detect all circumstances where a string instruction 25284might be used to access an I/O register, so their use cannot be 25285disabled automatically. Instead it is reliant upon the programmer to 25286use the @option{-mno-allow-string-insns} option if their program 25287accesses I/O space. 25288 25289When the instructions are enabled GCC defines the C preprocessor 25290symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the 25291symbol @code{__RX_DISALLOW_STRING_INSNS__}. 25292 25293@item -mjsr 25294@itemx -mno-jsr 25295@opindex mjsr 25296@opindex mno-jsr 25297Use only (or not only) @code{JSR} instructions to access functions. 25298This option can be used when code size exceeds the range of @code{BSR} 25299instructions. Note that @option{-mno-jsr} does not mean to not use 25300@code{JSR} but instead means that any type of branch may be used. 25301@end table 25302 25303@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 25304has special significance to the RX port when used with the 25305@code{interrupt} function attribute. This attribute indicates a 25306function intended to process fast interrupts. GCC ensures 25307that it only uses the registers @code{r10}, @code{r11}, @code{r12} 25308and/or @code{r13} and only provided that the normal use of the 25309corresponding registers have been restricted via the 25310@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 25311options. 25312 25313@node S/390 and zSeries Options 25314@subsection S/390 and zSeries Options 25315@cindex S/390 and zSeries Options 25316 25317These are the @samp{-m} options defined for the S/390 and zSeries architecture. 25318 25319@table @gcctabopt 25320@item -mhard-float 25321@itemx -msoft-float 25322@opindex mhard-float 25323@opindex msoft-float 25324Use (do not use) the hardware floating-point instructions and registers 25325for floating-point operations. When @option{-msoft-float} is specified, 25326functions in @file{libgcc.a} are used to perform floating-point 25327operations. When @option{-mhard-float} is specified, the compiler 25328generates IEEE floating-point instructions. This is the default. 25329 25330@item -mhard-dfp 25331@itemx -mno-hard-dfp 25332@opindex mhard-dfp 25333@opindex mno-hard-dfp 25334Use (do not use) the hardware decimal-floating-point instructions for 25335decimal-floating-point operations. When @option{-mno-hard-dfp} is 25336specified, functions in @file{libgcc.a} are used to perform 25337decimal-floating-point operations. When @option{-mhard-dfp} is 25338specified, the compiler generates decimal-floating-point hardware 25339instructions. This is the default for @option{-march=z9-ec} or higher. 25340 25341@item -mlong-double-64 25342@itemx -mlong-double-128 25343@opindex mlong-double-64 25344@opindex mlong-double-128 25345These switches control the size of @code{long double} type. A size 25346of 64 bits makes the @code{long double} type equivalent to the @code{double} 25347type. This is the default. 25348 25349@item -mbackchain 25350@itemx -mno-backchain 25351@opindex mbackchain 25352@opindex mno-backchain 25353Store (do not store) the address of the caller's frame as backchain pointer 25354into the callee's stack frame. 25355A backchain may be needed to allow debugging using tools that do not understand 25356DWARF call frame information. 25357When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 25358at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 25359the backchain is placed into the topmost word of the 96/160 byte register 25360save area. 25361 25362In general, code compiled with @option{-mbackchain} is call-compatible with 25363code compiled with @option{-mmo-backchain}; however, use of the backchain 25364for debugging purposes usually requires that the whole binary is built with 25365@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 25366@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 25367to build a linux kernel use @option{-msoft-float}. 25368 25369The default is to not maintain the backchain. 25370 25371@item -mpacked-stack 25372@itemx -mno-packed-stack 25373@opindex mpacked-stack 25374@opindex mno-packed-stack 25375Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 25376specified, the compiler uses the all fields of the 96/160 byte register save 25377area only for their default purpose; unused fields still take up stack space. 25378When @option{-mpacked-stack} is specified, register save slots are densely 25379packed at the top of the register save area; unused space is reused for other 25380purposes, allowing for more efficient use of the available stack space. 25381However, when @option{-mbackchain} is also in effect, the topmost word of 25382the save area is always used to store the backchain, and the return address 25383register is always saved two words below the backchain. 25384 25385As long as the stack frame backchain is not used, code generated with 25386@option{-mpacked-stack} is call-compatible with code generated with 25387@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 25388S/390 or zSeries generated code that uses the stack frame backchain at run 25389time, not just for debugging purposes. Such code is not call-compatible 25390with code compiled with @option{-mpacked-stack}. Also, note that the 25391combination of @option{-mbackchain}, 25392@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 25393to build a linux kernel use @option{-msoft-float}. 25394 25395The default is to not use the packed stack layout. 25396 25397@item -msmall-exec 25398@itemx -mno-small-exec 25399@opindex msmall-exec 25400@opindex mno-small-exec 25401Generate (or do not generate) code using the @code{bras} instruction 25402to do subroutine calls. 25403This only works reliably if the total executable size does not 25404exceed 64k. The default is to use the @code{basr} instruction instead, 25405which does not have this limitation. 25406 25407@item -m64 25408@itemx -m31 25409@opindex m64 25410@opindex m31 25411When @option{-m31} is specified, generate code compliant to the 25412GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 25413code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 25414particular to generate 64-bit instructions. For the @samp{s390} 25415targets, the default is @option{-m31}, while the @samp{s390x} 25416targets default to @option{-m64}. 25417 25418@item -mzarch 25419@itemx -mesa 25420@opindex mzarch 25421@opindex mesa 25422When @option{-mzarch} is specified, generate code using the 25423instructions available on z/Architecture. 25424When @option{-mesa} is specified, generate code using the 25425instructions available on ESA/390. Note that @option{-mesa} is 25426not possible with @option{-m64}. 25427When generating code compliant to the GNU/Linux for S/390 ABI, 25428the default is @option{-mesa}. When generating code compliant 25429to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 25430 25431@item -mhtm 25432@itemx -mno-htm 25433@opindex mhtm 25434@opindex mno-htm 25435The @option{-mhtm} option enables a set of builtins making use of 25436instructions available with the transactional execution facility 25437introduced with the IBM zEnterprise EC12 machine generation 25438@ref{S/390 System z Built-in Functions}. 25439@option{-mhtm} is enabled by default when using @option{-march=zEC12}. 25440 25441@item -mvx 25442@itemx -mno-vx 25443@opindex mvx 25444@opindex mno-vx 25445When @option{-mvx} is specified, generate code using the instructions 25446available with the vector extension facility introduced with the IBM 25447z13 machine generation. 25448This option changes the ABI for some vector type values with regard to 25449alignment and calling conventions. In case vector type values are 25450being used in an ABI-relevant context a GAS @samp{.gnu_attribute} 25451command will be added to mark the resulting binary with the ABI used. 25452@option{-mvx} is enabled by default when using @option{-march=z13}. 25453 25454@item -mzvector 25455@itemx -mno-zvector 25456@opindex mzvector 25457@opindex mno-zvector 25458The @option{-mzvector} option enables vector language extensions and 25459builtins using instructions available with the vector extension 25460facility introduced with the IBM z13 machine generation. 25461This option adds support for @samp{vector} to be used as a keyword to 25462define vector type variables and arguments. @samp{vector} is only 25463available when GNU extensions are enabled. It will not be expanded 25464when requesting strict standard compliance e.g.@: with @option{-std=c99}. 25465In addition to the GCC low-level builtins @option{-mzvector} enables 25466a set of builtins added for compatibility with AltiVec-style 25467implementations like Power and Cell. In order to make use of these 25468builtins the header file @file{vecintrin.h} needs to be included. 25469@option{-mzvector} is disabled by default. 25470 25471@item -mmvcle 25472@itemx -mno-mvcle 25473@opindex mmvcle 25474@opindex mno-mvcle 25475Generate (or do not generate) code using the @code{mvcle} instruction 25476to perform block moves. When @option{-mno-mvcle} is specified, 25477use a @code{mvc} loop instead. This is the default unless optimizing for 25478size. 25479 25480@item -mdebug 25481@itemx -mno-debug 25482@opindex mdebug 25483@opindex mno-debug 25484Print (or do not print) additional debug information when compiling. 25485The default is to not print debug information. 25486 25487@item -march=@var{cpu-type} 25488@opindex march 25489Generate code that runs on @var{cpu-type}, which is the name of a 25490system representing a certain processor type. Possible values for 25491@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6}, 25492@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8}, 25493@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, 25494@samp{z14}/@samp{arch12}, and @samp{native}. 25495 25496The default is @option{-march=z900}. 25497 25498Specifying @samp{native} as cpu type can be used to select the best 25499architecture option for the host processor. 25500@option{-march=native} has no effect if GCC does not recognize the 25501processor. 25502 25503@item -mtune=@var{cpu-type} 25504@opindex mtune 25505Tune to @var{cpu-type} everything applicable about the generated code, 25506except for the ABI and the set of available instructions. 25507The list of @var{cpu-type} values is the same as for @option{-march}. 25508The default is the value used for @option{-march}. 25509 25510@item -mtpf-trace 25511@itemx -mno-tpf-trace 25512@opindex mtpf-trace 25513@opindex mno-tpf-trace 25514Generate code that adds (does not add) in TPF OS specific branches to trace 25515routines in the operating system. This option is off by default, even 25516when compiling for the TPF OS@. 25517 25518@item -mfused-madd 25519@itemx -mno-fused-madd 25520@opindex mfused-madd 25521@opindex mno-fused-madd 25522Generate code that uses (does not use) the floating-point multiply and 25523accumulate instructions. These instructions are generated by default if 25524hardware floating point is used. 25525 25526@item -mwarn-framesize=@var{framesize} 25527@opindex mwarn-framesize 25528Emit a warning if the current function exceeds the given frame size. Because 25529this is a compile-time check it doesn't need to be a real problem when the program 25530runs. It is intended to identify functions that most probably cause 25531a stack overflow. It is useful to be used in an environment with limited stack 25532size e.g.@: the linux kernel. 25533 25534@item -mwarn-dynamicstack 25535@opindex mwarn-dynamicstack 25536Emit a warning if the function calls @code{alloca} or uses dynamically-sized 25537arrays. This is generally a bad idea with a limited stack size. 25538 25539@item -mstack-guard=@var{stack-guard} 25540@itemx -mstack-size=@var{stack-size} 25541@opindex mstack-guard 25542@opindex mstack-size 25543If these options are provided the S/390 back end emits additional instructions in 25544the function prologue that trigger a trap if the stack size is @var{stack-guard} 25545bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 25546If the @var{stack-guard} option is omitted the smallest power of 2 larger than 25547the frame size of the compiled function is chosen. 25548These options are intended to be used to help debugging stack overflow problems. 25549The additionally emitted code causes only little overhead and hence can also be 25550used in production-like systems without greater performance degradation. The given 25551values have to be exact powers of 2 and @var{stack-size} has to be greater than 25552@var{stack-guard} without exceeding 64k. 25553In order to be efficient the extra code makes the assumption that the stack starts 25554at an address aligned to the value given by @var{stack-size}. 25555The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 25556 25557@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 25558@opindex mhotpatch 25559If the hotpatch option is enabled, a ``hot-patching'' function 25560prologue is generated for all functions in the compilation unit. 25561The funtion label is prepended with the given number of two-byte 25562NOP instructions (@var{pre-halfwords}, maximum 1000000). After 25563the label, 2 * @var{post-halfwords} bytes are appended, using the 25564largest NOP like instructions the architecture allows (maximum 255651000000). 25566 25567If both arguments are zero, hotpatching is disabled. 25568 25569This option can be overridden for individual functions with the 25570@code{hotpatch} attribute. 25571@end table 25572 25573@node Score Options 25574@subsection Score Options 25575@cindex Score Options 25576 25577These options are defined for Score implementations: 25578 25579@table @gcctabopt 25580@item -meb 25581@opindex meb 25582Compile code for big-endian mode. This is the default. 25583 25584@item -mel 25585@opindex mel 25586Compile code for little-endian mode. 25587 25588@item -mnhwloop 25589@opindex mnhwloop 25590Disable generation of @code{bcnz} instructions. 25591 25592@item -muls 25593@opindex muls 25594Enable generation of unaligned load and store instructions. 25595 25596@item -mmac 25597@opindex mmac 25598Enable the use of multiply-accumulate instructions. Disabled by default. 25599 25600@item -mscore5 25601@opindex mscore5 25602Specify the SCORE5 as the target architecture. 25603 25604@item -mscore5u 25605@opindex mscore5u 25606Specify the SCORE5U of the target architecture. 25607 25608@item -mscore7 25609@opindex mscore7 25610Specify the SCORE7 as the target architecture. This is the default. 25611 25612@item -mscore7d 25613@opindex mscore7d 25614Specify the SCORE7D as the target architecture. 25615@end table 25616 25617@node SH Options 25618@subsection SH Options 25619 25620These @samp{-m} options are defined for the SH implementations: 25621 25622@table @gcctabopt 25623@item -m1 25624@opindex m1 25625Generate code for the SH1. 25626 25627@item -m2 25628@opindex m2 25629Generate code for the SH2. 25630 25631@item -m2e 25632Generate code for the SH2e. 25633 25634@item -m2a-nofpu 25635@opindex m2a-nofpu 25636Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 25637that the floating-point unit is not used. 25638 25639@item -m2a-single-only 25640@opindex m2a-single-only 25641Generate code for the SH2a-FPU, in such a way that no double-precision 25642floating-point operations are used. 25643 25644@item -m2a-single 25645@opindex m2a-single 25646Generate code for the SH2a-FPU assuming the floating-point unit is in 25647single-precision mode by default. 25648 25649@item -m2a 25650@opindex m2a 25651Generate code for the SH2a-FPU assuming the floating-point unit is in 25652double-precision mode by default. 25653 25654@item -m3 25655@opindex m3 25656Generate code for the SH3. 25657 25658@item -m3e 25659@opindex m3e 25660Generate code for the SH3e. 25661 25662@item -m4-nofpu 25663@opindex m4-nofpu 25664Generate code for the SH4 without a floating-point unit. 25665 25666@item -m4-single-only 25667@opindex m4-single-only 25668Generate code for the SH4 with a floating-point unit that only 25669supports single-precision arithmetic. 25670 25671@item -m4-single 25672@opindex m4-single 25673Generate code for the SH4 assuming the floating-point unit is in 25674single-precision mode by default. 25675 25676@item -m4 25677@opindex m4 25678Generate code for the SH4. 25679 25680@item -m4-100 25681@opindex m4-100 25682Generate code for SH4-100. 25683 25684@item -m4-100-nofpu 25685@opindex m4-100-nofpu 25686Generate code for SH4-100 in such a way that the 25687floating-point unit is not used. 25688 25689@item -m4-100-single 25690@opindex m4-100-single 25691Generate code for SH4-100 assuming the floating-point unit is in 25692single-precision mode by default. 25693 25694@item -m4-100-single-only 25695@opindex m4-100-single-only 25696Generate code for SH4-100 in such a way that no double-precision 25697floating-point operations are used. 25698 25699@item -m4-200 25700@opindex m4-200 25701Generate code for SH4-200. 25702 25703@item -m4-200-nofpu 25704@opindex m4-200-nofpu 25705Generate code for SH4-200 without in such a way that the 25706floating-point unit is not used. 25707 25708@item -m4-200-single 25709@opindex m4-200-single 25710Generate code for SH4-200 assuming the floating-point unit is in 25711single-precision mode by default. 25712 25713@item -m4-200-single-only 25714@opindex m4-200-single-only 25715Generate code for SH4-200 in such a way that no double-precision 25716floating-point operations are used. 25717 25718@item -m4-300 25719@opindex m4-300 25720Generate code for SH4-300. 25721 25722@item -m4-300-nofpu 25723@opindex m4-300-nofpu 25724Generate code for SH4-300 without in such a way that the 25725floating-point unit is not used. 25726 25727@item -m4-300-single 25728@opindex m4-300-single 25729Generate code for SH4-300 in such a way that no double-precision 25730floating-point operations are used. 25731 25732@item -m4-300-single-only 25733@opindex m4-300-single-only 25734Generate code for SH4-300 in such a way that no double-precision 25735floating-point operations are used. 25736 25737@item -m4-340 25738@opindex m4-340 25739Generate code for SH4-340 (no MMU, no FPU). 25740 25741@item -m4-500 25742@opindex m4-500 25743Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 25744assembler. 25745 25746@item -m4a-nofpu 25747@opindex m4a-nofpu 25748Generate code for the SH4al-dsp, or for a SH4a in such a way that the 25749floating-point unit is not used. 25750 25751@item -m4a-single-only 25752@opindex m4a-single-only 25753Generate code for the SH4a, in such a way that no double-precision 25754floating-point operations are used. 25755 25756@item -m4a-single 25757@opindex m4a-single 25758Generate code for the SH4a assuming the floating-point unit is in 25759single-precision mode by default. 25760 25761@item -m4a 25762@opindex m4a 25763Generate code for the SH4a. 25764 25765@item -m4al 25766@opindex m4al 25767Same as @option{-m4a-nofpu}, except that it implicitly passes 25768@option{-dsp} to the assembler. GCC doesn't generate any DSP 25769instructions at the moment. 25770 25771@item -mb 25772@opindex mb 25773Compile code for the processor in big-endian mode. 25774 25775@item -ml 25776@opindex ml 25777Compile code for the processor in little-endian mode. 25778 25779@item -mdalign 25780@opindex mdalign 25781Align doubles at 64-bit boundaries. Note that this changes the calling 25782conventions, and thus some functions from the standard C library do 25783not work unless you recompile it first with @option{-mdalign}. 25784 25785@item -mrelax 25786@opindex mrelax 25787Shorten some address references at link time, when possible; uses the 25788linker option @option{-relax}. 25789 25790@item -mbigtable 25791@opindex mbigtable 25792Use 32-bit offsets in @code{switch} tables. The default is to use 2579316-bit offsets. 25794 25795@item -mbitops 25796@opindex mbitops 25797Enable the use of bit manipulation instructions on SH2A. 25798 25799@item -mfmovd 25800@opindex mfmovd 25801Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 25802alignment constraints. 25803 25804@item -mrenesas 25805@opindex mrenesas 25806Comply with the calling conventions defined by Renesas. 25807 25808@item -mno-renesas 25809@opindex mno-renesas 25810Comply with the calling conventions defined for GCC before the Renesas 25811conventions were available. This option is the default for all 25812targets of the SH toolchain. 25813 25814@item -mnomacsave 25815@opindex mnomacsave 25816Mark the @code{MAC} register as call-clobbered, even if 25817@option{-mrenesas} is given. 25818 25819@item -mieee 25820@itemx -mno-ieee 25821@opindex mieee 25822@opindex mno-ieee 25823Control the IEEE compliance of floating-point comparisons, which affects the 25824handling of cases where the result of a comparison is unordered. By default 25825@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 25826enabled @option{-mno-ieee} is implicitly set, which results in faster 25827floating-point greater-equal and less-equal comparisons. The implicit settings 25828can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 25829 25830@item -minline-ic_invalidate 25831@opindex minline-ic_invalidate 25832Inline code to invalidate instruction cache entries after setting up 25833nested function trampolines. 25834This option has no effect if @option{-musermode} is in effect and the selected 25835code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi} 25836instruction. 25837If the selected code generation option does not allow the use of the @code{icbi} 25838instruction, and @option{-musermode} is not in effect, the inlined code 25839manipulates the instruction cache address array directly with an associative 25840write. This not only requires privileged mode at run time, but it also 25841fails if the cache line had been mapped via the TLB and has become unmapped. 25842 25843@item -misize 25844@opindex misize 25845Dump instruction size and location in the assembly code. 25846 25847@item -mpadstruct 25848@opindex mpadstruct 25849This option is deprecated. It pads structures to multiple of 4 bytes, 25850which is incompatible with the SH ABI@. 25851 25852@item -matomic-model=@var{model} 25853@opindex matomic-model=@var{model} 25854Sets the model of atomic operations and additional parameters as a comma 25855separated list. For details on the atomic built-in functions see 25856@ref{__atomic Builtins}. The following models and parameters are supported: 25857 25858@table @samp 25859 25860@item none 25861Disable compiler generated atomic sequences and emit library calls for atomic 25862operations. This is the default if the target is not @code{sh*-*-linux*}. 25863 25864@item soft-gusa 25865Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 25866built-in functions. The generated atomic sequences require additional support 25867from the interrupt/exception handling code of the system and are only suitable 25868for SH3* and SH4* single-core systems. This option is enabled by default when 25869the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 25870this option also partially utilizes the hardware atomic instructions 25871@code{movli.l} and @code{movco.l} to create more efficient code, unless 25872@samp{strict} is specified. 25873 25874@item soft-tcb 25875Generate software atomic sequences that use a variable in the thread control 25876block. This is a variation of the gUSA sequences which can also be used on 25877SH1* and SH2* targets. The generated atomic sequences require additional 25878support from the interrupt/exception handling code of the system and are only 25879suitable for single-core systems. When using this model, the @samp{gbr-offset=} 25880parameter has to be specified as well. 25881 25882@item soft-imask 25883Generate software atomic sequences that temporarily disable interrupts by 25884setting @code{SR.IMASK = 1111}. This model works only when the program runs 25885in privileged mode and is only suitable for single-core systems. Additional 25886support from the interrupt/exception handling code of the system is not 25887required. This model is enabled by default when the target is 25888@code{sh*-*-linux*} and SH1* or SH2*. 25889 25890@item hard-llcs 25891Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 25892instructions only. This is only available on SH4A and is suitable for 25893multi-core systems. Since the hardware instructions support only 32 bit atomic 25894variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 25895Code compiled with this option is also compatible with other software 25896atomic model interrupt/exception handling systems if executed on an SH4A 25897system. Additional support from the interrupt/exception handling code of the 25898system is not required for this model. 25899 25900@item gbr-offset= 25901This parameter specifies the offset in bytes of the variable in the thread 25902control block structure that should be used by the generated atomic sequences 25903when the @samp{soft-tcb} model has been selected. For other models this 25904parameter is ignored. The specified value must be an integer multiple of four 25905and in the range 0-1020. 25906 25907@item strict 25908This parameter prevents mixed usage of multiple atomic models, even if they 25909are compatible, and makes the compiler generate atomic sequences of the 25910specified model only. 25911 25912@end table 25913 25914@item -mtas 25915@opindex mtas 25916Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 25917Notice that depending on the particular hardware and software configuration 25918this can degrade overall performance due to the operand cache line flushes 25919that are implied by the @code{tas.b} instruction. On multi-core SH4A 25920processors the @code{tas.b} instruction must be used with caution since it 25921can result in data corruption for certain cache configurations. 25922 25923@item -mprefergot 25924@opindex mprefergot 25925When generating position-independent code, emit function calls using 25926the Global Offset Table instead of the Procedure Linkage Table. 25927 25928@item -musermode 25929@itemx -mno-usermode 25930@opindex musermode 25931@opindex mno-usermode 25932Don't allow (allow) the compiler generating privileged mode code. Specifying 25933@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 25934inlined code would not work in user mode. @option{-musermode} is the default 25935when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 25936@option{-musermode} has no effect, since there is no user mode. 25937 25938@item -multcost=@var{number} 25939@opindex multcost=@var{number} 25940Set the cost to assume for a multiply insn. 25941 25942@item -mdiv=@var{strategy} 25943@opindex mdiv=@var{strategy} 25944Set the division strategy to be used for integer division operations. 25945@var{strategy} can be one of: 25946 25947@table @samp 25948 25949@item call-div1 25950Calls a library function that uses the single-step division instruction 25951@code{div1} to perform the operation. Division by zero calculates an 25952unspecified result and does not trap. This is the default except for SH4, 25953SH2A and SHcompact. 25954 25955@item call-fp 25956Calls a library function that performs the operation in double precision 25957floating point. Division by zero causes a floating-point exception. This is 25958the default for SHcompact with FPU. Specifying this for targets that do not 25959have a double precision FPU defaults to @code{call-div1}. 25960 25961@item call-table 25962Calls a library function that uses a lookup table for small divisors and 25963the @code{div1} instruction with case distinction for larger divisors. Division 25964by zero calculates an unspecified result and does not trap. This is the default 25965for SH4. Specifying this for targets that do not have dynamic shift 25966instructions defaults to @code{call-div1}. 25967 25968@end table 25969 25970When a division strategy has not been specified the default strategy is 25971selected based on the current target. For SH2A the default strategy is to 25972use the @code{divs} and @code{divu} instructions instead of library function 25973calls. 25974 25975@item -maccumulate-outgoing-args 25976@opindex maccumulate-outgoing-args 25977Reserve space once for outgoing arguments in the function prologue rather 25978than around each call. Generally beneficial for performance and size. Also 25979needed for unwinding to avoid changing the stack frame around conditional code. 25980 25981@item -mdivsi3_libfunc=@var{name} 25982@opindex mdivsi3_libfunc=@var{name} 25983Set the name of the library function used for 32-bit signed division to 25984@var{name}. 25985This only affects the name used in the @samp{call} division strategies, and 25986the compiler still expects the same sets of input/output/clobbered registers as 25987if this option were not present. 25988 25989@item -mfixed-range=@var{register-range} 25990@opindex mfixed-range 25991Generate code treating the given register range as fixed registers. 25992A fixed register is one that the register allocator cannot use. This is 25993useful when compiling kernel code. A register range is specified as 25994two registers separated by a dash. Multiple register ranges can be 25995specified separated by a comma. 25996 25997@item -mbranch-cost=@var{num} 25998@opindex mbranch-cost=@var{num} 25999Assume @var{num} to be the cost for a branch instruction. Higher numbers 26000make the compiler try to generate more branch-free code if possible. 26001If not specified the value is selected depending on the processor type that 26002is being compiled for. 26003 26004@item -mzdcbranch 26005@itemx -mno-zdcbranch 26006@opindex mzdcbranch 26007@opindex mno-zdcbranch 26008Assume (do not assume) that zero displacement conditional branch instructions 26009@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 26010compiler prefers zero displacement branch code sequences. This is 26011enabled by default when generating code for SH4 and SH4A. It can be explicitly 26012disabled by specifying @option{-mno-zdcbranch}. 26013 26014@item -mcbranch-force-delay-slot 26015@opindex mcbranch-force-delay-slot 26016Force the usage of delay slots for conditional branches, which stuffs the delay 26017slot with a @code{nop} if a suitable instruction cannot be found. By default 26018this option is disabled. It can be enabled to work around hardware bugs as 26019found in the original SH7055. 26020 26021@item -mfused-madd 26022@itemx -mno-fused-madd 26023@opindex mfused-madd 26024@opindex mno-fused-madd 26025Generate code that uses (does not use) the floating-point multiply and 26026accumulate instructions. These instructions are generated by default 26027if hardware floating point is used. The machine-dependent 26028@option{-mfused-madd} option is now mapped to the machine-independent 26029@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 26030mapped to @option{-ffp-contract=off}. 26031 26032@item -mfsca 26033@itemx -mno-fsca 26034@opindex mfsca 26035@opindex mno-fsca 26036Allow or disallow the compiler to emit the @code{fsca} instruction for sine 26037and cosine approximations. The option @option{-mfsca} must be used in 26038combination with @option{-funsafe-math-optimizations}. It is enabled by default 26039when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 26040approximations even if @option{-funsafe-math-optimizations} is in effect. 26041 26042@item -mfsrra 26043@itemx -mno-fsrra 26044@opindex mfsrra 26045@opindex mno-fsrra 26046Allow or disallow the compiler to emit the @code{fsrra} instruction for 26047reciprocal square root approximations. The option @option{-mfsrra} must be used 26048in combination with @option{-funsafe-math-optimizations} and 26049@option{-ffinite-math-only}. It is enabled by default when generating code for 26050SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 26051even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 26052in effect. 26053 26054@item -mpretend-cmove 26055@opindex mpretend-cmove 26056Prefer zero-displacement conditional branches for conditional move instruction 26057patterns. This can result in faster code on the SH4 processor. 26058 26059@item -mfdpic 26060@opindex fdpic 26061Generate code using the FDPIC ABI. 26062 26063@end table 26064 26065@node Solaris 2 Options 26066@subsection Solaris 2 Options 26067@cindex Solaris 2 options 26068 26069These @samp{-m} options are supported on Solaris 2: 26070 26071@table @gcctabopt 26072@item -mclear-hwcap 26073@opindex mclear-hwcap 26074@option{-mclear-hwcap} tells the compiler to remove the hardware 26075capabilities generated by the Solaris assembler. This is only necessary 26076when object files use ISA extensions not supported by the current 26077machine, but check at runtime whether or not to use them. 26078 26079@item -mimpure-text 26080@opindex mimpure-text 26081@option{-mimpure-text}, used in addition to @option{-shared}, tells 26082the compiler to not pass @option{-z text} to the linker when linking a 26083shared object. Using this option, you can link position-dependent 26084code into a shared object. 26085 26086@option{-mimpure-text} suppresses the ``relocations remain against 26087allocatable but non-writable sections'' linker error message. 26088However, the necessary relocations trigger copy-on-write, and the 26089shared object is not actually shared across processes. Instead of 26090using @option{-mimpure-text}, you should compile all source code with 26091@option{-fpic} or @option{-fPIC}. 26092 26093@end table 26094 26095These switches are supported in addition to the above on Solaris 2: 26096 26097@table @gcctabopt 26098@item -pthreads 26099@opindex pthreads 26100This is a synonym for @option{-pthread}. 26101@end table 26102 26103@node SPARC Options 26104@subsection SPARC Options 26105@cindex SPARC options 26106 26107These @samp{-m} options are supported on the SPARC: 26108 26109@table @gcctabopt 26110@item -mno-app-regs 26111@itemx -mapp-regs 26112@opindex mno-app-regs 26113@opindex mapp-regs 26114Specify @option{-mapp-regs} to generate output using the global registers 261152 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 26116global register 1, each global register 2 through 4 is then treated as an 26117allocable register that is clobbered by function calls. This is the default. 26118 26119To be fully SVR4 ABI-compliant at the cost of some performance loss, 26120specify @option{-mno-app-regs}. You should compile libraries and system 26121software with this option. 26122 26123@item -mflat 26124@itemx -mno-flat 26125@opindex mflat 26126@opindex mno-flat 26127With @option{-mflat}, the compiler does not generate save/restore instructions 26128and uses a ``flat'' or single register window model. This model is compatible 26129with the regular register window model. The local registers and the input 26130registers (0--5) are still treated as ``call-saved'' registers and are 26131saved on the stack as needed. 26132 26133With @option{-mno-flat} (the default), the compiler generates save/restore 26134instructions (except for leaf functions). This is the normal operating mode. 26135 26136@item -mfpu 26137@itemx -mhard-float 26138@opindex mfpu 26139@opindex mhard-float 26140Generate output containing floating-point instructions. This is the 26141default. 26142 26143@item -mno-fpu 26144@itemx -msoft-float 26145@opindex mno-fpu 26146@opindex msoft-float 26147Generate output containing library calls for floating point. 26148@strong{Warning:} the requisite libraries are not available for all SPARC 26149targets. Normally the facilities of the machine's usual C compiler are 26150used, but this cannot be done directly in cross-compilation. You must make 26151your own arrangements to provide suitable library functions for 26152cross-compilation. The embedded targets @samp{sparc-*-aout} and 26153@samp{sparclite-*-*} do provide software floating-point support. 26154 26155@option{-msoft-float} changes the calling convention in the output file; 26156therefore, it is only useful if you compile @emph{all} of a program with 26157this option. In particular, you need to compile @file{libgcc.a}, the 26158library that comes with GCC, with @option{-msoft-float} in order for 26159this to work. 26160 26161@item -mhard-quad-float 26162@opindex mhard-quad-float 26163Generate output containing quad-word (long double) floating-point 26164instructions. 26165 26166@item -msoft-quad-float 26167@opindex msoft-quad-float 26168Generate output containing library calls for quad-word (long double) 26169floating-point instructions. The functions called are those specified 26170in the SPARC ABI@. This is the default. 26171 26172As of this writing, there are no SPARC implementations that have hardware 26173support for the quad-word floating-point instructions. They all invoke 26174a trap handler for one of these instructions, and then the trap handler 26175emulates the effect of the instruction. Because of the trap handler overhead, 26176this is much slower than calling the ABI library routines. Thus the 26177@option{-msoft-quad-float} option is the default. 26178 26179@item -mno-unaligned-doubles 26180@itemx -munaligned-doubles 26181@opindex mno-unaligned-doubles 26182@opindex munaligned-doubles 26183Assume that doubles have 8-byte alignment. This is the default. 26184 26185With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 26186alignment only if they are contained in another type, or if they have an 26187absolute address. Otherwise, it assumes they have 4-byte alignment. 26188Specifying this option avoids some rare compatibility problems with code 26189generated by other compilers. It is not the default because it results 26190in a performance loss, especially for floating-point code. 26191 26192@item -muser-mode 26193@itemx -mno-user-mode 26194@opindex muser-mode 26195@opindex mno-user-mode 26196Do not generate code that can only run in supervisor mode. This is relevant 26197only for the @code{casa} instruction emitted for the LEON3 processor. This 26198is the default. 26199 26200@item -mfaster-structs 26201@itemx -mno-faster-structs 26202@opindex mfaster-structs 26203@opindex mno-faster-structs 26204With @option{-mfaster-structs}, the compiler assumes that structures 26205should have 8-byte alignment. This enables the use of pairs of 26206@code{ldd} and @code{std} instructions for copies in structure 26207assignment, in place of twice as many @code{ld} and @code{st} pairs. 26208However, the use of this changed alignment directly violates the SPARC 26209ABI@. Thus, it's intended only for use on targets where the developer 26210acknowledges that their resulting code is not directly in line with 26211the rules of the ABI@. 26212 26213@item -mstd-struct-return 26214@itemx -mno-std-struct-return 26215@opindex mstd-struct-return 26216@opindex mno-std-struct-return 26217With @option{-mstd-struct-return}, the compiler generates checking code 26218in functions returning structures or unions to detect size mismatches 26219between the two sides of function calls, as per the 32-bit ABI@. 26220 26221The default is @option{-mno-std-struct-return}. This option has no effect 26222in 64-bit mode. 26223 26224@item -mlra 26225@itemx -mno-lra 26226@opindex mlra 26227@opindex mno-lra 26228Enable Local Register Allocation. This is the default for SPARC since GCC 7 26229so @option{-mno-lra} needs to be passed to get old Reload. 26230 26231@item -mcpu=@var{cpu_type} 26232@opindex mcpu 26233Set the instruction set, register set, and instruction scheduling parameters 26234for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 26235@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 26236@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 26237@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 26238@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 26239@samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}. 26240 26241Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 26242which selects the best architecture option for the host processor. 26243@option{-mcpu=native} has no effect if GCC does not recognize 26244the processor. 26245 26246Default instruction scheduling parameters are used for values that select 26247an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 26248@samp{sparclite}, @samp{sparclet}, @samp{v9}. 26249 26250Here is a list of each supported architecture and their supported 26251implementations. 26252 26253@table @asis 26254@item v7 26255cypress, leon3v7 26256 26257@item v8 26258supersparc, hypersparc, leon, leon3 26259 26260@item sparclite 26261f930, f934, sparclite86x 26262 26263@item sparclet 26264tsc701 26265 26266@item v9 26267ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, 26268niagara7, m8 26269@end table 26270 26271By default (unless configured otherwise), GCC generates code for the V7 26272variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 26273additionally optimizes it for the Cypress CY7C602 chip, as used in the 26274SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 26275SPARCStation 1, 2, IPX etc. 26276 26277With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 26278architecture. The only difference from V7 code is that the compiler emits 26279the integer multiply and integer divide instructions which exist in SPARC-V8 26280but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 26281optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 262822000 series. 26283 26284With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 26285the SPARC architecture. This adds the integer multiply, integer divide step 26286and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 26287With @option{-mcpu=f930}, the compiler additionally optimizes it for the 26288Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 26289@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 26290MB86934 chip, which is the more recent SPARClite with FPU@. 26291 26292With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 26293the SPARC architecture. This adds the integer multiply, multiply/accumulate, 26294integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 26295but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 26296optimizes it for the TEMIC SPARClet chip. 26297 26298With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 26299architecture. This adds 64-bit integer and floating-point move instructions, 263003 additional floating-point condition code registers and conditional move 26301instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 26302optimizes it for the Sun UltraSPARC I/II/IIi chips. With 26303@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 26304Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 26305@option{-mcpu=niagara}, the compiler additionally optimizes it for 26306Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 26307additionally optimizes it for Sun UltraSPARC T2 chips. With 26308@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 26309UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 26310additionally optimizes it for Sun UltraSPARC T4 chips. With 26311@option{-mcpu=niagara7}, the compiler additionally optimizes it for 26312Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler 26313additionally optimizes it for Oracle M8 chips. 26314 26315@item -mtune=@var{cpu_type} 26316@opindex mtune 26317Set the instruction scheduling parameters for machine type 26318@var{cpu_type}, but do not set the instruction set or register set that the 26319option @option{-mcpu=@var{cpu_type}} does. 26320 26321The same values for @option{-mcpu=@var{cpu_type}} can be used for 26322@option{-mtune=@var{cpu_type}}, but the only useful values are those 26323that select a particular CPU implementation. Those are 26324@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon}, 26325@samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934}, 26326@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 26327@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3}, 26328@samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris 26329and GNU/Linux toolchains, @samp{native} can also be used. 26330 26331@item -mv8plus 26332@itemx -mno-v8plus 26333@opindex mv8plus 26334@opindex mno-v8plus 26335With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 26336difference from the V8 ABI is that the global and out registers are 26337considered 64 bits wide. This is enabled by default on Solaris in 32-bit 26338mode for all SPARC-V9 processors. 26339 26340@item -mvis 26341@itemx -mno-vis 26342@opindex mvis 26343@opindex mno-vis 26344With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 26345Visual Instruction Set extensions. The default is @option{-mno-vis}. 26346 26347@item -mvis2 26348@itemx -mno-vis2 26349@opindex mvis2 26350@opindex mno-vis2 26351With @option{-mvis2}, GCC generates code that takes advantage of 26352version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 26353default is @option{-mvis2} when targeting a cpu that supports such 26354instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 26355also sets @option{-mvis}. 26356 26357@item -mvis3 26358@itemx -mno-vis3 26359@opindex mvis3 26360@opindex mno-vis3 26361With @option{-mvis3}, GCC generates code that takes advantage of 26362version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 26363default is @option{-mvis3} when targeting a cpu that supports such 26364instructions, such as niagara-3 and later. Setting @option{-mvis3} 26365also sets @option{-mvis2} and @option{-mvis}. 26366 26367@item -mvis4 26368@itemx -mno-vis4 26369@opindex mvis4 26370@opindex mno-vis4 26371With @option{-mvis4}, GCC generates code that takes advantage of 26372version 4.0 of the UltraSPARC Visual Instruction Set extensions. The 26373default is @option{-mvis4} when targeting a cpu that supports such 26374instructions, such as niagara-7 and later. Setting @option{-mvis4} 26375also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}. 26376 26377@item -mvis4b 26378@itemx -mno-vis4b 26379@opindex mvis4b 26380@opindex mno-vis4b 26381With @option{-mvis4b}, GCC generates code that takes advantage of 26382version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus 26383the additional VIS instructions introduced in the Oracle SPARC 26384Architecture 2017. The default is @option{-mvis4b} when targeting a 26385cpu that supports such instructions, such as m8 and later. Setting 26386@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3}, 26387@option{-mvis2} and @option{-mvis}. 26388 26389@item -mcbcond 26390@itemx -mno-cbcond 26391@opindex mcbcond 26392@opindex mno-cbcond 26393With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC 26394Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond} 26395when targeting a CPU that supports such instructions, such as Niagara-4 and 26396later. 26397 26398@item -mfmaf 26399@itemx -mno-fmaf 26400@opindex mfmaf 26401@opindex mno-fmaf 26402With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 26403Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf} 26404when targeting a CPU that supports such instructions, such as Niagara-3 and 26405later. 26406 26407@item -mfsmuld 26408@itemx -mno-fsmuld 26409@opindex mfsmuld 26410@opindex mno-fsmuld 26411With @option{-mfsmuld}, GCC generates code that takes advantage of the 26412Floating-point Multiply Single to Double (FsMULd) instruction. The default is 26413@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8 26414or V9 with FPU except @option{-mcpu=leon}. 26415 26416@item -mpopc 26417@itemx -mno-popc 26418@opindex mpopc 26419@opindex mno-popc 26420With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 26421Population Count instruction. The default is @option{-mpopc} 26422when targeting a CPU that supports such an instruction, such as Niagara-2 and 26423later. 26424 26425@item -msubxc 26426@itemx -mno-subxc 26427@opindex msubxc 26428@opindex mno-subxc 26429With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC 26430Subtract-Extended-with-Carry instruction. The default is @option{-msubxc} 26431when targeting a CPU that supports such an instruction, such as Niagara-7 and 26432later. 26433 26434@item -mfix-at697f 26435@opindex mfix-at697f 26436Enable the documented workaround for the single erratum of the Atmel AT697F 26437processor (which corresponds to erratum #13 of the AT697E processor). 26438 26439@item -mfix-ut699 26440@opindex mfix-ut699 26441Enable the documented workarounds for the floating-point errata and the data 26442cache nullify errata of the UT699 processor. 26443 26444@item -mfix-ut700 26445@opindex mfix-ut700 26446Enable the documented workaround for the back-to-back store errata of 26447the UT699E/UT700 processor. 26448 26449@item -mfix-gr712rc 26450@opindex mfix-gr712rc 26451Enable the documented workaround for the back-to-back store errata of 26452the GR712RC processor. 26453@end table 26454 26455These @samp{-m} options are supported in addition to the above 26456on SPARC-V9 processors in 64-bit environments: 26457 26458@table @gcctabopt 26459@item -m32 26460@itemx -m64 26461@opindex m32 26462@opindex m64 26463Generate code for a 32-bit or 64-bit environment. 26464The 32-bit environment sets int, long and pointer to 32 bits. 26465The 64-bit environment sets int to 32 bits and long and pointer 26466to 64 bits. 26467 26468@item -mcmodel=@var{which} 26469@opindex mcmodel 26470Set the code model to one of 26471 26472@table @samp 26473@item medlow 26474The Medium/Low code model: 64-bit addresses, programs 26475must be linked in the low 32 bits of memory. Programs can be statically 26476or dynamically linked. 26477 26478@item medmid 26479The Medium/Middle code model: 64-bit addresses, programs 26480must be linked in the low 44 bits of memory, the text and data segments must 26481be less than 2GB in size and the data segment must be located within 2GB of 26482the text segment. 26483 26484@item medany 26485The Medium/Anywhere code model: 64-bit addresses, programs 26486may be linked anywhere in memory, the text and data segments must be less 26487than 2GB in size and the data segment must be located within 2GB of the 26488text segment. 26489 26490@item embmedany 26491The Medium/Anywhere code model for embedded systems: 2649264-bit addresses, the text and data segments must be less than 2GB in 26493size, both starting anywhere in memory (determined at link time). The 26494global register %g4 points to the base of the data segment. Programs 26495are statically linked and PIC is not supported. 26496@end table 26497 26498@item -mmemory-model=@var{mem-model} 26499@opindex mmemory-model 26500Set the memory model in force on the processor to one of 26501 26502@table @samp 26503@item default 26504The default memory model for the processor and operating system. 26505 26506@item rmo 26507Relaxed Memory Order 26508 26509@item pso 26510Partial Store Order 26511 26512@item tso 26513Total Store Order 26514 26515@item sc 26516Sequential Consistency 26517@end table 26518 26519These memory models are formally defined in Appendix D of the SPARC-V9 26520architecture manual, as set in the processor's @code{PSTATE.MM} field. 26521 26522@item -mstack-bias 26523@itemx -mno-stack-bias 26524@opindex mstack-bias 26525@opindex mno-stack-bias 26526With @option{-mstack-bias}, GCC assumes that the stack pointer, and 26527frame pointer if present, are offset by @minus{}2047 which must be added back 26528when making stack frame references. This is the default in 64-bit mode. 26529Otherwise, assume no such offset is present. 26530@end table 26531 26532@node SPU Options 26533@subsection SPU Options 26534@cindex SPU options 26535 26536These @samp{-m} options are supported on the SPU: 26537 26538@table @gcctabopt 26539@item -mwarn-reloc 26540@itemx -merror-reloc 26541@opindex mwarn-reloc 26542@opindex merror-reloc 26543 26544The loader for SPU does not handle dynamic relocations. By default, GCC 26545gives an error when it generates code that requires a dynamic 26546relocation. @option{-mno-error-reloc} disables the error, 26547@option{-mwarn-reloc} generates a warning instead. 26548 26549@item -msafe-dma 26550@itemx -munsafe-dma 26551@opindex msafe-dma 26552@opindex munsafe-dma 26553 26554Instructions that initiate or test completion of DMA must not be 26555reordered with respect to loads and stores of the memory that is being 26556accessed. 26557With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect 26558memory accesses, but that can lead to inefficient code in places where the 26559memory is known to not change. Rather than mark the memory as volatile, 26560you can use @option{-msafe-dma} to tell the compiler to treat 26561the DMA instructions as potentially affecting all memory. 26562 26563@item -mbranch-hints 26564@opindex mbranch-hints 26565 26566By default, GCC generates a branch hint instruction to avoid 26567pipeline stalls for always-taken or probably-taken branches. A hint 26568is not generated closer than 8 instructions away from its branch. 26569There is little reason to disable them, except for debugging purposes, 26570or to make an object a little bit smaller. 26571 26572@item -msmall-mem 26573@itemx -mlarge-mem 26574@opindex msmall-mem 26575@opindex mlarge-mem 26576 26577By default, GCC generates code assuming that addresses are never larger 26578than 18 bits. With @option{-mlarge-mem} code is generated that assumes 26579a full 32-bit address. 26580 26581@item -mstdmain 26582@opindex mstdmain 26583 26584By default, GCC links against startup code that assumes the SPU-style 26585main function interface (which has an unconventional parameter list). 26586With @option{-mstdmain}, GCC links your program against startup 26587code that assumes a C99-style interface to @code{main}, including a 26588local copy of @code{argv} strings. 26589 26590@item -mfixed-range=@var{register-range} 26591@opindex mfixed-range 26592Generate code treating the given register range as fixed registers. 26593A fixed register is one that the register allocator cannot use. This is 26594useful when compiling kernel code. A register range is specified as 26595two registers separated by a dash. Multiple register ranges can be 26596specified separated by a comma. 26597 26598@item -mea32 26599@itemx -mea64 26600@opindex mea32 26601@opindex mea64 26602Compile code assuming that pointers to the PPU address space accessed 26603via the @code{__ea} named address space qualifier are either 32 or 64 26604bits wide. The default is 32 bits. As this is an ABI-changing option, 26605all object code in an executable must be compiled with the same setting. 26606 26607@item -maddress-space-conversion 26608@itemx -mno-address-space-conversion 26609@opindex maddress-space-conversion 26610@opindex mno-address-space-conversion 26611Allow/disallow treating the @code{__ea} address space as superset 26612of the generic address space. This enables explicit type casts 26613between @code{__ea} and generic pointer as well as implicit 26614conversions of generic pointers to @code{__ea} pointers. The 26615default is to allow address space pointer conversions. 26616 26617@item -mcache-size=@var{cache-size} 26618@opindex mcache-size 26619This option controls the version of libgcc that the compiler links to an 26620executable and selects a software-managed cache for accessing variables 26621in the @code{__ea} address space with a particular cache size. Possible 26622options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} 26623and @samp{128}. The default cache size is 64KB. 26624 26625@item -matomic-updates 26626@itemx -mno-atomic-updates 26627@opindex matomic-updates 26628@opindex mno-atomic-updates 26629This option controls the version of libgcc that the compiler links to an 26630executable and selects whether atomic updates to the software-managed 26631cache of PPU-side variables are used. If you use atomic updates, changes 26632to a PPU variable from SPU code using the @code{__ea} named address space 26633qualifier do not interfere with changes to other PPU variables residing 26634in the same cache line from PPU code. If you do not use atomic updates, 26635such interference may occur; however, writing back cache lines is 26636more efficient. The default behavior is to use atomic updates. 26637 26638@item -mdual-nops 26639@itemx -mdual-nops=@var{n} 26640@opindex mdual-nops 26641By default, GCC inserts NOPs to increase dual issue when it expects 26642it to increase performance. @var{n} can be a value from 0 to 10. A 26643smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the 26644same as @option{-mno-dual-nops}. Disabled with @option{-Os}. 26645 26646@item -mhint-max-nops=@var{n} 26647@opindex mhint-max-nops 26648Maximum number of NOPs to insert for a branch hint. A branch hint must 26649be at least 8 instructions away from the branch it is affecting. GCC 26650inserts up to @var{n} NOPs to enforce this, otherwise it does not 26651generate the branch hint. 26652 26653@item -mhint-max-distance=@var{n} 26654@opindex mhint-max-distance 26655The encoding of the branch hint instruction limits the hint to be within 26656256 instructions of the branch it is affecting. By default, GCC makes 26657sure it is within 125. 26658 26659@item -msafe-hints 26660@opindex msafe-hints 26661Work around a hardware bug that causes the SPU to stall indefinitely. 26662By default, GCC inserts the @code{hbrp} instruction to make sure 26663this stall won't happen. 26664 26665@end table 26666 26667@node System V Options 26668@subsection Options for System V 26669 26670These additional options are available on System V Release 4 for 26671compatibility with other compilers on those systems: 26672 26673@table @gcctabopt 26674@item -G 26675@opindex G 26676Create a shared object. 26677It is recommended that @option{-symbolic} or @option{-shared} be used instead. 26678 26679@item -Qy 26680@opindex Qy 26681Identify the versions of each tool used by the compiler, in a 26682@code{.ident} assembler directive in the output. 26683 26684@item -Qn 26685@opindex Qn 26686Refrain from adding @code{.ident} directives to the output file (this is 26687the default). 26688 26689@item -YP,@var{dirs} 26690@opindex YP 26691Search the directories @var{dirs}, and no others, for libraries 26692specified with @option{-l}. 26693 26694@item -Ym,@var{dir} 26695@opindex Ym 26696Look in the directory @var{dir} to find the M4 preprocessor. 26697The assembler uses this option. 26698@c This is supposed to go with a -Yd for predefined M4 macro files, but 26699@c the generic assembler that comes with Solaris takes just -Ym. 26700@end table 26701 26702@node TILE-Gx Options 26703@subsection TILE-Gx Options 26704@cindex TILE-Gx options 26705 26706These @samp{-m} options are supported on the TILE-Gx: 26707 26708@table @gcctabopt 26709@item -mcmodel=small 26710@opindex mcmodel=small 26711Generate code for the small model. The distance for direct calls is 26712limited to 500M in either direction. PC-relative addresses are 32 26713bits. Absolute addresses support the full address range. 26714 26715@item -mcmodel=large 26716@opindex mcmodel=large 26717Generate code for the large model. There is no limitation on call 26718distance, pc-relative addresses, or absolute addresses. 26719 26720@item -mcpu=@var{name} 26721@opindex mcpu 26722Selects the type of CPU to be targeted. Currently the only supported 26723type is @samp{tilegx}. 26724 26725@item -m32 26726@itemx -m64 26727@opindex m32 26728@opindex m64 26729Generate code for a 32-bit or 64-bit environment. The 32-bit 26730environment sets int, long, and pointer to 32 bits. The 64-bit 26731environment sets int to 32 bits and long and pointer to 64 bits. 26732 26733@item -mbig-endian 26734@itemx -mlittle-endian 26735@opindex mbig-endian 26736@opindex mlittle-endian 26737Generate code in big/little endian mode, respectively. 26738@end table 26739 26740@node TILEPro Options 26741@subsection TILEPro Options 26742@cindex TILEPro options 26743 26744These @samp{-m} options are supported on the TILEPro: 26745 26746@table @gcctabopt 26747@item -mcpu=@var{name} 26748@opindex mcpu 26749Selects the type of CPU to be targeted. Currently the only supported 26750type is @samp{tilepro}. 26751 26752@item -m32 26753@opindex m32 26754Generate code for a 32-bit environment, which sets int, long, and 26755pointer to 32 bits. This is the only supported behavior so the flag 26756is essentially ignored. 26757@end table 26758 26759@node V850 Options 26760@subsection V850 Options 26761@cindex V850 Options 26762 26763These @samp{-m} options are defined for V850 implementations: 26764 26765@table @gcctabopt 26766@item -mlong-calls 26767@itemx -mno-long-calls 26768@opindex mlong-calls 26769@opindex mno-long-calls 26770Treat all calls as being far away (near). If calls are assumed to be 26771far away, the compiler always loads the function's address into a 26772register, and calls indirect through the pointer. 26773 26774@item -mno-ep 26775@itemx -mep 26776@opindex mno-ep 26777@opindex mep 26778Do not optimize (do optimize) basic blocks that use the same index 26779pointer 4 or more times to copy pointer into the @code{ep} register, and 26780use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 26781option is on by default if you optimize. 26782 26783@item -mno-prolog-function 26784@itemx -mprolog-function 26785@opindex mno-prolog-function 26786@opindex mprolog-function 26787Do not use (do use) external functions to save and restore registers 26788at the prologue and epilogue of a function. The external functions 26789are slower, but use less code space if more than one function saves 26790the same number of registers. The @option{-mprolog-function} option 26791is on by default if you optimize. 26792 26793@item -mspace 26794@opindex mspace 26795Try to make the code as small as possible. At present, this just turns 26796on the @option{-mep} and @option{-mprolog-function} options. 26797 26798@item -mtda=@var{n} 26799@opindex mtda 26800Put static or global variables whose size is @var{n} bytes or less into 26801the tiny data area that register @code{ep} points to. The tiny data 26802area can hold up to 256 bytes in total (128 bytes for byte references). 26803 26804@item -msda=@var{n} 26805@opindex msda 26806Put static or global variables whose size is @var{n} bytes or less into 26807the small data area that register @code{gp} points to. The small data 26808area can hold up to 64 kilobytes. 26809 26810@item -mzda=@var{n} 26811@opindex mzda 26812Put static or global variables whose size is @var{n} bytes or less into 26813the first 32 kilobytes of memory. 26814 26815@item -mv850 26816@opindex mv850 26817Specify that the target processor is the V850. 26818 26819@item -mv850e3v5 26820@opindex mv850e3v5 26821Specify that the target processor is the V850E3V5. The preprocessor 26822constant @code{__v850e3v5__} is defined if this option is used. 26823 26824@item -mv850e2v4 26825@opindex mv850e2v4 26826Specify that the target processor is the V850E3V5. This is an alias for 26827the @option{-mv850e3v5} option. 26828 26829@item -mv850e2v3 26830@opindex mv850e2v3 26831Specify that the target processor is the V850E2V3. The preprocessor 26832constant @code{__v850e2v3__} is defined if this option is used. 26833 26834@item -mv850e2 26835@opindex mv850e2 26836Specify that the target processor is the V850E2. The preprocessor 26837constant @code{__v850e2__} is defined if this option is used. 26838 26839@item -mv850e1 26840@opindex mv850e1 26841Specify that the target processor is the V850E1. The preprocessor 26842constants @code{__v850e1__} and @code{__v850e__} are defined if 26843this option is used. 26844 26845@item -mv850es 26846@opindex mv850es 26847Specify that the target processor is the V850ES. This is an alias for 26848the @option{-mv850e1} option. 26849 26850@item -mv850e 26851@opindex mv850e 26852Specify that the target processor is the V850E@. The preprocessor 26853constant @code{__v850e__} is defined if this option is used. 26854 26855If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 26856nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 26857are defined then a default target processor is chosen and the 26858relevant @samp{__v850*__} preprocessor constant is defined. 26859 26860The preprocessor constants @code{__v850} and @code{__v851__} are always 26861defined, regardless of which processor variant is the target. 26862 26863@item -mdisable-callt 26864@itemx -mno-disable-callt 26865@opindex mdisable-callt 26866@opindex mno-disable-callt 26867This option suppresses generation of the @code{CALLT} instruction for the 26868v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 26869architecture. 26870 26871This option is enabled by default when the RH850 ABI is 26872in use (see @option{-mrh850-abi}), and disabled by default when the 26873GCC ABI is in use. If @code{CALLT} instructions are being generated 26874then the C preprocessor symbol @code{__V850_CALLT__} is defined. 26875 26876@item -mrelax 26877@itemx -mno-relax 26878@opindex mrelax 26879@opindex mno-relax 26880Pass on (or do not pass on) the @option{-mrelax} command-line option 26881to the assembler. 26882 26883@item -mlong-jumps 26884@itemx -mno-long-jumps 26885@opindex mlong-jumps 26886@opindex mno-long-jumps 26887Disable (or re-enable) the generation of PC-relative jump instructions. 26888 26889@item -msoft-float 26890@itemx -mhard-float 26891@opindex msoft-float 26892@opindex mhard-float 26893Disable (or re-enable) the generation of hardware floating point 26894instructions. This option is only significant when the target 26895architecture is @samp{V850E2V3} or higher. If hardware floating point 26896instructions are being generated then the C preprocessor symbol 26897@code{__FPU_OK__} is defined, otherwise the symbol 26898@code{__NO_FPU__} is defined. 26899 26900@item -mloop 26901@opindex mloop 26902Enables the use of the e3v5 LOOP instruction. The use of this 26903instruction is not enabled by default when the e3v5 architecture is 26904selected because its use is still experimental. 26905 26906@item -mrh850-abi 26907@itemx -mghs 26908@opindex mrh850-abi 26909@opindex mghs 26910Enables support for the RH850 version of the V850 ABI. This is the 26911default. With this version of the ABI the following rules apply: 26912 26913@itemize 26914@item 26915Integer sized structures and unions are returned via a memory pointer 26916rather than a register. 26917 26918@item 26919Large structures and unions (more than 8 bytes in size) are passed by 26920value. 26921 26922@item 26923Functions are aligned to 16-bit boundaries. 26924 26925@item 26926The @option{-m8byte-align} command-line option is supported. 26927 26928@item 26929The @option{-mdisable-callt} command-line option is enabled by 26930default. The @option{-mno-disable-callt} command-line option is not 26931supported. 26932@end itemize 26933 26934When this version of the ABI is enabled the C preprocessor symbol 26935@code{__V850_RH850_ABI__} is defined. 26936 26937@item -mgcc-abi 26938@opindex mgcc-abi 26939Enables support for the old GCC version of the V850 ABI. With this 26940version of the ABI the following rules apply: 26941 26942@itemize 26943@item 26944Integer sized structures and unions are returned in register @code{r10}. 26945 26946@item 26947Large structures and unions (more than 8 bytes in size) are passed by 26948reference. 26949 26950@item 26951Functions are aligned to 32-bit boundaries, unless optimizing for 26952size. 26953 26954@item 26955The @option{-m8byte-align} command-line option is not supported. 26956 26957@item 26958The @option{-mdisable-callt} command-line option is supported but not 26959enabled by default. 26960@end itemize 26961 26962When this version of the ABI is enabled the C preprocessor symbol 26963@code{__V850_GCC_ABI__} is defined. 26964 26965@item -m8byte-align 26966@itemx -mno-8byte-align 26967@opindex m8byte-align 26968@opindex mno-8byte-align 26969Enables support for @code{double} and @code{long long} types to be 26970aligned on 8-byte boundaries. The default is to restrict the 26971alignment of all objects to at most 4-bytes. When 26972@option{-m8byte-align} is in effect the C preprocessor symbol 26973@code{__V850_8BYTE_ALIGN__} is defined. 26974 26975@item -mbig-switch 26976@opindex mbig-switch 26977Generate code suitable for big switch tables. Use this option only if 26978the assembler/linker complain about out of range branches within a switch 26979table. 26980 26981@item -mapp-regs 26982@opindex mapp-regs 26983This option causes r2 and r5 to be used in the code generated by 26984the compiler. This setting is the default. 26985 26986@item -mno-app-regs 26987@opindex mno-app-regs 26988This option causes r2 and r5 to be treated as fixed registers. 26989 26990@end table 26991 26992@node VAX Options 26993@subsection VAX Options 26994@cindex VAX options 26995 26996These @samp{-m} options are defined for the VAX: 26997 26998@table @gcctabopt 26999@item -munix 27000@opindex munix 27001Do not output certain jump instructions (@code{aobleq} and so on) 27002that the Unix assembler for the VAX cannot handle across long 27003ranges. 27004 27005@item -mgnu 27006@opindex mgnu 27007Do output those jump instructions, on the assumption that the 27008GNU assembler is being used. 27009 27010@item -mg 27011@opindex mg 27012Output code for G-format floating-point numbers instead of D-format. 27013@end table 27014 27015@node Visium Options 27016@subsection Visium Options 27017@cindex Visium options 27018 27019@table @gcctabopt 27020 27021@item -mdebug 27022@opindex mdebug 27023A program which performs file I/O and is destined to run on an MCM target 27024should be linked with this option. It causes the libraries libc.a and 27025libdebug.a to be linked. The program should be run on the target under 27026the control of the GDB remote debugging stub. 27027 27028@item -msim 27029@opindex msim 27030A program which performs file I/O and is destined to run on the simulator 27031should be linked with option. This causes libraries libc.a and libsim.a to 27032be linked. 27033 27034@item -mfpu 27035@itemx -mhard-float 27036@opindex mfpu 27037@opindex mhard-float 27038Generate code containing floating-point instructions. This is the 27039default. 27040 27041@item -mno-fpu 27042@itemx -msoft-float 27043@opindex mno-fpu 27044@opindex msoft-float 27045Generate code containing library calls for floating-point. 27046 27047@option{-msoft-float} changes the calling convention in the output file; 27048therefore, it is only useful if you compile @emph{all} of a program with 27049this option. In particular, you need to compile @file{libgcc.a}, the 27050library that comes with GCC, with @option{-msoft-float} in order for 27051this to work. 27052 27053@item -mcpu=@var{cpu_type} 27054@opindex mcpu 27055Set the instruction set, register set, and instruction scheduling parameters 27056for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 27057@samp{mcm}, @samp{gr5} and @samp{gr6}. 27058 27059@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 27060 27061By default (unless configured otherwise), GCC generates code for the GR5 27062variant of the Visium architecture. 27063 27064With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 27065architecture. The only difference from GR5 code is that the compiler will 27066generate block move instructions. 27067 27068@item -mtune=@var{cpu_type} 27069@opindex mtune 27070Set the instruction scheduling parameters for machine type @var{cpu_type}, 27071but do not set the instruction set or register set that the option 27072@option{-mcpu=@var{cpu_type}} would. 27073 27074@item -msv-mode 27075@opindex msv-mode 27076Generate code for the supervisor mode, where there are no restrictions on 27077the access to general registers. This is the default. 27078 27079@item -muser-mode 27080@opindex muser-mode 27081Generate code for the user mode, where the access to some general registers 27082is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 27083mode; on the GR6, only registers r29 to r31 are affected. 27084@end table 27085 27086@node VMS Options 27087@subsection VMS Options 27088 27089These @samp{-m} options are defined for the VMS implementations: 27090 27091@table @gcctabopt 27092@item -mvms-return-codes 27093@opindex mvms-return-codes 27094Return VMS condition codes from @code{main}. The default is to return POSIX-style 27095condition (e.g.@: error) codes. 27096 27097@item -mdebug-main=@var{prefix} 27098@opindex mdebug-main=@var{prefix} 27099Flag the first routine whose name starts with @var{prefix} as the main 27100routine for the debugger. 27101 27102@item -mmalloc64 27103@opindex mmalloc64 27104Default to 64-bit memory allocation routines. 27105 27106@item -mpointer-size=@var{size} 27107@opindex mpointer-size=@var{size} 27108Set the default size of pointers. Possible options for @var{size} are 27109@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 27110for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 27111The later option disables @code{pragma pointer_size}. 27112@end table 27113 27114@node VxWorks Options 27115@subsection VxWorks Options 27116@cindex VxWorks Options 27117 27118The options in this section are defined for all VxWorks targets. 27119Options specific to the target hardware are listed with the other 27120options for that target. 27121 27122@table @gcctabopt 27123@item -mrtp 27124@opindex mrtp 27125GCC can generate code for both VxWorks kernels and real time processes 27126(RTPs). This option switches from the former to the latter. It also 27127defines the preprocessor macro @code{__RTP__}. 27128 27129@item -non-static 27130@opindex non-static 27131Link an RTP executable against shared libraries rather than static 27132libraries. The options @option{-static} and @option{-shared} can 27133also be used for RTPs (@pxref{Link Options}); @option{-static} 27134is the default. 27135 27136@item -Bstatic 27137@itemx -Bdynamic 27138@opindex Bstatic 27139@opindex Bdynamic 27140These options are passed down to the linker. They are defined for 27141compatibility with Diab. 27142 27143@item -Xbind-lazy 27144@opindex Xbind-lazy 27145Enable lazy binding of function calls. This option is equivalent to 27146@option{-Wl,-z,now} and is defined for compatibility with Diab. 27147 27148@item -Xbind-now 27149@opindex Xbind-now 27150Disable lazy binding of function calls. This option is the default and 27151is defined for compatibility with Diab. 27152@end table 27153 27154@node x86 Options 27155@subsection x86 Options 27156@cindex x86 Options 27157 27158These @samp{-m} options are defined for the x86 family of computers. 27159 27160@table @gcctabopt 27161 27162@item -march=@var{cpu-type} 27163@opindex march 27164Generate instructions for the machine type @var{cpu-type}. In contrast to 27165@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 27166for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 27167to generate code that may not run at all on processors other than the one 27168indicated. Specifying @option{-march=@var{cpu-type}} implies 27169@option{-mtune=@var{cpu-type}}. 27170 27171The choices for @var{cpu-type} are: 27172 27173@table @samp 27174@item native 27175This selects the CPU to generate code for at compilation time by determining 27176the processor type of the compiling machine. Using @option{-march=native} 27177enables all instruction subsets supported by the local machine (hence 27178the result might not run on different machines). Using @option{-mtune=native} 27179produces code optimized for the local machine under the constraints 27180of the selected instruction set. 27181 27182@item x86-64 27183A generic CPU with 64-bit extensions. 27184 27185@item i386 27186Original Intel i386 CPU@. 27187 27188@item i486 27189Intel i486 CPU@. (No scheduling is implemented for this chip.) 27190 27191@item i586 27192@itemx pentium 27193Intel Pentium CPU with no MMX support. 27194 27195@item lakemont 27196Intel Lakemont MCU, based on Intel Pentium CPU. 27197 27198@item pentium-mmx 27199Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 27200 27201@item pentiumpro 27202Intel Pentium Pro CPU@. 27203 27204@item i686 27205When used with @option{-march}, the Pentium Pro 27206instruction set is used, so the code runs on all i686 family chips. 27207When used with @option{-mtune}, it has the same meaning as @samp{generic}. 27208 27209@item pentium2 27210Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 27211support. 27212 27213@item pentium3 27214@itemx pentium3m 27215Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 27216set support. 27217 27218@item pentium-m 27219Intel Pentium M; low-power version of Intel Pentium III CPU 27220with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 27221 27222@item pentium4 27223@itemx pentium4m 27224Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 27225 27226@item prescott 27227Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 27228set support. 27229 27230@item nocona 27231Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 27232SSE2 and SSE3 instruction set support. 27233 27234@item core2 27235Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 27236instruction set support. 27237 27238@item nehalem 27239Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27240SSE4.1, SSE4.2 and POPCNT instruction set support. 27241 27242@item westmere 27243Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27244SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. 27245 27246@item sandybridge 27247Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27248SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. 27249 27250@item ivybridge 27251Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27252SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C 27253instruction set support. 27254 27255@item haswell 27256Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27257SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27258BMI, BMI2 and F16C instruction set support. 27259 27260@item broadwell 27261Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27262SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27263BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support. 27264 27265@item skylake 27266Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27267SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27268BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and 27269XSAVES instruction set support. 27270 27271@item bonnell 27272Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 27273instruction set support. 27274 27275@item silvermont 27276Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27277SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support. 27278 27279@item goldmont 27280Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27281SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE 27282instruction set support. 27283 27284@item goldmont-plus 27285Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27286SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, 27287PTWRITE, RDPID, SGX and UMIP instruction set support. 27288 27289@item tremont 27290Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27291SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, 27292RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support. 27293 27294@item knl 27295Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27296SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27297BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and 27298AVX512CD instruction set support. 27299 27300@item knm 27301Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27302SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27303BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD, 27304AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support. 27305 27306@item skylake-avx512 27307Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27308SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27309BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, 27310CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support. 27311 27312@item cannonlake 27313Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 27314SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 27315RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 27316XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 27317AVX512IFMA, SHA and UMIP instruction set support. 27318 27319@item icelake-client 27320Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 27321SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 27322RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 27323XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 27324AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 27325AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support. 27326 27327@item icelake-server 27328Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 27329SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 27330RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 27331XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 27332AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 27333AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction 27334set support. 27335 27336@item cascadelake 27337Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27338SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, 27339BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, 27340AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support. 27341 27342@item k6 27343AMD K6 CPU with MMX instruction set support. 27344 27345@item k6-2 27346@itemx k6-3 27347Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 27348 27349@item athlon 27350@itemx athlon-tbird 27351AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 27352support. 27353 27354@item athlon-4 27355@itemx athlon-xp 27356@itemx athlon-mp 27357Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 27358instruction set support. 27359 27360@item k8 27361@itemx opteron 27362@itemx athlon64 27363@itemx athlon-fx 27364Processors based on the AMD K8 core with x86-64 instruction set support, 27365including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 27366(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 27367instruction set extensions.) 27368 27369@item k8-sse3 27370@itemx opteron-sse3 27371@itemx athlon64-sse3 27372Improved versions of AMD K8 cores with SSE3 instruction set support. 27373 27374@item amdfam10 27375@itemx barcelona 27376CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 27377supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 27378instruction set extensions.) 27379 27380@item bdver1 27381CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 27382supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 27383SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 27384@item bdver2 27385AMD Family 15h core based CPUs with x86-64 instruction set support. (This 27386supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, 27387SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 27388extensions.) 27389@item bdver3 27390AMD Family 15h core based CPUs with x86-64 instruction set support. (This 27391supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 27392PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 2739364-bit instruction set extensions. 27394@item bdver4 27395AMD Family 15h core based CPUs with x86-64 instruction set support. (This 27396supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 27397AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 27398SSE4.2, ABM and 64-bit instruction set extensions. 27399 27400@item znver1 27401AMD Family 17h core based CPUs with x86-64 instruction set support. (This 27402supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, 27403SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, 27404SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 27405instruction set extensions. 27406@item znver2 27407AMD Family 17h core based CPUs with x86-64 instruction set support. (This 27408supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 27409MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 27410SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 27411instruction set extensions.) 27412 27413 27414@item btver1 27415CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 27416supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 27417instruction set extensions.) 27418 27419@item btver2 27420CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 27421includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, 27422SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 27423 27424@item winchip-c6 27425IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 27426set support. 27427 27428@item winchip2 27429IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 27430instruction set support. 27431 27432@item c3 27433VIA C3 CPU with MMX and 3DNow!@: instruction set support. 27434(No scheduling is implemented for this chip.) 27435 27436@item c3-2 27437VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 27438(No scheduling is implemented for this chip.) 27439 27440@item c7 27441VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 27442(No scheduling is implemented for this chip.) 27443 27444@item samuel-2 27445VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support. 27446(No scheduling is implemented for this chip.) 27447 27448@item nehemiah 27449VIA Eden Nehemiah CPU with MMX and SSE instruction set support. 27450(No scheduling is implemented for this chip.) 27451 27452@item esther 27453VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 27454(No scheduling is implemented for this chip.) 27455 27456@item eden-x2 27457VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. 27458(No scheduling is implemented for this chip.) 27459 27460@item eden-x4 27461VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, 27462AVX and AVX2 instruction set support. 27463(No scheduling is implemented for this chip.) 27464 27465@item nano 27466Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 27467instruction set support. 27468(No scheduling is implemented for this chip.) 27469 27470@item nano-1000 27471VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 27472instruction set support. 27473(No scheduling is implemented for this chip.) 27474 27475@item nano-2000 27476VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 27477instruction set support. 27478(No scheduling is implemented for this chip.) 27479 27480@item nano-3000 27481VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 27482instruction set support. 27483(No scheduling is implemented for this chip.) 27484 27485@item nano-x2 27486VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 27487instruction set support. 27488(No scheduling is implemented for this chip.) 27489 27490@item nano-x4 27491VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 27492instruction set support. 27493(No scheduling is implemented for this chip.) 27494 27495@item geode 27496AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 27497@end table 27498 27499@item -mtune=@var{cpu-type} 27500@opindex mtune 27501Tune to @var{cpu-type} everything applicable about the generated code, except 27502for the ABI and the set of available instructions. 27503While picking a specific @var{cpu-type} schedules things appropriately 27504for that particular chip, the compiler does not generate any code that 27505cannot run on the default machine type unless you use a 27506@option{-march=@var{cpu-type}} option. 27507For example, if GCC is configured for i686-pc-linux-gnu 27508then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 27509but still runs on i686 machines. 27510 27511The choices for @var{cpu-type} are the same as for @option{-march}. 27512In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 27513 27514@table @samp 27515@item generic 27516Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 27517If you know the CPU on which your code will run, then you should use 27518the corresponding @option{-mtune} or @option{-march} option instead of 27519@option{-mtune=generic}. But, if you do not know exactly what CPU users 27520of your application will have, then you should use this option. 27521 27522As new processors are deployed in the marketplace, the behavior of this 27523option will change. Therefore, if you upgrade to a newer version of 27524GCC, code generation controlled by this option will change to reflect 27525the processors 27526that are most common at the time that version of GCC is released. 27527 27528There is no @option{-march=generic} option because @option{-march} 27529indicates the instruction set the compiler can use, and there is no 27530generic instruction set applicable to all processors. In contrast, 27531@option{-mtune} indicates the processor (or, in this case, collection of 27532processors) for which the code is optimized. 27533 27534@item intel 27535Produce code optimized for the most current Intel processors, which are 27536Haswell and Silvermont for this version of GCC. If you know the CPU 27537on which your code will run, then you should use the corresponding 27538@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 27539But, if you want your application performs better on both Haswell and 27540Silvermont, then you should use this option. 27541 27542As new Intel processors are deployed in the marketplace, the behavior of 27543this option will change. Therefore, if you upgrade to a newer version of 27544GCC, code generation controlled by this option will change to reflect 27545the most current Intel processors at the time that version of GCC is 27546released. 27547 27548There is no @option{-march=intel} option because @option{-march} indicates 27549the instruction set the compiler can use, and there is no common 27550instruction set applicable to all processors. In contrast, 27551@option{-mtune} indicates the processor (or, in this case, collection of 27552processors) for which the code is optimized. 27553@end table 27554 27555@item -mcpu=@var{cpu-type} 27556@opindex mcpu 27557A deprecated synonym for @option{-mtune}. 27558 27559@item -mfpmath=@var{unit} 27560@opindex mfpmath 27561Generate floating-point arithmetic for selected unit @var{unit}. The choices 27562for @var{unit} are: 27563 27564@table @samp 27565@item 387 27566Use the standard 387 floating-point coprocessor present on the majority of chips and 27567emulated otherwise. Code compiled with this option runs almost everywhere. 27568The temporary results are computed in 80-bit precision instead of the precision 27569specified by the type, resulting in slightly different results compared to most 27570of other chips. See @option{-ffloat-store} for more detailed description. 27571 27572This is the default choice for non-Darwin x86-32 targets. 27573 27574@item sse 27575Use scalar floating-point instructions present in the SSE instruction set. 27576This instruction set is supported by Pentium III and newer chips, 27577and in the AMD line 27578by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 27579instruction set supports only single-precision arithmetic, thus the double and 27580extended-precision arithmetic are still done using 387. A later version, present 27581only in Pentium 4 and AMD x86-64 chips, supports double-precision 27582arithmetic too. 27583 27584For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 27585or @option{-msse2} switches to enable SSE extensions and make this option 27586effective. For the x86-64 compiler, these extensions are enabled by default. 27587 27588The resulting code should be considerably faster in the majority of cases and avoid 27589the numerical instability problems of 387 code, but may break some existing 27590code that expects temporaries to be 80 bits. 27591 27592This is the default choice for the x86-64 compiler, Darwin x86-32 targets, 27593and the default choice for x86-32 targets with the SSE2 instruction set 27594when @option{-ffast-math} is enabled. 27595 27596@item sse,387 27597@itemx sse+387 27598@itemx both 27599Attempt to utilize both instruction sets at once. This effectively doubles the 27600amount of available registers, and on chips with separate execution units for 27601387 and SSE the execution resources too. Use this option with care, as it is 27602still experimental, because the GCC register allocator does not model separate 27603functional units well, resulting in unstable performance. 27604@end table 27605 27606@item -masm=@var{dialect} 27607@opindex masm=@var{dialect} 27608Output assembly instructions using selected @var{dialect}. Also affects 27609which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 27610extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 27611order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 27612not support @samp{intel}. 27613 27614@item -mieee-fp 27615@itemx -mno-ieee-fp 27616@opindex mieee-fp 27617@opindex mno-ieee-fp 27618Control whether or not the compiler uses IEEE floating-point 27619comparisons. These correctly handle the case where the result of a 27620comparison is unordered. 27621 27622@item -m80387 27623@itemx -mhard-float 27624@opindex 80387 27625@opindex mhard-float 27626Generate output containing 80387 instructions for floating point. 27627 27628@item -mno-80387 27629@itemx -msoft-float 27630@opindex no-80387 27631@opindex msoft-float 27632Generate output containing library calls for floating point. 27633 27634@strong{Warning:} the requisite libraries are not part of GCC@. 27635Normally the facilities of the machine's usual C compiler are used, but 27636this cannot be done directly in cross-compilation. You must make your 27637own arrangements to provide suitable library functions for 27638cross-compilation. 27639 27640On machines where a function returns floating-point results in the 80387 27641register stack, some floating-point opcodes may be emitted even if 27642@option{-msoft-float} is used. 27643 27644@item -mno-fp-ret-in-387 27645@opindex mno-fp-ret-in-387 27646@opindex mfp-ret-in-387 27647Do not use the FPU registers for return values of functions. 27648 27649The usual calling convention has functions return values of types 27650@code{float} and @code{double} in an FPU register, even if there 27651is no FPU@. The idea is that the operating system should emulate 27652an FPU@. 27653 27654The option @option{-mno-fp-ret-in-387} causes such values to be returned 27655in ordinary CPU registers instead. 27656 27657@item -mno-fancy-math-387 27658@opindex mno-fancy-math-387 27659@opindex mfancy-math-387 27660Some 387 emulators do not support the @code{sin}, @code{cos} and 27661@code{sqrt} instructions for the 387. Specify this option to avoid 27662generating those instructions. 27663This option is overridden when @option{-march} 27664indicates that the target CPU always has an FPU and so the 27665instruction does not need emulation. These 27666instructions are not generated unless you also use the 27667@option{-funsafe-math-optimizations} switch. 27668 27669@item -malign-double 27670@itemx -mno-align-double 27671@opindex malign-double 27672@opindex mno-align-double 27673Control whether GCC aligns @code{double}, @code{long double}, and 27674@code{long long} variables on a two-word boundary or a one-word 27675boundary. Aligning @code{double} variables on a two-word boundary 27676produces code that runs somewhat faster on a Pentium at the 27677expense of more memory. 27678 27679On x86-64, @option{-malign-double} is enabled by default. 27680 27681@strong{Warning:} if you use the @option{-malign-double} switch, 27682structures containing the above types are aligned differently than 27683the published application binary interface specifications for the x86-32 27684and are not binary compatible with structures in code compiled 27685without that switch. 27686 27687@item -m96bit-long-double 27688@itemx -m128bit-long-double 27689@opindex m96bit-long-double 27690@opindex m128bit-long-double 27691These switches control the size of @code{long double} type. The x86-32 27692application binary interface specifies the size to be 96 bits, 27693so @option{-m96bit-long-double} is the default in 32-bit mode. 27694 27695Modern architectures (Pentium and newer) prefer @code{long double} 27696to be aligned to an 8- or 16-byte boundary. In arrays or structures 27697conforming to the ABI, this is not possible. So specifying 27698@option{-m128bit-long-double} aligns @code{long double} 27699to a 16-byte boundary by padding the @code{long double} with an additional 2770032-bit zero. 27701 27702In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 27703its ABI specifies that @code{long double} is aligned on 16-byte boundary. 27704 27705Notice that neither of these options enable any extra precision over the x87 27706standard of 80 bits for a @code{long double}. 27707 27708@strong{Warning:} if you override the default value for your target ABI, this 27709changes the size of 27710structures and arrays containing @code{long double} variables, 27711as well as modifying the function calling convention for functions taking 27712@code{long double}. Hence they are not binary-compatible 27713with code compiled without that switch. 27714 27715@item -mlong-double-64 27716@itemx -mlong-double-80 27717@itemx -mlong-double-128 27718@opindex mlong-double-64 27719@opindex mlong-double-80 27720@opindex mlong-double-128 27721These switches control the size of @code{long double} type. A size 27722of 64 bits makes the @code{long double} type equivalent to the @code{double} 27723type. This is the default for 32-bit Bionic C library. A size 27724of 128 bits makes the @code{long double} type equivalent to the 27725@code{__float128} type. This is the default for 64-bit Bionic C library. 27726 27727@strong{Warning:} if you override the default value for your target ABI, this 27728changes the size of 27729structures and arrays containing @code{long double} variables, 27730as well as modifying the function calling convention for functions taking 27731@code{long double}. Hence they are not binary-compatible 27732with code compiled without that switch. 27733 27734@item -malign-data=@var{type} 27735@opindex malign-data 27736Control how GCC aligns variables. Supported values for @var{type} are 27737@samp{compat} uses increased alignment value compatible uses GCC 4.8 27738and earlier, @samp{abi} uses alignment value as specified by the 27739psABI, and @samp{cacheline} uses increased alignment value to match 27740the cache line size. @samp{compat} is the default. 27741 27742@item -mlarge-data-threshold=@var{threshold} 27743@opindex mlarge-data-threshold 27744When @option{-mcmodel=medium} is specified, data objects larger than 27745@var{threshold} are placed in the large data section. This value must be the 27746same across all objects linked into the binary, and defaults to 65535. 27747 27748@item -mrtd 27749@opindex mrtd 27750Use a different function-calling convention, in which functions that 27751take a fixed number of arguments return with the @code{ret @var{num}} 27752instruction, which pops their arguments while returning. This saves one 27753instruction in the caller since there is no need to pop the arguments 27754there. 27755 27756You can specify that an individual function is called with this calling 27757sequence with the function attribute @code{stdcall}. You can also 27758override the @option{-mrtd} option by using the function attribute 27759@code{cdecl}. @xref{Function Attributes}. 27760 27761@strong{Warning:} this calling convention is incompatible with the one 27762normally used on Unix, so you cannot use it if you need to call 27763libraries compiled with the Unix compiler. 27764 27765Also, you must provide function prototypes for all functions that 27766take variable numbers of arguments (including @code{printf}); 27767otherwise incorrect code is generated for calls to those 27768functions. 27769 27770In addition, seriously incorrect code results if you call a 27771function with too many arguments. (Normally, extra arguments are 27772harmlessly ignored.) 27773 27774@item -mregparm=@var{num} 27775@opindex mregparm 27776Control how many registers are used to pass integer arguments. By 27777default, no registers are used to pass arguments, and at most 3 27778registers can be used. You can control this behavior for a specific 27779function by using the function attribute @code{regparm}. 27780@xref{Function Attributes}. 27781 27782@strong{Warning:} if you use this switch, and 27783@var{num} is nonzero, then you must build all modules with the same 27784value, including any libraries. This includes the system libraries and 27785startup modules. 27786 27787@item -msseregparm 27788@opindex msseregparm 27789Use SSE register passing conventions for float and double arguments 27790and return values. You can control this behavior for a specific 27791function by using the function attribute @code{sseregparm}. 27792@xref{Function Attributes}. 27793 27794@strong{Warning:} if you use this switch then you must build all 27795modules with the same value, including any libraries. This includes 27796the system libraries and startup modules. 27797 27798@item -mvect8-ret-in-mem 27799@opindex mvect8-ret-in-mem 27800Return 8-byte vectors in memory instead of MMX registers. This is the 27801default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun 27802Studio compilers until version 12. Later compiler versions (starting 27803with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which 27804is the default on Solaris@tie{}10 and later. @emph{Only} use this option if 27805you need to remain compatible with existing code produced by those 27806previous compiler versions or older versions of GCC@. 27807 27808@item -mpc32 27809@itemx -mpc64 27810@itemx -mpc80 27811@opindex mpc32 27812@opindex mpc64 27813@opindex mpc80 27814 27815Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 27816is specified, the significands of results of floating-point operations are 27817rounded to 24 bits (single precision); @option{-mpc64} rounds the 27818significands of results of floating-point operations to 53 bits (double 27819precision) and @option{-mpc80} rounds the significands of results of 27820floating-point operations to 64 bits (extended double precision), which is 27821the default. When this option is used, floating-point operations in higher 27822precisions are not available to the programmer without setting the FPU 27823control word explicitly. 27824 27825Setting the rounding of floating-point operations to less than the default 2782680 bits can speed some programs by 2% or more. Note that some mathematical 27827libraries assume that extended-precision (80-bit) floating-point operations 27828are enabled by default; routines in such libraries could suffer significant 27829loss of accuracy, typically through so-called ``catastrophic cancellation'', 27830when this option is used to set the precision to less than extended precision. 27831 27832@item -mstackrealign 27833@opindex mstackrealign 27834Realign the stack at entry. On the x86, the @option{-mstackrealign} 27835option generates an alternate prologue and epilogue that realigns the 27836run-time stack if necessary. This supports mixing legacy codes that keep 278374-byte stack alignment with modern codes that keep 16-byte stack alignment for 27838SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 27839applicable to individual functions. 27840 27841@item -mpreferred-stack-boundary=@var{num} 27842@opindex mpreferred-stack-boundary 27843Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 27844byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 27845the default is 4 (16 bytes or 128 bits). 27846 27847@strong{Warning:} When generating code for the x86-64 architecture with 27848SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 27849used to keep the stack boundary aligned to 8 byte boundary. Since 27850x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 27851intended to be used in controlled environment where stack space is 27852important limitation. This option leads to wrong code when functions 27853compiled with 16 byte stack alignment (such as functions from a standard 27854library) are called with misaligned stack. In this case, SSE 27855instructions may lead to misaligned memory access traps. In addition, 27856variable arguments are handled incorrectly for 16 byte aligned 27857objects (including x87 long double and __int128), leading to wrong 27858results. You must build all modules with 27859@option{-mpreferred-stack-boundary=3}, including any libraries. This 27860includes the system libraries and startup modules. 27861 27862@item -mincoming-stack-boundary=@var{num} 27863@opindex mincoming-stack-boundary 27864Assume the incoming stack is aligned to a 2 raised to @var{num} byte 27865boundary. If @option{-mincoming-stack-boundary} is not specified, 27866the one specified by @option{-mpreferred-stack-boundary} is used. 27867 27868On Pentium and Pentium Pro, @code{double} and @code{long double} values 27869should be aligned to an 8-byte boundary (see @option{-malign-double}) or 27870suffer significant run time performance penalties. On Pentium III, the 27871Streaming SIMD Extension (SSE) data type @code{__m128} may not work 27872properly if it is not 16-byte aligned. 27873 27874To ensure proper alignment of this values on the stack, the stack boundary 27875must be as aligned as that required by any value stored on the stack. 27876Further, every function must be generated such that it keeps the stack 27877aligned. Thus calling a function compiled with a higher preferred 27878stack boundary from a function compiled with a lower preferred stack 27879boundary most likely misaligns the stack. It is recommended that 27880libraries that use callbacks always use the default setting. 27881 27882This extra alignment does consume extra stack space, and generally 27883increases code size. Code that is sensitive to stack space usage, such 27884as embedded systems and operating system kernels, may want to reduce the 27885preferred alignment to @option{-mpreferred-stack-boundary=2}. 27886 27887@need 200 27888@item -mmmx 27889@opindex mmmx 27890@need 200 27891@itemx -msse 27892@opindex msse 27893@need 200 27894@itemx -msse2 27895@opindex msse2 27896@need 200 27897@itemx -msse3 27898@opindex msse3 27899@need 200 27900@itemx -mssse3 27901@opindex mssse3 27902@need 200 27903@itemx -msse4 27904@opindex msse4 27905@need 200 27906@itemx -msse4a 27907@opindex msse4a 27908@need 200 27909@itemx -msse4.1 27910@opindex msse4.1 27911@need 200 27912@itemx -msse4.2 27913@opindex msse4.2 27914@need 200 27915@itemx -mavx 27916@opindex mavx 27917@need 200 27918@itemx -mavx2 27919@opindex mavx2 27920@need 200 27921@itemx -mavx512f 27922@opindex mavx512f 27923@need 200 27924@itemx -mavx512pf 27925@opindex mavx512pf 27926@need 200 27927@itemx -mavx512er 27928@opindex mavx512er 27929@need 200 27930@itemx -mavx512cd 27931@opindex mavx512cd 27932@need 200 27933@itemx -mavx512vl 27934@opindex mavx512vl 27935@need 200 27936@itemx -mavx512bw 27937@opindex mavx512bw 27938@need 200 27939@itemx -mavx512dq 27940@opindex mavx512dq 27941@need 200 27942@itemx -mavx512ifma 27943@opindex mavx512ifma 27944@need 200 27945@itemx -mavx512vbmi 27946@opindex mavx512vbmi 27947@need 200 27948@itemx -msha 27949@opindex msha 27950@need 200 27951@itemx -maes 27952@opindex maes 27953@need 200 27954@itemx -mpclmul 27955@opindex mpclmul 27956@need 200 27957@itemx -mclflushopt 27958@opindex mclflushopt 27959@need 200 27960@itemx -mclwb 27961@opindex mclwb 27962@need 200 27963@itemx -mfsgsbase 27964@opindex mfsgsbase 27965@need 200 27966@itemx -mptwrite 27967@opindex mptwrite 27968@need 200 27969@itemx -mrdrnd 27970@opindex mrdrnd 27971@need 200 27972@itemx -mf16c 27973@opindex mf16c 27974@need 200 27975@itemx -mfma 27976@opindex mfma 27977@need 200 27978@itemx -mpconfig 27979@opindex mpconfig 27980@need 200 27981@itemx -mwbnoinvd 27982@opindex mwbnoinvd 27983@need 200 27984@itemx -mfma4 27985@opindex mfma4 27986@need 200 27987@itemx -mprfchw 27988@opindex mprfchw 27989@need 200 27990@itemx -mrdpid 27991@opindex mrdpid 27992@need 200 27993@itemx -mprefetchwt1 27994@opindex mprefetchwt1 27995@need 200 27996@itemx -mrdseed 27997@opindex mrdseed 27998@need 200 27999@itemx -msgx 28000@opindex msgx 28001@need 200 28002@itemx -mxop 28003@opindex mxop 28004@need 200 28005@itemx -mlwp 28006@opindex mlwp 28007@need 200 28008@itemx -m3dnow 28009@opindex m3dnow 28010@need 200 28011@itemx -m3dnowa 28012@opindex m3dnowa 28013@need 200 28014@itemx -mpopcnt 28015@opindex mpopcnt 28016@need 200 28017@itemx -mabm 28018@opindex mabm 28019@need 200 28020@itemx -madx 28021@opindex madx 28022@need 200 28023@itemx -mbmi 28024@opindex mbmi 28025@need 200 28026@itemx -mbmi2 28027@opindex mbmi2 28028@need 200 28029@itemx -mlzcnt 28030@opindex mlzcnt 28031@need 200 28032@itemx -mfxsr 28033@opindex mfxsr 28034@need 200 28035@itemx -mxsave 28036@opindex mxsave 28037@need 200 28038@itemx -mxsaveopt 28039@opindex mxsaveopt 28040@need 200 28041@itemx -mxsavec 28042@opindex mxsavec 28043@need 200 28044@itemx -mxsaves 28045@opindex mxsaves 28046@need 200 28047@itemx -mrtm 28048@opindex mrtm 28049@need 200 28050@itemx -mhle 28051@opindex mhle 28052@need 200 28053@itemx -mtbm 28054@opindex mtbm 28055@need 200 28056@itemx -mmwaitx 28057@opindex mmwaitx 28058@need 200 28059@itemx -mclzero 28060@opindex mclzero 28061@need 200 28062@itemx -mpku 28063@opindex mpku 28064@need 200 28065@itemx -mavx512vbmi2 28066@opindex mavx512vbmi2 28067@need 200 28068@itemx -mgfni 28069@opindex mgfni 28070@need 200 28071@itemx -mvaes 28072@opindex mvaes 28073@need 200 28074@itemx -mwaitpkg 28075@opindex mwaitpkg 28076@need 200 28077@itemx -mvpclmulqdq 28078@opindex mvpclmulqdq 28079@need 200 28080@itemx -mavx512bitalg 28081@opindex mavx512bitalg 28082@need 200 28083@itemx -mmovdiri 28084@opindex mmovdiri 28085@need 200 28086@itemx -mmovdir64b 28087@opindex mmovdir64b 28088@need 200 28089@itemx -mavx512vpopcntdq 28090@opindex mavx512vpopcntdq 28091@need 200 28092@itemx -mavx5124fmaps 28093@opindex mavx5124fmaps 28094@need 200 28095@itemx -mavx512vnni 28096@opindex mavx512vnni 28097@need 200 28098@itemx -mavx5124vnniw 28099@opindex mavx5124vnniw 28100@need 200 28101@itemx -mcldemote 28102@opindex mcldemote 28103These switches enable the use of instructions in the MMX, SSE, 28104SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF, 28105AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA, 28106AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, 28107WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 281083DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE, 28109XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2, 28110GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, 28111AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE 28112extended instruction sets. Each has a corresponding @option{-mno-} option to 28113disable use of these instructions. 28114 28115These extensions are also available as built-in functions: see 28116@ref{x86 Built-in Functions}, for details of the functions enabled and 28117disabled by these switches. 28118 28119To generate SSE/SSE2 instructions automatically from floating-point 28120code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 28121 28122GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 28123generates new AVX instructions or AVX equivalence for all SSEx instructions 28124when needed. 28125 28126These options enable GCC to use these extended instructions in 28127generated code, even without @option{-mfpmath=sse}. Applications that 28128perform run-time CPU detection must compile separate files for each 28129supported architecture, using the appropriate flags. In particular, 28130the file containing the CPU detection code should be compiled without 28131these options. 28132 28133@item -mdump-tune-features 28134@opindex mdump-tune-features 28135This option instructs GCC to dump the names of the x86 performance 28136tuning features and default settings. The names can be used in 28137@option{-mtune-ctrl=@var{feature-list}}. 28138 28139@item -mtune-ctrl=@var{feature-list} 28140@opindex mtune-ctrl=@var{feature-list} 28141This option is used to do fine grain control of x86 code generation features. 28142@var{feature-list} is a comma separated list of @var{feature} names. See also 28143@option{-mdump-tune-features}. When specified, the @var{feature} is turned 28144on if it is not preceded with @samp{^}, otherwise, it is turned off. 28145@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 28146developers. Using it may lead to code paths not covered by testing and can 28147potentially result in compiler ICEs or runtime errors. 28148 28149@item -mno-default 28150@opindex mno-default 28151This option instructs GCC to turn off all tunable features. See also 28152@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 28153 28154@item -mcld 28155@opindex mcld 28156This option instructs GCC to emit a @code{cld} instruction in the prologue 28157of functions that use string instructions. String instructions depend on 28158the DF flag to select between autoincrement or autodecrement mode. While the 28159ABI specifies the DF flag to be cleared on function entry, some operating 28160systems violate this specification by not clearing the DF flag in their 28161exception dispatchers. The exception handler can be invoked with the DF flag 28162set, which leads to wrong direction mode when string instructions are used. 28163This option can be enabled by default on 32-bit x86 targets by configuring 28164GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 28165instructions can be suppressed with the @option{-mno-cld} compiler option 28166in this case. 28167 28168@item -mvzeroupper 28169@opindex mvzeroupper 28170This option instructs GCC to emit a @code{vzeroupper} instruction 28171before a transfer of control flow out of the function to minimize 28172the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 28173intrinsics. 28174 28175@item -mprefer-avx128 28176@opindex mprefer-avx128 28177This option instructs GCC to use 128-bit AVX instructions instead of 28178256-bit AVX instructions in the auto-vectorizer. 28179 28180@item -mprefer-vector-width=@var{opt} 28181@opindex mprefer-vector-width 28182This option instructs GCC to use @var{opt}-bit vector width in instructions 28183instead of default on the selected platform. 28184 28185@table @samp 28186@item none 28187No extra limitations applied to GCC other than defined by the selected platform. 28188 28189@item 128 28190Prefer 128-bit vector width for instructions. 28191 28192@item 256 28193Prefer 256-bit vector width for instructions. 28194 28195@item 512 28196Prefer 512-bit vector width for instructions. 28197@end table 28198 28199@item -mcx16 28200@opindex mcx16 28201This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit 28202code to implement compare-and-exchange operations on 16-byte aligned 128-bit 28203objects. This is useful for atomic updates of data structures exceeding one 28204machine word in size. The compiler uses this instruction to implement 28205@ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on 28206128-bit integers, a library call is always used. 28207 28208@item -msahf 28209@opindex msahf 28210This option enables generation of @code{SAHF} instructions in 64-bit code. 28211Early Intel Pentium 4 CPUs with Intel 64 support, 28212prior to the introduction of Pentium 4 G1 step in December 2005, 28213lacked the @code{LAHF} and @code{SAHF} instructions 28214which are supported by AMD64. 28215These are load and store instructions, respectively, for certain status flags. 28216In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 28217@code{drem}, and @code{remainder} built-in functions; 28218see @ref{Other Builtins} for details. 28219 28220@item -mmovbe 28221@opindex mmovbe 28222This option enables use of the @code{movbe} instruction to implement 28223@code{__builtin_bswap32} and @code{__builtin_bswap64}. 28224 28225@item -mshstk 28226@opindex mshstk 28227The @option{-mshstk} option enables shadow stack built-in functions 28228from x86 Control-flow Enforcement Technology (CET). 28229 28230@item -mcrc32 28231@opindex mcrc32 28232This option enables built-in functions @code{__builtin_ia32_crc32qi}, 28233@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 28234@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 28235 28236@item -mrecip 28237@opindex mrecip 28238This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 28239(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 28240with an additional Newton-Raphson step 28241to increase precision instead of @code{DIVSS} and @code{SQRTSS} 28242(and their vectorized 28243variants) for single-precision floating-point arguments. These instructions 28244are generated only when @option{-funsafe-math-optimizations} is enabled 28245together with @option{-ffinite-math-only} and @option{-fno-trapping-math}. 28246Note that while the throughput of the sequence is higher than the throughput 28247of the non-reciprocal instruction, the precision of the sequence can be 28248decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994). 28249 28250Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 28251(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 28252combination), and doesn't need @option{-mrecip}. 28253 28254Also note that GCC emits the above sequence with additional Newton-Raphson step 28255for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 28256already with @option{-ffast-math} (or the above option combination), and 28257doesn't need @option{-mrecip}. 28258 28259@item -mrecip=@var{opt} 28260@opindex mrecip=opt 28261This option controls which reciprocal estimate instructions 28262may be used. @var{opt} is a comma-separated list of options, which may 28263be preceded by a @samp{!} to invert the option: 28264 28265@table @samp 28266@item all 28267Enable all estimate instructions. 28268 28269@item default 28270Enable the default instructions, equivalent to @option{-mrecip}. 28271 28272@item none 28273Disable all estimate instructions, equivalent to @option{-mno-recip}. 28274 28275@item div 28276Enable the approximation for scalar division. 28277 28278@item vec-div 28279Enable the approximation for vectorized division. 28280 28281@item sqrt 28282Enable the approximation for scalar square root. 28283 28284@item vec-sqrt 28285Enable the approximation for vectorized square root. 28286@end table 28287 28288So, for example, @option{-mrecip=all,!sqrt} enables 28289all of the reciprocal approximations, except for square root. 28290 28291@item -mveclibabi=@var{type} 28292@opindex mveclibabi 28293Specifies the ABI type to use for vectorizing intrinsics using an 28294external library. Supported values for @var{type} are @samp{svml} 28295for the Intel short 28296vector math library and @samp{acml} for the AMD math core library. 28297To use this option, both @option{-ftree-vectorize} and 28298@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 28299ABI-compatible library must be specified at link time. 28300 28301GCC currently emits calls to @code{vmldExp2}, 28302@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2}, 28303@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 28304@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 28305@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 28306@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, 28307@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 28308@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 28309@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 28310@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 28311function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 28312@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 28313@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 28314@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 28315@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 28316when @option{-mveclibabi=acml} is used. 28317 28318@item -mabi=@var{name} 28319@opindex mabi 28320Generate code for the specified calling convention. Permissible values 28321are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 28322@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 28323ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 28324You can control this behavior for specific functions by 28325using the function attributes @code{ms_abi} and @code{sysv_abi}. 28326@xref{Function Attributes}. 28327 28328@item -mforce-indirect-call 28329@opindex mforce-indirect-call 28330Force all calls to functions to be indirect. This is useful 28331when using Intel Processor Trace where it generates more precise timing 28332information for function calls. 28333 28334@item -mmanual-endbr 28335@opindex mmanual-endbr 28336Insert ENDBR instruction at function entry only via the @code{cf_check} 28337function attribute. This is useful when used with the option 28338@option{-fcf-protection=branch} to control ENDBR insertion at the 28339function entry. 28340 28341@item -mcall-ms2sysv-xlogues 28342@opindex mcall-ms2sysv-xlogues 28343@opindex mno-call-ms2sysv-xlogues 28344Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a 28345System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By 28346default, the code for saving and restoring these registers is emitted inline, 28347resulting in fairly lengthy prologues and epilogues. Using 28348@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that 28349use stubs in the static portion of libgcc to perform these saves and restores, 28350thus reducing function size at the cost of a few extra instructions. 28351 28352@item -mtls-dialect=@var{type} 28353@opindex mtls-dialect 28354Generate code to access thread-local storage using the @samp{gnu} or 28355@samp{gnu2} conventions. @samp{gnu} is the conservative default; 28356@samp{gnu2} is more efficient, but it may add compile- and run-time 28357requirements that cannot be satisfied on all systems. 28358 28359@item -mpush-args 28360@itemx -mno-push-args 28361@opindex mpush-args 28362@opindex mno-push-args 28363Use PUSH operations to store outgoing parameters. This method is shorter 28364and usually equally fast as method using SUB/MOV operations and is enabled 28365by default. In some cases disabling it may improve performance because of 28366improved scheduling and reduced dependencies. 28367 28368@item -maccumulate-outgoing-args 28369@opindex maccumulate-outgoing-args 28370If enabled, the maximum amount of space required for outgoing arguments is 28371computed in the function prologue. This is faster on most modern CPUs 28372because of reduced dependencies, improved scheduling and reduced stack usage 28373when the preferred stack boundary is not equal to 2. The drawback is a notable 28374increase in code size. This switch implies @option{-mno-push-args}. 28375 28376@item -mthreads 28377@opindex mthreads 28378Support thread-safe exception handling on MinGW. Programs that rely 28379on thread-safe exception handling must compile and link all code with the 28380@option{-mthreads} option. When compiling, @option{-mthreads} defines 28381@option{-D_MT}; when linking, it links in a special thread helper library 28382@option{-lmingwthrd} which cleans up per-thread exception-handling data. 28383 28384@item -mms-bitfields 28385@itemx -mno-ms-bitfields 28386@opindex mms-bitfields 28387@opindex mno-ms-bitfields 28388 28389Enable/disable bit-field layout compatible with the native Microsoft 28390Windows compiler. 28391 28392If @code{packed} is used on a structure, or if bit-fields are used, 28393it may be that the Microsoft ABI lays out the structure differently 28394than the way GCC normally does. Particularly when moving packed 28395data between functions compiled with GCC and the native Microsoft compiler 28396(either via function call or as data in a file), it may be necessary to access 28397either format. 28398 28399This option is enabled by default for Microsoft Windows 28400targets. This behavior can also be controlled locally by use of variable 28401or type attributes. For more information, see @ref{x86 Variable Attributes} 28402and @ref{x86 Type Attributes}. 28403 28404The Microsoft structure layout algorithm is fairly simple with the exception 28405of the bit-field packing. 28406The padding and alignment of members of structures and whether a bit-field 28407can straddle a storage-unit boundary are determine by these rules: 28408 28409@enumerate 28410@item Structure members are stored sequentially in the order in which they are 28411declared: the first member has the lowest memory address and the last member 28412the highest. 28413 28414@item Every data object has an alignment requirement. The alignment requirement 28415for all data except structures, unions, and arrays is either the size of the 28416object or the current packing size (specified with either the 28417@code{aligned} attribute or the @code{pack} pragma), 28418whichever is less. For structures, unions, and arrays, 28419the alignment requirement is the largest alignment requirement of its members. 28420Every object is allocated an offset so that: 28421 28422@smallexample 28423offset % alignment_requirement == 0 28424@end smallexample 28425 28426@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation 28427unit if the integral types are the same size and if the next bit-field fits 28428into the current allocation unit without crossing the boundary imposed by the 28429common alignment requirements of the bit-fields. 28430@end enumerate 28431 28432MSVC interprets zero-length bit-fields in the following ways: 28433 28434@enumerate 28435@item If a zero-length bit-field is inserted between two bit-fields that 28436are normally coalesced, the bit-fields are not coalesced. 28437 28438For example: 28439 28440@smallexample 28441struct 28442 @{ 28443 unsigned long bf_1 : 12; 28444 unsigned long : 0; 28445 unsigned long bf_2 : 12; 28446 @} t1; 28447@end smallexample 28448 28449@noindent 28450The size of @code{t1} is 8 bytes with the zero-length bit-field. If the 28451zero-length bit-field were removed, @code{t1}'s size would be 4 bytes. 28452 28453@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the 28454alignment of the zero-length bit-field is greater than the member that follows it, 28455@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field. 28456 28457For example: 28458 28459@smallexample 28460struct 28461 @{ 28462 char foo : 4; 28463 short : 0; 28464 char bar; 28465 @} t2; 28466 28467struct 28468 @{ 28469 char foo : 4; 28470 short : 0; 28471 double bar; 28472 @} t3; 28473@end smallexample 28474 28475@noindent 28476For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1. 28477Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length 28478bit-field does not affect the alignment of @code{bar} or, as a result, the size 28479of the structure. 28480 28481Taking this into account, it is important to note the following: 28482 28483@enumerate 28484@item If a zero-length bit-field follows a normal bit-field, the type of the 28485zero-length bit-field may affect the alignment of the structure as whole. For 28486example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a 28487normal bit-field, and is of type short. 28488 28489@item Even if a zero-length bit-field is not followed by a normal bit-field, it may 28490still affect the alignment of the structure: 28491 28492@smallexample 28493struct 28494 @{ 28495 char foo : 6; 28496 long : 0; 28497 @} t4; 28498@end smallexample 28499 28500@noindent 28501Here, @code{t4} takes up 4 bytes. 28502@end enumerate 28503 28504@item Zero-length bit-fields following non-bit-field members are ignored: 28505 28506@smallexample 28507struct 28508 @{ 28509 char foo; 28510 long : 0; 28511 char bar; 28512 @} t5; 28513@end smallexample 28514 28515@noindent 28516Here, @code{t5} takes up 2 bytes. 28517@end enumerate 28518 28519 28520@item -mno-align-stringops 28521@opindex mno-align-stringops 28522@opindex malign-stringops 28523Do not align the destination of inlined string operations. This switch reduces 28524code size and improves performance in case the destination is already aligned, 28525but GCC doesn't know about it. 28526 28527@item -minline-all-stringops 28528@opindex minline-all-stringops 28529By default GCC inlines string operations only when the destination is 28530known to be aligned to least a 4-byte boundary. 28531This enables more inlining and increases code 28532size, but may improve performance of code that depends on fast 28533@code{memcpy}, @code{strlen}, 28534and @code{memset} for short lengths. 28535 28536@item -minline-stringops-dynamically 28537@opindex minline-stringops-dynamically 28538For string operations of unknown size, use run-time checks with 28539inline code for small blocks and a library call for large blocks. 28540 28541@item -mstringop-strategy=@var{alg} 28542@opindex mstringop-strategy=@var{alg} 28543Override the internal decision heuristic for the particular algorithm to use 28544for inlining string operations. The allowed values for @var{alg} are: 28545 28546@table @samp 28547@item rep_byte 28548@itemx rep_4byte 28549@itemx rep_8byte 28550Expand using i386 @code{rep} prefix of the specified size. 28551 28552@item byte_loop 28553@itemx loop 28554@itemx unrolled_loop 28555Expand into an inline loop. 28556 28557@item libcall 28558Always use a library call. 28559@end table 28560 28561@item -mmemcpy-strategy=@var{strategy} 28562@opindex mmemcpy-strategy=@var{strategy} 28563Override the internal decision heuristic to decide if @code{__builtin_memcpy} 28564should be inlined and what inline algorithm to use when the expected size 28565of the copy operation is known. @var{strategy} 28566is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 28567@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 28568the max byte size with which inline algorithm @var{alg} is allowed. For the last 28569triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 28570in the list must be specified in increasing order. The minimal byte size for 28571@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 28572preceding range. 28573 28574@item -mmemset-strategy=@var{strategy} 28575@opindex mmemset-strategy=@var{strategy} 28576The option is similar to @option{-mmemcpy-strategy=} except that it is to control 28577@code{__builtin_memset} expansion. 28578 28579@item -momit-leaf-frame-pointer 28580@opindex momit-leaf-frame-pointer 28581Don't keep the frame pointer in a register for leaf functions. This 28582avoids the instructions to save, set up, and restore frame pointers and 28583makes an extra register available in leaf functions. The option 28584@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 28585which might make debugging harder. 28586 28587@item -mtls-direct-seg-refs 28588@itemx -mno-tls-direct-seg-refs 28589@opindex mtls-direct-seg-refs 28590Controls whether TLS variables may be accessed with offsets from the 28591TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 28592or whether the thread base pointer must be added. Whether or not this 28593is valid depends on the operating system, and whether it maps the 28594segment to cover the entire TLS area. 28595 28596For systems that use the GNU C Library, the default is on. 28597 28598@item -msse2avx 28599@itemx -mno-sse2avx 28600@opindex msse2avx 28601Specify that the assembler should encode SSE instructions with VEX 28602prefix. The option @option{-mavx} turns this on by default. 28603 28604@item -mfentry 28605@itemx -mno-fentry 28606@opindex mfentry 28607If profiling is active (@option{-pg}), put the profiling 28608counter call before the prologue. 28609Note: On x86 architectures the attribute @code{ms_hook_prologue} 28610isn't possible at the moment for @option{-mfentry} and @option{-pg}. 28611 28612@item -mrecord-mcount 28613@itemx -mno-record-mcount 28614@opindex mrecord-mcount 28615If profiling is active (@option{-pg}), generate a __mcount_loc section 28616that contains pointers to each profiling call. This is useful for 28617automatically patching and out calls. 28618 28619@item -mnop-mcount 28620@itemx -mno-nop-mcount 28621@opindex mnop-mcount 28622If profiling is active (@option{-pg}), generate the calls to 28623the profiling functions as NOPs. This is useful when they 28624should be patched in later dynamically. This is likely only 28625useful together with @option{-mrecord-mcount}. 28626 28627@item -minstrument-return=@var{type} 28628@opindex minstrument-return 28629Instrument function exit in -pg -mfentry instrumented functions with 28630call to specified function. This only instruments true returns ending 28631with ret, but not sibling calls ending with jump. Valid types 28632are @var{none} to not instrument, @var{call} to generate a call to __return__, 28633or @var{nop5} to generate a 5 byte nop. 28634 28635@item -mrecord-return 28636@itemx -mno-record-return 28637@opindex mrecord-return 28638Generate a __return_loc section pointing to all return instrumentation code. 28639 28640@item -mfentry-name=@var{name} 28641@opindex mfentry-name 28642Set name of __fentry__ symbol called at function entry for -pg -mfentry functions. 28643 28644@item -mfentry-section=@var{name} 28645@opindex mfentry-section 28646Set name of section to record -mrecord-mcount calls (default __mcount_loc). 28647 28648@item -mskip-rax-setup 28649@itemx -mno-skip-rax-setup 28650@opindex mskip-rax-setup 28651When generating code for the x86-64 architecture with SSE extensions 28652disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 28653register when there are no variable arguments passed in vector registers. 28654 28655@strong{Warning:} Since RAX register is used to avoid unnecessarily 28656saving vector registers on stack when passing variable arguments, the 28657impacts of this option are callees may waste some stack space, 28658misbehave or jump to a random location. GCC 4.4 or newer don't have 28659those issues, regardless the RAX register value. 28660 28661@item -m8bit-idiv 28662@itemx -mno-8bit-idiv 28663@opindex m8bit-idiv 28664On some processors, like Intel Atom, 8-bit unsigned integer divide is 28665much faster than 32-bit/64-bit integer divide. This option generates a 28666run-time check. If both dividend and divisor are within range of 0 28667to 255, 8-bit unsigned integer divide is used instead of 2866832-bit/64-bit integer divide. 28669 28670@item -mavx256-split-unaligned-load 28671@itemx -mavx256-split-unaligned-store 28672@opindex mavx256-split-unaligned-load 28673@opindex mavx256-split-unaligned-store 28674Split 32-byte AVX unaligned load and store. 28675 28676@item -mstack-protector-guard=@var{guard} 28677@itemx -mstack-protector-guard-reg=@var{reg} 28678@itemx -mstack-protector-guard-offset=@var{offset} 28679@opindex mstack-protector-guard 28680@opindex mstack-protector-guard-reg 28681@opindex mstack-protector-guard-offset 28682Generate stack protection code using canary at @var{guard}. Supported 28683locations are @samp{global} for global canary or @samp{tls} for per-thread 28684canary in the TLS block (the default). This option has effect only when 28685@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 28686 28687With the latter choice the options 28688@option{-mstack-protector-guard-reg=@var{reg}} and 28689@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 28690which segment register (@code{%fs} or @code{%gs}) to use as base register 28691for reading the canary, and from what offset from that base register. 28692The default for those is as specified in the relevant ABI. 28693 28694@item -mgeneral-regs-only 28695@opindex mgeneral-regs-only 28696Generate code that uses only the general-purpose registers. This 28697prevents the compiler from using floating-point, vector, mask and bound 28698registers. 28699 28700@item -mindirect-branch=@var{choice} 28701@opindex mindirect-branch 28702Convert indirect call and jump with @var{choice}. The default is 28703@samp{keep}, which keeps indirect call and jump unmodified. 28704@samp{thunk} converts indirect call and jump to call and return thunk. 28705@samp{thunk-inline} converts indirect call and jump to inlined call 28706and return thunk. @samp{thunk-extern} converts indirect call and jump 28707to external call and return thunk provided in a separate object file. 28708You can control this behavior for a specific function by using the 28709function attribute @code{indirect_branch}. @xref{Function Attributes}. 28710 28711Note that @option{-mcmodel=large} is incompatible with 28712@option{-mindirect-branch=thunk} and 28713@option{-mindirect-branch=thunk-extern} since the thunk function may 28714not be reachable in the large code model. 28715 28716Note that @option{-mindirect-branch=thunk-extern} is incompatible with 28717@option{-fcf-protection=branch} since the external thunk cannot be modified 28718to disable control-flow check. 28719 28720@item -mfunction-return=@var{choice} 28721@opindex mfunction-return 28722Convert function return with @var{choice}. The default is @samp{keep}, 28723which keeps function return unmodified. @samp{thunk} converts function 28724return to call and return thunk. @samp{thunk-inline} converts function 28725return to inlined call and return thunk. @samp{thunk-extern} converts 28726function return to external call and return thunk provided in a separate 28727object file. You can control this behavior for a specific function by 28728using the function attribute @code{function_return}. 28729@xref{Function Attributes}. 28730 28731Note that @option{-mcmodel=large} is incompatible with 28732@option{-mfunction-return=thunk} and 28733@option{-mfunction-return=thunk-extern} since the thunk function may 28734not be reachable in the large code model. 28735 28736 28737@item -mindirect-branch-register 28738@opindex mindirect-branch-register 28739Force indirect call and jump via register. 28740 28741@end table 28742 28743These @samp{-m} switches are supported in addition to the above 28744on x86-64 processors in 64-bit environments. 28745 28746@table @gcctabopt 28747@item -m32 28748@itemx -m64 28749@itemx -mx32 28750@itemx -m16 28751@itemx -miamcu 28752@opindex m32 28753@opindex m64 28754@opindex mx32 28755@opindex m16 28756@opindex miamcu 28757Generate code for a 16-bit, 32-bit or 64-bit environment. 28758The @option{-m32} option sets @code{int}, @code{long}, and pointer types 28759to 32 bits, and 28760generates code that runs on any i386 system. 28761 28762The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 28763types to 64 bits, and generates code for the x86-64 architecture. 28764For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 28765and @option{-mdynamic-no-pic} options. 28766 28767The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 28768to 32 bits, and 28769generates code for the x86-64 architecture. 28770 28771The @option{-m16} option is the same as @option{-m32}, except for that 28772it outputs the @code{.code16gcc} assembly directive at the beginning of 28773the assembly output so that the binary can run in 16-bit mode. 28774 28775The @option{-miamcu} option generates code which conforms to Intel MCU 28776psABI. It requires the @option{-m32} option to be turned on. 28777 28778@item -mno-red-zone 28779@opindex mno-red-zone 28780@opindex mred-zone 28781Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 28782by the x86-64 ABI; it is a 128-byte area beyond the location of the 28783stack pointer that is not modified by signal or interrupt handlers 28784and therefore can be used for temporary data without adjusting the stack 28785pointer. The flag @option{-mno-red-zone} disables this red zone. 28786 28787@item -mcmodel=small 28788@opindex mcmodel=small 28789Generate code for the small code model: the program and its symbols must 28790be linked in the lower 2 GB of the address space. Pointers are 64 bits. 28791Programs can be statically or dynamically linked. This is the default 28792code model. 28793 28794@item -mcmodel=kernel 28795@opindex mcmodel=kernel 28796Generate code for the kernel code model. The kernel runs in the 28797negative 2 GB of the address space. 28798This model has to be used for Linux kernel code. 28799 28800@item -mcmodel=medium 28801@opindex mcmodel=medium 28802Generate code for the medium model: the program is linked in the lower 2 28803GB of the address space. Small symbols are also placed there. Symbols 28804with sizes larger than @option{-mlarge-data-threshold} are put into 28805large data or BSS sections and can be located above 2GB. Programs can 28806be statically or dynamically linked. 28807 28808@item -mcmodel=large 28809@opindex mcmodel=large 28810Generate code for the large model. This model makes no assumptions 28811about addresses and sizes of sections. 28812 28813@item -maddress-mode=long 28814@opindex maddress-mode=long 28815Generate code for long address mode. This is only supported for 64-bit 28816and x32 environments. It is the default address mode for 64-bit 28817environments. 28818 28819@item -maddress-mode=short 28820@opindex maddress-mode=short 28821Generate code for short address mode. This is only supported for 32-bit 28822and x32 environments. It is the default address mode for 32-bit and 28823x32 environments. 28824@end table 28825 28826@node x86 Windows Options 28827@subsection x86 Windows Options 28828@cindex x86 Windows Options 28829@cindex Windows Options for x86 28830 28831These additional options are available for Microsoft Windows targets: 28832 28833@table @gcctabopt 28834@item -mconsole 28835@opindex mconsole 28836This option 28837specifies that a console application is to be generated, by 28838instructing the linker to set the PE header subsystem type 28839required for console applications. 28840This option is available for Cygwin and MinGW targets and is 28841enabled by default on those targets. 28842 28843@item -mdll 28844@opindex mdll 28845This option is available for Cygwin and MinGW targets. It 28846specifies that a DLL---a dynamic link library---is to be 28847generated, enabling the selection of the required runtime 28848startup object and entry point. 28849 28850@item -mnop-fun-dllimport 28851@opindex mnop-fun-dllimport 28852This option is available for Cygwin and MinGW targets. It 28853specifies that the @code{dllimport} attribute should be ignored. 28854 28855@item -mthread 28856@opindex mthread 28857This option is available for MinGW targets. It specifies 28858that MinGW-specific thread support is to be used. 28859 28860@item -municode 28861@opindex municode 28862This option is available for MinGW-w64 targets. It causes 28863the @code{UNICODE} preprocessor macro to be predefined, and 28864chooses Unicode-capable runtime startup code. 28865 28866@item -mwin32 28867@opindex mwin32 28868This option is available for Cygwin and MinGW targets. It 28869specifies that the typical Microsoft Windows predefined macros are to 28870be set in the pre-processor, but does not influence the choice 28871of runtime library/startup code. 28872 28873@item -mwindows 28874@opindex mwindows 28875This option is available for Cygwin and MinGW targets. It 28876specifies that a GUI application is to be generated by 28877instructing the linker to set the PE header subsystem type 28878appropriately. 28879 28880@item -fno-set-stack-executable 28881@opindex fno-set-stack-executable 28882@opindex fset-stack-executable 28883This option is available for MinGW targets. It specifies that 28884the executable flag for the stack used by nested functions isn't 28885set. This is necessary for binaries running in kernel mode of 28886Microsoft Windows, as there the User32 API, which is used to set executable 28887privileges, isn't available. 28888 28889@item -fwritable-relocated-rdata 28890@opindex fno-writable-relocated-rdata 28891@opindex fwritable-relocated-rdata 28892This option is available for MinGW and Cygwin targets. It specifies 28893that relocated-data in read-only section is put into the @code{.data} 28894section. This is a necessary for older runtimes not supporting 28895modification of @code{.rdata} sections for pseudo-relocation. 28896 28897@item -mpe-aligned-commons 28898@opindex mpe-aligned-commons 28899This option is available for Cygwin and MinGW targets. It 28900specifies that the GNU extension to the PE file format that 28901permits the correct alignment of COMMON variables should be 28902used when generating code. It is enabled by default if 28903GCC detects that the target assembler found during configuration 28904supports the feature. 28905 28906@item -mindirect-branch=@var{choice} 28907@opindex -mindirect-branch 28908Convert indirect call and jump with @var{choice}. The default is 28909@samp{keep}, which keeps indirect call and jump unmodified. 28910@samp{thunk} converts indirect call and jump to call and return thunk. 28911@samp{thunk-inline} converts indirect call and jump to inlined call 28912and return thunk. @samp{thunk-extern} converts indirect call and jump 28913to external call and return thunk provided in a separate object file. 28914You can control this behavior for a specific function by using the 28915function attribute @code{indirect_branch}. @xref{Function Attributes}. 28916 28917Note that @option{-mcmodel=large} is incompatible with 28918@option{-mindirect-branch=thunk} nor 28919@option{-mindirect-branch=thunk-extern} since the thunk function may 28920not be reachable in large code model. 28921 28922@item -mfunction-return=@var{choice} 28923@opindex -mfunction-return 28924Convert function return with @var{choice}. The default is @samp{keep}, 28925which keeps function return unmodified. @samp{thunk} converts function 28926return to call and return thunk. @samp{thunk-inline} converts function 28927return to inlined call and return thunk. @samp{thunk-extern} converts 28928function return to external call and return thunk provided in a separate 28929object file. You can control this behavior for a specific function by 28930using the function attribute @code{function_return}. 28931@xref{Function Attributes}. 28932 28933Note that @option{-mcmodel=large} is incompatible with 28934@option{-mfunction-return=thunk} nor 28935@option{-mfunction-return=thunk-extern} since the thunk function may 28936not be reachable in large code model. 28937 28938@item -mindirect-branch-register 28939@opindex -mindirect-branch-register 28940Force indirect call and jump via register. 28941@end table 28942 28943See also under @ref{x86 Options} for standard options. 28944 28945@node Xstormy16 Options 28946@subsection Xstormy16 Options 28947@cindex Xstormy16 Options 28948 28949These options are defined for Xstormy16: 28950 28951@table @gcctabopt 28952@item -msim 28953@opindex msim 28954Choose startup files and linker script suitable for the simulator. 28955@end table 28956 28957@node Xtensa Options 28958@subsection Xtensa Options 28959@cindex Xtensa Options 28960 28961These options are supported for Xtensa targets: 28962 28963@table @gcctabopt 28964@item -mconst16 28965@itemx -mno-const16 28966@opindex mconst16 28967@opindex mno-const16 28968Enable or disable use of @code{CONST16} instructions for loading 28969constant values. The @code{CONST16} instruction is currently not a 28970standard option from Tensilica. When enabled, @code{CONST16} 28971instructions are always used in place of the standard @code{L32R} 28972instructions. The use of @code{CONST16} is enabled by default only if 28973the @code{L32R} instruction is not available. 28974 28975@item -mfused-madd 28976@itemx -mno-fused-madd 28977@opindex mfused-madd 28978@opindex mno-fused-madd 28979Enable or disable use of fused multiply/add and multiply/subtract 28980instructions in the floating-point option. This has no effect if the 28981floating-point option is not also enabled. Disabling fused multiply/add 28982and multiply/subtract instructions forces the compiler to use separate 28983instructions for the multiply and add/subtract operations. This may be 28984desirable in some cases where strict IEEE 754-compliant results are 28985required: the fused multiply add/subtract instructions do not round the 28986intermediate result, thereby producing results with @emph{more} bits of 28987precision than specified by the IEEE standard. Disabling fused multiply 28988add/subtract instructions also ensures that the program output is not 28989sensitive to the compiler's ability to combine multiply and add/subtract 28990operations. 28991 28992@item -mserialize-volatile 28993@itemx -mno-serialize-volatile 28994@opindex mserialize-volatile 28995@opindex mno-serialize-volatile 28996When this option is enabled, GCC inserts @code{MEMW} instructions before 28997@code{volatile} memory references to guarantee sequential consistency. 28998The default is @option{-mserialize-volatile}. Use 28999@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 29000 29001@item -mforce-no-pic 29002@opindex mforce-no-pic 29003For targets, like GNU/Linux, where all user-mode Xtensa code must be 29004position-independent code (PIC), this option disables PIC for compiling 29005kernel code. 29006 29007@item -mtext-section-literals 29008@itemx -mno-text-section-literals 29009@opindex mtext-section-literals 29010@opindex mno-text-section-literals 29011These options control the treatment of literal pools. The default is 29012@option{-mno-text-section-literals}, which places literals in a separate 29013section in the output file. This allows the literal pool to be placed 29014in a data RAM/ROM, and it also allows the linker to combine literal 29015pools from separate object files to remove redundant literals and 29016improve code size. With @option{-mtext-section-literals}, the literals 29017are interspersed in the text section in order to keep them as close as 29018possible to their references. This may be necessary for large assembly 29019files. Literals for each function are placed right before that function. 29020 29021@item -mauto-litpools 29022@itemx -mno-auto-litpools 29023@opindex mauto-litpools 29024@opindex mno-auto-litpools 29025These options control the treatment of literal pools. The default is 29026@option{-mno-auto-litpools}, which places literals in a separate 29027section in the output file unless @option{-mtext-section-literals} is 29028used. With @option{-mauto-litpools} the literals are interspersed in 29029the text section by the assembler. Compiler does not produce explicit 29030@code{.literal} directives and loads literals into registers with 29031@code{MOVI} instructions instead of @code{L32R} to let the assembler 29032do relaxation and place literals as necessary. This option allows 29033assembler to create several literal pools per function and assemble 29034very big functions, which may not be possible with 29035@option{-mtext-section-literals}. 29036 29037@item -mtarget-align 29038@itemx -mno-target-align 29039@opindex mtarget-align 29040@opindex mno-target-align 29041When this option is enabled, GCC instructs the assembler to 29042automatically align instructions to reduce branch penalties at the 29043expense of some code density. The assembler attempts to widen density 29044instructions to align branch targets and the instructions following call 29045instructions. If there are not enough preceding safe density 29046instructions to align a target, no widening is performed. The 29047default is @option{-mtarget-align}. These options do not affect the 29048treatment of auto-aligned instructions like @code{LOOP}, which the 29049assembler always aligns, either by widening density instructions or 29050by inserting NOP instructions. 29051 29052@item -mlongcalls 29053@itemx -mno-longcalls 29054@opindex mlongcalls 29055@opindex mno-longcalls 29056When this option is enabled, GCC instructs the assembler to translate 29057direct calls to indirect calls unless it can determine that the target 29058of a direct call is in the range allowed by the call instruction. This 29059translation typically occurs for calls to functions in other source 29060files. Specifically, the assembler translates a direct @code{CALL} 29061instruction into an @code{L32R} followed by a @code{CALLX} instruction. 29062The default is @option{-mno-longcalls}. This option should be used in 29063programs where the call target can potentially be out of range. This 29064option is implemented in the assembler, not the compiler, so the 29065assembly code generated by GCC still shows direct call 29066instructions---look at the disassembled object code to see the actual 29067instructions. Note that the assembler uses an indirect call for 29068every cross-file call, not just those that really are out of range. 29069@end table 29070 29071@node zSeries Options 29072@subsection zSeries Options 29073@cindex zSeries options 29074 29075These are listed under @xref{S/390 and zSeries Options}. 29076 29077 29078@c man end 29079 29080@node Spec Files 29081@section Specifying Subprocesses and the Switches to Pass to Them 29082@cindex Spec Files 29083 29084@command{gcc} is a driver program. It performs its job by invoking a 29085sequence of other programs to do the work of compiling, assembling and 29086linking. GCC interprets its command-line parameters and uses these to 29087deduce which programs it should invoke, and which command-line options 29088it ought to place on their command lines. This behavior is controlled 29089by @dfn{spec strings}. In most cases there is one spec string for each 29090program that GCC can invoke, but a few programs have multiple spec 29091strings to control their behavior. The spec strings built into GCC can 29092be overridden by using the @option{-specs=} command-line switch to specify 29093a spec file. 29094 29095@dfn{Spec files} are plain-text files that are used to construct spec 29096strings. They consist of a sequence of directives separated by blank 29097lines. The type of directive is determined by the first non-whitespace 29098character on the line, which can be one of the following: 29099 29100@table @code 29101@item %@var{command} 29102Issues a @var{command} to the spec file processor. The commands that can 29103appear here are: 29104 29105@table @code 29106@item %include <@var{file}> 29107@cindex @code{%include} 29108Search for @var{file} and insert its text at the current point in the 29109specs file. 29110 29111@item %include_noerr <@var{file}> 29112@cindex @code{%include_noerr} 29113Just like @samp{%include}, but do not generate an error message if the include 29114file cannot be found. 29115 29116@item %rename @var{old_name} @var{new_name} 29117@cindex @code{%rename} 29118Rename the spec string @var{old_name} to @var{new_name}. 29119 29120@end table 29121 29122@item *[@var{spec_name}]: 29123This tells the compiler to create, override or delete the named spec 29124string. All lines after this directive up to the next directive or 29125blank line are considered to be the text for the spec string. If this 29126results in an empty string then the spec is deleted. (Or, if the 29127spec did not exist, then nothing happens.) Otherwise, if the spec 29128does not currently exist a new spec is created. If the spec does 29129exist then its contents are overridden by the text of this 29130directive, unless the first character of that text is the @samp{+} 29131character, in which case the text is appended to the spec. 29132 29133@item [@var{suffix}]: 29134Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 29135and up to the next directive or blank line are considered to make up the 29136spec string for the indicated suffix. When the compiler encounters an 29137input file with the named suffix, it processes the spec string in 29138order to work out how to compile that file. For example: 29139 29140@smallexample 29141.ZZ: 29142z-compile -input %i 29143@end smallexample 29144 29145This says that any input file whose name ends in @samp{.ZZ} should be 29146passed to the program @samp{z-compile}, which should be invoked with the 29147command-line switch @option{-input} and with the result of performing the 29148@samp{%i} substitution. (See below.) 29149 29150As an alternative to providing a spec string, the text following a 29151suffix directive can be one of the following: 29152 29153@table @code 29154@item @@@var{language} 29155This says that the suffix is an alias for a known @var{language}. This is 29156similar to using the @option{-x} command-line switch to GCC to specify a 29157language explicitly. For example: 29158 29159@smallexample 29160.ZZ: 29161@@c++ 29162@end smallexample 29163 29164Says that .ZZ files are, in fact, C++ source files. 29165 29166@item #@var{name} 29167This causes an error messages saying: 29168 29169@smallexample 29170@var{name} compiler not installed on this system. 29171@end smallexample 29172@end table 29173 29174GCC already has an extensive list of suffixes built into it. 29175This directive adds an entry to the end of the list of suffixes, but 29176since the list is searched from the end backwards, it is effectively 29177possible to override earlier entries using this technique. 29178 29179@end table 29180 29181GCC has the following spec strings built into it. Spec files can 29182override these strings or create their own. Note that individual 29183targets can also add their own spec strings to this list. 29184 29185@smallexample 29186asm Options to pass to the assembler 29187asm_final Options to pass to the assembler post-processor 29188cpp Options to pass to the C preprocessor 29189cc1 Options to pass to the C compiler 29190cc1plus Options to pass to the C++ compiler 29191endfile Object files to include at the end of the link 29192link Options to pass to the linker 29193lib Libraries to include on the command line to the linker 29194libgcc Decides which GCC support library to pass to the linker 29195linker Sets the name of the linker 29196predefines Defines to be passed to the C preprocessor 29197signed_char Defines to pass to CPP to say whether @code{char} is signed 29198 by default 29199startfile Object files to include at the start of the link 29200@end smallexample 29201 29202Here is a small example of a spec file: 29203 29204@smallexample 29205%rename lib old_lib 29206 29207*lib: 29208--start-group -lgcc -lc -leval1 --end-group %(old_lib) 29209@end smallexample 29210 29211This example renames the spec called @samp{lib} to @samp{old_lib} and 29212then overrides the previous definition of @samp{lib} with a new one. 29213The new definition adds in some extra command-line options before 29214including the text of the old definition. 29215 29216@dfn{Spec strings} are a list of command-line options to be passed to their 29217corresponding program. In addition, the spec strings can contain 29218@samp{%}-prefixed sequences to substitute variable text or to 29219conditionally insert text into the command line. Using these constructs 29220it is possible to generate quite complex command lines. 29221 29222Here is a table of all defined @samp{%}-sequences for spec 29223strings. Note that spaces are not generated automatically around the 29224results of expanding these sequences. Therefore you can concatenate them 29225together or combine them with constant text in a single argument. 29226 29227@table @code 29228@item %% 29229Substitute one @samp{%} into the program name or argument. 29230 29231@item %i 29232Substitute the name of the input file being processed. 29233 29234@item %b 29235Substitute the basename of the input file being processed. 29236This is the substring up to (and not including) the last period 29237and not including the directory. 29238 29239@item %B 29240This is the same as @samp{%b}, but include the file suffix (text after 29241the last period). 29242 29243@item %d 29244Marks the argument containing or following the @samp{%d} as a 29245temporary file name, so that that file is deleted if GCC exits 29246successfully. Unlike @samp{%g}, this contributes no text to the 29247argument. 29248 29249@item %g@var{suffix} 29250Substitute a file name that has suffix @var{suffix} and is chosen 29251once per compilation, and mark the argument in the same way as 29252@samp{%d}. To reduce exposure to denial-of-service attacks, the file 29253name is now chosen in a way that is hard to predict even when previously 29254chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 29255might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 29256the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 29257treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 29258was simply substituted with a file name chosen once per compilation, 29259without regard to any appended suffix (which was therefore treated 29260just like ordinary text), making such attacks more likely to succeed. 29261 29262@item %u@var{suffix} 29263Like @samp{%g}, but generates a new temporary file name 29264each time it appears instead of once per compilation. 29265 29266@item %U@var{suffix} 29267Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 29268new one if there is no such last file name. In the absence of any 29269@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 29270the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 29271involves the generation of two distinct file names, one 29272for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 29273simply substituted with a file name chosen for the previous @samp{%u}, 29274without regard to any appended suffix. 29275 29276@item %j@var{suffix} 29277Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 29278writable, and if @option{-save-temps} is not used; 29279otherwise, substitute the name 29280of a temporary file, just like @samp{%u}. This temporary file is not 29281meant for communication between processes, but rather as a junk 29282disposal mechanism. 29283 29284@item %|@var{suffix} 29285@itemx %m@var{suffix} 29286Like @samp{%g}, except if @option{-pipe} is in effect. In that case 29287@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 29288all. These are the two most common ways to instruct a program that it 29289should read from standard input or write to standard output. If you 29290need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 29291construct: see for example @file{f/lang-specs.h}. 29292 29293@item %.@var{SUFFIX} 29294Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 29295when it is subsequently output with @samp{%*}. @var{SUFFIX} is 29296terminated by the next space or %. 29297 29298@item %w 29299Marks the argument containing or following the @samp{%w} as the 29300designated output file of this compilation. This puts the argument 29301into the sequence of arguments that @samp{%o} substitutes. 29302 29303@item %o 29304Substitutes the names of all the output files, with spaces 29305automatically placed around them. You should write spaces 29306around the @samp{%o} as well or the results are undefined. 29307@samp{%o} is for use in the specs for running the linker. 29308Input files whose names have no recognized suffix are not compiled 29309at all, but they are included among the output files, so they are 29310linked. 29311 29312@item %O 29313Substitutes the suffix for object files. Note that this is 29314handled specially when it immediately follows @samp{%g, %u, or %U}, 29315because of the need for those to form complete file names. The 29316handling is such that @samp{%O} is treated exactly as if it had already 29317been substituted, except that @samp{%g, %u, and %U} do not currently 29318support additional @var{suffix} characters following @samp{%O} as they do 29319following, for example, @samp{.o}. 29320 29321@item %p 29322Substitutes the standard macro predefinitions for the 29323current target machine. Use this when running @command{cpp}. 29324 29325@item %P 29326Like @samp{%p}, but puts @samp{__} before and after the name of each 29327predefined macro, except for macros that start with @samp{__} or with 29328@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 29329C@. 29330 29331@item %I 29332Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 29333@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 29334@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 29335and @option{-imultilib} as necessary. 29336 29337@item %s 29338Current argument is the name of a library or startup file of some sort. 29339Search for that file in a standard list of directories and substitute 29340the full name found. The current working directory is included in the 29341list of directories scanned. 29342 29343@item %T 29344Current argument is the name of a linker script. Search for that file 29345in the current list of directories to scan for libraries. If the file 29346is located insert a @option{--script} option into the command line 29347followed by the full path name found. If the file is not found then 29348generate an error message. Note: the current working directory is not 29349searched. 29350 29351@item %e@var{str} 29352Print @var{str} as an error message. @var{str} is terminated by a newline. 29353Use this when inconsistent options are detected. 29354 29355@item %(@var{name}) 29356Substitute the contents of spec string @var{name} at this point. 29357 29358@item %x@{@var{option}@} 29359Accumulate an option for @samp{%X}. 29360 29361@item %X 29362Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 29363spec string. 29364 29365@item %Y 29366Output the accumulated assembler options specified by @option{-Wa}. 29367 29368@item %Z 29369Output the accumulated preprocessor options specified by @option{-Wp}. 29370 29371@item %a 29372Process the @code{asm} spec. This is used to compute the 29373switches to be passed to the assembler. 29374 29375@item %A 29376Process the @code{asm_final} spec. This is a spec string for 29377passing switches to an assembler post-processor, if such a program is 29378needed. 29379 29380@item %l 29381Process the @code{link} spec. This is the spec for computing the 29382command line passed to the linker. Typically it makes use of the 29383@samp{%L %G %S %D and %E} sequences. 29384 29385@item %D 29386Dump out a @option{-L} option for each directory that GCC believes might 29387contain startup files. If the target supports multilibs then the 29388current multilib directory is prepended to each of these paths. 29389 29390@item %L 29391Process the @code{lib} spec. This is a spec string for deciding which 29392libraries are included on the command line to the linker. 29393 29394@item %G 29395Process the @code{libgcc} spec. This is a spec string for deciding 29396which GCC support library is included on the command line to the linker. 29397 29398@item %S 29399Process the @code{startfile} spec. This is a spec for deciding which 29400object files are the first ones passed to the linker. Typically 29401this might be a file named @file{crt0.o}. 29402 29403@item %E 29404Process the @code{endfile} spec. This is a spec string that specifies 29405the last object files that are passed to the linker. 29406 29407@item %C 29408Process the @code{cpp} spec. This is used to construct the arguments 29409to be passed to the C preprocessor. 29410 29411@item %1 29412Process the @code{cc1} spec. This is used to construct the options to be 29413passed to the actual C compiler (@command{cc1}). 29414 29415@item %2 29416Process the @code{cc1plus} spec. This is used to construct the options to be 29417passed to the actual C++ compiler (@command{cc1plus}). 29418 29419@item %* 29420Substitute the variable part of a matched option. See below. 29421Note that each comma in the substituted string is replaced by 29422a single space. 29423 29424@item %<S 29425Remove all occurrences of @code{-S} from the command line. Note---this 29426command is position dependent. @samp{%} commands in the spec string 29427before this one see @code{-S}, @samp{%} commands in the spec string 29428after this one do not. 29429 29430@item %:@var{function}(@var{args}) 29431Call the named function @var{function}, passing it @var{args}. 29432@var{args} is first processed as a nested spec string, then split 29433into an argument vector in the usual fashion. The function returns 29434a string which is processed as if it had appeared literally as part 29435of the current spec. 29436 29437The following built-in spec functions are provided: 29438 29439@table @code 29440@item @code{getenv} 29441The @code{getenv} spec function takes two arguments: an environment 29442variable name and a string. If the environment variable is not 29443defined, a fatal error is issued. Otherwise, the return value is the 29444value of the environment variable concatenated with the string. For 29445example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 29446 29447@smallexample 29448%:getenv(TOPDIR /include) 29449@end smallexample 29450 29451expands to @file{/path/to/top/include}. 29452 29453@item @code{if-exists} 29454The @code{if-exists} spec function takes one argument, an absolute 29455pathname to a file. If the file exists, @code{if-exists} returns the 29456pathname. Here is a small example of its usage: 29457 29458@smallexample 29459*startfile: 29460crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 29461@end smallexample 29462 29463@item @code{if-exists-else} 29464The @code{if-exists-else} spec function is similar to the @code{if-exists} 29465spec function, except that it takes two arguments. The first argument is 29466an absolute pathname to a file. If the file exists, @code{if-exists-else} 29467returns the pathname. If it does not exist, it returns the second argument. 29468This way, @code{if-exists-else} can be used to select one file or another, 29469based on the existence of the first. Here is a small example of its usage: 29470 29471@smallexample 29472*startfile: 29473crt0%O%s %:if-exists(crti%O%s) \ 29474%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 29475@end smallexample 29476 29477@item @code{replace-outfile} 29478The @code{replace-outfile} spec function takes two arguments. It looks for the 29479first argument in the outfiles array and replaces it with the second argument. Here 29480is a small example of its usage: 29481 29482@smallexample 29483%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 29484@end smallexample 29485 29486@item @code{remove-outfile} 29487The @code{remove-outfile} spec function takes one argument. It looks for the 29488first argument in the outfiles array and removes it. Here is a small example 29489its usage: 29490 29491@smallexample 29492%:remove-outfile(-lm) 29493@end smallexample 29494 29495@item @code{pass-through-libs} 29496The @code{pass-through-libs} spec function takes any number of arguments. It 29497finds any @option{-l} options and any non-options ending in @file{.a} (which it 29498assumes are the names of linker input library archive files) and returns a 29499result containing all the found arguments each prepended by 29500@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 29501intended to be passed to the LTO linker plugin. 29502 29503@smallexample 29504%:pass-through-libs(%G %L %G) 29505@end smallexample 29506 29507@item @code{print-asm-header} 29508The @code{print-asm-header} function takes no arguments and simply 29509prints a banner like: 29510 29511@smallexample 29512Assembler options 29513================= 29514 29515Use "-Wa,OPTION" to pass "OPTION" to the assembler. 29516@end smallexample 29517 29518It is used to separate compiler options from assembler options 29519in the @option{--target-help} output. 29520@end table 29521 29522@item %@{S@} 29523Substitutes the @code{-S} switch, if that switch is given to GCC@. 29524If that switch is not specified, this substitutes nothing. Note that 29525the leading dash is omitted when specifying this option, and it is 29526automatically inserted if the substitution is performed. Thus the spec 29527string @samp{%@{foo@}} matches the command-line option @option{-foo} 29528and outputs the command-line option @option{-foo}. 29529 29530@item %W@{S@} 29531Like %@{@code{S}@} but mark last argument supplied within as a file to be 29532deleted on failure. 29533 29534@item %@{S*@} 29535Substitutes all the switches specified to GCC whose names start 29536with @code{-S}, but which also take an argument. This is used for 29537switches like @option{-o}, @option{-D}, @option{-I}, etc. 29538GCC considers @option{-o foo} as being 29539one switch whose name starts with @samp{o}. %@{o*@} substitutes this 29540text, including the space. Thus two arguments are generated. 29541 29542@item %@{S*&T*@} 29543Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 29544(the order of @code{S} and @code{T} in the spec is not significant). 29545There can be any number of ampersand-separated variables; for each the 29546wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 29547 29548@item %@{S:X@} 29549Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 29550 29551@item %@{!S:X@} 29552Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 29553 29554@item %@{S*:X@} 29555Substitutes @code{X} if one or more switches whose names start with 29556@code{-S} are specified to GCC@. Normally @code{X} is substituted only 29557once, no matter how many such switches appeared. However, if @code{%*} 29558appears somewhere in @code{X}, then @code{X} is substituted once 29559for each matching switch, with the @code{%*} replaced by the part of 29560that switch matching the @code{*}. 29561 29562If @code{%*} appears as the last part of a spec sequence then a space 29563is added after the end of the last substitution. If there is more 29564text in the sequence, however, then a space is not generated. This 29565allows the @code{%*} substitution to be used as part of a larger 29566string. For example, a spec string like this: 29567 29568@smallexample 29569%@{mcu=*:--script=%*/memory.ld@} 29570@end smallexample 29571 29572@noindent 29573when matching an option like @option{-mcu=newchip} produces: 29574 29575@smallexample 29576--script=newchip/memory.ld 29577@end smallexample 29578 29579@item %@{.S:X@} 29580Substitutes @code{X}, if processing a file with suffix @code{S}. 29581 29582@item %@{!.S:X@} 29583Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 29584 29585@item %@{,S:X@} 29586Substitutes @code{X}, if processing a file for language @code{S}. 29587 29588@item %@{!,S:X@} 29589Substitutes @code{X}, if not processing a file for language @code{S}. 29590 29591@item %@{S|P:X@} 29592Substitutes @code{X} if either @code{-S} or @code{-P} is given to 29593GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 29594@code{*} sequences as well, although they have a stronger binding than 29595the @samp{|}. If @code{%*} appears in @code{X}, all of the 29596alternatives must be starred, and only the first matching alternative 29597is substituted. 29598 29599For example, a spec string like this: 29600 29601@smallexample 29602%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 29603@end smallexample 29604 29605@noindent 29606outputs the following command-line options from the following input 29607command-line options: 29608 29609@smallexample 29610fred.c -foo -baz 29611jim.d -bar -boggle 29612-d fred.c -foo -baz -boggle 29613-d jim.d -bar -baz -boggle 29614@end smallexample 29615 29616@item %@{S:X; T:Y; :D@} 29617 29618If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 29619given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 29620be as many clauses as you need. This may be combined with @code{.}, 29621@code{,}, @code{!}, @code{|}, and @code{*} as needed. 29622 29623 29624@end table 29625 29626The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}} 29627or similar construct can use a backslash to ignore the special meaning 29628of the character following it, thus allowing literal matching of a 29629character that is otherwise specially treated. For example, 29630@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the 29631@option{-std=iso9899:1999} option is given. 29632 29633The conditional text @code{X} in a @samp{%@{S:X@}} or similar 29634construct may contain other nested @samp{%} constructs or spaces, or 29635even newlines. They are processed as usual, as described above. 29636Trailing white space in @code{X} is ignored. White space may also 29637appear anywhere on the left side of the colon in these constructs, 29638except between @code{.} or @code{*} and the corresponding word. 29639 29640The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 29641handled specifically in these constructs. If another value of 29642@option{-O} or the negated form of a @option{-f}, @option{-m}, or 29643@option{-W} switch is found later in the command line, the earlier 29644switch value is ignored, except with @{@code{S}*@} where @code{S} is 29645just one letter, which passes all matching options. 29646 29647The character @samp{|} at the beginning of the predicate text is used to 29648indicate that a command should be piped to the following command, but 29649only if @option{-pipe} is specified. 29650 29651It is built into GCC which switches take arguments and which do not. 29652(You might think it would be useful to generalize this to allow each 29653compiler's spec to say which switches take arguments. But this cannot 29654be done in a consistent fashion. GCC cannot even decide which input 29655files have been specified without knowing which switches take arguments, 29656and it must know which input files to compile in order to tell which 29657compilers to run). 29658 29659GCC also knows implicitly that arguments starting in @option{-l} are to be 29660treated as compiler output files, and passed to the linker in their 29661proper position among the other output files. 29662 29663@node Environment Variables 29664@section Environment Variables Affecting GCC 29665@cindex environment variables 29666 29667@c man begin ENVIRONMENT 29668This section describes several environment variables that affect how GCC 29669operates. Some of them work by specifying directories or prefixes to use 29670when searching for various kinds of files. Some are used to specify other 29671aspects of the compilation environment. 29672 29673Note that you can also specify places to search using options such as 29674@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 29675take precedence over places specified using environment variables, which 29676in turn take precedence over those specified by the configuration of GCC@. 29677@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 29678GNU Compiler Collection (GCC) Internals}. 29679 29680@table @env 29681@item LANG 29682@itemx LC_CTYPE 29683@c @itemx LC_COLLATE 29684@itemx LC_MESSAGES 29685@c @itemx LC_MONETARY 29686@c @itemx LC_NUMERIC 29687@c @itemx LC_TIME 29688@itemx LC_ALL 29689@findex LANG 29690@findex LC_CTYPE 29691@c @findex LC_COLLATE 29692@findex LC_MESSAGES 29693@c @findex LC_MONETARY 29694@c @findex LC_NUMERIC 29695@c @findex LC_TIME 29696@findex LC_ALL 29697@cindex locale 29698These environment variables control the way that GCC uses 29699localization information which allows GCC to work with different 29700national conventions. GCC inspects the locale categories 29701@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 29702so. These locale categories can be set to any value supported by your 29703installation. A typical value is @samp{en_GB.UTF-8} for English in the United 29704Kingdom encoded in UTF-8. 29705 29706The @env{LC_CTYPE} environment variable specifies character 29707classification. GCC uses it to determine the character boundaries in 29708a string; this is needed for some multibyte encodings that contain quote 29709and escape characters that are otherwise interpreted as a string 29710end or escape. 29711 29712The @env{LC_MESSAGES} environment variable specifies the language to 29713use in diagnostic messages. 29714 29715If the @env{LC_ALL} environment variable is set, it overrides the value 29716of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 29717and @env{LC_MESSAGES} default to the value of the @env{LANG} 29718environment variable. If none of these variables are set, GCC 29719defaults to traditional C English behavior. 29720 29721@item TMPDIR 29722@findex TMPDIR 29723If @env{TMPDIR} is set, it specifies the directory to use for temporary 29724files. GCC uses temporary files to hold the output of one stage of 29725compilation which is to be used as input to the next stage: for example, 29726the output of the preprocessor, which is the input to the compiler 29727proper. 29728 29729@item GCC_COMPARE_DEBUG 29730@findex GCC_COMPARE_DEBUG 29731Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 29732@option{-fcompare-debug} to the compiler driver. See the documentation 29733of this option for more details. 29734 29735@item GCC_EXEC_PREFIX 29736@findex GCC_EXEC_PREFIX 29737If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 29738names of the subprograms executed by the compiler. No slash is added 29739when this prefix is combined with the name of a subprogram, but you can 29740specify a prefix that ends with a slash if you wish. 29741 29742If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 29743an appropriate prefix to use based on the pathname it is invoked with. 29744 29745If GCC cannot find the subprogram using the specified prefix, it 29746tries looking in the usual places for the subprogram. 29747 29748The default value of @env{GCC_EXEC_PREFIX} is 29749@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 29750the installed compiler. In many cases @var{prefix} is the value 29751of @code{prefix} when you ran the @file{configure} script. 29752 29753Other prefixes specified with @option{-B} take precedence over this prefix. 29754 29755This prefix is also used for finding files such as @file{crt0.o} that are 29756used for linking. 29757 29758In addition, the prefix is used in an unusual way in finding the 29759directories to search for header files. For each of the standard 29760directories whose name normally begins with @samp{/usr/local/lib/gcc} 29761(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 29762replacing that beginning with the specified prefix to produce an 29763alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 29764@file{foo/bar} just before it searches the standard directory 29765@file{/usr/local/lib/bar}. 29766If a standard directory begins with the configured 29767@var{prefix} then the value of @var{prefix} is replaced by 29768@env{GCC_EXEC_PREFIX} when looking for header files. 29769 29770@item COMPILER_PATH 29771@findex COMPILER_PATH 29772The value of @env{COMPILER_PATH} is a colon-separated list of 29773directories, much like @env{PATH}. GCC tries the directories thus 29774specified when searching for subprograms, if it cannot find the 29775subprograms using @env{GCC_EXEC_PREFIX}. 29776 29777@item LIBRARY_PATH 29778@findex LIBRARY_PATH 29779The value of @env{LIBRARY_PATH} is a colon-separated list of 29780directories, much like @env{PATH}. When configured as a native compiler, 29781GCC tries the directories thus specified when searching for special 29782linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking 29783using GCC also uses these directories when searching for ordinary 29784libraries for the @option{-l} option (but directories specified with 29785@option{-L} come first). 29786 29787@item LANG 29788@findex LANG 29789@cindex locale definition 29790This variable is used to pass locale information to the compiler. One way in 29791which this information is used is to determine the character set to be used 29792when character literals, string literals and comments are parsed in C and C++. 29793When the compiler is configured to allow multibyte characters, 29794the following values for @env{LANG} are recognized: 29795 29796@table @samp 29797@item C-JIS 29798Recognize JIS characters. 29799@item C-SJIS 29800Recognize SJIS characters. 29801@item C-EUCJP 29802Recognize EUCJP characters. 29803@end table 29804 29805If @env{LANG} is not defined, or if it has some other value, then the 29806compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 29807recognize and translate multibyte characters. 29808@end table 29809 29810@noindent 29811Some additional environment variables affect the behavior of the 29812preprocessor. 29813 29814@include cppenv.texi 29815 29816@c man end 29817 29818@node Precompiled Headers 29819@section Using Precompiled Headers 29820@cindex precompiled headers 29821@cindex speed of compilation 29822 29823Often large projects have many header files that are included in every 29824source file. The time the compiler takes to process these header files 29825over and over again can account for nearly all of the time required to 29826build the project. To make builds faster, GCC allows you to 29827@dfn{precompile} a header file. 29828 29829To create a precompiled header file, simply compile it as you would any 29830other file, if necessary using the @option{-x} option to make the driver 29831treat it as a C or C++ header file. You may want to use a 29832tool like @command{make} to keep the precompiled header up-to-date when 29833the headers it contains change. 29834 29835A precompiled header file is searched for when @code{#include} is 29836seen in the compilation. As it searches for the included file 29837(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 29838compiler looks for a precompiled header in each directory just before it 29839looks for the include file in that directory. The name searched for is 29840the name specified in the @code{#include} with @samp{.gch} appended. If 29841the precompiled header file cannot be used, it is ignored. 29842 29843For instance, if you have @code{#include "all.h"}, and you have 29844@file{all.h.gch} in the same directory as @file{all.h}, then the 29845precompiled header file is used if possible, and the original 29846header is used otherwise. 29847 29848Alternatively, you might decide to put the precompiled header file in a 29849directory and use @option{-I} to ensure that directory is searched 29850before (or instead of) the directory containing the original header. 29851Then, if you want to check that the precompiled header file is always 29852used, you can put a file of the same name as the original header in this 29853directory containing an @code{#error} command. 29854 29855This also works with @option{-include}. So yet another way to use 29856precompiled headers, good for projects not designed with precompiled 29857header files in mind, is to simply take most of the header files used by 29858a project, include them from another header file, precompile that header 29859file, and @option{-include} the precompiled header. If the header files 29860have guards against multiple inclusion, they are skipped because 29861they've already been included (in the precompiled header). 29862 29863If you need to precompile the same header file for different 29864languages, targets, or compiler options, you can instead make a 29865@emph{directory} named like @file{all.h.gch}, and put each precompiled 29866header in the directory, perhaps using @option{-o}. It doesn't matter 29867what you call the files in the directory; every precompiled header in 29868the directory is considered. The first precompiled header 29869encountered in the directory that is valid for this compilation is 29870used; they're searched in no particular order. 29871 29872There are many other possibilities, limited only by your imagination, 29873good sense, and the constraints of your build system. 29874 29875A precompiled header file can be used only when these conditions apply: 29876 29877@itemize 29878@item 29879Only one precompiled header can be used in a particular compilation. 29880 29881@item 29882A precompiled header cannot be used once the first C token is seen. You 29883can have preprocessor directives before a precompiled header; you cannot 29884include a precompiled header from inside another header. 29885 29886@item 29887The precompiled header file must be produced for the same language as 29888the current compilation. You cannot use a C precompiled header for a C++ 29889compilation. 29890 29891@item 29892The precompiled header file must have been produced by the same compiler 29893binary as the current compilation is using. 29894 29895@item 29896Any macros defined before the precompiled header is included must 29897either be defined in the same way as when the precompiled header was 29898generated, or must not affect the precompiled header, which usually 29899means that they don't appear in the precompiled header at all. 29900 29901The @option{-D} option is one way to define a macro before a 29902precompiled header is included; using a @code{#define} can also do it. 29903There are also some options that define macros implicitly, like 29904@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 29905defined this way. 29906 29907@item If debugging information is output when using the precompiled 29908header, using @option{-g} or similar, the same kind of debugging information 29909must have been output when building the precompiled header. However, 29910a precompiled header built using @option{-g} can be used in a compilation 29911when no debugging information is being output. 29912 29913@item The same @option{-m} options must generally be used when building 29914and using the precompiled header. @xref{Submodel Options}, 29915for any cases where this rule is relaxed. 29916 29917@item Each of the following options must be the same when building and using 29918the precompiled header: 29919 29920@gccoptlist{-fexceptions} 29921 29922@item 29923Some other command-line options starting with @option{-f}, 29924@option{-p}, or @option{-O} must be defined in the same way as when 29925the precompiled header was generated. At present, it's not clear 29926which options are safe to change and which are not; the safest choice 29927is to use exactly the same options when generating and using the 29928precompiled header. The following are known to be safe: 29929 29930@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 29931-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 29932-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 29933-pedantic-errors} 29934 29935@end itemize 29936 29937For all of these except the last, the compiler automatically 29938ignores the precompiled header if the conditions aren't met. If you 29939find an option combination that doesn't work and doesn't cause the 29940precompiled header to be ignored, please consider filing a bug report, 29941see @ref{Bugs}. 29942 29943If you do use differing options when generating and using the 29944precompiled header, the actual behavior is a mixture of the 29945behavior for the options. For instance, if you use @option{-g} to 29946generate the precompiled header but not when using it, you may or may 29947not get debugging information for routines in the precompiled header. 29948