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-traditional -traditional-cpp -trigraphs @gol 526-U@var{macro} -undef @gol 527-Wp,@var{option} -Xpreprocessor @var{option}} 528 529@item Assembler Options 530@xref{Assembler Options,,Passing Options to the Assembler}. 531@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 532 533@item Linker Options 534@xref{Link Options,,Options for Linking}. 535@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 536-nostartfiles -nodefaultlibs -nolibc -nostdlib @gol 537-e @var{entry} --entry=@var{entry} @gol 538-pie -pthread -r -rdynamic @gol 539-s -static -static-pie -static-libgcc -static-libstdc++ @gol 540-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 541-shared -shared-libgcc -symbolic @gol 542-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 543-u @var{symbol} -z @var{keyword}} 544 545@item Directory Options 546@xref{Directory Options,,Options for Directory Search}. 547@gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol 548-idirafter @var{dir} @gol 549-imacros @var{file} -imultilib @var{dir} @gol 550-iplugindir=@var{dir} -iprefix @var{file} @gol 551-iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol 552-iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol 553-L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol 554-nostdinc -nostdinc++ --sysroot=@var{dir}} 555 556@item Code Generation Options 557@xref{Code Gen Options,,Options for Code Generation Conventions}. 558@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 559-ffixed-@var{reg} -fexceptions @gol 560-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 561-fasynchronous-unwind-tables @gol 562-fno-gnu-unique @gol 563-finhibit-size-directive -fno-common -fno-ident @gol 564-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol 565-fno-jump-tables @gol 566-frecord-gcc-switches @gol 567-freg-struct-return -fshort-enums -fshort-wchar @gol 568-fverbose-asm -fpack-struct[=@var{n}] @gol 569-fleading-underscore -ftls-model=@var{model} @gol 570-fstack-reuse=@var{reuse_level} @gol 571-ftrampolines -ftrapv -fwrapv @gol 572-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 573-fstrict-volatile-bitfields -fsync-libcalls} 574 575@item Developer Options 576@xref{Developer Options,,GCC Developer Options}. 577@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 578-dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol 579-fdbg-cnt=@var{counter-value-list} @gol 580-fdisable-ipa-@var{pass_name} @gol 581-fdisable-rtl-@var{pass_name} @gol 582-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 583-fdisable-tree-@var{pass_name} @gol 584-fdisable-tree-@var{pass-name}=@var{range-list} @gol 585-fdump-debug -fdump-earlydebug @gol 586-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 587-fdump-final-insns@r{[}=@var{file}@r{]} @gol 588-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 589-fdump-lang-all @gol 590-fdump-lang-@var{switch} @gol 591-fdump-lang-@var{switch}-@var{options} @gol 592-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol 593-fdump-passes @gol 594-fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol 595-fdump-statistics @gol 596-fdump-tree-all @gol 597-fdump-tree-@var{switch} @gol 598-fdump-tree-@var{switch}-@var{options} @gol 599-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol 600-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 601-fenable-@var{kind}-@var{pass} @gol 602-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 603-fira-verbose=@var{n} @gol 604-flto-report -flto-report-wpa -fmem-report-wpa @gol 605-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol 606-fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 607-fprofile-report @gol 608-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 609-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 610-fstats -fstack-usage -ftime-report -ftime-report-details @gol 611-fvar-tracking-assignments-toggle -gtoggle @gol 612-print-file-name=@var{library} -print-libgcc-file-name @gol 613-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 614-print-prog-name=@var{program} -print-search-dirs -Q @gol 615-print-sysroot -print-sysroot-headers-suffix @gol 616-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 617 618@item Machine-Dependent Options 619@xref{Submodel Options,,Machine-Dependent Options}. 620@c This list is ordered alphanumerically by subsection name. 621@c Try and put the significant identifier (CPU or system) first, 622@c so users have a clue at guessing where the ones they want will be. 623 624@emph{AArch64 Options} 625@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 626-mgeneral-regs-only @gol 627-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 628-mstrict-align -mno-strict-align @gol 629-momit-leaf-frame-pointer @gol 630-mtls-dialect=desc -mtls-dialect=traditional @gol 631-mtls-size=@var{size} @gol 632-mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol 633-mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol 634-mpc-relative-literal-loads @gol 635-msign-return-address=@var{scope} @gol 636-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti} @gol 637-mharden-sls=@var{opts} @gol 638-march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol 639-moverride=@var{string} -mverbose-cost-dump @gol 640-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol 641-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol 642-moutline-atomics } 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 4318The effectiveness of some warnings depends on optimizations also being 4319enabled. For example @option{-Wsuggest-final-types} is more effective 4320with link-time optimization and @option{-Wmaybe-uninitialized} will not 4321warn at all unless optimization is enabled. 4322 4323@table @gcctabopt 4324@item -Wpedantic 4325@itemx -pedantic 4326@opindex pedantic 4327@opindex Wpedantic 4328@opindex Wno-pedantic 4329Issue all the warnings demanded by strict ISO C and ISO C++; 4330reject all programs that use forbidden extensions, and some other 4331programs that do not follow ISO C and ISO C++. For ISO C, follows the 4332version of the ISO C standard specified by any @option{-std} option used. 4333 4334Valid ISO C and ISO C++ programs should compile properly with or without 4335this option (though a rare few require @option{-ansi} or a 4336@option{-std} option specifying the required version of ISO C)@. However, 4337without this option, certain GNU extensions and traditional C and C++ 4338features are supported as well. With this option, they are rejected. 4339 4340@option{-Wpedantic} does not cause warning messages for use of the 4341alternate keywords whose names begin and end with @samp{__}. Pedantic 4342warnings are also disabled in the expression that follows 4343@code{__extension__}. However, only system header files should use 4344these escape routes; application programs should avoid them. 4345@xref{Alternate Keywords}. 4346 4347Some users try to use @option{-Wpedantic} to check programs for strict ISO 4348C conformance. They soon find that it does not do quite what they want: 4349it finds some non-ISO practices, but not all---only those for which 4350ISO C @emph{requires} a diagnostic, and some others for which 4351diagnostics have been added. 4352 4353A feature to report any failure to conform to ISO C might be useful in 4354some instances, but would require considerable additional work and would 4355be quite different from @option{-Wpedantic}. We don't have plans to 4356support such a feature in the near future. 4357 4358Where the standard specified with @option{-std} represents a GNU 4359extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 4360corresponding @dfn{base standard}, the version of ISO C on which the GNU 4361extended dialect is based. Warnings from @option{-Wpedantic} are given 4362where they are required by the base standard. (It does not make sense 4363for such warnings to be given only for features not in the specified GNU 4364C dialect, since by definition the GNU dialects of C include all 4365features the compiler supports with the given option, and there would be 4366nothing to warn about.) 4367 4368@item -pedantic-errors 4369@opindex pedantic-errors 4370Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 4371requires a diagnostic, in some cases where there is undefined behavior 4372at compile-time and in some other cases that do not prevent compilation 4373of programs that are valid according to the standard. This is not 4374equivalent to @option{-Werror=pedantic}, since there are errors enabled 4375by this option and not enabled by the latter and vice versa. 4376 4377@item -Wall 4378@opindex Wall 4379@opindex Wno-all 4380This enables all the warnings about constructions that some users 4381consider questionable, and that are easy to avoid (or modify to 4382prevent the warning), even in conjunction with macros. This also 4383enables some language-specific warnings described in @ref{C++ Dialect 4384Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 4385 4386@option{-Wall} turns on the following warning flags: 4387 4388@gccoptlist{-Waddress @gol 4389-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 4390-Wbool-compare @gol 4391-Wbool-operation @gol 4392-Wc++11-compat -Wc++14-compat @gol 4393-Wcatch-value @r{(C++ and Objective-C++ only)} @gol 4394-Wchar-subscripts @gol 4395-Wcomment @gol 4396-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol 4397-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 4398-Wformat @gol 4399-Wint-in-bool-context @gol 4400-Wimplicit @r{(C and Objective-C only)} @gol 4401-Wimplicit-int @r{(C and Objective-C only)} @gol 4402-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 4403-Winit-self @r{(only for C++)} @gol 4404-Wlogical-not-parentheses @gol 4405-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 4406-Wmaybe-uninitialized @gol 4407-Wmemset-elt-size @gol 4408-Wmemset-transposed-args @gol 4409-Wmisleading-indentation @r{(only for C/C++)} @gol 4410-Wmissing-attributes @gol 4411-Wmissing-braces @r{(only for C/ObjC)} @gol 4412-Wmultistatement-macros @gol 4413-Wnarrowing @r{(only for C++)} @gol 4414-Wnonnull @gol 4415-Wnonnull-compare @gol 4416-Wopenmp-simd @gol 4417-Wparentheses @gol 4418-Wpessimizing-move @r{(only for C++)} @gol 4419-Wpointer-sign @gol 4420-Wreorder @gol 4421-Wrestrict @gol 4422-Wreturn-type @gol 4423-Wsequence-point @gol 4424-Wsign-compare @r{(only in C++)} @gol 4425-Wsizeof-pointer-div @gol 4426-Wsizeof-pointer-memaccess @gol 4427-Wstrict-aliasing @gol 4428-Wstrict-overflow=1 @gol 4429-Wswitch @gol 4430-Wtautological-compare @gol 4431-Wtrigraphs @gol 4432-Wuninitialized @gol 4433-Wunknown-pragmas @gol 4434-Wunused-function @gol 4435-Wunused-label @gol 4436-Wunused-value @gol 4437-Wunused-variable @gol 4438-Wvolatile-register-var} 4439 4440Note that some warning flags are not implied by @option{-Wall}. Some of 4441them warn about constructions that users generally do not consider 4442questionable, but which occasionally you might wish to check for; 4443others warn about constructions that are necessary or hard to avoid in 4444some cases, and there is no simple way to modify the code to suppress 4445the warning. Some of them are enabled by @option{-Wextra} but many of 4446them must be enabled individually. 4447 4448@item -Wextra 4449@opindex W 4450@opindex Wextra 4451@opindex Wno-extra 4452This enables some extra warning flags that are not enabled by 4453@option{-Wall}. (This option used to be called @option{-W}. The older 4454name is still supported, but the newer name is more descriptive.) 4455 4456@gccoptlist{-Wclobbered @gol 4457-Wcast-function-type @gol 4458-Wdeprecated-copy @r{(C++ only)} @gol 4459-Wempty-body @gol 4460-Wignored-qualifiers @gol 4461-Wimplicit-fallthrough=3 @gol 4462-Wmissing-field-initializers @gol 4463-Wmissing-parameter-type @r{(C only)} @gol 4464-Wold-style-declaration @r{(C only)} @gol 4465-Woverride-init @gol 4466-Wsign-compare @r{(C only)} @gol 4467-Wredundant-move @r{(only for C++)} @gol 4468-Wtype-limits @gol 4469-Wuninitialized @gol 4470-Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol 4471-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 4472-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}} 4473 4474 4475The option @option{-Wextra} also prints warning messages for the 4476following cases: 4477 4478@itemize @bullet 4479 4480@item 4481A pointer is compared against integer zero with @code{<}, @code{<=}, 4482@code{>}, or @code{>=}. 4483 4484@item 4485(C++ only) An enumerator and a non-enumerator both appear in a 4486conditional expression. 4487 4488@item 4489(C++ only) Ambiguous virtual bases. 4490 4491@item 4492(C++ only) Subscripting an array that has been declared @code{register}. 4493 4494@item 4495(C++ only) Taking the address of a variable that has been declared 4496@code{register}. 4497 4498@item 4499(C++ only) A base class is not initialized in the copy constructor 4500of a derived class. 4501 4502@end itemize 4503 4504@item -Wchar-subscripts 4505@opindex Wchar-subscripts 4506@opindex Wno-char-subscripts 4507Warn if an array subscript has type @code{char}. This is a common cause 4508of error, as programmers often forget that this type is signed on some 4509machines. 4510This warning is enabled by @option{-Wall}. 4511 4512@item -Wno-coverage-mismatch 4513@opindex Wno-coverage-mismatch 4514@opindex Wcoverage-mismatch 4515Warn if feedback profiles do not match when using the 4516@option{-fprofile-use} option. 4517If a source file is changed between compiling with @option{-fprofile-generate} 4518and with @option{-fprofile-use}, the files with the profile feedback can fail 4519to match the source file and GCC cannot use the profile feedback 4520information. By default, this warning is enabled and is treated as an 4521error. @option{-Wno-coverage-mismatch} can be used to disable the 4522warning or @option{-Wno-error=coverage-mismatch} can be used to 4523disable the error. Disabling the error for this warning can result in 4524poorly optimized code and is useful only in the 4525case of very minor changes such as bug fixes to an existing code-base. 4526Completely disabling the warning is not recommended. 4527 4528@item -Wno-cpp 4529@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 4530 4531Suppress warning messages emitted by @code{#warning} directives. 4532 4533@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 4534@opindex Wdouble-promotion 4535@opindex Wno-double-promotion 4536Give a warning when a value of type @code{float} is implicitly 4537promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 4538floating-point unit implement @code{float} in hardware, but emulate 4539@code{double} in software. On such a machine, doing computations 4540using @code{double} values is much more expensive because of the 4541overhead required for software emulation. 4542 4543It is easy to accidentally do computations with @code{double} because 4544floating-point literals are implicitly of type @code{double}. For 4545example, in: 4546@smallexample 4547@group 4548float area(float radius) 4549@{ 4550 return 3.14159 * radius * radius; 4551@} 4552@end group 4553@end smallexample 4554the compiler performs the entire computation with @code{double} 4555because the floating-point literal is a @code{double}. 4556 4557@item -Wduplicate-decl-specifier @r{(C and Objective-C only)} 4558@opindex Wduplicate-decl-specifier 4559@opindex Wno-duplicate-decl-specifier 4560Warn if a declaration has duplicate @code{const}, @code{volatile}, 4561@code{restrict} or @code{_Atomic} specifier. This warning is enabled by 4562@option{-Wall}. 4563 4564@item -Wformat 4565@itemx -Wformat=@var{n} 4566@opindex Wformat 4567@opindex Wno-format 4568@opindex ffreestanding 4569@opindex fno-builtin 4570@opindex Wformat= 4571Check calls to @code{printf} and @code{scanf}, etc., to make sure that 4572the arguments supplied have types appropriate to the format string 4573specified, and that the conversions specified in the format string make 4574sense. This includes standard functions, and others specified by format 4575attributes (@pxref{Function Attributes}), in the @code{printf}, 4576@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 4577not in the C standard) families (or other target-specific families). 4578Which functions are checked without format attributes having been 4579specified depends on the standard version selected, and such checks of 4580functions without the attribute specified are disabled by 4581@option{-ffreestanding} or @option{-fno-builtin}. 4582 4583The formats are checked against the format features supported by GNU 4584libc version 2.2. These include all ISO C90 and C99 features, as well 4585as features from the Single Unix Specification and some BSD and GNU 4586extensions. Other library implementations may not support all these 4587features; GCC does not support warning about features that go beyond a 4588particular library's limitations. However, if @option{-Wpedantic} is used 4589with @option{-Wformat}, warnings are given about format features not 4590in the selected standard version (but not for @code{strfmon} formats, 4591since those are not in any version of the C standard). @xref{C Dialect 4592Options,,Options Controlling C Dialect}. 4593 4594@table @gcctabopt 4595@item -Wformat=1 4596@itemx -Wformat 4597@opindex Wformat 4598@opindex Wformat=1 4599Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 4600@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 4601@option{-Wformat} also checks for null format arguments for several 4602functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 4603aspects of this level of format checking can be disabled by the 4604options: @option{-Wno-format-contains-nul}, 4605@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 4606@option{-Wformat} is enabled by @option{-Wall}. 4607 4608@item -Wno-format-contains-nul 4609@opindex Wno-format-contains-nul 4610@opindex Wformat-contains-nul 4611If @option{-Wformat} is specified, do not warn about format strings that 4612contain NUL bytes. 4613 4614@item -Wno-format-extra-args 4615@opindex Wno-format-extra-args 4616@opindex Wformat-extra-args 4617If @option{-Wformat} is specified, do not warn about excess arguments to a 4618@code{printf} or @code{scanf} format function. The C standard specifies 4619that such arguments are ignored. 4620 4621Where the unused arguments lie between used arguments that are 4622specified with @samp{$} operand number specifications, normally 4623warnings are still given, since the implementation could not know what 4624type to pass to @code{va_arg} to skip the unused arguments. However, 4625in the case of @code{scanf} formats, this option suppresses the 4626warning if the unused arguments are all pointers, since the Single 4627Unix Specification says that such unused arguments are allowed. 4628 4629@item -Wformat-overflow 4630@itemx -Wformat-overflow=@var{level} 4631@opindex Wformat-overflow 4632@opindex Wno-format-overflow 4633Warn about calls to formatted input/output functions such as @code{sprintf} 4634and @code{vsprintf} that might overflow the destination buffer. When the 4635exact number of bytes written by a format directive cannot be determined 4636at compile-time it is estimated based on heuristics that depend on the 4637@var{level} argument and on optimization. While enabling optimization 4638will in most cases improve the accuracy of the warning, it may also 4639result in false positives. 4640 4641@table @gcctabopt 4642@item -Wformat-overflow 4643@itemx -Wformat-overflow=1 4644@opindex Wformat-overflow 4645@opindex Wno-format-overflow 4646Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat} 4647employs a conservative approach that warns only about calls that most 4648likely overflow the buffer. At this level, numeric arguments to format 4649directives with unknown values are assumed to have the value of one, and 4650strings of unknown length to be empty. Numeric arguments that are known 4651to be bounded to a subrange of their type, or string arguments whose output 4652is bounded either by their directive's precision or by a finite set of 4653string literals, are assumed to take on the value within the range that 4654results in the most bytes on output. For example, the call to @code{sprintf} 4655below is diagnosed because even with both @var{a} and @var{b} equal to zero, 4656the terminating NUL character (@code{'\0'}) appended by the function 4657to the destination buffer will be written past its end. Increasing 4658the size of the buffer by a single byte is sufficient to avoid the 4659warning, though it may not be sufficient to avoid the overflow. 4660 4661@smallexample 4662void f (int a, int b) 4663@{ 4664 char buf [13]; 4665 sprintf (buf, "a = %i, b = %i\n", a, b); 4666@} 4667@end smallexample 4668 4669@item -Wformat-overflow=2 4670Level @var{2} warns also about calls that might overflow the destination 4671buffer given an argument of sufficient length or magnitude. At level 4672@var{2}, unknown numeric arguments are assumed to have the minimum 4673representable value for signed types with a precision greater than 1, and 4674the maximum representable value otherwise. Unknown string arguments whose 4675length cannot be assumed to be bounded either by the directive's precision, 4676or by a finite set of string literals they may evaluate to, or the character 4677array they may point to, are assumed to be 1 character long. 4678 4679At level @var{2}, the call in the example above is again diagnosed, but 4680this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first 4681@code{%i} directive will write some of its digits beyond the end of 4682the destination buffer. To make the call safe regardless of the values 4683of the two variables, the size of the destination buffer must be increased 4684to at least 34 bytes. GCC includes the minimum size of the buffer in 4685an informational note following the warning. 4686 4687An alternative to increasing the size of the destination buffer is to 4688constrain the range of formatted values. The maximum length of string 4689arguments can be bounded by specifying the precision in the format 4690directive. When numeric arguments of format directives can be assumed 4691to be bounded by less than the precision of their type, choosing 4692an appropriate length modifier to the format specifier will reduce 4693the required buffer size. For example, if @var{a} and @var{b} in the 4694example above can be assumed to be within the precision of 4695the @code{short int} type then using either the @code{%hi} format 4696directive or casting the argument to @code{short} reduces the maximum 4697required size of the buffer to 24 bytes. 4698 4699@smallexample 4700void f (int a, int b) 4701@{ 4702 char buf [23]; 4703 sprintf (buf, "a = %hi, b = %i\n", a, (short)b); 4704@} 4705@end smallexample 4706@end table 4707 4708@item -Wno-format-zero-length 4709@opindex Wno-format-zero-length 4710@opindex Wformat-zero-length 4711If @option{-Wformat} is specified, do not warn about zero-length formats. 4712The C standard specifies that zero-length formats are allowed. 4713 4714 4715@item -Wformat=2 4716@opindex Wformat=2 4717Enable @option{-Wformat} plus additional format checks. Currently 4718equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 4719-Wformat-y2k}. 4720 4721@item -Wformat-nonliteral 4722@opindex Wformat-nonliteral 4723@opindex Wno-format-nonliteral 4724If @option{-Wformat} is specified, also warn if the format string is not a 4725string literal and so cannot be checked, unless the format function 4726takes its format arguments as a @code{va_list}. 4727 4728@item -Wformat-security 4729@opindex Wformat-security 4730@opindex Wno-format-security 4731If @option{-Wformat} is specified, also warn about uses of format 4732functions that represent possible security problems. At present, this 4733warns about calls to @code{printf} and @code{scanf} functions where the 4734format string is not a string literal and there are no format arguments, 4735as in @code{printf (foo);}. This may be a security hole if the format 4736string came from untrusted input and contains @samp{%n}. (This is 4737currently a subset of what @option{-Wformat-nonliteral} warns about, but 4738in future warnings may be added to @option{-Wformat-security} that are not 4739included in @option{-Wformat-nonliteral}.) 4740 4741@item -Wformat-signedness 4742@opindex Wformat-signedness 4743@opindex Wno-format-signedness 4744If @option{-Wformat} is specified, also warn if the format string 4745requires an unsigned argument and the argument is signed and vice versa. 4746 4747@item -Wformat-truncation 4748@itemx -Wformat-truncation=@var{level} 4749@opindex Wformat-truncation 4750@opindex Wno-format-truncation 4751Warn about calls to formatted input/output functions such as @code{snprintf} 4752and @code{vsnprintf} that might result in output truncation. When the exact 4753number of bytes written by a format directive cannot be determined at 4754compile-time it is estimated based on heuristics that depend on 4755the @var{level} argument and on optimization. While enabling optimization 4756will in most cases improve the accuracy of the warning, it may also result 4757in false positives. Except as noted otherwise, the option uses the same 4758logic @option{-Wformat-overflow}. 4759 4760@table @gcctabopt 4761@item -Wformat-truncation 4762@itemx -Wformat-truncation=1 4763@opindex Wformat-truncation 4764@opindex Wno-format-truncation 4765Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat} 4766employs a conservative approach that warns only about calls to bounded 4767functions whose return value is unused and that will most likely result 4768in output truncation. 4769 4770@item -Wformat-truncation=2 4771Level @var{2} warns also about calls to bounded functions whose return 4772value is used and that might result in truncation given an argument of 4773sufficient length or magnitude. 4774@end table 4775 4776@item -Wformat-y2k 4777@opindex Wformat-y2k 4778@opindex Wno-format-y2k 4779If @option{-Wformat} is specified, also warn about @code{strftime} 4780formats that may yield only a two-digit year. 4781@end table 4782 4783@item -Wnonnull 4784@opindex Wnonnull 4785@opindex Wno-nonnull 4786Warn about passing a null pointer for arguments marked as 4787requiring a non-null value by the @code{nonnull} function attribute. 4788 4789@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 4790can be disabled with the @option{-Wno-nonnull} option. 4791 4792@item -Wnonnull-compare 4793@opindex Wnonnull-compare 4794@opindex Wno-nonnull-compare 4795Warn when comparing an argument marked with the @code{nonnull} 4796function attribute against null inside the function. 4797 4798@option{-Wnonnull-compare} is included in @option{-Wall}. It 4799can be disabled with the @option{-Wno-nonnull-compare} option. 4800 4801@item -Wnull-dereference 4802@opindex Wnull-dereference 4803@opindex Wno-null-dereference 4804Warn if the compiler detects paths that trigger erroneous or 4805undefined behavior due to dereferencing a null pointer. This option 4806is only active when @option{-fdelete-null-pointer-checks} is active, 4807which is enabled by optimizations in most targets. The precision of 4808the warnings depends on the optimization options used. 4809 4810@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 4811@opindex Winit-self 4812@opindex Wno-init-self 4813Warn about uninitialized variables that are initialized with themselves. 4814Note this option can only be used with the @option{-Wuninitialized} option. 4815 4816For example, GCC warns about @code{i} being uninitialized in the 4817following snippet only when @option{-Winit-self} has been specified: 4818@smallexample 4819@group 4820int f() 4821@{ 4822 int i = i; 4823 return i; 4824@} 4825@end group 4826@end smallexample 4827 4828This warning is enabled by @option{-Wall} in C++. 4829 4830@item -Wimplicit-int @r{(C and Objective-C only)} 4831@opindex Wimplicit-int 4832@opindex Wno-implicit-int 4833Warn when a declaration does not specify a type. 4834This warning is enabled by @option{-Wall}. 4835 4836@item -Wimplicit-function-declaration @r{(C and Objective-C only)} 4837@opindex Wimplicit-function-declaration 4838@opindex Wno-implicit-function-declaration 4839Give a warning whenever a function is used before being declared. In 4840C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is 4841enabled by default and it is made into an error by 4842@option{-pedantic-errors}. This warning is also enabled by 4843@option{-Wall}. 4844 4845@item -Wimplicit @r{(C and Objective-C only)} 4846@opindex Wimplicit 4847@opindex Wno-implicit 4848Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 4849This warning is enabled by @option{-Wall}. 4850 4851@item -Wimplicit-fallthrough 4852@opindex Wimplicit-fallthrough 4853@opindex Wno-implicit-fallthrough 4854@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3} 4855and @option{-Wno-implicit-fallthrough} is the same as 4856@option{-Wimplicit-fallthrough=0}. 4857 4858@item -Wimplicit-fallthrough=@var{n} 4859@opindex Wimplicit-fallthrough= 4860Warn when a switch case falls through. For example: 4861 4862@smallexample 4863@group 4864switch (cond) 4865 @{ 4866 case 1: 4867 a = 1; 4868 break; 4869 case 2: 4870 a = 2; 4871 case 3: 4872 a = 3; 4873 break; 4874 @} 4875@end group 4876@end smallexample 4877 4878This warning does not warn when the last statement of a case cannot 4879fall through, e.g. when there is a return statement or a call to function 4880declared with the noreturn attribute. @option{-Wimplicit-fallthrough=} 4881also takes into account control flow statements, such as ifs, and only 4882warns when appropriate. E.g.@: 4883 4884@smallexample 4885@group 4886switch (cond) 4887 @{ 4888 case 1: 4889 if (i > 3) @{ 4890 bar (5); 4891 break; 4892 @} else if (i < 1) @{ 4893 bar (0); 4894 @} else 4895 return; 4896 default: 4897 @dots{} 4898 @} 4899@end group 4900@end smallexample 4901 4902Since there are occasions where a switch case fall through is desirable, 4903GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is 4904to be used along with a null statement to suppress this warning that 4905would normally occur: 4906 4907@smallexample 4908@group 4909switch (cond) 4910 @{ 4911 case 1: 4912 bar (0); 4913 __attribute__ ((fallthrough)); 4914 default: 4915 @dots{} 4916 @} 4917@end group 4918@end smallexample 4919 4920C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough} 4921warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11 4922or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension. 4923Instead of these attributes, it is also possible to add a fallthrough comment 4924to silence the warning. The whole body of the C or C++ style comment should 4925match the given regular expressions listed below. The option argument @var{n} 4926specifies what kind of comments are accepted: 4927 4928@itemize @bullet 4929 4930@item @option{-Wimplicit-fallthrough=0} disables the warning altogether. 4931 4932@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular 4933expression, any comment is used as fallthrough comment. 4934 4935@item @option{-Wimplicit-fallthrough=2} case insensitively matches 4936@code{.*falls?[ \t-]*thr(ough|u).*} regular expression. 4937 4938@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the 4939following regular expressions: 4940 4941@itemize @bullet 4942 4943@item @code{-fallthrough} 4944 4945@item @code{@@fallthrough@@} 4946 4947@item @code{lint -fallthrough[ \t]*} 4948 4949@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?} 4950 4951@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?} 4952 4953@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?} 4954 4955@end itemize 4956 4957@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the 4958following regular expressions: 4959 4960@itemize @bullet 4961 4962@item @code{-fallthrough} 4963 4964@item @code{@@fallthrough@@} 4965 4966@item @code{lint -fallthrough[ \t]*} 4967 4968@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*} 4969 4970@end itemize 4971 4972@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as 4973fallthrough comments, only attributes disable the warning. 4974 4975@end itemize 4976 4977The comment needs to be followed after optional whitespace and other comments 4978by @code{case} or @code{default} keywords or by a user label that precedes some 4979@code{case} or @code{default} label. 4980 4981@smallexample 4982@group 4983switch (cond) 4984 @{ 4985 case 1: 4986 bar (0); 4987 /* FALLTHRU */ 4988 default: 4989 @dots{} 4990 @} 4991@end group 4992@end smallexample 4993 4994The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}. 4995 4996@item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 4997@opindex Wif-not-aligned 4998@opindex Wno-if-not-aligned 4999Control if warning triggered by the @code{warn_if_not_aligned} attribute 5000should be issued. This is enabled by default. 5001Use @option{-Wno-if-not-aligned} to disable it. 5002 5003@item -Wignored-qualifiers @r{(C and C++ only)} 5004@opindex Wignored-qualifiers 5005@opindex Wno-ignored-qualifiers 5006Warn if the return type of a function has a type qualifier 5007such as @code{const}. For ISO C such a type qualifier has no effect, 5008since the value returned by a function is not an lvalue. 5009For C++, the warning is only emitted for scalar types or @code{void}. 5010ISO C prohibits qualified @code{void} return types on function 5011definitions, so such return types always receive a warning 5012even without this option. 5013 5014This warning is also enabled by @option{-Wextra}. 5015 5016@item -Wignored-attributes @r{(C and C++ only)} 5017@opindex Wignored-attributes 5018@opindex Wno-ignored-attributes 5019Warn when an attribute is ignored. This is different from the 5020@option{-Wattributes} option in that it warns whenever the compiler decides 5021to drop an attribute, not that the attribute is either unknown, used in a 5022wrong place, etc. This warning is enabled by default. 5023 5024@item -Wmain 5025@opindex Wmain 5026@opindex Wno-main 5027Warn if the type of @code{main} is suspicious. @code{main} should be 5028a function with external linkage, returning int, taking either zero 5029arguments, two, or three arguments of appropriate types. This warning 5030is enabled by default in C++ and is enabled by either @option{-Wall} 5031or @option{-Wpedantic}. 5032 5033@item -Wmisleading-indentation @r{(C and C++ only)} 5034@opindex Wmisleading-indentation 5035@opindex Wno-misleading-indentation 5036Warn when the indentation of the code does not reflect the block structure. 5037Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and 5038@code{for} clauses with a guarded statement that does not use braces, 5039followed by an unguarded statement with the same indentation. 5040 5041In the following example, the call to ``bar'' is misleadingly indented as 5042if it were guarded by the ``if'' conditional. 5043 5044@smallexample 5045 if (some_condition ()) 5046 foo (); 5047 bar (); /* Gotcha: this is not guarded by the "if". */ 5048@end smallexample 5049 5050In the case of mixed tabs and spaces, the warning uses the 5051@option{-ftabstop=} option to determine if the statements line up 5052(defaulting to 8). 5053 5054The warning is not issued for code involving multiline preprocessor logic 5055such as the following example. 5056 5057@smallexample 5058 if (flagA) 5059 foo (0); 5060#if SOME_CONDITION_THAT_DOES_NOT_HOLD 5061 if (flagB) 5062#endif 5063 foo (1); 5064@end smallexample 5065 5066The warning is not issued after a @code{#line} directive, since this 5067typically indicates autogenerated code, and no assumptions can be made 5068about the layout of the file that the directive references. 5069 5070This warning is enabled by @option{-Wall} in C and C++. 5071 5072@item -Wmissing-attributes 5073@opindex Wmissing-attributes 5074@opindex Wno-missing-attributes 5075Warn when a declaration of a function is missing one or more attributes 5076that a related function is declared with and whose absence may adversely 5077affect the correctness or efficiency of generated code. For example, 5078the warning is issued for declarations of aliases that use attributes 5079to specify less restrictive requirements than those of their targets. 5080This typically represents a potential optimization opportunity. 5081By contrast, the @option{-Wattribute-alias=2} option controls warnings 5082issued when the alias is more restrictive than the target, which could 5083lead to incorrect code generation. 5084Attributes considered include @code{alloc_align}, @code{alloc_size}, 5085@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 5086@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 5087@code{returns_nonnull}, and @code{returns_twice}. 5088 5089In C++, the warning is issued when an explicit specialization of a primary 5090template declared with attribute @code{alloc_align}, @code{alloc_size}, 5091@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc}, 5092or @code{nonnull} is declared without it. Attributes @code{deprecated}, 5093@code{error}, and @code{warning} suppress the warning. 5094(@pxref{Function Attributes}). 5095 5096You can use the @code{copy} attribute to apply the same 5097set of attributes to a declaration as that on another declaration without 5098explicitly enumerating the attributes. This attribute can be applied 5099to declarations of functions (@pxref{Common Function Attributes}), 5100variables (@pxref{Common Variable Attributes}), or types 5101(@pxref{Common Type Attributes}). 5102 5103@option{-Wmissing-attributes} is enabled by @option{-Wall}. 5104 5105For example, since the declaration of the primary function template 5106below makes use of both attribute @code{malloc} and @code{alloc_size} 5107the declaration of the explicit specialization of the template is 5108diagnosed because it is missing one of the attributes. 5109 5110@smallexample 5111template <class T> 5112T* __attribute__ ((malloc, alloc_size (1))) 5113allocate (size_t); 5114 5115template <> 5116void* __attribute__ ((malloc)) // missing alloc_size 5117allocate<void> (size_t); 5118@end smallexample 5119 5120@item -Wmissing-braces 5121@opindex Wmissing-braces 5122@opindex Wno-missing-braces 5123Warn if an aggregate or union initializer is not fully bracketed. In 5124the following example, the initializer for @code{a} is not fully 5125bracketed, but that for @code{b} is fully bracketed. This warning is 5126enabled by @option{-Wall} in C. 5127 5128@smallexample 5129int a[2][2] = @{ 0, 1, 2, 3 @}; 5130int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 5131@end smallexample 5132 5133This warning is enabled by @option{-Wall}. 5134 5135@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 5136@opindex Wmissing-include-dirs 5137@opindex Wno-missing-include-dirs 5138Warn if a user-supplied include directory does not exist. 5139 5140@item -Wmissing-profile 5141@opindex Wmissing-profile 5142@opindex Wno-missing-profile 5143Warn if feedback profiles are missing when using the 5144@option{-fprofile-use} option. 5145This option diagnoses those cases where a new function or a new file is added 5146to the user code between compiling with @option{-fprofile-generate} and with 5147@option{-fprofile-use}, without regenerating the profiles. In these cases, the 5148profile feedback data files do not contain any profile feedback information for 5149the newly added function or file respectively. Also, in the case when profile 5150count data (.gcda) files are removed, GCC cannot use any profile feedback 5151information. In all these cases, warnings are issued to inform the user that a 5152profile generation step is due. @option{-Wno-missing-profile} can be used to 5153disable the warning. Ignoring the warning can result in poorly optimized code. 5154Completely disabling the warning is not recommended and should be done only 5155when non-existent profile data is justified. 5156 5157@item -Wmultistatement-macros 5158@opindex Wmultistatement-macros 5159@opindex Wno-multistatement-macros 5160Warn about unsafe multiple statement macros that appear to be guarded 5161by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or 5162@code{while}, in which only the first statement is actually guarded after 5163the macro is expanded. 5164 5165For example: 5166 5167@smallexample 5168#define DOIT x++; y++ 5169if (c) 5170 DOIT; 5171@end smallexample 5172 5173will increment @code{y} unconditionally, not just when @code{c} holds. 5174The can usually be fixed by wrapping the macro in a do-while loop: 5175@smallexample 5176#define DOIT do @{ x++; y++; @} while (0) 5177if (c) 5178 DOIT; 5179@end smallexample 5180 5181This warning is enabled by @option{-Wall} in C and C++. 5182 5183@item -Wparentheses 5184@opindex Wparentheses 5185@opindex Wno-parentheses 5186Warn if parentheses are omitted in certain contexts, such 5187as when there is an assignment in a context where a truth value 5188is expected, or when operators are nested whose precedence people 5189often get confused about. 5190 5191Also warn if a comparison like @code{x<=y<=z} appears; this is 5192equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 5193interpretation from that of ordinary mathematical notation. 5194 5195Also warn for dangerous uses of the GNU extension to 5196@code{?:} with omitted middle operand. When the condition 5197in the @code{?}: operator is a boolean expression, the omitted value is 5198always 1. Often programmers expect it to be a value computed 5199inside the conditional expression instead. 5200 5201For C++ this also warns for some cases of unnecessary parentheses in 5202declarations, which can indicate an attempt at a function call instead 5203of a declaration: 5204@smallexample 5205@{ 5206 // Declares a local variable called mymutex. 5207 std::unique_lock<std::mutex> (mymutex); 5208 // User meant std::unique_lock<std::mutex> lock (mymutex); 5209@} 5210@end smallexample 5211 5212This warning is enabled by @option{-Wall}. 5213 5214@item -Wsequence-point 5215@opindex Wsequence-point 5216@opindex Wno-sequence-point 5217Warn about code that may have undefined semantics because of violations 5218of sequence point rules in the C and C++ standards. 5219 5220The C and C++ standards define the order in which expressions in a C/C++ 5221program are evaluated in terms of @dfn{sequence points}, which represent 5222a partial ordering between the execution of parts of the program: those 5223executed before the sequence point, and those executed after it. These 5224occur after the evaluation of a full expression (one which is not part 5225of a larger expression), after the evaluation of the first operand of a 5226@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 5227function is called (but after the evaluation of its arguments and the 5228expression denoting the called function), and in certain other places. 5229Other than as expressed by the sequence point rules, the order of 5230evaluation of subexpressions of an expression is not specified. All 5231these rules describe only a partial order rather than a total order, 5232since, for example, if two functions are called within one expression 5233with no sequence point between them, the order in which the functions 5234are called is not specified. However, the standards committee have 5235ruled that function calls do not overlap. 5236 5237It is not specified when between sequence points modifications to the 5238values of objects take effect. Programs whose behavior depends on this 5239have undefined behavior; the C and C++ standards specify that ``Between 5240the previous and next sequence point an object shall have its stored 5241value modified at most once by the evaluation of an expression. 5242Furthermore, the prior value shall be read only to determine the value 5243to be stored.''. If a program breaks these rules, the results on any 5244particular implementation are entirely unpredictable. 5245 5246Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 5247= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 5248diagnosed by this option, and it may give an occasional false positive 5249result, but in general it has been found fairly effective at detecting 5250this sort of problem in programs. 5251 5252The C++17 standard will define the order of evaluation of operands in 5253more cases: in particular it requires that the right-hand side of an 5254assignment be evaluated before the left-hand side, so the above 5255examples are no longer undefined. But this warning will still warn 5256about them, to help people avoid writing code that is undefined in C 5257and earlier revisions of C++. 5258 5259The standard is worded confusingly, therefore there is some debate 5260over the precise meaning of the sequence point rules in subtle cases. 5261Links to discussions of the problem, including proposed formal 5262definitions, may be found on the GCC readings page, at 5263@uref{http://gcc.gnu.org/@/readings.html}. 5264 5265This warning is enabled by @option{-Wall} for C and C++. 5266 5267@item -Wno-return-local-addr 5268@opindex Wno-return-local-addr 5269@opindex Wreturn-local-addr 5270Do not warn about returning a pointer (or in C++, a reference) to a 5271variable that goes out of scope after the function returns. 5272 5273@item -Wreturn-type 5274@opindex Wreturn-type 5275@opindex Wno-return-type 5276Warn whenever a function is defined with a return type that defaults 5277to @code{int}. Also warn about any @code{return} statement with no 5278return value in a function whose return type is not @code{void} 5279(falling off the end of the function body is considered returning 5280without a value). 5281 5282For C only, warn about a @code{return} statement with an expression in a 5283function whose return type is @code{void}, unless the expression type is 5284also @code{void}. As a GNU extension, the latter case is accepted 5285without a warning unless @option{-Wpedantic} is used. Attempting 5286to use the return value of a non-@code{void} function other than @code{main} 5287that flows off the end by reaching the closing curly brace that terminates 5288the function is undefined. 5289 5290Unlike in C, in C++, flowing off the end of a non-@code{void} function other 5291than @code{main} results in undefined behavior even when the value of 5292the function is not used. 5293 5294This warning is enabled by default in C++ and by @option{-Wall} otherwise. 5295 5296@item -Wshift-count-negative 5297@opindex Wshift-count-negative 5298@opindex Wno-shift-count-negative 5299Warn if shift count is negative. This warning is enabled by default. 5300 5301@item -Wshift-count-overflow 5302@opindex Wshift-count-overflow 5303@opindex Wno-shift-count-overflow 5304Warn if shift count >= width of type. This warning is enabled by default. 5305 5306@item -Wshift-negative-value 5307@opindex Wshift-negative-value 5308@opindex Wno-shift-negative-value 5309Warn if left shifting a negative value. This warning is enabled by 5310@option{-Wextra} in C99 and C++11 modes (and newer). 5311 5312@item -Wshift-overflow 5313@itemx -Wshift-overflow=@var{n} 5314@opindex Wshift-overflow 5315@opindex Wno-shift-overflow 5316Warn about left shift overflows. This warning is enabled by 5317default in C99 and C++11 modes (and newer). 5318 5319@table @gcctabopt 5320@item -Wshift-overflow=1 5321This is the warning level of @option{-Wshift-overflow} and is enabled 5322by default in C99 and C++11 modes (and newer). This warning level does 5323not warn about left-shifting 1 into the sign bit. (However, in C, such 5324an overflow is still rejected in contexts where an integer constant expression 5325is required.) No warning is emitted in C++2A mode (and newer), as signed left 5326shifts always wrap. 5327 5328@item -Wshift-overflow=2 5329This warning level also warns about left-shifting 1 into the sign bit, 5330unless C++14 mode (or newer) is active. 5331@end table 5332 5333@item -Wswitch 5334@opindex Wswitch 5335@opindex Wno-switch 5336Warn whenever a @code{switch} statement has an index of enumerated type 5337and lacks a @code{case} for one or more of the named codes of that 5338enumeration. (The presence of a @code{default} label prevents this 5339warning.) @code{case} labels outside the enumeration range also 5340provoke warnings when this option is used (even if there is a 5341@code{default} label). 5342This warning is enabled by @option{-Wall}. 5343 5344@item -Wswitch-default 5345@opindex Wswitch-default 5346@opindex Wno-switch-default 5347Warn whenever a @code{switch} statement does not have a @code{default} 5348case. 5349 5350@item -Wswitch-enum 5351@opindex Wswitch-enum 5352@opindex Wno-switch-enum 5353Warn whenever a @code{switch} statement has an index of enumerated type 5354and lacks a @code{case} for one or more of the named codes of that 5355enumeration. @code{case} labels outside the enumeration range also 5356provoke warnings when this option is used. The only difference 5357between @option{-Wswitch} and this option is that this option gives a 5358warning about an omitted enumeration code even if there is a 5359@code{default} label. 5360 5361@item -Wswitch-bool 5362@opindex Wswitch-bool 5363@opindex Wno-switch-bool 5364Warn whenever a @code{switch} statement has an index of boolean type 5365and the case values are outside the range of a boolean type. 5366It is possible to suppress this warning by casting the controlling 5367expression to a type other than @code{bool}. For example: 5368@smallexample 5369@group 5370switch ((int) (a == 4)) 5371 @{ 5372 @dots{} 5373 @} 5374@end group 5375@end smallexample 5376This warning is enabled by default for C and C++ programs. 5377 5378@item -Wswitch-unreachable 5379@opindex Wswitch-unreachable 5380@opindex Wno-switch-unreachable 5381Warn whenever a @code{switch} statement contains statements between the 5382controlling expression and the first case label, which will never be 5383executed. For example: 5384@smallexample 5385@group 5386switch (cond) 5387 @{ 5388 i = 15; 5389 @dots{} 5390 case 5: 5391 @dots{} 5392 @} 5393@end group 5394@end smallexample 5395@option{-Wswitch-unreachable} does not warn if the statement between the 5396controlling expression and the first case label is just a declaration: 5397@smallexample 5398@group 5399switch (cond) 5400 @{ 5401 int i; 5402 @dots{} 5403 case 5: 5404 i = 5; 5405 @dots{} 5406 @} 5407@end group 5408@end smallexample 5409This warning is enabled by default for C and C++ programs. 5410 5411@item -Wsync-nand @r{(C and C++ only)} 5412@opindex Wsync-nand 5413@opindex Wno-sync-nand 5414Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 5415built-in functions are used. These functions changed semantics in GCC 4.4. 5416 5417@item -Wunused-but-set-parameter 5418@opindex Wunused-but-set-parameter 5419@opindex Wno-unused-but-set-parameter 5420Warn whenever a function parameter is assigned to, but otherwise unused 5421(aside from its declaration). 5422 5423To suppress this warning use the @code{unused} attribute 5424(@pxref{Variable Attributes}). 5425 5426This warning is also enabled by @option{-Wunused} together with 5427@option{-Wextra}. 5428 5429@item -Wunused-but-set-variable 5430@opindex Wunused-but-set-variable 5431@opindex Wno-unused-but-set-variable 5432Warn whenever a local variable is assigned to, but otherwise unused 5433(aside from its declaration). 5434This warning is enabled by @option{-Wall}. 5435 5436To suppress this warning use the @code{unused} attribute 5437(@pxref{Variable Attributes}). 5438 5439This warning is also enabled by @option{-Wunused}, which is enabled 5440by @option{-Wall}. 5441 5442@item -Wunused-function 5443@opindex Wunused-function 5444@opindex Wno-unused-function 5445Warn whenever a static function is declared but not defined or a 5446non-inline static function is unused. 5447This warning is enabled by @option{-Wall}. 5448 5449@item -Wunused-label 5450@opindex Wunused-label 5451@opindex Wno-unused-label 5452Warn whenever a label is declared but not used. 5453This warning is enabled by @option{-Wall}. 5454 5455To suppress this warning use the @code{unused} attribute 5456(@pxref{Variable Attributes}). 5457 5458@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 5459@opindex Wunused-local-typedefs 5460@opindex Wno-unused-local-typedefs 5461Warn when a typedef locally defined in a function is not used. 5462This warning is enabled by @option{-Wall}. 5463 5464@item -Wunused-parameter 5465@opindex Wunused-parameter 5466@opindex Wno-unused-parameter 5467Warn whenever a function parameter is unused aside from its declaration. 5468 5469To suppress this warning use the @code{unused} attribute 5470(@pxref{Variable Attributes}). 5471 5472@item -Wno-unused-result 5473@opindex Wunused-result 5474@opindex Wno-unused-result 5475Do not warn if a caller of a function marked with attribute 5476@code{warn_unused_result} (@pxref{Function Attributes}) does not use 5477its return value. The default is @option{-Wunused-result}. 5478 5479@item -Wunused-variable 5480@opindex Wunused-variable 5481@opindex Wno-unused-variable 5482Warn whenever a local or static variable is unused aside from its 5483declaration. This option implies @option{-Wunused-const-variable=1} for C, 5484but not for C++. This warning is enabled by @option{-Wall}. 5485 5486To suppress this warning use the @code{unused} attribute 5487(@pxref{Variable Attributes}). 5488 5489@item -Wunused-const-variable 5490@itemx -Wunused-const-variable=@var{n} 5491@opindex Wunused-const-variable 5492@opindex Wno-unused-const-variable 5493Warn whenever a constant static variable is unused aside from its declaration. 5494@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable} 5495for C, but not for C++. In C this declares variable storage, but in C++ this 5496is not an error since const variables take the place of @code{#define}s. 5497 5498To suppress this warning use the @code{unused} attribute 5499(@pxref{Variable Attributes}). 5500 5501@table @gcctabopt 5502@item -Wunused-const-variable=1 5503This is the warning level that is enabled by @option{-Wunused-variable} for 5504C. It warns only about unused static const variables defined in the main 5505compilation unit, but not about static const variables declared in any 5506header included. 5507 5508@item -Wunused-const-variable=2 5509This warning level also warns for unused constant static variables in 5510headers (excluding system headers). This is the warning level of 5511@option{-Wunused-const-variable} and must be explicitly requested since 5512in C++ this isn't an error and in C it might be harder to clean up all 5513headers included. 5514@end table 5515 5516@item -Wunused-value 5517@opindex Wunused-value 5518@opindex Wno-unused-value 5519Warn whenever a statement computes a result that is explicitly not 5520used. To suppress this warning cast the unused expression to 5521@code{void}. This includes an expression-statement or the left-hand 5522side of a comma expression that contains no side effects. For example, 5523an expression such as @code{x[i,j]} causes a warning, while 5524@code{x[(void)i,j]} does not. 5525 5526This warning is enabled by @option{-Wall}. 5527 5528@item -Wunused 5529@opindex Wunused 5530@opindex Wno-unused 5531All the above @option{-Wunused} options combined. 5532 5533In order to get a warning about an unused function parameter, you must 5534either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 5535@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 5536 5537@item -Wuninitialized 5538@opindex Wuninitialized 5539@opindex Wno-uninitialized 5540Warn if an automatic variable is used without first being initialized 5541or if a variable may be clobbered by a @code{setjmp} call. In C++, 5542warn if a non-static reference or non-static @code{const} member 5543appears in a class without constructors. 5544 5545If you want to warn about code that uses the uninitialized value of the 5546variable in its own initializer, use the @option{-Winit-self} option. 5547 5548These warnings occur for individual uninitialized or clobbered 5549elements of structure, union or array variables as well as for 5550variables that are uninitialized or clobbered as a whole. They do 5551not occur for variables or elements declared @code{volatile}. Because 5552these warnings depend on optimization, the exact variables or elements 5553for which there are warnings depends on the precise optimization 5554options and version of GCC used. 5555 5556Note that there may be no warning about a variable that is used only 5557to compute a value that itself is never used, because such 5558computations may be deleted by data flow analysis before the warnings 5559are printed. 5560 5561@item -Winvalid-memory-model 5562@opindex Winvalid-memory-model 5563@opindex Wno-invalid-memory-model 5564Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, 5565and the C11 atomic generic functions with a memory consistency argument 5566that is either invalid for the operation or outside the range of values 5567of the @code{memory_order} enumeration. For example, since the 5568@code{__atomic_store} and @code{__atomic_store_n} built-ins are only 5569defined for the relaxed, release, and sequentially consistent memory 5570orders the following code is diagnosed: 5571 5572@smallexample 5573void store (int *i) 5574@{ 5575 __atomic_store_n (i, 0, memory_order_consume); 5576@} 5577@end smallexample 5578 5579@option{-Winvalid-memory-model} is enabled by default. 5580 5581@item -Wmaybe-uninitialized 5582@opindex Wmaybe-uninitialized 5583@opindex Wno-maybe-uninitialized 5584For an automatic (i.e.@: local) variable, if there exists a path from the 5585function entry to a use of the variable that is initialized, but there exist 5586some other paths for which the variable is not initialized, the compiler 5587emits a warning if it cannot prove the uninitialized paths are not 5588executed at run time. 5589 5590These warnings are only possible in optimizing compilation, because otherwise 5591GCC does not keep track of the state of variables. 5592 5593These warnings are made optional because GCC may not be able to determine when 5594the code is correct in spite of appearing to have an error. Here is one 5595example of how this can happen: 5596 5597@smallexample 5598@group 5599@{ 5600 int x; 5601 switch (y) 5602 @{ 5603 case 1: x = 1; 5604 break; 5605 case 2: x = 4; 5606 break; 5607 case 3: x = 5; 5608 @} 5609 foo (x); 5610@} 5611@end group 5612@end smallexample 5613 5614@noindent 5615If the value of @code{y} is always 1, 2 or 3, then @code{x} is 5616always initialized, but GCC doesn't know this. To suppress the 5617warning, you need to provide a default case with assert(0) or 5618similar code. 5619 5620@cindex @code{longjmp} warnings 5621This option also warns when a non-volatile automatic variable might be 5622changed by a call to @code{longjmp}. 5623The compiler sees only the calls to @code{setjmp}. It cannot know 5624where @code{longjmp} will be called; in fact, a signal handler could 5625call it at any point in the code. As a result, you may get a warning 5626even when there is in fact no problem because @code{longjmp} cannot 5627in fact be called at the place that would cause a problem. 5628 5629Some spurious warnings can be avoided if you declare all the functions 5630you use that never return as @code{noreturn}. @xref{Function 5631Attributes}. 5632 5633This warning is enabled by @option{-Wall} or @option{-Wextra}. 5634 5635@item -Wunknown-pragmas 5636@opindex Wunknown-pragmas 5637@opindex Wno-unknown-pragmas 5638@cindex warning for unknown pragmas 5639@cindex unknown pragmas, warning 5640@cindex pragmas, warning of unknown 5641Warn when a @code{#pragma} directive is encountered that is not understood by 5642GCC@. If this command-line option is used, warnings are even issued 5643for unknown pragmas in system header files. This is not the case if 5644the warnings are only enabled by the @option{-Wall} command-line option. 5645 5646@item -Wno-pragmas 5647@opindex Wno-pragmas 5648@opindex Wpragmas 5649Do not warn about misuses of pragmas, such as incorrect parameters, 5650invalid syntax, or conflicts between pragmas. See also 5651@option{-Wunknown-pragmas}. 5652 5653@item -Wno-prio-ctor-dtor 5654@opindex Wno-prio-ctor-dtor 5655@opindex Wprio-ctor-dtor 5656Do not warn if a priority from 0 to 100 is used for constructor or destructor. 5657The use of constructor and destructor attributes allow you to assign a 5658priority to the constructor/destructor to control its order of execution 5659before @code{main} is called or after it returns. The priority values must be 5660greater than 100 as the compiler reserves priority values between 0--100 for 5661the implementation. 5662 5663@item -Wstrict-aliasing 5664@opindex Wstrict-aliasing 5665@opindex Wno-strict-aliasing 5666This option is only active when @option{-fstrict-aliasing} is active. 5667It warns about code that might break the strict aliasing rules that the 5668compiler is using for optimization. The warning does not catch all 5669cases, but does attempt to catch the more common pitfalls. It is 5670included in @option{-Wall}. 5671It is equivalent to @option{-Wstrict-aliasing=3} 5672 5673@item -Wstrict-aliasing=n 5674@opindex Wstrict-aliasing=n 5675This option is only active when @option{-fstrict-aliasing} is active. 5676It warns about code that might break the strict aliasing rules that the 5677compiler is using for optimization. 5678Higher levels correspond to higher accuracy (fewer false positives). 5679Higher levels also correspond to more effort, similar to the way @option{-O} 5680works. 5681@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 5682 5683Level 1: Most aggressive, quick, least accurate. 5684Possibly useful when higher levels 5685do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 5686false negatives. However, it has many false positives. 5687Warns for all pointer conversions between possibly incompatible types, 5688even if never dereferenced. Runs in the front end only. 5689 5690Level 2: Aggressive, quick, not too precise. 5691May still have many false positives (not as many as level 1 though), 5692and few false negatives (but possibly more than level 1). 5693Unlike level 1, it only warns when an address is taken. Warns about 5694incomplete types. Runs in the front end only. 5695 5696Level 3 (default for @option{-Wstrict-aliasing}): 5697Should have very few false positives and few false 5698negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 5699Takes care of the common pun+dereference pattern in the front end: 5700@code{*(int*)&some_float}. 5701If optimization is enabled, it also runs in the back end, where it deals 5702with multiple statement cases using flow-sensitive points-to information. 5703Only warns when the converted pointer is dereferenced. 5704Does not warn about incomplete types. 5705 5706@item -Wstrict-overflow 5707@itemx -Wstrict-overflow=@var{n} 5708@opindex Wstrict-overflow 5709@opindex Wno-strict-overflow 5710This option is only active when signed overflow is undefined. 5711It warns about cases where the compiler optimizes based on the 5712assumption that signed overflow does not occur. Note that it does not 5713warn about all cases where the code might overflow: it only warns 5714about cases where the compiler implements some optimization. Thus 5715this warning depends on the optimization level. 5716 5717An optimization that assumes that signed overflow does not occur is 5718perfectly safe if the values of the variables involved are such that 5719overflow never does, in fact, occur. Therefore this warning can 5720easily give a false positive: a warning about code that is not 5721actually a problem. To help focus on important issues, several 5722warning levels are defined. No warnings are issued for the use of 5723undefined signed overflow when estimating how many iterations a loop 5724requires, in particular when determining whether a loop will be 5725executed at all. 5726 5727@table @gcctabopt 5728@item -Wstrict-overflow=1 5729Warn about cases that are both questionable and easy to avoid. For 5730example the compiler simplifies 5731@code{x + 1 > x} to @code{1}. This level of 5732@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 5733are not, and must be explicitly requested. 5734 5735@item -Wstrict-overflow=2 5736Also warn about other cases where a comparison is simplified to a 5737constant. For example: @code{abs (x) >= 0}. This can only be 5738simplified when signed integer overflow is undefined, because 5739@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 5740zero. @option{-Wstrict-overflow} (with no level) is the same as 5741@option{-Wstrict-overflow=2}. 5742 5743@item -Wstrict-overflow=3 5744Also warn about other cases where a comparison is simplified. For 5745example: @code{x + 1 > 1} is simplified to @code{x > 0}. 5746 5747@item -Wstrict-overflow=4 5748Also warn about other simplifications not covered by the above cases. 5749For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 5750 5751@item -Wstrict-overflow=5 5752Also warn about cases where the compiler reduces the magnitude of a 5753constant involved in a comparison. For example: @code{x + 2 > y} is 5754simplified to @code{x + 1 >= y}. This is reported only at the 5755highest warning level because this simplification applies to many 5756comparisons, so this warning level gives a very large number of 5757false positives. 5758@end table 5759 5760@item -Wstringop-overflow 5761@itemx -Wstringop-overflow=@var{type} 5762@opindex Wstringop-overflow 5763@opindex Wno-stringop-overflow 5764Warn for calls to string manipulation functions such as @code{memcpy} and 5765@code{strcpy} that are determined to overflow the destination buffer. The 5766optional argument is one greater than the type of Object Size Checking to 5767perform to determine the size of the destination. @xref{Object Size Checking}. 5768The argument is meaningful only for functions that operate on character arrays 5769but not for raw memory functions like @code{memcpy} which always make use 5770of Object Size type-0. The option also warns for calls that specify a size 5771in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes. 5772The option produces the best results with optimization enabled but can detect 5773a small subset of simple buffer overflows even without optimization in 5774calls to the GCC built-in functions like @code{__builtin_memcpy} that 5775correspond to the standard functions. In any case, the option warns about 5776just a subset of buffer overflows detected by the corresponding overflow 5777checking built-ins. For example, the option will issue a warning for 5778the @code{strcpy} call below because it copies at least 5 characters 5779(the string @code{"blue"} including the terminating NUL) into the buffer 5780of size 4. 5781 5782@smallexample 5783enum Color @{ blue, purple, yellow @}; 5784const char* f (enum Color clr) 5785@{ 5786 static char buf [4]; 5787 const char *str; 5788 switch (clr) 5789 @{ 5790 case blue: str = "blue"; break; 5791 case purple: str = "purple"; break; 5792 case yellow: str = "yellow"; break; 5793 @} 5794 5795 return strcpy (buf, str); // warning here 5796@} 5797@end smallexample 5798 5799Option @option{-Wstringop-overflow=2} is enabled by default. 5800 5801@table @gcctabopt 5802@item -Wstringop-overflow 5803@itemx -Wstringop-overflow=1 5804@opindex Wstringop-overflow 5805@opindex Wno-stringop-overflow 5806The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking 5807to determine the sizes of destination objects. This is the default setting 5808of the option. At this setting the option will not warn for writes past 5809the end of subobjects of larger objects accessed by pointers unless the 5810size of the largest surrounding object is known. When the destination may 5811be one of several objects it is assumed to be the largest one of them. On 5812Linux systems, when optimization is enabled at this setting the option warns 5813for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to 5814a non-zero value. 5815 5816@item -Wstringop-overflow=2 5817The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking 5818to determine the sizes of destination objects. At this setting the option 5819will warn about overflows when writing to members of the largest complete 5820objects whose exact size is known. It will, however, not warn for excessive 5821writes to the same members of unknown objects referenced by pointers since 5822they may point to arrays containing unknown numbers of elements. 5823 5824@item -Wstringop-overflow=3 5825The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking 5826to determine the sizes of destination objects. At this setting the option 5827warns about overflowing the smallest object or data member. This is the 5828most restrictive setting of the option that may result in warnings for safe 5829code. 5830 5831@item -Wstringop-overflow=4 5832The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking 5833to determine the sizes of destination objects. At this setting the option 5834will warn about overflowing any data members, and when the destination is 5835one of several objects it uses the size of the largest of them to decide 5836whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this 5837setting of the option may result in warnings for benign code. 5838@end table 5839 5840@item -Wstringop-truncation 5841@opindex Wstringop-truncation 5842@opindex Wno-stringop-truncation 5843Warn for calls to bounded string manipulation functions such as @code{strncat}, 5844@code{strncpy}, and @code{stpncpy} that may either truncate the copied string 5845or leave the destination unchanged. 5846 5847In the following example, the call to @code{strncat} specifies a bound that 5848is less than the length of the source string. As a result, the copy of 5849the source will be truncated and so the call is diagnosed. To avoid the 5850warning use @code{bufsize - strlen (buf) - 1)} as the bound. 5851 5852@smallexample 5853void append (char *buf, size_t bufsize) 5854@{ 5855 strncat (buf, ".txt", 3); 5856@} 5857@end smallexample 5858 5859As another example, the following call to @code{strncpy} results in copying 5860to @code{d} just the characters preceding the terminating NUL, without 5861appending the NUL to the end. Assuming the result of @code{strncpy} is 5862necessarily a NUL-terminated string is a common mistake, and so the call 5863is diagnosed. To avoid the warning when the result is not expected to be 5864NUL-terminated, call @code{memcpy} instead. 5865 5866@smallexample 5867void copy (char *d, const char *s) 5868@{ 5869 strncpy (d, s, strlen (s)); 5870@} 5871@end smallexample 5872 5873In the following example, the call to @code{strncpy} specifies the size 5874of the destination buffer as the bound. If the length of the source 5875string is equal to or greater than this size the result of the copy will 5876not be NUL-terminated. Therefore, the call is also diagnosed. To avoid 5877the warning, specify @code{sizeof buf - 1} as the bound and set the last 5878element of the buffer to @code{NUL}. 5879 5880@smallexample 5881void copy (const char *s) 5882@{ 5883 char buf[80]; 5884 strncpy (buf, s, sizeof buf); 5885 @dots{} 5886@} 5887@end smallexample 5888 5889In situations where a character array is intended to store a sequence 5890of bytes with no terminating @code{NUL} such an array may be annotated 5891with attribute @code{nonstring} to avoid this warning. Such arrays, 5892however, are not suitable arguments to functions that expect 5893@code{NUL}-terminated strings. To help detect accidental misuses of 5894such arrays GCC issues warnings unless it can prove that the use is 5895safe. @xref{Common Variable Attributes}. 5896 5897@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]} 5898@opindex Wsuggest-attribute= 5899@opindex Wno-suggest-attribute= 5900Warn for cases where adding an attribute may be beneficial. The 5901attributes currently supported are listed below. 5902 5903@table @gcctabopt 5904@item -Wsuggest-attribute=pure 5905@itemx -Wsuggest-attribute=const 5906@itemx -Wsuggest-attribute=noreturn 5907@itemx -Wmissing-noreturn 5908@itemx -Wsuggest-attribute=malloc 5909@opindex Wsuggest-attribute=pure 5910@opindex Wno-suggest-attribute=pure 5911@opindex Wsuggest-attribute=const 5912@opindex Wno-suggest-attribute=const 5913@opindex Wsuggest-attribute=noreturn 5914@opindex Wno-suggest-attribute=noreturn 5915@opindex Wmissing-noreturn 5916@opindex Wno-missing-noreturn 5917@opindex Wsuggest-attribute=malloc 5918@opindex Wno-suggest-attribute=malloc 5919 5920Warn about functions that might be candidates for attributes 5921@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler 5922only warns for functions visible in other compilation units or (in the case of 5923@code{pure} and @code{const}) if it cannot prove that the function returns 5924normally. A function returns normally if it doesn't contain an infinite loop or 5925return abnormally by throwing, calling @code{abort} or trapping. This analysis 5926requires option @option{-fipa-pure-const}, which is enabled by default at 5927@option{-O} and higher. Higher optimization levels improve the accuracy 5928of the analysis. 5929 5930@item -Wsuggest-attribute=format 5931@itemx -Wmissing-format-attribute 5932@opindex Wsuggest-attribute=format 5933@opindex Wmissing-format-attribute 5934@opindex Wno-suggest-attribute=format 5935@opindex Wno-missing-format-attribute 5936@opindex Wformat 5937@opindex Wno-format 5938 5939Warn about function pointers that might be candidates for @code{format} 5940attributes. Note these are only possible candidates, not absolute ones. 5941GCC guesses that function pointers with @code{format} attributes that 5942are used in assignment, initialization, parameter passing or return 5943statements should have a corresponding @code{format} attribute in the 5944resulting type. I.e.@: the left-hand side of the assignment or 5945initialization, the type of the parameter variable, or the return type 5946of the containing function respectively should also have a @code{format} 5947attribute to avoid the warning. 5948 5949GCC also warns about function definitions that might be 5950candidates for @code{format} attributes. Again, these are only 5951possible candidates. GCC guesses that @code{format} attributes 5952might be appropriate for any function that calls a function like 5953@code{vprintf} or @code{vscanf}, but this might not always be the 5954case, and some functions for which @code{format} attributes are 5955appropriate may not be detected. 5956 5957@item -Wsuggest-attribute=cold 5958@opindex Wsuggest-attribute=cold 5959@opindex Wno-suggest-attribute=cold 5960 5961Warn about functions that might be candidates for @code{cold} attribute. This 5962is based on static detection and generally will only warn about functions which 5963always leads to a call to another @code{cold} function such as wrappers of 5964C++ @code{throw} or fatal error reporting functions leading to @code{abort}. 5965@end table 5966 5967@item -Wsuggest-final-types 5968@opindex Wno-suggest-final-types 5969@opindex Wsuggest-final-types 5970Warn about types with virtual methods where code quality would be improved 5971if the type were declared with the C++11 @code{final} specifier, 5972or, if possible, 5973declared in an anonymous namespace. This allows GCC to more aggressively 5974devirtualize the polymorphic calls. This warning is more effective with link 5975time optimization, where the information about the class hierarchy graph is 5976more complete. 5977 5978@item -Wsuggest-final-methods 5979@opindex Wno-suggest-final-methods 5980@opindex Wsuggest-final-methods 5981Warn about virtual methods where code quality would be improved if the method 5982were declared with the C++11 @code{final} specifier, 5983or, if possible, its type were 5984declared in an anonymous namespace or with the @code{final} specifier. 5985This warning is 5986more effective with link-time optimization, where the information about the 5987class hierarchy graph is more complete. It is recommended to first consider 5988suggestions of @option{-Wsuggest-final-types} and then rebuild with new 5989annotations. 5990 5991@item -Wsuggest-override 5992Warn about overriding virtual functions that are not marked with the override 5993keyword. 5994 5995@item -Walloc-zero 5996@opindex Wno-alloc-zero 5997@opindex Walloc-zero 5998Warn about calls to allocation functions decorated with attribute 5999@code{alloc_size} that specify zero bytes, including those to the built-in 6000forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc}, 6001@code{malloc}, and @code{realloc}. Because the behavior of these functions 6002when called with a zero size differs among implementations (and in the case 6003of @code{realloc} has been deprecated) relying on it may result in subtle 6004portability bugs and should be avoided. 6005 6006@item -Walloc-size-larger-than=@var{byte-size} 6007@opindex Walloc-size-larger-than= 6008@opindex Wno-alloc-size-larger-than 6009Warn about calls to functions decorated with attribute @code{alloc_size} 6010that attempt to allocate objects larger than the specified number of bytes, 6011or where the result of the size computation in an integer type with infinite 6012precision would exceed the value of @samp{PTRDIFF_MAX} on the target. 6013@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 6014Warnings controlled by the option can be disabled either by specifying 6015@var{byte-size} of @samp{SIZE_MAX} or more or by 6016@option{-Wno-alloc-size-larger-than}. 6017@xref{Function Attributes}. 6018 6019@item -Wno-alloc-size-larger-than 6020@opindex Wno-alloc-size-larger-than 6021Disable @option{-Walloc-size-larger-than=} warnings. The option is 6022equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or 6023larger. 6024 6025@item -Walloca 6026@opindex Wno-alloca 6027@opindex Walloca 6028This option warns on all uses of @code{alloca} in the source. 6029 6030@item -Walloca-larger-than=@var{byte-size} 6031@opindex Walloca-larger-than= 6032@opindex Wno-alloca-larger-than 6033This option warns on calls to @code{alloca} with an integer argument whose 6034value is either zero, or that is not bounded by a controlling predicate 6035that limits its value to at most @var{byte-size}. It also warns for calls 6036to @code{alloca} where the bound value is unknown. Arguments of non-integer 6037types are considered unbounded even if they appear to be constrained to 6038the expected range. 6039 6040For example, a bounded case of @code{alloca} could be: 6041 6042@smallexample 6043void func (size_t n) 6044@{ 6045 void *p; 6046 if (n <= 1000) 6047 p = alloca (n); 6048 else 6049 p = malloc (n); 6050 f (p); 6051@} 6052@end smallexample 6053 6054In the above example, passing @code{-Walloca-larger-than=1000} would not 6055issue a warning because the call to @code{alloca} is known to be at most 60561000 bytes. However, if @code{-Walloca-larger-than=500} were passed, 6057the compiler would emit a warning. 6058 6059Unbounded uses, on the other hand, are uses of @code{alloca} with no 6060controlling predicate constraining its integer argument. For example: 6061 6062@smallexample 6063void func () 6064@{ 6065 void *p = alloca (n); 6066 f (p); 6067@} 6068@end smallexample 6069 6070If @code{-Walloca-larger-than=500} were passed, the above would trigger 6071a warning, but this time because of the lack of bounds checking. 6072 6073Note, that even seemingly correct code involving signed integers could 6074cause a warning: 6075 6076@smallexample 6077void func (signed int n) 6078@{ 6079 if (n < 500) 6080 @{ 6081 p = alloca (n); 6082 f (p); 6083 @} 6084@} 6085@end smallexample 6086 6087In the above example, @var{n} could be negative, causing a larger than 6088expected argument to be implicitly cast into the @code{alloca} call. 6089 6090This option also warns when @code{alloca} is used in a loop. 6091 6092@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default 6093but is usually only effective when @option{-ftree-vrp} is active (default 6094for @option{-O2} and above). 6095 6096See also @option{-Wvla-larger-than=}@samp{byte-size}. 6097 6098@item -Wno-alloca-larger-than 6099@opindex Wno-alloca-larger-than 6100Disable @option{-Walloca-larger-than=} warnings. The option is 6101equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger. 6102 6103@item -Warray-bounds 6104@itemx -Warray-bounds=@var{n} 6105@opindex Wno-array-bounds 6106@opindex Warray-bounds 6107This option is only active when @option{-ftree-vrp} is active 6108(default for @option{-O2} and above). It warns about subscripts to arrays 6109that are always out of bounds. This warning is enabled by @option{-Wall}. 6110 6111@table @gcctabopt 6112@item -Warray-bounds=1 6113This is the warning level of @option{-Warray-bounds} and is enabled 6114by @option{-Wall}; higher levels are not, and must be explicitly requested. 6115 6116@item -Warray-bounds=2 6117This warning level also warns about out of bounds access for 6118arrays at the end of a struct and for arrays accessed through 6119pointers. This warning level may give a larger number of 6120false positives and is deactivated by default. 6121@end table 6122 6123@item -Wattribute-alias=@var{n} 6124@itemx -Wno-attribute-alias 6125@opindex -Wattribute-alias 6126@opindex -Wno-attribute-alias 6127Warn about declarations using the @code{alias} and similar attributes whose 6128target is incompatible with the type of the alias. 6129@xref{Function Attributes,,Declaring Attributes of Functions}. 6130 6131@table @gcctabopt 6132@item -Wattribute-alias=1 6133The default warning level of the @option{-Wattribute-alias} option diagnoses 6134incompatibilities between the type of the alias declaration and that of its 6135target. Such incompatibilities are typically indicative of bugs. 6136 6137@item -Wattribute-alias=2 6138 6139At this level @option{-Wattribute-alias} also diagnoses cases where 6140the attributes of the alias declaration are more restrictive than the 6141attributes applied to its target. These mismatches can potentially 6142result in incorrect code generation. In other cases they may be 6143benign and could be resolved simply by adding the missing attribute to 6144the target. For comparison, see the @option{-Wmissing-attributes} 6145option, which controls diagnostics when the alias declaration is less 6146restrictive than the target, rather than more restrictive. 6147 6148Attributes considered include @code{alloc_align}, @code{alloc_size}, 6149@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 6150@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 6151@code{returns_nonnull}, and @code{returns_twice}. 6152@end table 6153 6154@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}. 6155This is the default. You can disable these warnings with either 6156@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}. 6157 6158@item -Wbool-compare 6159@opindex Wno-bool-compare 6160@opindex Wbool-compare 6161Warn about boolean expression compared with an integer value different from 6162@code{true}/@code{false}. For instance, the following comparison is 6163always false: 6164@smallexample 6165int n = 5; 6166@dots{} 6167if ((n > 1) == 2) @{ @dots{} @} 6168@end smallexample 6169This warning is enabled by @option{-Wall}. 6170 6171@item -Wbool-operation 6172@opindex Wno-bool-operation 6173@opindex Wbool-operation 6174Warn about suspicious operations on expressions of a boolean type. For 6175instance, bitwise negation of a boolean is very likely a bug in the program. 6176For C, this warning also warns about incrementing or decrementing a boolean, 6177which rarely makes sense. (In C++, decrementing a boolean is always invalid. 6178Incrementing a boolean is invalid in C++17, and deprecated otherwise.) 6179 6180This warning is enabled by @option{-Wall}. 6181 6182@item -Wduplicated-branches 6183@opindex Wno-duplicated-branches 6184@opindex Wduplicated-branches 6185Warn when an if-else has identical branches. This warning detects cases like 6186@smallexample 6187if (p != NULL) 6188 return 0; 6189else 6190 return 0; 6191@end smallexample 6192It doesn't warn when both branches contain just a null statement. This warning 6193also warn for conditional operators: 6194@smallexample 6195 int i = x ? *p : *p; 6196@end smallexample 6197 6198@item -Wduplicated-cond 6199@opindex Wno-duplicated-cond 6200@opindex Wduplicated-cond 6201Warn about duplicated conditions in an if-else-if chain. For instance, 6202warn for the following code: 6203@smallexample 6204if (p->q != NULL) @{ @dots{} @} 6205else if (p->q != NULL) @{ @dots{} @} 6206@end smallexample 6207 6208@item -Wframe-address 6209@opindex Wno-frame-address 6210@opindex Wframe-address 6211Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address} 6212is called with an argument greater than 0. Such calls may return indeterminate 6213values or crash the program. The warning is included in @option{-Wall}. 6214 6215@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 6216@opindex Wno-discarded-qualifiers 6217@opindex Wdiscarded-qualifiers 6218Do not warn if type qualifiers on pointers are being discarded. 6219Typically, the compiler warns if a @code{const char *} variable is 6220passed to a function that takes a @code{char *} parameter. This option 6221can be used to suppress such a warning. 6222 6223@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 6224@opindex Wno-discarded-array-qualifiers 6225@opindex Wdiscarded-array-qualifiers 6226Do not warn if type qualifiers on arrays which are pointer targets 6227are being discarded. Typically, the compiler warns if a 6228@code{const int (*)[]} variable is passed to a function that 6229takes a @code{int (*)[]} parameter. This option can be used to 6230suppress such a warning. 6231 6232@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 6233@opindex Wno-incompatible-pointer-types 6234@opindex Wincompatible-pointer-types 6235Do not warn when there is a conversion between pointers that have incompatible 6236types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 6237which warns for pointer argument passing or assignment with different 6238signedness. 6239 6240@item -Wno-int-conversion @r{(C and Objective-C only)} 6241@opindex Wno-int-conversion 6242@opindex Wint-conversion 6243Do not warn about incompatible integer to pointer and pointer to integer 6244conversions. This warning is about implicit conversions; for explicit 6245conversions the warnings @option{-Wno-int-to-pointer-cast} and 6246@option{-Wno-pointer-to-int-cast} may be used. 6247 6248@item -Wno-div-by-zero 6249@opindex Wno-div-by-zero 6250@opindex Wdiv-by-zero 6251Do not warn about compile-time integer division by zero. Floating-point 6252division by zero is not warned about, as it can be a legitimate way of 6253obtaining infinities and NaNs. 6254 6255@item -Wsystem-headers 6256@opindex Wsystem-headers 6257@opindex Wno-system-headers 6258@cindex warnings from system headers 6259@cindex system headers, warnings from 6260Print warning messages for constructs found in system header files. 6261Warnings from system headers are normally suppressed, on the assumption 6262that they usually do not indicate real problems and would only make the 6263compiler output harder to read. Using this command-line option tells 6264GCC to emit warnings from system headers as if they occurred in user 6265code. However, note that using @option{-Wall} in conjunction with this 6266option does @emph{not} warn about unknown pragmas in system 6267headers---for that, @option{-Wunknown-pragmas} must also be used. 6268 6269@item -Wtautological-compare 6270@opindex Wtautological-compare 6271@opindex Wno-tautological-compare 6272Warn if a self-comparison always evaluates to true or false. This 6273warning detects various mistakes such as: 6274@smallexample 6275int i = 1; 6276@dots{} 6277if (i > i) @{ @dots{} @} 6278@end smallexample 6279 6280This warning also warns about bitwise comparisons that always evaluate 6281to true or false, for instance: 6282@smallexample 6283if ((a & 16) == 10) @{ @dots{} @} 6284@end smallexample 6285will always be false. 6286 6287This warning is enabled by @option{-Wall}. 6288 6289@item -Wtrampolines 6290@opindex Wtrampolines 6291@opindex Wno-trampolines 6292Warn about trampolines generated for pointers to nested functions. 6293A trampoline is a small piece of data or code that is created at run 6294time on the stack when the address of a nested function is taken, and is 6295used to call the nested function indirectly. For some targets, it is 6296made up of data only and thus requires no special treatment. But, for 6297most targets, it is made up of code and thus requires the stack to be 6298made executable in order for the program to work properly. 6299 6300@item -Wfloat-equal 6301@opindex Wfloat-equal 6302@opindex Wno-float-equal 6303Warn if floating-point values are used in equality comparisons. 6304 6305The idea behind this is that sometimes it is convenient (for the 6306programmer) to consider floating-point values as approximations to 6307infinitely precise real numbers. If you are doing this, then you need 6308to compute (by analyzing the code, or in some other way) the maximum or 6309likely maximum error that the computation introduces, and allow for it 6310when performing comparisons (and when producing output, but that's a 6311different problem). In particular, instead of testing for equality, you 6312should check to see whether the two values have ranges that overlap; and 6313this is done with the relational operators, so equality comparisons are 6314probably mistaken. 6315 6316@item -Wtraditional @r{(C and Objective-C only)} 6317@opindex Wtraditional 6318@opindex Wno-traditional 6319Warn about certain constructs that behave differently in traditional and 6320ISO C@. Also warn about ISO C constructs that have no traditional C 6321equivalent, and/or problematic constructs that should be avoided. 6322 6323@itemize @bullet 6324@item 6325Macro parameters that appear within string literals in the macro body. 6326In traditional C macro replacement takes place within string literals, 6327but in ISO C it does not. 6328 6329@item 6330In traditional C, some preprocessor directives did not exist. 6331Traditional preprocessors only considered a line to be a directive 6332if the @samp{#} appeared in column 1 on the line. Therefore 6333@option{-Wtraditional} warns about directives that traditional C 6334understands but ignores because the @samp{#} does not appear as the 6335first character on the line. It also suggests you hide directives like 6336@code{#pragma} not understood by traditional C by indenting them. Some 6337traditional implementations do not recognize @code{#elif}, so this option 6338suggests avoiding it altogether. 6339 6340@item 6341A function-like macro that appears without arguments. 6342 6343@item 6344The unary plus operator. 6345 6346@item 6347The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 6348constant suffixes. (Traditional C does support the @samp{L} suffix on integer 6349constants.) Note, these suffixes appear in macros defined in the system 6350headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 6351Use of these macros in user code might normally lead to spurious 6352warnings, however GCC's integrated preprocessor has enough context to 6353avoid warning in these cases. 6354 6355@item 6356A function declared external in one block and then used after the end of 6357the block. 6358 6359@item 6360A @code{switch} statement has an operand of type @code{long}. 6361 6362@item 6363A non-@code{static} function declaration follows a @code{static} one. 6364This construct is not accepted by some traditional C compilers. 6365 6366@item 6367The ISO type of an integer constant has a different width or 6368signedness from its traditional type. This warning is only issued if 6369the base of the constant is ten. I.e.@: hexadecimal or octal values, which 6370typically represent bit patterns, are not warned about. 6371 6372@item 6373Usage of ISO string concatenation is detected. 6374 6375@item 6376Initialization of automatic aggregates. 6377 6378@item 6379Identifier conflicts with labels. Traditional C lacks a separate 6380namespace for labels. 6381 6382@item 6383Initialization of unions. If the initializer is zero, the warning is 6384omitted. This is done under the assumption that the zero initializer in 6385user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 6386initializer warnings and relies on default initialization to zero in the 6387traditional C case. 6388 6389@item 6390Conversions by prototypes between fixed/floating-point values and vice 6391versa. The absence of these prototypes when compiling with traditional 6392C causes serious problems. This is a subset of the possible 6393conversion warnings; for the full set use @option{-Wtraditional-conversion}. 6394 6395@item 6396Use of ISO C style function definitions. This warning intentionally is 6397@emph{not} issued for prototype declarations or variadic functions 6398because these ISO C features appear in your code when using 6399libiberty's traditional C compatibility macros, @code{PARAMS} and 6400@code{VPARAMS}. This warning is also bypassed for nested functions 6401because that feature is already a GCC extension and thus not relevant to 6402traditional C compatibility. 6403@end itemize 6404 6405@item -Wtraditional-conversion @r{(C and Objective-C only)} 6406@opindex Wtraditional-conversion 6407@opindex Wno-traditional-conversion 6408Warn if a prototype causes a type conversion that is different from what 6409would happen to the same argument in the absence of a prototype. This 6410includes conversions of fixed point to floating and vice versa, and 6411conversions changing the width or signedness of a fixed-point argument 6412except when the same as the default promotion. 6413 6414@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 6415@opindex Wdeclaration-after-statement 6416@opindex Wno-declaration-after-statement 6417Warn when a declaration is found after a statement in a block. This 6418construct, known from C++, was introduced with ISO C99 and is by default 6419allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}. 6420 6421@item -Wshadow 6422@opindex Wshadow 6423@opindex Wno-shadow 6424Warn whenever a local variable or type declaration shadows another 6425variable, parameter, type, class member (in C++), or instance variable 6426(in Objective-C) or whenever a built-in function is shadowed. Note 6427that in C++, the compiler warns if a local variable shadows an 6428explicit typedef, but not if it shadows a struct/class/enum. 6429Same as @option{-Wshadow=global}. 6430 6431@item -Wno-shadow-ivar @r{(Objective-C only)} 6432@opindex Wno-shadow-ivar 6433@opindex Wshadow-ivar 6434Do not warn whenever a local variable shadows an instance variable in an 6435Objective-C method. 6436 6437@item -Wshadow=global 6438@opindex Wshadow=local 6439The default for @option{-Wshadow}. Warns for any (global) shadowing. 6440 6441@item -Wshadow=local 6442@opindex Wshadow=local 6443Warn when a local variable shadows another local variable or parameter. 6444This warning is enabled by @option{-Wshadow=global}. 6445 6446@item -Wshadow=compatible-local 6447@opindex Wshadow=compatible-local 6448Warn when a local variable shadows another local variable or parameter 6449whose type is compatible with that of the shadowing variable. In C++, 6450type compatibility here means the type of the shadowing variable can be 6451converted to that of the shadowed variable. The creation of this flag 6452(in addition to @option{-Wshadow=local}) is based on the idea that when 6453a local variable shadows another one of incompatible type, it is most 6454likely intentional, not a bug or typo, as shown in the following example: 6455 6456@smallexample 6457@group 6458for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) 6459@{ 6460 for (int i = 0; i < N; ++i) 6461 @{ 6462 ... 6463 @} 6464 ... 6465@} 6466@end group 6467@end smallexample 6468 6469Since the two variable @code{i} in the example above have incompatible types, 6470enabling only @option{-Wshadow=compatible-local} will not emit a warning. 6471Because their types are incompatible, if a programmer accidentally uses one 6472in place of the other, type checking will catch that and emit an error or 6473warning. So not warning (about shadowing) in this case will not lead to 6474undetected bugs. Use of this flag instead of @option{-Wshadow=local} can 6475possibly reduce the number of warnings triggered by intentional shadowing. 6476 6477This warning is enabled by @option{-Wshadow=local}. 6478 6479@item -Wlarger-than=@var{byte-size} 6480@opindex Wlarger-than= 6481@opindex Wlarger-than-@var{byte-size} 6482Warn whenever an object is defined whose size exceeds @var{byte-size}. 6483@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default. 6484Warnings controlled by the option can be disabled either by specifying 6485@var{byte-size} of @samp{SIZE_MAX} or more or by 6486@option{-Wno-larger-than}. 6487 6488@item -Wno-larger-than 6489@opindex Wno-larger-than 6490Disable @option{-Wlarger-than=} warnings. The option is equivalent 6491to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger. 6492 6493@item -Wframe-larger-than=@var{byte-size} 6494@opindex Wframe-larger-than= 6495@opindex Wno-frame-larger-than 6496Warn if the size of a function frame exceeds @var{byte-size}. 6497The computation done to determine the stack frame size is approximate 6498and not conservative. 6499The actual requirements may be somewhat greater than @var{byte-size} 6500even if you do not get a warning. In addition, any space allocated 6501via @code{alloca}, variable-length arrays, or related constructs 6502is not included by the compiler when determining 6503whether or not to issue a warning. 6504@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 6505Warnings controlled by the option can be disabled either by specifying 6506@var{byte-size} of @samp{SIZE_MAX} or more or by 6507@option{-Wno-frame-larger-than}. 6508 6509@item -Wno-frame-larger-than 6510@opindex Wno-frame-larger-than 6511Disable @option{-Wframe-larger-than=} warnings. The option is equivalent 6512to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger. 6513 6514@item -Wno-free-nonheap-object 6515@opindex Wno-free-nonheap-object 6516@opindex Wfree-nonheap-object 6517Do not warn when attempting to free an object that was not allocated 6518on the heap. 6519 6520@item -Wstack-usage=@var{byte-size} 6521@opindex Wstack-usage 6522@opindex Wno-stack-usage 6523Warn if the stack usage of a function might exceed @var{byte-size}. 6524The computation done to determine the stack usage is conservative. 6525Any space allocated via @code{alloca}, variable-length arrays, or related 6526constructs is included by the compiler when determining whether or not to 6527issue a warning. 6528 6529The message is in keeping with the output of @option{-fstack-usage}. 6530 6531@itemize 6532@item 6533If the stack usage is fully static but exceeds the specified amount, it's: 6534 6535@smallexample 6536 warning: stack usage is 1120 bytes 6537@end smallexample 6538@item 6539If the stack usage is (partly) dynamic but bounded, it's: 6540 6541@smallexample 6542 warning: stack usage might be 1648 bytes 6543@end smallexample 6544@item 6545If the stack usage is (partly) dynamic and not bounded, it's: 6546 6547@smallexample 6548 warning: stack usage might be unbounded 6549@end smallexample 6550@end itemize 6551 6552@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default. 6553Warnings controlled by the option can be disabled either by specifying 6554@var{byte-size} of @samp{SIZE_MAX} or more or by 6555@option{-Wno-stack-usage}. 6556 6557@item -Wno-stack-usage 6558@opindex Wno-stack-usage 6559Disable @option{-Wstack-usage=} warnings. The option is equivalent 6560to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger. 6561 6562@item -Wunsafe-loop-optimizations 6563@opindex Wunsafe-loop-optimizations 6564@opindex Wno-unsafe-loop-optimizations 6565Warn if the loop cannot be optimized because the compiler cannot 6566assume anything on the bounds of the loop indices. With 6567@option{-funsafe-loop-optimizations} warn if the compiler makes 6568such assumptions. 6569 6570@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 6571@opindex Wno-pedantic-ms-format 6572@opindex Wpedantic-ms-format 6573When used in combination with @option{-Wformat} 6574and @option{-pedantic} without GNU extensions, this option 6575disables the warnings about non-ISO @code{printf} / @code{scanf} format 6576width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 6577which depend on the MS runtime. 6578 6579@item -Waligned-new 6580@opindex Waligned-new 6581@opindex Wno-aligned-new 6582Warn about a new-expression of a type that requires greater alignment 6583than the @code{alignof(std::max_align_t)} but uses an allocation 6584function without an explicit alignment parameter. This option is 6585enabled by @option{-Wall}. 6586 6587Normally this only warns about global allocation functions, but 6588@option{-Waligned-new=all} also warns about class member allocation 6589functions. 6590 6591@item -Wplacement-new 6592@itemx -Wplacement-new=@var{n} 6593@opindex Wplacement-new 6594@opindex Wno-placement-new 6595Warn about placement new expressions with undefined behavior, such as 6596constructing an object in a buffer that is smaller than the type of 6597the object. For example, the placement new expression below is diagnosed 6598because it attempts to construct an array of 64 integers in a buffer only 659964 bytes large. 6600@smallexample 6601char buf [64]; 6602new (buf) int[64]; 6603@end smallexample 6604This warning is enabled by default. 6605 6606@table @gcctabopt 6607@item -Wplacement-new=1 6608This is the default warning level of @option{-Wplacement-new}. At this 6609level the warning is not issued for some strictly undefined constructs that 6610GCC allows as extensions for compatibility with legacy code. For example, 6611the following @code{new} expression is not diagnosed at this level even 6612though it has undefined behavior according to the C++ standard because 6613it writes past the end of the one-element array. 6614@smallexample 6615struct S @{ int n, a[1]; @}; 6616S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]); 6617new (s->a)int [32](); 6618@end smallexample 6619 6620@item -Wplacement-new=2 6621At this level, in addition to diagnosing all the same constructs as at level 66221, a diagnostic is also issued for placement new expressions that construct 6623an object in the last member of structure whose type is an array of a single 6624element and whose size is less than the size of the object being constructed. 6625While the previous example would be diagnosed, the following construct makes 6626use of the flexible member array extension to avoid the warning at level 2. 6627@smallexample 6628struct S @{ int n, a[]; @}; 6629S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]); 6630new (s->a)int [32](); 6631@end smallexample 6632 6633@end table 6634 6635@item -Wpointer-arith 6636@opindex Wpointer-arith 6637@opindex Wno-pointer-arith 6638Warn about anything that depends on the ``size of'' a function type or 6639of @code{void}. GNU C assigns these types a size of 1, for 6640convenience in calculations with @code{void *} pointers and pointers 6641to functions. In C++, warn also when an arithmetic operation involves 6642@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 6643 6644@item -Wpointer-compare 6645@opindex Wpointer-compare 6646@opindex Wno-pointer-compare 6647Warn if a pointer is compared with a zero character constant. This usually 6648means that the pointer was meant to be dereferenced. For example: 6649 6650@smallexample 6651const char *p = foo (); 6652if (p == '\0') 6653 return 42; 6654@end smallexample 6655 6656Note that the code above is invalid in C++11. 6657 6658This warning is enabled by default. 6659 6660@item -Wtype-limits 6661@opindex Wtype-limits 6662@opindex Wno-type-limits 6663Warn if a comparison is always true or always false due to the limited 6664range of the data type, but do not warn for constant expressions. For 6665example, warn if an unsigned variable is compared against zero with 6666@code{<} or @code{>=}. This warning is also enabled by 6667@option{-Wextra}. 6668 6669@item -Wabsolute-value @r{(C and Objective-C only)} 6670@opindex Wabsolute-value 6671@opindex Wno-absolute-value 6672Warn for calls to standard functions that compute the absolute value 6673of an argument when a more appropriate standard function is available. 6674For example, calling @code{abs(3.14)} triggers the warning because the 6675appropriate function to call to compute the absolute value of a double 6676argument is @code{fabs}. The option also triggers warnings when the 6677argument in a call to such a function has an unsigned type. This 6678warning can be suppressed with an explicit type cast and it is also 6679enabled by @option{-Wextra}. 6680 6681@include cppwarnopts.texi 6682 6683@item -Wbad-function-cast @r{(C and Objective-C only)} 6684@opindex Wbad-function-cast 6685@opindex Wno-bad-function-cast 6686Warn when a function call is cast to a non-matching type. 6687For example, warn if a call to a function returning an integer type 6688is cast to a pointer type. 6689 6690@item -Wc90-c99-compat @r{(C and Objective-C only)} 6691@opindex Wc90-c99-compat 6692@opindex Wno-c90-c99-compat 6693Warn about features not present in ISO C90, but present in ISO C99. 6694For instance, warn about use of variable length arrays, @code{long long} 6695type, @code{bool} type, compound literals, designated initializers, and so 6696on. This option is independent of the standards mode. Warnings are disabled 6697in the expression that follows @code{__extension__}. 6698 6699@item -Wc99-c11-compat @r{(C and Objective-C only)} 6700@opindex Wc99-c11-compat 6701@opindex Wno-c99-c11-compat 6702Warn about features not present in ISO C99, but present in ISO C11. 6703For instance, warn about use of anonymous structures and unions, 6704@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 6705@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 6706and so on. This option is independent of the standards mode. Warnings are 6707disabled in the expression that follows @code{__extension__}. 6708 6709@item -Wc11-c2x-compat @r{(C and Objective-C only)} 6710@opindex Wc11-c2x-compat 6711@opindex Wno-c11-c2x-compat 6712Warn about features not present in ISO C11, but present in ISO C2X. 6713For instance, warn about omitting the string in @code{_Static_assert}. 6714This option is independent of the standards mode. Warnings are 6715disabled in the expression that follows @code{__extension__}. 6716 6717@item -Wc++-compat @r{(C and Objective-C only)} 6718@opindex Wc++-compat 6719@opindex Wno-c++-compat 6720Warn about ISO C constructs that are outside of the common subset of 6721ISO C and ISO C++, e.g.@: request for implicit conversion from 6722@code{void *} to a pointer to non-@code{void} type. 6723 6724@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 6725@opindex Wc++11-compat 6726@opindex Wno-c++11-compat 6727Warn about C++ constructs whose meaning differs between ISO C++ 1998 6728and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 6729in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 6730enabled by @option{-Wall}. 6731 6732@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 6733@opindex Wc++14-compat 6734@opindex Wno-c++14-compat 6735Warn about C++ constructs whose meaning differs between ISO C++ 2011 6736and ISO C++ 2014. This warning is enabled by @option{-Wall}. 6737 6738@item -Wc++17-compat @r{(C++ and Objective-C++ only)} 6739@opindex Wc++17-compat 6740@opindex Wno-c++17-compat 6741Warn about C++ constructs whose meaning differs between ISO C++ 2014 6742and ISO C++ 2017. This warning is enabled by @option{-Wall}. 6743 6744@item -Wcast-qual 6745@opindex Wcast-qual 6746@opindex Wno-cast-qual 6747Warn whenever a pointer is cast so as to remove a type qualifier from 6748the target type. For example, warn if a @code{const char *} is cast 6749to an ordinary @code{char *}. 6750 6751Also warn when making a cast that introduces a type qualifier in an 6752unsafe way. For example, casting @code{char **} to @code{const char **} 6753is unsafe, as in this example: 6754 6755@smallexample 6756 /* p is char ** value. */ 6757 const char **q = (const char **) p; 6758 /* Assignment of readonly string to const char * is OK. */ 6759 *q = "string"; 6760 /* Now char** pointer points to read-only memory. */ 6761 **p = 'b'; 6762@end smallexample 6763 6764@item -Wcast-align 6765@opindex Wcast-align 6766@opindex Wno-cast-align 6767Warn whenever a pointer is cast such that the required alignment of the 6768target is increased. For example, warn if a @code{char *} is cast to 6769an @code{int *} on machines where integers can only be accessed at 6770two- or four-byte boundaries. 6771 6772@item -Wcast-align=strict 6773@opindex Wcast-align=strict 6774Warn whenever a pointer is cast such that the required alignment of the 6775target is increased. For example, warn if a @code{char *} is cast to 6776an @code{int *} regardless of the target machine. 6777 6778@item -Wcast-function-type 6779@opindex Wcast-function-type 6780@opindex Wno-cast-function-type 6781Warn when a function pointer is cast to an incompatible function pointer. 6782In a cast involving function types with a variable argument list only 6783the types of initial arguments that are provided are considered. 6784Any parameter of pointer-type matches any other pointer-type. Any benign 6785differences in integral types are ignored, like @code{int} vs.@: @code{long} 6786on ILP32 targets. Likewise type qualifiers are ignored. The function 6787type @code{void (*) (void)} is special and matches everything, which can 6788be used to suppress this warning. 6789In a cast involving pointer to member types this warning warns whenever 6790the type cast is changing the pointer to member type. 6791This warning is enabled by @option{-Wextra}. 6792 6793@item -Wwrite-strings 6794@opindex Wwrite-strings 6795@opindex Wno-write-strings 6796When compiling C, give string constants the type @code{const 6797char[@var{length}]} so that copying the address of one into a 6798non-@code{const} @code{char *} pointer produces a warning. These 6799warnings help you find at compile time code that can try to write 6800into a string constant, but only if you have been very careful about 6801using @code{const} in declarations and prototypes. Otherwise, it is 6802just a nuisance. This is why we did not make @option{-Wall} request 6803these warnings. 6804 6805When compiling C++, warn about the deprecated conversion from string 6806literals to @code{char *}. This warning is enabled by default for C++ 6807programs. 6808 6809@item -Wcatch-value 6810@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)} 6811@opindex Wcatch-value 6812@opindex Wno-catch-value 6813Warn about catch handlers that do not catch via reference. 6814With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short) 6815warn about polymorphic class types that are caught by value. 6816With @option{-Wcatch-value=2} warn about all class types that are caught 6817by value. With @option{-Wcatch-value=3} warn about all types that are 6818not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}. 6819 6820@item -Wclobbered 6821@opindex Wclobbered 6822@opindex Wno-clobbered 6823Warn for variables that might be changed by @code{longjmp} or 6824@code{vfork}. This warning is also enabled by @option{-Wextra}. 6825 6826@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 6827@opindex Wconditionally-supported 6828@opindex Wno-conditionally-supported 6829Warn for conditionally-supported (C++11 [intro.defs]) constructs. 6830 6831@item -Wconversion 6832@opindex Wconversion 6833@opindex Wno-conversion 6834Warn for implicit conversions that may alter a value. This includes 6835conversions between real and integer, like @code{abs (x)} when 6836@code{x} is @code{double}; conversions between signed and unsigned, 6837like @code{unsigned ui = -1}; and conversions to smaller types, like 6838@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 6839((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 6840changed by the conversion like in @code{abs (2.0)}. Warnings about 6841conversions between signed and unsigned integers can be disabled by 6842using @option{-Wno-sign-conversion}. 6843 6844For C++, also warn for confusing overload resolution for user-defined 6845conversions; and conversions that never use a type conversion 6846operator: conversions to @code{void}, the same type, a base class or a 6847reference to them. Warnings about conversions between signed and 6848unsigned integers are disabled by default in C++ unless 6849@option{-Wsign-conversion} is explicitly enabled. 6850 6851@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 6852@opindex Wconversion-null 6853@opindex Wno-conversion-null 6854Do not warn for conversions between @code{NULL} and non-pointer 6855types. @option{-Wconversion-null} is enabled by default. 6856 6857@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 6858@opindex Wzero-as-null-pointer-constant 6859@opindex Wno-zero-as-null-pointer-constant 6860Warn when a literal @samp{0} is used as null pointer constant. This can 6861be useful to facilitate the conversion to @code{nullptr} in C++11. 6862 6863@item -Wsubobject-linkage @r{(C++ and Objective-C++ only)} 6864@opindex Wsubobject-linkage 6865@opindex Wno-subobject-linkage 6866Warn if a class type has a base or a field whose type uses the anonymous 6867namespace or depends on a type with no linkage. If a type A depends on 6868a type B with no or internal linkage, defining it in multiple 6869translation units would be an ODR violation because the meaning of B 6870is different in each translation unit. If A only appears in a single 6871translation unit, the best way to silence the warning is to give it 6872internal linkage by putting it in an anonymous namespace as well. The 6873compiler doesn't give this warning for types defined in the main .C 6874file, as those are unlikely to have multiple definitions. 6875@option{-Wsubobject-linkage} is enabled by default. 6876 6877@item -Wdangling-else 6878@opindex Wdangling-else 6879@opindex Wno-dangling-else 6880Warn about constructions where there may be confusion to which 6881@code{if} statement an @code{else} branch belongs. Here is an example of 6882such a case: 6883 6884@smallexample 6885@group 6886@{ 6887 if (a) 6888 if (b) 6889 foo (); 6890 else 6891 bar (); 6892@} 6893@end group 6894@end smallexample 6895 6896In C/C++, every @code{else} branch belongs to the innermost possible 6897@code{if} statement, which in this example is @code{if (b)}. This is 6898often not what the programmer expected, as illustrated in the above 6899example by indentation the programmer chose. When there is the 6900potential for this confusion, GCC issues a warning when this flag 6901is specified. To eliminate the warning, add explicit braces around 6902the innermost @code{if} statement so there is no way the @code{else} 6903can belong to the enclosing @code{if}. The resulting code 6904looks like this: 6905 6906@smallexample 6907@group 6908@{ 6909 if (a) 6910 @{ 6911 if (b) 6912 foo (); 6913 else 6914 bar (); 6915 @} 6916@} 6917@end group 6918@end smallexample 6919 6920This warning is enabled by @option{-Wparentheses}. 6921 6922@item -Wdate-time 6923@opindex Wdate-time 6924@opindex Wno-date-time 6925Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 6926are encountered as they might prevent bit-wise-identical reproducible 6927compilations. 6928 6929@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)} 6930@opindex Wdelete-incomplete 6931@opindex Wno-delete-incomplete 6932Warn when deleting a pointer to incomplete type, which may cause 6933undefined behavior at runtime. This warning is enabled by default. 6934 6935@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 6936@opindex Wuseless-cast 6937@opindex Wno-useless-cast 6938Warn when an expression is casted to its own type. 6939 6940@item -Wempty-body 6941@opindex Wempty-body 6942@opindex Wno-empty-body 6943Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 6944while} statement. This warning is also enabled by @option{-Wextra}. 6945 6946@item -Wenum-compare 6947@opindex Wenum-compare 6948@opindex Wno-enum-compare 6949Warn about a comparison between values of different enumerated types. 6950In C++ enumerated type mismatches in conditional expressions are also 6951diagnosed and the warning is enabled by default. In C this warning is 6952enabled by @option{-Wall}. 6953 6954@item -Wextra-semi @r{(C++, Objective-C++ only)} 6955@opindex Wextra-semi 6956@opindex Wno-extra-semi 6957Warn about redundant semicolon after in-class function definition. 6958 6959@item -Wjump-misses-init @r{(C, Objective-C only)} 6960@opindex Wjump-misses-init 6961@opindex Wno-jump-misses-init 6962Warn if a @code{goto} statement or a @code{switch} statement jumps 6963forward across the initialization of a variable, or jumps backward to a 6964label after the variable has been initialized. This only warns about 6965variables that are initialized when they are declared. This warning is 6966only supported for C and Objective-C; in C++ this sort of branch is an 6967error in any case. 6968 6969@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 6970can be disabled with the @option{-Wno-jump-misses-init} option. 6971 6972@item -Wsign-compare 6973@opindex Wsign-compare 6974@opindex Wno-sign-compare 6975@cindex warning for comparison of signed and unsigned values 6976@cindex comparison of signed and unsigned values, warning 6977@cindex signed and unsigned values, comparison warning 6978Warn when a comparison between signed and unsigned values could produce 6979an incorrect result when the signed value is converted to unsigned. 6980In C++, this warning is also enabled by @option{-Wall}. In C, it is 6981also enabled by @option{-Wextra}. 6982 6983@item -Wsign-conversion 6984@opindex Wsign-conversion 6985@opindex Wno-sign-conversion 6986Warn for implicit conversions that may change the sign of an integer 6987value, like assigning a signed integer expression to an unsigned 6988integer variable. An explicit cast silences the warning. In C, this 6989option is enabled also by @option{-Wconversion}. 6990 6991@item -Wfloat-conversion 6992@opindex Wfloat-conversion 6993@opindex Wno-float-conversion 6994Warn for implicit conversions that reduce the precision of a real value. 6995This includes conversions from real to integer, and from higher precision 6996real to lower precision real values. This option is also enabled by 6997@option{-Wconversion}. 6998 6999@item -Wno-scalar-storage-order 7000@opindex Wno-scalar-storage-order 7001@opindex Wscalar-storage-order 7002Do not warn on suspicious constructs involving reverse scalar storage order. 7003 7004@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 7005@opindex Wsized-deallocation 7006@opindex Wno-sized-deallocation 7007Warn about a definition of an unsized deallocation function 7008@smallexample 7009void operator delete (void *) noexcept; 7010void operator delete[] (void *) noexcept; 7011@end smallexample 7012without a definition of the corresponding sized deallocation function 7013@smallexample 7014void operator delete (void *, std::size_t) noexcept; 7015void operator delete[] (void *, std::size_t) noexcept; 7016@end smallexample 7017or vice versa. Enabled by @option{-Wextra} along with 7018@option{-fsized-deallocation}. 7019 7020@item -Wsizeof-pointer-div 7021@opindex Wsizeof-pointer-div 7022@opindex Wno-sizeof-pointer-div 7023Warn for suspicious divisions of two sizeof expressions that divide 7024the pointer size by the element size, which is the usual way to compute 7025the array size but won't work out correctly with pointers. This warning 7026warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is 7027not an array, but a pointer. This warning is enabled by @option{-Wall}. 7028 7029@item -Wsizeof-pointer-memaccess 7030@opindex Wsizeof-pointer-memaccess 7031@opindex Wno-sizeof-pointer-memaccess 7032Warn for suspicious length parameters to certain string and memory built-in 7033functions if the argument uses @code{sizeof}. This warning triggers for 7034example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not 7035an array, but a pointer, and suggests a possible fix, or about 7036@code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess} 7037also warns about calls to bounded string copy functions like @code{strncat} 7038or @code{strncpy} that specify as the bound a @code{sizeof} expression of 7039the source array. For example, in the following function the call to 7040@code{strncat} specifies the size of the source string as the bound. That 7041is almost certainly a mistake and so the call is diagnosed. 7042@smallexample 7043void make_file (const char *name) 7044@{ 7045 char path[PATH_MAX]; 7046 strncpy (path, name, sizeof path - 1); 7047 strncat (path, ".text", sizeof ".text"); 7048 @dots{} 7049@} 7050@end smallexample 7051 7052The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}. 7053 7054@item -Wsizeof-array-argument 7055@opindex Wsizeof-array-argument 7056@opindex Wno-sizeof-array-argument 7057Warn when the @code{sizeof} operator is applied to a parameter that is 7058declared as an array in a function definition. This warning is enabled by 7059default for C and C++ programs. 7060 7061@item -Wmemset-elt-size 7062@opindex Wmemset-elt-size 7063@opindex Wno-memset-elt-size 7064Warn for suspicious calls to the @code{memset} built-in function, if the 7065first argument references an array, and the third argument is a number 7066equal to the number of elements, but not equal to the size of the array 7067in memory. This indicates that the user has omitted a multiplication by 7068the element size. This warning is enabled by @option{-Wall}. 7069 7070@item -Wmemset-transposed-args 7071@opindex Wmemset-transposed-args 7072@opindex Wno-memset-transposed-args 7073Warn for suspicious calls to the @code{memset} built-in function where 7074the second argument is not zero and the third argument is zero. For 7075example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because 7076@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic 7077is only emitted if the third argument is a literal zero. Otherwise, if 7078it is an expression that is folded to zero, or a cast of zero to some 7079type, it is far less likely that the arguments have been mistakenly 7080transposed and no warning is emitted. This warning is enabled 7081by @option{-Wall}. 7082 7083@item -Waddress 7084@opindex Waddress 7085@opindex Wno-address 7086Warn about suspicious uses of memory addresses. These include using 7087the address of a function in a conditional expression, such as 7088@code{void func(void); if (func)}, and comparisons against the memory 7089address of a string literal, such as @code{if (x == "abc")}. Such 7090uses typically indicate a programmer error: the address of a function 7091always evaluates to true, so their use in a conditional usually 7092indicate that the programmer forgot the parentheses in a function 7093call; and comparisons against string literals result in unspecified 7094behavior and are not portable in C, so they usually indicate that the 7095programmer intended to use @code{strcmp}. This warning is enabled by 7096@option{-Wall}. 7097 7098@item -Waddress-of-packed-member 7099@opindex Waddress-of-packed-member 7100@opindex Wno-address-of-packed-member 7101Warn when the address of packed member of struct or union is taken, 7102which usually results in an unaligned pointer value. This is 7103enabled by default. 7104 7105@item -Wlogical-op 7106@opindex Wlogical-op 7107@opindex Wno-logical-op 7108Warn about suspicious uses of logical operators in expressions. 7109This includes using logical operators in contexts where a 7110bit-wise operator is likely to be expected. Also warns when 7111the operands of a logical operator are the same: 7112@smallexample 7113extern int a; 7114if (a < 0 && a < 0) @{ @dots{} @} 7115@end smallexample 7116 7117@item -Wlogical-not-parentheses 7118@opindex Wlogical-not-parentheses 7119@opindex Wno-logical-not-parentheses 7120Warn about logical not used on the left hand side operand of a comparison. 7121This option does not warn if the right operand is considered to be a boolean 7122expression. Its purpose is to detect suspicious code like the following: 7123@smallexample 7124int a; 7125@dots{} 7126if (!a > 1) @{ @dots{} @} 7127@end smallexample 7128 7129It is possible to suppress the warning by wrapping the LHS into 7130parentheses: 7131@smallexample 7132if ((!a) > 1) @{ @dots{} @} 7133@end smallexample 7134 7135This warning is enabled by @option{-Wall}. 7136 7137@item -Waggregate-return 7138@opindex Waggregate-return 7139@opindex Wno-aggregate-return 7140Warn if any functions that return structures or unions are defined or 7141called. (In languages where you can return an array, this also elicits 7142a warning.) 7143 7144@item -Wno-aggressive-loop-optimizations 7145@opindex Wno-aggressive-loop-optimizations 7146@opindex Waggressive-loop-optimizations 7147Warn if in a loop with constant number of iterations the compiler detects 7148undefined behavior in some statement during one or more of the iterations. 7149 7150@item -Wno-attributes 7151@opindex Wno-attributes 7152@opindex Wattributes 7153Do not warn if an unexpected @code{__attribute__} is used, such as 7154unrecognized attributes, function attributes applied to variables, 7155etc. This does not stop errors for incorrect use of supported 7156attributes. 7157 7158@item -Wno-builtin-declaration-mismatch 7159@opindex Wno-builtin-declaration-mismatch 7160@opindex Wbuiltin-declaration-mismatch 7161Warn if a built-in function is declared with an incompatible signature 7162or as a non-function, or when a built-in function declared with a type 7163that does not include a prototype is called with arguments whose promoted 7164types do not match those expected by the function. When @option{-Wextra} 7165is specified, also warn when a built-in function that takes arguments is 7166declared without a prototype. The @option{-Wno-builtin-declaration-mismatch} 7167warning is enabled by default. To avoid the warning include the appropriate 7168header to bring the prototypes of built-in functions into scope. 7169 7170For example, the call to @code{memset} below is diagnosed by the warning 7171because the function expects a value of type @code{size_t} as its argument 7172but the type of @code{32} is @code{int}. With @option{-Wextra}, 7173the declaration of the function is diagnosed as well. 7174@smallexample 7175extern void* memset (); 7176void f (void *d) 7177@{ 7178 memset (d, '\0', 32); 7179@} 7180@end smallexample 7181 7182@item -Wno-builtin-macro-redefined 7183@opindex Wno-builtin-macro-redefined 7184@opindex Wbuiltin-macro-redefined 7185Do not warn if certain built-in macros are redefined. This suppresses 7186warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 7187@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 7188 7189@item -Wstrict-prototypes @r{(C and Objective-C only)} 7190@opindex Wstrict-prototypes 7191@opindex Wno-strict-prototypes 7192Warn if a function is declared or defined without specifying the 7193argument types. (An old-style function definition is permitted without 7194a warning if preceded by a declaration that specifies the argument 7195types.) 7196 7197@item -Wold-style-declaration @r{(C and Objective-C only)} 7198@opindex Wold-style-declaration 7199@opindex Wno-old-style-declaration 7200Warn for obsolescent usages, according to the C Standard, in a 7201declaration. For example, warn if storage-class specifiers like 7202@code{static} are not the first things in a declaration. This warning 7203is also enabled by @option{-Wextra}. 7204 7205@item -Wold-style-definition @r{(C and Objective-C only)} 7206@opindex Wold-style-definition 7207@opindex Wno-old-style-definition 7208Warn if an old-style function definition is used. A warning is given 7209even if there is a previous prototype. 7210 7211@item -Wmissing-parameter-type @r{(C and Objective-C only)} 7212@opindex Wmissing-parameter-type 7213@opindex Wno-missing-parameter-type 7214A function parameter is declared without a type specifier in K&R-style 7215functions: 7216 7217@smallexample 7218void foo(bar) @{ @} 7219@end smallexample 7220 7221This warning is also enabled by @option{-Wextra}. 7222 7223@item -Wmissing-prototypes @r{(C and Objective-C only)} 7224@opindex Wmissing-prototypes 7225@opindex Wno-missing-prototypes 7226Warn if a global function is defined without a previous prototype 7227declaration. This warning is issued even if the definition itself 7228provides a prototype. Use this option to detect global functions 7229that do not have a matching prototype declaration in a header file. 7230This option is not valid for C++ because all function declarations 7231provide prototypes and a non-matching declaration declares an 7232overload rather than conflict with an earlier declaration. 7233Use @option{-Wmissing-declarations} to detect missing declarations in C++. 7234 7235@item -Wmissing-declarations 7236@opindex Wmissing-declarations 7237@opindex Wno-missing-declarations 7238Warn if a global function is defined without a previous declaration. 7239Do so even if the definition itself provides a prototype. 7240Use this option to detect global functions that are not declared in 7241header files. In C, no warnings are issued for functions with previous 7242non-prototype declarations; use @option{-Wmissing-prototypes} to detect 7243missing prototypes. In C++, no warnings are issued for function templates, 7244or for inline functions, or for functions in anonymous namespaces. 7245 7246@item -Wmissing-field-initializers 7247@opindex Wmissing-field-initializers 7248@opindex Wno-missing-field-initializers 7249@opindex W 7250@opindex Wextra 7251@opindex Wno-extra 7252Warn if a structure's initializer has some fields missing. For 7253example, the following code causes such a warning, because 7254@code{x.h} is implicitly zero: 7255 7256@smallexample 7257struct s @{ int f, g, h; @}; 7258struct s x = @{ 3, 4 @}; 7259@end smallexample 7260 7261This option does not warn about designated initializers, so the following 7262modification does not trigger a warning: 7263 7264@smallexample 7265struct s @{ int f, g, h; @}; 7266struct s x = @{ .f = 3, .g = 4 @}; 7267@end smallexample 7268 7269In C this option does not warn about the universal zero initializer 7270@samp{@{ 0 @}}: 7271 7272@smallexample 7273struct s @{ int f, g, h; @}; 7274struct s x = @{ 0 @}; 7275@end smallexample 7276 7277Likewise, in C++ this option does not warn about the empty @{ @} 7278initializer, for example: 7279 7280@smallexample 7281struct s @{ int f, g, h; @}; 7282s x = @{ @}; 7283@end smallexample 7284 7285This warning is included in @option{-Wextra}. To get other @option{-Wextra} 7286warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 7287 7288@item -Wno-multichar 7289@opindex Wno-multichar 7290@opindex Wmultichar 7291Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 7292Usually they indicate a typo in the user's code, as they have 7293implementation-defined values, and should not be used in portable code. 7294 7295@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} 7296@opindex Wnormalized= 7297@opindex Wnormalized 7298@opindex Wno-normalized 7299@cindex NFC 7300@cindex NFKC 7301@cindex character set, input normalization 7302In ISO C and ISO C++, two identifiers are different if they are 7303different sequences of characters. However, sometimes when characters 7304outside the basic ASCII character set are used, you can have two 7305different character sequences that look the same. To avoid confusion, 7306the ISO 10646 standard sets out some @dfn{normalization rules} which 7307when applied ensure that two sequences that look the same are turned into 7308the same sequence. GCC can warn you if you are using identifiers that 7309have not been normalized; this option controls that warning. 7310 7311There are four levels of warning supported by GCC@. The default is 7312@option{-Wnormalized=nfc}, which warns about any identifier that is 7313not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 7314recommended form for most uses. It is equivalent to 7315@option{-Wnormalized}. 7316 7317Unfortunately, there are some characters allowed in identifiers by 7318ISO C and ISO C++ that, when turned into NFC, are not allowed in 7319identifiers. That is, there's no way to use these symbols in portable 7320ISO C or C++ and have all your identifiers in NFC@. 7321@option{-Wnormalized=id} suppresses the warning for these characters. 7322It is hoped that future versions of the standards involved will correct 7323this, which is why this option is not the default. 7324 7325You can switch the warning off for all characters by writing 7326@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 7327only do this if you are using some other normalization scheme (like 7328``D''), because otherwise you can easily create bugs that are 7329literally impossible to see. 7330 7331Some characters in ISO 10646 have distinct meanings but look identical 7332in some fonts or display methodologies, especially once formatting has 7333been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 7334LETTER N'', displays just like a regular @code{n} that has been 7335placed in a superscript. ISO 10646 defines the @dfn{NFKC} 7336normalization scheme to convert all these into a standard form as 7337well, and GCC warns if your code is not in NFKC if you use 7338@option{-Wnormalized=nfkc}. This warning is comparable to warning 7339about every identifier that contains the letter O because it might be 7340confused with the digit 0, and so is not the default, but may be 7341useful as a local coding convention if the programming environment 7342cannot be fixed to display these characters distinctly. 7343 7344@item -Wno-attribute-warning 7345@opindex Wno-attribute-warning 7346@opindex Wattribute-warning 7347Do not warn about usage of functions (@pxref{Function Attributes}) 7348declared with @code{warning} attribute. By default, this warning is 7349enabled. @option{-Wno-attribute-warning} can be used to disable the 7350warning or @option{-Wno-error=attribute-warning} can be used to 7351disable the error when compiled with @option{-Werror} flag. 7352 7353@item -Wno-deprecated 7354@opindex Wno-deprecated 7355@opindex Wdeprecated 7356Do not warn about usage of deprecated features. @xref{Deprecated Features}. 7357 7358@item -Wno-deprecated-declarations 7359@opindex Wno-deprecated-declarations 7360@opindex Wdeprecated-declarations 7361Do not warn about uses of functions (@pxref{Function Attributes}), 7362variables (@pxref{Variable Attributes}), and types (@pxref{Type 7363Attributes}) marked as deprecated by using the @code{deprecated} 7364attribute. 7365 7366@item -Wno-overflow 7367@opindex Wno-overflow 7368@opindex Woverflow 7369Do not warn about compile-time overflow in constant expressions. 7370 7371@item -Wno-odr 7372@opindex Wno-odr 7373@opindex Wodr 7374Warn about One Definition Rule violations during link-time optimization. 7375Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default. 7376 7377@item -Wopenmp-simd 7378@opindex Wopenmp-simd 7379@opindex Wno-openmp-simd 7380Warn if the vectorizer cost model overrides the OpenMP 7381simd directive set by user. The @option{-fsimd-cost-model=unlimited} 7382option can be used to relax the cost model. 7383 7384@item -Woverride-init @r{(C and Objective-C only)} 7385@opindex Woverride-init 7386@opindex Wno-override-init 7387@opindex W 7388@opindex Wextra 7389@opindex Wno-extra 7390Warn if an initialized field without side effects is overridden when 7391using designated initializers (@pxref{Designated Inits, , Designated 7392Initializers}). 7393 7394This warning is included in @option{-Wextra}. To get other 7395@option{-Wextra} warnings without this one, use @option{-Wextra 7396-Wno-override-init}. 7397 7398@item -Woverride-init-side-effects @r{(C and Objective-C only)} 7399@opindex Woverride-init-side-effects 7400@opindex Wno-override-init-side-effects 7401Warn if an initialized field with side effects is overridden when 7402using designated initializers (@pxref{Designated Inits, , Designated 7403Initializers}). This warning is enabled by default. 7404 7405@item -Wpacked 7406@opindex Wpacked 7407@opindex Wno-packed 7408Warn if a structure is given the packed attribute, but the packed 7409attribute has no effect on the layout or size of the structure. 7410Such structures may be mis-aligned for little benefit. For 7411instance, in this code, the variable @code{f.x} in @code{struct bar} 7412is misaligned even though @code{struct bar} does not itself 7413have the packed attribute: 7414 7415@smallexample 7416@group 7417struct foo @{ 7418 int x; 7419 char a, b, c, d; 7420@} __attribute__((packed)); 7421struct bar @{ 7422 char z; 7423 struct foo f; 7424@}; 7425@end group 7426@end smallexample 7427 7428@item -Wpacked-bitfield-compat 7429@opindex Wpacked-bitfield-compat 7430@opindex Wno-packed-bitfield-compat 7431The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 7432on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but 7433the change can lead to differences in the structure layout. GCC 7434informs you when the offset of such a field has changed in GCC 4.4. 7435For example there is no longer a 4-bit padding between field @code{a} 7436and @code{b} in this structure: 7437 7438@smallexample 7439struct foo 7440@{ 7441 char a:4; 7442 char b:8; 7443@} __attribute__ ((packed)); 7444@end smallexample 7445 7446This warning is enabled by default. Use 7447@option{-Wno-packed-bitfield-compat} to disable this warning. 7448 7449@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 7450@opindex Wpacked-not-aligned 7451@opindex Wno-packed-not-aligned 7452Warn if a structure field with explicitly specified alignment in a 7453packed struct or union is misaligned. For example, a warning will 7454be issued on @code{struct S}, like, @code{warning: alignment 1 of 7455'struct S' is less than 8}, in this code: 7456 7457@smallexample 7458@group 7459struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @}; 7460struct __attribute__ ((packed)) S @{ 7461 struct S8 s8; 7462@}; 7463@end group 7464@end smallexample 7465 7466This warning is enabled by @option{-Wall}. 7467 7468@item -Wpadded 7469@opindex Wpadded 7470@opindex Wno-padded 7471Warn if padding is included in a structure, either to align an element 7472of the structure or to align the whole structure. Sometimes when this 7473happens it is possible to rearrange the fields of the structure to 7474reduce the padding and so make the structure smaller. 7475 7476@item -Wredundant-decls 7477@opindex Wredundant-decls 7478@opindex Wno-redundant-decls 7479Warn if anything is declared more than once in the same scope, even in 7480cases where multiple declaration is valid and changes nothing. 7481 7482@item -Wno-restrict 7483@opindex Wrestrict 7484@opindex Wno-restrict 7485Warn when an object referenced by a @code{restrict}-qualified parameter 7486(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another 7487argument, or when copies between such objects overlap. For example, 7488the call to the @code{strcpy} function below attempts to truncate the string 7489by replacing its initial characters with the last four. However, because 7490the call writes the terminating NUL into @code{a[4]}, the copies overlap and 7491the call is diagnosed. 7492 7493@smallexample 7494void foo (void) 7495@{ 7496 char a[] = "abcd1234"; 7497 strcpy (a, a + 4); 7498 @dots{} 7499@} 7500@end smallexample 7501The @option{-Wrestrict} option detects some instances of simple overlap 7502even without optimization but works best at @option{-O2} and above. It 7503is included in @option{-Wall}. 7504 7505@item -Wnested-externs @r{(C and Objective-C only)} 7506@opindex Wnested-externs 7507@opindex Wno-nested-externs 7508Warn if an @code{extern} declaration is encountered within a function. 7509 7510@item -Wno-inherited-variadic-ctor 7511@opindex Winherited-variadic-ctor 7512@opindex Wno-inherited-variadic-ctor 7513Suppress warnings about use of C++11 inheriting constructors when the 7514base class inherited from has a C variadic constructor; the warning is 7515on by default because the ellipsis is not inherited. 7516 7517@item -Winline 7518@opindex Winline 7519@opindex Wno-inline 7520Warn if a function that is declared as inline cannot be inlined. 7521Even with this option, the compiler does not warn about failures to 7522inline functions declared in system headers. 7523 7524The compiler uses a variety of heuristics to determine whether or not 7525to inline a function. For example, the compiler takes into account 7526the size of the function being inlined and the amount of inlining 7527that has already been done in the current function. Therefore, 7528seemingly insignificant changes in the source program can cause the 7529warnings produced by @option{-Winline} to appear or disappear. 7530 7531@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 7532@opindex Wno-invalid-offsetof 7533@opindex Winvalid-offsetof 7534Suppress warnings from applying the @code{offsetof} macro to a non-POD 7535type. According to the 2014 ISO C++ standard, applying @code{offsetof} 7536to a non-standard-layout type is undefined. In existing C++ implementations, 7537however, @code{offsetof} typically gives meaningful results. 7538This flag is for users who are aware that they are 7539writing nonportable code and who have deliberately chosen to ignore the 7540warning about it. 7541 7542The restrictions on @code{offsetof} may be relaxed in a future version 7543of the C++ standard. 7544 7545@item -Wint-in-bool-context 7546@opindex Wint-in-bool-context 7547@opindex Wno-int-in-bool-context 7548Warn for suspicious use of integer values where boolean values are expected, 7549such as conditional expressions (?:) using non-boolean integer constants in 7550boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed 7551integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise 7552for all kinds of multiplications regardless of the data type. 7553This warning is enabled by @option{-Wall}. 7554 7555@item -Wno-int-to-pointer-cast 7556@opindex Wno-int-to-pointer-cast 7557@opindex Wint-to-pointer-cast 7558Suppress warnings from casts to pointer type of an integer of a 7559different size. In C++, casting to a pointer type of smaller size is 7560an error. @option{Wint-to-pointer-cast} is enabled by default. 7561 7562 7563@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 7564@opindex Wno-pointer-to-int-cast 7565@opindex Wpointer-to-int-cast 7566Suppress warnings from casts from a pointer to an integer type of a 7567different size. 7568 7569@item -Winvalid-pch 7570@opindex Winvalid-pch 7571@opindex Wno-invalid-pch 7572Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 7573the search path but cannot be used. 7574 7575@item -Wlong-long 7576@opindex Wlong-long 7577@opindex Wno-long-long 7578Warn if @code{long long} type is used. This is enabled by either 7579@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 7580modes. To inhibit the warning messages, use @option{-Wno-long-long}. 7581 7582@item -Wvariadic-macros 7583@opindex Wvariadic-macros 7584@opindex Wno-variadic-macros 7585Warn if variadic macros are used in ISO C90 mode, or if the GNU 7586alternate syntax is used in ISO C99 mode. This is enabled by either 7587@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 7588messages, use @option{-Wno-variadic-macros}. 7589 7590@item -Wvarargs 7591@opindex Wvarargs 7592@opindex Wno-varargs 7593Warn upon questionable usage of the macros used to handle variable 7594arguments like @code{va_start}. This is default. To inhibit the 7595warning messages, use @option{-Wno-varargs}. 7596 7597@item -Wvector-operation-performance 7598@opindex Wvector-operation-performance 7599@opindex Wno-vector-operation-performance 7600Warn if vector operation is not implemented via SIMD capabilities of the 7601architecture. Mainly useful for the performance tuning. 7602Vector operation can be implemented @code{piecewise}, which means that the 7603scalar operation is performed on every vector element; 7604@code{in parallel}, which means that the vector operation is implemented 7605using scalars of wider type, which normally is more performance efficient; 7606and @code{as a single scalar}, which means that vector fits into a 7607scalar type. 7608 7609@item -Wno-virtual-move-assign 7610@opindex Wvirtual-move-assign 7611@opindex Wno-virtual-move-assign 7612Suppress warnings about inheriting from a virtual base with a 7613non-trivial C++11 move assignment operator. This is dangerous because 7614if the virtual base is reachable along more than one path, it is 7615moved multiple times, which can mean both objects end up in the 7616moved-from state. If the move assignment operator is written to avoid 7617moving from a moved-from object, this warning can be disabled. 7618 7619@item -Wvla 7620@opindex Wvla 7621@opindex Wno-vla 7622Warn if a variable-length array is used in the code. 7623@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 7624the variable-length array. 7625 7626@item -Wvla-larger-than=@var{byte-size} 7627@opindex Wvla-larger-than= 7628@opindex Wno-vla-larger-than 7629If this option is used, the compiler will warn for declarations of 7630variable-length arrays whose size is either unbounded, or bounded 7631by an argument that allows the array size to exceed @var{byte-size} 7632bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size} 7633works, but with variable-length arrays. 7634 7635Note that GCC may optimize small variable-length arrays of a known 7636value into plain arrays, so this warning may not get triggered for 7637such arrays. 7638 7639@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but 7640is typically only effective when @option{-ftree-vrp} is active (default 7641for @option{-O2} and above). 7642 7643See also @option{-Walloca-larger-than=@var{byte-size}}. 7644 7645@item -Wno-vla-larger-than 7646@opindex Wno-vla-larger-than 7647Disable @option{-Wvla-larger-than=} warnings. The option is equivalent 7648to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger. 7649 7650@item -Wvolatile-register-var 7651@opindex Wvolatile-register-var 7652@opindex Wno-volatile-register-var 7653Warn if a register variable is declared volatile. The volatile 7654modifier does not inhibit all optimizations that may eliminate reads 7655and/or writes to register variables. This warning is enabled by 7656@option{-Wall}. 7657 7658@item -Wdisabled-optimization 7659@opindex Wdisabled-optimization 7660@opindex Wno-disabled-optimization 7661Warn if a requested optimization pass is disabled. This warning does 7662not generally indicate that there is anything wrong with your code; it 7663merely indicates that GCC's optimizers are unable to handle the code 7664effectively. Often, the problem is that your code is too big or too 7665complex; GCC refuses to optimize programs when the optimization 7666itself is likely to take inordinate amounts of time. 7667 7668@item -Wpointer-sign @r{(C and Objective-C only)} 7669@opindex Wpointer-sign 7670@opindex Wno-pointer-sign 7671Warn for pointer argument passing or assignment with different signedness. 7672This option is only supported for C and Objective-C@. It is implied by 7673@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 7674@option{-Wno-pointer-sign}. 7675 7676@item -Wstack-protector 7677@opindex Wstack-protector 7678@opindex Wno-stack-protector 7679This option is only active when @option{-fstack-protector} is active. It 7680warns about functions that are not protected against stack smashing. 7681 7682@item -Woverlength-strings 7683@opindex Woverlength-strings 7684@opindex Wno-overlength-strings 7685Warn about string constants that are longer than the ``minimum 7686maximum'' length specified in the C standard. Modern compilers 7687generally allow string constants that are much longer than the 7688standard's minimum limit, but very portable programs should avoid 7689using longer strings. 7690 7691The limit applies @emph{after} string constant concatenation, and does 7692not count the trailing NUL@. In C90, the limit was 509 characters; in 7693C99, it was raised to 4095. C++98 does not specify a normative 7694minimum maximum, so we do not diagnose overlength strings in C++@. 7695 7696This option is implied by @option{-Wpedantic}, and can be disabled with 7697@option{-Wno-overlength-strings}. 7698 7699@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 7700@opindex Wunsuffixed-float-constants 7701@opindex Wno-unsuffixed-float-constants 7702 7703Issue a warning for any floating constant that does not have 7704a suffix. When used together with @option{-Wsystem-headers} it 7705warns about such constants in system header files. This can be useful 7706when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 7707from the decimal floating-point extension to C99. 7708 7709@item -Wno-designated-init @r{(C and Objective-C only)} 7710Suppress warnings when a positional initializer is used to initialize 7711a structure that has been marked with the @code{designated_init} 7712attribute. 7713 7714@item -Whsa 7715Issue a warning when HSAIL cannot be emitted for the compiled function or 7716OpenMP construct. 7717 7718@end table 7719 7720@node Debugging Options 7721@section Options for Debugging Your Program 7722@cindex options, debugging 7723@cindex debugging information options 7724 7725To tell GCC to emit extra information for use by a debugger, in almost 7726all cases you need only to add @option{-g} to your other options. 7727 7728GCC allows you to use @option{-g} with 7729@option{-O}. The shortcuts taken by optimized code may occasionally 7730be surprising: some variables you declared may not exist 7731at all; flow of control may briefly move where you did not expect it; 7732some statements may not be executed because they compute constant 7733results or their values are already at hand; some statements may 7734execute in different places because they have been moved out of loops. 7735Nevertheless it is possible to debug optimized output. This makes 7736it reasonable to use the optimizer for programs that might have bugs. 7737 7738If you are not using some other optimization option, consider 7739using @option{-Og} (@pxref{Optimize Options}) with @option{-g}. 7740With no @option{-O} option at all, some compiler passes that collect 7741information useful for debugging do not run at all, so that 7742@option{-Og} may result in a better debugging experience. 7743 7744@table @gcctabopt 7745@item -g 7746@opindex g 7747Produce debugging information in the operating system's native format 7748(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 7749information. 7750 7751On most systems that use stabs format, @option{-g} enables use of extra 7752debugging information that only GDB can use; this extra information 7753makes debugging work better in GDB but probably makes other debuggers 7754crash or 7755refuse to read the program. If you want to control for certain whether 7756to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 7757@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 7758 7759@item -ggdb 7760@opindex ggdb 7761Produce debugging information for use by GDB@. This means to use the 7762most expressive format available (DWARF, stabs, or the native format 7763if neither of those are supported), including GDB extensions if at all 7764possible. 7765 7766@item -gdwarf 7767@itemx -gdwarf-@var{version} 7768@opindex gdwarf 7769Produce debugging information in DWARF format (if that is supported). 7770The value of @var{version} may be either 2, 3, 4 or 5; the default version 7771for most targets is 4. DWARF Version 5 is only experimental. 7772 7773Note that with DWARF Version 2, some ports require and always 7774use some non-conflicting DWARF 3 extensions in the unwind tables. 7775 7776Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 7777for maximum benefit. 7778 7779GCC no longer supports DWARF Version 1, which is substantially 7780different than Version 2 and later. For historical reasons, some 7781other DWARF-related options such as 7782@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2 7783in their names, but apply to all currently-supported versions of DWARF. 7784 7785@item -gstabs 7786@opindex gstabs 7787Produce debugging information in stabs format (if that is supported), 7788without GDB extensions. This is the format used by DBX on most BSD 7789systems. On MIPS, Alpha and System V Release 4 systems this option 7790produces stabs debugging output that is not understood by DBX@. 7791On System V Release 4 systems this option requires the GNU assembler. 7792 7793@item -gstabs+ 7794@opindex gstabs+ 7795Produce debugging information in stabs format (if that is supported), 7796using GNU extensions understood only by the GNU debugger (GDB)@. The 7797use of these extensions is likely to make other debuggers crash or 7798refuse to read the program. 7799 7800@item -gxcoff 7801@opindex gxcoff 7802Produce debugging information in XCOFF format (if that is supported). 7803This is the format used by the DBX debugger on IBM RS/6000 systems. 7804 7805@item -gxcoff+ 7806@opindex gxcoff+ 7807Produce debugging information in XCOFF format (if that is supported), 7808using GNU extensions understood only by the GNU debugger (GDB)@. The 7809use of these extensions is likely to make other debuggers crash or 7810refuse to read the program, and may cause assemblers other than the GNU 7811assembler (GAS) to fail with an error. 7812 7813@item -gvms 7814@opindex gvms 7815Produce debugging information in Alpha/VMS debug format (if that is 7816supported). This is the format used by DEBUG on Alpha/VMS systems. 7817 7818@item -g@var{level} 7819@itemx -ggdb@var{level} 7820@itemx -gstabs@var{level} 7821@itemx -gxcoff@var{level} 7822@itemx -gvms@var{level} 7823Request debugging information and also use @var{level} to specify how 7824much information. The default level is 2. 7825 7826Level 0 produces no debug information at all. Thus, @option{-g0} negates 7827@option{-g}. 7828 7829Level 1 produces minimal information, enough for making backtraces in 7830parts of the program that you don't plan to debug. This includes 7831descriptions of functions and external variables, and line number 7832tables, but no information about local variables. 7833 7834Level 3 includes extra information, such as all the macro definitions 7835present in the program. Some debuggers support macro expansion when 7836you use @option{-g3}. 7837 7838If you use multiple @option{-g} options, with or without level numbers, 7839the last such option is the one that is effective. 7840 7841@option{-gdwarf} does not accept a concatenated debug level, to avoid 7842confusion with @option{-gdwarf-@var{level}}. 7843Instead use an additional @option{-g@var{level}} option to change the 7844debug level for DWARF. 7845 7846@item -feliminate-unused-debug-symbols 7847@opindex feliminate-unused-debug-symbols 7848Produce debugging information in stabs format (if that is supported), 7849for only symbols that are actually used. 7850 7851@item -femit-class-debug-always 7852@opindex femit-class-debug-always 7853Instead of emitting debugging information for a C++ class in only one 7854object file, emit it in all object files using the class. This option 7855should be used only with debuggers that are unable to handle the way GCC 7856normally emits debugging information for classes because using this 7857option increases the size of debugging information by as much as a 7858factor of two. 7859 7860@item -fno-merge-debug-strings 7861@opindex fmerge-debug-strings 7862@opindex fno-merge-debug-strings 7863Direct the linker to not merge together strings in the debugging 7864information that are identical in different object files. Merging is 7865not supported by all assemblers or linkers. Merging decreases the size 7866of the debug information in the output file at the cost of increasing 7867link processing time. Merging is enabled by default. 7868 7869@item -fdebug-prefix-map=@var{old}=@var{new} 7870@opindex fdebug-prefix-map 7871When compiling files residing in directory @file{@var{old}}, record 7872debugging information describing them as if the files resided in 7873directory @file{@var{new}} instead. This can be used to replace a 7874build-time path with an install-time path in the debug info. It can 7875also be used to change an absolute path to a relative path by using 7876@file{.} for @var{new}. This can give more reproducible builds, which 7877are location independent, but may require an extra command to tell GDB 7878where to find the source files. See also @option{-ffile-prefix-map}. 7879 7880@item -fvar-tracking 7881@opindex fvar-tracking 7882Run variable tracking pass. It computes where variables are stored at each 7883position in code. Better debugging information is then generated 7884(if the debugging information format supports this information). 7885 7886It is enabled by default when compiling with optimization (@option{-Os}, 7887@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 7888the debug info format supports it. 7889 7890@item -fvar-tracking-assignments 7891@opindex fvar-tracking-assignments 7892@opindex fno-var-tracking-assignments 7893Annotate assignments to user variables early in the compilation and 7894attempt to carry the annotations over throughout the compilation all the 7895way to the end, in an attempt to improve debug information while 7896optimizing. Use of @option{-gdwarf-4} is recommended along with it. 7897 7898It can be enabled even if var-tracking is disabled, in which case 7899annotations are created and maintained, but discarded at the end. 7900By default, this flag is enabled together with @option{-fvar-tracking}, 7901except when selective scheduling is enabled. 7902 7903@item -gsplit-dwarf 7904@opindex gsplit-dwarf 7905Separate as much DWARF debugging information as possible into a 7906separate output file with the extension @file{.dwo}. This option allows 7907the build system to avoid linking files with debug information. To 7908be useful, this option requires a debugger capable of reading @file{.dwo} 7909files. 7910 7911@item -gdescribe-dies 7912@opindex gdescribe-dies 7913Add description attributes to some DWARF DIEs that have no name attribute, 7914such as artificial variables, external references and call site 7915parameter DIEs. 7916 7917@item -gpubnames 7918@opindex gpubnames 7919Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections. 7920 7921@item -ggnu-pubnames 7922@opindex ggnu-pubnames 7923Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format 7924suitable for conversion into a GDB@ index. This option is only useful 7925with a linker that can produce GDB@ index version 7. 7926 7927@item -fdebug-types-section 7928@opindex fdebug-types-section 7929@opindex fno-debug-types-section 7930When using DWARF Version 4 or higher, type DIEs can be put into 7931their own @code{.debug_types} section instead of making them part of the 7932@code{.debug_info} section. It is more efficient to put them in a separate 7933comdat section since the linker can then remove duplicates. 7934But not all DWARF consumers support @code{.debug_types} sections yet 7935and on some objects @code{.debug_types} produces larger instead of smaller 7936debugging information. 7937 7938@item -grecord-gcc-switches 7939@itemx -gno-record-gcc-switches 7940@opindex grecord-gcc-switches 7941@opindex gno-record-gcc-switches 7942This switch causes the command-line options used to invoke the 7943compiler that may affect code generation to be appended to the 7944DW_AT_producer attribute in DWARF debugging information. The options 7945are concatenated with spaces separating them from each other and from 7946the compiler version. 7947It is enabled by default. 7948See also @option{-frecord-gcc-switches} for another 7949way of storing compiler options into the object file. 7950 7951@item -gstrict-dwarf 7952@opindex gstrict-dwarf 7953Disallow using extensions of later DWARF standard version than selected 7954with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 7955DWARF extensions from later standard versions is allowed. 7956 7957@item -gno-strict-dwarf 7958@opindex gno-strict-dwarf 7959Allow using extensions of later DWARF standard version than selected with 7960@option{-gdwarf-@var{version}}. 7961 7962@item -gas-loc-support 7963@opindex gas-loc-support 7964Inform the compiler that the assembler supports @code{.loc} directives. 7965It may then use them for the assembler to generate DWARF2+ line number 7966tables. 7967 7968This is generally desirable, because assembler-generated line-number 7969tables are a lot more compact than those the compiler can generate 7970itself. 7971 7972This option will be enabled by default if, at GCC configure time, the 7973assembler was found to support such directives. 7974 7975@item -gno-as-loc-support 7976@opindex gno-as-loc-support 7977Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ 7978line number tables are to be generated. 7979 7980@item gas-locview-support 7981@opindex gas-locview-support 7982Inform the compiler that the assembler supports @code{view} assignment 7983and reset assertion checking in @code{.loc} directives. 7984 7985This option will be enabled by default if, at GCC configure time, the 7986assembler was found to support them. 7987 7988@item gno-as-locview-support 7989Force GCC to assign view numbers internally, if 7990@option{-gvariable-location-views} are explicitly requested. 7991 7992@item -gcolumn-info 7993@itemx -gno-column-info 7994@opindex gcolumn-info 7995@opindex gno-column-info 7996Emit location column information into DWARF debugging information, rather 7997than just file and line. 7998This option is enabled by default. 7999 8000@item -gstatement-frontiers 8001@itemx -gno-statement-frontiers 8002@opindex gstatement-frontiers 8003@opindex gno-statement-frontiers 8004This option causes GCC to create markers in the internal representation 8005at the beginning of statements, and to keep them roughly in place 8006throughout compilation, using them to guide the output of @code{is_stmt} 8007markers in the line number table. This is enabled by default when 8008compiling with optimization (@option{-Os}, @option{-O}, @option{-O2}, 8009@dots{}), and outputting DWARF 2 debug information at the normal level. 8010 8011@item -gvariable-location-views 8012@itemx -gvariable-location-views=incompat5 8013@itemx -gno-variable-location-views 8014@opindex gvariable-location-views 8015@opindex gvariable-location-views=incompat5 8016@opindex gno-variable-location-views 8017Augment variable location lists with progressive view numbers implied 8018from the line number table. This enables debug information consumers to 8019inspect state at certain points of the program, even if no instructions 8020associated with the corresponding source locations are present at that 8021point. If the assembler lacks support for view numbers in line number 8022tables, this will cause the compiler to emit the line number table, 8023which generally makes them somewhat less compact. The augmented line 8024number tables and location lists are fully backward-compatible, so they 8025can be consumed by debug information consumers that are not aware of 8026these augmentations, but they won't derive any benefit from them either. 8027 8028This is enabled by default when outputting DWARF 2 debug information at 8029the normal level, as long as there is assembler support, 8030@option{-fvar-tracking-assignments} is enabled and 8031@option{-gstrict-dwarf} is not. When assembler support is not 8032available, this may still be enabled, but it will force GCC to output 8033internal line number tables, and if 8034@option{-ginternal-reset-location-views} is not enabled, that will most 8035certainly lead to silently mismatching location views. 8036 8037There is a proposed representation for view numbers that is not backward 8038compatible with the location list format introduced in DWARF 5, that can 8039be enabled with @option{-gvariable-location-views=incompat5}. This 8040option may be removed in the future, is only provided as a reference 8041implementation of the proposed representation. Debug information 8042consumers are not expected to support this extended format, and they 8043would be rendered unable to decode location lists using it. 8044 8045@item -ginternal-reset-location-views 8046@itemx -gno-internal-reset-location-views 8047@opindex ginternal-reset-location-views 8048@opindex gno-internal-reset-location-views 8049Attempt to determine location views that can be omitted from location 8050view lists. This requires the compiler to have very accurate insn 8051length estimates, which isn't always the case, and it may cause 8052incorrect view lists to be generated silently when using an assembler 8053that does not support location view lists. The GNU assembler will flag 8054any such error as a @code{view number mismatch}. This is only enabled 8055on ports that define a reliable estimation function. 8056 8057@item -ginline-points 8058@itemx -gno-inline-points 8059@opindex ginline-points 8060@opindex gno-inline-points 8061Generate extended debug information for inlined functions. Location 8062view tracking markers are inserted at inlined entry points, so that 8063address and view numbers can be computed and output in debug 8064information. This can be enabled independently of location views, in 8065which case the view numbers won't be output, but it can only be enabled 8066along with statement frontiers, and it is only enabled by default if 8067location views are enabled. 8068 8069@item -gz@r{[}=@var{type}@r{]} 8070@opindex gz 8071Produce compressed debug sections in DWARF format, if that is supported. 8072If @var{type} is not given, the default type depends on the capabilities 8073of the assembler and linker used. @var{type} may be one of 8074@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 8075compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 8076compression in traditional GNU format). If the linker doesn't support 8077writing compressed debug sections, the option is rejected. Otherwise, 8078if the assembler does not support them, @option{-gz} is silently ignored 8079when producing object files. 8080 8081@item -femit-struct-debug-baseonly 8082@opindex femit-struct-debug-baseonly 8083Emit debug information for struct-like types 8084only when the base name of the compilation source file 8085matches the base name of file in which the struct is defined. 8086 8087This option substantially reduces the size of debugging information, 8088but at significant potential loss in type information to the debugger. 8089See @option{-femit-struct-debug-reduced} for a less aggressive option. 8090See @option{-femit-struct-debug-detailed} for more detailed control. 8091 8092This option works only with DWARF debug output. 8093 8094@item -femit-struct-debug-reduced 8095@opindex femit-struct-debug-reduced 8096Emit debug information for struct-like types 8097only when the base name of the compilation source file 8098matches the base name of file in which the type is defined, 8099unless the struct is a template or defined in a system header. 8100 8101This option significantly reduces the size of debugging information, 8102with some potential loss in type information to the debugger. 8103See @option{-femit-struct-debug-baseonly} for a more aggressive option. 8104See @option{-femit-struct-debug-detailed} for more detailed control. 8105 8106This option works only with DWARF debug output. 8107 8108@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 8109@opindex femit-struct-debug-detailed 8110Specify the struct-like types 8111for which the compiler generates debug information. 8112The intent is to reduce duplicate struct debug information 8113between different object files within the same program. 8114 8115This option is a detailed version of 8116@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 8117which serves for most needs. 8118 8119A specification has the syntax@* 8120[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 8121 8122The optional first word limits the specification to 8123structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 8124A struct type is used directly when it is the type of a variable, member. 8125Indirect uses arise through pointers to structs. 8126That is, when use of an incomplete struct is valid, the use is indirect. 8127An example is 8128@samp{struct one direct; struct two * indirect;}. 8129 8130The optional second word limits the specification to 8131ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 8132Generic structs are a bit complicated to explain. 8133For C++, these are non-explicit specializations of template classes, 8134or non-template classes within the above. 8135Other programming languages have generics, 8136but @option{-femit-struct-debug-detailed} does not yet implement them. 8137 8138The third word specifies the source files for those 8139structs for which the compiler should emit debug information. 8140The values @samp{none} and @samp{any} have the normal meaning. 8141The value @samp{base} means that 8142the base of name of the file in which the type declaration appears 8143must match the base of the name of the main compilation file. 8144In practice, this means that when compiling @file{foo.c}, debug information 8145is generated for types declared in that file and @file{foo.h}, 8146but not other header files. 8147The value @samp{sys} means those types satisfying @samp{base} 8148or declared in system or compiler headers. 8149 8150You may need to experiment to determine the best settings for your application. 8151 8152The default is @option{-femit-struct-debug-detailed=all}. 8153 8154This option works only with DWARF debug output. 8155 8156@item -fno-dwarf2-cfi-asm 8157@opindex fdwarf2-cfi-asm 8158@opindex fno-dwarf2-cfi-asm 8159Emit DWARF unwind info as compiler generated @code{.eh_frame} section 8160instead of using GAS @code{.cfi_*} directives. 8161 8162@item -fno-eliminate-unused-debug-types 8163@opindex feliminate-unused-debug-types 8164@opindex fno-eliminate-unused-debug-types 8165Normally, when producing DWARF output, GCC avoids producing debug symbol 8166output for types that are nowhere used in the source file being compiled. 8167Sometimes it is useful to have GCC emit debugging 8168information for all types declared in a compilation 8169unit, regardless of whether or not they are actually used 8170in that compilation unit, for example 8171if, in the debugger, you want to cast a value to a type that is 8172not actually used in your program (but is declared). More often, 8173however, this results in a significant amount of wasted space. 8174@end table 8175 8176@node Optimize Options 8177@section Options That Control Optimization 8178@cindex optimize options 8179@cindex options, optimization 8180 8181These options control various sorts of optimizations. 8182 8183Without any optimization option, the compiler's goal is to reduce the 8184cost of compilation and to make debugging produce the expected 8185results. Statements are independent: if you stop the program with a 8186breakpoint between statements, you can then assign a new value to any 8187variable or change the program counter to any other statement in the 8188function and get exactly the results you expect from the source 8189code. 8190 8191Turning on optimization flags makes the compiler attempt to improve 8192the performance and/or code size at the expense of compilation time 8193and possibly the ability to debug the program. 8194 8195The compiler performs optimization based on the knowledge it has of the 8196program. Compiling multiple files at once to a single output file mode allows 8197the compiler to use information gained from all of the files when compiling 8198each of them. 8199 8200Not all optimizations are controlled directly by a flag. Only 8201optimizations that have a flag are listed in this section. 8202 8203Most optimizations are completely disabled at @option{-O0} or if an 8204@option{-O} level is not set on the command line, even if individual 8205optimization flags are specified. Similarly, @option{-Og} suppresses 8206many optimization passes. 8207 8208Depending on the target and how GCC was configured, a slightly different 8209set of optimizations may be enabled at each @option{-O} level than 8210those listed here. You can invoke GCC with @option{-Q --help=optimizers} 8211to find out the exact set of optimizations that are enabled at each level. 8212@xref{Overall Options}, for examples. 8213 8214@table @gcctabopt 8215@item -O 8216@itemx -O1 8217@opindex O 8218@opindex O1 8219Optimize. Optimizing compilation takes somewhat more time, and a lot 8220more memory for a large function. 8221 8222With @option{-O}, the compiler tries to reduce code size and execution 8223time, without performing any optimizations that take a great deal of 8224compilation time. 8225 8226@c Note that in addition to the default_options_table list in opts.c, 8227@c several optimization flags default to true but control optimization 8228@c passes that are explicitly disabled at -O0. 8229 8230@option{-O} turns on the following optimization flags: 8231 8232@c Please keep the following list alphabetized. 8233@gccoptlist{-fauto-inc-dec @gol 8234-fbranch-count-reg @gol 8235-fcombine-stack-adjustments @gol 8236-fcompare-elim @gol 8237-fcprop-registers @gol 8238-fdce @gol 8239-fdefer-pop @gol 8240-fdelayed-branch @gol 8241-fdse @gol 8242-fforward-propagate @gol 8243-fguess-branch-probability @gol 8244-fif-conversion @gol 8245-fif-conversion2 @gol 8246-finline-functions-called-once @gol 8247-fipa-profile @gol 8248-fipa-pure-const @gol 8249-fipa-reference @gol 8250-fipa-reference-addressable @gol 8251-fmerge-constants @gol 8252-fmove-loop-invariants @gol 8253-fomit-frame-pointer @gol 8254-freorder-blocks @gol 8255-fshrink-wrap @gol 8256-fshrink-wrap-separate @gol 8257-fsplit-wide-types @gol 8258-fssa-backprop @gol 8259-fssa-phiopt @gol 8260-ftree-bit-ccp @gol 8261-ftree-ccp @gol 8262-ftree-ch @gol 8263-ftree-coalesce-vars @gol 8264-ftree-copy-prop @gol 8265-ftree-dce @gol 8266-ftree-dominator-opts @gol 8267-ftree-dse @gol 8268-ftree-forwprop @gol 8269-ftree-fre @gol 8270-ftree-phiprop @gol 8271-ftree-pta @gol 8272-ftree-scev-cprop @gol 8273-ftree-sink @gol 8274-ftree-slsr @gol 8275-ftree-sra @gol 8276-ftree-ter @gol 8277-funit-at-a-time} 8278 8279@item -O2 8280@opindex O2 8281Optimize even more. GCC performs nearly all supported optimizations 8282that do not involve a space-speed tradeoff. 8283As compared to @option{-O}, this option increases both compilation time 8284and the performance of the generated code. 8285 8286@option{-O2} turns on all optimization flags specified by @option{-O}. It 8287also turns on the following optimization flags: 8288 8289@c Please keep the following list alphabetized! 8290@gccoptlist{-falign-functions -falign-jumps @gol 8291-falign-labels -falign-loops @gol 8292-fcaller-saves @gol 8293-fcode-hoisting @gol 8294-fcrossjumping @gol 8295-fcse-follow-jumps -fcse-skip-blocks @gol 8296-fdelete-null-pointer-checks @gol 8297-fdevirtualize -fdevirtualize-speculatively @gol 8298-fexpensive-optimizations @gol 8299-fgcse -fgcse-lm @gol 8300-fhoist-adjacent-loads @gol 8301-finline-small-functions @gol 8302-findirect-inlining @gol 8303-fipa-bit-cp -fipa-cp -fipa-icf @gol 8304-fipa-ra -fipa-sra -fipa-vrp @gol 8305-fisolate-erroneous-paths-dereference @gol 8306-flra-remat @gol 8307-foptimize-sibling-calls @gol 8308-foptimize-strlen @gol 8309-fpartial-inlining @gol 8310-fpeephole2 @gol 8311-freorder-blocks-algorithm=stc @gol 8312-freorder-blocks-and-partition -freorder-functions @gol 8313-frerun-cse-after-loop @gol 8314-fschedule-insns -fschedule-insns2 @gol 8315-fsched-interblock -fsched-spec @gol 8316-fstore-merging @gol 8317-fstrict-aliasing @gol 8318-fthread-jumps @gol 8319-ftree-builtin-call-dce @gol 8320-ftree-pre @gol 8321-ftree-switch-conversion -ftree-tail-merge @gol 8322-ftree-vrp} 8323 8324Please note the warning under @option{-fgcse} about 8325invoking @option{-O2} on programs that use computed gotos. 8326 8327@item -O3 8328@opindex O3 8329Optimize yet more. @option{-O3} turns on all optimizations specified 8330by @option{-O2} and also turns on the following optimization flags: 8331 8332@c Please keep the following list alphabetized! 8333@gccoptlist{-fgcse-after-reload @gol 8334-finline-functions @gol 8335-fipa-cp-clone 8336-floop-interchange @gol 8337-floop-unroll-and-jam @gol 8338-fpeel-loops @gol 8339-fpredictive-commoning @gol 8340-fsplit-paths @gol 8341-ftree-loop-distribute-patterns @gol 8342-ftree-loop-distribution @gol 8343-ftree-loop-vectorize @gol 8344-ftree-partial-pre @gol 8345-ftree-slp-vectorize @gol 8346-funswitch-loops @gol 8347-fvect-cost-model @gol 8348-fversion-loops-for-strides} 8349 8350@item -O0 8351@opindex O0 8352Reduce compilation time and make debugging produce the expected 8353results. This is the default. 8354 8355@item -Os 8356@opindex Os 8357Optimize for size. @option{-Os} enables all @option{-O2} optimizations 8358except those that often increase code size: 8359 8360@gccoptlist{-falign-functions -falign-jumps @gol 8361-falign-labels -falign-loops @gol 8362-fprefetch-loop-arrays -freorder-blocks-algorithm=stc} 8363 8364It also enables @option{-finline-functions}, causes the compiler to tune for 8365code size rather than execution speed, and performs further optimizations 8366designed to reduce code size. 8367 8368@item -Ofast 8369@opindex Ofast 8370Disregard strict standards compliance. @option{-Ofast} enables all 8371@option{-O3} optimizations. It also enables optimizations that are not 8372valid for all standard-compliant programs. 8373It turns on @option{-ffast-math} and the Fortran-specific 8374@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is 8375specified, and @option{-fno-protect-parens}. 8376 8377@item -Og 8378@opindex Og 8379Optimize debugging experience. @option{-Og} should be the optimization 8380level of choice for the standard edit-compile-debug cycle, offering 8381a reasonable level of optimization while maintaining fast compilation 8382and a good debugging experience. It is a better choice than @option{-O0} 8383for producing debuggable code because some compiler passes 8384that collect debug information are disabled at @option{-O0}. 8385 8386Like @option{-O0}, @option{-Og} completely disables a number of 8387optimization passes so that individual options controlling them have 8388no effect. Otherwise @option{-Og} enables all @option{-O1} 8389optimization flags except for those that may interfere with debugging: 8390 8391@gccoptlist{-fbranch-count-reg -fdelayed-branch @gol 8392-fif-conversion -fif-conversion2 @gol 8393-finline-functions-called-once @gol 8394-fmove-loop-invariants -fssa-phiopt @gol 8395-ftree-bit-ccp -ftree-pta -ftree-sra} 8396 8397@end table 8398 8399If you use multiple @option{-O} options, with or without level numbers, 8400the last such option is the one that is effective. 8401 8402Options of the form @option{-f@var{flag}} specify machine-independent 8403flags. Most flags have both positive and negative forms; the negative 8404form of @option{-ffoo} is @option{-fno-foo}. In the table 8405below, only one of the forms is listed---the one you typically 8406use. You can figure out the other form by either removing @samp{no-} 8407or adding it. 8408 8409The following options control specific optimizations. They are either 8410activated by @option{-O} options or are related to ones that are. You 8411can use the following flags in the rare cases when ``fine-tuning'' of 8412optimizations to be performed is desired. 8413 8414@table @gcctabopt 8415@item -fno-defer-pop 8416@opindex fno-defer-pop 8417@opindex fdefer-pop 8418For machines that must pop arguments after a function call, always pop 8419the arguments as soon as each function returns. 8420At levels @option{-O1} and higher, @option{-fdefer-pop} is the default; 8421this allows the compiler to let arguments accumulate on the stack for several 8422function calls and pop them all at once. 8423 8424@item -fforward-propagate 8425@opindex fforward-propagate 8426Perform a forward propagation pass on RTL@. The pass tries to combine two 8427instructions and checks if the result can be simplified. If loop unrolling 8428is active, two passes are performed and the second is scheduled after 8429loop unrolling. 8430 8431This option is enabled by default at optimization levels @option{-O}, 8432@option{-O2}, @option{-O3}, @option{-Os}. 8433 8434@item -ffp-contract=@var{style} 8435@opindex ffp-contract 8436@option{-ffp-contract=off} disables floating-point expression contraction. 8437@option{-ffp-contract=fast} enables floating-point expression contraction 8438such as forming of fused multiply-add operations if the target has 8439native support for them. 8440@option{-ffp-contract=on} enables floating-point expression contraction 8441if allowed by the language standard. This is currently not implemented 8442and treated equal to @option{-ffp-contract=off}. 8443 8444The default is @option{-ffp-contract=fast}. 8445 8446@item -fomit-frame-pointer 8447@opindex fomit-frame-pointer 8448Omit the frame pointer in functions that don't need one. This avoids the 8449instructions to save, set up and restore the frame pointer; on many targets 8450it also makes an extra register available. 8451 8452On some targets this flag has no effect because the standard calling sequence 8453always uses a frame pointer, so it cannot be omitted. 8454 8455Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer 8456is used in all functions. Several targets always omit the frame pointer in 8457leaf functions. 8458 8459Enabled by default at @option{-O} and higher. 8460 8461@item -foptimize-sibling-calls 8462@opindex foptimize-sibling-calls 8463Optimize sibling and tail recursive calls. 8464 8465Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8466 8467@item -foptimize-strlen 8468@opindex foptimize-strlen 8469Optimize various standard C string functions (e.g.@: @code{strlen}, 8470@code{strchr} or @code{strcpy}) and 8471their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 8472 8473Enabled at levels @option{-O2}, @option{-O3}. 8474 8475@item -fno-inline 8476@opindex fno-inline 8477@opindex finline 8478Do not expand any functions inline apart from those marked with 8479the @code{always_inline} attribute. This is the default when not 8480optimizing. 8481 8482Single functions can be exempted from inlining by marking them 8483with the @code{noinline} attribute. 8484 8485@item -finline-small-functions 8486@opindex finline-small-functions 8487Integrate functions into their callers when their body is smaller than expected 8488function call code (so overall size of program gets smaller). The compiler 8489heuristically decides which functions are simple enough to be worth integrating 8490in this way. This inlining applies to all functions, even those not declared 8491inline. 8492 8493Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8494 8495@item -findirect-inlining 8496@opindex findirect-inlining 8497Inline also indirect calls that are discovered to be known at compile 8498time thanks to previous inlining. This option has any effect only 8499when inlining itself is turned on by the @option{-finline-functions} 8500or @option{-finline-small-functions} options. 8501 8502Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8503 8504@item -finline-functions 8505@opindex finline-functions 8506Consider all functions for inlining, even if they are not declared inline. 8507The compiler heuristically decides which functions are worth integrating 8508in this way. 8509 8510If all calls to a given function are integrated, and the function is 8511declared @code{static}, then the function is normally not output as 8512assembler code in its own right. 8513 8514Enabled at levels @option{-O3}, @option{-Os}. Also enabled 8515by @option{-fprofile-use} and @option{-fauto-profile}. 8516 8517@item -finline-functions-called-once 8518@opindex finline-functions-called-once 8519Consider all @code{static} functions called once for inlining into their 8520caller even if they are not marked @code{inline}. If a call to a given 8521function is integrated, then the function is not output as assembler code 8522in its own right. 8523 8524Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}, 8525but not @option{-Og}. 8526 8527@item -fearly-inlining 8528@opindex fearly-inlining 8529Inline functions marked by @code{always_inline} and functions whose body seems 8530smaller than the function call overhead early before doing 8531@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 8532makes profiling significantly cheaper and usually inlining faster on programs 8533having large chains of nested wrapper functions. 8534 8535Enabled by default. 8536 8537@item -fipa-sra 8538@opindex fipa-sra 8539Perform interprocedural scalar replacement of aggregates, removal of 8540unused parameters and replacement of parameters passed by reference 8541by parameters passed by value. 8542 8543Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 8544 8545@item -finline-limit=@var{n} 8546@opindex finline-limit 8547By default, GCC limits the size of functions that can be inlined. This flag 8548allows coarse control of this limit. @var{n} is the size of functions that 8549can be inlined in number of pseudo instructions. 8550 8551Inlining is actually controlled by a number of parameters, which may be 8552specified individually by using @option{--param @var{name}=@var{value}}. 8553The @option{-finline-limit=@var{n}} option sets some of these parameters 8554as follows: 8555 8556@table @gcctabopt 8557@item max-inline-insns-single 8558is set to @var{n}/2. 8559@item max-inline-insns-auto 8560is set to @var{n}/2. 8561@end table 8562 8563See below for a documentation of the individual 8564parameters controlling inlining and for the defaults of these parameters. 8565 8566@emph{Note:} there may be no value to @option{-finline-limit} that results 8567in default behavior. 8568 8569@emph{Note:} pseudo instruction represents, in this particular context, an 8570abstract measurement of function's size. In no way does it represent a count 8571of assembly instructions and as such its exact meaning might change from one 8572release to an another. 8573 8574@item -fno-keep-inline-dllexport 8575@opindex fno-keep-inline-dllexport 8576@opindex fkeep-inline-dllexport 8577This is a more fine-grained version of @option{-fkeep-inline-functions}, 8578which applies only to functions that are declared using the @code{dllexport} 8579attribute or declspec. @xref{Function Attributes,,Declaring Attributes of 8580Functions}. 8581 8582@item -fkeep-inline-functions 8583@opindex fkeep-inline-functions 8584In C, emit @code{static} functions that are declared @code{inline} 8585into the object file, even if the function has been inlined into all 8586of its callers. This switch does not affect functions using the 8587@code{extern inline} extension in GNU C90@. In C++, emit any and all 8588inline functions into the object file. 8589 8590@item -fkeep-static-functions 8591@opindex fkeep-static-functions 8592Emit @code{static} functions into the object file, even if the function 8593is never used. 8594 8595@item -fkeep-static-consts 8596@opindex fkeep-static-consts 8597Emit variables declared @code{static const} when optimization isn't turned 8598on, even if the variables aren't referenced. 8599 8600GCC enables this option by default. If you want to force the compiler to 8601check if a variable is referenced, regardless of whether or not 8602optimization is turned on, use the @option{-fno-keep-static-consts} option. 8603 8604@item -fmerge-constants 8605@opindex fmerge-constants 8606Attempt to merge identical constants (string constants and floating-point 8607constants) across compilation units. 8608 8609This option is the default for optimized compilation if the assembler and 8610linker support it. Use @option{-fno-merge-constants} to inhibit this 8611behavior. 8612 8613Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8614 8615@item -fmerge-all-constants 8616@opindex fmerge-all-constants 8617Attempt to merge identical constants and identical variables. 8618 8619This option implies @option{-fmerge-constants}. In addition to 8620@option{-fmerge-constants} this considers e.g.@: even constant initialized 8621arrays or initialized constant variables with integral or floating-point 8622types. Languages like C or C++ require each variable, including multiple 8623instances of the same variable in recursive calls, to have distinct locations, 8624so using this option results in non-conforming 8625behavior. 8626 8627@item -fmodulo-sched 8628@opindex fmodulo-sched 8629Perform swing modulo scheduling immediately before the first scheduling 8630pass. This pass looks at innermost loops and reorders their 8631instructions by overlapping different iterations. 8632 8633@item -fmodulo-sched-allow-regmoves 8634@opindex fmodulo-sched-allow-regmoves 8635Perform more aggressive SMS-based modulo scheduling with register moves 8636allowed. By setting this flag certain anti-dependences edges are 8637deleted, which triggers the generation of reg-moves based on the 8638life-range analysis. This option is effective only with 8639@option{-fmodulo-sched} enabled. 8640 8641@item -fno-branch-count-reg 8642@opindex fno-branch-count-reg 8643@opindex fbranch-count-reg 8644Disable the optimization pass that scans for opportunities to use 8645``decrement and branch'' instructions on a count register instead of 8646instruction sequences that decrement a register, compare it against zero, and 8647then branch based upon the result. This option is only meaningful on 8648architectures that support such instructions, which include x86, PowerPC, 8649IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option 8650doesn't remove the decrement and branch instructions from the generated 8651instruction stream introduced by other optimization passes. 8652 8653The default is @option{-fbranch-count-reg} at @option{-O1} and higher, 8654except for @option{-Og}. 8655 8656@item -fno-function-cse 8657@opindex fno-function-cse 8658@opindex ffunction-cse 8659Do not put function addresses in registers; make each instruction that 8660calls a constant function contain the function's address explicitly. 8661 8662This option results in less efficient code, but some strange hacks 8663that alter the assembler output may be confused by the optimizations 8664performed when this option is not used. 8665 8666The default is @option{-ffunction-cse} 8667 8668@item -fno-zero-initialized-in-bss 8669@opindex fno-zero-initialized-in-bss 8670@opindex fzero-initialized-in-bss 8671If the target supports a BSS section, GCC by default puts variables that 8672are initialized to zero into BSS@. This can save space in the resulting 8673code. 8674 8675This option turns off this behavior because some programs explicitly 8676rely on variables going to the data section---e.g., so that the 8677resulting executable can find the beginning of that section and/or make 8678assumptions based on that. 8679 8680The default is @option{-fzero-initialized-in-bss}. 8681 8682@item -fthread-jumps 8683@opindex fthread-jumps 8684Perform optimizations that check to see if a jump branches to a 8685location where another comparison subsumed by the first is found. If 8686so, the first branch is redirected to either the destination of the 8687second branch or a point immediately following it, depending on whether 8688the condition is known to be true or false. 8689 8690Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8691 8692@item -fsplit-wide-types 8693@opindex fsplit-wide-types 8694When using a type that occupies multiple registers, such as @code{long 8695long} on a 32-bit system, split the registers apart and allocate them 8696independently. This normally generates better code for those types, 8697but may make debugging more difficult. 8698 8699Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 8700@option{-Os}. 8701 8702@item -fcse-follow-jumps 8703@opindex fcse-follow-jumps 8704In common subexpression elimination (CSE), scan through jump instructions 8705when the target of the jump is not reached by any other path. For 8706example, when CSE encounters an @code{if} statement with an 8707@code{else} clause, CSE follows the jump when the condition 8708tested is false. 8709 8710Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8711 8712@item -fcse-skip-blocks 8713@opindex fcse-skip-blocks 8714This is similar to @option{-fcse-follow-jumps}, but causes CSE to 8715follow jumps that conditionally skip over blocks. When CSE 8716encounters a simple @code{if} statement with no else clause, 8717@option{-fcse-skip-blocks} causes CSE to follow the jump around the 8718body of the @code{if}. 8719 8720Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8721 8722@item -frerun-cse-after-loop 8723@opindex frerun-cse-after-loop 8724Re-run common subexpression elimination after loop optimizations are 8725performed. 8726 8727Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8728 8729@item -fgcse 8730@opindex fgcse 8731Perform a global common subexpression elimination pass. 8732This pass also performs global constant and copy propagation. 8733 8734@emph{Note:} When compiling a program using computed gotos, a GCC 8735extension, you may get better run-time performance if you disable 8736the global common subexpression elimination pass by adding 8737@option{-fno-gcse} to the command line. 8738 8739Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8740 8741@item -fgcse-lm 8742@opindex fgcse-lm 8743When @option{-fgcse-lm} is enabled, global common subexpression elimination 8744attempts to move loads that are only killed by stores into themselves. This 8745allows a loop containing a load/store sequence to be changed to a load outside 8746the loop, and a copy/store within the loop. 8747 8748Enabled by default when @option{-fgcse} is enabled. 8749 8750@item -fgcse-sm 8751@opindex fgcse-sm 8752When @option{-fgcse-sm} is enabled, a store motion pass is run after 8753global common subexpression elimination. This pass attempts to move 8754stores out of loops. When used in conjunction with @option{-fgcse-lm}, 8755loops containing a load/store sequence can be changed to a load before 8756the loop and a store after the loop. 8757 8758Not enabled at any optimization level. 8759 8760@item -fgcse-las 8761@opindex fgcse-las 8762When @option{-fgcse-las} is enabled, the global common subexpression 8763elimination pass eliminates redundant loads that come after stores to the 8764same memory location (both partial and full redundancies). 8765 8766Not enabled at any optimization level. 8767 8768@item -fgcse-after-reload 8769@opindex fgcse-after-reload 8770When @option{-fgcse-after-reload} is enabled, a redundant load elimination 8771pass is performed after reload. The purpose of this pass is to clean up 8772redundant spilling. 8773 8774Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 8775 8776@item -faggressive-loop-optimizations 8777@opindex faggressive-loop-optimizations 8778This option tells the loop optimizer to use language constraints to 8779derive bounds for the number of iterations of a loop. This assumes that 8780loop code does not invoke undefined behavior by for example causing signed 8781integer overflows or out-of-bound array accesses. The bounds for the 8782number of iterations of a loop are used to guide loop unrolling and peeling 8783and loop exit test optimizations. 8784This option is enabled by default. 8785 8786@item -funconstrained-commons 8787@opindex funconstrained-commons 8788This option tells the compiler that variables declared in common blocks 8789(e.g.@: Fortran) may later be overridden with longer trailing arrays. This 8790prevents certain optimizations that depend on knowing the array bounds. 8791 8792@item -fcrossjumping 8793@opindex fcrossjumping 8794Perform cross-jumping transformation. 8795This transformation unifies equivalent code and saves code size. The 8796resulting code may or may not perform better than without cross-jumping. 8797 8798Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8799 8800@item -fauto-inc-dec 8801@opindex fauto-inc-dec 8802Combine increments or decrements of addresses with memory accesses. 8803This pass is always skipped on architectures that do not have 8804instructions to support this. Enabled by default at @option{-O} and 8805higher on architectures that support this. 8806 8807@item -fdce 8808@opindex fdce 8809Perform dead code elimination (DCE) on RTL@. 8810Enabled by default at @option{-O} and higher. 8811 8812@item -fdse 8813@opindex fdse 8814Perform dead store elimination (DSE) on RTL@. 8815Enabled by default at @option{-O} and higher. 8816 8817@item -fif-conversion 8818@opindex fif-conversion 8819Attempt to transform conditional jumps into branch-less equivalents. This 8820includes use of conditional moves, min, max, set flags and abs instructions, and 8821some tricks doable by standard arithmetics. The use of conditional execution 8822on chips where it is available is controlled by @option{-fif-conversion2}. 8823 8824Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but 8825not with @option{-Og}. 8826 8827@item -fif-conversion2 8828@opindex fif-conversion2 8829Use conditional execution (where available) to transform conditional jumps into 8830branch-less equivalents. 8831 8832Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but 8833not with @option{-Og}. 8834 8835@item -fdeclone-ctor-dtor 8836@opindex fdeclone-ctor-dtor 8837The C++ ABI requires multiple entry points for constructors and 8838destructors: one for a base subobject, one for a complete object, and 8839one for a virtual destructor that calls operator delete afterwards. 8840For a hierarchy with virtual bases, the base and complete variants are 8841clones, which means two copies of the function. With this option, the 8842base and complete variants are changed to be thunks that call a common 8843implementation. 8844 8845Enabled by @option{-Os}. 8846 8847@item -fdelete-null-pointer-checks 8848@opindex fdelete-null-pointer-checks 8849Assume that programs cannot safely dereference null pointers, and that 8850no code or data element resides at address zero. 8851This option enables simple constant 8852folding optimizations at all optimization levels. In addition, other 8853optimization passes in GCC use this flag to control global dataflow 8854analyses that eliminate useless checks for null pointers; these assume 8855that a memory access to address zero always results in a trap, so 8856that if a pointer is checked after it has already been dereferenced, 8857it cannot be null. 8858 8859Note however that in some environments this assumption is not true. 8860Use @option{-fno-delete-null-pointer-checks} to disable this optimization 8861for programs that depend on that behavior. 8862 8863This option is enabled by default on most targets. On Nios II ELF, it 8864defaults to off. On AVR, CR16, and MSP430, this option is completely disabled. 8865 8866Passes that use the dataflow information 8867are enabled independently at different optimization levels. 8868 8869@item -fdevirtualize 8870@opindex fdevirtualize 8871Attempt to convert calls to virtual functions to direct calls. This 8872is done both within a procedure and interprocedurally as part of 8873indirect inlining (@option{-findirect-inlining}) and interprocedural constant 8874propagation (@option{-fipa-cp}). 8875Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8876 8877@item -fdevirtualize-speculatively 8878@opindex fdevirtualize-speculatively 8879Attempt to convert calls to virtual functions to speculative direct calls. 8880Based on the analysis of the type inheritance graph, determine for a given call 8881the set of likely targets. If the set is small, preferably of size 1, change 8882the call into a conditional deciding between direct and indirect calls. The 8883speculative calls enable more optimizations, such as inlining. When they seem 8884useless after further optimization, they are converted back into original form. 8885 8886@item -fdevirtualize-at-ltrans 8887@opindex fdevirtualize-at-ltrans 8888Stream extra information needed for aggressive devirtualization when running 8889the link-time optimizer in local transformation mode. 8890This option enables more devirtualization but 8891significantly increases the size of streamed data. For this reason it is 8892disabled by default. 8893 8894@item -fexpensive-optimizations 8895@opindex fexpensive-optimizations 8896Perform a number of minor optimizations that are relatively expensive. 8897 8898Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8899 8900@item -free 8901@opindex free 8902Attempt to remove redundant extension instructions. This is especially 8903helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 8904registers after writing to their lower 32-bit half. 8905 8906Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 8907@option{-O3}, @option{-Os}. 8908 8909@item -fno-lifetime-dse 8910@opindex fno-lifetime-dse 8911@opindex flifetime-dse 8912In C++ the value of an object is only affected by changes within its 8913lifetime: when the constructor begins, the object has an indeterminate 8914value, and any changes during the lifetime of the object are dead when 8915the object is destroyed. Normally dead store elimination will take 8916advantage of this; if your code relies on the value of the object 8917storage persisting beyond the lifetime of the object, you can use this 8918flag to disable this optimization. To preserve stores before the 8919constructor starts (e.g.@: because your operator new clears the object 8920storage) but still treat the object as dead after the destructor you, 8921can use @option{-flifetime-dse=1}. The default behavior can be 8922explicitly selected with @option{-flifetime-dse=2}. 8923@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}. 8924 8925@item -flive-range-shrinkage 8926@opindex flive-range-shrinkage 8927Attempt to decrease register pressure through register live range 8928shrinkage. This is helpful for fast processors with small or moderate 8929size register sets. 8930 8931@item -fira-algorithm=@var{algorithm} 8932@opindex fira-algorithm 8933Use the specified coloring algorithm for the integrated register 8934allocator. The @var{algorithm} argument can be @samp{priority}, which 8935specifies Chow's priority coloring, or @samp{CB}, which specifies 8936Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 8937for all architectures, but for those targets that do support it, it is 8938the default because it generates better code. 8939 8940@item -fira-region=@var{region} 8941@opindex fira-region 8942Use specified regions for the integrated register allocator. The 8943@var{region} argument should be one of the following: 8944 8945@table @samp 8946 8947@item all 8948Use all loops as register allocation regions. 8949This can give the best results for machines with a small and/or 8950irregular register set. 8951 8952@item mixed 8953Use all loops except for loops with small register pressure 8954as the regions. This value usually gives 8955the best results in most cases and for most architectures, 8956and is enabled by default when compiling with optimization for speed 8957(@option{-O}, @option{-O2}, @dots{}). 8958 8959@item one 8960Use all functions as a single region. 8961This typically results in the smallest code size, and is enabled by default for 8962@option{-Os} or @option{-O0}. 8963 8964@end table 8965 8966@item -fira-hoist-pressure 8967@opindex fira-hoist-pressure 8968Use IRA to evaluate register pressure in the code hoisting pass for 8969decisions to hoist expressions. This option usually results in smaller 8970code, but it can slow the compiler down. 8971 8972This option is enabled at level @option{-Os} for all targets. 8973 8974@item -fira-loop-pressure 8975@opindex fira-loop-pressure 8976Use IRA to evaluate register pressure in loops for decisions to move 8977loop invariants. This option usually results in generation 8978of faster and smaller code on machines with large register files (>= 32 8979registers), but it can slow the compiler down. 8980 8981This option is enabled at level @option{-O3} for some targets. 8982 8983@item -fno-ira-share-save-slots 8984@opindex fno-ira-share-save-slots 8985@opindex fira-share-save-slots 8986Disable sharing of stack slots used for saving call-used hard 8987registers living through a call. Each hard register gets a 8988separate stack slot, and as a result function stack frames are 8989larger. 8990 8991@item -fno-ira-share-spill-slots 8992@opindex fno-ira-share-spill-slots 8993@opindex fira-share-spill-slots 8994Disable sharing of stack slots allocated for pseudo-registers. Each 8995pseudo-register that does not get a hard register gets a separate 8996stack slot, and as a result function stack frames are larger. 8997 8998@item -flra-remat 8999@opindex flra-remat 9000Enable CFG-sensitive rematerialization in LRA. Instead of loading 9001values of spilled pseudos, LRA tries to rematerialize (recalculate) 9002values if it is profitable. 9003 9004Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9005 9006@item -fdelayed-branch 9007@opindex fdelayed-branch 9008If supported for the target machine, attempt to reorder instructions 9009to exploit instruction slots available after delayed branch 9010instructions. 9011 9012Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, 9013but not at @option{-Og}. 9014 9015@item -fschedule-insns 9016@opindex fschedule-insns 9017If supported for the target machine, attempt to reorder instructions to 9018eliminate execution stalls due to required data being unavailable. This 9019helps machines that have slow floating point or memory load instructions 9020by allowing other instructions to be issued until the result of the load 9021or floating-point instruction is required. 9022 9023Enabled at levels @option{-O2}, @option{-O3}. 9024 9025@item -fschedule-insns2 9026@opindex fschedule-insns2 9027Similar to @option{-fschedule-insns}, but requests an additional pass of 9028instruction scheduling after register allocation has been done. This is 9029especially useful on machines with a relatively small number of 9030registers and where memory load instructions take more than one cycle. 9031 9032Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9033 9034@item -fno-sched-interblock 9035@opindex fno-sched-interblock 9036@opindex fsched-interblock 9037Disable instruction scheduling across basic blocks, which 9038is normally enabled when scheduling before register allocation, i.e.@: 9039with @option{-fschedule-insns} or at @option{-O2} or higher. 9040 9041@item -fno-sched-spec 9042@opindex fno-sched-spec 9043@opindex fsched-spec 9044Disable speculative motion of non-load instructions, which 9045is normally enabled when scheduling before register allocation, i.e.@: 9046with @option{-fschedule-insns} or at @option{-O2} or higher. 9047 9048@item -fsched-pressure 9049@opindex fsched-pressure 9050Enable register pressure sensitive insn scheduling before register 9051allocation. This only makes sense when scheduling before register 9052allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 9053@option{-O2} or higher. Usage of this option can improve the 9054generated code and decrease its size by preventing register pressure 9055increase above the number of available hard registers and subsequent 9056spills in register allocation. 9057 9058@item -fsched-spec-load 9059@opindex fsched-spec-load 9060Allow speculative motion of some load instructions. This only makes 9061sense when scheduling before register allocation, i.e.@: with 9062@option{-fschedule-insns} or at @option{-O2} or higher. 9063 9064@item -fsched-spec-load-dangerous 9065@opindex fsched-spec-load-dangerous 9066Allow speculative motion of more load instructions. This only makes 9067sense when scheduling before register allocation, i.e.@: with 9068@option{-fschedule-insns} or at @option{-O2} or higher. 9069 9070@item -fsched-stalled-insns 9071@itemx -fsched-stalled-insns=@var{n} 9072@opindex fsched-stalled-insns 9073Define how many insns (if any) can be moved prematurely from the queue 9074of stalled insns into the ready list during the second scheduling pass. 9075@option{-fno-sched-stalled-insns} means that no insns are moved 9076prematurely, @option{-fsched-stalled-insns=0} means there is no limit 9077on how many queued insns can be moved prematurely. 9078@option{-fsched-stalled-insns} without a value is equivalent to 9079@option{-fsched-stalled-insns=1}. 9080 9081@item -fsched-stalled-insns-dep 9082@itemx -fsched-stalled-insns-dep=@var{n} 9083@opindex fsched-stalled-insns-dep 9084Define how many insn groups (cycles) are examined for a dependency 9085on a stalled insn that is a candidate for premature removal from the queue 9086of stalled insns. This has an effect only during the second scheduling pass, 9087and only if @option{-fsched-stalled-insns} is used. 9088@option{-fno-sched-stalled-insns-dep} is equivalent to 9089@option{-fsched-stalled-insns-dep=0}. 9090@option{-fsched-stalled-insns-dep} without a value is equivalent to 9091@option{-fsched-stalled-insns-dep=1}. 9092 9093@item -fsched2-use-superblocks 9094@opindex fsched2-use-superblocks 9095When scheduling after register allocation, use superblock scheduling. 9096This allows motion across basic block boundaries, 9097resulting in faster schedules. This option is experimental, as not all machine 9098descriptions used by GCC model the CPU closely enough to avoid unreliable 9099results from the algorithm. 9100 9101This only makes sense when scheduling after register allocation, i.e.@: with 9102@option{-fschedule-insns2} or at @option{-O2} or higher. 9103 9104@item -fsched-group-heuristic 9105@opindex fsched-group-heuristic 9106Enable the group heuristic in the scheduler. This heuristic favors 9107the instruction that belongs to a schedule group. This is enabled 9108by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 9109or @option{-fschedule-insns2} or at @option{-O2} or higher. 9110 9111@item -fsched-critical-path-heuristic 9112@opindex fsched-critical-path-heuristic 9113Enable the critical-path heuristic in the scheduler. This heuristic favors 9114instructions on the critical path. This is enabled by default when 9115scheduling is enabled, i.e.@: with @option{-fschedule-insns} 9116or @option{-fschedule-insns2} or at @option{-O2} or higher. 9117 9118@item -fsched-spec-insn-heuristic 9119@opindex fsched-spec-insn-heuristic 9120Enable the speculative instruction heuristic in the scheduler. This 9121heuristic favors speculative instructions with greater dependency weakness. 9122This is enabled by default when scheduling is enabled, i.e.@: 9123with @option{-fschedule-insns} or @option{-fschedule-insns2} 9124or at @option{-O2} or higher. 9125 9126@item -fsched-rank-heuristic 9127@opindex fsched-rank-heuristic 9128Enable the rank heuristic in the scheduler. This heuristic favors 9129the instruction belonging to a basic block with greater size or frequency. 9130This is enabled by default when scheduling is enabled, i.e.@: 9131with @option{-fschedule-insns} or @option{-fschedule-insns2} or 9132at @option{-O2} or higher. 9133 9134@item -fsched-last-insn-heuristic 9135@opindex fsched-last-insn-heuristic 9136Enable the last-instruction heuristic in the scheduler. This heuristic 9137favors the instruction that is less dependent on the last instruction 9138scheduled. This is enabled by default when scheduling is enabled, 9139i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 9140at @option{-O2} or higher. 9141 9142@item -fsched-dep-count-heuristic 9143@opindex fsched-dep-count-heuristic 9144Enable the dependent-count heuristic in the scheduler. This heuristic 9145favors the instruction that has more instructions depending on it. 9146This is enabled by default when scheduling is enabled, i.e.@: 9147with @option{-fschedule-insns} or @option{-fschedule-insns2} or 9148at @option{-O2} or higher. 9149 9150@item -freschedule-modulo-scheduled-loops 9151@opindex freschedule-modulo-scheduled-loops 9152Modulo scheduling is performed before traditional scheduling. If a loop 9153is modulo scheduled, later scheduling passes may change its schedule. 9154Use this option to control that behavior. 9155 9156@item -fselective-scheduling 9157@opindex fselective-scheduling 9158Schedule instructions using selective scheduling algorithm. Selective 9159scheduling runs instead of the first scheduler pass. 9160 9161@item -fselective-scheduling2 9162@opindex fselective-scheduling2 9163Schedule instructions using selective scheduling algorithm. Selective 9164scheduling runs instead of the second scheduler pass. 9165 9166@item -fsel-sched-pipelining 9167@opindex fsel-sched-pipelining 9168Enable software pipelining of innermost loops during selective scheduling. 9169This option has no effect unless one of @option{-fselective-scheduling} or 9170@option{-fselective-scheduling2} is turned on. 9171 9172@item -fsel-sched-pipelining-outer-loops 9173@opindex fsel-sched-pipelining-outer-loops 9174When pipelining loops during selective scheduling, also pipeline outer loops. 9175This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 9176 9177@item -fsemantic-interposition 9178@opindex fsemantic-interposition 9179Some object formats, like ELF, allow interposing of symbols by the 9180dynamic linker. 9181This means that for symbols exported from the DSO, the compiler cannot perform 9182interprocedural propagation, inlining and other optimizations in anticipation 9183that the function or variable in question may change. While this feature is 9184useful, for example, to rewrite memory allocation functions by a debugging 9185implementation, it is expensive in the terms of code quality. 9186With @option{-fno-semantic-interposition} the compiler assumes that 9187if interposition happens for functions the overwriting function will have 9188precisely the same semantics (and side effects). 9189Similarly if interposition happens 9190for variables, the constructor of the variable will be the same. The flag 9191has no effect for functions explicitly declared inline 9192(where it is never allowed for interposition to change semantics) 9193and for symbols explicitly declared weak. 9194 9195@item -fshrink-wrap 9196@opindex fshrink-wrap 9197Emit function prologues only before parts of the function that need it, 9198rather than at the top of the function. This flag is enabled by default at 9199@option{-O} and higher. 9200 9201@item -fshrink-wrap-separate 9202@opindex fshrink-wrap-separate 9203Shrink-wrap separate parts of the prologue and epilogue separately, so that 9204those parts are only executed when needed. 9205This option is on by default, but has no effect unless @option{-fshrink-wrap} 9206is also turned on and the target supports this. 9207 9208@item -fcaller-saves 9209@opindex fcaller-saves 9210Enable allocation of values to registers that are clobbered by 9211function calls, by emitting extra instructions to save and restore the 9212registers around such calls. Such allocation is done only when it 9213seems to result in better code. 9214 9215This option is always enabled by default on certain machines, usually 9216those which have no call-preserved registers to use instead. 9217 9218Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9219 9220@item -fcombine-stack-adjustments 9221@opindex fcombine-stack-adjustments 9222Tracks stack adjustments (pushes and pops) and stack memory references 9223and then tries to find ways to combine them. 9224 9225Enabled by default at @option{-O1} and higher. 9226 9227@item -fipa-ra 9228@opindex fipa-ra 9229Use caller save registers for allocation if those registers are not used by 9230any called function. In that case it is not necessary to save and restore 9231them around calls. This is only possible if called functions are part of 9232same compilation unit as current function and they are compiled before it. 9233 9234Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option 9235is disabled if generated code will be instrumented for profiling 9236(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known 9237exactly (this happens on targets that do not expose prologues 9238and epilogues in RTL). 9239 9240@item -fconserve-stack 9241@opindex fconserve-stack 9242Attempt to minimize stack usage. The compiler attempts to use less 9243stack space, even if that makes the program slower. This option 9244implies setting the @option{large-stack-frame} parameter to 100 9245and the @option{large-stack-frame-growth} parameter to 400. 9246 9247@item -ftree-reassoc 9248@opindex ftree-reassoc 9249Perform reassociation on trees. This flag is enabled by default 9250at @option{-O} and higher. 9251 9252@item -fcode-hoisting 9253@opindex fcode-hoisting 9254Perform code hoisting. Code hoisting tries to move the 9255evaluation of expressions executed on all paths to the function exit 9256as early as possible. This is especially useful as a code size 9257optimization, but it often helps for code speed as well. 9258This flag is enabled by default at @option{-O2} and higher. 9259 9260@item -ftree-pre 9261@opindex ftree-pre 9262Perform partial redundancy elimination (PRE) on trees. This flag is 9263enabled by default at @option{-O2} and @option{-O3}. 9264 9265@item -ftree-partial-pre 9266@opindex ftree-partial-pre 9267Make partial redundancy elimination (PRE) more aggressive. This flag is 9268enabled by default at @option{-O3}. 9269 9270@item -ftree-forwprop 9271@opindex ftree-forwprop 9272Perform forward propagation on trees. This flag is enabled by default 9273at @option{-O} and higher. 9274 9275@item -ftree-fre 9276@opindex ftree-fre 9277Perform full redundancy elimination (FRE) on trees. The difference 9278between FRE and PRE is that FRE only considers expressions 9279that are computed on all paths leading to the redundant computation. 9280This analysis is faster than PRE, though it exposes fewer redundancies. 9281This flag is enabled by default at @option{-O} and higher. 9282 9283@item -ftree-phiprop 9284@opindex ftree-phiprop 9285Perform hoisting of loads from conditional pointers on trees. This 9286pass is enabled by default at @option{-O} and higher. 9287 9288@item -fhoist-adjacent-loads 9289@opindex fhoist-adjacent-loads 9290Speculatively hoist loads from both branches of an if-then-else if the 9291loads are from adjacent locations in the same structure and the target 9292architecture has a conditional move instruction. This flag is enabled 9293by default at @option{-O2} and higher. 9294 9295@item -ftree-copy-prop 9296@opindex ftree-copy-prop 9297Perform copy propagation on trees. This pass eliminates unnecessary 9298copy operations. This flag is enabled by default at @option{-O} and 9299higher. 9300 9301@item -fipa-pure-const 9302@opindex fipa-pure-const 9303Discover which functions are pure or constant. 9304Enabled by default at @option{-O} and higher. 9305 9306@item -fipa-reference 9307@opindex fipa-reference 9308Discover which static variables do not escape the 9309compilation unit. 9310Enabled by default at @option{-O} and higher. 9311 9312@item -fipa-reference-addressable 9313@opindex fipa-reference-addressable 9314Discover read-only, write-only and non-addressable static variables. 9315Enabled by default at @option{-O} and higher. 9316 9317@item -fipa-stack-alignment 9318@opindex fipa-stack-alignment 9319Reduce stack alignment on call sites if possible. 9320Enabled by default. 9321 9322@item -fipa-pta 9323@opindex fipa-pta 9324Perform interprocedural pointer analysis and interprocedural modification 9325and reference analysis. This option can cause excessive memory and 9326compile-time usage on large compilation units. It is not enabled by 9327default at any optimization level. 9328 9329@item -fipa-profile 9330@opindex fipa-profile 9331Perform interprocedural profile propagation. The functions called only from 9332cold functions are marked as cold. Also functions executed once (such as 9333@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold 9334functions and loop less parts of functions executed once are then optimized for 9335size. 9336Enabled by default at @option{-O} and higher. 9337 9338@item -fipa-cp 9339@opindex fipa-cp 9340Perform interprocedural constant propagation. 9341This optimization analyzes the program to determine when values passed 9342to functions are constants and then optimizes accordingly. 9343This optimization can substantially increase performance 9344if the application has constants passed to functions. 9345This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 9346It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9347 9348@item -fipa-cp-clone 9349@opindex fipa-cp-clone 9350Perform function cloning to make interprocedural constant propagation stronger. 9351When enabled, interprocedural constant propagation performs function cloning 9352when externally visible function can be called with constant arguments. 9353Because this optimization can create multiple copies of functions, 9354it may significantly increase code size 9355(see @option{--param ipcp-unit-growth=@var{value}}). 9356This flag is enabled by default at @option{-O3}. 9357It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9358 9359@item -fipa-bit-cp 9360@opindex fipa-bit-cp 9361When enabled, perform interprocedural bitwise constant 9362propagation. This flag is enabled by default at @option{-O2} and 9363by @option{-fprofile-use} and @option{-fauto-profile}. 9364It requires that @option{-fipa-cp} is enabled. 9365 9366@item -fipa-vrp 9367@opindex fipa-vrp 9368When enabled, perform interprocedural propagation of value 9369ranges. This flag is enabled by default at @option{-O2}. It requires 9370that @option{-fipa-cp} is enabled. 9371 9372@item -fipa-icf 9373@opindex fipa-icf 9374Perform Identical Code Folding for functions and read-only variables. 9375The optimization reduces code size and may disturb unwind stacks by replacing 9376a function by equivalent one with a different name. The optimization works 9377more effectively with link-time optimization enabled. 9378 9379Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF 9380works on different levels and thus the optimizations are not same - there are 9381equivalences that are found only by GCC and equivalences found only by Gold. 9382 9383This flag is enabled by default at @option{-O2} and @option{-Os}. 9384 9385@item -flive-patching=@var{level} 9386@opindex flive-patching 9387Control GCC's optimizations to produce output suitable for live-patching. 9388 9389If the compiler's optimization uses a function's body or information extracted 9390from its body to optimize/change another function, the latter is called an 9391impacted function of the former. If a function is patched, its impacted 9392functions should be patched too. 9393 9394The impacted functions are determined by the compiler's interprocedural 9395optimizations. For example, a caller is impacted when inlining a function 9396into its caller, 9397cloning a function and changing its caller to call this new clone, 9398or extracting a function's pureness/constness information to optimize 9399its direct or indirect callers, etc. 9400 9401Usually, the more IPA optimizations enabled, the larger the number of 9402impacted functions for each function. In order to control the number of 9403impacted functions and more easily compute the list of impacted function, 9404IPA optimizations can be partially enabled at two different levels. 9405 9406The @var{level} argument should be one of the following: 9407 9408@table @samp 9409 9410@item inline-clone 9411 9412Only enable inlining and cloning optimizations, which includes inlining, 9413cloning, interprocedural scalar replacement of aggregates and partial inlining. 9414As a result, when patching a function, all its callers and its clones' 9415callers are impacted, therefore need to be patched as well. 9416 9417@option{-flive-patching=inline-clone} disables the following optimization flags: 9418@gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol 9419-fipa-icf -fipa-icf-functions -fipa-icf-variables @gol 9420-fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol 9421-fipa-stack-alignment} 9422 9423@item inline-only-static 9424 9425Only enable inlining of static functions. 9426As a result, when patching a static function, all its callers are impacted 9427and so need to be patched as well. 9428 9429In addition to all the flags that @option{-flive-patching=inline-clone} 9430disables, 9431@option{-flive-patching=inline-only-static} disables the following additional 9432optimization flags: 9433@gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp} 9434 9435@end table 9436 9437When @option{-flive-patching} is specified without any value, the default value 9438is @var{inline-clone}. 9439 9440This flag is disabled by default. 9441 9442Note that @option{-flive-patching} is not supported with link-time optimization 9443(@option{-flto}). 9444 9445@item -fisolate-erroneous-paths-dereference 9446@opindex fisolate-erroneous-paths-dereference 9447Detect paths that trigger erroneous or undefined behavior due to 9448dereferencing a null pointer. Isolate those paths from the main control 9449flow and turn the statement with erroneous or undefined behavior into a trap. 9450This flag is enabled by default at @option{-O2} and higher and depends on 9451@option{-fdelete-null-pointer-checks} also being enabled. 9452 9453@item -fisolate-erroneous-paths-attribute 9454@opindex fisolate-erroneous-paths-attribute 9455Detect paths that trigger erroneous or undefined behavior due to a null value 9456being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 9457attribute. Isolate those paths from the main control flow and turn the 9458statement with erroneous or undefined behavior into a trap. This is not 9459currently enabled, but may be enabled by @option{-O2} in the future. 9460 9461@item -ftree-sink 9462@opindex ftree-sink 9463Perform forward store motion on trees. This flag is 9464enabled by default at @option{-O} and higher. 9465 9466@item -ftree-bit-ccp 9467@opindex ftree-bit-ccp 9468Perform sparse conditional bit constant propagation on trees and propagate 9469pointer alignment information. 9470This pass only operates on local scalar variables and is enabled by default 9471at @option{-O1} and higher, except for @option{-Og}. 9472It requires that @option{-ftree-ccp} is enabled. 9473 9474@item -ftree-ccp 9475@opindex ftree-ccp 9476Perform sparse conditional constant propagation (CCP) on trees. This 9477pass only operates on local scalar variables and is enabled by default 9478at @option{-O} and higher. 9479 9480@item -fssa-backprop 9481@opindex fssa-backprop 9482Propagate information about uses of a value up the definition chain 9483in order to simplify the definitions. For example, this pass strips 9484sign operations if the sign of a value never matters. The flag is 9485enabled by default at @option{-O} and higher. 9486 9487@item -fssa-phiopt 9488@opindex fssa-phiopt 9489Perform pattern matching on SSA PHI nodes to optimize conditional 9490code. This pass is enabled by default at @option{-O1} and higher, 9491except for @option{-Og}. 9492 9493@item -ftree-switch-conversion 9494@opindex ftree-switch-conversion 9495Perform conversion of simple initializations in a switch to 9496initializations from a scalar array. This flag is enabled by default 9497at @option{-O2} and higher. 9498 9499@item -ftree-tail-merge 9500@opindex ftree-tail-merge 9501Look for identical code sequences. When found, replace one with a jump to the 9502other. This optimization is known as tail merging or cross jumping. This flag 9503is enabled by default at @option{-O2} and higher. The compilation time 9504in this pass can 9505be limited using @option{max-tail-merge-comparisons} parameter and 9506@option{max-tail-merge-iterations} parameter. 9507 9508@item -ftree-dce 9509@opindex ftree-dce 9510Perform dead code elimination (DCE) on trees. This flag is enabled by 9511default at @option{-O} and higher. 9512 9513@item -ftree-builtin-call-dce 9514@opindex ftree-builtin-call-dce 9515Perform conditional dead code elimination (DCE) for calls to built-in functions 9516that may set @code{errno} but are otherwise free of side effects. This flag is 9517enabled by default at @option{-O2} and higher if @option{-Os} is not also 9518specified. 9519 9520@item -ftree-dominator-opts 9521@opindex ftree-dominator-opts 9522Perform a variety of simple scalar cleanups (constant/copy 9523propagation, redundancy elimination, range propagation and expression 9524simplification) based on a dominator tree traversal. This also 9525performs jump threading (to reduce jumps to jumps). This flag is 9526enabled by default at @option{-O} and higher. 9527 9528@item -ftree-dse 9529@opindex ftree-dse 9530Perform dead store elimination (DSE) on trees. A dead store is a store into 9531a memory location that is later overwritten by another store without 9532any intervening loads. In this case the earlier store can be deleted. This 9533flag is enabled by default at @option{-O} and higher. 9534 9535@item -ftree-ch 9536@opindex ftree-ch 9537Perform loop header copying on trees. This is beneficial since it increases 9538effectiveness of code motion optimizations. It also saves one jump. This flag 9539is enabled by default at @option{-O} and higher. It is not enabled 9540for @option{-Os}, since it usually increases code size. 9541 9542@item -ftree-loop-optimize 9543@opindex ftree-loop-optimize 9544Perform loop optimizations on trees. This flag is enabled by default 9545at @option{-O} and higher. 9546 9547@item -ftree-loop-linear 9548@itemx -floop-strip-mine 9549@itemx -floop-block 9550@opindex ftree-loop-linear 9551@opindex floop-strip-mine 9552@opindex floop-block 9553Perform loop nest optimizations. Same as 9554@option{-floop-nest-optimize}. To use this code transformation, GCC has 9555to be configured with @option{--with-isl} to enable the Graphite loop 9556transformation infrastructure. 9557 9558@item -fgraphite-identity 9559@opindex fgraphite-identity 9560Enable the identity transformation for graphite. For every SCoP we generate 9561the polyhedral representation and transform it back to gimple. Using 9562@option{-fgraphite-identity} we can check the costs or benefits of the 9563GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 9564are also performed by the code generator isl, like index splitting and 9565dead code elimination in loops. 9566 9567@item -floop-nest-optimize 9568@opindex floop-nest-optimize 9569Enable the isl based loop nest optimizer. This is a generic loop nest 9570optimizer based on the Pluto optimization algorithms. It calculates a loop 9571structure optimized for data-locality and parallelism. This option 9572is experimental. 9573 9574@item -floop-parallelize-all 9575@opindex floop-parallelize-all 9576Use the Graphite data dependence analysis to identify loops that can 9577be parallelized. Parallelize all the loops that can be analyzed to 9578not contain loop carried dependences without checking that it is 9579profitable to parallelize the loops. 9580 9581@item -ftree-coalesce-vars 9582@opindex ftree-coalesce-vars 9583While transforming the program out of the SSA representation, attempt to 9584reduce copying by coalescing versions of different user-defined 9585variables, instead of just compiler temporaries. This may severely 9586limit the ability to debug an optimized program compiled with 9587@option{-fno-var-tracking-assignments}. In the negated form, this flag 9588prevents SSA coalescing of user variables. This option is enabled by 9589default if optimization is enabled, and it does very little otherwise. 9590 9591@item -ftree-loop-if-convert 9592@opindex ftree-loop-if-convert 9593Attempt to transform conditional jumps in the innermost loops to 9594branch-less equivalents. The intent is to remove control-flow from 9595the innermost loops in order to improve the ability of the 9596vectorization pass to handle these loops. This is enabled by default 9597if vectorization is enabled. 9598 9599@item -ftree-loop-distribution 9600@opindex ftree-loop-distribution 9601Perform loop distribution. This flag can improve cache performance on 9602big loop bodies and allow further loop optimizations, like 9603parallelization or vectorization, to take place. For example, the loop 9604@smallexample 9605DO I = 1, N 9606 A(I) = B(I) + C 9607 D(I) = E(I) * F 9608ENDDO 9609@end smallexample 9610is transformed to 9611@smallexample 9612DO I = 1, N 9613 A(I) = B(I) + C 9614ENDDO 9615DO I = 1, N 9616 D(I) = E(I) * F 9617ENDDO 9618@end smallexample 9619This flag is enabled by default at @option{-O3}. 9620It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9621 9622@item -ftree-loop-distribute-patterns 9623@opindex ftree-loop-distribute-patterns 9624Perform loop distribution of patterns that can be code generated with 9625calls to a library. This flag is enabled by default at @option{-O3}, and 9626by @option{-fprofile-use} and @option{-fauto-profile}. 9627 9628This pass distributes the initialization loops and generates a call to 9629memset zero. For example, the loop 9630@smallexample 9631DO I = 1, N 9632 A(I) = 0 9633 B(I) = A(I) + I 9634ENDDO 9635@end smallexample 9636is transformed to 9637@smallexample 9638DO I = 1, N 9639 A(I) = 0 9640ENDDO 9641DO I = 1, N 9642 B(I) = A(I) + I 9643ENDDO 9644@end smallexample 9645and the initialization loop is transformed into a call to memset zero. 9646This flag is enabled by default at @option{-O3}. 9647It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9648 9649@item -floop-interchange 9650@opindex floop-interchange 9651Perform loop interchange outside of graphite. This flag can improve cache 9652performance on loop nest and allow further loop optimizations, like 9653vectorization, to take place. For example, the loop 9654@smallexample 9655for (int i = 0; i < N; i++) 9656 for (int j = 0; j < N; j++) 9657 for (int k = 0; k < N; k++) 9658 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 9659@end smallexample 9660is transformed to 9661@smallexample 9662for (int i = 0; i < N; i++) 9663 for (int k = 0; k < N; k++) 9664 for (int j = 0; j < N; j++) 9665 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 9666@end smallexample 9667This flag is enabled by default at @option{-O3}. 9668It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9669 9670@item -floop-unroll-and-jam 9671@opindex floop-unroll-and-jam 9672Apply unroll and jam transformations on feasible loops. In a loop 9673nest this unrolls the outer loop by some factor and fuses the resulting 9674multiple inner loops. This flag is enabled by default at @option{-O3}. 9675It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9676 9677@item -ftree-loop-im 9678@opindex ftree-loop-im 9679Perform loop invariant motion on trees. This pass moves only invariants that 9680are hard to handle at RTL level (function calls, operations that expand to 9681nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 9682operands of conditions that are invariant out of the loop, so that we can use 9683just trivial invariantness analysis in loop unswitching. The pass also includes 9684store motion. 9685 9686@item -ftree-loop-ivcanon 9687@opindex ftree-loop-ivcanon 9688Create a canonical counter for number of iterations in loops for which 9689determining number of iterations requires complicated analysis. Later 9690optimizations then may determine the number easily. Useful especially 9691in connection with unrolling. 9692 9693@item -ftree-scev-cprop 9694@opindex ftree-scev-cprop 9695Perform final value replacement. If a variable is modified in a loop 9696in such a way that its value when exiting the loop can be determined using 9697only its initial value and the number of loop iterations, replace uses of 9698the final value by such a computation, provided it is sufficiently cheap. 9699This reduces data dependencies and may allow further simplifications. 9700Enabled by default at @option{-O} and higher. 9701 9702@item -fivopts 9703@opindex fivopts 9704Perform induction variable optimizations (strength reduction, induction 9705variable merging and induction variable elimination) on trees. 9706 9707@item -ftree-parallelize-loops=n 9708@opindex ftree-parallelize-loops 9709Parallelize loops, i.e., split their iteration space to run in n threads. 9710This is only possible for loops whose iterations are independent 9711and can be arbitrarily reordered. The optimization is only 9712profitable on multiprocessor machines, for loops that are CPU-intensive, 9713rather than constrained e.g.@: by memory bandwidth. This option 9714implies @option{-pthread}, and thus is only supported on targets 9715that have support for @option{-pthread}. 9716 9717@item -ftree-pta 9718@opindex ftree-pta 9719Perform function-local points-to analysis on trees. This flag is 9720enabled by default at @option{-O1} and higher, except for @option{-Og}. 9721 9722@item -ftree-sra 9723@opindex ftree-sra 9724Perform scalar replacement of aggregates. This pass replaces structure 9725references with scalars to prevent committing structures to memory too 9726early. This flag is enabled by default at @option{-O1} and higher, 9727except for @option{-Og}. 9728 9729@item -fstore-merging 9730@opindex fstore-merging 9731Perform merging of narrow stores to consecutive memory addresses. This pass 9732merges contiguous stores of immediate values narrower than a word into fewer 9733wider stores to reduce the number of instructions. This is enabled by default 9734at @option{-O2} and higher as well as @option{-Os}. 9735 9736@item -ftree-ter 9737@opindex ftree-ter 9738Perform temporary expression replacement during the SSA->normal phase. Single 9739use/single def temporaries are replaced at their use location with their 9740defining expression. This results in non-GIMPLE code, but gives the expanders 9741much more complex trees to work on resulting in better RTL generation. This is 9742enabled by default at @option{-O} and higher. 9743 9744@item -ftree-slsr 9745@opindex ftree-slsr 9746Perform straight-line strength reduction on trees. This recognizes related 9747expressions involving multiplications and replaces them by less expensive 9748calculations when possible. This is enabled by default at @option{-O} and 9749higher. 9750 9751@item -ftree-vectorize 9752@opindex ftree-vectorize 9753Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 9754and @option{-ftree-slp-vectorize} if not explicitly specified. 9755 9756@item -ftree-loop-vectorize 9757@opindex ftree-loop-vectorize 9758Perform loop vectorization on trees. This flag is enabled by default at 9759@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 9760and @option{-fauto-profile}. 9761 9762@item -ftree-slp-vectorize 9763@opindex ftree-slp-vectorize 9764Perform basic block vectorization on trees. This flag is enabled by default at 9765@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 9766and @option{-fauto-profile}. 9767 9768@item -fvect-cost-model=@var{model} 9769@opindex fvect-cost-model 9770Alter the cost model used for vectorization. The @var{model} argument 9771should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}. 9772With the @samp{unlimited} model the vectorized code-path is assumed 9773to be profitable while with the @samp{dynamic} model a runtime check 9774guards the vectorized code-path to enable it only for iteration 9775counts that will likely execute faster than when executing the original 9776scalar loop. The @samp{cheap} model disables vectorization of 9777loops where doing so would be cost prohibitive for example due to 9778required runtime checks for data dependence or alignment but otherwise 9779is equal to the @samp{dynamic} model. 9780The default cost model depends on other optimization flags and is 9781either @samp{dynamic} or @samp{cheap}. 9782 9783@item -fsimd-cost-model=@var{model} 9784@opindex fsimd-cost-model 9785Alter the cost model used for vectorization of loops marked with the OpenMP 9786simd directive. The @var{model} argument should be one of 9787@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 9788have the same meaning as described in @option{-fvect-cost-model} and by 9789default a cost model defined with @option{-fvect-cost-model} is used. 9790 9791@item -ftree-vrp 9792@opindex ftree-vrp 9793Perform Value Range Propagation on trees. This is similar to the 9794constant propagation pass, but instead of values, ranges of values are 9795propagated. This allows the optimizers to remove unnecessary range 9796checks like array bound checks and null pointer checks. This is 9797enabled by default at @option{-O2} and higher. Null pointer check 9798elimination is only done if @option{-fdelete-null-pointer-checks} is 9799enabled. 9800 9801@item -fsplit-paths 9802@opindex fsplit-paths 9803Split paths leading to loop backedges. This can improve dead code 9804elimination and common subexpression elimination. This is enabled by 9805default at @option{-O3} and above. 9806 9807@item -fsplit-ivs-in-unroller 9808@opindex fsplit-ivs-in-unroller 9809Enables expression of values of induction variables in later iterations 9810of the unrolled loop using the value in the first iteration. This breaks 9811long dependency chains, thus improving efficiency of the scheduling passes. 9812 9813A combination of @option{-fweb} and CSE is often sufficient to obtain the 9814same effect. However, that is not reliable in cases where the loop body 9815is more complicated than a single basic block. It also does not work at all 9816on some architectures due to restrictions in the CSE pass. 9817 9818This optimization is enabled by default. 9819 9820@item -fvariable-expansion-in-unroller 9821@opindex fvariable-expansion-in-unroller 9822With this option, the compiler creates multiple copies of some 9823local variables when unrolling a loop, which can result in superior code. 9824 9825@item -fpartial-inlining 9826@opindex fpartial-inlining 9827Inline parts of functions. This option has any effect only 9828when inlining itself is turned on by the @option{-finline-functions} 9829or @option{-finline-small-functions} options. 9830 9831Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9832 9833@item -fpredictive-commoning 9834@opindex fpredictive-commoning 9835Perform predictive commoning optimization, i.e., reusing computations 9836(especially memory loads and stores) performed in previous 9837iterations of loops. 9838 9839This option is enabled at level @option{-O3}. 9840It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 9841 9842@item -fprefetch-loop-arrays 9843@opindex fprefetch-loop-arrays 9844If supported by the target machine, generate instructions to prefetch 9845memory to improve the performance of loops that access large arrays. 9846 9847This option may generate better or worse code; results are highly 9848dependent on the structure of loops within the source code. 9849 9850Disabled at level @option{-Os}. 9851 9852@item -fno-printf-return-value 9853@opindex fno-printf-return-value 9854@opindex fprintf-return-value 9855Do not substitute constants for known return value of formatted output 9856functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and 9857@code{vsnprintf} (but not @code{printf} of @code{fprintf}). This 9858transformation allows GCC to optimize or even eliminate branches based 9859on the known return value of these functions called with arguments that 9860are either constant, or whose values are known to be in a range that 9861makes determining the exact return value possible. For example, when 9862@option{-fprintf-return-value} is in effect, both the branch and the 9863body of the @code{if} statement (but not the call to @code{snprint}) 9864can be optimized away when @code{i} is a 32-bit or smaller integer 9865because the return value is guaranteed to be at most 8. 9866 9867@smallexample 9868char buf[9]; 9869if (snprintf (buf, "%08x", i) >= sizeof buf) 9870 @dots{} 9871@end smallexample 9872 9873The @option{-fprintf-return-value} option relies on other optimizations 9874and yields best results with @option{-O2} and above. It works in tandem 9875with the @option{-Wformat-overflow} and @option{-Wformat-truncation} 9876options. The @option{-fprintf-return-value} option is enabled by default. 9877 9878@item -fno-peephole 9879@itemx -fno-peephole2 9880@opindex fno-peephole 9881@opindex fpeephole 9882@opindex fno-peephole2 9883@opindex fpeephole2 9884Disable any machine-specific peephole optimizations. The difference 9885between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 9886are implemented in the compiler; some targets use one, some use the 9887other, a few use both. 9888 9889@option{-fpeephole} is enabled by default. 9890@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9891 9892@item -fno-guess-branch-probability 9893@opindex fno-guess-branch-probability 9894@opindex fguess-branch-probability 9895Do not guess branch probabilities using heuristics. 9896 9897GCC uses heuristics to guess branch probabilities if they are 9898not provided by profiling feedback (@option{-fprofile-arcs}). These 9899heuristics are based on the control flow graph. If some branch probabilities 9900are specified by @code{__builtin_expect}, then the heuristics are 9901used to guess branch probabilities for the rest of the control flow graph, 9902taking the @code{__builtin_expect} info into account. The interactions 9903between the heuristics and @code{__builtin_expect} can be complex, and in 9904some cases, it may be useful to disable the heuristics so that the effects 9905of @code{__builtin_expect} are easier to understand. 9906 9907It is also possible to specify expected probability of the expression 9908with @code{__builtin_expect_with_probability} built-in function. 9909 9910The default is @option{-fguess-branch-probability} at levels 9911@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9912 9913@item -freorder-blocks 9914@opindex freorder-blocks 9915Reorder basic blocks in the compiled function in order to reduce number of 9916taken branches and improve code locality. 9917 9918Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9919 9920@item -freorder-blocks-algorithm=@var{algorithm} 9921@opindex freorder-blocks-algorithm 9922Use the specified algorithm for basic block reordering. The 9923@var{algorithm} argument can be @samp{simple}, which does not increase 9924code size (except sometimes due to secondary effects like alignment), 9925or @samp{stc}, the ``software trace cache'' algorithm, which tries to 9926put all often executed code together, minimizing the number of branches 9927executed by making extra copies of code. 9928 9929The default is @samp{simple} at levels @option{-O}, @option{-Os}, and 9930@samp{stc} at levels @option{-O2}, @option{-O3}. 9931 9932@item -freorder-blocks-and-partition 9933@opindex freorder-blocks-and-partition 9934In addition to reordering basic blocks in the compiled function, in order 9935to reduce number of taken branches, partitions hot and cold basic blocks 9936into separate sections of the assembly and @file{.o} files, to improve 9937paging and cache locality performance. 9938 9939This optimization is automatically turned off in the presence of 9940exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined 9941section attribute and on any architecture that does not support named 9942sections. When @option{-fsplit-stack} is used this option is not 9943enabled by default (to avoid linker errors), but may be enabled 9944explicitly (if using a working linker). 9945 9946Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}. 9947 9948@item -freorder-functions 9949@opindex freorder-functions 9950Reorder functions in the object file in order to 9951improve code locality. This is implemented by using special 9952subsections @code{.text.hot} for most frequently executed functions and 9953@code{.text.unlikely} for unlikely executed functions. Reordering is done by 9954the linker so object file format must support named sections and linker must 9955place them in a reasonable way. 9956 9957This option isn't effective unless you either provide profile feedback 9958(see @option{-fprofile-arcs} for details) or manually annotate functions with 9959@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}). 9960 9961Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9962 9963@item -fstrict-aliasing 9964@opindex fstrict-aliasing 9965Allow the compiler to assume the strictest aliasing rules applicable to 9966the language being compiled. For C (and C++), this activates 9967optimizations based on the type of expressions. In particular, an 9968object of one type is assumed never to reside at the same address as an 9969object of a different type, unless the types are almost the same. For 9970example, an @code{unsigned int} can alias an @code{int}, but not a 9971@code{void*} or a @code{double}. A character type may alias any other 9972type. 9973 9974@anchor{Type-punning}Pay special attention to code like this: 9975@smallexample 9976union a_union @{ 9977 int i; 9978 double d; 9979@}; 9980 9981int f() @{ 9982 union a_union t; 9983 t.d = 3.0; 9984 return t.i; 9985@} 9986@end smallexample 9987The practice of reading from a different union member than the one most 9988recently written to (called ``type-punning'') is common. Even with 9989@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 9990is accessed through the union type. So, the code above works as 9991expected. @xref{Structures unions enumerations and bit-fields 9992implementation}. However, this code might not: 9993@smallexample 9994int f() @{ 9995 union a_union t; 9996 int* ip; 9997 t.d = 3.0; 9998 ip = &t.i; 9999 return *ip; 10000@} 10001@end smallexample 10002 10003Similarly, access by taking the address, casting the resulting pointer 10004and dereferencing the result has undefined behavior, even if the cast 10005uses a union type, e.g.: 10006@smallexample 10007int f() @{ 10008 double d = 3.0; 10009 return ((union a_union *) &d)->i; 10010@} 10011@end smallexample 10012 10013The @option{-fstrict-aliasing} option is enabled at levels 10014@option{-O2}, @option{-O3}, @option{-Os}. 10015 10016@item -falign-functions 10017@itemx -falign-functions=@var{n} 10018@itemx -falign-functions=@var{n}:@var{m} 10019@itemx -falign-functions=@var{n}:@var{m}:@var{n2} 10020@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2} 10021@opindex falign-functions 10022Align the start of functions to the next power-of-two greater than 10023@var{n}, skipping up to @var{m}-1 bytes. This ensures that at least 10024the first @var{m} bytes of the function can be fetched by the CPU 10025without crossing an @var{n}-byte alignment boundary. 10026 10027If @var{m} is not specified, it defaults to @var{n}. 10028 10029Examples: @option{-falign-functions=32} aligns functions to the next 1003032-byte boundary, @option{-falign-functions=24} aligns to the next 1003132-byte boundary only if this can be done by skipping 23 bytes or less, 10032@option{-falign-functions=32:7} aligns to the next 1003332-byte boundary only if this can be done by skipping 6 bytes or less. 10034 10035The second pair of @var{n2}:@var{m2} values allows you to specify 10036a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to 10037the next 64-byte boundary if this can be done by skipping 6 bytes or less, 10038otherwise aligns to the next 32-byte boundary if this can be done 10039by skipping 2 bytes or less. 10040If @var{m2} is not specified, it defaults to @var{n2}. 10041 10042Some assemblers only support this flag when @var{n} is a power of two; 10043in that case, it is rounded up. 10044 10045@option{-fno-align-functions} and @option{-falign-functions=1} are 10046equivalent and mean that functions are not aligned. 10047 10048If @var{n} is not specified or is zero, use a machine-dependent default. 10049The maximum allowed @var{n} option value is 65536. 10050 10051Enabled at levels @option{-O2}, @option{-O3}. 10052 10053@item -flimit-function-alignment 10054If this option is enabled, the compiler tries to avoid unnecessarily 10055overaligning functions. It attempts to instruct the assembler to align 10056by the amount specified by @option{-falign-functions}, but not to 10057skip more bytes than the size of the function. 10058 10059@item -falign-labels 10060@itemx -falign-labels=@var{n} 10061@itemx -falign-labels=@var{n}:@var{m} 10062@itemx -falign-labels=@var{n}:@var{m}:@var{n2} 10063@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2} 10064@opindex falign-labels 10065Align all branch targets to a power-of-two boundary. 10066 10067Parameters of this option are analogous to the @option{-falign-functions} option. 10068@option{-fno-align-labels} and @option{-falign-labels=1} are 10069equivalent and mean that labels are not aligned. 10070 10071If @option{-falign-loops} or @option{-falign-jumps} are applicable and 10072are greater than this value, then their values are used instead. 10073 10074If @var{n} is not specified or is zero, use a machine-dependent default 10075which is very likely to be @samp{1}, meaning no alignment. 10076The maximum allowed @var{n} option value is 65536. 10077 10078Enabled at levels @option{-O2}, @option{-O3}. 10079 10080@item -falign-loops 10081@itemx -falign-loops=@var{n} 10082@itemx -falign-loops=@var{n}:@var{m} 10083@itemx -falign-loops=@var{n}:@var{m}:@var{n2} 10084@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2} 10085@opindex falign-loops 10086Align loops to a power-of-two boundary. If the loops are executed 10087many times, this makes up for any execution of the dummy padding 10088instructions. 10089 10090Parameters of this option are analogous to the @option{-falign-functions} option. 10091@option{-fno-align-loops} and @option{-falign-loops=1} are 10092equivalent and mean that loops are not aligned. 10093The maximum allowed @var{n} option value is 65536. 10094 10095If @var{n} is not specified or is zero, use a machine-dependent default. 10096 10097Enabled at levels @option{-O2}, @option{-O3}. 10098 10099@item -falign-jumps 10100@itemx -falign-jumps=@var{n} 10101@itemx -falign-jumps=@var{n}:@var{m} 10102@itemx -falign-jumps=@var{n}:@var{m}:@var{n2} 10103@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2} 10104@opindex falign-jumps 10105Align branch targets to a power-of-two boundary, for branch targets 10106where the targets can only be reached by jumping. In this case, 10107no dummy operations need be executed. 10108 10109Parameters of this option are analogous to the @option{-falign-functions} option. 10110@option{-fno-align-jumps} and @option{-falign-jumps=1} are 10111equivalent and mean that loops are not aligned. 10112 10113If @var{n} is not specified or is zero, use a machine-dependent default. 10114The maximum allowed @var{n} option value is 65536. 10115 10116Enabled at levels @option{-O2}, @option{-O3}. 10117 10118@item -funit-at-a-time 10119@opindex funit-at-a-time 10120This option is left for compatibility reasons. @option{-funit-at-a-time} 10121has no effect, while @option{-fno-unit-at-a-time} implies 10122@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 10123 10124Enabled by default. 10125 10126@item -fno-toplevel-reorder 10127@opindex fno-toplevel-reorder 10128@opindex ftoplevel-reorder 10129Do not reorder top-level functions, variables, and @code{asm} 10130statements. Output them in the same order that they appear in the 10131input file. When this option is used, unreferenced static variables 10132are not removed. This option is intended to support existing code 10133that relies on a particular ordering. For new code, it is better to 10134use attributes when possible. 10135 10136@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and 10137also at @option{-O0} if @option{-fsection-anchors} is explicitly requested. 10138Additionally @option{-fno-toplevel-reorder} implies 10139@option{-fno-section-anchors}. 10140 10141@item -fweb 10142@opindex fweb 10143Constructs webs as commonly used for register allocation purposes and assign 10144each web individual pseudo register. This allows the register allocation pass 10145to operate on pseudos directly, but also strengthens several other optimization 10146passes, such as CSE, loop optimizer and trivial dead code remover. It can, 10147however, make debugging impossible, since variables no longer stay in a 10148``home register''. 10149 10150Enabled by default with @option{-funroll-loops}. 10151 10152@item -fwhole-program 10153@opindex fwhole-program 10154Assume that the current compilation unit represents the whole program being 10155compiled. All public functions and variables with the exception of @code{main} 10156and those merged by attribute @code{externally_visible} become static functions 10157and in effect are optimized more aggressively by interprocedural optimizers. 10158 10159This option should not be used in combination with @option{-flto}. 10160Instead relying on a linker plugin should provide safer and more precise 10161information. 10162 10163@item -flto[=@var{n}] 10164@opindex flto 10165This option runs the standard link-time optimizer. When invoked 10166with source code, it generates GIMPLE (one of GCC's internal 10167representations) and writes it to special ELF sections in the object 10168file. When the object files are linked together, all the function 10169bodies are read from these ELF sections and instantiated as if they 10170had been part of the same translation unit. 10171 10172To use the link-time optimizer, @option{-flto} and optimization 10173options should be specified at compile time and during the final link. 10174It is recommended that you compile all the files participating in the 10175same link with the same options and also specify those options at 10176link time. 10177For example: 10178 10179@smallexample 10180gcc -c -O2 -flto foo.c 10181gcc -c -O2 -flto bar.c 10182gcc -o myprog -flto -O2 foo.o bar.o 10183@end smallexample 10184 10185The first two invocations to GCC save a bytecode representation 10186of GIMPLE into special ELF sections inside @file{foo.o} and 10187@file{bar.o}. The final invocation reads the GIMPLE bytecode from 10188@file{foo.o} and @file{bar.o}, merges the two files into a single 10189internal image, and compiles the result as usual. Since both 10190@file{foo.o} and @file{bar.o} are merged into a single image, this 10191causes all the interprocedural analyses and optimizations in GCC to 10192work across the two files as if they were a single one. This means, 10193for example, that the inliner is able to inline functions in 10194@file{bar.o} into functions in @file{foo.o} and vice-versa. 10195 10196Another (simpler) way to enable link-time optimization is: 10197 10198@smallexample 10199gcc -o myprog -flto -O2 foo.c bar.c 10200@end smallexample 10201 10202The above generates bytecode for @file{foo.c} and @file{bar.c}, 10203merges them together into a single GIMPLE representation and optimizes 10204them as usual to produce @file{myprog}. 10205 10206The important thing to keep in mind is that to enable link-time 10207optimizations you need to use the GCC driver to perform the link step. 10208GCC automatically performs link-time optimization if any of the 10209objects involved were compiled with the @option{-flto} command-line option. 10210You can always override 10211the automatic decision to do link-time optimization 10212by passing @option{-fno-lto} to the link command. 10213 10214To make whole program optimization effective, it is necessary to make 10215certain whole program assumptions. The compiler needs to know 10216what functions and variables can be accessed by libraries and runtime 10217outside of the link-time optimized unit. When supported by the linker, 10218the linker plugin (see @option{-fuse-linker-plugin}) passes information 10219to the compiler about used and externally visible symbols. When 10220the linker plugin is not available, @option{-fwhole-program} should be 10221used to allow the compiler to make these assumptions, which leads 10222to more aggressive optimization decisions. 10223 10224When a file is compiled with @option{-flto} without 10225@option{-fuse-linker-plugin}, the generated object file is larger than 10226a regular object file because it contains GIMPLE bytecodes and the usual 10227final code (see @option{-ffat-lto-objects}. This means that 10228object files with LTO information can be linked as normal object 10229files; if @option{-fno-lto} is passed to the linker, no 10230interprocedural optimizations are applied. Note that when 10231@option{-fno-fat-lto-objects} is enabled the compile stage is faster 10232but you cannot perform a regular, non-LTO link on them. 10233 10234When producing the final binary, GCC only 10235applies link-time optimizations to those files that contain bytecode. 10236Therefore, you can mix and match object files and libraries with 10237GIMPLE bytecodes and final object code. GCC automatically selects 10238which files to optimize in LTO mode and which files to link without 10239further processing. 10240 10241Generally, options specified at link time override those 10242specified at compile time, although in some cases GCC attempts to infer 10243link-time options from the settings used to compile the input files. 10244 10245If you do not specify an optimization level option @option{-O} at 10246link time, then GCC uses the highest optimization level 10247used when compiling the object files. Note that it is generally 10248ineffective to specify an optimization level option only at link time and 10249not at compile time, for two reasons. First, compiling without 10250optimization suppresses compiler passes that gather information 10251needed for effective optimization at link time. Second, some early 10252optimization passes can be performed only at compile time and 10253not at link time. 10254 10255There are some code generation flags preserved by GCC when 10256generating bytecodes, as they need to be used during the final link. 10257Currently, the following options and their settings are taken from 10258the first object file that explicitly specifies them: 10259@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon}, 10260@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm} 10261and all the @option{-m} target flags. 10262 10263Certain ABI-changing flags are required to match in all compilation units, 10264and trying to override this at link time with a conflicting value 10265is ignored. This includes options such as @option{-freg-struct-return} 10266and @option{-fpcc-struct-return}. 10267 10268Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 10269@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 10270are passed through to the link stage and merged conservatively for 10271conflicting translation units. Specifically 10272@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 10273precedence; and for example @option{-ffp-contract=off} takes precedence 10274over @option{-ffp-contract=fast}. You can override them at link time. 10275 10276When you need to pass options to the assembler via @option{-Wa} or 10277@option{-Xassembler} make sure to either compile such translation 10278units with @option{-fno-lto} or consistently use the same assembler 10279options on all translation units. You can alternatively also 10280specify assembler options at LTO link time. 10281 10282If LTO encounters objects with C linkage declared with incompatible 10283types in separate translation units to be linked together (undefined 10284behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 10285issued. The behavior is still undefined at run time. Similar 10286diagnostics may be raised for other languages. 10287 10288Another feature of LTO is that it is possible to apply interprocedural 10289optimizations on files written in different languages: 10290 10291@smallexample 10292gcc -c -flto foo.c 10293g++ -c -flto bar.cc 10294gfortran -c -flto baz.f90 10295g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 10296@end smallexample 10297 10298Notice that the final link is done with @command{g++} to get the C++ 10299runtime libraries and @option{-lgfortran} is added to get the Fortran 10300runtime libraries. In general, when mixing languages in LTO mode, you 10301should use the same link command options as when mixing languages in a 10302regular (non-LTO) compilation. 10303 10304If object files containing GIMPLE bytecode are stored in a library archive, say 10305@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 10306are using a linker with plugin support. To create static libraries suitable 10307for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 10308and @command{ranlib}; 10309to show the symbols of object files with GIMPLE bytecode, use 10310@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 10311and @command{nm} have been compiled with plugin support. At link time, use the 10312flag @option{-fuse-linker-plugin} to ensure that the library participates in 10313the LTO optimization process: 10314 10315@smallexample 10316gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 10317@end smallexample 10318 10319With the linker plugin enabled, the linker extracts the needed 10320GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 10321to make them part of the aggregated GIMPLE image to be optimized. 10322 10323If you are not using a linker with plugin support and/or do not 10324enable the linker plugin, then the objects inside @file{libfoo.a} 10325are extracted and linked as usual, but they do not participate 10326in the LTO optimization process. In order to make a static library suitable 10327for both LTO optimization and usual linkage, compile its object files with 10328@option{-flto} @option{-ffat-lto-objects}. 10329 10330Link-time optimizations do not require the presence of the whole program to 10331operate. If the program does not require any symbols to be exported, it is 10332possible to combine @option{-flto} and @option{-fwhole-program} to allow 10333the interprocedural optimizers to use more aggressive assumptions which may 10334lead to improved optimization opportunities. 10335Use of @option{-fwhole-program} is not needed when linker plugin is 10336active (see @option{-fuse-linker-plugin}). 10337 10338The current implementation of LTO makes no 10339attempt to generate bytecode that is portable between different 10340types of hosts. The bytecode files are versioned and there is a 10341strict version check, so bytecode files generated in one version of 10342GCC do not work with an older or newer version of GCC. 10343 10344Link-time optimization does not work well with generation of debugging 10345information on systems other than those using a combination of ELF and 10346DWARF. 10347 10348If you specify the optional @var{n}, the optimization and code 10349generation done at link time is executed in parallel using @var{n} 10350parallel jobs by utilizing an installed @command{make} program. The 10351environment variable @env{MAKE} may be used to override the program 10352used. The default value for @var{n} is 1. 10353 10354You can also specify @option{-flto=jobserver} to use GNU make's 10355job server mode to determine the number of parallel jobs. This 10356is useful when the Makefile calling GCC is already executing in parallel. 10357You must prepend a @samp{+} to the command recipe in the parent Makefile 10358for this to work. This option likely only works if @env{MAKE} is 10359GNU make. 10360 10361@item -flto-partition=@var{alg} 10362@opindex flto-partition 10363Specify the partitioning algorithm used by the link-time optimizer. 10364The value is either @samp{1to1} to specify a partitioning mirroring 10365the original source files or @samp{balanced} to specify partitioning 10366into equally sized chunks (whenever possible) or @samp{max} to create 10367new partition for every symbol where possible. Specifying @samp{none} 10368as an algorithm disables partitioning and streaming completely. 10369The default value is @samp{balanced}. While @samp{1to1} can be used 10370as an workaround for various code ordering issues, the @samp{max} 10371partitioning is intended for internal testing only. 10372The value @samp{one} specifies that exactly one partition should be 10373used while the value @samp{none} bypasses partitioning and executes 10374the link-time optimization step directly from the WPA phase. 10375 10376@item -flto-odr-type-merging 10377@opindex flto-odr-type-merging 10378Enable streaming of mangled types names of C++ types and their unification 10379at link time. This increases size of LTO object files, but enables 10380diagnostics about One Definition Rule violations. 10381 10382@item -flto-compression-level=@var{n} 10383@opindex flto-compression-level 10384This option specifies the level of compression used for intermediate 10385language written to LTO object files, and is only meaningful in 10386conjunction with LTO mode (@option{-flto}). Valid 10387values are 0 (no compression) to 9 (maximum compression). Values 10388outside this range are clamped to either 0 or 9. If the option is not 10389given, a default balanced compression setting is used. 10390 10391@item -fuse-linker-plugin 10392@opindex fuse-linker-plugin 10393Enables the use of a linker plugin during link-time optimization. This 10394option relies on plugin support in the linker, which is available in gold 10395or in GNU ld 2.21 or newer. 10396 10397This option enables the extraction of object files with GIMPLE bytecode out 10398of library archives. This improves the quality of optimization by exposing 10399more code to the link-time optimizer. This information specifies what 10400symbols can be accessed externally (by non-LTO object or during dynamic 10401linking). Resulting code quality improvements on binaries (and shared 10402libraries that use hidden visibility) are similar to @option{-fwhole-program}. 10403See @option{-flto} for a description of the effect of this flag and how to 10404use it. 10405 10406This option is enabled by default when LTO support in GCC is enabled 10407and GCC was configured for use with 10408a linker supporting plugins (GNU ld 2.21 or newer or gold). 10409 10410@item -ffat-lto-objects 10411@opindex ffat-lto-objects 10412Fat LTO objects are object files that contain both the intermediate language 10413and the object code. This makes them usable for both LTO linking and normal 10414linking. This option is effective only when compiling with @option{-flto} 10415and is ignored at link time. 10416 10417@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 10418requires the complete toolchain to be aware of LTO. It requires a linker with 10419linker plugin support for basic functionality. Additionally, 10420@command{nm}, @command{ar} and @command{ranlib} 10421need to support linker plugins to allow a full-featured build environment 10422(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 10423@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 10424to these tools. With non fat LTO makefiles need to be modified to use them. 10425 10426Note that modern binutils provide plugin auto-load mechanism. 10427Installing the linker plugin into @file{$libdir/bfd-plugins} has the same 10428effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and 10429@command{gcc-ranlib}). 10430 10431The default is @option{-fno-fat-lto-objects} on targets with linker plugin 10432support. 10433 10434@item -fcompare-elim 10435@opindex fcompare-elim 10436After register allocation and post-register allocation instruction splitting, 10437identify arithmetic instructions that compute processor flags similar to a 10438comparison operation based on that arithmetic. If possible, eliminate the 10439explicit comparison operation. 10440 10441This pass only applies to certain targets that cannot explicitly represent 10442the comparison operation before register allocation is complete. 10443 10444Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 10445 10446@item -fcprop-registers 10447@opindex fcprop-registers 10448After register allocation and post-register allocation instruction splitting, 10449perform a copy-propagation pass to try to reduce scheduling dependencies 10450and occasionally eliminate the copy. 10451 10452Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 10453 10454@item -fprofile-correction 10455@opindex fprofile-correction 10456Profiles collected using an instrumented binary for multi-threaded programs may 10457be inconsistent due to missed counter updates. When this option is specified, 10458GCC uses heuristics to correct or smooth out such inconsistencies. By 10459default, GCC emits an error message when an inconsistent profile is detected. 10460 10461This option is enabled by @option{-fauto-profile}. 10462 10463@item -fprofile-use 10464@itemx -fprofile-use=@var{path} 10465@opindex fprofile-use 10466Enable profile feedback-directed optimizations, 10467and the following optimizations, many of which 10468are generally profitable only with profile feedback available: 10469 10470@gccoptlist{-fbranch-probabilities -fprofile-values @gol 10471-funroll-loops -fpeel-loops -ftracer -fvpt @gol 10472-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 10473-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 10474-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 10475-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 10476-fprofile-reorder-functions} 10477 10478Before you can use this option, you must first generate profiling information. 10479@xref{Instrumentation Options}, for information about the 10480@option{-fprofile-generate} option. 10481 10482By default, GCC emits an error message if the feedback profiles do not 10483match the source code. This error can be turned into a warning by using 10484@option{-Wno-error=coverage-mismatch}. Note this may result in poorly 10485optimized code. Additionally, by default, GCC also emits a warning message if 10486the feedback profiles do not exist (see @option{-Wmissing-profile}). 10487 10488If @var{path} is specified, GCC looks at the @var{path} to find 10489the profile feedback data files. See @option{-fprofile-dir}. 10490 10491@item -fauto-profile 10492@itemx -fauto-profile=@var{path} 10493@opindex fauto-profile 10494Enable sampling-based feedback-directed optimizations, 10495and the following optimizations, 10496many of which are generally profitable only with profile feedback available: 10497 10498@gccoptlist{-fbranch-probabilities -fprofile-values @gol 10499-funroll-loops -fpeel-loops -ftracer -fvpt @gol 10500-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 10501-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 10502-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 10503-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 10504-fprofile-correction} 10505 10506@var{path} is the name of a file containing AutoFDO profile information. 10507If omitted, it defaults to @file{fbdata.afdo} in the current directory. 10508 10509Producing an AutoFDO profile data file requires running your program 10510with the @command{perf} utility on a supported GNU/Linux target system. 10511For more information, see @uref{https://perf.wiki.kernel.org/}. 10512 10513E.g. 10514@smallexample 10515perf record -e br_inst_retired:near_taken -b -o perf.data \ 10516 -- your_program 10517@end smallexample 10518 10519Then use the @command{create_gcov} tool to convert the raw profile data 10520to a format that can be used by GCC.@ You must also supply the 10521unstripped binary for your program to this tool. 10522See @uref{https://github.com/google/autofdo}. 10523 10524E.g. 10525@smallexample 10526create_gcov --binary=your_program.unstripped --profile=perf.data \ 10527 --gcov=profile.afdo 10528@end smallexample 10529@end table 10530 10531The following options control compiler behavior regarding floating-point 10532arithmetic. These options trade off between speed and 10533correctness. All must be specifically enabled. 10534 10535@table @gcctabopt 10536@item -ffloat-store 10537@opindex ffloat-store 10538Do not store floating-point variables in registers, and inhibit other 10539options that might change whether a floating-point value is taken from a 10540register or memory. 10541 10542@cindex floating-point precision 10543This option prevents undesirable excess precision on machines such as 10544the 68000 where the floating registers (of the 68881) keep more 10545precision than a @code{double} is supposed to have. Similarly for the 10546x86 architecture. For most programs, the excess precision does only 10547good, but a few programs rely on the precise definition of IEEE floating 10548point. Use @option{-ffloat-store} for such programs, after modifying 10549them to store all pertinent intermediate computations into variables. 10550 10551@item -fexcess-precision=@var{style} 10552@opindex fexcess-precision 10553This option allows further control over excess precision on machines 10554where floating-point operations occur in a format with more precision or 10555range than the IEEE standard and interchange floating-point types. By 10556default, @option{-fexcess-precision=fast} is in effect; this means that 10557operations may be carried out in a wider precision than the types specified 10558in the source if that would result in faster code, and it is unpredictable 10559when rounding to the types specified in the source code takes place. 10560When compiling C, if @option{-fexcess-precision=standard} is specified then 10561excess precision follows the rules specified in ISO C99; in particular, 10562both casts and assignments cause values to be rounded to their 10563semantic types (whereas @option{-ffloat-store} only affects 10564assignments). This option is enabled by default for C if a strict 10565conformance option such as @option{-std=c99} is used. 10566@option{-ffast-math} enables @option{-fexcess-precision=fast} by default 10567regardless of whether a strict conformance option is used. 10568 10569@opindex mfpmath 10570@option{-fexcess-precision=standard} is not implemented for languages 10571other than C. On the x86, it has no effect if @option{-mfpmath=sse} 10572or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 10573semantics apply without excess precision, and in the latter, rounding 10574is unpredictable. 10575 10576@item -ffast-math 10577@opindex ffast-math 10578Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 10579@option{-ffinite-math-only}, @option{-fno-rounding-math}, 10580@option{-fno-signaling-nans}, @option{-fcx-limited-range} and 10581@option{-fexcess-precision=fast}. 10582 10583This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 10584 10585This option is not turned on by any @option{-O} option besides 10586@option{-Ofast} since it can result in incorrect output for programs 10587that depend on an exact implementation of IEEE or ISO rules/specifications 10588for math functions. It may, however, yield faster code for programs 10589that do not require the guarantees of these specifications. 10590 10591@item -fno-math-errno 10592@opindex fno-math-errno 10593@opindex fmath-errno 10594Do not set @code{errno} after calling math functions that are executed 10595with a single instruction, e.g., @code{sqrt}. A program that relies on 10596IEEE exceptions for math error handling may want to use this flag 10597for speed while maintaining IEEE arithmetic compatibility. 10598 10599This option is not turned on by any @option{-O} option since 10600it can result in incorrect output for programs that depend on 10601an exact implementation of IEEE or ISO rules/specifications for 10602math functions. It may, however, yield faster code for programs 10603that do not require the guarantees of these specifications. 10604 10605The default is @option{-fmath-errno}. 10606 10607On Darwin systems, the math library never sets @code{errno}. There is 10608therefore no reason for the compiler to consider the possibility that 10609it might, and @option{-fno-math-errno} is the default. 10610 10611@item -funsafe-math-optimizations 10612@opindex funsafe-math-optimizations 10613 10614Allow optimizations for floating-point arithmetic that (a) assume 10615that arguments and results are valid and (b) may violate IEEE or 10616ANSI standards. When used at link time, it may include libraries 10617or startup files that change the default FPU control word or other 10618similar optimizations. 10619 10620This option is not turned on by any @option{-O} option since 10621it can result in incorrect output for programs that depend on 10622an exact implementation of IEEE or ISO rules/specifications for 10623math functions. It may, however, yield faster code for programs 10624that do not require the guarantees of these specifications. 10625Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 10626@option{-fassociative-math} and @option{-freciprocal-math}. 10627 10628The default is @option{-fno-unsafe-math-optimizations}. 10629 10630@item -fassociative-math 10631@opindex fassociative-math 10632 10633Allow re-association of operands in series of floating-point operations. 10634This violates the ISO C and C++ language standard by possibly changing 10635computation result. NOTE: re-ordering may change the sign of zero as 10636well as ignore NaNs and inhibit or create underflow or overflow (and 10637thus cannot be used on code that relies on rounding behavior like 10638@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 10639and thus may not be used when ordered comparisons are required. 10640This option requires that both @option{-fno-signed-zeros} and 10641@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 10642much sense with @option{-frounding-math}. For Fortran the option 10643is automatically enabled when both @option{-fno-signed-zeros} and 10644@option{-fno-trapping-math} are in effect. 10645 10646The default is @option{-fno-associative-math}. 10647 10648@item -freciprocal-math 10649@opindex freciprocal-math 10650 10651Allow the reciprocal of a value to be used instead of dividing by 10652the value if this enables optimizations. For example @code{x / y} 10653can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 10654is subject to common subexpression elimination. Note that this loses 10655precision and increases the number of flops operating on the value. 10656 10657The default is @option{-fno-reciprocal-math}. 10658 10659@item -ffinite-math-only 10660@opindex ffinite-math-only 10661Allow optimizations for floating-point arithmetic that assume 10662that arguments and results are not NaNs or +-Infs. 10663 10664This option is not turned on by any @option{-O} option since 10665it can result in incorrect output for programs that depend on 10666an exact implementation of IEEE or ISO rules/specifications for 10667math functions. It may, however, yield faster code for programs 10668that do not require the guarantees of these specifications. 10669 10670The default is @option{-fno-finite-math-only}. 10671 10672@item -fno-signed-zeros 10673@opindex fno-signed-zeros 10674@opindex fsigned-zeros 10675Allow optimizations for floating-point arithmetic that ignore the 10676signedness of zero. IEEE arithmetic specifies the behavior of 10677distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 10678of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 10679This option implies that the sign of a zero result isn't significant. 10680 10681The default is @option{-fsigned-zeros}. 10682 10683@item -fno-trapping-math 10684@opindex fno-trapping-math 10685@opindex ftrapping-math 10686Compile code assuming that floating-point operations cannot generate 10687user-visible traps. These traps include division by zero, overflow, 10688underflow, inexact result and invalid operation. This option requires 10689that @option{-fno-signaling-nans} be in effect. Setting this option may 10690allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 10691 10692This option should never be turned on by any @option{-O} option since 10693it can result in incorrect output for programs that depend on 10694an exact implementation of IEEE or ISO rules/specifications for 10695math functions. 10696 10697The default is @option{-ftrapping-math}. 10698 10699@item -frounding-math 10700@opindex frounding-math 10701Disable transformations and optimizations that assume default floating-point 10702rounding behavior. This is round-to-zero for all floating point 10703to integer conversions, and round-to-nearest for all other arithmetic 10704truncations. This option should be specified for programs that change 10705the FP rounding mode dynamically, or that may be executed with a 10706non-default rounding mode. This option disables constant folding of 10707floating-point expressions at compile time (which may be affected by 10708rounding mode) and arithmetic transformations that are unsafe in the 10709presence of sign-dependent rounding modes. 10710 10711The default is @option{-fno-rounding-math}. 10712 10713This option is experimental and does not currently guarantee to 10714disable all GCC optimizations that are affected by rounding mode. 10715Future versions of GCC may provide finer control of this setting 10716using C99's @code{FENV_ACCESS} pragma. This command-line option 10717will be used to specify the default state for @code{FENV_ACCESS}. 10718 10719@item -fsignaling-nans 10720@opindex fsignaling-nans 10721Compile code assuming that IEEE signaling NaNs may generate user-visible 10722traps during floating-point operations. Setting this option disables 10723optimizations that may change the number of exceptions visible with 10724signaling NaNs. This option implies @option{-ftrapping-math}. 10725 10726This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 10727be defined. 10728 10729The default is @option{-fno-signaling-nans}. 10730 10731This option is experimental and does not currently guarantee to 10732disable all GCC optimizations that affect signaling NaN behavior. 10733 10734@item -fno-fp-int-builtin-inexact 10735@opindex fno-fp-int-builtin-inexact 10736@opindex ffp-int-builtin-inexact 10737Do not allow the built-in functions @code{ceil}, @code{floor}, 10738@code{round} and @code{trunc}, and their @code{float} and @code{long 10739double} variants, to generate code that raises the ``inexact'' 10740floating-point exception for noninteger arguments. ISO C99 and C11 10741allow these functions to raise the ``inexact'' exception, but ISO/IEC 10742TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these 10743functions to do so. 10744 10745The default is @option{-ffp-int-builtin-inexact}, allowing the 10746exception to be raised. This option does nothing unless 10747@option{-ftrapping-math} is in effect. 10748 10749Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions 10750generate a call to a library function then the ``inexact'' exception 10751may be raised if the library implementation does not follow TS 18661. 10752 10753@item -fsingle-precision-constant 10754@opindex fsingle-precision-constant 10755Treat floating-point constants as single precision instead of 10756implicitly converting them to double-precision constants. 10757 10758@item -fcx-limited-range 10759@opindex fcx-limited-range 10760When enabled, this option states that a range reduction step is not 10761needed when performing complex division. Also, there is no checking 10762whether the result of a complex multiplication or division is @code{NaN 10763+ I*NaN}, with an attempt to rescue the situation in that case. The 10764default is @option{-fno-cx-limited-range}, but is enabled by 10765@option{-ffast-math}. 10766 10767This option controls the default setting of the ISO C99 10768@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 10769all languages. 10770 10771@item -fcx-fortran-rules 10772@opindex fcx-fortran-rules 10773Complex multiplication and division follow Fortran rules. Range 10774reduction is done as part of complex division, but there is no checking 10775whether the result of a complex multiplication or division is @code{NaN 10776+ I*NaN}, with an attempt to rescue the situation in that case. 10777 10778The default is @option{-fno-cx-fortran-rules}. 10779 10780@end table 10781 10782The following options control optimizations that may improve 10783performance, but are not enabled by any @option{-O} options. This 10784section includes experimental options that may produce broken code. 10785 10786@table @gcctabopt 10787@item -fbranch-probabilities 10788@opindex fbranch-probabilities 10789After running a program compiled with @option{-fprofile-arcs} 10790(@pxref{Instrumentation Options}), 10791you can compile it a second time using 10792@option{-fbranch-probabilities}, to improve optimizations based on 10793the number of times each branch was taken. When a program 10794compiled with @option{-fprofile-arcs} exits, it saves arc execution 10795counts to a file called @file{@var{sourcename}.gcda} for each source 10796file. The information in this data file is very dependent on the 10797structure of the generated code, so you must use the same source code 10798and the same optimization options for both compilations. 10799 10800With @option{-fbranch-probabilities}, GCC puts a 10801@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 10802These can be used to improve optimization. Currently, they are only 10803used in one place: in @file{reorg.c}, instead of guessing which path a 10804branch is most likely to take, the @samp{REG_BR_PROB} values are used to 10805exactly determine which path is taken more often. 10806 10807Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10808 10809@item -fprofile-values 10810@opindex fprofile-values 10811If combined with @option{-fprofile-arcs}, it adds code so that some 10812data about values of expressions in the program is gathered. 10813 10814With @option{-fbranch-probabilities}, it reads back the data gathered 10815from profiling values of expressions for usage in optimizations. 10816 10817Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and 10818@option{-fauto-profile}. 10819 10820@item -fprofile-reorder-functions 10821@opindex fprofile-reorder-functions 10822Function reordering based on profile instrumentation collects 10823first time of execution of a function and orders these functions 10824in ascending order. 10825 10826Enabled with @option{-fprofile-use}. 10827 10828@item -fvpt 10829@opindex fvpt 10830If combined with @option{-fprofile-arcs}, this option instructs the compiler 10831to add code to gather information about values of expressions. 10832 10833With @option{-fbranch-probabilities}, it reads back the data gathered 10834and actually performs the optimizations based on them. 10835Currently the optimizations include specialization of division operations 10836using the knowledge about the value of the denominator. 10837 10838Enabled with @option{-fprofile-use} and @option{-fauto-profile}. 10839 10840@item -frename-registers 10841@opindex frename-registers 10842Attempt to avoid false dependencies in scheduled code by making use 10843of registers left over after register allocation. This optimization 10844most benefits processors with lots of registers. Depending on the 10845debug information format adopted by the target, however, it can 10846make debugging impossible, since variables no longer stay in 10847a ``home register''. 10848 10849Enabled by default with @option{-funroll-loops}. 10850 10851@item -fschedule-fusion 10852@opindex fschedule-fusion 10853Performs a target dependent pass over the instruction stream to schedule 10854instructions of same type together because target machine can execute them 10855more efficiently if they are adjacent to each other in the instruction flow. 10856 10857Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10858 10859@item -ftracer 10860@opindex ftracer 10861Perform tail duplication to enlarge superblock size. This transformation 10862simplifies the control flow of the function allowing other optimizations to do 10863a better job. 10864 10865Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10866 10867@item -funroll-loops 10868@opindex funroll-loops 10869Unroll loops whose number of iterations can be determined at compile time or 10870upon entry to the loop. @option{-funroll-loops} implies 10871@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 10872It also turns on complete loop peeling (i.e.@: complete removal of loops with 10873a small constant number of iterations). This option makes code larger, and may 10874or may not make it run faster. 10875 10876Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10877 10878@item -funroll-all-loops 10879@opindex funroll-all-loops 10880Unroll all loops, even if their number of iterations is uncertain when 10881the loop is entered. This usually makes programs run more slowly. 10882@option{-funroll-all-loops} implies the same options as 10883@option{-funroll-loops}. 10884 10885@item -fpeel-loops 10886@opindex fpeel-loops 10887Peels loops for which there is enough information that they do not 10888roll much (from profile feedback or static analysis). It also turns on 10889complete loop peeling (i.e.@: complete removal of loops with small constant 10890number of iterations). 10891 10892Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}. 10893 10894@item -fmove-loop-invariants 10895@opindex fmove-loop-invariants 10896Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 10897at level @option{-O1} and higher, except for @option{-Og}. 10898 10899@item -fsplit-loops 10900@opindex fsplit-loops 10901Split a loop into two if it contains a condition that's always true 10902for one side of the iteration space and false for the other. 10903 10904Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10905 10906@item -funswitch-loops 10907@opindex funswitch-loops 10908Move branches with loop invariant conditions out of the loop, with duplicates 10909of the loop on both branches (modified according to result of the condition). 10910 10911Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10912 10913@item -fversion-loops-for-strides 10914@opindex fversion-loops-for-strides 10915If a loop iterates over an array with a variable stride, create another 10916version of the loop that assumes the stride is always one. For example: 10917 10918@smallexample 10919for (int i = 0; i < n; ++i) 10920 x[i * stride] = @dots{}; 10921@end smallexample 10922 10923becomes: 10924 10925@smallexample 10926if (stride == 1) 10927 for (int i = 0; i < n; ++i) 10928 x[i] = @dots{}; 10929else 10930 for (int i = 0; i < n; ++i) 10931 x[i * stride] = @dots{}; 10932@end smallexample 10933 10934This is particularly useful for assumed-shape arrays in Fortran where 10935(for example) it allows better vectorization assuming contiguous accesses. 10936This flag is enabled by default at @option{-O3}. 10937It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10938 10939@item -ffunction-sections 10940@itemx -fdata-sections 10941@opindex ffunction-sections 10942@opindex fdata-sections 10943Place each function or data item into its own section in the output 10944file if the target supports arbitrary sections. The name of the 10945function or the name of the data item determines the section's name 10946in the output file. 10947 10948Use these options on systems where the linker can perform optimizations to 10949improve locality of reference in the instruction space. Most systems using the 10950ELF object format have linkers with such optimizations. On AIX, the linker 10951rearranges sections (CSECTs) based on the call graph. The performance impact 10952varies. 10953 10954Together with a linker garbage collection (linker @option{--gc-sections} 10955option) these options may lead to smaller statically-linked executables (after 10956stripping). 10957 10958On ELF/DWARF systems these options do not degenerate the quality of the debug 10959information. There could be issues with other object files/debug info formats. 10960 10961Only use these options when there are significant benefits from doing so. When 10962you specify these options, the assembler and linker create larger object and 10963executable files and are also slower. These options affect code generation. 10964They prevent optimizations by the compiler and assembler using relative 10965locations inside a translation unit since the locations are unknown until 10966link time. An example of such an optimization is relaxing calls to short call 10967instructions. 10968 10969@item -fbranch-target-load-optimize 10970@opindex fbranch-target-load-optimize 10971Perform branch target register load optimization before prologue / epilogue 10972threading. 10973The use of target registers can typically be exposed only during reload, 10974thus hoisting loads out of loops and doing inter-block scheduling needs 10975a separate optimization pass. 10976 10977@item -fbranch-target-load-optimize2 10978@opindex fbranch-target-load-optimize2 10979Perform branch target register load optimization after prologue / epilogue 10980threading. 10981 10982@item -fbtr-bb-exclusive 10983@opindex fbtr-bb-exclusive 10984When performing branch target register load optimization, don't reuse 10985branch target registers within any basic block. 10986 10987@item -fstdarg-opt 10988@opindex fstdarg-opt 10989Optimize the prologue of variadic argument functions with respect to usage of 10990those arguments. 10991 10992@item -fsection-anchors 10993@opindex fsection-anchors 10994Try to reduce the number of symbolic address calculations by using 10995shared ``anchor'' symbols to address nearby objects. This transformation 10996can help to reduce the number of GOT entries and GOT accesses on some 10997targets. 10998 10999For example, the implementation of the following function @code{foo}: 11000 11001@smallexample 11002static int a, b, c; 11003int foo (void) @{ return a + b + c; @} 11004@end smallexample 11005 11006@noindent 11007usually calculates the addresses of all three variables, but if you 11008compile it with @option{-fsection-anchors}, it accesses the variables 11009from a common anchor point instead. The effect is similar to the 11010following pseudocode (which isn't valid C): 11011 11012@smallexample 11013int foo (void) 11014@{ 11015 register int *xr = &x; 11016 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 11017@} 11018@end smallexample 11019 11020Not all targets support this option. 11021 11022@item --param @var{name}=@var{value} 11023@opindex param 11024In some places, GCC uses various constants to control the amount of 11025optimization that is done. For example, GCC does not inline functions 11026that contain more than a certain number of instructions. You can 11027control some of these constants on the command line using the 11028@option{--param} option. 11029 11030The names of specific parameters, and the meaning of the values, are 11031tied to the internals of the compiler, and are subject to change 11032without notice in future releases. 11033 11034In order to get minimal, maximal and default value of a parameter, 11035one can use @option{--help=param -Q} options. 11036 11037In each case, the @var{value} is an integer. The allowable choices for 11038@var{name} are: 11039 11040@table @gcctabopt 11041@item predictable-branch-outcome 11042When branch is predicted to be taken with probability lower than this threshold 11043(in percent), then it is considered well predictable. 11044 11045@item max-rtl-if-conversion-insns 11046RTL if-conversion tries to remove conditional branches around a block and 11047replace them with conditionally executed instructions. This parameter 11048gives the maximum number of instructions in a block which should be 11049considered for if-conversion. The compiler will 11050also use other heuristics to decide whether if-conversion is likely to be 11051profitable. 11052 11053@item max-rtl-if-conversion-predictable-cost 11054@itemx max-rtl-if-conversion-unpredictable-cost 11055RTL if-conversion will try to remove conditional branches around a block 11056and replace them with conditionally executed instructions. These parameters 11057give the maximum permissible cost for the sequence that would be generated 11058by if-conversion depending on whether the branch is statically determined 11059to be predictable or not. The units for this parameter are the same as 11060those for the GCC internal seq_cost metric. The compiler will try to 11061provide a reasonable default for this parameter using the BRANCH_COST 11062target macro. 11063 11064@item max-crossjump-edges 11065The maximum number of incoming edges to consider for cross-jumping. 11066The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 11067the number of edges incoming to each block. Increasing values mean 11068more aggressive optimization, making the compilation time increase with 11069probably small improvement in executable size. 11070 11071@item min-crossjump-insns 11072The minimum number of instructions that must be matched at the end 11073of two blocks before cross-jumping is performed on them. This 11074value is ignored in the case where all instructions in the block being 11075cross-jumped from are matched. 11076 11077@item max-grow-copy-bb-insns 11078The maximum code size expansion factor when copying basic blocks 11079instead of jumping. The expansion is relative to a jump instruction. 11080 11081@item max-goto-duplication-insns 11082The maximum number of instructions to duplicate to a block that jumps 11083to a computed goto. To avoid @math{O(N^2)} behavior in a number of 11084passes, GCC factors computed gotos early in the compilation process, 11085and unfactors them as late as possible. Only computed jumps at the 11086end of a basic blocks with no more than max-goto-duplication-insns are 11087unfactored. 11088 11089@item max-delay-slot-insn-search 11090The maximum number of instructions to consider when looking for an 11091instruction to fill a delay slot. If more than this arbitrary number of 11092instructions are searched, the time savings from filling the delay slot 11093are minimal, so stop searching. Increasing values mean more 11094aggressive optimization, making the compilation time increase with probably 11095small improvement in execution time. 11096 11097@item max-delay-slot-live-search 11098When trying to fill delay slots, the maximum number of instructions to 11099consider when searching for a block with valid live register 11100information. Increasing this arbitrarily chosen value means more 11101aggressive optimization, increasing the compilation time. This parameter 11102should be removed when the delay slot code is rewritten to maintain the 11103control-flow graph. 11104 11105@item max-gcse-memory 11106The approximate maximum amount of memory that can be allocated in 11107order to perform the global common subexpression elimination 11108optimization. If more memory than specified is required, the 11109optimization is not done. 11110 11111@item max-gcse-insertion-ratio 11112If the ratio of expression insertions to deletions is larger than this value 11113for any expression, then RTL PRE inserts or removes the expression and thus 11114leaves partially redundant computations in the instruction stream. 11115 11116@item max-pending-list-length 11117The maximum number of pending dependencies scheduling allows 11118before flushing the current state and starting over. Large functions 11119with few branches or calls can create excessively large lists which 11120needlessly consume memory and resources. 11121 11122@item max-modulo-backtrack-attempts 11123The maximum number of backtrack attempts the scheduler should make 11124when modulo scheduling a loop. Larger values can exponentially increase 11125compilation time. 11126 11127@item max-inline-insns-single 11128Several parameters control the tree inliner used in GCC@. 11129This number sets the maximum number of instructions (counted in GCC's 11130internal representation) in a single function that the tree inliner 11131considers for inlining. This only affects functions declared 11132inline and methods implemented in a class declaration (C++). 11133 11134@item max-inline-insns-auto 11135When you use @option{-finline-functions} (included in @option{-O3}), 11136a lot of functions that would otherwise not be considered for inlining 11137by the compiler are investigated. To those functions, a different 11138(more restrictive) limit compared to functions declared inline can 11139be applied. 11140 11141@item max-inline-insns-small 11142This is bound applied to calls which are considered relevant with 11143@option{-finline-small-functions}. 11144 11145@item max-inline-insns-size 11146This is bound applied to calls which are optimized for size. Small growth 11147may be desirable to anticipate optimization oppurtunities exposed by inlining. 11148 11149@item uninlined-function-insns 11150Number of instructions accounted by inliner for function overhead such as 11151function prologue and epilogue. 11152 11153@item uninlined-function-time 11154Extra time accounted by inliner for function overhead such as time needed to 11155execute function prologue and epilogue 11156 11157@item uninlined-thunk-insns 11158@item uninlined-thunk-time 11159Same as @option{--param uninlined-function-insns} and 11160@option{--param uninlined-function-time} but applied to function thunks 11161 11162@item inline-min-speedup 11163When estimated performance improvement of caller + callee runtime exceeds this 11164threshold (in percent), the function can be inlined regardless of the limit on 11165@option{--param max-inline-insns-single} and @option{--param 11166max-inline-insns-auto}. 11167 11168@item large-function-insns 11169The limit specifying really large functions. For functions larger than this 11170limit after inlining, inlining is constrained by 11171@option{--param large-function-growth}. This parameter is useful primarily 11172to avoid extreme compilation time caused by non-linear algorithms used by the 11173back end. 11174 11175@item large-function-growth 11176Specifies maximal growth of large function caused by inlining in percents. 11177For example, parameter value 100 limits large function growth to 2.0 times 11178the original size. 11179 11180@item large-unit-insns 11181The limit specifying large translation unit. Growth caused by inlining of 11182units larger than this limit is limited by @option{--param inline-unit-growth}. 11183For small units this might be too tight. 11184For example, consider a unit consisting of function A 11185that is inline and B that just calls A three times. If B is small relative to 11186A, the growth of unit is 300\% and yet such inlining is very sane. For very 11187large units consisting of small inlineable functions, however, the overall unit 11188growth limit is needed to avoid exponential explosion of code size. Thus for 11189smaller units, the size is increased to @option{--param large-unit-insns} 11190before applying @option{--param inline-unit-growth}. 11191 11192@item inline-unit-growth 11193Specifies maximal overall growth of the compilation unit caused by inlining. 11194For example, parameter value 20 limits unit growth to 1.2 times the original 11195size. Cold functions (either marked cold via an attribute or by profile 11196feedback) are not accounted into the unit size. 11197 11198@item ipcp-unit-growth 11199Specifies maximal overall growth of the compilation unit caused by 11200interprocedural constant propagation. For example, parameter value 10 limits 11201unit growth to 1.1 times the original size. 11202 11203@item large-stack-frame 11204The limit specifying large stack frames. While inlining the algorithm is trying 11205to not grow past this limit too much. 11206 11207@item large-stack-frame-growth 11208Specifies maximal growth of large stack frames caused by inlining in percents. 11209For example, parameter value 1000 limits large stack frame growth to 11 times 11210the original size. 11211 11212@item max-inline-insns-recursive 11213@itemx max-inline-insns-recursive-auto 11214Specifies the maximum number of instructions an out-of-line copy of a 11215self-recursive inline 11216function can grow into by performing recursive inlining. 11217 11218@option{--param max-inline-insns-recursive} applies to functions 11219declared inline. 11220For functions not declared inline, recursive inlining 11221happens only when @option{-finline-functions} (included in @option{-O3}) is 11222enabled; @option{--param max-inline-insns-recursive-auto} applies instead. 11223 11224@item max-inline-recursive-depth 11225@itemx max-inline-recursive-depth-auto 11226Specifies the maximum recursion depth used for recursive inlining. 11227 11228@option{--param max-inline-recursive-depth} applies to functions 11229declared inline. For functions not declared inline, recursive inlining 11230happens only when @option{-finline-functions} (included in @option{-O3}) is 11231enabled; @option{--param max-inline-recursive-depth-auto} applies instead. 11232 11233@item min-inline-recursive-probability 11234Recursive inlining is profitable only for function having deep recursion 11235in average and can hurt for function having little recursion depth by 11236increasing the prologue size or complexity of function body to other 11237optimizers. 11238 11239When profile feedback is available (see @option{-fprofile-generate}) the actual 11240recursion depth can be guessed from the probability that function recurses 11241via a given call expression. This parameter limits inlining only to call 11242expressions whose probability exceeds the given threshold (in percents). 11243 11244@item early-inlining-insns 11245Specify growth that the early inliner can make. In effect it increases 11246the amount of inlining for code having a large abstraction penalty. 11247 11248@item max-early-inliner-iterations 11249Limit of iterations of the early inliner. This basically bounds 11250the number of nested indirect calls the early inliner can resolve. 11251Deeper chains are still handled by late inlining. 11252 11253@item comdat-sharing-probability 11254Probability (in percent) that C++ inline function with comdat visibility 11255are shared across multiple compilation units. 11256 11257@item profile-func-internal-id 11258A parameter to control whether to use function internal id in profile 11259database lookup. If the value is 0, the compiler uses an id that 11260is based on function assembler name and filename, which makes old profile 11261data more tolerant to source changes such as function reordering etc. 11262 11263@item min-vect-loop-bound 11264The minimum number of iterations under which loops are not vectorized 11265when @option{-ftree-vectorize} is used. The number of iterations after 11266vectorization needs to be greater than the value specified by this option 11267to allow vectorization. 11268 11269@item gcse-cost-distance-ratio 11270Scaling factor in calculation of maximum distance an expression 11271can be moved by GCSE optimizations. This is currently supported only in the 11272code hoisting pass. The bigger the ratio, the more aggressive code hoisting 11273is with simple expressions, i.e., the expressions that have cost 11274less than @option{gcse-unrestricted-cost}. Specifying 0 disables 11275hoisting of simple expressions. 11276 11277@item gcse-unrestricted-cost 11278Cost, roughly measured as the cost of a single typical machine 11279instruction, at which GCSE optimizations do not constrain 11280the distance an expression can travel. This is currently 11281supported only in the code hoisting pass. The lesser the cost, 11282the more aggressive code hoisting is. Specifying 0 11283allows all expressions to travel unrestricted distances. 11284 11285@item max-hoist-depth 11286The depth of search in the dominator tree for expressions to hoist. 11287This is used to avoid quadratic behavior in hoisting algorithm. 11288The value of 0 does not limit on the search, but may slow down compilation 11289of huge functions. 11290 11291@item max-tail-merge-comparisons 11292The maximum amount of similar bbs to compare a bb with. This is used to 11293avoid quadratic behavior in tree tail merging. 11294 11295@item max-tail-merge-iterations 11296The maximum amount of iterations of the pass over the function. This is used to 11297limit compilation time in tree tail merging. 11298 11299@item store-merging-allow-unaligned 11300Allow the store merging pass to introduce unaligned stores if it is legal to 11301do so. 11302 11303@item max-stores-to-merge 11304The maximum number of stores to attempt to merge into wider stores in the store 11305merging pass. 11306 11307@item max-unrolled-insns 11308The maximum number of instructions that a loop may have to be unrolled. 11309If a loop is unrolled, this parameter also determines how many times 11310the loop code is unrolled. 11311 11312@item max-average-unrolled-insns 11313The maximum number of instructions biased by probabilities of their execution 11314that a loop may have to be unrolled. If a loop is unrolled, 11315this parameter also determines how many times the loop code is unrolled. 11316 11317@item max-unroll-times 11318The maximum number of unrollings of a single loop. 11319 11320@item max-peeled-insns 11321The maximum number of instructions that a loop may have to be peeled. 11322If a loop is peeled, this parameter also determines how many times 11323the loop code is peeled. 11324 11325@item max-peel-times 11326The maximum number of peelings of a single loop. 11327 11328@item max-peel-branches 11329The maximum number of branches on the hot path through the peeled sequence. 11330 11331@item max-completely-peeled-insns 11332The maximum number of insns of a completely peeled loop. 11333 11334@item max-completely-peel-times 11335The maximum number of iterations of a loop to be suitable for complete peeling. 11336 11337@item max-completely-peel-loop-nest-depth 11338The maximum depth of a loop nest suitable for complete peeling. 11339 11340@item max-unswitch-insns 11341The maximum number of insns of an unswitched loop. 11342 11343@item max-unswitch-level 11344The maximum number of branches unswitched in a single loop. 11345 11346@item lim-expensive 11347The minimum cost of an expensive expression in the loop invariant motion. 11348 11349@item iv-consider-all-candidates-bound 11350Bound on number of candidates for induction variables, below which 11351all candidates are considered for each use in induction variable 11352optimizations. If there are more candidates than this, 11353only the most relevant ones are considered to avoid quadratic time complexity. 11354 11355@item iv-max-considered-uses 11356The induction variable optimizations give up on loops that contain more 11357induction variable uses. 11358 11359@item iv-always-prune-cand-set-bound 11360If the number of candidates in the set is smaller than this value, 11361always try to remove unnecessary ivs from the set 11362when adding a new one. 11363 11364@item avg-loop-niter 11365Average number of iterations of a loop. 11366 11367@item dse-max-object-size 11368Maximum size (in bytes) of objects tracked bytewise by dead store elimination. 11369Larger values may result in larger compilation times. 11370 11371@item dse-max-alias-queries-per-store 11372Maximum number of queries into the alias oracle per store. 11373Larger values result in larger compilation times and may result in more 11374removed dead stores. 11375 11376@item scev-max-expr-size 11377Bound on size of expressions used in the scalar evolutions analyzer. 11378Large expressions slow the analyzer. 11379 11380@item scev-max-expr-complexity 11381Bound on the complexity of the expressions in the scalar evolutions analyzer. 11382Complex expressions slow the analyzer. 11383 11384@item max-tree-if-conversion-phi-args 11385Maximum number of arguments in a PHI supported by TREE if conversion 11386unless the loop is marked with simd pragma. 11387 11388@item vect-max-version-for-alignment-checks 11389The maximum number of run-time checks that can be performed when 11390doing loop versioning for alignment in the vectorizer. 11391 11392@item vect-max-version-for-alias-checks 11393The maximum number of run-time checks that can be performed when 11394doing loop versioning for alias in the vectorizer. 11395 11396@item vect-max-peeling-for-alignment 11397The maximum number of loop peels to enhance access alignment 11398for vectorizer. Value -1 means no limit. 11399 11400@item max-iterations-to-track 11401The maximum number of iterations of a loop the brute-force algorithm 11402for analysis of the number of iterations of the loop tries to evaluate. 11403 11404@item hot-bb-count-ws-permille 11405A basic block profile count is considered hot if it contributes to 11406the given permillage (i.e.@: 0...1000) of the entire profiled execution. 11407 11408@item hot-bb-frequency-fraction 11409Select fraction of the entry block frequency of executions of basic block in 11410function given basic block needs to have to be considered hot. 11411 11412@item max-predicted-iterations 11413The maximum number of loop iterations we predict statically. This is useful 11414in cases where a function contains a single loop with known bound and 11415another loop with unknown bound. 11416The known number of iterations is predicted correctly, while 11417the unknown number of iterations average to roughly 10. This means that the 11418loop without bounds appears artificially cold relative to the other one. 11419 11420@item builtin-expect-probability 11421Control the probability of the expression having the specified value. This 11422parameter takes a percentage (i.e.@: 0 ... 100) as input. 11423 11424@item builtin-string-cmp-inline-length 11425The maximum length of a constant string for a builtin string cmp call 11426eligible for inlining. 11427 11428@item align-threshold 11429 11430Select fraction of the maximal frequency of executions of a basic block in 11431a function to align the basic block. 11432 11433@item align-loop-iterations 11434 11435A loop expected to iterate at least the selected number of iterations is 11436aligned. 11437 11438@item tracer-dynamic-coverage 11439@itemx tracer-dynamic-coverage-feedback 11440 11441This value is used to limit superblock formation once the given percentage of 11442executed instructions is covered. This limits unnecessary code size 11443expansion. 11444 11445The @option{tracer-dynamic-coverage-feedback} parameter 11446is used only when profile 11447feedback is available. The real profiles (as opposed to statically estimated 11448ones) are much less balanced allowing the threshold to be larger value. 11449 11450@item tracer-max-code-growth 11451Stop tail duplication once code growth has reached given percentage. This is 11452a rather artificial limit, as most of the duplicates are eliminated later in 11453cross jumping, so it may be set to much higher values than is the desired code 11454growth. 11455 11456@item tracer-min-branch-ratio 11457 11458Stop reverse growth when the reverse probability of best edge is less than this 11459threshold (in percent). 11460 11461@item tracer-min-branch-probability 11462@itemx tracer-min-branch-probability-feedback 11463 11464Stop forward growth if the best edge has probability lower than this 11465threshold. 11466 11467Similarly to @option{tracer-dynamic-coverage} two parameters are 11468provided. @option{tracer-min-branch-probability-feedback} is used for 11469compilation with profile feedback and @option{tracer-min-branch-probability} 11470compilation without. The value for compilation with profile feedback 11471needs to be more conservative (higher) in order to make tracer 11472effective. 11473 11474@item stack-clash-protection-guard-size 11475Specify the size of the operating system provided stack guard as 114762 raised to @var{num} bytes. Higher values may reduce the 11477number of explicit probes, but a value larger than the operating system 11478provided guard will leave code vulnerable to stack clash style attacks. 11479 11480@item stack-clash-protection-probe-interval 11481Stack clash protection involves probing stack space as it is allocated. This 11482param controls the maximum distance between probes into the stack as 2 raised 11483to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value 11484larger than the operating system provided guard will leave code vulnerable to 11485stack clash style attacks. 11486 11487@item max-cse-path-length 11488 11489The maximum number of basic blocks on path that CSE considers. 11490 11491@item max-cse-insns 11492The maximum number of instructions CSE processes before flushing. 11493 11494@item ggc-min-expand 11495 11496GCC uses a garbage collector to manage its own memory allocation. This 11497parameter specifies the minimum percentage by which the garbage 11498collector's heap should be allowed to expand between collections. 11499Tuning this may improve compilation speed; it has no effect on code 11500generation. 11501 11502The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 11503RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 11504the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 11505GCC is not able to calculate RAM on a particular platform, the lower 11506bound of 30% is used. Setting this parameter and 11507@option{ggc-min-heapsize} to zero causes a full collection to occur at 11508every opportunity. This is extremely slow, but can be useful for 11509debugging. 11510 11511@item ggc-min-heapsize 11512 11513Minimum size of the garbage collector's heap before it begins bothering 11514to collect garbage. The first collection occurs after the heap expands 11515by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 11516tuning this may improve compilation speed, and has no effect on code 11517generation. 11518 11519The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 11520tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 11521with a lower bound of 4096 (four megabytes) and an upper bound of 11522131072 (128 megabytes). If GCC is not able to calculate RAM on a 11523particular platform, the lower bound is used. Setting this parameter 11524very large effectively disables garbage collection. Setting this 11525parameter and @option{ggc-min-expand} to zero causes a full collection 11526to occur at every opportunity. 11527 11528@item max-reload-search-insns 11529The maximum number of instruction reload should look backward for equivalent 11530register. Increasing values mean more aggressive optimization, making the 11531compilation time increase with probably slightly better performance. 11532 11533@item max-cselib-memory-locations 11534The maximum number of memory locations cselib should take into account. 11535Increasing values mean more aggressive optimization, making the compilation time 11536increase with probably slightly better performance. 11537 11538@item max-sched-ready-insns 11539The maximum number of instructions ready to be issued the scheduler should 11540consider at any given time during the first scheduling pass. Increasing 11541values mean more thorough searches, making the compilation time increase 11542with probably little benefit. 11543 11544@item max-sched-region-blocks 11545The maximum number of blocks in a region to be considered for 11546interblock scheduling. 11547 11548@item max-pipeline-region-blocks 11549The maximum number of blocks in a region to be considered for 11550pipelining in the selective scheduler. 11551 11552@item max-sched-region-insns 11553The maximum number of insns in a region to be considered for 11554interblock scheduling. 11555 11556@item max-pipeline-region-insns 11557The maximum number of insns in a region to be considered for 11558pipelining in the selective scheduler. 11559 11560@item min-spec-prob 11561The minimum probability (in percents) of reaching a source block 11562for interblock speculative scheduling. 11563 11564@item max-sched-extend-regions-iters 11565The maximum number of iterations through CFG to extend regions. 11566A value of 0 disables region extensions. 11567 11568@item max-sched-insn-conflict-delay 11569The maximum conflict delay for an insn to be considered for speculative motion. 11570 11571@item sched-spec-prob-cutoff 11572The minimal probability of speculation success (in percents), so that 11573speculative insns are scheduled. 11574 11575@item sched-state-edge-prob-cutoff 11576The minimum probability an edge must have for the scheduler to save its 11577state across it. 11578 11579@item sched-mem-true-dep-cost 11580Minimal distance (in CPU cycles) between store and load targeting same 11581memory locations. 11582 11583@item selsched-max-lookahead 11584The maximum size of the lookahead window of selective scheduling. It is a 11585depth of search for available instructions. 11586 11587@item selsched-max-sched-times 11588The maximum number of times that an instruction is scheduled during 11589selective scheduling. This is the limit on the number of iterations 11590through which the instruction may be pipelined. 11591 11592@item selsched-insns-to-rename 11593The maximum number of best instructions in the ready list that are considered 11594for renaming in the selective scheduler. 11595 11596@item sms-min-sc 11597The minimum value of stage count that swing modulo scheduler 11598generates. 11599 11600@item max-last-value-rtl 11601The maximum size measured as number of RTLs that can be recorded in an expression 11602in combiner for a pseudo register as last known value of that register. 11603 11604@item max-combine-insns 11605The maximum number of instructions the RTL combiner tries to combine. 11606 11607@item integer-share-limit 11608Small integer constants can use a shared data structure, reducing the 11609compiler's memory usage and increasing its speed. This sets the maximum 11610value of a shared integer constant. 11611 11612@item ssp-buffer-size 11613The minimum size of buffers (i.e.@: arrays) that receive stack smashing 11614protection when @option{-fstack-protection} is used. 11615 11616@item min-size-for-stack-sharing 11617The minimum size of variables taking part in stack slot sharing when not 11618optimizing. 11619 11620@item max-jump-thread-duplication-stmts 11621Maximum number of statements allowed in a block that needs to be 11622duplicated when threading jumps. 11623 11624@item max-fields-for-field-sensitive 11625Maximum number of fields in a structure treated in 11626a field sensitive manner during pointer analysis. 11627 11628@item prefetch-latency 11629Estimate on average number of instructions that are executed before 11630prefetch finishes. The distance prefetched ahead is proportional 11631to this constant. Increasing this number may also lead to less 11632streams being prefetched (see @option{simultaneous-prefetches}). 11633 11634@item simultaneous-prefetches 11635Maximum number of prefetches that can run at the same time. 11636 11637@item l1-cache-line-size 11638The size of cache line in L1 data cache, in bytes. 11639 11640@item l1-cache-size 11641The size of L1 data cache, in kilobytes. 11642 11643@item l2-cache-size 11644The size of L2 data cache, in kilobytes. 11645 11646@item prefetch-dynamic-strides 11647Whether the loop array prefetch pass should issue software prefetch hints 11648for strides that are non-constant. In some cases this may be 11649beneficial, though the fact the stride is non-constant may make it 11650hard to predict when there is clear benefit to issuing these hints. 11651 11652Set to 1 if the prefetch hints should be issued for non-constant 11653strides. Set to 0 if prefetch hints should be issued only for strides that 11654are known to be constant and below @option{prefetch-minimum-stride}. 11655 11656@item prefetch-minimum-stride 11657Minimum constant stride, in bytes, to start using prefetch hints for. If 11658the stride is less than this threshold, prefetch hints will not be issued. 11659 11660This setting is useful for processors that have hardware prefetchers, in 11661which case there may be conflicts between the hardware prefetchers and 11662the software prefetchers. If the hardware prefetchers have a maximum 11663stride they can handle, it should be used here to improve the use of 11664software prefetchers. 11665 11666A value of -1 means we don't have a threshold and therefore 11667prefetch hints can be issued for any constant stride. 11668 11669This setting is only useful for strides that are known and constant. 11670 11671@item loop-interchange-max-num-stmts 11672The maximum number of stmts in a loop to be interchanged. 11673 11674@item loop-interchange-stride-ratio 11675The minimum ratio between stride of two loops for interchange to be profitable. 11676 11677@item min-insn-to-prefetch-ratio 11678The minimum ratio between the number of instructions and the 11679number of prefetches to enable prefetching in a loop. 11680 11681@item prefetch-min-insn-to-mem-ratio 11682The minimum ratio between the number of instructions and the 11683number of memory references to enable prefetching in a loop. 11684 11685@item use-canonical-types 11686Whether the compiler should use the ``canonical'' type system. 11687Should always be 1, which uses a more efficient internal 11688mechanism for comparing types in C++ and Objective-C++. However, if 11689bugs in the canonical type system are causing compilation failures, 11690set this value to 0 to disable canonical types. 11691 11692@item switch-conversion-max-branch-ratio 11693Switch initialization conversion refuses to create arrays that are 11694bigger than @option{switch-conversion-max-branch-ratio} times the number of 11695branches in the switch. 11696 11697@item max-partial-antic-length 11698Maximum length of the partial antic set computed during the tree 11699partial redundancy elimination optimization (@option{-ftree-pre}) when 11700optimizing at @option{-O3} and above. For some sorts of source code 11701the enhanced partial redundancy elimination optimization can run away, 11702consuming all of the memory available on the host machine. This 11703parameter sets a limit on the length of the sets that are computed, 11704which prevents the runaway behavior. Setting a value of 0 for 11705this parameter allows an unlimited set length. 11706 11707@item rpo-vn-max-loop-depth 11708Maximum loop depth that is value-numbered optimistically. 11709When the limit hits the innermost 11710@var{rpo-vn-max-loop-depth} loops and the outermost loop in the 11711loop nest are value-numbered optimistically and the remaining ones not. 11712 11713@item sccvn-max-alias-queries-per-access 11714Maximum number of alias-oracle queries we perform when looking for 11715redundancies for loads and stores. If this limit is hit the search 11716is aborted and the load or store is not considered redundant. The 11717number of queries is algorithmically limited to the number of 11718stores on all paths from the load to the function entry. 11719 11720@item ira-max-loops-num 11721IRA uses regional register allocation by default. If a function 11722contains more loops than the number given by this parameter, only at most 11723the given number of the most frequently-executed loops form regions 11724for regional register allocation. 11725 11726@item ira-max-conflict-table-size 11727Although IRA uses a sophisticated algorithm to compress the conflict 11728table, the table can still require excessive amounts of memory for 11729huge functions. If the conflict table for a function could be more 11730than the size in MB given by this parameter, the register allocator 11731instead uses a faster, simpler, and lower-quality 11732algorithm that does not require building a pseudo-register conflict table. 11733 11734@item ira-loop-reserved-regs 11735IRA can be used to evaluate more accurate register pressure in loops 11736for decisions to move loop invariants (see @option{-O3}). The number 11737of available registers reserved for some other purposes is given 11738by this parameter. Default of the parameter 11739is the best found from numerous experiments. 11740 11741@item lra-inheritance-ebb-probability-cutoff 11742LRA tries to reuse values reloaded in registers in subsequent insns. 11743This optimization is called inheritance. EBB is used as a region to 11744do this optimization. The parameter defines a minimal fall-through 11745edge probability in percentage used to add BB to inheritance EBB in 11746LRA. The default value was chosen 11747from numerous runs of SPEC2000 on x86-64. 11748 11749@item loop-invariant-max-bbs-in-loop 11750Loop invariant motion can be very expensive, both in compilation time and 11751in amount of needed compile-time memory, with very large loops. Loops 11752with more basic blocks than this parameter won't have loop invariant 11753motion optimization performed on them. 11754 11755@item loop-max-datarefs-for-datadeps 11756Building data dependencies is expensive for very large loops. This 11757parameter limits the number of data references in loops that are 11758considered for data dependence analysis. These large loops are no 11759handled by the optimizations using loop data dependencies. 11760 11761@item max-vartrack-size 11762Sets a maximum number of hash table slots to use during variable 11763tracking dataflow analysis of any function. If this limit is exceeded 11764with variable tracking at assignments enabled, analysis for that 11765function is retried without it, after removing all debug insns from 11766the function. If the limit is exceeded even without debug insns, var 11767tracking analysis is completely disabled for the function. Setting 11768the parameter to zero makes it unlimited. 11769 11770@item max-vartrack-expr-depth 11771Sets a maximum number of recursion levels when attempting to map 11772variable names or debug temporaries to value expressions. This trades 11773compilation time for more complete debug information. If this is set too 11774low, value expressions that are available and could be represented in 11775debug information may end up not being used; setting this higher may 11776enable the compiler to find more complex debug expressions, but compile 11777time and memory use may grow. 11778 11779@item max-debug-marker-count 11780Sets a threshold on the number of debug markers (e.g.@: begin stmt 11781markers) to avoid complexity explosion at inlining or expanding to RTL. 11782If a function has more such gimple stmts than the set limit, such stmts 11783will be dropped from the inlined copy of a function, and from its RTL 11784expansion. 11785 11786@item min-nondebug-insn-uid 11787Use uids starting at this parameter for nondebug insns. The range below 11788the parameter is reserved exclusively for debug insns created by 11789@option{-fvar-tracking-assignments}, but debug insns may get 11790(non-overlapping) uids above it if the reserved range is exhausted. 11791 11792@item ipa-sra-ptr-growth-factor 11793IPA-SRA replaces a pointer to an aggregate with one or more new 11794parameters only when their cumulative size is less or equal to 11795@option{ipa-sra-ptr-growth-factor} times the size of the original 11796pointer parameter. 11797 11798@item sra-max-scalarization-size-Ospeed 11799@itemx sra-max-scalarization-size-Osize 11800The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 11801replace scalar parts of aggregates with uses of independent scalar 11802variables. These parameters control the maximum size, in storage units, 11803of aggregate which is considered for replacement when compiling for 11804speed 11805(@option{sra-max-scalarization-size-Ospeed}) or size 11806(@option{sra-max-scalarization-size-Osize}) respectively. 11807 11808@item sra-max-propagations 11809The maximum number of artificial accesses that Scalar Replacement of 11810Aggregates (SRA) will track, per one local variable, in order to 11811facilitate copy propagation. 11812 11813@item tm-max-aggregate-size 11814When making copies of thread-local variables in a transaction, this 11815parameter specifies the size in bytes after which variables are 11816saved with the logging functions as opposed to save/restore code 11817sequence pairs. This option only applies when using 11818@option{-fgnu-tm}. 11819 11820@item graphite-max-nb-scop-params 11821To avoid exponential effects in the Graphite loop transforms, the 11822number of parameters in a Static Control Part (SCoP) is bounded. 11823A value of zero can be used to lift 11824the bound. A variable whose value is unknown at compilation time and 11825defined outside a SCoP is a parameter of the SCoP. 11826 11827@item loop-block-tile-size 11828Loop blocking or strip mining transforms, enabled with 11829@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 11830loop in the loop nest by a given number of iterations. The strip 11831length can be changed using the @option{loop-block-tile-size} 11832parameter. 11833 11834@item ipa-cp-value-list-size 11835IPA-CP attempts to track all possible values and types passed to a function's 11836parameter in order to propagate them and perform devirtualization. 11837@option{ipa-cp-value-list-size} is the maximum number of values and types it 11838stores per one formal parameter of a function. 11839 11840@item ipa-cp-eval-threshold 11841IPA-CP calculates its own score of cloning profitability heuristics 11842and performs those cloning opportunities with scores that exceed 11843@option{ipa-cp-eval-threshold}. 11844 11845@item ipa-cp-recursion-penalty 11846Percentage penalty the recursive functions will receive when they 11847are evaluated for cloning. 11848 11849@item ipa-cp-single-call-penalty 11850Percentage penalty functions containing a single call to another 11851function will receive when they are evaluated for cloning. 11852 11853@item ipa-max-agg-items 11854IPA-CP is also capable to propagate a number of scalar values passed 11855in an aggregate. @option{ipa-max-agg-items} controls the maximum 11856number of such values per one parameter. 11857 11858@item ipa-cp-loop-hint-bonus 11859When IPA-CP determines that a cloning candidate would make the number 11860of iterations of a loop known, it adds a bonus of 11861@option{ipa-cp-loop-hint-bonus} to the profitability score of 11862the candidate. 11863 11864@item ipa-cp-array-index-hint-bonus 11865When IPA-CP determines that a cloning candidate would make the index of 11866an array access known, it adds a bonus of 11867@option{ipa-cp-array-index-hint-bonus} to the profitability 11868score of the candidate. 11869 11870@item ipa-max-aa-steps 11871During its analysis of function bodies, IPA-CP employs alias analysis 11872in order to track values pointed to by function parameters. In order 11873not spend too much time analyzing huge functions, it gives up and 11874consider all memory clobbered after examining 11875@option{ipa-max-aa-steps} statements modifying memory. 11876 11877@item lto-partitions 11878Specify desired number of partitions produced during WHOPR compilation. 11879The number of partitions should exceed the number of CPUs used for compilation. 11880 11881@item lto-min-partition 11882Size of minimal partition for WHOPR (in estimated instructions). 11883This prevents expenses of splitting very small programs into too many 11884partitions. 11885 11886@item lto-max-partition 11887Size of max partition for WHOPR (in estimated instructions). 11888to provide an upper bound for individual size of partition. 11889Meant to be used only with balanced partitioning. 11890 11891@item lto-max-streaming-parallelism 11892Maximal number of parallel processes used for LTO streaming. 11893 11894@item cxx-max-namespaces-for-diagnostic-help 11895The maximum number of namespaces to consult for suggestions when C++ 11896name lookup fails for an identifier. 11897 11898@item sink-frequency-threshold 11899The maximum relative execution frequency (in percents) of the target block 11900relative to a statement's original block to allow statement sinking of a 11901statement. Larger numbers result in more aggressive statement sinking. 11902A small positive adjustment is applied for 11903statements with memory operands as those are even more profitable so sink. 11904 11905@item max-stores-to-sink 11906The maximum number of conditional store pairs that can be sunk. Set to 0 11907if either vectorization (@option{-ftree-vectorize}) or if-conversion 11908(@option{-ftree-loop-if-convert}) is disabled. 11909 11910@item allow-store-data-races 11911Allow optimizers to introduce new data races on stores. 11912Set to 1 to allow, otherwise to 0. 11913 11914@item case-values-threshold 11915The smallest number of different values for which it is best to use a 11916jump-table instead of a tree of conditional branches. If the value is 119170, use the default for the machine. 11918 11919@item tree-reassoc-width 11920Set the maximum number of instructions executed in parallel in 11921reassociated tree. This parameter overrides target dependent 11922heuristics used by default if has non zero value. 11923 11924@item sched-pressure-algorithm 11925Choose between the two available implementations of 11926@option{-fsched-pressure}. Algorithm 1 is the original implementation 11927and is the more likely to prevent instructions from being reordered. 11928Algorithm 2 was designed to be a compromise between the relatively 11929conservative approach taken by algorithm 1 and the rather aggressive 11930approach taken by the default scheduler. It relies more heavily on 11931having a regular register file and accurate register pressure classes. 11932See @file{haifa-sched.c} in the GCC sources for more details. 11933 11934The default choice depends on the target. 11935 11936@item max-slsr-cand-scan 11937Set the maximum number of existing candidates that are considered when 11938seeking a basis for a new straight-line strength reduction candidate. 11939 11940@item asan-globals 11941Enable buffer overflow detection for global objects. This kind 11942of protection is enabled by default if you are using 11943@option{-fsanitize=address} option. 11944To disable global objects protection use @option{--param asan-globals=0}. 11945 11946@item asan-stack 11947Enable buffer overflow detection for stack objects. This kind of 11948protection is enabled by default when using @option{-fsanitize=address}. 11949To disable stack protection use @option{--param asan-stack=0} option. 11950 11951@item asan-instrument-reads 11952Enable buffer overflow detection for memory reads. This kind of 11953protection is enabled by default when using @option{-fsanitize=address}. 11954To disable memory reads protection use 11955@option{--param asan-instrument-reads=0}. 11956 11957@item asan-instrument-writes 11958Enable buffer overflow detection for memory writes. This kind of 11959protection is enabled by default when using @option{-fsanitize=address}. 11960To disable memory writes protection use 11961@option{--param asan-instrument-writes=0} option. 11962 11963@item asan-memintrin 11964Enable detection for built-in functions. This kind of protection 11965is enabled by default when using @option{-fsanitize=address}. 11966To disable built-in functions protection use 11967@option{--param asan-memintrin=0}. 11968 11969@item asan-use-after-return 11970Enable detection of use-after-return. This kind of protection 11971is enabled by default when using the @option{-fsanitize=address} option. 11972To disable it use @option{--param asan-use-after-return=0}. 11973 11974Note: By default the check is disabled at run time. To enable it, 11975add @code{detect_stack_use_after_return=1} to the environment variable 11976@env{ASAN_OPTIONS}. 11977 11978@item asan-instrumentation-with-call-threshold 11979If number of memory accesses in function being instrumented 11980is greater or equal to this number, use callbacks instead of inline checks. 11981E.g. to disable inline code use 11982@option{--param asan-instrumentation-with-call-threshold=0}. 11983 11984@item use-after-scope-direct-emission-threshold 11985If the size of a local variable in bytes is smaller or equal to this 11986number, directly poison (or unpoison) shadow memory instead of using 11987run-time callbacks. 11988 11989@item max-fsm-thread-path-insns 11990Maximum number of instructions to copy when duplicating blocks on a 11991finite state automaton jump thread path. 11992 11993@item max-fsm-thread-length 11994Maximum number of basic blocks on a finite state automaton jump thread 11995path. 11996 11997@item max-fsm-thread-paths 11998Maximum number of new jump thread paths to create for a finite state 11999automaton. 12000 12001@item parloops-chunk-size 12002Chunk size of omp schedule for loops parallelized by parloops. 12003 12004@item parloops-schedule 12005Schedule type of omp schedule for loops parallelized by parloops (static, 12006dynamic, guided, auto, runtime). 12007 12008@item parloops-min-per-thread 12009The minimum number of iterations per thread of an innermost parallelized 12010loop for which the parallelized variant is preferred over the single threaded 12011one. Note that for a parallelized loop nest the 12012minimum number of iterations of the outermost loop per thread is two. 12013 12014@item max-ssa-name-query-depth 12015Maximum depth of recursion when querying properties of SSA names in things 12016like fold routines. One level of recursion corresponds to following a 12017use-def chain. 12018 12019@item hsa-gen-debug-stores 12020Enable emission of special debug stores within HSA kernels which are 12021then read and reported by libgomp plugin. Generation of these stores 12022is disabled by default, use @option{--param hsa-gen-debug-stores=1} to 12023enable it. 12024 12025@item max-speculative-devirt-maydefs 12026The maximum number of may-defs we analyze when looking for a must-def 12027specifying the dynamic type of an object that invokes a virtual call 12028we may be able to devirtualize speculatively. 12029 12030@item max-vrp-switch-assertions 12031The maximum number of assertions to add along the default edge of a switch 12032statement during VRP. 12033 12034@item unroll-jam-min-percent 12035The minimum percentage of memory references that must be optimized 12036away for the unroll-and-jam transformation to be considered profitable. 12037 12038@item unroll-jam-max-unroll 12039The maximum number of times the outer loop should be unrolled by 12040the unroll-and-jam transformation. 12041 12042@item max-rtl-if-conversion-unpredictable-cost 12043Maximum permissible cost for the sequence that would be generated 12044by the RTL if-conversion pass for a branch that is considered unpredictable. 12045 12046@item max-variable-expansions-in-unroller 12047If @option{-fvariable-expansion-in-unroller} is used, the maximum number 12048of times that an individual variable will be expanded during loop unrolling. 12049 12050@item tracer-min-branch-probability-feedback 12051Stop forward growth if the probability of best edge is less than 12052this threshold (in percent). Used when profile feedback is available. 12053 12054@item partial-inlining-entry-probability 12055Maximum probability of the entry BB of split region 12056(in percent relative to entry BB of the function) 12057to make partial inlining happen. 12058 12059@item max-tracked-strlens 12060Maximum number of strings for which strlen optimization pass will 12061track string lengths. 12062 12063@item gcse-after-reload-partial-fraction 12064The threshold ratio for performing partial redundancy 12065elimination after reload. 12066 12067@item gcse-after-reload-critical-fraction 12068The threshold ratio of critical edges execution count that 12069permit performing redundancy elimination after reload. 12070 12071@item max-loop-header-insns 12072The maximum number of insns in loop header duplicated 12073by the copy loop headers pass. 12074 12075@item vect-epilogues-nomask 12076Enable loop epilogue vectorization using smaller vector size. 12077 12078@item slp-max-insns-in-bb 12079Maximum number of instructions in basic block to be 12080considered for SLP vectorization. 12081 12082@item avoid-fma-max-bits 12083Maximum number of bits for which we avoid creating FMAs. 12084 12085@item sms-loop-average-count-threshold 12086A threshold on the average loop count considered by the swing modulo scheduler. 12087 12088@item sms-dfa-history 12089The number of cycles the swing modulo scheduler considers when checking 12090conflicts using DFA. 12091 12092@item hot-bb-count-fraction 12093Select fraction of the maximal count of repetitions of basic block 12094in program given basic block needs 12095to have to be considered hot (used in non-LTO mode) 12096 12097@item max-inline-insns-recursive-auto 12098The maximum number of instructions non-inline function 12099can grow to via recursive inlining. 12100 12101@item graphite-allow-codegen-errors 12102Whether codegen errors should be ICEs when @option{-fchecking}. 12103 12104@item sms-max-ii-factor 12105A factor for tuning the upper bound that swing modulo scheduler 12106uses for scheduling a loop. 12107 12108@item lra-max-considered-reload-pseudos 12109The max number of reload pseudos which are considered during 12110spilling a non-reload pseudo. 12111 12112@item max-pow-sqrt-depth 12113Maximum depth of sqrt chains to use when synthesizing exponentiation 12114by a real constant. 12115 12116@item max-dse-active-local-stores 12117Maximum number of active local stores in RTL dead store elimination. 12118 12119@item asan-instrument-allocas 12120Enable asan allocas/VLAs protection. 12121 12122@item max-iterations-computation-cost 12123Bound on the cost of an expression to compute the number of iterations. 12124 12125@item max-isl-operations 12126Maximum number of isl operations, 0 means unlimited. 12127 12128@item graphite-max-arrays-per-scop 12129Maximum number of arrays per scop. 12130 12131@item max-vartrack-reverse-op-size 12132Max. size of loc list for which reverse ops should be added. 12133 12134@item unlikely-bb-count-fraction 12135The minimum fraction of profile runs a given basic block execution count 12136must be not to be considered unlikely. 12137 12138@item tracer-dynamic-coverage-feedback 12139The percentage of function, weighted by execution frequency, 12140that must be covered by trace formation. 12141Used when profile feedback is available. 12142 12143@item max-inline-recursive-depth-auto 12144The maximum depth of recursive inlining for non-inline functions. 12145 12146@item fsm-scale-path-stmts 12147Scale factor to apply to the number of statements in a threading path 12148when comparing to the number of (scaled) blocks. 12149 12150@item fsm-maximum-phi-arguments 12151Maximum number of arguments a PHI may have before the FSM threader 12152will not try to thread through its block. 12153 12154@item uninit-control-dep-attempts 12155Maximum number of nested calls to search for control dependencies 12156during uninitialized variable analysis. 12157 12158@item indir-call-topn-profile 12159Track top N target addresses in indirect-call profile. 12160 12161@item max-once-peeled-insns 12162The maximum number of insns of a peeled loop that rolls only once. 12163 12164@item sra-max-scalarization-size-Osize 12165Maximum size, in storage units, of an aggregate 12166which should be considered for scalarization when compiling for size. 12167 12168@item fsm-scale-path-blocks 12169Scale factor to apply to the number of blocks in a threading path 12170when comparing to the number of (scaled) statements. 12171 12172@item sched-autopref-queue-depth 12173Hardware autoprefetcher scheduler model control flag. 12174Number of lookahead cycles the model looks into; at ' 12175' only enable instruction sorting heuristic. 12176 12177@item loop-versioning-max-inner-insns 12178The maximum number of instructions that an inner loop can have 12179before the loop versioning pass considers it too big to copy. 12180 12181@item loop-versioning-max-outer-insns 12182The maximum number of instructions that an outer loop can have 12183before the loop versioning pass considers it too big to copy, 12184discounting any instructions in inner loops that directly benefit 12185from versioning. 12186 12187@item ssa-name-def-chain-limit 12188The maximum number of SSA_NAME assignments to follow in determining 12189a property of a variable such as its value. This limits the number 12190of iterations or recursive calls GCC performs when optimizing certain 12191statements or when determining their validity prior to issuing 12192diagnostics. 12193 12194@end table 12195@end table 12196 12197@node Instrumentation Options 12198@section Program Instrumentation Options 12199@cindex instrumentation options 12200@cindex program instrumentation options 12201@cindex run-time error checking options 12202@cindex profiling options 12203@cindex options, program instrumentation 12204@cindex options, run-time error checking 12205@cindex options, profiling 12206 12207GCC supports a number of command-line options that control adding 12208run-time instrumentation to the code it normally generates. 12209For example, one purpose of instrumentation is collect profiling 12210statistics for use in finding program hot spots, code coverage 12211analysis, or profile-guided optimizations. 12212Another class of program instrumentation is adding run-time checking 12213to detect programming errors like invalid pointer 12214dereferences or out-of-bounds array accesses, as well as deliberately 12215hostile attacks such as stack smashing or C++ vtable hijacking. 12216There is also a general hook which can be used to implement other 12217forms of tracing or function-level instrumentation for debug or 12218program analysis purposes. 12219 12220@table @gcctabopt 12221@cindex @command{prof} 12222@cindex @command{gprof} 12223@item -p 12224@itemx -pg 12225@opindex p 12226@opindex pg 12227Generate extra code to write profile information suitable for the 12228analysis program @command{prof} (for @option{-p}) or @command{gprof} 12229(for @option{-pg}). You must use this option when compiling 12230the source files you want data about, and you must also use it when 12231linking. 12232 12233You can use the function attribute @code{no_instrument_function} to 12234suppress profiling of individual functions when compiling with these options. 12235@xref{Common Function Attributes}. 12236 12237@item -fprofile-arcs 12238@opindex fprofile-arcs 12239Add code so that program flow @dfn{arcs} are instrumented. During 12240execution the program records how many times each branch and call is 12241executed and how many times it is taken or returns. On targets that support 12242constructors with priority support, profiling properly handles constructors, 12243destructors and C++ constructors (and destructors) of classes which are used 12244as a type of a global variable. 12245 12246When the compiled 12247program exits it saves this data to a file called 12248@file{@var{auxname}.gcda} for each source file. The data may be used for 12249profile-directed optimizations (@option{-fbranch-probabilities}), or for 12250test coverage analysis (@option{-ftest-coverage}). Each object file's 12251@var{auxname} is generated from the name of the output file, if 12252explicitly specified and it is not the final executable, otherwise it is 12253the basename of the source file. In both cases any suffix is removed 12254(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 12255@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 12256@xref{Cross-profiling}. 12257 12258@cindex @command{gcov} 12259@item --coverage 12260@opindex coverage 12261 12262This option is used to compile and link code instrumented for coverage 12263analysis. The option is a synonym for @option{-fprofile-arcs} 12264@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 12265linking). See the documentation for those options for more details. 12266 12267@itemize 12268 12269@item 12270Compile the source files with @option{-fprofile-arcs} plus optimization 12271and code generation options. For test coverage analysis, use the 12272additional @option{-ftest-coverage} option. You do not need to profile 12273every source file in a program. 12274 12275@item 12276Compile the source files additionally with @option{-fprofile-abs-path} 12277to create absolute path names in the @file{.gcno} files. This allows 12278@command{gcov} to find the correct sources in projects where compilations 12279occur with different working directories. 12280 12281@item 12282Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 12283(the latter implies the former). 12284 12285@item 12286Run the program on a representative workload to generate the arc profile 12287information. This may be repeated any number of times. You can run 12288concurrent instances of your program, and provided that the file system 12289supports locking, the data files will be correctly updated. Unless 12290a strict ISO C dialect option is in effect, @code{fork} calls are 12291detected and correctly handled without double counting. 12292 12293@item 12294For profile-directed optimizations, compile the source files again with 12295the same optimization and code generation options plus 12296@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 12297Control Optimization}). 12298 12299@item 12300For test coverage analysis, use @command{gcov} to produce human readable 12301information from the @file{.gcno} and @file{.gcda} files. Refer to the 12302@command{gcov} documentation for further information. 12303 12304@end itemize 12305 12306With @option{-fprofile-arcs}, for each function of your program GCC 12307creates a program flow graph, then finds a spanning tree for the graph. 12308Only arcs that are not on the spanning tree have to be instrumented: the 12309compiler adds code to count the number of times that these arcs are 12310executed. When an arc is the only exit or only entrance to a block, the 12311instrumentation code can be added to the block; otherwise, a new basic 12312block must be created to hold the instrumentation code. 12313 12314@need 2000 12315@item -ftest-coverage 12316@opindex ftest-coverage 12317Produce a notes file that the @command{gcov} code-coverage utility 12318(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 12319show program coverage. Each source file's note file is called 12320@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 12321above for a description of @var{auxname} and instructions on how to 12322generate test coverage data. Coverage data matches the source files 12323more closely if you do not optimize. 12324 12325@item -fprofile-abs-path 12326@opindex fprofile-abs-path 12327Automatically convert relative source file names to absolute path names 12328in the @file{.gcno} files. This allows @command{gcov} to find the correct 12329sources in projects where compilations occur with different working 12330directories. 12331 12332@item -fprofile-dir=@var{path} 12333@opindex fprofile-dir 12334 12335Set the directory to search for the profile data files in to @var{path}. 12336This option affects only the profile data generated by 12337@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 12338and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 12339and its related options. Both absolute and relative paths can be used. 12340By default, GCC uses the current directory as @var{path}, thus the 12341profile data file appears in the same directory as the object file. 12342In order to prevent the file name clashing, if the object file name is 12343not an absolute path, we mangle the absolute path of the 12344@file{@var{sourcename}.gcda} file and use it as the file name of a 12345@file{.gcda} file. 12346 12347When an executable is run in a massive parallel environment, it is recommended 12348to save profile to different folders. That can be done with variables 12349in @var{path} that are exported during run-time: 12350 12351@table @gcctabopt 12352 12353@item %p 12354process ID. 12355 12356@item %q@{VAR@} 12357value of environment variable @var{VAR} 12358 12359@end table 12360 12361@item -fprofile-generate 12362@itemx -fprofile-generate=@var{path} 12363@opindex fprofile-generate 12364 12365Enable options usually used for instrumenting application to produce 12366profile useful for later recompilation with profile feedback based 12367optimization. You must use @option{-fprofile-generate} both when 12368compiling and when linking your program. 12369 12370The following options are enabled: 12371@option{-fprofile-arcs}, @option{-fprofile-values}, 12372@option{-finline-functions}, and @option{-fipa-bit-cp}. 12373 12374If @var{path} is specified, GCC looks at the @var{path} to find 12375the profile feedback data files. See @option{-fprofile-dir}. 12376 12377To optimize the program based on the collected profile information, use 12378@option{-fprofile-use}. @xref{Optimize Options}, for more information. 12379 12380@item -fprofile-update=@var{method} 12381@opindex fprofile-update 12382 12383Alter the update method for an application instrumented for profile 12384feedback based optimization. The @var{method} argument should be one of 12385@samp{single}, @samp{atomic} or @samp{prefer-atomic}. 12386The first one is useful for single-threaded applications, 12387while the second one prevents profile corruption by emitting thread-safe code. 12388 12389@strong{Warning:} When an application does not properly join all threads 12390(or creates an detached thread), a profile file can be still corrupted. 12391 12392Using @samp{prefer-atomic} would be transformed either to @samp{atomic}, 12393when supported by a target, or to @samp{single} otherwise. The GCC driver 12394automatically selects @samp{prefer-atomic} when @option{-pthread} 12395is present in the command line. 12396 12397@item -fprofile-filter-files=@var{regex} 12398@opindex fprofile-filter-files 12399 12400Instrument only functions from files where names match 12401any regular expression (separated by a semi-colon). 12402 12403For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument 12404only @file{main.c} and all C files starting with 'module'. 12405 12406@item -fprofile-exclude-files=@var{regex} 12407@opindex fprofile-exclude-files 12408 12409Instrument only functions from files where names do not match 12410all the regular expressions (separated by a semi-colon). 12411 12412For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation 12413of all files that are located in @file{/usr/} folder. 12414 12415@item -fsanitize=address 12416@opindex fsanitize=address 12417Enable AddressSanitizer, a fast memory error detector. 12418Memory access instructions are instrumented to detect 12419out-of-bounds and use-after-free bugs. 12420The option enables @option{-fsanitize-address-use-after-scope}. 12421See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 12422more details. The run-time behavior can be influenced using the 12423@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 12424the available options are shown at startup of the instrumented program. See 12425@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 12426for a list of supported options. 12427The option cannot be combined with @option{-fsanitize=thread}. 12428 12429@item -fsanitize=kernel-address 12430@opindex fsanitize=kernel-address 12431Enable AddressSanitizer for Linux kernel. 12432See @uref{https://github.com/google/kasan/wiki} for more details. 12433 12434@item -fsanitize=pointer-compare 12435@opindex fsanitize=pointer-compare 12436Instrument comparison operation (<, <=, >, >=) with pointer operands. 12437The option must be combined with either @option{-fsanitize=kernel-address} or 12438@option{-fsanitize=address} 12439The option cannot be combined with @option{-fsanitize=thread}. 12440Note: By default the check is disabled at run time. To enable it, 12441add @code{detect_invalid_pointer_pairs=2} to the environment variable 12442@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 12443invalid operation only when both pointers are non-null. 12444 12445@item -fsanitize=pointer-subtract 12446@opindex fsanitize=pointer-subtract 12447Instrument subtraction with pointer operands. 12448The option must be combined with either @option{-fsanitize=kernel-address} or 12449@option{-fsanitize=address} 12450The option cannot be combined with @option{-fsanitize=thread}. 12451Note: By default the check is disabled at run time. To enable it, 12452add @code{detect_invalid_pointer_pairs=2} to the environment variable 12453@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 12454invalid operation only when both pointers are non-null. 12455 12456@item -fsanitize=thread 12457@opindex fsanitize=thread 12458Enable ThreadSanitizer, a fast data race detector. 12459Memory access instructions are instrumented to detect 12460data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 12461details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 12462environment variable; see 12463@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 12464supported options. 12465The option cannot be combined with @option{-fsanitize=address}, 12466@option{-fsanitize=leak}. 12467 12468Note that sanitized atomic builtins cannot throw exceptions when 12469operating on invalid memory addresses with non-call exceptions 12470(@option{-fnon-call-exceptions}). 12471 12472@item -fsanitize=leak 12473@opindex fsanitize=leak 12474Enable LeakSanitizer, a memory leak detector. 12475This option only matters for linking of executables and 12476the executable is linked against a library that overrides @code{malloc} 12477and other allocator functions. See 12478@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 12479details. The run-time behavior can be influenced using the 12480@env{LSAN_OPTIONS} environment variable. 12481The option cannot be combined with @option{-fsanitize=thread}. 12482 12483@item -fsanitize=undefined 12484@opindex fsanitize=undefined 12485Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 12486Various computations are instrumented to detect undefined behavior 12487at runtime. Current suboptions are: 12488 12489@table @gcctabopt 12490 12491@item -fsanitize=shift 12492@opindex fsanitize=shift 12493This option enables checking that the result of a shift operation is 12494not undefined. Note that what exactly is considered undefined differs 12495slightly between C and C++, as well as between ISO C90 and C99, etc. 12496This option has two suboptions, @option{-fsanitize=shift-base} and 12497@option{-fsanitize=shift-exponent}. 12498 12499@item -fsanitize=shift-exponent 12500@opindex fsanitize=shift-exponent 12501This option enables checking that the second argument of a shift operation 12502is not negative and is smaller than the precision of the promoted first 12503argument. 12504 12505@item -fsanitize=shift-base 12506@opindex fsanitize=shift-base 12507If the second argument of a shift operation is within range, check that the 12508result of a shift operation is not undefined. Note that what exactly is 12509considered undefined differs slightly between C and C++, as well as between 12510ISO C90 and C99, etc. 12511 12512@item -fsanitize=integer-divide-by-zero 12513@opindex fsanitize=integer-divide-by-zero 12514Detect integer division by zero as well as @code{INT_MIN / -1} division. 12515 12516@item -fsanitize=unreachable 12517@opindex fsanitize=unreachable 12518With this option, the compiler turns the @code{__builtin_unreachable} 12519call into a diagnostics message call instead. When reaching the 12520@code{__builtin_unreachable} call, the behavior is undefined. 12521 12522@item -fsanitize=vla-bound 12523@opindex fsanitize=vla-bound 12524This option instructs the compiler to check that the size of a variable 12525length array is positive. 12526 12527@item -fsanitize=null 12528@opindex fsanitize=null 12529This option enables pointer checking. Particularly, the application 12530built with this option turned on will issue an error message when it 12531tries to dereference a NULL pointer, or if a reference (possibly an 12532rvalue reference) is bound to a NULL pointer, or if a method is invoked 12533on an object pointed by a NULL pointer. 12534 12535@item -fsanitize=return 12536@opindex fsanitize=return 12537This option enables return statement checking. Programs 12538built with this option turned on will issue an error message 12539when the end of a non-void function is reached without actually 12540returning a value. This option works in C++ only. 12541 12542@item -fsanitize=signed-integer-overflow 12543@opindex fsanitize=signed-integer-overflow 12544This option enables signed integer overflow checking. We check that 12545the result of @code{+}, @code{*}, and both unary and binary @code{-} 12546does not overflow in the signed arithmetics. Note, integer promotion 12547rules must be taken into account. That is, the following is not an 12548overflow: 12549@smallexample 12550signed char a = SCHAR_MAX; 12551a++; 12552@end smallexample 12553 12554@item -fsanitize=bounds 12555@opindex fsanitize=bounds 12556This option enables instrumentation of array bounds. Various out of bounds 12557accesses are detected. Flexible array members, flexible array member-like 12558arrays, and initializers of variables with static storage are not instrumented. 12559 12560@item -fsanitize=bounds-strict 12561@opindex fsanitize=bounds-strict 12562This option enables strict instrumentation of array bounds. Most out of bounds 12563accesses are detected, including flexible array members and flexible array 12564member-like arrays. Initializers of variables with static storage are not 12565instrumented. 12566 12567@item -fsanitize=alignment 12568@opindex fsanitize=alignment 12569 12570This option enables checking of alignment of pointers when they are 12571dereferenced, or when a reference is bound to insufficiently aligned target, 12572or when a method or constructor is invoked on insufficiently aligned object. 12573 12574@item -fsanitize=object-size 12575@opindex fsanitize=object-size 12576This option enables instrumentation of memory references using the 12577@code{__builtin_object_size} function. Various out of bounds pointer 12578accesses are detected. 12579 12580@item -fsanitize=float-divide-by-zero 12581@opindex fsanitize=float-divide-by-zero 12582Detect floating-point division by zero. Unlike other similar options, 12583@option{-fsanitize=float-divide-by-zero} is not enabled by 12584@option{-fsanitize=undefined}, since floating-point division by zero can 12585be a legitimate way of obtaining infinities and NaNs. 12586 12587@item -fsanitize=float-cast-overflow 12588@opindex fsanitize=float-cast-overflow 12589This option enables floating-point type to integer conversion checking. 12590We check that the result of the conversion does not overflow. 12591Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 12592not enabled by @option{-fsanitize=undefined}. 12593This option does not work well with @code{FE_INVALID} exceptions enabled. 12594 12595@item -fsanitize=nonnull-attribute 12596@opindex fsanitize=nonnull-attribute 12597 12598This option enables instrumentation of calls, checking whether null values 12599are not passed to arguments marked as requiring a non-null value by the 12600@code{nonnull} function attribute. 12601 12602@item -fsanitize=returns-nonnull-attribute 12603@opindex fsanitize=returns-nonnull-attribute 12604 12605This option enables instrumentation of return statements in functions 12606marked with @code{returns_nonnull} function attribute, to detect returning 12607of null values from such functions. 12608 12609@item -fsanitize=bool 12610@opindex fsanitize=bool 12611 12612This option enables instrumentation of loads from bool. If a value other 12613than 0/1 is loaded, a run-time error is issued. 12614 12615@item -fsanitize=enum 12616@opindex fsanitize=enum 12617 12618This option enables instrumentation of loads from an enum type. If 12619a value outside the range of values for the enum type is loaded, 12620a run-time error is issued. 12621 12622@item -fsanitize=vptr 12623@opindex fsanitize=vptr 12624 12625This option enables instrumentation of C++ member function calls, member 12626accesses and some conversions between pointers to base and derived classes, 12627to verify the referenced object has the correct dynamic type. 12628 12629@item -fsanitize=pointer-overflow 12630@opindex fsanitize=pointer-overflow 12631 12632This option enables instrumentation of pointer arithmetics. If the pointer 12633arithmetics overflows, a run-time error is issued. 12634 12635@item -fsanitize=builtin 12636@opindex fsanitize=builtin 12637 12638This option enables instrumentation of arguments to selected builtin 12639functions. If an invalid value is passed to such arguments, a run-time 12640error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz} 12641or @code{__builtin_clz} invokes undefined behavior and is diagnosed 12642by this option. 12643 12644@end table 12645 12646While @option{-ftrapv} causes traps for signed overflows to be emitted, 12647@option{-fsanitize=undefined} gives a diagnostic message. 12648This currently works only for the C family of languages. 12649 12650@item -fno-sanitize=all 12651@opindex fno-sanitize=all 12652 12653This option disables all previously enabled sanitizers. 12654@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 12655together. 12656 12657@item -fasan-shadow-offset=@var{number} 12658@opindex fasan-shadow-offset 12659This option forces GCC to use custom shadow offset in AddressSanitizer checks. 12660It is useful for experimenting with different shadow memory layouts in 12661Kernel AddressSanitizer. 12662 12663@item -fsanitize-sections=@var{s1},@var{s2},... 12664@opindex fsanitize-sections 12665Sanitize global variables in selected user-defined sections. @var{si} may 12666contain wildcards. 12667 12668@item -fsanitize-recover@r{[}=@var{opts}@r{]} 12669@opindex fsanitize-recover 12670@opindex fno-sanitize-recover 12671@option{-fsanitize-recover=} controls error recovery mode for sanitizers 12672mentioned in comma-separated list of @var{opts}. Enabling this option 12673for a sanitizer component causes it to attempt to continue 12674running the program as if no error happened. This means multiple 12675runtime errors can be reported in a single program run, and the exit 12676code of the program may indicate success even when errors 12677have been reported. The @option{-fno-sanitize-recover=} option 12678can be used to alter 12679this behavior: only the first detected error is reported 12680and program then exits with a non-zero exit code. 12681 12682Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 12683except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 12684@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero}, 12685@option{-fsanitize=bounds-strict}, 12686@option{-fsanitize=kernel-address} and @option{-fsanitize=address}. 12687For these sanitizers error recovery is turned on by default, 12688except @option{-fsanitize=address}, for which this feature is experimental. 12689@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 12690accepted, the former enables recovery for all sanitizers that support it, 12691the latter disables recovery for all sanitizers that support it. 12692 12693Even if a recovery mode is turned on the compiler side, it needs to be also 12694enabled on the runtime library side, otherwise the failures are still fatal. 12695The runtime library defaults to @code{halt_on_error=0} for 12696ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for 12697AddressSanitizer is @code{halt_on_error=1}. This can be overridden through 12698setting the @code{halt_on_error} flag in the corresponding environment variable. 12699 12700Syntax without an explicit @var{opts} parameter is deprecated. It is 12701equivalent to specifying an @var{opts} list of: 12702 12703@smallexample 12704undefined,float-cast-overflow,float-divide-by-zero,bounds-strict 12705@end smallexample 12706 12707@item -fsanitize-address-use-after-scope 12708@opindex fsanitize-address-use-after-scope 12709Enable sanitization of local variables to detect use-after-scope bugs. 12710The option sets @option{-fstack-reuse} to @samp{none}. 12711 12712@item -fsanitize-undefined-trap-on-error 12713@opindex fsanitize-undefined-trap-on-error 12714The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 12715report undefined behavior using @code{__builtin_trap} rather than 12716a @code{libubsan} library routine. The advantage of this is that the 12717@code{libubsan} library is not needed and is not linked in, so this 12718is usable even in freestanding environments. 12719 12720@item -fsanitize-coverage=trace-pc 12721@opindex fsanitize-coverage=trace-pc 12722Enable coverage-guided fuzzing code instrumentation. 12723Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block. 12724 12725@item -fsanitize-coverage=trace-cmp 12726@opindex fsanitize-coverage=trace-cmp 12727Enable dataflow guided fuzzing code instrumentation. 12728Inserts a call to @code{__sanitizer_cov_trace_cmp1}, 12729@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or 12730@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands 12731variable or @code{__sanitizer_cov_trace_const_cmp1}, 12732@code{__sanitizer_cov_trace_const_cmp2}, 12733@code{__sanitizer_cov_trace_const_cmp4} or 12734@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one 12735operand constant, @code{__sanitizer_cov_trace_cmpf} or 12736@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and 12737@code{__sanitizer_cov_trace_switch} for switch statements. 12738 12739@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} 12740@opindex fcf-protection 12741Enable code instrumentation of control-flow transfers to increase 12742program security by checking that target addresses of control-flow 12743transfer instructions (such as indirect function call, function return, 12744indirect jump) are valid. This prevents diverting the flow of control 12745to an unexpected target. This is intended to protect against such 12746threats as Return-oriented Programming (ROP), and similarly 12747call/jmp-oriented programming (COP/JOP). 12748 12749The value @code{branch} tells the compiler to implement checking of 12750validity of control-flow transfer at the point of indirect branch 12751instructions, i.e.@: call/jmp instructions. The value @code{return} 12752implements checking of validity at the point of returning from a 12753function. The value @code{full} is an alias for specifying both 12754@code{branch} and @code{return}. The value @code{none} turns off 12755instrumentation. 12756 12757The macro @code{__CET__} is defined when @option{-fcf-protection} is 12758used. The first bit of @code{__CET__} is set to 1 for the value 12759@code{branch} and the second bit of @code{__CET__} is set to 1 for 12760the @code{return}. 12761 12762You can also use the @code{nocf_check} attribute to identify 12763which functions and calls should be skipped from instrumentation 12764(@pxref{Function Attributes}). 12765 12766Currently the x86 GNU/Linux target provides an implementation based 12767on Intel Control-flow Enforcement Technology (CET). 12768 12769@item -fstack-protector 12770@opindex fstack-protector 12771Emit extra code to check for buffer overflows, such as stack smashing 12772attacks. This is done by adding a guard variable to functions with 12773vulnerable objects. This includes functions that call @code{alloca}, and 12774functions with buffers larger than 8 bytes. The guards are initialized 12775when a function is entered and then checked when the function exits. 12776If a guard check fails, an error message is printed and the program exits. 12777 12778@item -fstack-protector-all 12779@opindex fstack-protector-all 12780Like @option{-fstack-protector} except that all functions are protected. 12781 12782@item -fstack-protector-strong 12783@opindex fstack-protector-strong 12784Like @option{-fstack-protector} but includes additional functions to 12785be protected --- those that have local array definitions, or have 12786references to local frame addresses. 12787 12788@item -fstack-protector-explicit 12789@opindex fstack-protector-explicit 12790Like @option{-fstack-protector} but only protects those functions which 12791have the @code{stack_protect} attribute. 12792 12793@item -fstack-check 12794@opindex fstack-check 12795Generate code to verify that you do not go beyond the boundary of the 12796stack. You should specify this flag if you are running in an 12797environment with multiple threads, but you only rarely need to specify it in 12798a single-threaded environment since stack overflow is automatically 12799detected on nearly all systems if there is only one stack. 12800 12801Note that this switch does not actually cause checking to be done; the 12802operating system or the language runtime must do that. The switch causes 12803generation of code to ensure that they see the stack being extended. 12804 12805You can additionally specify a string parameter: @samp{no} means no 12806checking, @samp{generic} means force the use of old-style checking, 12807@samp{specific} means use the best checking method and is equivalent 12808to bare @option{-fstack-check}. 12809 12810Old-style checking is a generic mechanism that requires no specific 12811target support in the compiler but comes with the following drawbacks: 12812 12813@enumerate 12814@item 12815Modified allocation strategy for large objects: they are always 12816allocated dynamically if their size exceeds a fixed threshold. Note this 12817may change the semantics of some code. 12818 12819@item 12820Fixed limit on the size of the static frame of functions: when it is 12821topped by a particular function, stack checking is not reliable and 12822a warning is issued by the compiler. 12823 12824@item 12825Inefficiency: because of both the modified allocation strategy and the 12826generic implementation, code performance is hampered. 12827@end enumerate 12828 12829Note that old-style stack checking is also the fallback method for 12830@samp{specific} if no target support has been added in the compiler. 12831 12832@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion 12833and stack overflows. @samp{specific} is an excellent choice when compiling 12834Ada code. It is not generally sufficient to protect against stack-clash 12835attacks. To protect against those you want @samp{-fstack-clash-protection}. 12836 12837@item -fstack-clash-protection 12838@opindex fstack-clash-protection 12839Generate code to prevent stack clash style attacks. When this option is 12840enabled, the compiler will only allocate one page of stack space at a time 12841and each page is accessed immediately after allocation. Thus, it prevents 12842allocations from jumping over any stack guard page provided by the 12843operating system. 12844 12845Most targets do not fully support stack clash protection. However, on 12846those targets @option{-fstack-clash-protection} will protect dynamic stack 12847allocations. @option{-fstack-clash-protection} may also provide limited 12848protection for static stack allocations if the target supports 12849@option{-fstack-check=specific}. 12850 12851@item -fstack-limit-register=@var{reg} 12852@itemx -fstack-limit-symbol=@var{sym} 12853@itemx -fno-stack-limit 12854@opindex fstack-limit-register 12855@opindex fstack-limit-symbol 12856@opindex fno-stack-limit 12857Generate code to ensure that the stack does not grow beyond a certain value, 12858either the value of a register or the address of a symbol. If a larger 12859stack is required, a signal is raised at run time. For most targets, 12860the signal is raised before the stack overruns the boundary, so 12861it is possible to catch the signal without taking special precautions. 12862 12863For instance, if the stack starts at absolute address @samp{0x80000000} 12864and grows downwards, you can use the flags 12865@option{-fstack-limit-symbol=__stack_limit} and 12866@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 12867of 128KB@. Note that this may only work with the GNU linker. 12868 12869You can locally override stack limit checking by using the 12870@code{no_stack_limit} function attribute (@pxref{Function Attributes}). 12871 12872@item -fsplit-stack 12873@opindex fsplit-stack 12874Generate code to automatically split the stack before it overflows. 12875The resulting program has a discontiguous stack which can only 12876overflow if the program is unable to allocate any more memory. This 12877is most useful when running threaded programs, as it is no longer 12878necessary to calculate a good stack size to use for each thread. This 12879is currently only implemented for the x86 targets running 12880GNU/Linux. 12881 12882When code compiled with @option{-fsplit-stack} calls code compiled 12883without @option{-fsplit-stack}, there may not be much stack space 12884available for the latter code to run. If compiling all code, 12885including library code, with @option{-fsplit-stack} is not an option, 12886then the linker can fix up these calls so that the code compiled 12887without @option{-fsplit-stack} always has a large stack. Support for 12888this is implemented in the gold linker in GNU binutils release 2.21 12889and later. 12890 12891@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 12892@opindex fvtable-verify 12893This option is only available when compiling C++ code. 12894It turns on (or off, if using @option{-fvtable-verify=none}) the security 12895feature that verifies at run time, for every virtual call, that 12896the vtable pointer through which the call is made is valid for the type of 12897the object, and has not been corrupted or overwritten. If an invalid vtable 12898pointer is detected at run time, an error is reported and execution of the 12899program is immediately halted. 12900 12901This option causes run-time data structures to be built at program startup, 12902which are used for verifying the vtable pointers. 12903The options @samp{std} and @samp{preinit} 12904control the timing of when these data structures are built. In both cases the 12905data structures are built before execution reaches @code{main}. Using 12906@option{-fvtable-verify=std} causes the data structures to be built after 12907shared libraries have been loaded and initialized. 12908@option{-fvtable-verify=preinit} causes them to be built before shared 12909libraries have been loaded and initialized. 12910 12911If this option appears multiple times in the command line with different 12912values specified, @samp{none} takes highest priority over both @samp{std} and 12913@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 12914 12915@item -fvtv-debug 12916@opindex fvtv-debug 12917When used in conjunction with @option{-fvtable-verify=std} or 12918@option{-fvtable-verify=preinit}, causes debug versions of the 12919runtime functions for the vtable verification feature to be called. 12920This flag also causes the compiler to log information about which 12921vtable pointers it finds for each class. 12922This information is written to a file named @file{vtv_set_ptr_data.log} 12923in the directory named by the environment variable @env{VTV_LOGS_DIR} 12924if that is defined or the current working directory otherwise. 12925 12926Note: This feature @emph{appends} data to the log file. If you want a fresh log 12927file, be sure to delete any existing one. 12928 12929@item -fvtv-counts 12930@opindex fvtv-counts 12931This is a debugging flag. When used in conjunction with 12932@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 12933causes the compiler to keep track of the total number of virtual calls 12934it encounters and the number of verifications it inserts. It also 12935counts the number of calls to certain run-time library functions 12936that it inserts and logs this information for each compilation unit. 12937The compiler writes this information to a file named 12938@file{vtv_count_data.log} in the directory named by the environment 12939variable @env{VTV_LOGS_DIR} if that is defined or the current working 12940directory otherwise. It also counts the size of the vtable pointer sets 12941for each class, and writes this information to @file{vtv_class_set_sizes.log} 12942in the same directory. 12943 12944Note: This feature @emph{appends} data to the log files. To get fresh log 12945files, be sure to delete any existing ones. 12946 12947@item -finstrument-functions 12948@opindex finstrument-functions 12949Generate instrumentation calls for entry and exit to functions. Just 12950after function entry and just before function exit, the following 12951profiling functions are called with the address of the current 12952function and its call site. (On some platforms, 12953@code{__builtin_return_address} does not work beyond the current 12954function, so the call site information may not be available to the 12955profiling functions otherwise.) 12956 12957@smallexample 12958void __cyg_profile_func_enter (void *this_fn, 12959 void *call_site); 12960void __cyg_profile_func_exit (void *this_fn, 12961 void *call_site); 12962@end smallexample 12963 12964The first argument is the address of the start of the current function, 12965which may be looked up exactly in the symbol table. 12966 12967This instrumentation is also done for functions expanded inline in other 12968functions. The profiling calls indicate where, conceptually, the 12969inline function is entered and exited. This means that addressable 12970versions of such functions must be available. If all your uses of a 12971function are expanded inline, this may mean an additional expansion of 12972code size. If you use @code{extern inline} in your C code, an 12973addressable version of such functions must be provided. (This is 12974normally the case anyway, but if you get lucky and the optimizer always 12975expands the functions inline, you might have gotten away without 12976providing static copies.) 12977 12978A function may be given the attribute @code{no_instrument_function}, in 12979which case this instrumentation is not done. This can be used, for 12980example, for the profiling functions listed above, high-priority 12981interrupt routines, and any functions from which the profiling functions 12982cannot safely be called (perhaps signal handlers, if the profiling 12983routines generate output or allocate memory). 12984@xref{Common Function Attributes}. 12985 12986@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 12987@opindex finstrument-functions-exclude-file-list 12988 12989Set the list of functions that are excluded from instrumentation (see 12990the description of @option{-finstrument-functions}). If the file that 12991contains a function definition matches with one of @var{file}, then 12992that function is not instrumented. The match is done on substrings: 12993if the @var{file} parameter is a substring of the file name, it is 12994considered to be a match. 12995 12996For example: 12997 12998@smallexample 12999-finstrument-functions-exclude-file-list=/bits/stl,include/sys 13000@end smallexample 13001 13002@noindent 13003excludes any inline function defined in files whose pathnames 13004contain @file{/bits/stl} or @file{include/sys}. 13005 13006If, for some reason, you want to include letter @samp{,} in one of 13007@var{sym}, write @samp{\,}. For example, 13008@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 13009(note the single quote surrounding the option). 13010 13011@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 13012@opindex finstrument-functions-exclude-function-list 13013 13014This is similar to @option{-finstrument-functions-exclude-file-list}, 13015but this option sets the list of function names to be excluded from 13016instrumentation. The function name to be matched is its user-visible 13017name, such as @code{vector<int> blah(const vector<int> &)}, not the 13018internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 13019match is done on substrings: if the @var{sym} parameter is a substring 13020of the function name, it is considered to be a match. For C99 and C++ 13021extended identifiers, the function name must be given in UTF-8, not 13022using universal character names. 13023 13024@item -fpatchable-function-entry=@var{N}[,@var{M}] 13025@opindex fpatchable-function-entry 13026Generate @var{N} NOPs right at the beginning 13027of each function, with the function entry point before the @var{M}th NOP. 13028If @var{M} is omitted, it defaults to @code{0} so the 13029function entry points to the address just at the first NOP. 13030The NOP instructions reserve extra space which can be used to patch in 13031any desired instrumentation at run time, provided that the code segment 13032is writable. The amount of space is controllable indirectly via 13033the number of NOPs; the NOP instruction used corresponds to the instruction 13034emitted by the internal GCC back-end interface @code{gen_nop}. This behavior 13035is target-specific and may also depend on the architecture variant and/or 13036other compilation options. 13037 13038For run-time identification, the starting addresses of these areas, 13039which correspond to their respective function entries minus @var{M}, 13040are additionally collected in the @code{__patchable_function_entries} 13041section of the resulting binary. 13042 13043Note that the value of @code{__attribute__ ((patchable_function_entry 13044(N,M)))} takes precedence over command-line option 13045@option{-fpatchable-function-entry=N,M}. This can be used to increase 13046the area size or to remove it completely on a single function. 13047If @code{N=0}, no pad location is recorded. 13048 13049The NOP instructions are inserted at---and maybe before, depending on 13050@var{M}---the function entry address, even before the prologue. 13051 13052@end table 13053 13054 13055@node Preprocessor Options 13056@section Options Controlling the Preprocessor 13057@cindex preprocessor options 13058@cindex options, preprocessor 13059 13060These options control the C preprocessor, which is run on each C source 13061file before actual compilation. 13062 13063If you use the @option{-E} option, nothing is done except preprocessing. 13064Some of these options make sense only together with @option{-E} because 13065they cause the preprocessor output to be unsuitable for actual 13066compilation. 13067 13068In addition to the options listed here, there are a number of options 13069to control search paths for include files documented in 13070@ref{Directory Options}. 13071Options to control preprocessor diagnostics are listed in 13072@ref{Warning Options}. 13073 13074@table @gcctabopt 13075@include cppopts.texi 13076 13077@item -Wp,@var{option} 13078@opindex Wp 13079You can use @option{-Wp,@var{option}} to bypass the compiler driver 13080and pass @var{option} directly through to the preprocessor. If 13081@var{option} contains commas, it is split into multiple options at the 13082commas. However, many options are modified, translated or interpreted 13083by the compiler driver before being passed to the preprocessor, and 13084@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 13085interface is undocumented and subject to change, so whenever possible 13086you should avoid using @option{-Wp} and let the driver handle the 13087options instead. 13088 13089@item -Xpreprocessor @var{option} 13090@opindex Xpreprocessor 13091Pass @var{option} as an option to the preprocessor. You can use this to 13092supply system-specific preprocessor options that GCC does not 13093recognize. 13094 13095If you want to pass an option that takes an argument, you must use 13096@option{-Xpreprocessor} twice, once for the option and once for the argument. 13097 13098@item -no-integrated-cpp 13099@opindex no-integrated-cpp 13100Perform preprocessing as a separate pass before compilation. 13101By default, GCC performs preprocessing as an integrated part of 13102input tokenization and parsing. 13103If this option is provided, the appropriate language front end 13104(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 13105and Objective-C, respectively) is instead invoked twice, 13106once for preprocessing only and once for actual compilation 13107of the preprocessed input. 13108This option may be useful in conjunction with the @option{-B} or 13109@option{-wrapper} options to specify an alternate preprocessor or 13110perform additional processing of the program source between 13111normal preprocessing and compilation. 13112 13113@end table 13114 13115@node Assembler Options 13116@section Passing Options to the Assembler 13117 13118@c prevent bad page break with this line 13119You can pass options to the assembler. 13120 13121@table @gcctabopt 13122@item -Wa,@var{option} 13123@opindex Wa 13124Pass @var{option} as an option to the assembler. If @var{option} 13125contains commas, it is split into multiple options at the commas. 13126 13127@item -Xassembler @var{option} 13128@opindex Xassembler 13129Pass @var{option} as an option to the assembler. You can use this to 13130supply system-specific assembler options that GCC does not 13131recognize. 13132 13133If you want to pass an option that takes an argument, you must use 13134@option{-Xassembler} twice, once for the option and once for the argument. 13135 13136@end table 13137 13138@node Link Options 13139@section Options for Linking 13140@cindex link options 13141@cindex options, linking 13142 13143These options come into play when the compiler links object files into 13144an executable output file. They are meaningless if the compiler is 13145not doing a link step. 13146 13147@table @gcctabopt 13148@cindex file names 13149@item @var{object-file-name} 13150A file name that does not end in a special recognized suffix is 13151considered to name an object file or library. (Object files are 13152distinguished from libraries by the linker according to the file 13153contents.) If linking is done, these object files are used as input 13154to the linker. 13155 13156@item -c 13157@itemx -S 13158@itemx -E 13159@opindex c 13160@opindex S 13161@opindex E 13162If any of these options is used, then the linker is not run, and 13163object file names should not be used as arguments. @xref{Overall 13164Options}. 13165 13166@item -flinker-output=@var{type} 13167@opindex flinker-output 13168This option controls the code generation of the link time optimizer. By 13169default the linker output is determined by the linker plugin automatically. For 13170debugging the compiler and in the case of incremental linking to non-lto object 13171file is desired, it may be useful to control the type manually. 13172 13173If @var{type} is @samp{exec} the code generation is configured to produce static 13174binary. In this case @option{-fpic} and @option{-fpie} are both disabled. 13175 13176If @var{type} is @samp{dyn} the code generation is configured to produce shared 13177library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not 13178enabled automatically. This makes it possible to build shared libraries without 13179position independent code on architectures this is possible, i.e.@: on x86. 13180 13181If @var{type} is @samp{pie} the code generation is configured to produce 13182@option{-fpie} executable. This result in similar optimizations as @samp{exec} 13183except that @option{-fpie} is not disabled if specified at compilation time. 13184 13185If @var{type} is @samp{rel} the compiler assumes that incremental linking is 13186done. The sections containing intermediate code for link-time optimization are 13187merged, pre-optimized, and output to the resulting object file. In addition, if 13188@option{-ffat-lto-objects} is specified the binary code is produced for future 13189non-lto linking. The object file produced by incremental linking will be smaller 13190than a static library produced from the same object files. At link-time the 13191result of incremental linking will also load faster to compiler than a static 13192library assuming that majority of objects in the library are used. 13193 13194Finally @samp{nolto-rel} configure compiler to for incremental linking where 13195code generation is forced, final binary is produced and the intermediate code 13196for later link-time optimization is stripped. When multiple object files are 13197linked together the resulting code will be optimized better than with link time 13198optimizations disabled (for example, the cross-module inlining will happen), 13199most of benefits of whole program optimizations are however lost. 13200 13201During the incremental link (by @option{-r}) the linker plugin will default to 13202@option{rel}. With current interfaces to GNU Binutils it is however not 13203possible to link incrementally LTO objects and non-LTO objects into a single 13204mixed object file. In the case any of object files in incremental link cannot 13205be used for link-time optimization the linker plugin will output warning and 13206use @samp{nolto-rel}. To maintain the whole program optimization it is 13207recommended to link such objects into static library instead. Alternatively it 13208is possible to use H.J. Lu's binutils with support for mixed objects. 13209 13210@item -fuse-ld=bfd 13211@opindex fuse-ld=bfd 13212Use the @command{bfd} linker instead of the default linker. 13213 13214@item -fuse-ld=gold 13215@opindex fuse-ld=gold 13216Use the @command{gold} linker instead of the default linker. 13217 13218@item -fuse-ld=lld 13219@opindex fuse-ld=lld 13220Use the LLVM @command{lld} linker instead of the default linker. 13221 13222@cindex Libraries 13223@item -l@var{library} 13224@itemx -l @var{library} 13225@opindex l 13226Search the library named @var{library} when linking. (The second 13227alternative with the library as a separate argument is only for 13228POSIX compliance and is not recommended.) 13229 13230The @option{-l} option is passed directly to the linker by GCC. Refer 13231to your linker documentation for exact details. The general 13232description below applies to the GNU linker. 13233 13234The linker searches a standard list of directories for the library. 13235The directories searched include several standard system directories 13236plus any that you specify with @option{-L}. 13237 13238Static libraries are archives of object files, and have file names 13239like @file{lib@var{library}.a}. Some targets also support shared 13240libraries, which typically have names like @file{lib@var{library}.so}. 13241If both static and shared libraries are found, the linker gives 13242preference to linking with the shared library unless the 13243@option{-static} option is used. 13244 13245It makes a difference where in the command you write this option; the 13246linker searches and processes libraries and object files in the order they 13247are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 13248after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 13249to functions in @samp{z}, those functions may not be loaded. 13250 13251@item -lobjc 13252@opindex lobjc 13253You need this special case of the @option{-l} option in order to 13254link an Objective-C or Objective-C++ program. 13255 13256@item -nostartfiles 13257@opindex nostartfiles 13258Do not use the standard system startup files when linking. 13259The standard system libraries are used normally, unless @option{-nostdlib}, 13260@option{-nolibc}, or @option{-nodefaultlibs} is used. 13261 13262@item -nodefaultlibs 13263@opindex nodefaultlibs 13264Do not use the standard system libraries when linking. 13265Only the libraries you specify are passed to the linker, and options 13266specifying linkage of the system libraries, such as @option{-static-libgcc} 13267or @option{-shared-libgcc}, are ignored. 13268The standard startup files are used normally, unless @option{-nostartfiles} 13269is used. 13270 13271The compiler may generate calls to @code{memcmp}, 13272@code{memset}, @code{memcpy} and @code{memmove}. 13273These entries are usually resolved by entries in 13274libc. These entry points should be supplied through some other 13275mechanism when this option is specified. 13276 13277@item -nolibc 13278@opindex nolibc 13279Do not use the C library or system libraries tightly coupled with it when 13280linking. Still link with the startup files, @file{libgcc} or toolchain 13281provided language support libraries such as @file{libgnat}, @file{libgfortran} 13282or @file{libstdc++} unless options preventing their inclusion are used as 13283well. This typically removes @option{-lc} from the link command line, as well 13284as system libraries that normally go with it and become meaningless when 13285absence of a C library is assumed, for example @option{-lpthread} or 13286@option{-lm} in some configurations. This is intended for bare-board 13287targets when there is indeed no C library available. 13288 13289@item -nostdlib 13290@opindex nostdlib 13291Do not use the standard system startup files or libraries when linking. 13292No startup files and only the libraries you specify are passed to 13293the linker, and options specifying linkage of the system libraries, such as 13294@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 13295 13296The compiler may generate calls to @code{memcmp}, @code{memset}, 13297@code{memcpy} and @code{memmove}. 13298These entries are usually resolved by entries in 13299libc. These entry points should be supplied through some other 13300mechanism when this option is specified. 13301 13302@cindex @option{-lgcc}, use with @option{-nostdlib} 13303@cindex @option{-nostdlib} and unresolved references 13304@cindex unresolved references and @option{-nostdlib} 13305@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 13306@cindex @option{-nodefaultlibs} and unresolved references 13307@cindex unresolved references and @option{-nodefaultlibs} 13308One of the standard libraries bypassed by @option{-nostdlib} and 13309@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 13310which GCC uses to overcome shortcomings of particular machines, or special 13311needs for some languages. 13312(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 13313Collection (GCC) Internals}, 13314for more discussion of @file{libgcc.a}.) 13315In most cases, you need @file{libgcc.a} even when you want to avoid 13316other standard libraries. In other words, when you specify @option{-nostdlib} 13317or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 13318This ensures that you have no unresolved references to internal GCC 13319library subroutines. 13320(An example of such an internal subroutine is @code{__main}, used to ensure C++ 13321constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 13322GNU Compiler Collection (GCC) Internals}.) 13323 13324@item -e @var{entry} 13325@itemx --entry=@var{entry} 13326@opindex e 13327@opindex entry 13328 13329Specify that the program entry point is @var{entry}. The argument is 13330interpreted by the linker; the GNU linker accepts either a symbol name 13331or an address. 13332 13333@item -pie 13334@opindex pie 13335Produce a dynamically linked position independent executable on targets 13336that support it. For predictable results, you must also specify the same 13337set of options used for compilation (@option{-fpie}, @option{-fPIE}, 13338or model suboptions) when you specify this linker option. 13339 13340@item -no-pie 13341@opindex no-pie 13342Don't produce a dynamically linked position independent executable. 13343 13344@item -static-pie 13345@opindex static-pie 13346Produce a static position independent executable on targets that support 13347it. A static position independent executable is similar to a static 13348executable, but can be loaded at any address without a dynamic linker. 13349For predictable results, you must also specify the same set of options 13350used for compilation (@option{-fpie}, @option{-fPIE}, or model 13351suboptions) when you specify this linker option. 13352 13353@item -pthread 13354@opindex pthread 13355Link with the POSIX threads library. This option is supported on 13356GNU/Linux targets, most other Unix derivatives, and also on 13357x86 Cygwin and MinGW targets. On some targets this option also sets 13358flags for the preprocessor, so it should be used consistently for both 13359compilation and linking. 13360 13361@item -r 13362@opindex r 13363Produce a relocatable object as output. This is also known as partial 13364linking. 13365 13366@item -rdynamic 13367@opindex rdynamic 13368Pass the flag @option{-export-dynamic} to the ELF linker, on targets 13369that support it. This instructs the linker to add all symbols, not 13370only used ones, to the dynamic symbol table. This option is needed 13371for some uses of @code{dlopen} or to allow obtaining backtraces 13372from within a program. 13373 13374@item -s 13375@opindex s 13376Remove all symbol table and relocation information from the executable. 13377 13378@item -static 13379@opindex static 13380On systems that support dynamic linking, this overrides @option{-pie} 13381and prevents linking with the shared libraries. On other systems, this 13382option has no effect. 13383 13384@item -shared 13385@opindex shared 13386Produce a shared object which can then be linked with other objects to 13387form an executable. Not all systems support this option. For predictable 13388results, you must also specify the same set of options used for compilation 13389(@option{-fpic}, @option{-fPIC}, or model suboptions) when 13390you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 13391needs to build supplementary stub code for constructors to work. On 13392multi-libbed systems, @samp{gcc -shared} must select the correct support 13393libraries to link against. Failing to supply the correct flags may lead 13394to subtle defects. Supplying them in cases where they are not necessary 13395is innocuous.} 13396 13397@item -shared-libgcc 13398@itemx -static-libgcc 13399@opindex shared-libgcc 13400@opindex static-libgcc 13401On systems that provide @file{libgcc} as a shared library, these options 13402force the use of either the shared or static version, respectively. 13403If no shared version of @file{libgcc} was built when the compiler was 13404configured, these options have no effect. 13405 13406There are several situations in which an application should use the 13407shared @file{libgcc} instead of the static version. The most common 13408of these is when the application wishes to throw and catch exceptions 13409across different shared libraries. In that case, each of the libraries 13410as well as the application itself should use the shared @file{libgcc}. 13411 13412Therefore, the G++ driver automatically adds @option{-shared-libgcc} 13413whenever you build a shared library or a main executable, because C++ 13414programs typically use exceptions, so this is the right thing to do. 13415 13416If, instead, you use the GCC driver to create shared libraries, you may 13417find that they are not always linked with the shared @file{libgcc}. 13418If GCC finds, at its configuration time, that you have a non-GNU linker 13419or a GNU linker that does not support option @option{--eh-frame-hdr}, 13420it links the shared version of @file{libgcc} into shared libraries 13421by default. Otherwise, it takes advantage of the linker and optimizes 13422away the linking with the shared version of @file{libgcc}, linking with 13423the static version of libgcc by default. This allows exceptions to 13424propagate through such shared libraries, without incurring relocation 13425costs at library load time. 13426 13427However, if a library or main executable is supposed to throw or catch 13428exceptions, you must link it using the G++ driver, or using the option 13429@option{-shared-libgcc}, such that it is linked with the shared 13430@file{libgcc}. 13431 13432@item -static-libasan 13433@opindex static-libasan 13434When the @option{-fsanitize=address} option is used to link a program, 13435the GCC driver automatically links against @option{libasan}. If 13436@file{libasan} is available as a shared library, and the @option{-static} 13437option is not used, then this links against the shared version of 13438@file{libasan}. The @option{-static-libasan} option directs the GCC 13439driver to link @file{libasan} statically, without necessarily linking 13440other libraries statically. 13441 13442@item -static-libtsan 13443@opindex static-libtsan 13444When the @option{-fsanitize=thread} option is used to link a program, 13445the GCC driver automatically links against @option{libtsan}. If 13446@file{libtsan} is available as a shared library, and the @option{-static} 13447option is not used, then this links against the shared version of 13448@file{libtsan}. The @option{-static-libtsan} option directs the GCC 13449driver to link @file{libtsan} statically, without necessarily linking 13450other libraries statically. 13451 13452@item -static-liblsan 13453@opindex static-liblsan 13454When the @option{-fsanitize=leak} option is used to link a program, 13455the GCC driver automatically links against @option{liblsan}. If 13456@file{liblsan} is available as a shared library, and the @option{-static} 13457option is not used, then this links against the shared version of 13458@file{liblsan}. The @option{-static-liblsan} option directs the GCC 13459driver to link @file{liblsan} statically, without necessarily linking 13460other libraries statically. 13461 13462@item -static-libubsan 13463@opindex static-libubsan 13464When the @option{-fsanitize=undefined} option is used to link a program, 13465the GCC driver automatically links against @option{libubsan}. If 13466@file{libubsan} is available as a shared library, and the @option{-static} 13467option is not used, then this links against the shared version of 13468@file{libubsan}. The @option{-static-libubsan} option directs the GCC 13469driver to link @file{libubsan} statically, without necessarily linking 13470other libraries statically. 13471 13472@item -static-libstdc++ 13473@opindex static-libstdc++ 13474When the @command{g++} program is used to link a C++ program, it 13475normally automatically links against @option{libstdc++}. If 13476@file{libstdc++} is available as a shared library, and the 13477@option{-static} option is not used, then this links against the 13478shared version of @file{libstdc++}. That is normally fine. However, it 13479is sometimes useful to freeze the version of @file{libstdc++} used by 13480the program without going all the way to a fully static link. The 13481@option{-static-libstdc++} option directs the @command{g++} driver to 13482link @file{libstdc++} statically, without necessarily linking other 13483libraries statically. 13484 13485@item -symbolic 13486@opindex symbolic 13487Bind references to global symbols when building a shared object. Warn 13488about any unresolved references (unless overridden by the link editor 13489option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 13490this option. 13491 13492@item -T @var{script} 13493@opindex T 13494@cindex linker script 13495Use @var{script} as the linker script. This option is supported by most 13496systems using the GNU linker. On some targets, such as bare-board 13497targets without an operating system, the @option{-T} option may be required 13498when linking to avoid references to undefined symbols. 13499 13500@item -Xlinker @var{option} 13501@opindex Xlinker 13502Pass @var{option} as an option to the linker. You can use this to 13503supply system-specific linker options that GCC does not recognize. 13504 13505If you want to pass an option that takes a separate argument, you must use 13506@option{-Xlinker} twice, once for the option and once for the argument. 13507For example, to pass @option{-assert definitions}, you must write 13508@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 13509@option{-Xlinker "-assert definitions"}, because this passes the entire 13510string as a single argument, which is not what the linker expects. 13511 13512When using the GNU linker, it is usually more convenient to pass 13513arguments to linker options using the @option{@var{option}=@var{value}} 13514syntax than as separate arguments. For example, you can specify 13515@option{-Xlinker -Map=output.map} rather than 13516@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 13517this syntax for command-line options. 13518 13519@item -Wl,@var{option} 13520@opindex Wl 13521Pass @var{option} as an option to the linker. If @var{option} contains 13522commas, it is split into multiple options at the commas. You can use this 13523syntax to pass an argument to the option. 13524For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 13525linker. When using the GNU linker, you can also get the same effect with 13526@option{-Wl,-Map=output.map}. 13527 13528@item -u @var{symbol} 13529@opindex u 13530Pretend the symbol @var{symbol} is undefined, to force linking of 13531library modules to define it. You can use @option{-u} multiple times with 13532different symbols to force loading of additional library modules. 13533 13534@item -z @var{keyword} 13535@opindex z 13536@option{-z} is passed directly on to the linker along with the keyword 13537@var{keyword}. See the section in the documentation of your linker for 13538permitted values and their meanings. 13539@end table 13540 13541@node Directory Options 13542@section Options for Directory Search 13543@cindex directory options 13544@cindex options, directory search 13545@cindex search path 13546 13547These options specify directories to search for header files, for 13548libraries and for parts of the compiler: 13549 13550@table @gcctabopt 13551@include cppdiropts.texi 13552 13553@item -iplugindir=@var{dir} 13554@opindex iplugindir= 13555Set the directory to search for plugins that are passed 13556by @option{-fplugin=@var{name}} instead of 13557@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 13558to be used by the user, but only passed by the driver. 13559 13560@item -L@var{dir} 13561@opindex L 13562Add directory @var{dir} to the list of directories to be searched 13563for @option{-l}. 13564 13565@item -B@var{prefix} 13566@opindex B 13567This option specifies where to find the executables, libraries, 13568include files, and data files of the compiler itself. 13569 13570The compiler driver program runs one or more of the subprograms 13571@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 13572@var{prefix} as a prefix for each program it tries to run, both with and 13573without @samp{@var{machine}/@var{version}/} for the corresponding target 13574machine and compiler version. 13575 13576For each subprogram to be run, the compiler driver first tries the 13577@option{-B} prefix, if any. If that name is not found, or if @option{-B} 13578is not specified, the driver tries two standard prefixes, 13579@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 13580those results in a file name that is found, the unmodified program 13581name is searched for using the directories specified in your 13582@env{PATH} environment variable. 13583 13584The compiler checks to see if the path provided by @option{-B} 13585refers to a directory, and if necessary it adds a directory 13586separator character at the end of the path. 13587 13588@option{-B} prefixes that effectively specify directory names also apply 13589to libraries in the linker, because the compiler translates these 13590options into @option{-L} options for the linker. They also apply to 13591include files in the preprocessor, because the compiler translates these 13592options into @option{-isystem} options for the preprocessor. In this case, 13593the compiler appends @samp{include} to the prefix. 13594 13595The runtime support file @file{libgcc.a} can also be searched for using 13596the @option{-B} prefix, if needed. If it is not found there, the two 13597standard prefixes above are tried, and that is all. The file is left 13598out of the link if it is not found by those means. 13599 13600Another way to specify a prefix much like the @option{-B} prefix is to use 13601the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 13602Variables}. 13603 13604As a special kludge, if the path provided by @option{-B} is 13605@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 136069, then it is replaced by @file{[dir/]include}. This is to help 13607with boot-strapping the compiler. 13608 13609@item -no-canonical-prefixes 13610@opindex no-canonical-prefixes 13611Do not expand any symbolic links, resolve references to @samp{/../} 13612or @samp{/./}, or make the path absolute when generating a relative 13613prefix. 13614 13615@item --sysroot=@var{dir} 13616@opindex sysroot 13617Use @var{dir} as the logical root directory for headers and libraries. 13618For example, if the compiler normally searches for headers in 13619@file{/usr/include} and libraries in @file{/usr/lib}, it instead 13620searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 13621 13622If you use both this option and the @option{-isysroot} option, then 13623the @option{--sysroot} option applies to libraries, but the 13624@option{-isysroot} option applies to header files. 13625 13626The GNU linker (beginning with version 2.16) has the necessary support 13627for this option. If your linker does not support this option, the 13628header file aspect of @option{--sysroot} still works, but the 13629library aspect does not. 13630 13631@item --no-sysroot-suffix 13632@opindex no-sysroot-suffix 13633For some targets, a suffix is added to the root directory specified 13634with @option{--sysroot}, depending on the other options used, so that 13635headers may for example be found in 13636@file{@var{dir}/@var{suffix}/usr/include} instead of 13637@file{@var{dir}/usr/include}. This option disables the addition of 13638such a suffix. 13639 13640@end table 13641 13642@node Code Gen Options 13643@section Options for Code Generation Conventions 13644@cindex code generation conventions 13645@cindex options, code generation 13646@cindex run-time options 13647 13648These machine-independent options control the interface conventions 13649used in code generation. 13650 13651Most of them have both positive and negative forms; the negative form 13652of @option{-ffoo} is @option{-fno-foo}. In the table below, only 13653one of the forms is listed---the one that is not the default. You 13654can figure out the other form by either removing @samp{no-} or adding 13655it. 13656 13657@table @gcctabopt 13658@item -fstack-reuse=@var{reuse-level} 13659@opindex fstack_reuse 13660This option controls stack space reuse for user declared local/auto variables 13661and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 13662@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 13663local variables and temporaries, @samp{named_vars} enables the reuse only for 13664user defined local variables with names, and @samp{none} disables stack reuse 13665completely. The default value is @samp{all}. The option is needed when the 13666program extends the lifetime of a scoped local variable or a compiler generated 13667temporary beyond the end point defined by the language. When a lifetime of 13668a variable ends, and if the variable lives in memory, the optimizing compiler 13669has the freedom to reuse its stack space with other temporaries or scoped 13670local variables whose live range does not overlap with it. Legacy code extending 13671local lifetime is likely to break with the stack reuse optimization. 13672 13673For example, 13674 13675@smallexample 13676 int *p; 13677 @{ 13678 int local1; 13679 13680 p = &local1; 13681 local1 = 10; 13682 .... 13683 @} 13684 @{ 13685 int local2; 13686 local2 = 20; 13687 ... 13688 @} 13689 13690 if (*p == 10) // out of scope use of local1 13691 @{ 13692 13693 @} 13694@end smallexample 13695 13696Another example: 13697@smallexample 13698 13699 struct A 13700 @{ 13701 A(int k) : i(k), j(k) @{ @} 13702 int i; 13703 int j; 13704 @}; 13705 13706 A *ap; 13707 13708 void foo(const A& ar) 13709 @{ 13710 ap = &ar; 13711 @} 13712 13713 void bar() 13714 @{ 13715 foo(A(10)); // temp object's lifetime ends when foo returns 13716 13717 @{ 13718 A a(20); 13719 .... 13720 @} 13721 ap->i+= 10; // ap references out of scope temp whose space 13722 // is reused with a. What is the value of ap->i? 13723 @} 13724 13725@end smallexample 13726 13727The lifetime of a compiler generated temporary is well defined by the C++ 13728standard. When a lifetime of a temporary ends, and if the temporary lives 13729in memory, the optimizing compiler has the freedom to reuse its stack 13730space with other temporaries or scoped local variables whose live range 13731does not overlap with it. However some of the legacy code relies on 13732the behavior of older compilers in which temporaries' stack space is 13733not reused, the aggressive stack reuse can lead to runtime errors. This 13734option is used to control the temporary stack reuse optimization. 13735 13736@item -ftrapv 13737@opindex ftrapv 13738This option generates traps for signed overflow on addition, subtraction, 13739multiplication operations. 13740The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 13741@option{-ftrapv} @option{-fwrapv} on the command-line results in 13742@option{-fwrapv} being effective. Note that only active options override, so 13743using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 13744results in @option{-ftrapv} being effective. 13745 13746@item -fwrapv 13747@opindex fwrapv 13748This option instructs the compiler to assume that signed arithmetic 13749overflow of addition, subtraction and multiplication wraps around 13750using twos-complement representation. This flag enables some optimizations 13751and disables others. 13752The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 13753@option{-ftrapv} @option{-fwrapv} on the command-line results in 13754@option{-fwrapv} being effective. Note that only active options override, so 13755using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 13756results in @option{-ftrapv} being effective. 13757 13758@item -fwrapv-pointer 13759@opindex fwrapv-pointer 13760This option instructs the compiler to assume that pointer arithmetic 13761overflow on addition and subtraction wraps around using twos-complement 13762representation. This flag disables some optimizations which assume 13763pointer overflow is invalid. 13764 13765@item -fstrict-overflow 13766@opindex fstrict-overflow 13767This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when 13768negated implies @option{-fwrapv} @option{-fwrapv-pointer}. 13769 13770@item -fexceptions 13771@opindex fexceptions 13772Enable exception handling. Generates extra code needed to propagate 13773exceptions. For some targets, this implies GCC generates frame 13774unwind information for all functions, which can produce significant data 13775size overhead, although it does not affect execution. If you do not 13776specify this option, GCC enables it by default for languages like 13777C++ that normally require exception handling, and disables it for 13778languages like C that do not normally require it. However, you may need 13779to enable this option when compiling C code that needs to interoperate 13780properly with exception handlers written in C++. You may also wish to 13781disable this option if you are compiling older C++ programs that don't 13782use exception handling. 13783 13784@item -fnon-call-exceptions 13785@opindex fnon-call-exceptions 13786Generate code that allows trapping instructions to throw exceptions. 13787Note that this requires platform-specific runtime support that does 13788not exist everywhere. Moreover, it only allows @emph{trapping} 13789instructions to throw exceptions, i.e.@: memory references or floating-point 13790instructions. It does not allow exceptions to be thrown from 13791arbitrary signal handlers such as @code{SIGALRM}. 13792 13793@item -fdelete-dead-exceptions 13794@opindex fdelete-dead-exceptions 13795Consider that instructions that may throw exceptions but don't otherwise 13796contribute to the execution of the program can be optimized away. 13797This option is enabled by default for the Ada front end, as permitted by 13798the Ada language specification. 13799Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 13800 13801@item -funwind-tables 13802@opindex funwind-tables 13803Similar to @option{-fexceptions}, except that it just generates any needed 13804static data, but does not affect the generated code in any other way. 13805You normally do not need to enable this option; instead, a language processor 13806that needs this handling enables it on your behalf. 13807 13808@item -fasynchronous-unwind-tables 13809@opindex fasynchronous-unwind-tables 13810Generate unwind table in DWARF format, if supported by target machine. The 13811table is exact at each instruction boundary, so it can be used for stack 13812unwinding from asynchronous events (such as debugger or garbage collector). 13813 13814@item -fno-gnu-unique 13815@opindex fno-gnu-unique 13816@opindex fgnu-unique 13817On systems with recent GNU assembler and C library, the C++ compiler 13818uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 13819of template static data members and static local variables in inline 13820functions are unique even in the presence of @code{RTLD_LOCAL}; this 13821is necessary to avoid problems with a library used by two different 13822@code{RTLD_LOCAL} plugins depending on a definition in one of them and 13823therefore disagreeing with the other one about the binding of the 13824symbol. But this causes @code{dlclose} to be ignored for affected 13825DSOs; if your program relies on reinitialization of a DSO via 13826@code{dlclose} and @code{dlopen}, you can use 13827@option{-fno-gnu-unique}. 13828 13829@item -fpcc-struct-return 13830@opindex fpcc-struct-return 13831Return ``short'' @code{struct} and @code{union} values in memory like 13832longer ones, rather than in registers. This convention is less 13833efficient, but it has the advantage of allowing intercallability between 13834GCC-compiled files and files compiled with other compilers, particularly 13835the Portable C Compiler (pcc). 13836 13837The precise convention for returning structures in memory depends 13838on the target configuration macros. 13839 13840Short structures and unions are those whose size and alignment match 13841that of some integer type. 13842 13843@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13844switch is not binary compatible with code compiled with the 13845@option{-freg-struct-return} switch. 13846Use it to conform to a non-default application binary interface. 13847 13848@item -freg-struct-return 13849@opindex freg-struct-return 13850Return @code{struct} and @code{union} values in registers when possible. 13851This is more efficient for small structures than 13852@option{-fpcc-struct-return}. 13853 13854If you specify neither @option{-fpcc-struct-return} nor 13855@option{-freg-struct-return}, GCC defaults to whichever convention is 13856standard for the target. If there is no standard convention, GCC 13857defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13858the principal compiler. In those cases, we can choose the standard, and 13859we chose the more efficient register return alternative. 13860 13861@strong{Warning:} code compiled with the @option{-freg-struct-return} 13862switch is not binary compatible with code compiled with the 13863@option{-fpcc-struct-return} switch. 13864Use it to conform to a non-default application binary interface. 13865 13866@item -fshort-enums 13867@opindex fshort-enums 13868Allocate to an @code{enum} type only as many bytes as it needs for the 13869declared range of possible values. Specifically, the @code{enum} type 13870is equivalent to the smallest integer type that has enough room. 13871 13872@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13873code that is not binary compatible with code generated without that switch. 13874Use it to conform to a non-default application binary interface. 13875 13876@item -fshort-wchar 13877@opindex fshort-wchar 13878Override the underlying type for @code{wchar_t} to be @code{short 13879unsigned int} instead of the default for the target. This option is 13880useful for building programs to run under WINE@. 13881 13882@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13883code that is not binary compatible with code generated without that switch. 13884Use it to conform to a non-default application binary interface. 13885 13886@item -fno-common 13887@opindex fno-common 13888@opindex fcommon 13889@cindex tentative definitions 13890In C code, this option controls the placement of global variables 13891defined without an initializer, known as @dfn{tentative definitions} 13892in the C standard. Tentative definitions are distinct from declarations 13893of a variable with the @code{extern} keyword, which do not allocate storage. 13894 13895Unix C compilers have traditionally allocated storage for 13896uninitialized global variables in a common block. This allows the 13897linker to resolve all tentative definitions of the same variable 13898in different compilation units to the same object, or to a non-tentative 13899definition. 13900This is the behavior specified by @option{-fcommon}, and is the default for 13901GCC on most targets. 13902On the other hand, this behavior is not required by ISO 13903C, and on some targets may carry a speed or code size penalty on 13904variable references. 13905 13906The @option{-fno-common} option specifies that the compiler should instead 13907place uninitialized global variables in the BSS section of the object file. 13908This inhibits the merging of tentative definitions by the linker so 13909you get a multiple-definition error if the same 13910variable is defined in more than one compilation unit. 13911Compiling with @option{-fno-common} is useful on targets for which 13912it provides better performance, or if you wish to verify that the 13913program will work on other systems that always treat uninitialized 13914variable definitions this way. 13915 13916@item -fno-ident 13917@opindex fno-ident 13918@opindex fident 13919Ignore the @code{#ident} directive. 13920 13921@item -finhibit-size-directive 13922@opindex finhibit-size-directive 13923Don't output a @code{.size} assembler directive, or anything else that 13924would cause trouble if the function is split in the middle, and the 13925two halves are placed at locations far apart in memory. This option is 13926used when compiling @file{crtstuff.c}; you should not need to use it 13927for anything else. 13928 13929@item -fverbose-asm 13930@opindex fverbose-asm 13931Put extra commentary information in the generated assembly code to 13932make it more readable. This option is generally only of use to those 13933who actually need to read the generated assembly code (perhaps while 13934debugging the compiler itself). 13935 13936@option{-fno-verbose-asm}, the default, causes the 13937extra information to be omitted and is useful when comparing two assembler 13938files. 13939 13940The added comments include: 13941 13942@itemize @bullet 13943 13944@item 13945information on the compiler version and command-line options, 13946 13947@item 13948the source code lines associated with the assembly instructions, 13949in the form FILENAME:LINENUMBER:CONTENT OF LINE, 13950 13951@item 13952hints on which high-level expressions correspond to 13953the various assembly instruction operands. 13954 13955@end itemize 13956 13957For example, given this C source file: 13958 13959@smallexample 13960int test (int n) 13961@{ 13962 int i; 13963 int total = 0; 13964 13965 for (i = 0; i < n; i++) 13966 total += i * i; 13967 13968 return total; 13969@} 13970@end smallexample 13971 13972compiling to (x86_64) assembly via @option{-S} and emitting the result 13973direct to stdout via @option{-o} @option{-} 13974 13975@smallexample 13976gcc -S test.c -fverbose-asm -Os -o - 13977@end smallexample 13978 13979gives output similar to this: 13980 13981@smallexample 13982 .file "test.c" 13983# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu) 13984 [...snip...] 13985# options passed: 13986 [...snip...] 13987 13988 .text 13989 .globl test 13990 .type test, @@function 13991test: 13992.LFB0: 13993 .cfi_startproc 13994# test.c:4: int total = 0; 13995 xorl %eax, %eax # <retval> 13996# test.c:6: for (i = 0; i < n; i++) 13997 xorl %edx, %edx # i 13998.L2: 13999# test.c:6: for (i = 0; i < n; i++) 14000 cmpl %edi, %edx # n, i 14001 jge .L5 #, 14002# test.c:7: total += i * i; 14003 movl %edx, %ecx # i, tmp92 14004 imull %edx, %ecx # i, tmp92 14005# test.c:6: for (i = 0; i < n; i++) 14006 incl %edx # i 14007# test.c:7: total += i * i; 14008 addl %ecx, %eax # tmp92, <retval> 14009 jmp .L2 # 14010.L5: 14011# test.c:10: @} 14012 ret 14013 .cfi_endproc 14014.LFE0: 14015 .size test, .-test 14016 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)" 14017 .section .note.GNU-stack,"",@@progbits 14018@end smallexample 14019 14020The comments are intended for humans rather than machines and hence the 14021precise format of the comments is subject to change. 14022 14023@item -frecord-gcc-switches 14024@opindex frecord-gcc-switches 14025This switch causes the command line used to invoke the 14026compiler to be recorded into the object file that is being created. 14027This switch is only implemented on some targets and the exact format 14028of the recording is target and binary file format dependent, but it 14029usually takes the form of a section containing ASCII text. This 14030switch is related to the @option{-fverbose-asm} switch, but that 14031switch only records information in the assembler output file as 14032comments, so it never reaches the object file. 14033See also @option{-grecord-gcc-switches} for another 14034way of storing compiler options into the object file. 14035 14036@item -fpic 14037@opindex fpic 14038@cindex global offset table 14039@cindex PIC 14040Generate position-independent code (PIC) suitable for use in a shared 14041library, if supported for the target machine. Such code accesses all 14042constant addresses through a global offset table (GOT)@. The dynamic 14043loader resolves the GOT entries when the program starts (the dynamic 14044loader is not part of GCC; it is part of the operating system). If 14045the GOT size for the linked executable exceeds a machine-specific 14046maximum size, you get an error message from the linker indicating that 14047@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 14048instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k 14049on the m68k and RS/6000. The x86 has no such limit.) 14050 14051Position-independent code requires special support, and therefore works 14052only on certain machines. For the x86, GCC supports PIC for System V 14053but not for the Sun 386i. Code generated for the IBM RS/6000 is always 14054position-independent. 14055 14056When this flag is set, the macros @code{__pic__} and @code{__PIC__} 14057are defined to 1. 14058 14059@item -fPIC 14060@opindex fPIC 14061If supported for the target machine, emit position-independent code, 14062suitable for dynamic linking and avoiding any limit on the size of the 14063global offset table. This option makes a difference on AArch64, m68k, 14064PowerPC and SPARC@. 14065 14066Position-independent code requires special support, and therefore works 14067only on certain machines. 14068 14069When this flag is set, the macros @code{__pic__} and @code{__PIC__} 14070are defined to 2. 14071 14072@item -fpie 14073@itemx -fPIE 14074@opindex fpie 14075@opindex fPIE 14076These options are similar to @option{-fpic} and @option{-fPIC}, but the 14077generated position-independent code can be only linked into executables. 14078Usually these options are used to compile code that will be linked using 14079the @option{-pie} GCC option. 14080 14081@option{-fpie} and @option{-fPIE} both define the macros 14082@code{__pie__} and @code{__PIE__}. The macros have the value 1 14083for @option{-fpie} and 2 for @option{-fPIE}. 14084 14085@item -fno-plt 14086@opindex fno-plt 14087@opindex fplt 14088Do not use the PLT for external function calls in position-independent code. 14089Instead, load the callee address at call sites from the GOT and branch to it. 14090This leads to more efficient code by eliminating PLT stubs and exposing 14091GOT loads to optimizations. On architectures such as 32-bit x86 where 14092PLT stubs expect the GOT pointer in a specific register, this gives more 14093register allocation freedom to the compiler. 14094Lazy binding requires use of the PLT; 14095with @option{-fno-plt} all external symbols are resolved at load time. 14096 14097Alternatively, the function attribute @code{noplt} can be used to avoid calls 14098through the PLT for specific external functions. 14099 14100In position-dependent code, a few targets also convert calls to 14101functions that are marked to not use the PLT to use the GOT instead. 14102 14103@item -fno-jump-tables 14104@opindex fno-jump-tables 14105@opindex fjump-tables 14106Do not use jump tables for switch statements even where it would be 14107more efficient than other code generation strategies. This option is 14108of use in conjunction with @option{-fpic} or @option{-fPIC} for 14109building code that forms part of a dynamic linker and cannot 14110reference the address of a jump table. On some targets, jump tables 14111do not require a GOT and this option is not needed. 14112 14113@item -ffixed-@var{reg} 14114@opindex ffixed 14115Treat the register named @var{reg} as a fixed register; generated code 14116should never refer to it (except perhaps as a stack pointer, frame 14117pointer or in some other fixed role). 14118 14119@var{reg} must be the name of a register. The register names accepted 14120are machine-specific and are defined in the @code{REGISTER_NAMES} 14121macro in the machine description macro file. 14122 14123This flag does not have a negative form, because it specifies a 14124three-way choice. 14125 14126@item -fcall-used-@var{reg} 14127@opindex fcall-used 14128Treat the register named @var{reg} as an allocable register that is 14129clobbered by function calls. It may be allocated for temporaries or 14130variables that do not live across a call. Functions compiled this way 14131do not save and restore the register @var{reg}. 14132 14133It is an error to use this flag with the frame pointer or stack pointer. 14134Use of this flag for other registers that have fixed pervasive roles in 14135the machine's execution model produces disastrous results. 14136 14137This flag does not have a negative form, because it specifies a 14138three-way choice. 14139 14140@item -fcall-saved-@var{reg} 14141@opindex fcall-saved 14142Treat the register named @var{reg} as an allocable register saved by 14143functions. It may be allocated even for temporaries or variables that 14144live across a call. Functions compiled this way save and restore 14145the register @var{reg} if they use it. 14146 14147It is an error to use this flag with the frame pointer or stack pointer. 14148Use of this flag for other registers that have fixed pervasive roles in 14149the machine's execution model produces disastrous results. 14150 14151A different sort of disaster results from the use of this flag for 14152a register in which function values may be returned. 14153 14154This flag does not have a negative form, because it specifies a 14155three-way choice. 14156 14157@item -fpack-struct[=@var{n}] 14158@opindex fpack-struct 14159Without a value specified, pack all structure members together without 14160holes. When a value is specified (which must be a small power of two), pack 14161structure members according to this value, representing the maximum 14162alignment (that is, objects with default alignment requirements larger than 14163this are output potentially unaligned at the next fitting location. 14164 14165@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 14166code that is not binary compatible with code generated without that switch. 14167Additionally, it makes the code suboptimal. 14168Use it to conform to a non-default application binary interface. 14169 14170@item -fleading-underscore 14171@opindex fleading-underscore 14172This option and its counterpart, @option{-fno-leading-underscore}, forcibly 14173change the way C symbols are represented in the object file. One use 14174is to help link with legacy assembly code. 14175 14176@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 14177generate code that is not binary compatible with code generated without that 14178switch. Use it to conform to a non-default application binary interface. 14179Not all targets provide complete support for this switch. 14180 14181@item -ftls-model=@var{model} 14182@opindex ftls-model 14183Alter the thread-local storage model to be used (@pxref{Thread-Local}). 14184The @var{model} argument should be one of @samp{global-dynamic}, 14185@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 14186Note that the choice is subject to optimization: the compiler may use 14187a more efficient model for symbols not visible outside of the translation 14188unit, or if @option{-fpic} is not given on the command line. 14189 14190The default without @option{-fpic} is @samp{initial-exec}; with 14191@option{-fpic} the default is @samp{global-dynamic}. 14192 14193@item -ftrampolines 14194@opindex ftrampolines 14195For targets that normally need trampolines for nested functions, always 14196generate them instead of using descriptors. Otherwise, for targets that 14197do not need them, like for example HP-PA or IA-64, do nothing. 14198 14199A trampoline is a small piece of code that is created at run time on the 14200stack when the address of a nested function is taken, and is used to call 14201the nested function indirectly. Therefore, it requires the stack to be 14202made executable in order for the program to work properly. 14203 14204@option{-fno-trampolines} is enabled by default on a language by language 14205basis to let the compiler avoid generating them, if it computes that this 14206is safe, and replace them with descriptors. Descriptors are made up of data 14207only, but the generated code must be prepared to deal with them. As of this 14208writing, @option{-fno-trampolines} is enabled by default only for Ada. 14209 14210Moreover, code compiled with @option{-ftrampolines} and code compiled with 14211@option{-fno-trampolines} are not binary compatible if nested functions are 14212present. This option must therefore be used on a program-wide basis and be 14213manipulated with extreme care. 14214 14215@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 14216@opindex fvisibility 14217Set the default ELF image symbol visibility to the specified option---all 14218symbols are marked with this unless overridden within the code. 14219Using this feature can very substantially improve linking and 14220load times of shared object libraries, produce more optimized 14221code, provide near-perfect API export and prevent symbol clashes. 14222It is @strong{strongly} recommended that you use this in any shared objects 14223you distribute. 14224 14225Despite the nomenclature, @samp{default} always means public; i.e., 14226available to be linked against from outside the shared object. 14227@samp{protected} and @samp{internal} are pretty useless in real-world 14228usage so the only other commonly used option is @samp{hidden}. 14229The default if @option{-fvisibility} isn't specified is 14230@samp{default}, i.e., make every symbol public. 14231 14232A good explanation of the benefits offered by ensuring ELF 14233symbols have the correct visibility is given by ``How To Write 14234Shared Libraries'' by Ulrich Drepper (which can be found at 14235@w{@uref{https://www.akkadia.org/drepper/}})---however a superior 14236solution made possible by this option to marking things hidden when 14237the default is public is to make the default hidden and mark things 14238public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 14239and @code{__attribute__ ((visibility("default")))} instead of 14240@code{__declspec(dllexport)} you get almost identical semantics with 14241identical syntax. This is a great boon to those working with 14242cross-platform projects. 14243 14244For those adding visibility support to existing code, you may find 14245@code{#pragma GCC visibility} of use. This works by you enclosing 14246the declarations you wish to set visibility for with (for example) 14247@code{#pragma GCC visibility push(hidden)} and 14248@code{#pragma GCC visibility pop}. 14249Bear in mind that symbol visibility should be viewed @strong{as 14250part of the API interface contract} and thus all new code should 14251always specify visibility when it is not the default; i.e., declarations 14252only for use within the local DSO should @strong{always} be marked explicitly 14253as hidden as so to avoid PLT indirection overheads---making this 14254abundantly clear also aids readability and self-documentation of the code. 14255Note that due to ISO C++ specification requirements, @code{operator new} and 14256@code{operator delete} must always be of default visibility. 14257 14258Be aware that headers from outside your project, in particular system 14259headers and headers from any other library you use, may not be 14260expecting to be compiled with visibility other than the default. You 14261may need to explicitly say @code{#pragma GCC visibility push(default)} 14262before including any such headers. 14263 14264@code{extern} declarations are not affected by @option{-fvisibility}, so 14265a lot of code can be recompiled with @option{-fvisibility=hidden} with 14266no modifications. However, this means that calls to @code{extern} 14267functions with no explicit visibility use the PLT, so it is more 14268effective to use @code{__attribute ((visibility))} and/or 14269@code{#pragma GCC visibility} to tell the compiler which @code{extern} 14270declarations should be treated as hidden. 14271 14272Note that @option{-fvisibility} does affect C++ vague linkage 14273entities. This means that, for instance, an exception class that is 14274be thrown between DSOs must be explicitly marked with default 14275visibility so that the @samp{type_info} nodes are unified between 14276the DSOs. 14277 14278An overview of these techniques, their benefits and how to use them 14279is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 14280 14281@item -fstrict-volatile-bitfields 14282@opindex fstrict-volatile-bitfields 14283This option should be used if accesses to volatile bit-fields (or other 14284structure fields, although the compiler usually honors those types 14285anyway) should use a single access of the width of the 14286field's type, aligned to a natural alignment if possible. For 14287example, targets with memory-mapped peripheral registers might require 14288all such accesses to be 16 bits wide; with this flag you can 14289declare all peripheral bit-fields as @code{unsigned short} (assuming short 14290is 16 bits on these targets) to force GCC to use 16-bit accesses 14291instead of, perhaps, a more efficient 32-bit access. 14292 14293If this option is disabled, the compiler uses the most efficient 14294instruction. In the previous example, that might be a 32-bit load 14295instruction, even though that accesses bytes that do not contain 14296any portion of the bit-field, or memory-mapped registers unrelated to 14297the one being updated. 14298 14299In some cases, such as when the @code{packed} attribute is applied to a 14300structure field, it may not be possible to access the field with a single 14301read or write that is correctly aligned for the target machine. In this 14302case GCC falls back to generating multiple accesses rather than code that 14303will fault or truncate the result at run time. 14304 14305Note: Due to restrictions of the C/C++11 memory model, write accesses are 14306not allowed to touch non bit-field members. It is therefore recommended 14307to define all bits of the field's type as bit-field members. 14308 14309The default value of this option is determined by the application binary 14310interface for the target processor. 14311 14312@item -fsync-libcalls 14313@opindex fsync-libcalls 14314This option controls whether any out-of-line instance of the @code{__sync} 14315family of functions may be used to implement the C++11 @code{__atomic} 14316family of functions. 14317 14318The default value of this option is enabled, thus the only useful form 14319of the option is @option{-fno-sync-libcalls}. This option is used in 14320the implementation of the @file{libatomic} runtime library. 14321 14322@end table 14323 14324@node Developer Options 14325@section GCC Developer Options 14326@cindex developer options 14327@cindex debugging GCC 14328@cindex debug dump options 14329@cindex dump options 14330@cindex compilation statistics 14331 14332This section describes command-line options that are primarily of 14333interest to GCC developers, including options to support compiler 14334testing and investigation of compiler bugs and compile-time 14335performance problems. This includes options that produce debug dumps 14336at various points in the compilation; that print statistics such as 14337memory use and execution time; and that print information about GCC's 14338configuration, such as where it searches for libraries. You should 14339rarely need to use any of these options for ordinary compilation and 14340linking tasks. 14341 14342Many developer options that cause GCC to dump output to a file take an 14343optional @samp{=@var{filename}} suffix. You can specify @samp{stdout} 14344or @samp{-} to dump to standard output, and @samp{stderr} for standard 14345error. 14346 14347If @samp{=@var{filename}} is omitted, a default dump file name is 14348constructed by concatenating the base dump file name, a pass number, 14349phase letter, and pass name. The base dump file name is the name of 14350output file produced by the compiler if explicitly specified and not 14351an executable; otherwise it is the source file name. 14352The pass number is determined by the order passes are registered with 14353the compiler's pass manager. 14354This is generally the same as the order of execution, but passes 14355registered by plugins, target-specific passes, or passes that are 14356otherwise registered late are numbered higher than the pass named 14357@samp{final}, even if they are executed earlier. The phase letter is 14358one of @samp{i} (inter-procedural analysis), @samp{l} 14359(language-specific), @samp{r} (RTL), or @samp{t} (tree). 14360The files are created in the directory of the output file. 14361 14362@table @gcctabopt 14363 14364@item -d@var{letters} 14365@itemx -fdump-rtl-@var{pass} 14366@itemx -fdump-rtl-@var{pass}=@var{filename} 14367@opindex d 14368@opindex fdump-rtl-@var{pass} 14369Says to make debugging dumps during compilation at times specified by 14370@var{letters}. This is used for debugging the RTL-based passes of the 14371compiler. 14372 14373Some @option{-d@var{letters}} switches have different meaning when 14374@option{-E} is used for preprocessing. @xref{Preprocessor Options}, 14375for information about preprocessor-specific dump options. 14376 14377Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 14378@option{-d} option @var{letters}. Here are the possible 14379letters for use in @var{pass} and @var{letters}, and their meanings: 14380 14381@table @gcctabopt 14382 14383@item -fdump-rtl-alignments 14384@opindex fdump-rtl-alignments 14385Dump after branch alignments have been computed. 14386 14387@item -fdump-rtl-asmcons 14388@opindex fdump-rtl-asmcons 14389Dump after fixing rtl statements that have unsatisfied in/out constraints. 14390 14391@item -fdump-rtl-auto_inc_dec 14392@opindex fdump-rtl-auto_inc_dec 14393Dump after auto-inc-dec discovery. This pass is only run on 14394architectures that have auto inc or auto dec instructions. 14395 14396@item -fdump-rtl-barriers 14397@opindex fdump-rtl-barriers 14398Dump after cleaning up the barrier instructions. 14399 14400@item -fdump-rtl-bbpart 14401@opindex fdump-rtl-bbpart 14402Dump after partitioning hot and cold basic blocks. 14403 14404@item -fdump-rtl-bbro 14405@opindex fdump-rtl-bbro 14406Dump after block reordering. 14407 14408@item -fdump-rtl-btl1 14409@itemx -fdump-rtl-btl2 14410@opindex fdump-rtl-btl2 14411@opindex fdump-rtl-btl2 14412@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 14413after the two branch 14414target load optimization passes. 14415 14416@item -fdump-rtl-bypass 14417@opindex fdump-rtl-bypass 14418Dump after jump bypassing and control flow optimizations. 14419 14420@item -fdump-rtl-combine 14421@opindex fdump-rtl-combine 14422Dump after the RTL instruction combination pass. 14423 14424@item -fdump-rtl-compgotos 14425@opindex fdump-rtl-compgotos 14426Dump after duplicating the computed gotos. 14427 14428@item -fdump-rtl-ce1 14429@itemx -fdump-rtl-ce2 14430@itemx -fdump-rtl-ce3 14431@opindex fdump-rtl-ce1 14432@opindex fdump-rtl-ce2 14433@opindex fdump-rtl-ce3 14434@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 14435@option{-fdump-rtl-ce3} enable dumping after the three 14436if conversion passes. 14437 14438@item -fdump-rtl-cprop_hardreg 14439@opindex fdump-rtl-cprop_hardreg 14440Dump after hard register copy propagation. 14441 14442@item -fdump-rtl-csa 14443@opindex fdump-rtl-csa 14444Dump after combining stack adjustments. 14445 14446@item -fdump-rtl-cse1 14447@itemx -fdump-rtl-cse2 14448@opindex fdump-rtl-cse1 14449@opindex fdump-rtl-cse2 14450@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 14451the two common subexpression elimination passes. 14452 14453@item -fdump-rtl-dce 14454@opindex fdump-rtl-dce 14455Dump after the standalone dead code elimination passes. 14456 14457@item -fdump-rtl-dbr 14458@opindex fdump-rtl-dbr 14459Dump after delayed branch scheduling. 14460 14461@item -fdump-rtl-dce1 14462@itemx -fdump-rtl-dce2 14463@opindex fdump-rtl-dce1 14464@opindex fdump-rtl-dce2 14465@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 14466the two dead store elimination passes. 14467 14468@item -fdump-rtl-eh 14469@opindex fdump-rtl-eh 14470Dump after finalization of EH handling code. 14471 14472@item -fdump-rtl-eh_ranges 14473@opindex fdump-rtl-eh_ranges 14474Dump after conversion of EH handling range regions. 14475 14476@item -fdump-rtl-expand 14477@opindex fdump-rtl-expand 14478Dump after RTL generation. 14479 14480@item -fdump-rtl-fwprop1 14481@itemx -fdump-rtl-fwprop2 14482@opindex fdump-rtl-fwprop1 14483@opindex fdump-rtl-fwprop2 14484@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 14485dumping after the two forward propagation passes. 14486 14487@item -fdump-rtl-gcse1 14488@itemx -fdump-rtl-gcse2 14489@opindex fdump-rtl-gcse1 14490@opindex fdump-rtl-gcse2 14491@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 14492after global common subexpression elimination. 14493 14494@item -fdump-rtl-init-regs 14495@opindex fdump-rtl-init-regs 14496Dump after the initialization of the registers. 14497 14498@item -fdump-rtl-initvals 14499@opindex fdump-rtl-initvals 14500Dump after the computation of the initial value sets. 14501 14502@item -fdump-rtl-into_cfglayout 14503@opindex fdump-rtl-into_cfglayout 14504Dump after converting to cfglayout mode. 14505 14506@item -fdump-rtl-ira 14507@opindex fdump-rtl-ira 14508Dump after iterated register allocation. 14509 14510@item -fdump-rtl-jump 14511@opindex fdump-rtl-jump 14512Dump after the second jump optimization. 14513 14514@item -fdump-rtl-loop2 14515@opindex fdump-rtl-loop2 14516@option{-fdump-rtl-loop2} enables dumping after the rtl 14517loop optimization passes. 14518 14519@item -fdump-rtl-mach 14520@opindex fdump-rtl-mach 14521Dump after performing the machine dependent reorganization pass, if that 14522pass exists. 14523 14524@item -fdump-rtl-mode_sw 14525@opindex fdump-rtl-mode_sw 14526Dump after removing redundant mode switches. 14527 14528@item -fdump-rtl-rnreg 14529@opindex fdump-rtl-rnreg 14530Dump after register renumbering. 14531 14532@item -fdump-rtl-outof_cfglayout 14533@opindex fdump-rtl-outof_cfglayout 14534Dump after converting from cfglayout mode. 14535 14536@item -fdump-rtl-peephole2 14537@opindex fdump-rtl-peephole2 14538Dump after the peephole pass. 14539 14540@item -fdump-rtl-postreload 14541@opindex fdump-rtl-postreload 14542Dump after post-reload optimizations. 14543 14544@item -fdump-rtl-pro_and_epilogue 14545@opindex fdump-rtl-pro_and_epilogue 14546Dump after generating the function prologues and epilogues. 14547 14548@item -fdump-rtl-sched1 14549@itemx -fdump-rtl-sched2 14550@opindex fdump-rtl-sched1 14551@opindex fdump-rtl-sched2 14552@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 14553after the basic block scheduling passes. 14554 14555@item -fdump-rtl-ree 14556@opindex fdump-rtl-ree 14557Dump after sign/zero extension elimination. 14558 14559@item -fdump-rtl-seqabstr 14560@opindex fdump-rtl-seqabstr 14561Dump after common sequence discovery. 14562 14563@item -fdump-rtl-shorten 14564@opindex fdump-rtl-shorten 14565Dump after shortening branches. 14566 14567@item -fdump-rtl-sibling 14568@opindex fdump-rtl-sibling 14569Dump after sibling call optimizations. 14570 14571@item -fdump-rtl-split1 14572@itemx -fdump-rtl-split2 14573@itemx -fdump-rtl-split3 14574@itemx -fdump-rtl-split4 14575@itemx -fdump-rtl-split5 14576@opindex fdump-rtl-split1 14577@opindex fdump-rtl-split2 14578@opindex fdump-rtl-split3 14579@opindex fdump-rtl-split4 14580@opindex fdump-rtl-split5 14581These options enable dumping after five rounds of 14582instruction splitting. 14583 14584@item -fdump-rtl-sms 14585@opindex fdump-rtl-sms 14586Dump after modulo scheduling. This pass is only run on some 14587architectures. 14588 14589@item -fdump-rtl-stack 14590@opindex fdump-rtl-stack 14591Dump after conversion from GCC's ``flat register file'' registers to the 14592x87's stack-like registers. This pass is only run on x86 variants. 14593 14594@item -fdump-rtl-subreg1 14595@itemx -fdump-rtl-subreg2 14596@opindex fdump-rtl-subreg1 14597@opindex fdump-rtl-subreg2 14598@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 14599the two subreg expansion passes. 14600 14601@item -fdump-rtl-unshare 14602@opindex fdump-rtl-unshare 14603Dump after all rtl has been unshared. 14604 14605@item -fdump-rtl-vartrack 14606@opindex fdump-rtl-vartrack 14607Dump after variable tracking. 14608 14609@item -fdump-rtl-vregs 14610@opindex fdump-rtl-vregs 14611Dump after converting virtual registers to hard registers. 14612 14613@item -fdump-rtl-web 14614@opindex fdump-rtl-web 14615Dump after live range splitting. 14616 14617@item -fdump-rtl-regclass 14618@itemx -fdump-rtl-subregs_of_mode_init 14619@itemx -fdump-rtl-subregs_of_mode_finish 14620@itemx -fdump-rtl-dfinit 14621@itemx -fdump-rtl-dfinish 14622@opindex fdump-rtl-regclass 14623@opindex fdump-rtl-subregs_of_mode_init 14624@opindex fdump-rtl-subregs_of_mode_finish 14625@opindex fdump-rtl-dfinit 14626@opindex fdump-rtl-dfinish 14627These dumps are defined but always produce empty files. 14628 14629@item -da 14630@itemx -fdump-rtl-all 14631@opindex da 14632@opindex fdump-rtl-all 14633Produce all the dumps listed above. 14634 14635@item -dA 14636@opindex dA 14637Annotate the assembler output with miscellaneous debugging information. 14638 14639@item -dD 14640@opindex dD 14641Dump all macro definitions, at the end of preprocessing, in addition to 14642normal output. 14643 14644@item -dH 14645@opindex dH 14646Produce a core dump whenever an error occurs. 14647 14648@item -dp 14649@opindex dp 14650Annotate the assembler output with a comment indicating which 14651pattern and alternative is used. The length and cost of each instruction are 14652also printed. 14653 14654@item -dP 14655@opindex dP 14656Dump the RTL in the assembler output as a comment before each instruction. 14657Also turns on @option{-dp} annotation. 14658 14659@item -dx 14660@opindex dx 14661Just generate RTL for a function instead of compiling it. Usually used 14662with @option{-fdump-rtl-expand}. 14663@end table 14664 14665@item -fdump-debug 14666@opindex fdump-debug 14667Dump debugging information generated during the debug 14668generation phase. 14669 14670@item -fdump-earlydebug 14671@opindex fdump-earlydebug 14672Dump debugging information generated during the early debug 14673generation phase. 14674 14675@item -fdump-noaddr 14676@opindex fdump-noaddr 14677When doing debugging dumps, suppress address output. This makes it more 14678feasible to use diff on debugging dumps for compiler invocations with 14679different compiler binaries and/or different 14680text / bss / data / heap / stack / dso start locations. 14681 14682@item -freport-bug 14683@opindex freport-bug 14684Collect and dump debug information into a temporary file if an 14685internal compiler error (ICE) occurs. 14686 14687@item -fdump-unnumbered 14688@opindex fdump-unnumbered 14689When doing debugging dumps, suppress instruction numbers and address output. 14690This makes it more feasible to use diff on debugging dumps for compiler 14691invocations with different options, in particular with and without 14692@option{-g}. 14693 14694@item -fdump-unnumbered-links 14695@opindex fdump-unnumbered-links 14696When doing debugging dumps (see @option{-d} option above), suppress 14697instruction numbers for the links to the previous and next instructions 14698in a sequence. 14699 14700@item -fdump-ipa-@var{switch} 14701@itemx -fdump-ipa-@var{switch}-@var{options} 14702@opindex fdump-ipa 14703Control the dumping at various stages of inter-procedural analysis 14704language tree to a file. The file name is generated by appending a 14705switch specific suffix to the source file name, and the file is created 14706in the same directory as the output file. The following dumps are 14707possible: 14708 14709@table @samp 14710@item all 14711Enables all inter-procedural analysis dumps. 14712 14713@item cgraph 14714Dumps information about call-graph optimization, unused function removal, 14715and inlining decisions. 14716 14717@item inline 14718Dump after function inlining. 14719 14720@end table 14721 14722Additionally, the options @option{-optimized}, @option{-missed}, 14723@option{-note}, and @option{-all} can be provided, with the same meaning 14724as for @option{-fopt-info}, defaulting to @option{-optimized}. 14725 14726For example, @option{-fdump-ipa-inline-optimized-missed} will emit 14727information on callsites that were inlined, along with callsites 14728that were not inlined. 14729 14730By default, the dump will contain messages about successful 14731optimizations (equivalent to @option{-optimized}) together with 14732low-level details about the analysis. 14733 14734@item -fdump-lang-all 14735@itemx -fdump-lang-@var{switch} 14736@itemx -fdump-lang-@var{switch}-@var{options} 14737@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename} 14738@opindex fdump-lang-all 14739@opindex fdump-lang 14740Control the dumping of language-specific information. The @var{options} 14741and @var{filename} portions behave as described in the 14742@option{-fdump-tree} option. The following @var{switch} values are 14743accepted: 14744 14745@table @samp 14746@item all 14747 14748Enable all language-specific dumps. 14749 14750@item class 14751Dump class hierarchy information. Virtual table information is emitted 14752unless '@option{slim}' is specified. This option is applicable to C++ only. 14753 14754@item raw 14755Dump the raw internal tree data. This option is applicable to C++ only. 14756 14757@end table 14758 14759@item -fdump-passes 14760@opindex fdump-passes 14761Print on @file{stderr} the list of optimization passes that are turned 14762on and off by the current command-line options. 14763 14764@item -fdump-statistics-@var{option} 14765@opindex fdump-statistics 14766Enable and control dumping of pass statistics in a separate file. The 14767file name is generated by appending a suffix ending in 14768@samp{.statistics} to the source file name, and the file is created in 14769the same directory as the output file. If the @samp{-@var{option}} 14770form is used, @samp{-stats} causes counters to be summed over the 14771whole compilation unit while @samp{-details} dumps every event as 14772the passes generate them. The default with no option is to sum 14773counters for each function compiled. 14774 14775@item -fdump-tree-all 14776@itemx -fdump-tree-@var{switch} 14777@itemx -fdump-tree-@var{switch}-@var{options} 14778@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 14779@opindex fdump-tree-all 14780@opindex fdump-tree 14781Control the dumping at various stages of processing the intermediate 14782language tree to a file. If the @samp{-@var{options}} 14783form is used, @var{options} is a list of @samp{-} separated options 14784which control the details of the dump. Not all options are applicable 14785to all dumps; those that are not meaningful are ignored. The 14786following options are available 14787 14788@table @samp 14789@item address 14790Print the address of each node. Usually this is not meaningful as it 14791changes according to the environment and source file. Its primary use 14792is for tying up a dump file with a debug environment. 14793@item asmname 14794If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 14795in the dump instead of @code{DECL_NAME}. Its primary use is ease of 14796use working backward from mangled names in the assembly file. 14797@item slim 14798When dumping front-end intermediate representations, inhibit dumping 14799of members of a scope or body of a function merely because that scope 14800has been reached. Only dump such items when they are directly reachable 14801by some other path. 14802 14803When dumping pretty-printed trees, this option inhibits dumping the 14804bodies of control structures. 14805 14806When dumping RTL, print the RTL in slim (condensed) form instead of 14807the default LISP-like representation. 14808@item raw 14809Print a raw representation of the tree. By default, trees are 14810pretty-printed into a C-like representation. 14811@item details 14812Enable more detailed dumps (not honored by every dump option). Also 14813include information from the optimization passes. 14814@item stats 14815Enable dumping various statistics about the pass (not honored by every dump 14816option). 14817@item blocks 14818Enable showing basic block boundaries (disabled in raw dumps). 14819@item graph 14820For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 14821dump a representation of the control flow graph suitable for viewing with 14822GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 14823the file is pretty-printed as a subgraph, so that GraphViz can render them 14824all in a single plot. 14825 14826This option currently only works for RTL dumps, and the RTL is always 14827dumped in slim form. 14828@item vops 14829Enable showing virtual operands for every statement. 14830@item lineno 14831Enable showing line numbers for statements. 14832@item uid 14833Enable showing the unique ID (@code{DECL_UID}) for each variable. 14834@item verbose 14835Enable showing the tree dump for each statement. 14836@item eh 14837Enable showing the EH region number holding each statement. 14838@item scev 14839Enable showing scalar evolution analysis details. 14840@item optimized 14841Enable showing optimization information (only available in certain 14842passes). 14843@item missed 14844Enable showing missed optimization information (only available in certain 14845passes). 14846@item note 14847Enable other detailed optimization information (only available in 14848certain passes). 14849@item all 14850Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 14851and @option{lineno}. 14852@item optall 14853Turn on all optimization options, i.e., @option{optimized}, 14854@option{missed}, and @option{note}. 14855@end table 14856 14857To determine what tree dumps are available or find the dump for a pass 14858of interest follow the steps below. 14859 14860@enumerate 14861@item 14862Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output 14863look for a code that corresponds to the pass you are interested in. 14864For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and 14865@code{tree-vrp2} correspond to the three Value Range Propagation passes. 14866The number at the end distinguishes distinct invocations of the same pass. 14867@item 14868To enable the creation of the dump file, append the pass code to 14869the @option{-fdump-} option prefix and invoke GCC with it. For example, 14870to enable the dump from the Early Value Range Propagation pass, invoke 14871GCC with the @option{-fdump-tree-evrp} option. Optionally, you may 14872specify the name of the dump file. If you don't specify one, GCC 14873creates as described below. 14874@item 14875Find the pass dump in a file whose name is composed of three components 14876separated by a period: the name of the source file GCC was invoked to 14877compile, a numeric suffix indicating the pass number followed by the 14878letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes), 14879and finally the pass code. For example, the Early VRP pass dump might 14880be in a file named @file{myfile.c.038t.evrp} in the current working 14881directory. Note that the numeric codes are not stable and may change 14882from one version of GCC to another. 14883@end enumerate 14884 14885@item -fopt-info 14886@itemx -fopt-info-@var{options} 14887@itemx -fopt-info-@var{options}=@var{filename} 14888@opindex fopt-info 14889Controls optimization dumps from various optimization passes. If the 14890@samp{-@var{options}} form is used, @var{options} is a list of 14891@samp{-} separated option keywords to select the dump details and 14892optimizations. 14893 14894The @var{options} can be divided into three groups: 14895@enumerate 14896@item 14897options describing what kinds of messages should be emitted, 14898@item 14899options describing the verbosity of the dump, and 14900@item 14901options describing which optimizations should be included. 14902@end enumerate 14903The options from each group can be freely mixed as they are 14904non-overlapping. However, in case of any conflicts, 14905the later options override the earlier options on the command 14906line. 14907 14908The following options control which kinds of messages should be emitted: 14909 14910@table @samp 14911@item optimized 14912Print information when an optimization is successfully applied. It is 14913up to a pass to decide which information is relevant. For example, the 14914vectorizer passes print the source location of loops which are 14915successfully vectorized. 14916@item missed 14917Print information about missed optimizations. Individual passes 14918control which information to include in the output. 14919@item note 14920Print verbose information about optimizations, such as certain 14921transformations, more detailed messages about decisions etc. 14922@item all 14923Print detailed optimization information. This includes 14924@samp{optimized}, @samp{missed}, and @samp{note}. 14925@end table 14926 14927The following option controls the dump verbosity: 14928 14929@table @samp 14930@item internals 14931By default, only ``high-level'' messages are emitted. This option enables 14932additional, more detailed, messages, which are likely to only be of interest 14933to GCC developers. 14934@end table 14935 14936One or more of the following option keywords can be used to describe a 14937group of optimizations: 14938 14939@table @samp 14940@item ipa 14941Enable dumps from all interprocedural optimizations. 14942@item loop 14943Enable dumps from all loop optimizations. 14944@item inline 14945Enable dumps from all inlining optimizations. 14946@item omp 14947Enable dumps from all OMP (Offloading and Multi Processing) optimizations. 14948@item vec 14949Enable dumps from all vectorization optimizations. 14950@item optall 14951Enable dumps from all optimizations. This is a superset of 14952the optimization groups listed above. 14953@end table 14954 14955If @var{options} is 14956omitted, it defaults to @samp{optimized-optall}, which means to dump messages 14957about successful optimizations from all the passes, omitting messages 14958that are treated as ``internals''. 14959 14960If the @var{filename} is provided, then the dumps from all the 14961applicable optimizations are concatenated into the @var{filename}. 14962Otherwise the dump is output onto @file{stderr}. Though multiple 14963@option{-fopt-info} options are accepted, only one of them can include 14964a @var{filename}. If other filenames are provided then all but the 14965first such option are ignored. 14966 14967Note that the output @var{filename} is overwritten 14968in case of multiple translation units. If a combined output from 14969multiple translation units is desired, @file{stderr} should be used 14970instead. 14971 14972In the following example, the optimization info is output to 14973@file{stderr}: 14974 14975@smallexample 14976gcc -O3 -fopt-info 14977@end smallexample 14978 14979This example: 14980@smallexample 14981gcc -O3 -fopt-info-missed=missed.all 14982@end smallexample 14983 14984@noindent 14985outputs missed optimization report from all the passes into 14986@file{missed.all}, and this one: 14987 14988@smallexample 14989gcc -O2 -ftree-vectorize -fopt-info-vec-missed 14990@end smallexample 14991 14992@noindent 14993prints information about missed optimization opportunities from 14994vectorization passes on @file{stderr}. 14995Note that @option{-fopt-info-vec-missed} is equivalent to 14996@option{-fopt-info-missed-vec}. The order of the optimization group 14997names and message types listed after @option{-fopt-info} does not matter. 14998 14999As another example, 15000@smallexample 15001gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 15002@end smallexample 15003 15004@noindent 15005outputs information about missed optimizations as well as 15006optimized locations from all the inlining passes into 15007@file{inline.txt}. 15008 15009Finally, consider: 15010 15011@smallexample 15012gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 15013@end smallexample 15014 15015@noindent 15016Here the two output filenames @file{vec.miss} and @file{loop.opt} are 15017in conflict since only one output file is allowed. In this case, only 15018the first option takes effect and the subsequent options are 15019ignored. Thus only @file{vec.miss} is produced which contains 15020dumps from the vectorizer about missed opportunities. 15021 15022@item -fsave-optimization-record 15023@opindex fsave-optimization-record 15024Write a SRCFILE.opt-record.json.gz file detailing what optimizations 15025were performed, for those optimizations that support @option{-fopt-info}. 15026 15027This option is experimental and the format of the data within the 15028compressed JSON file is subject to change. 15029 15030It is roughly equivalent to a machine-readable version of 15031@option{-fopt-info-all}, as a collection of messages with source file, 15032line number and column number, with the following additional data for 15033each message: 15034 15035@itemize @bullet 15036 15037@item 15038the execution count of the code being optimized, along with metadata about 15039whether this was from actual profile data, or just an estimate, allowing 15040consumers to prioritize messages by code hotness, 15041 15042@item 15043the function name of the code being optimized, where applicable, 15044 15045@item 15046the ``inlining chain'' for the code being optimized, so that when 15047a function is inlined into several different places (which might 15048themselves be inlined), the reader can distinguish between the copies, 15049 15050@item 15051objects identifying those parts of the message that refer to expressions, 15052statements or symbol-table nodes, which of these categories they are, and, 15053when available, their source code location, 15054 15055@item 15056the GCC pass that emitted the message, and 15057 15058@item 15059the location in GCC's own code from which the message was emitted 15060 15061@end itemize 15062 15063Additionally, some messages are logically nested within other 15064messages, reflecting implementation details of the optimization 15065passes. 15066 15067@item -fsched-verbose=@var{n} 15068@opindex fsched-verbose 15069On targets that use instruction scheduling, this option controls the 15070amount of debugging output the scheduler prints to the dump files. 15071 15072For @var{n} greater than zero, @option{-fsched-verbose} outputs the 15073same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 15074For @var{n} greater than one, it also output basic block probabilities, 15075detailed ready list information and unit/insn info. For @var{n} greater 15076than two, it includes RTL at abort point, control-flow and regions info. 15077And for @var{n} over four, @option{-fsched-verbose} also includes 15078dependence info. 15079 15080 15081 15082@item -fenable-@var{kind}-@var{pass} 15083@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 15084@opindex fdisable- 15085@opindex fenable- 15086 15087This is a set of options that are used to explicitly disable/enable 15088optimization passes. These options are intended for use for debugging GCC. 15089Compiler users should use regular options for enabling/disabling 15090passes instead. 15091 15092@table @gcctabopt 15093 15094@item -fdisable-ipa-@var{pass} 15095Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 15096statically invoked in the compiler multiple times, the pass name should be 15097appended with a sequential number starting from 1. 15098 15099@item -fdisable-rtl-@var{pass} 15100@itemx -fdisable-rtl-@var{pass}=@var{range-list} 15101Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 15102statically invoked in the compiler multiple times, the pass name should be 15103appended with a sequential number starting from 1. @var{range-list} is a 15104comma-separated list of function ranges or assembler names. Each range is a number 15105pair separated by a colon. The range is inclusive in both ends. If the range 15106is trivial, the number pair can be simplified as a single number. If the 15107function's call graph node's @var{uid} falls within one of the specified ranges, 15108the @var{pass} is disabled for that function. The @var{uid} is shown in the 15109function header of a dump file, and the pass names can be dumped by using 15110option @option{-fdump-passes}. 15111 15112@item -fdisable-tree-@var{pass} 15113@itemx -fdisable-tree-@var{pass}=@var{range-list} 15114Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 15115option arguments. 15116 15117@item -fenable-ipa-@var{pass} 15118Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 15119statically invoked in the compiler multiple times, the pass name should be 15120appended with a sequential number starting from 1. 15121 15122@item -fenable-rtl-@var{pass} 15123@itemx -fenable-rtl-@var{pass}=@var{range-list} 15124Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 15125description and examples. 15126 15127@item -fenable-tree-@var{pass} 15128@itemx -fenable-tree-@var{pass}=@var{range-list} 15129Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 15130of option arguments. 15131 15132@end table 15133 15134Here are some examples showing uses of these options. 15135 15136@smallexample 15137 15138# disable ccp1 for all functions 15139 -fdisable-tree-ccp1 15140# disable complete unroll for function whose cgraph node uid is 1 15141 -fenable-tree-cunroll=1 15142# disable gcse2 for functions at the following ranges [1,1], 15143# [300,400], and [400,1000] 15144# disable gcse2 for functions foo and foo2 15145 -fdisable-rtl-gcse2=foo,foo2 15146# disable early inlining 15147 -fdisable-tree-einline 15148# disable ipa inlining 15149 -fdisable-ipa-inline 15150# enable tree full unroll 15151 -fenable-tree-unroll 15152 15153@end smallexample 15154 15155@item -fchecking 15156@itemx -fchecking=@var{n} 15157@opindex fchecking 15158@opindex fno-checking 15159Enable internal consistency checking. The default depends on 15160the compiler configuration. @option{-fchecking=2} enables further 15161internal consistency checking that might affect code generation. 15162 15163@item -frandom-seed=@var{string} 15164@opindex frandom-seed 15165This option provides a seed that GCC uses in place of 15166random numbers in generating certain symbol names 15167that have to be different in every compiled file. It is also used to 15168place unique stamps in coverage data files and the object files that 15169produce them. You can use the @option{-frandom-seed} option to produce 15170reproducibly identical object files. 15171 15172The @var{string} can either be a number (decimal, octal or hex) or an 15173arbitrary string (in which case it's converted to a number by 15174computing CRC32). 15175 15176The @var{string} should be different for every file you compile. 15177 15178@item -save-temps 15179@itemx -save-temps=cwd 15180@opindex save-temps 15181Store the usual ``temporary'' intermediate files permanently; place them 15182in the current directory and name them based on the source file. Thus, 15183compiling @file{foo.c} with @option{-c -save-temps} produces files 15184@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 15185preprocessed @file{foo.i} output file even though the compiler now 15186normally uses an integrated preprocessor. 15187 15188When used in combination with the @option{-x} command-line option, 15189@option{-save-temps} is sensible enough to avoid over writing an 15190input source file with the same extension as an intermediate file. 15191The corresponding intermediate file may be obtained by renaming the 15192source file before using @option{-save-temps}. 15193 15194If you invoke GCC in parallel, compiling several different source 15195files that share a common base name in different subdirectories or the 15196same source file compiled for multiple output destinations, it is 15197likely that the different parallel compilers will interfere with each 15198other, and overwrite the temporary files. For instance: 15199 15200@smallexample 15201gcc -save-temps -o outdir1/foo.o indir1/foo.c& 15202gcc -save-temps -o outdir2/foo.o indir2/foo.c& 15203@end smallexample 15204 15205may result in @file{foo.i} and @file{foo.o} being written to 15206simultaneously by both compilers. 15207 15208@item -save-temps=obj 15209@opindex save-temps=obj 15210Store the usual ``temporary'' intermediate files permanently. If the 15211@option{-o} option is used, the temporary files are based on the 15212object file. If the @option{-o} option is not used, the 15213@option{-save-temps=obj} switch behaves like @option{-save-temps}. 15214 15215For example: 15216 15217@smallexample 15218gcc -save-temps=obj -c foo.c 15219gcc -save-temps=obj -c bar.c -o dir/xbar.o 15220gcc -save-temps=obj foobar.c -o dir2/yfoobar 15221@end smallexample 15222 15223@noindent 15224creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, 15225@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and 15226@file{dir2/yfoobar.o}. 15227 15228@item -time@r{[}=@var{file}@r{]} 15229@opindex time 15230Report the CPU time taken by each subprocess in the compilation 15231sequence. For C source files, this is the compiler proper and assembler 15232(plus the linker if linking is done). 15233 15234Without the specification of an output file, the output looks like this: 15235 15236@smallexample 15237# cc1 0.12 0.01 15238# as 0.00 0.01 15239@end smallexample 15240 15241The first number on each line is the ``user time'', that is time spent 15242executing the program itself. The second number is ``system time'', 15243time spent executing operating system routines on behalf of the program. 15244Both numbers are in seconds. 15245 15246With the specification of an output file, the output is appended to the 15247named file, and it looks like this: 15248 15249@smallexample 152500.12 0.01 cc1 @var{options} 152510.00 0.01 as @var{options} 15252@end smallexample 15253 15254The ``user time'' and the ``system time'' are moved before the program 15255name, and the options passed to the program are displayed, so that one 15256can later tell what file was being compiled, and with which options. 15257 15258@item -fdump-final-insns@r{[}=@var{file}@r{]} 15259@opindex fdump-final-insns 15260Dump the final internal representation (RTL) to @var{file}. If the 15261optional argument is omitted (or if @var{file} is @code{.}), the name 15262of the dump file is determined by appending @code{.gkd} to the 15263compilation output file name. 15264 15265@item -fcompare-debug@r{[}=@var{opts}@r{]} 15266@opindex fcompare-debug 15267@opindex fno-compare-debug 15268If no error occurs during compilation, run the compiler a second time, 15269adding @var{opts} and @option{-fcompare-debug-second} to the arguments 15270passed to the second compilation. Dump the final internal 15271representation in both compilations, and print an error if they differ. 15272 15273If the equal sign is omitted, the default @option{-gtoggle} is used. 15274 15275The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 15276and nonzero, implicitly enables @option{-fcompare-debug}. If 15277@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 15278then it is used for @var{opts}, otherwise the default @option{-gtoggle} 15279is used. 15280 15281@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 15282is equivalent to @option{-fno-compare-debug}, which disables the dumping 15283of the final representation and the second compilation, preventing even 15284@env{GCC_COMPARE_DEBUG} from taking effect. 15285 15286To verify full coverage during @option{-fcompare-debug} testing, set 15287@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 15288which GCC rejects as an invalid option in any actual compilation 15289(rather than preprocessing, assembly or linking). To get just a 15290warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 15291not overridden} will do. 15292 15293@item -fcompare-debug-second 15294@opindex fcompare-debug-second 15295This option is implicitly passed to the compiler for the second 15296compilation requested by @option{-fcompare-debug}, along with options to 15297silence warnings, and omitting other options that would cause the compiler 15298to produce output to files or to standard output as a side effect. Dump 15299files and preserved temporary files are renamed so as to contain the 15300@code{.gk} additional extension during the second compilation, to avoid 15301overwriting those generated by the first. 15302 15303When this option is passed to the compiler driver, it causes the 15304@emph{first} compilation to be skipped, which makes it useful for little 15305other than debugging the compiler proper. 15306 15307@item -gtoggle 15308@opindex gtoggle 15309Turn off generation of debug info, if leaving out this option 15310generates it, or turn it on at level 2 otherwise. The position of this 15311argument in the command line does not matter; it takes effect after all 15312other options are processed, and it does so only once, no matter how 15313many times it is given. This is mainly intended to be used with 15314@option{-fcompare-debug}. 15315 15316@item -fvar-tracking-assignments-toggle 15317@opindex fvar-tracking-assignments-toggle 15318@opindex fno-var-tracking-assignments-toggle 15319Toggle @option{-fvar-tracking-assignments}, in the same way that 15320@option{-gtoggle} toggles @option{-g}. 15321 15322@item -Q 15323@opindex Q 15324Makes the compiler print out each function name as it is compiled, and 15325print some statistics about each pass when it finishes. 15326 15327@item -ftime-report 15328@opindex ftime-report 15329Makes the compiler print some statistics about the time consumed by each 15330pass when it finishes. 15331 15332@item -ftime-report-details 15333@opindex ftime-report-details 15334Record the time consumed by infrastructure parts separately for each pass. 15335 15336@item -fira-verbose=@var{n} 15337@opindex fira-verbose 15338Control the verbosity of the dump file for the integrated register allocator. 15339The default value is 5. If the value @var{n} is greater or equal to 10, 15340the dump output is sent to stderr using the same format as @var{n} minus 10. 15341 15342@item -flto-report 15343@opindex flto-report 15344Prints a report with internal details on the workings of the link-time 15345optimizer. The contents of this report vary from version to version. 15346It is meant to be useful to GCC developers when processing object 15347files in LTO mode (via @option{-flto}). 15348 15349Disabled by default. 15350 15351@item -flto-report-wpa 15352@opindex flto-report-wpa 15353Like @option{-flto-report}, but only print for the WPA phase of Link 15354Time Optimization. 15355 15356@item -fmem-report 15357@opindex fmem-report 15358Makes the compiler print some statistics about permanent memory 15359allocation when it finishes. 15360 15361@item -fmem-report-wpa 15362@opindex fmem-report-wpa 15363Makes the compiler print some statistics about permanent memory 15364allocation for the WPA phase only. 15365 15366@item -fpre-ipa-mem-report 15367@opindex fpre-ipa-mem-report 15368@item -fpost-ipa-mem-report 15369@opindex fpost-ipa-mem-report 15370Makes the compiler print some statistics about permanent memory 15371allocation before or after interprocedural optimization. 15372 15373@item -fprofile-report 15374@opindex fprofile-report 15375Makes the compiler print some statistics about consistency of the 15376(estimated) profile and effect of individual passes. 15377 15378@item -fstack-usage 15379@opindex fstack-usage 15380Makes the compiler output stack usage information for the program, on a 15381per-function basis. The filename for the dump is made by appending 15382@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 15383the output file, if explicitly specified and it is not an executable, 15384otherwise it is the basename of the source file. An entry is made up 15385of three fields: 15386 15387@itemize 15388@item 15389The name of the function. 15390@item 15391A number of bytes. 15392@item 15393One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 15394@end itemize 15395 15396The qualifier @code{static} means that the function manipulates the stack 15397statically: a fixed number of bytes are allocated for the frame on function 15398entry and released on function exit; no stack adjustments are otherwise made 15399in the function. The second field is this fixed number of bytes. 15400 15401The qualifier @code{dynamic} means that the function manipulates the stack 15402dynamically: in addition to the static allocation described above, stack 15403adjustments are made in the body of the function, for example to push/pop 15404arguments around function calls. If the qualifier @code{bounded} is also 15405present, the amount of these adjustments is bounded at compile time and 15406the second field is an upper bound of the total amount of stack used by 15407the function. If it is not present, the amount of these adjustments is 15408not bounded at compile time and the second field only represents the 15409bounded part. 15410 15411@item -fstats 15412@opindex fstats 15413Emit statistics about front-end processing at the end of the compilation. 15414This option is supported only by the C++ front end, and 15415the information is generally only useful to the G++ development team. 15416 15417@item -fdbg-cnt-list 15418@opindex fdbg-cnt-list 15419Print the name and the counter upper bound for all debug counters. 15420 15421 15422@item -fdbg-cnt=@var{counter-value-list} 15423@opindex fdbg-cnt 15424Set the internal debug counter lower and upper bound. @var{counter-value-list} 15425is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound} 15426tuples which sets the lower and the upper bound of each debug 15427counter @var{name}. The @var{lower_bound} is optional and is zero 15428initialized if not set. 15429All debug counters have the initial upper bound of @code{UINT_MAX}; 15430thus @code{dbg_cnt} returns true always unless the upper bound 15431is set by this option. 15432For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10}, 15433@code{dbg_cnt(dce)} returns true only for third and fourth invocation. 15434For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations. 15435 15436@item -print-file-name=@var{library} 15437@opindex print-file-name 15438Print the full absolute name of the library file @var{library} that 15439would be used when linking---and don't do anything else. With this 15440option, GCC does not compile or link anything; it just prints the 15441file name. 15442 15443@item -print-multi-directory 15444@opindex print-multi-directory 15445Print the directory name corresponding to the multilib selected by any 15446other switches present in the command line. This directory is supposed 15447to exist in @env{GCC_EXEC_PREFIX}. 15448 15449@item -print-multi-lib 15450@opindex print-multi-lib 15451Print the mapping from multilib directory names to compiler switches 15452that enable them. The directory name is separated from the switches by 15453@samp{;}, and each switch starts with an @samp{@@} instead of the 15454@samp{-}, without spaces between multiple switches. This is supposed to 15455ease shell processing. 15456 15457@item -print-multi-os-directory 15458@opindex print-multi-os-directory 15459Print the path to OS libraries for the selected 15460multilib, relative to some @file{lib} subdirectory. If OS libraries are 15461present in the @file{lib} subdirectory and no multilibs are used, this is 15462usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 15463sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 15464@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 15465subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 15466 15467@item -print-multiarch 15468@opindex print-multiarch 15469Print the path to OS libraries for the selected multiarch, 15470relative to some @file{lib} subdirectory. 15471 15472@item -print-prog-name=@var{program} 15473@opindex print-prog-name 15474Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 15475 15476@item -print-libgcc-file-name 15477@opindex print-libgcc-file-name 15478Same as @option{-print-file-name=libgcc.a}. 15479 15480This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 15481but you do want to link with @file{libgcc.a}. You can do: 15482 15483@smallexample 15484gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 15485@end smallexample 15486 15487@item -print-search-dirs 15488@opindex print-search-dirs 15489Print the name of the configured installation directory and a list of 15490program and library directories @command{gcc} searches---and don't do anything else. 15491 15492This is useful when @command{gcc} prints the error message 15493@samp{installation problem, cannot exec cpp0: No such file or directory}. 15494To resolve this you either need to put @file{cpp0} and the other compiler 15495components where @command{gcc} expects to find them, or you can set the environment 15496variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 15497Don't forget the trailing @samp{/}. 15498@xref{Environment Variables}. 15499 15500@item -print-sysroot 15501@opindex print-sysroot 15502Print the target sysroot directory that is used during 15503compilation. This is the target sysroot specified either at configure 15504time or using the @option{--sysroot} option, possibly with an extra 15505suffix that depends on compilation options. If no target sysroot is 15506specified, the option prints nothing. 15507 15508@item -print-sysroot-headers-suffix 15509@opindex print-sysroot-headers-suffix 15510Print the suffix added to the target sysroot when searching for 15511headers, or give an error if the compiler is not configured with such 15512a suffix---and don't do anything else. 15513 15514@item -dumpmachine 15515@opindex dumpmachine 15516Print the compiler's target machine (for example, 15517@samp{i686-pc-linux-gnu})---and don't do anything else. 15518 15519@item -dumpversion 15520@opindex dumpversion 15521Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do 15522anything else. This is the compiler version used in filesystem paths and 15523specs. Depending on how the compiler has been configured it can be just 15524a single number (major version), two numbers separated by a dot (major and 15525minor version) or three numbers separated by dots (major, minor and patchlevel 15526version). 15527 15528@item -dumpfullversion 15529@opindex dumpfullversion 15530Print the full compiler version---and don't do anything else. The output is 15531always three numbers separated by dots, major, minor and patchlevel version. 15532 15533@item -dumpspecs 15534@opindex dumpspecs 15535Print the compiler's built-in specs---and don't do anything else. (This 15536is used when GCC itself is being built.) @xref{Spec Files}. 15537@end table 15538 15539@node Submodel Options 15540@section Machine-Dependent Options 15541@cindex submodel options 15542@cindex specifying hardware config 15543@cindex hardware models and configurations, specifying 15544@cindex target-dependent options 15545@cindex machine-dependent options 15546 15547Each target machine supported by GCC can have its own options---for 15548example, to allow you to compile for a particular processor variant or 15549ABI, or to control optimizations specific to that machine. By 15550convention, the names of machine-specific options start with 15551@samp{-m}. 15552 15553Some configurations of the compiler also support additional target-specific 15554options, usually for compatibility with other compilers on the same 15555platform. 15556 15557@c This list is ordered alphanumerically by subsection name. 15558@c It should be the same order and spelling as these options are listed 15559@c in Machine Dependent Options 15560 15561@menu 15562* AArch64 Options:: 15563* Adapteva Epiphany Options:: 15564* AMD GCN Options:: 15565* ARC Options:: 15566* ARM Options:: 15567* AVR Options:: 15568* Blackfin Options:: 15569* C6X Options:: 15570* CRIS Options:: 15571* CR16 Options:: 15572* C-SKY Options:: 15573* Darwin Options:: 15574* DEC Alpha Options:: 15575* FR30 Options:: 15576* FT32 Options:: 15577* FRV Options:: 15578* GNU/Linux Options:: 15579* H8/300 Options:: 15580* HPPA Options:: 15581* IA-64 Options:: 15582* LM32 Options:: 15583* M32C Options:: 15584* M32R/D Options:: 15585* M680x0 Options:: 15586* MCore Options:: 15587* MeP Options:: 15588* MicroBlaze Options:: 15589* MIPS Options:: 15590* MMIX Options:: 15591* MN10300 Options:: 15592* Moxie Options:: 15593* MSP430 Options:: 15594* NDS32 Options:: 15595* Nios II Options:: 15596* Nvidia PTX Options:: 15597* OpenRISC Options:: 15598* PDP-11 Options:: 15599* picoChip Options:: 15600* PowerPC Options:: 15601* RISC-V Options:: 15602* RL78 Options:: 15603* RS/6000 and PowerPC Options:: 15604* RX Options:: 15605* S/390 and zSeries Options:: 15606* Score Options:: 15607* SH Options:: 15608* Solaris 2 Options:: 15609* SPARC Options:: 15610* SPU Options:: 15611* System V Options:: 15612* TILE-Gx Options:: 15613* TILEPro Options:: 15614* V850 Options:: 15615* VAX Options:: 15616* Visium Options:: 15617* VMS Options:: 15618* VxWorks Options:: 15619* x86 Options:: 15620* x86 Windows Options:: 15621* Xstormy16 Options:: 15622* Xtensa Options:: 15623* zSeries Options:: 15624@end menu 15625 15626@node AArch64 Options 15627@subsection AArch64 Options 15628@cindex AArch64 Options 15629 15630These options are defined for AArch64 implementations: 15631 15632@table @gcctabopt 15633 15634@item -mabi=@var{name} 15635@opindex mabi 15636Generate code for the specified data model. Permissible values 15637are @samp{ilp32} for SysV-like data model where int, long int and pointers 15638are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits, 15639but long int and pointers are 64 bits. 15640 15641The default depends on the specific target configuration. Note that 15642the LP64 and ILP32 ABIs are not link-compatible; you must compile your 15643entire program with the same ABI, and link with a compatible set of libraries. 15644 15645@item -mbig-endian 15646@opindex mbig-endian 15647Generate big-endian code. This is the default when GCC is configured for an 15648@samp{aarch64_be-*-*} target. 15649 15650@item -mgeneral-regs-only 15651@opindex mgeneral-regs-only 15652Generate code which uses only the general-purpose registers. This will prevent 15653the compiler from using floating-point and Advanced SIMD registers but will not 15654impose any restrictions on the assembler. 15655 15656@item -mlittle-endian 15657@opindex mlittle-endian 15658Generate little-endian code. This is the default when GCC is configured for an 15659@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 15660 15661@item -mcmodel=tiny 15662@opindex mcmodel=tiny 15663Generate code for the tiny code model. The program and its statically defined 15664symbols must be within 1MB of each other. Programs can be statically or 15665dynamically linked. 15666 15667@item -mcmodel=small 15668@opindex mcmodel=small 15669Generate code for the small code model. The program and its statically defined 15670symbols must be within 4GB of each other. Programs can be statically or 15671dynamically linked. This is the default code model. 15672 15673@item -mcmodel=large 15674@opindex mcmodel=large 15675Generate code for the large code model. This makes no assumptions about 15676addresses and sizes of sections. Programs can be statically linked only. 15677 15678@item -mstrict-align 15679@itemx -mno-strict-align 15680@opindex mstrict-align 15681@opindex mno-strict-align 15682Avoid or allow generating memory accesses that may not be aligned on a natural 15683object boundary as described in the architecture specification. 15684 15685@item -momit-leaf-frame-pointer 15686@itemx -mno-omit-leaf-frame-pointer 15687@opindex momit-leaf-frame-pointer 15688@opindex mno-omit-leaf-frame-pointer 15689Omit or keep the frame pointer in leaf functions. The former behavior is the 15690default. 15691 15692@item -mstack-protector-guard=@var{guard} 15693@itemx -mstack-protector-guard-reg=@var{reg} 15694@itemx -mstack-protector-guard-offset=@var{offset} 15695@opindex mstack-protector-guard 15696@opindex mstack-protector-guard-reg 15697@opindex mstack-protector-guard-offset 15698Generate stack protection code using canary at @var{guard}. Supported 15699locations are @samp{global} for a global canary or @samp{sysreg} for a 15700canary in an appropriate system register. 15701 15702With the latter choice the options 15703@option{-mstack-protector-guard-reg=@var{reg}} and 15704@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 15705which system register to use as base register for reading the canary, 15706and from what offset from that base register. There is no default 15707register or offset as this is entirely for use within the Linux 15708kernel. 15709 15710@item -mstack-protector-guard=@var{guard} 15711@itemx -mstack-protector-guard-reg=@var{reg} 15712@itemx -mstack-protector-guard-offset=@var{offset} 15713@opindex mstack-protector-guard 15714@opindex mstack-protector-guard-reg 15715@opindex mstack-protector-guard-offset 15716Generate stack protection code using canary at @var{guard}. Supported 15717locations are @samp{global} for a global canary or @samp{sysreg} for a 15718canary in an appropriate system register. 15719 15720With the latter choice the options 15721@option{-mstack-protector-guard-reg=@var{reg}} and 15722@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 15723which system register to use as base register for reading the canary, 15724and from what offset from that base register. There is no default 15725register or offset as this is entirely for use within the Linux 15726kernel. 15727 15728@item -mtls-dialect=desc 15729@opindex mtls-dialect=desc 15730Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 15731of TLS variables. This is the default. 15732 15733@item -mtls-dialect=traditional 15734@opindex mtls-dialect=traditional 15735Use traditional TLS as the thread-local storage mechanism for dynamic accesses 15736of TLS variables. 15737 15738@item -mtls-size=@var{size} 15739@opindex mtls-size 15740Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48. 15741This option requires binutils 2.26 or newer. 15742 15743@item -mfix-cortex-a53-835769 15744@itemx -mno-fix-cortex-a53-835769 15745@opindex mfix-cortex-a53-835769 15746@opindex mno-fix-cortex-a53-835769 15747Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 15748This involves inserting a NOP instruction between memory instructions and 1574964-bit integer multiply-accumulate instructions. 15750 15751@item -mfix-cortex-a53-843419 15752@itemx -mno-fix-cortex-a53-843419 15753@opindex mfix-cortex-a53-843419 15754@opindex mno-fix-cortex-a53-843419 15755Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 15756This erratum workaround is made at link time and this will only pass the 15757corresponding flag to the linker. 15758 15759@item -mlow-precision-recip-sqrt 15760@itemx -mno-low-precision-recip-sqrt 15761@opindex mlow-precision-recip-sqrt 15762@opindex mno-low-precision-recip-sqrt 15763Enable or disable the reciprocal square root approximation. 15764This option only has an effect if @option{-ffast-math} or 15765@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 15766precision of reciprocal square root results to about 16 bits for 15767single precision and to 32 bits for double precision. 15768 15769@item -mlow-precision-sqrt 15770@itemx -mno-low-precision-sqrt 15771@opindex mlow-precision-sqrt 15772@opindex mno-low-precision-sqrt 15773Enable or disable the square root approximation. 15774This option only has an effect if @option{-ffast-math} or 15775@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 15776precision of square root results to about 16 bits for 15777single precision and to 32 bits for double precision. 15778If enabled, it implies @option{-mlow-precision-recip-sqrt}. 15779 15780@item -mlow-precision-div 15781@itemx -mno-low-precision-div 15782@opindex mlow-precision-div 15783@opindex mno-low-precision-div 15784Enable or disable the division approximation. 15785This option only has an effect if @option{-ffast-math} or 15786@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 15787precision of division results to about 16 bits for 15788single precision and to 32 bits for double precision. 15789 15790@item -mtrack-speculation 15791@itemx -mno-track-speculation 15792Enable or disable generation of additional code to track speculative 15793execution through conditional branches. The tracking state can then 15794be used by the compiler when expanding calls to 15795@code{__builtin_speculation_safe_copy} to permit a more efficient code 15796sequence to be generated. 15797 15798@item -moutline-atomics 15799@itemx -mno-outline-atomics 15800Enable or disable calls to out-of-line helpers to implement atomic operations. 15801These helpers will, at runtime, determine if the LSE instructions from 15802ARMv8.1-A can be used; if not, they will use the load/store-exclusive 15803instructions that are present in the base ARMv8.0 ISA. 15804 15805This option is only applicable when compiling for the base ARMv8.0 15806instruction set. If using a later revision, e.g. @option{-march=armv8.1-a} 15807or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be 15808used directly. The same applies when using @option{-mcpu=} when the 15809selected cpu supports the @samp{lse} feature. 15810 15811@item -march=@var{name} 15812@opindex march 15813Specify the name of the target architecture and, optionally, one or 15814more feature modifiers. This option has the form 15815@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}. 15816 15817The permissible values for @var{arch} are @samp{armv8-a}, 15818@samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a}, 15819@samp{armv8.5-a} or @var{native}. 15820 15821The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler 15822support for the ARMv8.5-A architecture extensions. 15823 15824The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler 15825support for the ARMv8.4-A architecture extensions. 15826 15827The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler 15828support for the ARMv8.3-A architecture extensions. 15829 15830The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler 15831support for the ARMv8.2-A architecture extensions. 15832 15833The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler 15834support for the ARMv8.1-A architecture extension. In particular, it 15835enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features. 15836 15837The value @samp{native} is available on native AArch64 GNU/Linux and 15838causes the compiler to pick the architecture of the host system. This 15839option has no effect if the compiler is unable to recognize the 15840architecture of the host system, 15841 15842The permissible values for @var{feature} are listed in the sub-section 15843on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 15844Feature Modifiers}. Where conflicting feature modifiers are 15845specified, the right-most feature is used. 15846 15847GCC uses @var{name} to determine what kind of instructions it can emit 15848when generating assembly code. If @option{-march} is specified 15849without either of @option{-mtune} or @option{-mcpu} also being 15850specified, the code is tuned to perform well across a range of target 15851processors implementing the target architecture. 15852 15853@item -mtune=@var{name} 15854@opindex mtune 15855Specify the name of the target processor for which GCC should tune the 15856performance of the code. Permissible values for this option are: 15857@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 15858@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 15859@samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor}, 15860@samp{neoverse-e1}, @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, 15861@samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, 15862@samp{octeontx}, @samp{octeontx81}, @samp{octeontx83}, 15863@samp{a64fx}, 15864@samp{thunderx}, @samp{thunderxt88}, 15865@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110}, 15866@samp{thunderxt83}, @samp{thunderx2t99}, @samp{zeus}, 15867@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 15868@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 15869@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} 15870@samp{native}. 15871 15872The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 15873@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 15874@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC 15875should tune for a big.LITTLE system. 15876 15877Additionally on native AArch64 GNU/Linux systems the value 15878@samp{native} tunes performance to the host system. This option has no effect 15879if the compiler is unable to recognize the processor of the host system. 15880 15881Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 15882are specified, the code is tuned to perform well across a range 15883of target processors. 15884 15885This option cannot be suffixed by feature modifiers. 15886 15887@item -mcpu=@var{name} 15888@opindex mcpu 15889Specify the name of the target processor, optionally suffixed by one 15890or more feature modifiers. This option has the form 15891@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where 15892the permissible values for @var{cpu} are the same as those available 15893for @option{-mtune}. The permissible values for @var{feature} are 15894documented in the sub-section on 15895@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 15896Feature Modifiers}. Where conflicting feature modifiers are 15897specified, the right-most feature is used. 15898 15899GCC uses @var{name} to determine what kind of instructions it can emit when 15900generating assembly code (as if by @option{-march}) and to determine 15901the target processor for which to tune for performance (as if 15902by @option{-mtune}). Where this option is used in conjunction 15903with @option{-march} or @option{-mtune}, those options take precedence 15904over the appropriate part of this option. 15905 15906@item -moverride=@var{string} 15907@opindex moverride 15908Override tuning decisions made by the back-end in response to a 15909@option{-mtune=} switch. The syntax, semantics, and accepted values 15910for @var{string} in this option are not guaranteed to be consistent 15911across releases. 15912 15913This option is only intended to be useful when developing GCC. 15914 15915@item -mverbose-cost-dump 15916@opindex mverbose-cost-dump 15917Enable verbose cost model dumping in the debug dump files. This option is 15918provided for use in debugging the compiler. 15919 15920@item -mpc-relative-literal-loads 15921@itemx -mno-pc-relative-literal-loads 15922@opindex mpc-relative-literal-loads 15923@opindex mno-pc-relative-literal-loads 15924Enable or disable PC-relative literal loads. With this option literal pools are 15925accessed using a single instruction and emitted after each function. This 15926limits the maximum size of functions to 1MB. This is enabled by default for 15927@option{-mcmodel=tiny}. 15928 15929@item -msign-return-address=@var{scope} 15930@opindex msign-return-address 15931Select the function scope on which return address signing will be applied. 15932Permissible values are @samp{none}, which disables return address signing, 15933@samp{non-leaf}, which enables pointer signing for functions which are not leaf 15934functions, and @samp{all}, which enables pointer signing for all functions. The 15935default value is @samp{none}. This option has been deprecated by 15936-mbranch-protection. 15937 15938@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti} 15939@opindex mbranch-protection 15940Select the branch protection features to use. 15941@samp{none} is the default and turns off all types of branch protection. 15942@samp{standard} turns on all types of branch protection features. If a feature 15943has additional tuning options, then @samp{standard} sets it to its standard 15944level. 15945@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard 15946level: signing functions that save the return address to memory (non-leaf 15947functions will practically always do this) using the a-key. The optional 15948argument @samp{leaf} can be used to extend the signing to include leaf 15949functions. 15950@samp{bti} turns on branch target identification mechanism. 15951 15952@item -mharden-sls=@var{opts} 15953@opindex mharden-sls 15954Enable compiler hardening against straight line speculation (SLS). 15955@var{opts} is a comma-separated list of the following options: 15956@table @samp 15957@item retbr 15958@item blr 15959@end table 15960In addition, @samp{-mharden-sls=all} enables all SLS hardening while 15961@samp{-mharden-sls=none} disables all SLS hardening. 15962 15963@item -msve-vector-bits=@var{bits} 15964@opindex msve-vector-bits 15965Specify the number of bits in an SVE vector register. This option only has 15966an effect when SVE is enabled. 15967 15968GCC supports two forms of SVE code generation: ``vector-length 15969agnostic'' output that works with any size of vector register and 15970``vector-length specific'' output that allows GCC to make assumptions 15971about the vector length when it is useful for optimization reasons. 15972The possible values of @samp{bits} are: @samp{scalable}, @samp{128}, 15973@samp{256}, @samp{512}, @samp{1024} and @samp{2048}. 15974Specifying @samp{scalable} selects vector-length agnostic 15975output. At present @samp{-msve-vector-bits=128} also generates vector-length 15976agnostic output. All other values generate vector-length specific code. 15977The behavior of these values may change in future releases and no value except 15978@samp{scalable} should be relied on for producing code that is portable across 15979different hardware SVE vector lengths. 15980 15981The default is @samp{-msve-vector-bits=scalable}, which produces 15982vector-length agnostic code. 15983@end table 15984 15985@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 15986@anchor{aarch64-feature-modifiers} 15987@cindex @option{-march} feature modifiers 15988@cindex @option{-mcpu} feature modifiers 15989Feature modifiers used with @option{-march} and @option{-mcpu} can be any of 15990the following and their inverses @option{no@var{feature}}: 15991 15992@table @samp 15993@item crc 15994Enable CRC extension. This is on by default for 15995@option{-march=armv8.1-a}. 15996@item crypto 15997Enable Crypto extension. This also enables Advanced SIMD and floating-point 15998instructions. 15999@item fp 16000Enable floating-point instructions. This is on by default for all possible 16001values for options @option{-march} and @option{-mcpu}. 16002@item simd 16003Enable Advanced SIMD instructions. This also enables floating-point 16004instructions. This is on by default for all possible values for options 16005@option{-march} and @option{-mcpu}. 16006@item sve 16007Enable Scalable Vector Extension instructions. This also enables Advanced 16008SIMD and floating-point instructions. 16009@item lse 16010Enable Large System Extension instructions. This is on by default for 16011@option{-march=armv8.1-a}. 16012@item rdma 16013Enable Round Double Multiply Accumulate instructions. This is on by default 16014for @option{-march=armv8.1-a}. 16015@item fp16 16016Enable FP16 extension. This also enables floating-point instructions. 16017@item fp16fml 16018Enable FP16 fmla extension. This also enables FP16 extensions and 16019floating-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. 16020 16021@item rcpc 16022Enable the RcPc extension. This does not change code generation from GCC, 16023but is passed on to the assembler, enabling inline asm statements to use 16024instructions from the RcPc extension. 16025@item dotprod 16026Enable the Dot Product extension. This also enables Advanced SIMD instructions. 16027@item aes 16028Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced 16029SIMD instructions. 16030@item sha2 16031Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions. 16032@item sha3 16033Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD 16034instructions. Use of this option with architectures prior to Armv8.2-A is not supported. 16035@item sm4 16036Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. 16037Use of this option with architectures prior to Armv8.2-A is not supported. 16038@item profile 16039Enable the Statistical Profiling extension. This option is only to enable the 16040extension at the assembler level and does not affect code generation. 16041@item rng 16042Enable the Armv8.5-a Random Number instructions. This option is only to 16043enable the extension at the assembler level and does not affect code 16044generation. 16045@item memtag 16046Enable the Armv8.5-a Memory Tagging Extensions. This option is only to 16047enable the extension at the assembler level and does not affect code 16048generation. 16049@item sb 16050Enable the Armv8-a Speculation Barrier instruction. This option is only to 16051enable the extension at the assembler level and does not affect code 16052generation. This option is enabled by default for @option{-march=armv8.5-a}. 16053@item ssbs 16054Enable the Armv8-a Speculative Store Bypass Safe instruction. This option 16055is only to enable the extension at the assembler level and does not affect code 16056generation. This option is enabled by default for @option{-march=armv8.5-a}. 16057@item predres 16058Enable the Armv8-a Execution and Data Prediction Restriction instructions. 16059This option is only to enable the extension at the assembler level and does 16060not affect code generation. This option is enabled by default for 16061@option{-march=armv8.5-a}. 16062 16063@end table 16064 16065Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd}, 16066which implies @option{fp}. 16067Conversely, @option{nofp} implies @option{nosimd}, which implies 16068@option{nocrypto}, @option{noaes} and @option{nosha2}. 16069 16070@node Adapteva Epiphany Options 16071@subsection Adapteva Epiphany Options 16072 16073These @samp{-m} options are defined for Adapteva Epiphany: 16074 16075@table @gcctabopt 16076@item -mhalf-reg-file 16077@opindex mhalf-reg-file 16078Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 16079That allows code to run on hardware variants that lack these registers. 16080 16081@item -mprefer-short-insn-regs 16082@opindex mprefer-short-insn-regs 16083Preferentially allocate registers that allow short instruction generation. 16084This can result in increased instruction count, so this may either reduce or 16085increase overall code size. 16086 16087@item -mbranch-cost=@var{num} 16088@opindex mbranch-cost 16089Set the cost of branches to roughly @var{num} ``simple'' instructions. 16090This cost is only a heuristic and is not guaranteed to produce 16091consistent results across releases. 16092 16093@item -mcmove 16094@opindex mcmove 16095Enable the generation of conditional moves. 16096 16097@item -mnops=@var{num} 16098@opindex mnops 16099Emit @var{num} NOPs before every other generated instruction. 16100 16101@item -mno-soft-cmpsf 16102@opindex mno-soft-cmpsf 16103@opindex msoft-cmpsf 16104For single-precision floating-point comparisons, emit an @code{fsub} instruction 16105and test the flags. This is faster than a software comparison, but can 16106get incorrect results in the presence of NaNs, or when two different small 16107numbers are compared such that their difference is calculated as zero. 16108The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 16109software comparisons. 16110 16111@item -mstack-offset=@var{num} 16112@opindex mstack-offset 16113Set the offset between the top of the stack and the stack pointer. 16114E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 16115can be used by leaf functions without stack allocation. 16116Values other than @samp{8} or @samp{16} are untested and unlikely to work. 16117Note also that this option changes the ABI; compiling a program with a 16118different stack offset than the libraries have been compiled with 16119generally does not work. 16120This option can be useful if you want to evaluate if a different stack 16121offset would give you better code, but to actually use a different stack 16122offset to build working programs, it is recommended to configure the 16123toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 16124 16125@item -mno-round-nearest 16126@opindex mno-round-nearest 16127@opindex mround-nearest 16128Make the scheduler assume that the rounding mode has been set to 16129truncating. The default is @option{-mround-nearest}. 16130 16131@item -mlong-calls 16132@opindex mlong-calls 16133If not otherwise specified by an attribute, assume all calls might be beyond 16134the offset range of the @code{b} / @code{bl} instructions, and therefore load the 16135function address into a register before performing a (otherwise direct) call. 16136This is the default. 16137 16138@item -mshort-calls 16139@opindex short-calls 16140If not otherwise specified by an attribute, assume all direct calls are 16141in the range of the @code{b} / @code{bl} instructions, so use these instructions 16142for direct calls. The default is @option{-mlong-calls}. 16143 16144@item -msmall16 16145@opindex msmall16 16146Assume addresses can be loaded as 16-bit unsigned values. This does not 16147apply to function addresses for which @option{-mlong-calls} semantics 16148are in effect. 16149 16150@item -mfp-mode=@var{mode} 16151@opindex mfp-mode 16152Set the prevailing mode of the floating-point unit. 16153This determines the floating-point mode that is provided and expected 16154at function call and return time. Making this mode match the mode you 16155predominantly need at function start can make your programs smaller and 16156faster by avoiding unnecessary mode switches. 16157 16158@var{mode} can be set to one the following values: 16159 16160@table @samp 16161@item caller 16162Any mode at function entry is valid, and retained or restored when 16163the function returns, and when it calls other functions. 16164This mode is useful for compiling libraries or other compilation units 16165you might want to incorporate into different programs with different 16166prevailing FPU modes, and the convenience of being able to use a single 16167object file outweighs the size and speed overhead for any extra 16168mode switching that might be needed, compared with what would be needed 16169with a more specific choice of prevailing FPU mode. 16170 16171@item truncate 16172This is the mode used for floating-point calculations with 16173truncating (i.e.@: round towards zero) rounding mode. That includes 16174conversion from floating point to integer. 16175 16176@item round-nearest 16177This is the mode used for floating-point calculations with 16178round-to-nearest-or-even rounding mode. 16179 16180@item int 16181This is the mode used to perform integer calculations in the FPU, e.g.@: 16182integer multiply, or integer multiply-and-accumulate. 16183@end table 16184 16185The default is @option{-mfp-mode=caller} 16186 16187@item -mno-split-lohi 16188@itemx -mno-postinc 16189@itemx -mno-postmodify 16190@opindex mno-split-lohi 16191@opindex msplit-lohi 16192@opindex mno-postinc 16193@opindex mpostinc 16194@opindex mno-postmodify 16195@opindex mpostmodify 16196Code generation tweaks that disable, respectively, splitting of 32-bit 16197loads, generation of post-increment addresses, and generation of 16198post-modify addresses. The defaults are @option{msplit-lohi}, 16199@option{-mpost-inc}, and @option{-mpost-modify}. 16200 16201@item -mnovect-double 16202@opindex mno-vect-double 16203@opindex mvect-double 16204Change the preferred SIMD mode to SImode. The default is 16205@option{-mvect-double}, which uses DImode as preferred SIMD mode. 16206 16207@item -max-vect-align=@var{num} 16208@opindex max-vect-align 16209The maximum alignment for SIMD vector mode types. 16210@var{num} may be 4 or 8. The default is 8. 16211Note that this is an ABI change, even though many library function 16212interfaces are unaffected if they don't use SIMD vector modes 16213in places that affect size and/or alignment of relevant types. 16214 16215@item -msplit-vecmove-early 16216@opindex msplit-vecmove-early 16217Split vector moves into single word moves before reload. In theory this 16218can give better register allocation, but so far the reverse seems to be 16219generally the case. 16220 16221@item -m1reg-@var{reg} 16222@opindex m1reg- 16223Specify a register to hold the constant @minus{}1, which makes loading small negative 16224constants and certain bitmasks faster. 16225Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 16226which specify use of that register as a fixed register, 16227and @samp{none}, which means that no register is used for this 16228purpose. The default is @option{-m1reg-none}. 16229 16230@end table 16231 16232@node AMD GCN Options 16233@subsection AMD GCN Options 16234@cindex AMD GCN Options 16235 16236These options are defined specifically for the AMD GCN port. 16237 16238@table @gcctabopt 16239 16240@item -march=@var{gpu} 16241@opindex march 16242@itemx -mtune=@var{gpu} 16243@opindex mtune 16244Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu} 16245are 16246 16247@table @samp 16248@opindex fiji 16249@item fiji 16250Compile for GCN3 Fiji devices (gfx803). 16251 16252@item gfx900 16253Compile for GCN5 Vega 10 devices (gfx900). 16254 16255@end table 16256 16257@item -mstack-size=@var{bytes} 16258@opindex mstack-size 16259Specify how many @var{bytes} of stack space will be requested for each GPU 16260thread (wave-front). Beware that there may be many threads and limited memory 16261available. The size of the stack allocation may also have an impact on 16262run-time performance. The default is 32KB when using OpenACC or OpenMP, and 162631MB otherwise. 16264 16265@end table 16266 16267@node ARC Options 16268@subsection ARC Options 16269@cindex ARC options 16270 16271The following options control the architecture variant for which code 16272is being compiled: 16273 16274@c architecture variants 16275@table @gcctabopt 16276 16277@item -mbarrel-shifter 16278@opindex mbarrel-shifter 16279Generate instructions supported by barrel shifter. This is the default 16280unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect. 16281 16282@item -mjli-always 16283@opindex mjli-alawys 16284Force to call a function using jli_s instruction. This option is 16285valid only for ARCv2 architecture. 16286 16287@item -mcpu=@var{cpu} 16288@opindex mcpu 16289Set architecture type, register usage, and instruction scheduling 16290parameters for @var{cpu}. There are also shortcut alias options 16291available for backward compatibility and convenience. Supported 16292values for @var{cpu} are 16293 16294@table @samp 16295@opindex mA6 16296@opindex mARC600 16297@item arc600 16298Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 16299 16300@item arc601 16301@opindex mARC601 16302Compile for ARC601. Alias: @option{-mARC601}. 16303 16304@item arc700 16305@opindex mA7 16306@opindex mARC700 16307Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 16308This is the default when configured with @option{--with-cpu=arc700}@. 16309 16310@item arcem 16311Compile for ARC EM. 16312 16313@item archs 16314Compile for ARC HS. 16315 16316@item em 16317Compile for ARC EM CPU with no hardware extensions. 16318 16319@item em4 16320Compile for ARC EM4 CPU. 16321 16322@item em4_dmips 16323Compile for ARC EM4 DMIPS CPU. 16324 16325@item em4_fpus 16326Compile for ARC EM4 DMIPS CPU with the single-precision floating-point 16327extension. 16328 16329@item em4_fpuda 16330Compile for ARC EM4 DMIPS CPU with single-precision floating-point and 16331double assist instructions. 16332 16333@item hs 16334Compile for ARC HS CPU with no hardware extensions except the atomic 16335instructions. 16336 16337@item hs34 16338Compile for ARC HS34 CPU. 16339 16340@item hs38 16341Compile for ARC HS38 CPU. 16342 16343@item hs38_linux 16344Compile for ARC HS38 CPU with all hardware extensions on. 16345 16346@item arc600_norm 16347Compile for ARC 600 CPU with @code{norm} instructions enabled. 16348 16349@item arc600_mul32x16 16350Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 16351instructions enabled. 16352 16353@item arc600_mul64 16354Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 16355instructions enabled. 16356 16357@item arc601_norm 16358Compile for ARC 601 CPU with @code{norm} instructions enabled. 16359 16360@item arc601_mul32x16 16361Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply 16362instructions enabled. 16363 16364@item arc601_mul64 16365Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family 16366instructions enabled. 16367 16368@item nps400 16369Compile for ARC 700 on NPS400 chip. 16370 16371@item em_mini 16372Compile for ARC EM minimalist configuration featuring reduced register 16373set. 16374 16375@end table 16376 16377@item -mdpfp 16378@opindex mdpfp 16379@itemx -mdpfp-compact 16380@opindex mdpfp-compact 16381Generate double-precision FPX instructions, tuned for the compact 16382implementation. 16383 16384@item -mdpfp-fast 16385@opindex mdpfp-fast 16386Generate double-precision FPX instructions, tuned for the fast 16387implementation. 16388 16389@item -mno-dpfp-lrsr 16390@opindex mno-dpfp-lrsr 16391Disable @code{lr} and @code{sr} instructions from using FPX extension 16392aux registers. 16393 16394@item -mea 16395@opindex mea 16396Generate extended arithmetic instructions. Currently only 16397@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 16398supported. This is always enabled for @option{-mcpu=ARC700}. 16399 16400@item -mno-mpy 16401@opindex mno-mpy 16402@opindex mmpy 16403Do not generate @code{mpy}-family instructions for ARC700. This option is 16404deprecated. 16405 16406@item -mmul32x16 16407@opindex mmul32x16 16408Generate 32x16-bit multiply and multiply-accumulate instructions. 16409 16410@item -mmul64 16411@opindex mmul64 16412Generate @code{mul64} and @code{mulu64} instructions. 16413Only valid for @option{-mcpu=ARC600}. 16414 16415@item -mnorm 16416@opindex mnorm 16417Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700} 16418is in effect. 16419 16420@item -mspfp 16421@opindex mspfp 16422@itemx -mspfp-compact 16423@opindex mspfp-compact 16424Generate single-precision FPX instructions, tuned for the compact 16425implementation. 16426 16427@item -mspfp-fast 16428@opindex mspfp-fast 16429Generate single-precision FPX instructions, tuned for the fast 16430implementation. 16431 16432@item -msimd 16433@opindex msimd 16434Enable generation of ARC SIMD instructions via target-specific 16435builtins. Only valid for @option{-mcpu=ARC700}. 16436 16437@item -msoft-float 16438@opindex msoft-float 16439This option ignored; it is provided for compatibility purposes only. 16440Software floating-point code is emitted by default, and this default 16441can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or 16442@option{-mspfp-fast} for single precision, and @option{-mdpfp}, 16443@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision. 16444 16445@item -mswap 16446@opindex mswap 16447Generate @code{swap} instructions. 16448 16449@item -matomic 16450@opindex matomic 16451This enables use of the locked load/store conditional extension to implement 16452atomic memory built-in functions. Not available for ARC 6xx or ARC 16453EM cores. 16454 16455@item -mdiv-rem 16456@opindex mdiv-rem 16457Enable @code{div} and @code{rem} instructions for ARCv2 cores. 16458 16459@item -mcode-density 16460@opindex mcode-density 16461Enable code density instructions for ARC EM. 16462This option is on by default for ARC HS. 16463 16464@item -mll64 16465@opindex mll64 16466Enable double load/store operations for ARC HS cores. 16467 16468@item -mtp-regno=@var{regno} 16469@opindex mtp-regno 16470Specify thread pointer register number. 16471 16472@item -mmpy-option=@var{multo} 16473@opindex mmpy-option 16474Compile ARCv2 code with a multiplier design option. You can specify 16475the option using either a string or numeric value for @var{multo}. 16476@samp{wlh1} is the default value. The recognized values are: 16477 16478@table @samp 16479@item 0 16480@itemx none 16481No multiplier available. 16482 16483@item 1 16484@itemx w 1648516x16 multiplier, fully pipelined. 16486The following instructions are enabled: @code{mpyw} and @code{mpyuw}. 16487 16488@item 2 16489@itemx wlh1 1649032x32 multiplier, fully 16491pipelined (1 stage). The following instructions are additionally 16492enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16493 16494@item 3 16495@itemx wlh2 1649632x32 multiplier, fully pipelined 16497(2 stages). The following instructions are additionally enabled: @code{mpy}, 16498@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16499 16500@item 4 16501@itemx wlh3 16502Two 16x16 multipliers, blocking, 16503sequential. The following instructions are additionally enabled: @code{mpy}, 16504@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16505 16506@item 5 16507@itemx wlh4 16508One 16x16 multiplier, blocking, 16509sequential. The following instructions are additionally enabled: @code{mpy}, 16510@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16511 16512@item 6 16513@itemx wlh5 16514One 32x4 multiplier, blocking, 16515sequential. The following instructions are additionally enabled: @code{mpy}, 16516@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 16517 16518@item 7 16519@itemx plus_dmpy 16520ARC HS SIMD support. 16521 16522@item 8 16523@itemx plus_macd 16524ARC HS SIMD support. 16525 16526@item 9 16527@itemx plus_qmacw 16528ARC HS SIMD support. 16529 16530@end table 16531 16532This option is only available for ARCv2 cores@. 16533 16534@item -mfpu=@var{fpu} 16535@opindex mfpu 16536Enables support for specific floating-point hardware extensions for ARCv2 16537cores. Supported values for @var{fpu} are: 16538 16539@table @samp 16540 16541@item fpus 16542Enables support for single-precision floating-point hardware 16543extensions@. 16544 16545@item fpud 16546Enables support for double-precision floating-point hardware 16547extensions. The single-precision floating-point extension is also 16548enabled. Not available for ARC EM@. 16549 16550@item fpuda 16551Enables support for double-precision floating-point hardware 16552extensions using double-precision assist instructions. The single-precision 16553floating-point extension is also enabled. This option is 16554only available for ARC EM@. 16555 16556@item fpuda_div 16557Enables support for double-precision floating-point hardware 16558extensions using double-precision assist instructions. 16559The single-precision floating-point, square-root, and divide 16560extensions are also enabled. This option is 16561only available for ARC EM@. 16562 16563@item fpuda_fma 16564Enables support for double-precision floating-point hardware 16565extensions using double-precision assist instructions. 16566The single-precision floating-point and fused multiply and add 16567hardware extensions are also enabled. This option is 16568only available for ARC EM@. 16569 16570@item fpuda_all 16571Enables support for double-precision floating-point hardware 16572extensions using double-precision assist instructions. 16573All single-precision floating-point hardware extensions are also 16574enabled. This option is only available for ARC EM@. 16575 16576@item fpus_div 16577Enables support for single-precision floating-point, square-root and divide 16578hardware extensions@. 16579 16580@item fpud_div 16581Enables support for double-precision floating-point, square-root and divide 16582hardware extensions. This option 16583includes option @samp{fpus_div}. Not available for ARC EM@. 16584 16585@item fpus_fma 16586Enables support for single-precision floating-point and 16587fused multiply and add hardware extensions@. 16588 16589@item fpud_fma 16590Enables support for double-precision floating-point and 16591fused multiply and add hardware extensions. This option 16592includes option @samp{fpus_fma}. Not available for ARC EM@. 16593 16594@item fpus_all 16595Enables support for all single-precision floating-point hardware 16596extensions@. 16597 16598@item fpud_all 16599Enables support for all single- and double-precision floating-point 16600hardware extensions. Not available for ARC EM@. 16601 16602@end table 16603 16604@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count} 16605@opindex mirq-ctrl-saved 16606Specifies general-purposes registers that the processor automatically 16607saves/restores on interrupt entry and exit. @var{register-range} is 16608specified as two registers separated by a dash. The register range 16609always starts with @code{r0}, the upper limit is @code{fp} register. 16610@var{blink} and @var{lp_count} are optional. This option is only 16611valid for ARC EM and ARC HS cores. 16612 16613@item -mrgf-banked-regs=@var{number} 16614@opindex mrgf-banked-regs 16615Specifies the number of registers replicated in second register bank 16616on entry to fast interrupt. Fast interrupts are interrupts with the 16617highest priority level P0. These interrupts save only PC and STATUS32 16618registers to avoid memory transactions during interrupt entry and exit 16619sequences. Use this option when you are using fast interrupts in an 16620ARC V2 family processor. Permitted values are 4, 8, 16, and 32. 16621 16622@item -mlpc-width=@var{width} 16623@opindex mlpc-width 16624Specify the width of the @code{lp_count} register. Valid values for 16625@var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is 16626fixed to 32 bits. If the width is less than 32, the compiler does not 16627attempt to transform loops in your program to use the zero-delay loop 16628mechanism unless it is known that the @code{lp_count} register can 16629hold the required loop-counter value. Depending on the width 16630specified, the compiler and run-time library might continue to use the 16631loop mechanism for various needs. This option defines macro 16632@code{__ARC_LPC_WIDTH__} with the value of @var{width}. 16633 16634@item -mrf16 16635@opindex mrf16 16636This option instructs the compiler to generate code for a 16-entry 16637register file. This option defines the @code{__ARC_RF16__} 16638preprocessor macro. 16639 16640@item -mbranch-index 16641@opindex mbranch-index 16642Enable use of @code{bi} or @code{bih} instructions to implement jump 16643tables. 16644 16645@end table 16646 16647The following options are passed through to the assembler, and also 16648define preprocessor macro symbols. 16649 16650@c Flags used by the assembler, but for which we define preprocessor 16651@c macro symbols as well. 16652@table @gcctabopt 16653@item -mdsp-packa 16654@opindex mdsp-packa 16655Passed down to the assembler to enable the DSP Pack A extensions. 16656Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is 16657deprecated. 16658 16659@item -mdvbf 16660@opindex mdvbf 16661Passed down to the assembler to enable the dual Viterbi butterfly 16662extension. Also sets the preprocessor symbol @code{__Xdvbf}. This 16663option is deprecated. 16664 16665@c ARC700 4.10 extension instruction 16666@item -mlock 16667@opindex mlock 16668Passed down to the assembler to enable the locked load/store 16669conditional extension. Also sets the preprocessor symbol 16670@code{__Xlock}. 16671 16672@item -mmac-d16 16673@opindex mmac-d16 16674Passed down to the assembler. Also sets the preprocessor symbol 16675@code{__Xxmac_d16}. This option is deprecated. 16676 16677@item -mmac-24 16678@opindex mmac-24 16679Passed down to the assembler. Also sets the preprocessor symbol 16680@code{__Xxmac_24}. This option is deprecated. 16681 16682@c ARC700 4.10 extension instruction 16683@item -mrtsc 16684@opindex mrtsc 16685Passed down to the assembler to enable the 64-bit time-stamp counter 16686extension instruction. Also sets the preprocessor symbol 16687@code{__Xrtsc}. This option is deprecated. 16688 16689@c ARC700 4.10 extension instruction 16690@item -mswape 16691@opindex mswape 16692Passed down to the assembler to enable the swap byte ordering 16693extension instruction. Also sets the preprocessor symbol 16694@code{__Xswape}. 16695 16696@item -mtelephony 16697@opindex mtelephony 16698Passed down to the assembler to enable dual- and single-operand 16699instructions for telephony. Also sets the preprocessor symbol 16700@code{__Xtelephony}. This option is deprecated. 16701 16702@item -mxy 16703@opindex mxy 16704Passed down to the assembler to enable the XY memory extension. Also 16705sets the preprocessor symbol @code{__Xxy}. 16706 16707@end table 16708 16709The following options control how the assembly code is annotated: 16710 16711@c Assembly annotation options 16712@table @gcctabopt 16713@item -misize 16714@opindex misize 16715Annotate assembler instructions with estimated addresses. 16716 16717@item -mannotate-align 16718@opindex mannotate-align 16719Explain what alignment considerations lead to the decision to make an 16720instruction short or long. 16721 16722@end table 16723 16724The following options are passed through to the linker: 16725 16726@c options passed through to the linker 16727@table @gcctabopt 16728@item -marclinux 16729@opindex marclinux 16730Passed through to the linker, to specify use of the @code{arclinux} emulation. 16731This option is enabled by default in tool chains built for 16732@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 16733when profiling is not requested. 16734 16735@item -marclinux_prof 16736@opindex marclinux_prof 16737Passed through to the linker, to specify use of the 16738@code{arclinux_prof} emulation. This option is enabled by default in 16739tool chains built for @w{@code{arc-linux-uclibc}} and 16740@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 16741 16742@end table 16743 16744The following options control the semantics of generated code: 16745 16746@c semantically relevant code generation options 16747@table @gcctabopt 16748@item -mlong-calls 16749@opindex mlong-calls 16750Generate calls as register indirect calls, thus providing access 16751to the full 32-bit address range. 16752 16753@item -mmedium-calls 16754@opindex mmedium-calls 16755Don't use less than 25-bit addressing range for calls, which is the 16756offset available for an unconditional branch-and-link 16757instruction. Conditional execution of function calls is suppressed, to 16758allow use of the 25-bit range, rather than the 21-bit range with 16759conditional branch-and-link. This is the default for tool chains built 16760for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 16761 16762@item -G @var{num} 16763@opindex G 16764Put definitions of externally-visible data in a small data section if 16765that data is no bigger than @var{num} bytes. The default value of 16766@var{num} is 4 for any ARC configuration, or 8 when we have double 16767load/store operations. 16768 16769@item -mno-sdata 16770@opindex mno-sdata 16771@opindex msdata 16772Do not generate sdata references. This is the default for tool chains 16773built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 16774targets. 16775 16776@item -mvolatile-cache 16777@opindex mvolatile-cache 16778Use ordinarily cached memory accesses for volatile references. This is the 16779default. 16780 16781@item -mno-volatile-cache 16782@opindex mno-volatile-cache 16783@opindex mvolatile-cache 16784Enable cache bypass for volatile references. 16785 16786@end table 16787 16788The following options fine tune code generation: 16789@c code generation tuning options 16790@table @gcctabopt 16791@item -malign-call 16792@opindex malign-call 16793Do alignment optimizations for call instructions. 16794 16795@item -mauto-modify-reg 16796@opindex mauto-modify-reg 16797Enable the use of pre/post modify with register displacement. 16798 16799@item -mbbit-peephole 16800@opindex mbbit-peephole 16801Enable bbit peephole2. 16802 16803@item -mno-brcc 16804@opindex mno-brcc 16805This option disables a target-specific pass in @file{arc_reorg} to 16806generate compare-and-branch (@code{br@var{cc}}) instructions. 16807It has no effect on 16808generation of these instructions driven by the combiner pass. 16809 16810@item -mcase-vector-pcrel 16811@opindex mcase-vector-pcrel 16812Use PC-relative switch case tables to enable case table shortening. 16813This is the default for @option{-Os}. 16814 16815@item -mcompact-casesi 16816@opindex mcompact-casesi 16817Enable compact @code{casesi} pattern. This is the default for @option{-Os}, 16818and only available for ARCv1 cores. This option is deprecated. 16819 16820@item -mno-cond-exec 16821@opindex mno-cond-exec 16822Disable the ARCompact-specific pass to generate conditional 16823execution instructions. 16824 16825Due to delay slot scheduling and interactions between operand numbers, 16826literal sizes, instruction lengths, and the support for conditional execution, 16827the target-independent pass to generate conditional execution is often lacking, 16828so the ARC port has kept a special pass around that tries to find more 16829conditional execution generation opportunities after register allocation, 16830branch shortening, and delay slot scheduling have been done. This pass 16831generally, but not always, improves performance and code size, at the cost of 16832extra compilation time, which is why there is an option to switch it off. 16833If you have a problem with call instructions exceeding their allowable 16834offset range because they are conditionalized, you should consider using 16835@option{-mmedium-calls} instead. 16836 16837@item -mearly-cbranchsi 16838@opindex mearly-cbranchsi 16839Enable pre-reload use of the @code{cbranchsi} pattern. 16840 16841@item -mexpand-adddi 16842@opindex mexpand-adddi 16843Expand @code{adddi3} and @code{subdi3} at RTL generation time into 16844@code{add.f}, @code{adc} etc. This option is deprecated. 16845 16846@item -mindexed-loads 16847@opindex mindexed-loads 16848Enable the use of indexed loads. This can be problematic because some 16849optimizers then assume that indexed stores exist, which is not 16850the case. 16851 16852@item -mlra 16853@opindex mlra 16854Enable Local Register Allocation. This is still experimental for ARC, 16855so by default the compiler uses standard reload 16856(i.e.@: @option{-mno-lra}). 16857 16858@item -mlra-priority-none 16859@opindex mlra-priority-none 16860Don't indicate any priority for target registers. 16861 16862@item -mlra-priority-compact 16863@opindex mlra-priority-compact 16864Indicate target register priority for r0..r3 / r12..r15. 16865 16866@item -mlra-priority-noncompact 16867@opindex mlra-priority-noncompact 16868Reduce target register priority for r0..r3 / r12..r15. 16869 16870@item -mmillicode 16871@opindex mmillicode 16872When optimizing for size (using @option{-Os}), prologues and epilogues 16873that have to save or restore a large number of registers are often 16874shortened by using call to a special function in libgcc; this is 16875referred to as a @emph{millicode} call. As these calls can pose 16876performance issues, and/or cause linking issues when linking in a 16877nonstandard way, this option is provided to turn on or off millicode 16878call generation. 16879 16880@item -mcode-density-frame 16881@opindex mcode-density-frame 16882This option enable the compiler to emit @code{enter} and @code{leave} 16883instructions. These instructions are only valid for CPUs with 16884code-density feature. 16885 16886@item -mmixed-code 16887@opindex mmixed-code 16888Tweak register allocation to help 16-bit instruction generation. 16889This generally has the effect of decreasing the average instruction size 16890while increasing the instruction count. 16891 16892@item -mq-class 16893@opindex mq-class 16894Enable @samp{q} instruction alternatives. 16895This is the default for @option{-Os}. 16896 16897@item -mRcq 16898@opindex mRcq 16899Enable @samp{Rcq} constraint handling. 16900Most short code generation depends on this. 16901This is the default. 16902 16903@item -mRcw 16904@opindex mRcw 16905Enable @samp{Rcw} constraint handling. 16906Most ccfsm condexec mostly depends on this. 16907This is the default. 16908 16909@item -msize-level=@var{level} 16910@opindex msize-level 16911Fine-tune size optimization with regards to instruction lengths and alignment. 16912The recognized values for @var{level} are: 16913@table @samp 16914@item 0 16915No size optimization. This level is deprecated and treated like @samp{1}. 16916 16917@item 1 16918Short instructions are used opportunistically. 16919 16920@item 2 16921In addition, alignment of loops and of code after barriers are dropped. 16922 16923@item 3 16924In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 16925 16926@end table 16927 16928This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 16929the behavior when this is not set is equivalent to level @samp{1}. 16930 16931@item -mtune=@var{cpu} 16932@opindex mtune 16933Set instruction scheduling parameters for @var{cpu}, overriding any implied 16934by @option{-mcpu=}. 16935 16936Supported values for @var{cpu} are 16937 16938@table @samp 16939@item ARC600 16940Tune for ARC600 CPU. 16941 16942@item ARC601 16943Tune for ARC601 CPU. 16944 16945@item ARC700 16946Tune for ARC700 CPU with standard multiplier block. 16947 16948@item ARC700-xmac 16949Tune for ARC700 CPU with XMAC block. 16950 16951@item ARC725D 16952Tune for ARC725D CPU. 16953 16954@item ARC750D 16955Tune for ARC750D CPU. 16956 16957@end table 16958 16959@item -mmultcost=@var{num} 16960@opindex mmultcost 16961Cost to assume for a multiply instruction, with @samp{4} being equal to a 16962normal instruction. 16963 16964@item -munalign-prob-threshold=@var{probability} 16965@opindex munalign-prob-threshold 16966Set probability threshold for unaligning branches. 16967When tuning for @samp{ARC700} and optimizing for speed, branches without 16968filled delay slot are preferably emitted unaligned and long, unless 16969profiling indicates that the probability for the branch to be taken 16970is below @var{probability}. @xref{Cross-profiling}. 16971The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. 16972 16973@end table 16974 16975The following options are maintained for backward compatibility, but 16976are now deprecated and will be removed in a future release: 16977 16978@c Deprecated options 16979@table @gcctabopt 16980 16981@item -margonaut 16982@opindex margonaut 16983Obsolete FPX. 16984 16985@item -mbig-endian 16986@opindex mbig-endian 16987@itemx -EB 16988@opindex EB 16989Compile code for big-endian targets. Use of these options is now 16990deprecated. Big-endian code is supported by configuring GCC to build 16991@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets, 16992for which big endian is the default. 16993 16994@item -mlittle-endian 16995@opindex mlittle-endian 16996@itemx -EL 16997@opindex EL 16998Compile code for little-endian targets. Use of these options is now 16999deprecated. Little-endian code is supported by configuring GCC to build 17000@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets, 17001for which little endian is the default. 17002 17003@item -mbarrel_shifter 17004@opindex mbarrel_shifter 17005Replaced by @option{-mbarrel-shifter}. 17006 17007@item -mdpfp_compact 17008@opindex mdpfp_compact 17009Replaced by @option{-mdpfp-compact}. 17010 17011@item -mdpfp_fast 17012@opindex mdpfp_fast 17013Replaced by @option{-mdpfp-fast}. 17014 17015@item -mdsp_packa 17016@opindex mdsp_packa 17017Replaced by @option{-mdsp-packa}. 17018 17019@item -mEA 17020@opindex mEA 17021Replaced by @option{-mea}. 17022 17023@item -mmac_24 17024@opindex mmac_24 17025Replaced by @option{-mmac-24}. 17026 17027@item -mmac_d16 17028@opindex mmac_d16 17029Replaced by @option{-mmac-d16}. 17030 17031@item -mspfp_compact 17032@opindex mspfp_compact 17033Replaced by @option{-mspfp-compact}. 17034 17035@item -mspfp_fast 17036@opindex mspfp_fast 17037Replaced by @option{-mspfp-fast}. 17038 17039@item -mtune=@var{cpu} 17040@opindex mtune 17041Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 17042@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 17043@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively. 17044 17045@item -multcost=@var{num} 17046@opindex multcost 17047Replaced by @option{-mmultcost}. 17048 17049@end table 17050 17051@node ARM Options 17052@subsection ARM Options 17053@cindex ARM options 17054 17055These @samp{-m} options are defined for the ARM port: 17056 17057@table @gcctabopt 17058@item -mabi=@var{name} 17059@opindex mabi 17060Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 17061@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 17062 17063@item -mapcs-frame 17064@opindex mapcs-frame 17065Generate a stack frame that is compliant with the ARM Procedure Call 17066Standard for all functions, even if this is not strictly necessary for 17067correct execution of the code. Specifying @option{-fomit-frame-pointer} 17068with this option causes the stack frames not to be generated for 17069leaf functions. The default is @option{-mno-apcs-frame}. 17070This option is deprecated. 17071 17072@item -mapcs 17073@opindex mapcs 17074This is a synonym for @option{-mapcs-frame} and is deprecated. 17075 17076@ignore 17077@c not currently implemented 17078@item -mapcs-stack-check 17079@opindex mapcs-stack-check 17080Generate code to check the amount of stack space available upon entry to 17081every function (that actually uses some stack space). If there is 17082insufficient space available then either the function 17083@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 17084called, depending upon the amount of stack space required. The runtime 17085system is required to provide these functions. The default is 17086@option{-mno-apcs-stack-check}, since this produces smaller code. 17087 17088@c not currently implemented 17089@item -mapcs-reentrant 17090@opindex mapcs-reentrant 17091Generate reentrant, position-independent code. The default is 17092@option{-mno-apcs-reentrant}. 17093@end ignore 17094 17095@item -mthumb-interwork 17096@opindex mthumb-interwork 17097Generate code that supports calling between the ARM and Thumb 17098instruction sets. Without this option, on pre-v5 architectures, the 17099two instruction sets cannot be reliably used inside one program. The 17100default is @option{-mno-thumb-interwork}, since slightly larger code 17101is generated when @option{-mthumb-interwork} is specified. In AAPCS 17102configurations this option is meaningless. 17103 17104@item -mno-sched-prolog 17105@opindex mno-sched-prolog 17106@opindex msched-prolog 17107Prevent the reordering of instructions in the function prologue, or the 17108merging of those instruction with the instructions in the function's 17109body. This means that all functions start with a recognizable set 17110of instructions (or in fact one of a choice from a small set of 17111different function prologues), and this information can be used to 17112locate the start of functions inside an executable piece of code. The 17113default is @option{-msched-prolog}. 17114 17115@item -mfloat-abi=@var{name} 17116@opindex mfloat-abi 17117Specifies which floating-point ABI to use. Permissible values 17118are: @samp{soft}, @samp{softfp} and @samp{hard}. 17119 17120Specifying @samp{soft} causes GCC to generate output containing 17121library calls for floating-point operations. 17122@samp{softfp} allows the generation of code using hardware floating-point 17123instructions, but still uses the soft-float calling conventions. 17124@samp{hard} allows generation of floating-point instructions 17125and uses FPU-specific calling conventions. 17126 17127The default depends on the specific target configuration. Note that 17128the hard-float and soft-float ABIs are not link-compatible; you must 17129compile your entire program with the same ABI, and link with a 17130compatible set of libraries. 17131 17132@item -mgeneral-regs-only 17133@opindex mgeneral-regs-only 17134Generate code which uses only the general-purpose registers. This will prevent 17135the compiler from using floating-point and Advanced SIMD registers but will not 17136impose any restrictions on the assembler. 17137 17138@item -mlittle-endian 17139@opindex mlittle-endian 17140Generate code for a processor running in little-endian mode. This is 17141the default for all standard configurations. 17142 17143@item -mbig-endian 17144@opindex mbig-endian 17145Generate code for a processor running in big-endian mode; the default is 17146to compile code for a little-endian processor. 17147 17148@item -mbe8 17149@itemx -mbe32 17150@opindex mbe8 17151When linking a big-endian image select between BE8 and BE32 formats. 17152The option has no effect for little-endian images and is ignored. The 17153default is dependent on the selected target architecture. For ARMv6 17154and later architectures the default is BE8, for older architectures 17155the default is BE32. BE32 format has been deprecated by ARM. 17156 17157@item -march=@var{name}@r{[}+extension@dots{}@r{]} 17158@opindex march 17159This specifies the name of the target ARM architecture. GCC uses this 17160name to determine what kind of instructions it can emit when generating 17161assembly code. This option can be used in conjunction with or instead 17162of the @option{-mcpu=} option. 17163 17164Permissible names are: 17165@samp{armv4t}, 17166@samp{armv5t}, @samp{armv5te}, 17167@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2}, 17168@samp{armv6z}, @samp{armv6zk}, 17169@samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 17170@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, 17171@samp{armv8.4-a}, 17172@samp{armv8.5-a}, 17173@samp{armv7-r}, 17174@samp{armv8-r}, 17175@samp{armv6-m}, @samp{armv6s-m}, 17176@samp{armv7-m}, @samp{armv7e-m}, 17177@samp{armv8-m.base}, @samp{armv8-m.main}, 17178@samp{iwmmxt} and @samp{iwmmxt2}. 17179 17180Additionally, the following architectures, which lack support for the 17181Thumb execution state, are recognized but support is deprecated: @samp{armv4}. 17182 17183Many of the architectures support extensions. These can be added by 17184appending @samp{+@var{extension}} to the architecture name. Extension 17185options are processed in order and capabilities accumulate. An extension 17186will also enable any necessary base extensions 17187upon which it depends. For example, the @samp{+crypto} extension 17188will always enable the @samp{+simd} extension. The exception to the 17189additive construction is for extensions that are prefixed with 17190@samp{+no@dots{}}: these extensions disable the specified option and 17191any other extensions that may depend on the presence of that 17192extension. 17193 17194For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to 17195writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is 17196entirely disabled by the @samp{+nofp} option that follows it. 17197 17198Most extension names are generically named, but have an effect that is 17199dependent upon the architecture to which it is applied. For example, 17200the @samp{+simd} option can be applied to both @samp{armv7-a} and 17201@samp{armv8-a} architectures, but will enable the original ARMv7-A 17202Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A 17203variant for @samp{armv8-a}. 17204 17205The table below lists the supported extensions for each architecture. 17206Architectures not mentioned do not support any extensions. 17207 17208@table @samp 17209@item armv5te 17210@itemx armv6 17211@itemx armv6j 17212@itemx armv6k 17213@itemx armv6kz 17214@itemx armv6t2 17215@itemx armv6z 17216@itemx armv6zk 17217@table @samp 17218@item +fp 17219The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be 17220used as an alias for this extension. 17221 17222@item +nofp 17223Disable the floating-point instructions. 17224@end table 17225 17226@item armv7 17227The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures. 17228@table @samp 17229@item +fp 17230The VFPv3 floating-point instructions, with 16 double-precision 17231registers. The extension @samp{+vfpv3-d16} can be used as an alias 17232for this extension. Note that floating-point is not supported by the 17233base ARMv7-M architecture, but is compatible with both the ARMv7-A and 17234ARMv7-R architectures. 17235 17236@item +nofp 17237Disable the floating-point instructions. 17238@end table 17239 17240@item armv7-a 17241@table @samp 17242@item +mp 17243The multiprocessing extension. 17244 17245@item +sec 17246The security extension. 17247 17248@item +fp 17249The VFPv3 floating-point instructions, with 16 double-precision 17250registers. The extension @samp{+vfpv3-d16} can be used as an alias 17251for this extension. 17252 17253@item +simd 17254The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 17255The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases 17256for this extension. 17257 17258@item +vfpv3 17259The VFPv3 floating-point instructions, with 32 double-precision 17260registers. 17261 17262@item +vfpv3-d16-fp16 17263The VFPv3 floating-point instructions, with 16 double-precision 17264registers and the half-precision floating-point conversion operations. 17265 17266@item +vfpv3-fp16 17267The VFPv3 floating-point instructions, with 32 double-precision 17268registers and the half-precision floating-point conversion operations. 17269 17270@item +vfpv4-d16 17271The VFPv4 floating-point instructions, with 16 double-precision 17272registers. 17273 17274@item +vfpv4 17275The VFPv4 floating-point instructions, with 32 double-precision 17276registers. 17277 17278@item +neon-fp16 17279The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 17280the half-precision floating-point conversion operations. 17281 17282@item +neon-vfpv4 17283The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. 17284 17285@item +nosimd 17286Disable the Advanced SIMD instructions (does not disable floating point). 17287 17288@item +nofp 17289Disable the floating-point and Advanced SIMD instructions. 17290@end table 17291 17292@item armv7ve 17293The extended version of the ARMv7-A architecture with support for 17294virtualization. 17295@table @samp 17296@item +fp 17297The VFPv4 floating-point instructions, with 16 double-precision registers. 17298The extension @samp{+vfpv4-d16} can be used as an alias for this extension. 17299 17300@item +simd 17301The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The 17302extension @samp{+neon-vfpv4} can be used as an alias for this extension. 17303 17304@item +vfpv3-d16 17305The VFPv3 floating-point instructions, with 16 double-precision 17306registers. 17307 17308@item +vfpv3 17309The VFPv3 floating-point instructions, with 32 double-precision 17310registers. 17311 17312@item +vfpv3-d16-fp16 17313The VFPv3 floating-point instructions, with 16 double-precision 17314registers and the half-precision floating-point conversion operations. 17315 17316@item +vfpv3-fp16 17317The VFPv3 floating-point instructions, with 32 double-precision 17318registers and the half-precision floating-point conversion operations. 17319 17320@item +vfpv4-d16 17321The VFPv4 floating-point instructions, with 16 double-precision 17322registers. 17323 17324@item +vfpv4 17325The VFPv4 floating-point instructions, with 32 double-precision 17326registers. 17327 17328@item +neon 17329The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 17330The extension @samp{+neon-vfpv3} can be used as an alias for this extension. 17331 17332@item +neon-fp16 17333The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 17334the half-precision floating-point conversion operations. 17335 17336@item +nosimd 17337Disable the Advanced SIMD instructions (does not disable floating point). 17338 17339@item +nofp 17340Disable the floating-point and Advanced SIMD instructions. 17341@end table 17342 17343@item armv8-a 17344@table @samp 17345@item +crc 17346The Cyclic Redundancy Check (CRC) instructions. 17347@item +simd 17348The ARMv8-A Advanced SIMD and floating-point instructions. 17349@item +crypto 17350The cryptographic instructions. 17351@item +nocrypto 17352Disable the cryptographic instructions. 17353@item +nofp 17354Disable the floating-point, Advanced SIMD and cryptographic instructions. 17355@item +sb 17356Speculation Barrier Instruction. 17357@item +predres 17358Execution and Data Prediction Restriction Instructions. 17359@end table 17360 17361@item armv8.1-a 17362@table @samp 17363@item +simd 17364The ARMv8.1-A Advanced SIMD and floating-point instructions. 17365 17366@item +crypto 17367The cryptographic instructions. This also enables the Advanced SIMD and 17368floating-point instructions. 17369 17370@item +nocrypto 17371Disable the cryptographic instructions. 17372 17373@item +nofp 17374Disable the floating-point, Advanced SIMD and cryptographic instructions. 17375 17376@item +sb 17377Speculation Barrier Instruction. 17378 17379@item +predres 17380Execution and Data Prediction Restriction Instructions. 17381@end table 17382 17383@item armv8.2-a 17384@itemx armv8.3-a 17385@table @samp 17386@item +fp16 17387The half-precision floating-point data processing instructions. 17388This also enables the Advanced SIMD and floating-point instructions. 17389 17390@item +fp16fml 17391The half-precision floating-point fmla extension. This also enables 17392the half-precision floating-point extension and Advanced SIMD and 17393floating-point instructions. 17394 17395@item +simd 17396The ARMv8.1-A Advanced SIMD and floating-point instructions. 17397 17398@item +crypto 17399The cryptographic instructions. This also enables the Advanced SIMD and 17400floating-point instructions. 17401 17402@item +dotprod 17403Enable the Dot Product extension. This also enables Advanced SIMD instructions. 17404 17405@item +nocrypto 17406Disable the cryptographic extension. 17407 17408@item +nofp 17409Disable the floating-point, Advanced SIMD and cryptographic instructions. 17410 17411@item +sb 17412Speculation Barrier Instruction. 17413 17414@item +predres 17415Execution and Data Prediction Restriction Instructions. 17416@end table 17417 17418@item armv8.4-a 17419@table @samp 17420@item +fp16 17421The half-precision floating-point data processing instructions. 17422This also enables the Advanced SIMD and floating-point instructions as well 17423as the Dot Product extension and the half-precision floating-point fmla 17424extension. 17425 17426@item +simd 17427The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 17428Dot Product extension. 17429 17430@item +crypto 17431The cryptographic instructions. This also enables the Advanced SIMD and 17432floating-point instructions as well as the Dot Product extension. 17433 17434@item +nocrypto 17435Disable the cryptographic extension. 17436 17437@item +nofp 17438Disable the floating-point, Advanced SIMD and cryptographic instructions. 17439 17440@item +sb 17441Speculation Barrier Instruction. 17442 17443@item +predres 17444Execution and Data Prediction Restriction Instructions. 17445@end table 17446 17447@item armv8.5-a 17448@table @samp 17449@item +fp16 17450The half-precision floating-point data processing instructions. 17451This also enables the Advanced SIMD and floating-point instructions as well 17452as the Dot Product extension and the half-precision floating-point fmla 17453extension. 17454 17455@item +simd 17456The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 17457Dot Product extension. 17458 17459@item +crypto 17460The cryptographic instructions. This also enables the Advanced SIMD and 17461floating-point instructions as well as the Dot Product extension. 17462 17463@item +nocrypto 17464Disable the cryptographic extension. 17465 17466@item +nofp 17467Disable the floating-point, Advanced SIMD and cryptographic instructions. 17468@end table 17469 17470@item armv7-r 17471@table @samp 17472@item +fp.sp 17473The single-precision VFPv3 floating-point instructions. The extension 17474@samp{+vfpv3xd} can be used as an alias for this extension. 17475 17476@item +fp 17477The VFPv3 floating-point instructions with 16 double-precision registers. 17478The extension +vfpv3-d16 can be used as an alias for this extension. 17479 17480@item +vfpv3xd-d16-fp16 17481The single-precision VFPv3 floating-point instructions with 16 double-precision 17482registers and the half-precision floating-point conversion operations. 17483 17484@item +vfpv3-d16-fp16 17485The VFPv3 floating-point instructions with 16 double-precision 17486registers and the half-precision floating-point conversion operations. 17487 17488@item +nofp 17489Disable the floating-point extension. 17490 17491@item +idiv 17492The ARM-state integer division instructions. 17493 17494@item +noidiv 17495Disable the ARM-state integer division extension. 17496@end table 17497 17498@item armv7e-m 17499@table @samp 17500@item +fp 17501The single-precision VFPv4 floating-point instructions. 17502 17503@item +fpv5 17504The single-precision FPv5 floating-point instructions. 17505 17506@item +fp.dp 17507The single- and double-precision FPv5 floating-point instructions. 17508 17509@item +nofp 17510Disable the floating-point extensions. 17511@end table 17512 17513@item armv8-m.main 17514@table @samp 17515@item +dsp 17516The DSP instructions. 17517 17518@item +nodsp 17519Disable the DSP extension. 17520 17521@item +fp 17522The single-precision floating-point instructions. 17523 17524@item +fp.dp 17525The single- and double-precision floating-point instructions. 17526 17527@item +nofp 17528Disable the floating-point extension. 17529@end table 17530 17531@item armv8-r 17532@table @samp 17533@item +crc 17534The Cyclic Redundancy Check (CRC) instructions. 17535@item +fp.sp 17536The single-precision FPv5 floating-point instructions. 17537@item +simd 17538The ARMv8-A Advanced SIMD and floating-point instructions. 17539@item +crypto 17540The cryptographic instructions. 17541@item +nocrypto 17542Disable the cryptographic instructions. 17543@item +nofp 17544Disable the floating-point, Advanced SIMD and cryptographic instructions. 17545@end table 17546 17547@end table 17548 17549@option{-march=native} causes the compiler to auto-detect the architecture 17550of the build computer. At present, this feature is only supported on 17551GNU/Linux, and not all architectures are recognized. If the auto-detect 17552is unsuccessful the option has no effect. 17553 17554@item -mtune=@var{name} 17555@opindex mtune 17556This option specifies the name of the target ARM processor for 17557which GCC should tune the performance of the code. 17558For some ARM implementations better performance can be obtained by using 17559this option. 17560Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t}, 17561@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110}, 17562@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810}, 17563@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t}, 17564@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s}, 17565@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t}, 17566@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 17567@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 17568@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 17569@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, 17570@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17}, 17571@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 17572@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 17573@samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, 17574@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, 17575@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3}, 17576@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33}, 17577@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply}, 17578@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4}, 17579@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale}, 17580@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626}, 17581@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}. 17582 17583Additionally, this option can specify that GCC should tune the performance 17584of the code for a big.LITTLE system. Permissible names are: 17585@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7}, 17586@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 17587@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}, 17588@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}. 17589 17590@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 17591performance for a blend of processors within architecture @var{arch}. 17592The aim is to generate code that run well on the current most popular 17593processors, balancing between optimizations that benefit some CPUs in the 17594range, and avoiding performance pitfalls of other CPUs. The effects of 17595this option may change in future GCC versions as CPU models come and go. 17596 17597@option{-mtune} permits the same extension options as @option{-mcpu}, but 17598the extension options do not affect the tuning of the generated code. 17599 17600@option{-mtune=native} causes the compiler to auto-detect the CPU 17601of the build computer. At present, this feature is only supported on 17602GNU/Linux, and not all architectures are recognized. If the auto-detect is 17603unsuccessful the option has no effect. 17604 17605@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]} 17606@opindex mcpu 17607This specifies the name of the target ARM processor. GCC uses this name 17608to derive the name of the target ARM architecture (as if specified 17609by @option{-march}) and the ARM processor type for which to tune for 17610performance (as if specified by @option{-mtune}). Where this option 17611is used in conjunction with @option{-march} or @option{-mtune}, 17612those options take precedence over the appropriate part of this option. 17613 17614Many of the supported CPUs implement optional architectural 17615extensions. Where this is so the architectural extensions are 17616normally enabled by default. If implementations that lack the 17617extension exist, then the extension syntax can be used to disable 17618those extensions that have been omitted. For floating-point and 17619Advanced SIMD (Neon) instructions, the settings of the options 17620@option{-mfloat-abi} and @option{-mfpu} must also be considered: 17621floating-point and Advanced SIMD instructions will only be used if 17622@option{-mfloat-abi} is not set to @samp{soft}; and any setting of 17623@option{-mfpu} other than @samp{auto} will override the available 17624floating-point and SIMD extension instructions. 17625 17626For example, @samp{cortex-a9} can be found in three major 17627configurations: integer only, with just a floating-point unit or with 17628floating-point and Advanced SIMD. The default is to enable all the 17629instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can 17630be used to disable just the SIMD or both the SIMD and floating-point 17631instructions respectively. 17632 17633Permissible names for this option are the same as those for 17634@option{-mtune}. 17635 17636The following extension options are common to the listed CPUs: 17637 17638@table @samp 17639@item +nodsp 17640Disable the DSP instructions on @samp{cortex-m33}. 17641 17642@item +nofp 17643Disables the floating-point instructions on @samp{arm9e}, 17644@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e}, 17645@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s}, 17646@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, 17647@samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}. 17648Disables the floating-point and SIMD instructions on 17649@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, 17650@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12}, 17651@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7}, 17652@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35}, 17653@samp{cortex-a53} and @samp{cortex-a55}. 17654 17655@item +nofp.dp 17656Disables the double-precision component of the floating-point instructions 17657on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and 17658@samp{cortex-m7}. 17659 17660@item +nosimd 17661Disables the SIMD (but not floating-point) instructions on 17662@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7} 17663and @samp{cortex-a9}. 17664 17665@item +crypto 17666Enables the cryptographic instructions on @samp{cortex-a32}, 17667@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57}, 17668@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1}, 17669@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 17670@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and 17671@samp{cortex-a75.cortex-a55}. 17672@end table 17673 17674Additionally the @samp{generic-armv7-a} pseudo target defaults to 17675VFPv3 with 16 double-precision registers. It supports the following 17676extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16}, 17677@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, 17678@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, 17679@samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for 17680the extensions to @option{-march=armv7-a}. 17681 17682@option{-mcpu=generic-@var{arch}} is also permissible, and is 17683equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 17684See @option{-mtune} for more information. 17685 17686@option{-mcpu=native} causes the compiler to auto-detect the CPU 17687of the build computer. At present, this feature is only supported on 17688GNU/Linux, and not all architectures are recognized. If the auto-detect 17689is unsuccessful the option has no effect. 17690 17691@item -mfpu=@var{name} 17692@opindex mfpu 17693This specifies what floating-point hardware (or hardware emulation) is 17694available on the target. Permissible names are: @samp{auto}, @samp{vfpv2}, 17695@samp{vfpv3}, 17696@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 17697@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4}, 17698@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 17699@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 17700@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}. 17701Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp} 17702is an alias for @samp{vfpv2}. 17703 17704The setting @samp{auto} is the default and is special. It causes the 17705compiler to select the floating-point and Advanced SIMD instructions 17706based on the settings of @option{-mcpu} and @option{-march}. 17707 17708If the selected floating-point hardware includes the NEON extension 17709(e.g.@: @option{-mfpu=neon}), note that floating-point 17710operations are not generated by GCC's auto-vectorization pass unless 17711@option{-funsafe-math-optimizations} is also specified. This is 17712because NEON hardware does not fully implement the IEEE 754 standard for 17713floating-point arithmetic (in particular denormal values are treated as 17714zero), so the use of NEON instructions may lead to a loss of precision. 17715 17716You 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}). 17717 17718@item -mfp16-format=@var{name} 17719@opindex mfp16-format 17720Specify the format of the @code{__fp16} half-precision floating-point type. 17721Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 17722the default is @samp{none}, in which case the @code{__fp16} type is not 17723defined. @xref{Half-Precision}, for more information. 17724 17725@item -mstructure-size-boundary=@var{n} 17726@opindex mstructure-size-boundary 17727The sizes of all structures and unions are rounded up to a multiple 17728of the number of bits set by this option. Permissible values are 8, 32 17729and 64. The default value varies for different toolchains. For the COFF 17730targeted toolchain the default value is 8. A value of 64 is only allowed 17731if the underlying ABI supports it. 17732 17733Specifying a larger number can produce faster, more efficient code, but 17734can also increase the size of the program. Different values are potentially 17735incompatible. Code compiled with one value cannot necessarily expect to 17736work with code or libraries compiled with another value, if they exchange 17737information using structures or unions. 17738 17739This option is deprecated. 17740 17741@item -mabort-on-noreturn 17742@opindex mabort-on-noreturn 17743Generate a call to the function @code{abort} at the end of a 17744@code{noreturn} function. It is executed if the function tries to 17745return. 17746 17747@item -mlong-calls 17748@itemx -mno-long-calls 17749@opindex mlong-calls 17750@opindex mno-long-calls 17751Tells the compiler to perform function calls by first loading the 17752address of the function into a register and then performing a subroutine 17753call on this register. This switch is needed if the target function 17754lies outside of the 64-megabyte addressing range of the offset-based 17755version of subroutine call instruction. 17756 17757Even if this switch is enabled, not all function calls are turned 17758into long calls. The heuristic is that static functions, functions 17759that have the @code{short_call} attribute, functions that are inside 17760the scope of a @code{#pragma no_long_calls} directive, and functions whose 17761definitions have already been compiled within the current compilation 17762unit are not turned into long calls. The exceptions to this rule are 17763that weak function definitions, functions with the @code{long_call} 17764attribute or the @code{section} attribute, and functions that are within 17765the scope of a @code{#pragma long_calls} directive are always 17766turned into long calls. 17767 17768This feature is not enabled by default. Specifying 17769@option{-mno-long-calls} restores the default behavior, as does 17770placing the function calls within the scope of a @code{#pragma 17771long_calls_off} directive. Note these switches have no effect on how 17772the compiler generates code to handle function calls via function 17773pointers. 17774 17775@item -msingle-pic-base 17776@opindex msingle-pic-base 17777Treat the register used for PIC addressing as read-only, rather than 17778loading it in the prologue for each function. The runtime system is 17779responsible for initializing this register with an appropriate value 17780before execution begins. 17781 17782@item -mpic-register=@var{reg} 17783@opindex mpic-register 17784Specify the register to be used for PIC addressing. 17785For standard PIC base case, the default is any suitable register 17786determined by compiler. For single PIC base case, the default is 17787@samp{R9} if target is EABI based or stack-checking is enabled, 17788otherwise the default is @samp{R10}. 17789 17790@item -mpic-data-is-text-relative 17791@opindex mpic-data-is-text-relative 17792Assume that the displacement between the text and data segments is fixed 17793at static link time. This permits using PC-relative addressing 17794operations to access data known to be in the data segment. For 17795non-VxWorks RTP targets, this option is enabled by default. When 17796disabled on such targets, it will enable @option{-msingle-pic-base} by 17797default. 17798 17799@item -mpoke-function-name 17800@opindex mpoke-function-name 17801Write the name of each function into the text section, directly 17802preceding the function prologue. The generated code is similar to this: 17803 17804@smallexample 17805 t0 17806 .ascii "arm_poke_function_name", 0 17807 .align 17808 t1 17809 .word 0xff000000 + (t1 - t0) 17810 arm_poke_function_name 17811 mov ip, sp 17812 stmfd sp!, @{fp, ip, lr, pc@} 17813 sub fp, ip, #4 17814@end smallexample 17815 17816When performing a stack backtrace, code can inspect the value of 17817@code{pc} stored at @code{fp + 0}. If the trace function then looks at 17818location @code{pc - 12} and the top 8 bits are set, then we know that 17819there is a function name embedded immediately preceding this location 17820and has length @code{((pc[-3]) & 0xff000000)}. 17821 17822@item -mthumb 17823@itemx -marm 17824@opindex marm 17825@opindex mthumb 17826 17827Select between generating code that executes in ARM and Thumb 17828states. The default for most configurations is to generate code 17829that executes in ARM state, but the default can be changed by 17830configuring GCC with the @option{--with-mode=}@var{state} 17831configure option. 17832 17833You can also override the ARM and Thumb mode for each function 17834by using the @code{target("thumb")} and @code{target("arm")} function attributes 17835(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}). 17836 17837@item -mflip-thumb 17838@opindex mflip-thumb 17839Switch ARM/Thumb modes on alternating functions. 17840This option is provided for regression testing of mixed Thumb/ARM code 17841generation, and is not intended for ordinary use in compiling code. 17842 17843@item -mtpcs-frame 17844@opindex mtpcs-frame 17845Generate a stack frame that is compliant with the Thumb Procedure Call 17846Standard for all non-leaf functions. (A leaf function is one that does 17847not call any other functions.) The default is @option{-mno-tpcs-frame}. 17848 17849@item -mtpcs-leaf-frame 17850@opindex mtpcs-leaf-frame 17851Generate a stack frame that is compliant with the Thumb Procedure Call 17852Standard for all leaf functions. (A leaf function is one that does 17853not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 17854 17855@item -mcallee-super-interworking 17856@opindex mcallee-super-interworking 17857Gives all externally visible functions in the file being compiled an ARM 17858instruction set header which switches to Thumb mode before executing the 17859rest of the function. This allows these functions to be called from 17860non-interworking code. This option is not valid in AAPCS configurations 17861because interworking is enabled by default. 17862 17863@item -mcaller-super-interworking 17864@opindex mcaller-super-interworking 17865Allows calls via function pointers (including virtual functions) to 17866execute correctly regardless of whether the target code has been 17867compiled for interworking or not. There is a small overhead in the cost 17868of executing a function pointer if this option is enabled. This option 17869is not valid in AAPCS configurations because interworking is enabled 17870by default. 17871 17872@item -mtp=@var{name} 17873@opindex mtp 17874Specify the access model for the thread local storage pointer. The valid 17875models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 17876@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 17877(supported in the arm6k architecture), and @samp{auto}, which uses the 17878best available method for the selected processor. The default setting is 17879@samp{auto}. 17880 17881@item -mtls-dialect=@var{dialect} 17882@opindex mtls-dialect 17883Specify the dialect to use for accessing thread local storage. Two 17884@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 17885@samp{gnu} dialect selects the original GNU scheme for supporting 17886local and global dynamic TLS models. The @samp{gnu2} dialect 17887selects the GNU descriptor scheme, which provides better performance 17888for shared libraries. The GNU descriptor scheme is compatible with 17889the original scheme, but does require new assembler, linker and 17890library support. Initial and local exec TLS models are unaffected by 17891this option and always use the original scheme. 17892 17893@item -mword-relocations 17894@opindex mword-relocations 17895Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32). 17896This is enabled by default on targets (uClinux, SymbianOS) where the runtime 17897loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 17898is specified. This option conflicts with @option{-mslow-flash-data}. 17899 17900@item -mfix-cortex-m3-ldrd 17901@opindex mfix-cortex-m3-ldrd 17902Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 17903with overlapping destination and base registers are used. This option avoids 17904generating these instructions. This option is enabled by default when 17905@option{-mcpu=cortex-m3} is specified. 17906 17907@item -munaligned-access 17908@itemx -mno-unaligned-access 17909@opindex munaligned-access 17910@opindex mno-unaligned-access 17911Enables (or disables) reading and writing of 16- and 32- bit values 17912from addresses that are not 16- or 32- bit aligned. By default 17913unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for 17914ARMv8-M Baseline architectures, and enabled for all other 17915architectures. If unaligned access is not enabled then words in packed 17916data structures are accessed a byte at a time. 17917 17918The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 17919generated object file to either true or false, depending upon the 17920setting of this option. If unaligned access is enabled then the 17921preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 17922defined. 17923 17924@item -mneon-for-64bits 17925@opindex mneon-for-64bits 17926Enables using Neon to handle scalar 64-bits operations. This is 17927disabled by default since the cost of moving data from core registers 17928to Neon is high. 17929 17930@item -mslow-flash-data 17931@opindex mslow-flash-data 17932Assume loading data from flash is slower than fetching instruction. 17933Therefore literal load is minimized for better performance. 17934This option is only supported when compiling for ARMv7 M-profile and 17935off by default. It conflicts with @option{-mword-relocations}. 17936 17937@item -masm-syntax-unified 17938@opindex masm-syntax-unified 17939Assume inline assembler is using unified asm syntax. The default is 17940currently off which implies divided syntax. This option has no impact 17941on Thumb2. However, this may change in future releases of GCC. 17942Divided syntax should be considered deprecated. 17943 17944@item -mrestrict-it 17945@opindex mrestrict-it 17946Restricts generation of IT blocks to conform to the rules of ARMv8-A. 17947IT blocks can only contain a single 16-bit instruction from a select 17948set of instructions. This option is on by default for ARMv8-A Thumb mode. 17949 17950@item -mprint-tune-info 17951@opindex mprint-tune-info 17952Print CPU tuning information as comment in assembler file. This is 17953an option used only for regression testing of the compiler and not 17954intended for ordinary use in compiling code. This option is disabled 17955by default. 17956 17957@item -mverbose-cost-dump 17958@opindex mverbose-cost-dump 17959Enable verbose cost model dumping in the debug dump files. This option is 17960provided for use in debugging the compiler. 17961 17962@item -mpure-code 17963@opindex mpure-code 17964Do not allow constant data to be placed in code sections. 17965Additionally, when compiling for ELF object format give all text sections the 17966ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option 17967is only available when generating non-pic code for M-profile targets. 17968 17969@item -mcmse 17970@opindex mcmse 17971Generate secure code as per the "ARMv8-M Security Extensions: Requirements on 17972Development Tools Engineering Specification", which can be found on 17973@url{https://developer.arm.com/documentation/ecm0359818/latest/}. 17974@end table 17975 17976@node AVR Options 17977@subsection AVR Options 17978@cindex AVR Options 17979 17980These options are defined for AVR implementations: 17981 17982@table @gcctabopt 17983@item -mmcu=@var{mcu} 17984@opindex mmcu 17985Specify Atmel AVR instruction set architectures (ISA) or MCU type. 17986 17987The default for this option is@tie{}@samp{avr2}. 17988 17989GCC supports the following AVR devices and ISAs: 17990 17991@include avr-mmcu.texi 17992 17993@item -mabsdata 17994@opindex mabsdata 17995 17996Assume that all data in static storage can be accessed by LDS / STS 17997instructions. This option has only an effect on reduced Tiny devices like 17998ATtiny40. See also the @code{absdata} 17999@ref{AVR Variable Attributes,variable attribute}. 18000 18001@item -maccumulate-args 18002@opindex maccumulate-args 18003Accumulate outgoing function arguments and acquire/release the needed 18004stack space for outgoing function arguments once in function 18005prologue/epilogue. Without this option, outgoing arguments are pushed 18006before calling a function and popped afterwards. 18007 18008Popping the arguments after the function call can be expensive on 18009AVR so that accumulating the stack space might lead to smaller 18010executables because arguments need not be removed from the 18011stack after such a function call. 18012 18013This option can lead to reduced code size for functions that perform 18014several calls to functions that get their arguments on the stack like 18015calls to printf-like functions. 18016 18017@item -mbranch-cost=@var{cost} 18018@opindex mbranch-cost 18019Set the branch costs for conditional branch instructions to 18020@var{cost}. Reasonable values for @var{cost} are small, non-negative 18021integers. The default branch cost is 0. 18022 18023@item -mcall-prologues 18024@opindex mcall-prologues 18025Functions prologues/epilogues are expanded as calls to appropriate 18026subroutines. Code size is smaller. 18027 18028@item -mgas-isr-prologues 18029@opindex mgas-isr-prologues 18030Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo 18031instruction supported by GNU Binutils. 18032If this option is on, the feature can still be disabled for individual 18033ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}} 18034function attribute. This feature is activated per default 18035if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}), 18036and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}. 18037 18038@item -mint8 18039@opindex mint8 18040Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 18041@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 18042and @code{long long} is 4 bytes. Please note that this option does not 18043conform to the C standards, but it results in smaller code 18044size. 18045 18046@item -mmain-is-OS_task 18047@opindex mmain-is-OS_task 18048Do not save registers in @code{main}. The effect is the same like 18049attaching attribute @ref{AVR Function Attributes,,@code{OS_task}} 18050to @code{main}. It is activated per default if optimization is on. 18051 18052@item -mn-flash=@var{num} 18053@opindex mn-flash 18054Assume that the flash memory has a size of 18055@var{num} times 64@tie{}KiB. 18056 18057@item -mno-interrupts 18058@opindex mno-interrupts 18059Generated code is not compatible with hardware interrupts. 18060Code size is smaller. 18061 18062@item -mrelax 18063@opindex mrelax 18064Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 18065@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 18066Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 18067the assembler's command line and the @option{--relax} option to the 18068linker's command line. 18069 18070Jump relaxing is performed by the linker because jump offsets are not 18071known before code is located. Therefore, the assembler code generated by the 18072compiler is the same, but the instructions in the executable may 18073differ from instructions in the assembler code. 18074 18075Relaxing must be turned on if linker stubs are needed, see the 18076section on @code{EIND} and linker stubs below. 18077 18078@item -mrmw 18079@opindex mrmw 18080Assume that the device supports the Read-Modify-Write 18081instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 18082 18083@item -mshort-calls 18084@opindex mshort-calls 18085 18086Assume that @code{RJMP} and @code{RCALL} can target the whole 18087program memory. 18088 18089This option is used internally for multilib selection. It is 18090not an optimization option, and you don't need to set it by hand. 18091 18092@item -msp8 18093@opindex msp8 18094Treat the stack pointer register as an 8-bit register, 18095i.e.@: assume the high byte of the stack pointer is zero. 18096In general, you don't need to set this option by hand. 18097 18098This option is used internally by the compiler to select and 18099build multilibs for architectures @code{avr2} and @code{avr25}. 18100These architectures mix devices with and without @code{SPH}. 18101For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 18102the compiler driver adds or removes this option from the compiler 18103proper's command line, because the compiler then knows if the device 18104or architecture has an 8-bit stack pointer and thus no @code{SPH} 18105register or not. 18106 18107@item -mstrict-X 18108@opindex mstrict-X 18109Use address register @code{X} in a way proposed by the hardware. This means 18110that @code{X} is only used in indirect, post-increment or 18111pre-decrement addressing. 18112 18113Without this option, the @code{X} register may be used in the same way 18114as @code{Y} or @code{Z} which then is emulated by additional 18115instructions. 18116For example, loading a value with @code{X+const} addressing with a 18117small non-negative @code{const < 64} to a register @var{Rn} is 18118performed as 18119 18120@example 18121adiw r26, const ; X += const 18122ld @var{Rn}, X ; @var{Rn} = *X 18123sbiw r26, const ; X -= const 18124@end example 18125 18126@item -mtiny-stack 18127@opindex mtiny-stack 18128Only change the lower 8@tie{}bits of the stack pointer. 18129 18130@item -mfract-convert-truncate 18131@opindex mfract-convert-truncate 18132Allow to use truncation instead of rounding towards zero for fractional fixed-point types. 18133 18134@item -nodevicelib 18135@opindex nodevicelib 18136Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. 18137 18138@item -nodevicespecs 18139@opindex nodevicespecs 18140Don't add @option{-specs=device-specs/specs-<mcu>} to the compiler driver's 18141command line. The user takes responsibility for supplying the sub-processes 18142like compiler proper, assembler and linker with appropriate command line 18143options. 18144 18145@item -Waddr-space-convert 18146@opindex Waddr-space-convert 18147@opindex Wno-addr-space-convert 18148Warn about conversions between address spaces in the case where the 18149resulting address space is not contained in the incoming address space. 18150 18151@item -Wmisspelled-isr 18152@opindex Wmisspelled-isr 18153@opindex Wno-misspelled-isr 18154Warn if the ISR is misspelled, i.e.@: without __vector prefix. 18155Enabled by default. 18156@end table 18157 18158@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 18159@cindex @code{EIND} 18160Pointers in the implementation are 16@tie{}bits wide. 18161The address of a function or label is represented as word address so 18162that indirect jumps and calls can target any code address in the 18163range of 64@tie{}Ki words. 18164 18165In order to facilitate indirect jump on devices with more than 128@tie{}Ki 18166bytes of program memory space, there is a special function register called 18167@code{EIND} that serves as most significant part of the target address 18168when @code{EICALL} or @code{EIJMP} instructions are used. 18169 18170Indirect jumps and calls on these devices are handled as follows by 18171the compiler and are subject to some limitations: 18172 18173@itemize @bullet 18174 18175@item 18176The compiler never sets @code{EIND}. 18177 18178@item 18179The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP} 18180instructions or might read @code{EIND} directly in order to emulate an 18181indirect call/jump by means of a @code{RET} instruction. 18182 18183@item 18184The compiler assumes that @code{EIND} never changes during the startup 18185code or during the application. In particular, @code{EIND} is not 18186saved/restored in function or interrupt service routine 18187prologue/epilogue. 18188 18189@item 18190For indirect calls to functions and computed goto, the linker 18191generates @emph{stubs}. Stubs are jump pads sometimes also called 18192@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 18193The stub contains a direct jump to the desired address. 18194 18195@item 18196Linker relaxation must be turned on so that the linker generates 18197the stubs correctly in all situations. See the compiler option 18198@option{-mrelax} and the linker option @option{--relax}. 18199There are corner cases where the linker is supposed to generate stubs 18200but aborts without relaxation and without a helpful error message. 18201 18202@item 18203The default linker script is arranged for code with @code{EIND = 0}. 18204If code is supposed to work for a setup with @code{EIND != 0}, a custom 18205linker script has to be used in order to place the sections whose 18206name start with @code{.trampolines} into the segment where @code{EIND} 18207points to. 18208 18209@item 18210The startup code from libgcc never sets @code{EIND}. 18211Notice that startup code is a blend of code from libgcc and AVR-LibC. 18212For the impact of AVR-LibC on @code{EIND}, see the 18213@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 18214 18215@item 18216It is legitimate for user-specific startup code to set up @code{EIND} 18217early, for example by means of initialization code located in 18218section @code{.init3}. Such code runs prior to general startup code 18219that initializes RAM and calls constructors, but after the bit 18220of startup code from AVR-LibC that sets @code{EIND} to the segment 18221where the vector table is located. 18222@example 18223#include <avr/io.h> 18224 18225static void 18226__attribute__((section(".init3"),naked,used,no_instrument_function)) 18227init3_set_eind (void) 18228@{ 18229 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 18230 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 18231@} 18232@end example 18233 18234@noindent 18235The @code{__trampolines_start} symbol is defined in the linker script. 18236 18237@item 18238Stubs are generated automatically by the linker if 18239the following two conditions are met: 18240@itemize @minus 18241 18242@item The address of a label is taken by means of the @code{gs} modifier 18243(short for @emph{generate stubs}) like so: 18244@example 18245LDI r24, lo8(gs(@var{func})) 18246LDI r25, hi8(gs(@var{func})) 18247@end example 18248@item The final location of that label is in a code segment 18249@emph{outside} the segment where the stubs are located. 18250@end itemize 18251 18252@item 18253The compiler emits such @code{gs} modifiers for code labels in the 18254following situations: 18255@itemize @minus 18256@item Taking address of a function or code label. 18257@item Computed goto. 18258@item If prologue-save function is used, see @option{-mcall-prologues} 18259command-line option. 18260@item Switch/case dispatch tables. If you do not want such dispatch 18261tables you can specify the @option{-fno-jump-tables} command-line option. 18262@item C and C++ constructors/destructors called during startup/shutdown. 18263@item If the tools hit a @code{gs()} modifier explained above. 18264@end itemize 18265 18266@item 18267Jumping to non-symbolic addresses like so is @emph{not} supported: 18268 18269@example 18270int main (void) 18271@{ 18272 /* Call function at word address 0x2 */ 18273 return ((int(*)(void)) 0x2)(); 18274@} 18275@end example 18276 18277Instead, a stub has to be set up, i.e.@: the function has to be called 18278through a symbol (@code{func_4} in the example): 18279 18280@example 18281int main (void) 18282@{ 18283 extern int func_4 (void); 18284 18285 /* Call function at byte address 0x4 */ 18286 return func_4(); 18287@} 18288@end example 18289 18290and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 18291Alternatively, @code{func_4} can be defined in the linker script. 18292@end itemize 18293 18294@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 18295@cindex @code{RAMPD} 18296@cindex @code{RAMPX} 18297@cindex @code{RAMPY} 18298@cindex @code{RAMPZ} 18299Some AVR devices support memories larger than the 64@tie{}KiB range 18300that can be accessed with 16-bit pointers. To access memory locations 18301outside this 64@tie{}KiB range, the content of a @code{RAMP} 18302register is used as high part of the address: 18303The @code{X}, @code{Y}, @code{Z} address register is concatenated 18304with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 18305register, respectively, to get a wide address. Similarly, 18306@code{RAMPD} is used together with direct addressing. 18307 18308@itemize 18309@item 18310The startup code initializes the @code{RAMP} special function 18311registers with zero. 18312 18313@item 18314If a @ref{AVR Named Address Spaces,named address space} other than 18315generic or @code{__flash} is used, then @code{RAMPZ} is set 18316as needed before the operation. 18317 18318@item 18319If the device supports RAM larger than 64@tie{}KiB and the compiler 18320needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 18321is reset to zero after the operation. 18322 18323@item 18324If the device comes with a specific @code{RAMP} register, the ISR 18325prologue/epilogue saves/restores that SFR and initializes it with 18326zero in case the ISR code might (implicitly) use it. 18327 18328@item 18329RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 18330If you use inline assembler to read from locations outside the 1833116-bit address range and change one of the @code{RAMP} registers, 18332you must reset it to zero after the access. 18333 18334@end itemize 18335 18336@subsubsection AVR Built-in Macros 18337 18338GCC defines several built-in macros so that the user code can test 18339for the presence or absence of features. Almost any of the following 18340built-in macros are deduced from device capabilities and thus 18341triggered by the @option{-mmcu=} command-line option. 18342 18343For even more AVR-specific built-in macros see 18344@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 18345 18346@table @code 18347 18348@item __AVR_ARCH__ 18349Build-in macro that resolves to a decimal number that identifies the 18350architecture and depends on the @option{-mmcu=@var{mcu}} option. 18351Possible values are: 18352 18353@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 18354@code{4}, @code{5}, @code{51}, @code{6} 18355 18356for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 18357@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 18358 18359respectively and 18360 18361@code{100}, 18362@code{102}, @code{103}, @code{104}, 18363@code{105}, @code{106}, @code{107} 18364 18365for @var{mcu}=@code{avrtiny}, 18366@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4}, 18367@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 18368If @var{mcu} specifies a device, this built-in macro is set 18369accordingly. For example, with @option{-mmcu=atmega8} the macro is 18370defined to @code{4}. 18371 18372@item __AVR_@var{Device}__ 18373Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 18374the device's name. For example, @option{-mmcu=atmega8} defines the 18375built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 18376@code{__AVR_ATtiny261A__}, etc. 18377 18378The built-in macros' names follow 18379the scheme @code{__AVR_@var{Device}__} where @var{Device} is 18380the device name as from the AVR user manual. The difference between 18381@var{Device} in the built-in macro and @var{device} in 18382@option{-mmcu=@var{device}} is that the latter is always lowercase. 18383 18384If @var{device} is not a device but only a core architecture like 18385@samp{avr51}, this macro is not defined. 18386 18387@item __AVR_DEVICE_NAME__ 18388Setting @option{-mmcu=@var{device}} defines this built-in macro to 18389the device's name. For example, with @option{-mmcu=atmega8} the macro 18390is defined to @code{atmega8}. 18391 18392If @var{device} is not a device but only a core architecture like 18393@samp{avr51}, this macro is not defined. 18394 18395@item __AVR_XMEGA__ 18396The device / architecture belongs to the XMEGA family of devices. 18397 18398@item __AVR_HAVE_ELPM__ 18399The device has the @code{ELPM} instruction. 18400 18401@item __AVR_HAVE_ELPMX__ 18402The device has the @code{ELPM R@var{n},Z} and @code{ELPM 18403R@var{n},Z+} instructions. 18404 18405@item __AVR_HAVE_MOVW__ 18406The device has the @code{MOVW} instruction to perform 16-bit 18407register-register moves. 18408 18409@item __AVR_HAVE_LPMX__ 18410The device has the @code{LPM R@var{n},Z} and 18411@code{LPM R@var{n},Z+} instructions. 18412 18413@item __AVR_HAVE_MUL__ 18414The device has a hardware multiplier. 18415 18416@item __AVR_HAVE_JMP_CALL__ 18417The device has the @code{JMP} and @code{CALL} instructions. 18418This is the case for devices with more than 8@tie{}KiB of program 18419memory. 18420 18421@item __AVR_HAVE_EIJMP_EICALL__ 18422@itemx __AVR_3_BYTE_PC__ 18423The device has the @code{EIJMP} and @code{EICALL} instructions. 18424This is the case for devices with more than 128@tie{}KiB of program memory. 18425This also means that the program counter 18426(PC) is 3@tie{}bytes wide. 18427 18428@item __AVR_2_BYTE_PC__ 18429The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 18430with up to 128@tie{}KiB of program memory. 18431 18432@item __AVR_HAVE_8BIT_SP__ 18433@itemx __AVR_HAVE_16BIT_SP__ 18434The stack pointer (SP) register is treated as 8-bit respectively 1843516-bit register by the compiler. 18436The definition of these macros is affected by @option{-mtiny-stack}. 18437 18438@item __AVR_HAVE_SPH__ 18439@itemx __AVR_SP8__ 18440The device has the SPH (high part of stack pointer) special function 18441register or has an 8-bit stack pointer, respectively. 18442The definition of these macros is affected by @option{-mmcu=} and 18443in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 18444by @option{-msp8}. 18445 18446@item __AVR_HAVE_RAMPD__ 18447@itemx __AVR_HAVE_RAMPX__ 18448@itemx __AVR_HAVE_RAMPY__ 18449@itemx __AVR_HAVE_RAMPZ__ 18450The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 18451@code{RAMPZ} special function register, respectively. 18452 18453@item __NO_INTERRUPTS__ 18454This macro reflects the @option{-mno-interrupts} command-line option. 18455 18456@item __AVR_ERRATA_SKIP__ 18457@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 18458Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 18459instructions because of a hardware erratum. Skip instructions are 18460@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 18461The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 18462set. 18463 18464@item __AVR_ISA_RMW__ 18465The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 18466 18467@item __AVR_SFR_OFFSET__=@var{offset} 18468Instructions that can address I/O special function registers directly 18469like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 18470address as if addressed by an instruction to access RAM like @code{LD} 18471or @code{STS}. This offset depends on the device architecture and has 18472to be subtracted from the RAM address in order to get the 18473respective I/O@tie{}address. 18474 18475@item __AVR_SHORT_CALLS__ 18476The @option{-mshort-calls} command line option is set. 18477 18478@item __AVR_PM_BASE_ADDRESS__=@var{addr} 18479Some devices support reading from flash memory by means of @code{LD*} 18480instructions. The flash memory is seen in the data address space 18481at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro 18482is not defined, this feature is not available. If defined, 18483the address space is linear and there is no need to put 18484@code{.rodata} into RAM. This is handled by the default linker 18485description file, and is currently available for 18486@code{avrtiny} and @code{avrxmega3}. Even more convenient, 18487there is no need to use address spaces like @code{__flash} or 18488features like attribute @code{progmem} and @code{pgm_read_*}. 18489 18490@item __WITH_AVRLIBC__ 18491The compiler is configured to be used together with AVR-Libc. 18492See the @option{--with-avrlibc} configure option. 18493 18494@end table 18495 18496@node Blackfin Options 18497@subsection Blackfin Options 18498@cindex Blackfin Options 18499 18500@table @gcctabopt 18501@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 18502@opindex mcpu= 18503Specifies the name of the target Blackfin processor. Currently, @var{cpu} 18504can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 18505@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 18506@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 18507@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 18508@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 18509@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 18510@samp{bf561}, @samp{bf592}. 18511 18512The optional @var{sirevision} specifies the silicon revision of the target 18513Blackfin processor. Any workarounds available for the targeted silicon revision 18514are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 18515If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 18516are enabled. The @code{__SILICON_REVISION__} macro is defined to two 18517hexadecimal digits representing the major and minor numbers in the silicon 18518revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 18519is not defined. If @var{sirevision} is @samp{any}, the 18520@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 18521If this optional @var{sirevision} is not used, GCC assumes the latest known 18522silicon revision of the targeted Blackfin processor. 18523 18524GCC defines a preprocessor macro for the specified @var{cpu}. 18525For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 18526provided by libgloss to be linked in if @option{-msim} is not given. 18527 18528Without this option, @samp{bf532} is used as the processor by default. 18529 18530Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 18531only the preprocessor macro is defined. 18532 18533@item -msim 18534@opindex msim 18535Specifies that the program will be run on the simulator. This causes 18536the simulator BSP provided by libgloss to be linked in. This option 18537has effect only for @samp{bfin-elf} toolchain. 18538Certain other options, such as @option{-mid-shared-library} and 18539@option{-mfdpic}, imply @option{-msim}. 18540 18541@item -momit-leaf-frame-pointer 18542@opindex momit-leaf-frame-pointer 18543Don't keep the frame pointer in a register for leaf functions. This 18544avoids the instructions to save, set up and restore frame pointers and 18545makes an extra register available in leaf functions. 18546 18547@item -mspecld-anomaly 18548@opindex mspecld-anomaly 18549When enabled, the compiler ensures that the generated code does not 18550contain speculative loads after jump instructions. If this option is used, 18551@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 18552 18553@item -mno-specld-anomaly 18554@opindex mno-specld-anomaly 18555@opindex mspecld-anomaly 18556Don't generate extra code to prevent speculative loads from occurring. 18557 18558@item -mcsync-anomaly 18559@opindex mcsync-anomaly 18560When enabled, the compiler ensures that the generated code does not 18561contain CSYNC or SSYNC instructions too soon after conditional branches. 18562If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 18563 18564@item -mno-csync-anomaly 18565@opindex mno-csync-anomaly 18566@opindex mcsync-anomaly 18567Don't generate extra code to prevent CSYNC or SSYNC instructions from 18568occurring too soon after a conditional branch. 18569 18570@item -mlow64k 18571@opindex mlow64k 18572When enabled, the compiler is free to take advantage of the knowledge that 18573the entire program fits into the low 64k of memory. 18574 18575@item -mno-low64k 18576@opindex mno-low64k 18577Assume that the program is arbitrarily large. This is the default. 18578 18579@item -mstack-check-l1 18580@opindex mstack-check-l1 18581Do stack checking using information placed into L1 scratchpad memory by the 18582uClinux kernel. 18583 18584@item -mid-shared-library 18585@opindex mid-shared-library 18586Generate code that supports shared libraries via the library ID method. 18587This allows for execute in place and shared libraries in an environment 18588without virtual memory management. This option implies @option{-fPIC}. 18589With a @samp{bfin-elf} target, this option implies @option{-msim}. 18590 18591@item -mno-id-shared-library 18592@opindex mno-id-shared-library 18593@opindex mid-shared-library 18594Generate code that doesn't assume ID-based shared libraries are being used. 18595This is the default. 18596 18597@item -mleaf-id-shared-library 18598@opindex mleaf-id-shared-library 18599Generate code that supports shared libraries via the library ID method, 18600but assumes that this library or executable won't link against any other 18601ID shared libraries. That allows the compiler to use faster code for jumps 18602and calls. 18603 18604@item -mno-leaf-id-shared-library 18605@opindex mno-leaf-id-shared-library 18606@opindex mleaf-id-shared-library 18607Do not assume that the code being compiled won't link against any ID shared 18608libraries. Slower code is generated for jump and call insns. 18609 18610@item -mshared-library-id=n 18611@opindex mshared-library-id 18612Specifies the identification number of the ID-based shared library being 18613compiled. Specifying a value of 0 generates more compact code; specifying 18614other values forces the allocation of that number to the current 18615library but is no more space- or time-efficient than omitting this option. 18616 18617@item -msep-data 18618@opindex msep-data 18619Generate code that allows the data segment to be located in a different 18620area of memory from the text segment. This allows for execute in place in 18621an environment without virtual memory management by eliminating relocations 18622against the text section. 18623 18624@item -mno-sep-data 18625@opindex mno-sep-data 18626@opindex msep-data 18627Generate code that assumes that the data segment follows the text segment. 18628This is the default. 18629 18630@item -mlong-calls 18631@itemx -mno-long-calls 18632@opindex mlong-calls 18633@opindex mno-long-calls 18634Tells the compiler to perform function calls by first loading the 18635address of the function into a register and then performing a subroutine 18636call on this register. This switch is needed if the target function 18637lies outside of the 24-bit addressing range of the offset-based 18638version of subroutine call instruction. 18639 18640This feature is not enabled by default. Specifying 18641@option{-mno-long-calls} restores the default behavior. Note these 18642switches have no effect on how the compiler generates code to handle 18643function calls via function pointers. 18644 18645@item -mfast-fp 18646@opindex mfast-fp 18647Link with the fast floating-point library. This library relaxes some of 18648the IEEE floating-point standard's rules for checking inputs against 18649Not-a-Number (NAN), in the interest of performance. 18650 18651@item -minline-plt 18652@opindex minline-plt 18653Enable inlining of PLT entries in function calls to functions that are 18654not known to bind locally. It has no effect without @option{-mfdpic}. 18655 18656@item -mmulticore 18657@opindex mmulticore 18658Build a standalone application for multicore Blackfin processors. 18659This option causes proper start files and link scripts supporting 18660multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 18661It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 18662 18663This option can be used with @option{-mcorea} or @option{-mcoreb}, which 18664selects the one-application-per-core programming model. Without 18665@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 18666programming model is used. In this model, the main function of Core B 18667should be named as @code{coreb_main}. 18668 18669If this option is not used, the single-core application programming 18670model is used. 18671 18672@item -mcorea 18673@opindex mcorea 18674Build a standalone application for Core A of BF561 when using 18675the one-application-per-core programming model. Proper start files 18676and link scripts are used to support Core A, and the macro 18677@code{__BFIN_COREA} is defined. 18678This option can only be used in conjunction with @option{-mmulticore}. 18679 18680@item -mcoreb 18681@opindex mcoreb 18682Build a standalone application for Core B of BF561 when using 18683the one-application-per-core programming model. Proper start files 18684and link scripts are used to support Core B, and the macro 18685@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 18686should be used instead of @code{main}. 18687This option can only be used in conjunction with @option{-mmulticore}. 18688 18689@item -msdram 18690@opindex msdram 18691Build a standalone application for SDRAM. Proper start files and 18692link scripts are used to put the application into SDRAM, and the macro 18693@code{__BFIN_SDRAM} is defined. 18694The loader should initialize SDRAM before loading the application. 18695 18696@item -micplb 18697@opindex micplb 18698Assume that ICPLBs are enabled at run time. This has an effect on certain 18699anomaly workarounds. For Linux targets, the default is to assume ICPLBs 18700are enabled; for standalone applications the default is off. 18701@end table 18702 18703@node C6X Options 18704@subsection C6X Options 18705@cindex C6X Options 18706 18707@table @gcctabopt 18708@item -march=@var{name} 18709@opindex march 18710This specifies the name of the target architecture. GCC uses this 18711name to determine what kind of instructions it can emit when generating 18712assembly code. Permissible names are: @samp{c62x}, 18713@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 18714 18715@item -mbig-endian 18716@opindex mbig-endian 18717Generate code for a big-endian target. 18718 18719@item -mlittle-endian 18720@opindex mlittle-endian 18721Generate code for a little-endian target. This is the default. 18722 18723@item -msim 18724@opindex msim 18725Choose startup files and linker script suitable for the simulator. 18726 18727@item -msdata=default 18728@opindex msdata=default 18729Put small global and static data in the @code{.neardata} section, 18730which is pointed to by register @code{B14}. Put small uninitialized 18731global and static data in the @code{.bss} section, which is adjacent 18732to the @code{.neardata} section. Put small read-only data into the 18733@code{.rodata} section. The corresponding sections used for large 18734pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 18735 18736@item -msdata=all 18737@opindex msdata=all 18738Put all data, not just small objects, into the sections reserved for 18739small data, and use addressing relative to the @code{B14} register to 18740access them. 18741 18742@item -msdata=none 18743@opindex msdata=none 18744Make no use of the sections reserved for small data, and use absolute 18745addresses to access all data. Put all initialized global and static 18746data in the @code{.fardata} section, and all uninitialized data in the 18747@code{.far} section. Put all constant data into the @code{.const} 18748section. 18749@end table 18750 18751@node CRIS Options 18752@subsection CRIS Options 18753@cindex CRIS Options 18754 18755These options are defined specifically for the CRIS ports. 18756 18757@table @gcctabopt 18758@item -march=@var{architecture-type} 18759@itemx -mcpu=@var{architecture-type} 18760@opindex march 18761@opindex mcpu 18762Generate code for the specified architecture. The choices for 18763@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 18764respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 18765Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 18766@samp{v10}. 18767 18768@item -mtune=@var{architecture-type} 18769@opindex mtune 18770Tune to @var{architecture-type} everything applicable about the generated 18771code, except for the ABI and the set of available instructions. The 18772choices for @var{architecture-type} are the same as for 18773@option{-march=@var{architecture-type}}. 18774 18775@item -mmax-stack-frame=@var{n} 18776@opindex mmax-stack-frame 18777Warn when the stack frame of a function exceeds @var{n} bytes. 18778 18779@item -metrax4 18780@itemx -metrax100 18781@opindex metrax4 18782@opindex metrax100 18783The options @option{-metrax4} and @option{-metrax100} are synonyms for 18784@option{-march=v3} and @option{-march=v8} respectively. 18785 18786@item -mmul-bug-workaround 18787@itemx -mno-mul-bug-workaround 18788@opindex mmul-bug-workaround 18789@opindex mno-mul-bug-workaround 18790Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 18791models where it applies. This option is active by default. 18792 18793@item -mpdebug 18794@opindex mpdebug 18795Enable CRIS-specific verbose debug-related information in the assembly 18796code. This option also has the effect of turning off the @samp{#NO_APP} 18797formatted-code indicator to the assembler at the beginning of the 18798assembly file. 18799 18800@item -mcc-init 18801@opindex mcc-init 18802Do not use condition-code results from previous instruction; always emit 18803compare and test instructions before use of condition codes. 18804 18805@item -mno-side-effects 18806@opindex mno-side-effects 18807@opindex mside-effects 18808Do not emit instructions with side effects in addressing modes other than 18809post-increment. 18810 18811@item -mstack-align 18812@itemx -mno-stack-align 18813@itemx -mdata-align 18814@itemx -mno-data-align 18815@itemx -mconst-align 18816@itemx -mno-const-align 18817@opindex mstack-align 18818@opindex mno-stack-align 18819@opindex mdata-align 18820@opindex mno-data-align 18821@opindex mconst-align 18822@opindex mno-const-align 18823These options (@samp{no-} options) arrange (eliminate arrangements) for the 18824stack frame, individual data and constants to be aligned for the maximum 18825single data access size for the chosen CPU model. The default is to 18826arrange for 32-bit alignment. ABI details such as structure layout are 18827not affected by these options. 18828 18829@item -m32-bit 18830@itemx -m16-bit 18831@itemx -m8-bit 18832@opindex m32-bit 18833@opindex m16-bit 18834@opindex m8-bit 18835Similar to the stack- data- and const-align options above, these options 18836arrange for stack frame, writable data and constants to all be 32-bit, 1883716-bit or 8-bit aligned. The default is 32-bit alignment. 18838 18839@item -mno-prologue-epilogue 18840@itemx -mprologue-epilogue 18841@opindex mno-prologue-epilogue 18842@opindex mprologue-epilogue 18843With @option{-mno-prologue-epilogue}, the normal function prologue and 18844epilogue which set up the stack frame are omitted and no return 18845instructions or return sequences are generated in the code. Use this 18846option only together with visual inspection of the compiled code: no 18847warnings or errors are generated when call-saved registers must be saved, 18848or storage for local variables needs to be allocated. 18849 18850@item -mno-gotplt 18851@itemx -mgotplt 18852@opindex mno-gotplt 18853@opindex mgotplt 18854With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 18855instruction sequences that load addresses for functions from the PLT part 18856of the GOT rather than (traditional on other architectures) calls to the 18857PLT@. The default is @option{-mgotplt}. 18858 18859@item -melf 18860@opindex melf 18861Legacy no-op option only recognized with the cris-axis-elf and 18862cris-axis-linux-gnu targets. 18863 18864@item -mlinux 18865@opindex mlinux 18866Legacy no-op option only recognized with the cris-axis-linux-gnu target. 18867 18868@item -sim 18869@opindex sim 18870This option, recognized for the cris-axis-elf, arranges 18871to link with input-output functions from a simulator library. Code, 18872initialized data and zero-initialized data are allocated consecutively. 18873 18874@item -sim2 18875@opindex sim2 18876Like @option{-sim}, but pass linker options to locate initialized data at 188770x40000000 and zero-initialized data at 0x80000000. 18878@end table 18879 18880@node CR16 Options 18881@subsection CR16 Options 18882@cindex CR16 Options 18883 18884These options are defined specifically for the CR16 ports. 18885 18886@table @gcctabopt 18887 18888@item -mmac 18889@opindex mmac 18890Enable the use of multiply-accumulate instructions. Disabled by default. 18891 18892@item -mcr16cplus 18893@itemx -mcr16c 18894@opindex mcr16cplus 18895@opindex mcr16c 18896Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 18897is default. 18898 18899@item -msim 18900@opindex msim 18901Links the library libsim.a which is in compatible with simulator. Applicable 18902to ELF compiler only. 18903 18904@item -mint32 18905@opindex mint32 18906Choose integer type as 32-bit wide. 18907 18908@item -mbit-ops 18909@opindex mbit-ops 18910Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 18911 18912@item -mdata-model=@var{model} 18913@opindex mdata-model 18914Choose a data model. The choices for @var{model} are @samp{near}, 18915@samp{far} or @samp{medium}. @samp{medium} is default. 18916However, @samp{far} is not valid with @option{-mcr16c}, as the 18917CR16C architecture does not support the far data model. 18918@end table 18919 18920@node C-SKY Options 18921@subsection C-SKY Options 18922@cindex C-SKY Options 18923 18924GCC supports these options when compiling for C-SKY V2 processors. 18925 18926@table @gcctabopt 18927 18928@item -march=@var{arch} 18929@opindex march= 18930Specify the C-SKY target architecture. Valid values for @var{arch} are: 18931@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}. 18932The default is @samp{ck810}. 18933 18934@item -mcpu=@var{cpu} 18935@opindex mcpu= 18936Specify the C-SKY target processor. Valid values for @var{cpu} are: 18937@samp{ck801}, @samp{ck801t}, 18938@samp{ck802}, @samp{ck802t}, @samp{ck802j}, 18939@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht}, 18940@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh}, 18941@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh}, 18942@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1}, 18943@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1}, 18944@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1}, 18945@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1}, 18946@samp{ck803eftr1}, @samp{ck803efhtr1}, 18947@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf}, 18948@samp{ck803sef}, @samp{ck803seft}, 18949@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f}, 18950@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft}, 18951@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv}, 18952@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}. 18953 18954@item -mbig-endian 18955@opindex mbig-endian 18956@itemx -EB 18957@opindex EB 18958@itemx -mlittle-endian 18959@opindex mlittle-endian 18960@itemx -EL 18961@opindex EL 18962 18963Select big- or little-endian code. The default is little-endian. 18964 18965@item -mhard-float 18966@opindex mhard-float 18967@itemx -msoft-float 18968@opindex msoft-float 18969 18970Select hardware or software floating-point implementations. 18971The default is soft float. 18972 18973@item -mdouble-float 18974@itemx -mno-double-float 18975@opindex mdouble-float 18976When @option{-mhard-float} is in effect, enable generation of 18977double-precision float instructions. This is the default except 18978when compiling for CK803. 18979 18980@item -mfdivdu 18981@itemx -mno-fdivdu 18982@opindex mfdivdu 18983When @option{-mhard-float} is in effect, enable generation of 18984@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions. 18985This is the default except when compiling for CK803. 18986 18987@item -mfpu=@var{fpu} 18988@opindex mfpu= 18989Select the floating-point processor. This option can only be used with 18990@option{-mhard-float}. 18991Values for @var{fpu} are 18992@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}), 18993@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and 18994@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}). 18995 18996@item -melrw 18997@itemx -mno-elrw 18998@opindex melrw 18999Enable the extended @code{lrw} instruction. This option defaults to on 19000for CK801 and off otherwise. 19001 19002@item -mistack 19003@itemx -mno-istack 19004@opindex mistack 19005Enable interrupt stack instructions; the default is off. 19006 19007The @option{-mistack} option is required to handle the 19008@code{interrupt} and @code{isr} function attributes 19009(@pxref{C-SKY Function Attributes}). 19010 19011@item -mmp 19012@opindex mmp 19013Enable multiprocessor instructions; the default is off. 19014 19015@item -mcp 19016@opindex mcp 19017Enable coprocessor instructions; the default is off. 19018 19019@item -mcache 19020@opindex mcache 19021Enable coprocessor instructions; the default is off. 19022 19023@item -msecurity 19024@opindex msecurity 19025Enable C-SKY security instructions; the default is off. 19026 19027@item -mtrust 19028@opindex mtrust 19029Enable C-SKY trust instructions; the default is off. 19030 19031@item -mdsp 19032@opindex mdsp 19033@itemx -medsp 19034@opindex medsp 19035@itemx -mvdsp 19036@opindex mvdsp 19037Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively. 19038All of these options default to off. 19039 19040@item -mdiv 19041@itemx -mno-div 19042@opindex mdiv 19043Generate divide instructions. Default is off. 19044 19045@item -msmart 19046@itemx -mno-smart 19047@opindex msmart 19048Generate code for Smart Mode, using only registers numbered 0-7 to allow 19049use of 16-bit instructions. This option is ignored for CK801 where this 19050is the required behavior, and it defaults to on for CK802. 19051For other targets, the default is off. 19052 19053@item -mhigh-registers 19054@itemx -mno-high-registers 19055@opindex mhigh-registers 19056Generate code using the high registers numbered 16-31. This option 19057is not supported on CK801, CK802, or CK803, and is enabled by default 19058for other processors. 19059 19060@item -manchor 19061@itemx -mno-anchor 19062@opindex manchor 19063Generate code using global anchor symbol addresses. 19064 19065@item -mpushpop 19066@itemx -mno-pushpop 19067@opindex mpushpop 19068Generate code using @code{push} and @code{pop} instructions. This option 19069defaults to on. 19070 19071@item -mmultiple-stld 19072@itemx -mstm 19073@itemx -mno-multiple-stld 19074@itemx -mno-stm 19075@opindex mmultiple-stld 19076Generate code using @code{stm} and @code{ldm} instructions. This option 19077isn't supported on CK801 but is enabled by default on other processors. 19078 19079@item -mconstpool 19080@itemx -mno-constpool 19081@opindex mconstpool 19082Create constant pools in the compiler instead of deferring it to the 19083assembler. This option is the default and required for correct code 19084generation on CK801 and CK802, and is optional on other processors. 19085 19086@item -mstack-size 19087@item -mno-stack-size 19088@opindex mstack-size 19089Emit @code{.stack_size} directives for each function in the assembly 19090output. This option defaults to off. 19091 19092@item -mccrt 19093@itemx -mno-ccrt 19094@opindex mccrt 19095Generate code for the C-SKY compiler runtime instead of libgcc. This 19096option defaults to off. 19097 19098@item -mbranch-cost=@var{n} 19099@opindex mbranch-cost= 19100Set the branch costs to roughly @code{n} instructions. The default is 1. 19101 19102@item -msched-prolog 19103@itemx -mno-sched-prolog 19104@opindex msched-prolog 19105Permit scheduling of function prologue and epilogue sequences. Using 19106this option can result in code that is not compliant with the C-SKY V2 ABI 19107prologue requirements and that cannot be debugged or backtraced. 19108It is disabled by default. 19109 19110@end table 19111 19112@node Darwin Options 19113@subsection Darwin Options 19114@cindex Darwin options 19115 19116These options are defined for all architectures running the Darwin operating 19117system. 19118 19119FSF GCC on Darwin does not create ``fat'' object files; it creates 19120an object file for the single architecture that GCC was built to 19121target. Apple's GCC on Darwin does create ``fat'' files if multiple 19122@option{-arch} options are used; it does so by running the compiler or 19123linker multiple times and joining the results together with 19124@file{lipo}. 19125 19126The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 19127@samp{i686}) is determined by the flags that specify the ISA 19128that GCC is targeting, like @option{-mcpu} or @option{-march}. The 19129@option{-force_cpusubtype_ALL} option can be used to override this. 19130 19131The Darwin tools vary in their behavior when presented with an ISA 19132mismatch. The assembler, @file{as}, only permits instructions to 19133be used that are valid for the subtype of the file it is generating, 19134so you cannot put 64-bit instructions in a @samp{ppc750} object file. 19135The linker for shared libraries, @file{/usr/bin/libtool}, fails 19136and prints an error if asked to create a shared library with a less 19137restrictive subtype than its input files (for instance, trying to put 19138a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 19139for executables, @command{ld}, quietly gives the executable the most 19140restrictive subtype of any of its input files. 19141 19142@table @gcctabopt 19143@item -F@var{dir} 19144@opindex F 19145Add the framework directory @var{dir} to the head of the list of 19146directories to be searched for header files. These directories are 19147interleaved with those specified by @option{-I} options and are 19148scanned in a left-to-right order. 19149 19150A framework directory is a directory with frameworks in it. A 19151framework is a directory with a @file{Headers} and/or 19152@file{PrivateHeaders} directory contained directly in it that ends 19153in @file{.framework}. The name of a framework is the name of this 19154directory excluding the @file{.framework}. Headers associated with 19155the framework are found in one of those two directories, with 19156@file{Headers} being searched first. A subframework is a framework 19157directory that is in a framework's @file{Frameworks} directory. 19158Includes of subframework headers can only appear in a header of a 19159framework that contains the subframework, or in a sibling subframework 19160header. Two subframeworks are siblings if they occur in the same 19161framework. A subframework should not have the same name as a 19162framework; a warning is issued if this is violated. Currently a 19163subframework cannot have subframeworks; in the future, the mechanism 19164may be extended to support this. The standard frameworks can be found 19165in @file{/System/Library/Frameworks} and 19166@file{/Library/Frameworks}. An example include looks like 19167@code{#include <Framework/header.h>}, where @file{Framework} denotes 19168the name of the framework and @file{header.h} is found in the 19169@file{PrivateHeaders} or @file{Headers} directory. 19170 19171@item -iframework@var{dir} 19172@opindex iframework 19173Like @option{-F} except the directory is a treated as a system 19174directory. The main difference between this @option{-iframework} and 19175@option{-F} is that with @option{-iframework} the compiler does not 19176warn about constructs contained within header files found via 19177@var{dir}. This option is valid only for the C family of languages. 19178 19179@item -gused 19180@opindex gused 19181Emit debugging information for symbols that are used. For stabs 19182debugging format, this enables @option{-feliminate-unused-debug-symbols}. 19183This is by default ON@. 19184 19185@item -gfull 19186@opindex gfull 19187Emit debugging information for all symbols and types. 19188 19189@item -mmacosx-version-min=@var{version} 19190The earliest version of MacOS X that this executable will run on 19191is @var{version}. Typical values of @var{version} include @code{10.1}, 19192@code{10.2}, and @code{10.3.9}. 19193 19194If the compiler was built to use the system's headers by default, 19195then the default for this option is the system version on which the 19196compiler is running, otherwise the default is to make choices that 19197are compatible with as many systems and code bases as possible. 19198 19199@item -mkernel 19200@opindex mkernel 19201Enable kernel development mode. The @option{-mkernel} option sets 19202@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 19203@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 19204@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 19205applicable. This mode also sets @option{-mno-altivec}, 19206@option{-msoft-float}, @option{-fno-builtin} and 19207@option{-mlong-branch} for PowerPC targets. 19208 19209@item -mone-byte-bool 19210@opindex mone-byte-bool 19211Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 19212By default @code{sizeof(bool)} is @code{4} when compiling for 19213Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 19214option has no effect on x86. 19215 19216@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 19217to generate code that is not binary compatible with code generated 19218without that switch. Using this switch may require recompiling all 19219other modules in a program, including system libraries. Use this 19220switch to conform to a non-default data model. 19221 19222@item -mfix-and-continue 19223@itemx -ffix-and-continue 19224@itemx -findirect-data 19225@opindex mfix-and-continue 19226@opindex ffix-and-continue 19227@opindex findirect-data 19228Generate code suitable for fast turnaround development, such as to 19229allow GDB to dynamically load @file{.o} files into already-running 19230programs. @option{-findirect-data} and @option{-ffix-and-continue} 19231are provided for backwards compatibility. 19232 19233@item -all_load 19234@opindex all_load 19235Loads all members of static archive libraries. 19236See man ld(1) for more information. 19237 19238@item -arch_errors_fatal 19239@opindex arch_errors_fatal 19240Cause the errors having to do with files that have the wrong architecture 19241to be fatal. 19242 19243@item -bind_at_load 19244@opindex bind_at_load 19245Causes the output file to be marked such that the dynamic linker will 19246bind all undefined references when the file is loaded or launched. 19247 19248@item -bundle 19249@opindex bundle 19250Produce a Mach-o bundle format file. 19251See man ld(1) for more information. 19252 19253@item -bundle_loader @var{executable} 19254@opindex bundle_loader 19255This option specifies the @var{executable} that will load the build 19256output file being linked. See man ld(1) for more information. 19257 19258@item -dynamiclib 19259@opindex dynamiclib 19260When passed this option, GCC produces a dynamic library instead of 19261an executable when linking, using the Darwin @file{libtool} command. 19262 19263@item -force_cpusubtype_ALL 19264@opindex force_cpusubtype_ALL 19265This causes GCC's output file to have the @samp{ALL} subtype, instead of 19266one controlled by the @option{-mcpu} or @option{-march} option. 19267 19268@item -allowable_client @var{client_name} 19269@itemx -client_name 19270@itemx -compatibility_version 19271@itemx -current_version 19272@itemx -dead_strip 19273@itemx -dependency-file 19274@itemx -dylib_file 19275@itemx -dylinker_install_name 19276@itemx -dynamic 19277@itemx -exported_symbols_list 19278@itemx -filelist 19279@need 800 19280@itemx -flat_namespace 19281@itemx -force_flat_namespace 19282@itemx -headerpad_max_install_names 19283@itemx -image_base 19284@itemx -init 19285@itemx -install_name 19286@itemx -keep_private_externs 19287@itemx -multi_module 19288@itemx -multiply_defined 19289@itemx -multiply_defined_unused 19290@need 800 19291@itemx -noall_load 19292@itemx -no_dead_strip_inits_and_terms 19293@itemx -nofixprebinding 19294@itemx -nomultidefs 19295@itemx -noprebind 19296@itemx -noseglinkedit 19297@itemx -pagezero_size 19298@itemx -prebind 19299@itemx -prebind_all_twolevel_modules 19300@itemx -private_bundle 19301@need 800 19302@itemx -read_only_relocs 19303@itemx -sectalign 19304@itemx -sectobjectsymbols 19305@itemx -whyload 19306@itemx -seg1addr 19307@itemx -sectcreate 19308@itemx -sectobjectsymbols 19309@itemx -sectorder 19310@itemx -segaddr 19311@itemx -segs_read_only_addr 19312@need 800 19313@itemx -segs_read_write_addr 19314@itemx -seg_addr_table 19315@itemx -seg_addr_table_filename 19316@itemx -seglinkedit 19317@itemx -segprot 19318@itemx -segs_read_only_addr 19319@itemx -segs_read_write_addr 19320@itemx -single_module 19321@itemx -static 19322@itemx -sub_library 19323@need 800 19324@itemx -sub_umbrella 19325@itemx -twolevel_namespace 19326@itemx -umbrella 19327@itemx -undefined 19328@itemx -unexported_symbols_list 19329@itemx -weak_reference_mismatches 19330@itemx -whatsloaded 19331@opindex allowable_client 19332@opindex client_name 19333@opindex compatibility_version 19334@opindex current_version 19335@opindex dead_strip 19336@opindex dependency-file 19337@opindex dylib_file 19338@opindex dylinker_install_name 19339@opindex dynamic 19340@opindex exported_symbols_list 19341@opindex filelist 19342@opindex flat_namespace 19343@opindex force_flat_namespace 19344@opindex headerpad_max_install_names 19345@opindex image_base 19346@opindex init 19347@opindex install_name 19348@opindex keep_private_externs 19349@opindex multi_module 19350@opindex multiply_defined 19351@opindex multiply_defined_unused 19352@opindex noall_load 19353@opindex no_dead_strip_inits_and_terms 19354@opindex nofixprebinding 19355@opindex nomultidefs 19356@opindex noprebind 19357@opindex noseglinkedit 19358@opindex pagezero_size 19359@opindex prebind 19360@opindex prebind_all_twolevel_modules 19361@opindex private_bundle 19362@opindex read_only_relocs 19363@opindex sectalign 19364@opindex sectobjectsymbols 19365@opindex whyload 19366@opindex seg1addr 19367@opindex sectcreate 19368@opindex sectobjectsymbols 19369@opindex sectorder 19370@opindex segaddr 19371@opindex segs_read_only_addr 19372@opindex segs_read_write_addr 19373@opindex seg_addr_table 19374@opindex seg_addr_table_filename 19375@opindex seglinkedit 19376@opindex segprot 19377@opindex segs_read_only_addr 19378@opindex segs_read_write_addr 19379@opindex single_module 19380@opindex static 19381@opindex sub_library 19382@opindex sub_umbrella 19383@opindex twolevel_namespace 19384@opindex umbrella 19385@opindex undefined 19386@opindex unexported_symbols_list 19387@opindex weak_reference_mismatches 19388@opindex whatsloaded 19389These options are passed to the Darwin linker. The Darwin linker man page 19390describes them in detail. 19391@end table 19392 19393@node DEC Alpha Options 19394@subsection DEC Alpha Options 19395 19396These @samp{-m} options are defined for the DEC Alpha implementations: 19397 19398@table @gcctabopt 19399@item -mno-soft-float 19400@itemx -msoft-float 19401@opindex mno-soft-float 19402@opindex msoft-float 19403Use (do not use) the hardware floating-point instructions for 19404floating-point operations. When @option{-msoft-float} is specified, 19405functions in @file{libgcc.a} are used to perform floating-point 19406operations. Unless they are replaced by routines that emulate the 19407floating-point operations, or compiled in such a way as to call such 19408emulations routines, these routines issue floating-point 19409operations. If you are compiling for an Alpha without floating-point 19410operations, you must ensure that the library is built so as not to call 19411them. 19412 19413Note that Alpha implementations without floating-point operations are 19414required to have floating-point registers. 19415 19416@item -mfp-reg 19417@itemx -mno-fp-regs 19418@opindex mfp-reg 19419@opindex mno-fp-regs 19420Generate code that uses (does not use) the floating-point register set. 19421@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 19422register set is not used, floating-point operands are passed in integer 19423registers as if they were integers and floating-point results are passed 19424in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 19425so any function with a floating-point argument or return value called by code 19426compiled with @option{-mno-fp-regs} must also be compiled with that 19427option. 19428 19429A typical use of this option is building a kernel that does not use, 19430and hence need not save and restore, any floating-point registers. 19431 19432@item -mieee 19433@opindex mieee 19434The Alpha architecture implements floating-point hardware optimized for 19435maximum performance. It is mostly compliant with the IEEE floating-point 19436standard. However, for full compliance, software assistance is 19437required. This option generates code fully IEEE-compliant code 19438@emph{except} that the @var{inexact-flag} is not maintained (see below). 19439If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 19440defined during compilation. The resulting code is less efficient but is 19441able to correctly support denormalized numbers and exceptional IEEE 19442values such as not-a-number and plus/minus infinity. Other Alpha 19443compilers call this option @option{-ieee_with_no_inexact}. 19444 19445@item -mieee-with-inexact 19446@opindex mieee-with-inexact 19447This is like @option{-mieee} except the generated code also maintains 19448the IEEE @var{inexact-flag}. Turning on this option causes the 19449generated code to implement fully-compliant IEEE math. In addition to 19450@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 19451macro. On some Alpha implementations the resulting code may execute 19452significantly slower than the code generated by default. Since there is 19453very little code that depends on the @var{inexact-flag}, you should 19454normally not specify this option. Other Alpha compilers call this 19455option @option{-ieee_with_inexact}. 19456 19457@item -mfp-trap-mode=@var{trap-mode} 19458@opindex mfp-trap-mode 19459This option controls what floating-point related traps are enabled. 19460Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 19461The trap mode can be set to one of four values: 19462 19463@table @samp 19464@item n 19465This is the default (normal) setting. The only traps that are enabled 19466are the ones that cannot be disabled in software (e.g., division by zero 19467trap). 19468 19469@item u 19470In addition to the traps enabled by @samp{n}, underflow traps are enabled 19471as well. 19472 19473@item su 19474Like @samp{u}, but the instructions are marked to be safe for software 19475completion (see Alpha architecture manual for details). 19476 19477@item sui 19478Like @samp{su}, but inexact traps are enabled as well. 19479@end table 19480 19481@item -mfp-rounding-mode=@var{rounding-mode} 19482@opindex mfp-rounding-mode 19483Selects the IEEE rounding mode. Other Alpha compilers call this option 19484@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 19485of: 19486 19487@table @samp 19488@item n 19489Normal IEEE rounding mode. Floating-point numbers are rounded towards 19490the nearest machine number or towards the even machine number in case 19491of a tie. 19492 19493@item m 19494Round towards minus infinity. 19495 19496@item c 19497Chopped rounding mode. Floating-point numbers are rounded towards zero. 19498 19499@item d 19500Dynamic rounding mode. A field in the floating-point control register 19501(@var{fpcr}, see Alpha architecture reference manual) controls the 19502rounding mode in effect. The C library initializes this register for 19503rounding towards plus infinity. Thus, unless your program modifies the 19504@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 19505@end table 19506 19507@item -mtrap-precision=@var{trap-precision} 19508@opindex mtrap-precision 19509In the Alpha architecture, floating-point traps are imprecise. This 19510means without software assistance it is impossible to recover from a 19511floating trap and program execution normally needs to be terminated. 19512GCC can generate code that can assist operating system trap handlers 19513in determining the exact location that caused a floating-point trap. 19514Depending on the requirements of an application, different levels of 19515precisions can be selected: 19516 19517@table @samp 19518@item p 19519Program precision. This option is the default and means a trap handler 19520can only identify which program caused a floating-point exception. 19521 19522@item f 19523Function precision. The trap handler can determine the function that 19524caused a floating-point exception. 19525 19526@item i 19527Instruction precision. The trap handler can determine the exact 19528instruction that caused a floating-point exception. 19529@end table 19530 19531Other Alpha compilers provide the equivalent options called 19532@option{-scope_safe} and @option{-resumption_safe}. 19533 19534@item -mieee-conformant 19535@opindex mieee-conformant 19536This option marks the generated code as IEEE conformant. You must not 19537use this option unless you also specify @option{-mtrap-precision=i} and either 19538@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 19539is to emit the line @samp{.eflag 48} in the function prologue of the 19540generated assembly file. 19541 19542@item -mbuild-constants 19543@opindex mbuild-constants 19544Normally GCC examines a 32- or 64-bit integer constant to 19545see if it can construct it from smaller constants in two or three 19546instructions. If it cannot, it outputs the constant as a literal and 19547generates code to load it from the data segment at run time. 19548 19549Use this option to require GCC to construct @emph{all} integer constants 19550using code, even if it takes more instructions (the maximum is six). 19551 19552You typically use this option to build a shared library dynamic 19553loader. Itself a shared library, it must relocate itself in memory 19554before it can find the variables and constants in its own data segment. 19555 19556@item -mbwx 19557@itemx -mno-bwx 19558@itemx -mcix 19559@itemx -mno-cix 19560@itemx -mfix 19561@itemx -mno-fix 19562@itemx -mmax 19563@itemx -mno-max 19564@opindex mbwx 19565@opindex mno-bwx 19566@opindex mcix 19567@opindex mno-cix 19568@opindex mfix 19569@opindex mno-fix 19570@opindex mmax 19571@opindex mno-max 19572Indicate whether GCC should generate code to use the optional BWX, 19573CIX, FIX and MAX instruction sets. The default is to use the instruction 19574sets supported by the CPU type specified via @option{-mcpu=} option or that 19575of the CPU on which GCC was built if none is specified. 19576 19577@item -mfloat-vax 19578@itemx -mfloat-ieee 19579@opindex mfloat-vax 19580@opindex mfloat-ieee 19581Generate code that uses (does not use) VAX F and G floating-point 19582arithmetic instead of IEEE single and double precision. 19583 19584@item -mexplicit-relocs 19585@itemx -mno-explicit-relocs 19586@opindex mexplicit-relocs 19587@opindex mno-explicit-relocs 19588Older Alpha assemblers provided no way to generate symbol relocations 19589except via assembler macros. Use of these macros does not allow 19590optimal instruction scheduling. GNU binutils as of version 2.12 19591supports a new syntax that allows the compiler to explicitly mark 19592which relocations should apply to which instructions. This option 19593is mostly useful for debugging, as GCC detects the capabilities of 19594the assembler when it is built and sets the default accordingly. 19595 19596@item -msmall-data 19597@itemx -mlarge-data 19598@opindex msmall-data 19599@opindex mlarge-data 19600When @option{-mexplicit-relocs} is in effect, static data is 19601accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 19602is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 19603(the @code{.sdata} and @code{.sbss} sections) and are accessed via 1960416-bit relocations off of the @code{$gp} register. This limits the 19605size of the small data area to 64KB, but allows the variables to be 19606directly accessed via a single instruction. 19607 19608The default is @option{-mlarge-data}. With this option the data area 19609is limited to just below 2GB@. Programs that require more than 2GB of 19610data must use @code{malloc} or @code{mmap} to allocate the data in the 19611heap instead of in the program's data segment. 19612 19613When generating code for shared libraries, @option{-fpic} implies 19614@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 19615 19616@item -msmall-text 19617@itemx -mlarge-text 19618@opindex msmall-text 19619@opindex mlarge-text 19620When @option{-msmall-text} is used, the compiler assumes that the 19621code of the entire program (or shared library) fits in 4MB, and is 19622thus reachable with a branch instruction. When @option{-msmall-data} 19623is used, the compiler can assume that all local symbols share the 19624same @code{$gp} value, and thus reduce the number of instructions 19625required for a function call from 4 to 1. 19626 19627The default is @option{-mlarge-text}. 19628 19629@item -mcpu=@var{cpu_type} 19630@opindex mcpu 19631Set the instruction set and instruction scheduling parameters for 19632machine type @var{cpu_type}. You can specify either the @samp{EV} 19633style name or the corresponding chip number. GCC supports scheduling 19634parameters for the EV4, EV5 and EV6 family of processors and 19635chooses the default values for the instruction set from the processor 19636you specify. If you do not specify a processor type, GCC defaults 19637to the processor on which the compiler was built. 19638 19639Supported values for @var{cpu_type} are 19640 19641@table @samp 19642@item ev4 19643@itemx ev45 19644@itemx 21064 19645Schedules as an EV4 and has no instruction set extensions. 19646 19647@item ev5 19648@itemx 21164 19649Schedules as an EV5 and has no instruction set extensions. 19650 19651@item ev56 19652@itemx 21164a 19653Schedules as an EV5 and supports the BWX extension. 19654 19655@item pca56 19656@itemx 21164pc 19657@itemx 21164PC 19658Schedules as an EV5 and supports the BWX and MAX extensions. 19659 19660@item ev6 19661@itemx 21264 19662Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 19663 19664@item ev67 19665@itemx 21264a 19666Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 19667@end table 19668 19669Native toolchains also support the value @samp{native}, 19670which selects the best architecture option for the host processor. 19671@option{-mcpu=native} has no effect if GCC does not recognize 19672the processor. 19673 19674@item -mtune=@var{cpu_type} 19675@opindex mtune 19676Set only the instruction scheduling parameters for machine type 19677@var{cpu_type}. The instruction set is not changed. 19678 19679Native toolchains also support the value @samp{native}, 19680which selects the best architecture option for the host processor. 19681@option{-mtune=native} has no effect if GCC does not recognize 19682the processor. 19683 19684@item -mmemory-latency=@var{time} 19685@opindex mmemory-latency 19686Sets the latency the scheduler should assume for typical memory 19687references as seen by the application. This number is highly 19688dependent on the memory access patterns used by the application 19689and the size of the external cache on the machine. 19690 19691Valid options for @var{time} are 19692 19693@table @samp 19694@item @var{number} 19695A decimal number representing clock cycles. 19696 19697@item L1 19698@itemx L2 19699@itemx L3 19700@itemx main 19701The compiler contains estimates of the number of clock cycles for 19702``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 19703(also called Dcache, Scache, and Bcache), as well as to main memory. 19704Note that L3 is only valid for EV5. 19705 19706@end table 19707@end table 19708 19709@node FR30 Options 19710@subsection FR30 Options 19711@cindex FR30 Options 19712 19713These options are defined specifically for the FR30 port. 19714 19715@table @gcctabopt 19716 19717@item -msmall-model 19718@opindex msmall-model 19719Use the small address space model. This can produce smaller code, but 19720it does assume that all symbolic values and addresses fit into a 1972120-bit range. 19722 19723@item -mno-lsim 19724@opindex mno-lsim 19725Assume that runtime support has been provided and so there is no need 19726to include the simulator library (@file{libsim.a}) on the linker 19727command line. 19728 19729@end table 19730 19731@node FT32 Options 19732@subsection FT32 Options 19733@cindex FT32 Options 19734 19735These options are defined specifically for the FT32 port. 19736 19737@table @gcctabopt 19738 19739@item -msim 19740@opindex msim 19741Specifies that the program will be run on the simulator. This causes 19742an alternate runtime startup and library to be linked. 19743You must not use this option when generating programs that will run on 19744real hardware; you must provide your own runtime library for whatever 19745I/O functions are needed. 19746 19747@item -mlra 19748@opindex mlra 19749Enable Local Register Allocation. This is still experimental for FT32, 19750so by default the compiler uses standard reload. 19751 19752@item -mnodiv 19753@opindex mnodiv 19754Do not use div and mod instructions. 19755 19756@item -mft32b 19757@opindex mft32b 19758Enable use of the extended instructions of the FT32B processor. 19759 19760@item -mcompress 19761@opindex mcompress 19762Compress all code using the Ft32B code compression scheme. 19763 19764@item -mnopm 19765@opindex mnopm 19766Do not generate code that reads program memory. 19767 19768@end table 19769 19770@node FRV Options 19771@subsection FRV Options 19772@cindex FRV Options 19773 19774@table @gcctabopt 19775@item -mgpr-32 19776@opindex mgpr-32 19777 19778Only use the first 32 general-purpose registers. 19779 19780@item -mgpr-64 19781@opindex mgpr-64 19782 19783Use all 64 general-purpose registers. 19784 19785@item -mfpr-32 19786@opindex mfpr-32 19787 19788Use only the first 32 floating-point registers. 19789 19790@item -mfpr-64 19791@opindex mfpr-64 19792 19793Use all 64 floating-point registers. 19794 19795@item -mhard-float 19796@opindex mhard-float 19797 19798Use hardware instructions for floating-point operations. 19799 19800@item -msoft-float 19801@opindex msoft-float 19802 19803Use library routines for floating-point operations. 19804 19805@item -malloc-cc 19806@opindex malloc-cc 19807 19808Dynamically allocate condition code registers. 19809 19810@item -mfixed-cc 19811@opindex mfixed-cc 19812 19813Do not try to dynamically allocate condition code registers, only 19814use @code{icc0} and @code{fcc0}. 19815 19816@item -mdword 19817@opindex mdword 19818 19819Change ABI to use double word insns. 19820 19821@item -mno-dword 19822@opindex mno-dword 19823@opindex mdword 19824 19825Do not use double word instructions. 19826 19827@item -mdouble 19828@opindex mdouble 19829 19830Use floating-point double instructions. 19831 19832@item -mno-double 19833@opindex mno-double 19834 19835Do not use floating-point double instructions. 19836 19837@item -mmedia 19838@opindex mmedia 19839 19840Use media instructions. 19841 19842@item -mno-media 19843@opindex mno-media 19844 19845Do not use media instructions. 19846 19847@item -mmuladd 19848@opindex mmuladd 19849 19850Use multiply and add/subtract instructions. 19851 19852@item -mno-muladd 19853@opindex mno-muladd 19854 19855Do not use multiply and add/subtract instructions. 19856 19857@item -mfdpic 19858@opindex mfdpic 19859 19860Select the FDPIC ABI, which uses function descriptors to represent 19861pointers to functions. Without any PIC/PIE-related options, it 19862implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 19863assumes GOT entries and small data are within a 12-bit range from the 19864GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 19865are computed with 32 bits. 19866With a @samp{bfin-elf} target, this option implies @option{-msim}. 19867 19868@item -minline-plt 19869@opindex minline-plt 19870 19871Enable inlining of PLT entries in function calls to functions that are 19872not known to bind locally. It has no effect without @option{-mfdpic}. 19873It's enabled by default if optimizing for speed and compiling for 19874shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 19875optimization option such as @option{-O3} or above is present in the 19876command line. 19877 19878@item -mTLS 19879@opindex mTLS 19880 19881Assume a large TLS segment when generating thread-local code. 19882 19883@item -mtls 19884@opindex mtls 19885 19886Do not assume a large TLS segment when generating thread-local code. 19887 19888@item -mgprel-ro 19889@opindex mgprel-ro 19890 19891Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 19892that is known to be in read-only sections. It's enabled by default, 19893except for @option{-fpic} or @option{-fpie}: even though it may help 19894make the global offset table smaller, it trades 1 instruction for 4. 19895With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 19896one of which may be shared by multiple symbols, and it avoids the need 19897for a GOT entry for the referenced symbol, so it's more likely to be a 19898win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 19899 19900@item -multilib-library-pic 19901@opindex multilib-library-pic 19902 19903Link with the (library, not FD) pic libraries. It's implied by 19904@option{-mlibrary-pic}, as well as by @option{-fPIC} and 19905@option{-fpic} without @option{-mfdpic}. You should never have to use 19906it explicitly. 19907 19908@item -mlinked-fp 19909@opindex mlinked-fp 19910 19911Follow the EABI requirement of always creating a frame pointer whenever 19912a stack frame is allocated. This option is enabled by default and can 19913be disabled with @option{-mno-linked-fp}. 19914 19915@item -mlong-calls 19916@opindex mlong-calls 19917 19918Use indirect addressing to call functions outside the current 19919compilation unit. This allows the functions to be placed anywhere 19920within the 32-bit address space. 19921 19922@item -malign-labels 19923@opindex malign-labels 19924 19925Try to align labels to an 8-byte boundary by inserting NOPs into the 19926previous packet. This option only has an effect when VLIW packing 19927is enabled. It doesn't create new packets; it merely adds NOPs to 19928existing ones. 19929 19930@item -mlibrary-pic 19931@opindex mlibrary-pic 19932 19933Generate position-independent EABI code. 19934 19935@item -macc-4 19936@opindex macc-4 19937 19938Use only the first four media accumulator registers. 19939 19940@item -macc-8 19941@opindex macc-8 19942 19943Use all eight media accumulator registers. 19944 19945@item -mpack 19946@opindex mpack 19947 19948Pack VLIW instructions. 19949 19950@item -mno-pack 19951@opindex mno-pack 19952 19953Do not pack VLIW instructions. 19954 19955@item -mno-eflags 19956@opindex mno-eflags 19957 19958Do not mark ABI switches in e_flags. 19959 19960@item -mcond-move 19961@opindex mcond-move 19962 19963Enable the use of conditional-move instructions (default). 19964 19965This switch is mainly for debugging the compiler and will likely be removed 19966in a future version. 19967 19968@item -mno-cond-move 19969@opindex mno-cond-move 19970 19971Disable the use of conditional-move instructions. 19972 19973This switch is mainly for debugging the compiler and will likely be removed 19974in a future version. 19975 19976@item -mscc 19977@opindex mscc 19978 19979Enable the use of conditional set instructions (default). 19980 19981This switch is mainly for debugging the compiler and will likely be removed 19982in a future version. 19983 19984@item -mno-scc 19985@opindex mno-scc 19986 19987Disable the use of conditional set instructions. 19988 19989This switch is mainly for debugging the compiler and will likely be removed 19990in a future version. 19991 19992@item -mcond-exec 19993@opindex mcond-exec 19994 19995Enable the use of conditional execution (default). 19996 19997This switch is mainly for debugging the compiler and will likely be removed 19998in a future version. 19999 20000@item -mno-cond-exec 20001@opindex mno-cond-exec 20002 20003Disable the use of conditional execution. 20004 20005This switch is mainly for debugging the compiler and will likely be removed 20006in a future version. 20007 20008@item -mvliw-branch 20009@opindex mvliw-branch 20010 20011Run a pass to pack branches into VLIW instructions (default). 20012 20013This switch is mainly for debugging the compiler and will likely be removed 20014in a future version. 20015 20016@item -mno-vliw-branch 20017@opindex mno-vliw-branch 20018 20019Do not run a pass to pack branches into VLIW instructions. 20020 20021This switch is mainly for debugging the compiler and will likely be removed 20022in a future version. 20023 20024@item -mmulti-cond-exec 20025@opindex mmulti-cond-exec 20026 20027Enable optimization of @code{&&} and @code{||} in conditional execution 20028(default). 20029 20030This switch is mainly for debugging the compiler and will likely be removed 20031in a future version. 20032 20033@item -mno-multi-cond-exec 20034@opindex mno-multi-cond-exec 20035 20036Disable optimization of @code{&&} and @code{||} in conditional execution. 20037 20038This switch is mainly for debugging the compiler and will likely be removed 20039in a future version. 20040 20041@item -mnested-cond-exec 20042@opindex mnested-cond-exec 20043 20044Enable nested conditional execution optimizations (default). 20045 20046This switch is mainly for debugging the compiler and will likely be removed 20047in a future version. 20048 20049@item -mno-nested-cond-exec 20050@opindex mno-nested-cond-exec 20051 20052Disable nested conditional execution optimizations. 20053 20054This switch is mainly for debugging the compiler and will likely be removed 20055in a future version. 20056 20057@item -moptimize-membar 20058@opindex moptimize-membar 20059 20060This switch removes redundant @code{membar} instructions from the 20061compiler-generated code. It is enabled by default. 20062 20063@item -mno-optimize-membar 20064@opindex mno-optimize-membar 20065@opindex moptimize-membar 20066 20067This switch disables the automatic removal of redundant @code{membar} 20068instructions from the generated code. 20069 20070@item -mtomcat-stats 20071@opindex mtomcat-stats 20072 20073Cause gas to print out tomcat statistics. 20074 20075@item -mcpu=@var{cpu} 20076@opindex mcpu 20077 20078Select the processor type for which to generate code. Possible values are 20079@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 20080@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 20081 20082@end table 20083 20084@node GNU/Linux Options 20085@subsection GNU/Linux Options 20086 20087These @samp{-m} options are defined for GNU/Linux targets: 20088 20089@table @gcctabopt 20090@item -mglibc 20091@opindex mglibc 20092Use the GNU C library. This is the default except 20093on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and 20094@samp{*-*-linux-*android*} targets. 20095 20096@item -muclibc 20097@opindex muclibc 20098Use uClibc C library. This is the default on 20099@samp{*-*-linux-*uclibc*} targets. 20100 20101@item -mmusl 20102@opindex mmusl 20103Use the musl C library. This is the default on 20104@samp{*-*-linux-*musl*} targets. 20105 20106@item -mbionic 20107@opindex mbionic 20108Use Bionic C library. This is the default on 20109@samp{*-*-linux-*android*} targets. 20110 20111@item -mandroid 20112@opindex mandroid 20113Compile code compatible with Android platform. This is the default on 20114@samp{*-*-linux-*android*} targets. 20115 20116When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 20117@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 20118this option makes the GCC driver pass Android-specific options to the linker. 20119Finally, this option causes the preprocessor macro @code{__ANDROID__} 20120to be defined. 20121 20122@item -tno-android-cc 20123@opindex tno-android-cc 20124Disable compilation effects of @option{-mandroid}, i.e., do not enable 20125@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 20126@option{-fno-rtti} by default. 20127 20128@item -tno-android-ld 20129@opindex tno-android-ld 20130Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 20131linking options to the linker. 20132 20133@end table 20134 20135@node H8/300 Options 20136@subsection H8/300 Options 20137 20138These @samp{-m} options are defined for the H8/300 implementations: 20139 20140@table @gcctabopt 20141@item -mrelax 20142@opindex mrelax 20143Shorten some address references at link time, when possible; uses the 20144linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 20145ld, Using ld}, for a fuller description. 20146 20147@item -mh 20148@opindex mh 20149Generate code for the H8/300H@. 20150 20151@item -ms 20152@opindex ms 20153Generate code for the H8S@. 20154 20155@item -mn 20156@opindex mn 20157Generate code for the H8S and H8/300H in the normal mode. This switch 20158must be used either with @option{-mh} or @option{-ms}. 20159 20160@item -ms2600 20161@opindex ms2600 20162Generate code for the H8S/2600. This switch must be used with @option{-ms}. 20163 20164@item -mexr 20165@opindex mexr 20166Extended registers are stored on stack before execution of function 20167with monitor attribute. Default option is @option{-mexr}. 20168This option is valid only for H8S targets. 20169 20170@item -mno-exr 20171@opindex mno-exr 20172@opindex mexr 20173Extended registers are not stored on stack before execution of function 20174with monitor attribute. Default option is @option{-mno-exr}. 20175This option is valid only for H8S targets. 20176 20177@item -mint32 20178@opindex mint32 20179Make @code{int} data 32 bits by default. 20180 20181@item -malign-300 20182@opindex malign-300 20183On the H8/300H and H8S, use the same alignment rules as for the H8/300. 20184The default for the H8/300H and H8S is to align longs and floats on 201854-byte boundaries. 20186@option{-malign-300} causes them to be aligned on 2-byte boundaries. 20187This option has no effect on the H8/300. 20188@end table 20189 20190@node HPPA Options 20191@subsection HPPA Options 20192@cindex HPPA Options 20193 20194These @samp{-m} options are defined for the HPPA family of computers: 20195 20196@table @gcctabopt 20197@item -march=@var{architecture-type} 20198@opindex march 20199Generate code for the specified architecture. The choices for 20200@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 202011.1, and @samp{2.0} for PA 2.0 processors. Refer to 20202@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 20203architecture option for your machine. Code compiled for lower numbered 20204architectures runs on higher numbered architectures, but not the 20205other way around. 20206 20207@item -mpa-risc-1-0 20208@itemx -mpa-risc-1-1 20209@itemx -mpa-risc-2-0 20210@opindex mpa-risc-1-0 20211@opindex mpa-risc-1-1 20212@opindex mpa-risc-2-0 20213Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 20214 20215@item -mcaller-copies 20216@opindex mcaller-copies 20217The caller copies function arguments passed by hidden reference. This 20218option should be used with care as it is not compatible with the default 2021932-bit runtime. However, only aggregates larger than eight bytes are 20220passed by hidden reference and the option provides better compatibility 20221with OpenMP. 20222 20223@item -mjump-in-delay 20224@opindex mjump-in-delay 20225This option is ignored and provided for compatibility purposes only. 20226 20227@item -mdisable-fpregs 20228@opindex mdisable-fpregs 20229Prevent floating-point registers from being used in any manner. This is 20230necessary for compiling kernels that perform lazy context switching of 20231floating-point registers. If you use this option and attempt to perform 20232floating-point operations, the compiler aborts. 20233 20234@item -mdisable-indexing 20235@opindex mdisable-indexing 20236Prevent the compiler from using indexing address modes. This avoids some 20237rather obscure problems when compiling MIG generated code under MACH@. 20238 20239@item -mno-space-regs 20240@opindex mno-space-regs 20241@opindex mspace-regs 20242Generate code that assumes the target has no space registers. This allows 20243GCC to generate faster indirect calls and use unscaled index address modes. 20244 20245Such code is suitable for level 0 PA systems and kernels. 20246 20247@item -mfast-indirect-calls 20248@opindex mfast-indirect-calls 20249Generate code that assumes calls never cross space boundaries. This 20250allows GCC to emit code that performs faster indirect calls. 20251 20252This option does not work in the presence of shared libraries or nested 20253functions. 20254 20255@item -mfixed-range=@var{register-range} 20256@opindex mfixed-range 20257Generate code treating the given register range as fixed registers. 20258A fixed register is one that the register allocator cannot use. This is 20259useful when compiling kernel code. A register range is specified as 20260two registers separated by a dash. Multiple register ranges can be 20261specified separated by a comma. 20262 20263@item -mlong-load-store 20264@opindex mlong-load-store 20265Generate 3-instruction load and store sequences as sometimes required by 20266the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 20267the HP compilers. 20268 20269@item -mportable-runtime 20270@opindex mportable-runtime 20271Use the portable calling conventions proposed by HP for ELF systems. 20272 20273@item -mgas 20274@opindex mgas 20275Enable the use of assembler directives only GAS understands. 20276 20277@item -mschedule=@var{cpu-type} 20278@opindex mschedule 20279Schedule code according to the constraints for the machine type 20280@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 20281@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 20282to @file{/usr/lib/sched.models} on an HP-UX system to determine the 20283proper scheduling option for your machine. The default scheduling is 20284@samp{8000}. 20285 20286@item -mlinker-opt 20287@opindex mlinker-opt 20288Enable the optimization pass in the HP-UX linker. Note this makes symbolic 20289debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 20290linkers in which they give bogus error messages when linking some programs. 20291 20292@item -msoft-float 20293@opindex msoft-float 20294Generate output containing library calls for floating point. 20295@strong{Warning:} the requisite libraries are not available for all HPPA 20296targets. Normally the facilities of the machine's usual C compiler are 20297used, but this cannot be done directly in cross-compilation. You must make 20298your own arrangements to provide suitable library functions for 20299cross-compilation. 20300 20301@option{-msoft-float} changes the calling convention in the output file; 20302therefore, it is only useful if you compile @emph{all} of a program with 20303this option. In particular, you need to compile @file{libgcc.a}, the 20304library that comes with GCC, with @option{-msoft-float} in order for 20305this to work. 20306 20307@item -msio 20308@opindex msio 20309Generate the predefine, @code{_SIO}, for server IO@. The default is 20310@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 20311@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 20312options are available under HP-UX and HI-UX@. 20313 20314@item -mgnu-ld 20315@opindex mgnu-ld 20316Use options specific to GNU @command{ld}. 20317This passes @option{-shared} to @command{ld} when 20318building a shared library. It is the default when GCC is configured, 20319explicitly or implicitly, with the GNU linker. This option does not 20320affect which @command{ld} is called; it only changes what parameters 20321are passed to that @command{ld}. 20322The @command{ld} that is called is determined by the 20323@option{--with-ld} configure option, GCC's program search path, and 20324finally by the user's @env{PATH}. The linker used by GCC can be printed 20325using @samp{which `gcc -print-prog-name=ld`}. This option is only available 20326on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 20327 20328@item -mhp-ld 20329@opindex mhp-ld 20330Use options specific to HP @command{ld}. 20331This passes @option{-b} to @command{ld} when building 20332a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 20333links. It is the default when GCC is configured, explicitly or 20334implicitly, with the HP linker. This option does not affect 20335which @command{ld} is called; it only changes what parameters are passed to that 20336@command{ld}. 20337The @command{ld} that is called is determined by the @option{--with-ld} 20338configure option, GCC's program search path, and finally by the user's 20339@env{PATH}. The linker used by GCC can be printed using @samp{which 20340`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 20341HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 20342 20343@item -mlong-calls 20344@opindex mno-long-calls 20345@opindex mlong-calls 20346Generate code that uses long call sequences. This ensures that a call 20347is always able to reach linker generated stubs. The default is to generate 20348long calls only when the distance from the call site to the beginning 20349of the function or translation unit, as the case may be, exceeds a 20350predefined limit set by the branch type being used. The limits for 20351normal calls are 7,600,000 and 240,000 bytes, respectively for the 20352PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 20353240,000 bytes. 20354 20355Distances are measured from the beginning of functions when using the 20356@option{-ffunction-sections} option, or when using the @option{-mgas} 20357and @option{-mno-portable-runtime} options together under HP-UX with 20358the SOM linker. 20359 20360It is normally not desirable to use this option as it degrades 20361performance. However, it may be useful in large applications, 20362particularly when partial linking is used to build the application. 20363 20364The types of long calls used depends on the capabilities of the 20365assembler and linker, and the type of code being generated. The 20366impact on systems that support long absolute calls, and long pic 20367symbol-difference or pc-relative calls should be relatively small. 20368However, an indirect call is used on 32-bit ELF systems in pic code 20369and it is quite long. 20370 20371@item -munix=@var{unix-std} 20372@opindex march 20373Generate compiler predefines and select a startfile for the specified 20374UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 20375and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 20376is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 2037711.11 and later. The default values are @samp{93} for HP-UX 10.00, 20378@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 20379and later. 20380 20381@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 20382@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 20383and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 20384@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 20385@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 20386@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 20387 20388It is @emph{important} to note that this option changes the interfaces 20389for various library routines. It also affects the operational behavior 20390of the C library. Thus, @emph{extreme} care is needed in using this 20391option. 20392 20393Library code that is intended to operate with more than one UNIX 20394standard must test, set and restore the variable @code{__xpg4_extended_mask} 20395as appropriate. Most GNU software doesn't provide this capability. 20396 20397@item -nolibdld 20398@opindex nolibdld 20399Suppress the generation of link options to search libdld.sl when the 20400@option{-static} option is specified on HP-UX 10 and later. 20401 20402@item -static 20403@opindex static 20404The HP-UX implementation of setlocale in libc has a dependency on 20405libdld.sl. There isn't an archive version of libdld.sl. Thus, 20406when the @option{-static} option is specified, special link options 20407are needed to resolve this dependency. 20408 20409On HP-UX 10 and later, the GCC driver adds the necessary options to 20410link with libdld.sl when the @option{-static} option is specified. 20411This causes the resulting binary to be dynamic. On the 64-bit port, 20412the linkers generate dynamic binaries by default in any case. The 20413@option{-nolibdld} option can be used to prevent the GCC driver from 20414adding these link options. 20415 20416@item -threads 20417@opindex threads 20418Add support for multithreading with the @dfn{dce thread} library 20419under HP-UX@. This option sets flags for both the preprocessor and 20420linker. 20421@end table 20422 20423@node IA-64 Options 20424@subsection IA-64 Options 20425@cindex IA-64 Options 20426 20427These are the @samp{-m} options defined for the Intel IA-64 architecture. 20428 20429@table @gcctabopt 20430@item -mbig-endian 20431@opindex mbig-endian 20432Generate code for a big-endian target. This is the default for HP-UX@. 20433 20434@item -mlittle-endian 20435@opindex mlittle-endian 20436Generate code for a little-endian target. This is the default for AIX5 20437and GNU/Linux. 20438 20439@item -mgnu-as 20440@itemx -mno-gnu-as 20441@opindex mgnu-as 20442@opindex mno-gnu-as 20443Generate (or don't) code for the GNU assembler. This is the default. 20444@c Also, this is the default if the configure option @option{--with-gnu-as} 20445@c is used. 20446 20447@item -mgnu-ld 20448@itemx -mno-gnu-ld 20449@opindex mgnu-ld 20450@opindex mno-gnu-ld 20451Generate (or don't) code for the GNU linker. This is the default. 20452@c Also, this is the default if the configure option @option{--with-gnu-ld} 20453@c is used. 20454 20455@item -mno-pic 20456@opindex mno-pic 20457Generate code that does not use a global pointer register. The result 20458is not position independent code, and violates the IA-64 ABI@. 20459 20460@item -mvolatile-asm-stop 20461@itemx -mno-volatile-asm-stop 20462@opindex mvolatile-asm-stop 20463@opindex mno-volatile-asm-stop 20464Generate (or don't) a stop bit immediately before and after volatile asm 20465statements. 20466 20467@item -mregister-names 20468@itemx -mno-register-names 20469@opindex mregister-names 20470@opindex mno-register-names 20471Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 20472the stacked registers. This may make assembler output more readable. 20473 20474@item -mno-sdata 20475@itemx -msdata 20476@opindex mno-sdata 20477@opindex msdata 20478Disable (or enable) optimizations that use the small data section. This may 20479be useful for working around optimizer bugs. 20480 20481@item -mconstant-gp 20482@opindex mconstant-gp 20483Generate code that uses a single constant global pointer value. This is 20484useful when compiling kernel code. 20485 20486@item -mauto-pic 20487@opindex mauto-pic 20488Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 20489This is useful when compiling firmware code. 20490 20491@item -minline-float-divide-min-latency 20492@opindex minline-float-divide-min-latency 20493Generate code for inline divides of floating-point values 20494using the minimum latency algorithm. 20495 20496@item -minline-float-divide-max-throughput 20497@opindex minline-float-divide-max-throughput 20498Generate code for inline divides of floating-point values 20499using the maximum throughput algorithm. 20500 20501@item -mno-inline-float-divide 20502@opindex mno-inline-float-divide 20503Do not generate inline code for divides of floating-point values. 20504 20505@item -minline-int-divide-min-latency 20506@opindex minline-int-divide-min-latency 20507Generate code for inline divides of integer values 20508using the minimum latency algorithm. 20509 20510@item -minline-int-divide-max-throughput 20511@opindex minline-int-divide-max-throughput 20512Generate code for inline divides of integer values 20513using the maximum throughput algorithm. 20514 20515@item -mno-inline-int-divide 20516@opindex mno-inline-int-divide 20517@opindex minline-int-divide 20518Do not generate inline code for divides of integer values. 20519 20520@item -minline-sqrt-min-latency 20521@opindex minline-sqrt-min-latency 20522Generate code for inline square roots 20523using the minimum latency algorithm. 20524 20525@item -minline-sqrt-max-throughput 20526@opindex minline-sqrt-max-throughput 20527Generate code for inline square roots 20528using the maximum throughput algorithm. 20529 20530@item -mno-inline-sqrt 20531@opindex mno-inline-sqrt 20532Do not generate inline code for @code{sqrt}. 20533 20534@item -mfused-madd 20535@itemx -mno-fused-madd 20536@opindex mfused-madd 20537@opindex mno-fused-madd 20538Do (don't) generate code that uses the fused multiply/add or multiply/subtract 20539instructions. The default is to use these instructions. 20540 20541@item -mno-dwarf2-asm 20542@itemx -mdwarf2-asm 20543@opindex mno-dwarf2-asm 20544@opindex mdwarf2-asm 20545Don't (or do) generate assembler code for the DWARF line number debugging 20546info. This may be useful when not using the GNU assembler. 20547 20548@item -mearly-stop-bits 20549@itemx -mno-early-stop-bits 20550@opindex mearly-stop-bits 20551@opindex mno-early-stop-bits 20552Allow stop bits to be placed earlier than immediately preceding the 20553instruction that triggered the stop bit. This can improve instruction 20554scheduling, but does not always do so. 20555 20556@item -mfixed-range=@var{register-range} 20557@opindex mfixed-range 20558Generate code treating the given register range as fixed registers. 20559A fixed register is one that the register allocator cannot use. This is 20560useful when compiling kernel code. A register range is specified as 20561two registers separated by a dash. Multiple register ranges can be 20562specified separated by a comma. 20563 20564@item -mtls-size=@var{tls-size} 20565@opindex mtls-size 20566Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 2056764. 20568 20569@item -mtune=@var{cpu-type} 20570@opindex mtune 20571Tune the instruction scheduling for a particular CPU, Valid values are 20572@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 20573and @samp{mckinley}. 20574 20575@item -milp32 20576@itemx -mlp64 20577@opindex milp32 20578@opindex mlp64 20579Generate code for a 32-bit or 64-bit environment. 20580The 32-bit environment sets int, long and pointer to 32 bits. 20581The 64-bit environment sets int to 32 bits and long and pointer 20582to 64 bits. These are HP-UX specific flags. 20583 20584@item -mno-sched-br-data-spec 20585@itemx -msched-br-data-spec 20586@opindex mno-sched-br-data-spec 20587@opindex msched-br-data-spec 20588(Dis/En)able data speculative scheduling before reload. 20589This results in generation of @code{ld.a} instructions and 20590the corresponding check instructions (@code{ld.c} / @code{chk.a}). 20591The default setting is disabled. 20592 20593@item -msched-ar-data-spec 20594@itemx -mno-sched-ar-data-spec 20595@opindex msched-ar-data-spec 20596@opindex mno-sched-ar-data-spec 20597(En/Dis)able data speculative scheduling after reload. 20598This results in generation of @code{ld.a} instructions and 20599the corresponding check instructions (@code{ld.c} / @code{chk.a}). 20600The default setting is enabled. 20601 20602@item -mno-sched-control-spec 20603@itemx -msched-control-spec 20604@opindex mno-sched-control-spec 20605@opindex msched-control-spec 20606(Dis/En)able control speculative scheduling. This feature is 20607available only during region scheduling (i.e.@: before reload). 20608This results in generation of the @code{ld.s} instructions and 20609the corresponding check instructions @code{chk.s}. 20610The default setting is disabled. 20611 20612@item -msched-br-in-data-spec 20613@itemx -mno-sched-br-in-data-spec 20614@opindex msched-br-in-data-spec 20615@opindex mno-sched-br-in-data-spec 20616(En/Dis)able speculative scheduling of the instructions that 20617are dependent on the data speculative loads before reload. 20618This is effective only with @option{-msched-br-data-spec} enabled. 20619The default setting is enabled. 20620 20621@item -msched-ar-in-data-spec 20622@itemx -mno-sched-ar-in-data-spec 20623@opindex msched-ar-in-data-spec 20624@opindex mno-sched-ar-in-data-spec 20625(En/Dis)able speculative scheduling of the instructions that 20626are dependent on the data speculative loads after reload. 20627This is effective only with @option{-msched-ar-data-spec} enabled. 20628The default setting is enabled. 20629 20630@item -msched-in-control-spec 20631@itemx -mno-sched-in-control-spec 20632@opindex msched-in-control-spec 20633@opindex mno-sched-in-control-spec 20634(En/Dis)able speculative scheduling of the instructions that 20635are dependent on the control speculative loads. 20636This is effective only with @option{-msched-control-spec} enabled. 20637The default setting is enabled. 20638 20639@item -mno-sched-prefer-non-data-spec-insns 20640@itemx -msched-prefer-non-data-spec-insns 20641@opindex mno-sched-prefer-non-data-spec-insns 20642@opindex msched-prefer-non-data-spec-insns 20643If enabled, data-speculative instructions are chosen for schedule 20644only if there are no other choices at the moment. This makes 20645the use of the data speculation much more conservative. 20646The default setting is disabled. 20647 20648@item -mno-sched-prefer-non-control-spec-insns 20649@itemx -msched-prefer-non-control-spec-insns 20650@opindex mno-sched-prefer-non-control-spec-insns 20651@opindex msched-prefer-non-control-spec-insns 20652If enabled, control-speculative instructions are chosen for schedule 20653only if there are no other choices at the moment. This makes 20654the use of the control speculation much more conservative. 20655The default setting is disabled. 20656 20657@item -mno-sched-count-spec-in-critical-path 20658@itemx -msched-count-spec-in-critical-path 20659@opindex mno-sched-count-spec-in-critical-path 20660@opindex msched-count-spec-in-critical-path 20661If enabled, speculative dependencies are considered during 20662computation of the instructions priorities. This makes the use of the 20663speculation a bit more conservative. 20664The default setting is disabled. 20665 20666@item -msched-spec-ldc 20667@opindex msched-spec-ldc 20668Use a simple data speculation check. This option is on by default. 20669 20670@item -msched-control-spec-ldc 20671@opindex msched-spec-ldc 20672Use a simple check for control speculation. This option is on by default. 20673 20674@item -msched-stop-bits-after-every-cycle 20675@opindex msched-stop-bits-after-every-cycle 20676Place a stop bit after every cycle when scheduling. This option is on 20677by default. 20678 20679@item -msched-fp-mem-deps-zero-cost 20680@opindex msched-fp-mem-deps-zero-cost 20681Assume that floating-point stores and loads are not likely to cause a conflict 20682when placed into the same instruction group. This option is disabled by 20683default. 20684 20685@item -msel-sched-dont-check-control-spec 20686@opindex msel-sched-dont-check-control-spec 20687Generate checks for control speculation in selective scheduling. 20688This flag is disabled by default. 20689 20690@item -msched-max-memory-insns=@var{max-insns} 20691@opindex msched-max-memory-insns 20692Limit on the number of memory insns per instruction group, giving lower 20693priority to subsequent memory insns attempting to schedule in the same 20694instruction group. Frequently useful to prevent cache bank conflicts. 20695The default value is 1. 20696 20697@item -msched-max-memory-insns-hard-limit 20698@opindex msched-max-memory-insns-hard-limit 20699Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 20700disallowing more than that number in an instruction group. 20701Otherwise, the limit is ``soft'', meaning that non-memory operations 20702are preferred when the limit is reached, but memory operations may still 20703be scheduled. 20704 20705@end table 20706 20707@node LM32 Options 20708@subsection LM32 Options 20709@cindex LM32 options 20710 20711These @option{-m} options are defined for the LatticeMico32 architecture: 20712 20713@table @gcctabopt 20714@item -mbarrel-shift-enabled 20715@opindex mbarrel-shift-enabled 20716Enable barrel-shift instructions. 20717 20718@item -mdivide-enabled 20719@opindex mdivide-enabled 20720Enable divide and modulus instructions. 20721 20722@item -mmultiply-enabled 20723@opindex multiply-enabled 20724Enable multiply instructions. 20725 20726@item -msign-extend-enabled 20727@opindex msign-extend-enabled 20728Enable sign extend instructions. 20729 20730@item -muser-enabled 20731@opindex muser-enabled 20732Enable user-defined instructions. 20733 20734@end table 20735 20736@node M32C Options 20737@subsection M32C Options 20738@cindex M32C options 20739 20740@table @gcctabopt 20741@item -mcpu=@var{name} 20742@opindex mcpu= 20743Select the CPU for which code is generated. @var{name} may be one of 20744@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 20745/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 20746the M32C/80 series. 20747 20748@item -msim 20749@opindex msim 20750Specifies that the program will be run on the simulator. This causes 20751an alternate runtime library to be linked in which supports, for 20752example, file I/O@. You must not use this option when generating 20753programs that will run on real hardware; you must provide your own 20754runtime library for whatever I/O functions are needed. 20755 20756@item -memregs=@var{number} 20757@opindex memregs= 20758Specifies the number of memory-based pseudo-registers GCC uses 20759during code generation. These pseudo-registers are used like real 20760registers, so there is a tradeoff between GCC's ability to fit the 20761code into available registers, and the performance penalty of using 20762memory instead of registers. Note that all modules in a program must 20763be compiled with the same value for this option. Because of that, you 20764must not use this option with GCC's default runtime libraries. 20765 20766@end table 20767 20768@node M32R/D Options 20769@subsection M32R/D Options 20770@cindex M32R/D options 20771 20772These @option{-m} options are defined for Renesas M32R/D architectures: 20773 20774@table @gcctabopt 20775@item -m32r2 20776@opindex m32r2 20777Generate code for the M32R/2@. 20778 20779@item -m32rx 20780@opindex m32rx 20781Generate code for the M32R/X@. 20782 20783@item -m32r 20784@opindex m32r 20785Generate code for the M32R@. This is the default. 20786 20787@item -mmodel=small 20788@opindex mmodel=small 20789Assume all objects live in the lower 16MB of memory (so that their addresses 20790can be loaded with the @code{ld24} instruction), and assume all subroutines 20791are reachable with the @code{bl} instruction. 20792This is the default. 20793 20794The addressability of a particular object can be set with the 20795@code{model} attribute. 20796 20797@item -mmodel=medium 20798@opindex mmodel=medium 20799Assume objects may be anywhere in the 32-bit address space (the compiler 20800generates @code{seth/add3} instructions to load their addresses), and 20801assume all subroutines are reachable with the @code{bl} instruction. 20802 20803@item -mmodel=large 20804@opindex mmodel=large 20805Assume objects may be anywhere in the 32-bit address space (the compiler 20806generates @code{seth/add3} instructions to load their addresses), and 20807assume subroutines may not be reachable with the @code{bl} instruction 20808(the compiler generates the much slower @code{seth/add3/jl} 20809instruction sequence). 20810 20811@item -msdata=none 20812@opindex msdata=none 20813Disable use of the small data area. Variables are put into 20814one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 20815@code{section} attribute has been specified). 20816This is the default. 20817 20818The small data area consists of sections @code{.sdata} and @code{.sbss}. 20819Objects may be explicitly put in the small data area with the 20820@code{section} attribute using one of these sections. 20821 20822@item -msdata=sdata 20823@opindex msdata=sdata 20824Put small global and static data in the small data area, but do not 20825generate special code to reference them. 20826 20827@item -msdata=use 20828@opindex msdata=use 20829Put small global and static data in the small data area, and generate 20830special instructions to reference them. 20831 20832@item -G @var{num} 20833@opindex G 20834@cindex smaller data references 20835Put global and static objects less than or equal to @var{num} bytes 20836into the small data or BSS sections instead of the normal data or BSS 20837sections. The default value of @var{num} is 8. 20838The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 20839for this option to have any effect. 20840 20841All modules should be compiled with the same @option{-G @var{num}} value. 20842Compiling with different values of @var{num} may or may not work; if it 20843doesn't the linker gives an error message---incorrect code is not 20844generated. 20845 20846@item -mdebug 20847@opindex mdebug 20848Makes the M32R-specific code in the compiler display some statistics 20849that might help in debugging programs. 20850 20851@item -malign-loops 20852@opindex malign-loops 20853Align all loops to a 32-byte boundary. 20854 20855@item -mno-align-loops 20856@opindex mno-align-loops 20857Do not enforce a 32-byte alignment for loops. This is the default. 20858 20859@item -missue-rate=@var{number} 20860@opindex missue-rate=@var{number} 20861Issue @var{number} instructions per cycle. @var{number} can only be 1 20862or 2. 20863 20864@item -mbranch-cost=@var{number} 20865@opindex mbranch-cost=@var{number} 20866@var{number} can only be 1 or 2. If it is 1 then branches are 20867preferred over conditional code, if it is 2, then the opposite applies. 20868 20869@item -mflush-trap=@var{number} 20870@opindex mflush-trap=@var{number} 20871Specifies the trap number to use to flush the cache. The default is 2087212. Valid numbers are between 0 and 15 inclusive. 20873 20874@item -mno-flush-trap 20875@opindex mno-flush-trap 20876Specifies that the cache cannot be flushed by using a trap. 20877 20878@item -mflush-func=@var{name} 20879@opindex mflush-func=@var{name} 20880Specifies the name of the operating system function to call to flush 20881the cache. The default is @samp{_flush_cache}, but a function call 20882is only used if a trap is not available. 20883 20884@item -mno-flush-func 20885@opindex mno-flush-func 20886Indicates that there is no OS function for flushing the cache. 20887 20888@end table 20889 20890@node M680x0 Options 20891@subsection M680x0 Options 20892@cindex M680x0 options 20893 20894These are the @samp{-m} options defined for M680x0 and ColdFire processors. 20895The default settings depend on which architecture was selected when 20896the compiler was configured; the defaults for the most common choices 20897are given below. 20898 20899@table @gcctabopt 20900@item -march=@var{arch} 20901@opindex march 20902Generate code for a specific M680x0 or ColdFire instruction set 20903architecture. Permissible values of @var{arch} for M680x0 20904architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 20905@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 20906architectures are selected according to Freescale's ISA classification 20907and the permissible values are: @samp{isaa}, @samp{isaaplus}, 20908@samp{isab} and @samp{isac}. 20909 20910GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 20911code for a ColdFire target. The @var{arch} in this macro is one of the 20912@option{-march} arguments given above. 20913 20914When used together, @option{-march} and @option{-mtune} select code 20915that runs on a family of similar processors but that is optimized 20916for a particular microarchitecture. 20917 20918@item -mcpu=@var{cpu} 20919@opindex mcpu 20920Generate code for a specific M680x0 or ColdFire processor. 20921The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 20922@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 20923and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 20924below, which also classifies the CPUs into families: 20925 20926@multitable @columnfractions 0.20 0.80 20927@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 20928@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} 20929@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 20930@item @samp{5206e} @tab @samp{5206e} 20931@item @samp{5208} @tab @samp{5207} @samp{5208} 20932@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 20933@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 20934@item @samp{5216} @tab @samp{5214} @samp{5216} 20935@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 20936@item @samp{5225} @tab @samp{5224} @samp{5225} 20937@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 20938@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 20939@item @samp{5249} @tab @samp{5249} 20940@item @samp{5250} @tab @samp{5250} 20941@item @samp{5271} @tab @samp{5270} @samp{5271} 20942@item @samp{5272} @tab @samp{5272} 20943@item @samp{5275} @tab @samp{5274} @samp{5275} 20944@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 20945@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 20946@item @samp{5307} @tab @samp{5307} 20947@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 20948@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 20949@item @samp{5407} @tab @samp{5407} 20950@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} 20951@end multitable 20952 20953@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 20954@var{arch} is compatible with @var{cpu}. Other combinations of 20955@option{-mcpu} and @option{-march} are rejected. 20956 20957GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 20958@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 20959where the value of @var{family} is given by the table above. 20960 20961@item -mtune=@var{tune} 20962@opindex mtune 20963Tune the code for a particular microarchitecture within the 20964constraints set by @option{-march} and @option{-mcpu}. 20965The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 20966@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 20967and @samp{cpu32}. The ColdFire microarchitectures 20968are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 20969 20970You can also use @option{-mtune=68020-40} for code that needs 20971to run relatively well on 68020, 68030 and 68040 targets. 20972@option{-mtune=68020-60} is similar but includes 68060 targets 20973as well. These two options select the same tuning decisions as 20974@option{-m68020-40} and @option{-m68020-60} respectively. 20975 20976GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 20977when tuning for 680x0 architecture @var{arch}. It also defines 20978@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 20979option is used. If GCC is tuning for a range of architectures, 20980as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 20981it defines the macros for every architecture in the range. 20982 20983GCC also defines the macro @code{__m@var{uarch}__} when tuning for 20984ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 20985of the arguments given above. 20986 20987@item -m68000 20988@itemx -mc68000 20989@opindex m68000 20990@opindex mc68000 20991Generate output for a 68000. This is the default 20992when the compiler is configured for 68000-based systems. 20993It is equivalent to @option{-march=68000}. 20994 20995Use this option for microcontrollers with a 68000 or EC000 core, 20996including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 20997 20998@item -m68010 20999@opindex m68010 21000Generate output for a 68010. This is the default 21001when the compiler is configured for 68010-based systems. 21002It is equivalent to @option{-march=68010}. 21003 21004@item -m68020 21005@itemx -mc68020 21006@opindex m68020 21007@opindex mc68020 21008Generate output for a 68020. This is the default 21009when the compiler is configured for 68020-based systems. 21010It is equivalent to @option{-march=68020}. 21011 21012@item -m68030 21013@opindex m68030 21014Generate output for a 68030. This is the default when the compiler is 21015configured for 68030-based systems. It is equivalent to 21016@option{-march=68030}. 21017 21018@item -m68040 21019@opindex m68040 21020Generate output for a 68040. This is the default when the compiler is 21021configured for 68040-based systems. It is equivalent to 21022@option{-march=68040}. 21023 21024This option inhibits the use of 68881/68882 instructions that have to be 21025emulated by software on the 68040. Use this option if your 68040 does not 21026have code to emulate those instructions. 21027 21028@item -m68060 21029@opindex m68060 21030Generate output for a 68060. This is the default when the compiler is 21031configured for 68060-based systems. It is equivalent to 21032@option{-march=68060}. 21033 21034This option inhibits the use of 68020 and 68881/68882 instructions that 21035have to be emulated by software on the 68060. Use this option if your 68060 21036does not have code to emulate those instructions. 21037 21038@item -mcpu32 21039@opindex mcpu32 21040Generate output for a CPU32. This is the default 21041when the compiler is configured for CPU32-based systems. 21042It is equivalent to @option{-march=cpu32}. 21043 21044Use this option for microcontrollers with a 21045CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 2104668336, 68340, 68341, 68349 and 68360. 21047 21048@item -m5200 21049@opindex m5200 21050Generate output for a 520X ColdFire CPU@. This is the default 21051when the compiler is configured for 520X-based systems. 21052It is equivalent to @option{-mcpu=5206}, and is now deprecated 21053in favor of that option. 21054 21055Use this option for microcontroller with a 5200 core, including 21056the MCF5202, MCF5203, MCF5204 and MCF5206. 21057 21058@item -m5206e 21059@opindex m5206e 21060Generate output for a 5206e ColdFire CPU@. The option is now 21061deprecated in favor of the equivalent @option{-mcpu=5206e}. 21062 21063@item -m528x 21064@opindex m528x 21065Generate output for a member of the ColdFire 528X family. 21066The option is now deprecated in favor of the equivalent 21067@option{-mcpu=528x}. 21068 21069@item -m5307 21070@opindex m5307 21071Generate output for a ColdFire 5307 CPU@. The option is now deprecated 21072in favor of the equivalent @option{-mcpu=5307}. 21073 21074@item -m5407 21075@opindex m5407 21076Generate output for a ColdFire 5407 CPU@. The option is now deprecated 21077in favor of the equivalent @option{-mcpu=5407}. 21078 21079@item -mcfv4e 21080@opindex mcfv4e 21081Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 21082This includes use of hardware floating-point instructions. 21083The option is equivalent to @option{-mcpu=547x}, and is now 21084deprecated in favor of that option. 21085 21086@item -m68020-40 21087@opindex m68020-40 21088Generate output for a 68040, without using any of the new instructions. 21089This results in code that can run relatively efficiently on either a 2109068020/68881 or a 68030 or a 68040. The generated code does use the 2109168881 instructions that are emulated on the 68040. 21092 21093The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 21094 21095@item -m68020-60 21096@opindex m68020-60 21097Generate output for a 68060, without using any of the new instructions. 21098This results in code that can run relatively efficiently on either a 2109968020/68881 or a 68030 or a 68040. The generated code does use the 2110068881 instructions that are emulated on the 68060. 21101 21102The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 21103 21104@item -mhard-float 21105@itemx -m68881 21106@opindex mhard-float 21107@opindex m68881 21108Generate floating-point instructions. This is the default for 68020 21109and above, and for ColdFire devices that have an FPU@. It defines the 21110macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 21111on ColdFire targets. 21112 21113@item -msoft-float 21114@opindex msoft-float 21115Do not generate floating-point instructions; use library calls instead. 21116This is the default for 68000, 68010, and 68832 targets. It is also 21117the default for ColdFire devices that have no FPU. 21118 21119@item -mdiv 21120@itemx -mno-div 21121@opindex mdiv 21122@opindex mno-div 21123Generate (do not generate) ColdFire hardware divide and remainder 21124instructions. If @option{-march} is used without @option{-mcpu}, 21125the default is ``on'' for ColdFire architectures and ``off'' for M680x0 21126architectures. Otherwise, the default is taken from the target CPU 21127(either the default CPU, or the one specified by @option{-mcpu}). For 21128example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 21129@option{-mcpu=5206e}. 21130 21131GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 21132 21133@item -mshort 21134@opindex mshort 21135Consider type @code{int} to be 16 bits wide, like @code{short int}. 21136Additionally, parameters passed on the stack are also aligned to a 2113716-bit boundary even on targets whose API mandates promotion to 32-bit. 21138 21139@item -mno-short 21140@opindex mno-short 21141Do not consider type @code{int} to be 16 bits wide. This is the default. 21142 21143@item -mnobitfield 21144@itemx -mno-bitfield 21145@opindex mnobitfield 21146@opindex mno-bitfield 21147Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 21148and @option{-m5200} options imply @w{@option{-mnobitfield}}. 21149 21150@item -mbitfield 21151@opindex mbitfield 21152Do use the bit-field instructions. The @option{-m68020} option implies 21153@option{-mbitfield}. This is the default if you use a configuration 21154designed for a 68020. 21155 21156@item -mrtd 21157@opindex mrtd 21158Use a different function-calling convention, in which functions 21159that take a fixed number of arguments return with the @code{rtd} 21160instruction, which pops their arguments while returning. This 21161saves one instruction in the caller since there is no need to pop 21162the arguments there. 21163 21164This calling convention is incompatible with the one normally 21165used on Unix, so you cannot use it if you need to call libraries 21166compiled with the Unix compiler. 21167 21168Also, you must provide function prototypes for all functions that 21169take variable numbers of arguments (including @code{printf}); 21170otherwise incorrect code is generated for calls to those 21171functions. 21172 21173In addition, seriously incorrect code results if you call a 21174function with too many arguments. (Normally, extra arguments are 21175harmlessly ignored.) 21176 21177The @code{rtd} instruction is supported by the 68010, 68020, 68030, 2117868040, 68060 and CPU32 processors, but not by the 68000 or 5200. 21179 21180The default is @option{-mno-rtd}. 21181 21182@item -malign-int 21183@itemx -mno-align-int 21184@opindex malign-int 21185@opindex mno-align-int 21186Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 21187@code{float}, @code{double}, and @code{long double} variables on a 32-bit 21188boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 21189Aligning variables on 32-bit boundaries produces code that runs somewhat 21190faster on processors with 32-bit busses at the expense of more memory. 21191 21192@strong{Warning:} if you use the @option{-malign-int} switch, GCC 21193aligns structures containing the above types differently than 21194most published application binary interface specifications for the m68k. 21195 21196@item -mpcrel 21197@opindex mpcrel 21198Use the pc-relative addressing mode of the 68000 directly, instead of 21199using a global offset table. At present, this option implies @option{-fpic}, 21200allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 21201not presently supported with @option{-mpcrel}, though this could be supported for 2120268020 and higher processors. 21203 21204@item -mno-strict-align 21205@itemx -mstrict-align 21206@opindex mno-strict-align 21207@opindex mstrict-align 21208Do not (do) assume that unaligned memory references are handled by 21209the system. 21210 21211@item -msep-data 21212Generate code that allows the data segment to be located in a different 21213area of memory from the text segment. This allows for execute-in-place in 21214an environment without virtual memory management. This option implies 21215@option{-fPIC}. 21216 21217@item -mno-sep-data 21218Generate code that assumes that the data segment follows the text segment. 21219This is the default. 21220 21221@item -mid-shared-library 21222Generate code that supports shared libraries via the library ID method. 21223This allows for execute-in-place and shared libraries in an environment 21224without virtual memory management. This option implies @option{-fPIC}. 21225 21226@item -mno-id-shared-library 21227Generate code that doesn't assume ID-based shared libraries are being used. 21228This is the default. 21229 21230@item -mshared-library-id=n 21231Specifies the identification number of the ID-based shared library being 21232compiled. Specifying a value of 0 generates more compact code; specifying 21233other values forces the allocation of that number to the current 21234library, but is no more space- or time-efficient than omitting this option. 21235 21236@item -mxgot 21237@itemx -mno-xgot 21238@opindex mxgot 21239@opindex mno-xgot 21240When generating position-independent code for ColdFire, generate code 21241that works if the GOT has more than 8192 entries. This code is 21242larger and slower than code generated without this option. On M680x0 21243processors, this option is not needed; @option{-fPIC} suffices. 21244 21245GCC normally uses a single instruction to load values from the GOT@. 21246While this is relatively efficient, it only works if the GOT 21247is smaller than about 64k. Anything larger causes the linker 21248to report an error such as: 21249 21250@cindex relocation truncated to fit (ColdFire) 21251@smallexample 21252relocation truncated to fit: R_68K_GOT16O foobar 21253@end smallexample 21254 21255If this happens, you should recompile your code with @option{-mxgot}. 21256It should then work with very large GOTs. However, code generated with 21257@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 21258the value of a global symbol. 21259 21260Note that some linkers, including newer versions of the GNU linker, 21261can create multiple GOTs and sort GOT entries. If you have such a linker, 21262you should only need to use @option{-mxgot} when compiling a single 21263object file that accesses more than 8192 GOT entries. Very few do. 21264 21265These options have no effect unless GCC is generating 21266position-independent code. 21267 21268@item -mlong-jump-table-offsets 21269@opindex mlong-jump-table-offsets 21270Use 32-bit offsets in @code{switch} tables. The default is to use 2127116-bit offsets. 21272 21273@end table 21274 21275@node MCore Options 21276@subsection MCore Options 21277@cindex MCore options 21278 21279These are the @samp{-m} options defined for the Motorola M*Core 21280processors. 21281 21282@table @gcctabopt 21283 21284@item -mhardlit 21285@itemx -mno-hardlit 21286@opindex mhardlit 21287@opindex mno-hardlit 21288Inline constants into the code stream if it can be done in two 21289instructions or less. 21290 21291@item -mdiv 21292@itemx -mno-div 21293@opindex mdiv 21294@opindex mno-div 21295Use the divide instruction. (Enabled by default). 21296 21297@item -mrelax-immediate 21298@itemx -mno-relax-immediate 21299@opindex mrelax-immediate 21300@opindex mno-relax-immediate 21301Allow arbitrary-sized immediates in bit operations. 21302 21303@item -mwide-bitfields 21304@itemx -mno-wide-bitfields 21305@opindex mwide-bitfields 21306@opindex mno-wide-bitfields 21307Always treat bit-fields as @code{int}-sized. 21308 21309@item -m4byte-functions 21310@itemx -mno-4byte-functions 21311@opindex m4byte-functions 21312@opindex mno-4byte-functions 21313Force all functions to be aligned to a 4-byte boundary. 21314 21315@item -mcallgraph-data 21316@itemx -mno-callgraph-data 21317@opindex mcallgraph-data 21318@opindex mno-callgraph-data 21319Emit callgraph information. 21320 21321@item -mslow-bytes 21322@itemx -mno-slow-bytes 21323@opindex mslow-bytes 21324@opindex mno-slow-bytes 21325Prefer word access when reading byte quantities. 21326 21327@item -mlittle-endian 21328@itemx -mbig-endian 21329@opindex mlittle-endian 21330@opindex mbig-endian 21331Generate code for a little-endian target. 21332 21333@item -m210 21334@itemx -m340 21335@opindex m210 21336@opindex m340 21337Generate code for the 210 processor. 21338 21339@item -mno-lsim 21340@opindex mno-lsim 21341Assume that runtime support has been provided and so omit the 21342simulator library (@file{libsim.a)} from the linker command line. 21343 21344@item -mstack-increment=@var{size} 21345@opindex mstack-increment 21346Set the maximum amount for a single stack increment operation. Large 21347values can increase the speed of programs that contain functions 21348that need a large amount of stack space, but they can also trigger a 21349segmentation fault if the stack is extended too much. The default 21350value is 0x1000. 21351 21352@end table 21353 21354@node MeP Options 21355@subsection MeP Options 21356@cindex MeP options 21357 21358@table @gcctabopt 21359 21360@item -mabsdiff 21361@opindex mabsdiff 21362Enables the @code{abs} instruction, which is the absolute difference 21363between two registers. 21364 21365@item -mall-opts 21366@opindex mall-opts 21367Enables all the optional instructions---average, multiply, divide, bit 21368operations, leading zero, absolute difference, min/max, clip, and 21369saturation. 21370 21371 21372@item -maverage 21373@opindex maverage 21374Enables the @code{ave} instruction, which computes the average of two 21375registers. 21376 21377@item -mbased=@var{n} 21378@opindex mbased= 21379Variables of size @var{n} bytes or smaller are placed in the 21380@code{.based} section by default. Based variables use the @code{$tp} 21381register as a base register, and there is a 128-byte limit to the 21382@code{.based} section. 21383 21384@item -mbitops 21385@opindex mbitops 21386Enables the bit operation instructions---bit test (@code{btstm}), set 21387(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 21388test-and-set (@code{tas}). 21389 21390@item -mc=@var{name} 21391@opindex mc= 21392Selects which section constant data is placed in. @var{name} may 21393be @samp{tiny}, @samp{near}, or @samp{far}. 21394 21395@item -mclip 21396@opindex mclip 21397Enables the @code{clip} instruction. Note that @option{-mclip} is not 21398useful unless you also provide @option{-mminmax}. 21399 21400@item -mconfig=@var{name} 21401@opindex mconfig= 21402Selects one of the built-in core configurations. Each MeP chip has 21403one or more modules in it; each module has a core CPU and a variety of 21404coprocessors, optional instructions, and peripherals. The 21405@code{MeP-Integrator} tool, not part of GCC, provides these 21406configurations through this option; using this option is the same as 21407using all the corresponding command-line options. The default 21408configuration is @samp{default}. 21409 21410@item -mcop 21411@opindex mcop 21412Enables the coprocessor instructions. By default, this is a 32-bit 21413coprocessor. Note that the coprocessor is normally enabled via the 21414@option{-mconfig=} option. 21415 21416@item -mcop32 21417@opindex mcop32 21418Enables the 32-bit coprocessor's instructions. 21419 21420@item -mcop64 21421@opindex mcop64 21422Enables the 64-bit coprocessor's instructions. 21423 21424@item -mivc2 21425@opindex mivc2 21426Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 21427 21428@item -mdc 21429@opindex mdc 21430Causes constant variables to be placed in the @code{.near} section. 21431 21432@item -mdiv 21433@opindex mdiv 21434Enables the @code{div} and @code{divu} instructions. 21435 21436@item -meb 21437@opindex meb 21438Generate big-endian code. 21439 21440@item -mel 21441@opindex mel 21442Generate little-endian code. 21443 21444@item -mio-volatile 21445@opindex mio-volatile 21446Tells the compiler that any variable marked with the @code{io} 21447attribute is to be considered volatile. 21448 21449@item -ml 21450@opindex ml 21451Causes variables to be assigned to the @code{.far} section by default. 21452 21453@item -mleadz 21454@opindex mleadz 21455Enables the @code{leadz} (leading zero) instruction. 21456 21457@item -mm 21458@opindex mm 21459Causes variables to be assigned to the @code{.near} section by default. 21460 21461@item -mminmax 21462@opindex mminmax 21463Enables the @code{min} and @code{max} instructions. 21464 21465@item -mmult 21466@opindex mmult 21467Enables the multiplication and multiply-accumulate instructions. 21468 21469@item -mno-opts 21470@opindex mno-opts 21471Disables all the optional instructions enabled by @option{-mall-opts}. 21472 21473@item -mrepeat 21474@opindex mrepeat 21475Enables the @code{repeat} and @code{erepeat} instructions, used for 21476low-overhead looping. 21477 21478@item -ms 21479@opindex ms 21480Causes all variables to default to the @code{.tiny} section. Note 21481that there is a 65536-byte limit to this section. Accesses to these 21482variables use the @code{%gp} base register. 21483 21484@item -msatur 21485@opindex msatur 21486Enables the saturation instructions. Note that the compiler does not 21487currently generate these itself, but this option is included for 21488compatibility with other tools, like @code{as}. 21489 21490@item -msdram 21491@opindex msdram 21492Link the SDRAM-based runtime instead of the default ROM-based runtime. 21493 21494@item -msim 21495@opindex msim 21496Link the simulator run-time libraries. 21497 21498@item -msimnovec 21499@opindex msimnovec 21500Link the simulator runtime libraries, excluding built-in support 21501for reset and exception vectors and tables. 21502 21503@item -mtf 21504@opindex mtf 21505Causes all functions to default to the @code{.far} section. Without 21506this option, functions default to the @code{.near} section. 21507 21508@item -mtiny=@var{n} 21509@opindex mtiny= 21510Variables that are @var{n} bytes or smaller are allocated to the 21511@code{.tiny} section. These variables use the @code{$gp} base 21512register. The default for this option is 4, but note that there's a 2151365536-byte limit to the @code{.tiny} section. 21514 21515@end table 21516 21517@node MicroBlaze Options 21518@subsection MicroBlaze Options 21519@cindex MicroBlaze Options 21520 21521@table @gcctabopt 21522 21523@item -msoft-float 21524@opindex msoft-float 21525Use software emulation for floating point (default). 21526 21527@item -mhard-float 21528@opindex mhard-float 21529Use hardware floating-point instructions. 21530 21531@item -mmemcpy 21532@opindex mmemcpy 21533Do not optimize block moves, use @code{memcpy}. 21534 21535@item -mno-clearbss 21536@opindex mno-clearbss 21537This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 21538 21539@item -mcpu=@var{cpu-type} 21540@opindex mcpu= 21541Use features of, and schedule code for, the given CPU. 21542Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 21543where @var{X} is a major version, @var{YY} is the minor version, and 21544@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 21545@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}. 21546 21547@item -mxl-soft-mul 21548@opindex mxl-soft-mul 21549Use software multiply emulation (default). 21550 21551@item -mxl-soft-div 21552@opindex mxl-soft-div 21553Use software emulation for divides (default). 21554 21555@item -mxl-barrel-shift 21556@opindex mxl-barrel-shift 21557Use the hardware barrel shifter. 21558 21559@item -mxl-pattern-compare 21560@opindex mxl-pattern-compare 21561Use pattern compare instructions. 21562 21563@item -msmall-divides 21564@opindex msmall-divides 21565Use table lookup optimization for small signed integer divisions. 21566 21567@item -mxl-stack-check 21568@opindex mxl-stack-check 21569This option is deprecated. Use @option{-fstack-check} instead. 21570 21571@item -mxl-gp-opt 21572@opindex mxl-gp-opt 21573Use GP-relative @code{.sdata}/@code{.sbss} sections. 21574 21575@item -mxl-multiply-high 21576@opindex mxl-multiply-high 21577Use multiply high instructions for high part of 32x32 multiply. 21578 21579@item -mxl-float-convert 21580@opindex mxl-float-convert 21581Use hardware floating-point conversion instructions. 21582 21583@item -mxl-float-sqrt 21584@opindex mxl-float-sqrt 21585Use hardware floating-point square root instruction. 21586 21587@item -mbig-endian 21588@opindex mbig-endian 21589Generate code for a big-endian target. 21590 21591@item -mlittle-endian 21592@opindex mlittle-endian 21593Generate code for a little-endian target. 21594 21595@item -mxl-reorder 21596@opindex mxl-reorder 21597Use reorder instructions (swap and byte reversed load/store). 21598 21599@item -mxl-mode-@var{app-model} 21600Select application model @var{app-model}. Valid models are 21601@table @samp 21602@item executable 21603normal executable (default), uses startup code @file{crt0.o}. 21604 21605@item -mpic-data-is-text-relative 21606@opindex mpic-data-is-text-relative 21607Assume that the displacement between the text and data segments is fixed 21608at static link time. This allows data to be referenced by offset from start of 21609text address instead of GOT since PC-relative addressing is not supported. 21610 21611@item xmdstub 21612for use with Xilinx Microprocessor Debugger (XMD) based 21613software intrusive debug agent called xmdstub. This uses startup file 21614@file{crt1.o} and sets the start address of the program to 0x800. 21615 21616@item bootstrap 21617for applications that are loaded using a bootloader. 21618This model uses startup file @file{crt2.o} which does not contain a processor 21619reset vector handler. This is suitable for transferring control on a 21620processor reset to the bootloader rather than the application. 21621 21622@item novectors 21623for applications that do not require any of the 21624MicroBlaze vectors. This option may be useful for applications running 21625within a monitoring application. This model uses @file{crt3.o} as a startup file. 21626@end table 21627 21628Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 21629@option{-mxl-mode-@var{app-model}}. 21630 21631@end table 21632 21633@node MIPS Options 21634@subsection MIPS Options 21635@cindex MIPS options 21636 21637@table @gcctabopt 21638 21639@item -EB 21640@opindex EB 21641Generate big-endian code. 21642 21643@item -EL 21644@opindex EL 21645Generate little-endian code. This is the default for @samp{mips*el-*-*} 21646configurations. 21647 21648@item -march=@var{arch} 21649@opindex march 21650Generate code that runs on @var{arch}, which can be the name of a 21651generic MIPS ISA, or the name of a particular processor. 21652The ISA names are: 21653@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 21654@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 21655@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 21656@samp{mips64r5} and @samp{mips64r6}. 21657The processor names are: 21658@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 21659@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 21660@samp{5kc}, @samp{5kf}, 21661@samp{20kc}, 21662@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 21663@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 21664@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 21665@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 21666@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 21667@samp{i6400}, @samp{i6500}, 21668@samp{interaptiv}, 21669@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464}, 21670@samp{gs464e}, @samp{gs264e}, 21671@samp{m4k}, 21672@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 21673@samp{m5100}, @samp{m5101}, 21674@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 21675@samp{orion}, 21676@samp{p5600}, @samp{p6600}, 21677@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 21678@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900}, 21679@samp{r6000}, @samp{r8000}, 21680@samp{rm7000}, @samp{rm9000}, 21681@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 21682@samp{sb1}, 21683@samp{sr71000}, 21684@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 21685@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 21686@samp{xlr} and @samp{xlp}. 21687The special value @samp{from-abi} selects the 21688most compatible architecture for the selected ABI (that is, 21689@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 21690 21691The native Linux/GNU toolchain also supports the value @samp{native}, 21692which selects the best architecture option for the host processor. 21693@option{-march=native} has no effect if GCC does not recognize 21694the processor. 21695 21696In processor names, a final @samp{000} can be abbreviated as @samp{k} 21697(for example, @option{-march=r2k}). Prefixes are optional, and 21698@samp{vr} may be written @samp{r}. 21699 21700Names of the form @samp{@var{n}f2_1} refer to processors with 21701FPUs clocked at half the rate of the core, names of the form 21702@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 21703rate as the core, and names of the form @samp{@var{n}f3_2} refer to 21704processors with FPUs clocked a ratio of 3:2 with respect to the core. 21705For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 21706for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 21707accepted as synonyms for @samp{@var{n}f1_1}. 21708 21709GCC defines two macros based on the value of this option. The first 21710is @code{_MIPS_ARCH}, which gives the name of target architecture, as 21711a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 21712where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 21713For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 21714to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 21715 21716Note that the @code{_MIPS_ARCH} macro uses the processor names given 21717above. In other words, it has the full prefix and does not 21718abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 21719the macro names the resolved architecture (either @code{"mips1"} or 21720@code{"mips3"}). It names the default architecture when no 21721@option{-march} option is given. 21722 21723@item -mtune=@var{arch} 21724@opindex mtune 21725Optimize for @var{arch}. Among other things, this option controls 21726the way instructions are scheduled, and the perceived cost of arithmetic 21727operations. The list of @var{arch} values is the same as for 21728@option{-march}. 21729 21730When this option is not used, GCC optimizes for the processor 21731specified by @option{-march}. By using @option{-march} and 21732@option{-mtune} together, it is possible to generate code that 21733runs on a family of processors, but optimize the code for one 21734particular member of that family. 21735 21736@option{-mtune} defines the macros @code{_MIPS_TUNE} and 21737@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 21738@option{-march} ones described above. 21739 21740@item -mips1 21741@opindex mips1 21742Equivalent to @option{-march=mips1}. 21743 21744@item -mips2 21745@opindex mips2 21746Equivalent to @option{-march=mips2}. 21747 21748@item -mips3 21749@opindex mips3 21750Equivalent to @option{-march=mips3}. 21751 21752@item -mips4 21753@opindex mips4 21754Equivalent to @option{-march=mips4}. 21755 21756@item -mips32 21757@opindex mips32 21758Equivalent to @option{-march=mips32}. 21759 21760@item -mips32r3 21761@opindex mips32r3 21762Equivalent to @option{-march=mips32r3}. 21763 21764@item -mips32r5 21765@opindex mips32r5 21766Equivalent to @option{-march=mips32r5}. 21767 21768@item -mips32r6 21769@opindex mips32r6 21770Equivalent to @option{-march=mips32r6}. 21771 21772@item -mips64 21773@opindex mips64 21774Equivalent to @option{-march=mips64}. 21775 21776@item -mips64r2 21777@opindex mips64r2 21778Equivalent to @option{-march=mips64r2}. 21779 21780@item -mips64r3 21781@opindex mips64r3 21782Equivalent to @option{-march=mips64r3}. 21783 21784@item -mips64r5 21785@opindex mips64r5 21786Equivalent to @option{-march=mips64r5}. 21787 21788@item -mips64r6 21789@opindex mips64r6 21790Equivalent to @option{-march=mips64r6}. 21791 21792@item -mips16 21793@itemx -mno-mips16 21794@opindex mips16 21795@opindex mno-mips16 21796Generate (do not generate) MIPS16 code. If GCC is targeting a 21797MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 21798 21799MIPS16 code generation can also be controlled on a per-function basis 21800by means of @code{mips16} and @code{nomips16} attributes. 21801@xref{Function Attributes}, for more information. 21802 21803@item -mflip-mips16 21804@opindex mflip-mips16 21805Generate MIPS16 code on alternating functions. This option is provided 21806for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 21807not intended for ordinary use in compiling user code. 21808 21809@item -minterlink-compressed 21810@itemx -mno-interlink-compressed 21811@opindex minterlink-compressed 21812@opindex mno-interlink-compressed 21813Require (do not require) that code using the standard (uncompressed) MIPS ISA 21814be link-compatible with MIPS16 and microMIPS code, and vice versa. 21815 21816For example, code using the standard ISA encoding cannot jump directly 21817to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 21818@option{-minterlink-compressed} therefore disables direct jumps unless GCC 21819knows that the target of the jump is not compressed. 21820 21821@item -minterlink-mips16 21822@itemx -mno-interlink-mips16 21823@opindex minterlink-mips16 21824@opindex mno-interlink-mips16 21825Aliases of @option{-minterlink-compressed} and 21826@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 21827and are retained for backwards compatibility. 21828 21829@item -mabi=32 21830@itemx -mabi=o64 21831@itemx -mabi=n32 21832@itemx -mabi=64 21833@itemx -mabi=eabi 21834@opindex mabi=32 21835@opindex mabi=o64 21836@opindex mabi=n32 21837@opindex mabi=64 21838@opindex mabi=eabi 21839Generate code for the given ABI@. 21840 21841Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 21842generates 64-bit code when you select a 64-bit architecture, but you 21843can use @option{-mgp32} to get 32-bit code instead. 21844 21845For information about the O64 ABI, see 21846@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 21847 21848GCC supports a variant of the o32 ABI in which floating-point registers 21849are 64 rather than 32 bits wide. You can select this combination with 21850@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 21851and @code{mfhc1} instructions and is therefore only supported for 21852MIPS32R2, MIPS32R3 and MIPS32R5 processors. 21853 21854The register assignments for arguments and return values remain the 21855same, but each scalar value is passed in a single 64-bit register 21856rather than a pair of 32-bit registers. For example, scalar 21857floating-point values are returned in @samp{$f0} only, not a 21858@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 21859remains the same in that the even-numbered double-precision registers 21860are saved. 21861 21862Two additional variants of the o32 ABI are supported to enable 21863a transition from 32-bit to 64-bit registers. These are FPXX 21864(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 21865The FPXX extension mandates that all code must execute correctly 21866when run using 32-bit or 64-bit registers. The code can be interlinked 21867with either FP32 or FP64, but not both. 21868The FP64A extension is similar to the FP64 extension but forbids the 21869use of odd-numbered single-precision registers. This can be used 21870in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 21871processors and allows both FP32 and FP64A code to interlink and 21872run in the same process without changing FPU modes. 21873 21874@item -mabicalls 21875@itemx -mno-abicalls 21876@opindex mabicalls 21877@opindex mno-abicalls 21878Generate (do not generate) code that is suitable for SVR4-style 21879dynamic objects. @option{-mabicalls} is the default for SVR4-based 21880systems. 21881 21882@item -mshared 21883@itemx -mno-shared 21884Generate (do not generate) code that is fully position-independent, 21885and that can therefore be linked into shared libraries. This option 21886only affects @option{-mabicalls}. 21887 21888All @option{-mabicalls} code has traditionally been position-independent, 21889regardless of options like @option{-fPIC} and @option{-fpic}. However, 21890as an extension, the GNU toolchain allows executables to use absolute 21891accesses for locally-binding symbols. It can also use shorter GP 21892initialization sequences and generate direct calls to locally-defined 21893functions. This mode is selected by @option{-mno-shared}. 21894 21895@option{-mno-shared} depends on binutils 2.16 or higher and generates 21896objects that can only be linked by the GNU linker. However, the option 21897does not affect the ABI of the final executable; it only affects the ABI 21898of relocatable objects. Using @option{-mno-shared} generally makes 21899executables both smaller and quicker. 21900 21901@option{-mshared} is the default. 21902 21903@item -mplt 21904@itemx -mno-plt 21905@opindex mplt 21906@opindex mno-plt 21907Assume (do not assume) that the static and dynamic linkers 21908support PLTs and copy relocations. This option only affects 21909@option{-mno-shared -mabicalls}. For the n64 ABI, this option 21910has no effect without @option{-msym32}. 21911 21912You can make @option{-mplt} the default by configuring 21913GCC with @option{--with-mips-plt}. The default is 21914@option{-mno-plt} otherwise. 21915 21916@item -mxgot 21917@itemx -mno-xgot 21918@opindex mxgot 21919@opindex mno-xgot 21920Lift (do not lift) the usual restrictions on the size of the global 21921offset table. 21922 21923GCC normally uses a single instruction to load values from the GOT@. 21924While this is relatively efficient, it only works if the GOT 21925is smaller than about 64k. Anything larger causes the linker 21926to report an error such as: 21927 21928@cindex relocation truncated to fit (MIPS) 21929@smallexample 21930relocation truncated to fit: R_MIPS_GOT16 foobar 21931@end smallexample 21932 21933If this happens, you should recompile your code with @option{-mxgot}. 21934This works with very large GOTs, although the code is also 21935less efficient, since it takes three instructions to fetch the 21936value of a global symbol. 21937 21938Note that some linkers can create multiple GOTs. If you have such a 21939linker, you should only need to use @option{-mxgot} when a single object 21940file accesses more than 64k's worth of GOT entries. Very few do. 21941 21942These options have no effect unless GCC is generating position 21943independent code. 21944 21945@item -mgp32 21946@opindex mgp32 21947Assume that general-purpose registers are 32 bits wide. 21948 21949@item -mgp64 21950@opindex mgp64 21951Assume that general-purpose registers are 64 bits wide. 21952 21953@item -mfp32 21954@opindex mfp32 21955Assume that floating-point registers are 32 bits wide. 21956 21957@item -mfp64 21958@opindex mfp64 21959Assume that floating-point registers are 64 bits wide. 21960 21961@item -mfpxx 21962@opindex mfpxx 21963Do not assume the width of floating-point registers. 21964 21965@item -mhard-float 21966@opindex mhard-float 21967Use floating-point coprocessor instructions. 21968 21969@item -msoft-float 21970@opindex msoft-float 21971Do not use floating-point coprocessor instructions. Implement 21972floating-point calculations using library calls instead. 21973 21974@item -mno-float 21975@opindex mno-float 21976Equivalent to @option{-msoft-float}, but additionally asserts that the 21977program being compiled does not perform any floating-point operations. 21978This option is presently supported only by some bare-metal MIPS 21979configurations, where it may select a special set of libraries 21980that lack all floating-point support (including, for example, the 21981floating-point @code{printf} formats). 21982If code compiled with @option{-mno-float} accidentally contains 21983floating-point operations, it is likely to suffer a link-time 21984or run-time failure. 21985 21986@item -msingle-float 21987@opindex msingle-float 21988Assume that the floating-point coprocessor only supports single-precision 21989operations. 21990 21991@item -mdouble-float 21992@opindex mdouble-float 21993Assume that the floating-point coprocessor supports double-precision 21994operations. This is the default. 21995 21996@item -modd-spreg 21997@itemx -mno-odd-spreg 21998@opindex modd-spreg 21999@opindex mno-odd-spreg 22000Enable the use of odd-numbered single-precision floating-point registers 22001for the o32 ABI. This is the default for processors that are known to 22002support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 22003is set by default. 22004 22005@item -mabs=2008 22006@itemx -mabs=legacy 22007@opindex mabs=2008 22008@opindex mabs=legacy 22009These options control the treatment of the special not-a-number (NaN) 22010IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 22011@code{neg.@i{fmt}} machine instructions. 22012 22013By default or when @option{-mabs=legacy} is used the legacy 22014treatment is selected. In this case these instructions are considered 22015arithmetic and avoided where correct operation is required and the 22016input operand might be a NaN. A longer sequence of instructions that 22017manipulate the sign bit of floating-point datum manually is used 22018instead unless the @option{-ffinite-math-only} option has also been 22019specified. 22020 22021The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 22022this case these instructions are considered non-arithmetic and therefore 22023operating correctly in all cases, including in particular where the 22024input operand is a NaN. These instructions are therefore always used 22025for the respective operations. 22026 22027@item -mnan=2008 22028@itemx -mnan=legacy 22029@opindex mnan=2008 22030@opindex mnan=legacy 22031These options control the encoding of the special not-a-number (NaN) 22032IEEE 754 floating-point data. 22033 22034The @option{-mnan=legacy} option selects the legacy encoding. In this 22035case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 22036significand field being 0, whereas signaling NaNs (sNaNs) are denoted 22037by the first bit of their trailing significand field being 1. 22038 22039The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 22040this case qNaNs are denoted by the first bit of their trailing 22041significand field being 1, whereas sNaNs are denoted by the first bit of 22042their trailing significand field being 0. 22043 22044The default is @option{-mnan=legacy} unless GCC has been configured with 22045@option{--with-nan=2008}. 22046 22047@item -mllsc 22048@itemx -mno-llsc 22049@opindex mllsc 22050@opindex mno-llsc 22051Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 22052implement atomic memory built-in functions. When neither option is 22053specified, GCC uses the instructions if the target architecture 22054supports them. 22055 22056@option{-mllsc} is useful if the runtime environment can emulate the 22057instructions and @option{-mno-llsc} can be useful when compiling for 22058nonstandard ISAs. You can make either option the default by 22059configuring GCC with @option{--with-llsc} and @option{--without-llsc} 22060respectively. @option{--with-llsc} is the default for some 22061configurations; see the installation documentation for details. 22062 22063@item -mdsp 22064@itemx -mno-dsp 22065@opindex mdsp 22066@opindex mno-dsp 22067Use (do not use) revision 1 of the MIPS DSP ASE@. 22068@xref{MIPS DSP Built-in Functions}. This option defines the 22069preprocessor macro @code{__mips_dsp}. It also defines 22070@code{__mips_dsp_rev} to 1. 22071 22072@item -mdspr2 22073@itemx -mno-dspr2 22074@opindex mdspr2 22075@opindex mno-dspr2 22076Use (do not use) revision 2 of the MIPS DSP ASE@. 22077@xref{MIPS DSP Built-in Functions}. This option defines the 22078preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 22079It also defines @code{__mips_dsp_rev} to 2. 22080 22081@item -msmartmips 22082@itemx -mno-smartmips 22083@opindex msmartmips 22084@opindex mno-smartmips 22085Use (do not use) the MIPS SmartMIPS ASE. 22086 22087@item -mpaired-single 22088@itemx -mno-paired-single 22089@opindex mpaired-single 22090@opindex mno-paired-single 22091Use (do not use) paired-single floating-point instructions. 22092@xref{MIPS Paired-Single Support}. This option requires 22093hardware floating-point support to be enabled. 22094 22095@item -mdmx 22096@itemx -mno-mdmx 22097@opindex mdmx 22098@opindex mno-mdmx 22099Use (do not use) MIPS Digital Media Extension instructions. 22100This option can only be used when generating 64-bit code and requires 22101hardware floating-point support to be enabled. 22102 22103@item -mips3d 22104@itemx -mno-mips3d 22105@opindex mips3d 22106@opindex mno-mips3d 22107Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 22108The option @option{-mips3d} implies @option{-mpaired-single}. 22109 22110@item -mmicromips 22111@itemx -mno-micromips 22112@opindex mmicromips 22113@opindex mno-mmicromips 22114Generate (do not generate) microMIPS code. 22115 22116MicroMIPS code generation can also be controlled on a per-function basis 22117by means of @code{micromips} and @code{nomicromips} attributes. 22118@xref{Function Attributes}, for more information. 22119 22120@item -mmt 22121@itemx -mno-mt 22122@opindex mmt 22123@opindex mno-mt 22124Use (do not use) MT Multithreading instructions. 22125 22126@item -mmcu 22127@itemx -mno-mcu 22128@opindex mmcu 22129@opindex mno-mcu 22130Use (do not use) the MIPS MCU ASE instructions. 22131 22132@item -meva 22133@itemx -mno-eva 22134@opindex meva 22135@opindex mno-eva 22136Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 22137 22138@item -mvirt 22139@itemx -mno-virt 22140@opindex mvirt 22141@opindex mno-virt 22142Use (do not use) the MIPS Virtualization (VZ) instructions. 22143 22144@item -mxpa 22145@itemx -mno-xpa 22146@opindex mxpa 22147@opindex mno-xpa 22148Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 22149 22150@item -mcrc 22151@itemx -mno-crc 22152@opindex mcrc 22153@opindex mno-crc 22154Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions. 22155 22156@item -mginv 22157@itemx -mno-ginv 22158@opindex mginv 22159@opindex mno-ginv 22160Use (do not use) the MIPS Global INValidate (GINV) instructions. 22161 22162@item -mloongson-mmi 22163@itemx -mno-loongson-mmi 22164@opindex mloongson-mmi 22165@opindex mno-loongson-mmi 22166Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI). 22167 22168@item -mloongson-ext 22169@itemx -mno-loongson-ext 22170@opindex mloongson-ext 22171@opindex mno-loongson-ext 22172Use (do not use) the MIPS Loongson EXTensions (EXT) instructions. 22173 22174@item -mloongson-ext2 22175@itemx -mno-loongson-ext2 22176@opindex mloongson-ext2 22177@opindex mno-loongson-ext2 22178Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions. 22179 22180@item -mlong64 22181@opindex mlong64 22182Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 22183an explanation of the default and the way that the pointer size is 22184determined. 22185 22186@item -mlong32 22187@opindex mlong32 22188Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 22189 22190The default size of @code{int}s, @code{long}s and pointers depends on 22191the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 22192uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 2219332-bit @code{long}s. Pointers are the same size as @code{long}s, 22194or the same size as integer registers, whichever is smaller. 22195 22196@item -msym32 22197@itemx -mno-sym32 22198@opindex msym32 22199@opindex mno-sym32 22200Assume (do not assume) that all symbols have 32-bit values, regardless 22201of the selected ABI@. This option is useful in combination with 22202@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 22203to generate shorter and faster references to symbolic addresses. 22204 22205@item -G @var{num} 22206@opindex G 22207Put definitions of externally-visible data in a small data section 22208if that data is no bigger than @var{num} bytes. GCC can then generate 22209more efficient accesses to the data; see @option{-mgpopt} for details. 22210 22211The default @option{-G} option depends on the configuration. 22212 22213@item -mlocal-sdata 22214@itemx -mno-local-sdata 22215@opindex mlocal-sdata 22216@opindex mno-local-sdata 22217Extend (do not extend) the @option{-G} behavior to local data too, 22218such as to static variables in C@. @option{-mlocal-sdata} is the 22219default for all configurations. 22220 22221If the linker complains that an application is using too much small data, 22222you might want to try rebuilding the less performance-critical parts with 22223@option{-mno-local-sdata}. You might also want to build large 22224libraries with @option{-mno-local-sdata}, so that the libraries leave 22225more room for the main program. 22226 22227@item -mextern-sdata 22228@itemx -mno-extern-sdata 22229@opindex mextern-sdata 22230@opindex mno-extern-sdata 22231Assume (do not assume) that externally-defined data is in 22232a small data section if the size of that data is within the @option{-G} limit. 22233@option{-mextern-sdata} is the default for all configurations. 22234 22235If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 22236@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 22237that is no bigger than @var{num} bytes, you must make sure that @var{Var} 22238is placed in a small data section. If @var{Var} is defined by another 22239module, you must either compile that module with a high-enough 22240@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 22241definition. If @var{Var} is common, you must link the application 22242with a high-enough @option{-G} setting. 22243 22244The easiest way of satisfying these restrictions is to compile 22245and link every module with the same @option{-G} option. However, 22246you may wish to build a library that supports several different 22247small data limits. You can do this by compiling the library with 22248the highest supported @option{-G} setting and additionally using 22249@option{-mno-extern-sdata} to stop the library from making assumptions 22250about externally-defined data. 22251 22252@item -mgpopt 22253@itemx -mno-gpopt 22254@opindex mgpopt 22255@opindex mno-gpopt 22256Use (do not use) GP-relative accesses for symbols that are known to be 22257in a small data section; see @option{-G}, @option{-mlocal-sdata} and 22258@option{-mextern-sdata}. @option{-mgpopt} is the default for all 22259configurations. 22260 22261@option{-mno-gpopt} is useful for cases where the @code{$gp} register 22262might not hold the value of @code{_gp}. For example, if the code is 22263part of a library that might be used in a boot monitor, programs that 22264call boot monitor routines pass an unknown value in @code{$gp}. 22265(In such situations, the boot monitor itself is usually compiled 22266with @option{-G0}.) 22267 22268@option{-mno-gpopt} implies @option{-mno-local-sdata} and 22269@option{-mno-extern-sdata}. 22270 22271@item -membedded-data 22272@itemx -mno-embedded-data 22273@opindex membedded-data 22274@opindex mno-embedded-data 22275Allocate variables to the read-only data section first if possible, then 22276next in the small data section if possible, otherwise in data. This gives 22277slightly slower code than the default, but reduces the amount of RAM required 22278when executing, and thus may be preferred for some embedded systems. 22279 22280@item -muninit-const-in-rodata 22281@itemx -mno-uninit-const-in-rodata 22282@opindex muninit-const-in-rodata 22283@opindex mno-uninit-const-in-rodata 22284Put uninitialized @code{const} variables in the read-only data section. 22285This option is only meaningful in conjunction with @option{-membedded-data}. 22286 22287@item -mcode-readable=@var{setting} 22288@opindex mcode-readable 22289Specify whether GCC may generate code that reads from executable sections. 22290There are three possible settings: 22291 22292@table @gcctabopt 22293@item -mcode-readable=yes 22294Instructions may freely access executable sections. This is the 22295default setting. 22296 22297@item -mcode-readable=pcrel 22298MIPS16 PC-relative load instructions can access executable sections, 22299but other instructions must not do so. This option is useful on 4KSc 22300and 4KSd processors when the code TLBs have the Read Inhibit bit set. 22301It is also useful on processors that can be configured to have a dual 22302instruction/data SRAM interface and that, like the M4K, automatically 22303redirect PC-relative loads to the instruction RAM. 22304 22305@item -mcode-readable=no 22306Instructions must not access executable sections. This option can be 22307useful on targets that are configured to have a dual instruction/data 22308SRAM interface but that (unlike the M4K) do not automatically redirect 22309PC-relative loads to the instruction RAM. 22310@end table 22311 22312@item -msplit-addresses 22313@itemx -mno-split-addresses 22314@opindex msplit-addresses 22315@opindex mno-split-addresses 22316Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 22317relocation operators. This option has been superseded by 22318@option{-mexplicit-relocs} but is retained for backwards compatibility. 22319 22320@item -mexplicit-relocs 22321@itemx -mno-explicit-relocs 22322@opindex mexplicit-relocs 22323@opindex mno-explicit-relocs 22324Use (do not use) assembler relocation operators when dealing with symbolic 22325addresses. The alternative, selected by @option{-mno-explicit-relocs}, 22326is to use assembler macros instead. 22327 22328@option{-mexplicit-relocs} is the default if GCC was configured 22329to use an assembler that supports relocation operators. 22330 22331@item -mcheck-zero-division 22332@itemx -mno-check-zero-division 22333@opindex mcheck-zero-division 22334@opindex mno-check-zero-division 22335Trap (do not trap) on integer division by zero. 22336 22337The default is @option{-mcheck-zero-division}. 22338 22339@item -mdivide-traps 22340@itemx -mdivide-breaks 22341@opindex mdivide-traps 22342@opindex mdivide-breaks 22343MIPS systems check for division by zero by generating either a 22344conditional trap or a break instruction. Using traps results in 22345smaller code, but is only supported on MIPS II and later. Also, some 22346versions of the Linux kernel have a bug that prevents trap from 22347generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 22348allow conditional traps on architectures that support them and 22349@option{-mdivide-breaks} to force the use of breaks. 22350 22351The default is usually @option{-mdivide-traps}, but this can be 22352overridden at configure time using @option{--with-divide=breaks}. 22353Divide-by-zero checks can be completely disabled using 22354@option{-mno-check-zero-division}. 22355 22356@item -mload-store-pairs 22357@itemx -mno-load-store-pairs 22358@opindex mload-store-pairs 22359@opindex mno-load-store-pairs 22360Enable (disable) an optimization that pairs consecutive load or store 22361instructions to enable load/store bonding. This option is enabled by 22362default but only takes effect when the selected architecture is known 22363to support bonding. 22364 22365@item -mmemcpy 22366@itemx -mno-memcpy 22367@opindex mmemcpy 22368@opindex mno-memcpy 22369Force (do not force) the use of @code{memcpy} for non-trivial block 22370moves. The default is @option{-mno-memcpy}, which allows GCC to inline 22371most constant-sized copies. 22372 22373@item -mlong-calls 22374@itemx -mno-long-calls 22375@opindex mlong-calls 22376@opindex mno-long-calls 22377Disable (do not disable) use of the @code{jal} instruction. Calling 22378functions using @code{jal} is more efficient but requires the caller 22379and callee to be in the same 256 megabyte segment. 22380 22381This option has no effect on abicalls code. The default is 22382@option{-mno-long-calls}. 22383 22384@item -mmad 22385@itemx -mno-mad 22386@opindex mmad 22387@opindex mno-mad 22388Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 22389instructions, as provided by the R4650 ISA@. 22390 22391@item -mimadd 22392@itemx -mno-imadd 22393@opindex mimadd 22394@opindex mno-imadd 22395Enable (disable) use of the @code{madd} and @code{msub} integer 22396instructions. The default is @option{-mimadd} on architectures 22397that support @code{madd} and @code{msub} except for the 74k 22398architecture where it was found to generate slower code. 22399 22400@item -mfused-madd 22401@itemx -mno-fused-madd 22402@opindex mfused-madd 22403@opindex mno-fused-madd 22404Enable (disable) use of the floating-point multiply-accumulate 22405instructions, when they are available. The default is 22406@option{-mfused-madd}. 22407 22408On the R8000 CPU when multiply-accumulate instructions are used, 22409the intermediate product is calculated to infinite precision 22410and is not subject to the FCSR Flush to Zero bit. This may be 22411undesirable in some circumstances. On other processors the result 22412is numerically identical to the equivalent computation using 22413separate multiply, add, subtract and negate instructions. 22414 22415@item -nocpp 22416@opindex nocpp 22417Tell the MIPS assembler to not run its preprocessor over user 22418assembler files (with a @samp{.s} suffix) when assembling them. 22419 22420@item -mfix-24k 22421@itemx -mno-fix-24k 22422@opindex mfix-24k 22423@opindex mno-fix-24k 22424Work around the 24K E48 (lost data on stores during refill) errata. 22425The workarounds are implemented by the assembler rather than by GCC@. 22426 22427@item -mfix-r4000 22428@itemx -mno-fix-r4000 22429@opindex mfix-r4000 22430@opindex mno-fix-r4000 22431Work around certain R4000 CPU errata: 22432@itemize @minus 22433@item 22434A double-word or a variable shift may give an incorrect result if executed 22435immediately after starting an integer division. 22436@item 22437A double-word or a variable shift may give an incorrect result if executed 22438while an integer multiplication is in progress. 22439@item 22440An integer division may give an incorrect result if started in a delay slot 22441of a taken branch or a jump. 22442@end itemize 22443 22444@item -mfix-r4400 22445@itemx -mno-fix-r4400 22446@opindex mfix-r4400 22447@opindex mno-fix-r4400 22448Work around certain R4400 CPU errata: 22449@itemize @minus 22450@item 22451A double-word or a variable shift may give an incorrect result if executed 22452immediately after starting an integer division. 22453@end itemize 22454 22455@item -mfix-r10000 22456@itemx -mno-fix-r10000 22457@opindex mfix-r10000 22458@opindex mno-fix-r10000 22459Work around certain R10000 errata: 22460@itemize @minus 22461@item 22462@code{ll}/@code{sc} sequences may not behave atomically on revisions 22463prior to 3.0. They may deadlock on revisions 2.6 and earlier. 22464@end itemize 22465 22466This option can only be used if the target architecture supports 22467branch-likely instructions. @option{-mfix-r10000} is the default when 22468@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 22469otherwise. 22470 22471@item -mfix-r5900 22472@itemx -mno-fix-r5900 22473@opindex mfix-r5900 22474Do not attempt to schedule the preceding instruction into the delay slot 22475of a branch instruction placed at the end of a short loop of six 22476instructions or fewer and always schedule a @code{nop} instruction there 22477instead. The short loop bug under certain conditions causes loops to 22478execute only once or twice, due to a hardware bug in the R5900 chip. The 22479workaround is implemented by the assembler rather than by GCC@. 22480 22481@item -mfix-rm7000 22482@itemx -mno-fix-rm7000 22483@opindex mfix-rm7000 22484Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 22485workarounds are implemented by the assembler rather than by GCC@. 22486 22487@item -mfix-vr4120 22488@itemx -mno-fix-vr4120 22489@opindex mfix-vr4120 22490Work around certain VR4120 errata: 22491@itemize @minus 22492@item 22493@code{dmultu} does not always produce the correct result. 22494@item 22495@code{div} and @code{ddiv} do not always produce the correct result if one 22496of the operands is negative. 22497@end itemize 22498The workarounds for the division errata rely on special functions in 22499@file{libgcc.a}. At present, these functions are only provided by 22500the @code{mips64vr*-elf} configurations. 22501 22502Other VR4120 errata require a NOP to be inserted between certain pairs of 22503instructions. These errata are handled by the assembler, not by GCC itself. 22504 22505@item -mfix-vr4130 22506@opindex mfix-vr4130 22507Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 22508workarounds are implemented by the assembler rather than by GCC, 22509although GCC avoids using @code{mflo} and @code{mfhi} if the 22510VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 22511instructions are available instead. 22512 22513@item -mfix-sb1 22514@itemx -mno-fix-sb1 22515@opindex mfix-sb1 22516Work around certain SB-1 CPU core errata. 22517(This flag currently works around the SB-1 revision 2 22518``F1'' and ``F2'' floating-point errata.) 22519 22520@item -mr10k-cache-barrier=@var{setting} 22521@opindex mr10k-cache-barrier 22522Specify whether GCC should insert cache barriers to avoid the 22523side effects of speculation on R10K processors. 22524 22525In common with many processors, the R10K tries to predict the outcome 22526of a conditional branch and speculatively executes instructions from 22527the ``taken'' branch. It later aborts these instructions if the 22528predicted outcome is wrong. However, on the R10K, even aborted 22529instructions can have side effects. 22530 22531This problem only affects kernel stores and, depending on the system, 22532kernel loads. As an example, a speculatively-executed store may load 22533the target memory into cache and mark the cache line as dirty, even if 22534the store itself is later aborted. If a DMA operation writes to the 22535same area of memory before the ``dirty'' line is flushed, the cached 22536data overwrites the DMA-ed data. See the R10K processor manual 22537for a full description, including other potential problems. 22538 22539One workaround is to insert cache barrier instructions before every memory 22540access that might be speculatively executed and that might have side 22541effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 22542controls GCC's implementation of this workaround. It assumes that 22543aborted accesses to any byte in the following regions does not have 22544side effects: 22545 22546@enumerate 22547@item 22548the memory occupied by the current function's stack frame; 22549 22550@item 22551the memory occupied by an incoming stack argument; 22552 22553@item 22554the memory occupied by an object with a link-time-constant address. 22555@end enumerate 22556 22557It is the kernel's responsibility to ensure that speculative 22558accesses to these regions are indeed safe. 22559 22560If the input program contains a function declaration such as: 22561 22562@smallexample 22563void foo (void); 22564@end smallexample 22565 22566then the implementation of @code{foo} must allow @code{j foo} and 22567@code{jal foo} to be executed speculatively. GCC honors this 22568restriction for functions it compiles itself. It expects non-GCC 22569functions (such as hand-written assembly code) to do the same. 22570 22571The option has three forms: 22572 22573@table @gcctabopt 22574@item -mr10k-cache-barrier=load-store 22575Insert a cache barrier before a load or store that might be 22576speculatively executed and that might have side effects even 22577if aborted. 22578 22579@item -mr10k-cache-barrier=store 22580Insert a cache barrier before a store that might be speculatively 22581executed and that might have side effects even if aborted. 22582 22583@item -mr10k-cache-barrier=none 22584Disable the insertion of cache barriers. This is the default setting. 22585@end table 22586 22587@item -mflush-func=@var{func} 22588@itemx -mno-flush-func 22589@opindex mflush-func 22590Specifies the function to call to flush the I and D caches, or to not 22591call any such function. If called, the function must take the same 22592arguments as the common @code{_flush_func}, that is, the address of the 22593memory range for which the cache is being flushed, the size of the 22594memory range, and the number 3 (to flush both caches). The default 22595depends on the target GCC was configured for, but commonly is either 22596@code{_flush_func} or @code{__cpu_flush}. 22597 22598@item mbranch-cost=@var{num} 22599@opindex mbranch-cost 22600Set the cost of branches to roughly @var{num} ``simple'' instructions. 22601This cost is only a heuristic and is not guaranteed to produce 22602consistent results across releases. A zero cost redundantly selects 22603the default, which is based on the @option{-mtune} setting. 22604 22605@item -mbranch-likely 22606@itemx -mno-branch-likely 22607@opindex mbranch-likely 22608@opindex mno-branch-likely 22609Enable or disable use of Branch Likely instructions, regardless of the 22610default for the selected architecture. By default, Branch Likely 22611instructions may be generated if they are supported by the selected 22612architecture. An exception is for the MIPS32 and MIPS64 architectures 22613and processors that implement those architectures; for those, Branch 22614Likely instructions are not be generated by default because the MIPS32 22615and MIPS64 architectures specifically deprecate their use. 22616 22617@item -mcompact-branches=never 22618@itemx -mcompact-branches=optimal 22619@itemx -mcompact-branches=always 22620@opindex mcompact-branches=never 22621@opindex mcompact-branches=optimal 22622@opindex mcompact-branches=always 22623These options control which form of branches will be generated. The 22624default is @option{-mcompact-branches=optimal}. 22625 22626The @option{-mcompact-branches=never} option ensures that compact branch 22627instructions will never be generated. 22628 22629The @option{-mcompact-branches=always} option ensures that a compact 22630branch instruction will be generated if available. If a compact branch 22631instruction is not available, a delay slot form of the branch will be 22632used instead. 22633 22634This option is supported from MIPS Release 6 onwards. 22635 22636The @option{-mcompact-branches=optimal} option will cause a delay slot 22637branch to be used if one is available in the current ISA and the delay 22638slot is successfully filled. If the delay slot is not filled, a compact 22639branch will be chosen if one is available. 22640 22641@item -mfp-exceptions 22642@itemx -mno-fp-exceptions 22643@opindex mfp-exceptions 22644Specifies whether FP exceptions are enabled. This affects how 22645FP instructions are scheduled for some processors. 22646The default is that FP exceptions are 22647enabled. 22648 22649For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 2265064-bit code, then we can use both FP pipes. Otherwise, we can only use one 22651FP pipe. 22652 22653@item -mvr4130-align 22654@itemx -mno-vr4130-align 22655@opindex mvr4130-align 22656The VR4130 pipeline is two-way superscalar, but can only issue two 22657instructions together if the first one is 8-byte aligned. When this 22658option is enabled, GCC aligns pairs of instructions that it 22659thinks should execute in parallel. 22660 22661This option only has an effect when optimizing for the VR4130. 22662It normally makes code faster, but at the expense of making it bigger. 22663It is enabled by default at optimization level @option{-O3}. 22664 22665@item -msynci 22666@itemx -mno-synci 22667@opindex msynci 22668Enable (disable) generation of @code{synci} instructions on 22669architectures that support it. The @code{synci} instructions (if 22670enabled) are generated when @code{__builtin___clear_cache} is 22671compiled. 22672 22673This option defaults to @option{-mno-synci}, but the default can be 22674overridden by configuring GCC with @option{--with-synci}. 22675 22676When compiling code for single processor systems, it is generally safe 22677to use @code{synci}. However, on many multi-core (SMP) systems, it 22678does not invalidate the instruction caches on all cores and may lead 22679to undefined behavior. 22680 22681@item -mrelax-pic-calls 22682@itemx -mno-relax-pic-calls 22683@opindex mrelax-pic-calls 22684Try to turn PIC calls that are normally dispatched via register 22685@code{$25} into direct calls. This is only possible if the linker can 22686resolve the destination at link time and if the destination is within 22687range for a direct call. 22688 22689@option{-mrelax-pic-calls} is the default if GCC was configured to use 22690an assembler and a linker that support the @code{.reloc} assembly 22691directive and @option{-mexplicit-relocs} is in effect. With 22692@option{-mno-explicit-relocs}, this optimization can be performed by the 22693assembler and the linker alone without help from the compiler. 22694 22695@item -mmcount-ra-address 22696@itemx -mno-mcount-ra-address 22697@opindex mmcount-ra-address 22698@opindex mno-mcount-ra-address 22699Emit (do not emit) code that allows @code{_mcount} to modify the 22700calling function's return address. When enabled, this option extends 22701the usual @code{_mcount} interface with a new @var{ra-address} 22702parameter, which has type @code{intptr_t *} and is passed in register 22703@code{$12}. @code{_mcount} can then modify the return address by 22704doing both of the following: 22705@itemize 22706@item 22707Returning the new address in register @code{$31}. 22708@item 22709Storing the new address in @code{*@var{ra-address}}, 22710if @var{ra-address} is nonnull. 22711@end itemize 22712 22713The default is @option{-mno-mcount-ra-address}. 22714 22715@item -mframe-header-opt 22716@itemx -mno-frame-header-opt 22717@opindex mframe-header-opt 22718Enable (disable) frame header optimization in the o32 ABI. When using the 22719o32 ABI, calling functions will allocate 16 bytes on the stack for the called 22720function to write out register arguments. When enabled, this optimization 22721will suppress the allocation of the frame header if it can be determined that 22722it is unused. 22723 22724This optimization is off by default at all optimization levels. 22725 22726@item -mlxc1-sxc1 22727@itemx -mno-lxc1-sxc1 22728@opindex mlxc1-sxc1 22729When applicable, enable (disable) the generation of @code{lwxc1}, 22730@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default. 22731 22732@item -mmadd4 22733@itemx -mno-madd4 22734@opindex mmadd4 22735When applicable, enable (disable) the generation of 4-operand @code{madd.s}, 22736@code{madd.d} and related instructions. Enabled by default. 22737 22738@end table 22739 22740@node MMIX Options 22741@subsection MMIX Options 22742@cindex MMIX Options 22743 22744These options are defined for the MMIX: 22745 22746@table @gcctabopt 22747@item -mlibfuncs 22748@itemx -mno-libfuncs 22749@opindex mlibfuncs 22750@opindex mno-libfuncs 22751Specify that intrinsic library functions are being compiled, passing all 22752values in registers, no matter the size. 22753 22754@item -mepsilon 22755@itemx -mno-epsilon 22756@opindex mepsilon 22757@opindex mno-epsilon 22758Generate floating-point comparison instructions that compare with respect 22759to the @code{rE} epsilon register. 22760 22761@item -mabi=mmixware 22762@itemx -mabi=gnu 22763@opindex mabi=mmixware 22764@opindex mabi=gnu 22765Generate code that passes function parameters and return values that (in 22766the called function) are seen as registers @code{$0} and up, as opposed to 22767the GNU ABI which uses global registers @code{$231} and up. 22768 22769@item -mzero-extend 22770@itemx -mno-zero-extend 22771@opindex mzero-extend 22772@opindex mno-zero-extend 22773When reading data from memory in sizes shorter than 64 bits, use (do not 22774use) zero-extending load instructions by default, rather than 22775sign-extending ones. 22776 22777@item -mknuthdiv 22778@itemx -mno-knuthdiv 22779@opindex mknuthdiv 22780@opindex mno-knuthdiv 22781Make the result of a division yielding a remainder have the same sign as 22782the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 22783remainder follows the sign of the dividend. Both methods are 22784arithmetically valid, the latter being almost exclusively used. 22785 22786@item -mtoplevel-symbols 22787@itemx -mno-toplevel-symbols 22788@opindex mtoplevel-symbols 22789@opindex mno-toplevel-symbols 22790Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 22791code can be used with the @code{PREFIX} assembly directive. 22792 22793@item -melf 22794@opindex melf 22795Generate an executable in the ELF format, rather than the default 22796@samp{mmo} format used by the @command{mmix} simulator. 22797 22798@item -mbranch-predict 22799@itemx -mno-branch-predict 22800@opindex mbranch-predict 22801@opindex mno-branch-predict 22802Use (do not use) the probable-branch instructions, when static branch 22803prediction indicates a probable branch. 22804 22805@item -mbase-addresses 22806@itemx -mno-base-addresses 22807@opindex mbase-addresses 22808@opindex mno-base-addresses 22809Generate (do not generate) code that uses @emph{base addresses}. Using a 22810base address automatically generates a request (handled by the assembler 22811and the linker) for a constant to be set up in a global register. The 22812register is used for one or more base address requests within the range 0 22813to 255 from the value held in the register. The generally leads to short 22814and fast code, but the number of different data items that can be 22815addressed is limited. This means that a program that uses lots of static 22816data may require @option{-mno-base-addresses}. 22817 22818@item -msingle-exit 22819@itemx -mno-single-exit 22820@opindex msingle-exit 22821@opindex mno-single-exit 22822Force (do not force) generated code to have a single exit point in each 22823function. 22824@end table 22825 22826@node MN10300 Options 22827@subsection MN10300 Options 22828@cindex MN10300 options 22829 22830These @option{-m} options are defined for Matsushita MN10300 architectures: 22831 22832@table @gcctabopt 22833@item -mmult-bug 22834@opindex mmult-bug 22835Generate code to avoid bugs in the multiply instructions for the MN10300 22836processors. This is the default. 22837 22838@item -mno-mult-bug 22839@opindex mno-mult-bug 22840Do not generate code to avoid bugs in the multiply instructions for the 22841MN10300 processors. 22842 22843@item -mam33 22844@opindex mam33 22845Generate code using features specific to the AM33 processor. 22846 22847@item -mno-am33 22848@opindex mno-am33 22849Do not generate code using features specific to the AM33 processor. This 22850is the default. 22851 22852@item -mam33-2 22853@opindex mam33-2 22854Generate code using features specific to the AM33/2.0 processor. 22855 22856@item -mam34 22857@opindex mam34 22858Generate code using features specific to the AM34 processor. 22859 22860@item -mtune=@var{cpu-type} 22861@opindex mtune 22862Use the timing characteristics of the indicated CPU type when 22863scheduling instructions. This does not change the targeted processor 22864type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 22865@samp{am33-2} or @samp{am34}. 22866 22867@item -mreturn-pointer-on-d0 22868@opindex mreturn-pointer-on-d0 22869When generating a function that returns a pointer, return the pointer 22870in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 22871only in @code{a0}, and attempts to call such functions without a prototype 22872result in errors. Note that this option is on by default; use 22873@option{-mno-return-pointer-on-d0} to disable it. 22874 22875@item -mno-crt0 22876@opindex mno-crt0 22877Do not link in the C run-time initialization object file. 22878 22879@item -mrelax 22880@opindex mrelax 22881Indicate to the linker that it should perform a relaxation optimization pass 22882to shorten branches, calls and absolute memory addresses. This option only 22883has an effect when used on the command line for the final link step. 22884 22885This option makes symbolic debugging impossible. 22886 22887@item -mliw 22888@opindex mliw 22889Allow the compiler to generate @emph{Long Instruction Word} 22890instructions if the target is the @samp{AM33} or later. This is the 22891default. This option defines the preprocessor macro @code{__LIW__}. 22892 22893@item -mno-liw 22894@opindex mno-liw 22895Do not allow the compiler to generate @emph{Long Instruction Word} 22896instructions. This option defines the preprocessor macro 22897@code{__NO_LIW__}. 22898 22899@item -msetlb 22900@opindex msetlb 22901Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 22902instructions if the target is the @samp{AM33} or later. This is the 22903default. This option defines the preprocessor macro @code{__SETLB__}. 22904 22905@item -mno-setlb 22906@opindex mno-setlb 22907Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 22908instructions. This option defines the preprocessor macro 22909@code{__NO_SETLB__}. 22910 22911@end table 22912 22913@node Moxie Options 22914@subsection Moxie Options 22915@cindex Moxie Options 22916 22917@table @gcctabopt 22918 22919@item -meb 22920@opindex meb 22921Generate big-endian code. This is the default for @samp{moxie-*-*} 22922configurations. 22923 22924@item -mel 22925@opindex mel 22926Generate little-endian code. 22927 22928@item -mmul.x 22929@opindex mmul.x 22930Generate mul.x and umul.x instructions. This is the default for 22931@samp{moxiebox-*-*} configurations. 22932 22933@item -mno-crt0 22934@opindex mno-crt0 22935Do not link in the C run-time initialization object file. 22936 22937@end table 22938 22939@node MSP430 Options 22940@subsection MSP430 Options 22941@cindex MSP430 Options 22942 22943These options are defined for the MSP430: 22944 22945@table @gcctabopt 22946 22947@item -masm-hex 22948@opindex masm-hex 22949Force assembly output to always use hex constants. Normally such 22950constants are signed decimals, but this option is available for 22951testsuite and/or aesthetic purposes. 22952 22953@item -mmcu= 22954@opindex mmcu= 22955Select the MCU to target. This is used to create a C preprocessor 22956symbol based upon the MCU name, converted to upper case and pre- and 22957post-fixed with @samp{__}. This in turn is used by the 22958@file{msp430.h} header file to select an MCU-specific supplementary 22959header file. 22960 22961The option also sets the ISA to use. If the MCU name is one that is 22962known to only support the 430 ISA then that is selected, otherwise the 22963430X ISA is selected. A generic MCU name of @samp{msp430} can also be 22964used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 22965name selects the 430X ISA. 22966 22967In addition an MCU-specific linker script is added to the linker 22968command line. The script's name is the name of the MCU with 22969@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 22970command line defines the C preprocessor symbol @code{__XXX__} and 22971cause the linker to search for a script called @file{xxx.ld}. 22972 22973This option is also passed on to the assembler. 22974 22975@item -mwarn-mcu 22976@itemx -mno-warn-mcu 22977@opindex mwarn-mcu 22978@opindex mno-warn-mcu 22979This option enables or disables warnings about conflicts between the 22980MCU name specified by the @option{-mmcu} option and the ISA set by the 22981@option{-mcpu} option and/or the hardware multiply support set by the 22982@option{-mhwmult} option. It also toggles warnings about unrecognized 22983MCU names. This option is on by default. 22984 22985@item -mcpu= 22986@opindex mcpu= 22987Specifies the ISA to use. Accepted values are @samp{msp430}, 22988@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 22989@option{-mmcu=} option should be used to select the ISA. 22990 22991@item -msim 22992@opindex msim 22993Link to the simulator runtime libraries and linker script. Overrides 22994any scripts that would be selected by the @option{-mmcu=} option. 22995 22996@item -mlarge 22997@opindex mlarge 22998Use large-model addressing (20-bit pointers, 32-bit @code{size_t}). 22999 23000@item -msmall 23001@opindex msmall 23002Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 23003 23004@item -mrelax 23005@opindex mrelax 23006This option is passed to the assembler and linker, and allows the 23007linker to perform certain optimizations that cannot be done until 23008the final link. 23009 23010@item mhwmult= 23011@opindex mhwmult= 23012Describes the type of hardware multiply supported by the target. 23013Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 23014for the original 16-bit-only multiply supported by early MCUs. 23015@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 23016@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 23017A value of @samp{auto} can also be given. This tells GCC to deduce 23018the hardware multiply support based upon the MCU name provided by the 23019@option{-mmcu} option. If no @option{-mmcu} option is specified or if 23020the MCU name is not recognized then no hardware multiply support is 23021assumed. @code{auto} is the default setting. 23022 23023Hardware multiplies are normally performed by calling a library 23024routine. This saves space in the generated code. When compiling at 23025@option{-O3} or higher however the hardware multiplier is invoked 23026inline. This makes for bigger, but faster code. 23027 23028The hardware multiply routines disable interrupts whilst running and 23029restore the previous interrupt state when they finish. This makes 23030them safe to use inside interrupt handlers as well as in normal code. 23031 23032@item -minrt 23033@opindex minrt 23034Enable the use of a minimum runtime environment - no static 23035initializers or constructors. This is intended for memory-constrained 23036devices. The compiler includes special symbols in some objects 23037that tell the linker and runtime which code fragments are required. 23038 23039@item -mcode-region= 23040@itemx -mdata-region= 23041@opindex mcode-region 23042@opindex mdata-region 23043These options tell the compiler where to place functions and data that 23044do not have one of the @code{lower}, @code{upper}, @code{either} or 23045@code{section} attributes. Possible values are @code{lower}, 23046@code{upper}, @code{either} or @code{any}. The first three behave 23047like the corresponding attribute. The fourth possible value - 23048@code{any} - is the default. It leaves placement entirely up to the 23049linker script and how it assigns the standard sections 23050(@code{.text}, @code{.data}, etc) to the memory regions. 23051 23052@item -msilicon-errata= 23053@opindex msilicon-errata 23054This option passes on a request to assembler to enable the fixes for 23055the named silicon errata. 23056 23057@item -msilicon-errata-warn= 23058@opindex msilicon-errata-warn 23059This option passes on a request to the assembler to enable warning 23060messages when a silicon errata might need to be applied. 23061 23062@end table 23063 23064@node NDS32 Options 23065@subsection NDS32 Options 23066@cindex NDS32 Options 23067 23068These options are defined for NDS32 implementations: 23069 23070@table @gcctabopt 23071 23072@item -mbig-endian 23073@opindex mbig-endian 23074Generate code in big-endian mode. 23075 23076@item -mlittle-endian 23077@opindex mlittle-endian 23078Generate code in little-endian mode. 23079 23080@item -mreduced-regs 23081@opindex mreduced-regs 23082Use reduced-set registers for register allocation. 23083 23084@item -mfull-regs 23085@opindex mfull-regs 23086Use full-set registers for register allocation. 23087 23088@item -mcmov 23089@opindex mcmov 23090Generate conditional move instructions. 23091 23092@item -mno-cmov 23093@opindex mno-cmov 23094Do not generate conditional move instructions. 23095 23096@item -mext-perf 23097@opindex mext-perf 23098Generate performance extension instructions. 23099 23100@item -mno-ext-perf 23101@opindex mno-ext-perf 23102Do not generate performance extension instructions. 23103 23104@item -mext-perf2 23105@opindex mext-perf2 23106Generate performance extension 2 instructions. 23107 23108@item -mno-ext-perf2 23109@opindex mno-ext-perf2 23110Do not generate performance extension 2 instructions. 23111 23112@item -mext-string 23113@opindex mext-string 23114Generate string extension instructions. 23115 23116@item -mno-ext-string 23117@opindex mno-ext-string 23118Do not generate string extension instructions. 23119 23120@item -mv3push 23121@opindex mv3push 23122Generate v3 push25/pop25 instructions. 23123 23124@item -mno-v3push 23125@opindex mno-v3push 23126Do not generate v3 push25/pop25 instructions. 23127 23128@item -m16-bit 23129@opindex m16-bit 23130Generate 16-bit instructions. 23131 23132@item -mno-16-bit 23133@opindex mno-16-bit 23134Do not generate 16-bit instructions. 23135 23136@item -misr-vector-size=@var{num} 23137@opindex misr-vector-size 23138Specify the size of each interrupt vector, which must be 4 or 16. 23139 23140@item -mcache-block-size=@var{num} 23141@opindex mcache-block-size 23142Specify the size of each cache block, 23143which must be a power of 2 between 4 and 512. 23144 23145@item -march=@var{arch} 23146@opindex march 23147Specify the name of the target architecture. 23148 23149@item -mcmodel=@var{code-model} 23150@opindex mcmodel 23151Set the code model to one of 23152@table @asis 23153@item @samp{small} 23154All the data and read-only data segments must be within 512KB addressing space. 23155The text segment must be within 16MB addressing space. 23156@item @samp{medium} 23157The data segment must be within 512KB while the read-only data segment can be 23158within 4GB addressing space. The text segment should be still within 16MB 23159addressing space. 23160@item @samp{large} 23161All the text and data segments can be within 4GB addressing space. 23162@end table 23163 23164@item -mctor-dtor 23165@opindex mctor-dtor 23166Enable constructor/destructor feature. 23167 23168@item -mrelax 23169@opindex mrelax 23170Guide linker to relax instructions. 23171 23172@end table 23173 23174@node Nios II Options 23175@subsection Nios II Options 23176@cindex Nios II options 23177@cindex Altera Nios II options 23178 23179These are the options defined for the Altera Nios II processor. 23180 23181@table @gcctabopt 23182 23183@item -G @var{num} 23184@opindex G 23185@cindex smaller data references 23186Put global and static objects less than or equal to @var{num} bytes 23187into the small data or BSS sections instead of the normal data or BSS 23188sections. The default value of @var{num} is 8. 23189 23190@item -mgpopt=@var{option} 23191@itemx -mgpopt 23192@itemx -mno-gpopt 23193@opindex mgpopt 23194@opindex mno-gpopt 23195Generate (do not generate) GP-relative accesses. The following 23196@var{option} names are recognized: 23197 23198@table @samp 23199 23200@item none 23201Do not generate GP-relative accesses. 23202 23203@item local 23204Generate GP-relative accesses for small data objects that are not 23205external, weak, or uninitialized common symbols. 23206Also use GP-relative addressing for objects that 23207have been explicitly placed in a small data section via a @code{section} 23208attribute. 23209 23210@item global 23211As for @samp{local}, but also generate GP-relative accesses for 23212small data objects that are external, weak, or common. If you use this option, 23213you must ensure that all parts of your program (including libraries) are 23214compiled with the same @option{-G} setting. 23215 23216@item data 23217Generate GP-relative accesses for all data objects in the program. If you 23218use this option, the entire data and BSS segments 23219of your program must fit in 64K of memory and you must use an appropriate 23220linker script to allocate them within the addressable range of the 23221global pointer. 23222 23223@item all 23224Generate GP-relative addresses for function pointers as well as data 23225pointers. If you use this option, the entire text, data, and BSS segments 23226of your program must fit in 64K of memory and you must use an appropriate 23227linker script to allocate them within the addressable range of the 23228global pointer. 23229 23230@end table 23231 23232@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 23233@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 23234 23235The default is @option{-mgpopt} except when @option{-fpic} or 23236@option{-fPIC} is specified to generate position-independent code. 23237Note that the Nios II ABI does not permit GP-relative accesses from 23238shared libraries. 23239 23240You may need to specify @option{-mno-gpopt} explicitly when building 23241programs that include large amounts of small data, including large 23242GOT data sections. In this case, the 16-bit offset for GP-relative 23243addressing may not be large enough to allow access to the entire 23244small data section. 23245 23246@item -mgprel-sec=@var{regexp} 23247@opindex mgprel-sec 23248This option specifies additional section names that can be accessed via 23249GP-relative addressing. It is most useful in conjunction with 23250@code{section} attributes on variable declarations 23251(@pxref{Common Variable Attributes}) and a custom linker script. 23252The @var{regexp} is a POSIX Extended Regular Expression. 23253 23254This option does not affect the behavior of the @option{-G} option, and 23255the specified sections are in addition to the standard @code{.sdata} 23256and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}. 23257 23258@item -mr0rel-sec=@var{regexp} 23259@opindex mr0rel-sec 23260This option specifies names of sections that can be accessed via a 2326116-bit offset from @code{r0}; that is, in the low 32K or high 32K 23262of the 32-bit address space. It is most useful in conjunction with 23263@code{section} attributes on variable declarations 23264(@pxref{Common Variable Attributes}) and a custom linker script. 23265The @var{regexp} is a POSIX Extended Regular Expression. 23266 23267In contrast to the use of GP-relative addressing for small data, 23268zero-based addressing is never generated by default and there are no 23269conventional section names used in standard linker scripts for sections 23270in the low or high areas of memory. 23271 23272@item -mel 23273@itemx -meb 23274@opindex mel 23275@opindex meb 23276Generate little-endian (default) or big-endian (experimental) code, 23277respectively. 23278 23279@item -march=@var{arch} 23280@opindex march 23281This specifies the name of the target Nios II architecture. GCC uses this 23282name to determine what kind of instructions it can emit when generating 23283assembly code. Permissible names are: @samp{r1}, @samp{r2}. 23284 23285The preprocessor macro @code{__nios2_arch__} is available to programs, 23286with value 1 or 2, indicating the targeted ISA level. 23287 23288@item -mbypass-cache 23289@itemx -mno-bypass-cache 23290@opindex mno-bypass-cache 23291@opindex mbypass-cache 23292Force all load and store instructions to always bypass cache by 23293using I/O variants of the instructions. The default is not to 23294bypass the cache. 23295 23296@item -mno-cache-volatile 23297@itemx -mcache-volatile 23298@opindex mcache-volatile 23299@opindex mno-cache-volatile 23300Volatile memory access bypass the cache using the I/O variants of 23301the load and store instructions. The default is not to bypass the cache. 23302 23303@item -mno-fast-sw-div 23304@itemx -mfast-sw-div 23305@opindex mno-fast-sw-div 23306@opindex mfast-sw-div 23307Do not use table-based fast divide for small numbers. The default 23308is to use the fast divide at @option{-O3} and above. 23309 23310@item -mno-hw-mul 23311@itemx -mhw-mul 23312@itemx -mno-hw-mulx 23313@itemx -mhw-mulx 23314@itemx -mno-hw-div 23315@itemx -mhw-div 23316@opindex mno-hw-mul 23317@opindex mhw-mul 23318@opindex mno-hw-mulx 23319@opindex mhw-mulx 23320@opindex mno-hw-div 23321@opindex mhw-div 23322Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 23323instructions by the compiler. The default is to emit @code{mul} 23324and not emit @code{div} and @code{mulx}. 23325 23326@item -mbmx 23327@itemx -mno-bmx 23328@itemx -mcdx 23329@itemx -mno-cdx 23330Enable or disable generation of Nios II R2 BMX (bit manipulation) and 23331CDX (code density) instructions. Enabling these instructions also 23332requires @option{-march=r2}. Since these instructions are optional 23333extensions to the R2 architecture, the default is not to emit them. 23334 23335@item -mcustom-@var{insn}=@var{N} 23336@itemx -mno-custom-@var{insn} 23337@opindex mcustom-@var{insn} 23338@opindex mno-custom-@var{insn} 23339Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 23340custom instruction with encoding @var{N} when generating code that uses 23341@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 23342instruction 253 for single-precision floating-point add operations instead 23343of the default behavior of using a library call. 23344 23345The following values of @var{insn} are supported. Except as otherwise 23346noted, floating-point operations are expected to be implemented with 23347normal IEEE 754 semantics and correspond directly to the C operators or the 23348equivalent GCC built-in functions (@pxref{Other Builtins}). 23349 23350Single-precision floating point: 23351@table @asis 23352 23353@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 23354Binary arithmetic operations. 23355 23356@item @samp{fnegs} 23357Unary negation. 23358 23359@item @samp{fabss} 23360Unary absolute value. 23361 23362@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 23363Comparison operations. 23364 23365@item @samp{fmins}, @samp{fmaxs} 23366Floating-point minimum and maximum. These instructions are only 23367generated if @option{-ffinite-math-only} is specified. 23368 23369@item @samp{fsqrts} 23370Unary square root operation. 23371 23372@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 23373Floating-point trigonometric and exponential functions. These instructions 23374are only generated if @option{-funsafe-math-optimizations} is also specified. 23375 23376@end table 23377 23378Double-precision floating point: 23379@table @asis 23380 23381@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 23382Binary arithmetic operations. 23383 23384@item @samp{fnegd} 23385Unary negation. 23386 23387@item @samp{fabsd} 23388Unary absolute value. 23389 23390@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 23391Comparison operations. 23392 23393@item @samp{fmind}, @samp{fmaxd} 23394Double-precision minimum and maximum. These instructions are only 23395generated if @option{-ffinite-math-only} is specified. 23396 23397@item @samp{fsqrtd} 23398Unary square root operation. 23399 23400@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 23401Double-precision trigonometric and exponential functions. These instructions 23402are only generated if @option{-funsafe-math-optimizations} is also specified. 23403 23404@end table 23405 23406Conversions: 23407@table @asis 23408@item @samp{fextsd} 23409Conversion from single precision to double precision. 23410 23411@item @samp{ftruncds} 23412Conversion from double precision to single precision. 23413 23414@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 23415Conversion from floating point to signed or unsigned integer types, with 23416truncation towards zero. 23417 23418@item @samp{round} 23419Conversion from single-precision floating point to signed integer, 23420rounding to the nearest integer and ties away from zero. 23421This corresponds to the @code{__builtin_lroundf} function when 23422@option{-fno-math-errno} is used. 23423 23424@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 23425Conversion from signed or unsigned integer types to floating-point types. 23426 23427@end table 23428 23429In addition, all of the following transfer instructions for internal 23430registers X and Y must be provided to use any of the double-precision 23431floating-point instructions. Custom instructions taking two 23432double-precision source operands expect the first operand in the 2343364-bit register X. The other operand (or only operand of a unary 23434operation) is given to the custom arithmetic instruction with the 23435least significant half in source register @var{src1} and the most 23436significant half in @var{src2}. A custom instruction that returns a 23437double-precision result returns the most significant 32 bits in the 23438destination register and the other half in 32-bit register Y. 23439GCC automatically generates the necessary code sequences to write 23440register X and/or read register Y when double-precision floating-point 23441instructions are used. 23442 23443@table @asis 23444 23445@item @samp{fwrx} 23446Write @var{src1} into the least significant half of X and @var{src2} into 23447the most significant half of X. 23448 23449@item @samp{fwry} 23450Write @var{src1} into Y. 23451 23452@item @samp{frdxhi}, @samp{frdxlo} 23453Read the most or least (respectively) significant half of X and store it in 23454@var{dest}. 23455 23456@item @samp{frdy} 23457Read the value of Y and store it into @var{dest}. 23458@end table 23459 23460Note that you can gain more local control over generation of Nios II custom 23461instructions by using the @code{target("custom-@var{insn}=@var{N}")} 23462and @code{target("no-custom-@var{insn}")} function attributes 23463(@pxref{Function Attributes}) 23464or pragmas (@pxref{Function Specific Option Pragmas}). 23465 23466@item -mcustom-fpu-cfg=@var{name} 23467@opindex mcustom-fpu-cfg 23468 23469This option enables a predefined, named set of custom instruction encodings 23470(see @option{-mcustom-@var{insn}} above). 23471Currently, the following sets are defined: 23472 23473@option{-mcustom-fpu-cfg=60-1} is equivalent to: 23474@gccoptlist{-mcustom-fmuls=252 @gol 23475-mcustom-fadds=253 @gol 23476-mcustom-fsubs=254 @gol 23477-fsingle-precision-constant} 23478 23479@option{-mcustom-fpu-cfg=60-2} is equivalent to: 23480@gccoptlist{-mcustom-fmuls=252 @gol 23481-mcustom-fadds=253 @gol 23482-mcustom-fsubs=254 @gol 23483-mcustom-fdivs=255 @gol 23484-fsingle-precision-constant} 23485 23486@option{-mcustom-fpu-cfg=72-3} is equivalent to: 23487@gccoptlist{-mcustom-floatus=243 @gol 23488-mcustom-fixsi=244 @gol 23489-mcustom-floatis=245 @gol 23490-mcustom-fcmpgts=246 @gol 23491-mcustom-fcmples=249 @gol 23492-mcustom-fcmpeqs=250 @gol 23493-mcustom-fcmpnes=251 @gol 23494-mcustom-fmuls=252 @gol 23495-mcustom-fadds=253 @gol 23496-mcustom-fsubs=254 @gol 23497-mcustom-fdivs=255 @gol 23498-fsingle-precision-constant} 23499 23500Custom instruction assignments given by individual 23501@option{-mcustom-@var{insn}=} options override those given by 23502@option{-mcustom-fpu-cfg=}, regardless of the 23503order of the options on the command line. 23504 23505Note that you can gain more local control over selection of a FPU 23506configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 23507function attribute (@pxref{Function Attributes}) 23508or pragma (@pxref{Function Specific Option Pragmas}). 23509 23510@end table 23511 23512These additional @samp{-m} options are available for the Altera Nios II 23513ELF (bare-metal) target: 23514 23515@table @gcctabopt 23516 23517@item -mhal 23518@opindex mhal 23519Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 23520startup and termination code, and is typically used in conjunction with 23521@option{-msys-crt0=} to specify the location of the alternate startup code 23522provided by the HAL BSP. 23523 23524@item -msmallc 23525@opindex msmallc 23526Link with a limited version of the C library, @option{-lsmallc}, rather than 23527Newlib. 23528 23529@item -msys-crt0=@var{startfile} 23530@opindex msys-crt0 23531@var{startfile} is the file name of the startfile (crt0) to use 23532when linking. This option is only useful in conjunction with @option{-mhal}. 23533 23534@item -msys-lib=@var{systemlib} 23535@opindex msys-lib 23536@var{systemlib} is the library name of the library that provides 23537low-level system calls required by the C library, 23538e.g.@: @code{read} and @code{write}. 23539This option is typically used to link with a library provided by a HAL BSP. 23540 23541@end table 23542 23543@node Nvidia PTX Options 23544@subsection Nvidia PTX Options 23545@cindex Nvidia PTX options 23546@cindex nvptx options 23547 23548These options are defined for Nvidia PTX: 23549 23550@table @gcctabopt 23551 23552@item -m32 23553@itemx -m64 23554@opindex m32 23555@opindex m64 23556Generate code for 32-bit or 64-bit ABI. 23557 23558@item -misa=@var{ISA-string} 23559@opindex march 23560Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA 23561strings must be lower-case. Valid ISA strings include @samp{sm_30} and 23562@samp{sm_35}. The default ISA is sm_30. 23563 23564@item -mmainkernel 23565@opindex mmainkernel 23566Link in code for a __main kernel. This is for stand-alone instead of 23567offloading execution. 23568 23569@item -moptimize 23570@opindex moptimize 23571Apply partitioned execution optimizations. This is the default when any 23572level of optimization is selected. 23573 23574@item -msoft-stack 23575@opindex msoft-stack 23576Generate code that does not use @code{.local} memory 23577directly for stack storage. Instead, a per-warp stack pointer is 23578maintained explicitly. This enables variable-length stack allocation (with 23579variable-length arrays or @code{alloca}), and when global memory is used for 23580underlying storage, makes it possible to access automatic variables from other 23581threads, or with atomic instructions. This code generation variant is used 23582for OpenMP offloading, but the option is exposed on its own for the purpose 23583of testing the compiler; to generate code suitable for linking into programs 23584using OpenMP offloading, use option @option{-mgomp}. 23585 23586@item -muniform-simt 23587@opindex muniform-simt 23588Switch to code generation variant that allows to execute all threads in each 23589warp, while maintaining memory state and side effects as if only one thread 23590in each warp was active outside of OpenMP SIMD regions. All atomic operations 23591and calls to runtime (malloc, free, vprintf) are conditionally executed (iff 23592current lane index equals the master lane index), and the register being 23593assigned is copied via a shuffle instruction from the master lane. Outside of 23594SIMD regions lane 0 is the master; inside, each thread sees itself as the 23595master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or 23596all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD 23597regions). Each thread can bitwise-and the bitmask at position @code{tid.y} 23598with current lane index to compute the master lane index. 23599 23600@item -mgomp 23601@opindex mgomp 23602Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and 23603@option{-muniform-simt} options, and selects corresponding multilib variant. 23604 23605@end table 23606 23607@node OpenRISC Options 23608@subsection OpenRISC Options 23609@cindex OpenRISC Options 23610 23611These options are defined for OpenRISC: 23612 23613@table @gcctabopt 23614 23615@item -mboard=@var{name} 23616@opindex mboard 23617Configure a board specific runtime. This will be passed to the linker for 23618newlib board library linking. The default is @code{or1ksim}. 23619 23620@item -mnewlib 23621@opindex mnewlib 23622For compatibility, it's always newlib for elf now. 23623 23624@item -mhard-div 23625@opindex mhard-div 23626Generate code for hardware which supports divide instructions. This is the 23627default. 23628 23629@item -mhard-mul 23630@opindex mhard-mul 23631Generate code for hardware which supports multiply instructions. This is the 23632default. 23633 23634@item -mcmov 23635@opindex mcmov 23636Generate code for hardware which supports the conditional move (@code{l.cmov}) 23637instruction. 23638 23639@item -mror 23640@opindex mror 23641Generate code for hardware which supports rotate right instructions. 23642 23643@item -msext 23644@opindex msext 23645Generate code for hardware which supports sign-extension instructions. 23646 23647@item -msfimm 23648@opindex msfimm 23649Generate code for hardware which supports set flag immediate (@code{l.sf*i}) 23650instructions. 23651 23652@item -mshftimm 23653@opindex mshftimm 23654Generate code for hardware which supports shift immediate related instructions 23655(i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to 23656enable generation of the @code{l.rori} instruction the @option{-mror} flag must 23657also be specified. 23658 23659@item -msoft-div 23660@opindex msoft-div 23661Generate code for hardware which requires divide instruction emulation. 23662 23663@item -msoft-mul 23664@opindex msoft-mul 23665Generate code for hardware which requires multiply instruction emulation. 23666 23667@end table 23668 23669@node PDP-11 Options 23670@subsection PDP-11 Options 23671@cindex PDP-11 Options 23672 23673These options are defined for the PDP-11: 23674 23675@table @gcctabopt 23676@item -mfpu 23677@opindex mfpu 23678Use hardware FPP floating point. This is the default. (FIS floating 23679point on the PDP-11/40 is not supported.) Implies -m45. 23680 23681@item -msoft-float 23682@opindex msoft-float 23683Do not use hardware floating point. 23684 23685@item -mac0 23686@opindex mac0 23687Return floating-point results in ac0 (fr0 in Unix assembler syntax). 23688 23689@item -mno-ac0 23690@opindex mno-ac0 23691Return floating-point results in memory. This is the default. 23692 23693@item -m40 23694@opindex m40 23695Generate code for a PDP-11/40. Implies -msoft-float -mno-split. 23696 23697@item -m45 23698@opindex m45 23699Generate code for a PDP-11/45. This is the default. 23700 23701@item -m10 23702@opindex m10 23703Generate code for a PDP-11/10. Implies -msoft-float -mno-split. 23704 23705@item -mint16 23706@itemx -mno-int32 23707@opindex mint16 23708@opindex mno-int32 23709Use 16-bit @code{int}. This is the default. 23710 23711@item -mint32 23712@itemx -mno-int16 23713@opindex mint32 23714@opindex mno-int16 23715Use 32-bit @code{int}. 23716 23717@item -msplit 23718@opindex msplit 23719Target has split instruction and data space. Implies -m45. 23720 23721@item -munix-asm 23722@opindex munix-asm 23723Use Unix assembler syntax. 23724 23725@item -mdec-asm 23726@opindex mdec-asm 23727Use DEC assembler syntax. 23728 23729@item -mgnu-asm 23730@opindex mgnu-asm 23731Use GNU assembler syntax. This is the default. 23732 23733@item -mlra 23734@opindex mlra 23735Use the new LRA register allocator. By default, the old ``reload'' 23736allocator is used. 23737@end table 23738 23739@node picoChip Options 23740@subsection picoChip Options 23741@cindex picoChip options 23742 23743These @samp{-m} options are defined for picoChip implementations: 23744 23745@table @gcctabopt 23746 23747@item -mae=@var{ae_type} 23748@opindex mcpu 23749Set the instruction set, register set, and instruction scheduling 23750parameters for array element type @var{ae_type}. Supported values 23751for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 23752 23753@option{-mae=ANY} selects a completely generic AE type. Code 23754generated with this option runs on any of the other AE types. The 23755code is not as efficient as it would be if compiled for a specific 23756AE type, and some types of operation (e.g., multiplication) do not 23757work properly on all types of AE. 23758 23759@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 23760for compiled code, and is the default. 23761 23762@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 23763option may suffer from poor performance of byte (char) manipulation, 23764since the DSP AE does not provide hardware support for byte load/stores. 23765 23766@item -msymbol-as-address 23767Enable the compiler to directly use a symbol name as an address in a 23768load/store instruction, without first loading it into a 23769register. Typically, the use of this option generates larger 23770programs, which run faster than when the option isn't used. However, the 23771results vary from program to program, so it is left as a user option, 23772rather than being permanently enabled. 23773 23774@item -mno-inefficient-warnings 23775Disables warnings about the generation of inefficient code. These 23776warnings can be generated, for example, when compiling code that 23777performs byte-level memory operations on the MAC AE type. The MAC AE has 23778no hardware support for byte-level memory operations, so all byte 23779load/stores must be synthesized from word load/store operations. This is 23780inefficient and a warning is generated to indicate 23781that you should rewrite the code to avoid byte operations, or to target 23782an AE type that has the necessary hardware support. This option disables 23783these warnings. 23784 23785@end table 23786 23787@node PowerPC Options 23788@subsection PowerPC Options 23789@cindex PowerPC options 23790 23791These are listed under @xref{RS/6000 and PowerPC Options}. 23792 23793@node RISC-V Options 23794@subsection RISC-V Options 23795@cindex RISC-V Options 23796 23797These command-line options are defined for RISC-V targets: 23798 23799@table @gcctabopt 23800@item -mbranch-cost=@var{n} 23801@opindex mbranch-cost 23802Set the cost of branches to roughly @var{n} instructions. 23803 23804@item -mplt 23805@itemx -mno-plt 23806@opindex plt 23807When generating PIC code, do or don't allow the use of PLTs. Ignored for 23808non-PIC. The default is @option{-mplt}. 23809 23810@item -mabi=@var{ABI-string} 23811@opindex mabi 23812Specify integer and floating-point calling convention. @var{ABI-string} 23813contains two parts: the size of integer types and the registers used for 23814floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that 23815@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be 2381632-bit), and that floating-point values up to 64 bits wide are passed in F 23817registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still 23818allows the compiler to generate code that uses the F and D extensions but only 23819allows floating-point values up to 32 bits long to be passed in registers; or 23820@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be 23821passed in registers. 23822 23823The default for this argument is system dependent, users who want a specific 23824calling convention should specify one explicitly. The valid calling 23825conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64}, 23826@samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to 23827implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is 23828invalid because the ABI requires 64-bit values be passed in F registers, but F 23829registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can 23830only be used with the @samp{rv32e} architecture. This ABI is not well 23831specified at present, and is subject to change. 23832 23833@item -mfdiv 23834@itemx -mno-fdiv 23835@opindex mfdiv 23836Do or don't use hardware floating-point divide and square root instructions. 23837This requires the F or D extensions for floating-point registers. The default 23838is to use them if the specified architecture has these instructions. 23839 23840@item -mdiv 23841@itemx -mno-div 23842@opindex mdiv 23843Do or don't use hardware instructions for integer division. This requires the 23844M extension. The default is to use them if the specified architecture has 23845these instructions. 23846 23847@item -march=@var{ISA-string} 23848@opindex march 23849Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be 23850lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and 23851@samp{rv32imaf}. 23852 23853@item -mtune=@var{processor-string} 23854@opindex mtune 23855Optimize the output for the given processor, specified by microarchitecture 23856name. Permissible values for this option are: @samp{rocket}, 23857@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series}, 23858and @samp{size}. 23859 23860When @option{-mtune=} is not specified, the default is @samp{rocket}. 23861 23862The @samp{size} choice is not intended for use by end-users. This is used 23863when @option{-Os} is specified. It overrides the instruction cost info 23864provided by @option{-mtune=}, but does not override the pipeline info. This 23865helps reduce code size while still giving good performance. 23866 23867@item -mpreferred-stack-boundary=@var{num} 23868@opindex mpreferred-stack-boundary 23869Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 23870byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 23871the default is 4 (16 bytes or 128-bits). 23872 23873@strong{Warning:} If you use this switch, then you must build all modules with 23874the same value, including any libraries. This includes the system libraries 23875and startup modules. 23876 23877@item -msmall-data-limit=@var{n} 23878@opindex msmall-data-limit 23879Put global and static data smaller than @var{n} bytes into a special section 23880(on some targets). 23881 23882@item -msave-restore 23883@itemx -mno-save-restore 23884@opindex msave-restore 23885Do or don't use smaller but slower prologue and epilogue code that uses 23886library function calls. The default is to use fast inline prologues and 23887epilogues. 23888 23889@item -mstrict-align 23890@itemx -mno-strict-align 23891@opindex mstrict-align 23892Do not or do generate unaligned memory accesses. The default is set depending 23893on whether the processor we are optimizing for supports fast unaligned access 23894or not. 23895 23896@item -mcmodel=medlow 23897@opindex mcmodel=medlow 23898Generate code for the medium-low code model. The program and its statically 23899defined symbols must lie within a single 2 GiB address range and must lie 23900between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be 23901statically or dynamically linked. This is the default code model. 23902 23903@item -mcmodel=medany 23904@opindex mcmodel=medany 23905Generate code for the medium-any code model. The program and its statically 23906defined symbols must be within any single 2 GiB address range. Programs can be 23907statically or dynamically linked. 23908 23909@item -mexplicit-relocs 23910@itemx -mno-exlicit-relocs 23911Use or do not use assembler relocation operators when dealing with symbolic 23912addresses. The alternative is to use assembler macros instead, which may 23913limit optimization. 23914 23915@item -mrelax 23916@itemx -mno-relax 23917Take advantage of linker relaxations to reduce the number of instructions 23918required to materialize symbol addresses. The default is to take advantage of 23919linker relaxations. 23920 23921@item -memit-attribute 23922@itemx -mno-emit-attribute 23923Emit (do not emit) RISC-V attribute to record extra information into ELF 23924objects. This feature requires at least binutils 2.32. 23925@end table 23926 23927@node RL78 Options 23928@subsection RL78 Options 23929@cindex RL78 Options 23930 23931@table @gcctabopt 23932 23933@item -msim 23934@opindex msim 23935Links in additional target libraries to support operation within a 23936simulator. 23937 23938@item -mmul=none 23939@itemx -mmul=g10 23940@itemx -mmul=g13 23941@itemx -mmul=g14 23942@itemx -mmul=rl78 23943@opindex mmul 23944Specifies the type of hardware multiplication and division support to 23945be used. The simplest is @code{none}, which uses software for both 23946multiplication and division. This is the default. The @code{g13} 23947value is for the hardware multiply/divide peripheral found on the 23948RL78/G13 (S2 core) targets. The @code{g14} value selects the use of 23949the multiplication and division instructions supported by the RL78/G14 23950(S3 core) parts. The value @code{rl78} is an alias for @code{g14} and 23951the value @code{mg10} is an alias for @code{none}. 23952 23953In addition a C preprocessor macro is defined, based upon the setting 23954of this option. Possible values are: @code{__RL78_MUL_NONE__}, 23955@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}. 23956 23957@item -mcpu=g10 23958@itemx -mcpu=g13 23959@itemx -mcpu=g14 23960@itemx -mcpu=rl78 23961@opindex mcpu 23962Specifies the RL78 core to target. The default is the G14 core, also 23963known as an S3 core or just RL78. The G13 or S2 core does not have 23964multiply or divide instructions, instead it uses a hardware peripheral 23965for these operations. The G10 or S1 core does not have register 23966banks, so it uses a different calling convention. 23967 23968If this option is set it also selects the type of hardware multiply 23969support to use, unless this is overridden by an explicit 23970@option{-mmul=none} option on the command line. Thus specifying 23971@option{-mcpu=g13} enables the use of the G13 hardware multiply 23972peripheral and specifying @option{-mcpu=g10} disables the use of 23973hardware multiplications altogether. 23974 23975Note, although the RL78/G14 core is the default target, specifying 23976@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does 23977change the behavior of the toolchain since it also enables G14 23978hardware multiply support. If these options are not specified on the 23979command line then software multiplication routines will be used even 23980though the code targets the RL78 core. This is for backwards 23981compatibility with older toolchains which did not have hardware 23982multiply and divide support. 23983 23984In addition a C preprocessor macro is defined, based upon the setting 23985of this option. Possible values are: @code{__RL78_G10__}, 23986@code{__RL78_G13__} or @code{__RL78_G14__}. 23987 23988@item -mg10 23989@itemx -mg13 23990@itemx -mg14 23991@itemx -mrl78 23992@opindex mg10 23993@opindex mg13 23994@opindex mg14 23995@opindex mrl78 23996These are aliases for the corresponding @option{-mcpu=} option. They 23997are provided for backwards compatibility. 23998 23999@item -mallregs 24000@opindex mallregs 24001Allow the compiler to use all of the available registers. By default 24002registers @code{r24..r31} are reserved for use in interrupt handlers. 24003With this option enabled these registers can be used in ordinary 24004functions as well. 24005 24006@item -m64bit-doubles 24007@itemx -m32bit-doubles 24008@opindex m64bit-doubles 24009@opindex m32bit-doubles 24010Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 24011or 32 bits (@option{-m32bit-doubles}) in size. The default is 24012@option{-m32bit-doubles}. 24013 24014@item -msave-mduc-in-interrupts 24015@itemx -mno-save-mduc-in-interrupts 24016@opindex msave-mduc-in-interrupts 24017@opindex mno-save-mduc-in-interrupts 24018Specifies that interrupt handler functions should preserve the 24019MDUC registers. This is only necessary if normal code might use 24020the MDUC registers, for example because it performs multiplication 24021and division operations. The default is to ignore the MDUC registers 24022as this makes the interrupt handlers faster. The target option -mg13 24023needs to be passed for this to work as this feature is only available 24024on the G13 target (S2 core). The MDUC registers will only be saved 24025if the interrupt handler performs a multiplication or division 24026operation or it calls another function. 24027 24028@end table 24029 24030@node RS/6000 and PowerPC Options 24031@subsection IBM RS/6000 and PowerPC Options 24032@cindex RS/6000 and PowerPC Options 24033@cindex IBM RS/6000 and PowerPC Options 24034 24035These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 24036@table @gcctabopt 24037@item -mpowerpc-gpopt 24038@itemx -mno-powerpc-gpopt 24039@itemx -mpowerpc-gfxopt 24040@itemx -mno-powerpc-gfxopt 24041@need 800 24042@itemx -mpowerpc64 24043@itemx -mno-powerpc64 24044@itemx -mmfcrf 24045@itemx -mno-mfcrf 24046@itemx -mpopcntb 24047@itemx -mno-popcntb 24048@itemx -mpopcntd 24049@itemx -mno-popcntd 24050@itemx -mfprnd 24051@itemx -mno-fprnd 24052@need 800 24053@itemx -mcmpb 24054@itemx -mno-cmpb 24055@itemx -mmfpgpr 24056@itemx -mno-mfpgpr 24057@itemx -mhard-dfp 24058@itemx -mno-hard-dfp 24059@opindex mpowerpc-gpopt 24060@opindex mno-powerpc-gpopt 24061@opindex mpowerpc-gfxopt 24062@opindex mno-powerpc-gfxopt 24063@opindex mpowerpc64 24064@opindex mno-powerpc64 24065@opindex mmfcrf 24066@opindex mno-mfcrf 24067@opindex mpopcntb 24068@opindex mno-popcntb 24069@opindex mpopcntd 24070@opindex mno-popcntd 24071@opindex mfprnd 24072@opindex mno-fprnd 24073@opindex mcmpb 24074@opindex mno-cmpb 24075@opindex mmfpgpr 24076@opindex mno-mfpgpr 24077@opindex mhard-dfp 24078@opindex mno-hard-dfp 24079You use these options to specify which instructions are available on the 24080processor you are using. The default value of these options is 24081determined when configuring GCC@. Specifying the 24082@option{-mcpu=@var{cpu_type}} overrides the specification of these 24083options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 24084rather than the options listed above. 24085 24086Specifying @option{-mpowerpc-gpopt} allows 24087GCC to use the optional PowerPC architecture instructions in the 24088General Purpose group, including floating-point square root. Specifying 24089@option{-mpowerpc-gfxopt} allows GCC to 24090use the optional PowerPC architecture instructions in the Graphics 24091group, including floating-point select. 24092 24093The @option{-mmfcrf} option allows GCC to generate the move from 24094condition register field instruction implemented on the POWER4 24095processor and other processors that support the PowerPC V2.01 24096architecture. 24097The @option{-mpopcntb} option allows GCC to generate the popcount and 24098double-precision FP reciprocal estimate instruction implemented on the 24099POWER5 processor and other processors that support the PowerPC V2.02 24100architecture. 24101The @option{-mpopcntd} option allows GCC to generate the popcount 24102instruction implemented on the POWER7 processor and other processors 24103that support the PowerPC V2.06 architecture. 24104The @option{-mfprnd} option allows GCC to generate the FP round to 24105integer instructions implemented on the POWER5+ processor and other 24106processors that support the PowerPC V2.03 architecture. 24107The @option{-mcmpb} option allows GCC to generate the compare bytes 24108instruction implemented on the POWER6 processor and other processors 24109that support the PowerPC V2.05 architecture. 24110The @option{-mmfpgpr} option allows GCC to generate the FP move to/from 24111general-purpose register instructions implemented on the POWER6X 24112processor and other processors that support the extended PowerPC V2.05 24113architecture. 24114The @option{-mhard-dfp} option allows GCC to generate the decimal 24115floating-point instructions implemented on some POWER processors. 24116 24117The @option{-mpowerpc64} option allows GCC to generate the additional 2411864-bit instructions that are found in the full PowerPC64 architecture 24119and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 24120@option{-mno-powerpc64}. 24121 24122@item -mcpu=@var{cpu_type} 24123@opindex mcpu 24124Set architecture type, register usage, and 24125instruction scheduling parameters for machine type @var{cpu_type}. 24126Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 24127@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 24128@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 24129@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 24130@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 24131@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 24132@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 24133@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 24134@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 24135@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, 24136@samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le}, 24137@samp{rs64}, and @samp{native}. 24138 24139@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 24140@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 24141endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 24142architecture machine types, with an appropriate, generic processor 24143model assumed for scheduling purposes. 24144 24145Specifying @samp{native} as cpu type detects and selects the 24146architecture option that corresponds to the host processor of the 24147system performing the compilation. 24148@option{-mcpu=native} has no effect if GCC does not recognize the 24149processor. 24150 24151The other options specify a specific processor. Code generated under 24152those options runs best on that processor, and may not run at all on 24153others. 24154 24155The @option{-mcpu} options automatically enable or disable the 24156following options: 24157 24158@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 24159-mpopcntb -mpopcntd -mpowerpc64 @gol 24160-mpowerpc-gpopt -mpowerpc-gfxopt @gol 24161-mmulhw -mdlmzb -mmfpgpr -mvsx @gol 24162-mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol 24163-mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware} 24164 24165The particular options set for any particular CPU varies between 24166compiler versions, depending on what setting seems to produce optimal 24167code for that CPU; it doesn't necessarily reflect the actual hardware's 24168capabilities. If you wish to set an individual option to a particular 24169value, you may specify it after the @option{-mcpu} option, like 24170@option{-mcpu=970 -mno-altivec}. 24171 24172On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 24173not enabled or disabled by the @option{-mcpu} option at present because 24174AIX does not have full support for these options. You may still 24175enable or disable them individually if you're sure it'll work in your 24176environment. 24177 24178@item -mtune=@var{cpu_type} 24179@opindex mtune 24180Set the instruction scheduling parameters for machine type 24181@var{cpu_type}, but do not set the architecture type or register usage, 24182as @option{-mcpu=@var{cpu_type}} does. The same 24183values for @var{cpu_type} are used for @option{-mtune} as for 24184@option{-mcpu}. If both are specified, the code generated uses the 24185architecture and registers set by @option{-mcpu}, but the 24186scheduling parameters set by @option{-mtune}. 24187 24188@item -mcmodel=small 24189@opindex mcmodel=small 24190Generate PowerPC64 code for the small model: The TOC is limited to 2419164k. 24192 24193@item -mcmodel=medium 24194@opindex mcmodel=medium 24195Generate PowerPC64 code for the medium model: The TOC and other static 24196data may be up to a total of 4G in size. This is the default for 64-bit 24197Linux. 24198 24199@item -mcmodel=large 24200@opindex mcmodel=large 24201Generate PowerPC64 code for the large model: The TOC may be up to 4G 24202in size. Other data and code is only limited by the 64-bit address 24203space. 24204 24205@item -maltivec 24206@itemx -mno-altivec 24207@opindex maltivec 24208@opindex mno-altivec 24209Generate code that uses (does not use) AltiVec instructions, and also 24210enable the use of built-in functions that allow more direct access to 24211the AltiVec instruction set. You may also need to set 24212@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 24213enhancements. 24214 24215When @option{-maltivec} is used, the element order for AltiVec intrinsics 24216such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 24217match array element order corresponding to the endianness of the 24218target. That is, element zero identifies the leftmost element in a 24219vector register when targeting a big-endian platform, and identifies 24220the rightmost element in a vector register when targeting a 24221little-endian platform. 24222 24223@item -mvrsave 24224@itemx -mno-vrsave 24225@opindex mvrsave 24226@opindex mno-vrsave 24227Generate VRSAVE instructions when generating AltiVec code. 24228 24229@item -msecure-plt 24230@opindex msecure-plt 24231Generate code that allows @command{ld} and @command{ld.so} 24232to build executables and shared 24233libraries with non-executable @code{.plt} and @code{.got} sections. 24234This is a PowerPC 2423532-bit SYSV ABI option. 24236 24237@item -mbss-plt 24238@opindex mbss-plt 24239Generate code that uses a BSS @code{.plt} section that @command{ld.so} 24240fills in, and 24241requires @code{.plt} and @code{.got} 24242sections that are both writable and executable. 24243This is a PowerPC 32-bit SYSV ABI option. 24244 24245@item -misel 24246@itemx -mno-isel 24247@opindex misel 24248@opindex mno-isel 24249This switch enables or disables the generation of ISEL instructions. 24250 24251@item -mvsx 24252@itemx -mno-vsx 24253@opindex mvsx 24254@opindex mno-vsx 24255Generate code that uses (does not use) vector/scalar (VSX) 24256instructions, and also enable the use of built-in functions that allow 24257more direct access to the VSX instruction set. 24258 24259@item -mcrypto 24260@itemx -mno-crypto 24261@opindex mcrypto 24262@opindex mno-crypto 24263Enable the use (disable) of the built-in functions that allow direct 24264access to the cryptographic instructions that were added in version 242652.07 of the PowerPC ISA. 24266 24267@item -mhtm 24268@itemx -mno-htm 24269@opindex mhtm 24270@opindex mno-htm 24271Enable (disable) the use of the built-in functions that allow direct 24272access to the Hardware Transactional Memory (HTM) instructions that 24273were added in version 2.07 of the PowerPC ISA. 24274 24275@item -mpower8-fusion 24276@itemx -mno-power8-fusion 24277@opindex mpower8-fusion 24278@opindex mno-power8-fusion 24279Generate code that keeps (does not keeps) some integer operations 24280adjacent so that the instructions can be fused together on power8 and 24281later processors. 24282 24283@item -mpower8-vector 24284@itemx -mno-power8-vector 24285@opindex mpower8-vector 24286@opindex mno-power8-vector 24287Generate code that uses (does not use) the vector and scalar 24288instructions that were added in version 2.07 of the PowerPC ISA. Also 24289enable the use of built-in functions that allow more direct access to 24290the vector instructions. 24291 24292@item -mquad-memory 24293@itemx -mno-quad-memory 24294@opindex mquad-memory 24295@opindex mno-quad-memory 24296Generate code that uses (does not use) the non-atomic quad word memory 24297instructions. The @option{-mquad-memory} option requires use of 2429864-bit mode. 24299 24300@item -mquad-memory-atomic 24301@itemx -mno-quad-memory-atomic 24302@opindex mquad-memory-atomic 24303@opindex mno-quad-memory-atomic 24304Generate code that uses (does not use) the atomic quad word memory 24305instructions. The @option{-mquad-memory-atomic} option requires use of 2430664-bit mode. 24307 24308@item -mfloat128 24309@itemx -mno-float128 24310@opindex mfloat128 24311@opindex mno-float128 24312Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point 24313and use either software emulation for IEEE 128-bit floating point or 24314hardware instructions. 24315 24316The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, 24317@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to 24318use the IEEE 128-bit floating point support. The IEEE 128-bit 24319floating point support only works on PowerPC Linux systems. 24320 24321The default for @option{-mfloat128} is enabled on PowerPC Linux 24322systems using the VSX instruction set, and disabled on other systems. 24323 24324If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or 24325@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating 24326point support will also enable the generation of ISA 3.0 IEEE 128-bit 24327floating point instructions. Otherwise, if you do not specify to 24328generate ISA 3.0 instructions or you are targeting a 32-bit big endian 24329system, IEEE 128-bit floating point will be done with software 24330emulation. 24331 24332@item -mfloat128-hardware 24333@itemx -mno-float128-hardware 24334@opindex mfloat128-hardware 24335@opindex mno-float128-hardware 24336Enable/disable using ISA 3.0 hardware instructions to support the 24337@var{__float128} data type. 24338 24339The default for @option{-mfloat128-hardware} is enabled on PowerPC 24340Linux systems using the ISA 3.0 instruction set, and disabled on other 24341systems. 24342 24343@item -m32 24344@itemx -m64 24345@opindex m32 24346@opindex m64 24347Generate code for 32-bit or 64-bit environments of Darwin and SVR4 24348targets (including GNU/Linux). The 32-bit environment sets int, long 24349and pointer to 32 bits and generates code that runs on any PowerPC 24350variant. The 64-bit environment sets int to 32 bits and long and 24351pointer to 64 bits, and generates code for PowerPC64, as for 24352@option{-mpowerpc64}. 24353 24354@item -mfull-toc 24355@itemx -mno-fp-in-toc 24356@itemx -mno-sum-in-toc 24357@itemx -mminimal-toc 24358@opindex mfull-toc 24359@opindex mno-fp-in-toc 24360@opindex mno-sum-in-toc 24361@opindex mminimal-toc 24362Modify generation of the TOC (Table Of Contents), which is created for 24363every executable file. The @option{-mfull-toc} option is selected by 24364default. In that case, GCC allocates at least one TOC entry for 24365each unique non-automatic variable reference in your program. GCC 24366also places floating-point constants in the TOC@. However, only 2436716,384 entries are available in the TOC@. 24368 24369If you receive a linker error message that saying you have overflowed 24370the available TOC space, you can reduce the amount of TOC space used 24371with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 24372@option{-mno-fp-in-toc} prevents GCC from putting floating-point 24373constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 24374generate code to calculate the sum of an address and a constant at 24375run time instead of putting that sum into the TOC@. You may specify one 24376or both of these options. Each causes GCC to produce very slightly 24377slower and larger code at the expense of conserving TOC space. 24378 24379If you still run out of space in the TOC even when you specify both of 24380these options, specify @option{-mminimal-toc} instead. This option causes 24381GCC to make only one TOC entry for every file. When you specify this 24382option, GCC produces code that is slower and larger but which 24383uses extremely little TOC space. You may wish to use this option 24384only on files that contain less frequently-executed code. 24385 24386@item -maix64 24387@itemx -maix32 24388@opindex maix64 24389@opindex maix32 24390Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 24391@code{long} type, and the infrastructure needed to support them. 24392Specifying @option{-maix64} implies @option{-mpowerpc64}, 24393while @option{-maix32} disables the 64-bit ABI and 24394implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 24395 24396@item -mxl-compat 24397@itemx -mno-xl-compat 24398@opindex mxl-compat 24399@opindex mno-xl-compat 24400Produce code that conforms more closely to IBM XL compiler semantics 24401when using AIX-compatible ABI@. Pass floating-point arguments to 24402prototyped functions beyond the register save area (RSA) on the stack 24403in addition to argument FPRs. Do not assume that most significant 24404double in 128-bit long double value is properly rounded when comparing 24405values and converting to double. Use XL symbol names for long double 24406support routines. 24407 24408The AIX calling convention was extended but not initially documented to 24409handle an obscure K&R C case of calling a function that takes the 24410address of its arguments with fewer arguments than declared. IBM XL 24411compilers access floating-point arguments that do not fit in the 24412RSA from the stack when a subroutine is compiled without 24413optimization. Because always storing floating-point arguments on the 24414stack is inefficient and rarely needed, this option is not enabled by 24415default and only is necessary when calling subroutines compiled by IBM 24416XL compilers without optimization. 24417 24418@item -mpe 24419@opindex mpe 24420Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 24421application written to use message passing with special startup code to 24422enable the application to run. The system must have PE installed in the 24423standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 24424must be overridden with the @option{-specs=} option to specify the 24425appropriate directory location. The Parallel Environment does not 24426support threads, so the @option{-mpe} option and the @option{-pthread} 24427option are incompatible. 24428 24429@item -malign-natural 24430@itemx -malign-power 24431@opindex malign-natural 24432@opindex malign-power 24433On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 24434@option{-malign-natural} overrides the ABI-defined alignment of larger 24435types, such as floating-point doubles, on their natural size-based boundary. 24436The option @option{-malign-power} instructs GCC to follow the ABI-specified 24437alignment rules. GCC defaults to the standard alignment defined in the ABI@. 24438 24439On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 24440is not supported. 24441 24442@item -msoft-float 24443@itemx -mhard-float 24444@opindex msoft-float 24445@opindex mhard-float 24446Generate code that does not use (uses) the floating-point register set. 24447Software floating-point emulation is provided if you use the 24448@option{-msoft-float} option, and pass the option to GCC when linking. 24449 24450@item -mmultiple 24451@itemx -mno-multiple 24452@opindex mmultiple 24453@opindex mno-multiple 24454Generate code that uses (does not use) the load multiple word 24455instructions and the store multiple word instructions. These 24456instructions are generated by default on POWER systems, and not 24457generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 24458PowerPC systems, since those instructions do not work when the 24459processor is in little-endian mode. The exceptions are PPC740 and 24460PPC750 which permit these instructions in little-endian mode. 24461 24462@item -mupdate 24463@itemx -mno-update 24464@opindex mupdate 24465@opindex mno-update 24466Generate code that uses (does not use) the load or store instructions 24467that update the base register to the address of the calculated memory 24468location. These instructions are generated by default. If you use 24469@option{-mno-update}, there is a small window between the time that the 24470stack pointer is updated and the address of the previous frame is 24471stored, which means code that walks the stack frame across interrupts or 24472signals may get corrupted data. 24473 24474@item -mavoid-indexed-addresses 24475@itemx -mno-avoid-indexed-addresses 24476@opindex mavoid-indexed-addresses 24477@opindex mno-avoid-indexed-addresses 24478Generate code that tries to avoid (not avoid) the use of indexed load 24479or store instructions. These instructions can incur a performance 24480penalty on Power6 processors in certain situations, such as when 24481stepping through large arrays that cross a 16M boundary. This option 24482is enabled by default when targeting Power6 and disabled otherwise. 24483 24484@item -mfused-madd 24485@itemx -mno-fused-madd 24486@opindex mfused-madd 24487@opindex mno-fused-madd 24488Generate code that uses (does not use) the floating-point multiply and 24489accumulate instructions. These instructions are generated by default 24490if hardware floating point is used. The machine-dependent 24491@option{-mfused-madd} option is now mapped to the machine-independent 24492@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 24493mapped to @option{-ffp-contract=off}. 24494 24495@item -mmulhw 24496@itemx -mno-mulhw 24497@opindex mmulhw 24498@opindex mno-mulhw 24499Generate code that uses (does not use) the half-word multiply and 24500multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 24501These instructions are generated by default when targeting those 24502processors. 24503 24504@item -mdlmzb 24505@itemx -mno-dlmzb 24506@opindex mdlmzb 24507@opindex mno-dlmzb 24508Generate code that uses (does not use) the string-search @samp{dlmzb} 24509instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 24510generated by default when targeting those processors. 24511 24512@item -mno-bit-align 24513@itemx -mbit-align 24514@opindex mno-bit-align 24515@opindex mbit-align 24516On System V.4 and embedded PowerPC systems do not (do) force structures 24517and unions that contain bit-fields to be aligned to the base type of the 24518bit-field. 24519 24520For example, by default a structure containing nothing but 8 24521@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 24522boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 24523the structure is aligned to a 1-byte boundary and is 1 byte in 24524size. 24525 24526@item -mno-strict-align 24527@itemx -mstrict-align 24528@opindex mno-strict-align 24529@opindex mstrict-align 24530On System V.4 and embedded PowerPC systems do not (do) assume that 24531unaligned memory references are handled by the system. 24532 24533@item -mrelocatable 24534@itemx -mno-relocatable 24535@opindex mrelocatable 24536@opindex mno-relocatable 24537Generate code that allows (does not allow) a static executable to be 24538relocated to a different address at run time. A simple embedded 24539PowerPC system loader should relocate the entire contents of 24540@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 24541a table of 32-bit addresses generated by this option. For this to 24542work, all objects linked together must be compiled with 24543@option{-mrelocatable} or @option{-mrelocatable-lib}. 24544@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 24545 24546@item -mrelocatable-lib 24547@itemx -mno-relocatable-lib 24548@opindex mrelocatable-lib 24549@opindex mno-relocatable-lib 24550Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 24551@code{.fixup} section to allow static executables to be relocated at 24552run time, but @option{-mrelocatable-lib} does not use the smaller stack 24553alignment of @option{-mrelocatable}. Objects compiled with 24554@option{-mrelocatable-lib} may be linked with objects compiled with 24555any combination of the @option{-mrelocatable} options. 24556 24557@item -mno-toc 24558@itemx -mtoc 24559@opindex mno-toc 24560@opindex mtoc 24561On System V.4 and embedded PowerPC systems do not (do) assume that 24562register 2 contains a pointer to a global area pointing to the addresses 24563used in the program. 24564 24565@item -mlittle 24566@itemx -mlittle-endian 24567@opindex mlittle 24568@opindex mlittle-endian 24569On System V.4 and embedded PowerPC systems compile code for the 24570processor in little-endian mode. The @option{-mlittle-endian} option is 24571the same as @option{-mlittle}. 24572 24573@item -mbig 24574@itemx -mbig-endian 24575@opindex mbig 24576@opindex mbig-endian 24577On System V.4 and embedded PowerPC systems compile code for the 24578processor in big-endian mode. The @option{-mbig-endian} option is 24579the same as @option{-mbig}. 24580 24581@item -mdynamic-no-pic 24582@opindex mdynamic-no-pic 24583On Darwin and Mac OS X systems, compile code so that it is not 24584relocatable, but that its external references are relocatable. The 24585resulting code is suitable for applications, but not shared 24586libraries. 24587 24588@item -msingle-pic-base 24589@opindex msingle-pic-base 24590Treat the register used for PIC addressing as read-only, rather than 24591loading it in the prologue for each function. The runtime system is 24592responsible for initializing this register with an appropriate value 24593before execution begins. 24594 24595@item -mprioritize-restricted-insns=@var{priority} 24596@opindex mprioritize-restricted-insns 24597This option controls the priority that is assigned to 24598dispatch-slot restricted instructions during the second scheduling 24599pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 24600or @samp{2} to assign no, highest, or second-highest (respectively) 24601priority to dispatch-slot restricted 24602instructions. 24603 24604@item -msched-costly-dep=@var{dependence_type} 24605@opindex msched-costly-dep 24606This option controls which dependences are considered costly 24607by the target during instruction scheduling. The argument 24608@var{dependence_type} takes one of the following values: 24609 24610@table @asis 24611@item @samp{no} 24612No dependence is costly. 24613 24614@item @samp{all} 24615All dependences are costly. 24616 24617@item @samp{true_store_to_load} 24618A true dependence from store to load is costly. 24619 24620@item @samp{store_to_load} 24621Any dependence from store to load is costly. 24622 24623@item @var{number} 24624Any dependence for which the latency is greater than or equal to 24625@var{number} is costly. 24626@end table 24627 24628@item -minsert-sched-nops=@var{scheme} 24629@opindex minsert-sched-nops 24630This option controls which NOP insertion scheme is used during 24631the second scheduling pass. The argument @var{scheme} takes one of the 24632following values: 24633 24634@table @asis 24635@item @samp{no} 24636Don't insert NOPs. 24637 24638@item @samp{pad} 24639Pad with NOPs any dispatch group that has vacant issue slots, 24640according to the scheduler's grouping. 24641 24642@item @samp{regroup_exact} 24643Insert NOPs to force costly dependent insns into 24644separate groups. Insert exactly as many NOPs as needed to force an insn 24645to a new group, according to the estimated processor grouping. 24646 24647@item @var{number} 24648Insert NOPs to force costly dependent insns into 24649separate groups. Insert @var{number} NOPs to force an insn to a new group. 24650@end table 24651 24652@item -mcall-sysv 24653@opindex mcall-sysv 24654On System V.4 and embedded PowerPC systems compile code using calling 24655conventions that adhere to the March 1995 draft of the System V 24656Application Binary Interface, PowerPC processor supplement. This is the 24657default unless you configured GCC using @samp{powerpc-*-eabiaix}. 24658 24659@item -mcall-sysv-eabi 24660@itemx -mcall-eabi 24661@opindex mcall-sysv-eabi 24662@opindex mcall-eabi 24663Specify both @option{-mcall-sysv} and @option{-meabi} options. 24664 24665@item -mcall-sysv-noeabi 24666@opindex mcall-sysv-noeabi 24667Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 24668 24669@item -mcall-aixdesc 24670@opindex m 24671On System V.4 and embedded PowerPC systems compile code for the AIX 24672operating system. 24673 24674@item -mcall-linux 24675@opindex mcall-linux 24676On System V.4 and embedded PowerPC systems compile code for the 24677Linux-based GNU system. 24678 24679@item -mcall-freebsd 24680@opindex mcall-freebsd 24681On System V.4 and embedded PowerPC systems compile code for the 24682FreeBSD operating system. 24683 24684@item -mcall-netbsd 24685@opindex mcall-netbsd 24686On System V.4 and embedded PowerPC systems compile code for the 24687NetBSD operating system. 24688 24689@item -mcall-openbsd 24690@opindex mcall-netbsd 24691On System V.4 and embedded PowerPC systems compile code for the 24692OpenBSD operating system. 24693 24694@item -mtraceback=@var{traceback_type} 24695@opindex mtraceback 24696Select the type of traceback table. Valid values for @var{traceback_type} 24697are @samp{full}, @samp{part}, and @samp{no}. 24698 24699@item -maix-struct-return 24700@opindex maix-struct-return 24701Return all structures in memory (as specified by the AIX ABI)@. 24702 24703@item -msvr4-struct-return 24704@opindex msvr4-struct-return 24705Return structures smaller than 8 bytes in registers (as specified by the 24706SVR4 ABI)@. 24707 24708@item -mabi=@var{abi-type} 24709@opindex mabi 24710Extend the current ABI with a particular extension, or remove such extension. 24711Valid values are @samp{altivec}, @samp{no-altivec}, 24712@samp{ibmlongdouble}, @samp{ieeelongdouble}, 24713@samp{elfv1}, @samp{elfv2}@. 24714 24715@item -mabi=ibmlongdouble 24716@opindex mabi=ibmlongdouble 24717Change the current ABI to use IBM extended-precision long double. 24718This is not likely to work if your system defaults to using IEEE 24719extended-precision long double. If you change the long double type 24720from IEEE extended-precision, the compiler will issue a warning unless 24721you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 24722to be enabled. 24723 24724@item -mabi=ieeelongdouble 24725@opindex mabi=ieeelongdouble 24726Change the current ABI to use IEEE extended-precision long double. 24727This is not likely to work if your system defaults to using IBM 24728extended-precision long double. If you change the long double type 24729from IBM extended-precision, the compiler will issue a warning unless 24730you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 24731to be enabled. 24732 24733@item -mabi=elfv1 24734@opindex mabi=elfv1 24735Change the current ABI to use the ELFv1 ABI. 24736This is the default ABI for big-endian PowerPC 64-bit Linux. 24737Overriding the default ABI requires special system support and is 24738likely to fail in spectacular ways. 24739 24740@item -mabi=elfv2 24741@opindex mabi=elfv2 24742Change the current ABI to use the ELFv2 ABI. 24743This is the default ABI for little-endian PowerPC 64-bit Linux. 24744Overriding the default ABI requires special system support and is 24745likely to fail in spectacular ways. 24746 24747@item -mgnu-attribute 24748@itemx -mno-gnu-attribute 24749@opindex mgnu-attribute 24750@opindex mno-gnu-attribute 24751Emit .gnu_attribute assembly directives to set tag/value pairs in a 24752.gnu.attributes section that specify ABI variations in function 24753parameters or return values. 24754 24755@item -mprototype 24756@itemx -mno-prototype 24757@opindex mprototype 24758@opindex mno-prototype 24759On System V.4 and embedded PowerPC systems assume that all calls to 24760variable argument functions are properly prototyped. Otherwise, the 24761compiler must insert an instruction before every non-prototyped call to 24762set or clear bit 6 of the condition code register (@code{CR}) to 24763indicate whether floating-point values are passed in the floating-point 24764registers in case the function takes variable arguments. With 24765@option{-mprototype}, only calls to prototyped variable argument functions 24766set or clear the bit. 24767 24768@item -msim 24769@opindex msim 24770On embedded PowerPC systems, assume that the startup module is called 24771@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 24772@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 24773configurations. 24774 24775@item -mmvme 24776@opindex mmvme 24777On embedded PowerPC systems, assume that the startup module is called 24778@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 24779@file{libc.a}. 24780 24781@item -mads 24782@opindex mads 24783On embedded PowerPC systems, assume that the startup module is called 24784@file{crt0.o} and the standard C libraries are @file{libads.a} and 24785@file{libc.a}. 24786 24787@item -myellowknife 24788@opindex myellowknife 24789On embedded PowerPC systems, assume that the startup module is called 24790@file{crt0.o} and the standard C libraries are @file{libyk.a} and 24791@file{libc.a}. 24792 24793@item -mvxworks 24794@opindex mvxworks 24795On System V.4 and embedded PowerPC systems, specify that you are 24796compiling for a VxWorks system. 24797 24798@item -memb 24799@opindex memb 24800On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 24801header to indicate that @samp{eabi} extended relocations are used. 24802 24803@item -meabi 24804@itemx -mno-eabi 24805@opindex meabi 24806@opindex mno-eabi 24807On System V.4 and embedded PowerPC systems do (do not) adhere to the 24808Embedded Applications Binary Interface (EABI), which is a set of 24809modifications to the System V.4 specifications. Selecting @option{-meabi} 24810means that the stack is aligned to an 8-byte boundary, a function 24811@code{__eabi} is called from @code{main} to set up the EABI 24812environment, and the @option{-msdata} option can use both @code{r2} and 24813@code{r13} to point to two separate small data areas. Selecting 24814@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 24815no EABI initialization function is called from @code{main}, and the 24816@option{-msdata} option only uses @code{r13} to point to a single 24817small data area. The @option{-meabi} option is on by default if you 24818configured GCC using one of the @samp{powerpc*-*-eabi*} options. 24819 24820@item -msdata=eabi 24821@opindex msdata=eabi 24822On System V.4 and embedded PowerPC systems, put small initialized 24823@code{const} global and static data in the @code{.sdata2} section, which 24824is pointed to by register @code{r2}. Put small initialized 24825non-@code{const} global and static data in the @code{.sdata} section, 24826which is pointed to by register @code{r13}. Put small uninitialized 24827global and static data in the @code{.sbss} section, which is adjacent to 24828the @code{.sdata} section. The @option{-msdata=eabi} option is 24829incompatible with the @option{-mrelocatable} option. The 24830@option{-msdata=eabi} option also sets the @option{-memb} option. 24831 24832@item -msdata=sysv 24833@opindex msdata=sysv 24834On System V.4 and embedded PowerPC systems, put small global and static 24835data in the @code{.sdata} section, which is pointed to by register 24836@code{r13}. Put small uninitialized global and static data in the 24837@code{.sbss} section, which is adjacent to the @code{.sdata} section. 24838The @option{-msdata=sysv} option is incompatible with the 24839@option{-mrelocatable} option. 24840 24841@item -msdata=default 24842@itemx -msdata 24843@opindex msdata=default 24844@opindex msdata 24845On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 24846compile code the same as @option{-msdata=eabi}, otherwise compile code the 24847same as @option{-msdata=sysv}. 24848 24849@item -msdata=data 24850@opindex msdata=data 24851On System V.4 and embedded PowerPC systems, put small global 24852data in the @code{.sdata} section. Put small uninitialized global 24853data in the @code{.sbss} section. Do not use register @code{r13} 24854to address small data however. This is the default behavior unless 24855other @option{-msdata} options are used. 24856 24857@item -msdata=none 24858@itemx -mno-sdata 24859@opindex msdata=none 24860@opindex mno-sdata 24861On embedded PowerPC systems, put all initialized global and static data 24862in the @code{.data} section, and all uninitialized data in the 24863@code{.bss} section. 24864 24865@item -mreadonly-in-sdata 24866@opindex mreadonly-in-sdata 24867@opindex mno-readonly-in-sdata 24868Put read-only objects in the @code{.sdata} section as well. This is the 24869default. 24870 24871@item -mblock-move-inline-limit=@var{num} 24872@opindex mblock-move-inline-limit 24873Inline all block moves (such as calls to @code{memcpy} or structure 24874copies) less than or equal to @var{num} bytes. The minimum value for 24875@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 24876targets. The default value is target-specific. 24877 24878@item -mblock-compare-inline-limit=@var{num} 24879@opindex mblock-compare-inline-limit 24880Generate non-looping inline code for all block compares (such as calls 24881to @code{memcmp} or structure compares) less than or equal to @var{num} 24882bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of 24883block compare is disabled. The default value is target-specific. 24884 24885@item -mblock-compare-inline-loop-limit=@var{num} 24886@opindex mblock-compare-inline-loop-limit 24887Generate an inline expansion using loop code for all block compares that 24888are less than or equal to @var{num} bytes, but greater than the limit 24889for non-loop inline block compare expansion. If the block length is not 24890constant, at most @var{num} bytes will be compared before @code{memcmp} 24891is called to compare the remainder of the block. The default value is 24892target-specific. 24893 24894@item -mstring-compare-inline-limit=@var{num} 24895@opindex mstring-compare-inline-limit 24896Compare at most @var{num} string bytes with inline code. 24897If the difference or end of string is not found at the 24898end of the inline compare a call to @code{strcmp} or @code{strncmp} will 24899take care of the rest of the comparison. The default is 64 bytes. 24900 24901@item -G @var{num} 24902@opindex G 24903@cindex smaller data references (PowerPC) 24904@cindex .sdata/.sdata2 references (PowerPC) 24905On embedded PowerPC systems, put global and static items less than or 24906equal to @var{num} bytes into the small data or BSS sections instead of 24907the normal data or BSS section. By default, @var{num} is 8. The 24908@option{-G @var{num}} switch is also passed to the linker. 24909All modules should be compiled with the same @option{-G @var{num}} value. 24910 24911@item -mregnames 24912@itemx -mno-regnames 24913@opindex mregnames 24914@opindex mno-regnames 24915On System V.4 and embedded PowerPC systems do (do not) emit register 24916names in the assembly language output using symbolic forms. 24917 24918@item -mlongcall 24919@itemx -mno-longcall 24920@opindex mlongcall 24921@opindex mno-longcall 24922By default assume that all calls are far away so that a longer and more 24923expensive calling sequence is required. This is required for calls 24924farther than 32 megabytes (33,554,432 bytes) from the current location. 24925A short call is generated if the compiler knows 24926the call cannot be that far away. This setting can be overridden by 24927the @code{shortcall} function attribute, or by @code{#pragma 24928longcall(0)}. 24929 24930Some linkers are capable of detecting out-of-range calls and generating 24931glue code on the fly. On these systems, long calls are unnecessary and 24932generate slower code. As of this writing, the AIX linker can do this, 24933as can the GNU linker for PowerPC/64. It is planned to add this feature 24934to the GNU linker for 32-bit PowerPC systems as well. 24935 24936On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers, 24937GCC can generate long calls using an inline PLT call sequence (see 24938@option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64 24939ELFv1 (big-endian) do not support inline PLT calls. 24940 24941On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 24942callee, L42}, plus a @dfn{branch island} (glue code). The two target 24943addresses represent the callee and the branch island. The 24944Darwin/PPC linker prefers the first address and generates a @code{bl 24945callee} if the PPC @code{bl} instruction reaches the callee directly; 24946otherwise, the linker generates @code{bl L42} to call the branch 24947island. The branch island is appended to the body of the 24948calling function; it computes the full 32-bit address of the callee 24949and jumps to it. 24950 24951On Mach-O (Darwin) systems, this option directs the compiler emit to 24952the glue for every direct call, and the Darwin linker decides whether 24953to use or discard it. 24954 24955In the future, GCC may ignore all longcall specifications 24956when the linker is known to generate glue. 24957 24958@item -mpltseq 24959@itemx -mno-pltseq 24960@opindex mpltseq 24961@opindex mno-pltseq 24962Implement (do not implement) -fno-plt and long calls using an inline 24963PLT call sequence that supports lazy linking and long calls to 24964functions in dlopen'd shared libraries. Inline PLT calls are only 24965supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU 24966linkers, and are enabled by default if the support is detected when 24967configuring GCC, and, in the case of 32-bit PowerPC, if GCC is 24968configured with @option{--enable-secureplt}. @option{-mpltseq} code 24969and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be 24970linked together. 24971 24972@item -mtls-markers 24973@itemx -mno-tls-markers 24974@opindex mtls-markers 24975@opindex mno-tls-markers 24976Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 24977specifying the function argument. The relocation allows the linker to 24978reliably associate function call with argument setup instructions for 24979TLS optimization, which in turn allows GCC to better schedule the 24980sequence. 24981 24982@item -mrecip 24983@itemx -mno-recip 24984@opindex mrecip 24985This option enables use of the reciprocal estimate and 24986reciprocal square root estimate instructions with additional 24987Newton-Raphson steps to increase precision instead of doing a divide or 24988square root and divide for floating-point arguments. You should use 24989the @option{-ffast-math} option when using @option{-mrecip} (or at 24990least @option{-funsafe-math-optimizations}, 24991@option{-ffinite-math-only}, @option{-freciprocal-math} and 24992@option{-fno-trapping-math}). Note that while the throughput of the 24993sequence is generally higher than the throughput of the non-reciprocal 24994instruction, the precision of the sequence can be decreased by up to 2 24995ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 24996roots. 24997 24998@item -mrecip=@var{opt} 24999@opindex mrecip=opt 25000This option controls which reciprocal estimate instructions 25001may be used. @var{opt} is a comma-separated list of options, which may 25002be preceded by a @code{!} to invert the option: 25003 25004@table @samp 25005 25006@item all 25007Enable all estimate instructions. 25008 25009@item default 25010Enable the default instructions, equivalent to @option{-mrecip}. 25011 25012@item none 25013Disable all estimate instructions, equivalent to @option{-mno-recip}. 25014 25015@item div 25016Enable the reciprocal approximation instructions for both 25017single and double precision. 25018 25019@item divf 25020Enable the single-precision reciprocal approximation instructions. 25021 25022@item divd 25023Enable the double-precision reciprocal approximation instructions. 25024 25025@item rsqrt 25026Enable the reciprocal square root approximation instructions for both 25027single and double precision. 25028 25029@item rsqrtf 25030Enable the single-precision reciprocal square root approximation instructions. 25031 25032@item rsqrtd 25033Enable the double-precision reciprocal square root approximation instructions. 25034 25035@end table 25036 25037So, for example, @option{-mrecip=all,!rsqrtd} enables 25038all of the reciprocal estimate instructions, except for the 25039@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 25040which handle the double-precision reciprocal square root calculations. 25041 25042@item -mrecip-precision 25043@itemx -mno-recip-precision 25044@opindex mrecip-precision 25045Assume (do not assume) that the reciprocal estimate instructions 25046provide higher-precision estimates than is mandated by the PowerPC 25047ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 25048@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 25049The double-precision square root estimate instructions are not generated by 25050default on low-precision machines, since they do not provide an 25051estimate that converges after three steps. 25052 25053@item -mveclibabi=@var{type} 25054@opindex mveclibabi 25055Specifies the ABI type to use for vectorizing intrinsics using an 25056external library. The only type supported at present is @samp{mass}, 25057which specifies to use IBM's Mathematical Acceleration Subsystem 25058(MASS) libraries for vectorizing intrinsics using external libraries. 25059GCC currently emits calls to @code{acosd2}, @code{acosf4}, 25060@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 25061@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 25062@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 25063@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 25064@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 25065@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 25066@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 25067@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 25068@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 25069@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 25070@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 25071@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 25072@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 25073for power7. Both @option{-ftree-vectorize} and 25074@option{-funsafe-math-optimizations} must also be enabled. The MASS 25075libraries must be specified at link time. 25076 25077@item -mfriz 25078@itemx -mno-friz 25079@opindex mfriz 25080Generate (do not generate) the @code{friz} instruction when the 25081@option{-funsafe-math-optimizations} option is used to optimize 25082rounding of floating-point values to 64-bit integer and back to floating 25083point. The @code{friz} instruction does not return the same value if 25084the floating-point number is too large to fit in an integer. 25085 25086@item -mpointers-to-nested-functions 25087@itemx -mno-pointers-to-nested-functions 25088@opindex mpointers-to-nested-functions 25089Generate (do not generate) code to load up the static chain register 25090(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 25091systems where a function pointer points to a 3-word descriptor giving 25092the function address, TOC value to be loaded in register @code{r2}, and 25093static chain value to be loaded in register @code{r11}. The 25094@option{-mpointers-to-nested-functions} is on by default. You cannot 25095call through pointers to nested functions or pointers 25096to functions compiled in other languages that use the static chain if 25097you use @option{-mno-pointers-to-nested-functions}. 25098 25099@item -msave-toc-indirect 25100@itemx -mno-save-toc-indirect 25101@opindex msave-toc-indirect 25102Generate (do not generate) code to save the TOC value in the reserved 25103stack location in the function prologue if the function calls through 25104a pointer on AIX and 64-bit Linux systems. If the TOC value is not 25105saved in the prologue, it is saved just before the call through the 25106pointer. The @option{-mno-save-toc-indirect} option is the default. 25107 25108@item -mcompat-align-parm 25109@itemx -mno-compat-align-parm 25110@opindex mcompat-align-parm 25111Generate (do not generate) code to pass structure parameters with a 25112maximum alignment of 64 bits, for compatibility with older versions 25113of GCC. 25114 25115Older versions of GCC (prior to 4.9.0) incorrectly did not align a 25116structure parameter on a 128-bit boundary when that structure contained 25117a member requiring 128-bit alignment. This is corrected in more 25118recent versions of GCC. This option may be used to generate code 25119that is compatible with functions compiled with older versions of 25120GCC. 25121 25122The @option{-mno-compat-align-parm} option is the default. 25123 25124@item -mstack-protector-guard=@var{guard} 25125@itemx -mstack-protector-guard-reg=@var{reg} 25126@itemx -mstack-protector-guard-offset=@var{offset} 25127@itemx -mstack-protector-guard-symbol=@var{symbol} 25128@opindex mstack-protector-guard 25129@opindex mstack-protector-guard-reg 25130@opindex mstack-protector-guard-offset 25131@opindex mstack-protector-guard-symbol 25132Generate stack protection code using canary at @var{guard}. Supported 25133locations are @samp{global} for global canary or @samp{tls} for per-thread 25134canary in the TLS block (the default with GNU libc version 2.4 or later). 25135 25136With the latter choice the options 25137@option{-mstack-protector-guard-reg=@var{reg}} and 25138@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 25139which register to use as base register for reading the canary, and from what 25140offset from that base register. The default for those is as specified in the 25141relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides 25142the offset with a symbol reference to a canary in the TLS block. 25143@end table 25144 25145@node RX Options 25146@subsection RX Options 25147@cindex RX Options 25148 25149These command-line options are defined for RX targets: 25150 25151@table @gcctabopt 25152@item -m64bit-doubles 25153@itemx -m32bit-doubles 25154@opindex m64bit-doubles 25155@opindex m32bit-doubles 25156Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 25157or 32 bits (@option{-m32bit-doubles}) in size. The default is 25158@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 25159works on 32-bit values, which is why the default is 25160@option{-m32bit-doubles}. 25161 25162@item -fpu 25163@itemx -nofpu 25164@opindex fpu 25165@opindex nofpu 25166Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 25167floating-point hardware. The default is enabled for the RX600 25168series and disabled for the RX200 series. 25169 25170Floating-point instructions are only generated for 32-bit floating-point 25171values, however, so the FPU hardware is not used for doubles if the 25172@option{-m64bit-doubles} option is used. 25173 25174@emph{Note} If the @option{-fpu} option is enabled then 25175@option{-funsafe-math-optimizations} is also enabled automatically. 25176This is because the RX FPU instructions are themselves unsafe. 25177 25178@item -mcpu=@var{name} 25179@opindex mcpu 25180Selects the type of RX CPU to be targeted. Currently three types are 25181supported, the generic @samp{RX600} and @samp{RX200} series hardware and 25182the specific @samp{RX610} CPU. The default is @samp{RX600}. 25183 25184The only difference between @samp{RX600} and @samp{RX610} is that the 25185@samp{RX610} does not support the @code{MVTIPL} instruction. 25186 25187The @samp{RX200} series does not have a hardware floating-point unit 25188and so @option{-nofpu} is enabled by default when this type is 25189selected. 25190 25191@item -mbig-endian-data 25192@itemx -mlittle-endian-data 25193@opindex mbig-endian-data 25194@opindex mlittle-endian-data 25195Store data (but not code) in the big-endian format. The default is 25196@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 25197format. 25198 25199@item -msmall-data-limit=@var{N} 25200@opindex msmall-data-limit 25201Specifies the maximum size in bytes of global and static variables 25202which can be placed into the small data area. Using the small data 25203area can lead to smaller and faster code, but the size of area is 25204limited and it is up to the programmer to ensure that the area does 25205not overflow. Also when the small data area is used one of the RX's 25206registers (usually @code{r13}) is reserved for use pointing to this 25207area, so it is no longer available for use by the compiler. This 25208could result in slower and/or larger code if variables are pushed onto 25209the stack instead of being held in this register. 25210 25211Note, common variables (variables that have not been initialized) and 25212constants are not placed into the small data area as they are assigned 25213to other sections in the output executable. 25214 25215The default value is zero, which disables this feature. Note, this 25216feature is not enabled by default with higher optimization levels 25217(@option{-O2} etc) because of the potentially detrimental effects of 25218reserving a register. It is up to the programmer to experiment and 25219discover whether this feature is of benefit to their program. See the 25220description of the @option{-mpid} option for a description of how the 25221actual register to hold the small data area pointer is chosen. 25222 25223@item -msim 25224@itemx -mno-sim 25225@opindex msim 25226@opindex mno-sim 25227Use the simulator runtime. The default is to use the libgloss 25228board-specific runtime. 25229 25230@item -mas100-syntax 25231@itemx -mno-as100-syntax 25232@opindex mas100-syntax 25233@opindex mno-as100-syntax 25234When generating assembler output use a syntax that is compatible with 25235Renesas's AS100 assembler. This syntax can also be handled by the GAS 25236assembler, but it has some restrictions so it is not generated by default. 25237 25238@item -mmax-constant-size=@var{N} 25239@opindex mmax-constant-size 25240Specifies the maximum size, in bytes, of a constant that can be used as 25241an operand in a RX instruction. Although the RX instruction set does 25242allow constants of up to 4 bytes in length to be used in instructions, 25243a longer value equates to a longer instruction. Thus in some 25244circumstances it can be beneficial to restrict the size of constants 25245that are used in instructions. Constants that are too big are instead 25246placed into a constant pool and referenced via register indirection. 25247 25248The value @var{N} can be between 0 and 4. A value of 0 (the default) 25249or 4 means that constants of any size are allowed. 25250 25251@item -mrelax 25252@opindex mrelax 25253Enable linker relaxation. Linker relaxation is a process whereby the 25254linker attempts to reduce the size of a program by finding shorter 25255versions of various instructions. Disabled by default. 25256 25257@item -mint-register=@var{N} 25258@opindex mint-register 25259Specify the number of registers to reserve for fast interrupt handler 25260functions. The value @var{N} can be between 0 and 4. A value of 1 25261means that register @code{r13} is reserved for the exclusive use 25262of fast interrupt handlers. A value of 2 reserves @code{r13} and 25263@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 25264@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 25265A value of 0, the default, does not reserve any registers. 25266 25267@item -msave-acc-in-interrupts 25268@opindex msave-acc-in-interrupts 25269Specifies that interrupt handler functions should preserve the 25270accumulator register. This is only necessary if normal code might use 25271the accumulator register, for example because it performs 64-bit 25272multiplications. The default is to ignore the accumulator as this 25273makes the interrupt handlers faster. 25274 25275@item -mpid 25276@itemx -mno-pid 25277@opindex mpid 25278@opindex mno-pid 25279Enables the generation of position independent data. When enabled any 25280access to constant data is done via an offset from a base address 25281held in a register. This allows the location of constant data to be 25282determined at run time without requiring the executable to be 25283relocated, which is a benefit to embedded applications with tight 25284memory constraints. Data that can be modified is not affected by this 25285option. 25286 25287Note, using this feature reserves a register, usually @code{r13}, for 25288the constant data base address. This can result in slower and/or 25289larger code, especially in complicated functions. 25290 25291The actual register chosen to hold the constant data base address 25292depends upon whether the @option{-msmall-data-limit} and/or the 25293@option{-mint-register} command-line options are enabled. Starting 25294with register @code{r13} and proceeding downwards, registers are 25295allocated first to satisfy the requirements of @option{-mint-register}, 25296then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 25297is possible for the small data area register to be @code{r8} if both 25298@option{-mint-register=4} and @option{-mpid} are specified on the 25299command line. 25300 25301By default this feature is not enabled. The default can be restored 25302via the @option{-mno-pid} command-line option. 25303 25304@item -mno-warn-multiple-fast-interrupts 25305@itemx -mwarn-multiple-fast-interrupts 25306@opindex mno-warn-multiple-fast-interrupts 25307@opindex mwarn-multiple-fast-interrupts 25308Prevents GCC from issuing a warning message if it finds more than one 25309fast interrupt handler when it is compiling a file. The default is to 25310issue a warning for each extra fast interrupt handler found, as the RX 25311only supports one such interrupt. 25312 25313@item -mallow-string-insns 25314@itemx -mno-allow-string-insns 25315@opindex mallow-string-insns 25316@opindex mno-allow-string-insns 25317Enables or disables the use of the string manipulation instructions 25318@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL} 25319@code{SWHILE} and also the @code{RMPA} instruction. These 25320instructions may prefetch data, which is not safe to do if accessing 25321an I/O register. (See section 12.2.7 of the RX62N Group User's Manual 25322for more information). 25323 25324The default is to allow these instructions, but it is not possible for 25325GCC to reliably detect all circumstances where a string instruction 25326might be used to access an I/O register, so their use cannot be 25327disabled automatically. Instead it is reliant upon the programmer to 25328use the @option{-mno-allow-string-insns} option if their program 25329accesses I/O space. 25330 25331When the instructions are enabled GCC defines the C preprocessor 25332symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the 25333symbol @code{__RX_DISALLOW_STRING_INSNS__}. 25334 25335@item -mjsr 25336@itemx -mno-jsr 25337@opindex mjsr 25338@opindex mno-jsr 25339Use only (or not only) @code{JSR} instructions to access functions. 25340This option can be used when code size exceeds the range of @code{BSR} 25341instructions. Note that @option{-mno-jsr} does not mean to not use 25342@code{JSR} but instead means that any type of branch may be used. 25343@end table 25344 25345@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 25346has special significance to the RX port when used with the 25347@code{interrupt} function attribute. This attribute indicates a 25348function intended to process fast interrupts. GCC ensures 25349that it only uses the registers @code{r10}, @code{r11}, @code{r12} 25350and/or @code{r13} and only provided that the normal use of the 25351corresponding registers have been restricted via the 25352@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 25353options. 25354 25355@node S/390 and zSeries Options 25356@subsection S/390 and zSeries Options 25357@cindex S/390 and zSeries Options 25358 25359These are the @samp{-m} options defined for the S/390 and zSeries architecture. 25360 25361@table @gcctabopt 25362@item -mhard-float 25363@itemx -msoft-float 25364@opindex mhard-float 25365@opindex msoft-float 25366Use (do not use) the hardware floating-point instructions and registers 25367for floating-point operations. When @option{-msoft-float} is specified, 25368functions in @file{libgcc.a} are used to perform floating-point 25369operations. When @option{-mhard-float} is specified, the compiler 25370generates IEEE floating-point instructions. This is the default. 25371 25372@item -mhard-dfp 25373@itemx -mno-hard-dfp 25374@opindex mhard-dfp 25375@opindex mno-hard-dfp 25376Use (do not use) the hardware decimal-floating-point instructions for 25377decimal-floating-point operations. When @option{-mno-hard-dfp} is 25378specified, functions in @file{libgcc.a} are used to perform 25379decimal-floating-point operations. When @option{-mhard-dfp} is 25380specified, the compiler generates decimal-floating-point hardware 25381instructions. This is the default for @option{-march=z9-ec} or higher. 25382 25383@item -mlong-double-64 25384@itemx -mlong-double-128 25385@opindex mlong-double-64 25386@opindex mlong-double-128 25387These switches control the size of @code{long double} type. A size 25388of 64 bits makes the @code{long double} type equivalent to the @code{double} 25389type. This is the default. 25390 25391@item -mbackchain 25392@itemx -mno-backchain 25393@opindex mbackchain 25394@opindex mno-backchain 25395Store (do not store) the address of the caller's frame as backchain pointer 25396into the callee's stack frame. 25397A backchain may be needed to allow debugging using tools that do not understand 25398DWARF call frame information. 25399When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 25400at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 25401the backchain is placed into the topmost word of the 96/160 byte register 25402save area. 25403 25404In general, code compiled with @option{-mbackchain} is call-compatible with 25405code compiled with @option{-mmo-backchain}; however, use of the backchain 25406for debugging purposes usually requires that the whole binary is built with 25407@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 25408@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 25409to build a linux kernel use @option{-msoft-float}. 25410 25411The default is to not maintain the backchain. 25412 25413@item -mpacked-stack 25414@itemx -mno-packed-stack 25415@opindex mpacked-stack 25416@opindex mno-packed-stack 25417Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 25418specified, the compiler uses the all fields of the 96/160 byte register save 25419area only for their default purpose; unused fields still take up stack space. 25420When @option{-mpacked-stack} is specified, register save slots are densely 25421packed at the top of the register save area; unused space is reused for other 25422purposes, allowing for more efficient use of the available stack space. 25423However, when @option{-mbackchain} is also in effect, the topmost word of 25424the save area is always used to store the backchain, and the return address 25425register is always saved two words below the backchain. 25426 25427As long as the stack frame backchain is not used, code generated with 25428@option{-mpacked-stack} is call-compatible with code generated with 25429@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 25430S/390 or zSeries generated code that uses the stack frame backchain at run 25431time, not just for debugging purposes. Such code is not call-compatible 25432with code compiled with @option{-mpacked-stack}. Also, note that the 25433combination of @option{-mbackchain}, 25434@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 25435to build a linux kernel use @option{-msoft-float}. 25436 25437The default is to not use the packed stack layout. 25438 25439@item -msmall-exec 25440@itemx -mno-small-exec 25441@opindex msmall-exec 25442@opindex mno-small-exec 25443Generate (or do not generate) code using the @code{bras} instruction 25444to do subroutine calls. 25445This only works reliably if the total executable size does not 25446exceed 64k. The default is to use the @code{basr} instruction instead, 25447which does not have this limitation. 25448 25449@item -m64 25450@itemx -m31 25451@opindex m64 25452@opindex m31 25453When @option{-m31} is specified, generate code compliant to the 25454GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 25455code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 25456particular to generate 64-bit instructions. For the @samp{s390} 25457targets, the default is @option{-m31}, while the @samp{s390x} 25458targets default to @option{-m64}. 25459 25460@item -mzarch 25461@itemx -mesa 25462@opindex mzarch 25463@opindex mesa 25464When @option{-mzarch} is specified, generate code using the 25465instructions available on z/Architecture. 25466When @option{-mesa} is specified, generate code using the 25467instructions available on ESA/390. Note that @option{-mesa} is 25468not possible with @option{-m64}. 25469When generating code compliant to the GNU/Linux for S/390 ABI, 25470the default is @option{-mesa}. When generating code compliant 25471to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 25472 25473@item -mhtm 25474@itemx -mno-htm 25475@opindex mhtm 25476@opindex mno-htm 25477The @option{-mhtm} option enables a set of builtins making use of 25478instructions available with the transactional execution facility 25479introduced with the IBM zEnterprise EC12 machine generation 25480@ref{S/390 System z Built-in Functions}. 25481@option{-mhtm} is enabled by default when using @option{-march=zEC12}. 25482 25483@item -mvx 25484@itemx -mno-vx 25485@opindex mvx 25486@opindex mno-vx 25487When @option{-mvx} is specified, generate code using the instructions 25488available with the vector extension facility introduced with the IBM 25489z13 machine generation. 25490This option changes the ABI for some vector type values with regard to 25491alignment and calling conventions. In case vector type values are 25492being used in an ABI-relevant context a GAS @samp{.gnu_attribute} 25493command will be added to mark the resulting binary with the ABI used. 25494@option{-mvx} is enabled by default when using @option{-march=z13}. 25495 25496@item -mzvector 25497@itemx -mno-zvector 25498@opindex mzvector 25499@opindex mno-zvector 25500The @option{-mzvector} option enables vector language extensions and 25501builtins using instructions available with the vector extension 25502facility introduced with the IBM z13 machine generation. 25503This option adds support for @samp{vector} to be used as a keyword to 25504define vector type variables and arguments. @samp{vector} is only 25505available when GNU extensions are enabled. It will not be expanded 25506when requesting strict standard compliance e.g.@: with @option{-std=c99}. 25507In addition to the GCC low-level builtins @option{-mzvector} enables 25508a set of builtins added for compatibility with AltiVec-style 25509implementations like Power and Cell. In order to make use of these 25510builtins the header file @file{vecintrin.h} needs to be included. 25511@option{-mzvector} is disabled by default. 25512 25513@item -mmvcle 25514@itemx -mno-mvcle 25515@opindex mmvcle 25516@opindex mno-mvcle 25517Generate (or do not generate) code using the @code{mvcle} instruction 25518to perform block moves. When @option{-mno-mvcle} is specified, 25519use a @code{mvc} loop instead. This is the default unless optimizing for 25520size. 25521 25522@item -mdebug 25523@itemx -mno-debug 25524@opindex mdebug 25525@opindex mno-debug 25526Print (or do not print) additional debug information when compiling. 25527The default is to not print debug information. 25528 25529@item -march=@var{cpu-type} 25530@opindex march 25531Generate code that runs on @var{cpu-type}, which is the name of a 25532system representing a certain processor type. Possible values for 25533@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6}, 25534@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8}, 25535@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, 25536@samp{z14}/@samp{arch12}, and @samp{native}. 25537 25538The default is @option{-march=z900}. 25539 25540Specifying @samp{native} as cpu type can be used to select the best 25541architecture option for the host processor. 25542@option{-march=native} has no effect if GCC does not recognize the 25543processor. 25544 25545@item -mtune=@var{cpu-type} 25546@opindex mtune 25547Tune to @var{cpu-type} everything applicable about the generated code, 25548except for the ABI and the set of available instructions. 25549The list of @var{cpu-type} values is the same as for @option{-march}. 25550The default is the value used for @option{-march}. 25551 25552@item -mtpf-trace 25553@itemx -mno-tpf-trace 25554@opindex mtpf-trace 25555@opindex mno-tpf-trace 25556Generate code that adds (does not add) in TPF OS specific branches to trace 25557routines in the operating system. This option is off by default, even 25558when compiling for the TPF OS@. 25559 25560@item -mfused-madd 25561@itemx -mno-fused-madd 25562@opindex mfused-madd 25563@opindex mno-fused-madd 25564Generate code that uses (does not use) the floating-point multiply and 25565accumulate instructions. These instructions are generated by default if 25566hardware floating point is used. 25567 25568@item -mwarn-framesize=@var{framesize} 25569@opindex mwarn-framesize 25570Emit a warning if the current function exceeds the given frame size. Because 25571this is a compile-time check it doesn't need to be a real problem when the program 25572runs. It is intended to identify functions that most probably cause 25573a stack overflow. It is useful to be used in an environment with limited stack 25574size e.g.@: the linux kernel. 25575 25576@item -mwarn-dynamicstack 25577@opindex mwarn-dynamicstack 25578Emit a warning if the function calls @code{alloca} or uses dynamically-sized 25579arrays. This is generally a bad idea with a limited stack size. 25580 25581@item -mstack-guard=@var{stack-guard} 25582@itemx -mstack-size=@var{stack-size} 25583@opindex mstack-guard 25584@opindex mstack-size 25585If these options are provided the S/390 back end emits additional instructions in 25586the function prologue that trigger a trap if the stack size is @var{stack-guard} 25587bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 25588If the @var{stack-guard} option is omitted the smallest power of 2 larger than 25589the frame size of the compiled function is chosen. 25590These options are intended to be used to help debugging stack overflow problems. 25591The additionally emitted code causes only little overhead and hence can also be 25592used in production-like systems without greater performance degradation. The given 25593values have to be exact powers of 2 and @var{stack-size} has to be greater than 25594@var{stack-guard} without exceeding 64k. 25595In order to be efficient the extra code makes the assumption that the stack starts 25596at an address aligned to the value given by @var{stack-size}. 25597The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 25598 25599@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 25600@opindex mhotpatch 25601If the hotpatch option is enabled, a ``hot-patching'' function 25602prologue is generated for all functions in the compilation unit. 25603The funtion label is prepended with the given number of two-byte 25604NOP instructions (@var{pre-halfwords}, maximum 1000000). After 25605the label, 2 * @var{post-halfwords} bytes are appended, using the 25606largest NOP like instructions the architecture allows (maximum 256071000000). 25608 25609If both arguments are zero, hotpatching is disabled. 25610 25611This option can be overridden for individual functions with the 25612@code{hotpatch} attribute. 25613@end table 25614 25615@node Score Options 25616@subsection Score Options 25617@cindex Score Options 25618 25619These options are defined for Score implementations: 25620 25621@table @gcctabopt 25622@item -meb 25623@opindex meb 25624Compile code for big-endian mode. This is the default. 25625 25626@item -mel 25627@opindex mel 25628Compile code for little-endian mode. 25629 25630@item -mnhwloop 25631@opindex mnhwloop 25632Disable generation of @code{bcnz} instructions. 25633 25634@item -muls 25635@opindex muls 25636Enable generation of unaligned load and store instructions. 25637 25638@item -mmac 25639@opindex mmac 25640Enable the use of multiply-accumulate instructions. Disabled by default. 25641 25642@item -mscore5 25643@opindex mscore5 25644Specify the SCORE5 as the target architecture. 25645 25646@item -mscore5u 25647@opindex mscore5u 25648Specify the SCORE5U of the target architecture. 25649 25650@item -mscore7 25651@opindex mscore7 25652Specify the SCORE7 as the target architecture. This is the default. 25653 25654@item -mscore7d 25655@opindex mscore7d 25656Specify the SCORE7D as the target architecture. 25657@end table 25658 25659@node SH Options 25660@subsection SH Options 25661 25662These @samp{-m} options are defined for the SH implementations: 25663 25664@table @gcctabopt 25665@item -m1 25666@opindex m1 25667Generate code for the SH1. 25668 25669@item -m2 25670@opindex m2 25671Generate code for the SH2. 25672 25673@item -m2e 25674Generate code for the SH2e. 25675 25676@item -m2a-nofpu 25677@opindex m2a-nofpu 25678Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 25679that the floating-point unit is not used. 25680 25681@item -m2a-single-only 25682@opindex m2a-single-only 25683Generate code for the SH2a-FPU, in such a way that no double-precision 25684floating-point operations are used. 25685 25686@item -m2a-single 25687@opindex m2a-single 25688Generate code for the SH2a-FPU assuming the floating-point unit is in 25689single-precision mode by default. 25690 25691@item -m2a 25692@opindex m2a 25693Generate code for the SH2a-FPU assuming the floating-point unit is in 25694double-precision mode by default. 25695 25696@item -m3 25697@opindex m3 25698Generate code for the SH3. 25699 25700@item -m3e 25701@opindex m3e 25702Generate code for the SH3e. 25703 25704@item -m4-nofpu 25705@opindex m4-nofpu 25706Generate code for the SH4 without a floating-point unit. 25707 25708@item -m4-single-only 25709@opindex m4-single-only 25710Generate code for the SH4 with a floating-point unit that only 25711supports single-precision arithmetic. 25712 25713@item -m4-single 25714@opindex m4-single 25715Generate code for the SH4 assuming the floating-point unit is in 25716single-precision mode by default. 25717 25718@item -m4 25719@opindex m4 25720Generate code for the SH4. 25721 25722@item -m4-100 25723@opindex m4-100 25724Generate code for SH4-100. 25725 25726@item -m4-100-nofpu 25727@opindex m4-100-nofpu 25728Generate code for SH4-100 in such a way that the 25729floating-point unit is not used. 25730 25731@item -m4-100-single 25732@opindex m4-100-single 25733Generate code for SH4-100 assuming the floating-point unit is in 25734single-precision mode by default. 25735 25736@item -m4-100-single-only 25737@opindex m4-100-single-only 25738Generate code for SH4-100 in such a way that no double-precision 25739floating-point operations are used. 25740 25741@item -m4-200 25742@opindex m4-200 25743Generate code for SH4-200. 25744 25745@item -m4-200-nofpu 25746@opindex m4-200-nofpu 25747Generate code for SH4-200 without in such a way that the 25748floating-point unit is not used. 25749 25750@item -m4-200-single 25751@opindex m4-200-single 25752Generate code for SH4-200 assuming the floating-point unit is in 25753single-precision mode by default. 25754 25755@item -m4-200-single-only 25756@opindex m4-200-single-only 25757Generate code for SH4-200 in such a way that no double-precision 25758floating-point operations are used. 25759 25760@item -m4-300 25761@opindex m4-300 25762Generate code for SH4-300. 25763 25764@item -m4-300-nofpu 25765@opindex m4-300-nofpu 25766Generate code for SH4-300 without in such a way that the 25767floating-point unit is not used. 25768 25769@item -m4-300-single 25770@opindex m4-300-single 25771Generate code for SH4-300 in such a way that no double-precision 25772floating-point operations are used. 25773 25774@item -m4-300-single-only 25775@opindex m4-300-single-only 25776Generate code for SH4-300 in such a way that no double-precision 25777floating-point operations are used. 25778 25779@item -m4-340 25780@opindex m4-340 25781Generate code for SH4-340 (no MMU, no FPU). 25782 25783@item -m4-500 25784@opindex m4-500 25785Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 25786assembler. 25787 25788@item -m4a-nofpu 25789@opindex m4a-nofpu 25790Generate code for the SH4al-dsp, or for a SH4a in such a way that the 25791floating-point unit is not used. 25792 25793@item -m4a-single-only 25794@opindex m4a-single-only 25795Generate code for the SH4a, in such a way that no double-precision 25796floating-point operations are used. 25797 25798@item -m4a-single 25799@opindex m4a-single 25800Generate code for the SH4a assuming the floating-point unit is in 25801single-precision mode by default. 25802 25803@item -m4a 25804@opindex m4a 25805Generate code for the SH4a. 25806 25807@item -m4al 25808@opindex m4al 25809Same as @option{-m4a-nofpu}, except that it implicitly passes 25810@option{-dsp} to the assembler. GCC doesn't generate any DSP 25811instructions at the moment. 25812 25813@item -mb 25814@opindex mb 25815Compile code for the processor in big-endian mode. 25816 25817@item -ml 25818@opindex ml 25819Compile code for the processor in little-endian mode. 25820 25821@item -mdalign 25822@opindex mdalign 25823Align doubles at 64-bit boundaries. Note that this changes the calling 25824conventions, and thus some functions from the standard C library do 25825not work unless you recompile it first with @option{-mdalign}. 25826 25827@item -mrelax 25828@opindex mrelax 25829Shorten some address references at link time, when possible; uses the 25830linker option @option{-relax}. 25831 25832@item -mbigtable 25833@opindex mbigtable 25834Use 32-bit offsets in @code{switch} tables. The default is to use 2583516-bit offsets. 25836 25837@item -mbitops 25838@opindex mbitops 25839Enable the use of bit manipulation instructions on SH2A. 25840 25841@item -mfmovd 25842@opindex mfmovd 25843Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 25844alignment constraints. 25845 25846@item -mrenesas 25847@opindex mrenesas 25848Comply with the calling conventions defined by Renesas. 25849 25850@item -mno-renesas 25851@opindex mno-renesas 25852Comply with the calling conventions defined for GCC before the Renesas 25853conventions were available. This option is the default for all 25854targets of the SH toolchain. 25855 25856@item -mnomacsave 25857@opindex mnomacsave 25858Mark the @code{MAC} register as call-clobbered, even if 25859@option{-mrenesas} is given. 25860 25861@item -mieee 25862@itemx -mno-ieee 25863@opindex mieee 25864@opindex mno-ieee 25865Control the IEEE compliance of floating-point comparisons, which affects the 25866handling of cases where the result of a comparison is unordered. By default 25867@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 25868enabled @option{-mno-ieee} is implicitly set, which results in faster 25869floating-point greater-equal and less-equal comparisons. The implicit settings 25870can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 25871 25872@item -minline-ic_invalidate 25873@opindex minline-ic_invalidate 25874Inline code to invalidate instruction cache entries after setting up 25875nested function trampolines. 25876This option has no effect if @option{-musermode} is in effect and the selected 25877code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi} 25878instruction. 25879If the selected code generation option does not allow the use of the @code{icbi} 25880instruction, and @option{-musermode} is not in effect, the inlined code 25881manipulates the instruction cache address array directly with an associative 25882write. This not only requires privileged mode at run time, but it also 25883fails if the cache line had been mapped via the TLB and has become unmapped. 25884 25885@item -misize 25886@opindex misize 25887Dump instruction size and location in the assembly code. 25888 25889@item -mpadstruct 25890@opindex mpadstruct 25891This option is deprecated. It pads structures to multiple of 4 bytes, 25892which is incompatible with the SH ABI@. 25893 25894@item -matomic-model=@var{model} 25895@opindex matomic-model=@var{model} 25896Sets the model of atomic operations and additional parameters as a comma 25897separated list. For details on the atomic built-in functions see 25898@ref{__atomic Builtins}. The following models and parameters are supported: 25899 25900@table @samp 25901 25902@item none 25903Disable compiler generated atomic sequences and emit library calls for atomic 25904operations. This is the default if the target is not @code{sh*-*-linux*}. 25905 25906@item soft-gusa 25907Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 25908built-in functions. The generated atomic sequences require additional support 25909from the interrupt/exception handling code of the system and are only suitable 25910for SH3* and SH4* single-core systems. This option is enabled by default when 25911the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 25912this option also partially utilizes the hardware atomic instructions 25913@code{movli.l} and @code{movco.l} to create more efficient code, unless 25914@samp{strict} is specified. 25915 25916@item soft-tcb 25917Generate software atomic sequences that use a variable in the thread control 25918block. This is a variation of the gUSA sequences which can also be used on 25919SH1* and SH2* targets. The generated atomic sequences require additional 25920support from the interrupt/exception handling code of the system and are only 25921suitable for single-core systems. When using this model, the @samp{gbr-offset=} 25922parameter has to be specified as well. 25923 25924@item soft-imask 25925Generate software atomic sequences that temporarily disable interrupts by 25926setting @code{SR.IMASK = 1111}. This model works only when the program runs 25927in privileged mode and is only suitable for single-core systems. Additional 25928support from the interrupt/exception handling code of the system is not 25929required. This model is enabled by default when the target is 25930@code{sh*-*-linux*} and SH1* or SH2*. 25931 25932@item hard-llcs 25933Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 25934instructions only. This is only available on SH4A and is suitable for 25935multi-core systems. Since the hardware instructions support only 32 bit atomic 25936variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 25937Code compiled with this option is also compatible with other software 25938atomic model interrupt/exception handling systems if executed on an SH4A 25939system. Additional support from the interrupt/exception handling code of the 25940system is not required for this model. 25941 25942@item gbr-offset= 25943This parameter specifies the offset in bytes of the variable in the thread 25944control block structure that should be used by the generated atomic sequences 25945when the @samp{soft-tcb} model has been selected. For other models this 25946parameter is ignored. The specified value must be an integer multiple of four 25947and in the range 0-1020. 25948 25949@item strict 25950This parameter prevents mixed usage of multiple atomic models, even if they 25951are compatible, and makes the compiler generate atomic sequences of the 25952specified model only. 25953 25954@end table 25955 25956@item -mtas 25957@opindex mtas 25958Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 25959Notice that depending on the particular hardware and software configuration 25960this can degrade overall performance due to the operand cache line flushes 25961that are implied by the @code{tas.b} instruction. On multi-core SH4A 25962processors the @code{tas.b} instruction must be used with caution since it 25963can result in data corruption for certain cache configurations. 25964 25965@item -mprefergot 25966@opindex mprefergot 25967When generating position-independent code, emit function calls using 25968the Global Offset Table instead of the Procedure Linkage Table. 25969 25970@item -musermode 25971@itemx -mno-usermode 25972@opindex musermode 25973@opindex mno-usermode 25974Don't allow (allow) the compiler generating privileged mode code. Specifying 25975@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 25976inlined code would not work in user mode. @option{-musermode} is the default 25977when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 25978@option{-musermode} has no effect, since there is no user mode. 25979 25980@item -multcost=@var{number} 25981@opindex multcost=@var{number} 25982Set the cost to assume for a multiply insn. 25983 25984@item -mdiv=@var{strategy} 25985@opindex mdiv=@var{strategy} 25986Set the division strategy to be used for integer division operations. 25987@var{strategy} can be one of: 25988 25989@table @samp 25990 25991@item call-div1 25992Calls a library function that uses the single-step division instruction 25993@code{div1} to perform the operation. Division by zero calculates an 25994unspecified result and does not trap. This is the default except for SH4, 25995SH2A and SHcompact. 25996 25997@item call-fp 25998Calls a library function that performs the operation in double precision 25999floating point. Division by zero causes a floating-point exception. This is 26000the default for SHcompact with FPU. Specifying this for targets that do not 26001have a double precision FPU defaults to @code{call-div1}. 26002 26003@item call-table 26004Calls a library function that uses a lookup table for small divisors and 26005the @code{div1} instruction with case distinction for larger divisors. Division 26006by zero calculates an unspecified result and does not trap. This is the default 26007for SH4. Specifying this for targets that do not have dynamic shift 26008instructions defaults to @code{call-div1}. 26009 26010@end table 26011 26012When a division strategy has not been specified the default strategy is 26013selected based on the current target. For SH2A the default strategy is to 26014use the @code{divs} and @code{divu} instructions instead of library function 26015calls. 26016 26017@item -maccumulate-outgoing-args 26018@opindex maccumulate-outgoing-args 26019Reserve space once for outgoing arguments in the function prologue rather 26020than around each call. Generally beneficial for performance and size. Also 26021needed for unwinding to avoid changing the stack frame around conditional code. 26022 26023@item -mdivsi3_libfunc=@var{name} 26024@opindex mdivsi3_libfunc=@var{name} 26025Set the name of the library function used for 32-bit signed division to 26026@var{name}. 26027This only affects the name used in the @samp{call} division strategies, and 26028the compiler still expects the same sets of input/output/clobbered registers as 26029if this option were not present. 26030 26031@item -mfixed-range=@var{register-range} 26032@opindex mfixed-range 26033Generate code treating the given register range as fixed registers. 26034A fixed register is one that the register allocator cannot use. This is 26035useful when compiling kernel code. A register range is specified as 26036two registers separated by a dash. Multiple register ranges can be 26037specified separated by a comma. 26038 26039@item -mbranch-cost=@var{num} 26040@opindex mbranch-cost=@var{num} 26041Assume @var{num} to be the cost for a branch instruction. Higher numbers 26042make the compiler try to generate more branch-free code if possible. 26043If not specified the value is selected depending on the processor type that 26044is being compiled for. 26045 26046@item -mzdcbranch 26047@itemx -mno-zdcbranch 26048@opindex mzdcbranch 26049@opindex mno-zdcbranch 26050Assume (do not assume) that zero displacement conditional branch instructions 26051@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 26052compiler prefers zero displacement branch code sequences. This is 26053enabled by default when generating code for SH4 and SH4A. It can be explicitly 26054disabled by specifying @option{-mno-zdcbranch}. 26055 26056@item -mcbranch-force-delay-slot 26057@opindex mcbranch-force-delay-slot 26058Force the usage of delay slots for conditional branches, which stuffs the delay 26059slot with a @code{nop} if a suitable instruction cannot be found. By default 26060this option is disabled. It can be enabled to work around hardware bugs as 26061found in the original SH7055. 26062 26063@item -mfused-madd 26064@itemx -mno-fused-madd 26065@opindex mfused-madd 26066@opindex mno-fused-madd 26067Generate code that uses (does not use) the floating-point multiply and 26068accumulate instructions. These instructions are generated by default 26069if hardware floating point is used. The machine-dependent 26070@option{-mfused-madd} option is now mapped to the machine-independent 26071@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 26072mapped to @option{-ffp-contract=off}. 26073 26074@item -mfsca 26075@itemx -mno-fsca 26076@opindex mfsca 26077@opindex mno-fsca 26078Allow or disallow the compiler to emit the @code{fsca} instruction for sine 26079and cosine approximations. The option @option{-mfsca} must be used in 26080combination with @option{-funsafe-math-optimizations}. It is enabled by default 26081when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 26082approximations even if @option{-funsafe-math-optimizations} is in effect. 26083 26084@item -mfsrra 26085@itemx -mno-fsrra 26086@opindex mfsrra 26087@opindex mno-fsrra 26088Allow or disallow the compiler to emit the @code{fsrra} instruction for 26089reciprocal square root approximations. The option @option{-mfsrra} must be used 26090in combination with @option{-funsafe-math-optimizations} and 26091@option{-ffinite-math-only}. It is enabled by default when generating code for 26092SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 26093even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 26094in effect. 26095 26096@item -mpretend-cmove 26097@opindex mpretend-cmove 26098Prefer zero-displacement conditional branches for conditional move instruction 26099patterns. This can result in faster code on the SH4 processor. 26100 26101@item -mfdpic 26102@opindex fdpic 26103Generate code using the FDPIC ABI. 26104 26105@end table 26106 26107@node Solaris 2 Options 26108@subsection Solaris 2 Options 26109@cindex Solaris 2 options 26110 26111These @samp{-m} options are supported on Solaris 2: 26112 26113@table @gcctabopt 26114@item -mclear-hwcap 26115@opindex mclear-hwcap 26116@option{-mclear-hwcap} tells the compiler to remove the hardware 26117capabilities generated by the Solaris assembler. This is only necessary 26118when object files use ISA extensions not supported by the current 26119machine, but check at runtime whether or not to use them. 26120 26121@item -mimpure-text 26122@opindex mimpure-text 26123@option{-mimpure-text}, used in addition to @option{-shared}, tells 26124the compiler to not pass @option{-z text} to the linker when linking a 26125shared object. Using this option, you can link position-dependent 26126code into a shared object. 26127 26128@option{-mimpure-text} suppresses the ``relocations remain against 26129allocatable but non-writable sections'' linker error message. 26130However, the necessary relocations trigger copy-on-write, and the 26131shared object is not actually shared across processes. Instead of 26132using @option{-mimpure-text}, you should compile all source code with 26133@option{-fpic} or @option{-fPIC}. 26134 26135@end table 26136 26137These switches are supported in addition to the above on Solaris 2: 26138 26139@table @gcctabopt 26140@item -pthreads 26141@opindex pthreads 26142This is a synonym for @option{-pthread}. 26143@end table 26144 26145@node SPARC Options 26146@subsection SPARC Options 26147@cindex SPARC options 26148 26149These @samp{-m} options are supported on the SPARC: 26150 26151@table @gcctabopt 26152@item -mno-app-regs 26153@itemx -mapp-regs 26154@opindex mno-app-regs 26155@opindex mapp-regs 26156Specify @option{-mapp-regs} to generate output using the global registers 261572 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 26158global register 1, each global register 2 through 4 is then treated as an 26159allocable register that is clobbered by function calls. This is the default. 26160 26161To be fully SVR4 ABI-compliant at the cost of some performance loss, 26162specify @option{-mno-app-regs}. You should compile libraries and system 26163software with this option. 26164 26165@item -mflat 26166@itemx -mno-flat 26167@opindex mflat 26168@opindex mno-flat 26169With @option{-mflat}, the compiler does not generate save/restore instructions 26170and uses a ``flat'' or single register window model. This model is compatible 26171with the regular register window model. The local registers and the input 26172registers (0--5) are still treated as ``call-saved'' registers and are 26173saved on the stack as needed. 26174 26175With @option{-mno-flat} (the default), the compiler generates save/restore 26176instructions (except for leaf functions). This is the normal operating mode. 26177 26178@item -mfpu 26179@itemx -mhard-float 26180@opindex mfpu 26181@opindex mhard-float 26182Generate output containing floating-point instructions. This is the 26183default. 26184 26185@item -mno-fpu 26186@itemx -msoft-float 26187@opindex mno-fpu 26188@opindex msoft-float 26189Generate output containing library calls for floating point. 26190@strong{Warning:} the requisite libraries are not available for all SPARC 26191targets. Normally the facilities of the machine's usual C compiler are 26192used, but this cannot be done directly in cross-compilation. You must make 26193your own arrangements to provide suitable library functions for 26194cross-compilation. The embedded targets @samp{sparc-*-aout} and 26195@samp{sparclite-*-*} do provide software floating-point support. 26196 26197@option{-msoft-float} changes the calling convention in the output file; 26198therefore, it is only useful if you compile @emph{all} of a program with 26199this option. In particular, you need to compile @file{libgcc.a}, the 26200library that comes with GCC, with @option{-msoft-float} in order for 26201this to work. 26202 26203@item -mhard-quad-float 26204@opindex mhard-quad-float 26205Generate output containing quad-word (long double) floating-point 26206instructions. 26207 26208@item -msoft-quad-float 26209@opindex msoft-quad-float 26210Generate output containing library calls for quad-word (long double) 26211floating-point instructions. The functions called are those specified 26212in the SPARC ABI@. This is the default. 26213 26214As of this writing, there are no SPARC implementations that have hardware 26215support for the quad-word floating-point instructions. They all invoke 26216a trap handler for one of these instructions, and then the trap handler 26217emulates the effect of the instruction. Because of the trap handler overhead, 26218this is much slower than calling the ABI library routines. Thus the 26219@option{-msoft-quad-float} option is the default. 26220 26221@item -mno-unaligned-doubles 26222@itemx -munaligned-doubles 26223@opindex mno-unaligned-doubles 26224@opindex munaligned-doubles 26225Assume that doubles have 8-byte alignment. This is the default. 26226 26227With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 26228alignment only if they are contained in another type, or if they have an 26229absolute address. Otherwise, it assumes they have 4-byte alignment. 26230Specifying this option avoids some rare compatibility problems with code 26231generated by other compilers. It is not the default because it results 26232in a performance loss, especially for floating-point code. 26233 26234@item -muser-mode 26235@itemx -mno-user-mode 26236@opindex muser-mode 26237@opindex mno-user-mode 26238Do not generate code that can only run in supervisor mode. This is relevant 26239only for the @code{casa} instruction emitted for the LEON3 processor. This 26240is the default. 26241 26242@item -mfaster-structs 26243@itemx -mno-faster-structs 26244@opindex mfaster-structs 26245@opindex mno-faster-structs 26246With @option{-mfaster-structs}, the compiler assumes that structures 26247should have 8-byte alignment. This enables the use of pairs of 26248@code{ldd} and @code{std} instructions for copies in structure 26249assignment, in place of twice as many @code{ld} and @code{st} pairs. 26250However, the use of this changed alignment directly violates the SPARC 26251ABI@. Thus, it's intended only for use on targets where the developer 26252acknowledges that their resulting code is not directly in line with 26253the rules of the ABI@. 26254 26255@item -mstd-struct-return 26256@itemx -mno-std-struct-return 26257@opindex mstd-struct-return 26258@opindex mno-std-struct-return 26259With @option{-mstd-struct-return}, the compiler generates checking code 26260in functions returning structures or unions to detect size mismatches 26261between the two sides of function calls, as per the 32-bit ABI@. 26262 26263The default is @option{-mno-std-struct-return}. This option has no effect 26264in 64-bit mode. 26265 26266@item -mlra 26267@itemx -mno-lra 26268@opindex mlra 26269@opindex mno-lra 26270Enable Local Register Allocation. This is the default for SPARC since GCC 7 26271so @option{-mno-lra} needs to be passed to get old Reload. 26272 26273@item -mcpu=@var{cpu_type} 26274@opindex mcpu 26275Set the instruction set, register set, and instruction scheduling parameters 26276for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 26277@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 26278@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 26279@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 26280@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 26281@samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}. 26282 26283Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 26284which selects the best architecture option for the host processor. 26285@option{-mcpu=native} has no effect if GCC does not recognize 26286the processor. 26287 26288Default instruction scheduling parameters are used for values that select 26289an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 26290@samp{sparclite}, @samp{sparclet}, @samp{v9}. 26291 26292Here is a list of each supported architecture and their supported 26293implementations. 26294 26295@table @asis 26296@item v7 26297cypress, leon3v7 26298 26299@item v8 26300supersparc, hypersparc, leon, leon3 26301 26302@item sparclite 26303f930, f934, sparclite86x 26304 26305@item sparclet 26306tsc701 26307 26308@item v9 26309ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, 26310niagara7, m8 26311@end table 26312 26313By default (unless configured otherwise), GCC generates code for the V7 26314variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 26315additionally optimizes it for the Cypress CY7C602 chip, as used in the 26316SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 26317SPARCStation 1, 2, IPX etc. 26318 26319With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 26320architecture. The only difference from V7 code is that the compiler emits 26321the integer multiply and integer divide instructions which exist in SPARC-V8 26322but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 26323optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 263242000 series. 26325 26326With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 26327the SPARC architecture. This adds the integer multiply, integer divide step 26328and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 26329With @option{-mcpu=f930}, the compiler additionally optimizes it for the 26330Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 26331@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 26332MB86934 chip, which is the more recent SPARClite with FPU@. 26333 26334With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 26335the SPARC architecture. This adds the integer multiply, multiply/accumulate, 26336integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 26337but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 26338optimizes it for the TEMIC SPARClet chip. 26339 26340With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 26341architecture. This adds 64-bit integer and floating-point move instructions, 263423 additional floating-point condition code registers and conditional move 26343instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 26344optimizes it for the Sun UltraSPARC I/II/IIi chips. With 26345@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 26346Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 26347@option{-mcpu=niagara}, the compiler additionally optimizes it for 26348Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 26349additionally optimizes it for Sun UltraSPARC T2 chips. With 26350@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 26351UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 26352additionally optimizes it for Sun UltraSPARC T4 chips. With 26353@option{-mcpu=niagara7}, the compiler additionally optimizes it for 26354Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler 26355additionally optimizes it for Oracle M8 chips. 26356 26357@item -mtune=@var{cpu_type} 26358@opindex mtune 26359Set the instruction scheduling parameters for machine type 26360@var{cpu_type}, but do not set the instruction set or register set that the 26361option @option{-mcpu=@var{cpu_type}} does. 26362 26363The same values for @option{-mcpu=@var{cpu_type}} can be used for 26364@option{-mtune=@var{cpu_type}}, but the only useful values are those 26365that select a particular CPU implementation. Those are 26366@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon}, 26367@samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934}, 26368@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 26369@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3}, 26370@samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris 26371and GNU/Linux toolchains, @samp{native} can also be used. 26372 26373@item -mv8plus 26374@itemx -mno-v8plus 26375@opindex mv8plus 26376@opindex mno-v8plus 26377With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 26378difference from the V8 ABI is that the global and out registers are 26379considered 64 bits wide. This is enabled by default on Solaris in 32-bit 26380mode for all SPARC-V9 processors. 26381 26382@item -mvis 26383@itemx -mno-vis 26384@opindex mvis 26385@opindex mno-vis 26386With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 26387Visual Instruction Set extensions. The default is @option{-mno-vis}. 26388 26389@item -mvis2 26390@itemx -mno-vis2 26391@opindex mvis2 26392@opindex mno-vis2 26393With @option{-mvis2}, GCC generates code that takes advantage of 26394version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 26395default is @option{-mvis2} when targeting a cpu that supports such 26396instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 26397also sets @option{-mvis}. 26398 26399@item -mvis3 26400@itemx -mno-vis3 26401@opindex mvis3 26402@opindex mno-vis3 26403With @option{-mvis3}, GCC generates code that takes advantage of 26404version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 26405default is @option{-mvis3} when targeting a cpu that supports such 26406instructions, such as niagara-3 and later. Setting @option{-mvis3} 26407also sets @option{-mvis2} and @option{-mvis}. 26408 26409@item -mvis4 26410@itemx -mno-vis4 26411@opindex mvis4 26412@opindex mno-vis4 26413With @option{-mvis4}, GCC generates code that takes advantage of 26414version 4.0 of the UltraSPARC Visual Instruction Set extensions. The 26415default is @option{-mvis4} when targeting a cpu that supports such 26416instructions, such as niagara-7 and later. Setting @option{-mvis4} 26417also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}. 26418 26419@item -mvis4b 26420@itemx -mno-vis4b 26421@opindex mvis4b 26422@opindex mno-vis4b 26423With @option{-mvis4b}, GCC generates code that takes advantage of 26424version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus 26425the additional VIS instructions introduced in the Oracle SPARC 26426Architecture 2017. The default is @option{-mvis4b} when targeting a 26427cpu that supports such instructions, such as m8 and later. Setting 26428@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3}, 26429@option{-mvis2} and @option{-mvis}. 26430 26431@item -mcbcond 26432@itemx -mno-cbcond 26433@opindex mcbcond 26434@opindex mno-cbcond 26435With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC 26436Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond} 26437when targeting a CPU that supports such instructions, such as Niagara-4 and 26438later. 26439 26440@item -mfmaf 26441@itemx -mno-fmaf 26442@opindex mfmaf 26443@opindex mno-fmaf 26444With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 26445Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf} 26446when targeting a CPU that supports such instructions, such as Niagara-3 and 26447later. 26448 26449@item -mfsmuld 26450@itemx -mno-fsmuld 26451@opindex mfsmuld 26452@opindex mno-fsmuld 26453With @option{-mfsmuld}, GCC generates code that takes advantage of the 26454Floating-point Multiply Single to Double (FsMULd) instruction. The default is 26455@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8 26456or V9 with FPU except @option{-mcpu=leon}. 26457 26458@item -mpopc 26459@itemx -mno-popc 26460@opindex mpopc 26461@opindex mno-popc 26462With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 26463Population Count instruction. The default is @option{-mpopc} 26464when targeting a CPU that supports such an instruction, such as Niagara-2 and 26465later. 26466 26467@item -msubxc 26468@itemx -mno-subxc 26469@opindex msubxc 26470@opindex mno-subxc 26471With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC 26472Subtract-Extended-with-Carry instruction. The default is @option{-msubxc} 26473when targeting a CPU that supports such an instruction, such as Niagara-7 and 26474later. 26475 26476@item -mfix-at697f 26477@opindex mfix-at697f 26478Enable the documented workaround for the single erratum of the Atmel AT697F 26479processor (which corresponds to erratum #13 of the AT697E processor). 26480 26481@item -mfix-ut699 26482@opindex mfix-ut699 26483Enable the documented workarounds for the floating-point errata and the data 26484cache nullify errata of the UT699 processor. 26485 26486@item -mfix-ut700 26487@opindex mfix-ut700 26488Enable the documented workaround for the back-to-back store errata of 26489the UT699E/UT700 processor. 26490 26491@item -mfix-gr712rc 26492@opindex mfix-gr712rc 26493Enable the documented workaround for the back-to-back store errata of 26494the GR712RC processor. 26495@end table 26496 26497These @samp{-m} options are supported in addition to the above 26498on SPARC-V9 processors in 64-bit environments: 26499 26500@table @gcctabopt 26501@item -m32 26502@itemx -m64 26503@opindex m32 26504@opindex m64 26505Generate code for a 32-bit or 64-bit environment. 26506The 32-bit environment sets int, long and pointer to 32 bits. 26507The 64-bit environment sets int to 32 bits and long and pointer 26508to 64 bits. 26509 26510@item -mcmodel=@var{which} 26511@opindex mcmodel 26512Set the code model to one of 26513 26514@table @samp 26515@item medlow 26516The Medium/Low code model: 64-bit addresses, programs 26517must be linked in the low 32 bits of memory. Programs can be statically 26518or dynamically linked. 26519 26520@item medmid 26521The Medium/Middle code model: 64-bit addresses, programs 26522must be linked in the low 44 bits of memory, the text and data segments must 26523be less than 2GB in size and the data segment must be located within 2GB of 26524the text segment. 26525 26526@item medany 26527The Medium/Anywhere code model: 64-bit addresses, programs 26528may be linked anywhere in memory, the text and data segments must be less 26529than 2GB in size and the data segment must be located within 2GB of the 26530text segment. 26531 26532@item embmedany 26533The Medium/Anywhere code model for embedded systems: 2653464-bit addresses, the text and data segments must be less than 2GB in 26535size, both starting anywhere in memory (determined at link time). The 26536global register %g4 points to the base of the data segment. Programs 26537are statically linked and PIC is not supported. 26538@end table 26539 26540@item -mmemory-model=@var{mem-model} 26541@opindex mmemory-model 26542Set the memory model in force on the processor to one of 26543 26544@table @samp 26545@item default 26546The default memory model for the processor and operating system. 26547 26548@item rmo 26549Relaxed Memory Order 26550 26551@item pso 26552Partial Store Order 26553 26554@item tso 26555Total Store Order 26556 26557@item sc 26558Sequential Consistency 26559@end table 26560 26561These memory models are formally defined in Appendix D of the SPARC-V9 26562architecture manual, as set in the processor's @code{PSTATE.MM} field. 26563 26564@item -mstack-bias 26565@itemx -mno-stack-bias 26566@opindex mstack-bias 26567@opindex mno-stack-bias 26568With @option{-mstack-bias}, GCC assumes that the stack pointer, and 26569frame pointer if present, are offset by @minus{}2047 which must be added back 26570when making stack frame references. This is the default in 64-bit mode. 26571Otherwise, assume no such offset is present. 26572@end table 26573 26574@node SPU Options 26575@subsection SPU Options 26576@cindex SPU options 26577 26578These @samp{-m} options are supported on the SPU: 26579 26580@table @gcctabopt 26581@item -mwarn-reloc 26582@itemx -merror-reloc 26583@opindex mwarn-reloc 26584@opindex merror-reloc 26585 26586The loader for SPU does not handle dynamic relocations. By default, GCC 26587gives an error when it generates code that requires a dynamic 26588relocation. @option{-mno-error-reloc} disables the error, 26589@option{-mwarn-reloc} generates a warning instead. 26590 26591@item -msafe-dma 26592@itemx -munsafe-dma 26593@opindex msafe-dma 26594@opindex munsafe-dma 26595 26596Instructions that initiate or test completion of DMA must not be 26597reordered with respect to loads and stores of the memory that is being 26598accessed. 26599With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect 26600memory accesses, but that can lead to inefficient code in places where the 26601memory is known to not change. Rather than mark the memory as volatile, 26602you can use @option{-msafe-dma} to tell the compiler to treat 26603the DMA instructions as potentially affecting all memory. 26604 26605@item -mbranch-hints 26606@opindex mbranch-hints 26607 26608By default, GCC generates a branch hint instruction to avoid 26609pipeline stalls for always-taken or probably-taken branches. A hint 26610is not generated closer than 8 instructions away from its branch. 26611There is little reason to disable them, except for debugging purposes, 26612or to make an object a little bit smaller. 26613 26614@item -msmall-mem 26615@itemx -mlarge-mem 26616@opindex msmall-mem 26617@opindex mlarge-mem 26618 26619By default, GCC generates code assuming that addresses are never larger 26620than 18 bits. With @option{-mlarge-mem} code is generated that assumes 26621a full 32-bit address. 26622 26623@item -mstdmain 26624@opindex mstdmain 26625 26626By default, GCC links against startup code that assumes the SPU-style 26627main function interface (which has an unconventional parameter list). 26628With @option{-mstdmain}, GCC links your program against startup 26629code that assumes a C99-style interface to @code{main}, including a 26630local copy of @code{argv} strings. 26631 26632@item -mfixed-range=@var{register-range} 26633@opindex mfixed-range 26634Generate code treating the given register range as fixed registers. 26635A fixed register is one that the register allocator cannot use. This is 26636useful when compiling kernel code. A register range is specified as 26637two registers separated by a dash. Multiple register ranges can be 26638specified separated by a comma. 26639 26640@item -mea32 26641@itemx -mea64 26642@opindex mea32 26643@opindex mea64 26644Compile code assuming that pointers to the PPU address space accessed 26645via the @code{__ea} named address space qualifier are either 32 or 64 26646bits wide. The default is 32 bits. As this is an ABI-changing option, 26647all object code in an executable must be compiled with the same setting. 26648 26649@item -maddress-space-conversion 26650@itemx -mno-address-space-conversion 26651@opindex maddress-space-conversion 26652@opindex mno-address-space-conversion 26653Allow/disallow treating the @code{__ea} address space as superset 26654of the generic address space. This enables explicit type casts 26655between @code{__ea} and generic pointer as well as implicit 26656conversions of generic pointers to @code{__ea} pointers. The 26657default is to allow address space pointer conversions. 26658 26659@item -mcache-size=@var{cache-size} 26660@opindex mcache-size 26661This option controls the version of libgcc that the compiler links to an 26662executable and selects a software-managed cache for accessing variables 26663in the @code{__ea} address space with a particular cache size. Possible 26664options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} 26665and @samp{128}. The default cache size is 64KB. 26666 26667@item -matomic-updates 26668@itemx -mno-atomic-updates 26669@opindex matomic-updates 26670@opindex mno-atomic-updates 26671This option controls the version of libgcc that the compiler links to an 26672executable and selects whether atomic updates to the software-managed 26673cache of PPU-side variables are used. If you use atomic updates, changes 26674to a PPU variable from SPU code using the @code{__ea} named address space 26675qualifier do not interfere with changes to other PPU variables residing 26676in the same cache line from PPU code. If you do not use atomic updates, 26677such interference may occur; however, writing back cache lines is 26678more efficient. The default behavior is to use atomic updates. 26679 26680@item -mdual-nops 26681@itemx -mdual-nops=@var{n} 26682@opindex mdual-nops 26683By default, GCC inserts NOPs to increase dual issue when it expects 26684it to increase performance. @var{n} can be a value from 0 to 10. A 26685smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the 26686same as @option{-mno-dual-nops}. Disabled with @option{-Os}. 26687 26688@item -mhint-max-nops=@var{n} 26689@opindex mhint-max-nops 26690Maximum number of NOPs to insert for a branch hint. A branch hint must 26691be at least 8 instructions away from the branch it is affecting. GCC 26692inserts up to @var{n} NOPs to enforce this, otherwise it does not 26693generate the branch hint. 26694 26695@item -mhint-max-distance=@var{n} 26696@opindex mhint-max-distance 26697The encoding of the branch hint instruction limits the hint to be within 26698256 instructions of the branch it is affecting. By default, GCC makes 26699sure it is within 125. 26700 26701@item -msafe-hints 26702@opindex msafe-hints 26703Work around a hardware bug that causes the SPU to stall indefinitely. 26704By default, GCC inserts the @code{hbrp} instruction to make sure 26705this stall won't happen. 26706 26707@end table 26708 26709@node System V Options 26710@subsection Options for System V 26711 26712These additional options are available on System V Release 4 for 26713compatibility with other compilers on those systems: 26714 26715@table @gcctabopt 26716@item -G 26717@opindex G 26718Create a shared object. 26719It is recommended that @option{-symbolic} or @option{-shared} be used instead. 26720 26721@item -Qy 26722@opindex Qy 26723Identify the versions of each tool used by the compiler, in a 26724@code{.ident} assembler directive in the output. 26725 26726@item -Qn 26727@opindex Qn 26728Refrain from adding @code{.ident} directives to the output file (this is 26729the default). 26730 26731@item -YP,@var{dirs} 26732@opindex YP 26733Search the directories @var{dirs}, and no others, for libraries 26734specified with @option{-l}. 26735 26736@item -Ym,@var{dir} 26737@opindex Ym 26738Look in the directory @var{dir} to find the M4 preprocessor. 26739The assembler uses this option. 26740@c This is supposed to go with a -Yd for predefined M4 macro files, but 26741@c the generic assembler that comes with Solaris takes just -Ym. 26742@end table 26743 26744@node TILE-Gx Options 26745@subsection TILE-Gx Options 26746@cindex TILE-Gx options 26747 26748These @samp{-m} options are supported on the TILE-Gx: 26749 26750@table @gcctabopt 26751@item -mcmodel=small 26752@opindex mcmodel=small 26753Generate code for the small model. The distance for direct calls is 26754limited to 500M in either direction. PC-relative addresses are 32 26755bits. Absolute addresses support the full address range. 26756 26757@item -mcmodel=large 26758@opindex mcmodel=large 26759Generate code for the large model. There is no limitation on call 26760distance, pc-relative addresses, or absolute addresses. 26761 26762@item -mcpu=@var{name} 26763@opindex mcpu 26764Selects the type of CPU to be targeted. Currently the only supported 26765type is @samp{tilegx}. 26766 26767@item -m32 26768@itemx -m64 26769@opindex m32 26770@opindex m64 26771Generate code for a 32-bit or 64-bit environment. The 32-bit 26772environment sets int, long, and pointer to 32 bits. The 64-bit 26773environment sets int to 32 bits and long and pointer to 64 bits. 26774 26775@item -mbig-endian 26776@itemx -mlittle-endian 26777@opindex mbig-endian 26778@opindex mlittle-endian 26779Generate code in big/little endian mode, respectively. 26780@end table 26781 26782@node TILEPro Options 26783@subsection TILEPro Options 26784@cindex TILEPro options 26785 26786These @samp{-m} options are supported on the TILEPro: 26787 26788@table @gcctabopt 26789@item -mcpu=@var{name} 26790@opindex mcpu 26791Selects the type of CPU to be targeted. Currently the only supported 26792type is @samp{tilepro}. 26793 26794@item -m32 26795@opindex m32 26796Generate code for a 32-bit environment, which sets int, long, and 26797pointer to 32 bits. This is the only supported behavior so the flag 26798is essentially ignored. 26799@end table 26800 26801@node V850 Options 26802@subsection V850 Options 26803@cindex V850 Options 26804 26805These @samp{-m} options are defined for V850 implementations: 26806 26807@table @gcctabopt 26808@item -mlong-calls 26809@itemx -mno-long-calls 26810@opindex mlong-calls 26811@opindex mno-long-calls 26812Treat all calls as being far away (near). If calls are assumed to be 26813far away, the compiler always loads the function's address into a 26814register, and calls indirect through the pointer. 26815 26816@item -mno-ep 26817@itemx -mep 26818@opindex mno-ep 26819@opindex mep 26820Do not optimize (do optimize) basic blocks that use the same index 26821pointer 4 or more times to copy pointer into the @code{ep} register, and 26822use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 26823option is on by default if you optimize. 26824 26825@item -mno-prolog-function 26826@itemx -mprolog-function 26827@opindex mno-prolog-function 26828@opindex mprolog-function 26829Do not use (do use) external functions to save and restore registers 26830at the prologue and epilogue of a function. The external functions 26831are slower, but use less code space if more than one function saves 26832the same number of registers. The @option{-mprolog-function} option 26833is on by default if you optimize. 26834 26835@item -mspace 26836@opindex mspace 26837Try to make the code as small as possible. At present, this just turns 26838on the @option{-mep} and @option{-mprolog-function} options. 26839 26840@item -mtda=@var{n} 26841@opindex mtda 26842Put static or global variables whose size is @var{n} bytes or less into 26843the tiny data area that register @code{ep} points to. The tiny data 26844area can hold up to 256 bytes in total (128 bytes for byte references). 26845 26846@item -msda=@var{n} 26847@opindex msda 26848Put static or global variables whose size is @var{n} bytes or less into 26849the small data area that register @code{gp} points to. The small data 26850area can hold up to 64 kilobytes. 26851 26852@item -mzda=@var{n} 26853@opindex mzda 26854Put static or global variables whose size is @var{n} bytes or less into 26855the first 32 kilobytes of memory. 26856 26857@item -mv850 26858@opindex mv850 26859Specify that the target processor is the V850. 26860 26861@item -mv850e3v5 26862@opindex mv850e3v5 26863Specify that the target processor is the V850E3V5. The preprocessor 26864constant @code{__v850e3v5__} is defined if this option is used. 26865 26866@item -mv850e2v4 26867@opindex mv850e2v4 26868Specify that the target processor is the V850E3V5. This is an alias for 26869the @option{-mv850e3v5} option. 26870 26871@item -mv850e2v3 26872@opindex mv850e2v3 26873Specify that the target processor is the V850E2V3. The preprocessor 26874constant @code{__v850e2v3__} is defined if this option is used. 26875 26876@item -mv850e2 26877@opindex mv850e2 26878Specify that the target processor is the V850E2. The preprocessor 26879constant @code{__v850e2__} is defined if this option is used. 26880 26881@item -mv850e1 26882@opindex mv850e1 26883Specify that the target processor is the V850E1. The preprocessor 26884constants @code{__v850e1__} and @code{__v850e__} are defined if 26885this option is used. 26886 26887@item -mv850es 26888@opindex mv850es 26889Specify that the target processor is the V850ES. This is an alias for 26890the @option{-mv850e1} option. 26891 26892@item -mv850e 26893@opindex mv850e 26894Specify that the target processor is the V850E@. The preprocessor 26895constant @code{__v850e__} is defined if this option is used. 26896 26897If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 26898nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 26899are defined then a default target processor is chosen and the 26900relevant @samp{__v850*__} preprocessor constant is defined. 26901 26902The preprocessor constants @code{__v850} and @code{__v851__} are always 26903defined, regardless of which processor variant is the target. 26904 26905@item -mdisable-callt 26906@itemx -mno-disable-callt 26907@opindex mdisable-callt 26908@opindex mno-disable-callt 26909This option suppresses generation of the @code{CALLT} instruction for the 26910v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 26911architecture. 26912 26913This option is enabled by default when the RH850 ABI is 26914in use (see @option{-mrh850-abi}), and disabled by default when the 26915GCC ABI is in use. If @code{CALLT} instructions are being generated 26916then the C preprocessor symbol @code{__V850_CALLT__} is defined. 26917 26918@item -mrelax 26919@itemx -mno-relax 26920@opindex mrelax 26921@opindex mno-relax 26922Pass on (or do not pass on) the @option{-mrelax} command-line option 26923to the assembler. 26924 26925@item -mlong-jumps 26926@itemx -mno-long-jumps 26927@opindex mlong-jumps 26928@opindex mno-long-jumps 26929Disable (or re-enable) the generation of PC-relative jump instructions. 26930 26931@item -msoft-float 26932@itemx -mhard-float 26933@opindex msoft-float 26934@opindex mhard-float 26935Disable (or re-enable) the generation of hardware floating point 26936instructions. This option is only significant when the target 26937architecture is @samp{V850E2V3} or higher. If hardware floating point 26938instructions are being generated then the C preprocessor symbol 26939@code{__FPU_OK__} is defined, otherwise the symbol 26940@code{__NO_FPU__} is defined. 26941 26942@item -mloop 26943@opindex mloop 26944Enables the use of the e3v5 LOOP instruction. The use of this 26945instruction is not enabled by default when the e3v5 architecture is 26946selected because its use is still experimental. 26947 26948@item -mrh850-abi 26949@itemx -mghs 26950@opindex mrh850-abi 26951@opindex mghs 26952Enables support for the RH850 version of the V850 ABI. This is the 26953default. With this version of the ABI the following rules apply: 26954 26955@itemize 26956@item 26957Integer sized structures and unions are returned via a memory pointer 26958rather than a register. 26959 26960@item 26961Large structures and unions (more than 8 bytes in size) are passed by 26962value. 26963 26964@item 26965Functions are aligned to 16-bit boundaries. 26966 26967@item 26968The @option{-m8byte-align} command-line option is supported. 26969 26970@item 26971The @option{-mdisable-callt} command-line option is enabled by 26972default. The @option{-mno-disable-callt} command-line option is not 26973supported. 26974@end itemize 26975 26976When this version of the ABI is enabled the C preprocessor symbol 26977@code{__V850_RH850_ABI__} is defined. 26978 26979@item -mgcc-abi 26980@opindex mgcc-abi 26981Enables support for the old GCC version of the V850 ABI. With this 26982version of the ABI the following rules apply: 26983 26984@itemize 26985@item 26986Integer sized structures and unions are returned in register @code{r10}. 26987 26988@item 26989Large structures and unions (more than 8 bytes in size) are passed by 26990reference. 26991 26992@item 26993Functions are aligned to 32-bit boundaries, unless optimizing for 26994size. 26995 26996@item 26997The @option{-m8byte-align} command-line option is not supported. 26998 26999@item 27000The @option{-mdisable-callt} command-line option is supported but not 27001enabled by default. 27002@end itemize 27003 27004When this version of the ABI is enabled the C preprocessor symbol 27005@code{__V850_GCC_ABI__} is defined. 27006 27007@item -m8byte-align 27008@itemx -mno-8byte-align 27009@opindex m8byte-align 27010@opindex mno-8byte-align 27011Enables support for @code{double} and @code{long long} types to be 27012aligned on 8-byte boundaries. The default is to restrict the 27013alignment of all objects to at most 4-bytes. When 27014@option{-m8byte-align} is in effect the C preprocessor symbol 27015@code{__V850_8BYTE_ALIGN__} is defined. 27016 27017@item -mbig-switch 27018@opindex mbig-switch 27019Generate code suitable for big switch tables. Use this option only if 27020the assembler/linker complain about out of range branches within a switch 27021table. 27022 27023@item -mapp-regs 27024@opindex mapp-regs 27025This option causes r2 and r5 to be used in the code generated by 27026the compiler. This setting is the default. 27027 27028@item -mno-app-regs 27029@opindex mno-app-regs 27030This option causes r2 and r5 to be treated as fixed registers. 27031 27032@end table 27033 27034@node VAX Options 27035@subsection VAX Options 27036@cindex VAX options 27037 27038These @samp{-m} options are defined for the VAX: 27039 27040@table @gcctabopt 27041@item -munix 27042@opindex munix 27043Do not output certain jump instructions (@code{aobleq} and so on) 27044that the Unix assembler for the VAX cannot handle across long 27045ranges. 27046 27047@item -mgnu 27048@opindex mgnu 27049Do output those jump instructions, on the assumption that the 27050GNU assembler is being used. 27051 27052@item -mg 27053@opindex mg 27054Output code for G-format floating-point numbers instead of D-format. 27055@end table 27056 27057@node Visium Options 27058@subsection Visium Options 27059@cindex Visium options 27060 27061@table @gcctabopt 27062 27063@item -mdebug 27064@opindex mdebug 27065A program which performs file I/O and is destined to run on an MCM target 27066should be linked with this option. It causes the libraries libc.a and 27067libdebug.a to be linked. The program should be run on the target under 27068the control of the GDB remote debugging stub. 27069 27070@item -msim 27071@opindex msim 27072A program which performs file I/O and is destined to run on the simulator 27073should be linked with option. This causes libraries libc.a and libsim.a to 27074be linked. 27075 27076@item -mfpu 27077@itemx -mhard-float 27078@opindex mfpu 27079@opindex mhard-float 27080Generate code containing floating-point instructions. This is the 27081default. 27082 27083@item -mno-fpu 27084@itemx -msoft-float 27085@opindex mno-fpu 27086@opindex msoft-float 27087Generate code containing library calls for floating-point. 27088 27089@option{-msoft-float} changes the calling convention in the output file; 27090therefore, it is only useful if you compile @emph{all} of a program with 27091this option. In particular, you need to compile @file{libgcc.a}, the 27092library that comes with GCC, with @option{-msoft-float} in order for 27093this to work. 27094 27095@item -mcpu=@var{cpu_type} 27096@opindex mcpu 27097Set the instruction set, register set, and instruction scheduling parameters 27098for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 27099@samp{mcm}, @samp{gr5} and @samp{gr6}. 27100 27101@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 27102 27103By default (unless configured otherwise), GCC generates code for the GR5 27104variant of the Visium architecture. 27105 27106With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 27107architecture. The only difference from GR5 code is that the compiler will 27108generate block move instructions. 27109 27110@item -mtune=@var{cpu_type} 27111@opindex mtune 27112Set the instruction scheduling parameters for machine type @var{cpu_type}, 27113but do not set the instruction set or register set that the option 27114@option{-mcpu=@var{cpu_type}} would. 27115 27116@item -msv-mode 27117@opindex msv-mode 27118Generate code for the supervisor mode, where there are no restrictions on 27119the access to general registers. This is the default. 27120 27121@item -muser-mode 27122@opindex muser-mode 27123Generate code for the user mode, where the access to some general registers 27124is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 27125mode; on the GR6, only registers r29 to r31 are affected. 27126@end table 27127 27128@node VMS Options 27129@subsection VMS Options 27130 27131These @samp{-m} options are defined for the VMS implementations: 27132 27133@table @gcctabopt 27134@item -mvms-return-codes 27135@opindex mvms-return-codes 27136Return VMS condition codes from @code{main}. The default is to return POSIX-style 27137condition (e.g.@: error) codes. 27138 27139@item -mdebug-main=@var{prefix} 27140@opindex mdebug-main=@var{prefix} 27141Flag the first routine whose name starts with @var{prefix} as the main 27142routine for the debugger. 27143 27144@item -mmalloc64 27145@opindex mmalloc64 27146Default to 64-bit memory allocation routines. 27147 27148@item -mpointer-size=@var{size} 27149@opindex mpointer-size=@var{size} 27150Set the default size of pointers. Possible options for @var{size} are 27151@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 27152for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 27153The later option disables @code{pragma pointer_size}. 27154@end table 27155 27156@node VxWorks Options 27157@subsection VxWorks Options 27158@cindex VxWorks Options 27159 27160The options in this section are defined for all VxWorks targets. 27161Options specific to the target hardware are listed with the other 27162options for that target. 27163 27164@table @gcctabopt 27165@item -mrtp 27166@opindex mrtp 27167GCC can generate code for both VxWorks kernels and real time processes 27168(RTPs). This option switches from the former to the latter. It also 27169defines the preprocessor macro @code{__RTP__}. 27170 27171@item -non-static 27172@opindex non-static 27173Link an RTP executable against shared libraries rather than static 27174libraries. The options @option{-static} and @option{-shared} can 27175also be used for RTPs (@pxref{Link Options}); @option{-static} 27176is the default. 27177 27178@item -Bstatic 27179@itemx -Bdynamic 27180@opindex Bstatic 27181@opindex Bdynamic 27182These options are passed down to the linker. They are defined for 27183compatibility with Diab. 27184 27185@item -Xbind-lazy 27186@opindex Xbind-lazy 27187Enable lazy binding of function calls. This option is equivalent to 27188@option{-Wl,-z,now} and is defined for compatibility with Diab. 27189 27190@item -Xbind-now 27191@opindex Xbind-now 27192Disable lazy binding of function calls. This option is the default and 27193is defined for compatibility with Diab. 27194@end table 27195 27196@node x86 Options 27197@subsection x86 Options 27198@cindex x86 Options 27199 27200These @samp{-m} options are defined for the x86 family of computers. 27201 27202@table @gcctabopt 27203 27204@item -march=@var{cpu-type} 27205@opindex march 27206Generate instructions for the machine type @var{cpu-type}. In contrast to 27207@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 27208for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 27209to generate code that may not run at all on processors other than the one 27210indicated. Specifying @option{-march=@var{cpu-type}} implies 27211@option{-mtune=@var{cpu-type}}. 27212 27213The choices for @var{cpu-type} are: 27214 27215@table @samp 27216@item native 27217This selects the CPU to generate code for at compilation time by determining 27218the processor type of the compiling machine. Using @option{-march=native} 27219enables all instruction subsets supported by the local machine (hence 27220the result might not run on different machines). Using @option{-mtune=native} 27221produces code optimized for the local machine under the constraints 27222of the selected instruction set. 27223 27224@item x86-64 27225A generic CPU with 64-bit extensions. 27226 27227@item i386 27228Original Intel i386 CPU@. 27229 27230@item i486 27231Intel i486 CPU@. (No scheduling is implemented for this chip.) 27232 27233@item i586 27234@itemx pentium 27235Intel Pentium CPU with no MMX support. 27236 27237@item lakemont 27238Intel Lakemont MCU, based on Intel Pentium CPU. 27239 27240@item pentium-mmx 27241Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 27242 27243@item pentiumpro 27244Intel Pentium Pro CPU@. 27245 27246@item i686 27247When used with @option{-march}, the Pentium Pro 27248instruction set is used, so the code runs on all i686 family chips. 27249When used with @option{-mtune}, it has the same meaning as @samp{generic}. 27250 27251@item pentium2 27252Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 27253support. 27254 27255@item pentium3 27256@itemx pentium3m 27257Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 27258set support. 27259 27260@item pentium-m 27261Intel Pentium M; low-power version of Intel Pentium III CPU 27262with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 27263 27264@item pentium4 27265@itemx pentium4m 27266Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 27267 27268@item prescott 27269Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 27270set support. 27271 27272@item nocona 27273Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 27274SSE2 and SSE3 instruction set support. 27275 27276@item core2 27277Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 27278instruction set support. 27279 27280@item nehalem 27281Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27282SSE4.1, SSE4.2 and POPCNT instruction set support. 27283 27284@item westmere 27285Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27286SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. 27287 27288@item sandybridge 27289Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27290SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. 27291 27292@item ivybridge 27293Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 27294SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C 27295instruction set support. 27296 27297@item haswell 27298Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27299SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27300BMI, BMI2 and F16C instruction set support. 27301 27302@item broadwell 27303Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27304SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, 27305F16C, RDSEED ADCX and PREFETCHW instruction set support. 27306 27307@item skylake 27308Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27309SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27310BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES 27311instruction set support. 27312 27313@item bonnell 27314Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 27315instruction set support. 27316 27317@item silvermont 27318Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27319SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support. 27320 27321@item goldmont 27322Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27323SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, 27324XSAVEOPT and FSGSBASE instruction set support. 27325 27326@item goldmont-plus 27327Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27328SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, 27329XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support. 27330 27331@item tremont 27332Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27333SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, 27334XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, 27335MOVDIR64B, CLDEMOTE and WAITPKG instruction set support. 27336 27337@item knl 27338Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27339SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27340BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, 27341AVX512ER and AVX512CD instruction set support. 27342 27343@item knm 27344Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27345SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27346BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, 27347AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction 27348set support. 27349 27350@item skylake-avx512 27351Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 27352SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 27353BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, 27354CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support. 27355 27356@item cannonlake 27357Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 27358SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 27359RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 27360XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 27361AVX512IFMA, SHA and UMIP instruction set support. 27362 27363@item icelake-client 27364Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 27365SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 27366RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 27367XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 27368AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 27369AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support. 27370 27371@item icelake-server 27372Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 27373SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 27374RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 27375XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 27376AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 27377AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction 27378set support. 27379 27380@item cascadelake 27381Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27382SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, 27383BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, 27384AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support. 27385 27386@item tigerlake 27387Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 27388SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, 27389BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, 27390AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP, 27391RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ, 27392VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and CLWB instruction set support. 27393 27394@item k6 27395AMD K6 CPU with MMX instruction set support. 27396 27397@item k6-2 27398@itemx k6-3 27399Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 27400 27401@item athlon 27402@itemx athlon-tbird 27403AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 27404support. 27405 27406@item athlon-4 27407@itemx athlon-xp 27408@itemx athlon-mp 27409Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 27410instruction set support. 27411 27412@item k8 27413@itemx opteron 27414@itemx athlon64 27415@itemx athlon-fx 27416Processors based on the AMD K8 core with x86-64 instruction set support, 27417including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 27418(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 27419instruction set extensions.) 27420 27421@item k8-sse3 27422@itemx opteron-sse3 27423@itemx athlon64-sse3 27424Improved versions of AMD K8 cores with SSE3 instruction set support. 27425 27426@item amdfam10 27427@itemx barcelona 27428CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 27429supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 27430instruction set extensions.) 27431 27432@item bdver1 27433CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 27434supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 27435SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 27436@item bdver2 27437AMD Family 15h core based CPUs with x86-64 instruction set support. (This 27438supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, 27439SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 27440extensions.) 27441@item bdver3 27442AMD Family 15h core based CPUs with x86-64 instruction set support. (This 27443supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 27444PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 2744564-bit instruction set extensions. 27446@item bdver4 27447AMD Family 15h core based CPUs with x86-64 instruction set support. (This 27448supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 27449AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 27450SSE4.2, ABM and 64-bit instruction set extensions. 27451 27452@item znver1 27453AMD Family 17h core based CPUs with x86-64 instruction set support. (This 27454supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, 27455SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, 27456SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 27457instruction set extensions. 27458@item znver2 27459AMD Family 17h core based CPUs with x86-64 instruction set support. (This 27460supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 27461MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 27462SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 27463instruction set extensions.) 27464 27465 27466@item btver1 27467CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 27468supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 27469instruction set extensions.) 27470 27471@item btver2 27472CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 27473includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, 27474SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 27475 27476@item winchip-c6 27477IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 27478set support. 27479 27480@item winchip2 27481IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 27482instruction set support. 27483 27484@item c3 27485VIA C3 CPU with MMX and 3DNow!@: instruction set support. 27486(No scheduling is implemented for this chip.) 27487 27488@item c3-2 27489VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 27490(No scheduling is implemented for this chip.) 27491 27492@item c7 27493VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 27494(No scheduling is implemented for this chip.) 27495 27496@item samuel-2 27497VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support. 27498(No scheduling is implemented for this chip.) 27499 27500@item nehemiah 27501VIA Eden Nehemiah CPU with MMX and SSE instruction set support. 27502(No scheduling is implemented for this chip.) 27503 27504@item esther 27505VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 27506(No scheduling is implemented for this chip.) 27507 27508@item eden-x2 27509VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. 27510(No scheduling is implemented for this chip.) 27511 27512@item eden-x4 27513VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, 27514AVX and AVX2 instruction set support. 27515(No scheduling is implemented for this chip.) 27516 27517@item nano 27518Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 27519instruction set support. 27520(No scheduling is implemented for this chip.) 27521 27522@item nano-1000 27523VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 27524instruction set support. 27525(No scheduling is implemented for this chip.) 27526 27527@item nano-2000 27528VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 27529instruction set support. 27530(No scheduling is implemented for this chip.) 27531 27532@item nano-3000 27533VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 27534instruction set support. 27535(No scheduling is implemented for this chip.) 27536 27537@item nano-x2 27538VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 27539instruction set support. 27540(No scheduling is implemented for this chip.) 27541 27542@item nano-x4 27543VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 27544instruction set support. 27545(No scheduling is implemented for this chip.) 27546 27547@item geode 27548AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 27549@end table 27550 27551@item -mtune=@var{cpu-type} 27552@opindex mtune 27553Tune to @var{cpu-type} everything applicable about the generated code, except 27554for the ABI and the set of available instructions. 27555While picking a specific @var{cpu-type} schedules things appropriately 27556for that particular chip, the compiler does not generate any code that 27557cannot run on the default machine type unless you use a 27558@option{-march=@var{cpu-type}} option. 27559For example, if GCC is configured for i686-pc-linux-gnu 27560then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 27561but still runs on i686 machines. 27562 27563The choices for @var{cpu-type} are the same as for @option{-march}. 27564In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 27565 27566@table @samp 27567@item generic 27568Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 27569If you know the CPU on which your code will run, then you should use 27570the corresponding @option{-mtune} or @option{-march} option instead of 27571@option{-mtune=generic}. But, if you do not know exactly what CPU users 27572of your application will have, then you should use this option. 27573 27574As new processors are deployed in the marketplace, the behavior of this 27575option will change. Therefore, if you upgrade to a newer version of 27576GCC, code generation controlled by this option will change to reflect 27577the processors 27578that are most common at the time that version of GCC is released. 27579 27580There is no @option{-march=generic} option because @option{-march} 27581indicates the instruction set the compiler can use, and there is no 27582generic instruction set applicable to all processors. In contrast, 27583@option{-mtune} indicates the processor (or, in this case, collection of 27584processors) for which the code is optimized. 27585 27586@item intel 27587Produce code optimized for the most current Intel processors, which are 27588Haswell and Silvermont for this version of GCC. If you know the CPU 27589on which your code will run, then you should use the corresponding 27590@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 27591But, if you want your application performs better on both Haswell and 27592Silvermont, then you should use this option. 27593 27594As new Intel processors are deployed in the marketplace, the behavior of 27595this option will change. Therefore, if you upgrade to a newer version of 27596GCC, code generation controlled by this option will change to reflect 27597the most current Intel processors at the time that version of GCC is 27598released. 27599 27600There is no @option{-march=intel} option because @option{-march} indicates 27601the instruction set the compiler can use, and there is no common 27602instruction set applicable to all processors. In contrast, 27603@option{-mtune} indicates the processor (or, in this case, collection of 27604processors) for which the code is optimized. 27605@end table 27606 27607@item -mcpu=@var{cpu-type} 27608@opindex mcpu 27609A deprecated synonym for @option{-mtune}. 27610 27611@item -mfpmath=@var{unit} 27612@opindex mfpmath 27613Generate floating-point arithmetic for selected unit @var{unit}. The choices 27614for @var{unit} are: 27615 27616@table @samp 27617@item 387 27618Use the standard 387 floating-point coprocessor present on the majority of chips and 27619emulated otherwise. Code compiled with this option runs almost everywhere. 27620The temporary results are computed in 80-bit precision instead of the precision 27621specified by the type, resulting in slightly different results compared to most 27622of other chips. See @option{-ffloat-store} for more detailed description. 27623 27624This is the default choice for non-Darwin x86-32 targets. 27625 27626@item sse 27627Use scalar floating-point instructions present in the SSE instruction set. 27628This instruction set is supported by Pentium III and newer chips, 27629and in the AMD line 27630by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 27631instruction set supports only single-precision arithmetic, thus the double and 27632extended-precision arithmetic are still done using 387. A later version, present 27633only in Pentium 4 and AMD x86-64 chips, supports double-precision 27634arithmetic too. 27635 27636For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 27637or @option{-msse2} switches to enable SSE extensions and make this option 27638effective. For the x86-64 compiler, these extensions are enabled by default. 27639 27640The resulting code should be considerably faster in the majority of cases and avoid 27641the numerical instability problems of 387 code, but may break some existing 27642code that expects temporaries to be 80 bits. 27643 27644This is the default choice for the x86-64 compiler, Darwin x86-32 targets, 27645and the default choice for x86-32 targets with the SSE2 instruction set 27646when @option{-ffast-math} is enabled. 27647 27648@item sse,387 27649@itemx sse+387 27650@itemx both 27651Attempt to utilize both instruction sets at once. This effectively doubles the 27652amount of available registers, and on chips with separate execution units for 27653387 and SSE the execution resources too. Use this option with care, as it is 27654still experimental, because the GCC register allocator does not model separate 27655functional units well, resulting in unstable performance. 27656@end table 27657 27658@item -masm=@var{dialect} 27659@opindex masm=@var{dialect} 27660Output assembly instructions using selected @var{dialect}. Also affects 27661which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 27662extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 27663order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 27664not support @samp{intel}. 27665 27666@item -mieee-fp 27667@itemx -mno-ieee-fp 27668@opindex mieee-fp 27669@opindex mno-ieee-fp 27670Control whether or not the compiler uses IEEE floating-point 27671comparisons. These correctly handle the case where the result of a 27672comparison is unordered. 27673 27674@item -m80387 27675@itemx -mhard-float 27676@opindex 80387 27677@opindex mhard-float 27678Generate output containing 80387 instructions for floating point. 27679 27680@item -mno-80387 27681@itemx -msoft-float 27682@opindex no-80387 27683@opindex msoft-float 27684Generate output containing library calls for floating point. 27685 27686@strong{Warning:} the requisite libraries are not part of GCC@. 27687Normally the facilities of the machine's usual C compiler are used, but 27688this cannot be done directly in cross-compilation. You must make your 27689own arrangements to provide suitable library functions for 27690cross-compilation. 27691 27692On machines where a function returns floating-point results in the 80387 27693register stack, some floating-point opcodes may be emitted even if 27694@option{-msoft-float} is used. 27695 27696@item -mno-fp-ret-in-387 27697@opindex mno-fp-ret-in-387 27698@opindex mfp-ret-in-387 27699Do not use the FPU registers for return values of functions. 27700 27701The usual calling convention has functions return values of types 27702@code{float} and @code{double} in an FPU register, even if there 27703is no FPU@. The idea is that the operating system should emulate 27704an FPU@. 27705 27706The option @option{-mno-fp-ret-in-387} causes such values to be returned 27707in ordinary CPU registers instead. 27708 27709@item -mno-fancy-math-387 27710@opindex mno-fancy-math-387 27711@opindex mfancy-math-387 27712Some 387 emulators do not support the @code{sin}, @code{cos} and 27713@code{sqrt} instructions for the 387. Specify this option to avoid 27714generating those instructions. 27715This option is overridden when @option{-march} 27716indicates that the target CPU always has an FPU and so the 27717instruction does not need emulation. These 27718instructions are not generated unless you also use the 27719@option{-funsafe-math-optimizations} switch. 27720 27721@item -malign-double 27722@itemx -mno-align-double 27723@opindex malign-double 27724@opindex mno-align-double 27725Control whether GCC aligns @code{double}, @code{long double}, and 27726@code{long long} variables on a two-word boundary or a one-word 27727boundary. Aligning @code{double} variables on a two-word boundary 27728produces code that runs somewhat faster on a Pentium at the 27729expense of more memory. 27730 27731On x86-64, @option{-malign-double} is enabled by default. 27732 27733@strong{Warning:} if you use the @option{-malign-double} switch, 27734structures containing the above types are aligned differently than 27735the published application binary interface specifications for the x86-32 27736and are not binary compatible with structures in code compiled 27737without that switch. 27738 27739@item -m96bit-long-double 27740@itemx -m128bit-long-double 27741@opindex m96bit-long-double 27742@opindex m128bit-long-double 27743These switches control the size of @code{long double} type. The x86-32 27744application binary interface specifies the size to be 96 bits, 27745so @option{-m96bit-long-double} is the default in 32-bit mode. 27746 27747Modern architectures (Pentium and newer) prefer @code{long double} 27748to be aligned to an 8- or 16-byte boundary. In arrays or structures 27749conforming to the ABI, this is not possible. So specifying 27750@option{-m128bit-long-double} aligns @code{long double} 27751to a 16-byte boundary by padding the @code{long double} with an additional 2775232-bit zero. 27753 27754In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 27755its ABI specifies that @code{long double} is aligned on 16-byte boundary. 27756 27757Notice that neither of these options enable any extra precision over the x87 27758standard of 80 bits for a @code{long double}. 27759 27760@strong{Warning:} if you override the default value for your target ABI, this 27761changes the size of 27762structures and arrays containing @code{long double} variables, 27763as well as modifying the function calling convention for functions taking 27764@code{long double}. Hence they are not binary-compatible 27765with code compiled without that switch. 27766 27767@item -mlong-double-64 27768@itemx -mlong-double-80 27769@itemx -mlong-double-128 27770@opindex mlong-double-64 27771@opindex mlong-double-80 27772@opindex mlong-double-128 27773These switches control the size of @code{long double} type. A size 27774of 64 bits makes the @code{long double} type equivalent to the @code{double} 27775type. This is the default for 32-bit Bionic C library. A size 27776of 128 bits makes the @code{long double} type equivalent to the 27777@code{__float128} type. This is the default for 64-bit Bionic C library. 27778 27779@strong{Warning:} if you override the default value for your target ABI, this 27780changes the size of 27781structures and arrays containing @code{long double} variables, 27782as well as modifying the function calling convention for functions taking 27783@code{long double}. Hence they are not binary-compatible 27784with code compiled without that switch. 27785 27786@item -malign-data=@var{type} 27787@opindex malign-data 27788Control how GCC aligns variables. Supported values for @var{type} are 27789@samp{compat} uses increased alignment value compatible uses GCC 4.8 27790and earlier, @samp{abi} uses alignment value as specified by the 27791psABI, and @samp{cacheline} uses increased alignment value to match 27792the cache line size. @samp{compat} is the default. 27793 27794@item -mlarge-data-threshold=@var{threshold} 27795@opindex mlarge-data-threshold 27796When @option{-mcmodel=medium} is specified, data objects larger than 27797@var{threshold} are placed in the large data section. This value must be the 27798same across all objects linked into the binary, and defaults to 65535. 27799 27800@item -mrtd 27801@opindex mrtd 27802Use a different function-calling convention, in which functions that 27803take a fixed number of arguments return with the @code{ret @var{num}} 27804instruction, which pops their arguments while returning. This saves one 27805instruction in the caller since there is no need to pop the arguments 27806there. 27807 27808You can specify that an individual function is called with this calling 27809sequence with the function attribute @code{stdcall}. You can also 27810override the @option{-mrtd} option by using the function attribute 27811@code{cdecl}. @xref{Function Attributes}. 27812 27813@strong{Warning:} this calling convention is incompatible with the one 27814normally used on Unix, so you cannot use it if you need to call 27815libraries compiled with the Unix compiler. 27816 27817Also, you must provide function prototypes for all functions that 27818take variable numbers of arguments (including @code{printf}); 27819otherwise incorrect code is generated for calls to those 27820functions. 27821 27822In addition, seriously incorrect code results if you call a 27823function with too many arguments. (Normally, extra arguments are 27824harmlessly ignored.) 27825 27826@item -mregparm=@var{num} 27827@opindex mregparm 27828Control how many registers are used to pass integer arguments. By 27829default, no registers are used to pass arguments, and at most 3 27830registers can be used. You can control this behavior for a specific 27831function by using the function attribute @code{regparm}. 27832@xref{Function Attributes}. 27833 27834@strong{Warning:} if you use this switch, and 27835@var{num} is nonzero, then you must build all modules with the same 27836value, including any libraries. This includes the system libraries and 27837startup modules. 27838 27839@item -msseregparm 27840@opindex msseregparm 27841Use SSE register passing conventions for float and double arguments 27842and return values. You can control this behavior for a specific 27843function by using the function attribute @code{sseregparm}. 27844@xref{Function Attributes}. 27845 27846@strong{Warning:} if you use this switch then you must build all 27847modules with the same value, including any libraries. This includes 27848the system libraries and startup modules. 27849 27850@item -mvect8-ret-in-mem 27851@opindex mvect8-ret-in-mem 27852Return 8-byte vectors in memory instead of MMX registers. This is the 27853default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun 27854Studio compilers until version 12. Later compiler versions (starting 27855with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which 27856is the default on Solaris@tie{}10 and later. @emph{Only} use this option if 27857you need to remain compatible with existing code produced by those 27858previous compiler versions or older versions of GCC@. 27859 27860@item -mpc32 27861@itemx -mpc64 27862@itemx -mpc80 27863@opindex mpc32 27864@opindex mpc64 27865@opindex mpc80 27866 27867Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 27868is specified, the significands of results of floating-point operations are 27869rounded to 24 bits (single precision); @option{-mpc64} rounds the 27870significands of results of floating-point operations to 53 bits (double 27871precision) and @option{-mpc80} rounds the significands of results of 27872floating-point operations to 64 bits (extended double precision), which is 27873the default. When this option is used, floating-point operations in higher 27874precisions are not available to the programmer without setting the FPU 27875control word explicitly. 27876 27877Setting the rounding of floating-point operations to less than the default 2787880 bits can speed some programs by 2% or more. Note that some mathematical 27879libraries assume that extended-precision (80-bit) floating-point operations 27880are enabled by default; routines in such libraries could suffer significant 27881loss of accuracy, typically through so-called ``catastrophic cancellation'', 27882when this option is used to set the precision to less than extended precision. 27883 27884@item -mstackrealign 27885@opindex mstackrealign 27886Realign the stack at entry. On the x86, the @option{-mstackrealign} 27887option generates an alternate prologue and epilogue that realigns the 27888run-time stack if necessary. This supports mixing legacy codes that keep 278894-byte stack alignment with modern codes that keep 16-byte stack alignment for 27890SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 27891applicable to individual functions. 27892 27893@item -mpreferred-stack-boundary=@var{num} 27894@opindex mpreferred-stack-boundary 27895Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 27896byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 27897the default is 4 (16 bytes or 128 bits). 27898 27899@strong{Warning:} When generating code for the x86-64 architecture with 27900SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 27901used to keep the stack boundary aligned to 8 byte boundary. Since 27902x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 27903intended to be used in controlled environment where stack space is 27904important limitation. This option leads to wrong code when functions 27905compiled with 16 byte stack alignment (such as functions from a standard 27906library) are called with misaligned stack. In this case, SSE 27907instructions may lead to misaligned memory access traps. In addition, 27908variable arguments are handled incorrectly for 16 byte aligned 27909objects (including x87 long double and __int128), leading to wrong 27910results. You must build all modules with 27911@option{-mpreferred-stack-boundary=3}, including any libraries. This 27912includes the system libraries and startup modules. 27913 27914@item -mincoming-stack-boundary=@var{num} 27915@opindex mincoming-stack-boundary 27916Assume the incoming stack is aligned to a 2 raised to @var{num} byte 27917boundary. If @option{-mincoming-stack-boundary} is not specified, 27918the one specified by @option{-mpreferred-stack-boundary} is used. 27919 27920On Pentium and Pentium Pro, @code{double} and @code{long double} values 27921should be aligned to an 8-byte boundary (see @option{-malign-double}) or 27922suffer significant run time performance penalties. On Pentium III, the 27923Streaming SIMD Extension (SSE) data type @code{__m128} may not work 27924properly if it is not 16-byte aligned. 27925 27926To ensure proper alignment of this values on the stack, the stack boundary 27927must be as aligned as that required by any value stored on the stack. 27928Further, every function must be generated such that it keeps the stack 27929aligned. Thus calling a function compiled with a higher preferred 27930stack boundary from a function compiled with a lower preferred stack 27931boundary most likely misaligns the stack. It is recommended that 27932libraries that use callbacks always use the default setting. 27933 27934This extra alignment does consume extra stack space, and generally 27935increases code size. Code that is sensitive to stack space usage, such 27936as embedded systems and operating system kernels, may want to reduce the 27937preferred alignment to @option{-mpreferred-stack-boundary=2}. 27938 27939@need 200 27940@item -mmmx 27941@opindex mmmx 27942@need 200 27943@itemx -msse 27944@opindex msse 27945@need 200 27946@itemx -msse2 27947@opindex msse2 27948@need 200 27949@itemx -msse3 27950@opindex msse3 27951@need 200 27952@itemx -mssse3 27953@opindex mssse3 27954@need 200 27955@itemx -msse4 27956@opindex msse4 27957@need 200 27958@itemx -msse4a 27959@opindex msse4a 27960@need 200 27961@itemx -msse4.1 27962@opindex msse4.1 27963@need 200 27964@itemx -msse4.2 27965@opindex msse4.2 27966@need 200 27967@itemx -mavx 27968@opindex mavx 27969@need 200 27970@itemx -mavx2 27971@opindex mavx2 27972@need 200 27973@itemx -mavx512f 27974@opindex mavx512f 27975@need 200 27976@itemx -mavx512pf 27977@opindex mavx512pf 27978@need 200 27979@itemx -mavx512er 27980@opindex mavx512er 27981@need 200 27982@itemx -mavx512cd 27983@opindex mavx512cd 27984@need 200 27985@itemx -mavx512vl 27986@opindex mavx512vl 27987@need 200 27988@itemx -mavx512bw 27989@opindex mavx512bw 27990@need 200 27991@itemx -mavx512dq 27992@opindex mavx512dq 27993@need 200 27994@itemx -mavx512ifma 27995@opindex mavx512ifma 27996@need 200 27997@itemx -mavx512vbmi 27998@opindex mavx512vbmi 27999@need 200 28000@itemx -msha 28001@opindex msha 28002@need 200 28003@itemx -maes 28004@opindex maes 28005@need 200 28006@itemx -mpclmul 28007@opindex mpclmul 28008@need 200 28009@itemx -mclflushopt 28010@opindex mclflushopt 28011@need 200 28012@itemx -mclwb 28013@opindex mclwb 28014@need 200 28015@itemx -mfsgsbase 28016@opindex mfsgsbase 28017@need 200 28018@itemx -mptwrite 28019@opindex mptwrite 28020@need 200 28021@itemx -mrdrnd 28022@opindex mrdrnd 28023@need 200 28024@itemx -mf16c 28025@opindex mf16c 28026@need 200 28027@itemx -mfma 28028@opindex mfma 28029@need 200 28030@itemx -mpconfig 28031@opindex mpconfig 28032@need 200 28033@itemx -mwbnoinvd 28034@opindex mwbnoinvd 28035@need 200 28036@itemx -mfma4 28037@opindex mfma4 28038@need 200 28039@itemx -mprfchw 28040@opindex mprfchw 28041@need 200 28042@itemx -mrdpid 28043@opindex mrdpid 28044@need 200 28045@itemx -mprefetchwt1 28046@opindex mprefetchwt1 28047@need 200 28048@itemx -mrdseed 28049@opindex mrdseed 28050@need 200 28051@itemx -msgx 28052@opindex msgx 28053@need 200 28054@itemx -mxop 28055@opindex mxop 28056@need 200 28057@itemx -mlwp 28058@opindex mlwp 28059@need 200 28060@itemx -m3dnow 28061@opindex m3dnow 28062@need 200 28063@itemx -m3dnowa 28064@opindex m3dnowa 28065@need 200 28066@itemx -mpopcnt 28067@opindex mpopcnt 28068@need 200 28069@itemx -mabm 28070@opindex mabm 28071@need 200 28072@itemx -madx 28073@opindex madx 28074@need 200 28075@itemx -mbmi 28076@opindex mbmi 28077@need 200 28078@itemx -mbmi2 28079@opindex mbmi2 28080@need 200 28081@itemx -mlzcnt 28082@opindex mlzcnt 28083@need 200 28084@itemx -mfxsr 28085@opindex mfxsr 28086@need 200 28087@itemx -mxsave 28088@opindex mxsave 28089@need 200 28090@itemx -mxsaveopt 28091@opindex mxsaveopt 28092@need 200 28093@itemx -mxsavec 28094@opindex mxsavec 28095@need 200 28096@itemx -mxsaves 28097@opindex mxsaves 28098@need 200 28099@itemx -mrtm 28100@opindex mrtm 28101@need 200 28102@itemx -mhle 28103@opindex mhle 28104@need 200 28105@itemx -mtbm 28106@opindex mtbm 28107@need 200 28108@itemx -mmwaitx 28109@opindex mmwaitx 28110@need 200 28111@itemx -mclzero 28112@opindex mclzero 28113@need 200 28114@itemx -mpku 28115@opindex mpku 28116@need 200 28117@itemx -mavx512vbmi2 28118@opindex mavx512vbmi2 28119@need 200 28120@itemx -mgfni 28121@opindex mgfni 28122@need 200 28123@itemx -mvaes 28124@opindex mvaes 28125@need 200 28126@itemx -mwaitpkg 28127@opindex mwaitpkg 28128@need 200 28129@itemx -mvpclmulqdq 28130@opindex mvpclmulqdq 28131@need 200 28132@itemx -mavx512bitalg 28133@opindex mavx512bitalg 28134@need 200 28135@itemx -mmovdiri 28136@opindex mmovdiri 28137@need 200 28138@itemx -mmovdir64b 28139@opindex mmovdir64b 28140@need 200 28141@itemx -mavx512vpopcntdq 28142@opindex mavx512vpopcntdq 28143@need 200 28144@itemx -mavx5124fmaps 28145@opindex mavx5124fmaps 28146@need 200 28147@itemx -mavx512vnni 28148@opindex mavx512vnni 28149@need 200 28150@itemx -mavx5124vnniw 28151@opindex mavx5124vnniw 28152@need 200 28153@itemx -mcldemote 28154@opindex mcldemote 28155These switches enable the use of instructions in the MMX, SSE, 28156SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF, 28157AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA, 28158AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, 28159WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 281603DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE, 28161XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2, 28162GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, 28163AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE 28164extended instruction sets. Each has a corresponding @option{-mno-} option to 28165disable use of these instructions. 28166 28167These extensions are also available as built-in functions: see 28168@ref{x86 Built-in Functions}, for details of the functions enabled and 28169disabled by these switches. 28170 28171To generate SSE/SSE2 instructions automatically from floating-point 28172code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 28173 28174GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 28175generates new AVX instructions or AVX equivalence for all SSEx instructions 28176when needed. 28177 28178These options enable GCC to use these extended instructions in 28179generated code, even without @option{-mfpmath=sse}. Applications that 28180perform run-time CPU detection must compile separate files for each 28181supported architecture, using the appropriate flags. In particular, 28182the file containing the CPU detection code should be compiled without 28183these options. 28184 28185@item -mdump-tune-features 28186@opindex mdump-tune-features 28187This option instructs GCC to dump the names of the x86 performance 28188tuning features and default settings. The names can be used in 28189@option{-mtune-ctrl=@var{feature-list}}. 28190 28191@item -mtune-ctrl=@var{feature-list} 28192@opindex mtune-ctrl=@var{feature-list} 28193This option is used to do fine grain control of x86 code generation features. 28194@var{feature-list} is a comma separated list of @var{feature} names. See also 28195@option{-mdump-tune-features}. When specified, the @var{feature} is turned 28196on if it is not preceded with @samp{^}, otherwise, it is turned off. 28197@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 28198developers. Using it may lead to code paths not covered by testing and can 28199potentially result in compiler ICEs or runtime errors. 28200 28201@item -mno-default 28202@opindex mno-default 28203This option instructs GCC to turn off all tunable features. See also 28204@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 28205 28206@item -mcld 28207@opindex mcld 28208This option instructs GCC to emit a @code{cld} instruction in the prologue 28209of functions that use string instructions. String instructions depend on 28210the DF flag to select between autoincrement or autodecrement mode. While the 28211ABI specifies the DF flag to be cleared on function entry, some operating 28212systems violate this specification by not clearing the DF flag in their 28213exception dispatchers. The exception handler can be invoked with the DF flag 28214set, which leads to wrong direction mode when string instructions are used. 28215This option can be enabled by default on 32-bit x86 targets by configuring 28216GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 28217instructions can be suppressed with the @option{-mno-cld} compiler option 28218in this case. 28219 28220@item -mvzeroupper 28221@opindex mvzeroupper 28222This option instructs GCC to emit a @code{vzeroupper} instruction 28223before a transfer of control flow out of the function to minimize 28224the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 28225intrinsics. 28226 28227@item -mprefer-avx128 28228@opindex mprefer-avx128 28229This option instructs GCC to use 128-bit AVX instructions instead of 28230256-bit AVX instructions in the auto-vectorizer. 28231 28232@item -mprefer-vector-width=@var{opt} 28233@opindex mprefer-vector-width 28234This option instructs GCC to use @var{opt}-bit vector width in instructions 28235instead of default on the selected platform. 28236 28237@table @samp 28238@item none 28239No extra limitations applied to GCC other than defined by the selected platform. 28240 28241@item 128 28242Prefer 128-bit vector width for instructions. 28243 28244@item 256 28245Prefer 256-bit vector width for instructions. 28246 28247@item 512 28248Prefer 512-bit vector width for instructions. 28249@end table 28250 28251@item -mcx16 28252@opindex mcx16 28253This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit 28254code to implement compare-and-exchange operations on 16-byte aligned 128-bit 28255objects. This is useful for atomic updates of data structures exceeding one 28256machine word in size. The compiler uses this instruction to implement 28257@ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on 28258128-bit integers, a library call is always used. 28259 28260@item -msahf 28261@opindex msahf 28262This option enables generation of @code{SAHF} instructions in 64-bit code. 28263Early Intel Pentium 4 CPUs with Intel 64 support, 28264prior to the introduction of Pentium 4 G1 step in December 2005, 28265lacked the @code{LAHF} and @code{SAHF} instructions 28266which are supported by AMD64. 28267These are load and store instructions, respectively, for certain status flags. 28268In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 28269@code{drem}, and @code{remainder} built-in functions; 28270see @ref{Other Builtins} for details. 28271 28272@item -mmovbe 28273@opindex mmovbe 28274This option enables use of the @code{movbe} instruction to implement 28275@code{__builtin_bswap32} and @code{__builtin_bswap64}. 28276 28277@item -mshstk 28278@opindex mshstk 28279The @option{-mshstk} option enables shadow stack built-in functions 28280from x86 Control-flow Enforcement Technology (CET). 28281 28282@item -mcrc32 28283@opindex mcrc32 28284This option enables built-in functions @code{__builtin_ia32_crc32qi}, 28285@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 28286@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 28287 28288@item -mrecip 28289@opindex mrecip 28290This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 28291(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 28292with an additional Newton-Raphson step 28293to increase precision instead of @code{DIVSS} and @code{SQRTSS} 28294(and their vectorized 28295variants) for single-precision floating-point arguments. These instructions 28296are generated only when @option{-funsafe-math-optimizations} is enabled 28297together with @option{-ffinite-math-only} and @option{-fno-trapping-math}. 28298Note that while the throughput of the sequence is higher than the throughput 28299of the non-reciprocal instruction, the precision of the sequence can be 28300decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994). 28301 28302Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 28303(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 28304combination), and doesn't need @option{-mrecip}. 28305 28306Also note that GCC emits the above sequence with additional Newton-Raphson step 28307for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 28308already with @option{-ffast-math} (or the above option combination), and 28309doesn't need @option{-mrecip}. 28310 28311@item -mrecip=@var{opt} 28312@opindex mrecip=opt 28313This option controls which reciprocal estimate instructions 28314may be used. @var{opt} is a comma-separated list of options, which may 28315be preceded by a @samp{!} to invert the option: 28316 28317@table @samp 28318@item all 28319Enable all estimate instructions. 28320 28321@item default 28322Enable the default instructions, equivalent to @option{-mrecip}. 28323 28324@item none 28325Disable all estimate instructions, equivalent to @option{-mno-recip}. 28326 28327@item div 28328Enable the approximation for scalar division. 28329 28330@item vec-div 28331Enable the approximation for vectorized division. 28332 28333@item sqrt 28334Enable the approximation for scalar square root. 28335 28336@item vec-sqrt 28337Enable the approximation for vectorized square root. 28338@end table 28339 28340So, for example, @option{-mrecip=all,!sqrt} enables 28341all of the reciprocal approximations, except for square root. 28342 28343@item -mveclibabi=@var{type} 28344@opindex mveclibabi 28345Specifies the ABI type to use for vectorizing intrinsics using an 28346external library. Supported values for @var{type} are @samp{svml} 28347for the Intel short 28348vector math library and @samp{acml} for the AMD math core library. 28349To use this option, both @option{-ftree-vectorize} and 28350@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 28351ABI-compatible library must be specified at link time. 28352 28353GCC currently emits calls to @code{vmldExp2}, 28354@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2}, 28355@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 28356@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 28357@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 28358@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, 28359@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 28360@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 28361@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 28362@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 28363function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 28364@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 28365@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 28366@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 28367@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 28368when @option{-mveclibabi=acml} is used. 28369 28370@item -mabi=@var{name} 28371@opindex mabi 28372Generate code for the specified calling convention. Permissible values 28373are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 28374@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 28375ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 28376You can control this behavior for specific functions by 28377using the function attributes @code{ms_abi} and @code{sysv_abi}. 28378@xref{Function Attributes}. 28379 28380@item -mforce-indirect-call 28381@opindex mforce-indirect-call 28382Force all calls to functions to be indirect. This is useful 28383when using Intel Processor Trace where it generates more precise timing 28384information for function calls. 28385 28386@item -mmanual-endbr 28387@opindex mmanual-endbr 28388Insert ENDBR instruction at function entry only via the @code{cf_check} 28389function attribute. This is useful when used with the option 28390@option{-fcf-protection=branch} to control ENDBR insertion at the 28391function entry. 28392 28393@item -mcall-ms2sysv-xlogues 28394@opindex mcall-ms2sysv-xlogues 28395@opindex mno-call-ms2sysv-xlogues 28396Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a 28397System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By 28398default, the code for saving and restoring these registers is emitted inline, 28399resulting in fairly lengthy prologues and epilogues. Using 28400@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that 28401use stubs in the static portion of libgcc to perform these saves and restores, 28402thus reducing function size at the cost of a few extra instructions. 28403 28404@item -mtls-dialect=@var{type} 28405@opindex mtls-dialect 28406Generate code to access thread-local storage using the @samp{gnu} or 28407@samp{gnu2} conventions. @samp{gnu} is the conservative default; 28408@samp{gnu2} is more efficient, but it may add compile- and run-time 28409requirements that cannot be satisfied on all systems. 28410 28411@item -mpush-args 28412@itemx -mno-push-args 28413@opindex mpush-args 28414@opindex mno-push-args 28415Use PUSH operations to store outgoing parameters. This method is shorter 28416and usually equally fast as method using SUB/MOV operations and is enabled 28417by default. In some cases disabling it may improve performance because of 28418improved scheduling and reduced dependencies. 28419 28420@item -maccumulate-outgoing-args 28421@opindex maccumulate-outgoing-args 28422If enabled, the maximum amount of space required for outgoing arguments is 28423computed in the function prologue. This is faster on most modern CPUs 28424because of reduced dependencies, improved scheduling and reduced stack usage 28425when the preferred stack boundary is not equal to 2. The drawback is a notable 28426increase in code size. This switch implies @option{-mno-push-args}. 28427 28428@item -mthreads 28429@opindex mthreads 28430Support thread-safe exception handling on MinGW. Programs that rely 28431on thread-safe exception handling must compile and link all code with the 28432@option{-mthreads} option. When compiling, @option{-mthreads} defines 28433@option{-D_MT}; when linking, it links in a special thread helper library 28434@option{-lmingwthrd} which cleans up per-thread exception-handling data. 28435 28436@item -mms-bitfields 28437@itemx -mno-ms-bitfields 28438@opindex mms-bitfields 28439@opindex mno-ms-bitfields 28440 28441Enable/disable bit-field layout compatible with the native Microsoft 28442Windows compiler. 28443 28444If @code{packed} is used on a structure, or if bit-fields are used, 28445it may be that the Microsoft ABI lays out the structure differently 28446than the way GCC normally does. Particularly when moving packed 28447data between functions compiled with GCC and the native Microsoft compiler 28448(either via function call or as data in a file), it may be necessary to access 28449either format. 28450 28451This option is enabled by default for Microsoft Windows 28452targets. This behavior can also be controlled locally by use of variable 28453or type attributes. For more information, see @ref{x86 Variable Attributes} 28454and @ref{x86 Type Attributes}. 28455 28456The Microsoft structure layout algorithm is fairly simple with the exception 28457of the bit-field packing. 28458The padding and alignment of members of structures and whether a bit-field 28459can straddle a storage-unit boundary are determine by these rules: 28460 28461@enumerate 28462@item Structure members are stored sequentially in the order in which they are 28463declared: the first member has the lowest memory address and the last member 28464the highest. 28465 28466@item Every data object has an alignment requirement. The alignment requirement 28467for all data except structures, unions, and arrays is either the size of the 28468object or the current packing size (specified with either the 28469@code{aligned} attribute or the @code{pack} pragma), 28470whichever is less. For structures, unions, and arrays, 28471the alignment requirement is the largest alignment requirement of its members. 28472Every object is allocated an offset so that: 28473 28474@smallexample 28475offset % alignment_requirement == 0 28476@end smallexample 28477 28478@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation 28479unit if the integral types are the same size and if the next bit-field fits 28480into the current allocation unit without crossing the boundary imposed by the 28481common alignment requirements of the bit-fields. 28482@end enumerate 28483 28484MSVC interprets zero-length bit-fields in the following ways: 28485 28486@enumerate 28487@item If a zero-length bit-field is inserted between two bit-fields that 28488are normally coalesced, the bit-fields are not coalesced. 28489 28490For example: 28491 28492@smallexample 28493struct 28494 @{ 28495 unsigned long bf_1 : 12; 28496 unsigned long : 0; 28497 unsigned long bf_2 : 12; 28498 @} t1; 28499@end smallexample 28500 28501@noindent 28502The size of @code{t1} is 8 bytes with the zero-length bit-field. If the 28503zero-length bit-field were removed, @code{t1}'s size would be 4 bytes. 28504 28505@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the 28506alignment of the zero-length bit-field is greater than the member that follows it, 28507@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field. 28508 28509For example: 28510 28511@smallexample 28512struct 28513 @{ 28514 char foo : 4; 28515 short : 0; 28516 char bar; 28517 @} t2; 28518 28519struct 28520 @{ 28521 char foo : 4; 28522 short : 0; 28523 double bar; 28524 @} t3; 28525@end smallexample 28526 28527@noindent 28528For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1. 28529Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length 28530bit-field does not affect the alignment of @code{bar} or, as a result, the size 28531of the structure. 28532 28533Taking this into account, it is important to note the following: 28534 28535@enumerate 28536@item If a zero-length bit-field follows a normal bit-field, the type of the 28537zero-length bit-field may affect the alignment of the structure as whole. For 28538example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a 28539normal bit-field, and is of type short. 28540 28541@item Even if a zero-length bit-field is not followed by a normal bit-field, it may 28542still affect the alignment of the structure: 28543 28544@smallexample 28545struct 28546 @{ 28547 char foo : 6; 28548 long : 0; 28549 @} t4; 28550@end smallexample 28551 28552@noindent 28553Here, @code{t4} takes up 4 bytes. 28554@end enumerate 28555 28556@item Zero-length bit-fields following non-bit-field members are ignored: 28557 28558@smallexample 28559struct 28560 @{ 28561 char foo; 28562 long : 0; 28563 char bar; 28564 @} t5; 28565@end smallexample 28566 28567@noindent 28568Here, @code{t5} takes up 2 bytes. 28569@end enumerate 28570 28571 28572@item -mno-align-stringops 28573@opindex mno-align-stringops 28574@opindex malign-stringops 28575Do not align the destination of inlined string operations. This switch reduces 28576code size and improves performance in case the destination is already aligned, 28577but GCC doesn't know about it. 28578 28579@item -minline-all-stringops 28580@opindex minline-all-stringops 28581By default GCC inlines string operations only when the destination is 28582known to be aligned to least a 4-byte boundary. 28583This enables more inlining and increases code 28584size, but may improve performance of code that depends on fast 28585@code{memcpy}, @code{strlen}, 28586and @code{memset} for short lengths. 28587 28588@item -minline-stringops-dynamically 28589@opindex minline-stringops-dynamically 28590For string operations of unknown size, use run-time checks with 28591inline code for small blocks and a library call for large blocks. 28592 28593@item -mstringop-strategy=@var{alg} 28594@opindex mstringop-strategy=@var{alg} 28595Override the internal decision heuristic for the particular algorithm to use 28596for inlining string operations. The allowed values for @var{alg} are: 28597 28598@table @samp 28599@item rep_byte 28600@itemx rep_4byte 28601@itemx rep_8byte 28602Expand using i386 @code{rep} prefix of the specified size. 28603 28604@item byte_loop 28605@itemx loop 28606@itemx unrolled_loop 28607Expand into an inline loop. 28608 28609@item libcall 28610Always use a library call. 28611@end table 28612 28613@item -mmemcpy-strategy=@var{strategy} 28614@opindex mmemcpy-strategy=@var{strategy} 28615Override the internal decision heuristic to decide if @code{__builtin_memcpy} 28616should be inlined and what inline algorithm to use when the expected size 28617of the copy operation is known. @var{strategy} 28618is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 28619@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 28620the max byte size with which inline algorithm @var{alg} is allowed. For the last 28621triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 28622in the list must be specified in increasing order. The minimal byte size for 28623@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 28624preceding range. 28625 28626@item -mmemset-strategy=@var{strategy} 28627@opindex mmemset-strategy=@var{strategy} 28628The option is similar to @option{-mmemcpy-strategy=} except that it is to control 28629@code{__builtin_memset} expansion. 28630 28631@item -momit-leaf-frame-pointer 28632@opindex momit-leaf-frame-pointer 28633Don't keep the frame pointer in a register for leaf functions. This 28634avoids the instructions to save, set up, and restore frame pointers and 28635makes an extra register available in leaf functions. The option 28636@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 28637which might make debugging harder. 28638 28639@item -mtls-direct-seg-refs 28640@itemx -mno-tls-direct-seg-refs 28641@opindex mtls-direct-seg-refs 28642Controls whether TLS variables may be accessed with offsets from the 28643TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 28644or whether the thread base pointer must be added. Whether or not this 28645is valid depends on the operating system, and whether it maps the 28646segment to cover the entire TLS area. 28647 28648For systems that use the GNU C Library, the default is on. 28649 28650@item -msse2avx 28651@itemx -mno-sse2avx 28652@opindex msse2avx 28653Specify that the assembler should encode SSE instructions with VEX 28654prefix. The option @option{-mavx} turns this on by default. 28655 28656@item -mfentry 28657@itemx -mno-fentry 28658@opindex mfentry 28659If profiling is active (@option{-pg}), put the profiling 28660counter call before the prologue. 28661Note: On x86 architectures the attribute @code{ms_hook_prologue} 28662isn't possible at the moment for @option{-mfentry} and @option{-pg}. 28663 28664@item -mrecord-mcount 28665@itemx -mno-record-mcount 28666@opindex mrecord-mcount 28667If profiling is active (@option{-pg}), generate a __mcount_loc section 28668that contains pointers to each profiling call. This is useful for 28669automatically patching and out calls. 28670 28671@item -mnop-mcount 28672@itemx -mno-nop-mcount 28673@opindex mnop-mcount 28674If profiling is active (@option{-pg}), generate the calls to 28675the profiling functions as NOPs. This is useful when they 28676should be patched in later dynamically. This is likely only 28677useful together with @option{-mrecord-mcount}. 28678 28679@item -minstrument-return=@var{type} 28680@opindex minstrument-return 28681Instrument function exit in -pg -mfentry instrumented functions with 28682call to specified function. This only instruments true returns ending 28683with ret, but not sibling calls ending with jump. Valid types 28684are @var{none} to not instrument, @var{call} to generate a call to __return__, 28685or @var{nop5} to generate a 5 byte nop. 28686 28687@item -mrecord-return 28688@itemx -mno-record-return 28689@opindex mrecord-return 28690Generate a __return_loc section pointing to all return instrumentation code. 28691 28692@item -mfentry-name=@var{name} 28693@opindex mfentry-name 28694Set name of __fentry__ symbol called at function entry for -pg -mfentry functions. 28695 28696@item -mfentry-section=@var{name} 28697@opindex mfentry-section 28698Set name of section to record -mrecord-mcount calls (default __mcount_loc). 28699 28700@item -mskip-rax-setup 28701@itemx -mno-skip-rax-setup 28702@opindex mskip-rax-setup 28703When generating code for the x86-64 architecture with SSE extensions 28704disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 28705register when there are no variable arguments passed in vector registers. 28706 28707@strong{Warning:} Since RAX register is used to avoid unnecessarily 28708saving vector registers on stack when passing variable arguments, the 28709impacts of this option are callees may waste some stack space, 28710misbehave or jump to a random location. GCC 4.4 or newer don't have 28711those issues, regardless the RAX register value. 28712 28713@item -m8bit-idiv 28714@itemx -mno-8bit-idiv 28715@opindex m8bit-idiv 28716On some processors, like Intel Atom, 8-bit unsigned integer divide is 28717much faster than 32-bit/64-bit integer divide. This option generates a 28718run-time check. If both dividend and divisor are within range of 0 28719to 255, 8-bit unsigned integer divide is used instead of 2872032-bit/64-bit integer divide. 28721 28722@item -mavx256-split-unaligned-load 28723@itemx -mavx256-split-unaligned-store 28724@opindex mavx256-split-unaligned-load 28725@opindex mavx256-split-unaligned-store 28726Split 32-byte AVX unaligned load and store. 28727 28728@item -mstack-protector-guard=@var{guard} 28729@itemx -mstack-protector-guard-reg=@var{reg} 28730@itemx -mstack-protector-guard-offset=@var{offset} 28731@opindex mstack-protector-guard 28732@opindex mstack-protector-guard-reg 28733@opindex mstack-protector-guard-offset 28734Generate stack protection code using canary at @var{guard}. Supported 28735locations are @samp{global} for global canary or @samp{tls} for per-thread 28736canary in the TLS block (the default). This option has effect only when 28737@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 28738 28739With the latter choice the options 28740@option{-mstack-protector-guard-reg=@var{reg}} and 28741@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 28742which segment register (@code{%fs} or @code{%gs}) to use as base register 28743for reading the canary, and from what offset from that base register. 28744The default for those is as specified in the relevant ABI. 28745 28746@item -mgeneral-regs-only 28747@opindex mgeneral-regs-only 28748Generate code that uses only the general-purpose registers. This 28749prevents the compiler from using floating-point, vector, mask and bound 28750registers. 28751 28752@item -mindirect-branch=@var{choice} 28753@opindex mindirect-branch 28754Convert indirect call and jump with @var{choice}. The default is 28755@samp{keep}, which keeps indirect call and jump unmodified. 28756@samp{thunk} converts indirect call and jump to call and return thunk. 28757@samp{thunk-inline} converts indirect call and jump to inlined call 28758and return thunk. @samp{thunk-extern} converts indirect call and jump 28759to external call and return thunk provided in a separate object file. 28760You can control this behavior for a specific function by using the 28761function attribute @code{indirect_branch}. @xref{Function Attributes}. 28762 28763Note that @option{-mcmodel=large} is incompatible with 28764@option{-mindirect-branch=thunk} and 28765@option{-mindirect-branch=thunk-extern} since the thunk function may 28766not be reachable in the large code model. 28767 28768Note that @option{-mindirect-branch=thunk-extern} is compatible with 28769@option{-fcf-protection=branch} since the external thunk can be made 28770to enable control-flow check. 28771 28772@item -mfunction-return=@var{choice} 28773@opindex mfunction-return 28774Convert function return with @var{choice}. The default is @samp{keep}, 28775which keeps function return unmodified. @samp{thunk} converts function 28776return to call and return thunk. @samp{thunk-inline} converts function 28777return to inlined call and return thunk. @samp{thunk-extern} converts 28778function return to external call and return thunk provided in a separate 28779object file. You can control this behavior for a specific function by 28780using the function attribute @code{function_return}. 28781@xref{Function Attributes}. 28782 28783Note that @option{-mindirect-return=thunk-extern} is compatible with 28784@option{-fcf-protection=branch} since the external thunk can be made 28785to enable control-flow check. 28786 28787Note that @option{-mcmodel=large} is incompatible with 28788@option{-mfunction-return=thunk} and 28789@option{-mfunction-return=thunk-extern} since the thunk function may 28790not be reachable in the large code model. 28791 28792 28793@item -mindirect-branch-register 28794@opindex mindirect-branch-register 28795Force indirect call and jump via register. 28796 28797@end table 28798 28799These @samp{-m} switches are supported in addition to the above 28800on x86-64 processors in 64-bit environments. 28801 28802@table @gcctabopt 28803@item -m32 28804@itemx -m64 28805@itemx -mx32 28806@itemx -m16 28807@itemx -miamcu 28808@opindex m32 28809@opindex m64 28810@opindex mx32 28811@opindex m16 28812@opindex miamcu 28813Generate code for a 16-bit, 32-bit or 64-bit environment. 28814The @option{-m32} option sets @code{int}, @code{long}, and pointer types 28815to 32 bits, and 28816generates code that runs on any i386 system. 28817 28818The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 28819types to 64 bits, and generates code for the x86-64 architecture. 28820For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 28821and @option{-mdynamic-no-pic} options. 28822 28823The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 28824to 32 bits, and 28825generates code for the x86-64 architecture. 28826 28827The @option{-m16} option is the same as @option{-m32}, except for that 28828it outputs the @code{.code16gcc} assembly directive at the beginning of 28829the assembly output so that the binary can run in 16-bit mode. 28830 28831The @option{-miamcu} option generates code which conforms to Intel MCU 28832psABI. It requires the @option{-m32} option to be turned on. 28833 28834@item -mno-red-zone 28835@opindex mno-red-zone 28836@opindex mred-zone 28837Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 28838by the x86-64 ABI; it is a 128-byte area beyond the location of the 28839stack pointer that is not modified by signal or interrupt handlers 28840and therefore can be used for temporary data without adjusting the stack 28841pointer. The flag @option{-mno-red-zone} disables this red zone. 28842 28843@item -mcmodel=small 28844@opindex mcmodel=small 28845Generate code for the small code model: the program and its symbols must 28846be linked in the lower 2 GB of the address space. Pointers are 64 bits. 28847Programs can be statically or dynamically linked. This is the default 28848code model. 28849 28850@item -mcmodel=kernel 28851@opindex mcmodel=kernel 28852Generate code for the kernel code model. The kernel runs in the 28853negative 2 GB of the address space. 28854This model has to be used for Linux kernel code. 28855 28856@item -mcmodel=medium 28857@opindex mcmodel=medium 28858Generate code for the medium model: the program is linked in the lower 2 28859GB of the address space. Small symbols are also placed there. Symbols 28860with sizes larger than @option{-mlarge-data-threshold} are put into 28861large data or BSS sections and can be located above 2GB. Programs can 28862be statically or dynamically linked. 28863 28864@item -mcmodel=large 28865@opindex mcmodel=large 28866Generate code for the large model. This model makes no assumptions 28867about addresses and sizes of sections. 28868 28869@item -maddress-mode=long 28870@opindex maddress-mode=long 28871Generate code for long address mode. This is only supported for 64-bit 28872and x32 environments. It is the default address mode for 64-bit 28873environments. 28874 28875@item -maddress-mode=short 28876@opindex maddress-mode=short 28877Generate code for short address mode. This is only supported for 32-bit 28878and x32 environments. It is the default address mode for 32-bit and 28879x32 environments. 28880@end table 28881 28882@node x86 Windows Options 28883@subsection x86 Windows Options 28884@cindex x86 Windows Options 28885@cindex Windows Options for x86 28886 28887These additional options are available for Microsoft Windows targets: 28888 28889@table @gcctabopt 28890@item -mconsole 28891@opindex mconsole 28892This option 28893specifies that a console application is to be generated, by 28894instructing the linker to set the PE header subsystem type 28895required for console applications. 28896This option is available for Cygwin and MinGW targets and is 28897enabled by default on those targets. 28898 28899@item -mdll 28900@opindex mdll 28901This option is available for Cygwin and MinGW targets. It 28902specifies that a DLL---a dynamic link library---is to be 28903generated, enabling the selection of the required runtime 28904startup object and entry point. 28905 28906@item -mnop-fun-dllimport 28907@opindex mnop-fun-dllimport 28908This option is available for Cygwin and MinGW targets. It 28909specifies that the @code{dllimport} attribute should be ignored. 28910 28911@item -mthread 28912@opindex mthread 28913This option is available for MinGW targets. It specifies 28914that MinGW-specific thread support is to be used. 28915 28916@item -municode 28917@opindex municode 28918This option is available for MinGW-w64 targets. It causes 28919the @code{UNICODE} preprocessor macro to be predefined, and 28920chooses Unicode-capable runtime startup code. 28921 28922@item -mwin32 28923@opindex mwin32 28924This option is available for Cygwin and MinGW targets. It 28925specifies that the typical Microsoft Windows predefined macros are to 28926be set in the pre-processor, but does not influence the choice 28927of runtime library/startup code. 28928 28929@item -mwindows 28930@opindex mwindows 28931This option is available for Cygwin and MinGW targets. It 28932specifies that a GUI application is to be generated by 28933instructing the linker to set the PE header subsystem type 28934appropriately. 28935 28936@item -fno-set-stack-executable 28937@opindex fno-set-stack-executable 28938@opindex fset-stack-executable 28939This option is available for MinGW targets. It specifies that 28940the executable flag for the stack used by nested functions isn't 28941set. This is necessary for binaries running in kernel mode of 28942Microsoft Windows, as there the User32 API, which is used to set executable 28943privileges, isn't available. 28944 28945@item -fwritable-relocated-rdata 28946@opindex fno-writable-relocated-rdata 28947@opindex fwritable-relocated-rdata 28948This option is available for MinGW and Cygwin targets. It specifies 28949that relocated-data in read-only section is put into the @code{.data} 28950section. This is a necessary for older runtimes not supporting 28951modification of @code{.rdata} sections for pseudo-relocation. 28952 28953@item -mpe-aligned-commons 28954@opindex mpe-aligned-commons 28955This option is available for Cygwin and MinGW targets. It 28956specifies that the GNU extension to the PE file format that 28957permits the correct alignment of COMMON variables should be 28958used when generating code. It is enabled by default if 28959GCC detects that the target assembler found during configuration 28960supports the feature. 28961@end table 28962 28963See also under @ref{x86 Options} for standard options. 28964 28965@node Xstormy16 Options 28966@subsection Xstormy16 Options 28967@cindex Xstormy16 Options 28968 28969These options are defined for Xstormy16: 28970 28971@table @gcctabopt 28972@item -msim 28973@opindex msim 28974Choose startup files and linker script suitable for the simulator. 28975@end table 28976 28977@node Xtensa Options 28978@subsection Xtensa Options 28979@cindex Xtensa Options 28980 28981These options are supported for Xtensa targets: 28982 28983@table @gcctabopt 28984@item -mconst16 28985@itemx -mno-const16 28986@opindex mconst16 28987@opindex mno-const16 28988Enable or disable use of @code{CONST16} instructions for loading 28989constant values. The @code{CONST16} instruction is currently not a 28990standard option from Tensilica. When enabled, @code{CONST16} 28991instructions are always used in place of the standard @code{L32R} 28992instructions. The use of @code{CONST16} is enabled by default only if 28993the @code{L32R} instruction is not available. 28994 28995@item -mfused-madd 28996@itemx -mno-fused-madd 28997@opindex mfused-madd 28998@opindex mno-fused-madd 28999Enable or disable use of fused multiply/add and multiply/subtract 29000instructions in the floating-point option. This has no effect if the 29001floating-point option is not also enabled. Disabling fused multiply/add 29002and multiply/subtract instructions forces the compiler to use separate 29003instructions for the multiply and add/subtract operations. This may be 29004desirable in some cases where strict IEEE 754-compliant results are 29005required: the fused multiply add/subtract instructions do not round the 29006intermediate result, thereby producing results with @emph{more} bits of 29007precision than specified by the IEEE standard. Disabling fused multiply 29008add/subtract instructions also ensures that the program output is not 29009sensitive to the compiler's ability to combine multiply and add/subtract 29010operations. 29011 29012@item -mserialize-volatile 29013@itemx -mno-serialize-volatile 29014@opindex mserialize-volatile 29015@opindex mno-serialize-volatile 29016When this option is enabled, GCC inserts @code{MEMW} instructions before 29017@code{volatile} memory references to guarantee sequential consistency. 29018The default is @option{-mserialize-volatile}. Use 29019@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 29020 29021@item -mforce-no-pic 29022@opindex mforce-no-pic 29023For targets, like GNU/Linux, where all user-mode Xtensa code must be 29024position-independent code (PIC), this option disables PIC for compiling 29025kernel code. 29026 29027@item -mtext-section-literals 29028@itemx -mno-text-section-literals 29029@opindex mtext-section-literals 29030@opindex mno-text-section-literals 29031These options control the treatment of literal pools. The default is 29032@option{-mno-text-section-literals}, which places literals in a separate 29033section in the output file. This allows the literal pool to be placed 29034in a data RAM/ROM, and it also allows the linker to combine literal 29035pools from separate object files to remove redundant literals and 29036improve code size. With @option{-mtext-section-literals}, the literals 29037are interspersed in the text section in order to keep them as close as 29038possible to their references. This may be necessary for large assembly 29039files. Literals for each function are placed right before that function. 29040 29041@item -mauto-litpools 29042@itemx -mno-auto-litpools 29043@opindex mauto-litpools 29044@opindex mno-auto-litpools 29045These options control the treatment of literal pools. The default is 29046@option{-mno-auto-litpools}, which places literals in a separate 29047section in the output file unless @option{-mtext-section-literals} is 29048used. With @option{-mauto-litpools} the literals are interspersed in 29049the text section by the assembler. Compiler does not produce explicit 29050@code{.literal} directives and loads literals into registers with 29051@code{MOVI} instructions instead of @code{L32R} to let the assembler 29052do relaxation and place literals as necessary. This option allows 29053assembler to create several literal pools per function and assemble 29054very big functions, which may not be possible with 29055@option{-mtext-section-literals}. 29056 29057@item -mtarget-align 29058@itemx -mno-target-align 29059@opindex mtarget-align 29060@opindex mno-target-align 29061When this option is enabled, GCC instructs the assembler to 29062automatically align instructions to reduce branch penalties at the 29063expense of some code density. The assembler attempts to widen density 29064instructions to align branch targets and the instructions following call 29065instructions. If there are not enough preceding safe density 29066instructions to align a target, no widening is performed. The 29067default is @option{-mtarget-align}. These options do not affect the 29068treatment of auto-aligned instructions like @code{LOOP}, which the 29069assembler always aligns, either by widening density instructions or 29070by inserting NOP instructions. 29071 29072@item -mlongcalls 29073@itemx -mno-longcalls 29074@opindex mlongcalls 29075@opindex mno-longcalls 29076When this option is enabled, GCC instructs the assembler to translate 29077direct calls to indirect calls unless it can determine that the target 29078of a direct call is in the range allowed by the call instruction. This 29079translation typically occurs for calls to functions in other source 29080files. Specifically, the assembler translates a direct @code{CALL} 29081instruction into an @code{L32R} followed by a @code{CALLX} instruction. 29082The default is @option{-mno-longcalls}. This option should be used in 29083programs where the call target can potentially be out of range. This 29084option is implemented in the assembler, not the compiler, so the 29085assembly code generated by GCC still shows direct call 29086instructions---look at the disassembled object code to see the actual 29087instructions. Note that the assembler uses an indirect call for 29088every cross-file call, not just those that really are out of range. 29089@end table 29090 29091@node zSeries Options 29092@subsection zSeries Options 29093@cindex zSeries options 29094 29095These are listed under @xref{S/390 and zSeries Options}. 29096 29097 29098@c man end 29099 29100@node Spec Files 29101@section Specifying Subprocesses and the Switches to Pass to Them 29102@cindex Spec Files 29103 29104@command{gcc} is a driver program. It performs its job by invoking a 29105sequence of other programs to do the work of compiling, assembling and 29106linking. GCC interprets its command-line parameters and uses these to 29107deduce which programs it should invoke, and which command-line options 29108it ought to place on their command lines. This behavior is controlled 29109by @dfn{spec strings}. In most cases there is one spec string for each 29110program that GCC can invoke, but a few programs have multiple spec 29111strings to control their behavior. The spec strings built into GCC can 29112be overridden by using the @option{-specs=} command-line switch to specify 29113a spec file. 29114 29115@dfn{Spec files} are plain-text files that are used to construct spec 29116strings. They consist of a sequence of directives separated by blank 29117lines. The type of directive is determined by the first non-whitespace 29118character on the line, which can be one of the following: 29119 29120@table @code 29121@item %@var{command} 29122Issues a @var{command} to the spec file processor. The commands that can 29123appear here are: 29124 29125@table @code 29126@item %include <@var{file}> 29127@cindex @code{%include} 29128Search for @var{file} and insert its text at the current point in the 29129specs file. 29130 29131@item %include_noerr <@var{file}> 29132@cindex @code{%include_noerr} 29133Just like @samp{%include}, but do not generate an error message if the include 29134file cannot be found. 29135 29136@item %rename @var{old_name} @var{new_name} 29137@cindex @code{%rename} 29138Rename the spec string @var{old_name} to @var{new_name}. 29139 29140@end table 29141 29142@item *[@var{spec_name}]: 29143This tells the compiler to create, override or delete the named spec 29144string. All lines after this directive up to the next directive or 29145blank line are considered to be the text for the spec string. If this 29146results in an empty string then the spec is deleted. (Or, if the 29147spec did not exist, then nothing happens.) Otherwise, if the spec 29148does not currently exist a new spec is created. If the spec does 29149exist then its contents are overridden by the text of this 29150directive, unless the first character of that text is the @samp{+} 29151character, in which case the text is appended to the spec. 29152 29153@item [@var{suffix}]: 29154Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 29155and up to the next directive or blank line are considered to make up the 29156spec string for the indicated suffix. When the compiler encounters an 29157input file with the named suffix, it processes the spec string in 29158order to work out how to compile that file. For example: 29159 29160@smallexample 29161.ZZ: 29162z-compile -input %i 29163@end smallexample 29164 29165This says that any input file whose name ends in @samp{.ZZ} should be 29166passed to the program @samp{z-compile}, which should be invoked with the 29167command-line switch @option{-input} and with the result of performing the 29168@samp{%i} substitution. (See below.) 29169 29170As an alternative to providing a spec string, the text following a 29171suffix directive can be one of the following: 29172 29173@table @code 29174@item @@@var{language} 29175This says that the suffix is an alias for a known @var{language}. This is 29176similar to using the @option{-x} command-line switch to GCC to specify a 29177language explicitly. For example: 29178 29179@smallexample 29180.ZZ: 29181@@c++ 29182@end smallexample 29183 29184Says that .ZZ files are, in fact, C++ source files. 29185 29186@item #@var{name} 29187This causes an error messages saying: 29188 29189@smallexample 29190@var{name} compiler not installed on this system. 29191@end smallexample 29192@end table 29193 29194GCC already has an extensive list of suffixes built into it. 29195This directive adds an entry to the end of the list of suffixes, but 29196since the list is searched from the end backwards, it is effectively 29197possible to override earlier entries using this technique. 29198 29199@end table 29200 29201GCC has the following spec strings built into it. Spec files can 29202override these strings or create their own. Note that individual 29203targets can also add their own spec strings to this list. 29204 29205@smallexample 29206asm Options to pass to the assembler 29207asm_final Options to pass to the assembler post-processor 29208cpp Options to pass to the C preprocessor 29209cc1 Options to pass to the C compiler 29210cc1plus Options to pass to the C++ compiler 29211endfile Object files to include at the end of the link 29212link Options to pass to the linker 29213lib Libraries to include on the command line to the linker 29214libgcc Decides which GCC support library to pass to the linker 29215linker Sets the name of the linker 29216predefines Defines to be passed to the C preprocessor 29217signed_char Defines to pass to CPP to say whether @code{char} is signed 29218 by default 29219startfile Object files to include at the start of the link 29220@end smallexample 29221 29222Here is a small example of a spec file: 29223 29224@smallexample 29225%rename lib old_lib 29226 29227*lib: 29228--start-group -lgcc -lc -leval1 --end-group %(old_lib) 29229@end smallexample 29230 29231This example renames the spec called @samp{lib} to @samp{old_lib} and 29232then overrides the previous definition of @samp{lib} with a new one. 29233The new definition adds in some extra command-line options before 29234including the text of the old definition. 29235 29236@dfn{Spec strings} are a list of command-line options to be passed to their 29237corresponding program. In addition, the spec strings can contain 29238@samp{%}-prefixed sequences to substitute variable text or to 29239conditionally insert text into the command line. Using these constructs 29240it is possible to generate quite complex command lines. 29241 29242Here is a table of all defined @samp{%}-sequences for spec 29243strings. Note that spaces are not generated automatically around the 29244results of expanding these sequences. Therefore you can concatenate them 29245together or combine them with constant text in a single argument. 29246 29247@table @code 29248@item %% 29249Substitute one @samp{%} into the program name or argument. 29250 29251@item %i 29252Substitute the name of the input file being processed. 29253 29254@item %b 29255Substitute the basename of the input file being processed. 29256This is the substring up to (and not including) the last period 29257and not including the directory. 29258 29259@item %B 29260This is the same as @samp{%b}, but include the file suffix (text after 29261the last period). 29262 29263@item %d 29264Marks the argument containing or following the @samp{%d} as a 29265temporary file name, so that that file is deleted if GCC exits 29266successfully. Unlike @samp{%g}, this contributes no text to the 29267argument. 29268 29269@item %g@var{suffix} 29270Substitute a file name that has suffix @var{suffix} and is chosen 29271once per compilation, and mark the argument in the same way as 29272@samp{%d}. To reduce exposure to denial-of-service attacks, the file 29273name is now chosen in a way that is hard to predict even when previously 29274chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 29275might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 29276the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 29277treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 29278was simply substituted with a file name chosen once per compilation, 29279without regard to any appended suffix (which was therefore treated 29280just like ordinary text), making such attacks more likely to succeed. 29281 29282@item %u@var{suffix} 29283Like @samp{%g}, but generates a new temporary file name 29284each time it appears instead of once per compilation. 29285 29286@item %U@var{suffix} 29287Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 29288new one if there is no such last file name. In the absence of any 29289@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 29290the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 29291involves the generation of two distinct file names, one 29292for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 29293simply substituted with a file name chosen for the previous @samp{%u}, 29294without regard to any appended suffix. 29295 29296@item %j@var{suffix} 29297Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 29298writable, and if @option{-save-temps} is not used; 29299otherwise, substitute the name 29300of a temporary file, just like @samp{%u}. This temporary file is not 29301meant for communication between processes, but rather as a junk 29302disposal mechanism. 29303 29304@item %|@var{suffix} 29305@itemx %m@var{suffix} 29306Like @samp{%g}, except if @option{-pipe} is in effect. In that case 29307@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 29308all. These are the two most common ways to instruct a program that it 29309should read from standard input or write to standard output. If you 29310need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 29311construct: see for example @file{f/lang-specs.h}. 29312 29313@item %.@var{SUFFIX} 29314Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 29315when it is subsequently output with @samp{%*}. @var{SUFFIX} is 29316terminated by the next space or %. 29317 29318@item %w 29319Marks the argument containing or following the @samp{%w} as the 29320designated output file of this compilation. This puts the argument 29321into the sequence of arguments that @samp{%o} substitutes. 29322 29323@item %o 29324Substitutes the names of all the output files, with spaces 29325automatically placed around them. You should write spaces 29326around the @samp{%o} as well or the results are undefined. 29327@samp{%o} is for use in the specs for running the linker. 29328Input files whose names have no recognized suffix are not compiled 29329at all, but they are included among the output files, so they are 29330linked. 29331 29332@item %O 29333Substitutes the suffix for object files. Note that this is 29334handled specially when it immediately follows @samp{%g, %u, or %U}, 29335because of the need for those to form complete file names. The 29336handling is such that @samp{%O} is treated exactly as if it had already 29337been substituted, except that @samp{%g, %u, and %U} do not currently 29338support additional @var{suffix} characters following @samp{%O} as they do 29339following, for example, @samp{.o}. 29340 29341@item %p 29342Substitutes the standard macro predefinitions for the 29343current target machine. Use this when running @command{cpp}. 29344 29345@item %P 29346Like @samp{%p}, but puts @samp{__} before and after the name of each 29347predefined macro, except for macros that start with @samp{__} or with 29348@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 29349C@. 29350 29351@item %I 29352Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 29353@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 29354@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 29355and @option{-imultilib} as necessary. 29356 29357@item %s 29358Current argument is the name of a library or startup file of some sort. 29359Search for that file in a standard list of directories and substitute 29360the full name found. The current working directory is included in the 29361list of directories scanned. 29362 29363@item %T 29364Current argument is the name of a linker script. Search for that file 29365in the current list of directories to scan for libraries. If the file 29366is located insert a @option{--script} option into the command line 29367followed by the full path name found. If the file is not found then 29368generate an error message. Note: the current working directory is not 29369searched. 29370 29371@item %e@var{str} 29372Print @var{str} as an error message. @var{str} is terminated by a newline. 29373Use this when inconsistent options are detected. 29374 29375@item %(@var{name}) 29376Substitute the contents of spec string @var{name} at this point. 29377 29378@item %x@{@var{option}@} 29379Accumulate an option for @samp{%X}. 29380 29381@item %X 29382Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 29383spec string. 29384 29385@item %Y 29386Output the accumulated assembler options specified by @option{-Wa}. 29387 29388@item %Z 29389Output the accumulated preprocessor options specified by @option{-Wp}. 29390 29391@item %a 29392Process the @code{asm} spec. This is used to compute the 29393switches to be passed to the assembler. 29394 29395@item %A 29396Process the @code{asm_final} spec. This is a spec string for 29397passing switches to an assembler post-processor, if such a program is 29398needed. 29399 29400@item %l 29401Process the @code{link} spec. This is the spec for computing the 29402command line passed to the linker. Typically it makes use of the 29403@samp{%L %G %S %D and %E} sequences. 29404 29405@item %D 29406Dump out a @option{-L} option for each directory that GCC believes might 29407contain startup files. If the target supports multilibs then the 29408current multilib directory is prepended to each of these paths. 29409 29410@item %L 29411Process the @code{lib} spec. This is a spec string for deciding which 29412libraries are included on the command line to the linker. 29413 29414@item %G 29415Process the @code{libgcc} spec. This is a spec string for deciding 29416which GCC support library is included on the command line to the linker. 29417 29418@item %S 29419Process the @code{startfile} spec. This is a spec for deciding which 29420object files are the first ones passed to the linker. Typically 29421this might be a file named @file{crt0.o}. 29422 29423@item %E 29424Process the @code{endfile} spec. This is a spec string that specifies 29425the last object files that are passed to the linker. 29426 29427@item %C 29428Process the @code{cpp} spec. This is used to construct the arguments 29429to be passed to the C preprocessor. 29430 29431@item %1 29432Process the @code{cc1} spec. This is used to construct the options to be 29433passed to the actual C compiler (@command{cc1}). 29434 29435@item %2 29436Process the @code{cc1plus} spec. This is used to construct the options to be 29437passed to the actual C++ compiler (@command{cc1plus}). 29438 29439@item %* 29440Substitute the variable part of a matched option. See below. 29441Note that each comma in the substituted string is replaced by 29442a single space. 29443 29444@item %<S 29445Remove all occurrences of @code{-S} from the command line. Note---this 29446command is position dependent. @samp{%} commands in the spec string 29447before this one see @code{-S}, @samp{%} commands in the spec string 29448after this one do not. 29449 29450@item %:@var{function}(@var{args}) 29451Call the named function @var{function}, passing it @var{args}. 29452@var{args} is first processed as a nested spec string, then split 29453into an argument vector in the usual fashion. The function returns 29454a string which is processed as if it had appeared literally as part 29455of the current spec. 29456 29457The following built-in spec functions are provided: 29458 29459@table @code 29460@item @code{getenv} 29461The @code{getenv} spec function takes two arguments: an environment 29462variable name and a string. If the environment variable is not 29463defined, a fatal error is issued. Otherwise, the return value is the 29464value of the environment variable concatenated with the string. For 29465example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 29466 29467@smallexample 29468%:getenv(TOPDIR /include) 29469@end smallexample 29470 29471expands to @file{/path/to/top/include}. 29472 29473@item @code{if-exists} 29474The @code{if-exists} spec function takes one argument, an absolute 29475pathname to a file. If the file exists, @code{if-exists} returns the 29476pathname. Here is a small example of its usage: 29477 29478@smallexample 29479*startfile: 29480crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 29481@end smallexample 29482 29483@item @code{if-exists-else} 29484The @code{if-exists-else} spec function is similar to the @code{if-exists} 29485spec function, except that it takes two arguments. The first argument is 29486an absolute pathname to a file. If the file exists, @code{if-exists-else} 29487returns the pathname. If it does not exist, it returns the second argument. 29488This way, @code{if-exists-else} can be used to select one file or another, 29489based on the existence of the first. Here is a small example of its usage: 29490 29491@smallexample 29492*startfile: 29493crt0%O%s %:if-exists(crti%O%s) \ 29494%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 29495@end smallexample 29496 29497@item @code{replace-outfile} 29498The @code{replace-outfile} spec function takes two arguments. It looks for the 29499first argument in the outfiles array and replaces it with the second argument. Here 29500is a small example of its usage: 29501 29502@smallexample 29503%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 29504@end smallexample 29505 29506@item @code{remove-outfile} 29507The @code{remove-outfile} spec function takes one argument. It looks for the 29508first argument in the outfiles array and removes it. Here is a small example 29509its usage: 29510 29511@smallexample 29512%:remove-outfile(-lm) 29513@end smallexample 29514 29515@item @code{pass-through-libs} 29516The @code{pass-through-libs} spec function takes any number of arguments. It 29517finds any @option{-l} options and any non-options ending in @file{.a} (which it 29518assumes are the names of linker input library archive files) and returns a 29519result containing all the found arguments each prepended by 29520@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 29521intended to be passed to the LTO linker plugin. 29522 29523@smallexample 29524%:pass-through-libs(%G %L %G) 29525@end smallexample 29526 29527@item @code{print-asm-header} 29528The @code{print-asm-header} function takes no arguments and simply 29529prints a banner like: 29530 29531@smallexample 29532Assembler options 29533================= 29534 29535Use "-Wa,OPTION" to pass "OPTION" to the assembler. 29536@end smallexample 29537 29538It is used to separate compiler options from assembler options 29539in the @option{--target-help} output. 29540@end table 29541 29542@item %@{S@} 29543Substitutes the @code{-S} switch, if that switch is given to GCC@. 29544If that switch is not specified, this substitutes nothing. Note that 29545the leading dash is omitted when specifying this option, and it is 29546automatically inserted if the substitution is performed. Thus the spec 29547string @samp{%@{foo@}} matches the command-line option @option{-foo} 29548and outputs the command-line option @option{-foo}. 29549 29550@item %W@{S@} 29551Like %@{@code{S}@} but mark last argument supplied within as a file to be 29552deleted on failure. 29553 29554@item %@{S*@} 29555Substitutes all the switches specified to GCC whose names start 29556with @code{-S}, but which also take an argument. This is used for 29557switches like @option{-o}, @option{-D}, @option{-I}, etc. 29558GCC considers @option{-o foo} as being 29559one switch whose name starts with @samp{o}. %@{o*@} substitutes this 29560text, including the space. Thus two arguments are generated. 29561 29562@item %@{S*&T*@} 29563Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 29564(the order of @code{S} and @code{T} in the spec is not significant). 29565There can be any number of ampersand-separated variables; for each the 29566wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 29567 29568@item %@{S:X@} 29569Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 29570 29571@item %@{!S:X@} 29572Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 29573 29574@item %@{S*:X@} 29575Substitutes @code{X} if one or more switches whose names start with 29576@code{-S} are specified to GCC@. Normally @code{X} is substituted only 29577once, no matter how many such switches appeared. However, if @code{%*} 29578appears somewhere in @code{X}, then @code{X} is substituted once 29579for each matching switch, with the @code{%*} replaced by the part of 29580that switch matching the @code{*}. 29581 29582If @code{%*} appears as the last part of a spec sequence then a space 29583is added after the end of the last substitution. If there is more 29584text in the sequence, however, then a space is not generated. This 29585allows the @code{%*} substitution to be used as part of a larger 29586string. For example, a spec string like this: 29587 29588@smallexample 29589%@{mcu=*:--script=%*/memory.ld@} 29590@end smallexample 29591 29592@noindent 29593when matching an option like @option{-mcu=newchip} produces: 29594 29595@smallexample 29596--script=newchip/memory.ld 29597@end smallexample 29598 29599@item %@{.S:X@} 29600Substitutes @code{X}, if processing a file with suffix @code{S}. 29601 29602@item %@{!.S:X@} 29603Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 29604 29605@item %@{,S:X@} 29606Substitutes @code{X}, if processing a file for language @code{S}. 29607 29608@item %@{!,S:X@} 29609Substitutes @code{X}, if not processing a file for language @code{S}. 29610 29611@item %@{S|P:X@} 29612Substitutes @code{X} if either @code{-S} or @code{-P} is given to 29613GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 29614@code{*} sequences as well, although they have a stronger binding than 29615the @samp{|}. If @code{%*} appears in @code{X}, all of the 29616alternatives must be starred, and only the first matching alternative 29617is substituted. 29618 29619For example, a spec string like this: 29620 29621@smallexample 29622%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 29623@end smallexample 29624 29625@noindent 29626outputs the following command-line options from the following input 29627command-line options: 29628 29629@smallexample 29630fred.c -foo -baz 29631jim.d -bar -boggle 29632-d fred.c -foo -baz -boggle 29633-d jim.d -bar -baz -boggle 29634@end smallexample 29635 29636@item %@{S:X; T:Y; :D@} 29637 29638If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 29639given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 29640be as many clauses as you need. This may be combined with @code{.}, 29641@code{,}, @code{!}, @code{|}, and @code{*} as needed. 29642 29643 29644@end table 29645 29646The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}} 29647or similar construct can use a backslash to ignore the special meaning 29648of the character following it, thus allowing literal matching of a 29649character that is otherwise specially treated. For example, 29650@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the 29651@option{-std=iso9899:1999} option is given. 29652 29653The conditional text @code{X} in a @samp{%@{S:X@}} or similar 29654construct may contain other nested @samp{%} constructs or spaces, or 29655even newlines. They are processed as usual, as described above. 29656Trailing white space in @code{X} is ignored. White space may also 29657appear anywhere on the left side of the colon in these constructs, 29658except between @code{.} or @code{*} and the corresponding word. 29659 29660The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 29661handled specifically in these constructs. If another value of 29662@option{-O} or the negated form of a @option{-f}, @option{-m}, or 29663@option{-W} switch is found later in the command line, the earlier 29664switch value is ignored, except with @{@code{S}*@} where @code{S} is 29665just one letter, which passes all matching options. 29666 29667The character @samp{|} at the beginning of the predicate text is used to 29668indicate that a command should be piped to the following command, but 29669only if @option{-pipe} is specified. 29670 29671It is built into GCC which switches take arguments and which do not. 29672(You might think it would be useful to generalize this to allow each 29673compiler's spec to say which switches take arguments. But this cannot 29674be done in a consistent fashion. GCC cannot even decide which input 29675files have been specified without knowing which switches take arguments, 29676and it must know which input files to compile in order to tell which 29677compilers to run). 29678 29679GCC also knows implicitly that arguments starting in @option{-l} are to be 29680treated as compiler output files, and passed to the linker in their 29681proper position among the other output files. 29682 29683@node Environment Variables 29684@section Environment Variables Affecting GCC 29685@cindex environment variables 29686 29687@c man begin ENVIRONMENT 29688This section describes several environment variables that affect how GCC 29689operates. Some of them work by specifying directories or prefixes to use 29690when searching for various kinds of files. Some are used to specify other 29691aspects of the compilation environment. 29692 29693Note that you can also specify places to search using options such as 29694@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 29695take precedence over places specified using environment variables, which 29696in turn take precedence over those specified by the configuration of GCC@. 29697@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 29698GNU Compiler Collection (GCC) Internals}. 29699 29700@table @env 29701@item LANG 29702@itemx LC_CTYPE 29703@c @itemx LC_COLLATE 29704@itemx LC_MESSAGES 29705@c @itemx LC_MONETARY 29706@c @itemx LC_NUMERIC 29707@c @itemx LC_TIME 29708@itemx LC_ALL 29709@findex LANG 29710@findex LC_CTYPE 29711@c @findex LC_COLLATE 29712@findex LC_MESSAGES 29713@c @findex LC_MONETARY 29714@c @findex LC_NUMERIC 29715@c @findex LC_TIME 29716@findex LC_ALL 29717@cindex locale 29718These environment variables control the way that GCC uses 29719localization information which allows GCC to work with different 29720national conventions. GCC inspects the locale categories 29721@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 29722so. These locale categories can be set to any value supported by your 29723installation. A typical value is @samp{en_GB.UTF-8} for English in the United 29724Kingdom encoded in UTF-8. 29725 29726The @env{LC_CTYPE} environment variable specifies character 29727classification. GCC uses it to determine the character boundaries in 29728a string; this is needed for some multibyte encodings that contain quote 29729and escape characters that are otherwise interpreted as a string 29730end or escape. 29731 29732The @env{LC_MESSAGES} environment variable specifies the language to 29733use in diagnostic messages. 29734 29735If the @env{LC_ALL} environment variable is set, it overrides the value 29736of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 29737and @env{LC_MESSAGES} default to the value of the @env{LANG} 29738environment variable. If none of these variables are set, GCC 29739defaults to traditional C English behavior. 29740 29741@item TMPDIR 29742@findex TMPDIR 29743If @env{TMPDIR} is set, it specifies the directory to use for temporary 29744files. GCC uses temporary files to hold the output of one stage of 29745compilation which is to be used as input to the next stage: for example, 29746the output of the preprocessor, which is the input to the compiler 29747proper. 29748 29749@item GCC_COMPARE_DEBUG 29750@findex GCC_COMPARE_DEBUG 29751Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 29752@option{-fcompare-debug} to the compiler driver. See the documentation 29753of this option for more details. 29754 29755@item GCC_EXEC_PREFIX 29756@findex GCC_EXEC_PREFIX 29757If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 29758names of the subprograms executed by the compiler. No slash is added 29759when this prefix is combined with the name of a subprogram, but you can 29760specify a prefix that ends with a slash if you wish. 29761 29762If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 29763an appropriate prefix to use based on the pathname it is invoked with. 29764 29765If GCC cannot find the subprogram using the specified prefix, it 29766tries looking in the usual places for the subprogram. 29767 29768The default value of @env{GCC_EXEC_PREFIX} is 29769@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 29770the installed compiler. In many cases @var{prefix} is the value 29771of @code{prefix} when you ran the @file{configure} script. 29772 29773Other prefixes specified with @option{-B} take precedence over this prefix. 29774 29775This prefix is also used for finding files such as @file{crt0.o} that are 29776used for linking. 29777 29778In addition, the prefix is used in an unusual way in finding the 29779directories to search for header files. For each of the standard 29780directories whose name normally begins with @samp{/usr/local/lib/gcc} 29781(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 29782replacing that beginning with the specified prefix to produce an 29783alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 29784@file{foo/bar} just before it searches the standard directory 29785@file{/usr/local/lib/bar}. 29786If a standard directory begins with the configured 29787@var{prefix} then the value of @var{prefix} is replaced by 29788@env{GCC_EXEC_PREFIX} when looking for header files. 29789 29790@item COMPILER_PATH 29791@findex COMPILER_PATH 29792The value of @env{COMPILER_PATH} is a colon-separated list of 29793directories, much like @env{PATH}. GCC tries the directories thus 29794specified when searching for subprograms, if it cannot find the 29795subprograms using @env{GCC_EXEC_PREFIX}. 29796 29797@item LIBRARY_PATH 29798@findex LIBRARY_PATH 29799The value of @env{LIBRARY_PATH} is a colon-separated list of 29800directories, much like @env{PATH}. When configured as a native compiler, 29801GCC tries the directories thus specified when searching for special 29802linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking 29803using GCC also uses these directories when searching for ordinary 29804libraries for the @option{-l} option (but directories specified with 29805@option{-L} come first). 29806 29807@item LANG 29808@findex LANG 29809@cindex locale definition 29810This variable is used to pass locale information to the compiler. One way in 29811which this information is used is to determine the character set to be used 29812when character literals, string literals and comments are parsed in C and C++. 29813When the compiler is configured to allow multibyte characters, 29814the following values for @env{LANG} are recognized: 29815 29816@table @samp 29817@item C-JIS 29818Recognize JIS characters. 29819@item C-SJIS 29820Recognize SJIS characters. 29821@item C-EUCJP 29822Recognize EUCJP characters. 29823@end table 29824 29825If @env{LANG} is not defined, or if it has some other value, then the 29826compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 29827recognize and translate multibyte characters. 29828@end table 29829 29830@noindent 29831Some additional environment variables affect the behavior of the 29832preprocessor. 29833 29834@include cppenv.texi 29835 29836@c man end 29837 29838@node Precompiled Headers 29839@section Using Precompiled Headers 29840@cindex precompiled headers 29841@cindex speed of compilation 29842 29843Often large projects have many header files that are included in every 29844source file. The time the compiler takes to process these header files 29845over and over again can account for nearly all of the time required to 29846build the project. To make builds faster, GCC allows you to 29847@dfn{precompile} a header file. 29848 29849To create a precompiled header file, simply compile it as you would any 29850other file, if necessary using the @option{-x} option to make the driver 29851treat it as a C or C++ header file. You may want to use a 29852tool like @command{make} to keep the precompiled header up-to-date when 29853the headers it contains change. 29854 29855A precompiled header file is searched for when @code{#include} is 29856seen in the compilation. As it searches for the included file 29857(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 29858compiler looks for a precompiled header in each directory just before it 29859looks for the include file in that directory. The name searched for is 29860the name specified in the @code{#include} with @samp{.gch} appended. If 29861the precompiled header file cannot be used, it is ignored. 29862 29863For instance, if you have @code{#include "all.h"}, and you have 29864@file{all.h.gch} in the same directory as @file{all.h}, then the 29865precompiled header file is used if possible, and the original 29866header is used otherwise. 29867 29868Alternatively, you might decide to put the precompiled header file in a 29869directory and use @option{-I} to ensure that directory is searched 29870before (or instead of) the directory containing the original header. 29871Then, if you want to check that the precompiled header file is always 29872used, you can put a file of the same name as the original header in this 29873directory containing an @code{#error} command. 29874 29875This also works with @option{-include}. So yet another way to use 29876precompiled headers, good for projects not designed with precompiled 29877header files in mind, is to simply take most of the header files used by 29878a project, include them from another header file, precompile that header 29879file, and @option{-include} the precompiled header. If the header files 29880have guards against multiple inclusion, they are skipped because 29881they've already been included (in the precompiled header). 29882 29883If you need to precompile the same header file for different 29884languages, targets, or compiler options, you can instead make a 29885@emph{directory} named like @file{all.h.gch}, and put each precompiled 29886header in the directory, perhaps using @option{-o}. It doesn't matter 29887what you call the files in the directory; every precompiled header in 29888the directory is considered. The first precompiled header 29889encountered in the directory that is valid for this compilation is 29890used; they're searched in no particular order. 29891 29892There are many other possibilities, limited only by your imagination, 29893good sense, and the constraints of your build system. 29894 29895A precompiled header file can be used only when these conditions apply: 29896 29897@itemize 29898@item 29899Only one precompiled header can be used in a particular compilation. 29900 29901@item 29902A precompiled header cannot be used once the first C token is seen. You 29903can have preprocessor directives before a precompiled header; you cannot 29904include a precompiled header from inside another header. 29905 29906@item 29907The precompiled header file must be produced for the same language as 29908the current compilation. You cannot use a C precompiled header for a C++ 29909compilation. 29910 29911@item 29912The precompiled header file must have been produced by the same compiler 29913binary as the current compilation is using. 29914 29915@item 29916Any macros defined before the precompiled header is included must 29917either be defined in the same way as when the precompiled header was 29918generated, or must not affect the precompiled header, which usually 29919means that they don't appear in the precompiled header at all. 29920 29921The @option{-D} option is one way to define a macro before a 29922precompiled header is included; using a @code{#define} can also do it. 29923There are also some options that define macros implicitly, like 29924@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 29925defined this way. 29926 29927@item If debugging information is output when using the precompiled 29928header, using @option{-g} or similar, the same kind of debugging information 29929must have been output when building the precompiled header. However, 29930a precompiled header built using @option{-g} can be used in a compilation 29931when no debugging information is being output. 29932 29933@item The same @option{-m} options must generally be used when building 29934and using the precompiled header. @xref{Submodel Options}, 29935for any cases where this rule is relaxed. 29936 29937@item Each of the following options must be the same when building and using 29938the precompiled header: 29939 29940@gccoptlist{-fexceptions} 29941 29942@item 29943Some other command-line options starting with @option{-f}, 29944@option{-p}, or @option{-O} must be defined in the same way as when 29945the precompiled header was generated. At present, it's not clear 29946which options are safe to change and which are not; the safest choice 29947is to use exactly the same options when generating and using the 29948precompiled header. The following are known to be safe: 29949 29950@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 29951-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 29952-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 29953-pedantic-errors} 29954 29955@end itemize 29956 29957For all of these except the last, the compiler automatically 29958ignores the precompiled header if the conditions aren't met. If you 29959find an option combination that doesn't work and doesn't cause the 29960precompiled header to be ignored, please consider filing a bug report, 29961see @ref{Bugs}. 29962 29963If you do use differing options when generating and using the 29964precompiled header, the actual behavior is a mixture of the 29965behavior for the options. For instance, if you use @option{-g} to 29966generate the precompiled header but not when using it, you may or may 29967not get debugging information for routines in the precompiled header. 29968