1@c Copyright (C) 1988-2021 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-2021 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 @command{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* Static Analyzer Options:: More expensive warnings. 157* Debugging Options:: Producing debuggable code. 158* Optimize Options:: How much optimization? 159* Instrumentation Options:: Enabling profiling and extra run-time error checking. 160* Preprocessor Options:: Controlling header files and macro definitions. 161 Also, getting dependency information for Make. 162* Assembler Options:: Passing options to the assembler. 163* Link Options:: Specifying libraries and so on. 164* Directory Options:: Where to find header files and libraries. 165 Where to find the compiler executable files. 166* Code Gen Options:: Specifying conventions for function calls, data layout 167 and register usage. 168* Developer Options:: Printing GCC configuration info, statistics, and 169 debugging dumps. 170* Submodel Options:: Target-specific options, such as compiling for a 171 specific processor variant. 172* Spec Files:: How to pass switches to sub-processes. 173* Environment Variables:: Env vars that affect GCC. 174* Precompiled Headers:: Compiling a header once, and using it many times. 175* C++ Modules:: Experimental C++20 module system. 176@end menu 177 178@c man begin OPTIONS 179 180@node Option Summary 181@section Option Summary 182 183Here is a summary of all the options, grouped by type. Explanations are 184in the following sections. 185 186@table @emph 187@item Overall Options 188@xref{Overall Options,,Options Controlling the Kind of Output}. 189@gccoptlist{-c -S -E -o @var{file} @gol 190-dumpbase @var{dumpbase} -dumpbase-ext @var{auxdropsuf} @gol 191-dumpdir @var{dumppfx} -x @var{language} @gol 192-v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol 193-pass-exit-codes -pipe -specs=@var{file} -wrapper @gol 194@@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol 195-fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol 196-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}} 197 198@item C Language Options 199@xref{C Dialect Options,,Options Controlling C Dialect}. 200@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 201-fpermitted-flt-eval-methods=@var{standard} @gol 202-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol 203-fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol 204-fhosted -ffreestanding @gol 205-fopenacc -fopenacc-dim=@var{geom} @gol 206-fopenmp -fopenmp-simd @gol 207-fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol 208-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 209-fsigned-bitfields -fsigned-char @gol 210-funsigned-bitfields -funsigned-char} 211 212@item C++ Language Options 213@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 214@gccoptlist{-fabi-version=@var{n} -fno-access-control @gol 215-faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol 216-fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol 217-fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol 218-fno-elide-constructors @gol 219-fno-enforce-eh-specs @gol 220-fno-gnu-keywords @gol 221-fno-implicit-templates @gol 222-fno-implicit-inline-templates @gol 223-fno-implement-inlines @gol 224-fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts @gol 225-fmodule-implicit-inline @gol 226-fno-module-lazy @gol 227-fmodule-mapper=@var{specification} @gol 228-fmodule-version-ignore @gol 229-fms-extensions @gol 230-fnew-inheriting-ctors @gol 231-fnew-ttp-matching @gol 232-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol 233-fno-optional-diags -fpermissive @gol 234-fno-pretty-templates @gol 235-fno-rtti -fsized-deallocation @gol 236-ftemplate-backtrace-limit=@var{n} @gol 237-ftemplate-depth=@var{n} @gol 238-fno-threadsafe-statics -fuse-cxa-atexit @gol 239-fno-weak -nostdinc++ @gol 240-fvisibility-inlines-hidden @gol 241-fvisibility-ms-compat @gol 242-fext-numeric-literals @gol 243-flang-info-include-translate@r{[}=@var{header}@r{]} @gol 244-flang-info-include-translate-not @gol 245-flang-info-module-cmi@r{[}=@var{module}@r{]} @gol 246-stdlib=@var{libstdc++,libc++} @gol 247-Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol 248-Wno-class-conversion -Wclass-memaccess @gol 249-Wcomma-subscript -Wconditionally-supported @gol 250-Wno-conversion-null -Wctad-maybe-unsupported @gol 251-Wctor-dtor-privacy -Wno-delete-incomplete @gol 252-Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol 253-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol 254-Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base @gol 255-Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol 256-Winvalid-imported-macros @gol 257-Wno-invalid-offsetof -Wno-literal-suffix @gol 258-Wno-mismatched-new-delete -Wmismatched-tags @gol 259-Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol 260-Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol 261-Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol 262-Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol 263-Wreorder -Wregister @gol 264-Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol 265-Wno-non-template-friend -Wold-style-cast @gol 266-Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol 267-Wsized-deallocation -Wsuggest-final-methods @gol 268-Wsuggest-final-types -Wsuggest-override @gol 269-Wno-terminate -Wuseless-cast -Wno-vexing-parse @gol 270-Wvirtual-inheritance @gol 271-Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant} 272 273@item Objective-C and Objective-C++ Language Options 274@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling 275Objective-C and Objective-C++ Dialects}. 276@gccoptlist{-fconstant-string-class=@var{class-name} @gol 277-fgnu-runtime -fnext-runtime @gol 278-fno-nil-receivers @gol 279-fobjc-abi-version=@var{n} @gol 280-fobjc-call-cxx-cdtors @gol 281-fobjc-direct-dispatch @gol 282-fobjc-exceptions @gol 283-fobjc-gc @gol 284-fobjc-nilcheck @gol 285-fobjc-std=objc1 @gol 286-fno-local-ivars @gol 287-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol 288-freplace-objc-classes @gol 289-fzero-link @gol 290-gen-decls @gol 291-Wassign-intercept -Wno-property-assign-default @gol 292-Wno-protocol -Wobjc-root-class -Wselector @gol 293-Wstrict-selector-match @gol 294-Wundeclared-selector} 295 296@item Diagnostic Message Formatting Options 297@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}. 298@gccoptlist{-fmessage-length=@var{n} @gol 299-fdiagnostics-plain-output @gol 300-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 301-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol 302-fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol 303-fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol 304-fno-diagnostics-show-option -fno-diagnostics-show-caret @gol 305-fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol 306-fno-diagnostics-show-cwe @gol 307-fdiagnostics-minimum-margin-width=@var{width} @gol 308-fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol 309-fdiagnostics-show-template-tree -fno-elide-type @gol 310-fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol 311-fdiagnostics-show-path-depths @gol 312-fno-show-column @gol 313-fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol 314-fdiagnostics-column-origin=@var{origin}} 315 316@item Warning Options 317@xref{Warning Options,,Options to Request or Suppress Warnings}. 318@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol 319-pedantic-errors @gol 320-w -Wextra -Wall -Wabi=@var{n} @gol 321-Waddress -Wno-address-of-packed-member -Waggregate-return @gol 322-Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol 323-Walloca -Walloca-larger-than=@var{byte-size} @gol 324-Wno-aggressive-loop-optimizations @gol 325-Warith-conversion @gol 326-Warray-bounds -Warray-bounds=@var{n} @gol 327-Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol 328-Wno-attribute-warning -Wbool-compare -Wbool-operation @gol 329-Wno-builtin-declaration-mismatch @gol 330-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol 331-Wc11-c2x-compat @gol 332-Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol 333-Wc++20-compat @gol 334-Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol 335-Wchar-subscripts @gol 336-Wclobbered -Wcomment @gol 337-Wconversion -Wno-coverage-mismatch -Wno-cpp @gol 338-Wdangling-else -Wdate-time @gol 339-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol 340-Wdisabled-optimization @gol 341-Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol 342-Wno-div-by-zero -Wdouble-promotion @gol 343-Wduplicated-branches -Wduplicated-cond @gol 344-Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol 345-Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol 346-Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol 347-Wno-format-contains-nul -Wno-format-extra-args @gol 348-Wformat-nonliteral -Wformat-overflow=@var{n} @gol 349-Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol 350-Wformat-y2k -Wframe-address @gol 351-Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol 352-Wno-if-not-aligned -Wno-ignored-attributes @gol 353-Wignored-qualifiers -Wno-incompatible-pointer-types @gol 354-Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol 355-Wno-implicit-function-declaration -Wno-implicit-int @gol 356-Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol 357-Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol 358-Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol 359-Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol 360-Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol 361-Wmemset-elt-size -Wmemset-transposed-args @gol 362-Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol 363-Wmissing-field-initializers -Wmissing-format-attribute @gol 364-Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol 365-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol 366-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol 367-Wnull-dereference -Wno-odr -Wopenmp-simd @gol 368-Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol 369-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol 370-Wparentheses -Wno-pedantic-ms-format @gol 371-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol 372-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol 373-Wrestrict -Wno-return-local-addr -Wreturn-type @gol 374-Wno-scalar-storage-order -Wsequence-point @gol 375-Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol 376-Wno-shadow-ivar @gol 377-Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol 378-Wno-shift-overflow -Wshift-overflow=@var{n} @gol 379-Wsign-compare -Wsign-conversion @gol 380-Wno-sizeof-array-argument @gol 381-Wsizeof-array-div @gol 382-Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol 383-Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol 384-Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol 385-Wstring-compare @gol 386-Wno-stringop-overflow -Wno-stringop-overread @gol 387-Wno-stringop-truncation @gol 388-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol 389-Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol 390-Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol 391-Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol 392-Wtsan -Wtype-limits -Wundef @gol 393-Wuninitialized -Wunknown-pragmas @gol 394-Wunsuffixed-float-constants -Wunused @gol 395-Wunused-but-set-parameter -Wunused-but-set-variable @gol 396-Wunused-const-variable -Wunused-const-variable=@var{n} @gol 397-Wunused-function -Wunused-label -Wunused-local-typedefs @gol 398-Wunused-macros @gol 399-Wunused-parameter -Wno-unused-result @gol 400-Wunused-value -Wunused-variable @gol 401-Wno-varargs -Wvariadic-macros @gol 402-Wvector-operation-performance @gol 403-Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol 404-Wvolatile-register-var -Wwrite-strings @gol 405-Wzero-length-bounds} 406 407@item Static Analyzer Options 408@gccoptlist{ 409-fanalyzer @gol 410-fanalyzer-call-summaries @gol 411-fanalyzer-checker=@var{name} @gol 412-fno-analyzer-feasibility @gol 413-fanalyzer-fine-grained @gol 414-fanalyzer-state-merge @gol 415-fanalyzer-state-purge @gol 416-fanalyzer-transitivity @gol 417-fanalyzer-verbose-edges @gol 418-fanalyzer-verbose-state-changes @gol 419-fanalyzer-verbosity=@var{level} @gol 420-fdump-analyzer @gol 421-fdump-analyzer-stderr @gol 422-fdump-analyzer-callgraph @gol 423-fdump-analyzer-exploded-graph @gol 424-fdump-analyzer-exploded-nodes @gol 425-fdump-analyzer-exploded-nodes-2 @gol 426-fdump-analyzer-exploded-nodes-3 @gol 427-fdump-analyzer-feasibility @gol 428-fdump-analyzer-json @gol 429-fdump-analyzer-state-purge @gol 430-fdump-analyzer-supergraph @gol 431-Wno-analyzer-double-fclose @gol 432-Wno-analyzer-double-free @gol 433-Wno-analyzer-exposure-through-output-file @gol 434-Wno-analyzer-file-leak @gol 435-Wno-analyzer-free-of-non-heap @gol 436-Wno-analyzer-malloc-leak @gol 437-Wno-analyzer-mismatching-deallocation @gol 438-Wno-analyzer-null-argument @gol 439-Wno-analyzer-null-dereference @gol 440-Wno-analyzer-possible-null-argument @gol 441-Wno-analyzer-possible-null-dereference @gol 442-Wno-analyzer-shift-count-negative @gol 443-Wno-analyzer-shift-count-overflow @gol 444-Wno-analyzer-stale-setjmp-buffer @gol 445-Wno-analyzer-tainted-array-index @gol 446-Wanalyzer-too-complex @gol 447-Wno-analyzer-unsafe-call-within-signal-handler @gol 448-Wno-analyzer-use-after-free @gol 449-Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol 450-Wno-analyzer-use-of-uninitialized-value @gol 451-Wno-analyzer-write-to-const @gol 452-Wno-analyzer-write-to-string-literal @gol 453} 454 455@item C and Objective-C-only Warning Options 456@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 457-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol 458-Wold-style-declaration -Wold-style-definition @gol 459-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol 460-Wdeclaration-after-statement -Wpointer-sign} 461 462@item Debugging Options 463@xref{Debugging Options,,Options for Debugging Your Program}. 464@gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol 465-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol 466-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol 467-gas-loc-support -gno-as-loc-support @gol 468-gas-locview-support -gno-as-locview-support @gol 469-gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol 470-gstatement-frontiers -gno-statement-frontiers @gol 471-gvariable-location-views -gno-variable-location-views @gol 472-ginternal-reset-location-views -gno-internal-reset-location-views @gol 473-ginline-points -gno-inline-points @gol 474-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol 475-gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol 476-fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol 477-fno-eliminate-unused-debug-types @gol 478-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 479-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 480-fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol 481-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol 482-fvar-tracking -fvar-tracking-assignments} 483 484@item Optimization Options 485@xref{Optimize Options,,Options that Control Optimization}. 486@gccoptlist{-faggressive-loop-optimizations @gol 487-falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 488-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 489-falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 490-falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 491-fno-allocation-dce -fallow-store-data-races @gol 492-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol 493-fauto-inc-dec -fbranch-probabilities @gol 494-fcaller-saves @gol 495-fcombine-stack-adjustments -fconserve-stack @gol 496-fcompare-elim -fcprop-registers -fcrossjumping @gol 497-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol 498-fcx-limited-range @gol 499-fdata-sections -fdce -fdelayed-branch @gol 500-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol 501-fdevirtualize-at-ltrans -fdse @gol 502-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol 503-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol 504-ffinite-loops @gol 505-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol 506-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol 507-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol 508-fif-conversion2 -findirect-inlining @gol 509-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol 510-finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol 511-fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol 512-fipa-reference -fipa-reference-addressable @gol 513-fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol 514-flive-patching=@var{level} @gol 515-fira-region=@var{region} -fira-hoist-pressure @gol 516-fira-loop-pressure -fno-ira-share-save-slots @gol 517-fno-ira-share-spill-slots @gol 518-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol 519-fivopts -fkeep-inline-functions -fkeep-static-functions @gol 520-fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol 521-floop-block -floop-interchange -floop-strip-mine @gol 522-floop-unroll-and-jam -floop-nest-optimize @gol 523-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol 524-flto-partition=@var{alg} -fmerge-all-constants @gol 525-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol 526-fmove-loop-invariants -fno-branch-count-reg @gol 527-fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol 528-fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol 529-fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol 530-fno-sched-spec -fno-signed-zeros @gol 531-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 532-fomit-frame-pointer -foptimize-sibling-calls @gol 533-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol 534-fprefetch-loop-arrays @gol 535-fprofile-correction @gol 536-fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol 537-fprofile-values -fprofile-reorder-functions @gol 538-freciprocal-math -free -frename-registers -freorder-blocks @gol 539-freorder-blocks-algorithm=@var{algorithm} @gol 540-freorder-blocks-and-partition -freorder-functions @gol 541-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol 542-frounding-math -fsave-optimization-record @gol 543-fsched2-use-superblocks -fsched-pressure @gol 544-fsched-spec-load -fsched-spec-load-dangerous @gol 545-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol 546-fsched-group-heuristic -fsched-critical-path-heuristic @gol 547-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol 548-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol 549-fschedule-fusion @gol 550-fschedule-insns -fschedule-insns2 -fsection-anchors @gol 551-fselective-scheduling -fselective-scheduling2 @gol 552-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol 553-fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol 554-fsignaling-nans @gol 555-fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol 556-fsplit-paths @gol 557-fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol 558-fstdarg-opt -fstore-merging -fstrict-aliasing @gol 559-fthread-jumps -ftracer -ftree-bit-ccp @gol 560-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol 561-ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol 562-ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol 563-ftree-loop-if-convert -ftree-loop-im @gol 564-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol 565-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol 566-ftree-loop-vectorize @gol 567-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol 568-ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol 569-ftree-switch-conversion -ftree-tail-merge @gol 570-ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol 571-funit-at-a-time -funroll-all-loops -funroll-loops @gol 572-funsafe-math-optimizations -funswitch-loops @gol 573-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol 574-fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol 575--param @var{name}=@var{value} 576-O -O0 -O1 -O2 -O3 -Os -Ofast -Og} 577 578@item Program Instrumentation Options 579@xref{Instrumentation Options,,Program Instrumentation Options}. 580@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol 581-fprofile-abs-path @gol 582-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol 583-fprofile-info-section -fprofile-info-section=@var{name} @gol 584-fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol 585-fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol 586-fprofile-exclude-files=@var{regex} @gol 587-fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol 588-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol 589-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol 590-fsanitize-undefined-trap-on-error -fbounds-check @gol 591-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol 592-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 593-fstack-protector-explicit -fstack-check @gol 594-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 595-fno-stack-limit -fsplit-stack @gol 596-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol 597-fvtv-counts -fvtv-debug @gol 598-finstrument-functions @gol 599-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 600-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} 601 602@item Preprocessor Options 603@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 604@gccoptlist{-A@var{question}=@var{answer} @gol 605-A-@var{question}@r{[}=@var{answer}@r{]} @gol 606-C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol 607-dD -dI -dM -dN -dU @gol 608-fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol 609-fexec-charset=@var{charset} -fextended-identifiers @gol 610-finput-charset=@var{charset} -flarge-source-files @gol 611-fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol 612-fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol 613-fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol 614-fwide-exec-charset=@var{charset} -fworking-directory @gol 615-H -imacros @var{file} -include @var{file} @gol 616-M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules @gol 617-no-integrated-cpp -P -pthread -remap @gol 618-traditional -traditional-cpp -trigraphs @gol 619-U@var{macro} -undef @gol 620-Wp,@var{option} -Xpreprocessor @var{option}} 621 622@item Assembler Options 623@xref{Assembler Options,,Passing Options to the Assembler}. 624@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 625 626@item Linker Options 627@xref{Link Options,,Options for Linking}. 628@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 629-nostartfiles -nodefaultlibs -nolibc -nostdlib @gol 630-e @var{entry} --entry=@var{entry} @gol 631-pie -pthread -r -rdynamic @gol 632-s -static -static-pie -static-libgcc -static-libstdc++ @gol 633-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 634-shared -shared-libgcc -symbolic @gol 635-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 636-u @var{symbol} -z @var{keyword}} 637 638@item Directory Options 639@xref{Directory Options,,Options for Directory Search}. 640@gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol 641-idirafter @var{dir} @gol 642-imacros @var{file} -imultilib @var{dir} @gol 643-iplugindir=@var{dir} -iprefix @var{file} @gol 644-iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol 645-iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol 646-L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol 647-nostdinc -nostdinc++ --sysroot=@var{dir}} 648 649@item Code Generation Options 650@xref{Code Gen Options,,Options for Code Generation Conventions}. 651@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 652-ffixed-@var{reg} -fexceptions @gol 653-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 654-fasynchronous-unwind-tables @gol 655-fno-gnu-unique @gol 656-finhibit-size-directive -fcommon -fno-ident @gol 657-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol 658-fno-jump-tables -fno-bit-tests @gol 659-frecord-gcc-switches @gol 660-freg-struct-return -fshort-enums -fshort-wchar @gol 661-fverbose-asm -fpack-struct[=@var{n}] @gol 662-fleading-underscore -ftls-model=@var{model} @gol 663-fstack-reuse=@var{reuse_level} @gol 664-ftrampolines -ftrapv -fwrapv @gol 665-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 666-fstrict-volatile-bitfields -fsync-libcalls} 667 668@item Developer Options 669@xref{Developer Options,,GCC Developer Options}. 670@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 671-dumpfullversion -fcallgraph-info@r{[}=su,da@r{]} 672-fchecking -fchecking=@var{n} 673-fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol 674-fdisable-ipa-@var{pass_name} @gol 675-fdisable-rtl-@var{pass_name} @gol 676-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 677-fdisable-tree-@var{pass_name} @gol 678-fdisable-tree-@var{pass-name}=@var{range-list} @gol 679-fdump-debug -fdump-earlydebug @gol 680-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 681-fdump-final-insns@r{[}=@var{file}@r{]} @gol 682-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 683-fdump-lang-all @gol 684-fdump-lang-@var{switch} @gol 685-fdump-lang-@var{switch}-@var{options} @gol 686-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol 687-fdump-passes @gol 688-fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol 689-fdump-statistics @gol 690-fdump-tree-all @gol 691-fdump-tree-@var{switch} @gol 692-fdump-tree-@var{switch}-@var{options} @gol 693-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol 694-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 695-fenable-@var{kind}-@var{pass} @gol 696-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 697-fira-verbose=@var{n} @gol 698-flto-report -flto-report-wpa -fmem-report-wpa @gol 699-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol 700-fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 701-fprofile-report @gol 702-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 703-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 704-fstats -fstack-usage -ftime-report -ftime-report-details @gol 705-fvar-tracking-assignments-toggle -gtoggle @gol 706-print-file-name=@var{library} -print-libgcc-file-name @gol 707-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 708-print-prog-name=@var{program} -print-search-dirs -Q @gol 709-print-sysroot -print-sysroot-headers-suffix @gol 710-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 711 712@item Machine-Dependent Options 713@xref{Submodel Options,,Machine-Dependent Options}. 714@c This list is ordered alphanumerically by subsection name. 715@c Try and put the significant identifier (CPU or system) first, 716@c so users have a clue at guessing where the ones they want will be. 717 718@emph{AArch64 Options} 719@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 720-mgeneral-regs-only @gol 721-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 722-mstrict-align -mno-strict-align @gol 723-momit-leaf-frame-pointer @gol 724-mtls-dialect=desc -mtls-dialect=traditional @gol 725-mtls-size=@var{size} @gol 726-mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol 727-mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol 728-mpc-relative-literal-loads @gol 729-msign-return-address=@var{scope} @gol 730-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf} 731+@var{b-key}]|@var{bti} @gol 732-mharden-sls=@var{opts} @gol 733-march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol 734-moverride=@var{string} -mverbose-cost-dump @gol 735-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol 736-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol 737-moutline-atomics } 738 739@emph{Adapteva Epiphany Options} 740@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 741-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 742-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 743-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 744-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 745-msplit-vecmove-early -m1reg-@var{reg}} 746 747@emph{AMD GCN Options} 748@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}} 749 750@emph{ARC Options} 751@gccoptlist{-mbarrel-shifter -mjli-always @gol 752-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol 753-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol 754-mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol 755-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol 756-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol 757-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol 758-mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol 759-mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol 760-mvolatile-cache -mtp-regno=@var{regno} @gol 761-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol 762-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol 763-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol 764-mlra-priority-compact mlra-priority-noncompact -mmillicode @gol 765-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol 766-mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol 767-munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol 768-mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index} 769 770@emph{ARM Options} 771@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 772-mabi=@var{name} @gol 773-mapcs-stack-check -mno-apcs-stack-check @gol 774-mapcs-reentrant -mno-apcs-reentrant @gol 775-mgeneral-regs-only @gol 776-msched-prolog -mno-sched-prolog @gol 777-mlittle-endian -mbig-endian @gol 778-mbe8 -mbe32 @gol 779-mfloat-abi=@var{name} @gol 780-mfp16-format=@var{name} 781-mthumb-interwork -mno-thumb-interwork @gol 782-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 783-mtune=@var{name} -mprint-tune-info @gol 784-mstructure-size-boundary=@var{n} @gol 785-mabort-on-noreturn @gol 786-mlong-calls -mno-long-calls @gol 787-msingle-pic-base -mno-single-pic-base @gol 788-mpic-register=@var{reg} @gol 789-mnop-fun-dllimport @gol 790-mpoke-function-name @gol 791-mthumb -marm -mflip-thumb @gol 792-mtpcs-frame -mtpcs-leaf-frame @gol 793-mcaller-super-interworking -mcallee-super-interworking @gol 794-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 795-mword-relocations @gol 796-mfix-cortex-m3-ldrd @gol 797-munaligned-access @gol 798-mneon-for-64bits @gol 799-mslow-flash-data @gol 800-masm-syntax-unified @gol 801-mrestrict-it @gol 802-mverbose-cost-dump @gol 803-mpure-code @gol 804-mcmse @gol 805-mfdpic} 806 807@emph{AVR Options} 808@gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol 809-mbranch-cost=@var{cost} @gol 810-mcall-prologues -mgas-isr-prologues -mint8 @gol 811-mdouble=@var{bits} -mlong-double=@var{bits} @gol 812-mn_flash=@var{size} -mno-interrupts @gol 813-mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol 814-mfract-convert-truncate @gol 815-mshort-calls -nodevicelib -nodevicespecs @gol 816-Waddr-space-convert -Wmisspelled-isr} 817 818@emph{Blackfin Options} 819@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 820-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 821-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 822-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 823-mno-id-shared-library -mshared-library-id=@var{n} @gol 824-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 825-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 826-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 827-micplb} 828 829@emph{C6X Options} 830@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 831-msim -msdata=@var{sdata-type}} 832 833@emph{CRIS Options} 834@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 835-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 836-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 837-mstack-align -mdata-align -mconst-align @gol 838-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 839-melf -maout -melinux -mlinux -sim -sim2 @gol 840-mmul-bug-workaround -mno-mul-bug-workaround} 841 842@emph{CR16 Options} 843@gccoptlist{-mmac @gol 844-mcr16cplus -mcr16c @gol 845-msim -mint32 -mbit-ops 846-mdata-model=@var{model}} 847 848@emph{C-SKY Options} 849@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol 850-mbig-endian -EB -mlittle-endian -EL @gol 851-mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol 852-mfloat-abi=@var{name} @gol 853-melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol 854-mdsp -medsp -mvdsp @gol 855-mdiv -msmart -mhigh-registers -manchor @gol 856-mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol 857-mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim} 858 859@emph{Darwin Options} 860@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 861-arch_only -bind_at_load -bundle -bundle_loader @gol 862-client_name -compatibility_version -current_version @gol 863-dead_strip @gol 864-dependency-file -dylib_file -dylinker_install_name @gol 865-dynamic -dynamiclib -exported_symbols_list @gol 866-filelist -flat_namespace -force_cpusubtype_ALL @gol 867-force_flat_namespace -headerpad_max_install_names @gol 868-iframework @gol 869-image_base -init -install_name -keep_private_externs @gol 870-multi_module -multiply_defined -multiply_defined_unused @gol 871-noall_load -no_dead_strip_inits_and_terms @gol 872-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 873-pagezero_size -prebind -prebind_all_twolevel_modules @gol 874-private_bundle -read_only_relocs -sectalign @gol 875-sectobjectsymbols -whyload -seg1addr @gol 876-sectcreate -sectobjectsymbols -sectorder @gol 877-segaddr -segs_read_only_addr -segs_read_write_addr @gol 878-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 879-segprot -segs_read_only_addr -segs_read_write_addr @gol 880-single_module -static -sub_library -sub_umbrella @gol 881-twolevel_namespace -umbrella -undefined @gol 882-unexported_symbols_list -weak_reference_mismatches @gol 883-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 884-mkernel -mone-byte-bool} 885 886@emph{DEC Alpha Options} 887@gccoptlist{-mno-fp-regs -msoft-float @gol 888-mieee -mieee-with-inexact -mieee-conformant @gol 889-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 890-mtrap-precision=@var{mode} -mbuild-constants @gol 891-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 892-mbwx -mmax -mfix -mcix @gol 893-mfloat-vax -mfloat-ieee @gol 894-mexplicit-relocs -msmall-data -mlarge-data @gol 895-msmall-text -mlarge-text @gol 896-mmemory-latency=@var{time}} 897 898@emph{eBPF Options} 899@gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version} 900-mframe-limit=@var{bytes} -mxbpf} 901 902@emph{FR30 Options} 903@gccoptlist{-msmall-model -mno-lsim} 904 905@emph{FT32 Options} 906@gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm} 907 908@emph{FRV Options} 909@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 910-mhard-float -msoft-float @gol 911-malloc-cc -mfixed-cc -mdword -mno-dword @gol 912-mdouble -mno-double @gol 913-mmedia -mno-media -mmuladd -mno-muladd @gol 914-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 915-mlinked-fp -mlong-calls -malign-labels @gol 916-mlibrary-pic -macc-4 -macc-8 @gol 917-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 918-moptimize-membar -mno-optimize-membar @gol 919-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 920-mvliw-branch -mno-vliw-branch @gol 921-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 922-mno-nested-cond-exec -mtomcat-stats @gol 923-mTLS -mtls @gol 924-mcpu=@var{cpu}} 925 926@emph{GNU/Linux Options} 927@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol 928-tno-android-cc -tno-android-ld} 929 930@emph{H8/300 Options} 931@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 932 933@emph{HPPA Options} 934@gccoptlist{-march=@var{architecture-type} @gol 935-mcaller-copies -mdisable-fpregs -mdisable-indexing @gol 936-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 937-mfixed-range=@var{register-range} @gol 938-mjump-in-delay -mlinker-opt -mlong-calls @gol 939-mlong-load-store -mno-disable-fpregs @gol 940-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 941-mno-jump-in-delay -mno-long-load-store @gol 942-mno-portable-runtime -mno-soft-float @gol 943-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 944-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 945-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 946-munix=@var{unix-std} -nolibdld -static -threads} 947 948@emph{IA-64 Options} 949@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 950-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 951-mconstant-gp -mauto-pic -mfused-madd @gol 952-minline-float-divide-min-latency @gol 953-minline-float-divide-max-throughput @gol 954-mno-inline-float-divide @gol 955-minline-int-divide-min-latency @gol 956-minline-int-divide-max-throughput @gol 957-mno-inline-int-divide @gol 958-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 959-mno-inline-sqrt @gol 960-mdwarf2-asm -mearly-stop-bits @gol 961-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 962-mtune=@var{cpu-type} -milp32 -mlp64 @gol 963-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 964-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 965-msched-spec-ldc -msched-spec-control-ldc @gol 966-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 967-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 968-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 969-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 970 971@emph{LM32 Options} 972@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 973-msign-extend-enabled -muser-enabled} 974 975@emph{M32R/D Options} 976@gccoptlist{-m32r2 -m32rx -m32r @gol 977-mdebug @gol 978-malign-loops -mno-align-loops @gol 979-missue-rate=@var{number} @gol 980-mbranch-cost=@var{number} @gol 981-mmodel=@var{code-size-model-type} @gol 982-msdata=@var{sdata-type} @gol 983-mno-flush-func -mflush-func=@var{name} @gol 984-mno-flush-trap -mflush-trap=@var{number} @gol 985-G @var{num}} 986 987@emph{M32C Options} 988@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 989 990@emph{M680x0 Options} 991@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol 992-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 993-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 994-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 995-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 996-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 997-malign-int -mstrict-align -msep-data -mno-sep-data @gol 998-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 999-mxgot -mno-xgot -mlong-jump-table-offsets} 1000 1001@emph{MCore Options} 1002@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 1003-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 1004-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 1005-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 1006-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 1007 1008@emph{MeP Options} 1009@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 1010-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 1011-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 1012-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 1013-mtiny=@var{n}} 1014 1015@emph{MicroBlaze Options} 1016@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 1017-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 1018-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 1019-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 1020-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol 1021-mpic-data-is-text-relative} 1022 1023@emph{MIPS Options} 1024@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 1025-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol 1026-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol 1027-mips16 -mno-mips16 -mflip-mips16 @gol 1028-minterlink-compressed -mno-interlink-compressed @gol 1029-minterlink-mips16 -mno-interlink-mips16 @gol 1030-mabi=@var{abi} -mabicalls -mno-abicalls @gol 1031-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 1032-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol 1033-mno-float -msingle-float -mdouble-float @gol 1034-modd-spreg -mno-odd-spreg @gol 1035-mabs=@var{mode} -mnan=@var{encoding} @gol 1036-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 1037-mmcu -mmno-mcu @gol 1038-meva -mno-eva @gol 1039-mvirt -mno-virt @gol 1040-mxpa -mno-xpa @gol 1041-mcrc -mno-crc @gol 1042-mginv -mno-ginv @gol 1043-mmicromips -mno-micromips @gol 1044-mmsa -mno-msa @gol 1045-mloongson-mmi -mno-loongson-mmi @gol 1046-mloongson-ext -mno-loongson-ext @gol 1047-mloongson-ext2 -mno-loongson-ext2 @gol 1048-mfpu=@var{fpu-type} @gol 1049-msmartmips -mno-smartmips @gol 1050-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 1051-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 1052-mlong64 -mlong32 -msym32 -mno-sym32 @gol 1053-G@var{num} -mlocal-sdata -mno-local-sdata @gol 1054-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 1055-membedded-data -mno-embedded-data @gol 1056-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 1057-mcode-readable=@var{setting} @gol 1058-msplit-addresses -mno-split-addresses @gol 1059-mexplicit-relocs -mno-explicit-relocs @gol 1060-mcheck-zero-division -mno-check-zero-division @gol 1061-mdivide-traps -mdivide-breaks @gol 1062-mload-store-pairs -mno-load-store-pairs @gol 1063-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 1064-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol 1065-mfix-24k -mno-fix-24k @gol 1066-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 1067-mfix-r5900 -mno-fix-r5900 @gol 1068-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol 1069-mfix-vr4120 -mno-fix-vr4120 @gol 1070-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 1071-mflush-func=@var{func} -mno-flush-func @gol 1072-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 1073-mcompact-branches=@var{policy} @gol 1074-mfp-exceptions -mno-fp-exceptions @gol 1075-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 1076-mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol 1077-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol 1078-mframe-header-opt -mno-frame-header-opt} 1079 1080@emph{MMIX Options} 1081@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 1082-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 1083-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 1084-mno-base-addresses -msingle-exit -mno-single-exit} 1085 1086@emph{MN10300 Options} 1087@gccoptlist{-mmult-bug -mno-mult-bug @gol 1088-mno-am33 -mam33 -mam33-2 -mam34 @gol 1089-mtune=@var{cpu-type} @gol 1090-mreturn-pointer-on-d0 @gol 1091-mno-crt0 -mrelax -mliw -msetlb} 1092 1093@emph{Moxie Options} 1094@gccoptlist{-meb -mel -mmul.x -mno-crt0} 1095 1096@emph{MSP430 Options} 1097@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol 1098-mwarn-mcu @gol 1099-mcode-region= -mdata-region= @gol 1100-msilicon-errata= -msilicon-errata-warn= @gol 1101-mhwmult= -minrt -mtiny-printf -mmax-inline-shift=} 1102 1103@emph{NDS32 Options} 1104@gccoptlist{-mbig-endian -mlittle-endian @gol 1105-mreduced-regs -mfull-regs @gol 1106-mcmov -mno-cmov @gol 1107-mext-perf -mno-ext-perf @gol 1108-mext-perf2 -mno-ext-perf2 @gol 1109-mext-string -mno-ext-string @gol 1110-mv3push -mno-v3push @gol 1111-m16bit -mno-16bit @gol 1112-misr-vector-size=@var{num} @gol 1113-mcache-block-size=@var{num} @gol 1114-march=@var{arch} @gol 1115-mcmodel=@var{code-model} @gol 1116-mctor-dtor -mrelax} 1117 1118@emph{Nios II Options} 1119@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol 1120-mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol 1121-mel -meb @gol 1122-mno-bypass-cache -mbypass-cache @gol 1123-mno-cache-volatile -mcache-volatile @gol 1124-mno-fast-sw-div -mfast-sw-div @gol 1125-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol 1126-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol 1127-mcustom-fpu-cfg=@var{name} @gol 1128-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol 1129-march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx} 1130 1131@emph{Nvidia PTX Options} 1132@gccoptlist{-m64 -mmainkernel -moptimize} 1133 1134@emph{OpenRISC Options} 1135@gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol 1136-msoft-mul -msoft-div @gol 1137-msoft-float -mhard-float -mdouble-float -munordered-float @gol 1138-mcmov -mror -mrori -msext -msfimm -mshftimm} 1139 1140@emph{PDP-11 Options} 1141@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 1142-mint32 -mno-int16 -mint16 -mno-int32 @gol 1143-msplit -munix-asm -mdec-asm -mgnu-asm -mlra} 1144 1145@emph{picoChip Options} 1146@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 1147-msymbol-as-address -mno-inefficient-warnings} 1148 1149@emph{PowerPC Options} 1150See RS/6000 and PowerPC Options. 1151 1152@emph{PRU Options} 1153@gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol 1154-mabi=@var{variant} @gol} 1155 1156@emph{RISC-V Options} 1157@gccoptlist{-mbranch-cost=@var{N-instruction} @gol 1158-mplt -mno-plt @gol 1159-mabi=@var{ABI-string} @gol 1160-mfdiv -mno-fdiv @gol 1161-mdiv -mno-div @gol 1162-march=@var{ISA-string} @gol 1163-mtune=@var{processor-string} @gol 1164-mpreferred-stack-boundary=@var{num} @gol 1165-msmall-data-limit=@var{N-bytes} @gol 1166-msave-restore -mno-save-restore @gol 1167-mshorten-memrefs -mno-shorten-memrefs @gol 1168-mstrict-align -mno-strict-align @gol 1169-mcmodel=medlow -mcmodel=medany @gol 1170-mexplicit-relocs -mno-explicit-relocs @gol 1171-mrelax -mno-relax @gol 1172-mriscv-attribute -mmo-riscv-attribute @gol 1173-malign-data=@var{type} @gol 1174-mbig-endian -mlittle-endian @gol 1175+-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1176+-mstack-protector-guard-offset=@var{offset}} 1177 1178@emph{RL78 Options} 1179@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol 1180-mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol 1181-m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts} 1182 1183@emph{RS/6000 and PowerPC Options} 1184@gccoptlist{-mcpu=@var{cpu-type} @gol 1185-mtune=@var{cpu-type} @gol 1186-mcmodel=@var{code-model} @gol 1187-mpowerpc64 @gol 1188-maltivec -mno-altivec @gol 1189-mpowerpc-gpopt -mno-powerpc-gpopt @gol 1190-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 1191-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 1192-mfprnd -mno-fprnd @gol 1193-mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol 1194-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 1195-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 1196-malign-power -malign-natural @gol 1197-msoft-float -mhard-float -mmultiple -mno-multiple @gol 1198-mupdate -mno-update @gol 1199-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 1200-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 1201-mstrict-align -mno-strict-align -mrelocatable @gol 1202-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 1203-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 1204-mdynamic-no-pic -mswdiv -msingle-pic-base @gol 1205-mprioritize-restricted-insns=@var{priority} @gol 1206-msched-costly-dep=@var{dependence_type} @gol 1207-minsert-sched-nops=@var{scheme} @gol 1208-mcall-aixdesc -mcall-eabi -mcall-freebsd @gol 1209-mcall-linux -mcall-netbsd -mcall-openbsd @gol 1210-mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol 1211-mtraceback=@var{traceback_type} @gol 1212-maix-struct-return -msvr4-struct-return @gol 1213-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 1214-mlongcall -mno-longcall -mpltseq -mno-pltseq @gol 1215-mblock-move-inline-limit=@var{num} @gol 1216-mblock-compare-inline-limit=@var{num} @gol 1217-mblock-compare-inline-loop-limit=@var{num} @gol 1218-mno-block-ops-unaligned-vsx @gol 1219-mstring-compare-inline-limit=@var{num} @gol 1220-misel -mno-isel @gol 1221-mvrsave -mno-vrsave @gol 1222-mmulhw -mno-mulhw @gol 1223-mdlmzb -mno-dlmzb @gol 1224-mprototype -mno-prototype @gol 1225-msim -mmvme -mads -myellowknife -memb -msdata @gol 1226-msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol 1227-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 1228-mno-recip-precision @gol 1229-mveclibabi=@var{type} -mfriz -mno-friz @gol 1230-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 1231-msave-toc-indirect -mno-save-toc-indirect @gol 1232-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 1233-mcrypto -mno-crypto -mhtm -mno-htm @gol 1234-mquad-memory -mno-quad-memory @gol 1235-mquad-memory-atomic -mno-quad-memory-atomic @gol 1236-mcompat-align-parm -mno-compat-align-parm @gol 1237-mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol 1238-mgnu-attribute -mno-gnu-attribute @gol 1239-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1240-mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol 1241-mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol 1242-mprivileged -mno-privileged} 1243 1244@emph{RX Options} 1245@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 1246-mcpu=@gol 1247-mbig-endian-data -mlittle-endian-data @gol 1248-msmall-data @gol 1249-msim -mno-sim@gol 1250-mas100-syntax -mno-as100-syntax@gol 1251-mrelax@gol 1252-mmax-constant-size=@gol 1253-mint-register=@gol 1254-mpid@gol 1255-mallow-string-insns -mno-allow-string-insns@gol 1256-mjsr@gol 1257-mno-warn-multiple-fast-interrupts@gol 1258-msave-acc-in-interrupts} 1259 1260@emph{S/390 and zSeries Options} 1261@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1262-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 1263-mlong-double-64 -mlong-double-128 @gol 1264-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 1265-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 1266-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 1267-mhtm -mvx -mzvector @gol 1268-mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol 1269-mfused-madd -mno-fused-madd @gol 1270-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 1271-mhotpatch=@var{halfwords},@var{halfwords}} 1272 1273@emph{Score Options} 1274@gccoptlist{-meb -mel @gol 1275-mnhwloop @gol 1276-muls @gol 1277-mmac @gol 1278-mscore5 -mscore5u -mscore7 -mscore7d} 1279 1280@emph{SH Options} 1281@gccoptlist{-m1 -m2 -m2e @gol 1282-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 1283-m3 -m3e @gol 1284-m4-nofpu -m4-single-only -m4-single -m4 @gol 1285-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 1286-mb -ml -mdalign -mrelax @gol 1287-mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol 1288-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 1289-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 1290-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 1291-maccumulate-outgoing-args @gol 1292-matomic-model=@var{atomic-model} @gol 1293-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol 1294-mcbranch-force-delay-slot @gol 1295-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 1296-mpretend-cmove -mtas} 1297 1298@emph{Solaris 2 Options} 1299@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol 1300-pthreads} 1301 1302@emph{SPARC Options} 1303@gccoptlist{-mcpu=@var{cpu-type} @gol 1304-mtune=@var{cpu-type} @gol 1305-mcmodel=@var{code-model} @gol 1306-mmemory-model=@var{mem-model} @gol 1307-m32 -m64 -mapp-regs -mno-app-regs @gol 1308-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 1309-mfpu -mno-fpu -mhard-float -msoft-float @gol 1310-mhard-quad-float -msoft-quad-float @gol 1311-mstack-bias -mno-stack-bias @gol 1312-mstd-struct-return -mno-std-struct-return @gol 1313-munaligned-doubles -mno-unaligned-doubles @gol 1314-muser-mode -mno-user-mode @gol 1315-mv8plus -mno-v8plus -mvis -mno-vis @gol 1316-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 1317-mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol 1318-mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol 1319-mpopc -mno-popc -msubxc -mno-subxc @gol 1320-mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol 1321-mlra -mno-lra} 1322 1323@emph{System V Options} 1324@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 1325 1326@emph{TILE-Gx Options} 1327@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol 1328-mcmodel=@var{code-model}} 1329 1330@emph{TILEPro Options} 1331@gccoptlist{-mcpu=@var{cpu} -m32} 1332 1333@emph{V850 Options} 1334@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 1335-mprolog-function -mno-prolog-function -mspace @gol 1336-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 1337-mapp-regs -mno-app-regs @gol 1338-mdisable-callt -mno-disable-callt @gol 1339-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 1340-mv850e -mv850 -mv850e3v5 @gol 1341-mloop @gol 1342-mrelax @gol 1343-mlong-jumps @gol 1344-msoft-float @gol 1345-mhard-float @gol 1346-mgcc-abi @gol 1347-mrh850-abi @gol 1348-mbig-switch} 1349 1350@emph{VAX Options} 1351@gccoptlist{-mg -mgnu -munix} 1352 1353@emph{Visium Options} 1354@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol 1355-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} 1356 1357@emph{VMS Options} 1358@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 1359-mpointer-size=@var{size}} 1360 1361@emph{VxWorks Options} 1362@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 1363-Xbind-lazy -Xbind-now} 1364 1365@emph{x86 Options} 1366@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1367-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol 1368-mfpmath=@var{unit} @gol 1369-masm=@var{dialect} -mno-fancy-math-387 @gol 1370-mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol 1371-mno-wide-multiply -mrtd -malign-double @gol 1372-mpreferred-stack-boundary=@var{num} @gol 1373-mincoming-stack-boundary=@var{num} @gol 1374-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol 1375-mrecip -mrecip=@var{opt} @gol 1376-mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol 1377-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 1378-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol 1379-mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol 1380-mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol 1381-mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol 1382-msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol 1383-madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol 1384-mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol 1385-mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol 1386-mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol 1387-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol 1388-mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol 1389-mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol 1390-mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol 1391-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 1392-mkl -mwidekl @gol 1393-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol 1394-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 1395-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol 1396-mregparm=@var{num} -msseregparm @gol 1397-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 1398-mpc32 -mpc64 -mpc80 -mstackrealign @gol 1399-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 1400-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 1401-m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol 1402-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol 1403-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol 1404-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol 1405-malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol 1406-mstack-protector-guard-reg=@var{reg} @gol 1407-mstack-protector-guard-offset=@var{offset} @gol 1408-mstack-protector-guard-symbol=@var{symbol} @gol 1409-mgeneral-regs-only -mcall-ms2sysv-xlogues @gol 1410-mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol 1411-mindirect-branch-register -mneeded} 1412 1413@emph{x86 Windows Options} 1414@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 1415-mnop-fun-dllimport -mthread @gol 1416-municode -mwin32 -mwindows -fno-set-stack-executable} 1417 1418@emph{Xstormy16 Options} 1419@gccoptlist{-msim} 1420 1421@emph{Xtensa Options} 1422@gccoptlist{-mconst16 -mno-const16 @gol 1423-mfused-madd -mno-fused-madd @gol 1424-mforce-no-pic @gol 1425-mserialize-volatile -mno-serialize-volatile @gol 1426-mtext-section-literals -mno-text-section-literals @gol 1427-mauto-litpools -mno-auto-litpools @gol 1428-mtarget-align -mno-target-align @gol 1429-mlongcalls -mno-longcalls @gol 1430-mabi=@var{abi-type}} 1431 1432@emph{zSeries Options} 1433See S/390 and zSeries Options. 1434@end table 1435 1436 1437@node Overall Options 1438@section Options Controlling the Kind of Output 1439 1440Compilation can involve up to four stages: preprocessing, compilation 1441proper, assembly and linking, always in that order. GCC is capable of 1442preprocessing and compiling several files either into several 1443assembler input files, or into one assembler input file; then each 1444assembler input file produces an object file, and linking combines all 1445the object files (those newly compiled, and those specified as input) 1446into an executable file. 1447 1448@cindex file name suffix 1449For any given input file, the file name suffix determines what kind of 1450compilation is done: 1451 1452@table @gcctabopt 1453@item @var{file}.c 1454C source code that must be preprocessed. 1455 1456@item @var{file}.i 1457C source code that should not be preprocessed. 1458 1459@item @var{file}.ii 1460C++ source code that should not be preprocessed. 1461 1462@item @var{file}.m 1463Objective-C source code. Note that you must link with the @file{libobjc} 1464library to make an Objective-C program work. 1465 1466@item @var{file}.mi 1467Objective-C source code that should not be preprocessed. 1468 1469@item @var{file}.mm 1470@itemx @var{file}.M 1471Objective-C++ source code. Note that you must link with the @file{libobjc} 1472library to make an Objective-C++ program work. Note that @samp{.M} refers 1473to a literal capital M@. 1474 1475@item @var{file}.mii 1476Objective-C++ source code that should not be preprocessed. 1477 1478@item @var{file}.h 1479C, C++, Objective-C or Objective-C++ header file to be turned into a 1480precompiled header (default), or C, C++ header file to be turned into an 1481Ada spec (via the @option{-fdump-ada-spec} switch). 1482 1483@item @var{file}.cc 1484@itemx @var{file}.cp 1485@itemx @var{file}.cxx 1486@itemx @var{file}.cpp 1487@itemx @var{file}.CPP 1488@itemx @var{file}.c++ 1489@itemx @var{file}.C 1490C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1491the last two letters must both be literally @samp{x}. Likewise, 1492@samp{.C} refers to a literal capital C@. 1493 1494@item @var{file}.mm 1495@itemx @var{file}.M 1496Objective-C++ source code that must be preprocessed. 1497 1498@item @var{file}.mii 1499Objective-C++ source code that should not be preprocessed. 1500 1501@item @var{file}.hh 1502@itemx @var{file}.H 1503@itemx @var{file}.hp 1504@itemx @var{file}.hxx 1505@itemx @var{file}.hpp 1506@itemx @var{file}.HPP 1507@itemx @var{file}.h++ 1508@itemx @var{file}.tcc 1509C++ header file to be turned into a precompiled header or Ada spec. 1510 1511@item @var{file}.f 1512@itemx @var{file}.for 1513@itemx @var{file}.ftn 1514Fixed form Fortran source code that should not be preprocessed. 1515 1516@item @var{file}.F 1517@itemx @var{file}.FOR 1518@itemx @var{file}.fpp 1519@itemx @var{file}.FPP 1520@itemx @var{file}.FTN 1521Fixed form Fortran source code that must be preprocessed (with the traditional 1522preprocessor). 1523 1524@item @var{file}.f90 1525@itemx @var{file}.f95 1526@itemx @var{file}.f03 1527@itemx @var{file}.f08 1528Free form Fortran source code that should not be preprocessed. 1529 1530@item @var{file}.F90 1531@itemx @var{file}.F95 1532@itemx @var{file}.F03 1533@itemx @var{file}.F08 1534Free form Fortran source code that must be preprocessed (with the 1535traditional preprocessor). 1536 1537@item @var{file}.go 1538Go source code. 1539 1540@item @var{file}.brig 1541BRIG files (binary representation of HSAIL). 1542 1543@item @var{file}.d 1544D source code. 1545 1546@item @var{file}.di 1547D interface file. 1548 1549@item @var{file}.dd 1550D documentation code (Ddoc). 1551 1552@item @var{file}.ads 1553Ada source code file that contains a library unit declaration (a 1554declaration of a package, subprogram, or generic, or a generic 1555instantiation), or a library unit renaming declaration (a package, 1556generic, or subprogram renaming declaration). Such files are also 1557called @dfn{specs}. 1558 1559@item @var{file}.adb 1560Ada source code file containing a library unit body (a subprogram or 1561package body). Such files are also called @dfn{bodies}. 1562 1563@c GCC also knows about some suffixes for languages not yet included: 1564@c Ratfor: 1565@c @var{file}.r 1566 1567@item @var{file}.s 1568Assembler code. 1569 1570@item @var{file}.S 1571@itemx @var{file}.sx 1572Assembler code that must be preprocessed. 1573 1574@item @var{other} 1575An object file to be fed straight into linking. 1576Any file name with no recognized suffix is treated this way. 1577@end table 1578 1579@opindex x 1580You can specify the input language explicitly with the @option{-x} option: 1581 1582@table @gcctabopt 1583@item -x @var{language} 1584Specify explicitly the @var{language} for the following input files 1585(rather than letting the compiler choose a default based on the file 1586name suffix). This option applies to all following input files until 1587the next @option{-x} option. Possible values for @var{language} are: 1588@smallexample 1589c c-header cpp-output 1590c++ c++-header c++-system-header c++-user-header c++-cpp-output 1591objective-c objective-c-header objective-c-cpp-output 1592objective-c++ objective-c++-header objective-c++-cpp-output 1593assembler assembler-with-cpp 1594ada 1595d 1596f77 f77-cpp-input f95 f95-cpp-input 1597go 1598brig 1599@end smallexample 1600 1601@item -x none 1602Turn off any specification of a language, so that subsequent files are 1603handled according to their file name suffixes (as they are if @option{-x} 1604has not been used at all). 1605@end table 1606 1607If you only want some of the stages of compilation, you can use 1608@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1609one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1610@command{gcc} is to stop. Note that some combinations (for example, 1611@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1612 1613@table @gcctabopt 1614@item -c 1615@opindex c 1616Compile or assemble the source files, but do not link. The linking 1617stage simply is not done. The ultimate output is in the form of an 1618object file for each source file. 1619 1620By default, the object file name for a source file is made by replacing 1621the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1622 1623Unrecognized input files, not requiring compilation or assembly, are 1624ignored. 1625 1626@item -S 1627@opindex S 1628Stop after the stage of compilation proper; do not assemble. The output 1629is in the form of an assembler code file for each non-assembler input 1630file specified. 1631 1632By default, the assembler file name for a source file is made by 1633replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1634 1635Input files that don't require compilation are ignored. 1636 1637@item -E 1638@opindex E 1639Stop after the preprocessing stage; do not run the compiler proper. The 1640output is in the form of preprocessed source code, which is sent to the 1641standard output. 1642 1643Input files that don't require preprocessing are ignored. 1644 1645@cindex output file option 1646@item -o @var{file} 1647@opindex o 1648Place the primary output in file @var{file}. This applies to whatever 1649sort of output is being produced, whether it be an executable file, an 1650object file, an assembler file or preprocessed C code. 1651 1652If @option{-o} is not specified, the default is to put an executable 1653file in @file{a.out}, the object file for 1654@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1655assembler file in @file{@var{source}.s}, a precompiled header file in 1656@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1657standard output. 1658 1659Though @option{-o} names only the primary output, it also affects the 1660naming of auxiliary and dump outputs. See the examples below. Unless 1661overridden, both auxiliary outputs and dump outputs are placed in the 1662same directory as the primary output. In auxiliary outputs, the suffix 1663of the input file is replaced with that of the auxiliary output file 1664type; in dump outputs, the suffix of the dump file is appended to the 1665input file suffix. In compilation commands, the base name of both 1666auxiliary and dump outputs is that of the primary output; in compile and 1667link commands, the primary output name, minus the executable suffix, is 1668combined with the input file name. If both share the same base name, 1669disregarding the suffix, the result of the combination is that base 1670name, otherwise, they are concatenated, separated by a dash. 1671 1672@smallexample 1673gcc -c foo.c ... 1674@end smallexample 1675 1676will use @file{foo.o} as the primary output, and place aux outputs and 1677dumps next to it, e.g., aux file @file{foo.dwo} for 1678@option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for 1679@option{-fdump-rtl-final}. 1680 1681If a non-linker output file is explicitly specified, aux and dump files 1682by default take the same base name: 1683 1684@smallexample 1685gcc -c foo.c -o dir/foobar.o ... 1686@end smallexample 1687 1688will name aux outputs @file{dir/foobar.*} and dump outputs 1689@file{dir/foobar.c.*}. 1690 1691A linker output will instead prefix aux and dump outputs: 1692 1693@smallexample 1694gcc foo.c bar.c -o dir/foobar ... 1695@end smallexample 1696 1697will generally name aux outputs @file{dir/foobar-foo.*} and 1698@file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and 1699@file{dir/foobar-bar.c.*}. 1700 1701The one exception to the above is when the executable shares the base 1702name with the single input: 1703 1704@smallexample 1705gcc foo.c -o dir/foo ... 1706@end smallexample 1707 1708in which case aux outputs are named @file{dir/foo.*} and dump outputs 1709named @file{dir/foo.c.*}. 1710 1711The location and the names of auxiliary and dump outputs can be adjusted 1712by the options @option{-dumpbase}, @option{-dumpbase-ext}, 1713@option{-dumpdir}, @option{-save-temps=cwd}, and 1714@option{-save-temps=obj}. 1715 1716 1717@item -dumpbase @var{dumpbase} 1718@opindex dumpbase 1719This option sets the base name for auxiliary and dump output files. It 1720does not affect the name of the primary output file. Intermediate 1721outputs, when preserved, are not regarded as primary outputs, but as 1722auxiliary outputs: 1723 1724@smallexample 1725gcc -save-temps -S foo.c 1726@end smallexample 1727 1728saves the (no longer) temporary preprocessed file in @file{foo.i}, and 1729then compiles to the (implied) output file @file{foo.s}, whereas: 1730 1731@smallexample 1732gcc -save-temps -dumpbase save-foo -c foo.c 1733@end smallexample 1734 1735preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now 1736an intermediate, thus auxiliary output), and then assembles to the 1737(implied) output file @file{foo.o}. 1738 1739Absent this option, dump and aux files take their names from the input 1740file, or from the (non-linker) output file, if one is explicitly 1741specified: dump output files (e.g. those requested by @option{-fdump-*} 1742options) with the input name suffix, and aux output files (those 1743requested by other non-dump options, e.g. @code{-save-temps}, 1744@code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it. 1745 1746Similar suffix differentiation of dump and aux outputs can be attained 1747for explicitly-given @option{-dumpbase basename.suf} by also specifying 1748@option{-dumpbase-ext .suf}. 1749 1750If @var{dumpbase} is explicitly specified with any directory component, 1751any @var{dumppfx} specification (e.g. @option{-dumpdir} or 1752@option{-save-temps=*}) is ignored, and instead of appending to it, 1753@var{dumpbase} fully overrides it: 1754 1755@smallexample 1756gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \ 1757 -dumpdir pfx- -save-temps=cwd ... 1758@end smallexample 1759 1760creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding 1761@file{dir/} in @option{-o}, the @file{./} prefix implied by 1762@option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}. 1763 1764When @option{-dumpbase} is specified in a command that compiles multiple 1765inputs, or that compiles and then links, it may be combined with 1766@var{dumppfx}, as specified under @option{-dumpdir}. Then, each input 1767file is compiled using the combined @var{dumppfx}, and default values 1768for @var{dumpbase} and @var{auxdropsuf} are computed for each input 1769file: 1770 1771@smallexample 1772gcc foo.c bar.c -c -dumpbase main ... 1773@end smallexample 1774 1775creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids 1776overwriting the auxiliary and dump outputs by using the @var{dumpbase} 1777as a prefix, creating auxiliary and dump outputs named @file{main-foo.*} 1778and @file{main-bar.*}. 1779 1780An empty string specified as @var{dumpbase} avoids the influence of the 1781output basename in the naming of auxiliary and dump outputs during 1782compilation, computing default values : 1783 1784@smallexample 1785gcc -c foo.c -o dir/foobar.o -dumpbase '' ... 1786@end smallexample 1787 1788will name aux outputs @file{dir/foo.*} and dump outputs 1789@file{dir/foo.c.*}. Note how their basenames are taken from the input 1790name, but the directory still defaults to that of the output. 1791 1792The empty-string dumpbase does not prevent the use of the output 1793basename for outputs during linking: 1794 1795@smallexample 1796gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ... 1797@end smallexample 1798 1799The compilation of the source files will name auxiliary outputs 1800@file{dir/foo.*} and @file{dir/bar.*}, and dump outputs 1801@file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during 1802linking will use @file{dir/foobar.} as the prefix for dumps and 1803auxiliary files. 1804 1805 1806@item -dumpbase-ext @var{auxdropsuf} 1807@opindex dumpbase-ext 1808When forming the name of an auxiliary (but not a dump) output file, drop 1809trailing @var{auxdropsuf} from @var{dumpbase} before appending any 1810suffixes. If not specified, this option defaults to the suffix of a 1811default @var{dumpbase}, i.e., the suffix of the input file when 1812@option{-dumpbase} is not present in the command line, or @var{dumpbase} 1813is combined with @var{dumppfx}. 1814 1815@smallexample 1816gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ... 1817@end smallexample 1818 1819creates @file{dir/foo.o} as the main output, and generates auxiliary 1820outputs in @file{dir/x-foo.*}, taking the location of the primary 1821output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump 1822outputs retain the suffix: @file{dir/x-foo.c.*}. 1823 1824This option is disregarded if it does not match the suffix of a 1825specified @var{dumpbase}, except as an alternative to the executable 1826suffix when appending the linker output base name to @var{dumppfx}, as 1827specified below: 1828 1829@smallexample 1830gcc foo.c bar.c -o main.out -dumpbase-ext .out ... 1831@end smallexample 1832 1833creates @file{main.out} as the primary output, and avoids overwriting 1834the auxiliary and dump outputs by using the executable name minus 1835@var{auxdropsuf} as a prefix, creating auxiliary outputs named 1836@file{main-foo.*} and @file{main-bar.*} and dump outputs named 1837@file{main-foo.c.*} and @file{main-bar.c.*}. 1838 1839 1840@item -dumpdir @var{dumppfx} 1841@opindex dumpdir 1842When forming the name of an auxiliary or dump output file, use 1843@var{dumppfx} as a prefix: 1844 1845@smallexample 1846gcc -dumpdir pfx- -c foo.c ... 1847@end smallexample 1848 1849creates @file{foo.o} as the primary output, and auxiliary outputs named 1850@file{pfx-foo.*}, combining the given @var{dumppfx} with the default 1851@var{dumpbase} derived from the default primary output, derived in turn 1852from the input name. Dump outputs also take the input name suffix: 1853@file{pfx-foo.c.*}. 1854 1855If @var{dumppfx} is to be used as a directory name, it must end with a 1856directory separator: 1857 1858@smallexample 1859gcc -dumpdir dir/ -c foo.c -o obj/bar.o ... 1860@end smallexample 1861 1862creates @file{obj/bar.o} as the primary output, and auxiliary outputs 1863named @file{dir/bar.*}, combining the given @var{dumppfx} with the 1864default @var{dumpbase} derived from the primary output name. Dump 1865outputs also take the input name suffix: @file{dir/bar.c.*}. 1866 1867It defaults to the location of the output file; options 1868@option{-save-temps=cwd} and @option{-save-temps=obj} override this 1869default, just like an explicit @option{-dumpdir} option. In case 1870multiple such options are given, the last one prevails: 1871 1872@smallexample 1873gcc -dumpdir pfx- -c foo.c -save-temps=obj ... 1874@end smallexample 1875 1876outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because 1877@option{-save-temps=*} overrides the @var{dumppfx} given by the earlier 1878@option{-dumpdir} option. It does not matter that @option{=obj} is the 1879default for @option{-save-temps}, nor that the output directory is 1880implicitly the current directory. Dump outputs are named 1881@file{foo.c.*}. 1882 1883When compiling from multiple input files, if @option{-dumpbase} is 1884specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash 1885are appended to (or override, if containing any directory components) an 1886explicit or defaulted @var{dumppfx}, so that each of the multiple 1887compilations gets differently-named aux and dump outputs. 1888 1889@smallexample 1890gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ... 1891@end smallexample 1892 1893outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and 1894@file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}. 1895Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*} 1896and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the 1897single-input compilation: 1898 1899@smallexample 1900gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ... 1901@end smallexample 1902 1903that, applying @option{-dumpbase} to a single source, does not compute 1904and append a separate @var{dumpbase} per input file. Its auxiliary and 1905dump outputs go in @file{dir/pfx-main.*}. 1906 1907When compiling and then linking from multiple input files, a defaulted 1908or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}- 1909transformation above (e.g. the compilation of @file{foo.c} and 1910@file{bar.c} above, but without @option{-c}). If neither 1911@option{-dumpdir} nor @option{-dumpbase} are given, the linker output 1912base name, minus @var{auxdropsuf}, if specified, or the executable 1913suffix otherwise, plus a dash is appended to the default @var{dumppfx} 1914instead. Note, however, that unlike earlier cases of linking: 1915 1916@smallexample 1917gcc foo.c bar.c -dumpdir dir/pfx- -o main ... 1918@end smallexample 1919 1920does not append the output name @file{main} to @var{dumppfx}, because 1921@option{-dumpdir} is explicitly specified. The goal is that the 1922explicitly-specified @var{dumppfx} may contain the specified output name 1923as part of the prefix, if desired; only an explicitly-specified 1924@option{-dumpbase} would be combined with it, in order to avoid simply 1925discarding a meaningful option. 1926 1927When compiling and then linking from a single input file, the linker 1928output base name will only be appended to the default @var{dumppfx} as 1929above if it does not share the base name with the single input file 1930name. This has been covered in single-input linking cases above, but 1931not with an explicit @option{-dumpdir} that inhibits the combination, 1932even if overridden by @option{-save-temps=*}: 1933 1934@smallexample 1935gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ... 1936@end smallexample 1937 1938Auxiliary outputs are named @file{foo.*}, and dump outputs 1939@file{foo.c.*}, in the current working directory as ultimately requested 1940by @option{-save-temps=cwd}. 1941 1942Summing it all up for an intuitive though slightly imprecise data flow: 1943the primary output name is broken into a directory part and a basename 1944part; @var{dumppfx} is set to the former, unless overridden by 1945@option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set 1946to the latter, unless overriden by @option{-dumpbase}. If there are 1947multiple inputs or linking, this @var{dumpbase} may be combined with 1948@var{dumppfx} and taken from each input file. Auxiliary output names 1949for each input are formed by combining @var{dumppfx}, @var{dumpbase} 1950minus suffix, and the auxiliary output suffix; dump output names are 1951only different in that the suffix from @var{dumpbase} is retained. 1952 1953When it comes to auxiliary and dump outputs created during LTO 1954recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as 1955given or as derived from the linker output name but not from inputs, 1956even in cases in which this combination would not otherwise be used as 1957such, is passed down with a trailing period replacing the compiler-added 1958dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper}; 1959being involved in linking, this program does not normally get any 1960@option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them. 1961 1962When running sub-compilers, @command{lto-wrapper} appends LTO stage 1963names to the received @var{dumppfx}, ensures it contains a directory 1964component so that it overrides any @option{-dumpdir}, and passes that as 1965@option{-dumpbase} to sub-compilers. 1966 1967@item -v 1968@opindex v 1969Print (on standard error output) the commands executed to run the stages 1970of compilation. Also print the version number of the compiler driver 1971program and of the preprocessor and the compiler proper. 1972 1973@item -### 1974@opindex ### 1975Like @option{-v} except the commands are not executed and arguments 1976are quoted unless they contain only alphanumeric characters or @code{./-_}. 1977This is useful for shell scripts to capture the driver-generated command lines. 1978 1979@item --help 1980@opindex help 1981Print (on the standard output) a description of the command-line options 1982understood by @command{gcc}. If the @option{-v} option is also specified 1983then @option{--help} is also passed on to the various processes 1984invoked by @command{gcc}, so that they can display the command-line options 1985they accept. If the @option{-Wextra} option has also been specified 1986(prior to the @option{--help} option), then command-line options that 1987have no documentation associated with them are also displayed. 1988 1989@item --target-help 1990@opindex target-help 1991Print (on the standard output) a description of target-specific command-line 1992options for each tool. For some targets extra target-specific 1993information may also be printed. 1994 1995@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 1996Print (on the standard output) a description of the command-line 1997options understood by the compiler that fit into all specified classes 1998and qualifiers. These are the supported classes: 1999 2000@table @asis 2001@item @samp{optimizers} 2002Display all of the optimization options supported by the 2003compiler. 2004 2005@item @samp{warnings} 2006Display all of the options controlling warning messages 2007produced by the compiler. 2008 2009@item @samp{target} 2010Display target-specific options. Unlike the 2011@option{--target-help} option however, target-specific options of the 2012linker and assembler are not displayed. This is because those 2013tools do not currently support the extended @option{--help=} syntax. 2014 2015@item @samp{params} 2016Display the values recognized by the @option{--param} 2017option. 2018 2019@item @var{language} 2020Display the options supported for @var{language}, where 2021@var{language} is the name of one of the languages supported in this 2022version of GCC@. If an option is supported by all languages, one needs 2023to select @samp{common} class. 2024 2025@item @samp{common} 2026Display the options that are common to all languages. 2027@end table 2028 2029These are the supported qualifiers: 2030 2031@table @asis 2032@item @samp{undocumented} 2033Display only those options that are undocumented. 2034 2035@item @samp{joined} 2036Display options taking an argument that appears after an equal 2037sign in the same continuous piece of text, such as: 2038@samp{--help=target}. 2039 2040@item @samp{separate} 2041Display options taking an argument that appears as a separate word 2042following the original option, such as: @samp{-o output-file}. 2043@end table 2044 2045Thus for example to display all the undocumented target-specific 2046switches supported by the compiler, use: 2047 2048@smallexample 2049--help=target,undocumented 2050@end smallexample 2051 2052The sense of a qualifier can be inverted by prefixing it with the 2053@samp{^} character, so for example to display all binary warning 2054options (i.e., ones that are either on or off and that do not take an 2055argument) that have a description, use: 2056 2057@smallexample 2058--help=warnings,^joined,^undocumented 2059@end smallexample 2060 2061The argument to @option{--help=} should not consist solely of inverted 2062qualifiers. 2063 2064Combining several classes is possible, although this usually 2065restricts the output so much that there is nothing to display. One 2066case where it does work, however, is when one of the classes is 2067@var{target}. For example, to display all the target-specific 2068optimization options, use: 2069 2070@smallexample 2071--help=target,optimizers 2072@end smallexample 2073 2074The @option{--help=} option can be repeated on the command line. Each 2075successive use displays its requested class of options, skipping 2076those that have already been displayed. If @option{--help} is also 2077specified anywhere on the command line then this takes precedence 2078over any @option{--help=} option. 2079 2080If the @option{-Q} option appears on the command line before the 2081@option{--help=} option, then the descriptive text displayed by 2082@option{--help=} is changed. Instead of describing the displayed 2083options, an indication is given as to whether the option is enabled, 2084disabled or set to a specific value (assuming that the compiler 2085knows this at the point where the @option{--help=} option is used). 2086 2087Here is a truncated example from the ARM port of @command{gcc}: 2088 2089@smallexample 2090 % gcc -Q -mabi=2 --help=target -c 2091 The following options are target specific: 2092 -mabi= 2 2093 -mabort-on-noreturn [disabled] 2094 -mapcs [disabled] 2095@end smallexample 2096 2097The output is sensitive to the effects of previous command-line 2098options, so for example it is possible to find out which optimizations 2099are enabled at @option{-O2} by using: 2100 2101@smallexample 2102-Q -O2 --help=optimizers 2103@end smallexample 2104 2105Alternatively you can discover which binary optimizations are enabled 2106by @option{-O3} by using: 2107 2108@smallexample 2109gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 2110gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 2111diff /tmp/O2-opts /tmp/O3-opts | grep enabled 2112@end smallexample 2113 2114@item --version 2115@opindex version 2116Display the version number and copyrights of the invoked GCC@. 2117 2118@item -pass-exit-codes 2119@opindex pass-exit-codes 2120Normally the @command{gcc} program exits with the code of 1 if any 2121phase of the compiler returns a non-success return code. If you specify 2122@option{-pass-exit-codes}, the @command{gcc} program instead returns with 2123the numerically highest error produced by any phase returning an error 2124indication. The C, C++, and Fortran front ends return 4 if an internal 2125compiler error is encountered. 2126 2127@item -pipe 2128@opindex pipe 2129Use pipes rather than temporary files for communication between the 2130various stages of compilation. This fails to work on some systems where 2131the assembler is unable to read from a pipe; but the GNU assembler has 2132no trouble. 2133 2134@item -specs=@var{file} 2135@opindex specs 2136Process @var{file} after the compiler reads in the standard @file{specs} 2137file, in order to override the defaults which the @command{gcc} driver 2138program uses when determining what switches to pass to @command{cc1}, 2139@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 2140@option{-specs=@var{file}} can be specified on the command line, and they 2141are processed in order, from left to right. @xref{Spec Files}, for 2142information about the format of the @var{file}. 2143 2144@item -wrapper 2145@opindex wrapper 2146Invoke all subcommands under a wrapper program. The name of the 2147wrapper program and its parameters are passed as a comma separated 2148list. 2149 2150@smallexample 2151gcc -c t.c -wrapper gdb,--args 2152@end smallexample 2153 2154@noindent 2155This invokes all subprograms of @command{gcc} under 2156@samp{gdb --args}, thus the invocation of @command{cc1} is 2157@samp{gdb --args cc1 @dots{}}. 2158 2159@item -ffile-prefix-map=@var{old}=@var{new} 2160@opindex ffile-prefix-map 2161When compiling files residing in directory @file{@var{old}}, record 2162any references to them in the result of the compilation as if the 2163files resided in directory @file{@var{new}} instead. Specifying this 2164option is equivalent to specifying all the individual 2165@option{-f*-prefix-map} options. This can be used to make reproducible 2166builds that are location independent. See also 2167@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}. 2168 2169@item -fplugin=@var{name}.so 2170@opindex fplugin 2171Load the plugin code in file @var{name}.so, assumed to be a 2172shared object to be dlopen'd by the compiler. The base name of 2173the shared object file is used to identify the plugin for the 2174purposes of argument parsing (See 2175@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 2176Each plugin should define the callback functions specified in the 2177Plugins API. 2178 2179@item -fplugin-arg-@var{name}-@var{key}=@var{value} 2180@opindex fplugin-arg 2181Define an argument called @var{key} with a value of @var{value} 2182for the plugin called @var{name}. 2183 2184@item -fdump-ada-spec@r{[}-slim@r{]} 2185@opindex fdump-ada-spec 2186For C and C++ source and include files, generate corresponding Ada specs. 2187@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 2188GNAT User's Guide}, which provides detailed documentation on this feature. 2189 2190@item -fada-spec-parent=@var{unit} 2191@opindex fada-spec-parent 2192In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 2193Ada specs as child units of parent @var{unit}. 2194 2195@item -fdump-go-spec=@var{file} 2196@opindex fdump-go-spec 2197For input files in any language, generate corresponding Go 2198declarations in @var{file}. This generates Go @code{const}, 2199@code{type}, @code{var}, and @code{func} declarations which may be a 2200useful way to start writing a Go interface to code written in some 2201other language. 2202 2203@include @value{srcdir}/../libiberty/at-file.texi 2204@end table 2205 2206@node Invoking G++ 2207@section Compiling C++ Programs 2208 2209@cindex suffixes for C++ source 2210@cindex C++ source file suffixes 2211C++ source files conventionally use one of the suffixes @samp{.C}, 2212@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 2213@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 2214@samp{.H}, or (for shared template code) @samp{.tcc}; and 2215preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 2216files with these names and compiles them as C++ programs even if you 2217call the compiler the same way as for compiling C programs (usually 2218with the name @command{gcc}). 2219 2220@findex g++ 2221@findex c++ 2222However, the use of @command{gcc} does not add the C++ library. 2223@command{g++} is a program that calls GCC and automatically specifies linking 2224against the C++ library. It treats @samp{.c}, 2225@samp{.h} and @samp{.i} files as C++ source files instead of C source 2226files unless @option{-x} is used. This program is also useful when 2227precompiling a C header file with a @samp{.h} extension for use in C++ 2228compilations. On many systems, @command{g++} is also installed with 2229the name @command{c++}. 2230 2231@cindex invoking @command{g++} 2232When you compile C++ programs, you may specify many of the same 2233command-line options that you use for compiling programs in any 2234language; or command-line options meaningful for C and related 2235languages; or options that are meaningful only for C++ programs. 2236@xref{C Dialect Options,,Options Controlling C Dialect}, for 2237explanations of options for languages related to C@. 2238@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 2239explanations of options that are meaningful only for C++ programs. 2240 2241@node C Dialect Options 2242@section Options Controlling C Dialect 2243@cindex dialect options 2244@cindex language dialect options 2245@cindex options, dialect 2246 2247The following options control the dialect of C (or languages derived 2248from C, such as C++, Objective-C and Objective-C++) that the compiler 2249accepts: 2250 2251@table @gcctabopt 2252@cindex ANSI support 2253@cindex ISO support 2254@item -ansi 2255@opindex ansi 2256In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 2257equivalent to @option{-std=c++98}. 2258 2259This turns off certain features of GCC that are incompatible with ISO 2260C90 (when compiling C code), or of standard C++ (when compiling C++ code), 2261such as the @code{asm} and @code{typeof} keywords, and 2262predefined macros such as @code{unix} and @code{vax} that identify the 2263type of system you are using. It also enables the undesirable and 2264rarely used ISO trigraph feature. For the C compiler, 2265it disables recognition of C++ style @samp{//} comments as well as 2266the @code{inline} keyword. 2267 2268The alternate keywords @code{__asm__}, @code{__extension__}, 2269@code{__inline__} and @code{__typeof__} continue to work despite 2270@option{-ansi}. You would not want to use them in an ISO C program, of 2271course, but it is useful to put them in header files that might be included 2272in compilations done with @option{-ansi}. Alternate predefined macros 2273such as @code{__unix__} and @code{__vax__} are also available, with or 2274without @option{-ansi}. 2275 2276The @option{-ansi} option does not cause non-ISO programs to be 2277rejected gratuitously. For that, @option{-Wpedantic} is required in 2278addition to @option{-ansi}. @xref{Warning Options}. 2279 2280The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 2281option is used. Some header files may notice this macro and refrain 2282from declaring certain functions or defining certain macros that the 2283ISO standard doesn't call for; this is to avoid interfering with any 2284programs that might use these names for other things. 2285 2286Functions that are normally built in but do not have semantics 2287defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 2288functions when @option{-ansi} is used. @xref{Other Builtins,,Other 2289built-in functions provided by GCC}, for details of the functions 2290affected. 2291 2292@item -std= 2293@opindex std 2294Determine the language standard. @xref{Standards,,Language Standards 2295Supported by GCC}, for details of these standard versions. This option 2296is currently only supported when compiling C or C++. 2297 2298The compiler can accept several base standards, such as @samp{c90} or 2299@samp{c++98}, and GNU dialects of those standards, such as 2300@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 2301compiler accepts all programs following that standard plus those 2302using GNU extensions that do not contradict it. For example, 2303@option{-std=c90} turns off certain features of GCC that are 2304incompatible with ISO C90, such as the @code{asm} and @code{typeof} 2305keywords, but not other GNU extensions that do not have a meaning in 2306ISO C90, such as omitting the middle term of a @code{?:} 2307expression. On the other hand, when a GNU dialect of a standard is 2308specified, all features supported by the compiler are enabled, even when 2309those features change the meaning of the base standard. As a result, some 2310strict-conforming programs may be rejected. The particular standard 2311is used by @option{-Wpedantic} to identify which features are GNU 2312extensions given that version of the standard. For example 2313@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 2314comments, while @option{-std=gnu99 -Wpedantic} does not. 2315 2316A value for this option must be provided; possible values are 2317 2318@table @samp 2319@item c90 2320@itemx c89 2321@itemx iso9899:1990 2322Support all ISO C90 programs (certain GNU extensions that conflict 2323with ISO C90 are disabled). Same as @option{-ansi} for C code. 2324 2325@item iso9899:199409 2326ISO C90 as modified in amendment 1. 2327 2328@item c99 2329@itemx c9x 2330@itemx iso9899:1999 2331@itemx iso9899:199x 2332ISO C99. This standard is substantially completely supported, modulo 2333bugs and floating-point issues 2334(mainly but not entirely relating to optional C99 features from 2335Annexes F and G). See 2336@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The 2337names @samp{c9x} and @samp{iso9899:199x} are deprecated. 2338 2339@item c11 2340@itemx c1x 2341@itemx iso9899:2011 2342ISO C11, the 2011 revision of the ISO C standard. This standard is 2343substantially completely supported, modulo bugs, floating-point issues 2344(mainly but not entirely relating to optional C11 features from 2345Annexes F and G) and the optional Annexes K (Bounds-checking 2346interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. 2347 2348@item c17 2349@itemx c18 2350@itemx iso9899:2017 2351@itemx iso9899:2018 2352ISO C17, the 2017 revision of the ISO C standard 2353(published in 2018). This standard is 2354same as C11 except for corrections of defects (all of which are also 2355applied with @option{-std=c11}) and a new value of 2356@code{__STDC_VERSION__}, and so is supported to the same extent as C11. 2357 2358@item c2x 2359The next version of the ISO C standard, still under development. The 2360support for this version is experimental and incomplete. 2361 2362@item gnu90 2363@itemx gnu89 2364GNU dialect of ISO C90 (including some C99 features). 2365 2366@item gnu99 2367@itemx gnu9x 2368GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. 2369 2370@item gnu11 2371@itemx gnu1x 2372GNU dialect of ISO C11. 2373The name @samp{gnu1x} is deprecated. 2374 2375@item gnu17 2376@itemx gnu18 2377GNU dialect of ISO C17. This is the default for C code. 2378 2379@item gnu2x 2380The next version of the ISO C standard, still under development, plus 2381GNU extensions. The support for this version is experimental and 2382incomplete. 2383 2384@item c++98 2385@itemx c++03 2386The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 2387additional defect reports. Same as @option{-ansi} for C++ code. 2388 2389@item gnu++98 2390@itemx gnu++03 2391GNU dialect of @option{-std=c++98}. 2392 2393@item c++11 2394@itemx c++0x 2395The 2011 ISO C++ standard plus amendments. 2396The name @samp{c++0x} is deprecated. 2397 2398@item gnu++11 2399@itemx gnu++0x 2400GNU dialect of @option{-std=c++11}. 2401The name @samp{gnu++0x} is deprecated. 2402 2403@item c++14 2404@itemx c++1y 2405The 2014 ISO C++ standard plus amendments. 2406The name @samp{c++1y} is deprecated. 2407 2408@item gnu++14 2409@itemx gnu++1y 2410GNU dialect of @option{-std=c++14}. 2411The name @samp{gnu++1y} is deprecated. 2412 2413@item c++17 2414@itemx c++1z 2415The 2017 ISO C++ standard plus amendments. 2416The name @samp{c++1z} is deprecated. 2417 2418@item gnu++17 2419@itemx gnu++1z 2420GNU dialect of @option{-std=c++17}. 2421This is the default for C++ code. 2422The name @samp{gnu++1z} is deprecated. 2423 2424@item c++20 2425@itemx c++2a 2426The 2020 ISO C++ standard plus amendments. 2427Support is experimental, and could change in incompatible ways in 2428future releases. 2429The name @samp{c++2a} is deprecated. 2430 2431@item gnu++20 2432@itemx gnu++2a 2433GNU dialect of @option{-std=c++20}. 2434Support is experimental, and could change in incompatible ways in 2435future releases. 2436The name @samp{gnu++2a} is deprecated. 2437 2438@item c++2b 2439@itemx c++23 2440The next revision of the ISO C++ standard, planned for 24412023. Support is highly experimental, and will almost certainly 2442change in incompatible ways in future releases. 2443 2444@item gnu++2b 2445@itemx gnu++23 2446GNU dialect of @option{-std=c++2b}. Support is highly experimental, 2447and will almost certainly change in incompatible ways in future 2448releases. 2449@end table 2450 2451@item -fgnu89-inline 2452@opindex fgnu89-inline 2453The option @option{-fgnu89-inline} tells GCC to use the traditional 2454GNU semantics for @code{inline} functions when in C99 mode. 2455@xref{Inline,,An Inline Function is As Fast As a Macro}. 2456Using this option is roughly equivalent to adding the 2457@code{gnu_inline} function attribute to all inline functions 2458(@pxref{Function Attributes}). 2459 2460The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 2461C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 2462specifies the default behavior). 2463This option is not supported in @option{-std=c90} or 2464@option{-std=gnu90} mode. 2465 2466The preprocessor macros @code{__GNUC_GNU_INLINE__} and 2467@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 2468in effect for @code{inline} functions. @xref{Common Predefined 2469Macros,,,cpp,The C Preprocessor}. 2470 2471@item -fpermitted-flt-eval-methods=@var{style} 2472@opindex fpermitted-flt-eval-methods 2473@opindex fpermitted-flt-eval-methods=c11 2474@opindex fpermitted-flt-eval-methods=ts-18661-3 2475ISO/IEC TS 18661-3 defines new permissible values for 2476@code{FLT_EVAL_METHOD} that indicate that operations and constants with 2477a semantic type that is an interchange or extended format should be 2478evaluated to the precision and range of that type. These new values are 2479a superset of those permitted under C99/C11, which does not specify the 2480meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code 2481conforming to C11 may not have been written expecting the possibility of 2482the new values. 2483 2484@option{-fpermitted-flt-eval-methods} specifies whether the compiler 2485should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11, 2486or the extended set of values specified in ISO/IEC TS 18661-3. 2487 2488@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate. 2489 2490The default when in a standards compliant mode (@option{-std=c11} or similar) 2491is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU 2492dialect (@option{-std=gnu11} or similar) is 2493@option{-fpermitted-flt-eval-methods=ts-18661-3}. 2494 2495@item -aux-info @var{filename} 2496@opindex aux-info 2497Output to the given filename prototyped declarations for all functions 2498declared and/or defined in a translation unit, including those in header 2499files. This option is silently ignored in any language other than C@. 2500 2501Besides declarations, the file indicates, in comments, the origin of 2502each declaration (source file and line), whether the declaration was 2503implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 2504@samp{O} for old, respectively, in the first character after the line 2505number and the colon), and whether it came from a declaration or a 2506definition (@samp{C} or @samp{F}, respectively, in the following 2507character). In the case of function definitions, a K&R-style list of 2508arguments followed by their declarations is also provided, inside 2509comments, after the declaration. 2510 2511@item -fallow-parameterless-variadic-functions 2512@opindex fallow-parameterless-variadic-functions 2513Accept variadic functions without named parameters. 2514 2515Although it is possible to define such a function, this is not very 2516useful as it is not possible to read the arguments. This is only 2517supported for C as this construct is allowed by C++. 2518 2519@item -fno-asm 2520@opindex fno-asm 2521@opindex fasm 2522Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 2523keyword, so that code can use these words as identifiers. You can use 2524the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 2525instead. @option{-ansi} implies @option{-fno-asm}. 2526 2527In C++, this switch only affects the @code{typeof} keyword, since 2528@code{asm} and @code{inline} are standard keywords. You may want to 2529use the @option{-fno-gnu-keywords} flag instead, which has the same 2530effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 2531switch only affects the @code{asm} and @code{typeof} keywords, since 2532@code{inline} is a standard keyword in ISO C99. 2533 2534@item -fno-builtin 2535@itemx -fno-builtin-@var{function} 2536@opindex fno-builtin 2537@opindex fbuiltin 2538@cindex built-in functions 2539Don't recognize built-in functions that do not begin with 2540@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 2541functions provided by GCC}, for details of the functions affected, 2542including those which are not built-in functions when @option{-ansi} or 2543@option{-std} options for strict ISO C conformance are used because they 2544do not have an ISO standard meaning. 2545 2546GCC normally generates special code to handle certain built-in functions 2547more efficiently; for instance, calls to @code{alloca} may become single 2548instructions which adjust the stack directly, and calls to @code{memcpy} 2549may become inline copy loops. The resulting code is often both smaller 2550and faster, but since the function calls no longer appear as such, you 2551cannot set a breakpoint on those calls, nor can you change the behavior 2552of the functions by linking with a different library. In addition, 2553when a function is recognized as a built-in function, GCC may use 2554information about that function to warn about problems with calls to 2555that function, or to generate more efficient code, even if the 2556resulting code still contains calls to that function. For example, 2557warnings are given with @option{-Wformat} for bad calls to 2558@code{printf} when @code{printf} is built in and @code{strlen} is 2559known not to modify global memory. 2560 2561With the @option{-fno-builtin-@var{function}} option 2562only the built-in function @var{function} is 2563disabled. @var{function} must not begin with @samp{__builtin_}. If a 2564function is named that is not built-in in this version of GCC, this 2565option is ignored. There is no corresponding 2566@option{-fbuiltin-@var{function}} option; if you wish to enable 2567built-in functions selectively when using @option{-fno-builtin} or 2568@option{-ffreestanding}, you may define macros such as: 2569 2570@smallexample 2571#define abs(n) __builtin_abs ((n)) 2572#define strcpy(d, s) __builtin_strcpy ((d), (s)) 2573@end smallexample 2574 2575@item -fgimple 2576@opindex fgimple 2577 2578Enable parsing of function definitions marked with @code{__GIMPLE}. 2579This is an experimental feature that allows unit testing of GIMPLE 2580passes. 2581 2582@item -fhosted 2583@opindex fhosted 2584@cindex hosted environment 2585 2586Assert that compilation targets a hosted environment. This implies 2587@option{-fbuiltin}. A hosted environment is one in which the 2588entire standard library is available, and in which @code{main} has a return 2589type of @code{int}. Examples are nearly everything except a kernel. 2590This is equivalent to @option{-fno-freestanding}. 2591 2592@item -ffreestanding 2593@opindex ffreestanding 2594@cindex hosted environment 2595 2596Assert that compilation targets a freestanding environment. This 2597implies @option{-fno-builtin}. A freestanding environment 2598is one in which the standard library may not exist, and program startup may 2599not necessarily be at @code{main}. The most obvious example is an OS kernel. 2600This is equivalent to @option{-fno-hosted}. 2601 2602@xref{Standards,,Language Standards Supported by GCC}, for details of 2603freestanding and hosted environments. 2604 2605@item -fopenacc 2606@opindex fopenacc 2607@cindex OpenACC accelerator programming 2608Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and 2609@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the 2610compiler generates accelerated code according to the OpenACC Application 2611Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option 2612implies @option{-pthread}, and thus is only supported on targets that 2613have support for @option{-pthread}. 2614 2615@item -fopenacc-dim=@var{geom} 2616@opindex fopenacc-dim 2617@cindex OpenACC accelerator programming 2618Specify default compute dimensions for parallel offload regions that do 2619not explicitly specify. The @var{geom} value is a triple of 2620':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size 2621can be omitted, to use a target-specific default value. 2622 2623@item -fopenmp 2624@opindex fopenmp 2625@cindex OpenMP parallel 2626Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 2627@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 2628compiler generates parallel code according to the OpenMP Application 2629Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option 2630implies @option{-pthread}, and thus is only supported on targets that 2631have support for @option{-pthread}. @option{-fopenmp} implies 2632@option{-fopenmp-simd}. 2633 2634@item -fopenmp-simd 2635@opindex fopenmp-simd 2636@cindex OpenMP SIMD 2637@cindex SIMD 2638Enable handling of OpenMP's SIMD directives with @code{#pragma omp} 2639in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives 2640are ignored. 2641 2642@item -fgnu-tm 2643@opindex fgnu-tm 2644When the option @option{-fgnu-tm} is specified, the compiler 2645generates code for the Linux variant of Intel's current Transactional 2646Memory ABI specification document (Revision 1.1, May 6 2009). This is 2647an experimental feature whose interface may change in future versions 2648of GCC, as the official specification changes. Please note that not 2649all architectures are supported for this feature. 2650 2651For more information on GCC's support for transactional memory, 2652@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 2653Transactional Memory Library}. 2654 2655Note that the transactional memory feature is not supported with 2656non-call exceptions (@option{-fnon-call-exceptions}). 2657 2658@item -fms-extensions 2659@opindex fms-extensions 2660Accept some non-standard constructs used in Microsoft header files. 2661 2662In C++ code, this allows member names in structures to be similar 2663to previous types declarations. 2664 2665@smallexample 2666typedef int UOW; 2667struct ABC @{ 2668 UOW UOW; 2669@}; 2670@end smallexample 2671 2672Some cases of unnamed fields in structures and unions are only 2673accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 2674fields within structs/unions}, for details. 2675 2676Note that this option is off for all targets except for x86 2677targets using ms-abi. 2678 2679@item -fplan9-extensions 2680@opindex fplan9-extensions 2681Accept some non-standard constructs used in Plan 9 code. 2682 2683This enables @option{-fms-extensions}, permits passing pointers to 2684structures with anonymous fields to functions that expect pointers to 2685elements of the type of the field, and permits referring to anonymous 2686fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 2687struct/union fields within structs/unions}, for details. This is only 2688supported for C, not C++. 2689 2690@item -fcond-mismatch 2691@opindex fcond-mismatch 2692Allow conditional expressions with mismatched types in the second and 2693third arguments. The value of such an expression is void. This option 2694is not supported for C++. 2695 2696@item -flax-vector-conversions 2697@opindex flax-vector-conversions 2698Allow implicit conversions between vectors with differing numbers of 2699elements and/or incompatible element types. This option should not be 2700used for new code. 2701 2702@item -funsigned-char 2703@opindex funsigned-char 2704Let the type @code{char} be unsigned, like @code{unsigned char}. 2705 2706Each kind of machine has a default for what @code{char} should 2707be. It is either like @code{unsigned char} by default or like 2708@code{signed char} by default. 2709 2710Ideally, a portable program should always use @code{signed char} or 2711@code{unsigned char} when it depends on the signedness of an object. 2712But many programs have been written to use plain @code{char} and 2713expect it to be signed, or expect it to be unsigned, depending on the 2714machines they were written for. This option, and its inverse, let you 2715make such a program work with the opposite default. 2716 2717The type @code{char} is always a distinct type from each of 2718@code{signed char} or @code{unsigned char}, even though its behavior 2719is always just like one of those two. 2720 2721@item -fsigned-char 2722@opindex fsigned-char 2723Let the type @code{char} be signed, like @code{signed char}. 2724 2725Note that this is equivalent to @option{-fno-unsigned-char}, which is 2726the negative form of @option{-funsigned-char}. Likewise, the option 2727@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 2728 2729@item -fsigned-bitfields 2730@itemx -funsigned-bitfields 2731@itemx -fno-signed-bitfields 2732@itemx -fno-unsigned-bitfields 2733@opindex fsigned-bitfields 2734@opindex funsigned-bitfields 2735@opindex fno-signed-bitfields 2736@opindex fno-unsigned-bitfields 2737These options control whether a bit-field is signed or unsigned, when the 2738declaration does not use either @code{signed} or @code{unsigned}. By 2739default, such a bit-field is signed, because this is consistent: the 2740basic integer types such as @code{int} are signed types. 2741 2742@item -fsso-struct=@var{endianness} 2743@opindex fsso-struct 2744Set the default scalar storage order of structures and unions to the 2745specified endianness. The accepted values are @samp{big-endian}, 2746@samp{little-endian} and @samp{native} for the native endianness of 2747the target (the default). This option is not supported for C++. 2748 2749@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate 2750code that is not binary compatible with code generated without it if the 2751specified endianness is not the native endianness of the target. 2752@end table 2753 2754@node C++ Dialect Options 2755@section Options Controlling C++ Dialect 2756 2757@cindex compiler options, C++ 2758@cindex C++ options, command-line 2759@cindex options, C++ 2760This section describes the command-line options that are only meaningful 2761for C++ programs. You can also use most of the GNU compiler options 2762regardless of what language your program is in. For example, you 2763might compile a file @file{firstClass.C} like this: 2764 2765@smallexample 2766g++ -g -fstrict-enums -O -c firstClass.C 2767@end smallexample 2768 2769@noindent 2770In this example, only @option{-fstrict-enums} is an option meant 2771only for C++ programs; you can use the other options with any 2772language supported by GCC@. 2773 2774Some options for compiling C programs, such as @option{-std}, are also 2775relevant for C++ programs. 2776@xref{C Dialect Options,,Options Controlling C Dialect}. 2777 2778Here is a list of options that are @emph{only} for compiling C++ programs: 2779 2780@table @gcctabopt 2781 2782@item -fabi-version=@var{n} 2783@opindex fabi-version 2784Use version @var{n} of the C++ ABI@. The default is version 0. 2785 2786Version 0 refers to the version conforming most closely to 2787the C++ ABI specification. Therefore, the ABI obtained using version 0 2788will change in different versions of G++ as ABI bugs are fixed. 2789 2790Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 2791 2792Version 2 is the version of the C++ ABI that first appeared in G++ 27933.4, and was the default through G++ 4.9. 2794 2795Version 3 corrects an error in mangling a constant address as a 2796template argument. 2797 2798Version 4, which first appeared in G++ 4.5, implements a standard 2799mangling for vector types. 2800 2801Version 5, which first appeared in G++ 4.6, corrects the mangling of 2802attribute const/volatile on function pointer types, decltype of a 2803plain decl, and use of a function parameter in the declaration of 2804another parameter. 2805 2806Version 6, which first appeared in G++ 4.7, corrects the promotion 2807behavior of C++11 scoped enums and the mangling of template argument 2808packs, const/static_cast, prefix ++ and --, and a class scope function 2809used as a template argument. 2810 2811Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a 2812builtin type and corrects the mangling of lambdas in default argument 2813scope. 2814 2815Version 8, which first appeared in G++ 4.9, corrects the substitution 2816behavior of function types with function-cv-qualifiers. 2817 2818Version 9, which first appeared in G++ 5.2, corrects the alignment of 2819@code{nullptr_t}. 2820 2821Version 10, which first appeared in G++ 6.1, adds mangling of 2822attributes that affect type identity, such as ia32 calling convention 2823attributes (e.g.@: @samp{stdcall}). 2824 2825Version 11, which first appeared in G++ 7, corrects the mangling of 2826sizeof... expressions and operator names. For multiple entities with 2827the same name within a function, that are declared in different scopes, 2828the mangling now changes starting with the twelfth occurrence. It also 2829implies @option{-fnew-inheriting-ctors}. 2830 2831Version 12, which first appeared in G++ 8, corrects the calling 2832conventions for empty classes on the x86_64 target and for classes 2833with only deleted copy/move constructors. It accidentally changes the 2834calling convention for classes with a deleted copy constructor and a 2835trivial move constructor. 2836 2837Version 13, which first appeared in G++ 8.2, fixes the accidental 2838change in version 12. 2839 2840Version 14, which first appeared in G++ 10, corrects the mangling of 2841the nullptr expression. 2842 2843Version 15, which first appeared in G++ 11, changes the mangling of 2844@code{__alignof__} to be distinct from that of @code{alignof}, and 2845dependent operator names. 2846 2847See also @option{-Wabi}. 2848 2849@item -fabi-compat-version=@var{n} 2850@opindex fabi-compat-version 2851On targets that support strong aliases, G++ 2852works around mangling changes by creating an alias with the correct 2853mangled name when defining a symbol with an incorrect mangled name. 2854This switch specifies which ABI version to use for the alias. 2855 2856With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7 2857compatibility). If another ABI version is explicitly selected, this 2858defaults to 0. For compatibility with GCC versions 3.2 through 4.9, 2859use @option{-fabi-compat-version=2}. 2860 2861If this option is not provided but @option{-Wabi=@var{n}} is, that 2862version is used for compatibility aliases. If this option is provided 2863along with @option{-Wabi} (without the version), the version from this 2864option is used for the warning. 2865 2866@item -fno-access-control 2867@opindex fno-access-control 2868@opindex faccess-control 2869Turn off all access checking. This switch is mainly useful for working 2870around bugs in the access control code. 2871 2872@item -faligned-new 2873@opindex faligned-new 2874Enable support for C++17 @code{new} of types that require more 2875alignment than @code{void* ::operator new(std::size_t)} provides. A 2876numeric argument such as @code{-faligned-new=32} can be used to 2877specify how much alignment (in bytes) is provided by that function, 2878but few users will need to override the default of 2879@code{alignof(std::max_align_t)}. 2880 2881This flag is enabled by default for @option{-std=c++17}. 2882 2883@item -fchar8_t 2884@itemx -fno-char8_t 2885@opindex fchar8_t 2886@opindex fno-char8_t 2887Enable support for @code{char8_t} as adopted for C++20. This includes 2888the addition of a new @code{char8_t} fundamental type, changes to the 2889types of UTF-8 string and character literals, new signatures for 2890user-defined literals, associated standard library updates, and new 2891@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros. 2892 2893This option enables functions to be overloaded for ordinary and UTF-8 2894strings: 2895 2896@smallexample 2897int f(const char *); // #1 2898int f(const char8_t *); // #2 2899int v1 = f("text"); // Calls #1 2900int v2 = f(u8"text"); // Calls #2 2901@end smallexample 2902 2903@noindent 2904and introduces new signatures for user-defined literals: 2905 2906@smallexample 2907int operator""_udl1(char8_t); 2908int v3 = u8'x'_udl1; 2909int operator""_udl2(const char8_t*, std::size_t); 2910int v4 = u8"text"_udl2; 2911template<typename T, T...> int operator""_udl3(); 2912int v5 = u8"text"_udl3; 2913@end smallexample 2914 2915@noindent 2916The change to the types of UTF-8 string and character literals introduces 2917incompatibilities with ISO C++11 and later standards. For example, the 2918following code is well-formed under ISO C++11, but is ill-formed when 2919@option{-fchar8_t} is specified. 2920 2921@smallexample 2922char ca[] = u8"xx"; // error: char-array initialized from wide 2923 // string 2924const char *cp = u8"xx";// error: invalid conversion from 2925 // `const char8_t*' to `const char*' 2926int f(const char*); 2927auto v = f(u8"xx"); // error: invalid conversion from 2928 // `const char8_t*' to `const char*' 2929std::string s@{u8"xx"@}; // error: no matching function for call to 2930 // `std::basic_string<char>::basic_string()' 2931using namespace std::literals; 2932s = u8"xx"s; // error: conversion from 2933 // `basic_string<char8_t>' to non-scalar 2934 // type `basic_string<char>' requested 2935@end smallexample 2936 2937@item -fcheck-new 2938@opindex fcheck-new 2939Check that the pointer returned by @code{operator new} is non-null 2940before attempting to modify the storage allocated. This check is 2941normally unnecessary because the C++ standard specifies that 2942@code{operator new} only returns @code{0} if it is declared 2943@code{throw()}, in which case the compiler always checks the 2944return value even without this option. In all other cases, when 2945@code{operator new} has a non-empty exception specification, memory 2946exhaustion is signalled by throwing @code{std::bad_alloc}. See also 2947@samp{new (nothrow)}. 2948 2949@item -fconcepts 2950@itemx -fconcepts-ts 2951@opindex fconcepts 2952@opindex fconcepts-ts 2953Below @option{-std=c++20}, @option{-fconcepts} enables support for the 2954C++ Extensions for Concepts Technical Specification, ISO 19217 (2015). 2955 2956With @option{-std=c++20} and above, Concepts are part of the language 2957standard, so @option{-fconcepts} defaults to on. But the standard 2958specification of Concepts differs significantly from the TS, so some 2959constructs that were allowed in the TS but didn't make it into the 2960standard can still be enabled by @option{-fconcepts-ts}. 2961 2962@item -fconstexpr-depth=@var{n} 2963@opindex fconstexpr-depth 2964Set the maximum nested evaluation depth for C++11 constexpr functions 2965to @var{n}. A limit is needed to detect endless recursion during 2966constant expression evaluation. The minimum specified by the standard 2967is 512. 2968 2969@item -fconstexpr-cache-depth=@var{n} 2970@opindex fconstexpr-cache-depth 2971Set the maximum level of nested evaluation depth for C++11 constexpr 2972functions that will be cached to @var{n}. This is a heuristic that 2973trades off compilation speed (when the cache avoids repeated 2974calculations) against memory consumption (when the cache grows very 2975large from highly recursive evaluations). The default is 8. Very few 2976users are likely to want to adjust it, but if your code does heavy 2977constexpr calculations you might want to experiment to find which 2978value works best for you. 2979 2980@item -fconstexpr-loop-limit=@var{n} 2981@opindex fconstexpr-loop-limit 2982Set the maximum number of iterations for a loop in C++14 constexpr functions 2983to @var{n}. A limit is needed to detect infinite loops during 2984constant expression evaluation. The default is 262144 (1<<18). 2985 2986@item -fconstexpr-ops-limit=@var{n} 2987@opindex fconstexpr-ops-limit 2988Set the maximum number of operations during a single constexpr evaluation. 2989Even when number of iterations of a single loop is limited with the above limit, 2990if there are several nested loops and each of them has many iterations but still 2991smaller than the above limit, or if in a body of some loop or even outside 2992of a loop too many expressions need to be evaluated, the resulting constexpr 2993evaluation might take too long. 2994The default is 33554432 (1<<25). 2995 2996@item -fcoroutines 2997@opindex fcoroutines 2998Enable support for the C++ coroutines extension (experimental). 2999 3000@item -fno-elide-constructors 3001@opindex fno-elide-constructors 3002@opindex felide-constructors 3003The C++ standard allows an implementation to omit creating a temporary 3004that is only used to initialize another object of the same type. 3005Specifying this option disables that optimization, and forces G++ to 3006call the copy constructor in all cases. This option also causes G++ 3007to call trivial member functions which otherwise would be expanded inline. 3008 3009In C++17, the compiler is required to omit these temporaries, but this 3010option still affects trivial member functions. 3011 3012@item -fno-enforce-eh-specs 3013@opindex fno-enforce-eh-specs 3014@opindex fenforce-eh-specs 3015Don't generate code to check for violation of exception specifications 3016at run time. This option violates the C++ standard, but may be useful 3017for reducing code size in production builds, much like defining 3018@code{NDEBUG}. This does not give user code permission to throw 3019exceptions in violation of the exception specifications; the compiler 3020still optimizes based on the specifications, so throwing an 3021unexpected exception results in undefined behavior at run time. 3022 3023@item -fextern-tls-init 3024@itemx -fno-extern-tls-init 3025@opindex fextern-tls-init 3026@opindex fno-extern-tls-init 3027The C++11 and OpenMP standards allow @code{thread_local} and 3028@code{threadprivate} variables to have dynamic (runtime) 3029initialization. To support this, any use of such a variable goes 3030through a wrapper function that performs any necessary initialization. 3031When the use and definition of the variable are in the same 3032translation unit, this overhead can be optimized away, but when the 3033use is in a different translation unit there is significant overhead 3034even if the variable doesn't actually need dynamic initialization. If 3035the programmer can be sure that no use of the variable in a 3036non-defining TU needs to trigger dynamic initialization (either 3037because the variable is statically initialized, or a use of the 3038variable in the defining TU will be executed before any uses in 3039another TU), they can avoid this overhead with the 3040@option{-fno-extern-tls-init} option. 3041 3042On targets that support symbol aliases, the default is 3043@option{-fextern-tls-init}. On targets that do not support symbol 3044aliases, the default is @option{-fno-extern-tls-init}. 3045 3046@item -fno-gnu-keywords 3047@opindex fno-gnu-keywords 3048@opindex fgnu-keywords 3049Do not recognize @code{typeof} as a keyword, so that code can use this 3050word as an identifier. You can use the keyword @code{__typeof__} instead. 3051This option is implied by the strict ISO C++ dialects: @option{-ansi}, 3052@option{-std=c++98}, @option{-std=c++11}, etc. 3053 3054@item -fno-implicit-templates 3055@opindex fno-implicit-templates 3056@opindex fimplicit-templates 3057Never emit code for non-inline templates that are instantiated 3058implicitly (i.e.@: by use); only emit code for explicit instantiations. 3059If you use this option, you must take care to structure your code to 3060include all the necessary explicit instantiations to avoid getting 3061undefined symbols at link time. 3062@xref{Template Instantiation}, for more information. 3063 3064@item -fno-implicit-inline-templates 3065@opindex fno-implicit-inline-templates 3066@opindex fimplicit-inline-templates 3067Don't emit code for implicit instantiations of inline templates, either. 3068The default is to handle inlines differently so that compiles with and 3069without optimization need the same set of explicit instantiations. 3070 3071@item -fno-implement-inlines 3072@opindex fno-implement-inlines 3073@opindex fimplement-inlines 3074To save space, do not emit out-of-line copies of inline functions 3075controlled by @code{#pragma implementation}. This causes linker 3076errors if these functions are not inlined everywhere they are called. 3077 3078@item -fmodules-ts 3079@itemx -fno-modules-ts 3080@opindex fmodules-ts 3081@opindex fno-modules-ts 3082Enable support for C++20 modules (@xref{C++ Modules}). The 3083@option{-fno-modules-ts} is usually not needed, as that is the 3084default. Even though this is a C++20 feature, it is not currently 3085implicitly enabled by selecting that standard version. 3086 3087@item -fmodule-header 3088@itemx -fmodule-header=user 3089@itemx -fmodule-header=system 3090@opindex fmodule-header 3091Compile a header file to create an importable header unit. 3092 3093@item -fmodule-implicit-inline 3094@opindex fmodule-implicit-inline 3095Member functions defined in their class definitions are not implicitly 3096inline for modular code. This is different to traditional C++ 3097behavior, for good reasons. However, it may result in a difficulty 3098during code porting. This option makes such function definitions 3099implicitly inline. It does however generate an ABI incompatibility, 3100so you must use it everywhere or nowhere. (Such definitions outside 3101of a named module remain implicitly inline, regardless.) 3102 3103@item -fno-module-lazy 3104@opindex fno-module-lazy 3105@opindex fmodule-lazy 3106Disable lazy module importing and module mapper creation. 3107 3108@item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]} 3109@itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...} 3110@itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]} 3111@itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]} 3112@itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]} 3113@itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]} 3114@vindex CXX_MODULE_MAPPER @r{environment variable} 3115@opindex fmodule-mapper 3116An oracle to query for module name to filename mappings. If 3117unspecified the @env{CXX_MODULE_MAPPER} environment variable is used, 3118and if that is unset, an in-process default is provided. 3119 3120@item -fmodule-only 3121@opindex fmodule-only 3122Only emit the Compiled Module Interface, inhibiting any object file. 3123 3124@item -fms-extensions 3125@opindex fms-extensions 3126Disable Wpedantic warnings about constructs used in MFC, such as implicit 3127int and getting a pointer to member function via non-standard syntax. 3128 3129@item -fnew-inheriting-ctors 3130@opindex fnew-inheriting-ctors 3131Enable the P0136 adjustment to the semantics of C++11 constructor 3132inheritance. This is part of C++17 but also considered to be a Defect 3133Report against C++11 and C++14. This flag is enabled by default 3134unless @option{-fabi-version=10} or lower is specified. 3135 3136@item -fnew-ttp-matching 3137@opindex fnew-ttp-matching 3138Enable the P0522 resolution to Core issue 150, template template 3139parameters and default arguments: this allows a template with default 3140template arguments as an argument for a template template parameter 3141with fewer template parameters. This flag is enabled by default for 3142@option{-std=c++17}. 3143 3144@item -fno-nonansi-builtins 3145@opindex fno-nonansi-builtins 3146@opindex fnonansi-builtins 3147Disable built-in declarations of functions that are not mandated by 3148ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 3149@code{index}, @code{bzero}, @code{conjf}, and other related functions. 3150 3151@item -fnothrow-opt 3152@opindex fnothrow-opt 3153Treat a @code{throw()} exception specification as if it were a 3154@code{noexcept} specification to reduce or eliminate the text size 3155overhead relative to a function with no exception specification. If 3156the function has local variables of types with non-trivial 3157destructors, the exception specification actually makes the 3158function smaller because the EH cleanups for those variables can be 3159optimized away. The semantic effect is that an exception thrown out of 3160a function with such an exception specification results in a call 3161to @code{terminate} rather than @code{unexpected}. 3162 3163@item -fno-operator-names 3164@opindex fno-operator-names 3165@opindex foperator-names 3166Do not treat the operator name keywords @code{and}, @code{bitand}, 3167@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 3168synonyms as keywords. 3169 3170@item -fno-optional-diags 3171@opindex fno-optional-diags 3172@opindex foptional-diags 3173Disable diagnostics that the standard says a compiler does not need to 3174issue. Currently, the only such diagnostic issued by G++ is the one for 3175a name having multiple meanings within a class. 3176 3177@item -fpermissive 3178@opindex fpermissive 3179Downgrade some diagnostics about nonconformant code from errors to 3180warnings. Thus, using @option{-fpermissive} allows some 3181nonconforming code to compile. 3182 3183@item -fno-pretty-templates 3184@opindex fno-pretty-templates 3185@opindex fpretty-templates 3186When an error message refers to a specialization of a function 3187template, the compiler normally prints the signature of the 3188template followed by the template arguments and any typedefs or 3189typenames in the signature (e.g.@: @code{void f(T) [with T = int]} 3190rather than @code{void f(int)}) so that it's clear which template is 3191involved. When an error message refers to a specialization of a class 3192template, the compiler omits any template arguments that match 3193the default template arguments for that template. If either of these 3194behaviors make it harder to understand the error message rather than 3195easier, you can use @option{-fno-pretty-templates} to disable them. 3196 3197@item -fno-rtti 3198@opindex fno-rtti 3199@opindex frtti 3200Disable generation of information about every class with virtual 3201functions for use by the C++ run-time type identification features 3202(@code{dynamic_cast} and @code{typeid}). If you don't use those parts 3203of the language, you can save some space by using this flag. Note that 3204exception handling uses the same information, but G++ generates it as 3205needed. The @code{dynamic_cast} operator can still be used for casts that 3206do not require run-time type information, i.e.@: casts to @code{void *} or to 3207unambiguous base classes. 3208 3209Mixing code compiled with @option{-frtti} with that compiled with 3210@option{-fno-rtti} may not work. For example, programs may 3211fail to link if a class compiled with @option{-fno-rtti} is used as a base 3212for a class compiled with @option{-frtti}. 3213 3214@item -fsized-deallocation 3215@opindex fsized-deallocation 3216Enable the built-in global declarations 3217@smallexample 3218void operator delete (void *, std::size_t) noexcept; 3219void operator delete[] (void *, std::size_t) noexcept; 3220@end smallexample 3221as introduced in C++14. This is useful for user-defined replacement 3222deallocation functions that, for example, use the size of the object 3223to make deallocation faster. Enabled by default under 3224@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} 3225warns about places that might want to add a definition. 3226 3227@item -fstrict-enums 3228@opindex fstrict-enums 3229Allow the compiler to optimize using the assumption that a value of 3230enumerated type can only be one of the values of the enumeration (as 3231defined in the C++ standard; basically, a value that can be 3232represented in the minimum number of bits needed to represent all the 3233enumerators). This assumption may not be valid if the program uses a 3234cast to convert an arbitrary integer value to the enumerated type. 3235 3236@item -fstrong-eval-order 3237@opindex fstrong-eval-order 3238Evaluate member access, array subscripting, and shift expressions in 3239left-to-right order, and evaluate assignment in right-to-left order, 3240as adopted for C++17. Enabled by default with @option{-std=c++17}. 3241@option{-fstrong-eval-order=some} enables just the ordering of member 3242access and shift expressions, and is the default without 3243@option{-std=c++17}. 3244 3245@item -ftemplate-backtrace-limit=@var{n} 3246@opindex ftemplate-backtrace-limit 3247Set the maximum number of template instantiation notes for a single 3248warning or error to @var{n}. The default value is 10. 3249 3250@item -ftemplate-depth=@var{n} 3251@opindex ftemplate-depth 3252Set the maximum instantiation depth for template classes to @var{n}. 3253A limit on the template instantiation depth is needed to detect 3254endless recursions during template class instantiation. ANSI/ISO C++ 3255conforming programs must not rely on a maximum depth greater than 17 3256(changed to 1024 in C++11). The default value is 900, as the compiler 3257can run out of stack space before hitting 1024 in some situations. 3258 3259@item -fno-threadsafe-statics 3260@opindex fno-threadsafe-statics 3261@opindex fthreadsafe-statics 3262Do not emit the extra code to use the routines specified in the C++ 3263ABI for thread-safe initialization of local statics. You can use this 3264option to reduce code size slightly in code that doesn't need to be 3265thread-safe. 3266 3267@item -fuse-cxa-atexit 3268@opindex fuse-cxa-atexit 3269Register destructors for objects with static storage duration with the 3270@code{__cxa_atexit} function rather than the @code{atexit} function. 3271This option is required for fully standards-compliant handling of static 3272destructors, but only works if your C library supports 3273@code{__cxa_atexit}. 3274 3275@item -fno-use-cxa-get-exception-ptr 3276@opindex fno-use-cxa-get-exception-ptr 3277@opindex fuse-cxa-get-exception-ptr 3278Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 3279causes @code{std::uncaught_exception} to be incorrect, but is necessary 3280if the runtime routine is not available. 3281 3282@item -fvisibility-inlines-hidden 3283@opindex fvisibility-inlines-hidden 3284This switch declares that the user does not attempt to compare 3285pointers to inline functions or methods where the addresses of the two functions 3286are taken in different shared objects. 3287 3288The effect of this is that GCC may, effectively, mark inline methods with 3289@code{__attribute__ ((visibility ("hidden")))} so that they do not 3290appear in the export table of a DSO and do not require a PLT indirection 3291when used within the DSO@. Enabling this option can have a dramatic effect 3292on load and link times of a DSO as it massively reduces the size of the 3293dynamic export table when the library makes heavy use of templates. 3294 3295The behavior of this switch is not quite the same as marking the 3296methods as hidden directly, because it does not affect static variables 3297local to the function or cause the compiler to deduce that 3298the function is defined in only one shared object. 3299 3300You may mark a method as having a visibility explicitly to negate the 3301effect of the switch for that method. For example, if you do want to 3302compare pointers to a particular inline method, you might mark it as 3303having default visibility. Marking the enclosing class with explicit 3304visibility has no effect. 3305 3306Explicitly instantiated inline methods are unaffected by this option 3307as their linkage might otherwise cross a shared library boundary. 3308@xref{Template Instantiation}. 3309 3310@item -fvisibility-ms-compat 3311@opindex fvisibility-ms-compat 3312This flag attempts to use visibility settings to make GCC's C++ 3313linkage model compatible with that of Microsoft Visual Studio. 3314 3315The flag makes these changes to GCC's linkage model: 3316 3317@enumerate 3318@item 3319It sets the default visibility to @code{hidden}, like 3320@option{-fvisibility=hidden}. 3321 3322@item 3323Types, but not their members, are not hidden by default. 3324 3325@item 3326The One Definition Rule is relaxed for types without explicit 3327visibility specifications that are defined in more than one 3328shared object: those declarations are permitted if they are 3329permitted when this option is not used. 3330@end enumerate 3331 3332In new code it is better to use @option{-fvisibility=hidden} and 3333export those classes that are intended to be externally visible. 3334Unfortunately it is possible for code to rely, perhaps accidentally, 3335on the Visual Studio behavior. 3336 3337Among the consequences of these changes are that static data members 3338of the same type with the same name but defined in different shared 3339objects are different, so changing one does not change the other; 3340and that pointers to function members defined in different shared 3341objects may not compare equal. When this flag is given, it is a 3342violation of the ODR to define types with the same name differently. 3343 3344@item -fno-weak 3345@opindex fno-weak 3346@opindex fweak 3347Do not use weak symbol support, even if it is provided by the linker. 3348By default, G++ uses weak symbols if they are available. This 3349option exists only for testing, and should not be used by end-users; 3350it results in inferior code and has no benefits. This option may 3351be removed in a future release of G++. 3352 3353@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 3354@opindex fext-numeric-literals 3355@opindex fno-ext-numeric-literals 3356Accept imaginary, fixed-point, or machine-defined 3357literal number suffixes as GNU extensions. 3358When this option is turned off these suffixes are treated 3359as C++11 user-defined literal numeric suffixes. 3360This is on by default for all pre-C++11 dialects and all GNU dialects: 3361@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 3362@option{-std=gnu++14}. 3363This option is off by default 3364for ISO C++11 onwards (@option{-std=c++11}, ...). 3365 3366@item -nostdinc++ 3367@opindex nostdinc++ 3368Do not search for header files in the standard directories specific to 3369C++, but do still search the other standard directories. (This option 3370is used when building the C++ library.) 3371 3372@item -flang-info-include-translate 3373@itemx -flang-info-include-translate-not 3374@itemx -flang-info-include-translate=@var{header} 3375@opindex flang-info-include-translate 3376@opindex flang-info-include-translate-not 3377Inform of include translation events. The first will note accepted 3378include translations, the second will note declined include 3379translations. The @var{header} form will inform of include 3380translations relating to that specific header. If @var{header} is of 3381the form @code{"user"} or @code{<system>} it will be resolved to a 3382specific user or system header using the include path. 3383 3384@item -flang-info-module-cmi 3385@itemx -flang-info-module-cmi=@var{module} 3386@opindex flang-info-module-cmi 3387Inform of Compiled Module Interface pathnames. The first will note 3388all read CMI pathnames. The @var{module} form will not reading a 3389specific module's CMI. @var{module} may be a named module or a 3390header-unit (the latter indicated by either being a pathname containing 3391directory separators or enclosed in @code{<>} or @code{""}). 3392 3393@item -stdlib=@var{libstdc++,libc++} 3394@opindex stdlib 3395When G++ is configured to support this option, it allows specification of 3396alternate C++ runtime libraries. Two options are available: @var{libstdc++} 3397(the default, native C++ runtime for G++) and @var{libc++} which is the 3398C++ runtime installed on some operating systems (e.g. Darwin versions from 3399Darwin11 onwards). The option switches G++ to use the headers from the 3400specified library and to emit @code{-lstdc++} or @code{-lc++} respectively, 3401when a C++ runtime is required for linking. 3402@end table 3403 3404In addition, these warning options have meanings only for C++ programs: 3405 3406@table @gcctabopt 3407@item -Wabi-tag @r{(C++ and Objective-C++ only)} 3408@opindex Wabi-tag 3409Warn when a type with an ABI tag is used in a context that does not 3410have that ABI tag. See @ref{C++ Attributes} for more information 3411about ABI tags. 3412 3413@item -Wcomma-subscript @r{(C++ and Objective-C++ only)} 3414@opindex Wcomma-subscript 3415@opindex Wno-comma-subscript 3416Warn about uses of a comma expression within a subscripting expression. 3417This usage was deprecated in C++20. However, a comma expression wrapped 3418in @code{( )} is not deprecated. Example: 3419 3420@smallexample 3421@group 3422void f(int *a, int b, int c) @{ 3423 a[b,c]; // deprecated 3424 a[(b,c)]; // OK 3425@} 3426@end group 3427@end smallexample 3428 3429Enabled by default with @option{-std=c++20}. 3430 3431@item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)} 3432@opindex Wctad-maybe-unsupported 3433@opindex Wno-ctad-maybe-unsupported 3434Warn when performing class template argument deduction (CTAD) on a type with 3435no explicitly written deduction guides. This warning will point out cases 3436where CTAD succeeded only because the compiler synthesized the implicit 3437deduction guides, which might not be what the programmer intended. Certain 3438style guides allow CTAD only on types that specifically "opt-in"; i.e., on 3439types that are designed to support CTAD. This warning can be suppressed with 3440the following pattern: 3441 3442@smallexample 3443struct allow_ctad_t; // any name works 3444template <typename T> struct S @{ 3445 S(T) @{ @} 3446@}; 3447S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered 3448@end smallexample 3449 3450@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 3451@opindex Wctor-dtor-privacy 3452@opindex Wno-ctor-dtor-privacy 3453Warn when a class seems unusable because all the constructors or 3454destructors in that class are private, and it has neither friends nor 3455public static member functions. Also warn if there are no non-private 3456methods, and there's at least one private member function that isn't 3457a constructor or destructor. 3458 3459@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 3460@opindex Wdelete-non-virtual-dtor 3461@opindex Wno-delete-non-virtual-dtor 3462Warn when @code{delete} is used to destroy an instance of a class that 3463has virtual functions and non-virtual destructor. It is unsafe to delete 3464an instance of a derived class through a pointer to a base class if the 3465base class does not have a virtual destructor. This warning is enabled 3466by @option{-Wall}. 3467 3468@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)} 3469@opindex Wdeprecated-copy 3470@opindex Wno-deprecated-copy 3471Warn that the implicit declaration of a copy constructor or copy 3472assignment operator is deprecated if the class has a user-provided 3473copy constructor or copy assignment operator, in C++11 and up. This 3474warning is enabled by @option{-Wextra}. With 3475@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a 3476user-provided destructor. 3477 3478@item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)} 3479@opindex Wdeprecated-enum-enum-conversion 3480@opindex Wno-deprecated-enum-enum-conversion 3481Disable the warning about the case when the usual arithmetic conversions 3482are applied on operands where one is of enumeration type and the other is 3483of a different enumeration type. This conversion was deprecated in C++20. 3484For example: 3485 3486@smallexample 3487enum E1 @{ e @}; 3488enum E2 @{ f @}; 3489int k = f - e; 3490@end smallexample 3491 3492@option{-Wdeprecated-enum-enum-conversion} is enabled by default with 3493@option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled 3494by @option{-Wenum-conversion}. 3495 3496@item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)} 3497@opindex Wdeprecated-enum-float-conversion 3498@opindex Wno-deprecated-enum-float-conversion 3499Disable the warning about the case when the usual arithmetic conversions 3500are applied on operands where one is of enumeration type and the other is 3501of a floating-point type. This conversion was deprecated in C++20. For 3502example: 3503 3504@smallexample 3505enum E1 @{ e @}; 3506enum E2 @{ f @}; 3507bool b = e <= 3.7; 3508@end smallexample 3509 3510@option{-Wdeprecated-enum-float-conversion} is enabled by default with 3511@option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled 3512by @option{-Wenum-conversion}. 3513 3514@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)} 3515@opindex Winit-list-lifetime 3516@opindex Wno-init-list-lifetime 3517Do not warn about uses of @code{std::initializer_list} that are likely 3518to result in dangling pointers. Since the underlying array for an 3519@code{initializer_list} is handled like a normal C++ temporary object, 3520it is easy to inadvertently keep a pointer to the array past the end 3521of the array's lifetime. For example: 3522 3523@itemize @bullet 3524@item 3525If a function returns a temporary @code{initializer_list}, or a local 3526@code{initializer_list} variable, the array's lifetime ends at the end 3527of the return statement, so the value returned has a dangling pointer. 3528 3529@item 3530If a new-expression creates an @code{initializer_list}, the array only 3531lives until the end of the enclosing full-expression, so the 3532@code{initializer_list} in the heap has a dangling pointer. 3533 3534@item 3535When an @code{initializer_list} variable is assigned from a 3536brace-enclosed initializer list, the temporary array created for the 3537right side of the assignment only lives until the end of the 3538full-expression, so at the next statement the @code{initializer_list} 3539variable has a dangling pointer. 3540 3541@smallexample 3542// li's initial underlying array lives as long as li 3543std::initializer_list<int> li = @{ 1,2,3 @}; 3544// assignment changes li to point to a temporary array 3545li = @{ 4, 5 @}; 3546// now the temporary is gone and li has a dangling pointer 3547int i = li.begin()[0] // undefined behavior 3548@end smallexample 3549 3550@item 3551When a list constructor stores the @code{begin} pointer from the 3552@code{initializer_list} argument, this doesn't extend the lifetime of 3553the array, so if a class variable is constructed from a temporary 3554@code{initializer_list}, the pointer is left dangling by the end of 3555the variable declaration statement. 3556 3557@end itemize 3558 3559@item -Winvalid-imported-macros 3560@opindex Winvalid-imported-macros 3561@opindex Wno-invalid-imported-macros 3562Verify all imported macro definitions are valid at the end of 3563compilation. This is not enabled by default, as it requires 3564additional processing to determine. It may be useful when preparing 3565sets of header-units to ensure consistent macros. 3566 3567@item -Wno-literal-suffix @r{(C++ and Objective-C++ only)} 3568@opindex Wliteral-suffix 3569@opindex Wno-literal-suffix 3570Do not warn when a string or character literal is followed by a 3571ud-suffix which does not begin with an underscore. As a conforming 3572extension, GCC treats such suffixes as separate preprocessing tokens 3573in order to maintain backwards compatibility with code that uses 3574formatting macros from @code{<inttypes.h>}. For example: 3575 3576@smallexample 3577#define __STDC_FORMAT_MACROS 3578#include <inttypes.h> 3579#include <stdio.h> 3580 3581int main() @{ 3582 int64_t i64 = 123; 3583 printf("My int64: %" PRId64"\n", i64); 3584@} 3585@end smallexample 3586 3587In this case, @code{PRId64} is treated as a separate preprocessing token. 3588 3589This option also controls warnings when a user-defined literal 3590operator is declared with a literal suffix identifier that doesn't 3591begin with an underscore. Literal suffix identifiers that don't begin 3592with an underscore are reserved for future standardization. 3593 3594These warnings are enabled by default. 3595 3596@item -Wno-narrowing @r{(C++ and Objective-C++ only)} 3597@opindex Wnarrowing 3598@opindex Wno-narrowing 3599For C++11 and later standards, narrowing conversions are diagnosed by default, 3600as required by the standard. A narrowing conversion from a constant produces 3601an error, and a narrowing conversion from a non-constant produces a warning, 3602but @option{-Wno-narrowing} suppresses the diagnostic. 3603Note that this does not affect the meaning of well-formed code; 3604narrowing conversions are still considered ill-formed in SFINAE contexts. 3605 3606With @option{-Wnarrowing} in C++98, warn when a narrowing 3607conversion prohibited by C++11 occurs within 3608@samp{@{ @}}, e.g. 3609 3610@smallexample 3611int i = @{ 2.2 @}; // error: narrowing from double to int 3612@end smallexample 3613 3614This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 3615 3616@item -Wnoexcept @r{(C++ and Objective-C++ only)} 3617@opindex Wnoexcept 3618@opindex Wno-noexcept 3619Warn when a noexcept-expression evaluates to false because of a call 3620to a function that does not have a non-throwing exception 3621specification (i.e. @code{throw()} or @code{noexcept}) but is known by 3622the compiler to never throw an exception. 3623 3624@item -Wnoexcept-type @r{(C++ and Objective-C++ only)} 3625@opindex Wnoexcept-type 3626@opindex Wno-noexcept-type 3627Warn if the C++17 feature making @code{noexcept} part of a function 3628type changes the mangled name of a symbol relative to C++14. Enabled 3629by @option{-Wabi} and @option{-Wc++17-compat}. 3630 3631As an example: 3632 3633@smallexample 3634template <class T> void f(T t) @{ t(); @}; 3635void g() noexcept; 3636void h() @{ f(g); @} 3637@end smallexample 3638 3639@noindent 3640In C++14, @code{f} calls @code{f<void(*)()>}, but in 3641C++17 it calls @code{f<void(*)()noexcept>}. 3642 3643@item -Wclass-memaccess @r{(C++ and Objective-C++ only)} 3644@opindex Wclass-memaccess 3645@opindex Wno-class-memaccess 3646Warn when the destination of a call to a raw memory function such as 3647@code{memset} or @code{memcpy} is an object of class type, and when writing 3648into such an object might bypass the class non-trivial or deleted constructor 3649or copy assignment, violate const-correctness or encapsulation, or corrupt 3650virtual table pointers. Modifying the representation of such objects may 3651violate invariants maintained by member functions of the class. For example, 3652the call to @code{memset} below is undefined because it modifies a non-trivial 3653class object and is, therefore, diagnosed. The safe way to either initialize 3654or clear the storage of objects of such types is by using the appropriate 3655constructor or assignment operator, if one is available. 3656@smallexample 3657std::string str = "abc"; 3658memset (&str, 0, sizeof str); 3659@end smallexample 3660The @option{-Wclass-memaccess} option is enabled by @option{-Wall}. 3661Explicitly casting the pointer to the class object to @code{void *} or 3662to a type that can be safely accessed by the raw memory function suppresses 3663the warning. 3664 3665@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 3666@opindex Wnon-virtual-dtor 3667@opindex Wno-non-virtual-dtor 3668Warn when a class has virtual functions and an accessible non-virtual 3669destructor itself or in an accessible polymorphic base class, in which 3670case it is possible but unsafe to delete an instance of a derived 3671class through a pointer to the class itself or base class. This 3672warning is automatically enabled if @option{-Weffc++} is specified. 3673 3674@item -Wregister @r{(C++ and Objective-C++ only)} 3675@opindex Wregister 3676@opindex Wno-register 3677Warn on uses of the @code{register} storage class specifier, except 3678when it is part of the GNU @ref{Explicit Register Variables} extension. 3679The use of the @code{register} keyword as storage class specifier has 3680been deprecated in C++11 and removed in C++17. 3681Enabled by default with @option{-std=c++17}. 3682 3683@item -Wreorder @r{(C++ and Objective-C++ only)} 3684@opindex Wreorder 3685@opindex Wno-reorder 3686@cindex reordering, warning 3687@cindex warning for reordering of member initializers 3688Warn when the order of member initializers given in the code does not 3689match the order in which they must be executed. For instance: 3690 3691@smallexample 3692struct A @{ 3693 int i; 3694 int j; 3695 A(): j (0), i (1) @{ @} 3696@}; 3697@end smallexample 3698 3699@noindent 3700The compiler rearranges the member initializers for @code{i} 3701and @code{j} to match the declaration order of the members, emitting 3702a warning to that effect. This warning is enabled by @option{-Wall}. 3703 3704@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)} 3705@opindex Wpessimizing-move 3706@opindex Wno-pessimizing-move 3707This warning warns when a call to @code{std::move} prevents copy 3708elision. A typical scenario when copy elision can occur is when returning in 3709a function with a class return type, when the expression being returned is the 3710name of a non-volatile automatic object, and is not a function parameter, and 3711has the same type as the function return type. 3712 3713@smallexample 3714struct T @{ 3715@dots{} 3716@}; 3717T fn() 3718@{ 3719 T t; 3720 @dots{} 3721 return std::move (t); 3722@} 3723@end smallexample 3724 3725But in this example, the @code{std::move} call prevents copy elision. 3726 3727This warning is enabled by @option{-Wall}. 3728 3729@item -Wno-redundant-move @r{(C++ and Objective-C++ only)} 3730@opindex Wredundant-move 3731@opindex Wno-redundant-move 3732This warning warns about redundant calls to @code{std::move}; that is, when 3733a move operation would have been performed even without the @code{std::move} 3734call. This happens because the compiler is forced to treat the object as if 3735it were an rvalue in certain situations such as returning a local variable, 3736where copy elision isn't applicable. Consider: 3737 3738@smallexample 3739struct T @{ 3740@dots{} 3741@}; 3742T fn(T t) 3743@{ 3744 @dots{} 3745 return std::move (t); 3746@} 3747@end smallexample 3748 3749Here, the @code{std::move} call is redundant. Because G++ implements Core 3750Issue 1579, another example is: 3751 3752@smallexample 3753struct T @{ // convertible to U 3754@dots{} 3755@}; 3756struct U @{ 3757@dots{} 3758@}; 3759U fn() 3760@{ 3761 T t; 3762 @dots{} 3763 return std::move (t); 3764@} 3765@end smallexample 3766In this example, copy elision isn't applicable because the type of the 3767expression being returned and the function return type differ, yet G++ 3768treats the return value as if it were designated by an rvalue. 3769 3770This warning is enabled by @option{-Wextra}. 3771 3772@item -Wrange-loop-construct @r{(C++ and Objective-C++ only)} 3773@opindex Wrange-loop-construct 3774@opindex Wno-range-loop-construct 3775This warning warns when a C++ range-based for-loop is creating an unnecessary 3776copy. This can happen when the range declaration is not a reference, but 3777probably should be. For example: 3778 3779@smallexample 3780struct S @{ char arr[128]; @}; 3781void fn () @{ 3782 S arr[5]; 3783 for (const auto x : arr) @{ @dots{} @} 3784@} 3785@end smallexample 3786 3787It does not warn when the type being copied is a trivially-copyable type whose 3788size is less than 64 bytes. 3789 3790This warning also warns when a loop variable in a range-based for-loop is 3791initialized with a value of a different type resulting in a copy. For example: 3792 3793@smallexample 3794void fn() @{ 3795 int arr[10]; 3796 for (const double &x : arr) @{ @dots{} @} 3797@} 3798@end smallexample 3799 3800In the example above, in every iteration of the loop a temporary value of 3801type @code{double} is created and destroyed, to which the reference 3802@code{const double &} is bound. 3803 3804This warning is enabled by @option{-Wall}. 3805 3806@item -Wredundant-tags @r{(C++ and Objective-C++ only)} 3807@opindex Wredundant-tags 3808@opindex Wno-redundant-tags 3809Warn about redundant class-key and enum-key in references to class types 3810and enumerated types in contexts where the key can be eliminated without 3811causing an ambiguity. For example: 3812 3813@smallexample 3814struct foo; 3815struct foo *p; // warn that keyword struct can be eliminated 3816@end smallexample 3817 3818@noindent 3819On the other hand, in this example there is no warning: 3820 3821@smallexample 3822struct foo; 3823void foo (); // "hides" struct foo 3824void bar (struct foo&); // no warning, keyword struct is necessary 3825@end smallexample 3826 3827@item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)} 3828@opindex Wsubobject-linkage 3829@opindex Wno-subobject-linkage 3830Do not warn 3831if a class type has a base or a field whose type uses the anonymous 3832namespace or depends on a type with no linkage. If a type A depends on 3833a type B with no or internal linkage, defining it in multiple 3834translation units would be an ODR violation because the meaning of B 3835is different in each translation unit. If A only appears in a single 3836translation unit, the best way to silence the warning is to give it 3837internal linkage by putting it in an anonymous namespace as well. The 3838compiler doesn't give this warning for types defined in the main .C 3839file, as those are unlikely to have multiple definitions. 3840@option{-Wsubobject-linkage} is enabled by default. 3841 3842@item -Weffc++ @r{(C++ and Objective-C++ only)} 3843@opindex Weffc++ 3844@opindex Wno-effc++ 3845Warn about violations of the following style guidelines from Scott Meyers' 3846@cite{Effective C++} series of books: 3847 3848@itemize @bullet 3849@item 3850Define a copy constructor and an assignment operator for classes 3851with dynamically-allocated memory. 3852 3853@item 3854Prefer initialization to assignment in constructors. 3855 3856@item 3857Have @code{operator=} return a reference to @code{*this}. 3858 3859@item 3860Don't try to return a reference when you must return an object. 3861 3862@item 3863Distinguish between prefix and postfix forms of increment and 3864decrement operators. 3865 3866@item 3867Never overload @code{&&}, @code{||}, or @code{,}. 3868 3869@end itemize 3870 3871This option also enables @option{-Wnon-virtual-dtor}, which is also 3872one of the effective C++ recommendations. However, the check is 3873extended to warn about the lack of virtual destructor in accessible 3874non-polymorphic bases classes too. 3875 3876When selecting this option, be aware that the standard library 3877headers do not obey all of these guidelines; use @samp{grep -v} 3878to filter out those warnings. 3879 3880@item -Wno-exceptions @r{(C++ and Objective-C++ only)} 3881@opindex Wexceptions 3882@opindex Wno-exceptions 3883Disable the warning about the case when an exception handler is shadowed by 3884another handler, which can point out a wrong ordering of exception handlers. 3885 3886@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 3887@opindex Wstrict-null-sentinel 3888@opindex Wno-strict-null-sentinel 3889Warn about the use of an uncasted @code{NULL} as sentinel. When 3890compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 3891to @code{__null}. Although it is a null pointer constant rather than a 3892null pointer, it is guaranteed to be of the same size as a pointer. 3893But this use is not portable across different compilers. 3894 3895@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 3896@opindex Wno-non-template-friend 3897@opindex Wnon-template-friend 3898Disable warnings when non-template friend functions are declared 3899within a template. In very old versions of GCC that predate implementation 3900of the ISO standard, declarations such as 3901@samp{friend int foo(int)}, where the name of the friend is an unqualified-id, 3902could be interpreted as a particular specialization of a template 3903function; the warning exists to diagnose compatibility problems, 3904and is enabled by default. 3905 3906@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 3907@opindex Wold-style-cast 3908@opindex Wno-old-style-cast 3909Warn if an old-style (C-style) cast to a non-void type is used within 3910a C++ program. The new-style casts (@code{dynamic_cast}, 3911@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are 3912less vulnerable to unintended effects and much easier to search for. 3913 3914@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 3915@opindex Woverloaded-virtual 3916@opindex Wno-overloaded-virtual 3917@cindex overloaded virtual function, warning 3918@cindex warning for overloaded virtual function 3919Warn when a function declaration hides virtual functions from a 3920base class. For example, in: 3921 3922@smallexample 3923struct A @{ 3924 virtual void f(); 3925@}; 3926 3927struct B: public A @{ 3928 void f(int); 3929@}; 3930@end smallexample 3931 3932the @code{A} class version of @code{f} is hidden in @code{B}, and code 3933like: 3934 3935@smallexample 3936B* b; 3937b->f(); 3938@end smallexample 3939 3940@noindent 3941fails to compile. 3942 3943@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 3944@opindex Wno-pmf-conversions 3945@opindex Wpmf-conversions 3946Disable the diagnostic for converting a bound pointer to member function 3947to a plain pointer. 3948 3949@item -Wsign-promo @r{(C++ and Objective-C++ only)} 3950@opindex Wsign-promo 3951@opindex Wno-sign-promo 3952Warn when overload resolution chooses a promotion from unsigned or 3953enumerated type to a signed type, over a conversion to an unsigned type of 3954the same size. Previous versions of G++ tried to preserve 3955unsignedness, but the standard mandates the current behavior. 3956 3957@item -Wtemplates @r{(C++ and Objective-C++ only)} 3958@opindex Wtemplates 3959@opindex Wno-templates 3960Warn when a primary template declaration is encountered. Some coding 3961rules disallow templates, and this may be used to enforce that rule. 3962The warning is inactive inside a system header file, such as the STL, so 3963one can still use the STL. One may also instantiate or specialize 3964templates. 3965 3966@item -Wno-mismatched-new-delete @r{(C++ and Objective-C++ only)} 3967@opindex Wmismatched-new-delete 3968@opindex Wno-mismatched-new-delete 3969Warn for mismatches between calls to @code{operator new} or @code{operator 3970delete} and the corresponding call to the allocation or deallocation function. 3971This includes invocations of C++ @code{operator delete} with pointers 3972returned from either mismatched forms of @code{operator new}, or from other 3973functions that allocate objects for which the @code{operator delete} isn't 3974a suitable deallocator, as well as calls to other deallocation functions 3975with pointers returned from @code{operator new} for which the deallocation 3976function isn't suitable. 3977 3978For example, the @code{delete} expression in the function below is diagnosed 3979because it doesn't match the array form of the @code{new} expression 3980the pointer argument was returned from. Similarly, the call to @code{free} 3981is also diagnosed. 3982 3983@smallexample 3984void f () 3985@{ 3986 int *a = new int[n]; 3987 delete a; // warning: mismatch in array forms of expressions 3988 3989 char *p = new char[n]; 3990 free (p); // warning: mismatch between new and free 3991@} 3992@end smallexample 3993 3994The related option @option{-Wmismatched-dealloc} diagnoses mismatches 3995involving allocation and deallocation functions other than @code{operator 3996new} and @code{operator delete}. 3997 3998@option{-Wmismatched-new-delete} is enabled by default. 3999 4000@item -Wmismatched-tags @r{(C++ and Objective-C++ only)} 4001@opindex Wmismatched-tags 4002@opindex Wno-mismatched-tags 4003Warn for declarations of structs, classes, and class templates and their 4004specializations with a class-key that does not match either the definition 4005or the first declaration if no definition is provided. 4006 4007For example, the declaration of @code{struct Object} in the argument list 4008of @code{draw} triggers the warning. To avoid it, either remove the redundant 4009class-key @code{struct} or replace it with @code{class} to match its definition. 4010@smallexample 4011class Object @{ 4012public: 4013 virtual ~Object () = 0; 4014@}; 4015void draw (struct Object*); 4016@end smallexample 4017 4018It is not wrong to declare a class with the class-key @code{struct} as 4019the example above shows. The @option{-Wmismatched-tags} option is intended 4020to help achieve a consistent style of class declarations. In code that is 4021intended to be portable to Windows-based compilers the warning helps prevent 4022unresolved references due to the difference in the mangling of symbols 4023declared with different class-keys. The option can be used either on its 4024own or in conjunction with @option{-Wredundant-tags}. 4025 4026@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)} 4027@opindex Wmultiple-inheritance 4028@opindex Wno-multiple-inheritance 4029Warn when a class is defined with multiple direct base classes. Some 4030coding rules disallow multiple inheritance, and this may be used to 4031enforce that rule. The warning is inactive inside a system header file, 4032such as the STL, so one can still use the STL. One may also define 4033classes that indirectly use multiple inheritance. 4034 4035@item -Wvirtual-inheritance 4036@opindex Wvirtual-inheritance 4037@opindex Wno-virtual-inheritance 4038Warn when a class is defined with a virtual direct base class. Some 4039coding rules disallow multiple inheritance, and this may be used to 4040enforce that rule. The warning is inactive inside a system header file, 4041such as the STL, so one can still use the STL. One may also define 4042classes that indirectly use virtual inheritance. 4043 4044@item -Wno-virtual-move-assign 4045@opindex Wvirtual-move-assign 4046@opindex Wno-virtual-move-assign 4047Suppress warnings about inheriting from a virtual base with a 4048non-trivial C++11 move assignment operator. This is dangerous because 4049if the virtual base is reachable along more than one path, it is 4050moved multiple times, which can mean both objects end up in the 4051moved-from state. If the move assignment operator is written to avoid 4052moving from a moved-from object, this warning can be disabled. 4053 4054@item -Wnamespaces 4055@opindex Wnamespaces 4056@opindex Wno-namespaces 4057Warn when a namespace definition is opened. Some coding rules disallow 4058namespaces, and this may be used to enforce that rule. The warning is 4059inactive inside a system header file, such as the STL, so one can still 4060use the STL. One may also use using directives and qualified names. 4061 4062@item -Wno-terminate @r{(C++ and Objective-C++ only)} 4063@opindex Wterminate 4064@opindex Wno-terminate 4065Disable the warning about a throw-expression that will immediately 4066result in a call to @code{terminate}. 4067 4068@item -Wno-vexing-parse @r{(C++ and Objective-C++ only)} 4069@opindex Wvexing-parse 4070@opindex Wno-vexing-parse 4071Warn about the most vexing parse syntactic ambiguity. This warns about 4072the cases when a declaration looks like a variable definition, but the 4073C++ language requires it to be interpreted as a function declaration. 4074For instance: 4075 4076@smallexample 4077void f(double a) @{ 4078 int i(); // extern int i (void); 4079 int n(int(a)); // extern int n (int); 4080@} 4081@end smallexample 4082 4083Another example: 4084 4085@smallexample 4086struct S @{ S(int); @}; 4087void f(double a) @{ 4088 S x(int(a)); // extern struct S x (int); 4089 S y(int()); // extern struct S y (int (*) (void)); 4090 S z(); // extern struct S z (void); 4091@} 4092@end smallexample 4093 4094The warning will suggest options how to deal with such an ambiguity; e.g., 4095it can suggest removing the parentheses or using braces instead. 4096 4097This warning is enabled by default. 4098 4099@item -Wno-class-conversion @r{(C++ and Objective-C++ only)} 4100@opindex Wno-class-conversion 4101@opindex Wclass-conversion 4102Do not warn when a conversion function converts an 4103object to the same type, to a base class of that type, or to void; such 4104a conversion function will never be called. 4105 4106@item -Wvolatile @r{(C++ and Objective-C++ only)} 4107@opindex Wvolatile 4108@opindex Wno-volatile 4109Warn about deprecated uses of the @code{volatile} qualifier. This includes 4110postfix and prefix @code{++} and @code{--} expressions of 4111@code{volatile}-qualified types, using simple assignments where the left 4112operand is a @code{volatile}-qualified non-class type for their value, 4113compound assignments where the left operand is a @code{volatile}-qualified 4114non-class type, @code{volatile}-qualified function return type, 4115@code{volatile}-qualified parameter type, and structured bindings of a 4116@code{volatile}-qualified type. This usage was deprecated in C++20. 4117 4118Enabled by default with @option{-std=c++20}. 4119 4120@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 4121@opindex Wzero-as-null-pointer-constant 4122@opindex Wno-zero-as-null-pointer-constant 4123Warn when a literal @samp{0} is used as null pointer constant. This can 4124be useful to facilitate the conversion to @code{nullptr} in C++11. 4125 4126@item -Waligned-new 4127@opindex Waligned-new 4128@opindex Wno-aligned-new 4129Warn about a new-expression of a type that requires greater alignment 4130than the @code{alignof(std::max_align_t)} but uses an allocation 4131function without an explicit alignment parameter. This option is 4132enabled by @option{-Wall}. 4133 4134Normally this only warns about global allocation functions, but 4135@option{-Waligned-new=all} also warns about class member allocation 4136functions. 4137 4138@item -Wno-placement-new 4139@itemx -Wplacement-new=@var{n} 4140@opindex Wplacement-new 4141@opindex Wno-placement-new 4142Warn about placement new expressions with undefined behavior, such as 4143constructing an object in a buffer that is smaller than the type of 4144the object. For example, the placement new expression below is diagnosed 4145because it attempts to construct an array of 64 integers in a buffer only 414664 bytes large. 4147@smallexample 4148char buf [64]; 4149new (buf) int[64]; 4150@end smallexample 4151This warning is enabled by default. 4152 4153@table @gcctabopt 4154@item -Wplacement-new=1 4155This is the default warning level of @option{-Wplacement-new}. At this 4156level the warning is not issued for some strictly undefined constructs that 4157GCC allows as extensions for compatibility with legacy code. For example, 4158the following @code{new} expression is not diagnosed at this level even 4159though it has undefined behavior according to the C++ standard because 4160it writes past the end of the one-element array. 4161@smallexample 4162struct S @{ int n, a[1]; @}; 4163S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]); 4164new (s->a)int [32](); 4165@end smallexample 4166 4167@item -Wplacement-new=2 4168At this level, in addition to diagnosing all the same constructs as at level 41691, a diagnostic is also issued for placement new expressions that construct 4170an object in the last member of structure whose type is an array of a single 4171element and whose size is less than the size of the object being constructed. 4172While the previous example would be diagnosed, the following construct makes 4173use of the flexible member array extension to avoid the warning at level 2. 4174@smallexample 4175struct S @{ int n, a[]; @}; 4176S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]); 4177new (s->a)int [32](); 4178@end smallexample 4179 4180@end table 4181 4182@item -Wcatch-value 4183@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)} 4184@opindex Wcatch-value 4185@opindex Wno-catch-value 4186Warn about catch handlers that do not catch via reference. 4187With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short) 4188warn about polymorphic class types that are caught by value. 4189With @option{-Wcatch-value=2} warn about all class types that are caught 4190by value. With @option{-Wcatch-value=3} warn about all types that are 4191not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}. 4192 4193@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 4194@opindex Wconditionally-supported 4195@opindex Wno-conditionally-supported 4196Warn for conditionally-supported (C++11 [intro.defs]) constructs. 4197 4198@item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)} 4199@opindex Wdelete-incomplete 4200@opindex Wno-delete-incomplete 4201Do not warn when deleting a pointer to incomplete type, which may cause 4202undefined behavior at runtime. This warning is enabled by default. 4203 4204@item -Wextra-semi @r{(C++, Objective-C++ only)} 4205@opindex Wextra-semi 4206@opindex Wno-extra-semi 4207Warn about redundant semicolons after in-class function definitions. 4208 4209@item -Wno-inaccessible-base @r{(C++, Objective-C++ only)} 4210@opindex Winaccessible-base 4211@opindex Wno-inaccessible-base 4212This option controls warnings 4213when a base class is inaccessible in a class derived from it due to 4214ambiguity. The warning is enabled by default. 4215Note that the warning for ambiguous virtual 4216bases is enabled by the @option{-Wextra} option. 4217@smallexample 4218@group 4219struct A @{ int a; @}; 4220 4221struct B : A @{ @}; 4222 4223struct C : B, A @{ @}; 4224@end group 4225@end smallexample 4226 4227@item -Wno-inherited-variadic-ctor 4228@opindex Winherited-variadic-ctor 4229@opindex Wno-inherited-variadic-ctor 4230Suppress warnings about use of C++11 inheriting constructors when the 4231base class inherited from has a C variadic constructor; the warning is 4232on by default because the ellipsis is not inherited. 4233 4234@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 4235@opindex Wno-invalid-offsetof 4236@opindex Winvalid-offsetof 4237Suppress warnings from applying the @code{offsetof} macro to a non-POD 4238type. According to the 2014 ISO C++ standard, applying @code{offsetof} 4239to a non-standard-layout type is undefined. In existing C++ implementations, 4240however, @code{offsetof} typically gives meaningful results. 4241This flag is for users who are aware that they are 4242writing nonportable code and who have deliberately chosen to ignore the 4243warning about it. 4244 4245The restrictions on @code{offsetof} may be relaxed in a future version 4246of the C++ standard. 4247 4248@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 4249@opindex Wsized-deallocation 4250@opindex Wno-sized-deallocation 4251Warn about a definition of an unsized deallocation function 4252@smallexample 4253void operator delete (void *) noexcept; 4254void operator delete[] (void *) noexcept; 4255@end smallexample 4256without a definition of the corresponding sized deallocation function 4257@smallexample 4258void operator delete (void *, std::size_t) noexcept; 4259void operator delete[] (void *, std::size_t) noexcept; 4260@end smallexample 4261or vice versa. Enabled by @option{-Wextra} along with 4262@option{-fsized-deallocation}. 4263 4264@item -Wsuggest-final-types 4265@opindex Wno-suggest-final-types 4266@opindex Wsuggest-final-types 4267Warn about types with virtual methods where code quality would be improved 4268if the type were declared with the C++11 @code{final} specifier, 4269or, if possible, 4270declared in an anonymous namespace. This allows GCC to more aggressively 4271devirtualize the polymorphic calls. This warning is more effective with 4272link-time optimization, 4273where the information about the class hierarchy graph is 4274more complete. 4275 4276@item -Wsuggest-final-methods 4277@opindex Wno-suggest-final-methods 4278@opindex Wsuggest-final-methods 4279Warn about virtual methods where code quality would be improved if the method 4280were declared with the C++11 @code{final} specifier, 4281or, if possible, its type were 4282declared in an anonymous namespace or with the @code{final} specifier. 4283This warning is 4284more effective with link-time optimization, where the information about the 4285class hierarchy graph is more complete. It is recommended to first consider 4286suggestions of @option{-Wsuggest-final-types} and then rebuild with new 4287annotations. 4288 4289@item -Wsuggest-override 4290@opindex Wsuggest-override 4291@opindex Wno-suggest-override 4292Warn about overriding virtual functions that are not marked with the 4293@code{override} keyword. 4294 4295@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 4296@opindex Wuseless-cast 4297@opindex Wno-useless-cast 4298Warn when an expression is casted to its own type. 4299 4300@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 4301@opindex Wconversion-null 4302@opindex Wno-conversion-null 4303Do not warn for conversions between @code{NULL} and non-pointer 4304types. @option{-Wconversion-null} is enabled by default. 4305 4306@end table 4307 4308@node Objective-C and Objective-C++ Dialect Options 4309@section Options Controlling Objective-C and Objective-C++ Dialects 4310 4311@cindex compiler options, Objective-C and Objective-C++ 4312@cindex Objective-C and Objective-C++ options, command-line 4313@cindex options, Objective-C and Objective-C++ 4314(NOTE: This manual does not describe the Objective-C and Objective-C++ 4315languages themselves. @xref{Standards,,Language Standards 4316Supported by GCC}, for references.) 4317 4318This section describes the command-line options that are only meaningful 4319for Objective-C and Objective-C++ programs. You can also use most of 4320the language-independent GNU compiler options. 4321For example, you might compile a file @file{some_class.m} like this: 4322 4323@smallexample 4324gcc -g -fgnu-runtime -O -c some_class.m 4325@end smallexample 4326 4327@noindent 4328In this example, @option{-fgnu-runtime} is an option meant only for 4329Objective-C and Objective-C++ programs; you can use the other options with 4330any language supported by GCC@. 4331 4332Note that since Objective-C is an extension of the C language, Objective-C 4333compilations may also use options specific to the C front-end (e.g., 4334@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 4335C++-specific options (e.g., @option{-Wabi}). 4336 4337Here is a list of options that are @emph{only} for compiling Objective-C 4338and Objective-C++ programs: 4339 4340@table @gcctabopt 4341@item -fconstant-string-class=@var{class-name} 4342@opindex fconstant-string-class 4343Use @var{class-name} as the name of the class to instantiate for each 4344literal string specified with the syntax @code{@@"@dots{}"}. The default 4345class name is @code{NXConstantString} if the GNU runtime is being used, and 4346@code{NSConstantString} if the NeXT runtime is being used (see below). The 4347@option{-fconstant-cfstrings} option, if also present, overrides the 4348@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals 4349to be laid out as constant CoreFoundation strings. 4350 4351@item -fgnu-runtime 4352@opindex fgnu-runtime 4353Generate object code compatible with the standard GNU Objective-C 4354runtime. This is the default for most types of systems. 4355 4356@item -fnext-runtime 4357@opindex fnext-runtime 4358Generate output compatible with the NeXT runtime. This is the default 4359for NeXT-based systems, including Darwin and Mac OS X@. The macro 4360@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 4361used. 4362 4363@item -fno-nil-receivers 4364@opindex fno-nil-receivers 4365@opindex fnil-receivers 4366Assume that all Objective-C message dispatches (@code{[receiver 4367message:arg]}) in this translation unit ensure that the receiver is 4368not @code{nil}. This allows for more efficient entry points in the 4369runtime to be used. This option is only available in conjunction with 4370the NeXT runtime and ABI version 0 or 1. 4371 4372@item -fobjc-abi-version=@var{n} 4373@opindex fobjc-abi-version 4374Use version @var{n} of the Objective-C ABI for the selected runtime. 4375This option is currently supported only for the NeXT runtime. In that 4376case, Version 0 is the traditional (32-bit) ABI without support for 4377properties and other Objective-C 2.0 additions. Version 1 is the 4378traditional (32-bit) ABI with support for properties and other 4379Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 4380nothing is specified, the default is Version 0 on 32-bit target 4381machines, and Version 2 on 64-bit target machines. 4382 4383@item -fobjc-call-cxx-cdtors 4384@opindex fobjc-call-cxx-cdtors 4385For each Objective-C class, check if any of its instance variables is a 4386C++ object with a non-trivial default constructor. If so, synthesize a 4387special @code{- (id) .cxx_construct} instance method which runs 4388non-trivial default constructors on any such instance variables, in order, 4389and then return @code{self}. Similarly, check if any instance variable 4390is a C++ object with a non-trivial destructor, and if so, synthesize a 4391special @code{- (void) .cxx_destruct} method which runs 4392all such default destructors, in reverse order. 4393 4394The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 4395methods thusly generated only operate on instance variables 4396declared in the current Objective-C class, and not those inherited 4397from superclasses. It is the responsibility of the Objective-C 4398runtime to invoke all such methods in an object's inheritance 4399hierarchy. The @code{- (id) .cxx_construct} methods are invoked 4400by the runtime immediately after a new object instance is allocated; 4401the @code{- (void) .cxx_destruct} methods are invoked immediately 4402before the runtime deallocates an object instance. 4403 4404As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 4405support for invoking the @code{- (id) .cxx_construct} and 4406@code{- (void) .cxx_destruct} methods. 4407 4408@item -fobjc-direct-dispatch 4409@opindex fobjc-direct-dispatch 4410Allow fast jumps to the message dispatcher. On Darwin this is 4411accomplished via the comm page. 4412 4413@item -fobjc-exceptions 4414@opindex fobjc-exceptions 4415Enable syntactic support for structured exception handling in 4416Objective-C, similar to what is offered by C++. This option 4417is required to use the Objective-C keywords @code{@@try}, 4418@code{@@throw}, @code{@@catch}, @code{@@finally} and 4419@code{@@synchronized}. This option is available with both the GNU 4420runtime and the NeXT runtime (but not available in conjunction with 4421the NeXT runtime on Mac OS X 10.2 and earlier). 4422 4423@item -fobjc-gc 4424@opindex fobjc-gc 4425Enable garbage collection (GC) in Objective-C and Objective-C++ 4426programs. This option is only available with the NeXT runtime; the 4427GNU runtime has a different garbage collection implementation that 4428does not require special compiler flags. 4429 4430@item -fobjc-nilcheck 4431@opindex fobjc-nilcheck 4432For the NeXT runtime with version 2 of the ABI, check for a nil 4433receiver in method invocations before doing the actual method call. 4434This is the default and can be disabled using 4435@option{-fno-objc-nilcheck}. Class methods and super calls are never 4436checked for nil in this way no matter what this flag is set to. 4437Currently this flag does nothing when the GNU runtime, or an older 4438version of the NeXT runtime ABI, is used. 4439 4440@item -fobjc-std=objc1 4441@opindex fobjc-std 4442Conform to the language syntax of Objective-C 1.0, the language 4443recognized by GCC 4.0. This only affects the Objective-C additions to 4444the C/C++ language; it does not affect conformance to C/C++ standards, 4445which is controlled by the separate C/C++ dialect option flags. When 4446this option is used with the Objective-C or Objective-C++ compiler, 4447any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 4448This is useful if you need to make sure that your Objective-C code can 4449be compiled with older versions of GCC@. 4450 4451@item -freplace-objc-classes 4452@opindex freplace-objc-classes 4453Emit a special marker instructing @command{ld(1)} not to statically link in 4454the resulting object file, and allow @command{dyld(1)} to load it in at 4455run time instead. This is used in conjunction with the Fix-and-Continue 4456debugging mode, where the object file in question may be recompiled and 4457dynamically reloaded in the course of program execution, without the need 4458to restart the program itself. Currently, Fix-and-Continue functionality 4459is only available in conjunction with the NeXT runtime on Mac OS X 10.3 4460and later. 4461 4462@item -fzero-link 4463@opindex fzero-link 4464When compiling for the NeXT runtime, the compiler ordinarily replaces calls 4465to @code{objc_getClass("@dots{}")} (when the name of the class is known at 4466compile time) with static class references that get initialized at load time, 4467which improves run-time performance. Specifying the @option{-fzero-link} flag 4468suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 4469to be retained. This is useful in Zero-Link debugging mode, since it allows 4470for individual class implementations to be modified during program execution. 4471The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 4472regardless of command-line options. 4473 4474@item -fno-local-ivars 4475@opindex fno-local-ivars 4476@opindex flocal-ivars 4477By default instance variables in Objective-C can be accessed as if 4478they were local variables from within the methods of the class they're 4479declared in. This can lead to shadowing between instance variables 4480and other variables declared either locally inside a class method or 4481globally with the same name. Specifying the @option{-fno-local-ivars} 4482flag disables this behavior thus avoiding variable shadowing issues. 4483 4484@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} 4485@opindex fivar-visibility 4486Set the default instance variable visibility to the specified option 4487so that instance variables declared outside the scope of any access 4488modifier directives default to the specified visibility. 4489 4490@item -gen-decls 4491@opindex gen-decls 4492Dump interface declarations for all classes seen in the source file to a 4493file named @file{@var{sourcename}.decl}. 4494 4495@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 4496@opindex Wassign-intercept 4497@opindex Wno-assign-intercept 4498Warn whenever an Objective-C assignment is being intercepted by the 4499garbage collector. 4500 4501@item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)} 4502@opindex Wproperty-assign-default 4503@opindex Wno-property-assign-default 4504Do not warn if a property for an Objective-C object has no assign 4505semantics specified. 4506 4507@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 4508@opindex Wno-protocol 4509@opindex Wprotocol 4510If a class is declared to implement a protocol, a warning is issued for 4511every method in the protocol that is not implemented by the class. The 4512default behavior is to issue a warning for every method not explicitly 4513implemented in the class, even if a method implementation is inherited 4514from the superclass. If you use the @option{-Wno-protocol} option, then 4515methods inherited from the superclass are considered to be implemented, 4516and no warning is issued for them. 4517 4518@item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)} 4519@opindex Wobjc-root-class 4520Warn if a class interface lacks a superclass. Most classes will inherit 4521from @code{NSObject} (or @code{Object}) for example. When declaring 4522classes intended to be root classes, the warning can be suppressed by 4523marking their interfaces with @code{__attribute__((objc_root_class))}. 4524 4525@item -Wselector @r{(Objective-C and Objective-C++ only)} 4526@opindex Wselector 4527@opindex Wno-selector 4528Warn if multiple methods of different types for the same selector are 4529found during compilation. The check is performed on the list of methods 4530in the final stage of compilation. Additionally, a check is performed 4531for each selector appearing in a @code{@@selector(@dots{})} 4532expression, and a corresponding method for that selector has been found 4533during compilation. Because these checks scan the method table only at 4534the end of compilation, these warnings are not produced if the final 4535stage of compilation is not reached, for example because an error is 4536found during compilation, or because the @option{-fsyntax-only} option is 4537being used. 4538 4539@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 4540@opindex Wstrict-selector-match 4541@opindex Wno-strict-selector-match 4542Warn if multiple methods with differing argument and/or return types are 4543found for a given selector when attempting to send a message using this 4544selector to a receiver of type @code{id} or @code{Class}. When this flag 4545is off (which is the default behavior), the compiler omits such warnings 4546if any differences found are confined to types that share the same size 4547and alignment. 4548 4549@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 4550@opindex Wundeclared-selector 4551@opindex Wno-undeclared-selector 4552Warn if a @code{@@selector(@dots{})} expression referring to an 4553undeclared selector is found. A selector is considered undeclared if no 4554method with that name has been declared before the 4555@code{@@selector(@dots{})} expression, either explicitly in an 4556@code{@@interface} or @code{@@protocol} declaration, or implicitly in 4557an @code{@@implementation} section. This option always performs its 4558checks as soon as a @code{@@selector(@dots{})} expression is found, 4559while @option{-Wselector} only performs its checks in the final stage of 4560compilation. This also enforces the coding style convention 4561that methods and selectors must be declared before being used. 4562 4563@item -print-objc-runtime-info 4564@opindex print-objc-runtime-info 4565Generate C header describing the largest structure that is passed by 4566value, if any. 4567 4568@end table 4569 4570@node Diagnostic Message Formatting Options 4571@section Options to Control Diagnostic Messages Formatting 4572@cindex options to control diagnostics formatting 4573@cindex diagnostic messages 4574@cindex message formatting 4575 4576Traditionally, diagnostic messages have been formatted irrespective of 4577the output device's aspect (e.g.@: its width, @dots{}). You can use the 4578options described below 4579to control the formatting algorithm for diagnostic messages, 4580e.g.@: how many characters per line, how often source location 4581information should be reported. Note that some language front ends may not 4582honor these options. 4583 4584@table @gcctabopt 4585@item -fmessage-length=@var{n} 4586@opindex fmessage-length 4587Try to format error messages so that they fit on lines of about 4588@var{n} characters. If @var{n} is zero, then no line-wrapping is 4589done; each error message appears on a single line. This is the 4590default for all front ends. 4591 4592Note - this option also affects the display of the @samp{#error} and 4593@samp{#warning} pre-processor directives, and the @samp{deprecated} 4594function/type/variable attribute. It does not however affect the 4595@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas. 4596 4597@item -fdiagnostics-plain-output 4598This option requests that diagnostic output look as plain as possible, which 4599may be useful when running @command{dejagnu} or other utilities that need to 4600parse diagnostics output and prefer that it remain more stable over time. 4601@option{-fdiagnostics-plain-output} is currently equivalent to the following 4602options: 4603@gccoptlist{-fno-diagnostics-show-caret @gol 4604-fno-diagnostics-show-line-numbers @gol 4605-fdiagnostics-color=never @gol 4606-fdiagnostics-urls=never @gol 4607-fdiagnostics-path-format=separate-events} 4608In the future, if GCC changes the default appearance of its diagnostics, the 4609corresponding option to disable the new behavior will be added to this list. 4610 4611@item -fdiagnostics-show-location=once 4612@opindex fdiagnostics-show-location 4613Only meaningful in line-wrapping mode. Instructs the diagnostic messages 4614reporter to emit source location information @emph{once}; that is, in 4615case the message is too long to fit on a single physical line and has to 4616be wrapped, the source location won't be emitted (as prefix) again, 4617over and over, in subsequent continuation lines. This is the default 4618behavior. 4619 4620@item -fdiagnostics-show-location=every-line 4621Only meaningful in line-wrapping mode. Instructs the diagnostic 4622messages reporter to emit the same source location information (as 4623prefix) for physical lines that result from the process of breaking 4624a message which is too long to fit on a single line. 4625 4626@item -fdiagnostics-color[=@var{WHEN}] 4627@itemx -fno-diagnostics-color 4628@opindex fdiagnostics-color 4629@cindex highlight, color 4630@vindex GCC_COLORS @r{environment variable} 4631Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, 4632or @samp{auto}. The default depends on how the compiler has been configured, 4633it can be any of the above @var{WHEN} options or also @samp{never} 4634if @env{GCC_COLORS} environment variable isn't present in the environment, 4635and @samp{auto} otherwise. 4636@samp{auto} makes GCC use color only when the standard error is a terminal, 4637and when not executing in an emacs shell. 4638The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are 4639aliases for @option{-fdiagnostics-color=always} and 4640@option{-fdiagnostics-color=never}, respectively. 4641 4642The colors are defined by the environment variable @env{GCC_COLORS}. 4643Its value is a colon-separated list of capabilities and Select Graphic 4644Rendition (SGR) substrings. SGR commands are interpreted by the 4645terminal or terminal emulator. (See the section in the documentation 4646of your text terminal for permitted values and their meanings as 4647character attributes.) These substring values are integers in decimal 4648representation and can be concatenated with semicolons. 4649Common values to concatenate include 4650@samp{1} for bold, 4651@samp{4} for underline, 4652@samp{5} for blink, 4653@samp{7} for inverse, 4654@samp{39} for default foreground color, 4655@samp{30} to @samp{37} for foreground colors, 4656@samp{90} to @samp{97} for 16-color mode foreground colors, 4657@samp{38;5;0} to @samp{38;5;255} 4658for 88-color and 256-color modes foreground colors, 4659@samp{49} for default background color, 4660@samp{40} to @samp{47} for background colors, 4661@samp{100} to @samp{107} for 16-color mode background colors, 4662and @samp{48;5;0} to @samp{48;5;255} 4663for 88-color and 256-color modes background colors. 4664 4665The default @env{GCC_COLORS} is 4666@smallexample 4667error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\ 4668quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\ 4669diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ 4670type-diff=01;32 4671@end smallexample 4672@noindent 4673where @samp{01;31} is bold red, @samp{01;35} is bold magenta, 4674@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue, 4675@samp{01} is bold, and @samp{31} is red. 4676Setting @env{GCC_COLORS} to the empty string disables colors. 4677Supported capabilities are as follows. 4678 4679@table @code 4680@item error= 4681@vindex error GCC_COLORS @r{capability} 4682SGR substring for error: markers. 4683 4684@item warning= 4685@vindex warning GCC_COLORS @r{capability} 4686SGR substring for warning: markers. 4687 4688@item note= 4689@vindex note GCC_COLORS @r{capability} 4690SGR substring for note: markers. 4691 4692@item path= 4693@vindex path GCC_COLORS @r{capability} 4694SGR substring for colorizing paths of control-flow events as printed 4695via @option{-fdiagnostics-path-format=}, such as the identifiers of 4696individual events and lines indicating interprocedural calls and returns. 4697 4698@item range1= 4699@vindex range1 GCC_COLORS @r{capability} 4700SGR substring for first additional range. 4701 4702@item range2= 4703@vindex range2 GCC_COLORS @r{capability} 4704SGR substring for second additional range. 4705 4706@item locus= 4707@vindex locus GCC_COLORS @r{capability} 4708SGR substring for location information, @samp{file:line} or 4709@samp{file:line:column} etc. 4710 4711@item quote= 4712@vindex quote GCC_COLORS @r{capability} 4713SGR substring for information printed within quotes. 4714 4715@item fixit-insert= 4716@vindex fixit-insert GCC_COLORS @r{capability} 4717SGR substring for fix-it hints suggesting text to 4718be inserted or replaced. 4719 4720@item fixit-delete= 4721@vindex fixit-delete GCC_COLORS @r{capability} 4722SGR substring for fix-it hints suggesting text to 4723be deleted. 4724 4725@item diff-filename= 4726@vindex diff-filename GCC_COLORS @r{capability} 4727SGR substring for filename headers within generated patches. 4728 4729@item diff-hunk= 4730@vindex diff-hunk GCC_COLORS @r{capability} 4731SGR substring for the starts of hunks within generated patches. 4732 4733@item diff-delete= 4734@vindex diff-delete GCC_COLORS @r{capability} 4735SGR substring for deleted lines within generated patches. 4736 4737@item diff-insert= 4738@vindex diff-insert GCC_COLORS @r{capability} 4739SGR substring for inserted lines within generated patches. 4740 4741@item type-diff= 4742@vindex type-diff GCC_COLORS @r{capability} 4743SGR substring for highlighting mismatching types within template 4744arguments in the C++ frontend. 4745@end table 4746 4747@item -fdiagnostics-urls[=@var{WHEN}] 4748@opindex fdiagnostics-urls 4749@cindex urls 4750@vindex GCC_URLS @r{environment variable} 4751@vindex TERM_URLS @r{environment variable} 4752Use escape sequences to embed URLs in diagnostics. For example, when 4753@option{-fdiagnostics-show-option} emits text showing the command-line 4754option controlling a diagnostic, embed a URL for documentation of that 4755option. 4756 4757@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}. 4758@samp{auto} makes GCC use URL escape sequences only when the standard error 4759is a terminal, and when not executing in an emacs shell or any graphical 4760terminal which is known to be incompatible with this feature, see below. 4761 4762The default depends on how the compiler has been configured. 4763It can be any of the above @var{WHEN} options. 4764 4765GCC can also be configured (via the 4766@option{--with-diagnostics-urls=auto-if-env} configure-time option) 4767so that the default is affected by environment variables. 4768Under such a configuration, GCC defaults to using @samp{auto} 4769if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are 4770present and non-empty in the environment of the compiler, or @samp{never} 4771if neither are. 4772 4773However, even with @option{-fdiagnostics-urls=always} the behavior is 4774dependent on those environment variables: 4775If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in 4776diagnostics. If set to @samp{st}, URLs use ST escape sequences. 4777If set to @samp{bel}, the default, URLs use BEL escape sequences. 4778Any other non-empty value enables the feature. 4779If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback. 4780Note: ST is an ANSI escape sequence, string terminator @samp{ESC \}, 4781BEL is an ASCII character, CTRL-G that usually sounds like a beep. 4782 4783At this time GCC tries to detect also a few terminals that are known to 4784not implement the URL feature, and have bugs or at least had bugs in 4785some versions that are still in use, where the URL escapes are likely 4786to misbehave, i.e. print garbage on the screen. 4787That list is currently xfce4-terminal, certain known to be buggy 4788gnome-terminal versions, the linux console, and mingw. 4789This check can be skipped with the @option{-fdiagnostics-urls=always}. 4790 4791@item -fno-diagnostics-show-option 4792@opindex fno-diagnostics-show-option 4793@opindex fdiagnostics-show-option 4794By default, each diagnostic emitted includes text indicating the 4795command-line option that directly controls the diagnostic (if such an 4796option is known to the diagnostic machinery). Specifying the 4797@option{-fno-diagnostics-show-option} flag suppresses that behavior. 4798 4799@item -fno-diagnostics-show-caret 4800@opindex fno-diagnostics-show-caret 4801@opindex fdiagnostics-show-caret 4802By default, each diagnostic emitted includes the original source line 4803and a caret @samp{^} indicating the column. This option suppresses this 4804information. The source line is truncated to @var{n} characters, if 4805the @option{-fmessage-length=n} option is given. When the output is done 4806to the terminal, the width is limited to the width given by the 4807@env{COLUMNS} environment variable or, if not set, to the terminal width. 4808 4809@item -fno-diagnostics-show-labels 4810@opindex fno-diagnostics-show-labels 4811@opindex fdiagnostics-show-labels 4812By default, when printing source code (via @option{-fdiagnostics-show-caret}), 4813diagnostics can label ranges of source code with pertinent information, such 4814as the types of expressions: 4815 4816@smallexample 4817 printf ("foo %s bar", long_i + long_j); 4818 ~^ ~~~~~~~~~~~~~~~ 4819 | | 4820 char * long int 4821@end smallexample 4822 4823This option suppresses the printing of these labels (in the example above, 4824the vertical bars and the ``char *'' and ``long int'' text). 4825 4826@item -fno-diagnostics-show-cwe 4827@opindex fno-diagnostics-show-cwe 4828@opindex fdiagnostics-show-cwe 4829Diagnostic messages can optionally have an associated 4830@url{https://cwe.mitre.org/index.html, CWE} identifier. 4831GCC itself only provides such metadata for some of the @option{-fanalyzer} 4832diagnostics. GCC plugins may also provide diagnostics with such metadata. 4833By default, if this information is present, it will be printed with 4834the diagnostic. This option suppresses the printing of this metadata. 4835 4836@item -fno-diagnostics-show-line-numbers 4837@opindex fno-diagnostics-show-line-numbers 4838@opindex fdiagnostics-show-line-numbers 4839By default, when printing source code (via @option{-fdiagnostics-show-caret}), 4840a left margin is printed, showing line numbers. This option suppresses this 4841left margin. 4842 4843@item -fdiagnostics-minimum-margin-width=@var{width} 4844@opindex fdiagnostics-minimum-margin-width 4845This option controls the minimum width of the left margin printed by 4846@option{-fdiagnostics-show-line-numbers}. It defaults to 6. 4847 4848@item -fdiagnostics-parseable-fixits 4849@opindex fdiagnostics-parseable-fixits 4850Emit fix-it hints in a machine-parseable format, suitable for consumption 4851by IDEs. For each fix-it, a line will be printed after the relevant 4852diagnostic, starting with the string ``fix-it:''. For example: 4853 4854@smallexample 4855fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all" 4856@end smallexample 4857 4858The location is expressed as a half-open range, expressed as a count of 4859bytes, starting at byte 1 for the initial column. In the above example, 4860bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the 4861given string: 4862 4863@smallexample 486400000000011111111112222222222 486512345678901234567890123456789 4866 gtk_widget_showall (dlg); 4867 ^^^^^^^^^^^^^^^^^^ 4868 gtk_widget_show_all 4869@end smallexample 4870 4871The filename and replacement string escape backslash as ``\\", tab as ``\t'', 4872newline as ``\n'', double quotes as ``\"'', non-printable characters as octal 4873(e.g. vertical tab as ``\013''). 4874 4875An empty replacement string indicates that the given range is to be removed. 4876An empty range (e.g. ``45:3-45:3'') indicates that the string is to 4877be inserted at the given position. 4878 4879@item -fdiagnostics-generate-patch 4880@opindex fdiagnostics-generate-patch 4881Print fix-it hints to stderr in unified diff format, after any diagnostics 4882are printed. For example: 4883 4884@smallexample 4885--- test.c 4886+++ test.c 4887@@ -42,5 +42,5 @@ 4888 4889 void show_cb(GtkDialog *dlg) 4890 @{ 4891- gtk_widget_showall(dlg); 4892+ gtk_widget_show_all(dlg); 4893 @} 4894 4895@end smallexample 4896 4897The diff may or may not be colorized, following the same rules 4898as for diagnostics (see @option{-fdiagnostics-color}). 4899 4900@item -fdiagnostics-show-template-tree 4901@opindex fdiagnostics-show-template-tree 4902 4903In the C++ frontend, when printing diagnostics showing mismatching 4904template types, such as: 4905 4906@smallexample 4907 could not convert 'std::map<int, std::vector<double> >()' 4908 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 4909@end smallexample 4910 4911the @option{-fdiagnostics-show-template-tree} flag enables printing a 4912tree-like structure showing the common and differing parts of the types, 4913such as: 4914 4915@smallexample 4916 map< 4917 [...], 4918 vector< 4919 [double != float]>> 4920@end smallexample 4921 4922The parts that differ are highlighted with color (``double'' and 4923``float'' in this case). 4924 4925@item -fno-elide-type 4926@opindex fno-elide-type 4927@opindex felide-type 4928By default when the C++ frontend prints diagnostics showing mismatching 4929template types, common parts of the types are printed as ``[...]'' to 4930simplify the error message. For example: 4931 4932@smallexample 4933 could not convert 'std::map<int, std::vector<double> >()' 4934 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 4935@end smallexample 4936 4937Specifying the @option{-fno-elide-type} flag suppresses that behavior. 4938This flag also affects the output of the 4939@option{-fdiagnostics-show-template-tree} flag. 4940 4941@item -fdiagnostics-path-format=@var{KIND} 4942@opindex fdiagnostics-path-format 4943Specify how to print paths of control-flow events for diagnostics that 4944have such a path associated with them. 4945 4946@var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events}, 4947the default. 4948 4949@samp{none} means to not print diagnostic paths. 4950 4951@samp{separate-events} means to print a separate ``note'' diagnostic for 4952each event within the diagnostic. For example: 4953 4954@smallexample 4955test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter 4956test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL 4957test.c:27:3: note: (2) when 'i < count' 4958test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1 4959@end smallexample 4960 4961@samp{inline-events} means to print the events ``inline'' within the source 4962code. This view attempts to consolidate the events into runs of 4963sufficiently-close events, printing them as labelled ranges within the source. 4964 4965For example, the same events as above might be printed as: 4966 4967@smallexample 4968 'test': events 1-3 4969 | 4970 | 25 | list = PyList_New(0); 4971 | | ^~~~~~~~~~~~~ 4972 | | | 4973 | | (1) when 'PyList_New' fails, returning NULL 4974 | 26 | 4975 | 27 | for (i = 0; i < count; i++) @{ 4976 | | ~~~ 4977 | | | 4978 | | (2) when 'i < count' 4979 | 28 | item = PyLong_FromLong(random()); 4980 | 29 | PyList_Append(list, item); 4981 | | ~~~~~~~~~~~~~~~~~~~~~~~~~ 4982 | | | 4983 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1 4984 | 4985@end smallexample 4986 4987Interprocedural control flow is shown by grouping the events by stack frame, 4988and using indentation to show how stack frames are nested, pushed, and popped. 4989 4990For example: 4991 4992@smallexample 4993 'test': events 1-2 4994 | 4995 | 133 | @{ 4996 | | ^ 4997 | | | 4998 | | (1) entering 'test' 4999 | 134 | boxed_int *obj = make_boxed_int (i); 5000 | | ~~~~~~~~~~~~~~~~~~ 5001 | | | 5002 | | (2) calling 'make_boxed_int' 5003 | 5004 +--> 'make_boxed_int': events 3-4 5005 | 5006 | 120 | @{ 5007 | | ^ 5008 | | | 5009 | | (3) entering 'make_boxed_int' 5010 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int)); 5011 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5012 | | | 5013 | | (4) calling 'wrapped_malloc' 5014 | 5015 +--> 'wrapped_malloc': events 5-6 5016 | 5017 | 7 | @{ 5018 | | ^ 5019 | | | 5020 | | (5) entering 'wrapped_malloc' 5021 | 8 | return malloc (size); 5022 | | ~~~~~~~~~~~~~ 5023 | | | 5024 | | (6) calling 'malloc' 5025 | 5026 <-------------+ 5027 | 5028 'test': event 7 5029 | 5030 | 138 | free_boxed_int (obj); 5031 | | ^~~~~~~~~~~~~~~~~~~~ 5032 | | | 5033 | | (7) calling 'free_boxed_int' 5034 | 5035(etc) 5036@end smallexample 5037 5038@item -fdiagnostics-show-path-depths 5039@opindex fdiagnostics-show-path-depths 5040This option provides additional information when printing control-flow paths 5041associated with a diagnostic. 5042 5043If this is option is provided then the stack depth will be printed for 5044each run of events within @option{-fdiagnostics-path-format=separate-events}. 5045 5046This is intended for use by GCC developers and plugin developers when 5047debugging diagnostics that report interprocedural control flow. 5048 5049@item -fno-show-column 5050@opindex fno-show-column 5051@opindex fshow-column 5052Do not print column numbers in diagnostics. This may be necessary if 5053diagnostics are being scanned by a program that does not understand the 5054column numbers, such as @command{dejagnu}. 5055 5056@item -fdiagnostics-column-unit=@var{UNIT} 5057@opindex fdiagnostics-column-unit 5058Select the units for the column number. This affects traditional diagnostics 5059(in the absence of @option{-fno-show-column}), as well as JSON format 5060diagnostics if requested. 5061 5062The default @var{UNIT}, @samp{display}, considers the number of display 5063columns occupied by each character. This may be larger than the number 5064of bytes required to encode the character, in the case of tab 5065characters, or it may be smaller, in the case of multibyte characters. 5066For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one 5067display column, and its UTF-8 encoding requires two bytes; the character 5068``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and 5069its UTF-8 encoding requires four bytes. 5070 5071Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte 5072count in all cases, as was traditionally output by GCC prior to version 11.1.0. 5073 5074@item -fdiagnostics-column-origin=@var{ORIGIN} 5075@opindex fdiagnostics-column-origin 5076Select the origin for column numbers, i.e. the column number assigned to the 5077first column. The default value of 1 corresponds to traditional GCC 5078behavior and to the GNU style guide. Some utilities may perform better with an 5079origin of 0; any non-negative value may be specified. 5080 5081@item -fdiagnostics-format=@var{FORMAT} 5082@opindex fdiagnostics-format 5083Select a different format for printing diagnostics. 5084@var{FORMAT} is @samp{text} or @samp{json}. 5085The default is @samp{text}. 5086 5087The @samp{json} format consists of a top-level JSON array containing JSON 5088objects representing the diagnostics. 5089 5090The JSON is emitted as one line, without formatting; the examples below 5091have been formatted for clarity. 5092 5093Diagnostics can have child diagnostics. For example, this error and note: 5094 5095@smallexample 5096misleading-indentation.c:15:3: warning: this 'if' clause does not 5097 guard... [-Wmisleading-indentation] 5098 15 | if (flag) 5099 | ^~ 5100misleading-indentation.c:17:5: note: ...this statement, but the latter 5101 is misleadingly indented as if it were guarded by the 'if' 5102 17 | y = 2; 5103 | ^ 5104@end smallexample 5105 5106@noindent 5107might be printed in JSON form (after formatting) like this: 5108 5109@smallexample 5110[ 5111 @{ 5112 "kind": "warning", 5113 "locations": [ 5114 @{ 5115 "caret": @{ 5116 "display-column": 3, 5117 "byte-column": 3, 5118 "column": 3, 5119 "file": "misleading-indentation.c", 5120 "line": 15 5121 @}, 5122 "finish": @{ 5123 "display-column": 4, 5124 "byte-column": 4, 5125 "column": 4, 5126 "file": "misleading-indentation.c", 5127 "line": 15 5128 @} 5129 @} 5130 ], 5131 "message": "this \u2018if\u2019 clause does not guard...", 5132 "option": "-Wmisleading-indentation", 5133 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation", 5134 "children": [ 5135 @{ 5136 "kind": "note", 5137 "locations": [ 5138 @{ 5139 "caret": @{ 5140 "display-column": 5, 5141 "byte-column": 5, 5142 "column": 5, 5143 "file": "misleading-indentation.c", 5144 "line": 17 5145 @} 5146 @} 5147 ], 5148 "message": "...this statement, but the latter is @dots{}" 5149 @} 5150 ] 5151 "column-origin": 1, 5152 @}, 5153 @dots{} 5154] 5155@end smallexample 5156 5157@noindent 5158where the @code{note} is a child of the @code{warning}. 5159 5160A diagnostic has a @code{kind}. If this is @code{warning}, then there is 5161an @code{option} key describing the command-line option controlling the 5162warning. 5163 5164A diagnostic can contain zero or more locations. Each location has an 5165optional @code{label} string and up to three positions within it: a 5166@code{caret} position and optional @code{start} and @code{finish} positions. 5167A position is described by a @code{file} name, a @code{line} number, and 5168three numbers indicating a column position: 5169@itemize @bullet 5170 5171@item 5172@code{display-column} counts display columns, accounting for tabs and 5173multibyte characters. 5174 5175@item 5176@code{byte-column} counts raw bytes. 5177 5178@item 5179@code{column} is equal to one of 5180the previous two, as dictated by the @option{-fdiagnostics-column-unit} 5181option. 5182 5183@end itemize 5184All three columns are relative to the origin specified by 5185@option{-fdiagnostics-column-origin}, which is typically equal to 1 but may 5186be set, for instance, to 0 for compatibility with other utilities that 5187number columns from 0. The column origin is recorded in the JSON output in 5188the @code{column-origin} tag. In the remaining examples below, the extra 5189column number outputs have been omitted for brevity. 5190 5191For example, this error: 5192 5193@smallexample 5194bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka 5195 'struct s'@} and 'T' @{aka 'struct t'@}) 5196 64 | return callee_4a () + callee_4b (); 5197 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ 5198 | | | 5199 | | T @{aka struct t@} 5200 | S @{aka struct s@} 5201@end smallexample 5202 5203@noindent 5204has three locations. Its primary location is at the ``+'' token at column 520523. It has two secondary locations, describing the left and right-hand sides 5206of the expression, which have labels. It might be printed in JSON form as: 5207 5208@smallexample 5209 @{ 5210 "children": [], 5211 "kind": "error", 5212 "locations": [ 5213 @{ 5214 "caret": @{ 5215 "column": 23, "file": "bad-binary-ops.c", "line": 64 5216 @} 5217 @}, 5218 @{ 5219 "caret": @{ 5220 "column": 10, "file": "bad-binary-ops.c", "line": 64 5221 @}, 5222 "finish": @{ 5223 "column": 21, "file": "bad-binary-ops.c", "line": 64 5224 @}, 5225 "label": "S @{aka struct s@}" 5226 @}, 5227 @{ 5228 "caret": @{ 5229 "column": 25, "file": "bad-binary-ops.c", "line": 64 5230 @}, 5231 "finish": @{ 5232 "column": 36, "file": "bad-binary-ops.c", "line": 64 5233 @}, 5234 "label": "T @{aka struct t@}" 5235 @} 5236 ], 5237 "message": "invalid operands to binary + @dots{}" 5238 @} 5239@end smallexample 5240 5241If a diagnostic contains fix-it hints, it has a @code{fixits} array, 5242consisting of half-open intervals, similar to the output of 5243@option{-fdiagnostics-parseable-fixits}. For example, this diagnostic 5244with a replacement fix-it hint: 5245 5246@smallexample 5247demo.c:8:15: error: 'struct s' has no member named 'colour'; did you 5248 mean 'color'? 5249 8 | return ptr->colour; 5250 | ^~~~~~ 5251 | color 5252@end smallexample 5253 5254@noindent 5255might be printed in JSON form as: 5256 5257@smallexample 5258 @{ 5259 "children": [], 5260 "fixits": [ 5261 @{ 5262 "next": @{ 5263 "column": 21, 5264 "file": "demo.c", 5265 "line": 8 5266 @}, 5267 "start": @{ 5268 "column": 15, 5269 "file": "demo.c", 5270 "line": 8 5271 @}, 5272 "string": "color" 5273 @} 5274 ], 5275 "kind": "error", 5276 "locations": [ 5277 @{ 5278 "caret": @{ 5279 "column": 15, 5280 "file": "demo.c", 5281 "line": 8 5282 @}, 5283 "finish": @{ 5284 "column": 20, 5285 "file": "demo.c", 5286 "line": 8 5287 @} 5288 @} 5289 ], 5290 "message": "\u2018struct s\u2019 has no member named @dots{}" 5291 @} 5292@end smallexample 5293 5294@noindent 5295where the fix-it hint suggests replacing the text from @code{start} up 5296to but not including @code{next} with @code{string}'s value. Deletions 5297are expressed via an empty value for @code{string}, insertions by 5298having @code{start} equal @code{next}. 5299 5300If the diagnostic has a path of control-flow events associated with it, 5301it has a @code{path} array of objects representing the events. Each 5302event object has a @code{description} string, a @code{location} object, 5303along with a @code{function} string and a @code{depth} number for 5304representing interprocedural paths. The @code{function} represents the 5305current function at that event, and the @code{depth} represents the 5306stack depth relative to some baseline: the higher, the more frames are 5307within the stack. 5308 5309For example, the intraprocedural example shown for 5310@option{-fdiagnostics-path-format=} might have this JSON for its path: 5311 5312@smallexample 5313 "path": [ 5314 @{ 5315 "depth": 0, 5316 "description": "when 'PyList_New' fails, returning NULL", 5317 "function": "test", 5318 "location": @{ 5319 "column": 10, 5320 "file": "test.c", 5321 "line": 25 5322 @} 5323 @}, 5324 @{ 5325 "depth": 0, 5326 "description": "when 'i < count'", 5327 "function": "test", 5328 "location": @{ 5329 "column": 3, 5330 "file": "test.c", 5331 "line": 27 5332 @} 5333 @}, 5334 @{ 5335 "depth": 0, 5336 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1", 5337 "function": "test", 5338 "location": @{ 5339 "column": 5, 5340 "file": "test.c", 5341 "line": 29 5342 @} 5343 @} 5344 ] 5345@end smallexample 5346 5347@end table 5348 5349@node Warning Options 5350@section Options to Request or Suppress Warnings 5351@cindex options to control warnings 5352@cindex warning messages 5353@cindex messages, warning 5354@cindex suppressing warnings 5355 5356Warnings are diagnostic messages that report constructions that 5357are not inherently erroneous but that are risky or suggest there 5358may have been an error. 5359 5360The following language-independent options do not enable specific 5361warnings but control the kinds of diagnostics produced by GCC@. 5362 5363@table @gcctabopt 5364@cindex syntax checking 5365@item -fsyntax-only 5366@opindex fsyntax-only 5367Check the code for syntax errors, but don't do anything beyond that. 5368 5369@item -fmax-errors=@var{n} 5370@opindex fmax-errors 5371Limits the maximum number of error messages to @var{n}, at which point 5372GCC bails out rather than attempting to continue processing the source 5373code. If @var{n} is 0 (the default), there is no limit on the number 5374of error messages produced. If @option{-Wfatal-errors} is also 5375specified, then @option{-Wfatal-errors} takes precedence over this 5376option. 5377 5378@item -w 5379@opindex w 5380Inhibit all warning messages. 5381 5382@item -Werror 5383@opindex Werror 5384@opindex Wno-error 5385Make all warnings into errors. 5386 5387@item -Werror= 5388@opindex Werror= 5389@opindex Wno-error= 5390Make the specified warning into an error. The specifier for a warning 5391is appended; for example @option{-Werror=switch} turns the warnings 5392controlled by @option{-Wswitch} into errors. This switch takes a 5393negative form, to be used to negate @option{-Werror} for specific 5394warnings; for example @option{-Wno-error=switch} makes 5395@option{-Wswitch} warnings not be errors, even when @option{-Werror} 5396is in effect. 5397 5398The warning message for each controllable warning includes the 5399option that controls the warning. That option can then be used with 5400@option{-Werror=} and @option{-Wno-error=} as described above. 5401(Printing of the option in the warning message can be disabled using the 5402@option{-fno-diagnostics-show-option} flag.) 5403 5404Note that specifying @option{-Werror=}@var{foo} automatically implies 5405@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 5406imply anything. 5407 5408@item -Wfatal-errors 5409@opindex Wfatal-errors 5410@opindex Wno-fatal-errors 5411This option causes the compiler to abort compilation on the first error 5412occurred rather than trying to keep going and printing further error 5413messages. 5414 5415@end table 5416 5417You can request many specific warnings with options beginning with 5418@samp{-W}, for example @option{-Wimplicit} to request warnings on 5419implicit declarations. Each of these specific warning options also 5420has a negative form beginning @samp{-Wno-} to turn off warnings; for 5421example, @option{-Wno-implicit}. This manual lists only one of the 5422two forms, whichever is not the default. For further 5423language-specific options also refer to @ref{C++ Dialect Options} and 5424@ref{Objective-C and Objective-C++ Dialect Options}. 5425Additional warnings can be produced by enabling the static analyzer; 5426@xref{Static Analyzer Options}. 5427 5428Some options, such as @option{-Wall} and @option{-Wextra}, turn on other 5429options, such as @option{-Wunused}, which may turn on further options, 5430such as @option{-Wunused-value}. The combined effect of positive and 5431negative forms is that more specific options have priority over less 5432specific ones, independently of their position in the command-line. For 5433options of the same specificity, the last one takes effect. Options 5434enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect 5435as if they appeared at the end of the command-line. 5436 5437When an unrecognized warning option is requested (e.g., 5438@option{-Wunknown-warning}), GCC emits a diagnostic stating 5439that the option is not recognized. However, if the @option{-Wno-} form 5440is used, the behavior is slightly different: no diagnostic is 5441produced for @option{-Wno-unknown-warning} unless other diagnostics 5442are being produced. This allows the use of new @option{-Wno-} options 5443with old compilers, but if something goes wrong, the compiler 5444warns that an unrecognized option is present. 5445 5446The effectiveness of some warnings depends on optimizations also being 5447enabled. For example @option{-Wsuggest-final-types} is more effective 5448with link-time optimization and @option{-Wmaybe-uninitialized} does not 5449warn at all unless optimization is enabled. 5450 5451@table @gcctabopt 5452@item -Wpedantic 5453@itemx -pedantic 5454@opindex pedantic 5455@opindex Wpedantic 5456@opindex Wno-pedantic 5457Issue all the warnings demanded by strict ISO C and ISO C++; 5458reject all programs that use forbidden extensions, and some other 5459programs that do not follow ISO C and ISO C++. For ISO C, follows the 5460version of the ISO C standard specified by any @option{-std} option used. 5461 5462Valid ISO C and ISO C++ programs should compile properly with or without 5463this option (though a rare few require @option{-ansi} or a 5464@option{-std} option specifying the required version of ISO C)@. However, 5465without this option, certain GNU extensions and traditional C and C++ 5466features are supported as well. With this option, they are rejected. 5467 5468@option{-Wpedantic} does not cause warning messages for use of the 5469alternate keywords whose names begin and end with @samp{__}. This alternate 5470format can also be used to disable warnings for non-ISO @samp{__intN} types, 5471i.e. @samp{__intN__}. 5472Pedantic warnings are also disabled in the expression that follows 5473@code{__extension__}. However, only system header files should use 5474these escape routes; application programs should avoid them. 5475@xref{Alternate Keywords}. 5476 5477Some users try to use @option{-Wpedantic} to check programs for strict ISO 5478C conformance. They soon find that it does not do quite what they want: 5479it finds some non-ISO practices, but not all---only those for which 5480ISO C @emph{requires} a diagnostic, and some others for which 5481diagnostics have been added. 5482 5483A feature to report any failure to conform to ISO C might be useful in 5484some instances, but would require considerable additional work and would 5485be quite different from @option{-Wpedantic}. We don't have plans to 5486support such a feature in the near future. 5487 5488Where the standard specified with @option{-std} represents a GNU 5489extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 5490corresponding @dfn{base standard}, the version of ISO C on which the GNU 5491extended dialect is based. Warnings from @option{-Wpedantic} are given 5492where they are required by the base standard. (It does not make sense 5493for such warnings to be given only for features not in the specified GNU 5494C dialect, since by definition the GNU dialects of C include all 5495features the compiler supports with the given option, and there would be 5496nothing to warn about.) 5497 5498@item -pedantic-errors 5499@opindex pedantic-errors 5500Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 5501requires a diagnostic, in some cases where there is undefined behavior 5502at compile-time and in some other cases that do not prevent compilation 5503of programs that are valid according to the standard. This is not 5504equivalent to @option{-Werror=pedantic}, since there are errors enabled 5505by this option and not enabled by the latter and vice versa. 5506 5507@item -Wall 5508@opindex Wall 5509@opindex Wno-all 5510This enables all the warnings about constructions that some users 5511consider questionable, and that are easy to avoid (or modify to 5512prevent the warning), even in conjunction with macros. This also 5513enables some language-specific warnings described in @ref{C++ Dialect 5514Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 5515 5516@option{-Wall} turns on the following warning flags: 5517 5518@gccoptlist{-Waddress @gol 5519-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 5520-Warray-parameter=2 @r{(C and Objective-C only)} @gol 5521-Wbool-compare @gol 5522-Wbool-operation @gol 5523-Wc++11-compat -Wc++14-compat @gol 5524-Wcatch-value @r{(C++ and Objective-C++ only)} @gol 5525-Wchar-subscripts @gol 5526-Wcomment @gol 5527-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol 5528-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 5529-Wformat @gol 5530-Wformat-overflow @gol 5531-Wformat-truncation @gol 5532-Wint-in-bool-context @gol 5533-Wimplicit @r{(C and Objective-C only)} @gol 5534-Wimplicit-int @r{(C and Objective-C only)} @gol 5535-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 5536-Winit-self @r{(only for C++)} @gol 5537-Wlogical-not-parentheses @gol 5538-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 5539-Wmaybe-uninitialized @gol 5540-Wmemset-elt-size @gol 5541-Wmemset-transposed-args @gol 5542-Wmisleading-indentation @r{(only for C/C++)} @gol 5543-Wmissing-attributes @gol 5544-Wmissing-braces @r{(only for C/ObjC)} @gol 5545-Wmultistatement-macros @gol 5546-Wnarrowing @r{(only for C++)} @gol 5547-Wnonnull @gol 5548-Wnonnull-compare @gol 5549-Wopenmp-simd @gol 5550-Wparentheses @gol 5551-Wpessimizing-move @r{(only for C++)} @gol 5552-Wpointer-sign @gol 5553-Wrange-loop-construct @r{(only for C++)} @gol 5554-Wreorder @gol 5555-Wrestrict @gol 5556-Wreturn-type @gol 5557-Wsequence-point @gol 5558-Wsign-compare @r{(only in C++)} @gol 5559-Wsizeof-array-div @gol 5560-Wsizeof-pointer-div @gol 5561-Wsizeof-pointer-memaccess @gol 5562-Wstrict-aliasing @gol 5563-Wstrict-overflow=1 @gol 5564-Wswitch @gol 5565-Wtautological-compare @gol 5566-Wtrigraphs @gol 5567-Wuninitialized @gol 5568-Wunknown-pragmas @gol 5569-Wunused-function @gol 5570-Wunused-label @gol 5571-Wunused-value @gol 5572-Wunused-variable @gol 5573-Wvla-parameter @r{(C and Objective-C only)} @gol 5574-Wvolatile-register-var @gol 5575-Wzero-length-bounds} 5576 5577Note that some warning flags are not implied by @option{-Wall}. Some of 5578them warn about constructions that users generally do not consider 5579questionable, but which occasionally you might wish to check for; 5580others warn about constructions that are necessary or hard to avoid in 5581some cases, and there is no simple way to modify the code to suppress 5582the warning. Some of them are enabled by @option{-Wextra} but many of 5583them must be enabled individually. 5584 5585@item -Wextra 5586@opindex W 5587@opindex Wextra 5588@opindex Wno-extra 5589This enables some extra warning flags that are not enabled by 5590@option{-Wall}. (This option used to be called @option{-W}. The older 5591name is still supported, but the newer name is more descriptive.) 5592 5593@gccoptlist{-Wclobbered @gol 5594-Wcast-function-type @gol 5595-Wdeprecated-copy @r{(C++ only)} @gol 5596-Wempty-body @gol 5597-Wenum-conversion @r{(C only)} @gol 5598-Wignored-qualifiers @gol 5599-Wimplicit-fallthrough=3 @gol 5600-Wmissing-field-initializers @gol 5601-Wmissing-parameter-type @r{(C only)} @gol 5602-Wold-style-declaration @r{(C only)} @gol 5603-Woverride-init @gol 5604-Wsign-compare @r{(C only)} @gol 5605-Wstring-compare @gol 5606-Wredundant-move @r{(only for C++)} @gol 5607-Wtype-limits @gol 5608-Wuninitialized @gol 5609-Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol 5610-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 5611-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}} 5612 5613 5614The option @option{-Wextra} also prints warning messages for the 5615following cases: 5616 5617@itemize @bullet 5618 5619@item 5620A pointer is compared against integer zero with @code{<}, @code{<=}, 5621@code{>}, or @code{>=}. 5622 5623@item 5624(C++ only) An enumerator and a non-enumerator both appear in a 5625conditional expression. 5626 5627@item 5628(C++ only) Ambiguous virtual bases. 5629 5630@item 5631(C++ only) Subscripting an array that has been declared @code{register}. 5632 5633@item 5634(C++ only) Taking the address of a variable that has been declared 5635@code{register}. 5636 5637@item 5638(C++ only) A base class is not initialized in the copy constructor 5639of a derived class. 5640 5641@end itemize 5642 5643@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 5644@opindex Wabi 5645@opindex Wno-abi 5646 5647Warn about code affected by ABI changes. This includes code that may 5648not be compatible with the vendor-neutral C++ ABI as well as the psABI 5649for the particular target. 5650 5651Since G++ now defaults to updating the ABI with each major release, 5652normally @option{-Wabi} warns only about C++ ABI compatibility 5653problems if there is a check added later in a release series for an 5654ABI issue discovered since the initial release. @option{-Wabi} warns 5655about more things if an older ABI version is selected (with 5656@option{-fabi-version=@var{n}}). 5657 5658@option{-Wabi} can also be used with an explicit version number to 5659warn about C++ ABI compatibility with a particular @option{-fabi-version} 5660level, e.g.@: @option{-Wabi=2} to warn about changes relative to 5661@option{-fabi-version=2}. 5662 5663If an explicit version number is provided and 5664@option{-fabi-compat-version} is not specified, the version number 5665from this option is used for compatibility aliases. If no explicit 5666version number is provided with this option, but 5667@option{-fabi-compat-version} is specified, that version number is 5668used for C++ ABI warnings. 5669 5670Although an effort has been made to warn about 5671all such cases, there are probably some cases that are not warned about, 5672even though G++ is generating incompatible code. There may also be 5673cases where warnings are emitted even though the code that is generated 5674is compatible. 5675 5676You should rewrite your code to avoid these warnings if you are 5677concerned about the fact that code generated by G++ may not be binary 5678compatible with code generated by other compilers. 5679 5680Known incompatibilities in @option{-fabi-version=2} (which was the 5681default from GCC 3.4 to 4.9) include: 5682 5683@itemize @bullet 5684 5685@item 5686A template with a non-type template parameter of reference type was 5687mangled incorrectly: 5688@smallexample 5689extern int N; 5690template <int &> struct S @{@}; 5691void n (S<N>) @{2@} 5692@end smallexample 5693 5694This was fixed in @option{-fabi-version=3}. 5695 5696@item 5697SIMD vector types declared using @code{__attribute ((vector_size))} were 5698mangled in a non-standard way that does not allow for overloading of 5699functions taking vectors of different sizes. 5700 5701The mangling was changed in @option{-fabi-version=4}. 5702 5703@item 5704@code{__attribute ((const))} and @code{noreturn} were mangled as type 5705qualifiers, and @code{decltype} of a plain declaration was folded away. 5706 5707These mangling issues were fixed in @option{-fabi-version=5}. 5708 5709@item 5710Scoped enumerators passed as arguments to a variadic function are 5711promoted like unscoped enumerators, causing @code{va_arg} to complain. 5712On most targets this does not actually affect the parameter passing 5713ABI, as there is no way to pass an argument smaller than @code{int}. 5714 5715Also, the ABI changed the mangling of template argument packs, 5716@code{const_cast}, @code{static_cast}, prefix increment/decrement, and 5717a class scope function used as a template argument. 5718 5719These issues were corrected in @option{-fabi-version=6}. 5720 5721@item 5722Lambdas in default argument scope were mangled incorrectly, and the 5723ABI changed the mangling of @code{nullptr_t}. 5724 5725These issues were corrected in @option{-fabi-version=7}. 5726 5727@item 5728When mangling a function type with function-cv-qualifiers, the 5729un-qualified function type was incorrectly treated as a substitution 5730candidate. 5731 5732This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. 5733 5734@item 5735@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to 5736unaligned accesses. Note that this did not affect the ABI of a 5737function with a @code{nullptr_t} parameter, as parameters have a 5738minimum alignment. 5739 5740This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. 5741 5742@item 5743Target-specific attributes that affect the identity of a type, such as 5744ia32 calling conventions on a function type (stdcall, regparm, etc.), 5745did not affect the mangled name, leading to name collisions when 5746function pointers were used as template arguments. 5747 5748This was fixed in @option{-fabi-version=10}, the default for GCC 6.1. 5749 5750@end itemize 5751 5752This option also enables warnings about psABI-related changes. 5753The known psABI changes at this point include: 5754 5755@itemize @bullet 5756 5757@item 5758For SysV/x86-64, unions with @code{long double} members are 5759passed in memory as specified in psABI. Prior to GCC 4.4, this was not 5760the case. For example: 5761 5762@smallexample 5763union U @{ 5764 long double ld; 5765 int i; 5766@}; 5767@end smallexample 5768 5769@noindent 5770@code{union U} is now always passed in memory. 5771 5772@end itemize 5773 5774@item -Wchar-subscripts 5775@opindex Wchar-subscripts 5776@opindex Wno-char-subscripts 5777Warn if an array subscript has type @code{char}. This is a common cause 5778of error, as programmers often forget that this type is signed on some 5779machines. 5780This warning is enabled by @option{-Wall}. 5781 5782@item -Wno-coverage-mismatch 5783@opindex Wno-coverage-mismatch 5784@opindex Wcoverage-mismatch 5785Warn if feedback profiles do not match when using the 5786@option{-fprofile-use} option. 5787If a source file is changed between compiling with @option{-fprofile-generate} 5788and with @option{-fprofile-use}, the files with the profile feedback can fail 5789to match the source file and GCC cannot use the profile feedback 5790information. By default, this warning is enabled and is treated as an 5791error. @option{-Wno-coverage-mismatch} can be used to disable the 5792warning or @option{-Wno-error=coverage-mismatch} can be used to 5793disable the error. Disabling the error for this warning can result in 5794poorly optimized code and is useful only in the 5795case of very minor changes such as bug fixes to an existing code-base. 5796Completely disabling the warning is not recommended. 5797 5798@item -Wno-cpp 5799@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 5800@opindex Wno-cpp 5801@opindex Wcpp 5802Suppress warning messages emitted by @code{#warning} directives. 5803 5804@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 5805@opindex Wdouble-promotion 5806@opindex Wno-double-promotion 5807Give a warning when a value of type @code{float} is implicitly 5808promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 5809floating-point unit implement @code{float} in hardware, but emulate 5810@code{double} in software. On such a machine, doing computations 5811using @code{double} values is much more expensive because of the 5812overhead required for software emulation. 5813 5814It is easy to accidentally do computations with @code{double} because 5815floating-point literals are implicitly of type @code{double}. For 5816example, in: 5817@smallexample 5818@group 5819float area(float radius) 5820@{ 5821 return 3.14159 * radius * radius; 5822@} 5823@end group 5824@end smallexample 5825the compiler performs the entire computation with @code{double} 5826because the floating-point literal is a @code{double}. 5827 5828@item -Wduplicate-decl-specifier @r{(C and Objective-C only)} 5829@opindex Wduplicate-decl-specifier 5830@opindex Wno-duplicate-decl-specifier 5831Warn if a declaration has duplicate @code{const}, @code{volatile}, 5832@code{restrict} or @code{_Atomic} specifier. This warning is enabled by 5833@option{-Wall}. 5834 5835@item -Wformat 5836@itemx -Wformat=@var{n} 5837@opindex Wformat 5838@opindex Wno-format 5839@opindex ffreestanding 5840@opindex fno-builtin 5841@opindex Wformat= 5842Check calls to @code{printf} and @code{scanf}, etc., to make sure that 5843the arguments supplied have types appropriate to the format string 5844specified, and that the conversions specified in the format string make 5845sense. This includes standard functions, and others specified by format 5846attributes (@pxref{Function Attributes}), in the @code{printf}, 5847@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 5848not in the C standard) families (or other target-specific families). 5849Which functions are checked without format attributes having been 5850specified depends on the standard version selected, and such checks of 5851functions without the attribute specified are disabled by 5852@option{-ffreestanding} or @option{-fno-builtin}. 5853 5854The formats are checked against the format features supported by GNU 5855libc version 2.2. These include all ISO C90 and C99 features, as well 5856as features from the Single Unix Specification and some BSD and GNU 5857extensions. Other library implementations may not support all these 5858features; GCC does not support warning about features that go beyond a 5859particular library's limitations. However, if @option{-Wpedantic} is used 5860with @option{-Wformat}, warnings are given about format features not 5861in the selected standard version (but not for @code{strfmon} formats, 5862since those are not in any version of the C standard). @xref{C Dialect 5863Options,,Options Controlling C Dialect}. 5864 5865@table @gcctabopt 5866@item -Wformat=1 5867@itemx -Wformat 5868@opindex Wformat 5869@opindex Wformat=1 5870Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 5871@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 5872@option{-Wformat} also checks for null format arguments for several 5873functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 5874aspects of this level of format checking can be disabled by the 5875options: @option{-Wno-format-contains-nul}, 5876@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 5877@option{-Wformat} is enabled by @option{-Wall}. 5878 5879@item -Wformat=2 5880@opindex Wformat=2 5881Enable @option{-Wformat} plus additional format checks. Currently 5882equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 5883-Wformat-y2k}. 5884@end table 5885 5886@item -Wno-format-contains-nul 5887@opindex Wno-format-contains-nul 5888@opindex Wformat-contains-nul 5889If @option{-Wformat} is specified, do not warn about format strings that 5890contain NUL bytes. 5891 5892@item -Wno-format-extra-args 5893@opindex Wno-format-extra-args 5894@opindex Wformat-extra-args 5895If @option{-Wformat} is specified, do not warn about excess arguments to a 5896@code{printf} or @code{scanf} format function. The C standard specifies 5897that such arguments are ignored. 5898 5899Where the unused arguments lie between used arguments that are 5900specified with @samp{$} operand number specifications, normally 5901warnings are still given, since the implementation could not know what 5902type to pass to @code{va_arg} to skip the unused arguments. However, 5903in the case of @code{scanf} formats, this option suppresses the 5904warning if the unused arguments are all pointers, since the Single 5905Unix Specification says that such unused arguments are allowed. 5906 5907@item -Wformat-overflow 5908@itemx -Wformat-overflow=@var{level} 5909@opindex Wformat-overflow 5910@opindex Wno-format-overflow 5911Warn about calls to formatted input/output functions such as @code{sprintf} 5912and @code{vsprintf} that might overflow the destination buffer. When the 5913exact number of bytes written by a format directive cannot be determined 5914at compile-time it is estimated based on heuristics that depend on the 5915@var{level} argument and on optimization. While enabling optimization 5916will in most cases improve the accuracy of the warning, it may also 5917result in false positives. 5918 5919@table @gcctabopt 5920@item -Wformat-overflow 5921@itemx -Wformat-overflow=1 5922@opindex Wformat-overflow 5923@opindex Wno-format-overflow 5924Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat} 5925employs a conservative approach that warns only about calls that most 5926likely overflow the buffer. At this level, numeric arguments to format 5927directives with unknown values are assumed to have the value of one, and 5928strings of unknown length to be empty. Numeric arguments that are known 5929to be bounded to a subrange of their type, or string arguments whose output 5930is bounded either by their directive's precision or by a finite set of 5931string literals, are assumed to take on the value within the range that 5932results in the most bytes on output. For example, the call to @code{sprintf} 5933below is diagnosed because even with both @var{a} and @var{b} equal to zero, 5934the terminating NUL character (@code{'\0'}) appended by the function 5935to the destination buffer will be written past its end. Increasing 5936the size of the buffer by a single byte is sufficient to avoid the 5937warning, though it may not be sufficient to avoid the overflow. 5938 5939@smallexample 5940void f (int a, int b) 5941@{ 5942 char buf [13]; 5943 sprintf (buf, "a = %i, b = %i\n", a, b); 5944@} 5945@end smallexample 5946 5947@item -Wformat-overflow=2 5948Level @var{2} warns also about calls that might overflow the destination 5949buffer given an argument of sufficient length or magnitude. At level 5950@var{2}, unknown numeric arguments are assumed to have the minimum 5951representable value for signed types with a precision greater than 1, and 5952the maximum representable value otherwise. Unknown string arguments whose 5953length cannot be assumed to be bounded either by the directive's precision, 5954or by a finite set of string literals they may evaluate to, or the character 5955array they may point to, are assumed to be 1 character long. 5956 5957At level @var{2}, the call in the example above is again diagnosed, but 5958this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first 5959@code{%i} directive will write some of its digits beyond the end of 5960the destination buffer. To make the call safe regardless of the values 5961of the two variables, the size of the destination buffer must be increased 5962to at least 34 bytes. GCC includes the minimum size of the buffer in 5963an informational note following the warning. 5964 5965An alternative to increasing the size of the destination buffer is to 5966constrain the range of formatted values. The maximum length of string 5967arguments can be bounded by specifying the precision in the format 5968directive. When numeric arguments of format directives can be assumed 5969to be bounded by less than the precision of their type, choosing 5970an appropriate length modifier to the format specifier will reduce 5971the required buffer size. For example, if @var{a} and @var{b} in the 5972example above can be assumed to be within the precision of 5973the @code{short int} type then using either the @code{%hi} format 5974directive or casting the argument to @code{short} reduces the maximum 5975required size of the buffer to 24 bytes. 5976 5977@smallexample 5978void f (int a, int b) 5979@{ 5980 char buf [23]; 5981 sprintf (buf, "a = %hi, b = %i\n", a, (short)b); 5982@} 5983@end smallexample 5984@end table 5985 5986@item -Wno-format-zero-length 5987@opindex Wno-format-zero-length 5988@opindex Wformat-zero-length 5989If @option{-Wformat} is specified, do not warn about zero-length formats. 5990The C standard specifies that zero-length formats are allowed. 5991 5992@item -Wformat-nonliteral 5993@opindex Wformat-nonliteral 5994@opindex Wno-format-nonliteral 5995If @option{-Wformat} is specified, also warn if the format string is not a 5996string literal and so cannot be checked, unless the format function 5997takes its format arguments as a @code{va_list}. 5998 5999@item -Wformat-security 6000@opindex Wformat-security 6001@opindex Wno-format-security 6002If @option{-Wformat} is specified, also warn about uses of format 6003functions that represent possible security problems. At present, this 6004warns about calls to @code{printf} and @code{scanf} functions where the 6005format string is not a string literal and there are no format arguments, 6006as in @code{printf (foo);}. This may be a security hole if the format 6007string came from untrusted input and contains @samp{%n}. (This is 6008currently a subset of what @option{-Wformat-nonliteral} warns about, but 6009in future warnings may be added to @option{-Wformat-security} that are not 6010included in @option{-Wformat-nonliteral}.) 6011 6012@item -Wformat-signedness 6013@opindex Wformat-signedness 6014@opindex Wno-format-signedness 6015If @option{-Wformat} is specified, also warn if the format string 6016requires an unsigned argument and the argument is signed and vice versa. 6017 6018@item -Wformat-truncation 6019@itemx -Wformat-truncation=@var{level} 6020@opindex Wformat-truncation 6021@opindex Wno-format-truncation 6022Warn about calls to formatted input/output functions such as @code{snprintf} 6023and @code{vsnprintf} that might result in output truncation. When the exact 6024number of bytes written by a format directive cannot be determined at 6025compile-time it is estimated based on heuristics that depend on 6026the @var{level} argument and on optimization. While enabling optimization 6027will in most cases improve the accuracy of the warning, it may also result 6028in false positives. Except as noted otherwise, the option uses the same 6029logic @option{-Wformat-overflow}. 6030 6031@table @gcctabopt 6032@item -Wformat-truncation 6033@itemx -Wformat-truncation=1 6034@opindex Wformat-truncation 6035@opindex Wno-format-truncation 6036Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat} 6037employs a conservative approach that warns only about calls to bounded 6038functions whose return value is unused and that will most likely result 6039in output truncation. 6040 6041@item -Wformat-truncation=2 6042Level @var{2} warns also about calls to bounded functions whose return 6043value is used and that might result in truncation given an argument of 6044sufficient length or magnitude. 6045@end table 6046 6047@item -Wformat-y2k 6048@opindex Wformat-y2k 6049@opindex Wno-format-y2k 6050If @option{-Wformat} is specified, also warn about @code{strftime} 6051formats that may yield only a two-digit year. 6052 6053@item -Wnonnull 6054@opindex Wnonnull 6055@opindex Wno-nonnull 6056Warn about passing a null pointer for arguments marked as 6057requiring a non-null value by the @code{nonnull} function attribute. 6058 6059@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 6060can be disabled with the @option{-Wno-nonnull} option. 6061 6062@item -Wnonnull-compare 6063@opindex Wnonnull-compare 6064@opindex Wno-nonnull-compare 6065Warn when comparing an argument marked with the @code{nonnull} 6066function attribute against null inside the function. 6067 6068@option{-Wnonnull-compare} is included in @option{-Wall}. It 6069can be disabled with the @option{-Wno-nonnull-compare} option. 6070 6071@item -Wnull-dereference 6072@opindex Wnull-dereference 6073@opindex Wno-null-dereference 6074Warn if the compiler detects paths that trigger erroneous or 6075undefined behavior due to dereferencing a null pointer. This option 6076is only active when @option{-fdelete-null-pointer-checks} is active, 6077which is enabled by optimizations in most targets. The precision of 6078the warnings depends on the optimization options used. 6079 6080@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 6081@opindex Winit-self 6082@opindex Wno-init-self 6083Warn about uninitialized variables that are initialized with themselves. 6084Note this option can only be used with the @option{-Wuninitialized} option. 6085 6086For example, GCC warns about @code{i} being uninitialized in the 6087following snippet only when @option{-Winit-self} has been specified: 6088@smallexample 6089@group 6090int f() 6091@{ 6092 int i = i; 6093 return i; 6094@} 6095@end group 6096@end smallexample 6097 6098This warning is enabled by @option{-Wall} in C++. 6099 6100@item -Wno-implicit-int @r{(C and Objective-C only)} 6101@opindex Wimplicit-int 6102@opindex Wno-implicit-int 6103This option controls warnings when a declaration does not specify a type. 6104This warning is enabled by default in C99 and later dialects of C, 6105and also by @option{-Wall}. 6106 6107@item -Wno-implicit-function-declaration @r{(C and Objective-C only)} 6108@opindex Wimplicit-function-declaration 6109@opindex Wno-implicit-function-declaration 6110This option controls warnings when a function is used before being declared. 6111This warning is enabled by default in C99 and later dialects of C, 6112and also by @option{-Wall}. 6113The warning is made into an error by @option{-pedantic-errors}. 6114 6115@item -Wimplicit @r{(C and Objective-C only)} 6116@opindex Wimplicit 6117@opindex Wno-implicit 6118Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 6119This warning is enabled by @option{-Wall}. 6120 6121@item -Wimplicit-fallthrough 6122@opindex Wimplicit-fallthrough 6123@opindex Wno-implicit-fallthrough 6124@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3} 6125and @option{-Wno-implicit-fallthrough} is the same as 6126@option{-Wimplicit-fallthrough=0}. 6127 6128@item -Wimplicit-fallthrough=@var{n} 6129@opindex Wimplicit-fallthrough= 6130Warn when a switch case falls through. For example: 6131 6132@smallexample 6133@group 6134switch (cond) 6135 @{ 6136 case 1: 6137 a = 1; 6138 break; 6139 case 2: 6140 a = 2; 6141 case 3: 6142 a = 3; 6143 break; 6144 @} 6145@end group 6146@end smallexample 6147 6148This warning does not warn when the last statement of a case cannot 6149fall through, e.g. when there is a return statement or a call to function 6150declared with the noreturn attribute. @option{-Wimplicit-fallthrough=} 6151also takes into account control flow statements, such as ifs, and only 6152warns when appropriate. E.g.@: 6153 6154@smallexample 6155@group 6156switch (cond) 6157 @{ 6158 case 1: 6159 if (i > 3) @{ 6160 bar (5); 6161 break; 6162 @} else if (i < 1) @{ 6163 bar (0); 6164 @} else 6165 return; 6166 default: 6167 @dots{} 6168 @} 6169@end group 6170@end smallexample 6171 6172Since there are occasions where a switch case fall through is desirable, 6173GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is 6174to be used along with a null statement to suppress this warning that 6175would normally occur: 6176 6177@smallexample 6178@group 6179switch (cond) 6180 @{ 6181 case 1: 6182 bar (0); 6183 __attribute__ ((fallthrough)); 6184 default: 6185 @dots{} 6186 @} 6187@end group 6188@end smallexample 6189 6190C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough} 6191warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11 6192or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension. 6193Instead of these attributes, it is also possible to add a fallthrough comment 6194to silence the warning. The whole body of the C or C++ style comment should 6195match the given regular expressions listed below. The option argument @var{n} 6196specifies what kind of comments are accepted: 6197 6198@itemize @bullet 6199 6200@item @option{-Wimplicit-fallthrough=0} disables the warning altogether. 6201 6202@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular 6203expression, any comment is used as fallthrough comment. 6204 6205@item @option{-Wimplicit-fallthrough=2} case insensitively matches 6206@code{.*falls?[ \t-]*thr(ough|u).*} regular expression. 6207 6208@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the 6209following regular expressions: 6210 6211@itemize @bullet 6212 6213@item @code{-fallthrough} 6214 6215@item @code{@@fallthrough@@} 6216 6217@item @code{lint -fallthrough[ \t]*} 6218 6219@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?} 6220 6221@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?} 6222 6223@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?} 6224 6225@end itemize 6226 6227@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the 6228following regular expressions: 6229 6230@itemize @bullet 6231 6232@item @code{-fallthrough} 6233 6234@item @code{@@fallthrough@@} 6235 6236@item @code{lint -fallthrough[ \t]*} 6237 6238@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*} 6239 6240@end itemize 6241 6242@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as 6243fallthrough comments, only attributes disable the warning. 6244 6245@end itemize 6246 6247The comment needs to be followed after optional whitespace and other comments 6248by @code{case} or @code{default} keywords or by a user label that precedes some 6249@code{case} or @code{default} label. 6250 6251@smallexample 6252@group 6253switch (cond) 6254 @{ 6255 case 1: 6256 bar (0); 6257 /* FALLTHRU */ 6258 default: 6259 @dots{} 6260 @} 6261@end group 6262@end smallexample 6263 6264The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}. 6265 6266@item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 6267@opindex Wif-not-aligned 6268@opindex Wno-if-not-aligned 6269Control if warnings triggered by the @code{warn_if_not_aligned} attribute 6270should be issued. These warnings are enabled by default. 6271 6272@item -Wignored-qualifiers @r{(C and C++ only)} 6273@opindex Wignored-qualifiers 6274@opindex Wno-ignored-qualifiers 6275Warn if the return type of a function has a type qualifier 6276such as @code{const}. For ISO C such a type qualifier has no effect, 6277since the value returned by a function is not an lvalue. 6278For C++, the warning is only emitted for scalar types or @code{void}. 6279ISO C prohibits qualified @code{void} return types on function 6280definitions, so such return types always receive a warning 6281even without this option. 6282 6283This warning is also enabled by @option{-Wextra}. 6284 6285@item -Wno-ignored-attributes @r{(C and C++ only)} 6286@opindex Wignored-attributes 6287@opindex Wno-ignored-attributes 6288This option controls warnings when an attribute is ignored. 6289This is different from the 6290@option{-Wattributes} option in that it warns whenever the compiler decides 6291to drop an attribute, not that the attribute is either unknown, used in a 6292wrong place, etc. This warning is enabled by default. 6293 6294@item -Wmain 6295@opindex Wmain 6296@opindex Wno-main 6297Warn if the type of @code{main} is suspicious. @code{main} should be 6298a function with external linkage, returning int, taking either zero 6299arguments, two, or three arguments of appropriate types. This warning 6300is enabled by default in C++ and is enabled by either @option{-Wall} 6301or @option{-Wpedantic}. 6302 6303@item -Wmisleading-indentation @r{(C and C++ only)} 6304@opindex Wmisleading-indentation 6305@opindex Wno-misleading-indentation 6306Warn when the indentation of the code does not reflect the block structure. 6307Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and 6308@code{for} clauses with a guarded statement that does not use braces, 6309followed by an unguarded statement with the same indentation. 6310 6311In the following example, the call to ``bar'' is misleadingly indented as 6312if it were guarded by the ``if'' conditional. 6313 6314@smallexample 6315 if (some_condition ()) 6316 foo (); 6317 bar (); /* Gotcha: this is not guarded by the "if". */ 6318@end smallexample 6319 6320In the case of mixed tabs and spaces, the warning uses the 6321@option{-ftabstop=} option to determine if the statements line up 6322(defaulting to 8). 6323 6324The warning is not issued for code involving multiline preprocessor logic 6325such as the following example. 6326 6327@smallexample 6328 if (flagA) 6329 foo (0); 6330#if SOME_CONDITION_THAT_DOES_NOT_HOLD 6331 if (flagB) 6332#endif 6333 foo (1); 6334@end smallexample 6335 6336The warning is not issued after a @code{#line} directive, since this 6337typically indicates autogenerated code, and no assumptions can be made 6338about the layout of the file that the directive references. 6339 6340This warning is enabled by @option{-Wall} in C and C++. 6341 6342@item -Wmissing-attributes 6343@opindex Wmissing-attributes 6344@opindex Wno-missing-attributes 6345Warn when a declaration of a function is missing one or more attributes 6346that a related function is declared with and whose absence may adversely 6347affect the correctness or efficiency of generated code. For example, 6348the warning is issued for declarations of aliases that use attributes 6349to specify less restrictive requirements than those of their targets. 6350This typically represents a potential optimization opportunity. 6351By contrast, the @option{-Wattribute-alias=2} option controls warnings 6352issued when the alias is more restrictive than the target, which could 6353lead to incorrect code generation. 6354Attributes considered include @code{alloc_align}, @code{alloc_size}, 6355@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 6356@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 6357@code{returns_nonnull}, and @code{returns_twice}. 6358 6359In C++, the warning is issued when an explicit specialization of a primary 6360template declared with attribute @code{alloc_align}, @code{alloc_size}, 6361@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc}, 6362or @code{nonnull} is declared without it. Attributes @code{deprecated}, 6363@code{error}, and @code{warning} suppress the warning. 6364(@pxref{Function Attributes}). 6365 6366You can use the @code{copy} attribute to apply the same 6367set of attributes to a declaration as that on another declaration without 6368explicitly enumerating the attributes. This attribute can be applied 6369to declarations of functions (@pxref{Common Function Attributes}), 6370variables (@pxref{Common Variable Attributes}), or types 6371(@pxref{Common Type Attributes}). 6372 6373@option{-Wmissing-attributes} is enabled by @option{-Wall}. 6374 6375For example, since the declaration of the primary function template 6376below makes use of both attribute @code{malloc} and @code{alloc_size} 6377the declaration of the explicit specialization of the template is 6378diagnosed because it is missing one of the attributes. 6379 6380@smallexample 6381template <class T> 6382T* __attribute__ ((malloc, alloc_size (1))) 6383allocate (size_t); 6384 6385template <> 6386void* __attribute__ ((malloc)) // missing alloc_size 6387allocate<void> (size_t); 6388@end smallexample 6389 6390@item -Wmissing-braces 6391@opindex Wmissing-braces 6392@opindex Wno-missing-braces 6393Warn if an aggregate or union initializer is not fully bracketed. In 6394the following example, the initializer for @code{a} is not fully 6395bracketed, but that for @code{b} is fully bracketed. 6396 6397@smallexample 6398int a[2][2] = @{ 0, 1, 2, 3 @}; 6399int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 6400@end smallexample 6401 6402This warning is enabled by @option{-Wall}. 6403 6404@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 6405@opindex Wmissing-include-dirs 6406@opindex Wno-missing-include-dirs 6407Warn if a user-supplied include directory does not exist. 6408 6409@item -Wno-missing-profile 6410@opindex Wmissing-profile 6411@opindex Wno-missing-profile 6412This option controls warnings if feedback profiles are missing when using the 6413@option{-fprofile-use} option. 6414This option diagnoses those cases where a new function or a new file is added 6415between compiling with @option{-fprofile-generate} and with 6416@option{-fprofile-use}, without regenerating the profiles. 6417In these cases, the profile feedback data files do not contain any 6418profile feedback information for 6419the newly added function or file respectively. Also, in the case when profile 6420count data (.gcda) files are removed, GCC cannot use any profile feedback 6421information. In all these cases, warnings are issued to inform you that a 6422profile generation step is due. 6423Ignoring the warning can result in poorly optimized code. 6424@option{-Wno-missing-profile} can be used to 6425disable the warning, but this is not recommended and should be done only 6426when non-existent profile data is justified. 6427 6428@item -Wno-mismatched-dealloc 6429@opindex Wmismatched-dealloc 6430@opindex Wno-mismatched-dealloc 6431 6432Warn for calls to deallocation functions with pointer arguments returned 6433from from allocations functions for which the former isn't a suitable 6434deallocator. A pair of functions can be associated as matching allocators 6435and deallocators by use of attribute @code{malloc}. Unless disabled by 6436the @option{-fno-builtin} option the standard functions @code{calloc}, 6437@code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding 6438forms of C++ @code{operator new} and @code{operator delete} are implicitly 6439associated as matching allocators and deallocators. In the following 6440example @code{mydealloc} is the deallocator for pointers returned from 6441@code{myalloc}. 6442 6443@smallexample 6444void mydealloc (void*); 6445 6446__attribute__ ((malloc (mydealloc, 1))) void* 6447myalloc (size_t); 6448 6449void f (void) 6450@{ 6451 void *p = myalloc (32); 6452 // @dots{}use p@dots{} 6453 free (p); // warning: not a matching deallocator for myalloc 6454 mydealloc (p); // ok 6455@} 6456@end smallexample 6457 6458In C++, the related option @option{-Wmismatched-new-delete} diagnoses 6459mismatches involving either @code{operator new} or @code{operator delete}. 6460 6461Option @option{-Wmismatched-dealloc} is enabled by default. 6462 6463@item -Wmultistatement-macros 6464@opindex Wmultistatement-macros 6465@opindex Wno-multistatement-macros 6466Warn about unsafe multiple statement macros that appear to be guarded 6467by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or 6468@code{while}, in which only the first statement is actually guarded after 6469the macro is expanded. 6470 6471For example: 6472 6473@smallexample 6474#define DOIT x++; y++ 6475if (c) 6476 DOIT; 6477@end smallexample 6478 6479will increment @code{y} unconditionally, not just when @code{c} holds. 6480The can usually be fixed by wrapping the macro in a do-while loop: 6481@smallexample 6482#define DOIT do @{ x++; y++; @} while (0) 6483if (c) 6484 DOIT; 6485@end smallexample 6486 6487This warning is enabled by @option{-Wall} in C and C++. 6488 6489@item -Wparentheses 6490@opindex Wparentheses 6491@opindex Wno-parentheses 6492Warn if parentheses are omitted in certain contexts, such 6493as when there is an assignment in a context where a truth value 6494is expected, or when operators are nested whose precedence people 6495often get confused about. 6496 6497Also warn if a comparison like @code{x<=y<=z} appears; this is 6498equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 6499interpretation from that of ordinary mathematical notation. 6500 6501Also warn for dangerous uses of the GNU extension to 6502@code{?:} with omitted middle operand. When the condition 6503in the @code{?}: operator is a boolean expression, the omitted value is 6504always 1. Often programmers expect it to be a value computed 6505inside the conditional expression instead. 6506 6507For C++ this also warns for some cases of unnecessary parentheses in 6508declarations, which can indicate an attempt at a function call instead 6509of a declaration: 6510@smallexample 6511@{ 6512 // Declares a local variable called mymutex. 6513 std::unique_lock<std::mutex> (mymutex); 6514 // User meant std::unique_lock<std::mutex> lock (mymutex); 6515@} 6516@end smallexample 6517 6518This warning is enabled by @option{-Wall}. 6519 6520@item -Wsequence-point 6521@opindex Wsequence-point 6522@opindex Wno-sequence-point 6523Warn about code that may have undefined semantics because of violations 6524of sequence point rules in the C and C++ standards. 6525 6526The C and C++ standards define the order in which expressions in a C/C++ 6527program are evaluated in terms of @dfn{sequence points}, which represent 6528a partial ordering between the execution of parts of the program: those 6529executed before the sequence point, and those executed after it. These 6530occur after the evaluation of a full expression (one which is not part 6531of a larger expression), after the evaluation of the first operand of a 6532@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 6533function is called (but after the evaluation of its arguments and the 6534expression denoting the called function), and in certain other places. 6535Other than as expressed by the sequence point rules, the order of 6536evaluation of subexpressions of an expression is not specified. All 6537these rules describe only a partial order rather than a total order, 6538since, for example, if two functions are called within one expression 6539with no sequence point between them, the order in which the functions 6540are called is not specified. However, the standards committee have 6541ruled that function calls do not overlap. 6542 6543It is not specified when between sequence points modifications to the 6544values of objects take effect. Programs whose behavior depends on this 6545have undefined behavior; the C and C++ standards specify that ``Between 6546the previous and next sequence point an object shall have its stored 6547value modified at most once by the evaluation of an expression. 6548Furthermore, the prior value shall be read only to determine the value 6549to be stored.''. If a program breaks these rules, the results on any 6550particular implementation are entirely unpredictable. 6551 6552Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 6553= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 6554diagnosed by this option, and it may give an occasional false positive 6555result, but in general it has been found fairly effective at detecting 6556this sort of problem in programs. 6557 6558The C++17 standard will define the order of evaluation of operands in 6559more cases: in particular it requires that the right-hand side of an 6560assignment be evaluated before the left-hand side, so the above 6561examples are no longer undefined. But this option will still warn 6562about them, to help people avoid writing code that is undefined in C 6563and earlier revisions of C++. 6564 6565The standard is worded confusingly, therefore there is some debate 6566over the precise meaning of the sequence point rules in subtle cases. 6567Links to discussions of the problem, including proposed formal 6568definitions, may be found on the GCC readings page, at 6569@uref{http://gcc.gnu.org/@/readings.html}. 6570 6571This warning is enabled by @option{-Wall} for C and C++. 6572 6573@item -Wno-return-local-addr 6574@opindex Wno-return-local-addr 6575@opindex Wreturn-local-addr 6576Do not warn about returning a pointer (or in C++, a reference) to a 6577variable that goes out of scope after the function returns. 6578 6579@item -Wreturn-type 6580@opindex Wreturn-type 6581@opindex Wno-return-type 6582Warn whenever a function is defined with a return type that defaults 6583to @code{int}. Also warn about any @code{return} statement with no 6584return value in a function whose return type is not @code{void} 6585(falling off the end of the function body is considered returning 6586without a value). 6587 6588For C only, warn about a @code{return} statement with an expression in a 6589function whose return type is @code{void}, unless the expression type is 6590also @code{void}. As a GNU extension, the latter case is accepted 6591without a warning unless @option{-Wpedantic} is used. Attempting 6592to use the return value of a non-@code{void} function other than @code{main} 6593that flows off the end by reaching the closing curly brace that terminates 6594the function is undefined. 6595 6596Unlike in C, in C++, flowing off the end of a non-@code{void} function other 6597than @code{main} results in undefined behavior even when the value of 6598the function is not used. 6599 6600This warning is enabled by default in C++ and by @option{-Wall} otherwise. 6601 6602@item -Wno-shift-count-negative 6603@opindex Wshift-count-negative 6604@opindex Wno-shift-count-negative 6605Controls warnings if a shift count is negative. 6606This warning is enabled by default. 6607 6608@item -Wno-shift-count-overflow 6609@opindex Wshift-count-overflow 6610@opindex Wno-shift-count-overflow 6611Controls warnings if a shift count is greater than or equal to the bit width 6612of the type. This warning is enabled by default. 6613 6614@item -Wshift-negative-value 6615@opindex Wshift-negative-value 6616@opindex Wno-shift-negative-value 6617Warn if left shifting a negative value. This warning is enabled by 6618@option{-Wextra} in C99 and C++11 modes (and newer). 6619 6620@item -Wno-shift-overflow 6621@itemx -Wshift-overflow=@var{n} 6622@opindex Wshift-overflow 6623@opindex Wno-shift-overflow 6624These options control warnings about left shift overflows. 6625 6626@table @gcctabopt 6627@item -Wshift-overflow=1 6628This is the warning level of @option{-Wshift-overflow} and is enabled 6629by default in C99 and C++11 modes (and newer). This warning level does 6630not warn about left-shifting 1 into the sign bit. (However, in C, such 6631an overflow is still rejected in contexts where an integer constant expression 6632is required.) No warning is emitted in C++20 mode (and newer), as signed left 6633shifts always wrap. 6634 6635@item -Wshift-overflow=2 6636This warning level also warns about left-shifting 1 into the sign bit, 6637unless C++14 mode (or newer) is active. 6638@end table 6639 6640@item -Wswitch 6641@opindex Wswitch 6642@opindex Wno-switch 6643Warn whenever a @code{switch} statement has an index of enumerated type 6644and lacks a @code{case} for one or more of the named codes of that 6645enumeration. (The presence of a @code{default} label prevents this 6646warning.) @code{case} labels outside the enumeration range also 6647provoke warnings when this option is used (even if there is a 6648@code{default} label). 6649This warning is enabled by @option{-Wall}. 6650 6651@item -Wswitch-default 6652@opindex Wswitch-default 6653@opindex Wno-switch-default 6654Warn whenever a @code{switch} statement does not have a @code{default} 6655case. 6656 6657@item -Wswitch-enum 6658@opindex Wswitch-enum 6659@opindex Wno-switch-enum 6660Warn whenever a @code{switch} statement has an index of enumerated type 6661and lacks a @code{case} for one or more of the named codes of that 6662enumeration. @code{case} labels outside the enumeration range also 6663provoke warnings when this option is used. The only difference 6664between @option{-Wswitch} and this option is that this option gives a 6665warning about an omitted enumeration code even if there is a 6666@code{default} label. 6667 6668@item -Wno-switch-bool 6669@opindex Wswitch-bool 6670@opindex Wno-switch-bool 6671Do not warn when a @code{switch} statement has an index of boolean type 6672and the case values are outside the range of a boolean type. 6673It is possible to suppress this warning by casting the controlling 6674expression to a type other than @code{bool}. For example: 6675@smallexample 6676@group 6677switch ((int) (a == 4)) 6678 @{ 6679 @dots{} 6680 @} 6681@end group 6682@end smallexample 6683This warning is enabled by default for C and C++ programs. 6684 6685@item -Wno-switch-outside-range 6686@opindex Wswitch-outside-range 6687@opindex Wno-switch-outside-range 6688This option controls warnings when a @code{switch} case has a value 6689that is outside of its 6690respective type range. This warning is enabled by default for 6691C and C++ programs. 6692 6693@item -Wno-switch-unreachable 6694@opindex Wswitch-unreachable 6695@opindex Wno-switch-unreachable 6696Do not warn when a @code{switch} statement contains statements between the 6697controlling expression and the first case label, which will never be 6698executed. For example: 6699@smallexample 6700@group 6701switch (cond) 6702 @{ 6703 i = 15; 6704 @dots{} 6705 case 5: 6706 @dots{} 6707 @} 6708@end group 6709@end smallexample 6710@option{-Wswitch-unreachable} does not warn if the statement between the 6711controlling expression and the first case label is just a declaration: 6712@smallexample 6713@group 6714switch (cond) 6715 @{ 6716 int i; 6717 @dots{} 6718 case 5: 6719 i = 5; 6720 @dots{} 6721 @} 6722@end group 6723@end smallexample 6724This warning is enabled by default for C and C++ programs. 6725 6726@item -Wsync-nand @r{(C and C++ only)} 6727@opindex Wsync-nand 6728@opindex Wno-sync-nand 6729Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 6730built-in functions are used. These functions changed semantics in GCC 4.4. 6731 6732@item -Wunused-but-set-parameter 6733@opindex Wunused-but-set-parameter 6734@opindex Wno-unused-but-set-parameter 6735Warn whenever a function parameter is assigned to, but otherwise unused 6736(aside from its declaration). 6737 6738To suppress this warning use the @code{unused} attribute 6739(@pxref{Variable Attributes}). 6740 6741This warning is also enabled by @option{-Wunused} together with 6742@option{-Wextra}. 6743 6744@item -Wunused-but-set-variable 6745@opindex Wunused-but-set-variable 6746@opindex Wno-unused-but-set-variable 6747Warn whenever a local variable is assigned to, but otherwise unused 6748(aside from its declaration). 6749This warning is enabled by @option{-Wall}. 6750 6751To suppress this warning use the @code{unused} attribute 6752(@pxref{Variable Attributes}). 6753 6754This warning is also enabled by @option{-Wunused}, which is enabled 6755by @option{-Wall}. 6756 6757@item -Wunused-function 6758@opindex Wunused-function 6759@opindex Wno-unused-function 6760Warn whenever a static function is declared but not defined or a 6761non-inline static function is unused. 6762This warning is enabled by @option{-Wall}. 6763 6764@item -Wunused-label 6765@opindex Wunused-label 6766@opindex Wno-unused-label 6767Warn whenever a label is declared but not used. 6768This warning is enabled by @option{-Wall}. 6769 6770To suppress this warning use the @code{unused} attribute 6771(@pxref{Variable Attributes}). 6772 6773@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 6774@opindex Wunused-local-typedefs 6775@opindex Wno-unused-local-typedefs 6776Warn when a typedef locally defined in a function is not used. 6777This warning is enabled by @option{-Wall}. 6778 6779@item -Wunused-parameter 6780@opindex Wunused-parameter 6781@opindex Wno-unused-parameter 6782Warn whenever a function parameter is unused aside from its declaration. 6783 6784To suppress this warning use the @code{unused} attribute 6785(@pxref{Variable Attributes}). 6786 6787@item -Wno-unused-result 6788@opindex Wunused-result 6789@opindex Wno-unused-result 6790Do not warn if a caller of a function marked with attribute 6791@code{warn_unused_result} (@pxref{Function Attributes}) does not use 6792its return value. The default is @option{-Wunused-result}. 6793 6794@item -Wunused-variable 6795@opindex Wunused-variable 6796@opindex Wno-unused-variable 6797Warn whenever a local or static variable is unused aside from its 6798declaration. This option implies @option{-Wunused-const-variable=1} for C, 6799but not for C++. This warning is enabled by @option{-Wall}. 6800 6801To suppress this warning use the @code{unused} attribute 6802(@pxref{Variable Attributes}). 6803 6804@item -Wunused-const-variable 6805@itemx -Wunused-const-variable=@var{n} 6806@opindex Wunused-const-variable 6807@opindex Wno-unused-const-variable 6808Warn whenever a constant static variable is unused aside from its declaration. 6809@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable} 6810for C, but not for C++. In C this declares variable storage, but in C++ this 6811is not an error since const variables take the place of @code{#define}s. 6812 6813To suppress this warning use the @code{unused} attribute 6814(@pxref{Variable Attributes}). 6815 6816@table @gcctabopt 6817@item -Wunused-const-variable=1 6818This is the warning level that is enabled by @option{-Wunused-variable} for 6819C. It warns only about unused static const variables defined in the main 6820compilation unit, but not about static const variables declared in any 6821header included. 6822 6823@item -Wunused-const-variable=2 6824This warning level also warns for unused constant static variables in 6825headers (excluding system headers). This is the warning level of 6826@option{-Wunused-const-variable} and must be explicitly requested since 6827in C++ this isn't an error and in C it might be harder to clean up all 6828headers included. 6829@end table 6830 6831@item -Wunused-value 6832@opindex Wunused-value 6833@opindex Wno-unused-value 6834Warn whenever a statement computes a result that is explicitly not 6835used. To suppress this warning cast the unused expression to 6836@code{void}. This includes an expression-statement or the left-hand 6837side of a comma expression that contains no side effects. For example, 6838an expression such as @code{x[i,j]} causes a warning, while 6839@code{x[(void)i,j]} does not. 6840 6841This warning is enabled by @option{-Wall}. 6842 6843@item -Wunused 6844@opindex Wunused 6845@opindex Wno-unused 6846All the above @option{-Wunused} options combined. 6847 6848In order to get a warning about an unused function parameter, you must 6849either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 6850@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 6851 6852@item -Wuninitialized 6853@opindex Wuninitialized 6854@opindex Wno-uninitialized 6855Warn if an object with automatic or allocated storage duration is used 6856without having been initialized. In C++, also warn if a non-static 6857reference or non-static @code{const} member appears in a class without 6858constructors. 6859 6860In addition, passing a pointer (or in C++, a reference) to an uninitialized 6861object to a @code{const}-qualified argument of a built-in function known to 6862read the object is also diagnosed by this warning. 6863(@option{-Wmaybe-uninitialized} is issued for ordinary functions.) 6864 6865If you want to warn about code that uses the uninitialized value of the 6866variable in its own initializer, use the @option{-Winit-self} option. 6867 6868These warnings occur for individual uninitialized elements of 6869structure, union or array variables as well as for variables that are 6870uninitialized as a whole. They do not occur for variables or elements 6871declared @code{volatile}. Because these warnings depend on 6872optimization, the exact variables or elements for which there are 6873warnings depend on the precise optimization options and version of GCC 6874used. 6875 6876Note that there may be no warning about a variable that is used only 6877to compute a value that itself is never used, because such 6878computations may be deleted by data flow analysis before the warnings 6879are printed. 6880 6881@item -Wno-invalid-memory-model 6882@opindex Winvalid-memory-model 6883@opindex Wno-invalid-memory-model 6884This option controls warnings 6885for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, 6886and the C11 atomic generic functions with a memory consistency argument 6887that is either invalid for the operation or outside the range of values 6888of the @code{memory_order} enumeration. For example, since the 6889@code{__atomic_store} and @code{__atomic_store_n} built-ins are only 6890defined for the relaxed, release, and sequentially consistent memory 6891orders the following code is diagnosed: 6892 6893@smallexample 6894void store (int *i) 6895@{ 6896 __atomic_store_n (i, 0, memory_order_consume); 6897@} 6898@end smallexample 6899 6900@option{-Winvalid-memory-model} is enabled by default. 6901 6902@item -Wmaybe-uninitialized 6903@opindex Wmaybe-uninitialized 6904@opindex Wno-maybe-uninitialized 6905For an object with automatic or allocated storage duration, if there exists 6906a path from the function entry to a use of the object that is initialized, 6907but there exist some other paths for which the object is not initialized, 6908the compiler emits a warning if it cannot prove the uninitialized paths 6909are not executed at run time. 6910 6911In addition, passing a pointer (or in C++, a reference) to an uninitialized 6912object to a @code{const}-qualified function argument is also diagnosed by 6913this warning. (@option{-Wuninitialized} is issued for built-in functions 6914known to read the object.) Annotating the function with attribute 6915@code{access (none)} indicates that the argument isn't used to access 6916the object and avoids the warning (@pxref{Common Function Attributes}). 6917 6918These warnings are only possible in optimizing compilation, because otherwise 6919GCC does not keep track of the state of variables. 6920 6921These warnings are made optional because GCC may not be able to determine when 6922the code is correct in spite of appearing to have an error. Here is one 6923example of how this can happen: 6924 6925@smallexample 6926@group 6927@{ 6928 int x; 6929 switch (y) 6930 @{ 6931 case 1: x = 1; 6932 break; 6933 case 2: x = 4; 6934 break; 6935 case 3: x = 5; 6936 @} 6937 foo (x); 6938@} 6939@end group 6940@end smallexample 6941 6942@noindent 6943If the value of @code{y} is always 1, 2 or 3, then @code{x} is 6944always initialized, but GCC doesn't know this. To suppress the 6945warning, you need to provide a default case with assert(0) or 6946similar code. 6947 6948@cindex @code{longjmp} warnings 6949This option also warns when a non-volatile automatic variable might be 6950changed by a call to @code{longjmp}. 6951The compiler sees only the calls to @code{setjmp}. It cannot know 6952where @code{longjmp} will be called; in fact, a signal handler could 6953call it at any point in the code. As a result, you may get a warning 6954even when there is in fact no problem because @code{longjmp} cannot 6955in fact be called at the place that would cause a problem. 6956 6957Some spurious warnings can be avoided if you declare all the functions 6958you use that never return as @code{noreturn}. @xref{Function 6959Attributes}. 6960 6961This warning is enabled by @option{-Wall} or @option{-Wextra}. 6962 6963@item -Wunknown-pragmas 6964@opindex Wunknown-pragmas 6965@opindex Wno-unknown-pragmas 6966@cindex warning for unknown pragmas 6967@cindex unknown pragmas, warning 6968@cindex pragmas, warning of unknown 6969Warn when a @code{#pragma} directive is encountered that is not understood by 6970GCC@. If this command-line option is used, warnings are even issued 6971for unknown pragmas in system header files. This is not the case if 6972the warnings are only enabled by the @option{-Wall} command-line option. 6973 6974@item -Wno-pragmas 6975@opindex Wno-pragmas 6976@opindex Wpragmas 6977Do not warn about misuses of pragmas, such as incorrect parameters, 6978invalid syntax, or conflicts between pragmas. See also 6979@option{-Wunknown-pragmas}. 6980 6981@item -Wno-prio-ctor-dtor 6982@opindex Wno-prio-ctor-dtor 6983@opindex Wprio-ctor-dtor 6984Do not warn if a priority from 0 to 100 is used for constructor or destructor. 6985The use of constructor and destructor attributes allow you to assign a 6986priority to the constructor/destructor to control its order of execution 6987before @code{main} is called or after it returns. The priority values must be 6988greater than 100 as the compiler reserves priority values between 0--100 for 6989the implementation. 6990 6991@item -Wstrict-aliasing 6992@opindex Wstrict-aliasing 6993@opindex Wno-strict-aliasing 6994This option is only active when @option{-fstrict-aliasing} is active. 6995It warns about code that might break the strict aliasing rules that the 6996compiler is using for optimization. The warning does not catch all 6997cases, but does attempt to catch the more common pitfalls. It is 6998included in @option{-Wall}. 6999It is equivalent to @option{-Wstrict-aliasing=3} 7000 7001@item -Wstrict-aliasing=n 7002@opindex Wstrict-aliasing=n 7003This option is only active when @option{-fstrict-aliasing} is active. 7004It warns about code that might break the strict aliasing rules that the 7005compiler is using for optimization. 7006Higher levels correspond to higher accuracy (fewer false positives). 7007Higher levels also correspond to more effort, similar to the way @option{-O} 7008works. 7009@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 7010 7011Level 1: Most aggressive, quick, least accurate. 7012Possibly useful when higher levels 7013do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 7014false negatives. However, it has many false positives. 7015Warns for all pointer conversions between possibly incompatible types, 7016even if never dereferenced. Runs in the front end only. 7017 7018Level 2: Aggressive, quick, not too precise. 7019May still have many false positives (not as many as level 1 though), 7020and few false negatives (but possibly more than level 1). 7021Unlike level 1, it only warns when an address is taken. Warns about 7022incomplete types. Runs in the front end only. 7023 7024Level 3 (default for @option{-Wstrict-aliasing}): 7025Should have very few false positives and few false 7026negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 7027Takes care of the common pun+dereference pattern in the front end: 7028@code{*(int*)&some_float}. 7029If optimization is enabled, it also runs in the back end, where it deals 7030with multiple statement cases using flow-sensitive points-to information. 7031Only warns when the converted pointer is dereferenced. 7032Does not warn about incomplete types. 7033 7034@item -Wstrict-overflow 7035@itemx -Wstrict-overflow=@var{n} 7036@opindex Wstrict-overflow 7037@opindex Wno-strict-overflow 7038This option is only active when signed overflow is undefined. 7039It warns about cases where the compiler optimizes based on the 7040assumption that signed overflow does not occur. Note that it does not 7041warn about all cases where the code might overflow: it only warns 7042about cases where the compiler implements some optimization. Thus 7043this warning depends on the optimization level. 7044 7045An optimization that assumes that signed overflow does not occur is 7046perfectly safe if the values of the variables involved are such that 7047overflow never does, in fact, occur. Therefore this warning can 7048easily give a false positive: a warning about code that is not 7049actually a problem. To help focus on important issues, several 7050warning levels are defined. No warnings are issued for the use of 7051undefined signed overflow when estimating how many iterations a loop 7052requires, in particular when determining whether a loop will be 7053executed at all. 7054 7055@table @gcctabopt 7056@item -Wstrict-overflow=1 7057Warn about cases that are both questionable and easy to avoid. For 7058example the compiler simplifies 7059@code{x + 1 > x} to @code{1}. This level of 7060@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 7061are not, and must be explicitly requested. 7062 7063@item -Wstrict-overflow=2 7064Also warn about other cases where a comparison is simplified to a 7065constant. For example: @code{abs (x) >= 0}. This can only be 7066simplified when signed integer overflow is undefined, because 7067@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 7068zero. @option{-Wstrict-overflow} (with no level) is the same as 7069@option{-Wstrict-overflow=2}. 7070 7071@item -Wstrict-overflow=3 7072Also warn about other cases where a comparison is simplified. For 7073example: @code{x + 1 > 1} is simplified to @code{x > 0}. 7074 7075@item -Wstrict-overflow=4 7076Also warn about other simplifications not covered by the above cases. 7077For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 7078 7079@item -Wstrict-overflow=5 7080Also warn about cases where the compiler reduces the magnitude of a 7081constant involved in a comparison. For example: @code{x + 2 > y} is 7082simplified to @code{x + 1 >= y}. This is reported only at the 7083highest warning level because this simplification applies to many 7084comparisons, so this warning level gives a very large number of 7085false positives. 7086@end table 7087 7088@item -Wstring-compare 7089@opindex Wstring-compare 7090@opindex Wno-string-compare 7091Warn for calls to @code{strcmp} and @code{strncmp} whose result is 7092determined to be either zero or non-zero in tests for such equality 7093owing to the length of one argument being greater than the size of 7094the array the other argument is stored in (or the bound in the case 7095of @code{strncmp}). Such calls could be mistakes. For example, 7096the call to @code{strcmp} below is diagnosed because its result is 7097necessarily non-zero irrespective of the contents of the array @code{a}. 7098 7099@smallexample 7100extern char a[4]; 7101void f (char *d) 7102@{ 7103 strcpy (d, "string"); 7104 @dots{} 7105 if (0 == strcmp (a, d)) // cannot be true 7106 puts ("a and d are the same"); 7107@} 7108@end smallexample 7109 7110@option{-Wstring-compare} is enabled by @option{-Wextra}. 7111 7112@item -Wno-stringop-overflow 7113@item -Wstringop-overflow 7114@itemx -Wstringop-overflow=@var{type} 7115@opindex Wstringop-overflow 7116@opindex Wno-stringop-overflow 7117Warn for calls to string manipulation functions such as @code{memcpy} and 7118@code{strcpy} that are determined to overflow the destination buffer. The 7119optional argument is one greater than the type of Object Size Checking to 7120perform to determine the size of the destination. @xref{Object Size Checking}. 7121The argument is meaningful only for functions that operate on character arrays 7122but not for raw memory functions like @code{memcpy} which always make use 7123of Object Size type-0. The option also warns for calls that specify a size 7124in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes. 7125The option produces the best results with optimization enabled but can detect 7126a small subset of simple buffer overflows even without optimization in 7127calls to the GCC built-in functions like @code{__builtin_memcpy} that 7128correspond to the standard functions. In any case, the option warns about 7129just a subset of buffer overflows detected by the corresponding overflow 7130checking built-ins. For example, the option issues a warning for 7131the @code{strcpy} call below because it copies at least 5 characters 7132(the string @code{"blue"} including the terminating NUL) into the buffer 7133of size 4. 7134 7135@smallexample 7136enum Color @{ blue, purple, yellow @}; 7137const char* f (enum Color clr) 7138@{ 7139 static char buf [4]; 7140 const char *str; 7141 switch (clr) 7142 @{ 7143 case blue: str = "blue"; break; 7144 case purple: str = "purple"; break; 7145 case yellow: str = "yellow"; break; 7146 @} 7147 7148 return strcpy (buf, str); // warning here 7149@} 7150@end smallexample 7151 7152Option @option{-Wstringop-overflow=2} is enabled by default. 7153 7154@table @gcctabopt 7155@item -Wstringop-overflow 7156@itemx -Wstringop-overflow=1 7157@opindex Wstringop-overflow 7158@opindex Wno-stringop-overflow 7159The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking 7160to determine the sizes of destination objects. At this setting the option 7161does not warn for writes past the end of subobjects of larger objects accessed 7162by pointers unless the size of the largest surrounding object is known. When 7163the destination may be one of several objects it is assumed to be the largest 7164one of them. On Linux systems, when optimization is enabled at this setting 7165the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro 7166is defined to a non-zero value. 7167 7168@item -Wstringop-overflow=2 7169The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking 7170to determine the sizes of destination objects. At this setting the option 7171warns about overflows when writing to members of the largest complete 7172objects whose exact size is known. However, it does not warn for excessive 7173writes to the same members of unknown objects referenced by pointers since 7174they may point to arrays containing unknown numbers of elements. This is 7175the default setting of the option. 7176 7177@item -Wstringop-overflow=3 7178The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking 7179to determine the sizes of destination objects. At this setting the option 7180warns about overflowing the smallest object or data member. This is the 7181most restrictive setting of the option that may result in warnings for safe 7182code. 7183 7184@item -Wstringop-overflow=4 7185The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking 7186to determine the sizes of destination objects. At this setting the option 7187warns about overflowing any data members, and when the destination is 7188one of several objects it uses the size of the largest of them to decide 7189whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this 7190setting of the option may result in warnings for benign code. 7191@end table 7192 7193@item -Wno-stringop-overread 7194@opindex Wstringop-overread 7195@opindex Wno-stringop-overread 7196Warn for calls to string manipulation functions such as @code{memchr}, or 7197@code{strcpy} that are determined to read past the end of the source 7198sequence. 7199 7200Option @option{-Wstringop-overread} is enabled by default. 7201 7202@item -Wno-stringop-truncation 7203@opindex Wstringop-truncation 7204@opindex Wno-stringop-truncation 7205Do not warn for calls to bounded string manipulation functions 7206such as @code{strncat}, 7207@code{strncpy}, and @code{stpncpy} that may either truncate the copied string 7208or leave the destination unchanged. 7209 7210In the following example, the call to @code{strncat} specifies a bound that 7211is less than the length of the source string. As a result, the copy of 7212the source will be truncated and so the call is diagnosed. To avoid the 7213warning use @code{bufsize - strlen (buf) - 1)} as the bound. 7214 7215@smallexample 7216void append (char *buf, size_t bufsize) 7217@{ 7218 strncat (buf, ".txt", 3); 7219@} 7220@end smallexample 7221 7222As another example, the following call to @code{strncpy} results in copying 7223to @code{d} just the characters preceding the terminating NUL, without 7224appending the NUL to the end. Assuming the result of @code{strncpy} is 7225necessarily a NUL-terminated string is a common mistake, and so the call 7226is diagnosed. To avoid the warning when the result is not expected to be 7227NUL-terminated, call @code{memcpy} instead. 7228 7229@smallexample 7230void copy (char *d, const char *s) 7231@{ 7232 strncpy (d, s, strlen (s)); 7233@} 7234@end smallexample 7235 7236In the following example, the call to @code{strncpy} specifies the size 7237of the destination buffer as the bound. If the length of the source 7238string is equal to or greater than this size the result of the copy will 7239not be NUL-terminated. Therefore, the call is also diagnosed. To avoid 7240the warning, specify @code{sizeof buf - 1} as the bound and set the last 7241element of the buffer to @code{NUL}. 7242 7243@smallexample 7244void copy (const char *s) 7245@{ 7246 char buf[80]; 7247 strncpy (buf, s, sizeof buf); 7248 @dots{} 7249@} 7250@end smallexample 7251 7252In situations where a character array is intended to store a sequence 7253of bytes with no terminating @code{NUL} such an array may be annotated 7254with attribute @code{nonstring} to avoid this warning. Such arrays, 7255however, are not suitable arguments to functions that expect 7256@code{NUL}-terminated strings. To help detect accidental misuses of 7257such arrays GCC issues warnings unless it can prove that the use is 7258safe. @xref{Common Variable Attributes}. 7259 7260@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]} 7261@opindex Wsuggest-attribute= 7262@opindex Wno-suggest-attribute= 7263Warn for cases where adding an attribute may be beneficial. The 7264attributes currently supported are listed below. 7265 7266@table @gcctabopt 7267@item -Wsuggest-attribute=pure 7268@itemx -Wsuggest-attribute=const 7269@itemx -Wsuggest-attribute=noreturn 7270@itemx -Wmissing-noreturn 7271@itemx -Wsuggest-attribute=malloc 7272@opindex Wsuggest-attribute=pure 7273@opindex Wno-suggest-attribute=pure 7274@opindex Wsuggest-attribute=const 7275@opindex Wno-suggest-attribute=const 7276@opindex Wsuggest-attribute=noreturn 7277@opindex Wno-suggest-attribute=noreturn 7278@opindex Wmissing-noreturn 7279@opindex Wno-missing-noreturn 7280@opindex Wsuggest-attribute=malloc 7281@opindex Wno-suggest-attribute=malloc 7282 7283Warn about functions that might be candidates for attributes 7284@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler 7285only warns for functions visible in other compilation units or (in the case of 7286@code{pure} and @code{const}) if it cannot prove that the function returns 7287normally. A function returns normally if it doesn't contain an infinite loop or 7288return abnormally by throwing, calling @code{abort} or trapping. This analysis 7289requires option @option{-fipa-pure-const}, which is enabled by default at 7290@option{-O} and higher. Higher optimization levels improve the accuracy 7291of the analysis. 7292 7293@item -Wsuggest-attribute=format 7294@itemx -Wmissing-format-attribute 7295@opindex Wsuggest-attribute=format 7296@opindex Wmissing-format-attribute 7297@opindex Wno-suggest-attribute=format 7298@opindex Wno-missing-format-attribute 7299@opindex Wformat 7300@opindex Wno-format 7301 7302Warn about function pointers that might be candidates for @code{format} 7303attributes. Note these are only possible candidates, not absolute ones. 7304GCC guesses that function pointers with @code{format} attributes that 7305are used in assignment, initialization, parameter passing or return 7306statements should have a corresponding @code{format} attribute in the 7307resulting type. I.e.@: the left-hand side of the assignment or 7308initialization, the type of the parameter variable, or the return type 7309of the containing function respectively should also have a @code{format} 7310attribute to avoid the warning. 7311 7312GCC also warns about function definitions that might be 7313candidates for @code{format} attributes. Again, these are only 7314possible candidates. GCC guesses that @code{format} attributes 7315might be appropriate for any function that calls a function like 7316@code{vprintf} or @code{vscanf}, but this might not always be the 7317case, and some functions for which @code{format} attributes are 7318appropriate may not be detected. 7319 7320@item -Wsuggest-attribute=cold 7321@opindex Wsuggest-attribute=cold 7322@opindex Wno-suggest-attribute=cold 7323 7324Warn about functions that might be candidates for @code{cold} attribute. This 7325is based on static detection and generally only warns about functions which 7326always leads to a call to another @code{cold} function such as wrappers of 7327C++ @code{throw} or fatal error reporting functions leading to @code{abort}. 7328@end table 7329 7330@item -Walloc-zero 7331@opindex Wno-alloc-zero 7332@opindex Walloc-zero 7333Warn about calls to allocation functions decorated with attribute 7334@code{alloc_size} that specify zero bytes, including those to the built-in 7335forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc}, 7336@code{malloc}, and @code{realloc}. Because the behavior of these functions 7337when called with a zero size differs among implementations (and in the case 7338of @code{realloc} has been deprecated) relying on it may result in subtle 7339portability bugs and should be avoided. 7340 7341@item -Walloc-size-larger-than=@var{byte-size} 7342@opindex Walloc-size-larger-than= 7343@opindex Wno-alloc-size-larger-than 7344Warn about calls to functions decorated with attribute @code{alloc_size} 7345that attempt to allocate objects larger than the specified number of bytes, 7346or where the result of the size computation in an integer type with infinite 7347precision would exceed the value of @samp{PTRDIFF_MAX} on the target. 7348@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 7349Warnings controlled by the option can be disabled either by specifying 7350@var{byte-size} of @samp{SIZE_MAX} or more or by 7351@option{-Wno-alloc-size-larger-than}. 7352@xref{Function Attributes}. 7353 7354@item -Wno-alloc-size-larger-than 7355@opindex Wno-alloc-size-larger-than 7356Disable @option{-Walloc-size-larger-than=} warnings. The option is 7357equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or 7358larger. 7359 7360@item -Walloca 7361@opindex Wno-alloca 7362@opindex Walloca 7363This option warns on all uses of @code{alloca} in the source. 7364 7365@item -Walloca-larger-than=@var{byte-size} 7366@opindex Walloca-larger-than= 7367@opindex Wno-alloca-larger-than 7368This option warns on calls to @code{alloca} with an integer argument whose 7369value is either zero, or that is not bounded by a controlling predicate 7370that limits its value to at most @var{byte-size}. It also warns for calls 7371to @code{alloca} where the bound value is unknown. Arguments of non-integer 7372types are considered unbounded even if they appear to be constrained to 7373the expected range. 7374 7375For example, a bounded case of @code{alloca} could be: 7376 7377@smallexample 7378void func (size_t n) 7379@{ 7380 void *p; 7381 if (n <= 1000) 7382 p = alloca (n); 7383 else 7384 p = malloc (n); 7385 f (p); 7386@} 7387@end smallexample 7388 7389In the above example, passing @code{-Walloca-larger-than=1000} would not 7390issue a warning because the call to @code{alloca} is known to be at most 73911000 bytes. However, if @code{-Walloca-larger-than=500} were passed, 7392the compiler would emit a warning. 7393 7394Unbounded uses, on the other hand, are uses of @code{alloca} with no 7395controlling predicate constraining its integer argument. For example: 7396 7397@smallexample 7398void func () 7399@{ 7400 void *p = alloca (n); 7401 f (p); 7402@} 7403@end smallexample 7404 7405If @code{-Walloca-larger-than=500} were passed, the above would trigger 7406a warning, but this time because of the lack of bounds checking. 7407 7408Note, that even seemingly correct code involving signed integers could 7409cause a warning: 7410 7411@smallexample 7412void func (signed int n) 7413@{ 7414 if (n < 500) 7415 @{ 7416 p = alloca (n); 7417 f (p); 7418 @} 7419@} 7420@end smallexample 7421 7422In the above example, @var{n} could be negative, causing a larger than 7423expected argument to be implicitly cast into the @code{alloca} call. 7424 7425This option also warns when @code{alloca} is used in a loop. 7426 7427@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default 7428but is usually only effective when @option{-ftree-vrp} is active (default 7429for @option{-O2} and above). 7430 7431See also @option{-Wvla-larger-than=}@samp{byte-size}. 7432 7433@item -Wno-alloca-larger-than 7434@opindex Wno-alloca-larger-than 7435Disable @option{-Walloca-larger-than=} warnings. The option is 7436equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger. 7437 7438@item -Warith-conversion 7439@opindex Warith-conversion 7440@opindex Wno-arith-conversion 7441Do warn about implicit conversions from arithmetic operations even 7442when conversion of the operands to the same type cannot change their 7443values. This affects warnings from @option{-Wconversion}, 7444@option{-Wfloat-conversion}, and @option{-Wsign-conversion}. 7445 7446@smallexample 7447@group 7448void f (char c, int i) 7449@{ 7450 c = c + i; // warns with @option{-Wconversion} 7451 c = c + 1; // only warns with @option{-Warith-conversion} 7452@} 7453@end group 7454@end smallexample 7455 7456@item -Warray-bounds 7457@itemx -Warray-bounds=@var{n} 7458@opindex Wno-array-bounds 7459@opindex Warray-bounds 7460This option is only active when @option{-ftree-vrp} is active 7461(default for @option{-O2} and above). It warns about subscripts to arrays 7462that are always out of bounds. This warning is enabled by @option{-Wall}. 7463 7464@table @gcctabopt 7465@item -Warray-bounds=1 7466This is the warning level of @option{-Warray-bounds} and is enabled 7467by @option{-Wall}; higher levels are not, and must be explicitly requested. 7468 7469@item -Warray-bounds=2 7470This warning level also warns about out of bounds access for 7471arrays at the end of a struct and for arrays accessed through 7472pointers. This warning level may give a larger number of 7473false positives and is deactivated by default. 7474@end table 7475 7476@item -Warray-parameter 7477@itemx -Warray-parameter=@var{n} 7478@opindex Wno-array-parameter 7479Warn about redeclarations of functions involving arguments of array or 7480pointer types of inconsistent kinds or forms, and enable the detection 7481of out-of-bounds accesses to such parameters by warnings such as 7482@option{-Warray-bounds}. 7483 7484If the first function declaration uses the array form the bound specified 7485in the array is assumed to be the minimum number of elements expected to 7486be provided in calls to the function and the maximum number of elements 7487accessed by it. Failing to provide arguments of sufficient size or accessing 7488more than the maximum number of elements may be diagnosed by warnings such 7489as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies 7490involving array parameters declared using the @code{T[static N]} form. 7491 7492For example, the warning triggers for the following redeclarations because 7493the first one allows an array of any size to be passed to @code{f} while 7494the second one with the keyword @code{static} specifies that the array 7495argument must have at least four elements. 7496 7497@smallexample 7498void f (int[static 4]); 7499void f (int[]); // warning (inconsistent array form) 7500 7501void g (void) 7502@{ 7503 int *p = (int *)malloc (4); 7504 f (p); // warning (array too small) 7505 @dots{} 7506@} 7507@end smallexample 7508 7509At level 2 the warning also triggers for redeclarations involving any other 7510inconsistency in array or pointer argument forms denoting array sizes. 7511Pointers and arrays of unspecified bound are considered equivalent and do 7512not trigger a warning. 7513 7514@smallexample 7515void g (int*); 7516void g (int[]); // no warning 7517void g (int[8]); // warning (inconsistent array bound) 7518@end smallexample 7519 7520@option{-Warray-parameter=2} is included in @option{-Wall}. The 7521@option{-Wvla-parameter} option triggers warnings for similar inconsistencies 7522involving Variable Length Array arguments. 7523 7524@item -Wattribute-alias=@var{n} 7525@itemx -Wno-attribute-alias 7526@opindex Wattribute-alias 7527@opindex Wno-attribute-alias 7528Warn about declarations using the @code{alias} and similar attributes whose 7529target is incompatible with the type of the alias. 7530@xref{Function Attributes,,Declaring Attributes of Functions}. 7531 7532@table @gcctabopt 7533@item -Wattribute-alias=1 7534The default warning level of the @option{-Wattribute-alias} option diagnoses 7535incompatibilities between the type of the alias declaration and that of its 7536target. Such incompatibilities are typically indicative of bugs. 7537 7538@item -Wattribute-alias=2 7539 7540At this level @option{-Wattribute-alias} also diagnoses cases where 7541the attributes of the alias declaration are more restrictive than the 7542attributes applied to its target. These mismatches can potentially 7543result in incorrect code generation. In other cases they may be 7544benign and could be resolved simply by adding the missing attribute to 7545the target. For comparison, see the @option{-Wmissing-attributes} 7546option, which controls diagnostics when the alias declaration is less 7547restrictive than the target, rather than more restrictive. 7548 7549Attributes considered include @code{alloc_align}, @code{alloc_size}, 7550@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 7551@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 7552@code{returns_nonnull}, and @code{returns_twice}. 7553@end table 7554 7555@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}. 7556This is the default. You can disable these warnings with either 7557@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}. 7558 7559@item -Wbool-compare 7560@opindex Wno-bool-compare 7561@opindex Wbool-compare 7562Warn about boolean expression compared with an integer value different from 7563@code{true}/@code{false}. For instance, the following comparison is 7564always false: 7565@smallexample 7566int n = 5; 7567@dots{} 7568if ((n > 1) == 2) @{ @dots{} @} 7569@end smallexample 7570This warning is enabled by @option{-Wall}. 7571 7572@item -Wbool-operation 7573@opindex Wno-bool-operation 7574@opindex Wbool-operation 7575Warn about suspicious operations on expressions of a boolean type. For 7576instance, bitwise negation of a boolean is very likely a bug in the program. 7577For C, this warning also warns about incrementing or decrementing a boolean, 7578which rarely makes sense. (In C++, decrementing a boolean is always invalid. 7579Incrementing a boolean is invalid in C++17, and deprecated otherwise.) 7580 7581This warning is enabled by @option{-Wall}. 7582 7583@item -Wduplicated-branches 7584@opindex Wno-duplicated-branches 7585@opindex Wduplicated-branches 7586Warn when an if-else has identical branches. This warning detects cases like 7587@smallexample 7588if (p != NULL) 7589 return 0; 7590else 7591 return 0; 7592@end smallexample 7593It doesn't warn when both branches contain just a null statement. This warning 7594also warn for conditional operators: 7595@smallexample 7596 int i = x ? *p : *p; 7597@end smallexample 7598 7599@item -Wduplicated-cond 7600@opindex Wno-duplicated-cond 7601@opindex Wduplicated-cond 7602Warn about duplicated conditions in an if-else-if chain. For instance, 7603warn for the following code: 7604@smallexample 7605if (p->q != NULL) @{ @dots{} @} 7606else if (p->q != NULL) @{ @dots{} @} 7607@end smallexample 7608 7609@item -Wframe-address 7610@opindex Wno-frame-address 7611@opindex Wframe-address 7612Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address} 7613is called with an argument greater than 0. Such calls may return indeterminate 7614values or crash the program. The warning is included in @option{-Wall}. 7615 7616@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 7617@opindex Wno-discarded-qualifiers 7618@opindex Wdiscarded-qualifiers 7619Do not warn if type qualifiers on pointers are being discarded. 7620Typically, the compiler warns if a @code{const char *} variable is 7621passed to a function that takes a @code{char *} parameter. This option 7622can be used to suppress such a warning. 7623 7624@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 7625@opindex Wno-discarded-array-qualifiers 7626@opindex Wdiscarded-array-qualifiers 7627Do not warn if type qualifiers on arrays which are pointer targets 7628are being discarded. Typically, the compiler warns if a 7629@code{const int (*)[]} variable is passed to a function that 7630takes a @code{int (*)[]} parameter. This option can be used to 7631suppress such a warning. 7632 7633@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 7634@opindex Wno-incompatible-pointer-types 7635@opindex Wincompatible-pointer-types 7636Do not warn when there is a conversion between pointers that have incompatible 7637types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 7638which warns for pointer argument passing or assignment with different 7639signedness. 7640 7641@item -Wno-int-conversion @r{(C and Objective-C only)} 7642@opindex Wno-int-conversion 7643@opindex Wint-conversion 7644Do not warn about incompatible integer to pointer and pointer to integer 7645conversions. This warning is about implicit conversions; for explicit 7646conversions the warnings @option{-Wno-int-to-pointer-cast} and 7647@option{-Wno-pointer-to-int-cast} may be used. 7648 7649@item -Wzero-length-bounds 7650@opindex Wzero-length-bounds 7651@opindex Wzero-length-bounds 7652Warn about accesses to elements of zero-length array members that might 7653overlap other members of the same object. Declaring interior zero-length 7654arrays is discouraged because accesses to them are undefined. See 7655@xref{Zero Length}. 7656 7657For example, the first two stores in function @code{bad} are diagnosed 7658because the array elements overlap the subsequent members @code{b} and 7659@code{c}. The third store is diagnosed by @option{-Warray-bounds} 7660because it is beyond the bounds of the enclosing object. 7661 7662@smallexample 7663struct X @{ int a[0]; int b, c; @}; 7664struct X x; 7665 7666void bad (void) 7667@{ 7668 x.a[0] = 0; // -Wzero-length-bounds 7669 x.a[1] = 1; // -Wzero-length-bounds 7670 x.a[2] = 2; // -Warray-bounds 7671@} 7672@end smallexample 7673 7674Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}. 7675 7676@item -Wno-div-by-zero 7677@opindex Wno-div-by-zero 7678@opindex Wdiv-by-zero 7679Do not warn about compile-time integer division by zero. Floating-point 7680division by zero is not warned about, as it can be a legitimate way of 7681obtaining infinities and NaNs. 7682 7683@item -Wsystem-headers 7684@opindex Wsystem-headers 7685@opindex Wno-system-headers 7686@cindex warnings from system headers 7687@cindex system headers, warnings from 7688Print warning messages for constructs found in system header files. 7689Warnings from system headers are normally suppressed, on the assumption 7690that they usually do not indicate real problems and would only make the 7691compiler output harder to read. Using this command-line option tells 7692GCC to emit warnings from system headers as if they occurred in user 7693code. However, note that using @option{-Wall} in conjunction with this 7694option does @emph{not} warn about unknown pragmas in system 7695headers---for that, @option{-Wunknown-pragmas} must also be used. 7696 7697@item -Wtautological-compare 7698@opindex Wtautological-compare 7699@opindex Wno-tautological-compare 7700Warn if a self-comparison always evaluates to true or false. This 7701warning detects various mistakes such as: 7702@smallexample 7703int i = 1; 7704@dots{} 7705if (i > i) @{ @dots{} @} 7706@end smallexample 7707 7708This warning also warns about bitwise comparisons that always evaluate 7709to true or false, for instance: 7710@smallexample 7711if ((a & 16) == 10) @{ @dots{} @} 7712@end smallexample 7713will always be false. 7714 7715This warning is enabled by @option{-Wall}. 7716 7717@item -Wtrampolines 7718@opindex Wtrampolines 7719@opindex Wno-trampolines 7720Warn about trampolines generated for pointers to nested functions. 7721A trampoline is a small piece of data or code that is created at run 7722time on the stack when the address of a nested function is taken, and is 7723used to call the nested function indirectly. For some targets, it is 7724made up of data only and thus requires no special treatment. But, for 7725most targets, it is made up of code and thus requires the stack to be 7726made executable in order for the program to work properly. 7727 7728@item -Wfloat-equal 7729@opindex Wfloat-equal 7730@opindex Wno-float-equal 7731Warn if floating-point values are used in equality comparisons. 7732 7733The idea behind this is that sometimes it is convenient (for the 7734programmer) to consider floating-point values as approximations to 7735infinitely precise real numbers. If you are doing this, then you need 7736to compute (by analyzing the code, or in some other way) the maximum or 7737likely maximum error that the computation introduces, and allow for it 7738when performing comparisons (and when producing output, but that's a 7739different problem). In particular, instead of testing for equality, you 7740should check to see whether the two values have ranges that overlap; and 7741this is done with the relational operators, so equality comparisons are 7742probably mistaken. 7743 7744@item -Wtraditional @r{(C and Objective-C only)} 7745@opindex Wtraditional 7746@opindex Wno-traditional 7747Warn about certain constructs that behave differently in traditional and 7748ISO C@. Also warn about ISO C constructs that have no traditional C 7749equivalent, and/or problematic constructs that should be avoided. 7750 7751@itemize @bullet 7752@item 7753Macro parameters that appear within string literals in the macro body. 7754In traditional C macro replacement takes place within string literals, 7755but in ISO C it does not. 7756 7757@item 7758In traditional C, some preprocessor directives did not exist. 7759Traditional preprocessors only considered a line to be a directive 7760if the @samp{#} appeared in column 1 on the line. Therefore 7761@option{-Wtraditional} warns about directives that traditional C 7762understands but ignores because the @samp{#} does not appear as the 7763first character on the line. It also suggests you hide directives like 7764@code{#pragma} not understood by traditional C by indenting them. Some 7765traditional implementations do not recognize @code{#elif}, so this option 7766suggests avoiding it altogether. 7767 7768@item 7769A function-like macro that appears without arguments. 7770 7771@item 7772The unary plus operator. 7773 7774@item 7775The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 7776constant suffixes. (Traditional C does support the @samp{L} suffix on integer 7777constants.) Note, these suffixes appear in macros defined in the system 7778headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 7779Use of these macros in user code might normally lead to spurious 7780warnings, however GCC's integrated preprocessor has enough context to 7781avoid warning in these cases. 7782 7783@item 7784A function declared external in one block and then used after the end of 7785the block. 7786 7787@item 7788A @code{switch} statement has an operand of type @code{long}. 7789 7790@item 7791A non-@code{static} function declaration follows a @code{static} one. 7792This construct is not accepted by some traditional C compilers. 7793 7794@item 7795The ISO type of an integer constant has a different width or 7796signedness from its traditional type. This warning is only issued if 7797the base of the constant is ten. I.e.@: hexadecimal or octal values, which 7798typically represent bit patterns, are not warned about. 7799 7800@item 7801Usage of ISO string concatenation is detected. 7802 7803@item 7804Initialization of automatic aggregates. 7805 7806@item 7807Identifier conflicts with labels. Traditional C lacks a separate 7808namespace for labels. 7809 7810@item 7811Initialization of unions. If the initializer is zero, the warning is 7812omitted. This is done under the assumption that the zero initializer in 7813user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 7814initializer warnings and relies on default initialization to zero in the 7815traditional C case. 7816 7817@item 7818Conversions by prototypes between fixed/floating-point values and vice 7819versa. The absence of these prototypes when compiling with traditional 7820C causes serious problems. This is a subset of the possible 7821conversion warnings; for the full set use @option{-Wtraditional-conversion}. 7822 7823@item 7824Use of ISO C style function definitions. This warning intentionally is 7825@emph{not} issued for prototype declarations or variadic functions 7826because these ISO C features appear in your code when using 7827libiberty's traditional C compatibility macros, @code{PARAMS} and 7828@code{VPARAMS}. This warning is also bypassed for nested functions 7829because that feature is already a GCC extension and thus not relevant to 7830traditional C compatibility. 7831@end itemize 7832 7833@item -Wtraditional-conversion @r{(C and Objective-C only)} 7834@opindex Wtraditional-conversion 7835@opindex Wno-traditional-conversion 7836Warn if a prototype causes a type conversion that is different from what 7837would happen to the same argument in the absence of a prototype. This 7838includes conversions of fixed point to floating and vice versa, and 7839conversions changing the width or signedness of a fixed-point argument 7840except when the same as the default promotion. 7841 7842@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 7843@opindex Wdeclaration-after-statement 7844@opindex Wno-declaration-after-statement 7845Warn when a declaration is found after a statement in a block. This 7846construct, known from C++, was introduced with ISO C99 and is by default 7847allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}. 7848 7849@item -Wshadow 7850@opindex Wshadow 7851@opindex Wno-shadow 7852Warn whenever a local variable or type declaration shadows another 7853variable, parameter, type, class member (in C++), or instance variable 7854(in Objective-C) or whenever a built-in function is shadowed. Note 7855that in C++, the compiler warns if a local variable shadows an 7856explicit typedef, but not if it shadows a struct/class/enum. 7857If this warning is enabled, it includes also all instances of 7858local shadowing. This means that @option{-Wno-shadow=local} 7859and @option{-Wno-shadow=compatible-local} are ignored when 7860@option{-Wshadow} is used. 7861Same as @option{-Wshadow=global}. 7862 7863@item -Wno-shadow-ivar @r{(Objective-C only)} 7864@opindex Wno-shadow-ivar 7865@opindex Wshadow-ivar 7866Do not warn whenever a local variable shadows an instance variable in an 7867Objective-C method. 7868 7869@item -Wshadow=global 7870@opindex Wshadow=global 7871Warn for any shadowing. 7872Same as @option{-Wshadow}. 7873 7874@item -Wshadow=local 7875@opindex Wshadow=local 7876Warn when a local variable shadows another local variable or parameter. 7877 7878@item -Wshadow=compatible-local 7879@opindex Wshadow=compatible-local 7880Warn when a local variable shadows another local variable or parameter 7881whose type is compatible with that of the shadowing variable. In C++, 7882type compatibility here means the type of the shadowing variable can be 7883converted to that of the shadowed variable. The creation of this flag 7884(in addition to @option{-Wshadow=local}) is based on the idea that when 7885a local variable shadows another one of incompatible type, it is most 7886likely intentional, not a bug or typo, as shown in the following example: 7887 7888@smallexample 7889@group 7890for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) 7891@{ 7892 for (int i = 0; i < N; ++i) 7893 @{ 7894 ... 7895 @} 7896 ... 7897@} 7898@end group 7899@end smallexample 7900 7901Since the two variable @code{i} in the example above have incompatible types, 7902enabling only @option{-Wshadow=compatible-local} does not emit a warning. 7903Because their types are incompatible, if a programmer accidentally uses one 7904in place of the other, type checking is expected to catch that and emit an 7905error or warning. Use of this flag instead of @option{-Wshadow=local} can 7906possibly reduce the number of warnings triggered by intentional shadowing. 7907Note that this also means that shadowing @code{const char *i} by 7908@code{char *i} does not emit a warning. 7909 7910This warning is also enabled by @option{-Wshadow=local}. 7911 7912@item -Wlarger-than=@var{byte-size} 7913@opindex Wlarger-than= 7914@opindex Wlarger-than-@var{byte-size} 7915Warn whenever an object is defined whose size exceeds @var{byte-size}. 7916@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default. 7917Warnings controlled by the option can be disabled either by specifying 7918@var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}. 7919 7920Also warn for calls to bounded functions such as @code{memchr} or 7921@code{strnlen} that specify a bound greater than the largest possible 7922object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings 7923can only be disabled by @option{-Wno-larger-than}. 7924 7925@item -Wno-larger-than 7926@opindex Wno-larger-than 7927Disable @option{-Wlarger-than=} warnings. The option is equivalent 7928to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger. 7929 7930@item -Wframe-larger-than=@var{byte-size} 7931@opindex Wframe-larger-than= 7932@opindex Wno-frame-larger-than 7933Warn if the size of a function frame exceeds @var{byte-size}. 7934The computation done to determine the stack frame size is approximate 7935and not conservative. 7936The actual requirements may be somewhat greater than @var{byte-size} 7937even if you do not get a warning. In addition, any space allocated 7938via @code{alloca}, variable-length arrays, or related constructs 7939is not included by the compiler when determining 7940whether or not to issue a warning. 7941@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 7942Warnings controlled by the option can be disabled either by specifying 7943@var{byte-size} of @samp{SIZE_MAX} or more or by 7944@option{-Wno-frame-larger-than}. 7945 7946@item -Wno-frame-larger-than 7947@opindex Wno-frame-larger-than 7948Disable @option{-Wframe-larger-than=} warnings. The option is equivalent 7949to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger. 7950 7951@item -Wno-free-nonheap-object 7952@opindex Wno-free-nonheap-object 7953@opindex Wfree-nonheap-object 7954Warn when attempting to deallocate an object that was either not allocated 7955on the heap, or by using a pointer that was not returned from a prior call 7956to the corresponding allocation function. For example, because the call 7957to @code{stpcpy} returns a pointer to the terminating nul character and 7958not to the begginning of the object, the call to @code{free} below is 7959diagnosed. 7960 7961@smallexample 7962void f (char *p) 7963@{ 7964 p = stpcpy (p, "abc"); 7965 // ... 7966 free (p); // warning 7967@} 7968@end smallexample 7969 7970@option{-Wfree-nonheap-object} is enabled by default. 7971 7972@item -Wstack-usage=@var{byte-size} 7973@opindex Wstack-usage 7974@opindex Wno-stack-usage 7975Warn if the stack usage of a function might exceed @var{byte-size}. 7976The computation done to determine the stack usage is conservative. 7977Any space allocated via @code{alloca}, variable-length arrays, or related 7978constructs is included by the compiler when determining whether or not to 7979issue a warning. 7980 7981The message is in keeping with the output of @option{-fstack-usage}. 7982 7983@itemize 7984@item 7985If the stack usage is fully static but exceeds the specified amount, it's: 7986 7987@smallexample 7988 warning: stack usage is 1120 bytes 7989@end smallexample 7990@item 7991If the stack usage is (partly) dynamic but bounded, it's: 7992 7993@smallexample 7994 warning: stack usage might be 1648 bytes 7995@end smallexample 7996@item 7997If the stack usage is (partly) dynamic and not bounded, it's: 7998 7999@smallexample 8000 warning: stack usage might be unbounded 8001@end smallexample 8002@end itemize 8003 8004@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default. 8005Warnings controlled by the option can be disabled either by specifying 8006@var{byte-size} of @samp{SIZE_MAX} or more or by 8007@option{-Wno-stack-usage}. 8008 8009@item -Wno-stack-usage 8010@opindex Wno-stack-usage 8011Disable @option{-Wstack-usage=} warnings. The option is equivalent 8012to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger. 8013 8014@item -Wunsafe-loop-optimizations 8015@opindex Wunsafe-loop-optimizations 8016@opindex Wno-unsafe-loop-optimizations 8017Warn if the loop cannot be optimized because the compiler cannot 8018assume anything on the bounds of the loop indices. With 8019@option{-funsafe-loop-optimizations} warn if the compiler makes 8020such assumptions. 8021 8022@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 8023@opindex Wno-pedantic-ms-format 8024@opindex Wpedantic-ms-format 8025When used in combination with @option{-Wformat} 8026and @option{-pedantic} without GNU extensions, this option 8027disables the warnings about non-ISO @code{printf} / @code{scanf} format 8028width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 8029which depend on the MS runtime. 8030 8031@item -Wpointer-arith 8032@opindex Wpointer-arith 8033@opindex Wno-pointer-arith 8034Warn about anything that depends on the ``size of'' a function type or 8035of @code{void}. GNU C assigns these types a size of 1, for 8036convenience in calculations with @code{void *} pointers and pointers 8037to functions. In C++, warn also when an arithmetic operation involves 8038@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 8039 8040@item -Wno-pointer-compare 8041@opindex Wpointer-compare 8042@opindex Wno-pointer-compare 8043Do not warn if a pointer is compared with a zero character constant. 8044This usually 8045means that the pointer was meant to be dereferenced. For example: 8046 8047@smallexample 8048const char *p = foo (); 8049if (p == '\0') 8050 return 42; 8051@end smallexample 8052 8053Note that the code above is invalid in C++11. 8054 8055This warning is enabled by default. 8056 8057@item -Wtsan 8058@opindex Wtsan 8059@opindex Wno-tsan 8060Warn about unsupported features in ThreadSanitizer. 8061 8062ThreadSanitizer does not support @code{std::atomic_thread_fence} and 8063can report false positives. 8064 8065This warning is enabled by default. 8066 8067@item -Wtype-limits 8068@opindex Wtype-limits 8069@opindex Wno-type-limits 8070Warn if a comparison is always true or always false due to the limited 8071range of the data type, but do not warn for constant expressions. For 8072example, warn if an unsigned variable is compared against zero with 8073@code{<} or @code{>=}. This warning is also enabled by 8074@option{-Wextra}. 8075 8076@item -Wabsolute-value @r{(C and Objective-C only)} 8077@opindex Wabsolute-value 8078@opindex Wno-absolute-value 8079Warn for calls to standard functions that compute the absolute value 8080of an argument when a more appropriate standard function is available. 8081For example, calling @code{abs(3.14)} triggers the warning because the 8082appropriate function to call to compute the absolute value of a double 8083argument is @code{fabs}. The option also triggers warnings when the 8084argument in a call to such a function has an unsigned type. This 8085warning can be suppressed with an explicit type cast and it is also 8086enabled by @option{-Wextra}. 8087 8088@include cppwarnopts.texi 8089 8090@item -Wbad-function-cast @r{(C and Objective-C only)} 8091@opindex Wbad-function-cast 8092@opindex Wno-bad-function-cast 8093Warn when a function call is cast to a non-matching type. 8094For example, warn if a call to a function returning an integer type 8095is cast to a pointer type. 8096 8097@item -Wc90-c99-compat @r{(C and Objective-C only)} 8098@opindex Wc90-c99-compat 8099@opindex Wno-c90-c99-compat 8100Warn about features not present in ISO C90, but present in ISO C99. 8101For instance, warn about use of variable length arrays, @code{long long} 8102type, @code{bool} type, compound literals, designated initializers, and so 8103on. This option is independent of the standards mode. Warnings are disabled 8104in the expression that follows @code{__extension__}. 8105 8106@item -Wc99-c11-compat @r{(C and Objective-C only)} 8107@opindex Wc99-c11-compat 8108@opindex Wno-c99-c11-compat 8109Warn about features not present in ISO C99, but present in ISO C11. 8110For instance, warn about use of anonymous structures and unions, 8111@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 8112@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 8113and so on. This option is independent of the standards mode. Warnings are 8114disabled in the expression that follows @code{__extension__}. 8115 8116@item -Wc11-c2x-compat @r{(C and Objective-C only)} 8117@opindex Wc11-c2x-compat 8118@opindex Wno-c11-c2x-compat 8119Warn about features not present in ISO C11, but present in ISO C2X. 8120For instance, warn about omitting the string in @code{_Static_assert}, 8121use of @samp{[[]]} syntax for attributes, use of decimal 8122floating-point types, and so on. This option is independent of the 8123standards mode. Warnings are disabled in the expression that follows 8124@code{__extension__}. 8125 8126@item -Wc++-compat @r{(C and Objective-C only)} 8127@opindex Wc++-compat 8128@opindex Wno-c++-compat 8129Warn about ISO C constructs that are outside of the common subset of 8130ISO C and ISO C++, e.g.@: request for implicit conversion from 8131@code{void *} to a pointer to non-@code{void} type. 8132 8133@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 8134@opindex Wc++11-compat 8135@opindex Wno-c++11-compat 8136Warn about C++ constructs whose meaning differs between ISO C++ 1998 8137and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 8138in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 8139enabled by @option{-Wall}. 8140 8141@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 8142@opindex Wc++14-compat 8143@opindex Wno-c++14-compat 8144Warn about C++ constructs whose meaning differs between ISO C++ 2011 8145and ISO C++ 2014. This warning is enabled by @option{-Wall}. 8146 8147@item -Wc++17-compat @r{(C++ and Objective-C++ only)} 8148@opindex Wc++17-compat 8149@opindex Wno-c++17-compat 8150Warn about C++ constructs whose meaning differs between ISO C++ 2014 8151and ISO C++ 2017. This warning is enabled by @option{-Wall}. 8152 8153@item -Wc++20-compat @r{(C++ and Objective-C++ only)} 8154@opindex Wc++20-compat 8155@opindex Wno-c++20-compat 8156Warn about C++ constructs whose meaning differs between ISO C++ 2017 8157and ISO C++ 2020. This warning is enabled by @option{-Wall}. 8158 8159@item -Wcast-qual 8160@opindex Wcast-qual 8161@opindex Wno-cast-qual 8162Warn whenever a pointer is cast so as to remove a type qualifier from 8163the target type. For example, warn if a @code{const char *} is cast 8164to an ordinary @code{char *}. 8165 8166Also warn when making a cast that introduces a type qualifier in an 8167unsafe way. For example, casting @code{char **} to @code{const char **} 8168is unsafe, as in this example: 8169 8170@smallexample 8171 /* p is char ** value. */ 8172 const char **q = (const char **) p; 8173 /* Assignment of readonly string to const char * is OK. */ 8174 *q = "string"; 8175 /* Now char** pointer points to read-only memory. */ 8176 **p = 'b'; 8177@end smallexample 8178 8179@item -Wcast-align 8180@opindex Wcast-align 8181@opindex Wno-cast-align 8182Warn whenever a pointer is cast such that the required alignment of the 8183target is increased. For example, warn if a @code{char *} is cast to 8184an @code{int *} on machines where integers can only be accessed at 8185two- or four-byte boundaries. 8186 8187@item -Wcast-align=strict 8188@opindex Wcast-align=strict 8189Warn whenever a pointer is cast such that the required alignment of the 8190target is increased. For example, warn if a @code{char *} is cast to 8191an @code{int *} regardless of the target machine. 8192 8193@item -Wcast-function-type 8194@opindex Wcast-function-type 8195@opindex Wno-cast-function-type 8196Warn when a function pointer is cast to an incompatible function pointer. 8197In a cast involving function types with a variable argument list only 8198the types of initial arguments that are provided are considered. 8199Any parameter of pointer-type matches any other pointer-type. Any benign 8200differences in integral types are ignored, like @code{int} vs.@: @code{long} 8201on ILP32 targets. Likewise type qualifiers are ignored. The function 8202type @code{void (*) (void)} is special and matches everything, which can 8203be used to suppress this warning. 8204In a cast involving pointer to member types this warning warns whenever 8205the type cast is changing the pointer to member type. 8206This warning is enabled by @option{-Wextra}. 8207 8208@item -Wwrite-strings 8209@opindex Wwrite-strings 8210@opindex Wno-write-strings 8211When compiling C, give string constants the type @code{const 8212char[@var{length}]} so that copying the address of one into a 8213non-@code{const} @code{char *} pointer produces a warning. These 8214warnings help you find at compile time code that can try to write 8215into a string constant, but only if you have been very careful about 8216using @code{const} in declarations and prototypes. Otherwise, it is 8217just a nuisance. This is why we did not make @option{-Wall} request 8218these warnings. 8219 8220When compiling C++, warn about the deprecated conversion from string 8221literals to @code{char *}. This warning is enabled by default for C++ 8222programs. 8223 8224@item -Wclobbered 8225@opindex Wclobbered 8226@opindex Wno-clobbered 8227Warn for variables that might be changed by @code{longjmp} or 8228@code{vfork}. This warning is also enabled by @option{-Wextra}. 8229 8230@item -Wconversion 8231@opindex Wconversion 8232@opindex Wno-conversion 8233Warn for implicit conversions that may alter a value. This includes 8234conversions between real and integer, like @code{abs (x)} when 8235@code{x} is @code{double}; conversions between signed and unsigned, 8236like @code{unsigned ui = -1}; and conversions to smaller types, like 8237@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 8238((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 8239changed by the conversion like in @code{abs (2.0)}. Warnings about 8240conversions between signed and unsigned integers can be disabled by 8241using @option{-Wno-sign-conversion}. 8242 8243For C++, also warn for confusing overload resolution for user-defined 8244conversions; and conversions that never use a type conversion 8245operator: conversions to @code{void}, the same type, a base class or a 8246reference to them. Warnings about conversions between signed and 8247unsigned integers are disabled by default in C++ unless 8248@option{-Wsign-conversion} is explicitly enabled. 8249 8250Warnings about conversion from arithmetic on a small type back to that 8251type are only given with @option{-Warith-conversion}. 8252 8253@item -Wdangling-else 8254@opindex Wdangling-else 8255@opindex Wno-dangling-else 8256Warn about constructions where there may be confusion to which 8257@code{if} statement an @code{else} branch belongs. Here is an example of 8258such a case: 8259 8260@smallexample 8261@group 8262@{ 8263 if (a) 8264 if (b) 8265 foo (); 8266 else 8267 bar (); 8268@} 8269@end group 8270@end smallexample 8271 8272In C/C++, every @code{else} branch belongs to the innermost possible 8273@code{if} statement, which in this example is @code{if (b)}. This is 8274often not what the programmer expected, as illustrated in the above 8275example by indentation the programmer chose. When there is the 8276potential for this confusion, GCC issues a warning when this flag 8277is specified. To eliminate the warning, add explicit braces around 8278the innermost @code{if} statement so there is no way the @code{else} 8279can belong to the enclosing @code{if}. The resulting code 8280looks like this: 8281 8282@smallexample 8283@group 8284@{ 8285 if (a) 8286 @{ 8287 if (b) 8288 foo (); 8289 else 8290 bar (); 8291 @} 8292@} 8293@end group 8294@end smallexample 8295 8296This warning is enabled by @option{-Wparentheses}. 8297 8298@item -Wdate-time 8299@opindex Wdate-time 8300@opindex Wno-date-time 8301Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 8302are encountered as they might prevent bit-wise-identical reproducible 8303compilations. 8304 8305@item -Wempty-body 8306@opindex Wempty-body 8307@opindex Wno-empty-body 8308Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 8309while} statement. This warning is also enabled by @option{-Wextra}. 8310 8311@item -Wno-endif-labels 8312@opindex Wendif-labels 8313@opindex Wno-endif-labels 8314Do not warn about stray tokens after @code{#else} and @code{#endif}. 8315 8316@item -Wenum-compare 8317@opindex Wenum-compare 8318@opindex Wno-enum-compare 8319Warn about a comparison between values of different enumerated types. 8320In C++ enumerated type mismatches in conditional expressions are also 8321diagnosed and the warning is enabled by default. In C this warning is 8322enabled by @option{-Wall}. 8323 8324@item -Wenum-conversion 8325@opindex Wenum-conversion 8326@opindex Wno-enum-conversion 8327Warn when a value of enumerated type is implicitly converted to a 8328different enumerated type. This warning is enabled by @option{-Wextra} 8329in C@. 8330 8331@item -Wjump-misses-init @r{(C, Objective-C only)} 8332@opindex Wjump-misses-init 8333@opindex Wno-jump-misses-init 8334Warn if a @code{goto} statement or a @code{switch} statement jumps 8335forward across the initialization of a variable, or jumps backward to a 8336label after the variable has been initialized. This only warns about 8337variables that are initialized when they are declared. This warning is 8338only supported for C and Objective-C; in C++ this sort of branch is an 8339error in any case. 8340 8341@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 8342can be disabled with the @option{-Wno-jump-misses-init} option. 8343 8344@item -Wsign-compare 8345@opindex Wsign-compare 8346@opindex Wno-sign-compare 8347@cindex warning for comparison of signed and unsigned values 8348@cindex comparison of signed and unsigned values, warning 8349@cindex signed and unsigned values, comparison warning 8350Warn when a comparison between signed and unsigned values could produce 8351an incorrect result when the signed value is converted to unsigned. 8352In C++, this warning is also enabled by @option{-Wall}. In C, it is 8353also enabled by @option{-Wextra}. 8354 8355@item -Wsign-conversion 8356@opindex Wsign-conversion 8357@opindex Wno-sign-conversion 8358Warn for implicit conversions that may change the sign of an integer 8359value, like assigning a signed integer expression to an unsigned 8360integer variable. An explicit cast silences the warning. In C, this 8361option is enabled also by @option{-Wconversion}. 8362 8363@item -Wfloat-conversion 8364@opindex Wfloat-conversion 8365@opindex Wno-float-conversion 8366Warn for implicit conversions that reduce the precision of a real value. 8367This includes conversions from real to integer, and from higher precision 8368real to lower precision real values. This option is also enabled by 8369@option{-Wconversion}. 8370 8371@item -Wno-scalar-storage-order 8372@opindex Wno-scalar-storage-order 8373@opindex Wscalar-storage-order 8374Do not warn on suspicious constructs involving reverse scalar storage order. 8375 8376@item -Wsizeof-array-div 8377@opindex Wsizeof-array-div 8378@opindex Wno-sizeof-array-div 8379Warn about divisions of two sizeof operators when the first one is applied 8380to an array and the divisor does not equal the size of the array element. 8381In such a case, the computation will not yield the number of elements in the 8382array, which is likely what the user intended. This warning warns e.g. about 8383@smallexample 8384int fn () 8385@{ 8386 int arr[10]; 8387 return sizeof (arr) / sizeof (short); 8388@} 8389@end smallexample 8390 8391This warning is enabled by @option{-Wall}. 8392 8393@item -Wsizeof-pointer-div 8394@opindex Wsizeof-pointer-div 8395@opindex Wno-sizeof-pointer-div 8396Warn for suspicious divisions of two sizeof expressions that divide 8397the pointer size by the element size, which is the usual way to compute 8398the array size but won't work out correctly with pointers. This warning 8399warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is 8400not an array, but a pointer. This warning is enabled by @option{-Wall}. 8401 8402@item -Wsizeof-pointer-memaccess 8403@opindex Wsizeof-pointer-memaccess 8404@opindex Wno-sizeof-pointer-memaccess 8405Warn for suspicious length parameters to certain string and memory built-in 8406functions if the argument uses @code{sizeof}. This warning triggers for 8407example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not 8408an array, but a pointer, and suggests a possible fix, or about 8409@code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess} 8410also warns about calls to bounded string copy functions like @code{strncat} 8411or @code{strncpy} that specify as the bound a @code{sizeof} expression of 8412the source array. For example, in the following function the call to 8413@code{strncat} specifies the size of the source string as the bound. That 8414is almost certainly a mistake and so the call is diagnosed. 8415@smallexample 8416void make_file (const char *name) 8417@{ 8418 char path[PATH_MAX]; 8419 strncpy (path, name, sizeof path - 1); 8420 strncat (path, ".text", sizeof ".text"); 8421 @dots{} 8422@} 8423@end smallexample 8424 8425The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}. 8426 8427@item -Wno-sizeof-array-argument 8428@opindex Wsizeof-array-argument 8429@opindex Wno-sizeof-array-argument 8430Do not warn when the @code{sizeof} operator is applied to a parameter that is 8431declared as an array in a function definition. This warning is enabled by 8432default for C and C++ programs. 8433 8434@item -Wmemset-elt-size 8435@opindex Wmemset-elt-size 8436@opindex Wno-memset-elt-size 8437Warn for suspicious calls to the @code{memset} built-in function, if the 8438first argument references an array, and the third argument is a number 8439equal to the number of elements, but not equal to the size of the array 8440in memory. This indicates that the user has omitted a multiplication by 8441the element size. This warning is enabled by @option{-Wall}. 8442 8443@item -Wmemset-transposed-args 8444@opindex Wmemset-transposed-args 8445@opindex Wno-memset-transposed-args 8446Warn for suspicious calls to the @code{memset} built-in function where 8447the second argument is not zero and the third argument is zero. For 8448example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because 8449@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic 8450is only emitted if the third argument is a literal zero. Otherwise, if 8451it is an expression that is folded to zero, or a cast of zero to some 8452type, it is far less likely that the arguments have been mistakenly 8453transposed and no warning is emitted. This warning is enabled 8454by @option{-Wall}. 8455 8456@item -Waddress 8457@opindex Waddress 8458@opindex Wno-address 8459Warn about suspicious uses of memory addresses. These include using 8460the address of a function in a conditional expression, such as 8461@code{void func(void); if (func)}, and comparisons against the memory 8462address of a string literal, such as @code{if (x == "abc")}. Such 8463uses typically indicate a programmer error: the address of a function 8464always evaluates to true, so their use in a conditional usually 8465indicate that the programmer forgot the parentheses in a function 8466call; and comparisons against string literals result in unspecified 8467behavior and are not portable in C, so they usually indicate that the 8468programmer intended to use @code{strcmp}. This warning is enabled by 8469@option{-Wall}. 8470 8471@item -Wno-address-of-packed-member 8472@opindex Waddress-of-packed-member 8473@opindex Wno-address-of-packed-member 8474Do not warn when the address of packed member of struct or union is taken, 8475which usually results in an unaligned pointer value. This is 8476enabled by default. 8477 8478@item -Wlogical-op 8479@opindex Wlogical-op 8480@opindex Wno-logical-op 8481Warn about suspicious uses of logical operators in expressions. 8482This includes using logical operators in contexts where a 8483bit-wise operator is likely to be expected. Also warns when 8484the operands of a logical operator are the same: 8485@smallexample 8486extern int a; 8487if (a < 0 && a < 0) @{ @dots{} @} 8488@end smallexample 8489 8490@item -Wlogical-not-parentheses 8491@opindex Wlogical-not-parentheses 8492@opindex Wno-logical-not-parentheses 8493Warn about logical not used on the left hand side operand of a comparison. 8494This option does not warn if the right operand is considered to be a boolean 8495expression. Its purpose is to detect suspicious code like the following: 8496@smallexample 8497int a; 8498@dots{} 8499if (!a > 1) @{ @dots{} @} 8500@end smallexample 8501 8502It is possible to suppress the warning by wrapping the LHS into 8503parentheses: 8504@smallexample 8505if ((!a) > 1) @{ @dots{} @} 8506@end smallexample 8507 8508This warning is enabled by @option{-Wall}. 8509 8510@item -Waggregate-return 8511@opindex Waggregate-return 8512@opindex Wno-aggregate-return 8513Warn if any functions that return structures or unions are defined or 8514called. (In languages where you can return an array, this also elicits 8515a warning.) 8516 8517@item -Wno-aggressive-loop-optimizations 8518@opindex Wno-aggressive-loop-optimizations 8519@opindex Waggressive-loop-optimizations 8520Warn if in a loop with constant number of iterations the compiler detects 8521undefined behavior in some statement during one or more of the iterations. 8522 8523@item -Wno-attributes 8524@opindex Wno-attributes 8525@opindex Wattributes 8526Do not warn if an unexpected @code{__attribute__} is used, such as 8527unrecognized attributes, function attributes applied to variables, 8528etc. This does not stop errors for incorrect use of supported 8529attributes. 8530 8531@item -Wno-builtin-declaration-mismatch 8532@opindex Wno-builtin-declaration-mismatch 8533@opindex Wbuiltin-declaration-mismatch 8534Warn if a built-in function is declared with an incompatible signature 8535or as a non-function, or when a built-in function declared with a type 8536that does not include a prototype is called with arguments whose promoted 8537types do not match those expected by the function. When @option{-Wextra} 8538is specified, also warn when a built-in function that takes arguments is 8539declared without a prototype. The @option{-Wbuiltin-declaration-mismatch} 8540warning is enabled by default. To avoid the warning include the appropriate 8541header to bring the prototypes of built-in functions into scope. 8542 8543For example, the call to @code{memset} below is diagnosed by the warning 8544because the function expects a value of type @code{size_t} as its argument 8545but the type of @code{32} is @code{int}. With @option{-Wextra}, 8546the declaration of the function is diagnosed as well. 8547@smallexample 8548extern void* memset (); 8549void f (void *d) 8550@{ 8551 memset (d, '\0', 32); 8552@} 8553@end smallexample 8554 8555@item -Wno-builtin-macro-redefined 8556@opindex Wno-builtin-macro-redefined 8557@opindex Wbuiltin-macro-redefined 8558Do not warn if certain built-in macros are redefined. This suppresses 8559warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 8560@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 8561 8562@item -Wstrict-prototypes @r{(C and Objective-C only)} 8563@opindex Wstrict-prototypes 8564@opindex Wno-strict-prototypes 8565Warn if a function is declared or defined without specifying the 8566argument types. (An old-style function definition is permitted without 8567a warning if preceded by a declaration that specifies the argument 8568types.) 8569 8570@item -Wold-style-declaration @r{(C and Objective-C only)} 8571@opindex Wold-style-declaration 8572@opindex Wno-old-style-declaration 8573Warn for obsolescent usages, according to the C Standard, in a 8574declaration. For example, warn if storage-class specifiers like 8575@code{static} are not the first things in a declaration. This warning 8576is also enabled by @option{-Wextra}. 8577 8578@item -Wold-style-definition @r{(C and Objective-C only)} 8579@opindex Wold-style-definition 8580@opindex Wno-old-style-definition 8581Warn if an old-style function definition is used. A warning is given 8582even if there is a previous prototype. A definition using @samp{()} 8583is not considered an old-style definition in C2X mode, because it is 8584equivalent to @samp{(void)} in that case, but is considered an 8585old-style definition for older standards. 8586 8587@item -Wmissing-parameter-type @r{(C and Objective-C only)} 8588@opindex Wmissing-parameter-type 8589@opindex Wno-missing-parameter-type 8590A function parameter is declared without a type specifier in K&R-style 8591functions: 8592 8593@smallexample 8594void foo(bar) @{ @} 8595@end smallexample 8596 8597This warning is also enabled by @option{-Wextra}. 8598 8599@item -Wmissing-prototypes @r{(C and Objective-C only)} 8600@opindex Wmissing-prototypes 8601@opindex Wno-missing-prototypes 8602Warn if a global function is defined without a previous prototype 8603declaration. This warning is issued even if the definition itself 8604provides a prototype. Use this option to detect global functions 8605that do not have a matching prototype declaration in a header file. 8606This option is not valid for C++ because all function declarations 8607provide prototypes and a non-matching declaration declares an 8608overload rather than conflict with an earlier declaration. 8609Use @option{-Wmissing-declarations} to detect missing declarations in C++. 8610 8611@item -Wmissing-declarations 8612@opindex Wmissing-declarations 8613@opindex Wno-missing-declarations 8614Warn if a global function is defined without a previous declaration. 8615Do so even if the definition itself provides a prototype. 8616Use this option to detect global functions that are not declared in 8617header files. In C, no warnings are issued for functions with previous 8618non-prototype declarations; use @option{-Wmissing-prototypes} to detect 8619missing prototypes. In C++, no warnings are issued for function templates, 8620or for inline functions, or for functions in anonymous namespaces. 8621 8622@item -Wmissing-field-initializers 8623@opindex Wmissing-field-initializers 8624@opindex Wno-missing-field-initializers 8625@opindex W 8626@opindex Wextra 8627@opindex Wno-extra 8628Warn if a structure's initializer has some fields missing. For 8629example, the following code causes such a warning, because 8630@code{x.h} is implicitly zero: 8631 8632@smallexample 8633struct s @{ int f, g, h; @}; 8634struct s x = @{ 3, 4 @}; 8635@end smallexample 8636 8637This option does not warn about designated initializers, so the following 8638modification does not trigger a warning: 8639 8640@smallexample 8641struct s @{ int f, g, h; @}; 8642struct s x = @{ .f = 3, .g = 4 @}; 8643@end smallexample 8644 8645In C this option does not warn about the universal zero initializer 8646@samp{@{ 0 @}}: 8647 8648@smallexample 8649struct s @{ int f, g, h; @}; 8650struct s x = @{ 0 @}; 8651@end smallexample 8652 8653Likewise, in C++ this option does not warn about the empty @{ @} 8654initializer, for example: 8655 8656@smallexample 8657struct s @{ int f, g, h; @}; 8658s x = @{ @}; 8659@end smallexample 8660 8661This warning is included in @option{-Wextra}. To get other @option{-Wextra} 8662warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 8663 8664@item -Wno-multichar 8665@opindex Wno-multichar 8666@opindex Wmultichar 8667Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 8668Usually they indicate a typo in the user's code, as they have 8669implementation-defined values, and should not be used in portable code. 8670 8671@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} 8672@opindex Wnormalized= 8673@opindex Wnormalized 8674@opindex Wno-normalized 8675@cindex NFC 8676@cindex NFKC 8677@cindex character set, input normalization 8678In ISO C and ISO C++, two identifiers are different if they are 8679different sequences of characters. However, sometimes when characters 8680outside the basic ASCII character set are used, you can have two 8681different character sequences that look the same. To avoid confusion, 8682the ISO 10646 standard sets out some @dfn{normalization rules} which 8683when applied ensure that two sequences that look the same are turned into 8684the same sequence. GCC can warn you if you are using identifiers that 8685have not been normalized; this option controls that warning. 8686 8687There are four levels of warning supported by GCC@. The default is 8688@option{-Wnormalized=nfc}, which warns about any identifier that is 8689not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 8690recommended form for most uses. It is equivalent to 8691@option{-Wnormalized}. 8692 8693Unfortunately, there are some characters allowed in identifiers by 8694ISO C and ISO C++ that, when turned into NFC, are not allowed in 8695identifiers. That is, there's no way to use these symbols in portable 8696ISO C or C++ and have all your identifiers in NFC@. 8697@option{-Wnormalized=id} suppresses the warning for these characters. 8698It is hoped that future versions of the standards involved will correct 8699this, which is why this option is not the default. 8700 8701You can switch the warning off for all characters by writing 8702@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 8703only do this if you are using some other normalization scheme (like 8704``D''), because otherwise you can easily create bugs that are 8705literally impossible to see. 8706 8707Some characters in ISO 10646 have distinct meanings but look identical 8708in some fonts or display methodologies, especially once formatting has 8709been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 8710LETTER N'', displays just like a regular @code{n} that has been 8711placed in a superscript. ISO 10646 defines the @dfn{NFKC} 8712normalization scheme to convert all these into a standard form as 8713well, and GCC warns if your code is not in NFKC if you use 8714@option{-Wnormalized=nfkc}. This warning is comparable to warning 8715about every identifier that contains the letter O because it might be 8716confused with the digit 0, and so is not the default, but may be 8717useful as a local coding convention if the programming environment 8718cannot be fixed to display these characters distinctly. 8719 8720@item -Wno-attribute-warning 8721@opindex Wno-attribute-warning 8722@opindex Wattribute-warning 8723Do not warn about usage of functions (@pxref{Function Attributes}) 8724declared with @code{warning} attribute. By default, this warning is 8725enabled. @option{-Wno-attribute-warning} can be used to disable the 8726warning or @option{-Wno-error=attribute-warning} can be used to 8727disable the error when compiled with @option{-Werror} flag. 8728 8729@item -Wno-deprecated 8730@opindex Wno-deprecated 8731@opindex Wdeprecated 8732Do not warn about usage of deprecated features. @xref{Deprecated Features}. 8733 8734@item -Wno-deprecated-declarations 8735@opindex Wno-deprecated-declarations 8736@opindex Wdeprecated-declarations 8737Do not warn about uses of functions (@pxref{Function Attributes}), 8738variables (@pxref{Variable Attributes}), and types (@pxref{Type 8739Attributes}) marked as deprecated by using the @code{deprecated} 8740attribute. 8741 8742@item -Wno-overflow 8743@opindex Wno-overflow 8744@opindex Woverflow 8745Do not warn about compile-time overflow in constant expressions. 8746 8747@item -Wno-odr 8748@opindex Wno-odr 8749@opindex Wodr 8750Warn about One Definition Rule violations during link-time optimization. 8751Enabled by default. 8752 8753@item -Wopenmp-simd 8754@opindex Wopenmp-simd 8755@opindex Wno-openmp-simd 8756Warn if the vectorizer cost model overrides the OpenMP 8757simd directive set by user. The @option{-fsimd-cost-model=unlimited} 8758option can be used to relax the cost model. 8759 8760@item -Woverride-init @r{(C and Objective-C only)} 8761@opindex Woverride-init 8762@opindex Wno-override-init 8763@opindex W 8764@opindex Wextra 8765@opindex Wno-extra 8766Warn if an initialized field without side effects is overridden when 8767using designated initializers (@pxref{Designated Inits, , Designated 8768Initializers}). 8769 8770This warning is included in @option{-Wextra}. To get other 8771@option{-Wextra} warnings without this one, use @option{-Wextra 8772-Wno-override-init}. 8773 8774@item -Wno-override-init-side-effects @r{(C and Objective-C only)} 8775@opindex Woverride-init-side-effects 8776@opindex Wno-override-init-side-effects 8777Do not warn if an initialized field with side effects is overridden when 8778using designated initializers (@pxref{Designated Inits, , Designated 8779Initializers}). This warning is enabled by default. 8780 8781@item -Wpacked 8782@opindex Wpacked 8783@opindex Wno-packed 8784Warn if a structure is given the packed attribute, but the packed 8785attribute has no effect on the layout or size of the structure. 8786Such structures may be mis-aligned for little benefit. For 8787instance, in this code, the variable @code{f.x} in @code{struct bar} 8788is misaligned even though @code{struct bar} does not itself 8789have the packed attribute: 8790 8791@smallexample 8792@group 8793struct foo @{ 8794 int x; 8795 char a, b, c, d; 8796@} __attribute__((packed)); 8797struct bar @{ 8798 char z; 8799 struct foo f; 8800@}; 8801@end group 8802@end smallexample 8803 8804@item -Wnopacked-bitfield-compat 8805@opindex Wpacked-bitfield-compat 8806@opindex Wno-packed-bitfield-compat 8807The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 8808on bit-fields of type @code{char}. This was fixed in GCC 4.4 but 8809the change can lead to differences in the structure layout. GCC 8810informs you when the offset of such a field has changed in GCC 4.4. 8811For example there is no longer a 4-bit padding between field @code{a} 8812and @code{b} in this structure: 8813 8814@smallexample 8815struct foo 8816@{ 8817 char a:4; 8818 char b:8; 8819@} __attribute__ ((packed)); 8820@end smallexample 8821 8822This warning is enabled by default. Use 8823@option{-Wno-packed-bitfield-compat} to disable this warning. 8824 8825@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 8826@opindex Wpacked-not-aligned 8827@opindex Wno-packed-not-aligned 8828Warn if a structure field with explicitly specified alignment in a 8829packed struct or union is misaligned. For example, a warning will 8830be issued on @code{struct S}, like, @code{warning: alignment 1 of 8831'struct S' is less than 8}, in this code: 8832 8833@smallexample 8834@group 8835struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @}; 8836struct __attribute__ ((packed)) S @{ 8837 struct S8 s8; 8838@}; 8839@end group 8840@end smallexample 8841 8842This warning is enabled by @option{-Wall}. 8843 8844@item -Wpadded 8845@opindex Wpadded 8846@opindex Wno-padded 8847Warn if padding is included in a structure, either to align an element 8848of the structure or to align the whole structure. Sometimes when this 8849happens it is possible to rearrange the fields of the structure to 8850reduce the padding and so make the structure smaller. 8851 8852@item -Wredundant-decls 8853@opindex Wredundant-decls 8854@opindex Wno-redundant-decls 8855Warn if anything is declared more than once in the same scope, even in 8856cases where multiple declaration is valid and changes nothing. 8857 8858@item -Wrestrict 8859@opindex Wrestrict 8860@opindex Wno-restrict 8861Warn when an object referenced by a @code{restrict}-qualified parameter 8862(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another 8863argument, or when copies between such objects overlap. For example, 8864the call to the @code{strcpy} function below attempts to truncate the string 8865by replacing its initial characters with the last four. However, because 8866the call writes the terminating NUL into @code{a[4]}, the copies overlap and 8867the call is diagnosed. 8868 8869@smallexample 8870void foo (void) 8871@{ 8872 char a[] = "abcd1234"; 8873 strcpy (a, a + 4); 8874 @dots{} 8875@} 8876@end smallexample 8877The @option{-Wrestrict} option detects some instances of simple overlap 8878even without optimization but works best at @option{-O2} and above. It 8879is included in @option{-Wall}. 8880 8881@item -Wnested-externs @r{(C and Objective-C only)} 8882@opindex Wnested-externs 8883@opindex Wno-nested-externs 8884Warn if an @code{extern} declaration is encountered within a function. 8885 8886@item -Winline 8887@opindex Winline 8888@opindex Wno-inline 8889Warn if a function that is declared as inline cannot be inlined. 8890Even with this option, the compiler does not warn about failures to 8891inline functions declared in system headers. 8892 8893The compiler uses a variety of heuristics to determine whether or not 8894to inline a function. For example, the compiler takes into account 8895the size of the function being inlined and the amount of inlining 8896that has already been done in the current function. Therefore, 8897seemingly insignificant changes in the source program can cause the 8898warnings produced by @option{-Winline} to appear or disappear. 8899 8900@item -Wint-in-bool-context 8901@opindex Wint-in-bool-context 8902@opindex Wno-int-in-bool-context 8903Warn for suspicious use of integer values where boolean values are expected, 8904such as conditional expressions (?:) using non-boolean integer constants in 8905boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed 8906integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise 8907for all kinds of multiplications regardless of the data type. 8908This warning is enabled by @option{-Wall}. 8909 8910@item -Wno-int-to-pointer-cast 8911@opindex Wno-int-to-pointer-cast 8912@opindex Wint-to-pointer-cast 8913Suppress warnings from casts to pointer type of an integer of a 8914different size. In C++, casting to a pointer type of smaller size is 8915an error. @option{Wint-to-pointer-cast} is enabled by default. 8916 8917 8918@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 8919@opindex Wno-pointer-to-int-cast 8920@opindex Wpointer-to-int-cast 8921Suppress warnings from casts from a pointer to an integer type of a 8922different size. 8923 8924@item -Winvalid-pch 8925@opindex Winvalid-pch 8926@opindex Wno-invalid-pch 8927Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 8928the search path but cannot be used. 8929 8930@item -Wlong-long 8931@opindex Wlong-long 8932@opindex Wno-long-long 8933Warn if @code{long long} type is used. This is enabled by either 8934@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 8935modes. To inhibit the warning messages, use @option{-Wno-long-long}. 8936 8937@item -Wvariadic-macros 8938@opindex Wvariadic-macros 8939@opindex Wno-variadic-macros 8940Warn if variadic macros are used in ISO C90 mode, or if the GNU 8941alternate syntax is used in ISO C99 mode. This is enabled by either 8942@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 8943messages, use @option{-Wno-variadic-macros}. 8944 8945@item -Wno-varargs 8946@opindex Wvarargs 8947@opindex Wno-varargs 8948Do not warn upon questionable usage of the macros used to handle variable 8949arguments like @code{va_start}. These warnings are enabled by default. 8950 8951@item -Wvector-operation-performance 8952@opindex Wvector-operation-performance 8953@opindex Wno-vector-operation-performance 8954Warn if vector operation is not implemented via SIMD capabilities of the 8955architecture. Mainly useful for the performance tuning. 8956Vector operation can be implemented @code{piecewise}, which means that the 8957scalar operation is performed on every vector element; 8958@code{in parallel}, which means that the vector operation is implemented 8959using scalars of wider type, which normally is more performance efficient; 8960and @code{as a single scalar}, which means that vector fits into a 8961scalar type. 8962 8963@item -Wvla 8964@opindex Wvla 8965@opindex Wno-vla 8966Warn if a variable-length array is used in the code. 8967@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 8968the variable-length array. 8969 8970@item -Wvla-larger-than=@var{byte-size} 8971@opindex Wvla-larger-than= 8972@opindex Wno-vla-larger-than 8973If this option is used, the compiler warns for declarations of 8974variable-length arrays whose size is either unbounded, or bounded 8975by an argument that allows the array size to exceed @var{byte-size} 8976bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size} 8977works, but with variable-length arrays. 8978 8979Note that GCC may optimize small variable-length arrays of a known 8980value into plain arrays, so this warning may not get triggered for 8981such arrays. 8982 8983@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but 8984is typically only effective when @option{-ftree-vrp} is active (default 8985for @option{-O2} and above). 8986 8987See also @option{-Walloca-larger-than=@var{byte-size}}. 8988 8989@item -Wno-vla-larger-than 8990@opindex Wno-vla-larger-than 8991Disable @option{-Wvla-larger-than=} warnings. The option is equivalent 8992to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger. 8993 8994@item -Wvla-parameter 8995@opindex Wno-vla-parameter 8996Warn about redeclarations of functions involving arguments of Variable 8997Length Array types of inconsistent kinds or forms, and enable the detection 8998of out-of-bounds accesses to such parameters by warnings such as 8999@option{-Warray-bounds}. 9000 9001If the first function declaration uses the VLA form the bound specified 9002in the array is assumed to be the minimum number of elements expected to 9003be provided in calls to the function and the maximum number of elements 9004accessed by it. Failing to provide arguments of sufficient size or 9005accessing more than the maximum number of elements may be diagnosed. 9006 9007For example, the warning triggers for the following redeclarations because 9008the first one allows an array of any size to be passed to @code{f} while 9009the second one specifies that the array argument must have at least @code{n} 9010elements. In addition, calling @code{f} with the assotiated VLA bound 9011parameter in excess of the actual VLA bound triggers a warning as well. 9012 9013@smallexample 9014void f (int n, int[n]); 9015void f (int, int[]); // warning: argument 2 previously declared as a VLA 9016 9017void g (int n) 9018@{ 9019 if (n > 4) 9020 return; 9021 int a[n]; 9022 f (sizeof a, a); // warning: access to a by f may be out of bounds 9023 @dots{} 9024@} 9025 9026@end smallexample 9027 9028@option{-Wvla-parameter} is included in @option{-Wall}. The 9029@option{-Warray-parameter} option triggers warnings for similar problems 9030involving ordinary array arguments. 9031 9032@item -Wvolatile-register-var 9033@opindex Wvolatile-register-var 9034@opindex Wno-volatile-register-var 9035Warn if a register variable is declared volatile. The volatile 9036modifier does not inhibit all optimizations that may eliminate reads 9037and/or writes to register variables. This warning is enabled by 9038@option{-Wall}. 9039 9040@item -Wdisabled-optimization 9041@opindex Wdisabled-optimization 9042@opindex Wno-disabled-optimization 9043Warn if a requested optimization pass is disabled. This warning does 9044not generally indicate that there is anything wrong with your code; it 9045merely indicates that GCC's optimizers are unable to handle the code 9046effectively. Often, the problem is that your code is too big or too 9047complex; GCC refuses to optimize programs when the optimization 9048itself is likely to take inordinate amounts of time. 9049 9050@item -Wpointer-sign @r{(C and Objective-C only)} 9051@opindex Wpointer-sign 9052@opindex Wno-pointer-sign 9053Warn for pointer argument passing or assignment with different signedness. 9054This option is only supported for C and Objective-C@. It is implied by 9055@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 9056@option{-Wno-pointer-sign}. 9057 9058@item -Wstack-protector 9059@opindex Wstack-protector 9060@opindex Wno-stack-protector 9061This option is only active when @option{-fstack-protector} is active. It 9062warns about functions that are not protected against stack smashing. 9063 9064@item -Woverlength-strings 9065@opindex Woverlength-strings 9066@opindex Wno-overlength-strings 9067Warn about string constants that are longer than the ``minimum 9068maximum'' length specified in the C standard. Modern compilers 9069generally allow string constants that are much longer than the 9070standard's minimum limit, but very portable programs should avoid 9071using longer strings. 9072 9073The limit applies @emph{after} string constant concatenation, and does 9074not count the trailing NUL@. In C90, the limit was 509 characters; in 9075C99, it was raised to 4095. C++98 does not specify a normative 9076minimum maximum, so we do not diagnose overlength strings in C++@. 9077 9078This option is implied by @option{-Wpedantic}, and can be disabled with 9079@option{-Wno-overlength-strings}. 9080 9081@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 9082@opindex Wunsuffixed-float-constants 9083@opindex Wno-unsuffixed-float-constants 9084 9085Issue a warning for any floating constant that does not have 9086a suffix. When used together with @option{-Wsystem-headers} it 9087warns about such constants in system header files. This can be useful 9088when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 9089from the decimal floating-point extension to C99. 9090 9091@item -Wno-lto-type-mismatch 9092@opindex Wlto-type-mismatch 9093@opindex Wno-lto-type-mismatch 9094 9095During the link-time optimization, do not warn about type mismatches in 9096global declarations from different compilation units. 9097Requires @option{-flto} to be enabled. Enabled by default. 9098 9099@item -Wno-designated-init @r{(C and Objective-C only)} 9100@opindex Wdesignated-init 9101@opindex Wno-designated-init 9102Suppress warnings when a positional initializer is used to initialize 9103a structure that has been marked with the @code{designated_init} 9104attribute. 9105 9106@end table 9107 9108@node Static Analyzer Options 9109@section Options That Control Static Analysis 9110 9111@table @gcctabopt 9112@item -fanalyzer 9113@opindex analyzer 9114@opindex fanalyzer 9115@opindex fno-analyzer 9116This option enables an static analysis of program flow which looks 9117for ``interesting'' interprocedural paths through the 9118code, and issues warnings for problems found on them. 9119 9120This analysis is much more expensive than other GCC warnings. 9121 9122Enabling this option effectively enables the following warnings: 9123 9124@gccoptlist{ @gol 9125-Wanalyzer-double-fclose @gol 9126-Wanalyzer-double-free @gol 9127-Wanalyzer-exposure-through-output-file @gol 9128-Wanalyzer-file-leak @gol 9129-Wanalyzer-free-of-non-heap @gol 9130-Wanalyzer-malloc-leak @gol 9131-Wanalyzer-mismatching-deallocation @gol 9132-Wanalyzer-possible-null-argument @gol 9133-Wanalyzer-possible-null-dereference @gol 9134-Wanalyzer-null-argument @gol 9135-Wanalyzer-null-dereference @gol 9136-Wanalyzer-shift-count-negative @gol 9137-Wanalyzer-shift-count-overflow @gol 9138-Wanalyzer-stale-setjmp-buffer @gol 9139-Wanalyzer-tainted-array-index @gol 9140-Wanalyzer-unsafe-call-within-signal-handler @gol 9141-Wanalyzer-use-after-free @gol 9142-Wanalyzer-use-of-pointer-in-stale-stack-frame @gol 9143-Wanalyzer-write-to-const @gol 9144-Wanalyzer-write-to-string-literal @gol 9145} 9146 9147This option is only available if GCC was configured with analyzer 9148support enabled. 9149 9150@item -Wanalyzer-too-complex 9151@opindex Wanalyzer-too-complex 9152@opindex Wno-analyzer-too-complex 9153If @option{-fanalyzer} is enabled, the analyzer uses various heuristics 9154to attempt to explore the control flow and data flow in the program, 9155but these can be defeated by sufficiently complicated code. 9156 9157By default, the analysis silently stops if the code is too 9158complicated for the analyzer to fully explore and it reaches an internal 9159limit. The @option{-Wanalyzer-too-complex} option warns if this occurs. 9160 9161@item -Wno-analyzer-double-fclose 9162@opindex Wanalyzer-double-fclose 9163@opindex Wno-analyzer-double-fclose 9164This warning requires @option{-fanalyzer}, which enables it; use 9165@option{-Wno-analyzer-double-fclose} to disable it. 9166 9167This diagnostic warns for paths through the code in which a @code{FILE *} 9168can have @code{fclose} called on it more than once. 9169 9170@item -Wno-analyzer-double-free 9171@opindex Wanalyzer-double-free 9172@opindex Wno-analyzer-double-free 9173This warning requires @option{-fanalyzer}, which enables it; use 9174@option{-Wno-analyzer-double-free} to disable it. 9175 9176This diagnostic warns for paths through the code in which a pointer 9177can have a deallocator called on it more than once, either @code{free}, 9178or a deallocator referenced by attribute @code{malloc}. 9179 9180@item -Wno-analyzer-exposure-through-output-file 9181@opindex Wanalyzer-exposure-through-output-file 9182@opindex Wno-analyzer-exposure-through-output-file 9183This warning requires @option{-fanalyzer}, which enables it; use 9184@option{-Wno-analyzer-exposure-through-output-file} 9185to disable it. 9186 9187This diagnostic warns for paths through the code in which a 9188security-sensitive value is written to an output file 9189(such as writing a password to a log file). 9190 9191@item -Wno-analyzer-file-leak 9192@opindex Wanalyzer-file-leak 9193@opindex Wno-analyzer-file-leak 9194This warning requires @option{-fanalyzer}, which enables it; use 9195@option{-Wno-analyzer-file-leak} 9196to disable it. 9197 9198This diagnostic warns for paths through the code in which a 9199@code{<stdio.h>} @code{FILE *} stream object is leaked. 9200 9201@item -Wno-analyzer-free-of-non-heap 9202@opindex Wanalyzer-free-of-non-heap 9203@opindex Wno-analyzer-free-of-non-heap 9204This warning requires @option{-fanalyzer}, which enables it; use 9205@option{-Wno-analyzer-free-of-non-heap} 9206to disable it. 9207 9208This diagnostic warns for paths through the code in which @code{free} 9209is called on a non-heap pointer (e.g. an on-stack buffer, or a global). 9210 9211@item -Wno-analyzer-malloc-leak 9212@opindex Wanalyzer-malloc-leak 9213@opindex Wno-analyzer-malloc-leak 9214This warning requires @option{-fanalyzer}, which enables it; use 9215@option{-Wno-analyzer-malloc-leak} 9216to disable it. 9217 9218This diagnostic warns for paths through the code in which a 9219pointer allocated via an allocator is leaked: either @code{malloc}, 9220or a function marked with attribute @code{malloc}. 9221 9222@item -Wno-analyzer-mismatching-deallocation 9223@opindex Wanalyzer-mismatching-deallocation 9224@opindex Wno-analyzer-mismatching-deallocation 9225This warning requires @option{-fanalyzer}, which enables it; use 9226@option{-Wno-analyzer-mismatching-deallocation} 9227to disable it. 9228 9229This diagnostic warns for paths through the code in which the 9230wrong deallocation function is called on a pointer value, based on 9231which function was used to allocate the pointer value. The diagnostic 9232will warn about mismatches between @code{free}, scalar @code{delete} 9233and vector @code{delete[]}, and those marked as allocator/deallocator 9234pairs using attribute @code{malloc}. 9235 9236@item -Wno-analyzer-possible-null-argument 9237@opindex Wanalyzer-possible-null-argument 9238@opindex Wno-analyzer-possible-null-argument 9239This warning requires @option{-fanalyzer}, which enables it; use 9240@option{-Wno-analyzer-possible-null-argument} to disable it. 9241 9242This diagnostic warns for paths through the code in which a 9243possibly-NULL value is passed to a function argument marked 9244with @code{__attribute__((nonnull))} as requiring a non-NULL 9245value. 9246 9247@item -Wno-analyzer-possible-null-dereference 9248@opindex Wanalyzer-possible-null-dereference 9249@opindex Wno-analyzer-possible-null-dereference 9250This warning requires @option{-fanalyzer}, which enables it; use 9251@option{-Wno-analyzer-possible-null-dereference} to disable it. 9252 9253This diagnostic warns for paths through the code in which a 9254possibly-NULL value is dereferenced. 9255 9256@item -Wno-analyzer-null-argument 9257@opindex Wanalyzer-null-argument 9258@opindex Wno-analyzer-null-argument 9259This warning requires @option{-fanalyzer}, which enables it; use 9260@option{-Wno-analyzer-null-argument} to disable it. 9261 9262This diagnostic warns for paths through the code in which a 9263value known to be NULL is passed to a function argument marked 9264with @code{__attribute__((nonnull))} as requiring a non-NULL 9265value. 9266 9267@item -Wno-analyzer-null-dereference 9268@opindex Wanalyzer-null-dereference 9269@opindex Wno-analyzer-null-dereference 9270This warning requires @option{-fanalyzer}, which enables it; use 9271@option{-Wno-analyzer-null-dereference} to disable it. 9272 9273This diagnostic warns for paths through the code in which a 9274value known to be NULL is dereferenced. 9275 9276@item -Wno-analyzer-shift-count-negative 9277@opindex Wanalyzer-shift-count-negative 9278@opindex Wno-analyzer-shift-count-negative 9279This warning requires @option{-fanalyzer}, which enables it; use 9280@option{-Wno-analyzer-shift-count-negative} to disable it. 9281 9282This diagnostic warns for paths through the code in which a 9283shift is attempted with a negative count. It is analogous to 9284the @option{-Wshift-count-negative} diagnostic implemented in 9285the C/C++ front ends, but is implemented based on analyzing 9286interprocedural paths, rather than merely parsing the syntax tree. 9287However, the analyzer does not prioritize detection of such paths, so 9288false negatives are more likely relative to other warnings. 9289 9290@item -Wno-analyzer-shift-count-overflow 9291@opindex Wanalyzer-shift-count-overflow 9292@opindex Wno-analyzer-shift-count-overflow 9293This warning requires @option{-fanalyzer}, which enables it; use 9294@option{-Wno-analyzer-shift-count-overflow} to disable it. 9295 9296This diagnostic warns for paths through the code in which a 9297shift is attempted with a count greater than or equal to the 9298precision of the operand's type. It is analogous to 9299the @option{-Wshift-count-overflow} diagnostic implemented in 9300the C/C++ front ends, but is implemented based on analyzing 9301interprocedural paths, rather than merely parsing the syntax tree. 9302However, the analyzer does not prioritize detection of such paths, so 9303false negatives are more likely relative to other warnings. 9304 9305@item -Wno-analyzer-stale-setjmp-buffer 9306@opindex Wanalyzer-stale-setjmp-buffer 9307@opindex Wno-analyzer-stale-setjmp-buffer 9308This warning requires @option{-fanalyzer}, which enables it; use 9309@option{-Wno-analyzer-stale-setjmp-buffer} to disable it. 9310 9311This diagnostic warns for paths through the code in which 9312@code{longjmp} is called to rewind to a @code{jmp_buf} relating 9313to a @code{setjmp} call in a function that has returned. 9314 9315When @code{setjmp} is called on a @code{jmp_buf} to record a rewind 9316location, it records the stack frame. The stack frame becomes invalid 9317when the function containing the @code{setjmp} call returns. Attempting 9318to rewind to it via @code{longjmp} would reference a stack frame that 9319no longer exists, and likely lead to a crash (or worse). 9320 9321@item -Wno-analyzer-tainted-array-index 9322@opindex Wanalyzer-tainted-array-index 9323@opindex Wno-analyzer-tainted-array-index 9324This warning requires both @option{-fanalyzer} and 9325@option{-fanalyzer-checker=taint} to enable it; 9326use @option{-Wno-analyzer-tainted-array-index} to disable it. 9327 9328This diagnostic warns for paths through the code in which a value 9329that could be under an attacker's control is used as the index 9330of an array access without being sanitized. 9331 9332@item -Wno-analyzer-unsafe-call-within-signal-handler 9333@opindex Wanalyzer-unsafe-call-within-signal-handler 9334@opindex Wno-analyzer-unsafe-call-within-signal-handler 9335This warning requires @option{-fanalyzer}, which enables it; use 9336@option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it. 9337 9338This diagnostic warns for paths through the code in which a 9339function known to be async-signal-unsafe (such as @code{fprintf}) is 9340called from a signal handler. 9341 9342@item -Wno-analyzer-use-after-free 9343@opindex Wanalyzer-use-after-free 9344@opindex Wno-analyzer-use-after-free 9345This warning requires @option{-fanalyzer}, which enables it; use 9346@option{-Wno-analyzer-use-after-free} to disable it. 9347 9348This diagnostic warns for paths through the code in which a 9349pointer is used after a deallocator is called on it: either @code{free}, 9350or a deallocator referenced by attribute @code{malloc}. 9351 9352@item -Wno-analyzer-use-of-pointer-in-stale-stack-frame 9353@opindex Wanalyzer-use-of-pointer-in-stale-stack-frame 9354@opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame 9355This warning requires @option{-fanalyzer}, which enables it; use 9356@option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame} 9357to disable it. 9358 9359This diagnostic warns for paths through the code in which a pointer 9360is dereferenced that points to a variable in a stale stack frame. 9361 9362@item -Wno-analyzer-write-to-const 9363@opindex Wanalyzer-write-to-const 9364@opindex Wno-analyzer-write-to-const 9365This warning requires @option{-fanalyzer}, which enables it; use 9366@option{-Wno-analyzer-write-to-const} 9367to disable it. 9368 9369This diagnostic warns for paths through the code in which the analyzer 9370detects an attempt to write through a pointer to a @code{const} object. 9371However, the analyzer does not prioritize detection of such paths, so 9372false negatives are more likely relative to other warnings. 9373 9374@item -Wno-analyzer-write-to-string-literal 9375@opindex Wanalyzer-write-to-string-literal 9376@opindex Wno-analyzer-write-to-string-literal 9377This warning requires @option{-fanalyzer}, which enables it; use 9378@option{-Wno-analyzer-write-to-string-literal} 9379to disable it. 9380 9381This diagnostic warns for paths through the code in which the analyzer 9382detects an attempt to write through a pointer to a string literal. 9383However, the analyzer does not prioritize detection of such paths, so 9384false negatives are more likely relative to other warnings. 9385 9386@end table 9387 9388Pertinent parameters for controlling the exploration are: 9389@option{--param analyzer-bb-explosion-factor=@var{value}}, 9390@option{--param analyzer-max-enodes-per-program-point=@var{value}}, 9391@option{--param analyzer-max-recursion-depth=@var{value}}, and 9392@option{--param analyzer-min-snodes-for-call-summary=@var{value}}. 9393 9394The following options control the analyzer. 9395 9396@table @gcctabopt 9397 9398@item -fanalyzer-call-summaries 9399@opindex fanalyzer-call-summaries 9400@opindex fno-analyzer-call-summaries 9401Simplify interprocedural analysis by computing the effect of certain calls, 9402rather than exploring all paths through the function from callsite to each 9403possible return. 9404 9405If enabled, call summaries are only used for functions with more than one 9406call site, and that are sufficiently complicated (as per 9407@option{--param analyzer-min-snodes-for-call-summary=@var{value}}). 9408 9409@item -fanalyzer-checker=@var{name} 9410@opindex fanalyzer-checker 9411Restrict the analyzer to run just the named checker, and enable it. 9412 9413Some checkers are disabled by default (even with @option{-fanalyzer}), 9414such as the @code{taint} checker that implements 9415@option{-Wanalyzer-tainted-array-index}, and this option is required 9416to enable them. 9417 9418@item -fno-analyzer-feasibility 9419@opindex fanalyzer-feasibility 9420@opindex fno-analyzer-feasibility 9421This option is intended for analyzer developers. 9422 9423By default the analyzer verifies that there is a feasible control flow path 9424for each diagnostic it emits: that the conditions that hold are not mutually 9425exclusive. Diagnostics for which no feasible path can be found are rejected. 9426This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for 9427debugging issues in this code. 9428 9429@item -fanalyzer-fine-grained 9430@opindex fanalyzer-fine-grained 9431@opindex fno-analyzer-fine-grained 9432This option is intended for analyzer developers. 9433 9434Internally the analyzer builds an ``exploded graph'' that combines 9435control flow graphs with data flow information. 9436 9437By default, an edge in this graph can contain the effects of a run 9438of multiple statements within a basic block. With 9439@option{-fanalyzer-fine-grained}, each statement gets its own edge. 9440 9441@item -fanalyzer-show-duplicate-count 9442@opindex fanalyzer-show-duplicate-count 9443@opindex fno-analyzer-show-duplicate-count 9444This option is intended for analyzer developers: if multiple diagnostics 9445have been detected as being duplicates of each other, it emits a note when 9446reporting the best diagnostic, giving the number of additional diagnostics 9447that were suppressed by the deduplication logic. 9448 9449@item -fno-analyzer-state-merge 9450@opindex fanalyzer-state-merge 9451@opindex fno-analyzer-state-merge 9452This option is intended for analyzer developers. 9453 9454By default the analyzer attempts to simplify analysis by merging 9455sufficiently similar states at each program point as it builds its 9456``exploded graph''. With @option{-fno-analyzer-state-merge} this 9457merging can be suppressed, for debugging state-handling issues. 9458 9459@item -fno-analyzer-state-purge 9460@opindex fanalyzer-state-purge 9461@opindex fno-analyzer-state-purge 9462This option is intended for analyzer developers. 9463 9464By default the analyzer attempts to simplify analysis by purging 9465aspects of state at a program point that appear to no longer be relevant 9466e.g. the values of locals that aren't accessed later in the function 9467and which aren't relevant to leak analysis. 9468 9469With @option{-fno-analyzer-state-purge} this purging of state can 9470be suppressed, for debugging state-handling issues. 9471 9472@item -fanalyzer-transitivity 9473@opindex fanalyzer-transitivity 9474@opindex fno-analyzer-transitivity 9475This option enables transitivity of constraints within the analyzer. 9476 9477@item -fanalyzer-verbose-edges 9478This option is intended for analyzer developers. It enables more 9479verbose, lower-level detail in the descriptions of control flow 9480within diagnostic paths. 9481 9482@item -fanalyzer-verbose-state-changes 9483This option is intended for analyzer developers. It enables more 9484verbose, lower-level detail in the descriptions of events relating 9485to state machines within diagnostic paths. 9486 9487@item -fanalyzer-verbosity=@var{level} 9488This option controls the complexity of the control flow paths that are 9489emitted for analyzer diagnostics. 9490 9491The @var{level} can be one of: 9492 9493@table @samp 9494@item 0 9495At this level, interprocedural call and return events are displayed, 9496along with the most pertinent state-change events relating to 9497a diagnostic. For example, for a double-@code{free} diagnostic, 9498both calls to @code{free} will be shown. 9499 9500@item 1 9501As per the previous level, but also show events for the entry 9502to each function. 9503 9504@item 2 9505As per the previous level, but also show events relating to 9506control flow that are significant to triggering the issue 9507(e.g. ``true path taken'' at a conditional). 9508 9509This level is the default. 9510 9511@item 3 9512As per the previous level, but show all control flow events, not 9513just significant ones. 9514 9515@item 4 9516This level is intended for analyzer developers; it adds various 9517other events intended for debugging the analyzer. 9518 9519@end table 9520 9521@item -fdump-analyzer 9522@opindex fdump-analyzer 9523Dump internal details about what the analyzer is doing to 9524@file{@var{file}.analyzer.txt}. 9525This option is overridden by @option{-fdump-analyzer-stderr}. 9526 9527@item -fdump-analyzer-stderr 9528@opindex fdump-analyzer-stderr 9529Dump internal details about what the analyzer is doing to stderr. 9530This option overrides @option{-fdump-analyzer}. 9531 9532@item -fdump-analyzer-callgraph 9533@opindex fdump-analyzer-callgraph 9534Dump a representation of the call graph suitable for viewing with 9535GraphViz to @file{@var{file}.callgraph.dot}. 9536 9537@item -fdump-analyzer-exploded-graph 9538@opindex fdump-analyzer-exploded-graph 9539Dump a representation of the ``exploded graph'' suitable for viewing with 9540GraphViz to @file{@var{file}.eg.dot}. 9541Nodes are color-coded based on state-machine states to emphasize 9542state changes. 9543 9544@item -fdump-analyzer-exploded-nodes 9545@opindex dump-analyzer-exploded-nodes 9546Emit diagnostics showing where nodes in the ``exploded graph'' are 9547in relation to the program source. 9548 9549@item -fdump-analyzer-exploded-nodes-2 9550@opindex dump-analyzer-exploded-nodes-2 9551Dump a textual representation of the ``exploded graph'' to 9552@file{@var{file}.eg.txt}. 9553 9554@item -fdump-analyzer-exploded-nodes-3 9555@opindex dump-analyzer-exploded-nodes-3 9556Dump a textual representation of the ``exploded graph'' to 9557one dump file per node, to @file{@var{file}.eg-@var{id}.txt}. 9558This is typically a large number of dump files. 9559 9560@item -fdump-analyzer-feasibility 9561@opindex dump-analyzer-feasibility 9562Dump internal details about the analyzer's search for feasible paths. 9563The details are written in a form suitable for viewing with GraphViz 9564to filenames of the form @file{@var{file}.*.fg.dot} and 9565@file{@var{file}.*.tg.dot}. 9566 9567@item -fdump-analyzer-json 9568@opindex fdump-analyzer-json 9569Dump a compressed JSON representation of analyzer internals to 9570@file{@var{file}.analyzer.json.gz}. The precise format is subject 9571to change. 9572 9573@item -fdump-analyzer-state-purge 9574@opindex fdump-analyzer-state-purge 9575As per @option{-fdump-analyzer-supergraph}, dump a representation of the 9576``supergraph'' suitable for viewing with GraphViz, but annotate the 9577graph with information on what state will be purged at each node. 9578The graph is written to @file{@var{file}.state-purge.dot}. 9579 9580@item -fdump-analyzer-supergraph 9581@opindex fdump-analyzer-supergraph 9582Dump representations of the ``supergraph'' suitable for viewing with 9583GraphViz to @file{@var{file}.supergraph.dot} and to 9584@file{@var{file}.supergraph-eg.dot}. These show all of the 9585control flow graphs in the program, with interprocedural edges for 9586calls and returns. The second dump contains annotations showing nodes 9587in the ``exploded graph'' and diagnostics associated with them. 9588 9589@end table 9590 9591@node Debugging Options 9592@section Options for Debugging Your Program 9593@cindex options, debugging 9594@cindex debugging information options 9595 9596To tell GCC to emit extra information for use by a debugger, in almost 9597all cases you need only to add @option{-g} to your other options. 9598 9599GCC allows you to use @option{-g} with 9600@option{-O}. The shortcuts taken by optimized code may occasionally 9601be surprising: some variables you declared may not exist 9602at all; flow of control may briefly move where you did not expect it; 9603some statements may not be executed because they compute constant 9604results or their values are already at hand; some statements may 9605execute in different places because they have been moved out of loops. 9606Nevertheless it is possible to debug optimized output. This makes 9607it reasonable to use the optimizer for programs that might have bugs. 9608 9609If you are not using some other optimization option, consider 9610using @option{-Og} (@pxref{Optimize Options}) with @option{-g}. 9611With no @option{-O} option at all, some compiler passes that collect 9612information useful for debugging do not run at all, so that 9613@option{-Og} may result in a better debugging experience. 9614 9615@table @gcctabopt 9616@item -g 9617@opindex g 9618Produce debugging information in the operating system's native format 9619(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 9620information. 9621 9622On most systems that use stabs format, @option{-g} enables use of extra 9623debugging information that only GDB can use; this extra information 9624makes debugging work better in GDB but probably makes other debuggers 9625crash or 9626refuse to read the program. If you want to control for certain whether 9627to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 9628@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 9629 9630@item -ggdb 9631@opindex ggdb 9632Produce debugging information for use by GDB@. This means to use the 9633most expressive format available (DWARF, stabs, or the native format 9634if neither of those are supported), including GDB extensions if at all 9635possible. 9636 9637@item -gdwarf 9638@itemx -gdwarf-@var{version} 9639@opindex gdwarf 9640Produce debugging information in DWARF format (if that is supported). 9641The value of @var{version} may be either 2, 3, 4 or 5; the default 9642version for most targets is 5 (with the exception of VxWorks, TPF and 9643Darwin/Mac OS X, which default to version 2, and AIX, which defaults 9644to version 4). 9645 9646Note that with DWARF Version 2, some ports require and always 9647use some non-conflicting DWARF 3 extensions in the unwind tables. 9648 9649Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 9650for maximum benefit. Version 5 requires GDB 8.0 or higher. 9651 9652GCC no longer supports DWARF Version 1, which is substantially 9653different than Version 2 and later. For historical reasons, some 9654other DWARF-related options such as 9655@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2 9656in their names, but apply to all currently-supported versions of DWARF. 9657 9658@item -gstabs 9659@opindex gstabs 9660Produce debugging information in stabs format (if that is supported), 9661without GDB extensions. This is the format used by DBX on most BSD 9662systems. On MIPS, Alpha and System V Release 4 systems this option 9663produces stabs debugging output that is not understood by DBX@. 9664On System V Release 4 systems this option requires the GNU assembler. 9665 9666@item -gstabs+ 9667@opindex gstabs+ 9668Produce debugging information in stabs format (if that is supported), 9669using GNU extensions understood only by the GNU debugger (GDB)@. The 9670use of these extensions is likely to make other debuggers crash or 9671refuse to read the program. 9672 9673@item -gxcoff 9674@opindex gxcoff 9675Produce debugging information in XCOFF format (if that is supported). 9676This is the format used by the DBX debugger on IBM RS/6000 systems. 9677 9678@item -gxcoff+ 9679@opindex gxcoff+ 9680Produce debugging information in XCOFF format (if that is supported), 9681using GNU extensions understood only by the GNU debugger (GDB)@. The 9682use of these extensions is likely to make other debuggers crash or 9683refuse to read the program, and may cause assemblers other than the GNU 9684assembler (GAS) to fail with an error. 9685 9686@item -gvms 9687@opindex gvms 9688Produce debugging information in Alpha/VMS debug format (if that is 9689supported). This is the format used by DEBUG on Alpha/VMS systems. 9690 9691@item -g@var{level} 9692@itemx -ggdb@var{level} 9693@itemx -gstabs@var{level} 9694@itemx -gxcoff@var{level} 9695@itemx -gvms@var{level} 9696Request debugging information and also use @var{level} to specify how 9697much information. The default level is 2. 9698 9699Level 0 produces no debug information at all. Thus, @option{-g0} negates 9700@option{-g}. 9701 9702Level 1 produces minimal information, enough for making backtraces in 9703parts of the program that you don't plan to debug. This includes 9704descriptions of functions and external variables, and line number 9705tables, but no information about local variables. 9706 9707Level 3 includes extra information, such as all the macro definitions 9708present in the program. Some debuggers support macro expansion when 9709you use @option{-g3}. 9710 9711If you use multiple @option{-g} options, with or without level numbers, 9712the last such option is the one that is effective. 9713 9714@option{-gdwarf} does not accept a concatenated debug level, to avoid 9715confusion with @option{-gdwarf-@var{level}}. 9716Instead use an additional @option{-g@var{level}} option to change the 9717debug level for DWARF. 9718 9719@item -fno-eliminate-unused-debug-symbols 9720@opindex feliminate-unused-debug-symbols 9721@opindex fno-eliminate-unused-debug-symbols 9722By default, no debug information is produced for symbols that are not actually 9723used. Use this option if you want debug information for all symbols. 9724 9725@item -femit-class-debug-always 9726@opindex femit-class-debug-always 9727Instead of emitting debugging information for a C++ class in only one 9728object file, emit it in all object files using the class. This option 9729should be used only with debuggers that are unable to handle the way GCC 9730normally emits debugging information for classes because using this 9731option increases the size of debugging information by as much as a 9732factor of two. 9733 9734@item -fno-merge-debug-strings 9735@opindex fmerge-debug-strings 9736@opindex fno-merge-debug-strings 9737Direct the linker to not merge together strings in the debugging 9738information that are identical in different object files. Merging is 9739not supported by all assemblers or linkers. Merging decreases the size 9740of the debug information in the output file at the cost of increasing 9741link processing time. Merging is enabled by default. 9742 9743@item -fdebug-prefix-map=@var{old}=@var{new} 9744@opindex fdebug-prefix-map 9745When compiling files residing in directory @file{@var{old}}, record 9746debugging information describing them as if the files resided in 9747directory @file{@var{new}} instead. This can be used to replace a 9748build-time path with an install-time path in the debug info. It can 9749also be used to change an absolute path to a relative path by using 9750@file{.} for @var{new}. This can give more reproducible builds, which 9751are location independent, but may require an extra command to tell GDB 9752where to find the source files. See also @option{-ffile-prefix-map}. 9753 9754@item -fvar-tracking 9755@opindex fvar-tracking 9756Run variable tracking pass. It computes where variables are stored at each 9757position in code. Better debugging information is then generated 9758(if the debugging information format supports this information). 9759 9760It is enabled by default when compiling with optimization (@option{-Os}, 9761@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 9762the debug info format supports it. 9763 9764@item -fvar-tracking-assignments 9765@opindex fvar-tracking-assignments 9766@opindex fno-var-tracking-assignments 9767Annotate assignments to user variables early in the compilation and 9768attempt to carry the annotations over throughout the compilation all the 9769way to the end, in an attempt to improve debug information while 9770optimizing. Use of @option{-gdwarf-4} is recommended along with it. 9771 9772It can be enabled even if var-tracking is disabled, in which case 9773annotations are created and maintained, but discarded at the end. 9774By default, this flag is enabled together with @option{-fvar-tracking}, 9775except when selective scheduling is enabled. 9776 9777@item -gsplit-dwarf 9778@opindex gsplit-dwarf 9779If DWARF debugging information is enabled, separate as much debugging 9780information as possible into a separate output file with the extension 9781@file{.dwo}. This option allows the build system to avoid linking files with 9782debug information. To be useful, this option requires a debugger capable of 9783reading @file{.dwo} files. 9784 9785@item -gdwarf32 9786@itemx -gdwarf64 9787@opindex gdwarf32 9788@opindex gdwarf64 9789If DWARF debugging information is enabled, the @option{-gdwarf32} selects 9790the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit 9791DWARF format. The default is target specific, on most targets it is 9792@option{-gdwarf32} though. The 32-bit DWARF format is smaller, but 9793can't support more than 2GiB of debug information in any of the DWARF 9794debug information sections. The 64-bit DWARF format allows larger debug 9795information and might not be well supported by all consumers yet. 9796 9797@item -gdescribe-dies 9798@opindex gdescribe-dies 9799Add description attributes to some DWARF DIEs that have no name attribute, 9800such as artificial variables, external references and call site 9801parameter DIEs. 9802 9803@item -gpubnames 9804@opindex gpubnames 9805Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections. 9806 9807@item -ggnu-pubnames 9808@opindex ggnu-pubnames 9809Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format 9810suitable for conversion into a GDB@ index. This option is only useful 9811with a linker that can produce GDB@ index version 7. 9812 9813@item -fdebug-types-section 9814@opindex fdebug-types-section 9815@opindex fno-debug-types-section 9816When using DWARF Version 4 or higher, type DIEs can be put into 9817their own @code{.debug_types} section instead of making them part of the 9818@code{.debug_info} section. It is more efficient to put them in a separate 9819comdat section since the linker can then remove duplicates. 9820But not all DWARF consumers support @code{.debug_types} sections yet 9821and on some objects @code{.debug_types} produces larger instead of smaller 9822debugging information. 9823 9824@item -grecord-gcc-switches 9825@itemx -gno-record-gcc-switches 9826@opindex grecord-gcc-switches 9827@opindex gno-record-gcc-switches 9828This switch causes the command-line options used to invoke the 9829compiler that may affect code generation to be appended to the 9830DW_AT_producer attribute in DWARF debugging information. The options 9831are concatenated with spaces separating them from each other and from 9832the compiler version. 9833It is enabled by default. 9834See also @option{-frecord-gcc-switches} for another 9835way of storing compiler options into the object file. 9836 9837@item -gstrict-dwarf 9838@opindex gstrict-dwarf 9839Disallow using extensions of later DWARF standard version than selected 9840with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 9841DWARF extensions from later standard versions is allowed. 9842 9843@item -gno-strict-dwarf 9844@opindex gno-strict-dwarf 9845Allow using extensions of later DWARF standard version than selected with 9846@option{-gdwarf-@var{version}}. 9847 9848@item -gas-loc-support 9849@opindex gas-loc-support 9850Inform the compiler that the assembler supports @code{.loc} directives. 9851It may then use them for the assembler to generate DWARF2+ line number 9852tables. 9853 9854This is generally desirable, because assembler-generated line-number 9855tables are a lot more compact than those the compiler can generate 9856itself. 9857 9858This option will be enabled by default if, at GCC configure time, the 9859assembler was found to support such directives. 9860 9861@item -gno-as-loc-support 9862@opindex gno-as-loc-support 9863Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ 9864line number tables are to be generated. 9865 9866@item -gas-locview-support 9867@opindex gas-locview-support 9868Inform the compiler that the assembler supports @code{view} assignment 9869and reset assertion checking in @code{.loc} directives. 9870 9871This option will be enabled by default if, at GCC configure time, the 9872assembler was found to support them. 9873 9874@item -gno-as-locview-support 9875Force GCC to assign view numbers internally, if 9876@option{-gvariable-location-views} are explicitly requested. 9877 9878@item -gcolumn-info 9879@itemx -gno-column-info 9880@opindex gcolumn-info 9881@opindex gno-column-info 9882Emit location column information into DWARF debugging information, rather 9883than just file and line. 9884This option is enabled by default. 9885 9886@item -gstatement-frontiers 9887@itemx -gno-statement-frontiers 9888@opindex gstatement-frontiers 9889@opindex gno-statement-frontiers 9890This option causes GCC to create markers in the internal representation 9891at the beginning of statements, and to keep them roughly in place 9892throughout compilation, using them to guide the output of @code{is_stmt} 9893markers in the line number table. This is enabled by default when 9894compiling with optimization (@option{-Os}, @option{-O}, @option{-O2}, 9895@dots{}), and outputting DWARF 2 debug information at the normal level. 9896 9897@item -gvariable-location-views 9898@itemx -gvariable-location-views=incompat5 9899@itemx -gno-variable-location-views 9900@opindex gvariable-location-views 9901@opindex gvariable-location-views=incompat5 9902@opindex gno-variable-location-views 9903Augment variable location lists with progressive view numbers implied 9904from the line number table. This enables debug information consumers to 9905inspect state at certain points of the program, even if no instructions 9906associated with the corresponding source locations are present at that 9907point. If the assembler lacks support for view numbers in line number 9908tables, this will cause the compiler to emit the line number table, 9909which generally makes them somewhat less compact. The augmented line 9910number tables and location lists are fully backward-compatible, so they 9911can be consumed by debug information consumers that are not aware of 9912these augmentations, but they won't derive any benefit from them either. 9913 9914This is enabled by default when outputting DWARF 2 debug information at 9915the normal level, as long as there is assembler support, 9916@option{-fvar-tracking-assignments} is enabled and 9917@option{-gstrict-dwarf} is not. When assembler support is not 9918available, this may still be enabled, but it will force GCC to output 9919internal line number tables, and if 9920@option{-ginternal-reset-location-views} is not enabled, that will most 9921certainly lead to silently mismatching location views. 9922 9923There is a proposed representation for view numbers that is not backward 9924compatible with the location list format introduced in DWARF 5, that can 9925be enabled with @option{-gvariable-location-views=incompat5}. This 9926option may be removed in the future, is only provided as a reference 9927implementation of the proposed representation. Debug information 9928consumers are not expected to support this extended format, and they 9929would be rendered unable to decode location lists using it. 9930 9931@item -ginternal-reset-location-views 9932@itemx -gno-internal-reset-location-views 9933@opindex ginternal-reset-location-views 9934@opindex gno-internal-reset-location-views 9935Attempt to determine location views that can be omitted from location 9936view lists. This requires the compiler to have very accurate insn 9937length estimates, which isn't always the case, and it may cause 9938incorrect view lists to be generated silently when using an assembler 9939that does not support location view lists. The GNU assembler will flag 9940any such error as a @code{view number mismatch}. This is only enabled 9941on ports that define a reliable estimation function. 9942 9943@item -ginline-points 9944@itemx -gno-inline-points 9945@opindex ginline-points 9946@opindex gno-inline-points 9947Generate extended debug information for inlined functions. Location 9948view tracking markers are inserted at inlined entry points, so that 9949address and view numbers can be computed and output in debug 9950information. This can be enabled independently of location views, in 9951which case the view numbers won't be output, but it can only be enabled 9952along with statement frontiers, and it is only enabled by default if 9953location views are enabled. 9954 9955@item -gz@r{[}=@var{type}@r{]} 9956@opindex gz 9957Produce compressed debug sections in DWARF format, if that is supported. 9958If @var{type} is not given, the default type depends on the capabilities 9959of the assembler and linker used. @var{type} may be one of 9960@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 9961compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 9962compression in traditional GNU format). If the linker doesn't support 9963writing compressed debug sections, the option is rejected. Otherwise, 9964if the assembler does not support them, @option{-gz} is silently ignored 9965when producing object files. 9966 9967@item -femit-struct-debug-baseonly 9968@opindex femit-struct-debug-baseonly 9969Emit debug information for struct-like types 9970only when the base name of the compilation source file 9971matches the base name of file in which the struct is defined. 9972 9973This option substantially reduces the size of debugging information, 9974but at significant potential loss in type information to the debugger. 9975See @option{-femit-struct-debug-reduced} for a less aggressive option. 9976See @option{-femit-struct-debug-detailed} for more detailed control. 9977 9978This option works only with DWARF debug output. 9979 9980@item -femit-struct-debug-reduced 9981@opindex femit-struct-debug-reduced 9982Emit debug information for struct-like types 9983only when the base name of the compilation source file 9984matches the base name of file in which the type is defined, 9985unless the struct is a template or defined in a system header. 9986 9987This option significantly reduces the size of debugging information, 9988with some potential loss in type information to the debugger. 9989See @option{-femit-struct-debug-baseonly} for a more aggressive option. 9990See @option{-femit-struct-debug-detailed} for more detailed control. 9991 9992This option works only with DWARF debug output. 9993 9994@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 9995@opindex femit-struct-debug-detailed 9996Specify the struct-like types 9997for which the compiler generates debug information. 9998The intent is to reduce duplicate struct debug information 9999between different object files within the same program. 10000 10001This option is a detailed version of 10002@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 10003which serves for most needs. 10004 10005A specification has the syntax@* 10006[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 10007 10008The optional first word limits the specification to 10009structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 10010A struct type is used directly when it is the type of a variable, member. 10011Indirect uses arise through pointers to structs. 10012That is, when use of an incomplete struct is valid, the use is indirect. 10013An example is 10014@samp{struct one direct; struct two * indirect;}. 10015 10016The optional second word limits the specification to 10017ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 10018Generic structs are a bit complicated to explain. 10019For C++, these are non-explicit specializations of template classes, 10020or non-template classes within the above. 10021Other programming languages have generics, 10022but @option{-femit-struct-debug-detailed} does not yet implement them. 10023 10024The third word specifies the source files for those 10025structs for which the compiler should emit debug information. 10026The values @samp{none} and @samp{any} have the normal meaning. 10027The value @samp{base} means that 10028the base of name of the file in which the type declaration appears 10029must match the base of the name of the main compilation file. 10030In practice, this means that when compiling @file{foo.c}, debug information 10031is generated for types declared in that file and @file{foo.h}, 10032but not other header files. 10033The value @samp{sys} means those types satisfying @samp{base} 10034or declared in system or compiler headers. 10035 10036You may need to experiment to determine the best settings for your application. 10037 10038The default is @option{-femit-struct-debug-detailed=all}. 10039 10040This option works only with DWARF debug output. 10041 10042@item -fno-dwarf2-cfi-asm 10043@opindex fdwarf2-cfi-asm 10044@opindex fno-dwarf2-cfi-asm 10045Emit DWARF unwind info as compiler generated @code{.eh_frame} section 10046instead of using GAS @code{.cfi_*} directives. 10047 10048@item -fno-eliminate-unused-debug-types 10049@opindex feliminate-unused-debug-types 10050@opindex fno-eliminate-unused-debug-types 10051Normally, when producing DWARF output, GCC avoids producing debug symbol 10052output for types that are nowhere used in the source file being compiled. 10053Sometimes it is useful to have GCC emit debugging 10054information for all types declared in a compilation 10055unit, regardless of whether or not they are actually used 10056in that compilation unit, for example 10057if, in the debugger, you want to cast a value to a type that is 10058not actually used in your program (but is declared). More often, 10059however, this results in a significant amount of wasted space. 10060@end table 10061 10062@node Optimize Options 10063@section Options That Control Optimization 10064@cindex optimize options 10065@cindex options, optimization 10066 10067These options control various sorts of optimizations. 10068 10069Without any optimization option, the compiler's goal is to reduce the 10070cost of compilation and to make debugging produce the expected 10071results. Statements are independent: if you stop the program with a 10072breakpoint between statements, you can then assign a new value to any 10073variable or change the program counter to any other statement in the 10074function and get exactly the results you expect from the source 10075code. 10076 10077Turning on optimization flags makes the compiler attempt to improve 10078the performance and/or code size at the expense of compilation time 10079and possibly the ability to debug the program. 10080 10081The compiler performs optimization based on the knowledge it has of the 10082program. Compiling multiple files at once to a single output file mode allows 10083the compiler to use information gained from all of the files when compiling 10084each of them. 10085 10086Not all optimizations are controlled directly by a flag. Only 10087optimizations that have a flag are listed in this section. 10088 10089Most optimizations are completely disabled at @option{-O0} or if an 10090@option{-O} level is not set on the command line, even if individual 10091optimization flags are specified. Similarly, @option{-Og} suppresses 10092many optimization passes. 10093 10094Depending on the target and how GCC was configured, a slightly different 10095set of optimizations may be enabled at each @option{-O} level than 10096those listed here. You can invoke GCC with @option{-Q --help=optimizers} 10097to find out the exact set of optimizations that are enabled at each level. 10098@xref{Overall Options}, for examples. 10099 10100@table @gcctabopt 10101@item -O 10102@itemx -O1 10103@opindex O 10104@opindex O1 10105Optimize. Optimizing compilation takes somewhat more time, and a lot 10106more memory for a large function. 10107 10108With @option{-O}, the compiler tries to reduce code size and execution 10109time, without performing any optimizations that take a great deal of 10110compilation time. 10111 10112@c Note that in addition to the default_options_table list in opts.c, 10113@c several optimization flags default to true but control optimization 10114@c passes that are explicitly disabled at -O0. 10115 10116@option{-O} turns on the following optimization flags: 10117 10118@c Please keep the following list alphabetized. 10119@gccoptlist{-fauto-inc-dec @gol 10120-fbranch-count-reg @gol 10121-fcombine-stack-adjustments @gol 10122-fcompare-elim @gol 10123-fcprop-registers @gol 10124-fdce @gol 10125-fdefer-pop @gol 10126-fdelayed-branch @gol 10127-fdse @gol 10128-fforward-propagate @gol 10129-fguess-branch-probability @gol 10130-fif-conversion @gol 10131-fif-conversion2 @gol 10132-finline-functions-called-once @gol 10133-fipa-modref @gol 10134-fipa-profile @gol 10135-fipa-pure-const @gol 10136-fipa-reference @gol 10137-fipa-reference-addressable @gol 10138-fmerge-constants @gol 10139-fmove-loop-invariants @gol 10140-fomit-frame-pointer @gol 10141-freorder-blocks @gol 10142-fshrink-wrap @gol 10143-fshrink-wrap-separate @gol 10144-fsplit-wide-types @gol 10145-fssa-backprop @gol 10146-fssa-phiopt @gol 10147-ftree-bit-ccp @gol 10148-ftree-ccp @gol 10149-ftree-ch @gol 10150-ftree-coalesce-vars @gol 10151-ftree-copy-prop @gol 10152-ftree-dce @gol 10153-ftree-dominator-opts @gol 10154-ftree-dse @gol 10155-ftree-forwprop @gol 10156-ftree-fre @gol 10157-ftree-phiprop @gol 10158-ftree-pta @gol 10159-ftree-scev-cprop @gol 10160-ftree-sink @gol 10161-ftree-slsr @gol 10162-ftree-sra @gol 10163-ftree-ter @gol 10164-funit-at-a-time} 10165 10166@item -O2 10167@opindex O2 10168Optimize even more. GCC performs nearly all supported optimizations 10169that do not involve a space-speed tradeoff. 10170As compared to @option{-O}, this option increases both compilation time 10171and the performance of the generated code. 10172 10173@option{-O2} turns on all optimization flags specified by @option{-O}. It 10174also turns on the following optimization flags: 10175 10176@c Please keep the following list alphabetized! 10177@gccoptlist{-falign-functions -falign-jumps @gol 10178-falign-labels -falign-loops @gol 10179-fcaller-saves @gol 10180-fcode-hoisting @gol 10181-fcrossjumping @gol 10182-fcse-follow-jumps -fcse-skip-blocks @gol 10183-fdelete-null-pointer-checks @gol 10184-fdevirtualize -fdevirtualize-speculatively @gol 10185-fexpensive-optimizations @gol 10186-ffinite-loops @gol 10187-fgcse -fgcse-lm @gol 10188-fhoist-adjacent-loads @gol 10189-finline-functions @gol 10190-finline-small-functions @gol 10191-findirect-inlining @gol 10192-fipa-bit-cp -fipa-cp -fipa-icf @gol 10193-fipa-ra -fipa-sra -fipa-vrp @gol 10194-fisolate-erroneous-paths-dereference @gol 10195-flra-remat @gol 10196-foptimize-sibling-calls @gol 10197-foptimize-strlen @gol 10198-fpartial-inlining @gol 10199-fpeephole2 @gol 10200-freorder-blocks-algorithm=stc @gol 10201-freorder-blocks-and-partition -freorder-functions @gol 10202-frerun-cse-after-loop @gol 10203-fschedule-insns -fschedule-insns2 @gol 10204-fsched-interblock -fsched-spec @gol 10205-fstore-merging @gol 10206-fstrict-aliasing @gol 10207-fthread-jumps @gol 10208-ftree-builtin-call-dce @gol 10209-ftree-pre @gol 10210-ftree-switch-conversion -ftree-tail-merge @gol 10211-ftree-vrp} 10212 10213Please note the warning under @option{-fgcse} about 10214invoking @option{-O2} on programs that use computed gotos. 10215 10216@item -O3 10217@opindex O3 10218Optimize yet more. @option{-O3} turns on all optimizations specified 10219by @option{-O2} and also turns on the following optimization flags: 10220 10221@c Please keep the following list alphabetized! 10222@gccoptlist{-fgcse-after-reload @gol 10223-fipa-cp-clone 10224-floop-interchange @gol 10225-floop-unroll-and-jam @gol 10226-fpeel-loops @gol 10227-fpredictive-commoning @gol 10228-fsplit-loops @gol 10229-fsplit-paths @gol 10230-ftree-loop-distribution @gol 10231-ftree-loop-vectorize @gol 10232-ftree-partial-pre @gol 10233-ftree-slp-vectorize @gol 10234-funswitch-loops @gol 10235-fvect-cost-model @gol 10236-fvect-cost-model=dynamic @gol 10237-fversion-loops-for-strides} 10238 10239@item -O0 10240@opindex O0 10241Reduce compilation time and make debugging produce the expected 10242results. This is the default. 10243 10244@item -Os 10245@opindex Os 10246Optimize for size. @option{-Os} enables all @option{-O2} optimizations 10247except those that often increase code size: 10248 10249@gccoptlist{-falign-functions -falign-jumps @gol 10250-falign-labels -falign-loops @gol 10251-fprefetch-loop-arrays -freorder-blocks-algorithm=stc} 10252 10253It also enables @option{-finline-functions}, causes the compiler to tune for 10254code size rather than execution speed, and performs further optimizations 10255designed to reduce code size. 10256 10257@item -Ofast 10258@opindex Ofast 10259Disregard strict standards compliance. @option{-Ofast} enables all 10260@option{-O3} optimizations. It also enables optimizations that are not 10261valid for all standard-compliant programs. 10262It turns on @option{-ffast-math}, @option{-fallow-store-data-races} 10263and the Fortran-specific @option{-fstack-arrays}, unless 10264@option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}. 10265 10266@item -Og 10267@opindex Og 10268Optimize debugging experience. @option{-Og} should be the optimization 10269level of choice for the standard edit-compile-debug cycle, offering 10270a reasonable level of optimization while maintaining fast compilation 10271and a good debugging experience. It is a better choice than @option{-O0} 10272for producing debuggable code because some compiler passes 10273that collect debug information are disabled at @option{-O0}. 10274 10275Like @option{-O0}, @option{-Og} completely disables a number of 10276optimization passes so that individual options controlling them have 10277no effect. Otherwise @option{-Og} enables all @option{-O1} 10278optimization flags except for those that may interfere with debugging: 10279 10280@gccoptlist{-fbranch-count-reg -fdelayed-branch @gol 10281-fdse -fif-conversion -fif-conversion2 @gol 10282-finline-functions-called-once @gol 10283-fmove-loop-invariants -fssa-phiopt @gol 10284-ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra} 10285 10286@end table 10287 10288If you use multiple @option{-O} options, with or without level numbers, 10289the last such option is the one that is effective. 10290 10291Options of the form @option{-f@var{flag}} specify machine-independent 10292flags. Most flags have both positive and negative forms; the negative 10293form of @option{-ffoo} is @option{-fno-foo}. In the table 10294below, only one of the forms is listed---the one you typically 10295use. You can figure out the other form by either removing @samp{no-} 10296or adding it. 10297 10298The following options control specific optimizations. They are either 10299activated by @option{-O} options or are related to ones that are. You 10300can use the following flags in the rare cases when ``fine-tuning'' of 10301optimizations to be performed is desired. 10302 10303@table @gcctabopt 10304@item -fno-defer-pop 10305@opindex fno-defer-pop 10306@opindex fdefer-pop 10307For machines that must pop arguments after a function call, always pop 10308the arguments as soon as each function returns. 10309At levels @option{-O1} and higher, @option{-fdefer-pop} is the default; 10310this allows the compiler to let arguments accumulate on the stack for several 10311function calls and pop them all at once. 10312 10313@item -fforward-propagate 10314@opindex fforward-propagate 10315Perform a forward propagation pass on RTL@. The pass tries to combine two 10316instructions and checks if the result can be simplified. If loop unrolling 10317is active, two passes are performed and the second is scheduled after 10318loop unrolling. 10319 10320This option is enabled by default at optimization levels @option{-O}, 10321@option{-O2}, @option{-O3}, @option{-Os}. 10322 10323@item -ffp-contract=@var{style} 10324@opindex ffp-contract 10325@option{-ffp-contract=off} disables floating-point expression contraction. 10326@option{-ffp-contract=fast} enables floating-point expression contraction 10327such as forming of fused multiply-add operations if the target has 10328native support for them. 10329@option{-ffp-contract=on} enables floating-point expression contraction 10330if allowed by the language standard. This is currently not implemented 10331and treated equal to @option{-ffp-contract=off}. 10332 10333The default is @option{-ffp-contract=fast}. 10334 10335@item -fomit-frame-pointer 10336@opindex fomit-frame-pointer 10337Omit the frame pointer in functions that don't need one. This avoids the 10338instructions to save, set up and restore the frame pointer; on many targets 10339it also makes an extra register available. 10340 10341On some targets this flag has no effect because the standard calling sequence 10342always uses a frame pointer, so it cannot be omitted. 10343 10344Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer 10345is used in all functions. Several targets always omit the frame pointer in 10346leaf functions. 10347 10348Enabled by default at @option{-O} and higher. 10349 10350@item -foptimize-sibling-calls 10351@opindex foptimize-sibling-calls 10352Optimize sibling and tail recursive calls. 10353 10354Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10355 10356@item -foptimize-strlen 10357@opindex foptimize-strlen 10358Optimize various standard C string functions (e.g.@: @code{strlen}, 10359@code{strchr} or @code{strcpy}) and 10360their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 10361 10362Enabled at levels @option{-O2}, @option{-O3}. 10363 10364@item -fno-inline 10365@opindex fno-inline 10366@opindex finline 10367Do not expand any functions inline apart from those marked with 10368the @code{always_inline} attribute. This is the default when not 10369optimizing. 10370 10371Single functions can be exempted from inlining by marking them 10372with the @code{noinline} attribute. 10373 10374@item -finline-small-functions 10375@opindex finline-small-functions 10376Integrate functions into their callers when their body is smaller than expected 10377function call code (so overall size of program gets smaller). The compiler 10378heuristically decides which functions are simple enough to be worth integrating 10379in this way. This inlining applies to all functions, even those not declared 10380inline. 10381 10382Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10383 10384@item -findirect-inlining 10385@opindex findirect-inlining 10386Inline also indirect calls that are discovered to be known at compile 10387time thanks to previous inlining. This option has any effect only 10388when inlining itself is turned on by the @option{-finline-functions} 10389or @option{-finline-small-functions} options. 10390 10391Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10392 10393@item -finline-functions 10394@opindex finline-functions 10395Consider all functions for inlining, even if they are not declared inline. 10396The compiler heuristically decides which functions are worth integrating 10397in this way. 10398 10399If all calls to a given function are integrated, and the function is 10400declared @code{static}, then the function is normally not output as 10401assembler code in its own right. 10402 10403Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled 10404by @option{-fprofile-use} and @option{-fauto-profile}. 10405 10406@item -finline-functions-called-once 10407@opindex finline-functions-called-once 10408Consider all @code{static} functions called once for inlining into their 10409caller even if they are not marked @code{inline}. If a call to a given 10410function is integrated, then the function is not output as assembler code 10411in its own right. 10412 10413Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}, 10414but not @option{-Og}. 10415 10416@item -fearly-inlining 10417@opindex fearly-inlining 10418Inline functions marked by @code{always_inline} and functions whose body seems 10419smaller than the function call overhead early before doing 10420@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 10421makes profiling significantly cheaper and usually inlining faster on programs 10422having large chains of nested wrapper functions. 10423 10424Enabled by default. 10425 10426@item -fipa-sra 10427@opindex fipa-sra 10428Perform interprocedural scalar replacement of aggregates, removal of 10429unused parameters and replacement of parameters passed by reference 10430by parameters passed by value. 10431 10432Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 10433 10434@item -finline-limit=@var{n} 10435@opindex finline-limit 10436By default, GCC limits the size of functions that can be inlined. This flag 10437allows coarse control of this limit. @var{n} is the size of functions that 10438can be inlined in number of pseudo instructions. 10439 10440Inlining is actually controlled by a number of parameters, which may be 10441specified individually by using @option{--param @var{name}=@var{value}}. 10442The @option{-finline-limit=@var{n}} option sets some of these parameters 10443as follows: 10444 10445@table @gcctabopt 10446@item max-inline-insns-single 10447is set to @var{n}/2. 10448@item max-inline-insns-auto 10449is set to @var{n}/2. 10450@end table 10451 10452See below for a documentation of the individual 10453parameters controlling inlining and for the defaults of these parameters. 10454 10455@emph{Note:} there may be no value to @option{-finline-limit} that results 10456in default behavior. 10457 10458@emph{Note:} pseudo instruction represents, in this particular context, an 10459abstract measurement of function's size. In no way does it represent a count 10460of assembly instructions and as such its exact meaning might change from one 10461release to an another. 10462 10463@item -fno-keep-inline-dllexport 10464@opindex fno-keep-inline-dllexport 10465@opindex fkeep-inline-dllexport 10466This is a more fine-grained version of @option{-fkeep-inline-functions}, 10467which applies only to functions that are declared using the @code{dllexport} 10468attribute or declspec. @xref{Function Attributes,,Declaring Attributes of 10469Functions}. 10470 10471@item -fkeep-inline-functions 10472@opindex fkeep-inline-functions 10473In C, emit @code{static} functions that are declared @code{inline} 10474into the object file, even if the function has been inlined into all 10475of its callers. This switch does not affect functions using the 10476@code{extern inline} extension in GNU C90@. In C++, emit any and all 10477inline functions into the object file. 10478 10479@item -fkeep-static-functions 10480@opindex fkeep-static-functions 10481Emit @code{static} functions into the object file, even if the function 10482is never used. 10483 10484@item -fkeep-static-consts 10485@opindex fkeep-static-consts 10486Emit variables declared @code{static const} when optimization isn't turned 10487on, even if the variables aren't referenced. 10488 10489GCC enables this option by default. If you want to force the compiler to 10490check if a variable is referenced, regardless of whether or not 10491optimization is turned on, use the @option{-fno-keep-static-consts} option. 10492 10493@item -fmerge-constants 10494@opindex fmerge-constants 10495Attempt to merge identical constants (string constants and floating-point 10496constants) across compilation units. 10497 10498This option is the default for optimized compilation if the assembler and 10499linker support it. Use @option{-fno-merge-constants} to inhibit this 10500behavior. 10501 10502Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 10503 10504@item -fmerge-all-constants 10505@opindex fmerge-all-constants 10506Attempt to merge identical constants and identical variables. 10507 10508This option implies @option{-fmerge-constants}. In addition to 10509@option{-fmerge-constants} this considers e.g.@: even constant initialized 10510arrays or initialized constant variables with integral or floating-point 10511types. Languages like C or C++ require each variable, including multiple 10512instances of the same variable in recursive calls, to have distinct locations, 10513so using this option results in non-conforming 10514behavior. 10515 10516@item -fmodulo-sched 10517@opindex fmodulo-sched 10518Perform swing modulo scheduling immediately before the first scheduling 10519pass. This pass looks at innermost loops and reorders their 10520instructions by overlapping different iterations. 10521 10522@item -fmodulo-sched-allow-regmoves 10523@opindex fmodulo-sched-allow-regmoves 10524Perform more aggressive SMS-based modulo scheduling with register moves 10525allowed. By setting this flag certain anti-dependences edges are 10526deleted, which triggers the generation of reg-moves based on the 10527life-range analysis. This option is effective only with 10528@option{-fmodulo-sched} enabled. 10529 10530@item -fno-branch-count-reg 10531@opindex fno-branch-count-reg 10532@opindex fbranch-count-reg 10533Disable the optimization pass that scans for opportunities to use 10534``decrement and branch'' instructions on a count register instead of 10535instruction sequences that decrement a register, compare it against zero, and 10536then branch based upon the result. This option is only meaningful on 10537architectures that support such instructions, which include x86, PowerPC, 10538IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option 10539doesn't remove the decrement and branch instructions from the generated 10540instruction stream introduced by other optimization passes. 10541 10542The default is @option{-fbranch-count-reg} at @option{-O1} and higher, 10543except for @option{-Og}. 10544 10545@item -fno-function-cse 10546@opindex fno-function-cse 10547@opindex ffunction-cse 10548Do not put function addresses in registers; make each instruction that 10549calls a constant function contain the function's address explicitly. 10550 10551This option results in less efficient code, but some strange hacks 10552that alter the assembler output may be confused by the optimizations 10553performed when this option is not used. 10554 10555The default is @option{-ffunction-cse} 10556 10557@item -fno-zero-initialized-in-bss 10558@opindex fno-zero-initialized-in-bss 10559@opindex fzero-initialized-in-bss 10560If the target supports a BSS section, GCC by default puts variables that 10561are initialized to zero into BSS@. This can save space in the resulting 10562code. 10563 10564This option turns off this behavior because some programs explicitly 10565rely on variables going to the data section---e.g., so that the 10566resulting executable can find the beginning of that section and/or make 10567assumptions based on that. 10568 10569The default is @option{-fzero-initialized-in-bss}. 10570 10571@item -fthread-jumps 10572@opindex fthread-jumps 10573Perform optimizations that check to see if a jump branches to a 10574location where another comparison subsumed by the first is found. If 10575so, the first branch is redirected to either the destination of the 10576second branch or a point immediately following it, depending on whether 10577the condition is known to be true or false. 10578 10579Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10580 10581@item -fsplit-wide-types 10582@opindex fsplit-wide-types 10583When using a type that occupies multiple registers, such as @code{long 10584long} on a 32-bit system, split the registers apart and allocate them 10585independently. This normally generates better code for those types, 10586but may make debugging more difficult. 10587 10588Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 10589@option{-Os}. 10590 10591@item -fsplit-wide-types-early 10592@opindex fsplit-wide-types-early 10593Fully split wide types early, instead of very late. 10594This option has no effect unless @option{-fsplit-wide-types} is turned on. 10595 10596This is the default on some targets. 10597 10598@item -fcse-follow-jumps 10599@opindex fcse-follow-jumps 10600In common subexpression elimination (CSE), scan through jump instructions 10601when the target of the jump is not reached by any other path. For 10602example, when CSE encounters an @code{if} statement with an 10603@code{else} clause, CSE follows the jump when the condition 10604tested is false. 10605 10606Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10607 10608@item -fcse-skip-blocks 10609@opindex fcse-skip-blocks 10610This is similar to @option{-fcse-follow-jumps}, but causes CSE to 10611follow jumps that conditionally skip over blocks. When CSE 10612encounters a simple @code{if} statement with no else clause, 10613@option{-fcse-skip-blocks} causes CSE to follow the jump around the 10614body of the @code{if}. 10615 10616Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10617 10618@item -frerun-cse-after-loop 10619@opindex frerun-cse-after-loop 10620Re-run common subexpression elimination after loop optimizations are 10621performed. 10622 10623Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10624 10625@item -fgcse 10626@opindex fgcse 10627Perform a global common subexpression elimination pass. 10628This pass also performs global constant and copy propagation. 10629 10630@emph{Note:} When compiling a program using computed gotos, a GCC 10631extension, you may get better run-time performance if you disable 10632the global common subexpression elimination pass by adding 10633@option{-fno-gcse} to the command line. 10634 10635Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10636 10637@item -fgcse-lm 10638@opindex fgcse-lm 10639When @option{-fgcse-lm} is enabled, global common subexpression elimination 10640attempts to move loads that are only killed by stores into themselves. This 10641allows a loop containing a load/store sequence to be changed to a load outside 10642the loop, and a copy/store within the loop. 10643 10644Enabled by default when @option{-fgcse} is enabled. 10645 10646@item -fgcse-sm 10647@opindex fgcse-sm 10648When @option{-fgcse-sm} is enabled, a store motion pass is run after 10649global common subexpression elimination. This pass attempts to move 10650stores out of loops. When used in conjunction with @option{-fgcse-lm}, 10651loops containing a load/store sequence can be changed to a load before 10652the loop and a store after the loop. 10653 10654Not enabled at any optimization level. 10655 10656@item -fgcse-las 10657@opindex fgcse-las 10658When @option{-fgcse-las} is enabled, the global common subexpression 10659elimination pass eliminates redundant loads that come after stores to the 10660same memory location (both partial and full redundancies). 10661 10662Not enabled at any optimization level. 10663 10664@item -fgcse-after-reload 10665@opindex fgcse-after-reload 10666When @option{-fgcse-after-reload} is enabled, a redundant load elimination 10667pass is performed after reload. The purpose of this pass is to clean up 10668redundant spilling. 10669 10670Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 10671 10672@item -faggressive-loop-optimizations 10673@opindex faggressive-loop-optimizations 10674This option tells the loop optimizer to use language constraints to 10675derive bounds for the number of iterations of a loop. This assumes that 10676loop code does not invoke undefined behavior by for example causing signed 10677integer overflows or out-of-bound array accesses. The bounds for the 10678number of iterations of a loop are used to guide loop unrolling and peeling 10679and loop exit test optimizations. 10680This option is enabled by default. 10681 10682@item -funconstrained-commons 10683@opindex funconstrained-commons 10684This option tells the compiler that variables declared in common blocks 10685(e.g.@: Fortran) may later be overridden with longer trailing arrays. This 10686prevents certain optimizations that depend on knowing the array bounds. 10687 10688@item -fcrossjumping 10689@opindex fcrossjumping 10690Perform cross-jumping transformation. 10691This transformation unifies equivalent code and saves code size. The 10692resulting code may or may not perform better than without cross-jumping. 10693 10694Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10695 10696@item -fauto-inc-dec 10697@opindex fauto-inc-dec 10698Combine increments or decrements of addresses with memory accesses. 10699This pass is always skipped on architectures that do not have 10700instructions to support this. Enabled by default at @option{-O} and 10701higher on architectures that support this. 10702 10703@item -fdce 10704@opindex fdce 10705Perform dead code elimination (DCE) on RTL@. 10706Enabled by default at @option{-O} and higher. 10707 10708@item -fdse 10709@opindex fdse 10710Perform dead store elimination (DSE) on RTL@. 10711Enabled by default at @option{-O} and higher. 10712 10713@item -fif-conversion 10714@opindex fif-conversion 10715Attempt to transform conditional jumps into branch-less equivalents. This 10716includes use of conditional moves, min, max, set flags and abs instructions, and 10717some tricks doable by standard arithmetics. The use of conditional execution 10718on chips where it is available is controlled by @option{-fif-conversion2}. 10719 10720Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but 10721not with @option{-Og}. 10722 10723@item -fif-conversion2 10724@opindex fif-conversion2 10725Use conditional execution (where available) to transform conditional jumps into 10726branch-less equivalents. 10727 10728Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but 10729not with @option{-Og}. 10730 10731@item -fdeclone-ctor-dtor 10732@opindex fdeclone-ctor-dtor 10733The C++ ABI requires multiple entry points for constructors and 10734destructors: one for a base subobject, one for a complete object, and 10735one for a virtual destructor that calls operator delete afterwards. 10736For a hierarchy with virtual bases, the base and complete variants are 10737clones, which means two copies of the function. With this option, the 10738base and complete variants are changed to be thunks that call a common 10739implementation. 10740 10741Enabled by @option{-Os}. 10742 10743@item -fdelete-null-pointer-checks 10744@opindex fdelete-null-pointer-checks 10745Assume that programs cannot safely dereference null pointers, and that 10746no code or data element resides at address zero. 10747This option enables simple constant 10748folding optimizations at all optimization levels. In addition, other 10749optimization passes in GCC use this flag to control global dataflow 10750analyses that eliminate useless checks for null pointers; these assume 10751that a memory access to address zero always results in a trap, so 10752that if a pointer is checked after it has already been dereferenced, 10753it cannot be null. 10754 10755Note however that in some environments this assumption is not true. 10756Use @option{-fno-delete-null-pointer-checks} to disable this optimization 10757for programs that depend on that behavior. 10758 10759This option is enabled by default on most targets. On Nios II ELF, it 10760defaults to off. On AVR, CR16, and MSP430, this option is completely disabled. 10761 10762Passes that use the dataflow information 10763are enabled independently at different optimization levels. 10764 10765@item -fdevirtualize 10766@opindex fdevirtualize 10767Attempt to convert calls to virtual functions to direct calls. This 10768is done both within a procedure and interprocedurally as part of 10769indirect inlining (@option{-findirect-inlining}) and interprocedural constant 10770propagation (@option{-fipa-cp}). 10771Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10772 10773@item -fdevirtualize-speculatively 10774@opindex fdevirtualize-speculatively 10775Attempt to convert calls to virtual functions to speculative direct calls. 10776Based on the analysis of the type inheritance graph, determine for a given call 10777the set of likely targets. If the set is small, preferably of size 1, change 10778the call into a conditional deciding between direct and indirect calls. The 10779speculative calls enable more optimizations, such as inlining. When they seem 10780useless after further optimization, they are converted back into original form. 10781 10782@item -fdevirtualize-at-ltrans 10783@opindex fdevirtualize-at-ltrans 10784Stream extra information needed for aggressive devirtualization when running 10785the link-time optimizer in local transformation mode. 10786This option enables more devirtualization but 10787significantly increases the size of streamed data. For this reason it is 10788disabled by default. 10789 10790@item -fexpensive-optimizations 10791@opindex fexpensive-optimizations 10792Perform a number of minor optimizations that are relatively expensive. 10793 10794Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10795 10796@item -free 10797@opindex free 10798Attempt to remove redundant extension instructions. This is especially 10799helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 10800registers after writing to their lower 32-bit half. 10801 10802Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 10803@option{-O3}, @option{-Os}. 10804 10805@item -fno-lifetime-dse 10806@opindex fno-lifetime-dse 10807@opindex flifetime-dse 10808In C++ the value of an object is only affected by changes within its 10809lifetime: when the constructor begins, the object has an indeterminate 10810value, and any changes during the lifetime of the object are dead when 10811the object is destroyed. Normally dead store elimination will take 10812advantage of this; if your code relies on the value of the object 10813storage persisting beyond the lifetime of the object, you can use this 10814flag to disable this optimization. To preserve stores before the 10815constructor starts (e.g.@: because your operator new clears the object 10816storage) but still treat the object as dead after the destructor, you 10817can use @option{-flifetime-dse=1}. The default behavior can be 10818explicitly selected with @option{-flifetime-dse=2}. 10819@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}. 10820 10821@item -flive-range-shrinkage 10822@opindex flive-range-shrinkage 10823Attempt to decrease register pressure through register live range 10824shrinkage. This is helpful for fast processors with small or moderate 10825size register sets. 10826 10827@item -fira-algorithm=@var{algorithm} 10828@opindex fira-algorithm 10829Use the specified coloring algorithm for the integrated register 10830allocator. The @var{algorithm} argument can be @samp{priority}, which 10831specifies Chow's priority coloring, or @samp{CB}, which specifies 10832Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 10833for all architectures, but for those targets that do support it, it is 10834the default because it generates better code. 10835 10836@item -fira-region=@var{region} 10837@opindex fira-region 10838Use specified regions for the integrated register allocator. The 10839@var{region} argument should be one of the following: 10840 10841@table @samp 10842 10843@item all 10844Use all loops as register allocation regions. 10845This can give the best results for machines with a small and/or 10846irregular register set. 10847 10848@item mixed 10849Use all loops except for loops with small register pressure 10850as the regions. This value usually gives 10851the best results in most cases and for most architectures, 10852and is enabled by default when compiling with optimization for speed 10853(@option{-O}, @option{-O2}, @dots{}). 10854 10855@item one 10856Use all functions as a single region. 10857This typically results in the smallest code size, and is enabled by default for 10858@option{-Os} or @option{-O0}. 10859 10860@end table 10861 10862@item -fira-hoist-pressure 10863@opindex fira-hoist-pressure 10864Use IRA to evaluate register pressure in the code hoisting pass for 10865decisions to hoist expressions. This option usually results in smaller 10866code, but it can slow the compiler down. 10867 10868This option is enabled at level @option{-Os} for all targets. 10869 10870@item -fira-loop-pressure 10871@opindex fira-loop-pressure 10872Use IRA to evaluate register pressure in loops for decisions to move 10873loop invariants. This option usually results in generation 10874of faster and smaller code on machines with large register files (>= 32 10875registers), but it can slow the compiler down. 10876 10877This option is enabled at level @option{-O3} for some targets. 10878 10879@item -fno-ira-share-save-slots 10880@opindex fno-ira-share-save-slots 10881@opindex fira-share-save-slots 10882Disable sharing of stack slots used for saving call-used hard 10883registers living through a call. Each hard register gets a 10884separate stack slot, and as a result function stack frames are 10885larger. 10886 10887@item -fno-ira-share-spill-slots 10888@opindex fno-ira-share-spill-slots 10889@opindex fira-share-spill-slots 10890Disable sharing of stack slots allocated for pseudo-registers. Each 10891pseudo-register that does not get a hard register gets a separate 10892stack slot, and as a result function stack frames are larger. 10893 10894@item -flra-remat 10895@opindex flra-remat 10896Enable CFG-sensitive rematerialization in LRA. Instead of loading 10897values of spilled pseudos, LRA tries to rematerialize (recalculate) 10898values if it is profitable. 10899 10900Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10901 10902@item -fdelayed-branch 10903@opindex fdelayed-branch 10904If supported for the target machine, attempt to reorder instructions 10905to exploit instruction slots available after delayed branch 10906instructions. 10907 10908Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, 10909but not at @option{-Og}. 10910 10911@item -fschedule-insns 10912@opindex fschedule-insns 10913If supported for the target machine, attempt to reorder instructions to 10914eliminate execution stalls due to required data being unavailable. This 10915helps machines that have slow floating point or memory load instructions 10916by allowing other instructions to be issued until the result of the load 10917or floating-point instruction is required. 10918 10919Enabled at levels @option{-O2}, @option{-O3}. 10920 10921@item -fschedule-insns2 10922@opindex fschedule-insns2 10923Similar to @option{-fschedule-insns}, but requests an additional pass of 10924instruction scheduling after register allocation has been done. This is 10925especially useful on machines with a relatively small number of 10926registers and where memory load instructions take more than one cycle. 10927 10928Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10929 10930@item -fno-sched-interblock 10931@opindex fno-sched-interblock 10932@opindex fsched-interblock 10933Disable instruction scheduling across basic blocks, which 10934is normally enabled when scheduling before register allocation, i.e.@: 10935with @option{-fschedule-insns} or at @option{-O2} or higher. 10936 10937@item -fno-sched-spec 10938@opindex fno-sched-spec 10939@opindex fsched-spec 10940Disable speculative motion of non-load instructions, which 10941is normally enabled when scheduling before register allocation, i.e.@: 10942with @option{-fschedule-insns} or at @option{-O2} or higher. 10943 10944@item -fsched-pressure 10945@opindex fsched-pressure 10946Enable register pressure sensitive insn scheduling before register 10947allocation. This only makes sense when scheduling before register 10948allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 10949@option{-O2} or higher. Usage of this option can improve the 10950generated code and decrease its size by preventing register pressure 10951increase above the number of available hard registers and subsequent 10952spills in register allocation. 10953 10954@item -fsched-spec-load 10955@opindex fsched-spec-load 10956Allow speculative motion of some load instructions. This only makes 10957sense when scheduling before register allocation, i.e.@: with 10958@option{-fschedule-insns} or at @option{-O2} or higher. 10959 10960@item -fsched-spec-load-dangerous 10961@opindex fsched-spec-load-dangerous 10962Allow speculative motion of more load instructions. This only makes 10963sense when scheduling before register allocation, i.e.@: with 10964@option{-fschedule-insns} or at @option{-O2} or higher. 10965 10966@item -fsched-stalled-insns 10967@itemx -fsched-stalled-insns=@var{n} 10968@opindex fsched-stalled-insns 10969Define how many insns (if any) can be moved prematurely from the queue 10970of stalled insns into the ready list during the second scheduling pass. 10971@option{-fno-sched-stalled-insns} means that no insns are moved 10972prematurely, @option{-fsched-stalled-insns=0} means there is no limit 10973on how many queued insns can be moved prematurely. 10974@option{-fsched-stalled-insns} without a value is equivalent to 10975@option{-fsched-stalled-insns=1}. 10976 10977@item -fsched-stalled-insns-dep 10978@itemx -fsched-stalled-insns-dep=@var{n} 10979@opindex fsched-stalled-insns-dep 10980Define how many insn groups (cycles) are examined for a dependency 10981on a stalled insn that is a candidate for premature removal from the queue 10982of stalled insns. This has an effect only during the second scheduling pass, 10983and only if @option{-fsched-stalled-insns} is used. 10984@option{-fno-sched-stalled-insns-dep} is equivalent to 10985@option{-fsched-stalled-insns-dep=0}. 10986@option{-fsched-stalled-insns-dep} without a value is equivalent to 10987@option{-fsched-stalled-insns-dep=1}. 10988 10989@item -fsched2-use-superblocks 10990@opindex fsched2-use-superblocks 10991When scheduling after register allocation, use superblock scheduling. 10992This allows motion across basic block boundaries, 10993resulting in faster schedules. This option is experimental, as not all machine 10994descriptions used by GCC model the CPU closely enough to avoid unreliable 10995results from the algorithm. 10996 10997This only makes sense when scheduling after register allocation, i.e.@: with 10998@option{-fschedule-insns2} or at @option{-O2} or higher. 10999 11000@item -fsched-group-heuristic 11001@opindex fsched-group-heuristic 11002Enable the group heuristic in the scheduler. This heuristic favors 11003the instruction that belongs to a schedule group. This is enabled 11004by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 11005or @option{-fschedule-insns2} or at @option{-O2} or higher. 11006 11007@item -fsched-critical-path-heuristic 11008@opindex fsched-critical-path-heuristic 11009Enable the critical-path heuristic in the scheduler. This heuristic favors 11010instructions on the critical path. This is enabled by default when 11011scheduling is enabled, i.e.@: with @option{-fschedule-insns} 11012or @option{-fschedule-insns2} or at @option{-O2} or higher. 11013 11014@item -fsched-spec-insn-heuristic 11015@opindex fsched-spec-insn-heuristic 11016Enable the speculative instruction heuristic in the scheduler. This 11017heuristic favors speculative instructions with greater dependency weakness. 11018This is enabled by default when scheduling is enabled, i.e.@: 11019with @option{-fschedule-insns} or @option{-fschedule-insns2} 11020or at @option{-O2} or higher. 11021 11022@item -fsched-rank-heuristic 11023@opindex fsched-rank-heuristic 11024Enable the rank heuristic in the scheduler. This heuristic favors 11025the instruction belonging to a basic block with greater size or frequency. 11026This is enabled by default when scheduling is enabled, i.e.@: 11027with @option{-fschedule-insns} or @option{-fschedule-insns2} or 11028at @option{-O2} or higher. 11029 11030@item -fsched-last-insn-heuristic 11031@opindex fsched-last-insn-heuristic 11032Enable the last-instruction heuristic in the scheduler. This heuristic 11033favors the instruction that is less dependent on the last instruction 11034scheduled. This is enabled by default when scheduling is enabled, 11035i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 11036at @option{-O2} or higher. 11037 11038@item -fsched-dep-count-heuristic 11039@opindex fsched-dep-count-heuristic 11040Enable the dependent-count heuristic in the scheduler. This heuristic 11041favors the instruction that has more instructions depending on it. 11042This is enabled by default when scheduling is enabled, i.e.@: 11043with @option{-fschedule-insns} or @option{-fschedule-insns2} or 11044at @option{-O2} or higher. 11045 11046@item -freschedule-modulo-scheduled-loops 11047@opindex freschedule-modulo-scheduled-loops 11048Modulo scheduling is performed before traditional scheduling. If a loop 11049is modulo scheduled, later scheduling passes may change its schedule. 11050Use this option to control that behavior. 11051 11052@item -fselective-scheduling 11053@opindex fselective-scheduling 11054Schedule instructions using selective scheduling algorithm. Selective 11055scheduling runs instead of the first scheduler pass. 11056 11057@item -fselective-scheduling2 11058@opindex fselective-scheduling2 11059Schedule instructions using selective scheduling algorithm. Selective 11060scheduling runs instead of the second scheduler pass. 11061 11062@item -fsel-sched-pipelining 11063@opindex fsel-sched-pipelining 11064Enable software pipelining of innermost loops during selective scheduling. 11065This option has no effect unless one of @option{-fselective-scheduling} or 11066@option{-fselective-scheduling2} is turned on. 11067 11068@item -fsel-sched-pipelining-outer-loops 11069@opindex fsel-sched-pipelining-outer-loops 11070When pipelining loops during selective scheduling, also pipeline outer loops. 11071This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 11072 11073@item -fsemantic-interposition 11074@opindex fsemantic-interposition 11075Some object formats, like ELF, allow interposing of symbols by the 11076dynamic linker. 11077This means that for symbols exported from the DSO, the compiler cannot perform 11078interprocedural propagation, inlining and other optimizations in anticipation 11079that the function or variable in question may change. While this feature is 11080useful, for example, to rewrite memory allocation functions by a debugging 11081implementation, it is expensive in the terms of code quality. 11082With @option{-fno-semantic-interposition} the compiler assumes that 11083if interposition happens for functions the overwriting function will have 11084precisely the same semantics (and side effects). 11085Similarly if interposition happens 11086for variables, the constructor of the variable will be the same. The flag 11087has no effect for functions explicitly declared inline 11088(where it is never allowed for interposition to change semantics) 11089and for symbols explicitly declared weak. 11090 11091@item -fshrink-wrap 11092@opindex fshrink-wrap 11093Emit function prologues only before parts of the function that need it, 11094rather than at the top of the function. This flag is enabled by default at 11095@option{-O} and higher. 11096 11097@item -fshrink-wrap-separate 11098@opindex fshrink-wrap-separate 11099Shrink-wrap separate parts of the prologue and epilogue separately, so that 11100those parts are only executed when needed. 11101This option is on by default, but has no effect unless @option{-fshrink-wrap} 11102is also turned on and the target supports this. 11103 11104@item -fcaller-saves 11105@opindex fcaller-saves 11106Enable allocation of values to registers that are clobbered by 11107function calls, by emitting extra instructions to save and restore the 11108registers around such calls. Such allocation is done only when it 11109seems to result in better code. 11110 11111This option is always enabled by default on certain machines, usually 11112those which have no call-preserved registers to use instead. 11113 11114Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11115 11116@item -fcombine-stack-adjustments 11117@opindex fcombine-stack-adjustments 11118Tracks stack adjustments (pushes and pops) and stack memory references 11119and then tries to find ways to combine them. 11120 11121Enabled by default at @option{-O1} and higher. 11122 11123@item -fipa-ra 11124@opindex fipa-ra 11125Use caller save registers for allocation if those registers are not used by 11126any called function. In that case it is not necessary to save and restore 11127them around calls. This is only possible if called functions are part of 11128same compilation unit as current function and they are compiled before it. 11129 11130Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option 11131is disabled if generated code will be instrumented for profiling 11132(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known 11133exactly (this happens on targets that do not expose prologues 11134and epilogues in RTL). 11135 11136@item -fconserve-stack 11137@opindex fconserve-stack 11138Attempt to minimize stack usage. The compiler attempts to use less 11139stack space, even if that makes the program slower. This option 11140implies setting the @option{large-stack-frame} parameter to 100 11141and the @option{large-stack-frame-growth} parameter to 400. 11142 11143@item -ftree-reassoc 11144@opindex ftree-reassoc 11145Perform reassociation on trees. This flag is enabled by default 11146at @option{-O} and higher. 11147 11148@item -fcode-hoisting 11149@opindex fcode-hoisting 11150Perform code hoisting. Code hoisting tries to move the 11151evaluation of expressions executed on all paths to the function exit 11152as early as possible. This is especially useful as a code size 11153optimization, but it often helps for code speed as well. 11154This flag is enabled by default at @option{-O2} and higher. 11155 11156@item -ftree-pre 11157@opindex ftree-pre 11158Perform partial redundancy elimination (PRE) on trees. This flag is 11159enabled by default at @option{-O2} and @option{-O3}. 11160 11161@item -ftree-partial-pre 11162@opindex ftree-partial-pre 11163Make partial redundancy elimination (PRE) more aggressive. This flag is 11164enabled by default at @option{-O3}. 11165 11166@item -ftree-forwprop 11167@opindex ftree-forwprop 11168Perform forward propagation on trees. This flag is enabled by default 11169at @option{-O} and higher. 11170 11171@item -ftree-fre 11172@opindex ftree-fre 11173Perform full redundancy elimination (FRE) on trees. The difference 11174between FRE and PRE is that FRE only considers expressions 11175that are computed on all paths leading to the redundant computation. 11176This analysis is faster than PRE, though it exposes fewer redundancies. 11177This flag is enabled by default at @option{-O} and higher. 11178 11179@item -ftree-phiprop 11180@opindex ftree-phiprop 11181Perform hoisting of loads from conditional pointers on trees. This 11182pass is enabled by default at @option{-O} and higher. 11183 11184@item -fhoist-adjacent-loads 11185@opindex fhoist-adjacent-loads 11186Speculatively hoist loads from both branches of an if-then-else if the 11187loads are from adjacent locations in the same structure and the target 11188architecture has a conditional move instruction. This flag is enabled 11189by default at @option{-O2} and higher. 11190 11191@item -ftree-copy-prop 11192@opindex ftree-copy-prop 11193Perform copy propagation on trees. This pass eliminates unnecessary 11194copy operations. This flag is enabled by default at @option{-O} and 11195higher. 11196 11197@item -fipa-pure-const 11198@opindex fipa-pure-const 11199Discover which functions are pure or constant. 11200Enabled by default at @option{-O} and higher. 11201 11202@item -fipa-reference 11203@opindex fipa-reference 11204Discover which static variables do not escape the 11205compilation unit. 11206Enabled by default at @option{-O} and higher. 11207 11208@item -fipa-reference-addressable 11209@opindex fipa-reference-addressable 11210Discover read-only, write-only and non-addressable static variables. 11211Enabled by default at @option{-O} and higher. 11212 11213@item -fipa-stack-alignment 11214@opindex fipa-stack-alignment 11215Reduce stack alignment on call sites if possible. 11216Enabled by default. 11217 11218@item -fipa-pta 11219@opindex fipa-pta 11220Perform interprocedural pointer analysis and interprocedural modification 11221and reference analysis. This option can cause excessive memory and 11222compile-time usage on large compilation units. It is not enabled by 11223default at any optimization level. 11224 11225@item -fipa-profile 11226@opindex fipa-profile 11227Perform interprocedural profile propagation. The functions called only from 11228cold functions are marked as cold. Also functions executed once (such as 11229@code{cold}, @code{noreturn}, static constructors or destructors) are 11230identified. Cold functions and loop less parts of functions executed once are 11231then optimized for size. 11232Enabled by default at @option{-O} and higher. 11233 11234@item -fipa-modref 11235@opindex fipa-modref 11236Perform interprocedural mod/ref analysis. This optimization analyzes the side 11237effects of functions (memory locations that are modified or referenced) and 11238enables better optimization across the function call boundary. This flag is 11239enabled by default at @option{-O} and higher. 11240 11241@item -fipa-cp 11242@opindex fipa-cp 11243Perform interprocedural constant propagation. 11244This optimization analyzes the program to determine when values passed 11245to functions are constants and then optimizes accordingly. 11246This optimization can substantially increase performance 11247if the application has constants passed to functions. 11248This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 11249It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11250 11251@item -fipa-cp-clone 11252@opindex fipa-cp-clone 11253Perform function cloning to make interprocedural constant propagation stronger. 11254When enabled, interprocedural constant propagation performs function cloning 11255when externally visible function can be called with constant arguments. 11256Because this optimization can create multiple copies of functions, 11257it may significantly increase code size 11258(see @option{--param ipa-cp-unit-growth=@var{value}}). 11259This flag is enabled by default at @option{-O3}. 11260It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11261 11262@item -fipa-bit-cp 11263@opindex fipa-bit-cp 11264When enabled, perform interprocedural bitwise constant 11265propagation. This flag is enabled by default at @option{-O2} and 11266by @option{-fprofile-use} and @option{-fauto-profile}. 11267It requires that @option{-fipa-cp} is enabled. 11268 11269@item -fipa-vrp 11270@opindex fipa-vrp 11271When enabled, perform interprocedural propagation of value 11272ranges. This flag is enabled by default at @option{-O2}. It requires 11273that @option{-fipa-cp} is enabled. 11274 11275@item -fipa-icf 11276@opindex fipa-icf 11277Perform Identical Code Folding for functions and read-only variables. 11278The optimization reduces code size and may disturb unwind stacks by replacing 11279a function by equivalent one with a different name. The optimization works 11280more effectively with link-time optimization enabled. 11281 11282Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF 11283works on different levels and thus the optimizations are not same - there are 11284equivalences that are found only by GCC and equivalences found only by Gold. 11285 11286This flag is enabled by default at @option{-O2} and @option{-Os}. 11287 11288@item -flive-patching=@var{level} 11289@opindex flive-patching 11290Control GCC's optimizations to produce output suitable for live-patching. 11291 11292If the compiler's optimization uses a function's body or information extracted 11293from its body to optimize/change another function, the latter is called an 11294impacted function of the former. If a function is patched, its impacted 11295functions should be patched too. 11296 11297The impacted functions are determined by the compiler's interprocedural 11298optimizations. For example, a caller is impacted when inlining a function 11299into its caller, 11300cloning a function and changing its caller to call this new clone, 11301or extracting a function's pureness/constness information to optimize 11302its direct or indirect callers, etc. 11303 11304Usually, the more IPA optimizations enabled, the larger the number of 11305impacted functions for each function. In order to control the number of 11306impacted functions and more easily compute the list of impacted function, 11307IPA optimizations can be partially enabled at two different levels. 11308 11309The @var{level} argument should be one of the following: 11310 11311@table @samp 11312 11313@item inline-clone 11314 11315Only enable inlining and cloning optimizations, which includes inlining, 11316cloning, interprocedural scalar replacement of aggregates and partial inlining. 11317As a result, when patching a function, all its callers and its clones' 11318callers are impacted, therefore need to be patched as well. 11319 11320@option{-flive-patching=inline-clone} disables the following optimization flags: 11321@gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol 11322-fipa-icf -fipa-icf-functions -fipa-icf-variables @gol 11323-fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol 11324-fipa-stack-alignment -fipa-modref} 11325 11326@item inline-only-static 11327 11328Only enable inlining of static functions. 11329As a result, when patching a static function, all its callers are impacted 11330and so need to be patched as well. 11331 11332In addition to all the flags that @option{-flive-patching=inline-clone} 11333disables, 11334@option{-flive-patching=inline-only-static} disables the following additional 11335optimization flags: 11336@gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp} 11337 11338@end table 11339 11340When @option{-flive-patching} is specified without any value, the default value 11341is @var{inline-clone}. 11342 11343This flag is disabled by default. 11344 11345Note that @option{-flive-patching} is not supported with link-time optimization 11346(@option{-flto}). 11347 11348@item -fisolate-erroneous-paths-dereference 11349@opindex fisolate-erroneous-paths-dereference 11350Detect paths that trigger erroneous or undefined behavior due to 11351dereferencing a null pointer. Isolate those paths from the main control 11352flow and turn the statement with erroneous or undefined behavior into a trap. 11353This flag is enabled by default at @option{-O2} and higher and depends on 11354@option{-fdelete-null-pointer-checks} also being enabled. 11355 11356@item -fisolate-erroneous-paths-attribute 11357@opindex fisolate-erroneous-paths-attribute 11358Detect paths that trigger erroneous or undefined behavior due to a null value 11359being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 11360attribute. Isolate those paths from the main control flow and turn the 11361statement with erroneous or undefined behavior into a trap. This is not 11362currently enabled, but may be enabled by @option{-O2} in the future. 11363 11364@item -ftree-sink 11365@opindex ftree-sink 11366Perform forward store motion on trees. This flag is 11367enabled by default at @option{-O} and higher. 11368 11369@item -ftree-bit-ccp 11370@opindex ftree-bit-ccp 11371Perform sparse conditional bit constant propagation on trees and propagate 11372pointer alignment information. 11373This pass only operates on local scalar variables and is enabled by default 11374at @option{-O1} and higher, except for @option{-Og}. 11375It requires that @option{-ftree-ccp} is enabled. 11376 11377@item -ftree-ccp 11378@opindex ftree-ccp 11379Perform sparse conditional constant propagation (CCP) on trees. This 11380pass only operates on local scalar variables and is enabled by default 11381at @option{-O} and higher. 11382 11383@item -fssa-backprop 11384@opindex fssa-backprop 11385Propagate information about uses of a value up the definition chain 11386in order to simplify the definitions. For example, this pass strips 11387sign operations if the sign of a value never matters. The flag is 11388enabled by default at @option{-O} and higher. 11389 11390@item -fssa-phiopt 11391@opindex fssa-phiopt 11392Perform pattern matching on SSA PHI nodes to optimize conditional 11393code. This pass is enabled by default at @option{-O1} and higher, 11394except for @option{-Og}. 11395 11396@item -ftree-switch-conversion 11397@opindex ftree-switch-conversion 11398Perform conversion of simple initializations in a switch to 11399initializations from a scalar array. This flag is enabled by default 11400at @option{-O2} and higher. 11401 11402@item -ftree-tail-merge 11403@opindex ftree-tail-merge 11404Look for identical code sequences. When found, replace one with a jump to the 11405other. This optimization is known as tail merging or cross jumping. This flag 11406is enabled by default at @option{-O2} and higher. The compilation time 11407in this pass can 11408be limited using @option{max-tail-merge-comparisons} parameter and 11409@option{max-tail-merge-iterations} parameter. 11410 11411@item -ftree-dce 11412@opindex ftree-dce 11413Perform dead code elimination (DCE) on trees. This flag is enabled by 11414default at @option{-O} and higher. 11415 11416@item -ftree-builtin-call-dce 11417@opindex ftree-builtin-call-dce 11418Perform conditional dead code elimination (DCE) for calls to built-in functions 11419that may set @code{errno} but are otherwise free of side effects. This flag is 11420enabled by default at @option{-O2} and higher if @option{-Os} is not also 11421specified. 11422 11423@item -ffinite-loops 11424@opindex ffinite-loops 11425@opindex fno-finite-loops 11426Assume that a loop with an exit will eventually take the exit and not loop 11427indefinitely. This allows the compiler to remove loops that otherwise have 11428no side-effects, not considering eventual endless looping as such. 11429 11430This option is enabled by default at @option{-O2} for C++ with -std=c++11 11431or higher. 11432 11433@item -ftree-dominator-opts 11434@opindex ftree-dominator-opts 11435Perform a variety of simple scalar cleanups (constant/copy 11436propagation, redundancy elimination, range propagation and expression 11437simplification) based on a dominator tree traversal. This also 11438performs jump threading (to reduce jumps to jumps). This flag is 11439enabled by default at @option{-O} and higher. 11440 11441@item -ftree-dse 11442@opindex ftree-dse 11443Perform dead store elimination (DSE) on trees. A dead store is a store into 11444a memory location that is later overwritten by another store without 11445any intervening loads. In this case the earlier store can be deleted. This 11446flag is enabled by default at @option{-O} and higher. 11447 11448@item -ftree-ch 11449@opindex ftree-ch 11450Perform loop header copying on trees. This is beneficial since it increases 11451effectiveness of code motion optimizations. It also saves one jump. This flag 11452is enabled by default at @option{-O} and higher. It is not enabled 11453for @option{-Os}, since it usually increases code size. 11454 11455@item -ftree-loop-optimize 11456@opindex ftree-loop-optimize 11457Perform loop optimizations on trees. This flag is enabled by default 11458at @option{-O} and higher. 11459 11460@item -ftree-loop-linear 11461@itemx -floop-strip-mine 11462@itemx -floop-block 11463@opindex ftree-loop-linear 11464@opindex floop-strip-mine 11465@opindex floop-block 11466Perform loop nest optimizations. Same as 11467@option{-floop-nest-optimize}. To use this code transformation, GCC has 11468to be configured with @option{--with-isl} to enable the Graphite loop 11469transformation infrastructure. 11470 11471@item -fgraphite-identity 11472@opindex fgraphite-identity 11473Enable the identity transformation for graphite. For every SCoP we generate 11474the polyhedral representation and transform it back to gimple. Using 11475@option{-fgraphite-identity} we can check the costs or benefits of the 11476GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 11477are also performed by the code generator isl, like index splitting and 11478dead code elimination in loops. 11479 11480@item -floop-nest-optimize 11481@opindex floop-nest-optimize 11482Enable the isl based loop nest optimizer. This is a generic loop nest 11483optimizer based on the Pluto optimization algorithms. It calculates a loop 11484structure optimized for data-locality and parallelism. This option 11485is experimental. 11486 11487@item -floop-parallelize-all 11488@opindex floop-parallelize-all 11489Use the Graphite data dependence analysis to identify loops that can 11490be parallelized. Parallelize all the loops that can be analyzed to 11491not contain loop carried dependences without checking that it is 11492profitable to parallelize the loops. 11493 11494@item -ftree-coalesce-vars 11495@opindex ftree-coalesce-vars 11496While transforming the program out of the SSA representation, attempt to 11497reduce copying by coalescing versions of different user-defined 11498variables, instead of just compiler temporaries. This may severely 11499limit the ability to debug an optimized program compiled with 11500@option{-fno-var-tracking-assignments}. In the negated form, this flag 11501prevents SSA coalescing of user variables. This option is enabled by 11502default if optimization is enabled, and it does very little otherwise. 11503 11504@item -ftree-loop-if-convert 11505@opindex ftree-loop-if-convert 11506Attempt to transform conditional jumps in the innermost loops to 11507branch-less equivalents. The intent is to remove control-flow from 11508the innermost loops in order to improve the ability of the 11509vectorization pass to handle these loops. This is enabled by default 11510if vectorization is enabled. 11511 11512@item -ftree-loop-distribution 11513@opindex ftree-loop-distribution 11514Perform loop distribution. This flag can improve cache performance on 11515big loop bodies and allow further loop optimizations, like 11516parallelization or vectorization, to take place. For example, the loop 11517@smallexample 11518DO I = 1, N 11519 A(I) = B(I) + C 11520 D(I) = E(I) * F 11521ENDDO 11522@end smallexample 11523is transformed to 11524@smallexample 11525DO I = 1, N 11526 A(I) = B(I) + C 11527ENDDO 11528DO I = 1, N 11529 D(I) = E(I) * F 11530ENDDO 11531@end smallexample 11532This flag is enabled by default at @option{-O3}. 11533It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11534 11535@item -ftree-loop-distribute-patterns 11536@opindex ftree-loop-distribute-patterns 11537Perform loop distribution of patterns that can be code generated with 11538calls to a library. This flag is enabled by default at @option{-O2} and 11539higher, and by @option{-fprofile-use} and @option{-fauto-profile}. 11540 11541This pass distributes the initialization loops and generates a call to 11542memset zero. For example, the loop 11543@smallexample 11544DO I = 1, N 11545 A(I) = 0 11546 B(I) = A(I) + I 11547ENDDO 11548@end smallexample 11549is transformed to 11550@smallexample 11551DO I = 1, N 11552 A(I) = 0 11553ENDDO 11554DO I = 1, N 11555 B(I) = A(I) + I 11556ENDDO 11557@end smallexample 11558and the initialization loop is transformed into a call to memset zero. 11559This flag is enabled by default at @option{-O3}. 11560It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11561 11562@item -floop-interchange 11563@opindex floop-interchange 11564Perform loop interchange outside of graphite. This flag can improve cache 11565performance on loop nest and allow further loop optimizations, like 11566vectorization, to take place. For example, the loop 11567@smallexample 11568for (int i = 0; i < N; i++) 11569 for (int j = 0; j < N; j++) 11570 for (int k = 0; k < N; k++) 11571 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 11572@end smallexample 11573is transformed to 11574@smallexample 11575for (int i = 0; i < N; i++) 11576 for (int k = 0; k < N; k++) 11577 for (int j = 0; j < N; j++) 11578 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 11579@end smallexample 11580This flag is enabled by default at @option{-O3}. 11581It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11582 11583@item -floop-unroll-and-jam 11584@opindex floop-unroll-and-jam 11585Apply unroll and jam transformations on feasible loops. In a loop 11586nest this unrolls the outer loop by some factor and fuses the resulting 11587multiple inner loops. This flag is enabled by default at @option{-O3}. 11588It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11589 11590@item -ftree-loop-im 11591@opindex ftree-loop-im 11592Perform loop invariant motion on trees. This pass moves only invariants that 11593are hard to handle at RTL level (function calls, operations that expand to 11594nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 11595operands of conditions that are invariant out of the loop, so that we can use 11596just trivial invariantness analysis in loop unswitching. The pass also includes 11597store motion. 11598 11599@item -ftree-loop-ivcanon 11600@opindex ftree-loop-ivcanon 11601Create a canonical counter for number of iterations in loops for which 11602determining number of iterations requires complicated analysis. Later 11603optimizations then may determine the number easily. Useful especially 11604in connection with unrolling. 11605 11606@item -ftree-scev-cprop 11607@opindex ftree-scev-cprop 11608Perform final value replacement. If a variable is modified in a loop 11609in such a way that its value when exiting the loop can be determined using 11610only its initial value and the number of loop iterations, replace uses of 11611the final value by such a computation, provided it is sufficiently cheap. 11612This reduces data dependencies and may allow further simplifications. 11613Enabled by default at @option{-O} and higher. 11614 11615@item -fivopts 11616@opindex fivopts 11617Perform induction variable optimizations (strength reduction, induction 11618variable merging and induction variable elimination) on trees. 11619 11620@item -ftree-parallelize-loops=n 11621@opindex ftree-parallelize-loops 11622Parallelize loops, i.e., split their iteration space to run in n threads. 11623This is only possible for loops whose iterations are independent 11624and can be arbitrarily reordered. The optimization is only 11625profitable on multiprocessor machines, for loops that are CPU-intensive, 11626rather than constrained e.g.@: by memory bandwidth. This option 11627implies @option{-pthread}, and thus is only supported on targets 11628that have support for @option{-pthread}. 11629 11630@item -ftree-pta 11631@opindex ftree-pta 11632Perform function-local points-to analysis on trees. This flag is 11633enabled by default at @option{-O1} and higher, except for @option{-Og}. 11634 11635@item -ftree-sra 11636@opindex ftree-sra 11637Perform scalar replacement of aggregates. This pass replaces structure 11638references with scalars to prevent committing structures to memory too 11639early. This flag is enabled by default at @option{-O1} and higher, 11640except for @option{-Og}. 11641 11642@item -fstore-merging 11643@opindex fstore-merging 11644Perform merging of narrow stores to consecutive memory addresses. This pass 11645merges contiguous stores of immediate values narrower than a word into fewer 11646wider stores to reduce the number of instructions. This is enabled by default 11647at @option{-O2} and higher as well as @option{-Os}. 11648 11649@item -ftree-ter 11650@opindex ftree-ter 11651Perform temporary expression replacement during the SSA->normal phase. Single 11652use/single def temporaries are replaced at their use location with their 11653defining expression. This results in non-GIMPLE code, but gives the expanders 11654much more complex trees to work on resulting in better RTL generation. This is 11655enabled by default at @option{-O} and higher. 11656 11657@item -ftree-slsr 11658@opindex ftree-slsr 11659Perform straight-line strength reduction on trees. This recognizes related 11660expressions involving multiplications and replaces them by less expensive 11661calculations when possible. This is enabled by default at @option{-O} and 11662higher. 11663 11664@item -ftree-vectorize 11665@opindex ftree-vectorize 11666Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 11667and @option{-ftree-slp-vectorize} if not explicitly specified. 11668 11669@item -ftree-loop-vectorize 11670@opindex ftree-loop-vectorize 11671Perform loop vectorization on trees. This flag is enabled by default at 11672@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 11673and @option{-fauto-profile}. 11674 11675@item -ftree-slp-vectorize 11676@opindex ftree-slp-vectorize 11677Perform basic block vectorization on trees. This flag is enabled by default at 11678@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 11679and @option{-fauto-profile}. 11680 11681@item -fvect-cost-model=@var{model} 11682@opindex fvect-cost-model 11683Alter the cost model used for vectorization. The @var{model} argument 11684should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or 11685@samp{very-cheap}. 11686With the @samp{unlimited} model the vectorized code-path is assumed 11687to be profitable while with the @samp{dynamic} model a runtime check 11688guards the vectorized code-path to enable it only for iteration 11689counts that will likely execute faster than when executing the original 11690scalar loop. The @samp{cheap} model disables vectorization of 11691loops where doing so would be cost prohibitive for example due to 11692required runtime checks for data dependence or alignment but otherwise 11693is equal to the @samp{dynamic} model. The @samp{very-cheap} model only 11694allows vectorization if the vector code would entirely replace the 11695scalar code that is being vectorized. For example, if each iteration 11696of a vectorized loop would only be able to handle exactly four iterations 11697of the scalar loop, the @samp{very-cheap} model would only allow 11698vectorization if the scalar iteration count is known to be a multiple 11699of four. 11700 11701The default cost model depends on other optimization flags and is 11702either @samp{dynamic} or @samp{cheap}. 11703 11704@item -fsimd-cost-model=@var{model} 11705@opindex fsimd-cost-model 11706Alter the cost model used for vectorization of loops marked with the OpenMP 11707simd directive. The @var{model} argument should be one of 11708@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 11709have the same meaning as described in @option{-fvect-cost-model} and by 11710default a cost model defined with @option{-fvect-cost-model} is used. 11711 11712@item -ftree-vrp 11713@opindex ftree-vrp 11714Perform Value Range Propagation on trees. This is similar to the 11715constant propagation pass, but instead of values, ranges of values are 11716propagated. This allows the optimizers to remove unnecessary range 11717checks like array bound checks and null pointer checks. This is 11718enabled by default at @option{-O2} and higher. Null pointer check 11719elimination is only done if @option{-fdelete-null-pointer-checks} is 11720enabled. 11721 11722@item -fsplit-paths 11723@opindex fsplit-paths 11724Split paths leading to loop backedges. This can improve dead code 11725elimination and common subexpression elimination. This is enabled by 11726default at @option{-O3} and above. 11727 11728@item -fsplit-ivs-in-unroller 11729@opindex fsplit-ivs-in-unroller 11730Enables expression of values of induction variables in later iterations 11731of the unrolled loop using the value in the first iteration. This breaks 11732long dependency chains, thus improving efficiency of the scheduling passes. 11733 11734A combination of @option{-fweb} and CSE is often sufficient to obtain the 11735same effect. However, that is not reliable in cases where the loop body 11736is more complicated than a single basic block. It also does not work at all 11737on some architectures due to restrictions in the CSE pass. 11738 11739This optimization is enabled by default. 11740 11741@item -fvariable-expansion-in-unroller 11742@opindex fvariable-expansion-in-unroller 11743With this option, the compiler creates multiple copies of some 11744local variables when unrolling a loop, which can result in superior code. 11745 11746This optimization is enabled by default for PowerPC targets, but disabled 11747by default otherwise. 11748 11749@item -fpartial-inlining 11750@opindex fpartial-inlining 11751Inline parts of functions. This option has any effect only 11752when inlining itself is turned on by the @option{-finline-functions} 11753or @option{-finline-small-functions} options. 11754 11755Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11756 11757@item -fpredictive-commoning 11758@opindex fpredictive-commoning 11759Perform predictive commoning optimization, i.e., reusing computations 11760(especially memory loads and stores) performed in previous 11761iterations of loops. 11762 11763This option is enabled at level @option{-O3}. 11764It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11765 11766@item -fprefetch-loop-arrays 11767@opindex fprefetch-loop-arrays 11768If supported by the target machine, generate instructions to prefetch 11769memory to improve the performance of loops that access large arrays. 11770 11771This option may generate better or worse code; results are highly 11772dependent on the structure of loops within the source code. 11773 11774Disabled at level @option{-Os}. 11775 11776@item -fno-printf-return-value 11777@opindex fno-printf-return-value 11778@opindex fprintf-return-value 11779Do not substitute constants for known return value of formatted output 11780functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and 11781@code{vsnprintf} (but not @code{printf} of @code{fprintf}). This 11782transformation allows GCC to optimize or even eliminate branches based 11783on the known return value of these functions called with arguments that 11784are either constant, or whose values are known to be in a range that 11785makes determining the exact return value possible. For example, when 11786@option{-fprintf-return-value} is in effect, both the branch and the 11787body of the @code{if} statement (but not the call to @code{snprint}) 11788can be optimized away when @code{i} is a 32-bit or smaller integer 11789because the return value is guaranteed to be at most 8. 11790 11791@smallexample 11792char buf[9]; 11793if (snprintf (buf, "%08x", i) >= sizeof buf) 11794 @dots{} 11795@end smallexample 11796 11797The @option{-fprintf-return-value} option relies on other optimizations 11798and yields best results with @option{-O2} and above. It works in tandem 11799with the @option{-Wformat-overflow} and @option{-Wformat-truncation} 11800options. The @option{-fprintf-return-value} option is enabled by default. 11801 11802@item -fno-peephole 11803@itemx -fno-peephole2 11804@opindex fno-peephole 11805@opindex fpeephole 11806@opindex fno-peephole2 11807@opindex fpeephole2 11808Disable any machine-specific peephole optimizations. The difference 11809between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 11810are implemented in the compiler; some targets use one, some use the 11811other, a few use both. 11812 11813@option{-fpeephole} is enabled by default. 11814@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11815 11816@item -fno-guess-branch-probability 11817@opindex fno-guess-branch-probability 11818@opindex fguess-branch-probability 11819Do not guess branch probabilities using heuristics. 11820 11821GCC uses heuristics to guess branch probabilities if they are 11822not provided by profiling feedback (@option{-fprofile-arcs}). These 11823heuristics are based on the control flow graph. If some branch probabilities 11824are specified by @code{__builtin_expect}, then the heuristics are 11825used to guess branch probabilities for the rest of the control flow graph, 11826taking the @code{__builtin_expect} info into account. The interactions 11827between the heuristics and @code{__builtin_expect} can be complex, and in 11828some cases, it may be useful to disable the heuristics so that the effects 11829of @code{__builtin_expect} are easier to understand. 11830 11831It is also possible to specify expected probability of the expression 11832with @code{__builtin_expect_with_probability} built-in function. 11833 11834The default is @option{-fguess-branch-probability} at levels 11835@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 11836 11837@item -freorder-blocks 11838@opindex freorder-blocks 11839Reorder basic blocks in the compiled function in order to reduce number of 11840taken branches and improve code locality. 11841 11842Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 11843 11844@item -freorder-blocks-algorithm=@var{algorithm} 11845@opindex freorder-blocks-algorithm 11846Use the specified algorithm for basic block reordering. The 11847@var{algorithm} argument can be @samp{simple}, which does not increase 11848code size (except sometimes due to secondary effects like alignment), 11849or @samp{stc}, the ``software trace cache'' algorithm, which tries to 11850put all often executed code together, minimizing the number of branches 11851executed by making extra copies of code. 11852 11853The default is @samp{simple} at levels @option{-O}, @option{-Os}, and 11854@samp{stc} at levels @option{-O2}, @option{-O3}. 11855 11856@item -freorder-blocks-and-partition 11857@opindex freorder-blocks-and-partition 11858In addition to reordering basic blocks in the compiled function, in order 11859to reduce number of taken branches, partitions hot and cold basic blocks 11860into separate sections of the assembly and @file{.o} files, to improve 11861paging and cache locality performance. 11862 11863This optimization is automatically turned off in the presence of 11864exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined 11865section attribute and on any architecture that does not support named 11866sections. When @option{-fsplit-stack} is used this option is not 11867enabled by default (to avoid linker errors), but may be enabled 11868explicitly (if using a working linker). 11869 11870Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}. 11871 11872@item -freorder-functions 11873@opindex freorder-functions 11874Reorder functions in the object file in order to 11875improve code locality. This is implemented by using special 11876subsections @code{.text.hot} for most frequently executed functions and 11877@code{.text.unlikely} for unlikely executed functions. Reordering is done by 11878the linker so object file format must support named sections and linker must 11879place them in a reasonable way. 11880 11881This option isn't effective unless you either provide profile feedback 11882(see @option{-fprofile-arcs} for details) or manually annotate functions with 11883@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}). 11884 11885Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11886 11887@item -fstrict-aliasing 11888@opindex fstrict-aliasing 11889Allow the compiler to assume the strictest aliasing rules applicable to 11890the language being compiled. For C (and C++), this activates 11891optimizations based on the type of expressions. In particular, an 11892object of one type is assumed never to reside at the same address as an 11893object of a different type, unless the types are almost the same. For 11894example, an @code{unsigned int} can alias an @code{int}, but not a 11895@code{void*} or a @code{double}. A character type may alias any other 11896type. 11897 11898@anchor{Type-punning}Pay special attention to code like this: 11899@smallexample 11900union a_union @{ 11901 int i; 11902 double d; 11903@}; 11904 11905int f() @{ 11906 union a_union t; 11907 t.d = 3.0; 11908 return t.i; 11909@} 11910@end smallexample 11911The practice of reading from a different union member than the one most 11912recently written to (called ``type-punning'') is common. Even with 11913@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 11914is accessed through the union type. So, the code above works as 11915expected. @xref{Structures unions enumerations and bit-fields 11916implementation}. However, this code might not: 11917@smallexample 11918int f() @{ 11919 union a_union t; 11920 int* ip; 11921 t.d = 3.0; 11922 ip = &t.i; 11923 return *ip; 11924@} 11925@end smallexample 11926 11927Similarly, access by taking the address, casting the resulting pointer 11928and dereferencing the result has undefined behavior, even if the cast 11929uses a union type, e.g.: 11930@smallexample 11931int f() @{ 11932 double d = 3.0; 11933 return ((union a_union *) &d)->i; 11934@} 11935@end smallexample 11936 11937The @option{-fstrict-aliasing} option is enabled at levels 11938@option{-O2}, @option{-O3}, @option{-Os}. 11939 11940@item -falign-functions 11941@itemx -falign-functions=@var{n} 11942@itemx -falign-functions=@var{n}:@var{m} 11943@itemx -falign-functions=@var{n}:@var{m}:@var{n2} 11944@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2} 11945@opindex falign-functions 11946Align the start of functions to the next power-of-two greater than or 11947equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at 11948least the first @var{m} bytes of the function can be fetched by the CPU 11949without crossing an @var{n}-byte alignment boundary. 11950 11951If @var{m} is not specified, it defaults to @var{n}. 11952 11953Examples: @option{-falign-functions=32} aligns functions to the next 1195432-byte boundary, @option{-falign-functions=24} aligns to the next 1195532-byte boundary only if this can be done by skipping 23 bytes or less, 11956@option{-falign-functions=32:7} aligns to the next 1195732-byte boundary only if this can be done by skipping 6 bytes or less. 11958 11959The second pair of @var{n2}:@var{m2} values allows you to specify 11960a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to 11961the next 64-byte boundary if this can be done by skipping 6 bytes or less, 11962otherwise aligns to the next 32-byte boundary if this can be done 11963by skipping 2 bytes or less. 11964If @var{m2} is not specified, it defaults to @var{n2}. 11965 11966Some assemblers only support this flag when @var{n} is a power of two; 11967in that case, it is rounded up. 11968 11969@option{-fno-align-functions} and @option{-falign-functions=1} are 11970equivalent and mean that functions are not aligned. 11971 11972If @var{n} is not specified or is zero, use a machine-dependent default. 11973The maximum allowed @var{n} option value is 65536. 11974 11975Enabled at levels @option{-O2}, @option{-O3}. 11976 11977@item -flimit-function-alignment 11978If this option is enabled, the compiler tries to avoid unnecessarily 11979overaligning functions. It attempts to instruct the assembler to align 11980by the amount specified by @option{-falign-functions}, but not to 11981skip more bytes than the size of the function. 11982 11983@item -falign-labels 11984@itemx -falign-labels=@var{n} 11985@itemx -falign-labels=@var{n}:@var{m} 11986@itemx -falign-labels=@var{n}:@var{m}:@var{n2} 11987@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2} 11988@opindex falign-labels 11989Align all branch targets to a power-of-two boundary. 11990 11991Parameters of this option are analogous to the @option{-falign-functions} option. 11992@option{-fno-align-labels} and @option{-falign-labels=1} are 11993equivalent and mean that labels are not aligned. 11994 11995If @option{-falign-loops} or @option{-falign-jumps} are applicable and 11996are greater than this value, then their values are used instead. 11997 11998If @var{n} is not specified or is zero, use a machine-dependent default 11999which is very likely to be @samp{1}, meaning no alignment. 12000The maximum allowed @var{n} option value is 65536. 12001 12002Enabled at levels @option{-O2}, @option{-O3}. 12003 12004@item -falign-loops 12005@itemx -falign-loops=@var{n} 12006@itemx -falign-loops=@var{n}:@var{m} 12007@itemx -falign-loops=@var{n}:@var{m}:@var{n2} 12008@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2} 12009@opindex falign-loops 12010Align loops to a power-of-two boundary. If the loops are executed 12011many times, this makes up for any execution of the dummy padding 12012instructions. 12013 12014If @option{-falign-labels} is greater than this value, then its value 12015is used instead. 12016 12017Parameters of this option are analogous to the @option{-falign-functions} option. 12018@option{-fno-align-loops} and @option{-falign-loops=1} are 12019equivalent and mean that loops are not aligned. 12020The maximum allowed @var{n} option value is 65536. 12021 12022If @var{n} is not specified or is zero, use a machine-dependent default. 12023 12024Enabled at levels @option{-O2}, @option{-O3}. 12025 12026@item -falign-jumps 12027@itemx -falign-jumps=@var{n} 12028@itemx -falign-jumps=@var{n}:@var{m} 12029@itemx -falign-jumps=@var{n}:@var{m}:@var{n2} 12030@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2} 12031@opindex falign-jumps 12032Align branch targets to a power-of-two boundary, for branch targets 12033where the targets can only be reached by jumping. In this case, 12034no dummy operations need be executed. 12035 12036If @option{-falign-labels} is greater than this value, then its value 12037is used instead. 12038 12039Parameters of this option are analogous to the @option{-falign-functions} option. 12040@option{-fno-align-jumps} and @option{-falign-jumps=1} are 12041equivalent and mean that loops are not aligned. 12042 12043If @var{n} is not specified or is zero, use a machine-dependent default. 12044The maximum allowed @var{n} option value is 65536. 12045 12046Enabled at levels @option{-O2}, @option{-O3}. 12047 12048@item -fno-allocation-dce 12049@opindex fno-allocation-dce 12050Do not remove unused C++ allocations in dead code elimination. 12051 12052@item -fallow-store-data-races 12053@opindex fallow-store-data-races 12054Allow the compiler to perform optimizations that may introduce new data races 12055on stores, without proving that the variable cannot be concurrently accessed 12056by other threads. Does not affect optimization of local data. It is safe to 12057use this option if it is known that global data will not be accessed by 12058multiple threads. 12059 12060Examples of optimizations enabled by @option{-fallow-store-data-races} include 12061hoisting or if-conversions that may cause a value that was already in memory 12062to be re-written with that same value. Such re-writing is safe in a single 12063threaded context but may be unsafe in a multi-threaded context. Note that on 12064some processors, if-conversions may be required in order to enable 12065vectorization. 12066 12067Enabled at level @option{-Ofast}. 12068 12069@item -funit-at-a-time 12070@opindex funit-at-a-time 12071This option is left for compatibility reasons. @option{-funit-at-a-time} 12072has no effect, while @option{-fno-unit-at-a-time} implies 12073@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 12074 12075Enabled by default. 12076 12077@item -fno-toplevel-reorder 12078@opindex fno-toplevel-reorder 12079@opindex ftoplevel-reorder 12080Do not reorder top-level functions, variables, and @code{asm} 12081statements. Output them in the same order that they appear in the 12082input file. When this option is used, unreferenced static variables 12083are not removed. This option is intended to support existing code 12084that relies on a particular ordering. For new code, it is better to 12085use attributes when possible. 12086 12087@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and 12088also at @option{-O0} if @option{-fsection-anchors} is explicitly requested. 12089Additionally @option{-fno-toplevel-reorder} implies 12090@option{-fno-section-anchors}. 12091 12092@item -fweb 12093@opindex fweb 12094Constructs webs as commonly used for register allocation purposes and assign 12095each web individual pseudo register. This allows the register allocation pass 12096to operate on pseudos directly, but also strengthens several other optimization 12097passes, such as CSE, loop optimizer and trivial dead code remover. It can, 12098however, make debugging impossible, since variables no longer stay in a 12099``home register''. 12100 12101Enabled by default with @option{-funroll-loops}. 12102 12103@item -fwhole-program 12104@opindex fwhole-program 12105Assume that the current compilation unit represents the whole program being 12106compiled. All public functions and variables with the exception of @code{main} 12107and those merged by attribute @code{externally_visible} become static functions 12108and in effect are optimized more aggressively by interprocedural optimizers. 12109 12110This option should not be used in combination with @option{-flto}. 12111Instead relying on a linker plugin should provide safer and more precise 12112information. 12113 12114@item -flto[=@var{n}] 12115@opindex flto 12116This option runs the standard link-time optimizer. When invoked 12117with source code, it generates GIMPLE (one of GCC's internal 12118representations) and writes it to special ELF sections in the object 12119file. When the object files are linked together, all the function 12120bodies are read from these ELF sections and instantiated as if they 12121had been part of the same translation unit. 12122 12123To use the link-time optimizer, @option{-flto} and optimization 12124options should be specified at compile time and during the final link. 12125It is recommended that you compile all the files participating in the 12126same link with the same options and also specify those options at 12127link time. 12128For example: 12129 12130@smallexample 12131gcc -c -O2 -flto foo.c 12132gcc -c -O2 -flto bar.c 12133gcc -o myprog -flto -O2 foo.o bar.o 12134@end smallexample 12135 12136The first two invocations to GCC save a bytecode representation 12137of GIMPLE into special ELF sections inside @file{foo.o} and 12138@file{bar.o}. The final invocation reads the GIMPLE bytecode from 12139@file{foo.o} and @file{bar.o}, merges the two files into a single 12140internal image, and compiles the result as usual. Since both 12141@file{foo.o} and @file{bar.o} are merged into a single image, this 12142causes all the interprocedural analyses and optimizations in GCC to 12143work across the two files as if they were a single one. This means, 12144for example, that the inliner is able to inline functions in 12145@file{bar.o} into functions in @file{foo.o} and vice-versa. 12146 12147Another (simpler) way to enable link-time optimization is: 12148 12149@smallexample 12150gcc -o myprog -flto -O2 foo.c bar.c 12151@end smallexample 12152 12153The above generates bytecode for @file{foo.c} and @file{bar.c}, 12154merges them together into a single GIMPLE representation and optimizes 12155them as usual to produce @file{myprog}. 12156 12157The important thing to keep in mind is that to enable link-time 12158optimizations you need to use the GCC driver to perform the link step. 12159GCC automatically performs link-time optimization if any of the 12160objects involved were compiled with the @option{-flto} command-line option. 12161You can always override 12162the automatic decision to do link-time optimization 12163by passing @option{-fno-lto} to the link command. 12164 12165To make whole program optimization effective, it is necessary to make 12166certain whole program assumptions. The compiler needs to know 12167what functions and variables can be accessed by libraries and runtime 12168outside of the link-time optimized unit. When supported by the linker, 12169the linker plugin (see @option{-fuse-linker-plugin}) passes information 12170to the compiler about used and externally visible symbols. When 12171the linker plugin is not available, @option{-fwhole-program} should be 12172used to allow the compiler to make these assumptions, which leads 12173to more aggressive optimization decisions. 12174 12175When a file is compiled with @option{-flto} without 12176@option{-fuse-linker-plugin}, the generated object file is larger than 12177a regular object file because it contains GIMPLE bytecodes and the usual 12178final code (see @option{-ffat-lto-objects}). This means that 12179object files with LTO information can be linked as normal object 12180files; if @option{-fno-lto} is passed to the linker, no 12181interprocedural optimizations are applied. Note that when 12182@option{-fno-fat-lto-objects} is enabled the compile stage is faster 12183but you cannot perform a regular, non-LTO link on them. 12184 12185When producing the final binary, GCC only 12186applies link-time optimizations to those files that contain bytecode. 12187Therefore, you can mix and match object files and libraries with 12188GIMPLE bytecodes and final object code. GCC automatically selects 12189which files to optimize in LTO mode and which files to link without 12190further processing. 12191 12192Generally, options specified at link time override those 12193specified at compile time, although in some cases GCC attempts to infer 12194link-time options from the settings used to compile the input files. 12195 12196If you do not specify an optimization level option @option{-O} at 12197link time, then GCC uses the highest optimization level 12198used when compiling the object files. Note that it is generally 12199ineffective to specify an optimization level option only at link time and 12200not at compile time, for two reasons. First, compiling without 12201optimization suppresses compiler passes that gather information 12202needed for effective optimization at link time. Second, some early 12203optimization passes can be performed only at compile time and 12204not at link time. 12205 12206There are some code generation flags preserved by GCC when 12207generating bytecodes, as they need to be used during the final link. 12208Currently, the following options and their settings are taken from 12209the first object file that explicitly specifies them: 12210@option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions}, 12211@option{-fgnu-tm} and all the @option{-m} target flags. 12212 12213The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and 12214@option{-fPIE} are combined based on the following scheme: 12215 12216@smallexample 12217@option{-fPIC} + @option{-fpic} = @option{-fpic} 12218@option{-fPIC} + @option{-fno-pic} = @option{-fno-pic} 12219@option{-fpic/-fPIC} + (no option) = (no option) 12220@option{-fPIC} + @option{-fPIE} = @option{-fPIE} 12221@option{-fpic} + @option{-fPIE} = @option{-fpie} 12222@option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie} 12223@end smallexample 12224 12225Certain ABI-changing flags are required to match in all compilation units, 12226and trying to override this at link time with a conflicting value 12227is ignored. This includes options such as @option{-freg-struct-return} 12228and @option{-fpcc-struct-return}. 12229 12230Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 12231@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 12232are passed through to the link stage and merged conservatively for 12233conflicting translation units. Specifically 12234@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 12235precedence; and for example @option{-ffp-contract=off} takes precedence 12236over @option{-ffp-contract=fast}. You can override them at link time. 12237 12238Diagnostic options such as @option{-Wstringop-overflow} are passed 12239through to the link stage and their setting matches that of the 12240compile-step at function granularity. Note that this matters only 12241for diagnostics emitted during optimization. Note that code 12242transforms such as inlining can lead to warnings being enabled 12243or disabled for regions if code not consistent with the setting 12244at compile time. 12245 12246When you need to pass options to the assembler via @option{-Wa} or 12247@option{-Xassembler} make sure to either compile such translation 12248units with @option{-fno-lto} or consistently use the same assembler 12249options on all translation units. You can alternatively also 12250specify assembler options at LTO link time. 12251 12252To enable debug info generation you need to supply @option{-g} at 12253compile time. If any of the input files at link time were built 12254with debug info generation enabled the link will enable debug info 12255generation as well. Any elaborate debug info settings 12256like the dwarf level @option{-gdwarf-5} need to be explicitly repeated 12257at the linker command line and mixing different settings in different 12258translation units is discouraged. 12259 12260If LTO encounters objects with C linkage declared with incompatible 12261types in separate translation units to be linked together (undefined 12262behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 12263issued. The behavior is still undefined at run time. Similar 12264diagnostics may be raised for other languages. 12265 12266Another feature of LTO is that it is possible to apply interprocedural 12267optimizations on files written in different languages: 12268 12269@smallexample 12270gcc -c -flto foo.c 12271g++ -c -flto bar.cc 12272gfortran -c -flto baz.f90 12273g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 12274@end smallexample 12275 12276Notice that the final link is done with @command{g++} to get the C++ 12277runtime libraries and @option{-lgfortran} is added to get the Fortran 12278runtime libraries. In general, when mixing languages in LTO mode, you 12279should use the same link command options as when mixing languages in a 12280regular (non-LTO) compilation. 12281 12282If object files containing GIMPLE bytecode are stored in a library archive, say 12283@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 12284are using a linker with plugin support. To create static libraries suitable 12285for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 12286and @command{ranlib}; 12287to show the symbols of object files with GIMPLE bytecode, use 12288@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 12289and @command{nm} have been compiled with plugin support. At link time, use the 12290flag @option{-fuse-linker-plugin} to ensure that the library participates in 12291the LTO optimization process: 12292 12293@smallexample 12294gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 12295@end smallexample 12296 12297With the linker plugin enabled, the linker extracts the needed 12298GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 12299to make them part of the aggregated GIMPLE image to be optimized. 12300 12301If you are not using a linker with plugin support and/or do not 12302enable the linker plugin, then the objects inside @file{libfoo.a} 12303are extracted and linked as usual, but they do not participate 12304in the LTO optimization process. In order to make a static library suitable 12305for both LTO optimization and usual linkage, compile its object files with 12306@option{-flto} @option{-ffat-lto-objects}. 12307 12308Link-time optimizations do not require the presence of the whole program to 12309operate. If the program does not require any symbols to be exported, it is 12310possible to combine @option{-flto} and @option{-fwhole-program} to allow 12311the interprocedural optimizers to use more aggressive assumptions which may 12312lead to improved optimization opportunities. 12313Use of @option{-fwhole-program} is not needed when linker plugin is 12314active (see @option{-fuse-linker-plugin}). 12315 12316The current implementation of LTO makes no 12317attempt to generate bytecode that is portable between different 12318types of hosts. The bytecode files are versioned and there is a 12319strict version check, so bytecode files generated in one version of 12320GCC do not work with an older or newer version of GCC. 12321 12322Link-time optimization does not work well with generation of debugging 12323information on systems other than those using a combination of ELF and 12324DWARF. 12325 12326If you specify the optional @var{n}, the optimization and code 12327generation done at link time is executed in parallel using @var{n} 12328parallel jobs by utilizing an installed @command{make} program. The 12329environment variable @env{MAKE} may be used to override the program 12330used. 12331 12332You can also specify @option{-flto=jobserver} to use GNU make's 12333job server mode to determine the number of parallel jobs. This 12334is useful when the Makefile calling GCC is already executing in parallel. 12335You must prepend a @samp{+} to the command recipe in the parent Makefile 12336for this to work. This option likely only works if @env{MAKE} is 12337GNU make. Even without the option value, GCC tries to automatically 12338detect a running GNU make's job server. 12339 12340Use @option{-flto=auto} to use GNU make's job server, if available, 12341or otherwise fall back to autodetection of the number of CPU threads 12342present in your system. 12343 12344@item -flto-partition=@var{alg} 12345@opindex flto-partition 12346Specify the partitioning algorithm used by the link-time optimizer. 12347The value is either @samp{1to1} to specify a partitioning mirroring 12348the original source files or @samp{balanced} to specify partitioning 12349into equally sized chunks (whenever possible) or @samp{max} to create 12350new partition for every symbol where possible. Specifying @samp{none} 12351as an algorithm disables partitioning and streaming completely. 12352The default value is @samp{balanced}. While @samp{1to1} can be used 12353as an workaround for various code ordering issues, the @samp{max} 12354partitioning is intended for internal testing only. 12355The value @samp{one} specifies that exactly one partition should be 12356used while the value @samp{none} bypasses partitioning and executes 12357the link-time optimization step directly from the WPA phase. 12358 12359@item -flto-compression-level=@var{n} 12360@opindex flto-compression-level 12361This option specifies the level of compression used for intermediate 12362language written to LTO object files, and is only meaningful in 12363conjunction with LTO mode (@option{-flto}). GCC currently supports two 12364LTO compression algorithms. For zstd, valid values are 0 (no compression) 12365to 19 (maximum compression), while zlib supports values from 0 to 9. 12366Values outside this range are clamped to either minimum or maximum 12367of the supported values. If the option is not given, 12368a default balanced compression setting is used. 12369 12370@item -fuse-linker-plugin 12371@opindex fuse-linker-plugin 12372Enables the use of a linker plugin during link-time optimization. This 12373option relies on plugin support in the linker, which is available in gold 12374or in GNU ld 2.21 or newer. 12375 12376This option enables the extraction of object files with GIMPLE bytecode out 12377of library archives. This improves the quality of optimization by exposing 12378more code to the link-time optimizer. This information specifies what 12379symbols can be accessed externally (by non-LTO object or during dynamic 12380linking). Resulting code quality improvements on binaries (and shared 12381libraries that use hidden visibility) are similar to @option{-fwhole-program}. 12382See @option{-flto} for a description of the effect of this flag and how to 12383use it. 12384 12385This option is enabled by default when LTO support in GCC is enabled 12386and GCC was configured for use with 12387a linker supporting plugins (GNU ld 2.21 or newer or gold). 12388 12389@item -ffat-lto-objects 12390@opindex ffat-lto-objects 12391Fat LTO objects are object files that contain both the intermediate language 12392and the object code. This makes them usable for both LTO linking and normal 12393linking. This option is effective only when compiling with @option{-flto} 12394and is ignored at link time. 12395 12396@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 12397requires the complete toolchain to be aware of LTO. It requires a linker with 12398linker plugin support for basic functionality. Additionally, 12399@command{nm}, @command{ar} and @command{ranlib} 12400need to support linker plugins to allow a full-featured build environment 12401(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 12402@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 12403to these tools. With non fat LTO makefiles need to be modified to use them. 12404 12405Note that modern binutils provide plugin auto-load mechanism. 12406Installing the linker plugin into @file{$libdir/bfd-plugins} has the same 12407effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and 12408@command{gcc-ranlib}). 12409 12410The default is @option{-fno-fat-lto-objects} on targets with linker plugin 12411support. 12412 12413@item -fcompare-elim 12414@opindex fcompare-elim 12415After register allocation and post-register allocation instruction splitting, 12416identify arithmetic instructions that compute processor flags similar to a 12417comparison operation based on that arithmetic. If possible, eliminate the 12418explicit comparison operation. 12419 12420This pass only applies to certain targets that cannot explicitly represent 12421the comparison operation before register allocation is complete. 12422 12423Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 12424 12425@item -fcprop-registers 12426@opindex fcprop-registers 12427After register allocation and post-register allocation instruction splitting, 12428perform a copy-propagation pass to try to reduce scheduling dependencies 12429and occasionally eliminate the copy. 12430 12431Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 12432 12433@item -fprofile-correction 12434@opindex fprofile-correction 12435Profiles collected using an instrumented binary for multi-threaded programs may 12436be inconsistent due to missed counter updates. When this option is specified, 12437GCC uses heuristics to correct or smooth out such inconsistencies. By 12438default, GCC emits an error message when an inconsistent profile is detected. 12439 12440This option is enabled by @option{-fauto-profile}. 12441 12442@item -fprofile-partial-training 12443@opindex fprofile-partial-training 12444With @code{-fprofile-use} all portions of programs not executed during train 12445run are optimized agressively for size rather than speed. In some cases it is 12446not practical to train all possible hot paths in the program. (For 12447example, program may contain functions specific for a given hardware and 12448trianing may not cover all hardware configurations program is run on.) With 12449@code{-fprofile-partial-training} profile feedback will be ignored for all 12450functions not executed during the train run leading them to be optimized as if 12451they were compiled without profile feedback. This leads to better performance 12452when train run is not representative but also leads to significantly bigger 12453code. 12454 12455@item -fprofile-use 12456@itemx -fprofile-use=@var{path} 12457@opindex fprofile-use 12458Enable profile feedback-directed optimizations, 12459and the following optimizations, many of which 12460are generally profitable only with profile feedback available: 12461 12462@gccoptlist{-fbranch-probabilities -fprofile-values @gol 12463-funroll-loops -fpeel-loops -ftracer -fvpt @gol 12464-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 12465-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 12466-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 12467-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 12468-fprofile-reorder-functions} 12469 12470Before you can use this option, you must first generate profiling information. 12471@xref{Instrumentation Options}, for information about the 12472@option{-fprofile-generate} option. 12473 12474By default, GCC emits an error message if the feedback profiles do not 12475match the source code. This error can be turned into a warning by using 12476@option{-Wno-error=coverage-mismatch}. Note this may result in poorly 12477optimized code. Additionally, by default, GCC also emits a warning message if 12478the feedback profiles do not exist (see @option{-Wmissing-profile}). 12479 12480If @var{path} is specified, GCC looks at the @var{path} to find 12481the profile feedback data files. See @option{-fprofile-dir}. 12482 12483@item -fauto-profile 12484@itemx -fauto-profile=@var{path} 12485@opindex fauto-profile 12486Enable sampling-based feedback-directed optimizations, 12487and the following optimizations, 12488many of which are generally profitable only with profile feedback available: 12489 12490@gccoptlist{-fbranch-probabilities -fprofile-values @gol 12491-funroll-loops -fpeel-loops -ftracer -fvpt @gol 12492-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 12493-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 12494-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 12495-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 12496-fprofile-correction} 12497 12498@var{path} is the name of a file containing AutoFDO profile information. 12499If omitted, it defaults to @file{fbdata.afdo} in the current directory. 12500 12501Producing an AutoFDO profile data file requires running your program 12502with the @command{perf} utility on a supported GNU/Linux target system. 12503For more information, see @uref{https://perf.wiki.kernel.org/}. 12504 12505E.g. 12506@smallexample 12507perf record -e br_inst_retired:near_taken -b -o perf.data \ 12508 -- your_program 12509@end smallexample 12510 12511Then use the @command{create_gcov} tool to convert the raw profile data 12512to a format that can be used by GCC.@ You must also supply the 12513unstripped binary for your program to this tool. 12514See @uref{https://github.com/google/autofdo}. 12515 12516E.g. 12517@smallexample 12518create_gcov --binary=your_program.unstripped --profile=perf.data \ 12519 --gcov=profile.afdo 12520@end smallexample 12521@end table 12522 12523The following options control compiler behavior regarding floating-point 12524arithmetic. These options trade off between speed and 12525correctness. All must be specifically enabled. 12526 12527@table @gcctabopt 12528@item -ffloat-store 12529@opindex ffloat-store 12530Do not store floating-point variables in registers, and inhibit other 12531options that might change whether a floating-point value is taken from a 12532register or memory. 12533 12534@cindex floating-point precision 12535This option prevents undesirable excess precision on machines such as 12536the 68000 where the floating registers (of the 68881) keep more 12537precision than a @code{double} is supposed to have. Similarly for the 12538x86 architecture. For most programs, the excess precision does only 12539good, but a few programs rely on the precise definition of IEEE floating 12540point. Use @option{-ffloat-store} for such programs, after modifying 12541them to store all pertinent intermediate computations into variables. 12542 12543@item -fexcess-precision=@var{style} 12544@opindex fexcess-precision 12545This option allows further control over excess precision on machines 12546where floating-point operations occur in a format with more precision or 12547range than the IEEE standard and interchange floating-point types. By 12548default, @option{-fexcess-precision=fast} is in effect; this means that 12549operations may be carried out in a wider precision than the types specified 12550in the source if that would result in faster code, and it is unpredictable 12551when rounding to the types specified in the source code takes place. 12552When compiling C, if @option{-fexcess-precision=standard} is specified then 12553excess precision follows the rules specified in ISO C99; in particular, 12554both casts and assignments cause values to be rounded to their 12555semantic types (whereas @option{-ffloat-store} only affects 12556assignments). This option is enabled by default for C if a strict 12557conformance option such as @option{-std=c99} is used. 12558@option{-ffast-math} enables @option{-fexcess-precision=fast} by default 12559regardless of whether a strict conformance option is used. 12560 12561@opindex mfpmath 12562@option{-fexcess-precision=standard} is not implemented for languages 12563other than C. On the x86, it has no effect if @option{-mfpmath=sse} 12564or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 12565semantics apply without excess precision, and in the latter, rounding 12566is unpredictable. 12567 12568@item -ffast-math 12569@opindex ffast-math 12570Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 12571@option{-ffinite-math-only}, @option{-fno-rounding-math}, 12572@option{-fno-signaling-nans}, @option{-fcx-limited-range} and 12573@option{-fexcess-precision=fast}. 12574 12575This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 12576 12577This option is not turned on by any @option{-O} option besides 12578@option{-Ofast} since it can result in incorrect output for programs 12579that depend on an exact implementation of IEEE or ISO rules/specifications 12580for math functions. It may, however, yield faster code for programs 12581that do not require the guarantees of these specifications. 12582 12583@item -fno-math-errno 12584@opindex fno-math-errno 12585@opindex fmath-errno 12586Do not set @code{errno} after calling math functions that are executed 12587with a single instruction, e.g., @code{sqrt}. A program that relies on 12588IEEE exceptions for math error handling may want to use this flag 12589for speed while maintaining IEEE arithmetic compatibility. 12590 12591This option is not turned on by any @option{-O} option since 12592it can result in incorrect output for programs that depend on 12593an exact implementation of IEEE or ISO rules/specifications for 12594math functions. It may, however, yield faster code for programs 12595that do not require the guarantees of these specifications. 12596 12597The default is @option{-fmath-errno}. 12598 12599On Darwin systems, the math library never sets @code{errno}. There is 12600therefore no reason for the compiler to consider the possibility that 12601it might, and @option{-fno-math-errno} is the default. 12602 12603@item -funsafe-math-optimizations 12604@opindex funsafe-math-optimizations 12605 12606Allow optimizations for floating-point arithmetic that (a) assume 12607that arguments and results are valid and (b) may violate IEEE or 12608ANSI standards. When used at link time, it may include libraries 12609or startup files that change the default FPU control word or other 12610similar optimizations. 12611 12612This option is not turned on by any @option{-O} option since 12613it can result in incorrect output for programs that depend on 12614an exact implementation of IEEE or ISO rules/specifications for 12615math functions. It may, however, yield faster code for programs 12616that do not require the guarantees of these specifications. 12617Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 12618@option{-fassociative-math} and @option{-freciprocal-math}. 12619 12620The default is @option{-fno-unsafe-math-optimizations}. 12621 12622@item -fassociative-math 12623@opindex fassociative-math 12624 12625Allow re-association of operands in series of floating-point operations. 12626This violates the ISO C and C++ language standard by possibly changing 12627computation result. NOTE: re-ordering may change the sign of zero as 12628well as ignore NaNs and inhibit or create underflow or overflow (and 12629thus cannot be used on code that relies on rounding behavior like 12630@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 12631and thus may not be used when ordered comparisons are required. 12632This option requires that both @option{-fno-signed-zeros} and 12633@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 12634much sense with @option{-frounding-math}. For Fortran the option 12635is automatically enabled when both @option{-fno-signed-zeros} and 12636@option{-fno-trapping-math} are in effect. 12637 12638The default is @option{-fno-associative-math}. 12639 12640@item -freciprocal-math 12641@opindex freciprocal-math 12642 12643Allow the reciprocal of a value to be used instead of dividing by 12644the value if this enables optimizations. For example @code{x / y} 12645can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 12646is subject to common subexpression elimination. Note that this loses 12647precision and increases the number of flops operating on the value. 12648 12649The default is @option{-fno-reciprocal-math}. 12650 12651@item -ffinite-math-only 12652@opindex ffinite-math-only 12653Allow optimizations for floating-point arithmetic that assume 12654that arguments and results are not NaNs or +-Infs. 12655 12656This option is not turned on by any @option{-O} option since 12657it can result in incorrect output for programs that depend on 12658an exact implementation of IEEE or ISO rules/specifications for 12659math functions. It may, however, yield faster code for programs 12660that do not require the guarantees of these specifications. 12661 12662The default is @option{-fno-finite-math-only}. 12663 12664@item -fno-signed-zeros 12665@opindex fno-signed-zeros 12666@opindex fsigned-zeros 12667Allow optimizations for floating-point arithmetic that ignore the 12668signedness of zero. IEEE arithmetic specifies the behavior of 12669distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 12670of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 12671This option implies that the sign of a zero result isn't significant. 12672 12673The default is @option{-fsigned-zeros}. 12674 12675@item -fno-trapping-math 12676@opindex fno-trapping-math 12677@opindex ftrapping-math 12678Compile code assuming that floating-point operations cannot generate 12679user-visible traps. These traps include division by zero, overflow, 12680underflow, inexact result and invalid operation. This option requires 12681that @option{-fno-signaling-nans} be in effect. Setting this option may 12682allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 12683 12684This option should never be turned on by any @option{-O} option since 12685it can result in incorrect output for programs that depend on 12686an exact implementation of IEEE or ISO rules/specifications for 12687math functions. 12688 12689The default is @option{-ftrapping-math}. 12690 12691@item -frounding-math 12692@opindex frounding-math 12693Disable transformations and optimizations that assume default floating-point 12694rounding behavior. This is round-to-zero for all floating point 12695to integer conversions, and round-to-nearest for all other arithmetic 12696truncations. This option should be specified for programs that change 12697the FP rounding mode dynamically, or that may be executed with a 12698non-default rounding mode. This option disables constant folding of 12699floating-point expressions at compile time (which may be affected by 12700rounding mode) and arithmetic transformations that are unsafe in the 12701presence of sign-dependent rounding modes. 12702 12703The default is @option{-fno-rounding-math}. 12704 12705This option is experimental and does not currently guarantee to 12706disable all GCC optimizations that are affected by rounding mode. 12707Future versions of GCC may provide finer control of this setting 12708using C99's @code{FENV_ACCESS} pragma. This command-line option 12709will be used to specify the default state for @code{FENV_ACCESS}. 12710 12711@item -fsignaling-nans 12712@opindex fsignaling-nans 12713Compile code assuming that IEEE signaling NaNs may generate user-visible 12714traps during floating-point operations. Setting this option disables 12715optimizations that may change the number of exceptions visible with 12716signaling NaNs. This option implies @option{-ftrapping-math}. 12717 12718This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 12719be defined. 12720 12721The default is @option{-fno-signaling-nans}. 12722 12723This option is experimental and does not currently guarantee to 12724disable all GCC optimizations that affect signaling NaN behavior. 12725 12726@item -fno-fp-int-builtin-inexact 12727@opindex fno-fp-int-builtin-inexact 12728@opindex ffp-int-builtin-inexact 12729Do not allow the built-in functions @code{ceil}, @code{floor}, 12730@code{round} and @code{trunc}, and their @code{float} and @code{long 12731double} variants, to generate code that raises the ``inexact'' 12732floating-point exception for noninteger arguments. ISO C99 and C11 12733allow these functions to raise the ``inexact'' exception, but ISO/IEC 12734TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into 12735ISO C2X, does not allow these functions to do so. 12736 12737The default is @option{-ffp-int-builtin-inexact}, allowing the 12738exception to be raised, unless C2X or a later C standard is selected. 12739This option does nothing unless @option{-ftrapping-math} is in effect. 12740 12741Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions 12742generate a call to a library function then the ``inexact'' exception 12743may be raised if the library implementation does not follow TS 18661. 12744 12745@item -fsingle-precision-constant 12746@opindex fsingle-precision-constant 12747Treat floating-point constants as single precision instead of 12748implicitly converting them to double-precision constants. 12749 12750@item -fcx-limited-range 12751@opindex fcx-limited-range 12752When enabled, this option states that a range reduction step is not 12753needed when performing complex division. Also, there is no checking 12754whether the result of a complex multiplication or division is @code{NaN 12755+ I*NaN}, with an attempt to rescue the situation in that case. The 12756default is @option{-fno-cx-limited-range}, but is enabled by 12757@option{-ffast-math}. 12758 12759This option controls the default setting of the ISO C99 12760@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 12761all languages. 12762 12763@item -fcx-fortran-rules 12764@opindex fcx-fortran-rules 12765Complex multiplication and division follow Fortran rules. Range 12766reduction is done as part of complex division, but there is no checking 12767whether the result of a complex multiplication or division is @code{NaN 12768+ I*NaN}, with an attempt to rescue the situation in that case. 12769 12770The default is @option{-fno-cx-fortran-rules}. 12771 12772@end table 12773 12774The following options control optimizations that may improve 12775performance, but are not enabled by any @option{-O} options. This 12776section includes experimental options that may produce broken code. 12777 12778@table @gcctabopt 12779@item -fbranch-probabilities 12780@opindex fbranch-probabilities 12781After running a program compiled with @option{-fprofile-arcs} 12782(@pxref{Instrumentation Options}), 12783you can compile it a second time using 12784@option{-fbranch-probabilities}, to improve optimizations based on 12785the number of times each branch was taken. When a program 12786compiled with @option{-fprofile-arcs} exits, it saves arc execution 12787counts to a file called @file{@var{sourcename}.gcda} for each source 12788file. The information in this data file is very dependent on the 12789structure of the generated code, so you must use the same source code 12790and the same optimization options for both compilations. 12791 12792With @option{-fbranch-probabilities}, GCC puts a 12793@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 12794These can be used to improve optimization. Currently, they are only 12795used in one place: in @file{reorg.c}, instead of guessing which path a 12796branch is most likely to take, the @samp{REG_BR_PROB} values are used to 12797exactly determine which path is taken more often. 12798 12799Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12800 12801@item -fprofile-values 12802@opindex fprofile-values 12803If combined with @option{-fprofile-arcs}, it adds code so that some 12804data about values of expressions in the program is gathered. 12805 12806With @option{-fbranch-probabilities}, it reads back the data gathered 12807from profiling values of expressions for usage in optimizations. 12808 12809Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and 12810@option{-fauto-profile}. 12811 12812@item -fprofile-reorder-functions 12813@opindex fprofile-reorder-functions 12814Function reordering based on profile instrumentation collects 12815first time of execution of a function and orders these functions 12816in ascending order. 12817 12818Enabled with @option{-fprofile-use}. 12819 12820@item -fvpt 12821@opindex fvpt 12822If combined with @option{-fprofile-arcs}, this option instructs the compiler 12823to add code to gather information about values of expressions. 12824 12825With @option{-fbranch-probabilities}, it reads back the data gathered 12826and actually performs the optimizations based on them. 12827Currently the optimizations include specialization of division operations 12828using the knowledge about the value of the denominator. 12829 12830Enabled with @option{-fprofile-use} and @option{-fauto-profile}. 12831 12832@item -frename-registers 12833@opindex frename-registers 12834Attempt to avoid false dependencies in scheduled code by making use 12835of registers left over after register allocation. This optimization 12836most benefits processors with lots of registers. Depending on the 12837debug information format adopted by the target, however, it can 12838make debugging impossible, since variables no longer stay in 12839a ``home register''. 12840 12841Enabled by default with @option{-funroll-loops}. 12842 12843@item -fschedule-fusion 12844@opindex fschedule-fusion 12845Performs a target dependent pass over the instruction stream to schedule 12846instructions of same type together because target machine can execute them 12847more efficiently if they are adjacent to each other in the instruction flow. 12848 12849Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 12850 12851@item -ftracer 12852@opindex ftracer 12853Perform tail duplication to enlarge superblock size. This transformation 12854simplifies the control flow of the function allowing other optimizations to do 12855a better job. 12856 12857Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12858 12859@item -funroll-loops 12860@opindex funroll-loops 12861Unroll loops whose number of iterations can be determined at compile time or 12862upon entry to the loop. @option{-funroll-loops} implies 12863@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 12864It also turns on complete loop peeling (i.e.@: complete removal of loops with 12865a small constant number of iterations). This option makes code larger, and may 12866or may not make it run faster. 12867 12868Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12869 12870@item -funroll-all-loops 12871@opindex funroll-all-loops 12872Unroll all loops, even if their number of iterations is uncertain when 12873the loop is entered. This usually makes programs run more slowly. 12874@option{-funroll-all-loops} implies the same options as 12875@option{-funroll-loops}. 12876 12877@item -fpeel-loops 12878@opindex fpeel-loops 12879Peels loops for which there is enough information that they do not 12880roll much (from profile feedback or static analysis). It also turns on 12881complete loop peeling (i.e.@: complete removal of loops with small constant 12882number of iterations). 12883 12884Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}. 12885 12886@item -fmove-loop-invariants 12887@opindex fmove-loop-invariants 12888Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 12889at level @option{-O1} and higher, except for @option{-Og}. 12890 12891@item -fsplit-loops 12892@opindex fsplit-loops 12893Split a loop into two if it contains a condition that's always true 12894for one side of the iteration space and false for the other. 12895 12896Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12897 12898@item -funswitch-loops 12899@opindex funswitch-loops 12900Move branches with loop invariant conditions out of the loop, with duplicates 12901of the loop on both branches (modified according to result of the condition). 12902 12903Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12904 12905@item -fversion-loops-for-strides 12906@opindex fversion-loops-for-strides 12907If a loop iterates over an array with a variable stride, create another 12908version of the loop that assumes the stride is always one. For example: 12909 12910@smallexample 12911for (int i = 0; i < n; ++i) 12912 x[i * stride] = @dots{}; 12913@end smallexample 12914 12915becomes: 12916 12917@smallexample 12918if (stride == 1) 12919 for (int i = 0; i < n; ++i) 12920 x[i] = @dots{}; 12921else 12922 for (int i = 0; i < n; ++i) 12923 x[i * stride] = @dots{}; 12924@end smallexample 12925 12926This is particularly useful for assumed-shape arrays in Fortran where 12927(for example) it allows better vectorization assuming contiguous accesses. 12928This flag is enabled by default at @option{-O3}. 12929It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12930 12931@item -ffunction-sections 12932@itemx -fdata-sections 12933@opindex ffunction-sections 12934@opindex fdata-sections 12935Place each function or data item into its own section in the output 12936file if the target supports arbitrary sections. The name of the 12937function or the name of the data item determines the section's name 12938in the output file. 12939 12940Use these options on systems where the linker can perform optimizations to 12941improve locality of reference in the instruction space. Most systems using the 12942ELF object format have linkers with such optimizations. On AIX, the linker 12943rearranges sections (CSECTs) based on the call graph. The performance impact 12944varies. 12945 12946Together with a linker garbage collection (linker @option{--gc-sections} 12947option) these options may lead to smaller statically-linked executables (after 12948stripping). 12949 12950On ELF/DWARF systems these options do not degenerate the quality of the debug 12951information. There could be issues with other object files/debug info formats. 12952 12953Only use these options when there are significant benefits from doing so. When 12954you specify these options, the assembler and linker create larger object and 12955executable files and are also slower. These options affect code generation. 12956They prevent optimizations by the compiler and assembler using relative 12957locations inside a translation unit since the locations are unknown until 12958link time. An example of such an optimization is relaxing calls to short call 12959instructions. 12960 12961@item -fstdarg-opt 12962@opindex fstdarg-opt 12963Optimize the prologue of variadic argument functions with respect to usage of 12964those arguments. 12965 12966@item -fsection-anchors 12967@opindex fsection-anchors 12968Try to reduce the number of symbolic address calculations by using 12969shared ``anchor'' symbols to address nearby objects. This transformation 12970can help to reduce the number of GOT entries and GOT accesses on some 12971targets. 12972 12973For example, the implementation of the following function @code{foo}: 12974 12975@smallexample 12976static int a, b, c; 12977int foo (void) @{ return a + b + c; @} 12978@end smallexample 12979 12980@noindent 12981usually calculates the addresses of all three variables, but if you 12982compile it with @option{-fsection-anchors}, it accesses the variables 12983from a common anchor point instead. The effect is similar to the 12984following pseudocode (which isn't valid C): 12985 12986@smallexample 12987int foo (void) 12988@{ 12989 register int *xr = &x; 12990 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 12991@} 12992@end smallexample 12993 12994Not all targets support this option. 12995 12996@item -fzero-call-used-regs=@var{choice} 12997@opindex fzero-call-used-regs 12998Zero call-used registers at function return to increase program 12999security by either mitigating Return-Oriented Programming (ROP) 13000attacks or preventing information leakage through registers. 13001 13002The possible values of @var{choice} are the same as for the 13003@code{zero_call_used_regs} attribute (@pxref{Function Attributes}). 13004The default is @samp{skip}. 13005 13006You can control this behavior for a specific function by using the function 13007attribute @code{zero_call_used_regs} (@pxref{Function Attributes}). 13008 13009@item --param @var{name}=@var{value} 13010@opindex param 13011In some places, GCC uses various constants to control the amount of 13012optimization that is done. For example, GCC does not inline functions 13013that contain more than a certain number of instructions. You can 13014control some of these constants on the command line using the 13015@option{--param} option. 13016 13017The names of specific parameters, and the meaning of the values, are 13018tied to the internals of the compiler, and are subject to change 13019without notice in future releases. 13020 13021In order to get minimal, maximal and default value of a parameter, 13022one can use @option{--help=param -Q} options. 13023 13024In each case, the @var{value} is an integer. The following choices 13025of @var{name} are recognized for all targets: 13026 13027@table @gcctabopt 13028@item predictable-branch-outcome 13029When branch is predicted to be taken with probability lower than this threshold 13030(in percent), then it is considered well predictable. 13031 13032@item max-rtl-if-conversion-insns 13033RTL if-conversion tries to remove conditional branches around a block and 13034replace them with conditionally executed instructions. This parameter 13035gives the maximum number of instructions in a block which should be 13036considered for if-conversion. The compiler will 13037also use other heuristics to decide whether if-conversion is likely to be 13038profitable. 13039 13040@item max-rtl-if-conversion-predictable-cost 13041RTL if-conversion will try to remove conditional branches around a block 13042and replace them with conditionally executed instructions. These parameters 13043give the maximum permissible cost for the sequence that would be generated 13044by if-conversion depending on whether the branch is statically determined 13045to be predictable or not. The units for this parameter are the same as 13046those for the GCC internal seq_cost metric. The compiler will try to 13047provide a reasonable default for this parameter using the BRANCH_COST 13048target macro. 13049 13050@item max-crossjump-edges 13051The maximum number of incoming edges to consider for cross-jumping. 13052The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 13053the number of edges incoming to each block. Increasing values mean 13054more aggressive optimization, making the compilation time increase with 13055probably small improvement in executable size. 13056 13057@item min-crossjump-insns 13058The minimum number of instructions that must be matched at the end 13059of two blocks before cross-jumping is performed on them. This 13060value is ignored in the case where all instructions in the block being 13061cross-jumped from are matched. 13062 13063@item max-grow-copy-bb-insns 13064The maximum code size expansion factor when copying basic blocks 13065instead of jumping. The expansion is relative to a jump instruction. 13066 13067@item max-goto-duplication-insns 13068The maximum number of instructions to duplicate to a block that jumps 13069to a computed goto. To avoid @math{O(N^2)} behavior in a number of 13070passes, GCC factors computed gotos early in the compilation process, 13071and unfactors them as late as possible. Only computed jumps at the 13072end of a basic blocks with no more than max-goto-duplication-insns are 13073unfactored. 13074 13075@item max-delay-slot-insn-search 13076The maximum number of instructions to consider when looking for an 13077instruction to fill a delay slot. If more than this arbitrary number of 13078instructions are searched, the time savings from filling the delay slot 13079are minimal, so stop searching. Increasing values mean more 13080aggressive optimization, making the compilation time increase with probably 13081small improvement in execution time. 13082 13083@item max-delay-slot-live-search 13084When trying to fill delay slots, the maximum number of instructions to 13085consider when searching for a block with valid live register 13086information. Increasing this arbitrarily chosen value means more 13087aggressive optimization, increasing the compilation time. This parameter 13088should be removed when the delay slot code is rewritten to maintain the 13089control-flow graph. 13090 13091@item max-gcse-memory 13092The approximate maximum amount of memory in @code{kB} that can be allocated in 13093order to perform the global common subexpression elimination 13094optimization. If more memory than specified is required, the 13095optimization is not done. 13096 13097@item max-gcse-insertion-ratio 13098If the ratio of expression insertions to deletions is larger than this value 13099for any expression, then RTL PRE inserts or removes the expression and thus 13100leaves partially redundant computations in the instruction stream. 13101 13102@item max-pending-list-length 13103The maximum number of pending dependencies scheduling allows 13104before flushing the current state and starting over. Large functions 13105with few branches or calls can create excessively large lists which 13106needlessly consume memory and resources. 13107 13108@item max-modulo-backtrack-attempts 13109The maximum number of backtrack attempts the scheduler should make 13110when modulo scheduling a loop. Larger values can exponentially increase 13111compilation time. 13112 13113@item max-inline-insns-single 13114Several parameters control the tree inliner used in GCC@. This number sets the 13115maximum number of instructions (counted in GCC's internal representation) in a 13116single function that the tree inliner considers for inlining. This only 13117affects functions declared inline and methods implemented in a class 13118declaration (C++). 13119 13120 13121@item max-inline-insns-auto 13122When you use @option{-finline-functions} (included in @option{-O3}), 13123a lot of functions that would otherwise not be considered for inlining 13124by the compiler are investigated. To those functions, a different 13125(more restrictive) limit compared to functions declared inline can 13126be applied (@option{--param max-inline-insns-auto}). 13127 13128@item max-inline-insns-small 13129This is bound applied to calls which are considered relevant with 13130@option{-finline-small-functions}. 13131 13132@item max-inline-insns-size 13133This is bound applied to calls which are optimized for size. Small growth 13134may be desirable to anticipate optimization oppurtunities exposed by inlining. 13135 13136@item uninlined-function-insns 13137Number of instructions accounted by inliner for function overhead such as 13138function prologue and epilogue. 13139 13140@item uninlined-function-time 13141Extra time accounted by inliner for function overhead such as time needed to 13142execute function prologue and epilogue 13143 13144@item inline-heuristics-hint-percent 13145The scale (in percents) applied to @option{inline-insns-single}, 13146@option{inline-insns-single-O2}, @option{inline-insns-auto} 13147when inline heuristics hints that inlining is 13148very profitable (will enable later optimizations). 13149 13150@item uninlined-thunk-insns 13151@item uninlined-thunk-time 13152Same as @option{--param uninlined-function-insns} and 13153@option{--param uninlined-function-time} but applied to function thunks 13154 13155@item inline-min-speedup 13156When estimated performance improvement of caller + callee runtime exceeds this 13157threshold (in percent), the function can be inlined regardless of the limit on 13158@option{--param max-inline-insns-single} and @option{--param 13159max-inline-insns-auto}. 13160 13161@item large-function-insns 13162The limit specifying really large functions. For functions larger than this 13163limit after inlining, inlining is constrained by 13164@option{--param large-function-growth}. This parameter is useful primarily 13165to avoid extreme compilation time caused by non-linear algorithms used by the 13166back end. 13167 13168@item large-function-growth 13169Specifies maximal growth of large function caused by inlining in percents. 13170For example, parameter value 100 limits large function growth to 2.0 times 13171the original size. 13172 13173@item large-unit-insns 13174The limit specifying large translation unit. Growth caused by inlining of 13175units larger than this limit is limited by @option{--param inline-unit-growth}. 13176For small units this might be too tight. 13177For example, consider a unit consisting of function A 13178that is inline and B that just calls A three times. If B is small relative to 13179A, the growth of unit is 300\% and yet such inlining is very sane. For very 13180large units consisting of small inlineable functions, however, the overall unit 13181growth limit is needed to avoid exponential explosion of code size. Thus for 13182smaller units, the size is increased to @option{--param large-unit-insns} 13183before applying @option{--param inline-unit-growth}. 13184 13185@item lazy-modules 13186Maximum number of concurrently open C++ module files when lazy loading. 13187 13188@item inline-unit-growth 13189Specifies maximal overall growth of the compilation unit caused by inlining. 13190For example, parameter value 20 limits unit growth to 1.2 times the original 13191size. Cold functions (either marked cold via an attribute or by profile 13192feedback) are not accounted into the unit size. 13193 13194@item ipa-cp-unit-growth 13195Specifies maximal overall growth of the compilation unit caused by 13196interprocedural constant propagation. For example, parameter value 10 limits 13197unit growth to 1.1 times the original size. 13198 13199@item ipa-cp-large-unit-insns 13200The size of translation unit that IPA-CP pass considers large. 13201 13202@item large-stack-frame 13203The limit specifying large stack frames. While inlining the algorithm is trying 13204to not grow past this limit too much. 13205 13206@item large-stack-frame-growth 13207Specifies maximal growth of large stack frames caused by inlining in percents. 13208For example, parameter value 1000 limits large stack frame growth to 11 times 13209the original size. 13210 13211@item max-inline-insns-recursive 13212@itemx max-inline-insns-recursive-auto 13213Specifies the maximum number of instructions an out-of-line copy of a 13214self-recursive inline 13215function can grow into by performing recursive inlining. 13216 13217@option{--param max-inline-insns-recursive} applies to functions 13218declared inline. 13219For functions not declared inline, recursive inlining 13220happens only when @option{-finline-functions} (included in @option{-O3}) is 13221enabled; @option{--param max-inline-insns-recursive-auto} applies instead. 13222 13223@item max-inline-recursive-depth 13224@itemx max-inline-recursive-depth-auto 13225Specifies the maximum recursion depth used for recursive inlining. 13226 13227@option{--param max-inline-recursive-depth} applies to functions 13228declared inline. For functions not declared inline, recursive inlining 13229happens only when @option{-finline-functions} (included in @option{-O3}) is 13230enabled; @option{--param max-inline-recursive-depth-auto} applies instead. 13231 13232@item min-inline-recursive-probability 13233Recursive inlining is profitable only for function having deep recursion 13234in average and can hurt for function having little recursion depth by 13235increasing the prologue size or complexity of function body to other 13236optimizers. 13237 13238When profile feedback is available (see @option{-fprofile-generate}) the actual 13239recursion depth can be guessed from the probability that function recurses 13240via a given call expression. This parameter limits inlining only to call 13241expressions whose probability exceeds the given threshold (in percents). 13242 13243@item early-inlining-insns 13244Specify growth that the early inliner can make. In effect it increases 13245the amount of inlining for code having a large abstraction penalty. 13246 13247@item max-early-inliner-iterations 13248Limit of iterations of the early inliner. This basically bounds 13249the number of nested indirect calls the early inliner can resolve. 13250Deeper chains are still handled by late inlining. 13251 13252@item comdat-sharing-probability 13253Probability (in percent) that C++ inline function with comdat visibility 13254are shared across multiple compilation units. 13255 13256@item modref-max-bases 13257@item modref-max-refs 13258@item modref-max-accesses 13259Specifies the maximal number of base pointers, references and accesses stored 13260for a single function by mod/ref analysis. 13261 13262@item modref-max-tests 13263Specifies the maxmal number of tests alias oracle can perform to disambiguate 13264memory locations using the mod/ref information. This parameter ought to be 13265bigger than @option{--param modref-max-bases} and @option{--param 13266modref-max-refs}. 13267 13268@item modref-max-depth 13269Specifies the maximum depth of DFS walk used by modref escape analysis. 13270Setting to 0 disables the analysis completely. 13271 13272@item modref-max-escape-points 13273Specifies the maximum number of escape points tracked by modref per SSA-name. 13274 13275@item profile-func-internal-id 13276A parameter to control whether to use function internal id in profile 13277database lookup. If the value is 0, the compiler uses an id that 13278is based on function assembler name and filename, which makes old profile 13279data more tolerant to source changes such as function reordering etc. 13280 13281@item min-vect-loop-bound 13282The minimum number of iterations under which loops are not vectorized 13283when @option{-ftree-vectorize} is used. The number of iterations after 13284vectorization needs to be greater than the value specified by this option 13285to allow vectorization. 13286 13287@item gcse-cost-distance-ratio 13288Scaling factor in calculation of maximum distance an expression 13289can be moved by GCSE optimizations. This is currently supported only in the 13290code hoisting pass. The bigger the ratio, the more aggressive code hoisting 13291is with simple expressions, i.e., the expressions that have cost 13292less than @option{gcse-unrestricted-cost}. Specifying 0 disables 13293hoisting of simple expressions. 13294 13295@item gcse-unrestricted-cost 13296Cost, roughly measured as the cost of a single typical machine 13297instruction, at which GCSE optimizations do not constrain 13298the distance an expression can travel. This is currently 13299supported only in the code hoisting pass. The lesser the cost, 13300the more aggressive code hoisting is. Specifying 0 13301allows all expressions to travel unrestricted distances. 13302 13303@item max-hoist-depth 13304The depth of search in the dominator tree for expressions to hoist. 13305This is used to avoid quadratic behavior in hoisting algorithm. 13306The value of 0 does not limit on the search, but may slow down compilation 13307of huge functions. 13308 13309@item max-tail-merge-comparisons 13310The maximum amount of similar bbs to compare a bb with. This is used to 13311avoid quadratic behavior in tree tail merging. 13312 13313@item max-tail-merge-iterations 13314The maximum amount of iterations of the pass over the function. This is used to 13315limit compilation time in tree tail merging. 13316 13317@item store-merging-allow-unaligned 13318Allow the store merging pass to introduce unaligned stores if it is legal to 13319do so. 13320 13321@item max-stores-to-merge 13322The maximum number of stores to attempt to merge into wider stores in the store 13323merging pass. 13324 13325@item max-store-chains-to-track 13326The maximum number of store chains to track at the same time in the attempt 13327to merge them into wider stores in the store merging pass. 13328 13329@item max-stores-to-track 13330The maximum number of stores to track at the same time in the attemt to 13331to merge them into wider stores in the store merging pass. 13332 13333@item max-unrolled-insns 13334The maximum number of instructions that a loop may have to be unrolled. 13335If a loop is unrolled, this parameter also determines how many times 13336the loop code is unrolled. 13337 13338@item max-average-unrolled-insns 13339The maximum number of instructions biased by probabilities of their execution 13340that a loop may have to be unrolled. If a loop is unrolled, 13341this parameter also determines how many times the loop code is unrolled. 13342 13343@item max-unroll-times 13344The maximum number of unrollings of a single loop. 13345 13346@item max-peeled-insns 13347The maximum number of instructions that a loop may have to be peeled. 13348If a loop is peeled, this parameter also determines how many times 13349the loop code is peeled. 13350 13351@item max-peel-times 13352The maximum number of peelings of a single loop. 13353 13354@item max-peel-branches 13355The maximum number of branches on the hot path through the peeled sequence. 13356 13357@item max-completely-peeled-insns 13358The maximum number of insns of a completely peeled loop. 13359 13360@item max-completely-peel-times 13361The maximum number of iterations of a loop to be suitable for complete peeling. 13362 13363@item max-completely-peel-loop-nest-depth 13364The maximum depth of a loop nest suitable for complete peeling. 13365 13366@item max-unswitch-insns 13367The maximum number of insns of an unswitched loop. 13368 13369@item max-unswitch-level 13370The maximum number of branches unswitched in a single loop. 13371 13372@item lim-expensive 13373The minimum cost of an expensive expression in the loop invariant motion. 13374 13375@item min-loop-cond-split-prob 13376When FDO profile information is available, @option{min-loop-cond-split-prob} 13377specifies minimum threshold for probability of semi-invariant condition 13378statement to trigger loop split. 13379 13380@item iv-consider-all-candidates-bound 13381Bound on number of candidates for induction variables, below which 13382all candidates are considered for each use in induction variable 13383optimizations. If there are more candidates than this, 13384only the most relevant ones are considered to avoid quadratic time complexity. 13385 13386@item iv-max-considered-uses 13387The induction variable optimizations give up on loops that contain more 13388induction variable uses. 13389 13390@item iv-always-prune-cand-set-bound 13391If the number of candidates in the set is smaller than this value, 13392always try to remove unnecessary ivs from the set 13393when adding a new one. 13394 13395@item avg-loop-niter 13396Average number of iterations of a loop. 13397 13398@item dse-max-object-size 13399Maximum size (in bytes) of objects tracked bytewise by dead store elimination. 13400Larger values may result in larger compilation times. 13401 13402@item dse-max-alias-queries-per-store 13403Maximum number of queries into the alias oracle per store. 13404Larger values result in larger compilation times and may result in more 13405removed dead stores. 13406 13407@item scev-max-expr-size 13408Bound on size of expressions used in the scalar evolutions analyzer. 13409Large expressions slow the analyzer. 13410 13411@item scev-max-expr-complexity 13412Bound on the complexity of the expressions in the scalar evolutions analyzer. 13413Complex expressions slow the analyzer. 13414 13415@item max-tree-if-conversion-phi-args 13416Maximum number of arguments in a PHI supported by TREE if conversion 13417unless the loop is marked with simd pragma. 13418 13419@item vect-max-version-for-alignment-checks 13420The maximum number of run-time checks that can be performed when 13421doing loop versioning for alignment in the vectorizer. 13422 13423@item vect-max-version-for-alias-checks 13424The maximum number of run-time checks that can be performed when 13425doing loop versioning for alias in the vectorizer. 13426 13427@item vect-max-peeling-for-alignment 13428The maximum number of loop peels to enhance access alignment 13429for vectorizer. Value -1 means no limit. 13430 13431@item max-iterations-to-track 13432The maximum number of iterations of a loop the brute-force algorithm 13433for analysis of the number of iterations of the loop tries to evaluate. 13434 13435@item hot-bb-count-fraction 13436The denominator n of fraction 1/n of the maximal execution count of a 13437basic block in the entire program that a basic block needs to at least 13438have in order to be considered hot. The default is 10000, which means 13439that a basic block is considered hot if its execution count is greater 13440than 1/10000 of the maximal execution count. 0 means that it is never 13441considered hot. Used in non-LTO mode. 13442 13443@item hot-bb-count-ws-permille 13444The number of most executed permilles, ranging from 0 to 1000, of the 13445profiled execution of the entire program to which the execution count 13446of a basic block must be part of in order to be considered hot. The 13447default is 990, which means that a basic block is considered hot if 13448its execution count contributes to the upper 990 permilles, or 99.0%, 13449of the profiled execution of the entire program. 0 means that it is 13450never considered hot. Used in LTO mode. 13451 13452@item hot-bb-frequency-fraction 13453The denominator n of fraction 1/n of the execution frequency of the 13454entry block of a function that a basic block of this function needs 13455to at least have in order to be considered hot. The default is 1000, 13456which means that a basic block is considered hot in a function if it 13457is executed more frequently than 1/1000 of the frequency of the entry 13458block of the function. 0 means that it is never considered hot. 13459 13460@item unlikely-bb-count-fraction 13461The denominator n of fraction 1/n of the number of profiled runs of 13462the entire program below which the execution count of a basic block 13463must be in order for the basic block to be considered unlikely executed. 13464The default is 20, which means that a basic block is considered unlikely 13465executed if it is executed in fewer than 1/20, or 5%, of the runs of 13466the program. 0 means that it is always considered unlikely executed. 13467 13468@item max-predicted-iterations 13469The maximum number of loop iterations we predict statically. This is useful 13470in cases where a function contains a single loop with known bound and 13471another loop with unknown bound. 13472The known number of iterations is predicted correctly, while 13473the unknown number of iterations average to roughly 10. This means that the 13474loop without bounds appears artificially cold relative to the other one. 13475 13476@item builtin-expect-probability 13477Control the probability of the expression having the specified value. This 13478parameter takes a percentage (i.e.@: 0 ... 100) as input. 13479 13480@item builtin-string-cmp-inline-length 13481The maximum length of a constant string for a builtin string cmp call 13482eligible for inlining. 13483 13484@item align-threshold 13485 13486Select fraction of the maximal frequency of executions of a basic block in 13487a function to align the basic block. 13488 13489@item align-loop-iterations 13490 13491A loop expected to iterate at least the selected number of iterations is 13492aligned. 13493 13494@item tracer-dynamic-coverage 13495@itemx tracer-dynamic-coverage-feedback 13496 13497This value is used to limit superblock formation once the given percentage of 13498executed instructions is covered. This limits unnecessary code size 13499expansion. 13500 13501The @option{tracer-dynamic-coverage-feedback} parameter 13502is used only when profile 13503feedback is available. The real profiles (as opposed to statically estimated 13504ones) are much less balanced allowing the threshold to be larger value. 13505 13506@item tracer-max-code-growth 13507Stop tail duplication once code growth has reached given percentage. This is 13508a rather artificial limit, as most of the duplicates are eliminated later in 13509cross jumping, so it may be set to much higher values than is the desired code 13510growth. 13511 13512@item tracer-min-branch-ratio 13513 13514Stop reverse growth when the reverse probability of best edge is less than this 13515threshold (in percent). 13516 13517@item tracer-min-branch-probability 13518@itemx tracer-min-branch-probability-feedback 13519 13520Stop forward growth if the best edge has probability lower than this 13521threshold. 13522 13523Similarly to @option{tracer-dynamic-coverage} two parameters are 13524provided. @option{tracer-min-branch-probability-feedback} is used for 13525compilation with profile feedback and @option{tracer-min-branch-probability} 13526compilation without. The value for compilation with profile feedback 13527needs to be more conservative (higher) in order to make tracer 13528effective. 13529 13530@item stack-clash-protection-guard-size 13531Specify the size of the operating system provided stack guard as 135322 raised to @var{num} bytes. Higher values may reduce the 13533number of explicit probes, but a value larger than the operating system 13534provided guard will leave code vulnerable to stack clash style attacks. 13535 13536@item stack-clash-protection-probe-interval 13537Stack clash protection involves probing stack space as it is allocated. This 13538param controls the maximum distance between probes into the stack as 2 raised 13539to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value 13540larger than the operating system provided guard will leave code vulnerable to 13541stack clash style attacks. 13542 13543@item max-cse-path-length 13544 13545The maximum number of basic blocks on path that CSE considers. 13546 13547@item max-cse-insns 13548The maximum number of instructions CSE processes before flushing. 13549 13550@item ggc-min-expand 13551 13552GCC uses a garbage collector to manage its own memory allocation. This 13553parameter specifies the minimum percentage by which the garbage 13554collector's heap should be allowed to expand between collections. 13555Tuning this may improve compilation speed; it has no effect on code 13556generation. 13557 13558The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 13559RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 13560the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 13561GCC is not able to calculate RAM on a particular platform, the lower 13562bound of 30% is used. Setting this parameter and 13563@option{ggc-min-heapsize} to zero causes a full collection to occur at 13564every opportunity. This is extremely slow, but can be useful for 13565debugging. 13566 13567@item ggc-min-heapsize 13568 13569Minimum size of the garbage collector's heap before it begins bothering 13570to collect garbage. The first collection occurs after the heap expands 13571by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 13572tuning this may improve compilation speed, and has no effect on code 13573generation. 13574 13575The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 13576tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 13577with a lower bound of 4096 (four megabytes) and an upper bound of 13578131072 (128 megabytes). If GCC is not able to calculate RAM on a 13579particular platform, the lower bound is used. Setting this parameter 13580very large effectively disables garbage collection. Setting this 13581parameter and @option{ggc-min-expand} to zero causes a full collection 13582to occur at every opportunity. 13583 13584@item max-reload-search-insns 13585The maximum number of instruction reload should look backward for equivalent 13586register. Increasing values mean more aggressive optimization, making the 13587compilation time increase with probably slightly better performance. 13588 13589@item max-cselib-memory-locations 13590The maximum number of memory locations cselib should take into account. 13591Increasing values mean more aggressive optimization, making the compilation time 13592increase with probably slightly better performance. 13593 13594@item max-sched-ready-insns 13595The maximum number of instructions ready to be issued the scheduler should 13596consider at any given time during the first scheduling pass. Increasing 13597values mean more thorough searches, making the compilation time increase 13598with probably little benefit. 13599 13600@item max-sched-region-blocks 13601The maximum number of blocks in a region to be considered for 13602interblock scheduling. 13603 13604@item max-pipeline-region-blocks 13605The maximum number of blocks in a region to be considered for 13606pipelining in the selective scheduler. 13607 13608@item max-sched-region-insns 13609The maximum number of insns in a region to be considered for 13610interblock scheduling. 13611 13612@item max-pipeline-region-insns 13613The maximum number of insns in a region to be considered for 13614pipelining in the selective scheduler. 13615 13616@item min-spec-prob 13617The minimum probability (in percents) of reaching a source block 13618for interblock speculative scheduling. 13619 13620@item max-sched-extend-regions-iters 13621The maximum number of iterations through CFG to extend regions. 13622A value of 0 disables region extensions. 13623 13624@item max-sched-insn-conflict-delay 13625The maximum conflict delay for an insn to be considered for speculative motion. 13626 13627@item sched-spec-prob-cutoff 13628The minimal probability of speculation success (in percents), so that 13629speculative insns are scheduled. 13630 13631@item sched-state-edge-prob-cutoff 13632The minimum probability an edge must have for the scheduler to save its 13633state across it. 13634 13635@item sched-mem-true-dep-cost 13636Minimal distance (in CPU cycles) between store and load targeting same 13637memory locations. 13638 13639@item selsched-max-lookahead 13640The maximum size of the lookahead window of selective scheduling. It is a 13641depth of search for available instructions. 13642 13643@item selsched-max-sched-times 13644The maximum number of times that an instruction is scheduled during 13645selective scheduling. This is the limit on the number of iterations 13646through which the instruction may be pipelined. 13647 13648@item selsched-insns-to-rename 13649The maximum number of best instructions in the ready list that are considered 13650for renaming in the selective scheduler. 13651 13652@item sms-min-sc 13653The minimum value of stage count that swing modulo scheduler 13654generates. 13655 13656@item max-last-value-rtl 13657The maximum size measured as number of RTLs that can be recorded in an expression 13658in combiner for a pseudo register as last known value of that register. 13659 13660@item max-combine-insns 13661The maximum number of instructions the RTL combiner tries to combine. 13662 13663@item integer-share-limit 13664Small integer constants can use a shared data structure, reducing the 13665compiler's memory usage and increasing its speed. This sets the maximum 13666value of a shared integer constant. 13667 13668@item ssp-buffer-size 13669The minimum size of buffers (i.e.@: arrays) that receive stack smashing 13670protection when @option{-fstack-protection} is used. 13671 13672@item min-size-for-stack-sharing 13673The minimum size of variables taking part in stack slot sharing when not 13674optimizing. 13675 13676@item max-jump-thread-duplication-stmts 13677Maximum number of statements allowed in a block that needs to be 13678duplicated when threading jumps. 13679 13680@item max-fields-for-field-sensitive 13681Maximum number of fields in a structure treated in 13682a field sensitive manner during pointer analysis. 13683 13684@item prefetch-latency 13685Estimate on average number of instructions that are executed before 13686prefetch finishes. The distance prefetched ahead is proportional 13687to this constant. Increasing this number may also lead to less 13688streams being prefetched (see @option{simultaneous-prefetches}). 13689 13690@item simultaneous-prefetches 13691Maximum number of prefetches that can run at the same time. 13692 13693@item l1-cache-line-size 13694The size of cache line in L1 data cache, in bytes. 13695 13696@item l1-cache-size 13697The size of L1 data cache, in kilobytes. 13698 13699@item l2-cache-size 13700The size of L2 data cache, in kilobytes. 13701 13702@item prefetch-dynamic-strides 13703Whether the loop array prefetch pass should issue software prefetch hints 13704for strides that are non-constant. In some cases this may be 13705beneficial, though the fact the stride is non-constant may make it 13706hard to predict when there is clear benefit to issuing these hints. 13707 13708Set to 1 if the prefetch hints should be issued for non-constant 13709strides. Set to 0 if prefetch hints should be issued only for strides that 13710are known to be constant and below @option{prefetch-minimum-stride}. 13711 13712@item prefetch-minimum-stride 13713Minimum constant stride, in bytes, to start using prefetch hints for. If 13714the stride is less than this threshold, prefetch hints will not be issued. 13715 13716This setting is useful for processors that have hardware prefetchers, in 13717which case there may be conflicts between the hardware prefetchers and 13718the software prefetchers. If the hardware prefetchers have a maximum 13719stride they can handle, it should be used here to improve the use of 13720software prefetchers. 13721 13722A value of -1 means we don't have a threshold and therefore 13723prefetch hints can be issued for any constant stride. 13724 13725This setting is only useful for strides that are known and constant. 13726 13727@item loop-interchange-max-num-stmts 13728The maximum number of stmts in a loop to be interchanged. 13729 13730@item loop-interchange-stride-ratio 13731The minimum ratio between stride of two loops for interchange to be profitable. 13732 13733@item min-insn-to-prefetch-ratio 13734The minimum ratio between the number of instructions and the 13735number of prefetches to enable prefetching in a loop. 13736 13737@item prefetch-min-insn-to-mem-ratio 13738The minimum ratio between the number of instructions and the 13739number of memory references to enable prefetching in a loop. 13740 13741@item use-canonical-types 13742Whether the compiler should use the ``canonical'' type system. 13743Should always be 1, which uses a more efficient internal 13744mechanism for comparing types in C++ and Objective-C++. However, if 13745bugs in the canonical type system are causing compilation failures, 13746set this value to 0 to disable canonical types. 13747 13748@item switch-conversion-max-branch-ratio 13749Switch initialization conversion refuses to create arrays that are 13750bigger than @option{switch-conversion-max-branch-ratio} times the number of 13751branches in the switch. 13752 13753@item max-partial-antic-length 13754Maximum length of the partial antic set computed during the tree 13755partial redundancy elimination optimization (@option{-ftree-pre}) when 13756optimizing at @option{-O3} and above. For some sorts of source code 13757the enhanced partial redundancy elimination optimization can run away, 13758consuming all of the memory available on the host machine. This 13759parameter sets a limit on the length of the sets that are computed, 13760which prevents the runaway behavior. Setting a value of 0 for 13761this parameter allows an unlimited set length. 13762 13763@item rpo-vn-max-loop-depth 13764Maximum loop depth that is value-numbered optimistically. 13765When the limit hits the innermost 13766@var{rpo-vn-max-loop-depth} loops and the outermost loop in the 13767loop nest are value-numbered optimistically and the remaining ones not. 13768 13769@item sccvn-max-alias-queries-per-access 13770Maximum number of alias-oracle queries we perform when looking for 13771redundancies for loads and stores. If this limit is hit the search 13772is aborted and the load or store is not considered redundant. The 13773number of queries is algorithmically limited to the number of 13774stores on all paths from the load to the function entry. 13775 13776@item ira-max-loops-num 13777IRA uses regional register allocation by default. If a function 13778contains more loops than the number given by this parameter, only at most 13779the given number of the most frequently-executed loops form regions 13780for regional register allocation. 13781 13782@item ira-max-conflict-table-size 13783Although IRA uses a sophisticated algorithm to compress the conflict 13784table, the table can still require excessive amounts of memory for 13785huge functions. If the conflict table for a function could be more 13786than the size in MB given by this parameter, the register allocator 13787instead uses a faster, simpler, and lower-quality 13788algorithm that does not require building a pseudo-register conflict table. 13789 13790@item ira-loop-reserved-regs 13791IRA can be used to evaluate more accurate register pressure in loops 13792for decisions to move loop invariants (see @option{-O3}). The number 13793of available registers reserved for some other purposes is given 13794by this parameter. Default of the parameter 13795is the best found from numerous experiments. 13796 13797@item lra-inheritance-ebb-probability-cutoff 13798LRA tries to reuse values reloaded in registers in subsequent insns. 13799This optimization is called inheritance. EBB is used as a region to 13800do this optimization. The parameter defines a minimal fall-through 13801edge probability in percentage used to add BB to inheritance EBB in 13802LRA. The default value was chosen 13803from numerous runs of SPEC2000 on x86-64. 13804 13805@item loop-invariant-max-bbs-in-loop 13806Loop invariant motion can be very expensive, both in compilation time and 13807in amount of needed compile-time memory, with very large loops. Loops 13808with more basic blocks than this parameter won't have loop invariant 13809motion optimization performed on them. 13810 13811@item loop-max-datarefs-for-datadeps 13812Building data dependencies is expensive for very large loops. This 13813parameter limits the number of data references in loops that are 13814considered for data dependence analysis. These large loops are no 13815handled by the optimizations using loop data dependencies. 13816 13817@item max-vartrack-size 13818Sets a maximum number of hash table slots to use during variable 13819tracking dataflow analysis of any function. If this limit is exceeded 13820with variable tracking at assignments enabled, analysis for that 13821function is retried without it, after removing all debug insns from 13822the function. If the limit is exceeded even without debug insns, var 13823tracking analysis is completely disabled for the function. Setting 13824the parameter to zero makes it unlimited. 13825 13826@item max-vartrack-expr-depth 13827Sets a maximum number of recursion levels when attempting to map 13828variable names or debug temporaries to value expressions. This trades 13829compilation time for more complete debug information. If this is set too 13830low, value expressions that are available and could be represented in 13831debug information may end up not being used; setting this higher may 13832enable the compiler to find more complex debug expressions, but compile 13833time and memory use may grow. 13834 13835@item max-debug-marker-count 13836Sets a threshold on the number of debug markers (e.g.@: begin stmt 13837markers) to avoid complexity explosion at inlining or expanding to RTL. 13838If a function has more such gimple stmts than the set limit, such stmts 13839will be dropped from the inlined copy of a function, and from its RTL 13840expansion. 13841 13842@item min-nondebug-insn-uid 13843Use uids starting at this parameter for nondebug insns. The range below 13844the parameter is reserved exclusively for debug insns created by 13845@option{-fvar-tracking-assignments}, but debug insns may get 13846(non-overlapping) uids above it if the reserved range is exhausted. 13847 13848@item ipa-sra-ptr-growth-factor 13849IPA-SRA replaces a pointer to an aggregate with one or more new 13850parameters only when their cumulative size is less or equal to 13851@option{ipa-sra-ptr-growth-factor} times the size of the original 13852pointer parameter. 13853 13854@item ipa-sra-max-replacements 13855Maximum pieces of an aggregate that IPA-SRA tracks. As a 13856consequence, it is also the maximum number of replacements of a formal 13857parameter. 13858 13859@item sra-max-scalarization-size-Ospeed 13860@itemx sra-max-scalarization-size-Osize 13861The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 13862replace scalar parts of aggregates with uses of independent scalar 13863variables. These parameters control the maximum size, in storage units, 13864of aggregate which is considered for replacement when compiling for 13865speed 13866(@option{sra-max-scalarization-size-Ospeed}) or size 13867(@option{sra-max-scalarization-size-Osize}) respectively. 13868 13869@item sra-max-propagations 13870The maximum number of artificial accesses that Scalar Replacement of 13871Aggregates (SRA) will track, per one local variable, in order to 13872facilitate copy propagation. 13873 13874@item tm-max-aggregate-size 13875When making copies of thread-local variables in a transaction, this 13876parameter specifies the size in bytes after which variables are 13877saved with the logging functions as opposed to save/restore code 13878sequence pairs. This option only applies when using 13879@option{-fgnu-tm}. 13880 13881@item graphite-max-nb-scop-params 13882To avoid exponential effects in the Graphite loop transforms, the 13883number of parameters in a Static Control Part (SCoP) is bounded. 13884A value of zero can be used to lift 13885the bound. A variable whose value is unknown at compilation time and 13886defined outside a SCoP is a parameter of the SCoP. 13887 13888@item loop-block-tile-size 13889Loop blocking or strip mining transforms, enabled with 13890@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 13891loop in the loop nest by a given number of iterations. The strip 13892length can be changed using the @option{loop-block-tile-size} 13893parameter. 13894 13895@item ipa-jump-function-lookups 13896Specifies number of statements visited during jump function offset discovery. 13897 13898@item ipa-cp-value-list-size 13899IPA-CP attempts to track all possible values and types passed to a function's 13900parameter in order to propagate them and perform devirtualization. 13901@option{ipa-cp-value-list-size} is the maximum number of values and types it 13902stores per one formal parameter of a function. 13903 13904@item ipa-cp-eval-threshold 13905IPA-CP calculates its own score of cloning profitability heuristics 13906and performs those cloning opportunities with scores that exceed 13907@option{ipa-cp-eval-threshold}. 13908 13909@item ipa-cp-max-recursive-depth 13910Maximum depth of recursive cloning for self-recursive function. 13911 13912@item ipa-cp-min-recursive-probability 13913Recursive cloning only when the probability of call being executed exceeds 13914the parameter. 13915 13916@item ipa-cp-recursion-penalty 13917Percentage penalty the recursive functions will receive when they 13918are evaluated for cloning. 13919 13920@item ipa-cp-single-call-penalty 13921Percentage penalty functions containing a single call to another 13922function will receive when they are evaluated for cloning. 13923 13924@item ipa-max-agg-items 13925IPA-CP is also capable to propagate a number of scalar values passed 13926in an aggregate. @option{ipa-max-agg-items} controls the maximum 13927number of such values per one parameter. 13928 13929@item ipa-cp-loop-hint-bonus 13930When IPA-CP determines that a cloning candidate would make the number 13931of iterations of a loop known, it adds a bonus of 13932@option{ipa-cp-loop-hint-bonus} to the profitability score of 13933the candidate. 13934 13935@item ipa-max-loop-predicates 13936The maximum number of different predicates IPA will use to describe when 13937loops in a function have known properties. 13938 13939@item ipa-max-aa-steps 13940During its analysis of function bodies, IPA-CP employs alias analysis 13941in order to track values pointed to by function parameters. In order 13942not spend too much time analyzing huge functions, it gives up and 13943consider all memory clobbered after examining 13944@option{ipa-max-aa-steps} statements modifying memory. 13945 13946@item ipa-max-switch-predicate-bounds 13947Maximal number of boundary endpoints of case ranges of switch statement. 13948For switch exceeding this limit, IPA-CP will not construct cloning cost 13949predicate, which is used to estimate cloning benefit, for default case 13950of the switch statement. 13951 13952@item ipa-max-param-expr-ops 13953IPA-CP will analyze conditional statement that references some function 13954parameter to estimate benefit for cloning upon certain constant value. 13955But if number of operations in a parameter expression exceeds 13956@option{ipa-max-param-expr-ops}, the expression is treated as complicated 13957one, and is not handled by IPA analysis. 13958 13959@item lto-partitions 13960Specify desired number of partitions produced during WHOPR compilation. 13961The number of partitions should exceed the number of CPUs used for compilation. 13962 13963@item lto-min-partition 13964Size of minimal partition for WHOPR (in estimated instructions). 13965This prevents expenses of splitting very small programs into too many 13966partitions. 13967 13968@item lto-max-partition 13969Size of max partition for WHOPR (in estimated instructions). 13970to provide an upper bound for individual size of partition. 13971Meant to be used only with balanced partitioning. 13972 13973@item lto-max-streaming-parallelism 13974Maximal number of parallel processes used for LTO streaming. 13975 13976@item cxx-max-namespaces-for-diagnostic-help 13977The maximum number of namespaces to consult for suggestions when C++ 13978name lookup fails for an identifier. 13979 13980@item sink-frequency-threshold 13981The maximum relative execution frequency (in percents) of the target block 13982relative to a statement's original block to allow statement sinking of a 13983statement. Larger numbers result in more aggressive statement sinking. 13984A small positive adjustment is applied for 13985statements with memory operands as those are even more profitable so sink. 13986 13987@item max-stores-to-sink 13988The maximum number of conditional store pairs that can be sunk. Set to 0 13989if either vectorization (@option{-ftree-vectorize}) or if-conversion 13990(@option{-ftree-loop-if-convert}) is disabled. 13991 13992@item case-values-threshold 13993The smallest number of different values for which it is best to use a 13994jump-table instead of a tree of conditional branches. If the value is 139950, use the default for the machine. 13996 13997@item jump-table-max-growth-ratio-for-size 13998The maximum code size growth ratio when expanding 13999into a jump table (in percent). The parameter is used when 14000optimizing for size. 14001 14002@item jump-table-max-growth-ratio-for-speed 14003The maximum code size growth ratio when expanding 14004into a jump table (in percent). The parameter is used when 14005optimizing for speed. 14006 14007@item tree-reassoc-width 14008Set the maximum number of instructions executed in parallel in 14009reassociated tree. This parameter overrides target dependent 14010heuristics used by default if has non zero value. 14011 14012@item sched-pressure-algorithm 14013Choose between the two available implementations of 14014@option{-fsched-pressure}. Algorithm 1 is the original implementation 14015and is the more likely to prevent instructions from being reordered. 14016Algorithm 2 was designed to be a compromise between the relatively 14017conservative approach taken by algorithm 1 and the rather aggressive 14018approach taken by the default scheduler. It relies more heavily on 14019having a regular register file and accurate register pressure classes. 14020See @file{haifa-sched.c} in the GCC sources for more details. 14021 14022The default choice depends on the target. 14023 14024@item max-slsr-cand-scan 14025Set the maximum number of existing candidates that are considered when 14026seeking a basis for a new straight-line strength reduction candidate. 14027 14028@item asan-globals 14029Enable buffer overflow detection for global objects. This kind 14030of protection is enabled by default if you are using 14031@option{-fsanitize=address} option. 14032To disable global objects protection use @option{--param asan-globals=0}. 14033 14034@item asan-stack 14035Enable buffer overflow detection for stack objects. This kind of 14036protection is enabled by default when using @option{-fsanitize=address}. 14037To disable stack protection use @option{--param asan-stack=0} option. 14038 14039@item asan-instrument-reads 14040Enable buffer overflow detection for memory reads. This kind of 14041protection is enabled by default when using @option{-fsanitize=address}. 14042To disable memory reads protection use 14043@option{--param asan-instrument-reads=0}. 14044 14045@item asan-instrument-writes 14046Enable buffer overflow detection for memory writes. This kind of 14047protection is enabled by default when using @option{-fsanitize=address}. 14048To disable memory writes protection use 14049@option{--param asan-instrument-writes=0} option. 14050 14051@item asan-memintrin 14052Enable detection for built-in functions. This kind of protection 14053is enabled by default when using @option{-fsanitize=address}. 14054To disable built-in functions protection use 14055@option{--param asan-memintrin=0}. 14056 14057@item asan-use-after-return 14058Enable detection of use-after-return. This kind of protection 14059is enabled by default when using the @option{-fsanitize=address} option. 14060To disable it use @option{--param asan-use-after-return=0}. 14061 14062Note: By default the check is disabled at run time. To enable it, 14063add @code{detect_stack_use_after_return=1} to the environment variable 14064@env{ASAN_OPTIONS}. 14065 14066@item asan-instrumentation-with-call-threshold 14067If number of memory accesses in function being instrumented 14068is greater or equal to this number, use callbacks instead of inline checks. 14069E.g. to disable inline code use 14070@option{--param asan-instrumentation-with-call-threshold=0}. 14071 14072@item hwasan-instrument-stack 14073Enable hwasan instrumentation of statically sized stack-allocated variables. 14074This kind of instrumentation is enabled by default when using 14075@option{-fsanitize=hwaddress} and disabled by default when using 14076@option{-fsanitize=kernel-hwaddress}. 14077To disable stack instrumentation use 14078@option{--param hwasan-instrument-stack=0}, and to enable it use 14079@option{--param hwasan-instrument-stack=1}. 14080 14081@item hwasan-random-frame-tag 14082When using stack instrumentation, decide tags for stack variables using a 14083deterministic sequence beginning at a random tag for each frame. With this 14084parameter unset tags are chosen using the same sequence but beginning from 1. 14085This is enabled by default for @option{-fsanitize=hwaddress} and unavailable 14086for @option{-fsanitize=kernel-hwaddress}. 14087To disable it use @option{--param hwasan-random-frame-tag=0}. 14088 14089@item hwasan-instrument-allocas 14090Enable hwasan instrumentation of dynamically sized stack-allocated variables. 14091This kind of instrumentation is enabled by default when using 14092@option{-fsanitize=hwaddress} and disabled by default when using 14093@option{-fsanitize=kernel-hwaddress}. 14094To disable instrumentation of such variables use 14095@option{--param hwasan-instrument-allocas=0}, and to enable it use 14096@option{--param hwasan-instrument-allocas=1}. 14097 14098@item hwasan-instrument-reads 14099Enable hwasan checks on memory reads. Instrumentation of reads is enabled by 14100default for both @option{-fsanitize=hwaddress} and 14101@option{-fsanitize=kernel-hwaddress}. 14102To disable checking memory reads use 14103@option{--param hwasan-instrument-reads=0}. 14104 14105@item hwasan-instrument-writes 14106Enable hwasan checks on memory writes. Instrumentation of writes is enabled by 14107default for both @option{-fsanitize=hwaddress} and 14108@option{-fsanitize=kernel-hwaddress}. 14109To disable checking memory writes use 14110@option{--param hwasan-instrument-writes=0}. 14111 14112@item hwasan-instrument-mem-intrinsics 14113Enable hwasan instrumentation of builtin functions. Instrumentation of these 14114builtin functions is enabled by default for both @option{-fsanitize=hwaddress} 14115and @option{-fsanitize=kernel-hwaddress}. 14116To disable instrumentation of builtin functions use 14117@option{--param hwasan-instrument-mem-intrinsics=0}. 14118 14119@item use-after-scope-direct-emission-threshold 14120If the size of a local variable in bytes is smaller or equal to this 14121number, directly poison (or unpoison) shadow memory instead of using 14122run-time callbacks. 14123 14124@item tsan-distinguish-volatile 14125Emit special instrumentation for accesses to volatiles. 14126 14127@item tsan-instrument-func-entry-exit 14128Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit(). 14129 14130@item max-fsm-thread-path-insns 14131Maximum number of instructions to copy when duplicating blocks on a 14132finite state automaton jump thread path. 14133 14134@item max-fsm-thread-length 14135Maximum number of basic blocks on a finite state automaton jump thread 14136path. 14137 14138@item max-fsm-thread-paths 14139Maximum number of new jump thread paths to create for a finite state 14140automaton. 14141 14142@item parloops-chunk-size 14143Chunk size of omp schedule for loops parallelized by parloops. 14144 14145@item parloops-schedule 14146Schedule type of omp schedule for loops parallelized by parloops (static, 14147dynamic, guided, auto, runtime). 14148 14149@item parloops-min-per-thread 14150The minimum number of iterations per thread of an innermost parallelized 14151loop for which the parallelized variant is preferred over the single threaded 14152one. Note that for a parallelized loop nest the 14153minimum number of iterations of the outermost loop per thread is two. 14154 14155@item max-ssa-name-query-depth 14156Maximum depth of recursion when querying properties of SSA names in things 14157like fold routines. One level of recursion corresponds to following a 14158use-def chain. 14159 14160@item max-speculative-devirt-maydefs 14161The maximum number of may-defs we analyze when looking for a must-def 14162specifying the dynamic type of an object that invokes a virtual call 14163we may be able to devirtualize speculatively. 14164 14165@item max-vrp-switch-assertions 14166The maximum number of assertions to add along the default edge of a switch 14167statement during VRP. 14168 14169@item evrp-mode 14170Specifies the mode Early VRP should operate in. 14171 14172@item unroll-jam-min-percent 14173The minimum percentage of memory references that must be optimized 14174away for the unroll-and-jam transformation to be considered profitable. 14175 14176@item unroll-jam-max-unroll 14177The maximum number of times the outer loop should be unrolled by 14178the unroll-and-jam transformation. 14179 14180@item max-rtl-if-conversion-unpredictable-cost 14181Maximum permissible cost for the sequence that would be generated 14182by the RTL if-conversion pass for a branch that is considered unpredictable. 14183 14184@item max-variable-expansions-in-unroller 14185If @option{-fvariable-expansion-in-unroller} is used, the maximum number 14186of times that an individual variable will be expanded during loop unrolling. 14187 14188@item tracer-min-branch-probability-feedback 14189Stop forward growth if the probability of best edge is less than 14190this threshold (in percent). Used when profile feedback is available. 14191 14192@item partial-inlining-entry-probability 14193Maximum probability of the entry BB of split region 14194(in percent relative to entry BB of the function) 14195to make partial inlining happen. 14196 14197@item max-tracked-strlens 14198Maximum number of strings for which strlen optimization pass will 14199track string lengths. 14200 14201@item gcse-after-reload-partial-fraction 14202The threshold ratio for performing partial redundancy 14203elimination after reload. 14204 14205@item gcse-after-reload-critical-fraction 14206The threshold ratio of critical edges execution count that 14207permit performing redundancy elimination after reload. 14208 14209@item max-loop-header-insns 14210The maximum number of insns in loop header duplicated 14211by the copy loop headers pass. 14212 14213@item vect-epilogues-nomask 14214Enable loop epilogue vectorization using smaller vector size. 14215 14216@item vect-partial-vector-usage 14217Controls when the loop vectorizer considers using partial vector loads 14218and stores as an alternative to falling back to scalar code. 0 stops 14219the vectorizer from ever using partial vector loads and stores. 1 allows 14220partial vector loads and stores if vectorization removes the need for the 14221code to iterate. 2 allows partial vector loads and stores in all loops. 14222The parameter only has an effect on targets that support partial 14223vector loads and stores. 14224 14225@item avoid-fma-max-bits 14226Maximum number of bits for which we avoid creating FMAs. 14227 14228@item sms-loop-average-count-threshold 14229A threshold on the average loop count considered by the swing modulo scheduler. 14230 14231@item sms-dfa-history 14232The number of cycles the swing modulo scheduler considers when checking 14233conflicts using DFA. 14234 14235@item max-inline-insns-recursive-auto 14236The maximum number of instructions non-inline function 14237can grow to via recursive inlining. 14238 14239@item graphite-allow-codegen-errors 14240Whether codegen errors should be ICEs when @option{-fchecking}. 14241 14242@item sms-max-ii-factor 14243A factor for tuning the upper bound that swing modulo scheduler 14244uses for scheduling a loop. 14245 14246@item lra-max-considered-reload-pseudos 14247The max number of reload pseudos which are considered during 14248spilling a non-reload pseudo. 14249 14250@item max-pow-sqrt-depth 14251Maximum depth of sqrt chains to use when synthesizing exponentiation 14252by a real constant. 14253 14254@item max-dse-active-local-stores 14255Maximum number of active local stores in RTL dead store elimination. 14256 14257@item asan-instrument-allocas 14258Enable asan allocas/VLAs protection. 14259 14260@item max-iterations-computation-cost 14261Bound on the cost of an expression to compute the number of iterations. 14262 14263@item max-isl-operations 14264Maximum number of isl operations, 0 means unlimited. 14265 14266@item graphite-max-arrays-per-scop 14267Maximum number of arrays per scop. 14268 14269@item max-vartrack-reverse-op-size 14270Max. size of loc list for which reverse ops should be added. 14271 14272@item tracer-dynamic-coverage-feedback 14273The percentage of function, weighted by execution frequency, 14274that must be covered by trace formation. 14275Used when profile feedback is available. 14276 14277@item max-inline-recursive-depth-auto 14278The maximum depth of recursive inlining for non-inline functions. 14279 14280@item fsm-scale-path-stmts 14281Scale factor to apply to the number of statements in a threading path 14282when comparing to the number of (scaled) blocks. 14283 14284@item fsm-maximum-phi-arguments 14285Maximum number of arguments a PHI may have before the FSM threader 14286will not try to thread through its block. 14287 14288@item uninit-control-dep-attempts 14289Maximum number of nested calls to search for control dependencies 14290during uninitialized variable analysis. 14291 14292@item sra-max-scalarization-size-Osize 14293Maximum size, in storage units, of an aggregate 14294which should be considered for scalarization when compiling for size. 14295 14296@item fsm-scale-path-blocks 14297Scale factor to apply to the number of blocks in a threading path 14298when comparing to the number of (scaled) statements. 14299 14300@item sched-autopref-queue-depth 14301Hardware autoprefetcher scheduler model control flag. 14302Number of lookahead cycles the model looks into; at ' 14303' only enable instruction sorting heuristic. 14304 14305@item loop-versioning-max-inner-insns 14306The maximum number of instructions that an inner loop can have 14307before the loop versioning pass considers it too big to copy. 14308 14309@item loop-versioning-max-outer-insns 14310The maximum number of instructions that an outer loop can have 14311before the loop versioning pass considers it too big to copy, 14312discounting any instructions in inner loops that directly benefit 14313from versioning. 14314 14315@item ssa-name-def-chain-limit 14316The maximum number of SSA_NAME assignments to follow in determining 14317a property of a variable such as its value. This limits the number 14318of iterations or recursive calls GCC performs when optimizing certain 14319statements or when determining their validity prior to issuing 14320diagnostics. 14321 14322@item store-merging-max-size 14323Maximum size of a single store merging region in bytes. 14324 14325@item hash-table-verification-limit 14326The number of elements for which hash table verification is done 14327for each searched element. 14328 14329@item max-find-base-term-values 14330Maximum number of VALUEs handled during a single find_base_term call. 14331 14332@item analyzer-max-enodes-per-program-point 14333The maximum number of exploded nodes per program point within 14334the analyzer, before terminating analysis of that point. 14335 14336@item analyzer-max-constraints 14337The maximum number of constraints per state. 14338 14339@item analyzer-min-snodes-for-call-summary 14340The minimum number of supernodes within a function for the 14341analyzer to consider summarizing its effects at call sites. 14342 14343@item analyzer-max-enodes-for-full-dump 14344The maximum depth of exploded nodes that should appear in a dot dump 14345before switching to a less verbose format. 14346 14347@item analyzer-max-recursion-depth 14348The maximum number of times a callsite can appear in a call stack 14349within the analyzer, before terminating analysis of a call that would 14350recurse deeper. 14351 14352@item analyzer-max-svalue-depth 14353The maximum depth of a symbolic value, before approximating 14354the value as unknown. 14355 14356@item analyzer-max-infeasible-edges 14357The maximum number of infeasible edges to reject before declaring 14358a diagnostic as infeasible. 14359 14360@item gimple-fe-computed-hot-bb-threshold 14361The number of executions of a basic block which is considered hot. 14362The parameter is used only in GIMPLE FE. 14363 14364@item analyzer-bb-explosion-factor 14365The maximum number of 'after supernode' exploded nodes within the analyzer 14366per supernode, before terminating analysis. 14367 14368@item ranger-logical-depth 14369Maximum depth of logical expression evaluation ranger will look through 14370when evaluating outgoing edge ranges. 14371 14372@item openacc-kernels 14373Specify mode of OpenACC `kernels' constructs handling. 14374With @option{--param=openacc-kernels=decompose}, OpenACC `kernels' 14375constructs are decomposed into parts, a sequence of compute 14376constructs, each then handled individually. 14377This is work in progress. 14378With @option{--param=openacc-kernels=parloops}, OpenACC `kernels' 14379constructs are handled by the @samp{parloops} pass, en bloc. 14380This is the current default. 14381 14382@end table 14383 14384The following choices of @var{name} are available on AArch64 targets: 14385 14386@table @gcctabopt 14387@item aarch64-sve-compare-costs 14388When vectorizing for SVE, consider using ``unpacked'' vectors for 14389smaller elements and use the cost model to pick the cheapest approach. 14390Also use the cost model to choose between SVE and Advanced SIMD vectorization. 14391 14392Using unpacked vectors includes storing smaller elements in larger 14393containers and accessing elements with extending loads and truncating 14394stores. 14395 14396@item aarch64-float-recp-precision 14397The number of Newton iterations for calculating the reciprocal for float type. 14398The precision of division is proportional to this param when division 14399approximation is enabled. The default value is 1. 14400 14401@item aarch64-double-recp-precision 14402The number of Newton iterations for calculating the reciprocal for double type. 14403The precision of division is propotional to this param when division 14404approximation is enabled. The default value is 2. 14405 14406@item aarch64-autovec-preference 14407Force an ISA selection strategy for auto-vectorization. Accepts values from 144080 to 4, inclusive. 14409@table @samp 14410@item 0 14411Use the default heuristics. 14412@item 1 14413Use only Advanced SIMD for auto-vectorization. 14414@item 2 14415Use only SVE for auto-vectorization. 14416@item 3 14417Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are 14418deemed equal. 14419@item 4 14420Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal. 14421@end table 14422The default value is 0. 14423 14424@item aarch64-loop-vect-issue-rate-niters 14425The tuning for some AArch64 CPUs tries to take both latencies and issue 14426rates into account when deciding whether a loop should be vectorized 14427using SVE, vectorized using Advanced SIMD, or not vectorized at all. 14428If this parameter is set to @var{n}, GCC will not use this heuristic 14429for loops that are known to execute in fewer than @var{n} Advanced 14430SIMD iterations. 14431 14432@end table 14433 14434@end table 14435 14436@node Instrumentation Options 14437@section Program Instrumentation Options 14438@cindex instrumentation options 14439@cindex program instrumentation options 14440@cindex run-time error checking options 14441@cindex profiling options 14442@cindex options, program instrumentation 14443@cindex options, run-time error checking 14444@cindex options, profiling 14445 14446GCC supports a number of command-line options that control adding 14447run-time instrumentation to the code it normally generates. 14448For example, one purpose of instrumentation is collect profiling 14449statistics for use in finding program hot spots, code coverage 14450analysis, or profile-guided optimizations. 14451Another class of program instrumentation is adding run-time checking 14452to detect programming errors like invalid pointer 14453dereferences or out-of-bounds array accesses, as well as deliberately 14454hostile attacks such as stack smashing or C++ vtable hijacking. 14455There is also a general hook which can be used to implement other 14456forms of tracing or function-level instrumentation for debug or 14457program analysis purposes. 14458 14459@table @gcctabopt 14460@cindex @command{prof} 14461@cindex @command{gprof} 14462@item -p 14463@itemx -pg 14464@opindex p 14465@opindex pg 14466Generate extra code to write profile information suitable for the 14467analysis program @command{prof} (for @option{-p}) or @command{gprof} 14468(for @option{-pg}). You must use this option when compiling 14469the source files you want data about, and you must also use it when 14470linking. 14471 14472You can use the function attribute @code{no_instrument_function} to 14473suppress profiling of individual functions when compiling with these options. 14474@xref{Common Function Attributes}. 14475 14476@item -fprofile-arcs 14477@opindex fprofile-arcs 14478Add code so that program flow @dfn{arcs} are instrumented. During 14479execution the program records how many times each branch and call is 14480executed and how many times it is taken or returns. On targets that support 14481constructors with priority support, profiling properly handles constructors, 14482destructors and C++ constructors (and destructors) of classes which are used 14483as a type of a global variable. 14484 14485When the compiled 14486program exits it saves this data to a file called 14487@file{@var{auxname}.gcda} for each source file. The data may be used for 14488profile-directed optimizations (@option{-fbranch-probabilities}), or for 14489test coverage analysis (@option{-ftest-coverage}). Each object file's 14490@var{auxname} is generated from the name of the output file, if 14491explicitly specified and it is not the final executable, otherwise it is 14492the basename of the source file. In both cases any suffix is removed 14493(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 14494@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 14495@xref{Cross-profiling}. 14496 14497@cindex @command{gcov} 14498@item --coverage 14499@opindex coverage 14500 14501This option is used to compile and link code instrumented for coverage 14502analysis. The option is a synonym for @option{-fprofile-arcs} 14503@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 14504linking). See the documentation for those options for more details. 14505 14506@itemize 14507 14508@item 14509Compile the source files with @option{-fprofile-arcs} plus optimization 14510and code generation options. For test coverage analysis, use the 14511additional @option{-ftest-coverage} option. You do not need to profile 14512every source file in a program. 14513 14514@item 14515Compile the source files additionally with @option{-fprofile-abs-path} 14516to create absolute path names in the @file{.gcno} files. This allows 14517@command{gcov} to find the correct sources in projects where compilations 14518occur with different working directories. 14519 14520@item 14521Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 14522(the latter implies the former). 14523 14524@item 14525Run the program on a representative workload to generate the arc profile 14526information. This may be repeated any number of times. You can run 14527concurrent instances of your program, and provided that the file system 14528supports locking, the data files will be correctly updated. Unless 14529a strict ISO C dialect option is in effect, @code{fork} calls are 14530detected and correctly handled without double counting. 14531 14532@item 14533For profile-directed optimizations, compile the source files again with 14534the same optimization and code generation options plus 14535@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 14536Control Optimization}). 14537 14538@item 14539For test coverage analysis, use @command{gcov} to produce human readable 14540information from the @file{.gcno} and @file{.gcda} files. Refer to the 14541@command{gcov} documentation for further information. 14542 14543@end itemize 14544 14545With @option{-fprofile-arcs}, for each function of your program GCC 14546creates a program flow graph, then finds a spanning tree for the graph. 14547Only arcs that are not on the spanning tree have to be instrumented: the 14548compiler adds code to count the number of times that these arcs are 14549executed. When an arc is the only exit or only entrance to a block, the 14550instrumentation code can be added to the block; otherwise, a new basic 14551block must be created to hold the instrumentation code. 14552 14553@need 2000 14554@item -ftest-coverage 14555@opindex ftest-coverage 14556Produce a notes file that the @command{gcov} code-coverage utility 14557(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 14558show program coverage. Each source file's note file is called 14559@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 14560above for a description of @var{auxname} and instructions on how to 14561generate test coverage data. Coverage data matches the source files 14562more closely if you do not optimize. 14563 14564@item -fprofile-abs-path 14565@opindex fprofile-abs-path 14566Automatically convert relative source file names to absolute path names 14567in the @file{.gcno} files. This allows @command{gcov} to find the correct 14568sources in projects where compilations occur with different working 14569directories. 14570 14571@item -fprofile-dir=@var{path} 14572@opindex fprofile-dir 14573 14574Set the directory to search for the profile data files in to @var{path}. 14575This option affects only the profile data generated by 14576@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 14577and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 14578and its related options. Both absolute and relative paths can be used. 14579By default, GCC uses the current directory as @var{path}, thus the 14580profile data file appears in the same directory as the object file. 14581In order to prevent the file name clashing, if the object file name is 14582not an absolute path, we mangle the absolute path of the 14583@file{@var{sourcename}.gcda} file and use it as the file name of a 14584@file{.gcda} file. See similar option @option{-fprofile-note}. 14585 14586When an executable is run in a massive parallel environment, it is recommended 14587to save profile to different folders. That can be done with variables 14588in @var{path} that are exported during run-time: 14589 14590@table @gcctabopt 14591 14592@item %p 14593process ID. 14594 14595@item %q@{VAR@} 14596value of environment variable @var{VAR} 14597 14598@end table 14599 14600@item -fprofile-generate 14601@itemx -fprofile-generate=@var{path} 14602@opindex fprofile-generate 14603 14604Enable options usually used for instrumenting application to produce 14605profile useful for later recompilation with profile feedback based 14606optimization. You must use @option{-fprofile-generate} both when 14607compiling and when linking your program. 14608 14609The following options are enabled: 14610@option{-fprofile-arcs}, @option{-fprofile-values}, 14611@option{-finline-functions}, and @option{-fipa-bit-cp}. 14612 14613If @var{path} is specified, GCC looks at the @var{path} to find 14614the profile feedback data files. See @option{-fprofile-dir}. 14615 14616To optimize the program based on the collected profile information, use 14617@option{-fprofile-use}. @xref{Optimize Options}, for more information. 14618 14619@item -fprofile-info-section 14620@itemx -fprofile-info-section=@var{name} 14621@opindex fprofile-info-section 14622 14623Register the profile information in the specified section instead of using a 14624constructor/destructor. The section name is @var{name} if it is specified, 14625otherwise the section name defaults to @code{.gcov_info}. A pointer to the 14626profile information generated by @option{-fprofile-arcs} or 14627@option{-ftest-coverage} is placed in the specified section for each 14628translation unit. This option disables the profile information registration 14629through a constructor and it disables the profile information processing 14630through a destructor. This option is not intended to be used in hosted 14631environments such as GNU/Linux. It targets systems with limited resources 14632which do not support constructors and destructors. The linker could collect 14633the input sections in a continuous memory block and define start and end 14634symbols. The runtime support could dump the profiling information registered 14635in this linker set during program termination to a serial line for example. A 14636GNU linker script example which defines a linker output section follows: 14637 14638@smallexample 14639 .gcov_info : 14640 @{ 14641 PROVIDE (__gcov_info_start = .); 14642 KEEP (*(.gcov_info)) 14643 PROVIDE (__gcov_info_end = .); 14644 @} 14645@end smallexample 14646 14647@item -fprofile-note=@var{path} 14648@opindex fprofile-note 14649 14650If @var{path} is specified, GCC saves @file{.gcno} file into @var{path} 14651location. If you combine the option with multiple source files, 14652the @file{.gcno} file will be overwritten. 14653 14654@item -fprofile-prefix-path=@var{path} 14655@opindex fprofile-prefix-path 14656 14657This option can be used in combination with 14658@option{profile-generate=}@var{profile_dir} and 14659@option{profile-use=}@var{profile_dir} to inform GCC where is the base 14660directory of built source tree. By default @var{profile_dir} will contain 14661files with mangled absolute paths of all object files in the built project. 14662This is not desirable when directory used to build the instrumented binary 14663differs from the directory used to build the binary optimized with profile 14664feedback because the profile data will not be found during the optimized build. 14665In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path} 14666pointing to the base directory of the build can be used to strip the irrelevant 14667part of the path and keep all file names relative to the main build directory. 14668 14669@item -fprofile-update=@var{method} 14670@opindex fprofile-update 14671 14672Alter the update method for an application instrumented for profile 14673feedback based optimization. The @var{method} argument should be one of 14674@samp{single}, @samp{atomic} or @samp{prefer-atomic}. 14675The first one is useful for single-threaded applications, 14676while the second one prevents profile corruption by emitting thread-safe code. 14677 14678@strong{Warning:} When an application does not properly join all threads 14679(or creates an detached thread), a profile file can be still corrupted. 14680 14681Using @samp{prefer-atomic} would be transformed either to @samp{atomic}, 14682when supported by a target, or to @samp{single} otherwise. The GCC driver 14683automatically selects @samp{prefer-atomic} when @option{-pthread} 14684is present in the command line. 14685 14686@item -fprofile-filter-files=@var{regex} 14687@opindex fprofile-filter-files 14688 14689Instrument only functions from files whose name matches 14690any of the regular expressions (separated by semi-colons). 14691 14692For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument 14693only @file{main.c} and all C files starting with 'module'. 14694 14695@item -fprofile-exclude-files=@var{regex} 14696@opindex fprofile-exclude-files 14697 14698Instrument only functions from files whose name does not match 14699any of the regular expressions (separated by semi-colons). 14700 14701For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation 14702of all files that are located in the @file{/usr/} folder. 14703 14704@item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} 14705@opindex fprofile-reproducible 14706Control level of reproducibility of profile gathered by 14707@code{-fprofile-generate}. This makes it possible to rebuild program 14708with same outcome which is useful, for example, for distribution 14709packages. 14710 14711With @option{-fprofile-reproducible=serial} the profile gathered by 14712@option{-fprofile-generate} is reproducible provided the trained program 14713behaves the same at each invocation of the train run, it is not 14714multi-threaded and profile data streaming is always done in the same 14715order. Note that profile streaming happens at the end of program run but 14716also before @code{fork} function is invoked. 14717 14718Note that it is quite common that execution counts of some part of 14719programs depends, for example, on length of temporary file names or 14720memory space randomization (that may affect hash-table collision rate). 14721Such non-reproducible part of programs may be annotated by 14722@code{no_instrument_function} function attribute. @command{gcov-dump} with 14723@option{-l} can be used to dump gathered data and verify that they are 14724indeed reproducible. 14725 14726With @option{-fprofile-reproducible=parallel-runs} collected profile 14727stays reproducible regardless the order of streaming of the data into 14728gcda files. This setting makes it possible to run multiple instances of 14729instrumented program in parallel (such as with @code{make -j}). This 14730reduces quality of gathered data, in particular of indirect call 14731profiling. 14732 14733@item -fsanitize=address 14734@opindex fsanitize=address 14735Enable AddressSanitizer, a fast memory error detector. 14736Memory access instructions are instrumented to detect 14737out-of-bounds and use-after-free bugs. 14738The option enables @option{-fsanitize-address-use-after-scope}. 14739See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 14740more details. The run-time behavior can be influenced using the 14741@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 14742the available options are shown at startup of the instrumented program. See 14743@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 14744for a list of supported options. 14745The option cannot be combined with @option{-fsanitize=thread} or 14746@option{-fsanitize=hwaddress}. Note that the only target 14747@option{-fsanitize=hwaddress} is currently supported on is AArch64. 14748 14749@item -fsanitize=kernel-address 14750@opindex fsanitize=kernel-address 14751Enable AddressSanitizer for Linux kernel. 14752See @uref{https://github.com/google/kasan} for more details. 14753 14754@item -fsanitize=hwaddress 14755@opindex fsanitize=hwaddress 14756Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to 14757ignore the top byte of a pointer to allow the detection of memory errors with 14758a low memory overhead. 14759Memory access instructions are instrumented to detect out-of-bounds and 14760use-after-free bugs. 14761The option enables @option{-fsanitize-address-use-after-scope}. 14762See 14763@uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html} 14764for more details. The run-time behavior can be influenced using the 14765@env{HWASAN_OPTIONS} environment variable. When set to @code{help=1}, 14766the available options are shown at startup of the instrumented program. 14767The option cannot be combined with @option{-fsanitize=thread} or 14768@option{-fsanitize=address}, and is currently only available on AArch64. 14769 14770@item -fsanitize=kernel-hwaddress 14771@opindex fsanitize=kernel-hwaddress 14772Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel. 14773Similar to @option{-fsanitize=kernel-address} but using an alternate 14774instrumentation method, and similar to @option{-fsanitize=hwaddress} but with 14775instrumentation differences necessary for compiling the Linux kernel. 14776These differences are to avoid hwasan library initialization calls and to 14777account for the stack pointer having a different value in its top byte. 14778 14779@emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}. 14780Instrumenting the stack and alloca calls are not on by default but are still 14781possible by specifying the command-line options 14782@option{--param hwasan-instrument-stack=1} and 14783@option{--param hwasan-instrument-allocas=1} respectively. Using a random frame 14784tag is not implemented for kernel instrumentation. 14785 14786@item -fsanitize=pointer-compare 14787@opindex fsanitize=pointer-compare 14788Instrument comparison operation (<, <=, >, >=) with pointer operands. 14789The option must be combined with either @option{-fsanitize=kernel-address} or 14790@option{-fsanitize=address} 14791The option cannot be combined with @option{-fsanitize=thread}. 14792Note: By default the check is disabled at run time. To enable it, 14793add @code{detect_invalid_pointer_pairs=2} to the environment variable 14794@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 14795invalid operation only when both pointers are non-null. 14796 14797@item -fsanitize=pointer-subtract 14798@opindex fsanitize=pointer-subtract 14799Instrument subtraction with pointer operands. 14800The option must be combined with either @option{-fsanitize=kernel-address} or 14801@option{-fsanitize=address} 14802The option cannot be combined with @option{-fsanitize=thread}. 14803Note: By default the check is disabled at run time. To enable it, 14804add @code{detect_invalid_pointer_pairs=2} to the environment variable 14805@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 14806invalid operation only when both pointers are non-null. 14807 14808@item -fsanitize=thread 14809@opindex fsanitize=thread 14810Enable ThreadSanitizer, a fast data race detector. 14811Memory access instructions are instrumented to detect 14812data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 14813details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 14814environment variable; see 14815@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 14816supported options. 14817The option cannot be combined with @option{-fsanitize=address}, 14818@option{-fsanitize=leak}. 14819 14820Note that sanitized atomic builtins cannot throw exceptions when 14821operating on invalid memory addresses with non-call exceptions 14822(@option{-fnon-call-exceptions}). 14823 14824@item -fsanitize=leak 14825@opindex fsanitize=leak 14826Enable LeakSanitizer, a memory leak detector. 14827This option only matters for linking of executables and 14828the executable is linked against a library that overrides @code{malloc} 14829and other allocator functions. See 14830@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 14831details. The run-time behavior can be influenced using the 14832@env{LSAN_OPTIONS} environment variable. 14833The option cannot be combined with @option{-fsanitize=thread}. 14834 14835@item -fsanitize=undefined 14836@opindex fsanitize=undefined 14837Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 14838Various computations are instrumented to detect undefined behavior 14839at runtime. Current suboptions are: 14840 14841@table @gcctabopt 14842 14843@item -fsanitize=shift 14844@opindex fsanitize=shift 14845This option enables checking that the result of a shift operation is 14846not undefined. Note that what exactly is considered undefined differs 14847slightly between C and C++, as well as between ISO C90 and C99, etc. 14848This option has two suboptions, @option{-fsanitize=shift-base} and 14849@option{-fsanitize=shift-exponent}. 14850 14851@item -fsanitize=shift-exponent 14852@opindex fsanitize=shift-exponent 14853This option enables checking that the second argument of a shift operation 14854is not negative and is smaller than the precision of the promoted first 14855argument. 14856 14857@item -fsanitize=shift-base 14858@opindex fsanitize=shift-base 14859If the second argument of a shift operation is within range, check that the 14860result of a shift operation is not undefined. Note that what exactly is 14861considered undefined differs slightly between C and C++, as well as between 14862ISO C90 and C99, etc. 14863 14864@item -fsanitize=integer-divide-by-zero 14865@opindex fsanitize=integer-divide-by-zero 14866Detect integer division by zero as well as @code{INT_MIN / -1} division. 14867 14868@item -fsanitize=unreachable 14869@opindex fsanitize=unreachable 14870With this option, the compiler turns the @code{__builtin_unreachable} 14871call into a diagnostics message call instead. When reaching the 14872@code{__builtin_unreachable} call, the behavior is undefined. 14873 14874@item -fsanitize=vla-bound 14875@opindex fsanitize=vla-bound 14876This option instructs the compiler to check that the size of a variable 14877length array is positive. 14878 14879@item -fsanitize=null 14880@opindex fsanitize=null 14881This option enables pointer checking. Particularly, the application 14882built with this option turned on will issue an error message when it 14883tries to dereference a NULL pointer, or if a reference (possibly an 14884rvalue reference) is bound to a NULL pointer, or if a method is invoked 14885on an object pointed by a NULL pointer. 14886 14887@item -fsanitize=return 14888@opindex fsanitize=return 14889This option enables return statement checking. Programs 14890built with this option turned on will issue an error message 14891when the end of a non-void function is reached without actually 14892returning a value. This option works in C++ only. 14893 14894@item -fsanitize=signed-integer-overflow 14895@opindex fsanitize=signed-integer-overflow 14896This option enables signed integer overflow checking. We check that 14897the result of @code{+}, @code{*}, and both unary and binary @code{-} 14898does not overflow in the signed arithmetics. Note, integer promotion 14899rules must be taken into account. That is, the following is not an 14900overflow: 14901@smallexample 14902signed char a = SCHAR_MAX; 14903a++; 14904@end smallexample 14905 14906@item -fsanitize=bounds 14907@opindex fsanitize=bounds 14908This option enables instrumentation of array bounds. Various out of bounds 14909accesses are detected. Flexible array members, flexible array member-like 14910arrays, and initializers of variables with static storage are not instrumented. 14911 14912@item -fsanitize=bounds-strict 14913@opindex fsanitize=bounds-strict 14914This option enables strict instrumentation of array bounds. Most out of bounds 14915accesses are detected, including flexible array members and flexible array 14916member-like arrays. Initializers of variables with static storage are not 14917instrumented. 14918 14919@item -fsanitize=alignment 14920@opindex fsanitize=alignment 14921 14922This option enables checking of alignment of pointers when they are 14923dereferenced, or when a reference is bound to insufficiently aligned target, 14924or when a method or constructor is invoked on insufficiently aligned object. 14925 14926@item -fsanitize=object-size 14927@opindex fsanitize=object-size 14928This option enables instrumentation of memory references using the 14929@code{__builtin_object_size} function. Various out of bounds pointer 14930accesses are detected. 14931 14932@item -fsanitize=float-divide-by-zero 14933@opindex fsanitize=float-divide-by-zero 14934Detect floating-point division by zero. Unlike other similar options, 14935@option{-fsanitize=float-divide-by-zero} is not enabled by 14936@option{-fsanitize=undefined}, since floating-point division by zero can 14937be a legitimate way of obtaining infinities and NaNs. 14938 14939@item -fsanitize=float-cast-overflow 14940@opindex fsanitize=float-cast-overflow 14941This option enables floating-point type to integer conversion checking. 14942We check that the result of the conversion does not overflow. 14943Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 14944not enabled by @option{-fsanitize=undefined}. 14945This option does not work well with @code{FE_INVALID} exceptions enabled. 14946 14947@item -fsanitize=nonnull-attribute 14948@opindex fsanitize=nonnull-attribute 14949 14950This option enables instrumentation of calls, checking whether null values 14951are not passed to arguments marked as requiring a non-null value by the 14952@code{nonnull} function attribute. 14953 14954@item -fsanitize=returns-nonnull-attribute 14955@opindex fsanitize=returns-nonnull-attribute 14956 14957This option enables instrumentation of return statements in functions 14958marked with @code{returns_nonnull} function attribute, to detect returning 14959of null values from such functions. 14960 14961@item -fsanitize=bool 14962@opindex fsanitize=bool 14963 14964This option enables instrumentation of loads from bool. If a value other 14965than 0/1 is loaded, a run-time error is issued. 14966 14967@item -fsanitize=enum 14968@opindex fsanitize=enum 14969 14970This option enables instrumentation of loads from an enum type. If 14971a value outside the range of values for the enum type is loaded, 14972a run-time error is issued. 14973 14974@item -fsanitize=vptr 14975@opindex fsanitize=vptr 14976 14977This option enables instrumentation of C++ member function calls, member 14978accesses and some conversions between pointers to base and derived classes, 14979to verify the referenced object has the correct dynamic type. 14980 14981@item -fsanitize=pointer-overflow 14982@opindex fsanitize=pointer-overflow 14983 14984This option enables instrumentation of pointer arithmetics. If the pointer 14985arithmetics overflows, a run-time error is issued. 14986 14987@item -fsanitize=builtin 14988@opindex fsanitize=builtin 14989 14990This option enables instrumentation of arguments to selected builtin 14991functions. If an invalid value is passed to such arguments, a run-time 14992error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz} 14993or @code{__builtin_clz} invokes undefined behavior and is diagnosed 14994by this option. 14995 14996@end table 14997 14998While @option{-ftrapv} causes traps for signed overflows to be emitted, 14999@option{-fsanitize=undefined} gives a diagnostic message. 15000This currently works only for the C family of languages. 15001 15002@item -fno-sanitize=all 15003@opindex fno-sanitize=all 15004 15005This option disables all previously enabled sanitizers. 15006@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 15007together. 15008 15009@item -fasan-shadow-offset=@var{number} 15010@opindex fasan-shadow-offset 15011This option forces GCC to use custom shadow offset in AddressSanitizer checks. 15012It is useful for experimenting with different shadow memory layouts in 15013Kernel AddressSanitizer. 15014 15015@item -fsanitize-sections=@var{s1},@var{s2},... 15016@opindex fsanitize-sections 15017Sanitize global variables in selected user-defined sections. @var{si} may 15018contain wildcards. 15019 15020@item -fsanitize-recover@r{[}=@var{opts}@r{]} 15021@opindex fsanitize-recover 15022@opindex fno-sanitize-recover 15023@option{-fsanitize-recover=} controls error recovery mode for sanitizers 15024mentioned in comma-separated list of @var{opts}. Enabling this option 15025for a sanitizer component causes it to attempt to continue 15026running the program as if no error happened. This means multiple 15027runtime errors can be reported in a single program run, and the exit 15028code of the program may indicate success even when errors 15029have been reported. The @option{-fno-sanitize-recover=} option 15030can be used to alter 15031this behavior: only the first detected error is reported 15032and program then exits with a non-zero exit code. 15033 15034Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 15035except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 15036@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero}, 15037@option{-fsanitize=bounds-strict}, 15038@option{-fsanitize=kernel-address} and @option{-fsanitize=address}. 15039For these sanitizers error recovery is turned on by default, 15040except @option{-fsanitize=address}, for which this feature is experimental. 15041@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 15042accepted, the former enables recovery for all sanitizers that support it, 15043the latter disables recovery for all sanitizers that support it. 15044 15045Even if a recovery mode is turned on the compiler side, it needs to be also 15046enabled on the runtime library side, otherwise the failures are still fatal. 15047The runtime library defaults to @code{halt_on_error=0} for 15048ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for 15049AddressSanitizer is @code{halt_on_error=1}. This can be overridden through 15050setting the @code{halt_on_error} flag in the corresponding environment variable. 15051 15052Syntax without an explicit @var{opts} parameter is deprecated. It is 15053equivalent to specifying an @var{opts} list of: 15054 15055@smallexample 15056undefined,float-cast-overflow,float-divide-by-zero,bounds-strict 15057@end smallexample 15058 15059@item -fsanitize-address-use-after-scope 15060@opindex fsanitize-address-use-after-scope 15061Enable sanitization of local variables to detect use-after-scope bugs. 15062The option sets @option{-fstack-reuse} to @samp{none}. 15063 15064@item -fsanitize-undefined-trap-on-error 15065@opindex fsanitize-undefined-trap-on-error 15066The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 15067report undefined behavior using @code{__builtin_trap} rather than 15068a @code{libubsan} library routine. The advantage of this is that the 15069@code{libubsan} library is not needed and is not linked in, so this 15070is usable even in freestanding environments. 15071 15072@item -fsanitize-coverage=trace-pc 15073@opindex fsanitize-coverage=trace-pc 15074Enable coverage-guided fuzzing code instrumentation. 15075Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block. 15076 15077@item -fsanitize-coverage=trace-cmp 15078@opindex fsanitize-coverage=trace-cmp 15079Enable dataflow guided fuzzing code instrumentation. 15080Inserts a call to @code{__sanitizer_cov_trace_cmp1}, 15081@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or 15082@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands 15083variable or @code{__sanitizer_cov_trace_const_cmp1}, 15084@code{__sanitizer_cov_trace_const_cmp2}, 15085@code{__sanitizer_cov_trace_const_cmp4} or 15086@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one 15087operand constant, @code{__sanitizer_cov_trace_cmpf} or 15088@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and 15089@code{__sanitizer_cov_trace_switch} for switch statements. 15090 15091@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} 15092@opindex fcf-protection 15093Enable code instrumentation of control-flow transfers to increase 15094program security by checking that target addresses of control-flow 15095transfer instructions (such as indirect function call, function return, 15096indirect jump) are valid. This prevents diverting the flow of control 15097to an unexpected target. This is intended to protect against such 15098threats as Return-oriented Programming (ROP), and similarly 15099call/jmp-oriented programming (COP/JOP). 15100 15101The value @code{branch} tells the compiler to implement checking of 15102validity of control-flow transfer at the point of indirect branch 15103instructions, i.e.@: call/jmp instructions. The value @code{return} 15104implements checking of validity at the point of returning from a 15105function. The value @code{full} is an alias for specifying both 15106@code{branch} and @code{return}. The value @code{none} turns off 15107instrumentation. 15108 15109The value @code{check} is used for the final link with link-time 15110optimization (LTO). An error is issued if LTO object files are 15111compiled with different @option{-fcf-protection} values. The 15112value @code{check} is ignored at the compile time. 15113 15114The macro @code{__CET__} is defined when @option{-fcf-protection} is 15115used. The first bit of @code{__CET__} is set to 1 for the value 15116@code{branch} and the second bit of @code{__CET__} is set to 1 for 15117the @code{return}. 15118 15119You can also use the @code{nocf_check} attribute to identify 15120which functions and calls should be skipped from instrumentation 15121(@pxref{Function Attributes}). 15122 15123Currently the x86 GNU/Linux target provides an implementation based 15124on Intel Control-flow Enforcement Technology (CET). 15125 15126@item -fstack-protector 15127@opindex fstack-protector 15128Emit extra code to check for buffer overflows, such as stack smashing 15129attacks. This is done by adding a guard variable to functions with 15130vulnerable objects. This includes functions that call @code{alloca}, and 15131functions with buffers larger than or equal to 8 bytes. The guards are 15132initialized when a function is entered and then checked when the function 15133exits. If a guard check fails, an error message is printed and the program 15134exits. Only variables that are actually allocated on the stack are 15135considered, optimized away variables or variables allocated in registers 15136don't count. 15137 15138@item -fstack-protector-all 15139@opindex fstack-protector-all 15140Like @option{-fstack-protector} except that all functions are protected. 15141 15142@item -fstack-protector-strong 15143@opindex fstack-protector-strong 15144Like @option{-fstack-protector} but includes additional functions to 15145be protected --- those that have local array definitions, or have 15146references to local frame addresses. Only variables that are actually 15147allocated on the stack are considered, optimized away variables or variables 15148allocated in registers don't count. 15149 15150@item -fstack-protector-explicit 15151@opindex fstack-protector-explicit 15152Like @option{-fstack-protector} but only protects those functions which 15153have the @code{stack_protect} attribute. 15154 15155@item -fstack-check 15156@opindex fstack-check 15157Generate code to verify that you do not go beyond the boundary of the 15158stack. You should specify this flag if you are running in an 15159environment with multiple threads, but you only rarely need to specify it in 15160a single-threaded environment since stack overflow is automatically 15161detected on nearly all systems if there is only one stack. 15162 15163Note that this switch does not actually cause checking to be done; the 15164operating system or the language runtime must do that. The switch causes 15165generation of code to ensure that they see the stack being extended. 15166 15167You can additionally specify a string parameter: @samp{no} means no 15168checking, @samp{generic} means force the use of old-style checking, 15169@samp{specific} means use the best checking method and is equivalent 15170to bare @option{-fstack-check}. 15171 15172Old-style checking is a generic mechanism that requires no specific 15173target support in the compiler but comes with the following drawbacks: 15174 15175@enumerate 15176@item 15177Modified allocation strategy for large objects: they are always 15178allocated dynamically if their size exceeds a fixed threshold. Note this 15179may change the semantics of some code. 15180 15181@item 15182Fixed limit on the size of the static frame of functions: when it is 15183topped by a particular function, stack checking is not reliable and 15184a warning is issued by the compiler. 15185 15186@item 15187Inefficiency: because of both the modified allocation strategy and the 15188generic implementation, code performance is hampered. 15189@end enumerate 15190 15191Note that old-style stack checking is also the fallback method for 15192@samp{specific} if no target support has been added in the compiler. 15193 15194@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion 15195and stack overflows. @samp{specific} is an excellent choice when compiling 15196Ada code. It is not generally sufficient to protect against stack-clash 15197attacks. To protect against those you want @samp{-fstack-clash-protection}. 15198 15199@item -fstack-clash-protection 15200@opindex fstack-clash-protection 15201Generate code to prevent stack clash style attacks. When this option is 15202enabled, the compiler will only allocate one page of stack space at a time 15203and each page is accessed immediately after allocation. Thus, it prevents 15204allocations from jumping over any stack guard page provided by the 15205operating system. 15206 15207Most targets do not fully support stack clash protection. However, on 15208those targets @option{-fstack-clash-protection} will protect dynamic stack 15209allocations. @option{-fstack-clash-protection} may also provide limited 15210protection for static stack allocations if the target supports 15211@option{-fstack-check=specific}. 15212 15213@item -fstack-limit-register=@var{reg} 15214@itemx -fstack-limit-symbol=@var{sym} 15215@itemx -fno-stack-limit 15216@opindex fstack-limit-register 15217@opindex fstack-limit-symbol 15218@opindex fno-stack-limit 15219Generate code to ensure that the stack does not grow beyond a certain value, 15220either the value of a register or the address of a symbol. If a larger 15221stack is required, a signal is raised at run time. For most targets, 15222the signal is raised before the stack overruns the boundary, so 15223it is possible to catch the signal without taking special precautions. 15224 15225For instance, if the stack starts at absolute address @samp{0x80000000} 15226and grows downwards, you can use the flags 15227@option{-fstack-limit-symbol=__stack_limit} and 15228@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 15229of 128KB@. Note that this may only work with the GNU linker. 15230 15231You can locally override stack limit checking by using the 15232@code{no_stack_limit} function attribute (@pxref{Function Attributes}). 15233 15234@item -fsplit-stack 15235@opindex fsplit-stack 15236Generate code to automatically split the stack before it overflows. 15237The resulting program has a discontiguous stack which can only 15238overflow if the program is unable to allocate any more memory. This 15239is most useful when running threaded programs, as it is no longer 15240necessary to calculate a good stack size to use for each thread. This 15241is currently only implemented for the x86 targets running 15242GNU/Linux. 15243 15244When code compiled with @option{-fsplit-stack} calls code compiled 15245without @option{-fsplit-stack}, there may not be much stack space 15246available for the latter code to run. If compiling all code, 15247including library code, with @option{-fsplit-stack} is not an option, 15248then the linker can fix up these calls so that the code compiled 15249without @option{-fsplit-stack} always has a large stack. Support for 15250this is implemented in the gold linker in GNU binutils release 2.21 15251and later. 15252 15253@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 15254@opindex fvtable-verify 15255This option is only available when compiling C++ code. 15256It turns on (or off, if using @option{-fvtable-verify=none}) the security 15257feature that verifies at run time, for every virtual call, that 15258the vtable pointer through which the call is made is valid for the type of 15259the object, and has not been corrupted or overwritten. If an invalid vtable 15260pointer is detected at run time, an error is reported and execution of the 15261program is immediately halted. 15262 15263This option causes run-time data structures to be built at program startup, 15264which are used for verifying the vtable pointers. 15265The options @samp{std} and @samp{preinit} 15266control the timing of when these data structures are built. In both cases the 15267data structures are built before execution reaches @code{main}. Using 15268@option{-fvtable-verify=std} causes the data structures to be built after 15269shared libraries have been loaded and initialized. 15270@option{-fvtable-verify=preinit} causes them to be built before shared 15271libraries have been loaded and initialized. 15272 15273If this option appears multiple times in the command line with different 15274values specified, @samp{none} takes highest priority over both @samp{std} and 15275@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 15276 15277@item -fvtv-debug 15278@opindex fvtv-debug 15279When used in conjunction with @option{-fvtable-verify=std} or 15280@option{-fvtable-verify=preinit}, causes debug versions of the 15281runtime functions for the vtable verification feature to be called. 15282This flag also causes the compiler to log information about which 15283vtable pointers it finds for each class. 15284This information is written to a file named @file{vtv_set_ptr_data.log} 15285in the directory named by the environment variable @env{VTV_LOGS_DIR} 15286if that is defined or the current working directory otherwise. 15287 15288Note: This feature @emph{appends} data to the log file. If you want a fresh log 15289file, be sure to delete any existing one. 15290 15291@item -fvtv-counts 15292@opindex fvtv-counts 15293This is a debugging flag. When used in conjunction with 15294@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 15295causes the compiler to keep track of the total number of virtual calls 15296it encounters and the number of verifications it inserts. It also 15297counts the number of calls to certain run-time library functions 15298that it inserts and logs this information for each compilation unit. 15299The compiler writes this information to a file named 15300@file{vtv_count_data.log} in the directory named by the environment 15301variable @env{VTV_LOGS_DIR} if that is defined or the current working 15302directory otherwise. It also counts the size of the vtable pointer sets 15303for each class, and writes this information to @file{vtv_class_set_sizes.log} 15304in the same directory. 15305 15306Note: This feature @emph{appends} data to the log files. To get fresh log 15307files, be sure to delete any existing ones. 15308 15309@item -finstrument-functions 15310@opindex finstrument-functions 15311Generate instrumentation calls for entry and exit to functions. Just 15312after function entry and just before function exit, the following 15313profiling functions are called with the address of the current 15314function and its call site. (On some platforms, 15315@code{__builtin_return_address} does not work beyond the current 15316function, so the call site information may not be available to the 15317profiling functions otherwise.) 15318 15319@smallexample 15320void __cyg_profile_func_enter (void *this_fn, 15321 void *call_site); 15322void __cyg_profile_func_exit (void *this_fn, 15323 void *call_site); 15324@end smallexample 15325 15326The first argument is the address of the start of the current function, 15327which may be looked up exactly in the symbol table. 15328 15329This instrumentation is also done for functions expanded inline in other 15330functions. The profiling calls indicate where, conceptually, the 15331inline function is entered and exited. This means that addressable 15332versions of such functions must be available. If all your uses of a 15333function are expanded inline, this may mean an additional expansion of 15334code size. If you use @code{extern inline} in your C code, an 15335addressable version of such functions must be provided. (This is 15336normally the case anyway, but if you get lucky and the optimizer always 15337expands the functions inline, you might have gotten away without 15338providing static copies.) 15339 15340A function may be given the attribute @code{no_instrument_function}, in 15341which case this instrumentation is not done. This can be used, for 15342example, for the profiling functions listed above, high-priority 15343interrupt routines, and any functions from which the profiling functions 15344cannot safely be called (perhaps signal handlers, if the profiling 15345routines generate output or allocate memory). 15346@xref{Common Function Attributes}. 15347 15348@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 15349@opindex finstrument-functions-exclude-file-list 15350 15351Set the list of functions that are excluded from instrumentation (see 15352the description of @option{-finstrument-functions}). If the file that 15353contains a function definition matches with one of @var{file}, then 15354that function is not instrumented. The match is done on substrings: 15355if the @var{file} parameter is a substring of the file name, it is 15356considered to be a match. 15357 15358For example: 15359 15360@smallexample 15361-finstrument-functions-exclude-file-list=/bits/stl,include/sys 15362@end smallexample 15363 15364@noindent 15365excludes any inline function defined in files whose pathnames 15366contain @file{/bits/stl} or @file{include/sys}. 15367 15368If, for some reason, you want to include letter @samp{,} in one of 15369@var{sym}, write @samp{\,}. For example, 15370@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 15371(note the single quote surrounding the option). 15372 15373@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 15374@opindex finstrument-functions-exclude-function-list 15375 15376This is similar to @option{-finstrument-functions-exclude-file-list}, 15377but this option sets the list of function names to be excluded from 15378instrumentation. The function name to be matched is its user-visible 15379name, such as @code{vector<int> blah(const vector<int> &)}, not the 15380internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 15381match is done on substrings: if the @var{sym} parameter is a substring 15382of the function name, it is considered to be a match. For C99 and C++ 15383extended identifiers, the function name must be given in UTF-8, not 15384using universal character names. 15385 15386@item -fpatchable-function-entry=@var{N}[,@var{M}] 15387@opindex fpatchable-function-entry 15388Generate @var{N} NOPs right at the beginning 15389of each function, with the function entry point before the @var{M}th NOP. 15390If @var{M} is omitted, it defaults to @code{0} so the 15391function entry points to the address just at the first NOP. 15392The NOP instructions reserve extra space which can be used to patch in 15393any desired instrumentation at run time, provided that the code segment 15394is writable. The amount of space is controllable indirectly via 15395the number of NOPs; the NOP instruction used corresponds to the instruction 15396emitted by the internal GCC back-end interface @code{gen_nop}. This behavior 15397is target-specific and may also depend on the architecture variant and/or 15398other compilation options. 15399 15400For run-time identification, the starting addresses of these areas, 15401which correspond to their respective function entries minus @var{M}, 15402are additionally collected in the @code{__patchable_function_entries} 15403section of the resulting binary. 15404 15405Note that the value of @code{__attribute__ ((patchable_function_entry 15406(N,M)))} takes precedence over command-line option 15407@option{-fpatchable-function-entry=N,M}. This can be used to increase 15408the area size or to remove it completely on a single function. 15409If @code{N=0}, no pad location is recorded. 15410 15411The NOP instructions are inserted at---and maybe before, depending on 15412@var{M}---the function entry address, even before the prologue. 15413 15414The maximum value of @var{N} and @var{M} is 65535. 15415@end table 15416 15417 15418@node Preprocessor Options 15419@section Options Controlling the Preprocessor 15420@cindex preprocessor options 15421@cindex options, preprocessor 15422 15423These options control the C preprocessor, which is run on each C source 15424file before actual compilation. 15425 15426If you use the @option{-E} option, nothing is done except preprocessing. 15427Some of these options make sense only together with @option{-E} because 15428they cause the preprocessor output to be unsuitable for actual 15429compilation. 15430 15431In addition to the options listed here, there are a number of options 15432to control search paths for include files documented in 15433@ref{Directory Options}. 15434Options to control preprocessor diagnostics are listed in 15435@ref{Warning Options}. 15436 15437@table @gcctabopt 15438@include cppopts.texi 15439 15440@item -Wp,@var{option} 15441@opindex Wp 15442You can use @option{-Wp,@var{option}} to bypass the compiler driver 15443and pass @var{option} directly through to the preprocessor. If 15444@var{option} contains commas, it is split into multiple options at the 15445commas. However, many options are modified, translated or interpreted 15446by the compiler driver before being passed to the preprocessor, and 15447@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 15448interface is undocumented and subject to change, so whenever possible 15449you should avoid using @option{-Wp} and let the driver handle the 15450options instead. 15451 15452@item -Xpreprocessor @var{option} 15453@opindex Xpreprocessor 15454Pass @var{option} as an option to the preprocessor. You can use this to 15455supply system-specific preprocessor options that GCC does not 15456recognize. 15457 15458If you want to pass an option that takes an argument, you must use 15459@option{-Xpreprocessor} twice, once for the option and once for the argument. 15460 15461@item -no-integrated-cpp 15462@opindex no-integrated-cpp 15463Perform preprocessing as a separate pass before compilation. 15464By default, GCC performs preprocessing as an integrated part of 15465input tokenization and parsing. 15466If this option is provided, the appropriate language front end 15467(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 15468and Objective-C, respectively) is instead invoked twice, 15469once for preprocessing only and once for actual compilation 15470of the preprocessed input. 15471This option may be useful in conjunction with the @option{-B} or 15472@option{-wrapper} options to specify an alternate preprocessor or 15473perform additional processing of the program source between 15474normal preprocessing and compilation. 15475 15476@item -flarge-source-files 15477@opindex flarge-source-files 15478Adjust GCC to expect large source files, at the expense of slower 15479compilation and higher memory usage. 15480 15481Specifically, GCC normally tracks both column numbers and line numbers 15482within source files and it normally prints both of these numbers in 15483diagnostics. However, once it has processed a certain number of source 15484lines, it stops tracking column numbers and only tracks line numbers. 15485This means that diagnostics for later lines do not include column numbers. 15486It also means that options like @option{-Wmisleading-indentation} cease to work 15487at that point, although the compiler prints a note if this happens. 15488Passing @option{-flarge-source-files} significantly increases the number 15489of source lines that GCC can process before it stops tracking columns. 15490 15491@end table 15492 15493@node Assembler Options 15494@section Passing Options to the Assembler 15495 15496@c prevent bad page break with this line 15497You can pass options to the assembler. 15498 15499@table @gcctabopt 15500@item -Wa,@var{option} 15501@opindex Wa 15502Pass @var{option} as an option to the assembler. If @var{option} 15503contains commas, it is split into multiple options at the commas. 15504 15505@item -Xassembler @var{option} 15506@opindex Xassembler 15507Pass @var{option} as an option to the assembler. You can use this to 15508supply system-specific assembler options that GCC does not 15509recognize. 15510 15511If you want to pass an option that takes an argument, you must use 15512@option{-Xassembler} twice, once for the option and once for the argument. 15513 15514@end table 15515 15516@node Link Options 15517@section Options for Linking 15518@cindex link options 15519@cindex options, linking 15520 15521These options come into play when the compiler links object files into 15522an executable output file. They are meaningless if the compiler is 15523not doing a link step. 15524 15525@table @gcctabopt 15526@cindex file names 15527@item @var{object-file-name} 15528A file name that does not end in a special recognized suffix is 15529considered to name an object file or library. (Object files are 15530distinguished from libraries by the linker according to the file 15531contents.) If linking is done, these object files are used as input 15532to the linker. 15533 15534@item -c 15535@itemx -S 15536@itemx -E 15537@opindex c 15538@opindex S 15539@opindex E 15540If any of these options is used, then the linker is not run, and 15541object file names should not be used as arguments. @xref{Overall 15542Options}. 15543 15544@item -flinker-output=@var{type} 15545@opindex flinker-output 15546This option controls code generation of the link-time optimizer. By 15547default the linker output is automatically determined by the linker 15548plugin. For debugging the compiler and if incremental linking with a 15549non-LTO object file is desired, it may be useful to control the type 15550manually. 15551 15552If @var{type} is @samp{exec}, code generation produces a static 15553binary. In this case @option{-fpic} and @option{-fpie} are both 15554disabled. 15555 15556If @var{type} is @samp{dyn}, code generation produces a shared 15557library. In this case @option{-fpic} or @option{-fPIC} is preserved, 15558but not enabled automatically. This allows to build shared libraries 15559without position-independent code on architectures where this is 15560possible, i.e.@: on x86. 15561 15562If @var{type} is @samp{pie}, code generation produces an @option{-fpie} 15563executable. This results in similar optimizations as @samp{exec} 15564except that @option{-fpie} is not disabled if specified at compilation 15565time. 15566 15567If @var{type} is @samp{rel}, the compiler assumes that incremental linking is 15568done. The sections containing intermediate code for link-time optimization are 15569merged, pre-optimized, and output to the resulting object file. In addition, if 15570@option{-ffat-lto-objects} is specified, binary code is produced for future 15571non-LTO linking. The object file produced by incremental linking is smaller 15572than a static library produced from the same object files. At link time the 15573result of incremental linking also loads faster than a static 15574library assuming that the majority of objects in the library are used. 15575 15576Finally @samp{nolto-rel} configures the compiler for incremental linking where 15577code generation is forced, a final binary is produced, and the intermediate 15578code for later link-time optimization is stripped. When multiple object files 15579are linked together the resulting code is better optimized than with 15580link-time optimizations disabled (for example, cross-module inlining 15581happens), but most of benefits of whole program optimizations are lost. 15582 15583During the incremental link (by @option{-r}) the linker plugin defaults to 15584@option{rel}. With current interfaces to GNU Binutils it is however not 15585possible to incrementally link LTO objects and non-LTO objects into a single 15586mixed object file. If any of object files in incremental link cannot 15587be used for link-time optimization, the linker plugin issues a warning and 15588uses @samp{nolto-rel}. To maintain whole program optimization, it is 15589recommended to link such objects into static library instead. Alternatively it 15590is possible to use H.J. Lu's binutils with support for mixed objects. 15591 15592@item -fuse-ld=bfd 15593@opindex fuse-ld=bfd 15594Use the @command{bfd} linker instead of the default linker. 15595 15596@item -fuse-ld=gold 15597@opindex fuse-ld=gold 15598Use the @command{gold} linker instead of the default linker. 15599 15600@item -fuse-ld=lld 15601@opindex fuse-ld=lld 15602Use the LLVM @command{lld} linker instead of the default linker. 15603 15604@cindex Libraries 15605@item -l@var{library} 15606@itemx -l @var{library} 15607@opindex l 15608Search the library named @var{library} when linking. (The second 15609alternative with the library as a separate argument is only for 15610POSIX compliance and is not recommended.) 15611 15612The @option{-l} option is passed directly to the linker by GCC. Refer 15613to your linker documentation for exact details. The general 15614description below applies to the GNU linker. 15615 15616The linker searches a standard list of directories for the library. 15617The directories searched include several standard system directories 15618plus any that you specify with @option{-L}. 15619 15620Static libraries are archives of object files, and have file names 15621like @file{lib@var{library}.a}. Some targets also support shared 15622libraries, which typically have names like @file{lib@var{library}.so}. 15623If both static and shared libraries are found, the linker gives 15624preference to linking with the shared library unless the 15625@option{-static} option is used. 15626 15627It makes a difference where in the command you write this option; the 15628linker searches and processes libraries and object files in the order they 15629are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 15630after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 15631to functions in @samp{z}, those functions may not be loaded. 15632 15633@item -lobjc 15634@opindex lobjc 15635You need this special case of the @option{-l} option in order to 15636link an Objective-C or Objective-C++ program. 15637 15638@item -nostartfiles 15639@opindex nostartfiles 15640Do not use the standard system startup files when linking. 15641The standard system libraries are used normally, unless @option{-nostdlib}, 15642@option{-nolibc}, or @option{-nodefaultlibs} is used. 15643 15644@item -nodefaultlibs 15645@opindex nodefaultlibs 15646Do not use the standard system libraries when linking. 15647Only the libraries you specify are passed to the linker, and options 15648specifying linkage of the system libraries, such as @option{-static-libgcc} 15649or @option{-shared-libgcc}, are ignored. 15650The standard startup files are used normally, unless @option{-nostartfiles} 15651is used. 15652 15653The compiler may generate calls to @code{memcmp}, 15654@code{memset}, @code{memcpy} and @code{memmove}. 15655These entries are usually resolved by entries in 15656libc. These entry points should be supplied through some other 15657mechanism when this option is specified. 15658 15659@item -nolibc 15660@opindex nolibc 15661Do not use the C library or system libraries tightly coupled with it when 15662linking. Still link with the startup files, @file{libgcc} or toolchain 15663provided language support libraries such as @file{libgnat}, @file{libgfortran} 15664or @file{libstdc++} unless options preventing their inclusion are used as 15665well. This typically removes @option{-lc} from the link command line, as well 15666as system libraries that normally go with it and become meaningless when 15667absence of a C library is assumed, for example @option{-lpthread} or 15668@option{-lm} in some configurations. This is intended for bare-board 15669targets when there is indeed no C library available. 15670 15671@item -nostdlib 15672@opindex nostdlib 15673Do not use the standard system startup files or libraries when linking. 15674No startup files and only the libraries you specify are passed to 15675the linker, and options specifying linkage of the system libraries, such as 15676@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 15677 15678The compiler may generate calls to @code{memcmp}, @code{memset}, 15679@code{memcpy} and @code{memmove}. 15680These entries are usually resolved by entries in 15681libc. These entry points should be supplied through some other 15682mechanism when this option is specified. 15683 15684@cindex @option{-lgcc}, use with @option{-nostdlib} 15685@cindex @option{-nostdlib} and unresolved references 15686@cindex unresolved references and @option{-nostdlib} 15687@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 15688@cindex @option{-nodefaultlibs} and unresolved references 15689@cindex unresolved references and @option{-nodefaultlibs} 15690One of the standard libraries bypassed by @option{-nostdlib} and 15691@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 15692which GCC uses to overcome shortcomings of particular machines, or special 15693needs for some languages. 15694(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 15695Collection (GCC) Internals}, 15696for more discussion of @file{libgcc.a}.) 15697In most cases, you need @file{libgcc.a} even when you want to avoid 15698other standard libraries. In other words, when you specify @option{-nostdlib} 15699or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 15700This ensures that you have no unresolved references to internal GCC 15701library subroutines. 15702(An example of such an internal subroutine is @code{__main}, used to ensure C++ 15703constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 15704GNU Compiler Collection (GCC) Internals}.) 15705 15706@item -e @var{entry} 15707@itemx --entry=@var{entry} 15708@opindex e 15709@opindex entry 15710 15711Specify that the program entry point is @var{entry}. The argument is 15712interpreted by the linker; the GNU linker accepts either a symbol name 15713or an address. 15714 15715@item -pie 15716@opindex pie 15717Produce a dynamically linked position independent executable on targets 15718that support it. For predictable results, you must also specify the same 15719set of options used for compilation (@option{-fpie}, @option{-fPIE}, 15720or model suboptions) when you specify this linker option. 15721 15722@item -no-pie 15723@opindex no-pie 15724Don't produce a dynamically linked position independent executable. 15725 15726@item -static-pie 15727@opindex static-pie 15728Produce a static position independent executable on targets that support 15729it. A static position independent executable is similar to a static 15730executable, but can be loaded at any address without a dynamic linker. 15731For predictable results, you must also specify the same set of options 15732used for compilation (@option{-fpie}, @option{-fPIE}, or model 15733suboptions) when you specify this linker option. 15734 15735@item -pthread 15736@opindex pthread 15737Link with the POSIX threads library. This option is supported on 15738GNU/Linux targets, most other Unix derivatives, and also on 15739x86 Cygwin and MinGW targets. On some targets this option also sets 15740flags for the preprocessor, so it should be used consistently for both 15741compilation and linking. 15742 15743@item -r 15744@opindex r 15745Produce a relocatable object as output. This is also known as partial 15746linking. 15747 15748@item -rdynamic 15749@opindex rdynamic 15750Pass the flag @option{-export-dynamic} to the ELF linker, on targets 15751that support it. This instructs the linker to add all symbols, not 15752only used ones, to the dynamic symbol table. This option is needed 15753for some uses of @code{dlopen} or to allow obtaining backtraces 15754from within a program. 15755 15756@item -s 15757@opindex s 15758Remove all symbol table and relocation information from the executable. 15759 15760@item -static 15761@opindex static 15762On systems that support dynamic linking, this overrides @option{-pie} 15763and prevents linking with the shared libraries. On other systems, this 15764option has no effect. 15765 15766@item -shared 15767@opindex shared 15768Produce a shared object which can then be linked with other objects to 15769form an executable. Not all systems support this option. For predictable 15770results, you must also specify the same set of options used for compilation 15771(@option{-fpic}, @option{-fPIC}, or model suboptions) when 15772you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 15773needs to build supplementary stub code for constructors to work. On 15774multi-libbed systems, @samp{gcc -shared} must select the correct support 15775libraries to link against. Failing to supply the correct flags may lead 15776to subtle defects. Supplying them in cases where they are not necessary 15777is innocuous.} 15778 15779@item -shared-libgcc 15780@itemx -static-libgcc 15781@opindex shared-libgcc 15782@opindex static-libgcc 15783On systems that provide @file{libgcc} as a shared library, these options 15784force the use of either the shared or static version, respectively. 15785If no shared version of @file{libgcc} was built when the compiler was 15786configured, these options have no effect. 15787 15788There are several situations in which an application should use the 15789shared @file{libgcc} instead of the static version. The most common 15790of these is when the application wishes to throw and catch exceptions 15791across different shared libraries. In that case, each of the libraries 15792as well as the application itself should use the shared @file{libgcc}. 15793 15794Therefore, the G++ driver automatically adds @option{-shared-libgcc} 15795whenever you build a shared library or a main executable, because C++ 15796programs typically use exceptions, so this is the right thing to do. 15797 15798If, instead, you use the GCC driver to create shared libraries, you may 15799find that they are not always linked with the shared @file{libgcc}. 15800If GCC finds, at its configuration time, that you have a non-GNU linker 15801or a GNU linker that does not support option @option{--eh-frame-hdr}, 15802it links the shared version of @file{libgcc} into shared libraries 15803by default. Otherwise, it takes advantage of the linker and optimizes 15804away the linking with the shared version of @file{libgcc}, linking with 15805the static version of libgcc by default. This allows exceptions to 15806propagate through such shared libraries, without incurring relocation 15807costs at library load time. 15808 15809However, if a library or main executable is supposed to throw or catch 15810exceptions, you must link it using the G++ driver, or using the option 15811@option{-shared-libgcc}, such that it is linked with the shared 15812@file{libgcc}. 15813 15814@item -static-libasan 15815@opindex static-libasan 15816When the @option{-fsanitize=address} option is used to link a program, 15817the GCC driver automatically links against @option{libasan}. If 15818@file{libasan} is available as a shared library, and the @option{-static} 15819option is not used, then this links against the shared version of 15820@file{libasan}. The @option{-static-libasan} option directs the GCC 15821driver to link @file{libasan} statically, without necessarily linking 15822other libraries statically. 15823 15824@item -static-libtsan 15825@opindex static-libtsan 15826When the @option{-fsanitize=thread} option is used to link a program, 15827the GCC driver automatically links against @option{libtsan}. If 15828@file{libtsan} is available as a shared library, and the @option{-static} 15829option is not used, then this links against the shared version of 15830@file{libtsan}. The @option{-static-libtsan} option directs the GCC 15831driver to link @file{libtsan} statically, without necessarily linking 15832other libraries statically. 15833 15834@item -static-liblsan 15835@opindex static-liblsan 15836When the @option{-fsanitize=leak} option is used to link a program, 15837the GCC driver automatically links against @option{liblsan}. If 15838@file{liblsan} is available as a shared library, and the @option{-static} 15839option is not used, then this links against the shared version of 15840@file{liblsan}. The @option{-static-liblsan} option directs the GCC 15841driver to link @file{liblsan} statically, without necessarily linking 15842other libraries statically. 15843 15844@item -static-libubsan 15845@opindex static-libubsan 15846When the @option{-fsanitize=undefined} option is used to link a program, 15847the GCC driver automatically links against @option{libubsan}. If 15848@file{libubsan} is available as a shared library, and the @option{-static} 15849option is not used, then this links against the shared version of 15850@file{libubsan}. The @option{-static-libubsan} option directs the GCC 15851driver to link @file{libubsan} statically, without necessarily linking 15852other libraries statically. 15853 15854@item -static-libstdc++ 15855@opindex static-libstdc++ 15856When the @command{g++} program is used to link a C++ program, it 15857normally automatically links against @option{libstdc++}. If 15858@file{libstdc++} is available as a shared library, and the 15859@option{-static} option is not used, then this links against the 15860shared version of @file{libstdc++}. That is normally fine. However, it 15861is sometimes useful to freeze the version of @file{libstdc++} used by 15862the program without going all the way to a fully static link. The 15863@option{-static-libstdc++} option directs the @command{g++} driver to 15864link @file{libstdc++} statically, without necessarily linking other 15865libraries statically. 15866 15867@item -symbolic 15868@opindex symbolic 15869Bind references to global symbols when building a shared object. Warn 15870about any unresolved references (unless overridden by the link editor 15871option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 15872this option. 15873 15874@item -T @var{script} 15875@opindex T 15876@cindex linker script 15877Use @var{script} as the linker script. This option is supported by most 15878systems using the GNU linker. On some targets, such as bare-board 15879targets without an operating system, the @option{-T} option may be required 15880when linking to avoid references to undefined symbols. 15881 15882@item -Xlinker @var{option} 15883@opindex Xlinker 15884Pass @var{option} as an option to the linker. You can use this to 15885supply system-specific linker options that GCC does not recognize. 15886 15887If you want to pass an option that takes a separate argument, you must use 15888@option{-Xlinker} twice, once for the option and once for the argument. 15889For example, to pass @option{-assert definitions}, you must write 15890@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 15891@option{-Xlinker "-assert definitions"}, because this passes the entire 15892string as a single argument, which is not what the linker expects. 15893 15894When using the GNU linker, it is usually more convenient to pass 15895arguments to linker options using the @option{@var{option}=@var{value}} 15896syntax than as separate arguments. For example, you can specify 15897@option{-Xlinker -Map=output.map} rather than 15898@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 15899this syntax for command-line options. 15900 15901@item -Wl,@var{option} 15902@opindex Wl 15903Pass @var{option} as an option to the linker. If @var{option} contains 15904commas, it is split into multiple options at the commas. You can use this 15905syntax to pass an argument to the option. 15906For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 15907linker. When using the GNU linker, you can also get the same effect with 15908@option{-Wl,-Map=output.map}. 15909 15910@item -u @var{symbol} 15911@opindex u 15912Pretend the symbol @var{symbol} is undefined, to force linking of 15913library modules to define it. You can use @option{-u} multiple times with 15914different symbols to force loading of additional library modules. 15915 15916@item -z @var{keyword} 15917@opindex z 15918@option{-z} is passed directly on to the linker along with the keyword 15919@var{keyword}. See the section in the documentation of your linker for 15920permitted values and their meanings. 15921@end table 15922 15923@node Directory Options 15924@section Options for Directory Search 15925@cindex directory options 15926@cindex options, directory search 15927@cindex search path 15928 15929These options specify directories to search for header files, for 15930libraries and for parts of the compiler: 15931 15932@table @gcctabopt 15933@include cppdiropts.texi 15934 15935@item -iplugindir=@var{dir} 15936@opindex iplugindir= 15937Set the directory to search for plugins that are passed 15938by @option{-fplugin=@var{name}} instead of 15939@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 15940to be used by the user, but only passed by the driver. 15941 15942@item -L@var{dir} 15943@opindex L 15944Add directory @var{dir} to the list of directories to be searched 15945for @option{-l}. 15946 15947@item -B@var{prefix} 15948@opindex B 15949This option specifies where to find the executables, libraries, 15950include files, and data files of the compiler itself. 15951 15952The compiler driver program runs one or more of the subprograms 15953@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 15954@var{prefix} as a prefix for each program it tries to run, both with and 15955without @samp{@var{machine}/@var{version}/} for the corresponding target 15956machine and compiler version. 15957 15958For each subprogram to be run, the compiler driver first tries the 15959@option{-B} prefix, if any. If that name is not found, or if @option{-B} 15960is not specified, the driver tries two standard prefixes, 15961@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 15962those results in a file name that is found, the unmodified program 15963name is searched for using the directories specified in your 15964@env{PATH} environment variable. 15965 15966The compiler checks to see if the path provided by @option{-B} 15967refers to a directory, and if necessary it adds a directory 15968separator character at the end of the path. 15969 15970@option{-B} prefixes that effectively specify directory names also apply 15971to libraries in the linker, because the compiler translates these 15972options into @option{-L} options for the linker. They also apply to 15973include files in the preprocessor, because the compiler translates these 15974options into @option{-isystem} options for the preprocessor. In this case, 15975the compiler appends @samp{include} to the prefix. 15976 15977The runtime support file @file{libgcc.a} can also be searched for using 15978the @option{-B} prefix, if needed. If it is not found there, the two 15979standard prefixes above are tried, and that is all. The file is left 15980out of the link if it is not found by those means. 15981 15982Another way to specify a prefix much like the @option{-B} prefix is to use 15983the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 15984Variables}. 15985 15986As a special kludge, if the path provided by @option{-B} is 15987@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 159889, then it is replaced by @file{[dir/]include}. This is to help 15989with boot-strapping the compiler. 15990 15991@item -no-canonical-prefixes 15992@opindex no-canonical-prefixes 15993Do not expand any symbolic links, resolve references to @samp{/../} 15994or @samp{/./}, or make the path absolute when generating a relative 15995prefix. 15996 15997@item --sysroot=@var{dir} 15998@opindex sysroot 15999Use @var{dir} as the logical root directory for headers and libraries. 16000For example, if the compiler normally searches for headers in 16001@file{/usr/include} and libraries in @file{/usr/lib}, it instead 16002searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 16003 16004If you use both this option and the @option{-isysroot} option, then 16005the @option{--sysroot} option applies to libraries, but the 16006@option{-isysroot} option applies to header files. 16007 16008The GNU linker (beginning with version 2.16) has the necessary support 16009for this option. If your linker does not support this option, the 16010header file aspect of @option{--sysroot} still works, but the 16011library aspect does not. 16012 16013@item --no-sysroot-suffix 16014@opindex no-sysroot-suffix 16015For some targets, a suffix is added to the root directory specified 16016with @option{--sysroot}, depending on the other options used, so that 16017headers may for example be found in 16018@file{@var{dir}/@var{suffix}/usr/include} instead of 16019@file{@var{dir}/usr/include}. This option disables the addition of 16020such a suffix. 16021 16022@end table 16023 16024@node Code Gen Options 16025@section Options for Code Generation Conventions 16026@cindex code generation conventions 16027@cindex options, code generation 16028@cindex run-time options 16029 16030These machine-independent options control the interface conventions 16031used in code generation. 16032 16033Most of them have both positive and negative forms; the negative form 16034of @option{-ffoo} is @option{-fno-foo}. In the table below, only 16035one of the forms is listed---the one that is not the default. You 16036can figure out the other form by either removing @samp{no-} or adding 16037it. 16038 16039@table @gcctabopt 16040@item -fstack-reuse=@var{reuse-level} 16041@opindex fstack_reuse 16042This option controls stack space reuse for user declared local/auto variables 16043and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 16044@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 16045local variables and temporaries, @samp{named_vars} enables the reuse only for 16046user defined local variables with names, and @samp{none} disables stack reuse 16047completely. The default value is @samp{all}. The option is needed when the 16048program extends the lifetime of a scoped local variable or a compiler generated 16049temporary beyond the end point defined by the language. When a lifetime of 16050a variable ends, and if the variable lives in memory, the optimizing compiler 16051has the freedom to reuse its stack space with other temporaries or scoped 16052local variables whose live range does not overlap with it. Legacy code extending 16053local lifetime is likely to break with the stack reuse optimization. 16054 16055For example, 16056 16057@smallexample 16058 int *p; 16059 @{ 16060 int local1; 16061 16062 p = &local1; 16063 local1 = 10; 16064 .... 16065 @} 16066 @{ 16067 int local2; 16068 local2 = 20; 16069 ... 16070 @} 16071 16072 if (*p == 10) // out of scope use of local1 16073 @{ 16074 16075 @} 16076@end smallexample 16077 16078Another example: 16079@smallexample 16080 16081 struct A 16082 @{ 16083 A(int k) : i(k), j(k) @{ @} 16084 int i; 16085 int j; 16086 @}; 16087 16088 A *ap; 16089 16090 void foo(const A& ar) 16091 @{ 16092 ap = &ar; 16093 @} 16094 16095 void bar() 16096 @{ 16097 foo(A(10)); // temp object's lifetime ends when foo returns 16098 16099 @{ 16100 A a(20); 16101 .... 16102 @} 16103 ap->i+= 10; // ap references out of scope temp whose space 16104 // is reused with a. What is the value of ap->i? 16105 @} 16106 16107@end smallexample 16108 16109The lifetime of a compiler generated temporary is well defined by the C++ 16110standard. When a lifetime of a temporary ends, and if the temporary lives 16111in memory, the optimizing compiler has the freedom to reuse its stack 16112space with other temporaries or scoped local variables whose live range 16113does not overlap with it. However some of the legacy code relies on 16114the behavior of older compilers in which temporaries' stack space is 16115not reused, the aggressive stack reuse can lead to runtime errors. This 16116option is used to control the temporary stack reuse optimization. 16117 16118@item -ftrapv 16119@opindex ftrapv 16120This option generates traps for signed overflow on addition, subtraction, 16121multiplication operations. 16122The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 16123@option{-ftrapv} @option{-fwrapv} on the command-line results in 16124@option{-fwrapv} being effective. Note that only active options override, so 16125using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 16126results in @option{-ftrapv} being effective. 16127 16128@item -fwrapv 16129@opindex fwrapv 16130This option instructs the compiler to assume that signed arithmetic 16131overflow of addition, subtraction and multiplication wraps around 16132using twos-complement representation. This flag enables some optimizations 16133and disables others. 16134The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 16135@option{-ftrapv} @option{-fwrapv} on the command-line results in 16136@option{-fwrapv} being effective. Note that only active options override, so 16137using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 16138results in @option{-ftrapv} being effective. 16139 16140@item -fwrapv-pointer 16141@opindex fwrapv-pointer 16142This option instructs the compiler to assume that pointer arithmetic 16143overflow on addition and subtraction wraps around using twos-complement 16144representation. This flag disables some optimizations which assume 16145pointer overflow is invalid. 16146 16147@item -fstrict-overflow 16148@opindex fstrict-overflow 16149This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when 16150negated implies @option{-fwrapv} @option{-fwrapv-pointer}. 16151 16152@item -fexceptions 16153@opindex fexceptions 16154Enable exception handling. Generates extra code needed to propagate 16155exceptions. For some targets, this implies GCC generates frame 16156unwind information for all functions, which can produce significant data 16157size overhead, although it does not affect execution. If you do not 16158specify this option, GCC enables it by default for languages like 16159C++ that normally require exception handling, and disables it for 16160languages like C that do not normally require it. However, you may need 16161to enable this option when compiling C code that needs to interoperate 16162properly with exception handlers written in C++. You may also wish to 16163disable this option if you are compiling older C++ programs that don't 16164use exception handling. 16165 16166@item -fnon-call-exceptions 16167@opindex fnon-call-exceptions 16168Generate code that allows trapping instructions to throw exceptions. 16169Note that this requires platform-specific runtime support that does 16170not exist everywhere. Moreover, it only allows @emph{trapping} 16171instructions to throw exceptions, i.e.@: memory references or floating-point 16172instructions. It does not allow exceptions to be thrown from 16173arbitrary signal handlers such as @code{SIGALRM}. 16174 16175@item -fdelete-dead-exceptions 16176@opindex fdelete-dead-exceptions 16177Consider that instructions that may throw exceptions but don't otherwise 16178contribute to the execution of the program can be optimized away. 16179This option is enabled by default for the Ada compiler, as permitted by 16180the Ada language specification. 16181Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 16182 16183@item -funwind-tables 16184@opindex funwind-tables 16185Similar to @option{-fexceptions}, except that it just generates any needed 16186static data, but does not affect the generated code in any other way. 16187You normally do not need to enable this option; instead, a language processor 16188that needs this handling enables it on your behalf. 16189 16190@item -fasynchronous-unwind-tables 16191@opindex fasynchronous-unwind-tables 16192Generate unwind table in DWARF format, if supported by target machine. The 16193table is exact at each instruction boundary, so it can be used for stack 16194unwinding from asynchronous events (such as debugger or garbage collector). 16195 16196@item -fno-gnu-unique 16197@opindex fno-gnu-unique 16198@opindex fgnu-unique 16199On systems with recent GNU assembler and C library, the C++ compiler 16200uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 16201of template static data members and static local variables in inline 16202functions are unique even in the presence of @code{RTLD_LOCAL}; this 16203is necessary to avoid problems with a library used by two different 16204@code{RTLD_LOCAL} plugins depending on a definition in one of them and 16205therefore disagreeing with the other one about the binding of the 16206symbol. But this causes @code{dlclose} to be ignored for affected 16207DSOs; if your program relies on reinitialization of a DSO via 16208@code{dlclose} and @code{dlopen}, you can use 16209@option{-fno-gnu-unique}. 16210 16211@item -fpcc-struct-return 16212@opindex fpcc-struct-return 16213Return ``short'' @code{struct} and @code{union} values in memory like 16214longer ones, rather than in registers. This convention is less 16215efficient, but it has the advantage of allowing intercallability between 16216GCC-compiled files and files compiled with other compilers, particularly 16217the Portable C Compiler (pcc). 16218 16219The precise convention for returning structures in memory depends 16220on the target configuration macros. 16221 16222Short structures and unions are those whose size and alignment match 16223that of some integer type. 16224 16225@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 16226switch is not binary compatible with code compiled with the 16227@option{-freg-struct-return} switch. 16228Use it to conform to a non-default application binary interface. 16229 16230@item -freg-struct-return 16231@opindex freg-struct-return 16232Return @code{struct} and @code{union} values in registers when possible. 16233This is more efficient for small structures than 16234@option{-fpcc-struct-return}. 16235 16236If you specify neither @option{-fpcc-struct-return} nor 16237@option{-freg-struct-return}, GCC defaults to whichever convention is 16238standard for the target. If there is no standard convention, GCC 16239defaults to @option{-fpcc-struct-return}, except on targets where GCC is 16240the principal compiler. In those cases, we can choose the standard, and 16241we chose the more efficient register return alternative. 16242 16243@strong{Warning:} code compiled with the @option{-freg-struct-return} 16244switch is not binary compatible with code compiled with the 16245@option{-fpcc-struct-return} switch. 16246Use it to conform to a non-default application binary interface. 16247 16248@item -fshort-enums 16249@opindex fshort-enums 16250Allocate to an @code{enum} type only as many bytes as it needs for the 16251declared range of possible values. Specifically, the @code{enum} type 16252is equivalent to the smallest integer type that has enough room. 16253 16254@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 16255code that is not binary compatible with code generated without that switch. 16256Use it to conform to a non-default application binary interface. 16257 16258@item -fshort-wchar 16259@opindex fshort-wchar 16260Override the underlying type for @code{wchar_t} to be @code{short 16261unsigned int} instead of the default for the target. This option is 16262useful for building programs to run under WINE@. 16263 16264@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 16265code that is not binary compatible with code generated without that switch. 16266Use it to conform to a non-default application binary interface. 16267 16268@item -fcommon 16269@opindex fcommon 16270@opindex fno-common 16271@cindex tentative definitions 16272In C code, this option controls the placement of global variables 16273defined without an initializer, known as @dfn{tentative definitions} 16274in the C standard. Tentative definitions are distinct from declarations 16275of a variable with the @code{extern} keyword, which do not allocate storage. 16276 16277The default is @option{-fno-common}, which specifies that the compiler places 16278uninitialized global variables in the BSS section of the object file. 16279This inhibits the merging of tentative definitions by the linker so you get a 16280multiple-definition error if the same variable is accidentally defined in more 16281than one compilation unit. 16282 16283The @option{-fcommon} places uninitialized global variables in a common block. 16284This allows the linker to resolve all tentative definitions of the same variable 16285in different compilation units to the same object, or to a non-tentative 16286definition. This behavior is inconsistent with C++, and on many targets implies 16287a speed and code size penalty on global variable references. It is mainly 16288useful to enable legacy code to link without errors. 16289 16290@item -fno-ident 16291@opindex fno-ident 16292@opindex fident 16293Ignore the @code{#ident} directive. 16294 16295@item -finhibit-size-directive 16296@opindex finhibit-size-directive 16297Don't output a @code{.size} assembler directive, or anything else that 16298would cause trouble if the function is split in the middle, and the 16299two halves are placed at locations far apart in memory. This option is 16300used when compiling @file{crtstuff.c}; you should not need to use it 16301for anything else. 16302 16303@item -fverbose-asm 16304@opindex fverbose-asm 16305Put extra commentary information in the generated assembly code to 16306make it more readable. This option is generally only of use to those 16307who actually need to read the generated assembly code (perhaps while 16308debugging the compiler itself). 16309 16310@option{-fno-verbose-asm}, the default, causes the 16311extra information to be omitted and is useful when comparing two assembler 16312files. 16313 16314The added comments include: 16315 16316@itemize @bullet 16317 16318@item 16319information on the compiler version and command-line options, 16320 16321@item 16322the source code lines associated with the assembly instructions, 16323in the form FILENAME:LINENUMBER:CONTENT OF LINE, 16324 16325@item 16326hints on which high-level expressions correspond to 16327the various assembly instruction operands. 16328 16329@end itemize 16330 16331For example, given this C source file: 16332 16333@smallexample 16334int test (int n) 16335@{ 16336 int i; 16337 int total = 0; 16338 16339 for (i = 0; i < n; i++) 16340 total += i * i; 16341 16342 return total; 16343@} 16344@end smallexample 16345 16346compiling to (x86_64) assembly via @option{-S} and emitting the result 16347direct to stdout via @option{-o} @option{-} 16348 16349@smallexample 16350gcc -S test.c -fverbose-asm -Os -o - 16351@end smallexample 16352 16353gives output similar to this: 16354 16355@smallexample 16356 .file "test.c" 16357# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu) 16358 [...snip...] 16359# options passed: 16360 [...snip...] 16361 16362 .text 16363 .globl test 16364 .type test, @@function 16365test: 16366.LFB0: 16367 .cfi_startproc 16368# test.c:4: int total = 0; 16369 xorl %eax, %eax # <retval> 16370# test.c:6: for (i = 0; i < n; i++) 16371 xorl %edx, %edx # i 16372.L2: 16373# test.c:6: for (i = 0; i < n; i++) 16374 cmpl %edi, %edx # n, i 16375 jge .L5 #, 16376# test.c:7: total += i * i; 16377 movl %edx, %ecx # i, tmp92 16378 imull %edx, %ecx # i, tmp92 16379# test.c:6: for (i = 0; i < n; i++) 16380 incl %edx # i 16381# test.c:7: total += i * i; 16382 addl %ecx, %eax # tmp92, <retval> 16383 jmp .L2 # 16384.L5: 16385# test.c:10: @} 16386 ret 16387 .cfi_endproc 16388.LFE0: 16389 .size test, .-test 16390 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)" 16391 .section .note.GNU-stack,"",@@progbits 16392@end smallexample 16393 16394The comments are intended for humans rather than machines and hence the 16395precise format of the comments is subject to change. 16396 16397@item -frecord-gcc-switches 16398@opindex frecord-gcc-switches 16399This switch causes the command line used to invoke the 16400compiler to be recorded into the object file that is being created. 16401This switch is only implemented on some targets and the exact format 16402of the recording is target and binary file format dependent, but it 16403usually takes the form of a section containing ASCII text. This 16404switch is related to the @option{-fverbose-asm} switch, but that 16405switch only records information in the assembler output file as 16406comments, so it never reaches the object file. 16407See also @option{-grecord-gcc-switches} for another 16408way of storing compiler options into the object file. 16409 16410@item -fpic 16411@opindex fpic 16412@cindex global offset table 16413@cindex PIC 16414Generate position-independent code (PIC) suitable for use in a shared 16415library, if supported for the target machine. Such code accesses all 16416constant addresses through a global offset table (GOT)@. The dynamic 16417loader resolves the GOT entries when the program starts (the dynamic 16418loader is not part of GCC; it is part of the operating system). If 16419the GOT size for the linked executable exceeds a machine-specific 16420maximum size, you get an error message from the linker indicating that 16421@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 16422instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k 16423on the m68k and RS/6000. The x86 has no such limit.) 16424 16425Position-independent code requires special support, and therefore works 16426only on certain machines. For the x86, GCC supports PIC for System V 16427but not for the Sun 386i. Code generated for the IBM RS/6000 is always 16428position-independent. 16429 16430When this flag is set, the macros @code{__pic__} and @code{__PIC__} 16431are defined to 1. 16432 16433@item -fPIC 16434@opindex fPIC 16435If supported for the target machine, emit position-independent code, 16436suitable for dynamic linking and avoiding any limit on the size of the 16437global offset table. This option makes a difference on AArch64, m68k, 16438PowerPC and SPARC@. 16439 16440Position-independent code requires special support, and therefore works 16441only on certain machines. 16442 16443When this flag is set, the macros @code{__pic__} and @code{__PIC__} 16444are defined to 2. 16445 16446@item -fpie 16447@itemx -fPIE 16448@opindex fpie 16449@opindex fPIE 16450These options are similar to @option{-fpic} and @option{-fPIC}, but the 16451generated position-independent code can be only linked into executables. 16452Usually these options are used to compile code that will be linked using 16453the @option{-pie} GCC option. 16454 16455@option{-fpie} and @option{-fPIE} both define the macros 16456@code{__pie__} and @code{__PIE__}. The macros have the value 1 16457for @option{-fpie} and 2 for @option{-fPIE}. 16458 16459@item -fno-plt 16460@opindex fno-plt 16461@opindex fplt 16462Do not use the PLT for external function calls in position-independent code. 16463Instead, load the callee address at call sites from the GOT and branch to it. 16464This leads to more efficient code by eliminating PLT stubs and exposing 16465GOT loads to optimizations. On architectures such as 32-bit x86 where 16466PLT stubs expect the GOT pointer in a specific register, this gives more 16467register allocation freedom to the compiler. 16468Lazy binding requires use of the PLT; 16469with @option{-fno-plt} all external symbols are resolved at load time. 16470 16471Alternatively, the function attribute @code{noplt} can be used to avoid calls 16472through the PLT for specific external functions. 16473 16474In position-dependent code, a few targets also convert calls to 16475functions that are marked to not use the PLT to use the GOT instead. 16476 16477@item -fno-jump-tables 16478@opindex fno-jump-tables 16479@opindex fjump-tables 16480Do not use jump tables for switch statements even where it would be 16481more efficient than other code generation strategies. This option is 16482of use in conjunction with @option{-fpic} or @option{-fPIC} for 16483building code that forms part of a dynamic linker and cannot 16484reference the address of a jump table. On some targets, jump tables 16485do not require a GOT and this option is not needed. 16486 16487@item -fno-bit-tests 16488@opindex fno-bit-tests 16489@opindex fbit-tests 16490Do not use bit tests for switch statements even where it would be 16491more efficient than other code generation strategies. 16492 16493@item -ffixed-@var{reg} 16494@opindex ffixed 16495Treat the register named @var{reg} as a fixed register; generated code 16496should never refer to it (except perhaps as a stack pointer, frame 16497pointer or in some other fixed role). 16498 16499@var{reg} must be the name of a register. The register names accepted 16500are machine-specific and are defined in the @code{REGISTER_NAMES} 16501macro in the machine description macro file. 16502 16503This flag does not have a negative form, because it specifies a 16504three-way choice. 16505 16506@item -fcall-used-@var{reg} 16507@opindex fcall-used 16508Treat the register named @var{reg} as an allocable register that is 16509clobbered by function calls. It may be allocated for temporaries or 16510variables that do not live across a call. Functions compiled this way 16511do not save and restore the register @var{reg}. 16512 16513It is an error to use this flag with the frame pointer or stack pointer. 16514Use of this flag for other registers that have fixed pervasive roles in 16515the machine's execution model produces disastrous results. 16516 16517This flag does not have a negative form, because it specifies a 16518three-way choice. 16519 16520@item -fcall-saved-@var{reg} 16521@opindex fcall-saved 16522Treat the register named @var{reg} as an allocable register saved by 16523functions. It may be allocated even for temporaries or variables that 16524live across a call. Functions compiled this way save and restore 16525the register @var{reg} if they use it. 16526 16527It is an error to use this flag with the frame pointer or stack pointer. 16528Use of this flag for other registers that have fixed pervasive roles in 16529the machine's execution model produces disastrous results. 16530 16531A different sort of disaster results from the use of this flag for 16532a register in which function values may be returned. 16533 16534This flag does not have a negative form, because it specifies a 16535three-way choice. 16536 16537@item -fpack-struct[=@var{n}] 16538@opindex fpack-struct 16539Without a value specified, pack all structure members together without 16540holes. When a value is specified (which must be a small power of two), pack 16541structure members according to this value, representing the maximum 16542alignment (that is, objects with default alignment requirements larger than 16543this are output potentially unaligned at the next fitting location. 16544 16545@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 16546code that is not binary compatible with code generated without that switch. 16547Additionally, it makes the code suboptimal. 16548Use it to conform to a non-default application binary interface. 16549 16550@item -fleading-underscore 16551@opindex fleading-underscore 16552This option and its counterpart, @option{-fno-leading-underscore}, forcibly 16553change the way C symbols are represented in the object file. One use 16554is to help link with legacy assembly code. 16555 16556@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 16557generate code that is not binary compatible with code generated without that 16558switch. Use it to conform to a non-default application binary interface. 16559Not all targets provide complete support for this switch. 16560 16561@item -ftls-model=@var{model} 16562@opindex ftls-model 16563Alter the thread-local storage model to be used (@pxref{Thread-Local}). 16564The @var{model} argument should be one of @samp{global-dynamic}, 16565@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 16566Note that the choice is subject to optimization: the compiler may use 16567a more efficient model for symbols not visible outside of the translation 16568unit, or if @option{-fpic} is not given on the command line. 16569 16570The default without @option{-fpic} is @samp{initial-exec}; with 16571@option{-fpic} the default is @samp{global-dynamic}. 16572 16573@item -ftrampolines 16574@opindex ftrampolines 16575For targets that normally need trampolines for nested functions, always 16576generate them instead of using descriptors. Otherwise, for targets that 16577do not need them, like for example HP-PA or IA-64, do nothing. 16578 16579A trampoline is a small piece of code that is created at run time on the 16580stack when the address of a nested function is taken, and is used to call 16581the nested function indirectly. Therefore, it requires the stack to be 16582made executable in order for the program to work properly. 16583 16584@option{-fno-trampolines} is enabled by default on a language by language 16585basis to let the compiler avoid generating them, if it computes that this 16586is safe, and replace them with descriptors. Descriptors are made up of data 16587only, but the generated code must be prepared to deal with them. As of this 16588writing, @option{-fno-trampolines} is enabled by default only for Ada. 16589 16590Moreover, code compiled with @option{-ftrampolines} and code compiled with 16591@option{-fno-trampolines} are not binary compatible if nested functions are 16592present. This option must therefore be used on a program-wide basis and be 16593manipulated with extreme care. 16594 16595@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 16596@opindex fvisibility 16597Set the default ELF image symbol visibility to the specified option---all 16598symbols are marked with this unless overridden within the code. 16599Using this feature can very substantially improve linking and 16600load times of shared object libraries, produce more optimized 16601code, provide near-perfect API export and prevent symbol clashes. 16602It is @strong{strongly} recommended that you use this in any shared objects 16603you distribute. 16604 16605Despite the nomenclature, @samp{default} always means public; i.e., 16606available to be linked against from outside the shared object. 16607@samp{protected} and @samp{internal} are pretty useless in real-world 16608usage so the only other commonly used option is @samp{hidden}. 16609The default if @option{-fvisibility} isn't specified is 16610@samp{default}, i.e., make every symbol public. 16611 16612A good explanation of the benefits offered by ensuring ELF 16613symbols have the correct visibility is given by ``How To Write 16614Shared Libraries'' by Ulrich Drepper (which can be found at 16615@w{@uref{https://www.akkadia.org/drepper/}})---however a superior 16616solution made possible by this option to marking things hidden when 16617the default is public is to make the default hidden and mark things 16618public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 16619and @code{__attribute__ ((visibility("default")))} instead of 16620@code{__declspec(dllexport)} you get almost identical semantics with 16621identical syntax. This is a great boon to those working with 16622cross-platform projects. 16623 16624For those adding visibility support to existing code, you may find 16625@code{#pragma GCC visibility} of use. This works by you enclosing 16626the declarations you wish to set visibility for with (for example) 16627@code{#pragma GCC visibility push(hidden)} and 16628@code{#pragma GCC visibility pop}. 16629Bear in mind that symbol visibility should be viewed @strong{as 16630part of the API interface contract} and thus all new code should 16631always specify visibility when it is not the default; i.e., declarations 16632only for use within the local DSO should @strong{always} be marked explicitly 16633as hidden as so to avoid PLT indirection overheads---making this 16634abundantly clear also aids readability and self-documentation of the code. 16635Note that due to ISO C++ specification requirements, @code{operator new} and 16636@code{operator delete} must always be of default visibility. 16637 16638Be aware that headers from outside your project, in particular system 16639headers and headers from any other library you use, may not be 16640expecting to be compiled with visibility other than the default. You 16641may need to explicitly say @code{#pragma GCC visibility push(default)} 16642before including any such headers. 16643 16644@code{extern} declarations are not affected by @option{-fvisibility}, so 16645a lot of code can be recompiled with @option{-fvisibility=hidden} with 16646no modifications. However, this means that calls to @code{extern} 16647functions with no explicit visibility use the PLT, so it is more 16648effective to use @code{__attribute ((visibility))} and/or 16649@code{#pragma GCC visibility} to tell the compiler which @code{extern} 16650declarations should be treated as hidden. 16651 16652Note that @option{-fvisibility} does affect C++ vague linkage 16653entities. This means that, for instance, an exception class that is 16654be thrown between DSOs must be explicitly marked with default 16655visibility so that the @samp{type_info} nodes are unified between 16656the DSOs. 16657 16658An overview of these techniques, their benefits and how to use them 16659is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 16660 16661@item -fstrict-volatile-bitfields 16662@opindex fstrict-volatile-bitfields 16663This option should be used if accesses to volatile bit-fields (or other 16664structure fields, although the compiler usually honors those types 16665anyway) should use a single access of the width of the 16666field's type, aligned to a natural alignment if possible. For 16667example, targets with memory-mapped peripheral registers might require 16668all such accesses to be 16 bits wide; with this flag you can 16669declare all peripheral bit-fields as @code{unsigned short} (assuming short 16670is 16 bits on these targets) to force GCC to use 16-bit accesses 16671instead of, perhaps, a more efficient 32-bit access. 16672 16673If this option is disabled, the compiler uses the most efficient 16674instruction. In the previous example, that might be a 32-bit load 16675instruction, even though that accesses bytes that do not contain 16676any portion of the bit-field, or memory-mapped registers unrelated to 16677the one being updated. 16678 16679In some cases, such as when the @code{packed} attribute is applied to a 16680structure field, it may not be possible to access the field with a single 16681read or write that is correctly aligned for the target machine. In this 16682case GCC falls back to generating multiple accesses rather than code that 16683will fault or truncate the result at run time. 16684 16685Note: Due to restrictions of the C/C++11 memory model, write accesses are 16686not allowed to touch non bit-field members. It is therefore recommended 16687to define all bits of the field's type as bit-field members. 16688 16689The default value of this option is determined by the application binary 16690interface for the target processor. 16691 16692@item -fsync-libcalls 16693@opindex fsync-libcalls 16694This option controls whether any out-of-line instance of the @code{__sync} 16695family of functions may be used to implement the C++11 @code{__atomic} 16696family of functions. 16697 16698The default value of this option is enabled, thus the only useful form 16699of the option is @option{-fno-sync-libcalls}. This option is used in 16700the implementation of the @file{libatomic} runtime library. 16701 16702@end table 16703 16704@node Developer Options 16705@section GCC Developer Options 16706@cindex developer options 16707@cindex debugging GCC 16708@cindex debug dump options 16709@cindex dump options 16710@cindex compilation statistics 16711 16712This section describes command-line options that are primarily of 16713interest to GCC developers, including options to support compiler 16714testing and investigation of compiler bugs and compile-time 16715performance problems. This includes options that produce debug dumps 16716at various points in the compilation; that print statistics such as 16717memory use and execution time; and that print information about GCC's 16718configuration, such as where it searches for libraries. You should 16719rarely need to use any of these options for ordinary compilation and 16720linking tasks. 16721 16722Many developer options that cause GCC to dump output to a file take an 16723optional @samp{=@var{filename}} suffix. You can specify @samp{stdout} 16724or @samp{-} to dump to standard output, and @samp{stderr} for standard 16725error. 16726 16727If @samp{=@var{filename}} is omitted, a default dump file name is 16728constructed by concatenating the base dump file name, a pass number, 16729phase letter, and pass name. The base dump file name is the name of 16730output file produced by the compiler if explicitly specified and not 16731an executable; otherwise it is the source file name. 16732The pass number is determined by the order passes are registered with 16733the compiler's pass manager. 16734This is generally the same as the order of execution, but passes 16735registered by plugins, target-specific passes, or passes that are 16736otherwise registered late are numbered higher than the pass named 16737@samp{final}, even if they are executed earlier. The phase letter is 16738one of @samp{i} (inter-procedural analysis), @samp{l} 16739(language-specific), @samp{r} (RTL), or @samp{t} (tree). 16740The files are created in the directory of the output file. 16741 16742@table @gcctabopt 16743 16744@item -fcallgraph-info 16745@itemx -fcallgraph-info=@var{MARKERS} 16746@opindex fcallgraph-info 16747Makes the compiler output callgraph information for the program, on a 16748per-object-file basis. The information is generated in the common VCG 16749format. It can be decorated with additional, per-node and/or per-edge 16750information, if a list of comma-separated markers is additionally 16751specified. When the @code{su} marker is specified, the callgraph is 16752decorated with stack usage information; it is equivalent to 16753@option{-fstack-usage}. When the @code{da} marker is specified, the 16754callgraph is decorated with information about dynamically allocated 16755objects. 16756 16757When compiling with @option{-flto}, no callgraph information is output 16758along with the object file. At LTO link time, @option{-fcallgraph-info} 16759may generate multiple callgraph information files next to intermediate 16760LTO output files. 16761 16762@item -d@var{letters} 16763@itemx -fdump-rtl-@var{pass} 16764@itemx -fdump-rtl-@var{pass}=@var{filename} 16765@opindex d 16766@opindex fdump-rtl-@var{pass} 16767Says to make debugging dumps during compilation at times specified by 16768@var{letters}. This is used for debugging the RTL-based passes of the 16769compiler. 16770 16771Some @option{-d@var{letters}} switches have different meaning when 16772@option{-E} is used for preprocessing. @xref{Preprocessor Options}, 16773for information about preprocessor-specific dump options. 16774 16775Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 16776@option{-d} option @var{letters}. Here are the possible 16777letters for use in @var{pass} and @var{letters}, and their meanings: 16778 16779@table @gcctabopt 16780 16781@item -fdump-rtl-alignments 16782@opindex fdump-rtl-alignments 16783Dump after branch alignments have been computed. 16784 16785@item -fdump-rtl-asmcons 16786@opindex fdump-rtl-asmcons 16787Dump after fixing rtl statements that have unsatisfied in/out constraints. 16788 16789@item -fdump-rtl-auto_inc_dec 16790@opindex fdump-rtl-auto_inc_dec 16791Dump after auto-inc-dec discovery. This pass is only run on 16792architectures that have auto inc or auto dec instructions. 16793 16794@item -fdump-rtl-barriers 16795@opindex fdump-rtl-barriers 16796Dump after cleaning up the barrier instructions. 16797 16798@item -fdump-rtl-bbpart 16799@opindex fdump-rtl-bbpart 16800Dump after partitioning hot and cold basic blocks. 16801 16802@item -fdump-rtl-bbro 16803@opindex fdump-rtl-bbro 16804Dump after block reordering. 16805 16806@item -fdump-rtl-btl1 16807@itemx -fdump-rtl-btl2 16808@opindex fdump-rtl-btl2 16809@opindex fdump-rtl-btl2 16810@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 16811after the two branch 16812target load optimization passes. 16813 16814@item -fdump-rtl-bypass 16815@opindex fdump-rtl-bypass 16816Dump after jump bypassing and control flow optimizations. 16817 16818@item -fdump-rtl-combine 16819@opindex fdump-rtl-combine 16820Dump after the RTL instruction combination pass. 16821 16822@item -fdump-rtl-compgotos 16823@opindex fdump-rtl-compgotos 16824Dump after duplicating the computed gotos. 16825 16826@item -fdump-rtl-ce1 16827@itemx -fdump-rtl-ce2 16828@itemx -fdump-rtl-ce3 16829@opindex fdump-rtl-ce1 16830@opindex fdump-rtl-ce2 16831@opindex fdump-rtl-ce3 16832@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 16833@option{-fdump-rtl-ce3} enable dumping after the three 16834if conversion passes. 16835 16836@item -fdump-rtl-cprop_hardreg 16837@opindex fdump-rtl-cprop_hardreg 16838Dump after hard register copy propagation. 16839 16840@item -fdump-rtl-csa 16841@opindex fdump-rtl-csa 16842Dump after combining stack adjustments. 16843 16844@item -fdump-rtl-cse1 16845@itemx -fdump-rtl-cse2 16846@opindex fdump-rtl-cse1 16847@opindex fdump-rtl-cse2 16848@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 16849the two common subexpression elimination passes. 16850 16851@item -fdump-rtl-dce 16852@opindex fdump-rtl-dce 16853Dump after the standalone dead code elimination passes. 16854 16855@item -fdump-rtl-dbr 16856@opindex fdump-rtl-dbr 16857Dump after delayed branch scheduling. 16858 16859@item -fdump-rtl-dce1 16860@itemx -fdump-rtl-dce2 16861@opindex fdump-rtl-dce1 16862@opindex fdump-rtl-dce2 16863@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 16864the two dead store elimination passes. 16865 16866@item -fdump-rtl-eh 16867@opindex fdump-rtl-eh 16868Dump after finalization of EH handling code. 16869 16870@item -fdump-rtl-eh_ranges 16871@opindex fdump-rtl-eh_ranges 16872Dump after conversion of EH handling range regions. 16873 16874@item -fdump-rtl-expand 16875@opindex fdump-rtl-expand 16876Dump after RTL generation. 16877 16878@item -fdump-rtl-fwprop1 16879@itemx -fdump-rtl-fwprop2 16880@opindex fdump-rtl-fwprop1 16881@opindex fdump-rtl-fwprop2 16882@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 16883dumping after the two forward propagation passes. 16884 16885@item -fdump-rtl-gcse1 16886@itemx -fdump-rtl-gcse2 16887@opindex fdump-rtl-gcse1 16888@opindex fdump-rtl-gcse2 16889@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 16890after global common subexpression elimination. 16891 16892@item -fdump-rtl-init-regs 16893@opindex fdump-rtl-init-regs 16894Dump after the initialization of the registers. 16895 16896@item -fdump-rtl-initvals 16897@opindex fdump-rtl-initvals 16898Dump after the computation of the initial value sets. 16899 16900@item -fdump-rtl-into_cfglayout 16901@opindex fdump-rtl-into_cfglayout 16902Dump after converting to cfglayout mode. 16903 16904@item -fdump-rtl-ira 16905@opindex fdump-rtl-ira 16906Dump after iterated register allocation. 16907 16908@item -fdump-rtl-jump 16909@opindex fdump-rtl-jump 16910Dump after the second jump optimization. 16911 16912@item -fdump-rtl-loop2 16913@opindex fdump-rtl-loop2 16914@option{-fdump-rtl-loop2} enables dumping after the rtl 16915loop optimization passes. 16916 16917@item -fdump-rtl-mach 16918@opindex fdump-rtl-mach 16919Dump after performing the machine dependent reorganization pass, if that 16920pass exists. 16921 16922@item -fdump-rtl-mode_sw 16923@opindex fdump-rtl-mode_sw 16924Dump after removing redundant mode switches. 16925 16926@item -fdump-rtl-rnreg 16927@opindex fdump-rtl-rnreg 16928Dump after register renumbering. 16929 16930@item -fdump-rtl-outof_cfglayout 16931@opindex fdump-rtl-outof_cfglayout 16932Dump after converting from cfglayout mode. 16933 16934@item -fdump-rtl-peephole2 16935@opindex fdump-rtl-peephole2 16936Dump after the peephole pass. 16937 16938@item -fdump-rtl-postreload 16939@opindex fdump-rtl-postreload 16940Dump after post-reload optimizations. 16941 16942@item -fdump-rtl-pro_and_epilogue 16943@opindex fdump-rtl-pro_and_epilogue 16944Dump after generating the function prologues and epilogues. 16945 16946@item -fdump-rtl-sched1 16947@itemx -fdump-rtl-sched2 16948@opindex fdump-rtl-sched1 16949@opindex fdump-rtl-sched2 16950@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 16951after the basic block scheduling passes. 16952 16953@item -fdump-rtl-ree 16954@opindex fdump-rtl-ree 16955Dump after sign/zero extension elimination. 16956 16957@item -fdump-rtl-seqabstr 16958@opindex fdump-rtl-seqabstr 16959Dump after common sequence discovery. 16960 16961@item -fdump-rtl-shorten 16962@opindex fdump-rtl-shorten 16963Dump after shortening branches. 16964 16965@item -fdump-rtl-sibling 16966@opindex fdump-rtl-sibling 16967Dump after sibling call optimizations. 16968 16969@item -fdump-rtl-split1 16970@itemx -fdump-rtl-split2 16971@itemx -fdump-rtl-split3 16972@itemx -fdump-rtl-split4 16973@itemx -fdump-rtl-split5 16974@opindex fdump-rtl-split1 16975@opindex fdump-rtl-split2 16976@opindex fdump-rtl-split3 16977@opindex fdump-rtl-split4 16978@opindex fdump-rtl-split5 16979These options enable dumping after five rounds of 16980instruction splitting. 16981 16982@item -fdump-rtl-sms 16983@opindex fdump-rtl-sms 16984Dump after modulo scheduling. This pass is only run on some 16985architectures. 16986 16987@item -fdump-rtl-stack 16988@opindex fdump-rtl-stack 16989Dump after conversion from GCC's ``flat register file'' registers to the 16990x87's stack-like registers. This pass is only run on x86 variants. 16991 16992@item -fdump-rtl-subreg1 16993@itemx -fdump-rtl-subreg2 16994@opindex fdump-rtl-subreg1 16995@opindex fdump-rtl-subreg2 16996@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 16997the two subreg expansion passes. 16998 16999@item -fdump-rtl-unshare 17000@opindex fdump-rtl-unshare 17001Dump after all rtl has been unshared. 17002 17003@item -fdump-rtl-vartrack 17004@opindex fdump-rtl-vartrack 17005Dump after variable tracking. 17006 17007@item -fdump-rtl-vregs 17008@opindex fdump-rtl-vregs 17009Dump after converting virtual registers to hard registers. 17010 17011@item -fdump-rtl-web 17012@opindex fdump-rtl-web 17013Dump after live range splitting. 17014 17015@item -fdump-rtl-regclass 17016@itemx -fdump-rtl-subregs_of_mode_init 17017@itemx -fdump-rtl-subregs_of_mode_finish 17018@itemx -fdump-rtl-dfinit 17019@itemx -fdump-rtl-dfinish 17020@opindex fdump-rtl-regclass 17021@opindex fdump-rtl-subregs_of_mode_init 17022@opindex fdump-rtl-subregs_of_mode_finish 17023@opindex fdump-rtl-dfinit 17024@opindex fdump-rtl-dfinish 17025These dumps are defined but always produce empty files. 17026 17027@item -da 17028@itemx -fdump-rtl-all 17029@opindex da 17030@opindex fdump-rtl-all 17031Produce all the dumps listed above. 17032 17033@item -dA 17034@opindex dA 17035Annotate the assembler output with miscellaneous debugging information. 17036 17037@item -dD 17038@opindex dD 17039Dump all macro definitions, at the end of preprocessing, in addition to 17040normal output. 17041 17042@item -dH 17043@opindex dH 17044Produce a core dump whenever an error occurs. 17045 17046@item -dp 17047@opindex dp 17048Annotate the assembler output with a comment indicating which 17049pattern and alternative is used. The length and cost of each instruction are 17050also printed. 17051 17052@item -dP 17053@opindex dP 17054Dump the RTL in the assembler output as a comment before each instruction. 17055Also turns on @option{-dp} annotation. 17056 17057@item -dx 17058@opindex dx 17059Just generate RTL for a function instead of compiling it. Usually used 17060with @option{-fdump-rtl-expand}. 17061@end table 17062 17063@item -fdump-debug 17064@opindex fdump-debug 17065Dump debugging information generated during the debug 17066generation phase. 17067 17068@item -fdump-earlydebug 17069@opindex fdump-earlydebug 17070Dump debugging information generated during the early debug 17071generation phase. 17072 17073@item -fdump-noaddr 17074@opindex fdump-noaddr 17075When doing debugging dumps, suppress address output. This makes it more 17076feasible to use diff on debugging dumps for compiler invocations with 17077different compiler binaries and/or different 17078text / bss / data / heap / stack / dso start locations. 17079 17080@item -freport-bug 17081@opindex freport-bug 17082Collect and dump debug information into a temporary file if an 17083internal compiler error (ICE) occurs. 17084 17085@item -fdump-unnumbered 17086@opindex fdump-unnumbered 17087When doing debugging dumps, suppress instruction numbers and address output. 17088This makes it more feasible to use diff on debugging dumps for compiler 17089invocations with different options, in particular with and without 17090@option{-g}. 17091 17092@item -fdump-unnumbered-links 17093@opindex fdump-unnumbered-links 17094When doing debugging dumps (see @option{-d} option above), suppress 17095instruction numbers for the links to the previous and next instructions 17096in a sequence. 17097 17098@item -fdump-ipa-@var{switch} 17099@itemx -fdump-ipa-@var{switch}-@var{options} 17100@opindex fdump-ipa 17101Control the dumping at various stages of inter-procedural analysis 17102language tree to a file. The file name is generated by appending a 17103switch specific suffix to the source file name, and the file is created 17104in the same directory as the output file. The following dumps are 17105possible: 17106 17107@table @samp 17108@item all 17109Enables all inter-procedural analysis dumps. 17110 17111@item cgraph 17112Dumps information about call-graph optimization, unused function removal, 17113and inlining decisions. 17114 17115@item inline 17116Dump after function inlining. 17117 17118@end table 17119 17120Additionally, the options @option{-optimized}, @option{-missed}, 17121@option{-note}, and @option{-all} can be provided, with the same meaning 17122as for @option{-fopt-info}, defaulting to @option{-optimized}. 17123 17124For example, @option{-fdump-ipa-inline-optimized-missed} will emit 17125information on callsites that were inlined, along with callsites 17126that were not inlined. 17127 17128By default, the dump will contain messages about successful 17129optimizations (equivalent to @option{-optimized}) together with 17130low-level details about the analysis. 17131 17132@item -fdump-lang 17133@opindex fdump-lang 17134Dump language-specific information. The file name is made by appending 17135@file{.lang} to the source file name. 17136 17137@item -fdump-lang-all 17138@itemx -fdump-lang-@var{switch} 17139@itemx -fdump-lang-@var{switch}-@var{options} 17140@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename} 17141@opindex fdump-lang-all 17142@opindex fdump-lang 17143Control the dumping of language-specific information. The @var{options} 17144and @var{filename} portions behave as described in the 17145@option{-fdump-tree} option. The following @var{switch} values are 17146accepted: 17147 17148@table @samp 17149@item all 17150 17151Enable all language-specific dumps. 17152 17153@item class 17154Dump class hierarchy information. Virtual table information is emitted 17155unless '@option{slim}' is specified. This option is applicable to C++ only. 17156 17157@item module 17158Dump module information. Options @option{lineno} (locations), 17159@option{graph} (reachability), @option{blocks} (clusters), 17160@option{uid} (serialization), @option{alias} (mergeable), 17161@option{asmname} (Elrond), @option{eh} (mapper) & @option{vops} 17162(macros) may provide additional information. This option is 17163applicable to C++ only. 17164 17165@item raw 17166Dump the raw internal tree data. This option is applicable to C++ only. 17167 17168@end table 17169 17170@item -fdump-passes 17171@opindex fdump-passes 17172Print on @file{stderr} the list of optimization passes that are turned 17173on and off by the current command-line options. 17174 17175@item -fdump-statistics-@var{option} 17176@opindex fdump-statistics 17177Enable and control dumping of pass statistics in a separate file. The 17178file name is generated by appending a suffix ending in 17179@samp{.statistics} to the source file name, and the file is created in 17180the same directory as the output file. If the @samp{-@var{option}} 17181form is used, @samp{-stats} causes counters to be summed over the 17182whole compilation unit while @samp{-details} dumps every event as 17183the passes generate them. The default with no option is to sum 17184counters for each function compiled. 17185 17186@item -fdump-tree-all 17187@itemx -fdump-tree-@var{switch} 17188@itemx -fdump-tree-@var{switch}-@var{options} 17189@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 17190@opindex fdump-tree-all 17191@opindex fdump-tree 17192Control the dumping at various stages of processing the intermediate 17193language tree to a file. If the @samp{-@var{options}} 17194form is used, @var{options} is a list of @samp{-} separated options 17195which control the details of the dump. Not all options are applicable 17196to all dumps; those that are not meaningful are ignored. The 17197following options are available 17198 17199@table @samp 17200@item address 17201Print the address of each node. Usually this is not meaningful as it 17202changes according to the environment and source file. Its primary use 17203is for tying up a dump file with a debug environment. 17204@item asmname 17205If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 17206in the dump instead of @code{DECL_NAME}. Its primary use is ease of 17207use working backward from mangled names in the assembly file. 17208@item slim 17209When dumping front-end intermediate representations, inhibit dumping 17210of members of a scope or body of a function merely because that scope 17211has been reached. Only dump such items when they are directly reachable 17212by some other path. 17213 17214When dumping pretty-printed trees, this option inhibits dumping the 17215bodies of control structures. 17216 17217When dumping RTL, print the RTL in slim (condensed) form instead of 17218the default LISP-like representation. 17219@item raw 17220Print a raw representation of the tree. By default, trees are 17221pretty-printed into a C-like representation. 17222@item details 17223Enable more detailed dumps (not honored by every dump option). Also 17224include information from the optimization passes. 17225@item stats 17226Enable dumping various statistics about the pass (not honored by every dump 17227option). 17228@item blocks 17229Enable showing basic block boundaries (disabled in raw dumps). 17230@item graph 17231For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 17232dump a representation of the control flow graph suitable for viewing with 17233GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 17234the file is pretty-printed as a subgraph, so that GraphViz can render them 17235all in a single plot. 17236 17237This option currently only works for RTL dumps, and the RTL is always 17238dumped in slim form. 17239@item vops 17240Enable showing virtual operands for every statement. 17241@item lineno 17242Enable showing line numbers for statements. 17243@item uid 17244Enable showing the unique ID (@code{DECL_UID}) for each variable. 17245@item verbose 17246Enable showing the tree dump for each statement. 17247@item eh 17248Enable showing the EH region number holding each statement. 17249@item scev 17250Enable showing scalar evolution analysis details. 17251@item optimized 17252Enable showing optimization information (only available in certain 17253passes). 17254@item missed 17255Enable showing missed optimization information (only available in certain 17256passes). 17257@item note 17258Enable other detailed optimization information (only available in 17259certain passes). 17260@item all 17261Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 17262and @option{lineno}. 17263@item optall 17264Turn on all optimization options, i.e., @option{optimized}, 17265@option{missed}, and @option{note}. 17266@end table 17267 17268To determine what tree dumps are available or find the dump for a pass 17269of interest follow the steps below. 17270 17271@enumerate 17272@item 17273Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output 17274look for a code that corresponds to the pass you are interested in. 17275For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and 17276@code{tree-vrp2} correspond to the three Value Range Propagation passes. 17277The number at the end distinguishes distinct invocations of the same pass. 17278@item 17279To enable the creation of the dump file, append the pass code to 17280the @option{-fdump-} option prefix and invoke GCC with it. For example, 17281to enable the dump from the Early Value Range Propagation pass, invoke 17282GCC with the @option{-fdump-tree-evrp} option. Optionally, you may 17283specify the name of the dump file. If you don't specify one, GCC 17284creates as described below. 17285@item 17286Find the pass dump in a file whose name is composed of three components 17287separated by a period: the name of the source file GCC was invoked to 17288compile, a numeric suffix indicating the pass number followed by the 17289letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes), 17290and finally the pass code. For example, the Early VRP pass dump might 17291be in a file named @file{myfile.c.038t.evrp} in the current working 17292directory. Note that the numeric codes are not stable and may change 17293from one version of GCC to another. 17294@end enumerate 17295 17296@item -fopt-info 17297@itemx -fopt-info-@var{options} 17298@itemx -fopt-info-@var{options}=@var{filename} 17299@opindex fopt-info 17300Controls optimization dumps from various optimization passes. If the 17301@samp{-@var{options}} form is used, @var{options} is a list of 17302@samp{-} separated option keywords to select the dump details and 17303optimizations. 17304 17305The @var{options} can be divided into three groups: 17306@enumerate 17307@item 17308options describing what kinds of messages should be emitted, 17309@item 17310options describing the verbosity of the dump, and 17311@item 17312options describing which optimizations should be included. 17313@end enumerate 17314The options from each group can be freely mixed as they are 17315non-overlapping. However, in case of any conflicts, 17316the later options override the earlier options on the command 17317line. 17318 17319The following options control which kinds of messages should be emitted: 17320 17321@table @samp 17322@item optimized 17323Print information when an optimization is successfully applied. It is 17324up to a pass to decide which information is relevant. For example, the 17325vectorizer passes print the source location of loops which are 17326successfully vectorized. 17327@item missed 17328Print information about missed optimizations. Individual passes 17329control which information to include in the output. 17330@item note 17331Print verbose information about optimizations, such as certain 17332transformations, more detailed messages about decisions etc. 17333@item all 17334Print detailed optimization information. This includes 17335@samp{optimized}, @samp{missed}, and @samp{note}. 17336@end table 17337 17338The following option controls the dump verbosity: 17339 17340@table @samp 17341@item internals 17342By default, only ``high-level'' messages are emitted. This option enables 17343additional, more detailed, messages, which are likely to only be of interest 17344to GCC developers. 17345@end table 17346 17347One or more of the following option keywords can be used to describe a 17348group of optimizations: 17349 17350@table @samp 17351@item ipa 17352Enable dumps from all interprocedural optimizations. 17353@item loop 17354Enable dumps from all loop optimizations. 17355@item inline 17356Enable dumps from all inlining optimizations. 17357@item omp 17358Enable dumps from all OMP (Offloading and Multi Processing) optimizations. 17359@item vec 17360Enable dumps from all vectorization optimizations. 17361@item optall 17362Enable dumps from all optimizations. This is a superset of 17363the optimization groups listed above. 17364@end table 17365 17366If @var{options} is 17367omitted, it defaults to @samp{optimized-optall}, which means to dump messages 17368about successful optimizations from all the passes, omitting messages 17369that are treated as ``internals''. 17370 17371If the @var{filename} is provided, then the dumps from all the 17372applicable optimizations are concatenated into the @var{filename}. 17373Otherwise the dump is output onto @file{stderr}. Though multiple 17374@option{-fopt-info} options are accepted, only one of them can include 17375a @var{filename}. If other filenames are provided then all but the 17376first such option are ignored. 17377 17378Note that the output @var{filename} is overwritten 17379in case of multiple translation units. If a combined output from 17380multiple translation units is desired, @file{stderr} should be used 17381instead. 17382 17383In the following example, the optimization info is output to 17384@file{stderr}: 17385 17386@smallexample 17387gcc -O3 -fopt-info 17388@end smallexample 17389 17390This example: 17391@smallexample 17392gcc -O3 -fopt-info-missed=missed.all 17393@end smallexample 17394 17395@noindent 17396outputs missed optimization report from all the passes into 17397@file{missed.all}, and this one: 17398 17399@smallexample 17400gcc -O2 -ftree-vectorize -fopt-info-vec-missed 17401@end smallexample 17402 17403@noindent 17404prints information about missed optimization opportunities from 17405vectorization passes on @file{stderr}. 17406Note that @option{-fopt-info-vec-missed} is equivalent to 17407@option{-fopt-info-missed-vec}. The order of the optimization group 17408names and message types listed after @option{-fopt-info} does not matter. 17409 17410As another example, 17411@smallexample 17412gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 17413@end smallexample 17414 17415@noindent 17416outputs information about missed optimizations as well as 17417optimized locations from all the inlining passes into 17418@file{inline.txt}. 17419 17420Finally, consider: 17421 17422@smallexample 17423gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 17424@end smallexample 17425 17426@noindent 17427Here the two output filenames @file{vec.miss} and @file{loop.opt} are 17428in conflict since only one output file is allowed. In this case, only 17429the first option takes effect and the subsequent options are 17430ignored. Thus only @file{vec.miss} is produced which contains 17431dumps from the vectorizer about missed opportunities. 17432 17433@item -fsave-optimization-record 17434@opindex fsave-optimization-record 17435Write a SRCFILE.opt-record.json.gz file detailing what optimizations 17436were performed, for those optimizations that support @option{-fopt-info}. 17437 17438This option is experimental and the format of the data within the 17439compressed JSON file is subject to change. 17440 17441It is roughly equivalent to a machine-readable version of 17442@option{-fopt-info-all}, as a collection of messages with source file, 17443line number and column number, with the following additional data for 17444each message: 17445 17446@itemize @bullet 17447 17448@item 17449the execution count of the code being optimized, along with metadata about 17450whether this was from actual profile data, or just an estimate, allowing 17451consumers to prioritize messages by code hotness, 17452 17453@item 17454the function name of the code being optimized, where applicable, 17455 17456@item 17457the ``inlining chain'' for the code being optimized, so that when 17458a function is inlined into several different places (which might 17459themselves be inlined), the reader can distinguish between the copies, 17460 17461@item 17462objects identifying those parts of the message that refer to expressions, 17463statements or symbol-table nodes, which of these categories they are, and, 17464when available, their source code location, 17465 17466@item 17467the GCC pass that emitted the message, and 17468 17469@item 17470the location in GCC's own code from which the message was emitted 17471 17472@end itemize 17473 17474Additionally, some messages are logically nested within other 17475messages, reflecting implementation details of the optimization 17476passes. 17477 17478@item -fsched-verbose=@var{n} 17479@opindex fsched-verbose 17480On targets that use instruction scheduling, this option controls the 17481amount of debugging output the scheduler prints to the dump files. 17482 17483For @var{n} greater than zero, @option{-fsched-verbose} outputs the 17484same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 17485For @var{n} greater than one, it also output basic block probabilities, 17486detailed ready list information and unit/insn info. For @var{n} greater 17487than two, it includes RTL at abort point, control-flow and regions info. 17488And for @var{n} over four, @option{-fsched-verbose} also includes 17489dependence info. 17490 17491 17492 17493@item -fenable-@var{kind}-@var{pass} 17494@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 17495@opindex fdisable- 17496@opindex fenable- 17497 17498This is a set of options that are used to explicitly disable/enable 17499optimization passes. These options are intended for use for debugging GCC. 17500Compiler users should use regular options for enabling/disabling 17501passes instead. 17502 17503@table @gcctabopt 17504 17505@item -fdisable-ipa-@var{pass} 17506Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 17507statically invoked in the compiler multiple times, the pass name should be 17508appended with a sequential number starting from 1. 17509 17510@item -fdisable-rtl-@var{pass} 17511@itemx -fdisable-rtl-@var{pass}=@var{range-list} 17512Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 17513statically invoked in the compiler multiple times, the pass name should be 17514appended with a sequential number starting from 1. @var{range-list} is a 17515comma-separated list of function ranges or assembler names. Each range is a number 17516pair separated by a colon. The range is inclusive in both ends. If the range 17517is trivial, the number pair can be simplified as a single number. If the 17518function's call graph node's @var{uid} falls within one of the specified ranges, 17519the @var{pass} is disabled for that function. The @var{uid} is shown in the 17520function header of a dump file, and the pass names can be dumped by using 17521option @option{-fdump-passes}. 17522 17523@item -fdisable-tree-@var{pass} 17524@itemx -fdisable-tree-@var{pass}=@var{range-list} 17525Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 17526option arguments. 17527 17528@item -fenable-ipa-@var{pass} 17529Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 17530statically invoked in the compiler multiple times, the pass name should be 17531appended with a sequential number starting from 1. 17532 17533@item -fenable-rtl-@var{pass} 17534@itemx -fenable-rtl-@var{pass}=@var{range-list} 17535Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 17536description and examples. 17537 17538@item -fenable-tree-@var{pass} 17539@itemx -fenable-tree-@var{pass}=@var{range-list} 17540Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 17541of option arguments. 17542 17543@end table 17544 17545Here are some examples showing uses of these options. 17546 17547@smallexample 17548 17549# disable ccp1 for all functions 17550 -fdisable-tree-ccp1 17551# disable complete unroll for function whose cgraph node uid is 1 17552 -fenable-tree-cunroll=1 17553# disable gcse2 for functions at the following ranges [1,1], 17554# [300,400], and [400,1000] 17555# disable gcse2 for functions foo and foo2 17556 -fdisable-rtl-gcse2=foo,foo2 17557# disable early inlining 17558 -fdisable-tree-einline 17559# disable ipa inlining 17560 -fdisable-ipa-inline 17561# enable tree full unroll 17562 -fenable-tree-unroll 17563 17564@end smallexample 17565 17566@item -fchecking 17567@itemx -fchecking=@var{n} 17568@opindex fchecking 17569@opindex fno-checking 17570Enable internal consistency checking. The default depends on 17571the compiler configuration. @option{-fchecking=2} enables further 17572internal consistency checking that might affect code generation. 17573 17574@item -frandom-seed=@var{string} 17575@opindex frandom-seed 17576This option provides a seed that GCC uses in place of 17577random numbers in generating certain symbol names 17578that have to be different in every compiled file. It is also used to 17579place unique stamps in coverage data files and the object files that 17580produce them. You can use the @option{-frandom-seed} option to produce 17581reproducibly identical object files. 17582 17583The @var{string} can either be a number (decimal, octal or hex) or an 17584arbitrary string (in which case it's converted to a number by 17585computing CRC32). 17586 17587The @var{string} should be different for every file you compile. 17588 17589@item -save-temps 17590@opindex save-temps 17591Store the usual ``temporary'' intermediate files permanently; name them 17592as auxiliary output files, as specified described under 17593@option{-dumpbase} and @option{-dumpdir}. 17594 17595When used in combination with the @option{-x} command-line option, 17596@option{-save-temps} is sensible enough to avoid overwriting an 17597input source file with the same extension as an intermediate file. 17598The corresponding intermediate file may be obtained by renaming the 17599source file before using @option{-save-temps}. 17600 17601@item -save-temps=cwd 17602@opindex save-temps=cwd 17603Equivalent to @option{-save-temps -dumpdir ./}. 17604 17605@item -save-temps=obj 17606@opindex save-temps=obj 17607Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where 17608@file{outdir/} is the directory of the output file specified after the 17609@option{-o} option, including any directory separators. If the 17610@option{-o} option is not used, the @option{-save-temps=obj} switch 17611behaves like @option{-save-temps=cwd}. 17612 17613@item -time@r{[}=@var{file}@r{]} 17614@opindex time 17615Report the CPU time taken by each subprocess in the compilation 17616sequence. For C source files, this is the compiler proper and assembler 17617(plus the linker if linking is done). 17618 17619Without the specification of an output file, the output looks like this: 17620 17621@smallexample 17622# cc1 0.12 0.01 17623# as 0.00 0.01 17624@end smallexample 17625 17626The first number on each line is the ``user time'', that is time spent 17627executing the program itself. The second number is ``system time'', 17628time spent executing operating system routines on behalf of the program. 17629Both numbers are in seconds. 17630 17631With the specification of an output file, the output is appended to the 17632named file, and it looks like this: 17633 17634@smallexample 176350.12 0.01 cc1 @var{options} 176360.00 0.01 as @var{options} 17637@end smallexample 17638 17639The ``user time'' and the ``system time'' are moved before the program 17640name, and the options passed to the program are displayed, so that one 17641can later tell what file was being compiled, and with which options. 17642 17643@item -fdump-final-insns@r{[}=@var{file}@r{]} 17644@opindex fdump-final-insns 17645Dump the final internal representation (RTL) to @var{file}. If the 17646optional argument is omitted (or if @var{file} is @code{.}), the name 17647of the dump file is determined by appending @code{.gkd} to the 17648dump base name, see @option{-dumpbase}. 17649 17650@item -fcompare-debug@r{[}=@var{opts}@r{]} 17651@opindex fcompare-debug 17652@opindex fno-compare-debug 17653If no error occurs during compilation, run the compiler a second time, 17654adding @var{opts} and @option{-fcompare-debug-second} to the arguments 17655passed to the second compilation. Dump the final internal 17656representation in both compilations, and print an error if they differ. 17657 17658If the equal sign is omitted, the default @option{-gtoggle} is used. 17659 17660The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 17661and nonzero, implicitly enables @option{-fcompare-debug}. If 17662@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 17663then it is used for @var{opts}, otherwise the default @option{-gtoggle} 17664is used. 17665 17666@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 17667is equivalent to @option{-fno-compare-debug}, which disables the dumping 17668of the final representation and the second compilation, preventing even 17669@env{GCC_COMPARE_DEBUG} from taking effect. 17670 17671To verify full coverage during @option{-fcompare-debug} testing, set 17672@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 17673which GCC rejects as an invalid option in any actual compilation 17674(rather than preprocessing, assembly or linking). To get just a 17675warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 17676not overridden} will do. 17677 17678@item -fcompare-debug-second 17679@opindex fcompare-debug-second 17680This option is implicitly passed to the compiler for the second 17681compilation requested by @option{-fcompare-debug}, along with options to 17682silence warnings, and omitting other options that would cause the compiler 17683to produce output to files or to standard output as a side effect. Dump 17684files and preserved temporary files are renamed so as to contain the 17685@code{.gk} additional extension during the second compilation, to avoid 17686overwriting those generated by the first. 17687 17688When this option is passed to the compiler driver, it causes the 17689@emph{first} compilation to be skipped, which makes it useful for little 17690other than debugging the compiler proper. 17691 17692@item -gtoggle 17693@opindex gtoggle 17694Turn off generation of debug info, if leaving out this option 17695generates it, or turn it on at level 2 otherwise. The position of this 17696argument in the command line does not matter; it takes effect after all 17697other options are processed, and it does so only once, no matter how 17698many times it is given. This is mainly intended to be used with 17699@option{-fcompare-debug}. 17700 17701@item -fvar-tracking-assignments-toggle 17702@opindex fvar-tracking-assignments-toggle 17703@opindex fno-var-tracking-assignments-toggle 17704Toggle @option{-fvar-tracking-assignments}, in the same way that 17705@option{-gtoggle} toggles @option{-g}. 17706 17707@item -Q 17708@opindex Q 17709Makes the compiler print out each function name as it is compiled, and 17710print some statistics about each pass when it finishes. 17711 17712@item -ftime-report 17713@opindex ftime-report 17714Makes the compiler print some statistics about the time consumed by each 17715pass when it finishes. 17716 17717@item -ftime-report-details 17718@opindex ftime-report-details 17719Record the time consumed by infrastructure parts separately for each pass. 17720 17721@item -fira-verbose=@var{n} 17722@opindex fira-verbose 17723Control the verbosity of the dump file for the integrated register allocator. 17724The default value is 5. If the value @var{n} is greater or equal to 10, 17725the dump output is sent to stderr using the same format as @var{n} minus 10. 17726 17727@item -flto-report 17728@opindex flto-report 17729Prints a report with internal details on the workings of the link-time 17730optimizer. The contents of this report vary from version to version. 17731It is meant to be useful to GCC developers when processing object 17732files in LTO mode (via @option{-flto}). 17733 17734Disabled by default. 17735 17736@item -flto-report-wpa 17737@opindex flto-report-wpa 17738Like @option{-flto-report}, but only print for the WPA phase of link-time 17739optimization. 17740 17741@item -fmem-report 17742@opindex fmem-report 17743Makes the compiler print some statistics about permanent memory 17744allocation when it finishes. 17745 17746@item -fmem-report-wpa 17747@opindex fmem-report-wpa 17748Makes the compiler print some statistics about permanent memory 17749allocation for the WPA phase only. 17750 17751@item -fpre-ipa-mem-report 17752@opindex fpre-ipa-mem-report 17753@item -fpost-ipa-mem-report 17754@opindex fpost-ipa-mem-report 17755Makes the compiler print some statistics about permanent memory 17756allocation before or after interprocedural optimization. 17757 17758@item -fprofile-report 17759@opindex fprofile-report 17760Makes the compiler print some statistics about consistency of the 17761(estimated) profile and effect of individual passes. 17762 17763@item -fstack-usage 17764@opindex fstack-usage 17765Makes the compiler output stack usage information for the program, on a 17766per-function basis. The filename for the dump is made by appending 17767@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 17768the output file, if explicitly specified and it is not an executable, 17769otherwise it is the basename of the source file. An entry is made up 17770of three fields: 17771 17772@itemize 17773@item 17774The name of the function. 17775@item 17776A number of bytes. 17777@item 17778One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 17779@end itemize 17780 17781The qualifier @code{static} means that the function manipulates the stack 17782statically: a fixed number of bytes are allocated for the frame on function 17783entry and released on function exit; no stack adjustments are otherwise made 17784in the function. The second field is this fixed number of bytes. 17785 17786The qualifier @code{dynamic} means that the function manipulates the stack 17787dynamically: in addition to the static allocation described above, stack 17788adjustments are made in the body of the function, for example to push/pop 17789arguments around function calls. If the qualifier @code{bounded} is also 17790present, the amount of these adjustments is bounded at compile time and 17791the second field is an upper bound of the total amount of stack used by 17792the function. If it is not present, the amount of these adjustments is 17793not bounded at compile time and the second field only represents the 17794bounded part. 17795 17796@item -fstats 17797@opindex fstats 17798Emit statistics about front-end processing at the end of the compilation. 17799This option is supported only by the C++ front end, and 17800the information is generally only useful to the G++ development team. 17801 17802@item -fdbg-cnt-list 17803@opindex fdbg-cnt-list 17804Print the name and the counter upper bound for all debug counters. 17805 17806 17807@item -fdbg-cnt=@var{counter-value-list} 17808@opindex fdbg-cnt 17809Set the internal debug counter lower and upper bound. @var{counter-value-list} 17810is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1} 17811[:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets 17812the name of the counter and list of closed intervals. 17813The @var{lower_bound} is optional and is zero 17814initialized if not set. 17815For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10}, 17816@code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and 17817eleventh invocation. 17818For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations. 17819 17820@item -print-file-name=@var{library} 17821@opindex print-file-name 17822Print the full absolute name of the library file @var{library} that 17823would be used when linking---and don't do anything else. With this 17824option, GCC does not compile or link anything; it just prints the 17825file name. 17826 17827@item -print-multi-directory 17828@opindex print-multi-directory 17829Print the directory name corresponding to the multilib selected by any 17830other switches present in the command line. This directory is supposed 17831to exist in @env{GCC_EXEC_PREFIX}. 17832 17833@item -print-multi-lib 17834@opindex print-multi-lib 17835Print the mapping from multilib directory names to compiler switches 17836that enable them. The directory name is separated from the switches by 17837@samp{;}, and each switch starts with an @samp{@@} instead of the 17838@samp{-}, without spaces between multiple switches. This is supposed to 17839ease shell processing. 17840 17841@item -print-multi-os-directory 17842@opindex print-multi-os-directory 17843Print the path to OS libraries for the selected 17844multilib, relative to some @file{lib} subdirectory. If OS libraries are 17845present in the @file{lib} subdirectory and no multilibs are used, this is 17846usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 17847sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 17848@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 17849subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 17850 17851@item -print-multiarch 17852@opindex print-multiarch 17853Print the path to OS libraries for the selected multiarch, 17854relative to some @file{lib} subdirectory. 17855 17856@item -print-prog-name=@var{program} 17857@opindex print-prog-name 17858Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 17859 17860@item -print-libgcc-file-name 17861@opindex print-libgcc-file-name 17862Same as @option{-print-file-name=libgcc.a}. 17863 17864This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 17865but you do want to link with @file{libgcc.a}. You can do: 17866 17867@smallexample 17868gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 17869@end smallexample 17870 17871@item -print-search-dirs 17872@opindex print-search-dirs 17873Print the name of the configured installation directory and a list of 17874program and library directories @command{gcc} searches---and don't do anything else. 17875 17876This is useful when @command{gcc} prints the error message 17877@samp{installation problem, cannot exec cpp0: No such file or directory}. 17878To resolve this you either need to put @file{cpp0} and the other compiler 17879components where @command{gcc} expects to find them, or you can set the environment 17880variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 17881Don't forget the trailing @samp{/}. 17882@xref{Environment Variables}. 17883 17884@item -print-sysroot 17885@opindex print-sysroot 17886Print the target sysroot directory that is used during 17887compilation. This is the target sysroot specified either at configure 17888time or using the @option{--sysroot} option, possibly with an extra 17889suffix that depends on compilation options. If no target sysroot is 17890specified, the option prints nothing. 17891 17892@item -print-sysroot-headers-suffix 17893@opindex print-sysroot-headers-suffix 17894Print the suffix added to the target sysroot when searching for 17895headers, or give an error if the compiler is not configured with such 17896a suffix---and don't do anything else. 17897 17898@item -dumpmachine 17899@opindex dumpmachine 17900Print the compiler's target machine (for example, 17901@samp{i686-pc-linux-gnu})---and don't do anything else. 17902 17903@item -dumpversion 17904@opindex dumpversion 17905Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do 17906anything else. This is the compiler version used in filesystem paths and 17907specs. Depending on how the compiler has been configured it can be just 17908a single number (major version), two numbers separated by a dot (major and 17909minor version) or three numbers separated by dots (major, minor and patchlevel 17910version). 17911 17912@item -dumpfullversion 17913@opindex dumpfullversion 17914Print the full compiler version---and don't do anything else. The output is 17915always three numbers separated by dots, major, minor and patchlevel version. 17916 17917@item -dumpspecs 17918@opindex dumpspecs 17919Print the compiler's built-in specs---and don't do anything else. (This 17920is used when GCC itself is being built.) @xref{Spec Files}. 17921@end table 17922 17923@node Submodel Options 17924@section Machine-Dependent Options 17925@cindex submodel options 17926@cindex specifying hardware config 17927@cindex hardware models and configurations, specifying 17928@cindex target-dependent options 17929@cindex machine-dependent options 17930 17931Each target machine supported by GCC can have its own options---for 17932example, to allow you to compile for a particular processor variant or 17933ABI, or to control optimizations specific to that machine. By 17934convention, the names of machine-specific options start with 17935@samp{-m}. 17936 17937Some configurations of the compiler also support additional target-specific 17938options, usually for compatibility with other compilers on the same 17939platform. 17940 17941@c This list is ordered alphanumerically by subsection name. 17942@c It should be the same order and spelling as these options are listed 17943@c in Machine Dependent Options 17944 17945@menu 17946* AArch64 Options:: 17947* Adapteva Epiphany Options:: 17948* AMD GCN Options:: 17949* ARC Options:: 17950* ARM Options:: 17951* AVR Options:: 17952* Blackfin Options:: 17953* C6X Options:: 17954* CRIS Options:: 17955* CR16 Options:: 17956* C-SKY Options:: 17957* Darwin Options:: 17958* DEC Alpha Options:: 17959* eBPF Options:: 17960* FR30 Options:: 17961* FT32 Options:: 17962* FRV Options:: 17963* GNU/Linux Options:: 17964* H8/300 Options:: 17965* HPPA Options:: 17966* IA-64 Options:: 17967* LM32 Options:: 17968* M32C Options:: 17969* M32R/D Options:: 17970* M680x0 Options:: 17971* MCore Options:: 17972* MeP Options:: 17973* MicroBlaze Options:: 17974* MIPS Options:: 17975* MMIX Options:: 17976* MN10300 Options:: 17977* Moxie Options:: 17978* MSP430 Options:: 17979* NDS32 Options:: 17980* Nios II Options:: 17981* Nvidia PTX Options:: 17982* OpenRISC Options:: 17983* PDP-11 Options:: 17984* picoChip Options:: 17985* PowerPC Options:: 17986* PRU Options:: 17987* RISC-V Options:: 17988* RL78 Options:: 17989* RS/6000 and PowerPC Options:: 17990* RX Options:: 17991* S/390 and zSeries Options:: 17992* Score Options:: 17993* SH Options:: 17994* Solaris 2 Options:: 17995* SPARC Options:: 17996* System V Options:: 17997* TILE-Gx Options:: 17998* TILEPro Options:: 17999* V850 Options:: 18000* VAX Options:: 18001* Visium Options:: 18002* VMS Options:: 18003* VxWorks Options:: 18004* x86 Options:: 18005* x86 Windows Options:: 18006* Xstormy16 Options:: 18007* Xtensa Options:: 18008* zSeries Options:: 18009@end menu 18010 18011@node AArch64 Options 18012@subsection AArch64 Options 18013@cindex AArch64 Options 18014 18015These options are defined for AArch64 implementations: 18016 18017@table @gcctabopt 18018 18019@item -mabi=@var{name} 18020@opindex mabi 18021Generate code for the specified data model. Permissible values 18022are @samp{ilp32} for SysV-like data model where int, long int and pointers 18023are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits, 18024but long int and pointers are 64 bits. 18025 18026The default depends on the specific target configuration. Note that 18027the LP64 and ILP32 ABIs are not link-compatible; you must compile your 18028entire program with the same ABI, and link with a compatible set of libraries. 18029 18030@item -mbig-endian 18031@opindex mbig-endian 18032Generate big-endian code. This is the default when GCC is configured for an 18033@samp{aarch64_be-*-*} target. 18034 18035@item -mgeneral-regs-only 18036@opindex mgeneral-regs-only 18037Generate code which uses only the general-purpose registers. This will prevent 18038the compiler from using floating-point and Advanced SIMD registers but will not 18039impose any restrictions on the assembler. 18040 18041@item -mlittle-endian 18042@opindex mlittle-endian 18043Generate little-endian code. This is the default when GCC is configured for an 18044@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 18045 18046@item -mcmodel=tiny 18047@opindex mcmodel=tiny 18048Generate code for the tiny code model. The program and its statically defined 18049symbols must be within 1MB of each other. Programs can be statically or 18050dynamically linked. 18051 18052@item -mcmodel=small 18053@opindex mcmodel=small 18054Generate code for the small code model. The program and its statically defined 18055symbols must be within 4GB of each other. Programs can be statically or 18056dynamically linked. This is the default code model. 18057 18058@item -mcmodel=large 18059@opindex mcmodel=large 18060Generate code for the large code model. This makes no assumptions about 18061addresses and sizes of sections. Programs can be statically linked only. The 18062@option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32}, 18063@option{-fpic} and @option{-fPIC}. 18064 18065@item -mstrict-align 18066@itemx -mno-strict-align 18067@opindex mstrict-align 18068@opindex mno-strict-align 18069Avoid or allow generating memory accesses that may not be aligned on a natural 18070object boundary as described in the architecture specification. 18071 18072@item -momit-leaf-frame-pointer 18073@itemx -mno-omit-leaf-frame-pointer 18074@opindex momit-leaf-frame-pointer 18075@opindex mno-omit-leaf-frame-pointer 18076Omit or keep the frame pointer in leaf functions. The former behavior is the 18077default. 18078 18079@item -mstack-protector-guard=@var{guard} 18080@itemx -mstack-protector-guard-reg=@var{reg} 18081@itemx -mstack-protector-guard-offset=@var{offset} 18082@opindex mstack-protector-guard 18083@opindex mstack-protector-guard-reg 18084@opindex mstack-protector-guard-offset 18085Generate stack protection code using canary at @var{guard}. Supported 18086locations are @samp{global} for a global canary or @samp{sysreg} for a 18087canary in an appropriate system register. 18088 18089With the latter choice the options 18090@option{-mstack-protector-guard-reg=@var{reg}} and 18091@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 18092which system register to use as base register for reading the canary, 18093and from what offset from that base register. There is no default 18094register or offset as this is entirely for use within the Linux 18095kernel. 18096 18097@item -mtls-dialect=desc 18098@opindex mtls-dialect=desc 18099Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 18100of TLS variables. This is the default. 18101 18102@item -mtls-dialect=traditional 18103@opindex mtls-dialect=traditional 18104Use traditional TLS as the thread-local storage mechanism for dynamic accesses 18105of TLS variables. 18106 18107@item -mtls-size=@var{size} 18108@opindex mtls-size 18109Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48. 18110This option requires binutils 2.26 or newer. 18111 18112@item -mfix-cortex-a53-835769 18113@itemx -mno-fix-cortex-a53-835769 18114@opindex mfix-cortex-a53-835769 18115@opindex mno-fix-cortex-a53-835769 18116Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 18117This involves inserting a NOP instruction between memory instructions and 1811864-bit integer multiply-accumulate instructions. 18119 18120@item -mfix-cortex-a53-843419 18121@itemx -mno-fix-cortex-a53-843419 18122@opindex mfix-cortex-a53-843419 18123@opindex mno-fix-cortex-a53-843419 18124Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 18125This erratum workaround is made at link time and this will only pass the 18126corresponding flag to the linker. 18127 18128@item -mlow-precision-recip-sqrt 18129@itemx -mno-low-precision-recip-sqrt 18130@opindex mlow-precision-recip-sqrt 18131@opindex mno-low-precision-recip-sqrt 18132Enable or disable the reciprocal square root approximation. 18133This option only has an effect if @option{-ffast-math} or 18134@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 18135precision of reciprocal square root results to about 16 bits for 18136single precision and to 32 bits for double precision. 18137 18138@item -mlow-precision-sqrt 18139@itemx -mno-low-precision-sqrt 18140@opindex mlow-precision-sqrt 18141@opindex mno-low-precision-sqrt 18142Enable or disable the square root approximation. 18143This option only has an effect if @option{-ffast-math} or 18144@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 18145precision of square root results to about 16 bits for 18146single precision and to 32 bits for double precision. 18147If enabled, it implies @option{-mlow-precision-recip-sqrt}. 18148 18149@item -mlow-precision-div 18150@itemx -mno-low-precision-div 18151@opindex mlow-precision-div 18152@opindex mno-low-precision-div 18153Enable or disable the division approximation. 18154This option only has an effect if @option{-ffast-math} or 18155@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 18156precision of division results to about 16 bits for 18157single precision and to 32 bits for double precision. 18158 18159@item -mtrack-speculation 18160@itemx -mno-track-speculation 18161Enable or disable generation of additional code to track speculative 18162execution through conditional branches. The tracking state can then 18163be used by the compiler when expanding calls to 18164@code{__builtin_speculation_safe_copy} to permit a more efficient code 18165sequence to be generated. 18166 18167@item -moutline-atomics 18168@itemx -mno-outline-atomics 18169Enable or disable calls to out-of-line helpers to implement atomic operations. 18170These helpers will, at runtime, determine if the LSE instructions from 18171ARMv8.1-A can be used; if not, they will use the load/store-exclusive 18172instructions that are present in the base ARMv8.0 ISA. 18173 18174This option is only applicable when compiling for the base ARMv8.0 18175instruction set. If using a later revision, e.g. @option{-march=armv8.1-a} 18176or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be 18177used directly. The same applies when using @option{-mcpu=} when the 18178selected cpu supports the @samp{lse} feature. 18179This option is on by default. 18180 18181@item -march=@var{name} 18182@opindex march 18183Specify the name of the target architecture and, optionally, one or 18184more feature modifiers. This option has the form 18185@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}. 18186 18187The table below summarizes the permissible values for @var{arch} 18188and the features that they enable by default: 18189 18190@multitable @columnfractions 0.20 0.20 0.60 18191@headitem @var{arch} value @tab Architecture @tab Includes by default 18192@item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd} 18193@item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma} 18194@item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a} 18195@item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth} 18196@item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod} 18197@item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres} 18198@item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm} 18199@item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r} 18200@end multitable 18201 18202The value @samp{native} is available on native AArch64 GNU/Linux and 18203causes the compiler to pick the architecture of the host system. This 18204option has no effect if the compiler is unable to recognize the 18205architecture of the host system, 18206 18207The permissible values for @var{feature} are listed in the sub-section 18208on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 18209Feature Modifiers}. Where conflicting feature modifiers are 18210specified, the right-most feature is used. 18211 18212GCC uses @var{name} to determine what kind of instructions it can emit 18213when generating assembly code. If @option{-march} is specified 18214without either of @option{-mtune} or @option{-mcpu} also being 18215specified, the code is tuned to perform well across a range of target 18216processors implementing the target architecture. 18217 18218@item -mtune=@var{name} 18219@opindex mtune 18220Specify the name of the target processor for which GCC should tune the 18221performance of the code. Permissible values for this option are: 18222@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 18223@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 18224@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77}, 18225@samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34}, 18226@samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, 18227@samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor}, 18228@samp{neoverse-e1}, @samp{neoverse-n1}, @samp{neoverse-n2}, 18229@samp{neoverse-v1}, @samp{qdf24xx}, @samp{saphira}, 18230@samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx}, 18231@samp{octeontx81}, @samp{octeontx83}, 18232@samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96} 18233@samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n}, 18234@samp{octeontx2f95mm}, 18235@samp{a64fx}, 18236@samp{thunderx}, @samp{thunderxt88}, 18237@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110}, 18238@samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus}, 18239@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 18240@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 18241@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}, 18242@samp{cortex-r82}, @samp{cortex-x1}, @samp{native}. 18243 18244The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 18245@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 18246@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC 18247should tune for a big.LITTLE system. 18248 18249Additionally on native AArch64 GNU/Linux systems the value 18250@samp{native} tunes performance to the host system. This option has no effect 18251if the compiler is unable to recognize the processor of the host system. 18252 18253Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 18254are specified, the code is tuned to perform well across a range 18255of target processors. 18256 18257This option cannot be suffixed by feature modifiers. 18258 18259@item -mcpu=@var{name} 18260@opindex mcpu 18261Specify the name of the target processor, optionally suffixed by one 18262or more feature modifiers. This option has the form 18263@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where 18264the permissible values for @var{cpu} are the same as those available 18265for @option{-mtune}. The permissible values for @var{feature} are 18266documented in the sub-section on 18267@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 18268Feature Modifiers}. Where conflicting feature modifiers are 18269specified, the right-most feature is used. 18270 18271GCC uses @var{name} to determine what kind of instructions it can emit when 18272generating assembly code (as if by @option{-march}) and to determine 18273the target processor for which to tune for performance (as if 18274by @option{-mtune}). Where this option is used in conjunction 18275with @option{-march} or @option{-mtune}, those options take precedence 18276over the appropriate part of this option. 18277 18278@item -moverride=@var{string} 18279@opindex moverride 18280Override tuning decisions made by the back-end in response to a 18281@option{-mtune=} switch. The syntax, semantics, and accepted values 18282for @var{string} in this option are not guaranteed to be consistent 18283across releases. 18284 18285This option is only intended to be useful when developing GCC. 18286 18287@item -mverbose-cost-dump 18288@opindex mverbose-cost-dump 18289Enable verbose cost model dumping in the debug dump files. This option is 18290provided for use in debugging the compiler. 18291 18292@item -mpc-relative-literal-loads 18293@itemx -mno-pc-relative-literal-loads 18294@opindex mpc-relative-literal-loads 18295@opindex mno-pc-relative-literal-loads 18296Enable or disable PC-relative literal loads. With this option literal pools are 18297accessed using a single instruction and emitted after each function. This 18298limits the maximum size of functions to 1MB. This is enabled by default for 18299@option{-mcmodel=tiny}. 18300 18301@item -msign-return-address=@var{scope} 18302@opindex msign-return-address 18303Select the function scope on which return address signing will be applied. 18304Permissible values are @samp{none}, which disables return address signing, 18305@samp{non-leaf}, which enables pointer signing for functions which are not leaf 18306functions, and @samp{all}, which enables pointer signing for all functions. The 18307default value is @samp{none}. This option has been deprecated by 18308-mbranch-protection. 18309 18310@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti} 18311@opindex mbranch-protection 18312Select the branch protection features to use. 18313@samp{none} is the default and turns off all types of branch protection. 18314@samp{standard} turns on all types of branch protection features. If a feature 18315has additional tuning options, then @samp{standard} sets it to its standard 18316level. 18317@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard 18318level: signing functions that save the return address to memory (non-leaf 18319functions will practically always do this) using the a-key. The optional 18320argument @samp{leaf} can be used to extend the signing to include leaf 18321functions. The optional argument @samp{b-key} can be used to sign the functions 18322with the B-key instead of the A-key. 18323@samp{bti} turns on branch target identification mechanism. 18324 18325@item -mharden-sls=@var{opts} 18326@opindex mharden-sls 18327Enable compiler hardening against straight line speculation (SLS). 18328@var{opts} is a comma-separated list of the following options: 18329@table @samp 18330@item retbr 18331@item blr 18332@end table 18333In addition, @samp{-mharden-sls=all} enables all SLS hardening while 18334@samp{-mharden-sls=none} disables all SLS hardening. 18335 18336@item -msve-vector-bits=@var{bits} 18337@opindex msve-vector-bits 18338Specify the number of bits in an SVE vector register. This option only has 18339an effect when SVE is enabled. 18340 18341GCC supports two forms of SVE code generation: ``vector-length 18342agnostic'' output that works with any size of vector register and 18343``vector-length specific'' output that allows GCC to make assumptions 18344about the vector length when it is useful for optimization reasons. 18345The possible values of @samp{bits} are: @samp{scalable}, @samp{128}, 18346@samp{256}, @samp{512}, @samp{1024} and @samp{2048}. 18347Specifying @samp{scalable} selects vector-length agnostic 18348output. At present @samp{-msve-vector-bits=128} also generates vector-length 18349agnostic output for big-endian targets. All other values generate 18350vector-length specific code. The behavior of these values may change 18351in future releases and no value except @samp{scalable} should be 18352relied on for producing code that is portable across different 18353hardware SVE vector lengths. 18354 18355The default is @samp{-msve-vector-bits=scalable}, which produces 18356vector-length agnostic code. 18357@end table 18358 18359@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 18360@anchor{aarch64-feature-modifiers} 18361@cindex @option{-march} feature modifiers 18362@cindex @option{-mcpu} feature modifiers 18363Feature modifiers used with @option{-march} and @option{-mcpu} can be any of 18364the following and their inverses @option{no@var{feature}}: 18365 18366@table @samp 18367@item crc 18368Enable CRC extension. This is on by default for 18369@option{-march=armv8.1-a}. 18370@item crypto 18371Enable Crypto extension. This also enables Advanced SIMD and floating-point 18372instructions. 18373@item fp 18374Enable floating-point instructions. This is on by default for all possible 18375values for options @option{-march} and @option{-mcpu}. 18376@item simd 18377Enable Advanced SIMD instructions. This also enables floating-point 18378instructions. This is on by default for all possible values for options 18379@option{-march} and @option{-mcpu}. 18380@item sve 18381Enable Scalable Vector Extension instructions. This also enables Advanced 18382SIMD and floating-point instructions. 18383@item lse 18384Enable Large System Extension instructions. This is on by default for 18385@option{-march=armv8.1-a}. 18386@item rdma 18387Enable Round Double Multiply Accumulate instructions. This is on by default 18388for @option{-march=armv8.1-a}. 18389@item fp16 18390Enable FP16 extension. This also enables floating-point instructions. 18391@item fp16fml 18392Enable FP16 fmla extension. This also enables FP16 extensions and 18393floating-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. 18394 18395@item rcpc 18396Enable the RcPc extension. This does not change code generation from GCC, 18397but is passed on to the assembler, enabling inline asm statements to use 18398instructions from the RcPc extension. 18399@item dotprod 18400Enable the Dot Product extension. This also enables Advanced SIMD instructions. 18401@item aes 18402Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced 18403SIMD instructions. 18404@item sha2 18405Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions. 18406@item sha3 18407Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD 18408instructions. Use of this option with architectures prior to Armv8.2-A is not supported. 18409@item sm4 18410Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. 18411Use of this option with architectures prior to Armv8.2-A is not supported. 18412@item profile 18413Enable the Statistical Profiling extension. This option is only to enable the 18414extension at the assembler level and does not affect code generation. 18415@item rng 18416Enable the Armv8.5-a Random Number instructions. This option is only to 18417enable the extension at the assembler level and does not affect code 18418generation. 18419@item memtag 18420Enable the Armv8.5-a Memory Tagging Extensions. 18421Use of this option with architectures prior to Armv8.5-A is not supported. 18422@item sb 18423Enable the Armv8-a Speculation Barrier instruction. This option is only to 18424enable the extension at the assembler level and does not affect code 18425generation. This option is enabled by default for @option{-march=armv8.5-a}. 18426@item ssbs 18427Enable the Armv8-a Speculative Store Bypass Safe instruction. This option 18428is only to enable the extension at the assembler level and does not affect code 18429generation. This option is enabled by default for @option{-march=armv8.5-a}. 18430@item predres 18431Enable the Armv8-a Execution and Data Prediction Restriction instructions. 18432This option is only to enable the extension at the assembler level and does 18433not affect code generation. This option is enabled by default for 18434@option{-march=armv8.5-a}. 18435@item sve2 18436Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE 18437instructions. 18438@item sve2-bitperm 18439Enable SVE2 bitperm instructions. This also enables SVE2 instructions. 18440@item sve2-sm4 18441Enable SVE2 sm4 instructions. This also enables SVE2 instructions. 18442@item sve2-aes 18443Enable SVE2 aes instructions. This also enables SVE2 instructions. 18444@item sve2-sha3 18445Enable SVE2 sha3 instructions. This also enables SVE2 instructions. 18446@item tme 18447Enable the Transactional Memory Extension. 18448@item i8mm 18449Enable 8-bit Integer Matrix Multiply instructions. This also enables 18450Advanced SIMD and floating-point instructions. This option is enabled by 18451default for @option{-march=armv8.6-a}. Use of this option with architectures 18452prior to Armv8.2-A is not supported. 18453@item f32mm 18454Enable 32-bit Floating point Matrix Multiply instructions. This also enables 18455SVE instructions. Use of this option with architectures prior to Armv8.2-A is 18456not supported. 18457@item f64mm 18458Enable 64-bit Floating point Matrix Multiply instructions. This also enables 18459SVE instructions. Use of this option with architectures prior to Armv8.2-A is 18460not supported. 18461@item bf16 18462Enable brain half-precision floating-point instructions. This also enables 18463Advanced SIMD and floating-point instructions. This option is enabled by 18464default for @option{-march=armv8.6-a}. Use of this option with architectures 18465prior to Armv8.2-A is not supported. 18466@item flagm 18467Enable the Flag Manipulation instructions Extension. 18468@item pauth 18469Enable the Pointer Authentication Extension. 18470 18471@end table 18472 18473Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd}, 18474which implies @option{fp}. 18475Conversely, @option{nofp} implies @option{nosimd}, which implies 18476@option{nocrypto}, @option{noaes} and @option{nosha2}. 18477 18478@node Adapteva Epiphany Options 18479@subsection Adapteva Epiphany Options 18480 18481These @samp{-m} options are defined for Adapteva Epiphany: 18482 18483@table @gcctabopt 18484@item -mhalf-reg-file 18485@opindex mhalf-reg-file 18486Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 18487That allows code to run on hardware variants that lack these registers. 18488 18489@item -mprefer-short-insn-regs 18490@opindex mprefer-short-insn-regs 18491Preferentially allocate registers that allow short instruction generation. 18492This can result in increased instruction count, so this may either reduce or 18493increase overall code size. 18494 18495@item -mbranch-cost=@var{num} 18496@opindex mbranch-cost 18497Set the cost of branches to roughly @var{num} ``simple'' instructions. 18498This cost is only a heuristic and is not guaranteed to produce 18499consistent results across releases. 18500 18501@item -mcmove 18502@opindex mcmove 18503Enable the generation of conditional moves. 18504 18505@item -mnops=@var{num} 18506@opindex mnops 18507Emit @var{num} NOPs before every other generated instruction. 18508 18509@item -mno-soft-cmpsf 18510@opindex mno-soft-cmpsf 18511@opindex msoft-cmpsf 18512For single-precision floating-point comparisons, emit an @code{fsub} instruction 18513and test the flags. This is faster than a software comparison, but can 18514get incorrect results in the presence of NaNs, or when two different small 18515numbers are compared such that their difference is calculated as zero. 18516The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 18517software comparisons. 18518 18519@item -mstack-offset=@var{num} 18520@opindex mstack-offset 18521Set the offset between the top of the stack and the stack pointer. 18522E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 18523can be used by leaf functions without stack allocation. 18524Values other than @samp{8} or @samp{16} are untested and unlikely to work. 18525Note also that this option changes the ABI; compiling a program with a 18526different stack offset than the libraries have been compiled with 18527generally does not work. 18528This option can be useful if you want to evaluate if a different stack 18529offset would give you better code, but to actually use a different stack 18530offset to build working programs, it is recommended to configure the 18531toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 18532 18533@item -mno-round-nearest 18534@opindex mno-round-nearest 18535@opindex mround-nearest 18536Make the scheduler assume that the rounding mode has been set to 18537truncating. The default is @option{-mround-nearest}. 18538 18539@item -mlong-calls 18540@opindex mlong-calls 18541If not otherwise specified by an attribute, assume all calls might be beyond 18542the offset range of the @code{b} / @code{bl} instructions, and therefore load the 18543function address into a register before performing a (otherwise direct) call. 18544This is the default. 18545 18546@item -mshort-calls 18547@opindex short-calls 18548If not otherwise specified by an attribute, assume all direct calls are 18549in the range of the @code{b} / @code{bl} instructions, so use these instructions 18550for direct calls. The default is @option{-mlong-calls}. 18551 18552@item -msmall16 18553@opindex msmall16 18554Assume addresses can be loaded as 16-bit unsigned values. This does not 18555apply to function addresses for which @option{-mlong-calls} semantics 18556are in effect. 18557 18558@item -mfp-mode=@var{mode} 18559@opindex mfp-mode 18560Set the prevailing mode of the floating-point unit. 18561This determines the floating-point mode that is provided and expected 18562at function call and return time. Making this mode match the mode you 18563predominantly need at function start can make your programs smaller and 18564faster by avoiding unnecessary mode switches. 18565 18566@var{mode} can be set to one the following values: 18567 18568@table @samp 18569@item caller 18570Any mode at function entry is valid, and retained or restored when 18571the function returns, and when it calls other functions. 18572This mode is useful for compiling libraries or other compilation units 18573you might want to incorporate into different programs with different 18574prevailing FPU modes, and the convenience of being able to use a single 18575object file outweighs the size and speed overhead for any extra 18576mode switching that might be needed, compared with what would be needed 18577with a more specific choice of prevailing FPU mode. 18578 18579@item truncate 18580This is the mode used for floating-point calculations with 18581truncating (i.e.@: round towards zero) rounding mode. That includes 18582conversion from floating point to integer. 18583 18584@item round-nearest 18585This is the mode used for floating-point calculations with 18586round-to-nearest-or-even rounding mode. 18587 18588@item int 18589This is the mode used to perform integer calculations in the FPU, e.g.@: 18590integer multiply, or integer multiply-and-accumulate. 18591@end table 18592 18593The default is @option{-mfp-mode=caller} 18594 18595@item -mno-split-lohi 18596@itemx -mno-postinc 18597@itemx -mno-postmodify 18598@opindex mno-split-lohi 18599@opindex msplit-lohi 18600@opindex mno-postinc 18601@opindex mpostinc 18602@opindex mno-postmodify 18603@opindex mpostmodify 18604Code generation tweaks that disable, respectively, splitting of 32-bit 18605loads, generation of post-increment addresses, and generation of 18606post-modify addresses. The defaults are @option{msplit-lohi}, 18607@option{-mpost-inc}, and @option{-mpost-modify}. 18608 18609@item -mnovect-double 18610@opindex mno-vect-double 18611@opindex mvect-double 18612Change the preferred SIMD mode to SImode. The default is 18613@option{-mvect-double}, which uses DImode as preferred SIMD mode. 18614 18615@item -max-vect-align=@var{num} 18616@opindex max-vect-align 18617The maximum alignment for SIMD vector mode types. 18618@var{num} may be 4 or 8. The default is 8. 18619Note that this is an ABI change, even though many library function 18620interfaces are unaffected if they don't use SIMD vector modes 18621in places that affect size and/or alignment of relevant types. 18622 18623@item -msplit-vecmove-early 18624@opindex msplit-vecmove-early 18625Split vector moves into single word moves before reload. In theory this 18626can give better register allocation, but so far the reverse seems to be 18627generally the case. 18628 18629@item -m1reg-@var{reg} 18630@opindex m1reg- 18631Specify a register to hold the constant @minus{}1, which makes loading small negative 18632constants and certain bitmasks faster. 18633Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 18634which specify use of that register as a fixed register, 18635and @samp{none}, which means that no register is used for this 18636purpose. The default is @option{-m1reg-none}. 18637 18638@end table 18639 18640@node AMD GCN Options 18641@subsection AMD GCN Options 18642@cindex AMD GCN Options 18643 18644These options are defined specifically for the AMD GCN port. 18645 18646@table @gcctabopt 18647 18648@item -march=@var{gpu} 18649@opindex march 18650@itemx -mtune=@var{gpu} 18651@opindex mtune 18652Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu} 18653are 18654 18655@table @samp 18656@opindex fiji 18657@item fiji 18658Compile for GCN3 Fiji devices (gfx803). 18659 18660@item gfx900 18661Compile for GCN5 Vega 10 devices (gfx900). 18662 18663@item gfx906 18664Compile for GCN5 Vega 20 devices (gfx906). 18665 18666@end table 18667 18668@item -mstack-size=@var{bytes} 18669@opindex mstack-size 18670Specify how many @var{bytes} of stack space will be requested for each GPU 18671thread (wave-front). Beware that there may be many threads and limited memory 18672available. The size of the stack allocation may also have an impact on 18673run-time performance. The default is 32KB when using OpenACC or OpenMP, and 186741MB otherwise. 18675 18676@end table 18677 18678@node ARC Options 18679@subsection ARC Options 18680@cindex ARC options 18681 18682The following options control the architecture variant for which code 18683is being compiled: 18684 18685@c architecture variants 18686@table @gcctabopt 18687 18688@item -mbarrel-shifter 18689@opindex mbarrel-shifter 18690Generate instructions supported by barrel shifter. This is the default 18691unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect. 18692 18693@item -mjli-always 18694@opindex mjli-alawys 18695Force to call a function using jli_s instruction. This option is 18696valid only for ARCv2 architecture. 18697 18698@item -mcpu=@var{cpu} 18699@opindex mcpu 18700Set architecture type, register usage, and instruction scheduling 18701parameters for @var{cpu}. There are also shortcut alias options 18702available for backward compatibility and convenience. Supported 18703values for @var{cpu} are 18704 18705@table @samp 18706@opindex mA6 18707@opindex mARC600 18708@item arc600 18709Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 18710 18711@item arc601 18712@opindex mARC601 18713Compile for ARC601. Alias: @option{-mARC601}. 18714 18715@item arc700 18716@opindex mA7 18717@opindex mARC700 18718Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 18719This is the default when configured with @option{--with-cpu=arc700}@. 18720 18721@item arcem 18722Compile for ARC EM. 18723 18724@item archs 18725Compile for ARC HS. 18726 18727@item em 18728Compile for ARC EM CPU with no hardware extensions. 18729 18730@item em4 18731Compile for ARC EM4 CPU. 18732 18733@item em4_dmips 18734Compile for ARC EM4 DMIPS CPU. 18735 18736@item em4_fpus 18737Compile for ARC EM4 DMIPS CPU with the single-precision floating-point 18738extension. 18739 18740@item em4_fpuda 18741Compile for ARC EM4 DMIPS CPU with single-precision floating-point and 18742double assist instructions. 18743 18744@item hs 18745Compile for ARC HS CPU with no hardware extensions except the atomic 18746instructions. 18747 18748@item hs34 18749Compile for ARC HS34 CPU. 18750 18751@item hs38 18752Compile for ARC HS38 CPU. 18753 18754@item hs38_linux 18755Compile for ARC HS38 CPU with all hardware extensions on. 18756 18757@item arc600_norm 18758Compile for ARC 600 CPU with @code{norm} instructions enabled. 18759 18760@item arc600_mul32x16 18761Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 18762instructions enabled. 18763 18764@item arc600_mul64 18765Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 18766instructions enabled. 18767 18768@item arc601_norm 18769Compile for ARC 601 CPU with @code{norm} instructions enabled. 18770 18771@item arc601_mul32x16 18772Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply 18773instructions enabled. 18774 18775@item arc601_mul64 18776Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family 18777instructions enabled. 18778 18779@item nps400 18780Compile for ARC 700 on NPS400 chip. 18781 18782@item em_mini 18783Compile for ARC EM minimalist configuration featuring reduced register 18784set. 18785 18786@end table 18787 18788@item -mdpfp 18789@opindex mdpfp 18790@itemx -mdpfp-compact 18791@opindex mdpfp-compact 18792Generate double-precision FPX instructions, tuned for the compact 18793implementation. 18794 18795@item -mdpfp-fast 18796@opindex mdpfp-fast 18797Generate double-precision FPX instructions, tuned for the fast 18798implementation. 18799 18800@item -mno-dpfp-lrsr 18801@opindex mno-dpfp-lrsr 18802Disable @code{lr} and @code{sr} instructions from using FPX extension 18803aux registers. 18804 18805@item -mea 18806@opindex mea 18807Generate extended arithmetic instructions. Currently only 18808@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 18809supported. Only valid for @option{-mcpu=ARC700}. 18810 18811@item -mno-mpy 18812@opindex mno-mpy 18813@opindex mmpy 18814Do not generate @code{mpy}-family instructions for ARC700. This option is 18815deprecated. 18816 18817@item -mmul32x16 18818@opindex mmul32x16 18819Generate 32x16-bit multiply and multiply-accumulate instructions. 18820 18821@item -mmul64 18822@opindex mmul64 18823Generate @code{mul64} and @code{mulu64} instructions. 18824Only valid for @option{-mcpu=ARC600}. 18825 18826@item -mnorm 18827@opindex mnorm 18828Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700} 18829is in effect. 18830 18831@item -mspfp 18832@opindex mspfp 18833@itemx -mspfp-compact 18834@opindex mspfp-compact 18835Generate single-precision FPX instructions, tuned for the compact 18836implementation. 18837 18838@item -mspfp-fast 18839@opindex mspfp-fast 18840Generate single-precision FPX instructions, tuned for the fast 18841implementation. 18842 18843@item -msimd 18844@opindex msimd 18845Enable generation of ARC SIMD instructions via target-specific 18846builtins. Only valid for @option{-mcpu=ARC700}. 18847 18848@item -msoft-float 18849@opindex msoft-float 18850This option ignored; it is provided for compatibility purposes only. 18851Software floating-point code is emitted by default, and this default 18852can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or 18853@option{-mspfp-fast} for single precision, and @option{-mdpfp}, 18854@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision. 18855 18856@item -mswap 18857@opindex mswap 18858Generate @code{swap} instructions. 18859 18860@item -matomic 18861@opindex matomic 18862This enables use of the locked load/store conditional extension to implement 18863atomic memory built-in functions. Not available for ARC 6xx or ARC 18864EM cores. 18865 18866@item -mdiv-rem 18867@opindex mdiv-rem 18868Enable @code{div} and @code{rem} instructions for ARCv2 cores. 18869 18870@item -mcode-density 18871@opindex mcode-density 18872Enable code density instructions for ARC EM. 18873This option is on by default for ARC HS. 18874 18875@item -mll64 18876@opindex mll64 18877Enable double load/store operations for ARC HS cores. 18878 18879@item -mtp-regno=@var{regno} 18880@opindex mtp-regno 18881Specify thread pointer register number. 18882 18883@item -mmpy-option=@var{multo} 18884@opindex mmpy-option 18885Compile ARCv2 code with a multiplier design option. You can specify 18886the option using either a string or numeric value for @var{multo}. 18887@samp{wlh1} is the default value. The recognized values are: 18888 18889@table @samp 18890@item 0 18891@itemx none 18892No multiplier available. 18893 18894@item 1 18895@itemx w 1889616x16 multiplier, fully pipelined. 18897The following instructions are enabled: @code{mpyw} and @code{mpyuw}. 18898 18899@item 2 18900@itemx wlh1 1890132x32 multiplier, fully 18902pipelined (1 stage). The following instructions are additionally 18903enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 18904 18905@item 3 18906@itemx wlh2 1890732x32 multiplier, fully pipelined 18908(2 stages). The following instructions are additionally enabled: @code{mpy}, 18909@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 18910 18911@item 4 18912@itemx wlh3 18913Two 16x16 multipliers, blocking, 18914sequential. The following instructions are additionally enabled: @code{mpy}, 18915@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 18916 18917@item 5 18918@itemx wlh4 18919One 16x16 multiplier, blocking, 18920sequential. The following instructions are additionally enabled: @code{mpy}, 18921@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 18922 18923@item 6 18924@itemx wlh5 18925One 32x4 multiplier, blocking, 18926sequential. The following instructions are additionally enabled: @code{mpy}, 18927@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 18928 18929@item 7 18930@itemx plus_dmpy 18931ARC HS SIMD support. 18932 18933@item 8 18934@itemx plus_macd 18935ARC HS SIMD support. 18936 18937@item 9 18938@itemx plus_qmacw 18939ARC HS SIMD support. 18940 18941@end table 18942 18943This option is only available for ARCv2 cores@. 18944 18945@item -mfpu=@var{fpu} 18946@opindex mfpu 18947Enables support for specific floating-point hardware extensions for ARCv2 18948cores. Supported values for @var{fpu} are: 18949 18950@table @samp 18951 18952@item fpus 18953Enables support for single-precision floating-point hardware 18954extensions@. 18955 18956@item fpud 18957Enables support for double-precision floating-point hardware 18958extensions. The single-precision floating-point extension is also 18959enabled. Not available for ARC EM@. 18960 18961@item fpuda 18962Enables support for double-precision floating-point hardware 18963extensions using double-precision assist instructions. The single-precision 18964floating-point extension is also enabled. This option is 18965only available for ARC EM@. 18966 18967@item fpuda_div 18968Enables support for double-precision floating-point hardware 18969extensions using double-precision assist instructions. 18970The single-precision floating-point, square-root, and divide 18971extensions are also enabled. This option is 18972only available for ARC EM@. 18973 18974@item fpuda_fma 18975Enables support for double-precision floating-point hardware 18976extensions using double-precision assist instructions. 18977The single-precision floating-point and fused multiply and add 18978hardware extensions are also enabled. This option is 18979only available for ARC EM@. 18980 18981@item fpuda_all 18982Enables support for double-precision floating-point hardware 18983extensions using double-precision assist instructions. 18984All single-precision floating-point hardware extensions are also 18985enabled. This option is only available for ARC EM@. 18986 18987@item fpus_div 18988Enables support for single-precision floating-point, square-root and divide 18989hardware extensions@. 18990 18991@item fpud_div 18992Enables support for double-precision floating-point, square-root and divide 18993hardware extensions. This option 18994includes option @samp{fpus_div}. Not available for ARC EM@. 18995 18996@item fpus_fma 18997Enables support for single-precision floating-point and 18998fused multiply and add hardware extensions@. 18999 19000@item fpud_fma 19001Enables support for double-precision floating-point and 19002fused multiply and add hardware extensions. This option 19003includes option @samp{fpus_fma}. Not available for ARC EM@. 19004 19005@item fpus_all 19006Enables support for all single-precision floating-point hardware 19007extensions@. 19008 19009@item fpud_all 19010Enables support for all single- and double-precision floating-point 19011hardware extensions. Not available for ARC EM@. 19012 19013@end table 19014 19015@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count} 19016@opindex mirq-ctrl-saved 19017Specifies general-purposes registers that the processor automatically 19018saves/restores on interrupt entry and exit. @var{register-range} is 19019specified as two registers separated by a dash. The register range 19020always starts with @code{r0}, the upper limit is @code{fp} register. 19021@var{blink} and @var{lp_count} are optional. This option is only 19022valid for ARC EM and ARC HS cores. 19023 19024@item -mrgf-banked-regs=@var{number} 19025@opindex mrgf-banked-regs 19026Specifies the number of registers replicated in second register bank 19027on entry to fast interrupt. Fast interrupts are interrupts with the 19028highest priority level P0. These interrupts save only PC and STATUS32 19029registers to avoid memory transactions during interrupt entry and exit 19030sequences. Use this option when you are using fast interrupts in an 19031ARC V2 family processor. Permitted values are 4, 8, 16, and 32. 19032 19033@item -mlpc-width=@var{width} 19034@opindex mlpc-width 19035Specify the width of the @code{lp_count} register. Valid values for 19036@var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is 19037fixed to 32 bits. If the width is less than 32, the compiler does not 19038attempt to transform loops in your program to use the zero-delay loop 19039mechanism unless it is known that the @code{lp_count} register can 19040hold the required loop-counter value. Depending on the width 19041specified, the compiler and run-time library might continue to use the 19042loop mechanism for various needs. This option defines macro 19043@code{__ARC_LPC_WIDTH__} with the value of @var{width}. 19044 19045@item -mrf16 19046@opindex mrf16 19047This option instructs the compiler to generate code for a 16-entry 19048register file. This option defines the @code{__ARC_RF16__} 19049preprocessor macro. 19050 19051@item -mbranch-index 19052@opindex mbranch-index 19053Enable use of @code{bi} or @code{bih} instructions to implement jump 19054tables. 19055 19056@end table 19057 19058The following options are passed through to the assembler, and also 19059define preprocessor macro symbols. 19060 19061@c Flags used by the assembler, but for which we define preprocessor 19062@c macro symbols as well. 19063@table @gcctabopt 19064@item -mdsp-packa 19065@opindex mdsp-packa 19066Passed down to the assembler to enable the DSP Pack A extensions. 19067Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is 19068deprecated. 19069 19070@item -mdvbf 19071@opindex mdvbf 19072Passed down to the assembler to enable the dual Viterbi butterfly 19073extension. Also sets the preprocessor symbol @code{__Xdvbf}. This 19074option is deprecated. 19075 19076@c ARC700 4.10 extension instruction 19077@item -mlock 19078@opindex mlock 19079Passed down to the assembler to enable the locked load/store 19080conditional extension. Also sets the preprocessor symbol 19081@code{__Xlock}. 19082 19083@item -mmac-d16 19084@opindex mmac-d16 19085Passed down to the assembler. Also sets the preprocessor symbol 19086@code{__Xxmac_d16}. This option is deprecated. 19087 19088@item -mmac-24 19089@opindex mmac-24 19090Passed down to the assembler. Also sets the preprocessor symbol 19091@code{__Xxmac_24}. This option is deprecated. 19092 19093@c ARC700 4.10 extension instruction 19094@item -mrtsc 19095@opindex mrtsc 19096Passed down to the assembler to enable the 64-bit time-stamp counter 19097extension instruction. Also sets the preprocessor symbol 19098@code{__Xrtsc}. This option is deprecated. 19099 19100@c ARC700 4.10 extension instruction 19101@item -mswape 19102@opindex mswape 19103Passed down to the assembler to enable the swap byte ordering 19104extension instruction. Also sets the preprocessor symbol 19105@code{__Xswape}. 19106 19107@item -mtelephony 19108@opindex mtelephony 19109Passed down to the assembler to enable dual- and single-operand 19110instructions for telephony. Also sets the preprocessor symbol 19111@code{__Xtelephony}. This option is deprecated. 19112 19113@item -mxy 19114@opindex mxy 19115Passed down to the assembler to enable the XY memory extension. Also 19116sets the preprocessor symbol @code{__Xxy}. 19117 19118@end table 19119 19120The following options control how the assembly code is annotated: 19121 19122@c Assembly annotation options 19123@table @gcctabopt 19124@item -misize 19125@opindex misize 19126Annotate assembler instructions with estimated addresses. 19127 19128@item -mannotate-align 19129@opindex mannotate-align 19130Explain what alignment considerations lead to the decision to make an 19131instruction short or long. 19132 19133@end table 19134 19135The following options are passed through to the linker: 19136 19137@c options passed through to the linker 19138@table @gcctabopt 19139@item -marclinux 19140@opindex marclinux 19141Passed through to the linker, to specify use of the @code{arclinux} emulation. 19142This option is enabled by default in tool chains built for 19143@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 19144when profiling is not requested. 19145 19146@item -marclinux_prof 19147@opindex marclinux_prof 19148Passed through to the linker, to specify use of the 19149@code{arclinux_prof} emulation. This option is enabled by default in 19150tool chains built for @w{@code{arc-linux-uclibc}} and 19151@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 19152 19153@end table 19154 19155The following options control the semantics of generated code: 19156 19157@c semantically relevant code generation options 19158@table @gcctabopt 19159@item -mlong-calls 19160@opindex mlong-calls 19161Generate calls as register indirect calls, thus providing access 19162to the full 32-bit address range. 19163 19164@item -mmedium-calls 19165@opindex mmedium-calls 19166Don't use less than 25-bit addressing range for calls, which is the 19167offset available for an unconditional branch-and-link 19168instruction. Conditional execution of function calls is suppressed, to 19169allow use of the 25-bit range, rather than the 21-bit range with 19170conditional branch-and-link. This is the default for tool chains built 19171for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 19172 19173@item -G @var{num} 19174@opindex G 19175Put definitions of externally-visible data in a small data section if 19176that data is no bigger than @var{num} bytes. The default value of 19177@var{num} is 4 for any ARC configuration, or 8 when we have double 19178load/store operations. 19179 19180@item -mno-sdata 19181@opindex mno-sdata 19182@opindex msdata 19183Do not generate sdata references. This is the default for tool chains 19184built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 19185targets. 19186 19187@item -mvolatile-cache 19188@opindex mvolatile-cache 19189Use ordinarily cached memory accesses for volatile references. This is the 19190default. 19191 19192@item -mno-volatile-cache 19193@opindex mno-volatile-cache 19194@opindex mvolatile-cache 19195Enable cache bypass for volatile references. 19196 19197@end table 19198 19199The following options fine tune code generation: 19200@c code generation tuning options 19201@table @gcctabopt 19202@item -malign-call 19203@opindex malign-call 19204Do alignment optimizations for call instructions. 19205 19206@item -mauto-modify-reg 19207@opindex mauto-modify-reg 19208Enable the use of pre/post modify with register displacement. 19209 19210@item -mbbit-peephole 19211@opindex mbbit-peephole 19212Enable bbit peephole2. 19213 19214@item -mno-brcc 19215@opindex mno-brcc 19216This option disables a target-specific pass in @file{arc_reorg} to 19217generate compare-and-branch (@code{br@var{cc}}) instructions. 19218It has no effect on 19219generation of these instructions driven by the combiner pass. 19220 19221@item -mcase-vector-pcrel 19222@opindex mcase-vector-pcrel 19223Use PC-relative switch case tables to enable case table shortening. 19224This is the default for @option{-Os}. 19225 19226@item -mcompact-casesi 19227@opindex mcompact-casesi 19228Enable compact @code{casesi} pattern. This is the default for @option{-Os}, 19229and only available for ARCv1 cores. This option is deprecated. 19230 19231@item -mno-cond-exec 19232@opindex mno-cond-exec 19233Disable the ARCompact-specific pass to generate conditional 19234execution instructions. 19235 19236Due to delay slot scheduling and interactions between operand numbers, 19237literal sizes, instruction lengths, and the support for conditional execution, 19238the target-independent pass to generate conditional execution is often lacking, 19239so the ARC port has kept a special pass around that tries to find more 19240conditional execution generation opportunities after register allocation, 19241branch shortening, and delay slot scheduling have been done. This pass 19242generally, but not always, improves performance and code size, at the cost of 19243extra compilation time, which is why there is an option to switch it off. 19244If you have a problem with call instructions exceeding their allowable 19245offset range because they are conditionalized, you should consider using 19246@option{-mmedium-calls} instead. 19247 19248@item -mearly-cbranchsi 19249@opindex mearly-cbranchsi 19250Enable pre-reload use of the @code{cbranchsi} pattern. 19251 19252@item -mexpand-adddi 19253@opindex mexpand-adddi 19254Expand @code{adddi3} and @code{subdi3} at RTL generation time into 19255@code{add.f}, @code{adc} etc. This option is deprecated. 19256 19257@item -mindexed-loads 19258@opindex mindexed-loads 19259Enable the use of indexed loads. This can be problematic because some 19260optimizers then assume that indexed stores exist, which is not 19261the case. 19262 19263@item -mlra 19264@opindex mlra 19265Enable Local Register Allocation. This is still experimental for ARC, 19266so by default the compiler uses standard reload 19267(i.e.@: @option{-mno-lra}). 19268 19269@item -mlra-priority-none 19270@opindex mlra-priority-none 19271Don't indicate any priority for target registers. 19272 19273@item -mlra-priority-compact 19274@opindex mlra-priority-compact 19275Indicate target register priority for r0..r3 / r12..r15. 19276 19277@item -mlra-priority-noncompact 19278@opindex mlra-priority-noncompact 19279Reduce target register priority for r0..r3 / r12..r15. 19280 19281@item -mmillicode 19282@opindex mmillicode 19283When optimizing for size (using @option{-Os}), prologues and epilogues 19284that have to save or restore a large number of registers are often 19285shortened by using call to a special function in libgcc; this is 19286referred to as a @emph{millicode} call. As these calls can pose 19287performance issues, and/or cause linking issues when linking in a 19288nonstandard way, this option is provided to turn on or off millicode 19289call generation. 19290 19291@item -mcode-density-frame 19292@opindex mcode-density-frame 19293This option enable the compiler to emit @code{enter} and @code{leave} 19294instructions. These instructions are only valid for CPUs with 19295code-density feature. 19296 19297@item -mmixed-code 19298@opindex mmixed-code 19299Tweak register allocation to help 16-bit instruction generation. 19300This generally has the effect of decreasing the average instruction size 19301while increasing the instruction count. 19302 19303@item -mq-class 19304@opindex mq-class 19305Ths option is deprecated. Enable @samp{q} instruction alternatives. 19306This is the default for @option{-Os}. 19307 19308@item -mRcq 19309@opindex mRcq 19310Enable @samp{Rcq} constraint handling. 19311Most short code generation depends on this. 19312This is the default. 19313 19314@item -mRcw 19315@opindex mRcw 19316Enable @samp{Rcw} constraint handling. 19317Most ccfsm condexec mostly depends on this. 19318This is the default. 19319 19320@item -msize-level=@var{level} 19321@opindex msize-level 19322Fine-tune size optimization with regards to instruction lengths and alignment. 19323The recognized values for @var{level} are: 19324@table @samp 19325@item 0 19326No size optimization. This level is deprecated and treated like @samp{1}. 19327 19328@item 1 19329Short instructions are used opportunistically. 19330 19331@item 2 19332In addition, alignment of loops and of code after barriers are dropped. 19333 19334@item 3 19335In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 19336 19337@end table 19338 19339This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 19340the behavior when this is not set is equivalent to level @samp{1}. 19341 19342@item -mtune=@var{cpu} 19343@opindex mtune 19344Set instruction scheduling parameters for @var{cpu}, overriding any implied 19345by @option{-mcpu=}. 19346 19347Supported values for @var{cpu} are 19348 19349@table @samp 19350@item ARC600 19351Tune for ARC600 CPU. 19352 19353@item ARC601 19354Tune for ARC601 CPU. 19355 19356@item ARC700 19357Tune for ARC700 CPU with standard multiplier block. 19358 19359@item ARC700-xmac 19360Tune for ARC700 CPU with XMAC block. 19361 19362@item ARC725D 19363Tune for ARC725D CPU. 19364 19365@item ARC750D 19366Tune for ARC750D CPU. 19367 19368@end table 19369 19370@item -mmultcost=@var{num} 19371@opindex mmultcost 19372Cost to assume for a multiply instruction, with @samp{4} being equal to a 19373normal instruction. 19374 19375@item -munalign-prob-threshold=@var{probability} 19376@opindex munalign-prob-threshold 19377Set probability threshold for unaligning branches. 19378When tuning for @samp{ARC700} and optimizing for speed, branches without 19379filled delay slot are preferably emitted unaligned and long, unless 19380profiling indicates that the probability for the branch to be taken 19381is below @var{probability}. @xref{Cross-profiling}. 19382The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. 19383 19384@end table 19385 19386The following options are maintained for backward compatibility, but 19387are now deprecated and will be removed in a future release: 19388 19389@c Deprecated options 19390@table @gcctabopt 19391 19392@item -margonaut 19393@opindex margonaut 19394Obsolete FPX. 19395 19396@item -mbig-endian 19397@opindex mbig-endian 19398@itemx -EB 19399@opindex EB 19400Compile code for big-endian targets. Use of these options is now 19401deprecated. Big-endian code is supported by configuring GCC to build 19402@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets, 19403for which big endian is the default. 19404 19405@item -mlittle-endian 19406@opindex mlittle-endian 19407@itemx -EL 19408@opindex EL 19409Compile code for little-endian targets. Use of these options is now 19410deprecated. Little-endian code is supported by configuring GCC to build 19411@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets, 19412for which little endian is the default. 19413 19414@item -mbarrel_shifter 19415@opindex mbarrel_shifter 19416Replaced by @option{-mbarrel-shifter}. 19417 19418@item -mdpfp_compact 19419@opindex mdpfp_compact 19420Replaced by @option{-mdpfp-compact}. 19421 19422@item -mdpfp_fast 19423@opindex mdpfp_fast 19424Replaced by @option{-mdpfp-fast}. 19425 19426@item -mdsp_packa 19427@opindex mdsp_packa 19428Replaced by @option{-mdsp-packa}. 19429 19430@item -mEA 19431@opindex mEA 19432Replaced by @option{-mea}. 19433 19434@item -mmac_24 19435@opindex mmac_24 19436Replaced by @option{-mmac-24}. 19437 19438@item -mmac_d16 19439@opindex mmac_d16 19440Replaced by @option{-mmac-d16}. 19441 19442@item -mspfp_compact 19443@opindex mspfp_compact 19444Replaced by @option{-mspfp-compact}. 19445 19446@item -mspfp_fast 19447@opindex mspfp_fast 19448Replaced by @option{-mspfp-fast}. 19449 19450@item -mtune=@var{cpu} 19451@opindex mtune 19452Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 19453@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 19454@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively. 19455 19456@item -multcost=@var{num} 19457@opindex multcost 19458Replaced by @option{-mmultcost}. 19459 19460@end table 19461 19462@node ARM Options 19463@subsection ARM Options 19464@cindex ARM options 19465 19466These @samp{-m} options are defined for the ARM port: 19467 19468@table @gcctabopt 19469@item -mabi=@var{name} 19470@opindex mabi 19471Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 19472@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 19473 19474@item -mapcs-frame 19475@opindex mapcs-frame 19476Generate a stack frame that is compliant with the ARM Procedure Call 19477Standard for all functions, even if this is not strictly necessary for 19478correct execution of the code. Specifying @option{-fomit-frame-pointer} 19479with this option causes the stack frames not to be generated for 19480leaf functions. The default is @option{-mno-apcs-frame}. 19481This option is deprecated. 19482 19483@item -mapcs 19484@opindex mapcs 19485This is a synonym for @option{-mapcs-frame} and is deprecated. 19486 19487@ignore 19488@c not currently implemented 19489@item -mapcs-stack-check 19490@opindex mapcs-stack-check 19491Generate code to check the amount of stack space available upon entry to 19492every function (that actually uses some stack space). If there is 19493insufficient space available then either the function 19494@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 19495called, depending upon the amount of stack space required. The runtime 19496system is required to provide these functions. The default is 19497@option{-mno-apcs-stack-check}, since this produces smaller code. 19498 19499@c not currently implemented 19500@item -mapcs-reentrant 19501@opindex mapcs-reentrant 19502Generate reentrant, position-independent code. The default is 19503@option{-mno-apcs-reentrant}. 19504@end ignore 19505 19506@item -mthumb-interwork 19507@opindex mthumb-interwork 19508Generate code that supports calling between the ARM and Thumb 19509instruction sets. Without this option, on pre-v5 architectures, the 19510two instruction sets cannot be reliably used inside one program. The 19511default is @option{-mno-thumb-interwork}, since slightly larger code 19512is generated when @option{-mthumb-interwork} is specified. In AAPCS 19513configurations this option is meaningless. 19514 19515@item -mno-sched-prolog 19516@opindex mno-sched-prolog 19517@opindex msched-prolog 19518Prevent the reordering of instructions in the function prologue, or the 19519merging of those instruction with the instructions in the function's 19520body. This means that all functions start with a recognizable set 19521of instructions (or in fact one of a choice from a small set of 19522different function prologues), and this information can be used to 19523locate the start of functions inside an executable piece of code. The 19524default is @option{-msched-prolog}. 19525 19526@item -mfloat-abi=@var{name} 19527@opindex mfloat-abi 19528Specifies which floating-point ABI to use. Permissible values 19529are: @samp{soft}, @samp{softfp} and @samp{hard}. 19530 19531Specifying @samp{soft} causes GCC to generate output containing 19532library calls for floating-point operations. 19533@samp{softfp} allows the generation of code using hardware floating-point 19534instructions, but still uses the soft-float calling conventions. 19535@samp{hard} allows generation of floating-point instructions 19536and uses FPU-specific calling conventions. 19537 19538The default depends on the specific target configuration. Note that 19539the hard-float and soft-float ABIs are not link-compatible; you must 19540compile your entire program with the same ABI, and link with a 19541compatible set of libraries. 19542 19543@item -mgeneral-regs-only 19544@opindex mgeneral-regs-only 19545Generate code which uses only the general-purpose registers. This will prevent 19546the compiler from using floating-point and Advanced SIMD registers but will not 19547impose any restrictions on the assembler. 19548 19549@item -mlittle-endian 19550@opindex mlittle-endian 19551Generate code for a processor running in little-endian mode. This is 19552the default for all standard configurations. 19553 19554@item -mbig-endian 19555@opindex mbig-endian 19556Generate code for a processor running in big-endian mode; the default is 19557to compile code for a little-endian processor. 19558 19559@item -mbe8 19560@itemx -mbe32 19561@opindex mbe8 19562When linking a big-endian image select between BE8 and BE32 formats. 19563The option has no effect for little-endian images and is ignored. The 19564default is dependent on the selected target architecture. For ARMv6 19565and later architectures the default is BE8, for older architectures 19566the default is BE32. BE32 format has been deprecated by ARM. 19567 19568@item -march=@var{name}@r{[}+extension@dots{}@r{]} 19569@opindex march 19570This specifies the name of the target ARM architecture. GCC uses this 19571name to determine what kind of instructions it can emit when generating 19572assembly code. This option can be used in conjunction with or instead 19573of the @option{-mcpu=} option. 19574 19575Permissible names are: 19576@samp{armv4t}, 19577@samp{armv5t}, @samp{armv5te}, 19578@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2}, 19579@samp{armv6z}, @samp{armv6zk}, 19580@samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 19581@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, 19582@samp{armv8.4-a}, 19583@samp{armv8.5-a}, 19584@samp{armv8.6-a}, 19585@samp{armv7-r}, 19586@samp{armv8-r}, 19587@samp{armv6-m}, @samp{armv6s-m}, 19588@samp{armv7-m}, @samp{armv7e-m}, 19589@samp{armv8-m.base}, @samp{armv8-m.main}, 19590@samp{armv8.1-m.main}, 19591@samp{iwmmxt} and @samp{iwmmxt2}. 19592 19593Additionally, the following architectures, which lack support for the 19594Thumb execution state, are recognized but support is deprecated: @samp{armv4}. 19595 19596Many of the architectures support extensions. These can be added by 19597appending @samp{+@var{extension}} to the architecture name. Extension 19598options are processed in order and capabilities accumulate. An extension 19599will also enable any necessary base extensions 19600upon which it depends. For example, the @samp{+crypto} extension 19601will always enable the @samp{+simd} extension. The exception to the 19602additive construction is for extensions that are prefixed with 19603@samp{+no@dots{}}: these extensions disable the specified option and 19604any other extensions that may depend on the presence of that 19605extension. 19606 19607For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to 19608writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is 19609entirely disabled by the @samp{+nofp} option that follows it. 19610 19611Most extension names are generically named, but have an effect that is 19612dependent upon the architecture to which it is applied. For example, 19613the @samp{+simd} option can be applied to both @samp{armv7-a} and 19614@samp{armv8-a} architectures, but will enable the original ARMv7-A 19615Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A 19616variant for @samp{armv8-a}. 19617 19618The table below lists the supported extensions for each architecture. 19619Architectures not mentioned do not support any extensions. 19620 19621@table @samp 19622@item armv5te 19623@itemx armv6 19624@itemx armv6j 19625@itemx armv6k 19626@itemx armv6kz 19627@itemx armv6t2 19628@itemx armv6z 19629@itemx armv6zk 19630@table @samp 19631@item +fp 19632The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be 19633used as an alias for this extension. 19634 19635@item +nofp 19636Disable the floating-point instructions. 19637@end table 19638 19639@item armv7 19640The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures. 19641@table @samp 19642@item +fp 19643The VFPv3 floating-point instructions, with 16 double-precision 19644registers. The extension @samp{+vfpv3-d16} can be used as an alias 19645for this extension. Note that floating-point is not supported by the 19646base ARMv7-M architecture, but is compatible with both the ARMv7-A and 19647ARMv7-R architectures. 19648 19649@item +nofp 19650Disable the floating-point instructions. 19651@end table 19652 19653@item armv7-a 19654@table @samp 19655@item +mp 19656The multiprocessing extension. 19657 19658@item +sec 19659The security extension. 19660 19661@item +fp 19662The VFPv3 floating-point instructions, with 16 double-precision 19663registers. The extension @samp{+vfpv3-d16} can be used as an alias 19664for this extension. 19665 19666@item +simd 19667The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 19668The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases 19669for this extension. 19670 19671@item +vfpv3 19672The VFPv3 floating-point instructions, with 32 double-precision 19673registers. 19674 19675@item +vfpv3-d16-fp16 19676The VFPv3 floating-point instructions, with 16 double-precision 19677registers and the half-precision floating-point conversion operations. 19678 19679@item +vfpv3-fp16 19680The VFPv3 floating-point instructions, with 32 double-precision 19681registers and the half-precision floating-point conversion operations. 19682 19683@item +vfpv4-d16 19684The VFPv4 floating-point instructions, with 16 double-precision 19685registers. 19686 19687@item +vfpv4 19688The VFPv4 floating-point instructions, with 32 double-precision 19689registers. 19690 19691@item +neon-fp16 19692The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 19693the half-precision floating-point conversion operations. 19694 19695@item +neon-vfpv4 19696The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. 19697 19698@item +nosimd 19699Disable the Advanced SIMD instructions (does not disable floating point). 19700 19701@item +nofp 19702Disable the floating-point and Advanced SIMD instructions. 19703@end table 19704 19705@item armv7ve 19706The extended version of the ARMv7-A architecture with support for 19707virtualization. 19708@table @samp 19709@item +fp 19710The VFPv4 floating-point instructions, with 16 double-precision registers. 19711The extension @samp{+vfpv4-d16} can be used as an alias for this extension. 19712 19713@item +simd 19714The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The 19715extension @samp{+neon-vfpv4} can be used as an alias for this extension. 19716 19717@item +vfpv3-d16 19718The VFPv3 floating-point instructions, with 16 double-precision 19719registers. 19720 19721@item +vfpv3 19722The VFPv3 floating-point instructions, with 32 double-precision 19723registers. 19724 19725@item +vfpv3-d16-fp16 19726The VFPv3 floating-point instructions, with 16 double-precision 19727registers and the half-precision floating-point conversion operations. 19728 19729@item +vfpv3-fp16 19730The VFPv3 floating-point instructions, with 32 double-precision 19731registers and the half-precision floating-point conversion operations. 19732 19733@item +vfpv4-d16 19734The VFPv4 floating-point instructions, with 16 double-precision 19735registers. 19736 19737@item +vfpv4 19738The VFPv4 floating-point instructions, with 32 double-precision 19739registers. 19740 19741@item +neon 19742The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 19743The extension @samp{+neon-vfpv3} can be used as an alias for this extension. 19744 19745@item +neon-fp16 19746The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 19747the half-precision floating-point conversion operations. 19748 19749@item +nosimd 19750Disable the Advanced SIMD instructions (does not disable floating point). 19751 19752@item +nofp 19753Disable the floating-point and Advanced SIMD instructions. 19754@end table 19755 19756@item armv8-a 19757@table @samp 19758@item +crc 19759The Cyclic Redundancy Check (CRC) instructions. 19760@item +simd 19761The ARMv8-A Advanced SIMD and floating-point instructions. 19762@item +crypto 19763The cryptographic instructions. 19764@item +nocrypto 19765Disable the cryptographic instructions. 19766@item +nofp 19767Disable the floating-point, Advanced SIMD and cryptographic instructions. 19768@item +sb 19769Speculation Barrier Instruction. 19770@item +predres 19771Execution and Data Prediction Restriction Instructions. 19772@end table 19773 19774@item armv8.1-a 19775@table @samp 19776@item +simd 19777The ARMv8.1-A Advanced SIMD and floating-point instructions. 19778 19779@item +crypto 19780The cryptographic instructions. This also enables the Advanced SIMD and 19781floating-point instructions. 19782 19783@item +nocrypto 19784Disable the cryptographic instructions. 19785 19786@item +nofp 19787Disable the floating-point, Advanced SIMD and cryptographic instructions. 19788 19789@item +sb 19790Speculation Barrier Instruction. 19791 19792@item +predres 19793Execution and Data Prediction Restriction Instructions. 19794@end table 19795 19796@item armv8.2-a 19797@itemx armv8.3-a 19798@table @samp 19799@item +fp16 19800The half-precision floating-point data processing instructions. 19801This also enables the Advanced SIMD and floating-point instructions. 19802 19803@item +fp16fml 19804The half-precision floating-point fmla extension. This also enables 19805the half-precision floating-point extension and Advanced SIMD and 19806floating-point instructions. 19807 19808@item +simd 19809The ARMv8.1-A Advanced SIMD and floating-point instructions. 19810 19811@item +crypto 19812The cryptographic instructions. This also enables the Advanced SIMD and 19813floating-point instructions. 19814 19815@item +dotprod 19816Enable the Dot Product extension. This also enables Advanced SIMD instructions. 19817 19818@item +nocrypto 19819Disable the cryptographic extension. 19820 19821@item +nofp 19822Disable the floating-point, Advanced SIMD and cryptographic instructions. 19823 19824@item +sb 19825Speculation Barrier Instruction. 19826 19827@item +predres 19828Execution and Data Prediction Restriction Instructions. 19829 19830@item +i8mm 198318-bit Integer Matrix Multiply instructions. 19832This also enables Advanced SIMD and floating-point instructions. 19833 19834@item +bf16 19835Brain half-precision floating-point instructions. 19836This also enables Advanced SIMD and floating-point instructions. 19837@end table 19838 19839@item armv8.4-a 19840@table @samp 19841@item +fp16 19842The half-precision floating-point data processing instructions. 19843This also enables the Advanced SIMD and floating-point instructions as well 19844as the Dot Product extension and the half-precision floating-point fmla 19845extension. 19846 19847@item +simd 19848The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 19849Dot Product extension. 19850 19851@item +crypto 19852The cryptographic instructions. This also enables the Advanced SIMD and 19853floating-point instructions as well as the Dot Product extension. 19854 19855@item +nocrypto 19856Disable the cryptographic extension. 19857 19858@item +nofp 19859Disable the floating-point, Advanced SIMD and cryptographic instructions. 19860 19861@item +sb 19862Speculation Barrier Instruction. 19863 19864@item +predres 19865Execution and Data Prediction Restriction Instructions. 19866 19867@item +i8mm 198688-bit Integer Matrix Multiply instructions. 19869This also enables Advanced SIMD and floating-point instructions. 19870 19871@item +bf16 19872Brain half-precision floating-point instructions. 19873This also enables Advanced SIMD and floating-point instructions. 19874@end table 19875 19876@item armv8.5-a 19877@table @samp 19878@item +fp16 19879The half-precision floating-point data processing instructions. 19880This also enables the Advanced SIMD and floating-point instructions as well 19881as the Dot Product extension and the half-precision floating-point fmla 19882extension. 19883 19884@item +simd 19885The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 19886Dot Product extension. 19887 19888@item +crypto 19889The cryptographic instructions. This also enables the Advanced SIMD and 19890floating-point instructions as well as the Dot Product extension. 19891 19892@item +nocrypto 19893Disable the cryptographic extension. 19894 19895@item +nofp 19896Disable the floating-point, Advanced SIMD and cryptographic instructions. 19897 19898@item +i8mm 198998-bit Integer Matrix Multiply instructions. 19900This also enables Advanced SIMD and floating-point instructions. 19901 19902@item +bf16 19903Brain half-precision floating-point instructions. 19904This also enables Advanced SIMD and floating-point instructions. 19905@end table 19906 19907@item armv8.6-a 19908@table @samp 19909@item +fp16 19910The half-precision floating-point data processing instructions. 19911This also enables the Advanced SIMD and floating-point instructions as well 19912as the Dot Product extension and the half-precision floating-point fmla 19913extension. 19914 19915@item +simd 19916The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 19917Dot Product extension. 19918 19919@item +crypto 19920The cryptographic instructions. This also enables the Advanced SIMD and 19921floating-point instructions as well as the Dot Product extension. 19922 19923@item +nocrypto 19924Disable the cryptographic extension. 19925 19926@item +nofp 19927Disable the floating-point, Advanced SIMD and cryptographic instructions. 19928 19929@item +i8mm 199308-bit Integer Matrix Multiply instructions. 19931This also enables Advanced SIMD and floating-point instructions. 19932 19933@item +bf16 19934Brain half-precision floating-point instructions. 19935This also enables Advanced SIMD and floating-point instructions. 19936@end table 19937 19938@item armv7-r 19939@table @samp 19940@item +fp.sp 19941The single-precision VFPv3 floating-point instructions. The extension 19942@samp{+vfpv3xd} can be used as an alias for this extension. 19943 19944@item +fp 19945The VFPv3 floating-point instructions with 16 double-precision registers. 19946The extension +vfpv3-d16 can be used as an alias for this extension. 19947 19948@item +vfpv3xd-d16-fp16 19949The single-precision VFPv3 floating-point instructions with 16 double-precision 19950registers and the half-precision floating-point conversion operations. 19951 19952@item +vfpv3-d16-fp16 19953The VFPv3 floating-point instructions with 16 double-precision 19954registers and the half-precision floating-point conversion operations. 19955 19956@item +nofp 19957Disable the floating-point extension. 19958 19959@item +idiv 19960The ARM-state integer division instructions. 19961 19962@item +noidiv 19963Disable the ARM-state integer division extension. 19964@end table 19965 19966@item armv7e-m 19967@table @samp 19968@item +fp 19969The single-precision VFPv4 floating-point instructions. 19970 19971@item +fpv5 19972The single-precision FPv5 floating-point instructions. 19973 19974@item +fp.dp 19975The single- and double-precision FPv5 floating-point instructions. 19976 19977@item +nofp 19978Disable the floating-point extensions. 19979@end table 19980 19981@item armv8.1-m.main 19982@table @samp 19983 19984@item +dsp 19985The DSP instructions. 19986 19987@item +mve 19988The M-Profile Vector Extension (MVE) integer instructions. 19989 19990@item +mve.fp 19991The M-Profile Vector Extension (MVE) integer and single precision 19992floating-point instructions. 19993 19994@item +fp 19995The single-precision floating-point instructions. 19996 19997@item +fp.dp 19998The single- and double-precision floating-point instructions. 19999 20000@item +nofp 20001Disable the floating-point extension. 20002 20003@item +cdecp0, +cdecp1, ... , +cdecp7 20004Enable the Custom Datapath Extension (CDE) on selected coprocessors according 20005to the numbers given in the options in the range 0 to 7. 20006@end table 20007 20008@item armv8-m.main 20009@table @samp 20010@item +dsp 20011The DSP instructions. 20012 20013@item +nodsp 20014Disable the DSP extension. 20015 20016@item +fp 20017The single-precision floating-point instructions. 20018 20019@item +fp.dp 20020The single- and double-precision floating-point instructions. 20021 20022@item +nofp 20023Disable the floating-point extension. 20024 20025@item +cdecp0, +cdecp1, ... , +cdecp7 20026Enable the Custom Datapath Extension (CDE) on selected coprocessors according 20027to the numbers given in the options in the range 0 to 7. 20028@end table 20029 20030@item armv8-r 20031@table @samp 20032@item +crc 20033The Cyclic Redundancy Check (CRC) instructions. 20034@item +fp.sp 20035The single-precision FPv5 floating-point instructions. 20036@item +simd 20037The ARMv8-A Advanced SIMD and floating-point instructions. 20038@item +crypto 20039The cryptographic instructions. 20040@item +nocrypto 20041Disable the cryptographic instructions. 20042@item +nofp 20043Disable the floating-point, Advanced SIMD and cryptographic instructions. 20044@end table 20045 20046@end table 20047 20048@option{-march=native} causes the compiler to auto-detect the architecture 20049of the build computer. At present, this feature is only supported on 20050GNU/Linux, and not all architectures are recognized. If the auto-detect 20051is unsuccessful the option has no effect. 20052 20053@item -mtune=@var{name} 20054@opindex mtune 20055This option specifies the name of the target ARM processor for 20056which GCC should tune the performance of the code. 20057For some ARM implementations better performance can be obtained by using 20058this option. 20059Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t}, 20060@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110}, 20061@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810}, 20062@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t}, 20063@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s}, 20064@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t}, 20065@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 20066@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 20067@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 20068@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, 20069@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17}, 20070@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 20071@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 20072@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77}, 20073@samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, 20074@samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, 20075@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, 20076@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3}, 20077@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33}, 20078@samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1}, 20079@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply}, 20080@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4}, 20081@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale}, 20082@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626}, 20083@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}. 20084 20085Additionally, this option can specify that GCC should tune the performance 20086of the code for a big.LITTLE system. Permissible names are: 20087@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7}, 20088@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 20089@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}, 20090@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}. 20091 20092@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 20093performance for a blend of processors within architecture @var{arch}. 20094The aim is to generate code that run well on the current most popular 20095processors, balancing between optimizations that benefit some CPUs in the 20096range, and avoiding performance pitfalls of other CPUs. The effects of 20097this option may change in future GCC versions as CPU models come and go. 20098 20099@option{-mtune} permits the same extension options as @option{-mcpu}, but 20100the extension options do not affect the tuning of the generated code. 20101 20102@option{-mtune=native} causes the compiler to auto-detect the CPU 20103of the build computer. At present, this feature is only supported on 20104GNU/Linux, and not all architectures are recognized. If the auto-detect is 20105unsuccessful the option has no effect. 20106 20107@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]} 20108@opindex mcpu 20109This specifies the name of the target ARM processor. GCC uses this name 20110to derive the name of the target ARM architecture (as if specified 20111by @option{-march}) and the ARM processor type for which to tune for 20112performance (as if specified by @option{-mtune}). Where this option 20113is used in conjunction with @option{-march} or @option{-mtune}, 20114those options take precedence over the appropriate part of this option. 20115 20116Many of the supported CPUs implement optional architectural 20117extensions. Where this is so the architectural extensions are 20118normally enabled by default. If implementations that lack the 20119extension exist, then the extension syntax can be used to disable 20120those extensions that have been omitted. For floating-point and 20121Advanced SIMD (Neon) instructions, the settings of the options 20122@option{-mfloat-abi} and @option{-mfpu} must also be considered: 20123floating-point and Advanced SIMD instructions will only be used if 20124@option{-mfloat-abi} is not set to @samp{soft}; and any setting of 20125@option{-mfpu} other than @samp{auto} will override the available 20126floating-point and SIMD extension instructions. 20127 20128For example, @samp{cortex-a9} can be found in three major 20129configurations: integer only, with just a floating-point unit or with 20130floating-point and Advanced SIMD. The default is to enable all the 20131instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can 20132be used to disable just the SIMD or both the SIMD and floating-point 20133instructions respectively. 20134 20135Permissible names for this option are the same as those for 20136@option{-mtune}. 20137 20138The following extension options are common to the listed CPUs: 20139 20140@table @samp 20141@item +nodsp 20142Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}. 20143 20144@item +nofp 20145Disables the floating-point instructions on @samp{arm9e}, 20146@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e}, 20147@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s}, 20148@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, 20149@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}. 20150Disables the floating-point and SIMD instructions on 20151@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, 20152@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12}, 20153@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7}, 20154@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35}, 20155@samp{cortex-a53} and @samp{cortex-a55}. 20156 20157@item +nofp.dp 20158Disables the double-precision component of the floating-point instructions 20159on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and 20160@samp{cortex-m7}. 20161 20162@item +nosimd 20163Disables the SIMD (but not floating-point) instructions on 20164@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7} 20165and @samp{cortex-a9}. 20166 20167@item +crypto 20168Enables the cryptographic instructions on @samp{cortex-a32}, 20169@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57}, 20170@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1}, 20171@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 20172@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and 20173@samp{cortex-a75.cortex-a55}. 20174@end table 20175 20176Additionally the @samp{generic-armv7-a} pseudo target defaults to 20177VFPv3 with 16 double-precision registers. It supports the following 20178extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16}, 20179@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, 20180@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, 20181@samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for 20182the extensions to @option{-march=armv7-a}. 20183 20184@option{-mcpu=generic-@var{arch}} is also permissible, and is 20185equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 20186See @option{-mtune} for more information. 20187 20188@option{-mcpu=native} causes the compiler to auto-detect the CPU 20189of the build computer. At present, this feature is only supported on 20190GNU/Linux, and not all architectures are recognized. If the auto-detect 20191is unsuccessful the option has no effect. 20192 20193@item -mfpu=@var{name} 20194@opindex mfpu 20195This specifies what floating-point hardware (or hardware emulation) is 20196available on the target. Permissible names are: @samp{auto}, @samp{vfpv2}, 20197@samp{vfpv3}, 20198@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 20199@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4}, 20200@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 20201@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 20202@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}. 20203Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp} 20204is an alias for @samp{vfpv2}. 20205 20206The setting @samp{auto} is the default and is special. It causes the 20207compiler to select the floating-point and Advanced SIMD instructions 20208based on the settings of @option{-mcpu} and @option{-march}. 20209 20210If the selected floating-point hardware includes the NEON extension 20211(e.g.@: @option{-mfpu=neon}), note that floating-point 20212operations are not generated by GCC's auto-vectorization pass unless 20213@option{-funsafe-math-optimizations} is also specified. This is 20214because NEON hardware does not fully implement the IEEE 754 standard for 20215floating-point arithmetic (in particular denormal values are treated as 20216zero), so the use of NEON instructions may lead to a loss of precision. 20217 20218You 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}). 20219 20220@item -mfp16-format=@var{name} 20221@opindex mfp16-format 20222Specify the format of the @code{__fp16} half-precision floating-point type. 20223Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 20224the default is @samp{none}, in which case the @code{__fp16} type is not 20225defined. @xref{Half-Precision}, for more information. 20226 20227@item -mstructure-size-boundary=@var{n} 20228@opindex mstructure-size-boundary 20229The sizes of all structures and unions are rounded up to a multiple 20230of the number of bits set by this option. Permissible values are 8, 32 20231and 64. The default value varies for different toolchains. For the COFF 20232targeted toolchain the default value is 8. A value of 64 is only allowed 20233if the underlying ABI supports it. 20234 20235Specifying a larger number can produce faster, more efficient code, but 20236can also increase the size of the program. Different values are potentially 20237incompatible. Code compiled with one value cannot necessarily expect to 20238work with code or libraries compiled with another value, if they exchange 20239information using structures or unions. 20240 20241This option is deprecated. 20242 20243@item -mabort-on-noreturn 20244@opindex mabort-on-noreturn 20245Generate a call to the function @code{abort} at the end of a 20246@code{noreturn} function. It is executed if the function tries to 20247return. 20248 20249@item -mlong-calls 20250@itemx -mno-long-calls 20251@opindex mlong-calls 20252@opindex mno-long-calls 20253Tells the compiler to perform function calls by first loading the 20254address of the function into a register and then performing a subroutine 20255call on this register. This switch is needed if the target function 20256lies outside of the 64-megabyte addressing range of the offset-based 20257version of subroutine call instruction. 20258 20259Even if this switch is enabled, not all function calls are turned 20260into long calls. The heuristic is that static functions, functions 20261that have the @code{short_call} attribute, functions that are inside 20262the scope of a @code{#pragma no_long_calls} directive, and functions whose 20263definitions have already been compiled within the current compilation 20264unit are not turned into long calls. The exceptions to this rule are 20265that weak function definitions, functions with the @code{long_call} 20266attribute or the @code{section} attribute, and functions that are within 20267the scope of a @code{#pragma long_calls} directive are always 20268turned into long calls. 20269 20270This feature is not enabled by default. Specifying 20271@option{-mno-long-calls} restores the default behavior, as does 20272placing the function calls within the scope of a @code{#pragma 20273long_calls_off} directive. Note these switches have no effect on how 20274the compiler generates code to handle function calls via function 20275pointers. 20276 20277@item -msingle-pic-base 20278@opindex msingle-pic-base 20279Treat the register used for PIC addressing as read-only, rather than 20280loading it in the prologue for each function. The runtime system is 20281responsible for initializing this register with an appropriate value 20282before execution begins. 20283 20284@item -mpic-register=@var{reg} 20285@opindex mpic-register 20286Specify the register to be used for PIC addressing. 20287For standard PIC base case, the default is any suitable register 20288determined by compiler. For single PIC base case, the default is 20289@samp{R9} if target is EABI based or stack-checking is enabled, 20290otherwise the default is @samp{R10}. 20291 20292@item -mpic-data-is-text-relative 20293@opindex mpic-data-is-text-relative 20294Assume that the displacement between the text and data segments is fixed 20295at static link time. This permits using PC-relative addressing 20296operations to access data known to be in the data segment. For 20297non-VxWorks RTP targets, this option is enabled by default. When 20298disabled on such targets, it will enable @option{-msingle-pic-base} by 20299default. 20300 20301@item -mpoke-function-name 20302@opindex mpoke-function-name 20303Write the name of each function into the text section, directly 20304preceding the function prologue. The generated code is similar to this: 20305 20306@smallexample 20307 t0 20308 .ascii "arm_poke_function_name", 0 20309 .align 20310 t1 20311 .word 0xff000000 + (t1 - t0) 20312 arm_poke_function_name 20313 mov ip, sp 20314 stmfd sp!, @{fp, ip, lr, pc@} 20315 sub fp, ip, #4 20316@end smallexample 20317 20318When performing a stack backtrace, code can inspect the value of 20319@code{pc} stored at @code{fp + 0}. If the trace function then looks at 20320location @code{pc - 12} and the top 8 bits are set, then we know that 20321there is a function name embedded immediately preceding this location 20322and has length @code{((pc[-3]) & 0xff000000)}. 20323 20324@item -mthumb 20325@itemx -marm 20326@opindex marm 20327@opindex mthumb 20328 20329Select between generating code that executes in ARM and Thumb 20330states. The default for most configurations is to generate code 20331that executes in ARM state, but the default can be changed by 20332configuring GCC with the @option{--with-mode=}@var{state} 20333configure option. 20334 20335You can also override the ARM and Thumb mode for each function 20336by using the @code{target("thumb")} and @code{target("arm")} function attributes 20337(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}). 20338 20339@item -mflip-thumb 20340@opindex mflip-thumb 20341Switch ARM/Thumb modes on alternating functions. 20342This option is provided for regression testing of mixed Thumb/ARM code 20343generation, and is not intended for ordinary use in compiling code. 20344 20345@item -mtpcs-frame 20346@opindex mtpcs-frame 20347Generate a stack frame that is compliant with the Thumb Procedure Call 20348Standard for all non-leaf functions. (A leaf function is one that does 20349not call any other functions.) The default is @option{-mno-tpcs-frame}. 20350 20351@item -mtpcs-leaf-frame 20352@opindex mtpcs-leaf-frame 20353Generate a stack frame that is compliant with the Thumb Procedure Call 20354Standard for all leaf functions. (A leaf function is one that does 20355not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 20356 20357@item -mcallee-super-interworking 20358@opindex mcallee-super-interworking 20359Gives all externally visible functions in the file being compiled an ARM 20360instruction set header which switches to Thumb mode before executing the 20361rest of the function. This allows these functions to be called from 20362non-interworking code. This option is not valid in AAPCS configurations 20363because interworking is enabled by default. 20364 20365@item -mcaller-super-interworking 20366@opindex mcaller-super-interworking 20367Allows calls via function pointers (including virtual functions) to 20368execute correctly regardless of whether the target code has been 20369compiled for interworking or not. There is a small overhead in the cost 20370of executing a function pointer if this option is enabled. This option 20371is not valid in AAPCS configurations because interworking is enabled 20372by default. 20373 20374@item -mtp=@var{name} 20375@opindex mtp 20376Specify the access model for the thread local storage pointer. The valid 20377models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 20378@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 20379(supported in the arm6k architecture), and @samp{auto}, which uses the 20380best available method for the selected processor. The default setting is 20381@samp{auto}. 20382 20383@item -mtls-dialect=@var{dialect} 20384@opindex mtls-dialect 20385Specify the dialect to use for accessing thread local storage. Two 20386@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 20387@samp{gnu} dialect selects the original GNU scheme for supporting 20388local and global dynamic TLS models. The @samp{gnu2} dialect 20389selects the GNU descriptor scheme, which provides better performance 20390for shared libraries. The GNU descriptor scheme is compatible with 20391the original scheme, but does require new assembler, linker and 20392library support. Initial and local exec TLS models are unaffected by 20393this option and always use the original scheme. 20394 20395@item -mword-relocations 20396@opindex mword-relocations 20397Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32). 20398This is enabled by default on targets (uClinux, SymbianOS) where the runtime 20399loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 20400is specified. This option conflicts with @option{-mslow-flash-data}. 20401 20402@item -mfix-cortex-m3-ldrd 20403@opindex mfix-cortex-m3-ldrd 20404Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 20405with overlapping destination and base registers are used. This option avoids 20406generating these instructions. This option is enabled by default when 20407@option{-mcpu=cortex-m3} is specified. 20408 20409@item -munaligned-access 20410@itemx -mno-unaligned-access 20411@opindex munaligned-access 20412@opindex mno-unaligned-access 20413Enables (or disables) reading and writing of 16- and 32- bit values 20414from addresses that are not 16- or 32- bit aligned. By default 20415unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for 20416ARMv8-M Baseline architectures, and enabled for all other 20417architectures. If unaligned access is not enabled then words in packed 20418data structures are accessed a byte at a time. 20419 20420The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 20421generated object file to either true or false, depending upon the 20422setting of this option. If unaligned access is enabled then the 20423preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 20424defined. 20425 20426@item -mneon-for-64bits 20427@opindex mneon-for-64bits 20428This option is deprecated and has no effect. 20429 20430@item -mslow-flash-data 20431@opindex mslow-flash-data 20432Assume loading data from flash is slower than fetching instruction. 20433Therefore literal load is minimized for better performance. 20434This option is only supported when compiling for ARMv7 M-profile and 20435off by default. It conflicts with @option{-mword-relocations}. 20436 20437@item -masm-syntax-unified 20438@opindex masm-syntax-unified 20439Assume inline assembler is using unified asm syntax. The default is 20440currently off which implies divided syntax. This option has no impact 20441on Thumb2. However, this may change in future releases of GCC. 20442Divided syntax should be considered deprecated. 20443 20444@item -mrestrict-it 20445@opindex mrestrict-it 20446Restricts generation of IT blocks to conform to the rules of ARMv8-A. 20447IT blocks can only contain a single 16-bit instruction from a select 20448set of instructions. This option is on by default for ARMv8-A Thumb mode. 20449 20450@item -mprint-tune-info 20451@opindex mprint-tune-info 20452Print CPU tuning information as comment in assembler file. This is 20453an option used only for regression testing of the compiler and not 20454intended for ordinary use in compiling code. This option is disabled 20455by default. 20456 20457@item -mverbose-cost-dump 20458@opindex mverbose-cost-dump 20459Enable verbose cost model dumping in the debug dump files. This option is 20460provided for use in debugging the compiler. 20461 20462@item -mpure-code 20463@opindex mpure-code 20464Do not allow constant data to be placed in code sections. 20465Additionally, when compiling for ELF object format give all text sections the 20466ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option 20467is only available when generating non-pic code for M-profile targets. 20468 20469@item -mcmse 20470@opindex mcmse 20471Generate secure code as per the "ARMv8-M Security Extensions: Requirements on 20472Development Tools Engineering Specification", which can be found on 20473@url{https://developer.arm.com/documentation/ecm0359818/latest/}. 20474 20475@item -mfdpic 20476@itemx -mno-fdpic 20477@opindex mfdpic 20478@opindex mno-fdpic 20479Select the FDPIC ABI, which uses 64-bit function descriptors to 20480represent pointers to functions. When the compiler is configured for 20481@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default 20482and implies @option{-fPIE} if none of the PIC/PIE-related options is 20483provided. On other targets, it only enables the FDPIC-specific code 20484generation features, and the user should explicitly provide the 20485PIC/PIE-related options as needed. 20486 20487Note that static linking is not supported because it would still 20488involve the dynamic linker when the program self-relocates. If such 20489behavior is acceptable, use -static and -Wl,-dynamic-linker options. 20490 20491The opposite @option{-mno-fdpic} option is useful (and required) to 20492build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi}) 20493toolchain as the one used to build the userland programs. 20494 20495@end table 20496 20497@node AVR Options 20498@subsection AVR Options 20499@cindex AVR Options 20500 20501These options are defined for AVR implementations: 20502 20503@table @gcctabopt 20504@item -mmcu=@var{mcu} 20505@opindex mmcu 20506Specify Atmel AVR instruction set architectures (ISA) or MCU type. 20507 20508The default for this option is@tie{}@samp{avr2}. 20509 20510GCC supports the following AVR devices and ISAs: 20511 20512@include avr-mmcu.texi 20513 20514@item -mabsdata 20515@opindex mabsdata 20516 20517Assume that all data in static storage can be accessed by LDS / STS 20518instructions. This option has only an effect on reduced Tiny devices like 20519ATtiny40. See also the @code{absdata} 20520@ref{AVR Variable Attributes,variable attribute}. 20521 20522@item -maccumulate-args 20523@opindex maccumulate-args 20524Accumulate outgoing function arguments and acquire/release the needed 20525stack space for outgoing function arguments once in function 20526prologue/epilogue. Without this option, outgoing arguments are pushed 20527before calling a function and popped afterwards. 20528 20529Popping the arguments after the function call can be expensive on 20530AVR so that accumulating the stack space might lead to smaller 20531executables because arguments need not be removed from the 20532stack after such a function call. 20533 20534This option can lead to reduced code size for functions that perform 20535several calls to functions that get their arguments on the stack like 20536calls to printf-like functions. 20537 20538@item -mbranch-cost=@var{cost} 20539@opindex mbranch-cost 20540Set the branch costs for conditional branch instructions to 20541@var{cost}. Reasonable values for @var{cost} are small, non-negative 20542integers. The default branch cost is 0. 20543 20544@item -mcall-prologues 20545@opindex mcall-prologues 20546Functions prologues/epilogues are expanded as calls to appropriate 20547subroutines. Code size is smaller. 20548 20549@item -mdouble=@var{bits} 20550@itemx -mlong-double=@var{bits} 20551@opindex mdouble 20552@opindex mlong-double 20553Set the size (in bits) of the @code{double} or @code{long double} type, 20554respectively. Possible values for @var{bits} are 32 and 64. 20555Whether or not a specific value for @var{bits} is allowed depends on 20556the @code{--with-double=} and @code{--with-long-double=} 20557@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}}, 20558and the same applies for the default values of the options. 20559 20560@item -mgas-isr-prologues 20561@opindex mgas-isr-prologues 20562Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo 20563instruction supported by GNU Binutils. 20564If this option is on, the feature can still be disabled for individual 20565ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}} 20566function attribute. This feature is activated per default 20567if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}), 20568and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}. 20569 20570@item -mint8 20571@opindex mint8 20572Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 20573@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 20574and @code{long long} is 4 bytes. Please note that this option does not 20575conform to the C standards, but it results in smaller code 20576size. 20577 20578@item -mmain-is-OS_task 20579@opindex mmain-is-OS_task 20580Do not save registers in @code{main}. The effect is the same like 20581attaching attribute @ref{AVR Function Attributes,,@code{OS_task}} 20582to @code{main}. It is activated per default if optimization is on. 20583 20584@item -mn-flash=@var{num} 20585@opindex mn-flash 20586Assume that the flash memory has a size of 20587@var{num} times 64@tie{}KiB. 20588 20589@item -mno-interrupts 20590@opindex mno-interrupts 20591Generated code is not compatible with hardware interrupts. 20592Code size is smaller. 20593 20594@item -mrelax 20595@opindex mrelax 20596Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 20597@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 20598Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 20599the assembler's command line and the @option{--relax} option to the 20600linker's command line. 20601 20602Jump relaxing is performed by the linker because jump offsets are not 20603known before code is located. Therefore, the assembler code generated by the 20604compiler is the same, but the instructions in the executable may 20605differ from instructions in the assembler code. 20606 20607Relaxing must be turned on if linker stubs are needed, see the 20608section on @code{EIND} and linker stubs below. 20609 20610@item -mrmw 20611@opindex mrmw 20612Assume that the device supports the Read-Modify-Write 20613instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 20614 20615@item -mshort-calls 20616@opindex mshort-calls 20617 20618Assume that @code{RJMP} and @code{RCALL} can target the whole 20619program memory. 20620 20621This option is used internally for multilib selection. It is 20622not an optimization option, and you don't need to set it by hand. 20623 20624@item -msp8 20625@opindex msp8 20626Treat the stack pointer register as an 8-bit register, 20627i.e.@: assume the high byte of the stack pointer is zero. 20628In general, you don't need to set this option by hand. 20629 20630This option is used internally by the compiler to select and 20631build multilibs for architectures @code{avr2} and @code{avr25}. 20632These architectures mix devices with and without @code{SPH}. 20633For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 20634the compiler driver adds or removes this option from the compiler 20635proper's command line, because the compiler then knows if the device 20636or architecture has an 8-bit stack pointer and thus no @code{SPH} 20637register or not. 20638 20639@item -mstrict-X 20640@opindex mstrict-X 20641Use address register @code{X} in a way proposed by the hardware. This means 20642that @code{X} is only used in indirect, post-increment or 20643pre-decrement addressing. 20644 20645Without this option, the @code{X} register may be used in the same way 20646as @code{Y} or @code{Z} which then is emulated by additional 20647instructions. 20648For example, loading a value with @code{X+const} addressing with a 20649small non-negative @code{const < 64} to a register @var{Rn} is 20650performed as 20651 20652@example 20653adiw r26, const ; X += const 20654ld @var{Rn}, X ; @var{Rn} = *X 20655sbiw r26, const ; X -= const 20656@end example 20657 20658@item -mtiny-stack 20659@opindex mtiny-stack 20660Only change the lower 8@tie{}bits of the stack pointer. 20661 20662@item -mfract-convert-truncate 20663@opindex mfract-convert-truncate 20664Allow to use truncation instead of rounding towards zero for fractional fixed-point types. 20665 20666@item -nodevicelib 20667@opindex nodevicelib 20668Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. 20669 20670@item -nodevicespecs 20671@opindex nodevicespecs 20672Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's 20673command line. The user takes responsibility for supplying the sub-processes 20674like compiler proper, assembler and linker with appropriate command line 20675options. This means that the user has to supply her private device specs 20676file by means of @option{-specs=@var{path-to-specs-file}}. There is no 20677more need for option @option{-mmcu=@var{mcu}}. 20678 20679This option can also serve as a replacement for the older way of 20680specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory 20681which contains a folder named @code{device-specs} which contains a specs file named 20682@code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}. 20683 20684@item -Waddr-space-convert 20685@opindex Waddr-space-convert 20686@opindex Wno-addr-space-convert 20687Warn about conversions between address spaces in the case where the 20688resulting address space is not contained in the incoming address space. 20689 20690@item -Wmisspelled-isr 20691@opindex Wmisspelled-isr 20692@opindex Wno-misspelled-isr 20693Warn if the ISR is misspelled, i.e.@: without __vector prefix. 20694Enabled by default. 20695@end table 20696 20697@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 20698@cindex @code{EIND} 20699Pointers in the implementation are 16@tie{}bits wide. 20700The address of a function or label is represented as word address so 20701that indirect jumps and calls can target any code address in the 20702range of 64@tie{}Ki words. 20703 20704In order to facilitate indirect jump on devices with more than 128@tie{}Ki 20705bytes of program memory space, there is a special function register called 20706@code{EIND} that serves as most significant part of the target address 20707when @code{EICALL} or @code{EIJMP} instructions are used. 20708 20709Indirect jumps and calls on these devices are handled as follows by 20710the compiler and are subject to some limitations: 20711 20712@itemize @bullet 20713 20714@item 20715The compiler never sets @code{EIND}. 20716 20717@item 20718The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP} 20719instructions or might read @code{EIND} directly in order to emulate an 20720indirect call/jump by means of a @code{RET} instruction. 20721 20722@item 20723The compiler assumes that @code{EIND} never changes during the startup 20724code or during the application. In particular, @code{EIND} is not 20725saved/restored in function or interrupt service routine 20726prologue/epilogue. 20727 20728@item 20729For indirect calls to functions and computed goto, the linker 20730generates @emph{stubs}. Stubs are jump pads sometimes also called 20731@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 20732The stub contains a direct jump to the desired address. 20733 20734@item 20735Linker relaxation must be turned on so that the linker generates 20736the stubs correctly in all situations. See the compiler option 20737@option{-mrelax} and the linker option @option{--relax}. 20738There are corner cases where the linker is supposed to generate stubs 20739but aborts without relaxation and without a helpful error message. 20740 20741@item 20742The default linker script is arranged for code with @code{EIND = 0}. 20743If code is supposed to work for a setup with @code{EIND != 0}, a custom 20744linker script has to be used in order to place the sections whose 20745name start with @code{.trampolines} into the segment where @code{EIND} 20746points to. 20747 20748@item 20749The startup code from libgcc never sets @code{EIND}. 20750Notice that startup code is a blend of code from libgcc and AVR-LibC. 20751For the impact of AVR-LibC on @code{EIND}, see the 20752@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 20753 20754@item 20755It is legitimate for user-specific startup code to set up @code{EIND} 20756early, for example by means of initialization code located in 20757section @code{.init3}. Such code runs prior to general startup code 20758that initializes RAM and calls constructors, but after the bit 20759of startup code from AVR-LibC that sets @code{EIND} to the segment 20760where the vector table is located. 20761@example 20762#include <avr/io.h> 20763 20764static void 20765__attribute__((section(".init3"),naked,used,no_instrument_function)) 20766init3_set_eind (void) 20767@{ 20768 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 20769 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 20770@} 20771@end example 20772 20773@noindent 20774The @code{__trampolines_start} symbol is defined in the linker script. 20775 20776@item 20777Stubs are generated automatically by the linker if 20778the following two conditions are met: 20779@itemize @minus 20780 20781@item The address of a label is taken by means of the @code{gs} modifier 20782(short for @emph{generate stubs}) like so: 20783@example 20784LDI r24, lo8(gs(@var{func})) 20785LDI r25, hi8(gs(@var{func})) 20786@end example 20787@item The final location of that label is in a code segment 20788@emph{outside} the segment where the stubs are located. 20789@end itemize 20790 20791@item 20792The compiler emits such @code{gs} modifiers for code labels in the 20793following situations: 20794@itemize @minus 20795@item Taking address of a function or code label. 20796@item Computed goto. 20797@item If prologue-save function is used, see @option{-mcall-prologues} 20798command-line option. 20799@item Switch/case dispatch tables. If you do not want such dispatch 20800tables you can specify the @option{-fno-jump-tables} command-line option. 20801@item C and C++ constructors/destructors called during startup/shutdown. 20802@item If the tools hit a @code{gs()} modifier explained above. 20803@end itemize 20804 20805@item 20806Jumping to non-symbolic addresses like so is @emph{not} supported: 20807 20808@example 20809int main (void) 20810@{ 20811 /* Call function at word address 0x2 */ 20812 return ((int(*)(void)) 0x2)(); 20813@} 20814@end example 20815 20816Instead, a stub has to be set up, i.e.@: the function has to be called 20817through a symbol (@code{func_4} in the example): 20818 20819@example 20820int main (void) 20821@{ 20822 extern int func_4 (void); 20823 20824 /* Call function at byte address 0x4 */ 20825 return func_4(); 20826@} 20827@end example 20828 20829and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 20830Alternatively, @code{func_4} can be defined in the linker script. 20831@end itemize 20832 20833@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 20834@cindex @code{RAMPD} 20835@cindex @code{RAMPX} 20836@cindex @code{RAMPY} 20837@cindex @code{RAMPZ} 20838Some AVR devices support memories larger than the 64@tie{}KiB range 20839that can be accessed with 16-bit pointers. To access memory locations 20840outside this 64@tie{}KiB range, the content of a @code{RAMP} 20841register is used as high part of the address: 20842The @code{X}, @code{Y}, @code{Z} address register is concatenated 20843with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 20844register, respectively, to get a wide address. Similarly, 20845@code{RAMPD} is used together with direct addressing. 20846 20847@itemize 20848@item 20849The startup code initializes the @code{RAMP} special function 20850registers with zero. 20851 20852@item 20853If a @ref{AVR Named Address Spaces,named address space} other than 20854generic or @code{__flash} is used, then @code{RAMPZ} is set 20855as needed before the operation. 20856 20857@item 20858If the device supports RAM larger than 64@tie{}KiB and the compiler 20859needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 20860is reset to zero after the operation. 20861 20862@item 20863If the device comes with a specific @code{RAMP} register, the ISR 20864prologue/epilogue saves/restores that SFR and initializes it with 20865zero in case the ISR code might (implicitly) use it. 20866 20867@item 20868RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 20869If you use inline assembler to read from locations outside the 2087016-bit address range and change one of the @code{RAMP} registers, 20871you must reset it to zero after the access. 20872 20873@end itemize 20874 20875@subsubsection AVR Built-in Macros 20876 20877GCC defines several built-in macros so that the user code can test 20878for the presence or absence of features. Almost any of the following 20879built-in macros are deduced from device capabilities and thus 20880triggered by the @option{-mmcu=} command-line option. 20881 20882For even more AVR-specific built-in macros see 20883@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 20884 20885@table @code 20886 20887@item __AVR_ARCH__ 20888Build-in macro that resolves to a decimal number that identifies the 20889architecture and depends on the @option{-mmcu=@var{mcu}} option. 20890Possible values are: 20891 20892@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 20893@code{4}, @code{5}, @code{51}, @code{6} 20894 20895for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 20896@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 20897 20898respectively and 20899 20900@code{100}, 20901@code{102}, @code{103}, @code{104}, 20902@code{105}, @code{106}, @code{107} 20903 20904for @var{mcu}=@code{avrtiny}, 20905@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4}, 20906@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 20907If @var{mcu} specifies a device, this built-in macro is set 20908accordingly. For example, with @option{-mmcu=atmega8} the macro is 20909defined to @code{4}. 20910 20911@item __AVR_@var{Device}__ 20912Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 20913the device's name. For example, @option{-mmcu=atmega8} defines the 20914built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 20915@code{__AVR_ATtiny261A__}, etc. 20916 20917The built-in macros' names follow 20918the scheme @code{__AVR_@var{Device}__} where @var{Device} is 20919the device name as from the AVR user manual. The difference between 20920@var{Device} in the built-in macro and @var{device} in 20921@option{-mmcu=@var{device}} is that the latter is always lowercase. 20922 20923If @var{device} is not a device but only a core architecture like 20924@samp{avr51}, this macro is not defined. 20925 20926@item __AVR_DEVICE_NAME__ 20927Setting @option{-mmcu=@var{device}} defines this built-in macro to 20928the device's name. For example, with @option{-mmcu=atmega8} the macro 20929is defined to @code{atmega8}. 20930 20931If @var{device} is not a device but only a core architecture like 20932@samp{avr51}, this macro is not defined. 20933 20934@item __AVR_XMEGA__ 20935The device / architecture belongs to the XMEGA family of devices. 20936 20937@item __AVR_HAVE_ELPM__ 20938The device has the @code{ELPM} instruction. 20939 20940@item __AVR_HAVE_ELPMX__ 20941The device has the @code{ELPM R@var{n},Z} and @code{ELPM 20942R@var{n},Z+} instructions. 20943 20944@item __AVR_HAVE_MOVW__ 20945The device has the @code{MOVW} instruction to perform 16-bit 20946register-register moves. 20947 20948@item __AVR_HAVE_LPMX__ 20949The device has the @code{LPM R@var{n},Z} and 20950@code{LPM R@var{n},Z+} instructions. 20951 20952@item __AVR_HAVE_MUL__ 20953The device has a hardware multiplier. 20954 20955@item __AVR_HAVE_JMP_CALL__ 20956The device has the @code{JMP} and @code{CALL} instructions. 20957This is the case for devices with more than 8@tie{}KiB of program 20958memory. 20959 20960@item __AVR_HAVE_EIJMP_EICALL__ 20961@itemx __AVR_3_BYTE_PC__ 20962The device has the @code{EIJMP} and @code{EICALL} instructions. 20963This is the case for devices with more than 128@tie{}KiB of program memory. 20964This also means that the program counter 20965(PC) is 3@tie{}bytes wide. 20966 20967@item __AVR_2_BYTE_PC__ 20968The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 20969with up to 128@tie{}KiB of program memory. 20970 20971@item __AVR_HAVE_8BIT_SP__ 20972@itemx __AVR_HAVE_16BIT_SP__ 20973The stack pointer (SP) register is treated as 8-bit respectively 2097416-bit register by the compiler. 20975The definition of these macros is affected by @option{-mtiny-stack}. 20976 20977@item __AVR_HAVE_SPH__ 20978@itemx __AVR_SP8__ 20979The device has the SPH (high part of stack pointer) special function 20980register or has an 8-bit stack pointer, respectively. 20981The definition of these macros is affected by @option{-mmcu=} and 20982in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 20983by @option{-msp8}. 20984 20985@item __AVR_HAVE_RAMPD__ 20986@itemx __AVR_HAVE_RAMPX__ 20987@itemx __AVR_HAVE_RAMPY__ 20988@itemx __AVR_HAVE_RAMPZ__ 20989The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 20990@code{RAMPZ} special function register, respectively. 20991 20992@item __NO_INTERRUPTS__ 20993This macro reflects the @option{-mno-interrupts} command-line option. 20994 20995@item __AVR_ERRATA_SKIP__ 20996@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 20997Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 20998instructions because of a hardware erratum. Skip instructions are 20999@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 21000The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 21001set. 21002 21003@item __AVR_ISA_RMW__ 21004The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 21005 21006@item __AVR_SFR_OFFSET__=@var{offset} 21007Instructions that can address I/O special function registers directly 21008like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 21009address as if addressed by an instruction to access RAM like @code{LD} 21010or @code{STS}. This offset depends on the device architecture and has 21011to be subtracted from the RAM address in order to get the 21012respective I/O@tie{}address. 21013 21014@item __AVR_SHORT_CALLS__ 21015The @option{-mshort-calls} command line option is set. 21016 21017@item __AVR_PM_BASE_ADDRESS__=@var{addr} 21018Some devices support reading from flash memory by means of @code{LD*} 21019instructions. The flash memory is seen in the data address space 21020at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro 21021is not defined, this feature is not available. If defined, 21022the address space is linear and there is no need to put 21023@code{.rodata} into RAM. This is handled by the default linker 21024description file, and is currently available for 21025@code{avrtiny} and @code{avrxmega3}. Even more convenient, 21026there is no need to use address spaces like @code{__flash} or 21027features like attribute @code{progmem} and @code{pgm_read_*}. 21028 21029@item __WITH_AVRLIBC__ 21030The compiler is configured to be used together with AVR-Libc. 21031See the @option{--with-avrlibc} configure option. 21032 21033@item __HAVE_DOUBLE_MULTILIB__ 21034Defined if @option{-mdouble=} acts as a multilib option. 21035 21036@item __HAVE_DOUBLE32__ 21037@itemx __HAVE_DOUBLE64__ 21038Defined if the compiler supports 32-bit double resp. 64-bit double. 21039The actual layout is specified by option @option{-mdouble=}. 21040 21041@item __DEFAULT_DOUBLE__ 21042The size in bits of @code{double} if @option{-mdouble=} is not set. 21043To test the layout of @code{double} in a program, use the built-in 21044macro @code{__SIZEOF_DOUBLE__}. 21045 21046@item __HAVE_LONG_DOUBLE32__ 21047@itemx __HAVE_LONG_DOUBLE64__ 21048@itemx __HAVE_LONG_DOUBLE_MULTILIB__ 21049@itemx __DEFAULT_LONG_DOUBLE__ 21050Same as above, but for @code{long double} instead of @code{double}. 21051 21052@item __WITH_DOUBLE_COMPARISON__ 21053Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}} 21054@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}} 21055and is defined to @code{2} or @code{3}. 21056 21057@item __WITH_LIBF7_LIBGCC__ 21058@itemx __WITH_LIBF7_MATH__ 21059@itemx __WITH_LIBF7_MATH_SYMBOLS__ 21060Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}} 21061@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}. 21062 21063@end table 21064 21065@node Blackfin Options 21066@subsection Blackfin Options 21067@cindex Blackfin Options 21068 21069@table @gcctabopt 21070@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 21071@opindex mcpu= 21072Specifies the name of the target Blackfin processor. Currently, @var{cpu} 21073can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 21074@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 21075@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 21076@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 21077@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 21078@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 21079@samp{bf561}, @samp{bf592}. 21080 21081The optional @var{sirevision} specifies the silicon revision of the target 21082Blackfin processor. Any workarounds available for the targeted silicon revision 21083are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 21084If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 21085are enabled. The @code{__SILICON_REVISION__} macro is defined to two 21086hexadecimal digits representing the major and minor numbers in the silicon 21087revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 21088is not defined. If @var{sirevision} is @samp{any}, the 21089@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 21090If this optional @var{sirevision} is not used, GCC assumes the latest known 21091silicon revision of the targeted Blackfin processor. 21092 21093GCC defines a preprocessor macro for the specified @var{cpu}. 21094For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 21095provided by libgloss to be linked in if @option{-msim} is not given. 21096 21097Without this option, @samp{bf532} is used as the processor by default. 21098 21099Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 21100only the preprocessor macro is defined. 21101 21102@item -msim 21103@opindex msim 21104Specifies that the program will be run on the simulator. This causes 21105the simulator BSP provided by libgloss to be linked in. This option 21106has effect only for @samp{bfin-elf} toolchain. 21107Certain other options, such as @option{-mid-shared-library} and 21108@option{-mfdpic}, imply @option{-msim}. 21109 21110@item -momit-leaf-frame-pointer 21111@opindex momit-leaf-frame-pointer 21112Don't keep the frame pointer in a register for leaf functions. This 21113avoids the instructions to save, set up and restore frame pointers and 21114makes an extra register available in leaf functions. 21115 21116@item -mspecld-anomaly 21117@opindex mspecld-anomaly 21118When enabled, the compiler ensures that the generated code does not 21119contain speculative loads after jump instructions. If this option is used, 21120@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 21121 21122@item -mno-specld-anomaly 21123@opindex mno-specld-anomaly 21124@opindex mspecld-anomaly 21125Don't generate extra code to prevent speculative loads from occurring. 21126 21127@item -mcsync-anomaly 21128@opindex mcsync-anomaly 21129When enabled, the compiler ensures that the generated code does not 21130contain CSYNC or SSYNC instructions too soon after conditional branches. 21131If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 21132 21133@item -mno-csync-anomaly 21134@opindex mno-csync-anomaly 21135@opindex mcsync-anomaly 21136Don't generate extra code to prevent CSYNC or SSYNC instructions from 21137occurring too soon after a conditional branch. 21138 21139@item -mlow64k 21140@opindex mlow64k 21141When enabled, the compiler is free to take advantage of the knowledge that 21142the entire program fits into the low 64k of memory. 21143 21144@item -mno-low64k 21145@opindex mno-low64k 21146Assume that the program is arbitrarily large. This is the default. 21147 21148@item -mstack-check-l1 21149@opindex mstack-check-l1 21150Do stack checking using information placed into L1 scratchpad memory by the 21151uClinux kernel. 21152 21153@item -mid-shared-library 21154@opindex mid-shared-library 21155Generate code that supports shared libraries via the library ID method. 21156This allows for execute in place and shared libraries in an environment 21157without virtual memory management. This option implies @option{-fPIC}. 21158With a @samp{bfin-elf} target, this option implies @option{-msim}. 21159 21160@item -mno-id-shared-library 21161@opindex mno-id-shared-library 21162@opindex mid-shared-library 21163Generate code that doesn't assume ID-based shared libraries are being used. 21164This is the default. 21165 21166@item -mleaf-id-shared-library 21167@opindex mleaf-id-shared-library 21168Generate code that supports shared libraries via the library ID method, 21169but assumes that this library or executable won't link against any other 21170ID shared libraries. That allows the compiler to use faster code for jumps 21171and calls. 21172 21173@item -mno-leaf-id-shared-library 21174@opindex mno-leaf-id-shared-library 21175@opindex mleaf-id-shared-library 21176Do not assume that the code being compiled won't link against any ID shared 21177libraries. Slower code is generated for jump and call insns. 21178 21179@item -mshared-library-id=n 21180@opindex mshared-library-id 21181Specifies the identification number of the ID-based shared library being 21182compiled. Specifying a value of 0 generates more compact code; specifying 21183other values forces the allocation of that number to the current 21184library but is no more space- or time-efficient than omitting this option. 21185 21186@item -msep-data 21187@opindex msep-data 21188Generate code that allows the data segment to be located in a different 21189area of memory from the text segment. This allows for execute in place in 21190an environment without virtual memory management by eliminating relocations 21191against the text section. 21192 21193@item -mno-sep-data 21194@opindex mno-sep-data 21195@opindex msep-data 21196Generate code that assumes that the data segment follows the text segment. 21197This is the default. 21198 21199@item -mlong-calls 21200@itemx -mno-long-calls 21201@opindex mlong-calls 21202@opindex mno-long-calls 21203Tells the compiler to perform function calls by first loading the 21204address of the function into a register and then performing a subroutine 21205call on this register. This switch is needed if the target function 21206lies outside of the 24-bit addressing range of the offset-based 21207version of subroutine call instruction. 21208 21209This feature is not enabled by default. Specifying 21210@option{-mno-long-calls} restores the default behavior. Note these 21211switches have no effect on how the compiler generates code to handle 21212function calls via function pointers. 21213 21214@item -mfast-fp 21215@opindex mfast-fp 21216Link with the fast floating-point library. This library relaxes some of 21217the IEEE floating-point standard's rules for checking inputs against 21218Not-a-Number (NAN), in the interest of performance. 21219 21220@item -minline-plt 21221@opindex minline-plt 21222Enable inlining of PLT entries in function calls to functions that are 21223not known to bind locally. It has no effect without @option{-mfdpic}. 21224 21225@item -mmulticore 21226@opindex mmulticore 21227Build a standalone application for multicore Blackfin processors. 21228This option causes proper start files and link scripts supporting 21229multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 21230It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 21231 21232This option can be used with @option{-mcorea} or @option{-mcoreb}, which 21233selects the one-application-per-core programming model. Without 21234@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 21235programming model is used. In this model, the main function of Core B 21236should be named as @code{coreb_main}. 21237 21238If this option is not used, the single-core application programming 21239model is used. 21240 21241@item -mcorea 21242@opindex mcorea 21243Build a standalone application for Core A of BF561 when using 21244the one-application-per-core programming model. Proper start files 21245and link scripts are used to support Core A, and the macro 21246@code{__BFIN_COREA} is defined. 21247This option can only be used in conjunction with @option{-mmulticore}. 21248 21249@item -mcoreb 21250@opindex mcoreb 21251Build a standalone application for Core B of BF561 when using 21252the one-application-per-core programming model. Proper start files 21253and link scripts are used to support Core B, and the macro 21254@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 21255should be used instead of @code{main}. 21256This option can only be used in conjunction with @option{-mmulticore}. 21257 21258@item -msdram 21259@opindex msdram 21260Build a standalone application for SDRAM. Proper start files and 21261link scripts are used to put the application into SDRAM, and the macro 21262@code{__BFIN_SDRAM} is defined. 21263The loader should initialize SDRAM before loading the application. 21264 21265@item -micplb 21266@opindex micplb 21267Assume that ICPLBs are enabled at run time. This has an effect on certain 21268anomaly workarounds. For Linux targets, the default is to assume ICPLBs 21269are enabled; for standalone applications the default is off. 21270@end table 21271 21272@node C6X Options 21273@subsection C6X Options 21274@cindex C6X Options 21275 21276@table @gcctabopt 21277@item -march=@var{name} 21278@opindex march 21279This specifies the name of the target architecture. GCC uses this 21280name to determine what kind of instructions it can emit when generating 21281assembly code. Permissible names are: @samp{c62x}, 21282@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 21283 21284@item -mbig-endian 21285@opindex mbig-endian 21286Generate code for a big-endian target. 21287 21288@item -mlittle-endian 21289@opindex mlittle-endian 21290Generate code for a little-endian target. This is the default. 21291 21292@item -msim 21293@opindex msim 21294Choose startup files and linker script suitable for the simulator. 21295 21296@item -msdata=default 21297@opindex msdata=default 21298Put small global and static data in the @code{.neardata} section, 21299which is pointed to by register @code{B14}. Put small uninitialized 21300global and static data in the @code{.bss} section, which is adjacent 21301to the @code{.neardata} section. Put small read-only data into the 21302@code{.rodata} section. The corresponding sections used for large 21303pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 21304 21305@item -msdata=all 21306@opindex msdata=all 21307Put all data, not just small objects, into the sections reserved for 21308small data, and use addressing relative to the @code{B14} register to 21309access them. 21310 21311@item -msdata=none 21312@opindex msdata=none 21313Make no use of the sections reserved for small data, and use absolute 21314addresses to access all data. Put all initialized global and static 21315data in the @code{.fardata} section, and all uninitialized data in the 21316@code{.far} section. Put all constant data into the @code{.const} 21317section. 21318@end table 21319 21320@node CRIS Options 21321@subsection CRIS Options 21322@cindex CRIS Options 21323 21324These options are defined specifically for the CRIS ports. 21325 21326@table @gcctabopt 21327@item -march=@var{architecture-type} 21328@itemx -mcpu=@var{architecture-type} 21329@opindex march 21330@opindex mcpu 21331Generate code for the specified architecture. The choices for 21332@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 21333respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 21334Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 21335@samp{v10}. 21336 21337@item -mtune=@var{architecture-type} 21338@opindex mtune 21339Tune to @var{architecture-type} everything applicable about the generated 21340code, except for the ABI and the set of available instructions. The 21341choices for @var{architecture-type} are the same as for 21342@option{-march=@var{architecture-type}}. 21343 21344@item -mmax-stack-frame=@var{n} 21345@opindex mmax-stack-frame 21346Warn when the stack frame of a function exceeds @var{n} bytes. 21347 21348@item -metrax4 21349@itemx -metrax100 21350@opindex metrax4 21351@opindex metrax100 21352The options @option{-metrax4} and @option{-metrax100} are synonyms for 21353@option{-march=v3} and @option{-march=v8} respectively. 21354 21355@item -mmul-bug-workaround 21356@itemx -mno-mul-bug-workaround 21357@opindex mmul-bug-workaround 21358@opindex mno-mul-bug-workaround 21359Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 21360models where it applies. This option is active by default. 21361 21362@item -mpdebug 21363@opindex mpdebug 21364Enable CRIS-specific verbose debug-related information in the assembly 21365code. This option also has the effect of turning off the @samp{#NO_APP} 21366formatted-code indicator to the assembler at the beginning of the 21367assembly file. 21368 21369@item -mcc-init 21370@opindex mcc-init 21371Do not use condition-code results from previous instruction; always emit 21372compare and test instructions before use of condition codes. 21373 21374@item -mno-side-effects 21375@opindex mno-side-effects 21376@opindex mside-effects 21377Do not emit instructions with side effects in addressing modes other than 21378post-increment. 21379 21380@item -mstack-align 21381@itemx -mno-stack-align 21382@itemx -mdata-align 21383@itemx -mno-data-align 21384@itemx -mconst-align 21385@itemx -mno-const-align 21386@opindex mstack-align 21387@opindex mno-stack-align 21388@opindex mdata-align 21389@opindex mno-data-align 21390@opindex mconst-align 21391@opindex mno-const-align 21392These options (@samp{no-} options) arrange (eliminate arrangements) for the 21393stack frame, individual data and constants to be aligned for the maximum 21394single data access size for the chosen CPU model. The default is to 21395arrange for 32-bit alignment. ABI details such as structure layout are 21396not affected by these options. 21397 21398@item -m32-bit 21399@itemx -m16-bit 21400@itemx -m8-bit 21401@opindex m32-bit 21402@opindex m16-bit 21403@opindex m8-bit 21404Similar to the stack- data- and const-align options above, these options 21405arrange for stack frame, writable data and constants to all be 32-bit, 2140616-bit or 8-bit aligned. The default is 32-bit alignment. 21407 21408@item -mno-prologue-epilogue 21409@itemx -mprologue-epilogue 21410@opindex mno-prologue-epilogue 21411@opindex mprologue-epilogue 21412With @option{-mno-prologue-epilogue}, the normal function prologue and 21413epilogue which set up the stack frame are omitted and no return 21414instructions or return sequences are generated in the code. Use this 21415option only together with visual inspection of the compiled code: no 21416warnings or errors are generated when call-saved registers must be saved, 21417or storage for local variables needs to be allocated. 21418 21419@item -mno-gotplt 21420@itemx -mgotplt 21421@opindex mno-gotplt 21422@opindex mgotplt 21423With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 21424instruction sequences that load addresses for functions from the PLT part 21425of the GOT rather than (traditional on other architectures) calls to the 21426PLT@. The default is @option{-mgotplt}. 21427 21428@item -melf 21429@opindex melf 21430Legacy no-op option only recognized with the cris-axis-elf and 21431cris-axis-linux-gnu targets. 21432 21433@item -mlinux 21434@opindex mlinux 21435Legacy no-op option only recognized with the cris-axis-linux-gnu target. 21436 21437@item -sim 21438@opindex sim 21439This option, recognized for the cris-axis-elf, arranges 21440to link with input-output functions from a simulator library. Code, 21441initialized data and zero-initialized data are allocated consecutively. 21442 21443@item -sim2 21444@opindex sim2 21445Like @option{-sim}, but pass linker options to locate initialized data at 214460x40000000 and zero-initialized data at 0x80000000. 21447@end table 21448 21449@node CR16 Options 21450@subsection CR16 Options 21451@cindex CR16 Options 21452 21453These options are defined specifically for the CR16 ports. 21454 21455@table @gcctabopt 21456 21457@item -mmac 21458@opindex mmac 21459Enable the use of multiply-accumulate instructions. Disabled by default. 21460 21461@item -mcr16cplus 21462@itemx -mcr16c 21463@opindex mcr16cplus 21464@opindex mcr16c 21465Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 21466is default. 21467 21468@item -msim 21469@opindex msim 21470Links the library libsim.a which is in compatible with simulator. Applicable 21471to ELF compiler only. 21472 21473@item -mint32 21474@opindex mint32 21475Choose integer type as 32-bit wide. 21476 21477@item -mbit-ops 21478@opindex mbit-ops 21479Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 21480 21481@item -mdata-model=@var{model} 21482@opindex mdata-model 21483Choose a data model. The choices for @var{model} are @samp{near}, 21484@samp{far} or @samp{medium}. @samp{medium} is default. 21485However, @samp{far} is not valid with @option{-mcr16c}, as the 21486CR16C architecture does not support the far data model. 21487@end table 21488 21489@node C-SKY Options 21490@subsection C-SKY Options 21491@cindex C-SKY Options 21492 21493GCC supports these options when compiling for C-SKY V2 processors. 21494 21495@table @gcctabopt 21496 21497@item -march=@var{arch} 21498@opindex march= 21499Specify the C-SKY target architecture. Valid values for @var{arch} are: 21500@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}. 21501The default is @samp{ck810}. 21502 21503@item -mcpu=@var{cpu} 21504@opindex mcpu= 21505Specify the C-SKY target processor. Valid values for @var{cpu} are: 21506@samp{ck801}, @samp{ck801t}, 21507@samp{ck802}, @samp{ck802t}, @samp{ck802j}, 21508@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht}, 21509@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh}, 21510@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh}, 21511@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1}, 21512@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1}, 21513@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1}, 21514@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1}, 21515@samp{ck803eftr1}, @samp{ck803efhtr1}, 21516@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf}, 21517@samp{ck803sef}, @samp{ck803seft}, 21518@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f}, 21519@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft}, 21520@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv}, 21521@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}. 21522 21523@item -mbig-endian 21524@opindex mbig-endian 21525@itemx -EB 21526@opindex EB 21527@itemx -mlittle-endian 21528@opindex mlittle-endian 21529@itemx -EL 21530@opindex EL 21531 21532Select big- or little-endian code. The default is little-endian. 21533 21534@item -mfloat-abi=@var{name} 21535@opindex mfloat-abi 21536Specifies which floating-point ABI to use. Permissible values 21537are: @samp{soft}, @samp{softfp} and @samp{hard}. 21538 21539Specifying @samp{soft} causes GCC to generate output containing 21540library calls for floating-point operations. 21541@samp{softfp} allows the generation of code using hardware floating-point 21542instructions, but still uses the soft-float calling conventions. 21543@samp{hard} allows generation of floating-point instructions 21544and uses FPU-specific calling conventions. 21545 21546The default depends on the specific target configuration. Note that 21547the hard-float and soft-float ABIs are not link-compatible; you must 21548compile your entire program with the same ABI, and link with a 21549compatible set of libraries. 21550 21551@item -mhard-float 21552@opindex mhard-float 21553@itemx -msoft-float 21554@opindex msoft-float 21555 21556Select hardware or software floating-point implementations. 21557The default is soft float. 21558 21559@item -mdouble-float 21560@itemx -mno-double-float 21561@opindex mdouble-float 21562When @option{-mhard-float} is in effect, enable generation of 21563double-precision float instructions. This is the default except 21564when compiling for CK803. 21565 21566@item -mfdivdu 21567@itemx -mno-fdivdu 21568@opindex mfdivdu 21569When @option{-mhard-float} is in effect, enable generation of 21570@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions. 21571This is the default except when compiling for CK803. 21572 21573@item -mfpu=@var{fpu} 21574@opindex mfpu= 21575Select the floating-point processor. This option can only be used with 21576@option{-mhard-float}. 21577Values for @var{fpu} are 21578@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}), 21579@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and 21580@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}). 21581 21582@item -melrw 21583@itemx -mno-elrw 21584@opindex melrw 21585Enable the extended @code{lrw} instruction. This option defaults to on 21586for CK801 and off otherwise. 21587 21588@item -mistack 21589@itemx -mno-istack 21590@opindex mistack 21591Enable interrupt stack instructions; the default is off. 21592 21593The @option{-mistack} option is required to handle the 21594@code{interrupt} and @code{isr} function attributes 21595(@pxref{C-SKY Function Attributes}). 21596 21597@item -mmp 21598@opindex mmp 21599Enable multiprocessor instructions; the default is off. 21600 21601@item -mcp 21602@opindex mcp 21603Enable coprocessor instructions; the default is off. 21604 21605@item -mcache 21606@opindex mcache 21607Enable coprocessor instructions; the default is off. 21608 21609@item -msecurity 21610@opindex msecurity 21611Enable C-SKY security instructions; the default is off. 21612 21613@item -mtrust 21614@opindex mtrust 21615Enable C-SKY trust instructions; the default is off. 21616 21617@item -mdsp 21618@opindex mdsp 21619@itemx -medsp 21620@opindex medsp 21621@itemx -mvdsp 21622@opindex mvdsp 21623Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively. 21624All of these options default to off. 21625 21626@item -mdiv 21627@itemx -mno-div 21628@opindex mdiv 21629Generate divide instructions. Default is off. 21630 21631@item -msmart 21632@itemx -mno-smart 21633@opindex msmart 21634Generate code for Smart Mode, using only registers numbered 0-7 to allow 21635use of 16-bit instructions. This option is ignored for CK801 where this 21636is the required behavior, and it defaults to on for CK802. 21637For other targets, the default is off. 21638 21639@item -mhigh-registers 21640@itemx -mno-high-registers 21641@opindex mhigh-registers 21642Generate code using the high registers numbered 16-31. This option 21643is not supported on CK801, CK802, or CK803, and is enabled by default 21644for other processors. 21645 21646@item -manchor 21647@itemx -mno-anchor 21648@opindex manchor 21649Generate code using global anchor symbol addresses. 21650 21651@item -mpushpop 21652@itemx -mno-pushpop 21653@opindex mpushpop 21654Generate code using @code{push} and @code{pop} instructions. This option 21655defaults to on. 21656 21657@item -mmultiple-stld 21658@itemx -mstm 21659@itemx -mno-multiple-stld 21660@itemx -mno-stm 21661@opindex mmultiple-stld 21662Generate code using @code{stm} and @code{ldm} instructions. This option 21663isn't supported on CK801 but is enabled by default on other processors. 21664 21665@item -mconstpool 21666@itemx -mno-constpool 21667@opindex mconstpool 21668Create constant pools in the compiler instead of deferring it to the 21669assembler. This option is the default and required for correct code 21670generation on CK801 and CK802, and is optional on other processors. 21671 21672@item -mstack-size 21673@item -mno-stack-size 21674@opindex mstack-size 21675Emit @code{.stack_size} directives for each function in the assembly 21676output. This option defaults to off. 21677 21678@item -mccrt 21679@itemx -mno-ccrt 21680@opindex mccrt 21681Generate code for the C-SKY compiler runtime instead of libgcc. This 21682option defaults to off. 21683 21684@item -mbranch-cost=@var{n} 21685@opindex mbranch-cost= 21686Set the branch costs to roughly @code{n} instructions. The default is 1. 21687 21688@item -msched-prolog 21689@itemx -mno-sched-prolog 21690@opindex msched-prolog 21691Permit scheduling of function prologue and epilogue sequences. Using 21692this option can result in code that is not compliant with the C-SKY V2 ABI 21693prologue requirements and that cannot be debugged or backtraced. 21694It is disabled by default. 21695 21696@item -msim 21697@opindex msim 21698Links the library libsemi.a which is in compatible with simulator. Applicable 21699to ELF compiler only. 21700 21701@end table 21702 21703@node Darwin Options 21704@subsection Darwin Options 21705@cindex Darwin options 21706 21707These options are defined for all architectures running the Darwin operating 21708system. 21709 21710FSF GCC on Darwin does not create ``fat'' object files; it creates 21711an object file for the single architecture that GCC was built to 21712target. Apple's GCC on Darwin does create ``fat'' files if multiple 21713@option{-arch} options are used; it does so by running the compiler or 21714linker multiple times and joining the results together with 21715@file{lipo}. 21716 21717The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 21718@samp{i686}) is determined by the flags that specify the ISA 21719that GCC is targeting, like @option{-mcpu} or @option{-march}. The 21720@option{-force_cpusubtype_ALL} option can be used to override this. 21721 21722The Darwin tools vary in their behavior when presented with an ISA 21723mismatch. The assembler, @file{as}, only permits instructions to 21724be used that are valid for the subtype of the file it is generating, 21725so you cannot put 64-bit instructions in a @samp{ppc750} object file. 21726The linker for shared libraries, @file{/usr/bin/libtool}, fails 21727and prints an error if asked to create a shared library with a less 21728restrictive subtype than its input files (for instance, trying to put 21729a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 21730for executables, @command{ld}, quietly gives the executable the most 21731restrictive subtype of any of its input files. 21732 21733@table @gcctabopt 21734@item -F@var{dir} 21735@opindex F 21736Add the framework directory @var{dir} to the head of the list of 21737directories to be searched for header files. These directories are 21738interleaved with those specified by @option{-I} options and are 21739scanned in a left-to-right order. 21740 21741A framework directory is a directory with frameworks in it. A 21742framework is a directory with a @file{Headers} and/or 21743@file{PrivateHeaders} directory contained directly in it that ends 21744in @file{.framework}. The name of a framework is the name of this 21745directory excluding the @file{.framework}. Headers associated with 21746the framework are found in one of those two directories, with 21747@file{Headers} being searched first. A subframework is a framework 21748directory that is in a framework's @file{Frameworks} directory. 21749Includes of subframework headers can only appear in a header of a 21750framework that contains the subframework, or in a sibling subframework 21751header. Two subframeworks are siblings if they occur in the same 21752framework. A subframework should not have the same name as a 21753framework; a warning is issued if this is violated. Currently a 21754subframework cannot have subframeworks; in the future, the mechanism 21755may be extended to support this. The standard frameworks can be found 21756in @file{/System/Library/Frameworks} and 21757@file{/Library/Frameworks}. An example include looks like 21758@code{#include <Framework/header.h>}, where @file{Framework} denotes 21759the name of the framework and @file{header.h} is found in the 21760@file{PrivateHeaders} or @file{Headers} directory. 21761 21762@item -iframework@var{dir} 21763@opindex iframework 21764Like @option{-F} except the directory is a treated as a system 21765directory. The main difference between this @option{-iframework} and 21766@option{-F} is that with @option{-iframework} the compiler does not 21767warn about constructs contained within header files found via 21768@var{dir}. This option is valid only for the C family of languages. 21769 21770@item -gused 21771@opindex gused 21772Emit debugging information for symbols that are used. For stabs 21773debugging format, this enables @option{-feliminate-unused-debug-symbols}. 21774This is by default ON@. 21775 21776@item -gfull 21777@opindex gfull 21778Emit debugging information for all symbols and types. 21779 21780@item -mmacosx-version-min=@var{version} 21781The earliest version of MacOS X that this executable will run on 21782is @var{version}. Typical values of @var{version} include @code{10.1}, 21783@code{10.2}, and @code{10.3.9}. 21784 21785If the compiler was built to use the system's headers by default, 21786then the default for this option is the system version on which the 21787compiler is running, otherwise the default is to make choices that 21788are compatible with as many systems and code bases as possible. 21789 21790@item -mkernel 21791@opindex mkernel 21792Enable kernel development mode. The @option{-mkernel} option sets 21793@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 21794@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 21795@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 21796applicable. This mode also sets @option{-mno-altivec}, 21797@option{-msoft-float}, @option{-fno-builtin} and 21798@option{-mlong-branch} for PowerPC targets. 21799 21800@item -mone-byte-bool 21801@opindex mone-byte-bool 21802Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 21803By default @code{sizeof(bool)} is @code{4} when compiling for 21804Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 21805option has no effect on x86. 21806 21807@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 21808to generate code that is not binary compatible with code generated 21809without that switch. Using this switch may require recompiling all 21810other modules in a program, including system libraries. Use this 21811switch to conform to a non-default data model. 21812 21813@item -mfix-and-continue 21814@itemx -ffix-and-continue 21815@itemx -findirect-data 21816@opindex mfix-and-continue 21817@opindex ffix-and-continue 21818@opindex findirect-data 21819Generate code suitable for fast turnaround development, such as to 21820allow GDB to dynamically load @file{.o} files into already-running 21821programs. @option{-findirect-data} and @option{-ffix-and-continue} 21822are provided for backwards compatibility. 21823 21824@item -all_load 21825@opindex all_load 21826Loads all members of static archive libraries. 21827See man ld(1) for more information. 21828 21829@item -arch_errors_fatal 21830@opindex arch_errors_fatal 21831Cause the errors having to do with files that have the wrong architecture 21832to be fatal. 21833 21834@item -bind_at_load 21835@opindex bind_at_load 21836Causes the output file to be marked such that the dynamic linker will 21837bind all undefined references when the file is loaded or launched. 21838 21839@item -bundle 21840@opindex bundle 21841Produce a Mach-o bundle format file. 21842See man ld(1) for more information. 21843 21844@item -bundle_loader @var{executable} 21845@opindex bundle_loader 21846This option specifies the @var{executable} that will load the build 21847output file being linked. See man ld(1) for more information. 21848 21849@item -dynamiclib 21850@opindex dynamiclib 21851When passed this option, GCC produces a dynamic library instead of 21852an executable when linking, using the Darwin @file{libtool} command. 21853 21854@item -force_cpusubtype_ALL 21855@opindex force_cpusubtype_ALL 21856This causes GCC's output file to have the @samp{ALL} subtype, instead of 21857one controlled by the @option{-mcpu} or @option{-march} option. 21858 21859@item -allowable_client @var{client_name} 21860@itemx -client_name 21861@itemx -compatibility_version 21862@itemx -current_version 21863@itemx -dead_strip 21864@itemx -dependency-file 21865@itemx -dylib_file 21866@itemx -dylinker_install_name 21867@itemx -dynamic 21868@itemx -exported_symbols_list 21869@itemx -filelist 21870@need 800 21871@itemx -flat_namespace 21872@itemx -force_flat_namespace 21873@itemx -headerpad_max_install_names 21874@itemx -image_base 21875@itemx -init 21876@itemx -install_name 21877@itemx -keep_private_externs 21878@itemx -multi_module 21879@itemx -multiply_defined 21880@itemx -multiply_defined_unused 21881@need 800 21882@itemx -noall_load 21883@itemx -no_dead_strip_inits_and_terms 21884@itemx -nofixprebinding 21885@itemx -nomultidefs 21886@itemx -noprebind 21887@itemx -noseglinkedit 21888@itemx -pagezero_size 21889@itemx -prebind 21890@itemx -prebind_all_twolevel_modules 21891@itemx -private_bundle 21892@need 800 21893@itemx -read_only_relocs 21894@itemx -sectalign 21895@itemx -sectobjectsymbols 21896@itemx -whyload 21897@itemx -seg1addr 21898@itemx -sectcreate 21899@itemx -sectobjectsymbols 21900@itemx -sectorder 21901@itemx -segaddr 21902@itemx -segs_read_only_addr 21903@need 800 21904@itemx -segs_read_write_addr 21905@itemx -seg_addr_table 21906@itemx -seg_addr_table_filename 21907@itemx -seglinkedit 21908@itemx -segprot 21909@itemx -segs_read_only_addr 21910@itemx -segs_read_write_addr 21911@itemx -single_module 21912@itemx -static 21913@itemx -sub_library 21914@need 800 21915@itemx -sub_umbrella 21916@itemx -twolevel_namespace 21917@itemx -umbrella 21918@itemx -undefined 21919@itemx -unexported_symbols_list 21920@itemx -weak_reference_mismatches 21921@itemx -whatsloaded 21922@opindex allowable_client 21923@opindex client_name 21924@opindex compatibility_version 21925@opindex current_version 21926@opindex dead_strip 21927@opindex dependency-file 21928@opindex dylib_file 21929@opindex dylinker_install_name 21930@opindex dynamic 21931@opindex exported_symbols_list 21932@opindex filelist 21933@opindex flat_namespace 21934@opindex force_flat_namespace 21935@opindex headerpad_max_install_names 21936@opindex image_base 21937@opindex init 21938@opindex install_name 21939@opindex keep_private_externs 21940@opindex multi_module 21941@opindex multiply_defined 21942@opindex multiply_defined_unused 21943@opindex noall_load 21944@opindex no_dead_strip_inits_and_terms 21945@opindex nofixprebinding 21946@opindex nomultidefs 21947@opindex noprebind 21948@opindex noseglinkedit 21949@opindex pagezero_size 21950@opindex prebind 21951@opindex prebind_all_twolevel_modules 21952@opindex private_bundle 21953@opindex read_only_relocs 21954@opindex sectalign 21955@opindex sectobjectsymbols 21956@opindex whyload 21957@opindex seg1addr 21958@opindex sectcreate 21959@opindex sectobjectsymbols 21960@opindex sectorder 21961@opindex segaddr 21962@opindex segs_read_only_addr 21963@opindex segs_read_write_addr 21964@opindex seg_addr_table 21965@opindex seg_addr_table_filename 21966@opindex seglinkedit 21967@opindex segprot 21968@opindex segs_read_only_addr 21969@opindex segs_read_write_addr 21970@opindex single_module 21971@opindex static 21972@opindex sub_library 21973@opindex sub_umbrella 21974@opindex twolevel_namespace 21975@opindex umbrella 21976@opindex undefined 21977@opindex unexported_symbols_list 21978@opindex weak_reference_mismatches 21979@opindex whatsloaded 21980These options are passed to the Darwin linker. The Darwin linker man page 21981describes them in detail. 21982@end table 21983 21984@node DEC Alpha Options 21985@subsection DEC Alpha Options 21986 21987These @samp{-m} options are defined for the DEC Alpha implementations: 21988 21989@table @gcctabopt 21990@item -mno-soft-float 21991@itemx -msoft-float 21992@opindex mno-soft-float 21993@opindex msoft-float 21994Use (do not use) the hardware floating-point instructions for 21995floating-point operations. When @option{-msoft-float} is specified, 21996functions in @file{libgcc.a} are used to perform floating-point 21997operations. Unless they are replaced by routines that emulate the 21998floating-point operations, or compiled in such a way as to call such 21999emulations routines, these routines issue floating-point 22000operations. If you are compiling for an Alpha without floating-point 22001operations, you must ensure that the library is built so as not to call 22002them. 22003 22004Note that Alpha implementations without floating-point operations are 22005required to have floating-point registers. 22006 22007@item -mfp-reg 22008@itemx -mno-fp-regs 22009@opindex mfp-reg 22010@opindex mno-fp-regs 22011Generate code that uses (does not use) the floating-point register set. 22012@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 22013register set is not used, floating-point operands are passed in integer 22014registers as if they were integers and floating-point results are passed 22015in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 22016so any function with a floating-point argument or return value called by code 22017compiled with @option{-mno-fp-regs} must also be compiled with that 22018option. 22019 22020A typical use of this option is building a kernel that does not use, 22021and hence need not save and restore, any floating-point registers. 22022 22023@item -mieee 22024@opindex mieee 22025The Alpha architecture implements floating-point hardware optimized for 22026maximum performance. It is mostly compliant with the IEEE floating-point 22027standard. However, for full compliance, software assistance is 22028required. This option generates code fully IEEE-compliant code 22029@emph{except} that the @var{inexact-flag} is not maintained (see below). 22030If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 22031defined during compilation. The resulting code is less efficient but is 22032able to correctly support denormalized numbers and exceptional IEEE 22033values such as not-a-number and plus/minus infinity. Other Alpha 22034compilers call this option @option{-ieee_with_no_inexact}. 22035 22036@item -mieee-with-inexact 22037@opindex mieee-with-inexact 22038This is like @option{-mieee} except the generated code also maintains 22039the IEEE @var{inexact-flag}. Turning on this option causes the 22040generated code to implement fully-compliant IEEE math. In addition to 22041@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 22042macro. On some Alpha implementations the resulting code may execute 22043significantly slower than the code generated by default. Since there is 22044very little code that depends on the @var{inexact-flag}, you should 22045normally not specify this option. Other Alpha compilers call this 22046option @option{-ieee_with_inexact}. 22047 22048@item -mfp-trap-mode=@var{trap-mode} 22049@opindex mfp-trap-mode 22050This option controls what floating-point related traps are enabled. 22051Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 22052The trap mode can be set to one of four values: 22053 22054@table @samp 22055@item n 22056This is the default (normal) setting. The only traps that are enabled 22057are the ones that cannot be disabled in software (e.g., division by zero 22058trap). 22059 22060@item u 22061In addition to the traps enabled by @samp{n}, underflow traps are enabled 22062as well. 22063 22064@item su 22065Like @samp{u}, but the instructions are marked to be safe for software 22066completion (see Alpha architecture manual for details). 22067 22068@item sui 22069Like @samp{su}, but inexact traps are enabled as well. 22070@end table 22071 22072@item -mfp-rounding-mode=@var{rounding-mode} 22073@opindex mfp-rounding-mode 22074Selects the IEEE rounding mode. Other Alpha compilers call this option 22075@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 22076of: 22077 22078@table @samp 22079@item n 22080Normal IEEE rounding mode. Floating-point numbers are rounded towards 22081the nearest machine number or towards the even machine number in case 22082of a tie. 22083 22084@item m 22085Round towards minus infinity. 22086 22087@item c 22088Chopped rounding mode. Floating-point numbers are rounded towards zero. 22089 22090@item d 22091Dynamic rounding mode. A field in the floating-point control register 22092(@var{fpcr}, see Alpha architecture reference manual) controls the 22093rounding mode in effect. The C library initializes this register for 22094rounding towards plus infinity. Thus, unless your program modifies the 22095@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 22096@end table 22097 22098@item -mtrap-precision=@var{trap-precision} 22099@opindex mtrap-precision 22100In the Alpha architecture, floating-point traps are imprecise. This 22101means without software assistance it is impossible to recover from a 22102floating trap and program execution normally needs to be terminated. 22103GCC can generate code that can assist operating system trap handlers 22104in determining the exact location that caused a floating-point trap. 22105Depending on the requirements of an application, different levels of 22106precisions can be selected: 22107 22108@table @samp 22109@item p 22110Program precision. This option is the default and means a trap handler 22111can only identify which program caused a floating-point exception. 22112 22113@item f 22114Function precision. The trap handler can determine the function that 22115caused a floating-point exception. 22116 22117@item i 22118Instruction precision. The trap handler can determine the exact 22119instruction that caused a floating-point exception. 22120@end table 22121 22122Other Alpha compilers provide the equivalent options called 22123@option{-scope_safe} and @option{-resumption_safe}. 22124 22125@item -mieee-conformant 22126@opindex mieee-conformant 22127This option marks the generated code as IEEE conformant. You must not 22128use this option unless you also specify @option{-mtrap-precision=i} and either 22129@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 22130is to emit the line @samp{.eflag 48} in the function prologue of the 22131generated assembly file. 22132 22133@item -mbuild-constants 22134@opindex mbuild-constants 22135Normally GCC examines a 32- or 64-bit integer constant to 22136see if it can construct it from smaller constants in two or three 22137instructions. If it cannot, it outputs the constant as a literal and 22138generates code to load it from the data segment at run time. 22139 22140Use this option to require GCC to construct @emph{all} integer constants 22141using code, even if it takes more instructions (the maximum is six). 22142 22143You typically use this option to build a shared library dynamic 22144loader. Itself a shared library, it must relocate itself in memory 22145before it can find the variables and constants in its own data segment. 22146 22147@item -mbwx 22148@itemx -mno-bwx 22149@itemx -mcix 22150@itemx -mno-cix 22151@itemx -mfix 22152@itemx -mno-fix 22153@itemx -mmax 22154@itemx -mno-max 22155@opindex mbwx 22156@opindex mno-bwx 22157@opindex mcix 22158@opindex mno-cix 22159@opindex mfix 22160@opindex mno-fix 22161@opindex mmax 22162@opindex mno-max 22163Indicate whether GCC should generate code to use the optional BWX, 22164CIX, FIX and MAX instruction sets. The default is to use the instruction 22165sets supported by the CPU type specified via @option{-mcpu=} option or that 22166of the CPU on which GCC was built if none is specified. 22167 22168@item -mfloat-vax 22169@itemx -mfloat-ieee 22170@opindex mfloat-vax 22171@opindex mfloat-ieee 22172Generate code that uses (does not use) VAX F and G floating-point 22173arithmetic instead of IEEE single and double precision. 22174 22175@item -mexplicit-relocs 22176@itemx -mno-explicit-relocs 22177@opindex mexplicit-relocs 22178@opindex mno-explicit-relocs 22179Older Alpha assemblers provided no way to generate symbol relocations 22180except via assembler macros. Use of these macros does not allow 22181optimal instruction scheduling. GNU binutils as of version 2.12 22182supports a new syntax that allows the compiler to explicitly mark 22183which relocations should apply to which instructions. This option 22184is mostly useful for debugging, as GCC detects the capabilities of 22185the assembler when it is built and sets the default accordingly. 22186 22187@item -msmall-data 22188@itemx -mlarge-data 22189@opindex msmall-data 22190@opindex mlarge-data 22191When @option{-mexplicit-relocs} is in effect, static data is 22192accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 22193is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 22194(the @code{.sdata} and @code{.sbss} sections) and are accessed via 2219516-bit relocations off of the @code{$gp} register. This limits the 22196size of the small data area to 64KB, but allows the variables to be 22197directly accessed via a single instruction. 22198 22199The default is @option{-mlarge-data}. With this option the data area 22200is limited to just below 2GB@. Programs that require more than 2GB of 22201data must use @code{malloc} or @code{mmap} to allocate the data in the 22202heap instead of in the program's data segment. 22203 22204When generating code for shared libraries, @option{-fpic} implies 22205@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 22206 22207@item -msmall-text 22208@itemx -mlarge-text 22209@opindex msmall-text 22210@opindex mlarge-text 22211When @option{-msmall-text} is used, the compiler assumes that the 22212code of the entire program (or shared library) fits in 4MB, and is 22213thus reachable with a branch instruction. When @option{-msmall-data} 22214is used, the compiler can assume that all local symbols share the 22215same @code{$gp} value, and thus reduce the number of instructions 22216required for a function call from 4 to 1. 22217 22218The default is @option{-mlarge-text}. 22219 22220@item -mcpu=@var{cpu_type} 22221@opindex mcpu 22222Set the instruction set and instruction scheduling parameters for 22223machine type @var{cpu_type}. You can specify either the @samp{EV} 22224style name or the corresponding chip number. GCC supports scheduling 22225parameters for the EV4, EV5 and EV6 family of processors and 22226chooses the default values for the instruction set from the processor 22227you specify. If you do not specify a processor type, GCC defaults 22228to the processor on which the compiler was built. 22229 22230Supported values for @var{cpu_type} are 22231 22232@table @samp 22233@item ev4 22234@itemx ev45 22235@itemx 21064 22236Schedules as an EV4 and has no instruction set extensions. 22237 22238@item ev5 22239@itemx 21164 22240Schedules as an EV5 and has no instruction set extensions. 22241 22242@item ev56 22243@itemx 21164a 22244Schedules as an EV5 and supports the BWX extension. 22245 22246@item pca56 22247@itemx 21164pc 22248@itemx 21164PC 22249Schedules as an EV5 and supports the BWX and MAX extensions. 22250 22251@item ev6 22252@itemx 21264 22253Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 22254 22255@item ev67 22256@itemx 21264a 22257Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 22258@end table 22259 22260Native toolchains also support the value @samp{native}, 22261which selects the best architecture option for the host processor. 22262@option{-mcpu=native} has no effect if GCC does not recognize 22263the processor. 22264 22265@item -mtune=@var{cpu_type} 22266@opindex mtune 22267Set only the instruction scheduling parameters for machine type 22268@var{cpu_type}. The instruction set is not changed. 22269 22270Native toolchains also support the value @samp{native}, 22271which selects the best architecture option for the host processor. 22272@option{-mtune=native} has no effect if GCC does not recognize 22273the processor. 22274 22275@item -mmemory-latency=@var{time} 22276@opindex mmemory-latency 22277Sets the latency the scheduler should assume for typical memory 22278references as seen by the application. This number is highly 22279dependent on the memory access patterns used by the application 22280and the size of the external cache on the machine. 22281 22282Valid options for @var{time} are 22283 22284@table @samp 22285@item @var{number} 22286A decimal number representing clock cycles. 22287 22288@item L1 22289@itemx L2 22290@itemx L3 22291@itemx main 22292The compiler contains estimates of the number of clock cycles for 22293``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 22294(also called Dcache, Scache, and Bcache), as well as to main memory. 22295Note that L3 is only valid for EV5. 22296 22297@end table 22298@end table 22299 22300@node eBPF Options 22301@subsection eBPF Options 22302@cindex eBPF Options 22303 22304@table @gcctabopt 22305@item -mframe-limit=@var{bytes} 22306This specifies the hard limit for frame sizes, in bytes. Currently, 22307the value that can be specified should be less than or equal to 22308@samp{32767}. Defaults to whatever limit is imposed by the version of 22309the Linux kernel targeted. 22310 22311@item -mkernel=@var{version} 22312@opindex mkernel 22313This specifies the minimum version of the kernel that will run the 22314compiled program. GCC uses this version to determine which 22315instructions to use, what kernel helpers to allow, etc. Currently, 22316@var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2}, 22317@samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7}, 22318@samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12}, 22319@samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17}, 22320@samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1}, 22321@samp{5.2}, @samp{latest} and @samp{native}. 22322 22323@item -mbig-endian 22324@opindex mbig-endian 22325Generate code for a big-endian target. 22326 22327@item -mlittle-endian 22328@opindex mlittle-endian 22329Generate code for a little-endian target. This is the default. 22330 22331@item -mxbpf 22332Generate code for an expanded version of BPF, which relaxes some of 22333the restrictions imposed by the BPF architecture: 22334@itemize @minus 22335@item Save and restore callee-saved registers at function entry and 22336exit, respectively. 22337@end itemize 22338@end table 22339 22340@node FR30 Options 22341@subsection FR30 Options 22342@cindex FR30 Options 22343 22344These options are defined specifically for the FR30 port. 22345 22346@table @gcctabopt 22347 22348@item -msmall-model 22349@opindex msmall-model 22350Use the small address space model. This can produce smaller code, but 22351it does assume that all symbolic values and addresses fit into a 2235220-bit range. 22353 22354@item -mno-lsim 22355@opindex mno-lsim 22356Assume that runtime support has been provided and so there is no need 22357to include the simulator library (@file{libsim.a}) on the linker 22358command line. 22359 22360@end table 22361 22362@node FT32 Options 22363@subsection FT32 Options 22364@cindex FT32 Options 22365 22366These options are defined specifically for the FT32 port. 22367 22368@table @gcctabopt 22369 22370@item -msim 22371@opindex msim 22372Specifies that the program will be run on the simulator. This causes 22373an alternate runtime startup and library to be linked. 22374You must not use this option when generating programs that will run on 22375real hardware; you must provide your own runtime library for whatever 22376I/O functions are needed. 22377 22378@item -mlra 22379@opindex mlra 22380Enable Local Register Allocation. This is still experimental for FT32, 22381so by default the compiler uses standard reload. 22382 22383@item -mnodiv 22384@opindex mnodiv 22385Do not use div and mod instructions. 22386 22387@item -mft32b 22388@opindex mft32b 22389Enable use of the extended instructions of the FT32B processor. 22390 22391@item -mcompress 22392@opindex mcompress 22393Compress all code using the Ft32B code compression scheme. 22394 22395@item -mnopm 22396@opindex mnopm 22397Do not generate code that reads program memory. 22398 22399@end table 22400 22401@node FRV Options 22402@subsection FRV Options 22403@cindex FRV Options 22404 22405@table @gcctabopt 22406@item -mgpr-32 22407@opindex mgpr-32 22408 22409Only use the first 32 general-purpose registers. 22410 22411@item -mgpr-64 22412@opindex mgpr-64 22413 22414Use all 64 general-purpose registers. 22415 22416@item -mfpr-32 22417@opindex mfpr-32 22418 22419Use only the first 32 floating-point registers. 22420 22421@item -mfpr-64 22422@opindex mfpr-64 22423 22424Use all 64 floating-point registers. 22425 22426@item -mhard-float 22427@opindex mhard-float 22428 22429Use hardware instructions for floating-point operations. 22430 22431@item -msoft-float 22432@opindex msoft-float 22433 22434Use library routines for floating-point operations. 22435 22436@item -malloc-cc 22437@opindex malloc-cc 22438 22439Dynamically allocate condition code registers. 22440 22441@item -mfixed-cc 22442@opindex mfixed-cc 22443 22444Do not try to dynamically allocate condition code registers, only 22445use @code{icc0} and @code{fcc0}. 22446 22447@item -mdword 22448@opindex mdword 22449 22450Change ABI to use double word insns. 22451 22452@item -mno-dword 22453@opindex mno-dword 22454@opindex mdword 22455 22456Do not use double word instructions. 22457 22458@item -mdouble 22459@opindex mdouble 22460 22461Use floating-point double instructions. 22462 22463@item -mno-double 22464@opindex mno-double 22465 22466Do not use floating-point double instructions. 22467 22468@item -mmedia 22469@opindex mmedia 22470 22471Use media instructions. 22472 22473@item -mno-media 22474@opindex mno-media 22475 22476Do not use media instructions. 22477 22478@item -mmuladd 22479@opindex mmuladd 22480 22481Use multiply and add/subtract instructions. 22482 22483@item -mno-muladd 22484@opindex mno-muladd 22485 22486Do not use multiply and add/subtract instructions. 22487 22488@item -mfdpic 22489@opindex mfdpic 22490 22491Select the FDPIC ABI, which uses function descriptors to represent 22492pointers to functions. Without any PIC/PIE-related options, it 22493implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 22494assumes GOT entries and small data are within a 12-bit range from the 22495GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 22496are computed with 32 bits. 22497With a @samp{bfin-elf} target, this option implies @option{-msim}. 22498 22499@item -minline-plt 22500@opindex minline-plt 22501 22502Enable inlining of PLT entries in function calls to functions that are 22503not known to bind locally. It has no effect without @option{-mfdpic}. 22504It's enabled by default if optimizing for speed and compiling for 22505shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 22506optimization option such as @option{-O3} or above is present in the 22507command line. 22508 22509@item -mTLS 22510@opindex mTLS 22511 22512Assume a large TLS segment when generating thread-local code. 22513 22514@item -mtls 22515@opindex mtls 22516 22517Do not assume a large TLS segment when generating thread-local code. 22518 22519@item -mgprel-ro 22520@opindex mgprel-ro 22521 22522Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 22523that is known to be in read-only sections. It's enabled by default, 22524except for @option{-fpic} or @option{-fpie}: even though it may help 22525make the global offset table smaller, it trades 1 instruction for 4. 22526With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 22527one of which may be shared by multiple symbols, and it avoids the need 22528for a GOT entry for the referenced symbol, so it's more likely to be a 22529win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 22530 22531@item -multilib-library-pic 22532@opindex multilib-library-pic 22533 22534Link with the (library, not FD) pic libraries. It's implied by 22535@option{-mlibrary-pic}, as well as by @option{-fPIC} and 22536@option{-fpic} without @option{-mfdpic}. You should never have to use 22537it explicitly. 22538 22539@item -mlinked-fp 22540@opindex mlinked-fp 22541 22542Follow the EABI requirement of always creating a frame pointer whenever 22543a stack frame is allocated. This option is enabled by default and can 22544be disabled with @option{-mno-linked-fp}. 22545 22546@item -mlong-calls 22547@opindex mlong-calls 22548 22549Use indirect addressing to call functions outside the current 22550compilation unit. This allows the functions to be placed anywhere 22551within the 32-bit address space. 22552 22553@item -malign-labels 22554@opindex malign-labels 22555 22556Try to align labels to an 8-byte boundary by inserting NOPs into the 22557previous packet. This option only has an effect when VLIW packing 22558is enabled. It doesn't create new packets; it merely adds NOPs to 22559existing ones. 22560 22561@item -mlibrary-pic 22562@opindex mlibrary-pic 22563 22564Generate position-independent EABI code. 22565 22566@item -macc-4 22567@opindex macc-4 22568 22569Use only the first four media accumulator registers. 22570 22571@item -macc-8 22572@opindex macc-8 22573 22574Use all eight media accumulator registers. 22575 22576@item -mpack 22577@opindex mpack 22578 22579Pack VLIW instructions. 22580 22581@item -mno-pack 22582@opindex mno-pack 22583 22584Do not pack VLIW instructions. 22585 22586@item -mno-eflags 22587@opindex mno-eflags 22588 22589Do not mark ABI switches in e_flags. 22590 22591@item -mcond-move 22592@opindex mcond-move 22593 22594Enable the use of conditional-move instructions (default). 22595 22596This switch is mainly for debugging the compiler and will likely be removed 22597in a future version. 22598 22599@item -mno-cond-move 22600@opindex mno-cond-move 22601 22602Disable the use of conditional-move instructions. 22603 22604This switch is mainly for debugging the compiler and will likely be removed 22605in a future version. 22606 22607@item -mscc 22608@opindex mscc 22609 22610Enable the use of conditional set instructions (default). 22611 22612This switch is mainly for debugging the compiler and will likely be removed 22613in a future version. 22614 22615@item -mno-scc 22616@opindex mno-scc 22617 22618Disable the use of conditional set instructions. 22619 22620This switch is mainly for debugging the compiler and will likely be removed 22621in a future version. 22622 22623@item -mcond-exec 22624@opindex mcond-exec 22625 22626Enable the use of conditional execution (default). 22627 22628This switch is mainly for debugging the compiler and will likely be removed 22629in a future version. 22630 22631@item -mno-cond-exec 22632@opindex mno-cond-exec 22633 22634Disable the use of conditional execution. 22635 22636This switch is mainly for debugging the compiler and will likely be removed 22637in a future version. 22638 22639@item -mvliw-branch 22640@opindex mvliw-branch 22641 22642Run a pass to pack branches into VLIW instructions (default). 22643 22644This switch is mainly for debugging the compiler and will likely be removed 22645in a future version. 22646 22647@item -mno-vliw-branch 22648@opindex mno-vliw-branch 22649 22650Do not run a pass to pack branches into VLIW instructions. 22651 22652This switch is mainly for debugging the compiler and will likely be removed 22653in a future version. 22654 22655@item -mmulti-cond-exec 22656@opindex mmulti-cond-exec 22657 22658Enable optimization of @code{&&} and @code{||} in conditional execution 22659(default). 22660 22661This switch is mainly for debugging the compiler and will likely be removed 22662in a future version. 22663 22664@item -mno-multi-cond-exec 22665@opindex mno-multi-cond-exec 22666 22667Disable optimization of @code{&&} and @code{||} in conditional execution. 22668 22669This switch is mainly for debugging the compiler and will likely be removed 22670in a future version. 22671 22672@item -mnested-cond-exec 22673@opindex mnested-cond-exec 22674 22675Enable nested conditional execution optimizations (default). 22676 22677This switch is mainly for debugging the compiler and will likely be removed 22678in a future version. 22679 22680@item -mno-nested-cond-exec 22681@opindex mno-nested-cond-exec 22682 22683Disable nested conditional execution optimizations. 22684 22685This switch is mainly for debugging the compiler and will likely be removed 22686in a future version. 22687 22688@item -moptimize-membar 22689@opindex moptimize-membar 22690 22691This switch removes redundant @code{membar} instructions from the 22692compiler-generated code. It is enabled by default. 22693 22694@item -mno-optimize-membar 22695@opindex mno-optimize-membar 22696@opindex moptimize-membar 22697 22698This switch disables the automatic removal of redundant @code{membar} 22699instructions from the generated code. 22700 22701@item -mtomcat-stats 22702@opindex mtomcat-stats 22703 22704Cause gas to print out tomcat statistics. 22705 22706@item -mcpu=@var{cpu} 22707@opindex mcpu 22708 22709Select the processor type for which to generate code. Possible values are 22710@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 22711@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 22712 22713@end table 22714 22715@node GNU/Linux Options 22716@subsection GNU/Linux Options 22717 22718These @samp{-m} options are defined for GNU/Linux targets: 22719 22720@table @gcctabopt 22721@item -mglibc 22722@opindex mglibc 22723Use the GNU C library. This is the default except 22724on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and 22725@samp{*-*-linux-*android*} targets. 22726 22727@item -muclibc 22728@opindex muclibc 22729Use uClibc C library. This is the default on 22730@samp{*-*-linux-*uclibc*} targets. 22731 22732@item -mmusl 22733@opindex mmusl 22734Use the musl C library. This is the default on 22735@samp{*-*-linux-*musl*} targets. 22736 22737@item -mbionic 22738@opindex mbionic 22739Use Bionic C library. This is the default on 22740@samp{*-*-linux-*android*} targets. 22741 22742@item -mandroid 22743@opindex mandroid 22744Compile code compatible with Android platform. This is the default on 22745@samp{*-*-linux-*android*} targets. 22746 22747When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 22748@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 22749this option makes the GCC driver pass Android-specific options to the linker. 22750Finally, this option causes the preprocessor macro @code{__ANDROID__} 22751to be defined. 22752 22753@item -tno-android-cc 22754@opindex tno-android-cc 22755Disable compilation effects of @option{-mandroid}, i.e., do not enable 22756@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 22757@option{-fno-rtti} by default. 22758 22759@item -tno-android-ld 22760@opindex tno-android-ld 22761Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 22762linking options to the linker. 22763 22764@end table 22765 22766@node H8/300 Options 22767@subsection H8/300 Options 22768 22769These @samp{-m} options are defined for the H8/300 implementations: 22770 22771@table @gcctabopt 22772@item -mrelax 22773@opindex mrelax 22774Shorten some address references at link time, when possible; uses the 22775linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 22776ld, Using ld}, for a fuller description. 22777 22778@item -mh 22779@opindex mh 22780Generate code for the H8/300H@. 22781 22782@item -ms 22783@opindex ms 22784Generate code for the H8S@. 22785 22786@item -mn 22787@opindex mn 22788Generate code for the H8S and H8/300H in the normal mode. This switch 22789must be used either with @option{-mh} or @option{-ms}. 22790 22791@item -ms2600 22792@opindex ms2600 22793Generate code for the H8S/2600. This switch must be used with @option{-ms}. 22794 22795@item -mexr 22796@opindex mexr 22797Extended registers are stored on stack before execution of function 22798with monitor attribute. Default option is @option{-mexr}. 22799This option is valid only for H8S targets. 22800 22801@item -mno-exr 22802@opindex mno-exr 22803@opindex mexr 22804Extended registers are not stored on stack before execution of function 22805with monitor attribute. Default option is @option{-mno-exr}. 22806This option is valid only for H8S targets. 22807 22808@item -mint32 22809@opindex mint32 22810Make @code{int} data 32 bits by default. 22811 22812@item -malign-300 22813@opindex malign-300 22814On the H8/300H and H8S, use the same alignment rules as for the H8/300. 22815The default for the H8/300H and H8S is to align longs and floats on 228164-byte boundaries. 22817@option{-malign-300} causes them to be aligned on 2-byte boundaries. 22818This option has no effect on the H8/300. 22819@end table 22820 22821@node HPPA Options 22822@subsection HPPA Options 22823@cindex HPPA Options 22824 22825These @samp{-m} options are defined for the HPPA family of computers: 22826 22827@table @gcctabopt 22828@item -march=@var{architecture-type} 22829@opindex march 22830Generate code for the specified architecture. The choices for 22831@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 228321.1, and @samp{2.0} for PA 2.0 processors. Refer to 22833@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 22834architecture option for your machine. Code compiled for lower numbered 22835architectures runs on higher numbered architectures, but not the 22836other way around. 22837 22838@item -mpa-risc-1-0 22839@itemx -mpa-risc-1-1 22840@itemx -mpa-risc-2-0 22841@opindex mpa-risc-1-0 22842@opindex mpa-risc-1-1 22843@opindex mpa-risc-2-0 22844Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 22845 22846@item -mcaller-copies 22847@opindex mcaller-copies 22848The caller copies function arguments passed by hidden reference. This 22849option should be used with care as it is not compatible with the default 2285032-bit runtime. However, only aggregates larger than eight bytes are 22851passed by hidden reference and the option provides better compatibility 22852with OpenMP. 22853 22854@item -mjump-in-delay 22855@opindex mjump-in-delay 22856This option is ignored and provided for compatibility purposes only. 22857 22858@item -mdisable-fpregs 22859@opindex mdisable-fpregs 22860Prevent floating-point registers from being used in any manner. This is 22861necessary for compiling kernels that perform lazy context switching of 22862floating-point registers. If you use this option and attempt to perform 22863floating-point operations, the compiler aborts. 22864 22865@item -mdisable-indexing 22866@opindex mdisable-indexing 22867Prevent the compiler from using indexing address modes. This avoids some 22868rather obscure problems when compiling MIG generated code under MACH@. 22869 22870@item -mno-space-regs 22871@opindex mno-space-regs 22872@opindex mspace-regs 22873Generate code that assumes the target has no space registers. This allows 22874GCC to generate faster indirect calls and use unscaled index address modes. 22875 22876Such code is suitable for level 0 PA systems and kernels. 22877 22878@item -mfast-indirect-calls 22879@opindex mfast-indirect-calls 22880Generate code that assumes calls never cross space boundaries. This 22881allows GCC to emit code that performs faster indirect calls. 22882 22883This option does not work in the presence of shared libraries or nested 22884functions. 22885 22886@item -mfixed-range=@var{register-range} 22887@opindex mfixed-range 22888Generate code treating the given register range as fixed registers. 22889A fixed register is one that the register allocator cannot use. This is 22890useful when compiling kernel code. A register range is specified as 22891two registers separated by a dash. Multiple register ranges can be 22892specified separated by a comma. 22893 22894@item -mlong-load-store 22895@opindex mlong-load-store 22896Generate 3-instruction load and store sequences as sometimes required by 22897the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 22898the HP compilers. 22899 22900@item -mportable-runtime 22901@opindex mportable-runtime 22902Use the portable calling conventions proposed by HP for ELF systems. 22903 22904@item -mgas 22905@opindex mgas 22906Enable the use of assembler directives only GAS understands. 22907 22908@item -mschedule=@var{cpu-type} 22909@opindex mschedule 22910Schedule code according to the constraints for the machine type 22911@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 22912@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 22913to @file{/usr/lib/sched.models} on an HP-UX system to determine the 22914proper scheduling option for your machine. The default scheduling is 22915@samp{8000}. 22916 22917@item -mlinker-opt 22918@opindex mlinker-opt 22919Enable the optimization pass in the HP-UX linker. Note this makes symbolic 22920debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 22921linkers in which they give bogus error messages when linking some programs. 22922 22923@item -msoft-float 22924@opindex msoft-float 22925Generate output containing library calls for floating point. 22926@strong{Warning:} the requisite libraries are not available for all HPPA 22927targets. Normally the facilities of the machine's usual C compiler are 22928used, but this cannot be done directly in cross-compilation. You must make 22929your own arrangements to provide suitable library functions for 22930cross-compilation. 22931 22932@option{-msoft-float} changes the calling convention in the output file; 22933therefore, it is only useful if you compile @emph{all} of a program with 22934this option. In particular, you need to compile @file{libgcc.a}, the 22935library that comes with GCC, with @option{-msoft-float} in order for 22936this to work. 22937 22938@item -msio 22939@opindex msio 22940Generate the predefine, @code{_SIO}, for server IO@. The default is 22941@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 22942@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 22943options are available under HP-UX and HI-UX@. 22944 22945@item -mgnu-ld 22946@opindex mgnu-ld 22947Use options specific to GNU @command{ld}. 22948This passes @option{-shared} to @command{ld} when 22949building a shared library. It is the default when GCC is configured, 22950explicitly or implicitly, with the GNU linker. This option does not 22951affect which @command{ld} is called; it only changes what parameters 22952are passed to that @command{ld}. 22953The @command{ld} that is called is determined by the 22954@option{--with-ld} configure option, GCC's program search path, and 22955finally by the user's @env{PATH}. The linker used by GCC can be printed 22956using @samp{which `gcc -print-prog-name=ld`}. This option is only available 22957on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 22958 22959@item -mhp-ld 22960@opindex mhp-ld 22961Use options specific to HP @command{ld}. 22962This passes @option{-b} to @command{ld} when building 22963a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 22964links. It is the default when GCC is configured, explicitly or 22965implicitly, with the HP linker. This option does not affect 22966which @command{ld} is called; it only changes what parameters are passed to that 22967@command{ld}. 22968The @command{ld} that is called is determined by the @option{--with-ld} 22969configure option, GCC's program search path, and finally by the user's 22970@env{PATH}. The linker used by GCC can be printed using @samp{which 22971`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 22972HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 22973 22974@item -mlong-calls 22975@opindex mno-long-calls 22976@opindex mlong-calls 22977Generate code that uses long call sequences. This ensures that a call 22978is always able to reach linker generated stubs. The default is to generate 22979long calls only when the distance from the call site to the beginning 22980of the function or translation unit, as the case may be, exceeds a 22981predefined limit set by the branch type being used. The limits for 22982normal calls are 7,600,000 and 240,000 bytes, respectively for the 22983PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 22984240,000 bytes. 22985 22986Distances are measured from the beginning of functions when using the 22987@option{-ffunction-sections} option, or when using the @option{-mgas} 22988and @option{-mno-portable-runtime} options together under HP-UX with 22989the SOM linker. 22990 22991It is normally not desirable to use this option as it degrades 22992performance. However, it may be useful in large applications, 22993particularly when partial linking is used to build the application. 22994 22995The types of long calls used depends on the capabilities of the 22996assembler and linker, and the type of code being generated. The 22997impact on systems that support long absolute calls, and long pic 22998symbol-difference or pc-relative calls should be relatively small. 22999However, an indirect call is used on 32-bit ELF systems in pic code 23000and it is quite long. 23001 23002@item -munix=@var{unix-std} 23003@opindex march 23004Generate compiler predefines and select a startfile for the specified 23005UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 23006and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 23007is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 2300811.11 and later. The default values are @samp{93} for HP-UX 10.00, 23009@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 23010and later. 23011 23012@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 23013@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 23014and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 23015@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 23016@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 23017@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 23018 23019It is @emph{important} to note that this option changes the interfaces 23020for various library routines. It also affects the operational behavior 23021of the C library. Thus, @emph{extreme} care is needed in using this 23022option. 23023 23024Library code that is intended to operate with more than one UNIX 23025standard must test, set and restore the variable @code{__xpg4_extended_mask} 23026as appropriate. Most GNU software doesn't provide this capability. 23027 23028@item -nolibdld 23029@opindex nolibdld 23030Suppress the generation of link options to search libdld.sl when the 23031@option{-static} option is specified on HP-UX 10 and later. 23032 23033@item -static 23034@opindex static 23035The HP-UX implementation of setlocale in libc has a dependency on 23036libdld.sl. There isn't an archive version of libdld.sl. Thus, 23037when the @option{-static} option is specified, special link options 23038are needed to resolve this dependency. 23039 23040On HP-UX 10 and later, the GCC driver adds the necessary options to 23041link with libdld.sl when the @option{-static} option is specified. 23042This causes the resulting binary to be dynamic. On the 64-bit port, 23043the linkers generate dynamic binaries by default in any case. The 23044@option{-nolibdld} option can be used to prevent the GCC driver from 23045adding these link options. 23046 23047@item -threads 23048@opindex threads 23049Add support for multithreading with the @dfn{dce thread} library 23050under HP-UX@. This option sets flags for both the preprocessor and 23051linker. 23052@end table 23053 23054@node IA-64 Options 23055@subsection IA-64 Options 23056@cindex IA-64 Options 23057 23058These are the @samp{-m} options defined for the Intel IA-64 architecture. 23059 23060@table @gcctabopt 23061@item -mbig-endian 23062@opindex mbig-endian 23063Generate code for a big-endian target. This is the default for HP-UX@. 23064 23065@item -mlittle-endian 23066@opindex mlittle-endian 23067Generate code for a little-endian target. This is the default for AIX5 23068and GNU/Linux. 23069 23070@item -mgnu-as 23071@itemx -mno-gnu-as 23072@opindex mgnu-as 23073@opindex mno-gnu-as 23074Generate (or don't) code for the GNU assembler. This is the default. 23075@c Also, this is the default if the configure option @option{--with-gnu-as} 23076@c is used. 23077 23078@item -mgnu-ld 23079@itemx -mno-gnu-ld 23080@opindex mgnu-ld 23081@opindex mno-gnu-ld 23082Generate (or don't) code for the GNU linker. This is the default. 23083@c Also, this is the default if the configure option @option{--with-gnu-ld} 23084@c is used. 23085 23086@item -mno-pic 23087@opindex mno-pic 23088Generate code that does not use a global pointer register. The result 23089is not position independent code, and violates the IA-64 ABI@. 23090 23091@item -mvolatile-asm-stop 23092@itemx -mno-volatile-asm-stop 23093@opindex mvolatile-asm-stop 23094@opindex mno-volatile-asm-stop 23095Generate (or don't) a stop bit immediately before and after volatile asm 23096statements. 23097 23098@item -mregister-names 23099@itemx -mno-register-names 23100@opindex mregister-names 23101@opindex mno-register-names 23102Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 23103the stacked registers. This may make assembler output more readable. 23104 23105@item -mno-sdata 23106@itemx -msdata 23107@opindex mno-sdata 23108@opindex msdata 23109Disable (or enable) optimizations that use the small data section. This may 23110be useful for working around optimizer bugs. 23111 23112@item -mconstant-gp 23113@opindex mconstant-gp 23114Generate code that uses a single constant global pointer value. This is 23115useful when compiling kernel code. 23116 23117@item -mauto-pic 23118@opindex mauto-pic 23119Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 23120This is useful when compiling firmware code. 23121 23122@item -minline-float-divide-min-latency 23123@opindex minline-float-divide-min-latency 23124Generate code for inline divides of floating-point values 23125using the minimum latency algorithm. 23126 23127@item -minline-float-divide-max-throughput 23128@opindex minline-float-divide-max-throughput 23129Generate code for inline divides of floating-point values 23130using the maximum throughput algorithm. 23131 23132@item -mno-inline-float-divide 23133@opindex mno-inline-float-divide 23134Do not generate inline code for divides of floating-point values. 23135 23136@item -minline-int-divide-min-latency 23137@opindex minline-int-divide-min-latency 23138Generate code for inline divides of integer values 23139using the minimum latency algorithm. 23140 23141@item -minline-int-divide-max-throughput 23142@opindex minline-int-divide-max-throughput 23143Generate code for inline divides of integer values 23144using the maximum throughput algorithm. 23145 23146@item -mno-inline-int-divide 23147@opindex mno-inline-int-divide 23148@opindex minline-int-divide 23149Do not generate inline code for divides of integer values. 23150 23151@item -minline-sqrt-min-latency 23152@opindex minline-sqrt-min-latency 23153Generate code for inline square roots 23154using the minimum latency algorithm. 23155 23156@item -minline-sqrt-max-throughput 23157@opindex minline-sqrt-max-throughput 23158Generate code for inline square roots 23159using the maximum throughput algorithm. 23160 23161@item -mno-inline-sqrt 23162@opindex mno-inline-sqrt 23163Do not generate inline code for @code{sqrt}. 23164 23165@item -mfused-madd 23166@itemx -mno-fused-madd 23167@opindex mfused-madd 23168@opindex mno-fused-madd 23169Do (don't) generate code that uses the fused multiply/add or multiply/subtract 23170instructions. The default is to use these instructions. 23171 23172@item -mno-dwarf2-asm 23173@itemx -mdwarf2-asm 23174@opindex mno-dwarf2-asm 23175@opindex mdwarf2-asm 23176Don't (or do) generate assembler code for the DWARF line number debugging 23177info. This may be useful when not using the GNU assembler. 23178 23179@item -mearly-stop-bits 23180@itemx -mno-early-stop-bits 23181@opindex mearly-stop-bits 23182@opindex mno-early-stop-bits 23183Allow stop bits to be placed earlier than immediately preceding the 23184instruction that triggered the stop bit. This can improve instruction 23185scheduling, but does not always do so. 23186 23187@item -mfixed-range=@var{register-range} 23188@opindex mfixed-range 23189Generate code treating the given register range as fixed registers. 23190A fixed register is one that the register allocator cannot use. This is 23191useful when compiling kernel code. A register range is specified as 23192two registers separated by a dash. Multiple register ranges can be 23193specified separated by a comma. 23194 23195@item -mtls-size=@var{tls-size} 23196@opindex mtls-size 23197Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 2319864. 23199 23200@item -mtune=@var{cpu-type} 23201@opindex mtune 23202Tune the instruction scheduling for a particular CPU, Valid values are 23203@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 23204and @samp{mckinley}. 23205 23206@item -milp32 23207@itemx -mlp64 23208@opindex milp32 23209@opindex mlp64 23210Generate code for a 32-bit or 64-bit environment. 23211The 32-bit environment sets int, long and pointer to 32 bits. 23212The 64-bit environment sets int to 32 bits and long and pointer 23213to 64 bits. These are HP-UX specific flags. 23214 23215@item -mno-sched-br-data-spec 23216@itemx -msched-br-data-spec 23217@opindex mno-sched-br-data-spec 23218@opindex msched-br-data-spec 23219(Dis/En)able data speculative scheduling before reload. 23220This results in generation of @code{ld.a} instructions and 23221the corresponding check instructions (@code{ld.c} / @code{chk.a}). 23222The default setting is disabled. 23223 23224@item -msched-ar-data-spec 23225@itemx -mno-sched-ar-data-spec 23226@opindex msched-ar-data-spec 23227@opindex mno-sched-ar-data-spec 23228(En/Dis)able data speculative scheduling after reload. 23229This results in generation of @code{ld.a} instructions and 23230the corresponding check instructions (@code{ld.c} / @code{chk.a}). 23231The default setting is enabled. 23232 23233@item -mno-sched-control-spec 23234@itemx -msched-control-spec 23235@opindex mno-sched-control-spec 23236@opindex msched-control-spec 23237(Dis/En)able control speculative scheduling. This feature is 23238available only during region scheduling (i.e.@: before reload). 23239This results in generation of the @code{ld.s} instructions and 23240the corresponding check instructions @code{chk.s}. 23241The default setting is disabled. 23242 23243@item -msched-br-in-data-spec 23244@itemx -mno-sched-br-in-data-spec 23245@opindex msched-br-in-data-spec 23246@opindex mno-sched-br-in-data-spec 23247(En/Dis)able speculative scheduling of the instructions that 23248are dependent on the data speculative loads before reload. 23249This is effective only with @option{-msched-br-data-spec} enabled. 23250The default setting is enabled. 23251 23252@item -msched-ar-in-data-spec 23253@itemx -mno-sched-ar-in-data-spec 23254@opindex msched-ar-in-data-spec 23255@opindex mno-sched-ar-in-data-spec 23256(En/Dis)able speculative scheduling of the instructions that 23257are dependent on the data speculative loads after reload. 23258This is effective only with @option{-msched-ar-data-spec} enabled. 23259The default setting is enabled. 23260 23261@item -msched-in-control-spec 23262@itemx -mno-sched-in-control-spec 23263@opindex msched-in-control-spec 23264@opindex mno-sched-in-control-spec 23265(En/Dis)able speculative scheduling of the instructions that 23266are dependent on the control speculative loads. 23267This is effective only with @option{-msched-control-spec} enabled. 23268The default setting is enabled. 23269 23270@item -mno-sched-prefer-non-data-spec-insns 23271@itemx -msched-prefer-non-data-spec-insns 23272@opindex mno-sched-prefer-non-data-spec-insns 23273@opindex msched-prefer-non-data-spec-insns 23274If enabled, data-speculative instructions are chosen for schedule 23275only if there are no other choices at the moment. This makes 23276the use of the data speculation much more conservative. 23277The default setting is disabled. 23278 23279@item -mno-sched-prefer-non-control-spec-insns 23280@itemx -msched-prefer-non-control-spec-insns 23281@opindex mno-sched-prefer-non-control-spec-insns 23282@opindex msched-prefer-non-control-spec-insns 23283If enabled, control-speculative instructions are chosen for schedule 23284only if there are no other choices at the moment. This makes 23285the use of the control speculation much more conservative. 23286The default setting is disabled. 23287 23288@item -mno-sched-count-spec-in-critical-path 23289@itemx -msched-count-spec-in-critical-path 23290@opindex mno-sched-count-spec-in-critical-path 23291@opindex msched-count-spec-in-critical-path 23292If enabled, speculative dependencies are considered during 23293computation of the instructions priorities. This makes the use of the 23294speculation a bit more conservative. 23295The default setting is disabled. 23296 23297@item -msched-spec-ldc 23298@opindex msched-spec-ldc 23299Use a simple data speculation check. This option is on by default. 23300 23301@item -msched-control-spec-ldc 23302@opindex msched-spec-ldc 23303Use a simple check for control speculation. This option is on by default. 23304 23305@item -msched-stop-bits-after-every-cycle 23306@opindex msched-stop-bits-after-every-cycle 23307Place a stop bit after every cycle when scheduling. This option is on 23308by default. 23309 23310@item -msched-fp-mem-deps-zero-cost 23311@opindex msched-fp-mem-deps-zero-cost 23312Assume that floating-point stores and loads are not likely to cause a conflict 23313when placed into the same instruction group. This option is disabled by 23314default. 23315 23316@item -msel-sched-dont-check-control-spec 23317@opindex msel-sched-dont-check-control-spec 23318Generate checks for control speculation in selective scheduling. 23319This flag is disabled by default. 23320 23321@item -msched-max-memory-insns=@var{max-insns} 23322@opindex msched-max-memory-insns 23323Limit on the number of memory insns per instruction group, giving lower 23324priority to subsequent memory insns attempting to schedule in the same 23325instruction group. Frequently useful to prevent cache bank conflicts. 23326The default value is 1. 23327 23328@item -msched-max-memory-insns-hard-limit 23329@opindex msched-max-memory-insns-hard-limit 23330Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 23331disallowing more than that number in an instruction group. 23332Otherwise, the limit is ``soft'', meaning that non-memory operations 23333are preferred when the limit is reached, but memory operations may still 23334be scheduled. 23335 23336@end table 23337 23338@node LM32 Options 23339@subsection LM32 Options 23340@cindex LM32 options 23341 23342These @option{-m} options are defined for the LatticeMico32 architecture: 23343 23344@table @gcctabopt 23345@item -mbarrel-shift-enabled 23346@opindex mbarrel-shift-enabled 23347Enable barrel-shift instructions. 23348 23349@item -mdivide-enabled 23350@opindex mdivide-enabled 23351Enable divide and modulus instructions. 23352 23353@item -mmultiply-enabled 23354@opindex multiply-enabled 23355Enable multiply instructions. 23356 23357@item -msign-extend-enabled 23358@opindex msign-extend-enabled 23359Enable sign extend instructions. 23360 23361@item -muser-enabled 23362@opindex muser-enabled 23363Enable user-defined instructions. 23364 23365@end table 23366 23367@node M32C Options 23368@subsection M32C Options 23369@cindex M32C options 23370 23371@table @gcctabopt 23372@item -mcpu=@var{name} 23373@opindex mcpu= 23374Select the CPU for which code is generated. @var{name} may be one of 23375@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 23376/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 23377the M32C/80 series. 23378 23379@item -msim 23380@opindex msim 23381Specifies that the program will be run on the simulator. This causes 23382an alternate runtime library to be linked in which supports, for 23383example, file I/O@. You must not use this option when generating 23384programs that will run on real hardware; you must provide your own 23385runtime library for whatever I/O functions are needed. 23386 23387@item -memregs=@var{number} 23388@opindex memregs= 23389Specifies the number of memory-based pseudo-registers GCC uses 23390during code generation. These pseudo-registers are used like real 23391registers, so there is a tradeoff between GCC's ability to fit the 23392code into available registers, and the performance penalty of using 23393memory instead of registers. Note that all modules in a program must 23394be compiled with the same value for this option. Because of that, you 23395must not use this option with GCC's default runtime libraries. 23396 23397@end table 23398 23399@node M32R/D Options 23400@subsection M32R/D Options 23401@cindex M32R/D options 23402 23403These @option{-m} options are defined for Renesas M32R/D architectures: 23404 23405@table @gcctabopt 23406@item -m32r2 23407@opindex m32r2 23408Generate code for the M32R/2@. 23409 23410@item -m32rx 23411@opindex m32rx 23412Generate code for the M32R/X@. 23413 23414@item -m32r 23415@opindex m32r 23416Generate code for the M32R@. This is the default. 23417 23418@item -mmodel=small 23419@opindex mmodel=small 23420Assume all objects live in the lower 16MB of memory (so that their addresses 23421can be loaded with the @code{ld24} instruction), and assume all subroutines 23422are reachable with the @code{bl} instruction. 23423This is the default. 23424 23425The addressability of a particular object can be set with the 23426@code{model} attribute. 23427 23428@item -mmodel=medium 23429@opindex mmodel=medium 23430Assume objects may be anywhere in the 32-bit address space (the compiler 23431generates @code{seth/add3} instructions to load their addresses), and 23432assume all subroutines are reachable with the @code{bl} instruction. 23433 23434@item -mmodel=large 23435@opindex mmodel=large 23436Assume objects may be anywhere in the 32-bit address space (the compiler 23437generates @code{seth/add3} instructions to load their addresses), and 23438assume subroutines may not be reachable with the @code{bl} instruction 23439(the compiler generates the much slower @code{seth/add3/jl} 23440instruction sequence). 23441 23442@item -msdata=none 23443@opindex msdata=none 23444Disable use of the small data area. Variables are put into 23445one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 23446@code{section} attribute has been specified). 23447This is the default. 23448 23449The small data area consists of sections @code{.sdata} and @code{.sbss}. 23450Objects may be explicitly put in the small data area with the 23451@code{section} attribute using one of these sections. 23452 23453@item -msdata=sdata 23454@opindex msdata=sdata 23455Put small global and static data in the small data area, but do not 23456generate special code to reference them. 23457 23458@item -msdata=use 23459@opindex msdata=use 23460Put small global and static data in the small data area, and generate 23461special instructions to reference them. 23462 23463@item -G @var{num} 23464@opindex G 23465@cindex smaller data references 23466Put global and static objects less than or equal to @var{num} bytes 23467into the small data or BSS sections instead of the normal data or BSS 23468sections. The default value of @var{num} is 8. 23469The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 23470for this option to have any effect. 23471 23472All modules should be compiled with the same @option{-G @var{num}} value. 23473Compiling with different values of @var{num} may or may not work; if it 23474doesn't the linker gives an error message---incorrect code is not 23475generated. 23476 23477@item -mdebug 23478@opindex mdebug 23479Makes the M32R-specific code in the compiler display some statistics 23480that might help in debugging programs. 23481 23482@item -malign-loops 23483@opindex malign-loops 23484Align all loops to a 32-byte boundary. 23485 23486@item -mno-align-loops 23487@opindex mno-align-loops 23488Do not enforce a 32-byte alignment for loops. This is the default. 23489 23490@item -missue-rate=@var{number} 23491@opindex missue-rate=@var{number} 23492Issue @var{number} instructions per cycle. @var{number} can only be 1 23493or 2. 23494 23495@item -mbranch-cost=@var{number} 23496@opindex mbranch-cost=@var{number} 23497@var{number} can only be 1 or 2. If it is 1 then branches are 23498preferred over conditional code, if it is 2, then the opposite applies. 23499 23500@item -mflush-trap=@var{number} 23501@opindex mflush-trap=@var{number} 23502Specifies the trap number to use to flush the cache. The default is 2350312. Valid numbers are between 0 and 15 inclusive. 23504 23505@item -mno-flush-trap 23506@opindex mno-flush-trap 23507Specifies that the cache cannot be flushed by using a trap. 23508 23509@item -mflush-func=@var{name} 23510@opindex mflush-func=@var{name} 23511Specifies the name of the operating system function to call to flush 23512the cache. The default is @samp{_flush_cache}, but a function call 23513is only used if a trap is not available. 23514 23515@item -mno-flush-func 23516@opindex mno-flush-func 23517Indicates that there is no OS function for flushing the cache. 23518 23519@end table 23520 23521@node M680x0 Options 23522@subsection M680x0 Options 23523@cindex M680x0 options 23524 23525These are the @samp{-m} options defined for M680x0 and ColdFire processors. 23526The default settings depend on which architecture was selected when 23527the compiler was configured; the defaults for the most common choices 23528are given below. 23529 23530@table @gcctabopt 23531@item -march=@var{arch} 23532@opindex march 23533Generate code for a specific M680x0 or ColdFire instruction set 23534architecture. Permissible values of @var{arch} for M680x0 23535architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 23536@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 23537architectures are selected according to Freescale's ISA classification 23538and the permissible values are: @samp{isaa}, @samp{isaaplus}, 23539@samp{isab} and @samp{isac}. 23540 23541GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 23542code for a ColdFire target. The @var{arch} in this macro is one of the 23543@option{-march} arguments given above. 23544 23545When used together, @option{-march} and @option{-mtune} select code 23546that runs on a family of similar processors but that is optimized 23547for a particular microarchitecture. 23548 23549@item -mcpu=@var{cpu} 23550@opindex mcpu 23551Generate code for a specific M680x0 or ColdFire processor. 23552The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 23553@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 23554and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 23555below, which also classifies the CPUs into families: 23556 23557@multitable @columnfractions 0.20 0.80 23558@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 23559@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} 23560@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 23561@item @samp{5206e} @tab @samp{5206e} 23562@item @samp{5208} @tab @samp{5207} @samp{5208} 23563@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 23564@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 23565@item @samp{5216} @tab @samp{5214} @samp{5216} 23566@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 23567@item @samp{5225} @tab @samp{5224} @samp{5225} 23568@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 23569@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 23570@item @samp{5249} @tab @samp{5249} 23571@item @samp{5250} @tab @samp{5250} 23572@item @samp{5271} @tab @samp{5270} @samp{5271} 23573@item @samp{5272} @tab @samp{5272} 23574@item @samp{5275} @tab @samp{5274} @samp{5275} 23575@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 23576@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 23577@item @samp{5307} @tab @samp{5307} 23578@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 23579@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 23580@item @samp{5407} @tab @samp{5407} 23581@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} 23582@end multitable 23583 23584@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 23585@var{arch} is compatible with @var{cpu}. Other combinations of 23586@option{-mcpu} and @option{-march} are rejected. 23587 23588GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 23589@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 23590where the value of @var{family} is given by the table above. 23591 23592@item -mtune=@var{tune} 23593@opindex mtune 23594Tune the code for a particular microarchitecture within the 23595constraints set by @option{-march} and @option{-mcpu}. 23596The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 23597@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 23598and @samp{cpu32}. The ColdFire microarchitectures 23599are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 23600 23601You can also use @option{-mtune=68020-40} for code that needs 23602to run relatively well on 68020, 68030 and 68040 targets. 23603@option{-mtune=68020-60} is similar but includes 68060 targets 23604as well. These two options select the same tuning decisions as 23605@option{-m68020-40} and @option{-m68020-60} respectively. 23606 23607GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 23608when tuning for 680x0 architecture @var{arch}. It also defines 23609@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 23610option is used. If GCC is tuning for a range of architectures, 23611as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 23612it defines the macros for every architecture in the range. 23613 23614GCC also defines the macro @code{__m@var{uarch}__} when tuning for 23615ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 23616of the arguments given above. 23617 23618@item -m68000 23619@itemx -mc68000 23620@opindex m68000 23621@opindex mc68000 23622Generate output for a 68000. This is the default 23623when the compiler is configured for 68000-based systems. 23624It is equivalent to @option{-march=68000}. 23625 23626Use this option for microcontrollers with a 68000 or EC000 core, 23627including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 23628 23629@item -m68010 23630@opindex m68010 23631Generate output for a 68010. This is the default 23632when the compiler is configured for 68010-based systems. 23633It is equivalent to @option{-march=68010}. 23634 23635@item -m68020 23636@itemx -mc68020 23637@opindex m68020 23638@opindex mc68020 23639Generate output for a 68020. This is the default 23640when the compiler is configured for 68020-based systems. 23641It is equivalent to @option{-march=68020}. 23642 23643@item -m68030 23644@opindex m68030 23645Generate output for a 68030. This is the default when the compiler is 23646configured for 68030-based systems. It is equivalent to 23647@option{-march=68030}. 23648 23649@item -m68040 23650@opindex m68040 23651Generate output for a 68040. This is the default when the compiler is 23652configured for 68040-based systems. It is equivalent to 23653@option{-march=68040}. 23654 23655This option inhibits the use of 68881/68882 instructions that have to be 23656emulated by software on the 68040. Use this option if your 68040 does not 23657have code to emulate those instructions. 23658 23659@item -m68060 23660@opindex m68060 23661Generate output for a 68060. This is the default when the compiler is 23662configured for 68060-based systems. It is equivalent to 23663@option{-march=68060}. 23664 23665This option inhibits the use of 68020 and 68881/68882 instructions that 23666have to be emulated by software on the 68060. Use this option if your 68060 23667does not have code to emulate those instructions. 23668 23669@item -mcpu32 23670@opindex mcpu32 23671Generate output for a CPU32. This is the default 23672when the compiler is configured for CPU32-based systems. 23673It is equivalent to @option{-march=cpu32}. 23674 23675Use this option for microcontrollers with a 23676CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 2367768336, 68340, 68341, 68349 and 68360. 23678 23679@item -m5200 23680@opindex m5200 23681Generate output for a 520X ColdFire CPU@. This is the default 23682when the compiler is configured for 520X-based systems. 23683It is equivalent to @option{-mcpu=5206}, and is now deprecated 23684in favor of that option. 23685 23686Use this option for microcontroller with a 5200 core, including 23687the MCF5202, MCF5203, MCF5204 and MCF5206. 23688 23689@item -m5206e 23690@opindex m5206e 23691Generate output for a 5206e ColdFire CPU@. The option is now 23692deprecated in favor of the equivalent @option{-mcpu=5206e}. 23693 23694@item -m528x 23695@opindex m528x 23696Generate output for a member of the ColdFire 528X family. 23697The option is now deprecated in favor of the equivalent 23698@option{-mcpu=528x}. 23699 23700@item -m5307 23701@opindex m5307 23702Generate output for a ColdFire 5307 CPU@. The option is now deprecated 23703in favor of the equivalent @option{-mcpu=5307}. 23704 23705@item -m5407 23706@opindex m5407 23707Generate output for a ColdFire 5407 CPU@. The option is now deprecated 23708in favor of the equivalent @option{-mcpu=5407}. 23709 23710@item -mcfv4e 23711@opindex mcfv4e 23712Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 23713This includes use of hardware floating-point instructions. 23714The option is equivalent to @option{-mcpu=547x}, and is now 23715deprecated in favor of that option. 23716 23717@item -m68020-40 23718@opindex m68020-40 23719Generate output for a 68040, without using any of the new instructions. 23720This results in code that can run relatively efficiently on either a 2372168020/68881 or a 68030 or a 68040. The generated code does use the 2372268881 instructions that are emulated on the 68040. 23723 23724The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 23725 23726@item -m68020-60 23727@opindex m68020-60 23728Generate output for a 68060, without using any of the new instructions. 23729This results in code that can run relatively efficiently on either a 2373068020/68881 or a 68030 or a 68040. The generated code does use the 2373168881 instructions that are emulated on the 68060. 23732 23733The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 23734 23735@item -mhard-float 23736@itemx -m68881 23737@opindex mhard-float 23738@opindex m68881 23739Generate floating-point instructions. This is the default for 68020 23740and above, and for ColdFire devices that have an FPU@. It defines the 23741macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 23742on ColdFire targets. 23743 23744@item -msoft-float 23745@opindex msoft-float 23746Do not generate floating-point instructions; use library calls instead. 23747This is the default for 68000, 68010, and 68832 targets. It is also 23748the default for ColdFire devices that have no FPU. 23749 23750@item -mdiv 23751@itemx -mno-div 23752@opindex mdiv 23753@opindex mno-div 23754Generate (do not generate) ColdFire hardware divide and remainder 23755instructions. If @option{-march} is used without @option{-mcpu}, 23756the default is ``on'' for ColdFire architectures and ``off'' for M680x0 23757architectures. Otherwise, the default is taken from the target CPU 23758(either the default CPU, or the one specified by @option{-mcpu}). For 23759example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 23760@option{-mcpu=5206e}. 23761 23762GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 23763 23764@item -mshort 23765@opindex mshort 23766Consider type @code{int} to be 16 bits wide, like @code{short int}. 23767Additionally, parameters passed on the stack are also aligned to a 2376816-bit boundary even on targets whose API mandates promotion to 32-bit. 23769 23770@item -mno-short 23771@opindex mno-short 23772Do not consider type @code{int} to be 16 bits wide. This is the default. 23773 23774@item -mnobitfield 23775@itemx -mno-bitfield 23776@opindex mnobitfield 23777@opindex mno-bitfield 23778Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 23779and @option{-m5200} options imply @w{@option{-mnobitfield}}. 23780 23781@item -mbitfield 23782@opindex mbitfield 23783Do use the bit-field instructions. The @option{-m68020} option implies 23784@option{-mbitfield}. This is the default if you use a configuration 23785designed for a 68020. 23786 23787@item -mrtd 23788@opindex mrtd 23789Use a different function-calling convention, in which functions 23790that take a fixed number of arguments return with the @code{rtd} 23791instruction, which pops their arguments while returning. This 23792saves one instruction in the caller since there is no need to pop 23793the arguments there. 23794 23795This calling convention is incompatible with the one normally 23796used on Unix, so you cannot use it if you need to call libraries 23797compiled with the Unix compiler. 23798 23799Also, you must provide function prototypes for all functions that 23800take variable numbers of arguments (including @code{printf}); 23801otherwise incorrect code is generated for calls to those 23802functions. 23803 23804In addition, seriously incorrect code results if you call a 23805function with too many arguments. (Normally, extra arguments are 23806harmlessly ignored.) 23807 23808The @code{rtd} instruction is supported by the 68010, 68020, 68030, 2380968040, 68060 and CPU32 processors, but not by the 68000 or 5200. 23810 23811The default is @option{-mno-rtd}. 23812 23813@item -malign-int 23814@itemx -mno-align-int 23815@opindex malign-int 23816@opindex mno-align-int 23817Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 23818@code{float}, @code{double}, and @code{long double} variables on a 32-bit 23819boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 23820Aligning variables on 32-bit boundaries produces code that runs somewhat 23821faster on processors with 32-bit busses at the expense of more memory. 23822 23823@strong{Warning:} if you use the @option{-malign-int} switch, GCC 23824aligns structures containing the above types differently than 23825most published application binary interface specifications for the m68k. 23826 23827@opindex mpcrel 23828Use the pc-relative addressing mode of the 68000 directly, instead of 23829using a global offset table. At present, this option implies @option{-fpic}, 23830allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 23831not presently supported with @option{-mpcrel}, though this could be supported for 2383268020 and higher processors. 23833 23834@item -mno-strict-align 23835@itemx -mstrict-align 23836@opindex mno-strict-align 23837@opindex mstrict-align 23838Do not (do) assume that unaligned memory references are handled by 23839the system. 23840 23841@item -msep-data 23842Generate code that allows the data segment to be located in a different 23843area of memory from the text segment. This allows for execute-in-place in 23844an environment without virtual memory management. This option implies 23845@option{-fPIC}. 23846 23847@item -mno-sep-data 23848Generate code that assumes that the data segment follows the text segment. 23849This is the default. 23850 23851@item -mid-shared-library 23852Generate code that supports shared libraries via the library ID method. 23853This allows for execute-in-place and shared libraries in an environment 23854without virtual memory management. This option implies @option{-fPIC}. 23855 23856@item -mno-id-shared-library 23857Generate code that doesn't assume ID-based shared libraries are being used. 23858This is the default. 23859 23860@item -mshared-library-id=n 23861Specifies the identification number of the ID-based shared library being 23862compiled. Specifying a value of 0 generates more compact code; specifying 23863other values forces the allocation of that number to the current 23864library, but is no more space- or time-efficient than omitting this option. 23865 23866@item -mxgot 23867@itemx -mno-xgot 23868@opindex mxgot 23869@opindex mno-xgot 23870When generating position-independent code for ColdFire, generate code 23871that works if the GOT has more than 8192 entries. This code is 23872larger and slower than code generated without this option. On M680x0 23873processors, this option is not needed; @option{-fPIC} suffices. 23874 23875GCC normally uses a single instruction to load values from the GOT@. 23876While this is relatively efficient, it only works if the GOT 23877is smaller than about 64k. Anything larger causes the linker 23878to report an error such as: 23879 23880@cindex relocation truncated to fit (ColdFire) 23881@smallexample 23882relocation truncated to fit: R_68K_GOT16O foobar 23883@end smallexample 23884 23885If this happens, you should recompile your code with @option{-mxgot}. 23886It should then work with very large GOTs. However, code generated with 23887@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 23888the value of a global symbol. 23889 23890Note that some linkers, including newer versions of the GNU linker, 23891can create multiple GOTs and sort GOT entries. If you have such a linker, 23892you should only need to use @option{-mxgot} when compiling a single 23893object file that accesses more than 8192 GOT entries. Very few do. 23894 23895These options have no effect unless GCC is generating 23896position-independent code. 23897 23898@item -mlong-jump-table-offsets 23899@opindex mlong-jump-table-offsets 23900Use 32-bit offsets in @code{switch} tables. The default is to use 2390116-bit offsets. 23902 23903@end table 23904 23905@node MCore Options 23906@subsection MCore Options 23907@cindex MCore options 23908 23909These are the @samp{-m} options defined for the Motorola M*Core 23910processors. 23911 23912@table @gcctabopt 23913 23914@item -mhardlit 23915@itemx -mno-hardlit 23916@opindex mhardlit 23917@opindex mno-hardlit 23918Inline constants into the code stream if it can be done in two 23919instructions or less. 23920 23921@item -mdiv 23922@itemx -mno-div 23923@opindex mdiv 23924@opindex mno-div 23925Use the divide instruction. (Enabled by default). 23926 23927@item -mrelax-immediate 23928@itemx -mno-relax-immediate 23929@opindex mrelax-immediate 23930@opindex mno-relax-immediate 23931Allow arbitrary-sized immediates in bit operations. 23932 23933@item -mwide-bitfields 23934@itemx -mno-wide-bitfields 23935@opindex mwide-bitfields 23936@opindex mno-wide-bitfields 23937Always treat bit-fields as @code{int}-sized. 23938 23939@item -m4byte-functions 23940@itemx -mno-4byte-functions 23941@opindex m4byte-functions 23942@opindex mno-4byte-functions 23943Force all functions to be aligned to a 4-byte boundary. 23944 23945@item -mcallgraph-data 23946@itemx -mno-callgraph-data 23947@opindex mcallgraph-data 23948@opindex mno-callgraph-data 23949Emit callgraph information. 23950 23951@item -mslow-bytes 23952@itemx -mno-slow-bytes 23953@opindex mslow-bytes 23954@opindex mno-slow-bytes 23955Prefer word access when reading byte quantities. 23956 23957@item -mlittle-endian 23958@itemx -mbig-endian 23959@opindex mlittle-endian 23960@opindex mbig-endian 23961Generate code for a little-endian target. 23962 23963@item -m210 23964@itemx -m340 23965@opindex m210 23966@opindex m340 23967Generate code for the 210 processor. 23968 23969@item -mno-lsim 23970@opindex mno-lsim 23971Assume that runtime support has been provided and so omit the 23972simulator library (@file{libsim.a)} from the linker command line. 23973 23974@item -mstack-increment=@var{size} 23975@opindex mstack-increment 23976Set the maximum amount for a single stack increment operation. Large 23977values can increase the speed of programs that contain functions 23978that need a large amount of stack space, but they can also trigger a 23979segmentation fault if the stack is extended too much. The default 23980value is 0x1000. 23981 23982@end table 23983 23984@node MeP Options 23985@subsection MeP Options 23986@cindex MeP options 23987 23988@table @gcctabopt 23989 23990@item -mabsdiff 23991@opindex mabsdiff 23992Enables the @code{abs} instruction, which is the absolute difference 23993between two registers. 23994 23995@item -mall-opts 23996@opindex mall-opts 23997Enables all the optional instructions---average, multiply, divide, bit 23998operations, leading zero, absolute difference, min/max, clip, and 23999saturation. 24000 24001 24002@item -maverage 24003@opindex maverage 24004Enables the @code{ave} instruction, which computes the average of two 24005registers. 24006 24007@item -mbased=@var{n} 24008@opindex mbased= 24009Variables of size @var{n} bytes or smaller are placed in the 24010@code{.based} section by default. Based variables use the @code{$tp} 24011register as a base register, and there is a 128-byte limit to the 24012@code{.based} section. 24013 24014@item -mbitops 24015@opindex mbitops 24016Enables the bit operation instructions---bit test (@code{btstm}), set 24017(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 24018test-and-set (@code{tas}). 24019 24020@item -mc=@var{name} 24021@opindex mc= 24022Selects which section constant data is placed in. @var{name} may 24023be @samp{tiny}, @samp{near}, or @samp{far}. 24024 24025@item -mclip 24026@opindex mclip 24027Enables the @code{clip} instruction. Note that @option{-mclip} is not 24028useful unless you also provide @option{-mminmax}. 24029 24030@item -mconfig=@var{name} 24031@opindex mconfig= 24032Selects one of the built-in core configurations. Each MeP chip has 24033one or more modules in it; each module has a core CPU and a variety of 24034coprocessors, optional instructions, and peripherals. The 24035@code{MeP-Integrator} tool, not part of GCC, provides these 24036configurations through this option; using this option is the same as 24037using all the corresponding command-line options. The default 24038configuration is @samp{default}. 24039 24040@item -mcop 24041@opindex mcop 24042Enables the coprocessor instructions. By default, this is a 32-bit 24043coprocessor. Note that the coprocessor is normally enabled via the 24044@option{-mconfig=} option. 24045 24046@item -mcop32 24047@opindex mcop32 24048Enables the 32-bit coprocessor's instructions. 24049 24050@item -mcop64 24051@opindex mcop64 24052Enables the 64-bit coprocessor's instructions. 24053 24054@item -mivc2 24055@opindex mivc2 24056Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 24057 24058@item -mdc 24059@opindex mdc 24060Causes constant variables to be placed in the @code{.near} section. 24061 24062@item -mdiv 24063@opindex mdiv 24064Enables the @code{div} and @code{divu} instructions. 24065 24066@item -meb 24067@opindex meb 24068Generate big-endian code. 24069 24070@item -mel 24071@opindex mel 24072Generate little-endian code. 24073 24074@item -mio-volatile 24075@opindex mio-volatile 24076Tells the compiler that any variable marked with the @code{io} 24077attribute is to be considered volatile. 24078 24079@item -ml 24080@opindex ml 24081Causes variables to be assigned to the @code{.far} section by default. 24082 24083@item -mleadz 24084@opindex mleadz 24085Enables the @code{leadz} (leading zero) instruction. 24086 24087@item -mm 24088@opindex mm 24089Causes variables to be assigned to the @code{.near} section by default. 24090 24091@item -mminmax 24092@opindex mminmax 24093Enables the @code{min} and @code{max} instructions. 24094 24095@item -mmult 24096@opindex mmult 24097Enables the multiplication and multiply-accumulate instructions. 24098 24099@item -mno-opts 24100@opindex mno-opts 24101Disables all the optional instructions enabled by @option{-mall-opts}. 24102 24103@item -mrepeat 24104@opindex mrepeat 24105Enables the @code{repeat} and @code{erepeat} instructions, used for 24106low-overhead looping. 24107 24108@item -ms 24109@opindex ms 24110Causes all variables to default to the @code{.tiny} section. Note 24111that there is a 65536-byte limit to this section. Accesses to these 24112variables use the @code{%gp} base register. 24113 24114@item -msatur 24115@opindex msatur 24116Enables the saturation instructions. Note that the compiler does not 24117currently generate these itself, but this option is included for 24118compatibility with other tools, like @code{as}. 24119 24120@item -msdram 24121@opindex msdram 24122Link the SDRAM-based runtime instead of the default ROM-based runtime. 24123 24124@item -msim 24125@opindex msim 24126Link the simulator run-time libraries. 24127 24128@item -msimnovec 24129@opindex msimnovec 24130Link the simulator runtime libraries, excluding built-in support 24131for reset and exception vectors and tables. 24132 24133@item -mtf 24134@opindex mtf 24135Causes all functions to default to the @code{.far} section. Without 24136this option, functions default to the @code{.near} section. 24137 24138@item -mtiny=@var{n} 24139@opindex mtiny= 24140Variables that are @var{n} bytes or smaller are allocated to the 24141@code{.tiny} section. These variables use the @code{$gp} base 24142register. The default for this option is 4, but note that there's a 2414365536-byte limit to the @code{.tiny} section. 24144 24145@end table 24146 24147@node MicroBlaze Options 24148@subsection MicroBlaze Options 24149@cindex MicroBlaze Options 24150 24151@table @gcctabopt 24152 24153@item -msoft-float 24154@opindex msoft-float 24155Use software emulation for floating point (default). 24156 24157@item -mhard-float 24158@opindex mhard-float 24159Use hardware floating-point instructions. 24160 24161@item -mmemcpy 24162@opindex mmemcpy 24163Do not optimize block moves, use @code{memcpy}. 24164 24165@item -mno-clearbss 24166@opindex mno-clearbss 24167This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 24168 24169@item -mcpu=@var{cpu-type} 24170@opindex mcpu= 24171Use features of, and schedule code for, the given CPU. 24172Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 24173where @var{X} is a major version, @var{YY} is the minor version, and 24174@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 24175@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}. 24176 24177@item -mxl-soft-mul 24178@opindex mxl-soft-mul 24179Use software multiply emulation (default). 24180 24181@item -mxl-soft-div 24182@opindex mxl-soft-div 24183Use software emulation for divides (default). 24184 24185@item -mxl-barrel-shift 24186@opindex mxl-barrel-shift 24187Use the hardware barrel shifter. 24188 24189@item -mxl-pattern-compare 24190@opindex mxl-pattern-compare 24191Use pattern compare instructions. 24192 24193@item -msmall-divides 24194@opindex msmall-divides 24195Use table lookup optimization for small signed integer divisions. 24196 24197@item -mxl-stack-check 24198@opindex mxl-stack-check 24199This option is deprecated. Use @option{-fstack-check} instead. 24200 24201@item -mxl-gp-opt 24202@opindex mxl-gp-opt 24203Use GP-relative @code{.sdata}/@code{.sbss} sections. 24204 24205@item -mxl-multiply-high 24206@opindex mxl-multiply-high 24207Use multiply high instructions for high part of 32x32 multiply. 24208 24209@item -mxl-float-convert 24210@opindex mxl-float-convert 24211Use hardware floating-point conversion instructions. 24212 24213@item -mxl-float-sqrt 24214@opindex mxl-float-sqrt 24215Use hardware floating-point square root instruction. 24216 24217@item -mbig-endian 24218@opindex mbig-endian 24219Generate code for a big-endian target. 24220 24221@item -mlittle-endian 24222@opindex mlittle-endian 24223Generate code for a little-endian target. 24224 24225@item -mxl-reorder 24226@opindex mxl-reorder 24227Use reorder instructions (swap and byte reversed load/store). 24228 24229@item -mxl-mode-@var{app-model} 24230Select application model @var{app-model}. Valid models are 24231@table @samp 24232@item executable 24233normal executable (default), uses startup code @file{crt0.o}. 24234 24235@item -mpic-data-is-text-relative 24236@opindex mpic-data-is-text-relative 24237Assume that the displacement between the text and data segments is fixed 24238at static link time. This allows data to be referenced by offset from start of 24239text address instead of GOT since PC-relative addressing is not supported. 24240 24241@item xmdstub 24242for use with Xilinx Microprocessor Debugger (XMD) based 24243software intrusive debug agent called xmdstub. This uses startup file 24244@file{crt1.o} and sets the start address of the program to 0x800. 24245 24246@item bootstrap 24247for applications that are loaded using a bootloader. 24248This model uses startup file @file{crt2.o} which does not contain a processor 24249reset vector handler. This is suitable for transferring control on a 24250processor reset to the bootloader rather than the application. 24251 24252@item novectors 24253for applications that do not require any of the 24254MicroBlaze vectors. This option may be useful for applications running 24255within a monitoring application. This model uses @file{crt3.o} as a startup file. 24256@end table 24257 24258Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 24259@option{-mxl-mode-@var{app-model}}. 24260 24261@end table 24262 24263@node MIPS Options 24264@subsection MIPS Options 24265@cindex MIPS options 24266 24267@table @gcctabopt 24268 24269@item -EB 24270@opindex EB 24271Generate big-endian code. 24272 24273@item -EL 24274@opindex EL 24275Generate little-endian code. This is the default for @samp{mips*el-*-*} 24276configurations. 24277 24278@item -march=@var{arch} 24279@opindex march 24280Generate code that runs on @var{arch}, which can be the name of a 24281generic MIPS ISA, or the name of a particular processor. 24282The ISA names are: 24283@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 24284@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 24285@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 24286@samp{mips64r5} and @samp{mips64r6}. 24287The processor names are: 24288@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 24289@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 24290@samp{5kc}, @samp{5kf}, 24291@samp{20kc}, 24292@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 24293@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 24294@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 24295@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 24296@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 24297@samp{i6400}, @samp{i6500}, 24298@samp{interaptiv}, 24299@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464}, 24300@samp{gs464e}, @samp{gs264e}, 24301@samp{m4k}, 24302@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 24303@samp{m5100}, @samp{m5101}, 24304@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 24305@samp{orion}, 24306@samp{p5600}, @samp{p6600}, 24307@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 24308@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900}, 24309@samp{r6000}, @samp{r8000}, 24310@samp{rm7000}, @samp{rm9000}, 24311@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 24312@samp{sb1}, 24313@samp{sr71000}, 24314@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 24315@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 24316@samp{xlr} and @samp{xlp}. 24317The special value @samp{from-abi} selects the 24318most compatible architecture for the selected ABI (that is, 24319@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 24320 24321The native Linux/GNU toolchain also supports the value @samp{native}, 24322which selects the best architecture option for the host processor. 24323@option{-march=native} has no effect if GCC does not recognize 24324the processor. 24325 24326In processor names, a final @samp{000} can be abbreviated as @samp{k} 24327(for example, @option{-march=r2k}). Prefixes are optional, and 24328@samp{vr} may be written @samp{r}. 24329 24330Names of the form @samp{@var{n}f2_1} refer to processors with 24331FPUs clocked at half the rate of the core, names of the form 24332@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 24333rate as the core, and names of the form @samp{@var{n}f3_2} refer to 24334processors with FPUs clocked a ratio of 3:2 with respect to the core. 24335For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 24336for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 24337accepted as synonyms for @samp{@var{n}f1_1}. 24338 24339GCC defines two macros based on the value of this option. The first 24340is @code{_MIPS_ARCH}, which gives the name of target architecture, as 24341a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 24342where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 24343For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 24344to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 24345 24346Note that the @code{_MIPS_ARCH} macro uses the processor names given 24347above. In other words, it has the full prefix and does not 24348abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 24349the macro names the resolved architecture (either @code{"mips1"} or 24350@code{"mips3"}). It names the default architecture when no 24351@option{-march} option is given. 24352 24353@item -mtune=@var{arch} 24354@opindex mtune 24355Optimize for @var{arch}. Among other things, this option controls 24356the way instructions are scheduled, and the perceived cost of arithmetic 24357operations. The list of @var{arch} values is the same as for 24358@option{-march}. 24359 24360When this option is not used, GCC optimizes for the processor 24361specified by @option{-march}. By using @option{-march} and 24362@option{-mtune} together, it is possible to generate code that 24363runs on a family of processors, but optimize the code for one 24364particular member of that family. 24365 24366@option{-mtune} defines the macros @code{_MIPS_TUNE} and 24367@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 24368@option{-march} ones described above. 24369 24370@item -mips1 24371@opindex mips1 24372Equivalent to @option{-march=mips1}. 24373 24374@item -mips2 24375@opindex mips2 24376Equivalent to @option{-march=mips2}. 24377 24378@item -mips3 24379@opindex mips3 24380Equivalent to @option{-march=mips3}. 24381 24382@item -mips4 24383@opindex mips4 24384Equivalent to @option{-march=mips4}. 24385 24386@item -mips32 24387@opindex mips32 24388Equivalent to @option{-march=mips32}. 24389 24390@item -mips32r3 24391@opindex mips32r3 24392Equivalent to @option{-march=mips32r3}. 24393 24394@item -mips32r5 24395@opindex mips32r5 24396Equivalent to @option{-march=mips32r5}. 24397 24398@item -mips32r6 24399@opindex mips32r6 24400Equivalent to @option{-march=mips32r6}. 24401 24402@item -mips64 24403@opindex mips64 24404Equivalent to @option{-march=mips64}. 24405 24406@item -mips64r2 24407@opindex mips64r2 24408Equivalent to @option{-march=mips64r2}. 24409 24410@item -mips64r3 24411@opindex mips64r3 24412Equivalent to @option{-march=mips64r3}. 24413 24414@item -mips64r5 24415@opindex mips64r5 24416Equivalent to @option{-march=mips64r5}. 24417 24418@item -mips64r6 24419@opindex mips64r6 24420Equivalent to @option{-march=mips64r6}. 24421 24422@item -mips16 24423@itemx -mno-mips16 24424@opindex mips16 24425@opindex mno-mips16 24426Generate (do not generate) MIPS16 code. If GCC is targeting a 24427MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 24428 24429MIPS16 code generation can also be controlled on a per-function basis 24430by means of @code{mips16} and @code{nomips16} attributes. 24431@xref{Function Attributes}, for more information. 24432 24433@item -mflip-mips16 24434@opindex mflip-mips16 24435Generate MIPS16 code on alternating functions. This option is provided 24436for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 24437not intended for ordinary use in compiling user code. 24438 24439@item -minterlink-compressed 24440@itemx -mno-interlink-compressed 24441@opindex minterlink-compressed 24442@opindex mno-interlink-compressed 24443Require (do not require) that code using the standard (uncompressed) MIPS ISA 24444be link-compatible with MIPS16 and microMIPS code, and vice versa. 24445 24446For example, code using the standard ISA encoding cannot jump directly 24447to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 24448@option{-minterlink-compressed} therefore disables direct jumps unless GCC 24449knows that the target of the jump is not compressed. 24450 24451@item -minterlink-mips16 24452@itemx -mno-interlink-mips16 24453@opindex minterlink-mips16 24454@opindex mno-interlink-mips16 24455Aliases of @option{-minterlink-compressed} and 24456@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 24457and are retained for backwards compatibility. 24458 24459@item -mabi=32 24460@itemx -mabi=o64 24461@itemx -mabi=n32 24462@itemx -mabi=64 24463@itemx -mabi=eabi 24464@opindex mabi=32 24465@opindex mabi=o64 24466@opindex mabi=n32 24467@opindex mabi=64 24468@opindex mabi=eabi 24469Generate code for the given ABI@. 24470 24471Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 24472generates 64-bit code when you select a 64-bit architecture, but you 24473can use @option{-mgp32} to get 32-bit code instead. 24474 24475For information about the O64 ABI, see 24476@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 24477 24478GCC supports a variant of the o32 ABI in which floating-point registers 24479are 64 rather than 32 bits wide. You can select this combination with 24480@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 24481and @code{mfhc1} instructions and is therefore only supported for 24482MIPS32R2, MIPS32R3 and MIPS32R5 processors. 24483 24484The register assignments for arguments and return values remain the 24485same, but each scalar value is passed in a single 64-bit register 24486rather than a pair of 32-bit registers. For example, scalar 24487floating-point values are returned in @samp{$f0} only, not a 24488@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 24489remains the same in that the even-numbered double-precision registers 24490are saved. 24491 24492Two additional variants of the o32 ABI are supported to enable 24493a transition from 32-bit to 64-bit registers. These are FPXX 24494(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 24495The FPXX extension mandates that all code must execute correctly 24496when run using 32-bit or 64-bit registers. The code can be interlinked 24497with either FP32 or FP64, but not both. 24498The FP64A extension is similar to the FP64 extension but forbids the 24499use of odd-numbered single-precision registers. This can be used 24500in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 24501processors and allows both FP32 and FP64A code to interlink and 24502run in the same process without changing FPU modes. 24503 24504@item -mabicalls 24505@itemx -mno-abicalls 24506@opindex mabicalls 24507@opindex mno-abicalls 24508Generate (do not generate) code that is suitable for SVR4-style 24509dynamic objects. @option{-mabicalls} is the default for SVR4-based 24510systems. 24511 24512@item -mshared 24513@itemx -mno-shared 24514Generate (do not generate) code that is fully position-independent, 24515and that can therefore be linked into shared libraries. This option 24516only affects @option{-mabicalls}. 24517 24518All @option{-mabicalls} code has traditionally been position-independent, 24519regardless of options like @option{-fPIC} and @option{-fpic}. However, 24520as an extension, the GNU toolchain allows executables to use absolute 24521accesses for locally-binding symbols. It can also use shorter GP 24522initialization sequences and generate direct calls to locally-defined 24523functions. This mode is selected by @option{-mno-shared}. 24524 24525@option{-mno-shared} depends on binutils 2.16 or higher and generates 24526objects that can only be linked by the GNU linker. However, the option 24527does not affect the ABI of the final executable; it only affects the ABI 24528of relocatable objects. Using @option{-mno-shared} generally makes 24529executables both smaller and quicker. 24530 24531@option{-mshared} is the default. 24532 24533@item -mplt 24534@itemx -mno-plt 24535@opindex mplt 24536@opindex mno-plt 24537Assume (do not assume) that the static and dynamic linkers 24538support PLTs and copy relocations. This option only affects 24539@option{-mno-shared -mabicalls}. For the n64 ABI, this option 24540has no effect without @option{-msym32}. 24541 24542You can make @option{-mplt} the default by configuring 24543GCC with @option{--with-mips-plt}. The default is 24544@option{-mno-plt} otherwise. 24545 24546@item -mxgot 24547@itemx -mno-xgot 24548@opindex mxgot 24549@opindex mno-xgot 24550Lift (do not lift) the usual restrictions on the size of the global 24551offset table. 24552 24553GCC normally uses a single instruction to load values from the GOT@. 24554While this is relatively efficient, it only works if the GOT 24555is smaller than about 64k. Anything larger causes the linker 24556to report an error such as: 24557 24558@cindex relocation truncated to fit (MIPS) 24559@smallexample 24560relocation truncated to fit: R_MIPS_GOT16 foobar 24561@end smallexample 24562 24563If this happens, you should recompile your code with @option{-mxgot}. 24564This works with very large GOTs, although the code is also 24565less efficient, since it takes three instructions to fetch the 24566value of a global symbol. 24567 24568Note that some linkers can create multiple GOTs. If you have such a 24569linker, you should only need to use @option{-mxgot} when a single object 24570file accesses more than 64k's worth of GOT entries. Very few do. 24571 24572These options have no effect unless GCC is generating position 24573independent code. 24574 24575@item -mgp32 24576@opindex mgp32 24577Assume that general-purpose registers are 32 bits wide. 24578 24579@item -mgp64 24580@opindex mgp64 24581Assume that general-purpose registers are 64 bits wide. 24582 24583@item -mfp32 24584@opindex mfp32 24585Assume that floating-point registers are 32 bits wide. 24586 24587@item -mfp64 24588@opindex mfp64 24589Assume that floating-point registers are 64 bits wide. 24590 24591@item -mfpxx 24592@opindex mfpxx 24593Do not assume the width of floating-point registers. 24594 24595@item -mhard-float 24596@opindex mhard-float 24597Use floating-point coprocessor instructions. 24598 24599@item -msoft-float 24600@opindex msoft-float 24601Do not use floating-point coprocessor instructions. Implement 24602floating-point calculations using library calls instead. 24603 24604@item -mno-float 24605@opindex mno-float 24606Equivalent to @option{-msoft-float}, but additionally asserts that the 24607program being compiled does not perform any floating-point operations. 24608This option is presently supported only by some bare-metal MIPS 24609configurations, where it may select a special set of libraries 24610that lack all floating-point support (including, for example, the 24611floating-point @code{printf} formats). 24612If code compiled with @option{-mno-float} accidentally contains 24613floating-point operations, it is likely to suffer a link-time 24614or run-time failure. 24615 24616@item -msingle-float 24617@opindex msingle-float 24618Assume that the floating-point coprocessor only supports single-precision 24619operations. 24620 24621@item -mdouble-float 24622@opindex mdouble-float 24623Assume that the floating-point coprocessor supports double-precision 24624operations. This is the default. 24625 24626@item -modd-spreg 24627@itemx -mno-odd-spreg 24628@opindex modd-spreg 24629@opindex mno-odd-spreg 24630Enable the use of odd-numbered single-precision floating-point registers 24631for the o32 ABI. This is the default for processors that are known to 24632support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 24633is set by default. 24634 24635@item -mabs=2008 24636@itemx -mabs=legacy 24637@opindex mabs=2008 24638@opindex mabs=legacy 24639These options control the treatment of the special not-a-number (NaN) 24640IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 24641@code{neg.@i{fmt}} machine instructions. 24642 24643By default or when @option{-mabs=legacy} is used the legacy 24644treatment is selected. In this case these instructions are considered 24645arithmetic and avoided where correct operation is required and the 24646input operand might be a NaN. A longer sequence of instructions that 24647manipulate the sign bit of floating-point datum manually is used 24648instead unless the @option{-ffinite-math-only} option has also been 24649specified. 24650 24651The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 24652this case these instructions are considered non-arithmetic and therefore 24653operating correctly in all cases, including in particular where the 24654input operand is a NaN. These instructions are therefore always used 24655for the respective operations. 24656 24657@item -mnan=2008 24658@itemx -mnan=legacy 24659@opindex mnan=2008 24660@opindex mnan=legacy 24661These options control the encoding of the special not-a-number (NaN) 24662IEEE 754 floating-point data. 24663 24664The @option{-mnan=legacy} option selects the legacy encoding. In this 24665case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 24666significand field being 0, whereas signaling NaNs (sNaNs) are denoted 24667by the first bit of their trailing significand field being 1. 24668 24669The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 24670this case qNaNs are denoted by the first bit of their trailing 24671significand field being 1, whereas sNaNs are denoted by the first bit of 24672their trailing significand field being 0. 24673 24674The default is @option{-mnan=legacy} unless GCC has been configured with 24675@option{--with-nan=2008}. 24676 24677@item -mllsc 24678@itemx -mno-llsc 24679@opindex mllsc 24680@opindex mno-llsc 24681Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 24682implement atomic memory built-in functions. When neither option is 24683specified, GCC uses the instructions if the target architecture 24684supports them. 24685 24686@option{-mllsc} is useful if the runtime environment can emulate the 24687instructions and @option{-mno-llsc} can be useful when compiling for 24688nonstandard ISAs. You can make either option the default by 24689configuring GCC with @option{--with-llsc} and @option{--without-llsc} 24690respectively. @option{--with-llsc} is the default for some 24691configurations; see the installation documentation for details. 24692 24693@item -mdsp 24694@itemx -mno-dsp 24695@opindex mdsp 24696@opindex mno-dsp 24697Use (do not use) revision 1 of the MIPS DSP ASE@. 24698@xref{MIPS DSP Built-in Functions}. This option defines the 24699preprocessor macro @code{__mips_dsp}. It also defines 24700@code{__mips_dsp_rev} to 1. 24701 24702@item -mdspr2 24703@itemx -mno-dspr2 24704@opindex mdspr2 24705@opindex mno-dspr2 24706Use (do not use) revision 2 of the MIPS DSP ASE@. 24707@xref{MIPS DSP Built-in Functions}. This option defines the 24708preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 24709It also defines @code{__mips_dsp_rev} to 2. 24710 24711@item -msmartmips 24712@itemx -mno-smartmips 24713@opindex msmartmips 24714@opindex mno-smartmips 24715Use (do not use) the MIPS SmartMIPS ASE. 24716 24717@item -mpaired-single 24718@itemx -mno-paired-single 24719@opindex mpaired-single 24720@opindex mno-paired-single 24721Use (do not use) paired-single floating-point instructions. 24722@xref{MIPS Paired-Single Support}. This option requires 24723hardware floating-point support to be enabled. 24724 24725@item -mdmx 24726@itemx -mno-mdmx 24727@opindex mdmx 24728@opindex mno-mdmx 24729Use (do not use) MIPS Digital Media Extension instructions. 24730This option can only be used when generating 64-bit code and requires 24731hardware floating-point support to be enabled. 24732 24733@item -mips3d 24734@itemx -mno-mips3d 24735@opindex mips3d 24736@opindex mno-mips3d 24737Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 24738The option @option{-mips3d} implies @option{-mpaired-single}. 24739 24740@item -mmicromips 24741@itemx -mno-micromips 24742@opindex mmicromips 24743@opindex mno-mmicromips 24744Generate (do not generate) microMIPS code. 24745 24746MicroMIPS code generation can also be controlled on a per-function basis 24747by means of @code{micromips} and @code{nomicromips} attributes. 24748@xref{Function Attributes}, for more information. 24749 24750@item -mmt 24751@itemx -mno-mt 24752@opindex mmt 24753@opindex mno-mt 24754Use (do not use) MT Multithreading instructions. 24755 24756@item -mmcu 24757@itemx -mno-mcu 24758@opindex mmcu 24759@opindex mno-mcu 24760Use (do not use) the MIPS MCU ASE instructions. 24761 24762@item -meva 24763@itemx -mno-eva 24764@opindex meva 24765@opindex mno-eva 24766Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 24767 24768@item -mvirt 24769@itemx -mno-virt 24770@opindex mvirt 24771@opindex mno-virt 24772Use (do not use) the MIPS Virtualization (VZ) instructions. 24773 24774@item -mxpa 24775@itemx -mno-xpa 24776@opindex mxpa 24777@opindex mno-xpa 24778Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 24779 24780@item -mcrc 24781@itemx -mno-crc 24782@opindex mcrc 24783@opindex mno-crc 24784Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions. 24785 24786@item -mginv 24787@itemx -mno-ginv 24788@opindex mginv 24789@opindex mno-ginv 24790Use (do not use) the MIPS Global INValidate (GINV) instructions. 24791 24792@item -mloongson-mmi 24793@itemx -mno-loongson-mmi 24794@opindex mloongson-mmi 24795@opindex mno-loongson-mmi 24796Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI). 24797 24798@item -mloongson-ext 24799@itemx -mno-loongson-ext 24800@opindex mloongson-ext 24801@opindex mno-loongson-ext 24802Use (do not use) the MIPS Loongson EXTensions (EXT) instructions. 24803 24804@item -mloongson-ext2 24805@itemx -mno-loongson-ext2 24806@opindex mloongson-ext2 24807@opindex mno-loongson-ext2 24808Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions. 24809 24810@item -mlong64 24811@opindex mlong64 24812Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 24813an explanation of the default and the way that the pointer size is 24814determined. 24815 24816@item -mlong32 24817@opindex mlong32 24818Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 24819 24820The default size of @code{int}s, @code{long}s and pointers depends on 24821the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 24822uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 2482332-bit @code{long}s. Pointers are the same size as @code{long}s, 24824or the same size as integer registers, whichever is smaller. 24825 24826@item -msym32 24827@itemx -mno-sym32 24828@opindex msym32 24829@opindex mno-sym32 24830Assume (do not assume) that all symbols have 32-bit values, regardless 24831of the selected ABI@. This option is useful in combination with 24832@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 24833to generate shorter and faster references to symbolic addresses. 24834 24835@item -G @var{num} 24836@opindex G 24837Put definitions of externally-visible data in a small data section 24838if that data is no bigger than @var{num} bytes. GCC can then generate 24839more efficient accesses to the data; see @option{-mgpopt} for details. 24840 24841The default @option{-G} option depends on the configuration. 24842 24843@item -mlocal-sdata 24844@itemx -mno-local-sdata 24845@opindex mlocal-sdata 24846@opindex mno-local-sdata 24847Extend (do not extend) the @option{-G} behavior to local data too, 24848such as to static variables in C@. @option{-mlocal-sdata} is the 24849default for all configurations. 24850 24851If the linker complains that an application is using too much small data, 24852you might want to try rebuilding the less performance-critical parts with 24853@option{-mno-local-sdata}. You might also want to build large 24854libraries with @option{-mno-local-sdata}, so that the libraries leave 24855more room for the main program. 24856 24857@item -mextern-sdata 24858@itemx -mno-extern-sdata 24859@opindex mextern-sdata 24860@opindex mno-extern-sdata 24861Assume (do not assume) that externally-defined data is in 24862a small data section if the size of that data is within the @option{-G} limit. 24863@option{-mextern-sdata} is the default for all configurations. 24864 24865If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 24866@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 24867that is no bigger than @var{num} bytes, you must make sure that @var{Var} 24868is placed in a small data section. If @var{Var} is defined by another 24869module, you must either compile that module with a high-enough 24870@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 24871definition. If @var{Var} is common, you must link the application 24872with a high-enough @option{-G} setting. 24873 24874The easiest way of satisfying these restrictions is to compile 24875and link every module with the same @option{-G} option. However, 24876you may wish to build a library that supports several different 24877small data limits. You can do this by compiling the library with 24878the highest supported @option{-G} setting and additionally using 24879@option{-mno-extern-sdata} to stop the library from making assumptions 24880about externally-defined data. 24881 24882@item -mgpopt 24883@itemx -mno-gpopt 24884@opindex mgpopt 24885@opindex mno-gpopt 24886Use (do not use) GP-relative accesses for symbols that are known to be 24887in a small data section; see @option{-G}, @option{-mlocal-sdata} and 24888@option{-mextern-sdata}. @option{-mgpopt} is the default for all 24889configurations. 24890 24891@option{-mno-gpopt} is useful for cases where the @code{$gp} register 24892might not hold the value of @code{_gp}. For example, if the code is 24893part of a library that might be used in a boot monitor, programs that 24894call boot monitor routines pass an unknown value in @code{$gp}. 24895(In such situations, the boot monitor itself is usually compiled 24896with @option{-G0}.) 24897 24898@option{-mno-gpopt} implies @option{-mno-local-sdata} and 24899@option{-mno-extern-sdata}. 24900 24901@item -membedded-data 24902@itemx -mno-embedded-data 24903@opindex membedded-data 24904@opindex mno-embedded-data 24905Allocate variables to the read-only data section first if possible, then 24906next in the small data section if possible, otherwise in data. This gives 24907slightly slower code than the default, but reduces the amount of RAM required 24908when executing, and thus may be preferred for some embedded systems. 24909 24910@item -muninit-const-in-rodata 24911@itemx -mno-uninit-const-in-rodata 24912@opindex muninit-const-in-rodata 24913@opindex mno-uninit-const-in-rodata 24914Put uninitialized @code{const} variables in the read-only data section. 24915This option is only meaningful in conjunction with @option{-membedded-data}. 24916 24917@item -mcode-readable=@var{setting} 24918@opindex mcode-readable 24919Specify whether GCC may generate code that reads from executable sections. 24920There are three possible settings: 24921 24922@table @gcctabopt 24923@item -mcode-readable=yes 24924Instructions may freely access executable sections. This is the 24925default setting. 24926 24927@item -mcode-readable=pcrel 24928MIPS16 PC-relative load instructions can access executable sections, 24929but other instructions must not do so. This option is useful on 4KSc 24930and 4KSd processors when the code TLBs have the Read Inhibit bit set. 24931It is also useful on processors that can be configured to have a dual 24932instruction/data SRAM interface and that, like the M4K, automatically 24933redirect PC-relative loads to the instruction RAM. 24934 24935@item -mcode-readable=no 24936Instructions must not access executable sections. This option can be 24937useful on targets that are configured to have a dual instruction/data 24938SRAM interface but that (unlike the M4K) do not automatically redirect 24939PC-relative loads to the instruction RAM. 24940@end table 24941 24942@item -msplit-addresses 24943@itemx -mno-split-addresses 24944@opindex msplit-addresses 24945@opindex mno-split-addresses 24946Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 24947relocation operators. This option has been superseded by 24948@option{-mexplicit-relocs} but is retained for backwards compatibility. 24949 24950@item -mexplicit-relocs 24951@itemx -mno-explicit-relocs 24952@opindex mexplicit-relocs 24953@opindex mno-explicit-relocs 24954Use (do not use) assembler relocation operators when dealing with symbolic 24955addresses. The alternative, selected by @option{-mno-explicit-relocs}, 24956is to use assembler macros instead. 24957 24958@option{-mexplicit-relocs} is the default if GCC was configured 24959to use an assembler that supports relocation operators. 24960 24961@item -mcheck-zero-division 24962@itemx -mno-check-zero-division 24963@opindex mcheck-zero-division 24964@opindex mno-check-zero-division 24965Trap (do not trap) on integer division by zero. 24966 24967The default is @option{-mcheck-zero-division}. 24968 24969@item -mdivide-traps 24970@itemx -mdivide-breaks 24971@opindex mdivide-traps 24972@opindex mdivide-breaks 24973MIPS systems check for division by zero by generating either a 24974conditional trap or a break instruction. Using traps results in 24975smaller code, but is only supported on MIPS II and later. Also, some 24976versions of the Linux kernel have a bug that prevents trap from 24977generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 24978allow conditional traps on architectures that support them and 24979@option{-mdivide-breaks} to force the use of breaks. 24980 24981The default is usually @option{-mdivide-traps}, but this can be 24982overridden at configure time using @option{--with-divide=breaks}. 24983Divide-by-zero checks can be completely disabled using 24984@option{-mno-check-zero-division}. 24985 24986@item -mload-store-pairs 24987@itemx -mno-load-store-pairs 24988@opindex mload-store-pairs 24989@opindex mno-load-store-pairs 24990Enable (disable) an optimization that pairs consecutive load or store 24991instructions to enable load/store bonding. This option is enabled by 24992default but only takes effect when the selected architecture is known 24993to support bonding. 24994 24995@item -mmemcpy 24996@itemx -mno-memcpy 24997@opindex mmemcpy 24998@opindex mno-memcpy 24999Force (do not force) the use of @code{memcpy} for non-trivial block 25000moves. The default is @option{-mno-memcpy}, which allows GCC to inline 25001most constant-sized copies. 25002 25003@item -mlong-calls 25004@itemx -mno-long-calls 25005@opindex mlong-calls 25006@opindex mno-long-calls 25007Disable (do not disable) use of the @code{jal} instruction. Calling 25008functions using @code{jal} is more efficient but requires the caller 25009and callee to be in the same 256 megabyte segment. 25010 25011This option has no effect on abicalls code. The default is 25012@option{-mno-long-calls}. 25013 25014@item -mmad 25015@itemx -mno-mad 25016@opindex mmad 25017@opindex mno-mad 25018Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 25019instructions, as provided by the R4650 ISA@. 25020 25021@item -mimadd 25022@itemx -mno-imadd 25023@opindex mimadd 25024@opindex mno-imadd 25025Enable (disable) use of the @code{madd} and @code{msub} integer 25026instructions. The default is @option{-mimadd} on architectures 25027that support @code{madd} and @code{msub} except for the 74k 25028architecture where it was found to generate slower code. 25029 25030@item -mfused-madd 25031@itemx -mno-fused-madd 25032@opindex mfused-madd 25033@opindex mno-fused-madd 25034Enable (disable) use of the floating-point multiply-accumulate 25035instructions, when they are available. The default is 25036@option{-mfused-madd}. 25037 25038On the R8000 CPU when multiply-accumulate instructions are used, 25039the intermediate product is calculated to infinite precision 25040and is not subject to the FCSR Flush to Zero bit. This may be 25041undesirable in some circumstances. On other processors the result 25042is numerically identical to the equivalent computation using 25043separate multiply, add, subtract and negate instructions. 25044 25045@item -nocpp 25046@opindex nocpp 25047Tell the MIPS assembler to not run its preprocessor over user 25048assembler files (with a @samp{.s} suffix) when assembling them. 25049 25050@item -mfix-24k 25051@itemx -mno-fix-24k 25052@opindex mfix-24k 25053@opindex mno-fix-24k 25054Work around the 24K E48 (lost data on stores during refill) errata. 25055The workarounds are implemented by the assembler rather than by GCC@. 25056 25057@item -mfix-r4000 25058@itemx -mno-fix-r4000 25059@opindex mfix-r4000 25060@opindex mno-fix-r4000 25061Work around certain R4000 CPU errata: 25062@itemize @minus 25063@item 25064A double-word or a variable shift may give an incorrect result if executed 25065immediately after starting an integer division. 25066@item 25067A double-word or a variable shift may give an incorrect result if executed 25068while an integer multiplication is in progress. 25069@item 25070An integer division may give an incorrect result if started in a delay slot 25071of a taken branch or a jump. 25072@end itemize 25073 25074@item -mfix-r4400 25075@itemx -mno-fix-r4400 25076@opindex mfix-r4400 25077@opindex mno-fix-r4400 25078Work around certain R4400 CPU errata: 25079@itemize @minus 25080@item 25081A double-word or a variable shift may give an incorrect result if executed 25082immediately after starting an integer division. 25083@end itemize 25084 25085@item -mfix-r10000 25086@itemx -mno-fix-r10000 25087@opindex mfix-r10000 25088@opindex mno-fix-r10000 25089Work around certain R10000 errata: 25090@itemize @minus 25091@item 25092@code{ll}/@code{sc} sequences may not behave atomically on revisions 25093prior to 3.0. They may deadlock on revisions 2.6 and earlier. 25094@end itemize 25095 25096This option can only be used if the target architecture supports 25097branch-likely instructions. @option{-mfix-r10000} is the default when 25098@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 25099otherwise. 25100 25101@item -mfix-r5900 25102@itemx -mno-fix-r5900 25103@opindex mfix-r5900 25104Do not attempt to schedule the preceding instruction into the delay slot 25105of a branch instruction placed at the end of a short loop of six 25106instructions or fewer and always schedule a @code{nop} instruction there 25107instead. The short loop bug under certain conditions causes loops to 25108execute only once or twice, due to a hardware bug in the R5900 chip. The 25109workaround is implemented by the assembler rather than by GCC@. 25110 25111@item -mfix-rm7000 25112@itemx -mno-fix-rm7000 25113@opindex mfix-rm7000 25114Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 25115workarounds are implemented by the assembler rather than by GCC@. 25116 25117@item -mfix-vr4120 25118@itemx -mno-fix-vr4120 25119@opindex mfix-vr4120 25120Work around certain VR4120 errata: 25121@itemize @minus 25122@item 25123@code{dmultu} does not always produce the correct result. 25124@item 25125@code{div} and @code{ddiv} do not always produce the correct result if one 25126of the operands is negative. 25127@end itemize 25128The workarounds for the division errata rely on special functions in 25129@file{libgcc.a}. At present, these functions are only provided by 25130the @code{mips64vr*-elf} configurations. 25131 25132Other VR4120 errata require a NOP to be inserted between certain pairs of 25133instructions. These errata are handled by the assembler, not by GCC itself. 25134 25135@item -mfix-vr4130 25136@opindex mfix-vr4130 25137Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 25138workarounds are implemented by the assembler rather than by GCC, 25139although GCC avoids using @code{mflo} and @code{mfhi} if the 25140VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 25141instructions are available instead. 25142 25143@item -mfix-sb1 25144@itemx -mno-fix-sb1 25145@opindex mfix-sb1 25146Work around certain SB-1 CPU core errata. 25147(This flag currently works around the SB-1 revision 2 25148``F1'' and ``F2'' floating-point errata.) 25149 25150@item -mr10k-cache-barrier=@var{setting} 25151@opindex mr10k-cache-barrier 25152Specify whether GCC should insert cache barriers to avoid the 25153side effects of speculation on R10K processors. 25154 25155In common with many processors, the R10K tries to predict the outcome 25156of a conditional branch and speculatively executes instructions from 25157the ``taken'' branch. It later aborts these instructions if the 25158predicted outcome is wrong. However, on the R10K, even aborted 25159instructions can have side effects. 25160 25161This problem only affects kernel stores and, depending on the system, 25162kernel loads. As an example, a speculatively-executed store may load 25163the target memory into cache and mark the cache line as dirty, even if 25164the store itself is later aborted. If a DMA operation writes to the 25165same area of memory before the ``dirty'' line is flushed, the cached 25166data overwrites the DMA-ed data. See the R10K processor manual 25167for a full description, including other potential problems. 25168 25169One workaround is to insert cache barrier instructions before every memory 25170access that might be speculatively executed and that might have side 25171effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 25172controls GCC's implementation of this workaround. It assumes that 25173aborted accesses to any byte in the following regions does not have 25174side effects: 25175 25176@enumerate 25177@item 25178the memory occupied by the current function's stack frame; 25179 25180@item 25181the memory occupied by an incoming stack argument; 25182 25183@item 25184the memory occupied by an object with a link-time-constant address. 25185@end enumerate 25186 25187It is the kernel's responsibility to ensure that speculative 25188accesses to these regions are indeed safe. 25189 25190If the input program contains a function declaration such as: 25191 25192@smallexample 25193void foo (void); 25194@end smallexample 25195 25196then the implementation of @code{foo} must allow @code{j foo} and 25197@code{jal foo} to be executed speculatively. GCC honors this 25198restriction for functions it compiles itself. It expects non-GCC 25199functions (such as hand-written assembly code) to do the same. 25200 25201The option has three forms: 25202 25203@table @gcctabopt 25204@item -mr10k-cache-barrier=load-store 25205Insert a cache barrier before a load or store that might be 25206speculatively executed and that might have side effects even 25207if aborted. 25208 25209@item -mr10k-cache-barrier=store 25210Insert a cache barrier before a store that might be speculatively 25211executed and that might have side effects even if aborted. 25212 25213@item -mr10k-cache-barrier=none 25214Disable the insertion of cache barriers. This is the default setting. 25215@end table 25216 25217@item -mflush-func=@var{func} 25218@itemx -mno-flush-func 25219@opindex mflush-func 25220Specifies the function to call to flush the I and D caches, or to not 25221call any such function. If called, the function must take the same 25222arguments as the common @code{_flush_func}, that is, the address of the 25223memory range for which the cache is being flushed, the size of the 25224memory range, and the number 3 (to flush both caches). The default 25225depends on the target GCC was configured for, but commonly is either 25226@code{_flush_func} or @code{__cpu_flush}. 25227 25228@item mbranch-cost=@var{num} 25229@opindex mbranch-cost 25230Set the cost of branches to roughly @var{num} ``simple'' instructions. 25231This cost is only a heuristic and is not guaranteed to produce 25232consistent results across releases. A zero cost redundantly selects 25233the default, which is based on the @option{-mtune} setting. 25234 25235@item -mbranch-likely 25236@itemx -mno-branch-likely 25237@opindex mbranch-likely 25238@opindex mno-branch-likely 25239Enable or disable use of Branch Likely instructions, regardless of the 25240default for the selected architecture. By default, Branch Likely 25241instructions may be generated if they are supported by the selected 25242architecture. An exception is for the MIPS32 and MIPS64 architectures 25243and processors that implement those architectures; for those, Branch 25244Likely instructions are not be generated by default because the MIPS32 25245and MIPS64 architectures specifically deprecate their use. 25246 25247@item -mcompact-branches=never 25248@itemx -mcompact-branches=optimal 25249@itemx -mcompact-branches=always 25250@opindex mcompact-branches=never 25251@opindex mcompact-branches=optimal 25252@opindex mcompact-branches=always 25253These options control which form of branches will be generated. The 25254default is @option{-mcompact-branches=optimal}. 25255 25256The @option{-mcompact-branches=never} option ensures that compact branch 25257instructions will never be generated. 25258 25259The @option{-mcompact-branches=always} option ensures that a compact 25260branch instruction will be generated if available. If a compact branch 25261instruction is not available, a delay slot form of the branch will be 25262used instead. 25263 25264This option is supported from MIPS Release 6 onwards. 25265 25266The @option{-mcompact-branches=optimal} option will cause a delay slot 25267branch to be used if one is available in the current ISA and the delay 25268slot is successfully filled. If the delay slot is not filled, a compact 25269branch will be chosen if one is available. 25270 25271@item -mfp-exceptions 25272@itemx -mno-fp-exceptions 25273@opindex mfp-exceptions 25274Specifies whether FP exceptions are enabled. This affects how 25275FP instructions are scheduled for some processors. 25276The default is that FP exceptions are 25277enabled. 25278 25279For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 2528064-bit code, then we can use both FP pipes. Otherwise, we can only use one 25281FP pipe. 25282 25283@item -mvr4130-align 25284@itemx -mno-vr4130-align 25285@opindex mvr4130-align 25286The VR4130 pipeline is two-way superscalar, but can only issue two 25287instructions together if the first one is 8-byte aligned. When this 25288option is enabled, GCC aligns pairs of instructions that it 25289thinks should execute in parallel. 25290 25291This option only has an effect when optimizing for the VR4130. 25292It normally makes code faster, but at the expense of making it bigger. 25293It is enabled by default at optimization level @option{-O3}. 25294 25295@item -msynci 25296@itemx -mno-synci 25297@opindex msynci 25298Enable (disable) generation of @code{synci} instructions on 25299architectures that support it. The @code{synci} instructions (if 25300enabled) are generated when @code{__builtin___clear_cache} is 25301compiled. 25302 25303This option defaults to @option{-mno-synci}, but the default can be 25304overridden by configuring GCC with @option{--with-synci}. 25305 25306When compiling code for single processor systems, it is generally safe 25307to use @code{synci}. However, on many multi-core (SMP) systems, it 25308does not invalidate the instruction caches on all cores and may lead 25309to undefined behavior. 25310 25311@item -mrelax-pic-calls 25312@itemx -mno-relax-pic-calls 25313@opindex mrelax-pic-calls 25314Try to turn PIC calls that are normally dispatched via register 25315@code{$25} into direct calls. This is only possible if the linker can 25316resolve the destination at link time and if the destination is within 25317range for a direct call. 25318 25319@option{-mrelax-pic-calls} is the default if GCC was configured to use 25320an assembler and a linker that support the @code{.reloc} assembly 25321directive and @option{-mexplicit-relocs} is in effect. With 25322@option{-mno-explicit-relocs}, this optimization can be performed by the 25323assembler and the linker alone without help from the compiler. 25324 25325@item -mmcount-ra-address 25326@itemx -mno-mcount-ra-address 25327@opindex mmcount-ra-address 25328@opindex mno-mcount-ra-address 25329Emit (do not emit) code that allows @code{_mcount} to modify the 25330calling function's return address. When enabled, this option extends 25331the usual @code{_mcount} interface with a new @var{ra-address} 25332parameter, which has type @code{intptr_t *} and is passed in register 25333@code{$12}. @code{_mcount} can then modify the return address by 25334doing both of the following: 25335@itemize 25336@item 25337Returning the new address in register @code{$31}. 25338@item 25339Storing the new address in @code{*@var{ra-address}}, 25340if @var{ra-address} is nonnull. 25341@end itemize 25342 25343The default is @option{-mno-mcount-ra-address}. 25344 25345@item -mframe-header-opt 25346@itemx -mno-frame-header-opt 25347@opindex mframe-header-opt 25348Enable (disable) frame header optimization in the o32 ABI. When using the 25349o32 ABI, calling functions will allocate 16 bytes on the stack for the called 25350function to write out register arguments. When enabled, this optimization 25351will suppress the allocation of the frame header if it can be determined that 25352it is unused. 25353 25354This optimization is off by default at all optimization levels. 25355 25356@item -mlxc1-sxc1 25357@itemx -mno-lxc1-sxc1 25358@opindex mlxc1-sxc1 25359When applicable, enable (disable) the generation of @code{lwxc1}, 25360@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default. 25361 25362@item -mmadd4 25363@itemx -mno-madd4 25364@opindex mmadd4 25365When applicable, enable (disable) the generation of 4-operand @code{madd.s}, 25366@code{madd.d} and related instructions. Enabled by default. 25367 25368@end table 25369 25370@node MMIX Options 25371@subsection MMIX Options 25372@cindex MMIX Options 25373 25374These options are defined for the MMIX: 25375 25376@table @gcctabopt 25377@item -mlibfuncs 25378@itemx -mno-libfuncs 25379@opindex mlibfuncs 25380@opindex mno-libfuncs 25381Specify that intrinsic library functions are being compiled, passing all 25382values in registers, no matter the size. 25383 25384@item -mepsilon 25385@itemx -mno-epsilon 25386@opindex mepsilon 25387@opindex mno-epsilon 25388Generate floating-point comparison instructions that compare with respect 25389to the @code{rE} epsilon register. 25390 25391@item -mabi=mmixware 25392@itemx -mabi=gnu 25393@opindex mabi=mmixware 25394@opindex mabi=gnu 25395Generate code that passes function parameters and return values that (in 25396the called function) are seen as registers @code{$0} and up, as opposed to 25397the GNU ABI which uses global registers @code{$231} and up. 25398 25399@item -mzero-extend 25400@itemx -mno-zero-extend 25401@opindex mzero-extend 25402@opindex mno-zero-extend 25403When reading data from memory in sizes shorter than 64 bits, use (do not 25404use) zero-extending load instructions by default, rather than 25405sign-extending ones. 25406 25407@item -mknuthdiv 25408@itemx -mno-knuthdiv 25409@opindex mknuthdiv 25410@opindex mno-knuthdiv 25411Make the result of a division yielding a remainder have the same sign as 25412the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 25413remainder follows the sign of the dividend. Both methods are 25414arithmetically valid, the latter being almost exclusively used. 25415 25416@item -mtoplevel-symbols 25417@itemx -mno-toplevel-symbols 25418@opindex mtoplevel-symbols 25419@opindex mno-toplevel-symbols 25420Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 25421code can be used with the @code{PREFIX} assembly directive. 25422 25423@item -melf 25424@opindex melf 25425Generate an executable in the ELF format, rather than the default 25426@samp{mmo} format used by the @command{mmix} simulator. 25427 25428@item -mbranch-predict 25429@itemx -mno-branch-predict 25430@opindex mbranch-predict 25431@opindex mno-branch-predict 25432Use (do not use) the probable-branch instructions, when static branch 25433prediction indicates a probable branch. 25434 25435@item -mbase-addresses 25436@itemx -mno-base-addresses 25437@opindex mbase-addresses 25438@opindex mno-base-addresses 25439Generate (do not generate) code that uses @emph{base addresses}. Using a 25440base address automatically generates a request (handled by the assembler 25441and the linker) for a constant to be set up in a global register. The 25442register is used for one or more base address requests within the range 0 25443to 255 from the value held in the register. The generally leads to short 25444and fast code, but the number of different data items that can be 25445addressed is limited. This means that a program that uses lots of static 25446data may require @option{-mno-base-addresses}. 25447 25448@item -msingle-exit 25449@itemx -mno-single-exit 25450@opindex msingle-exit 25451@opindex mno-single-exit 25452Force (do not force) generated code to have a single exit point in each 25453function. 25454@end table 25455 25456@node MN10300 Options 25457@subsection MN10300 Options 25458@cindex MN10300 options 25459 25460These @option{-m} options are defined for Matsushita MN10300 architectures: 25461 25462@table @gcctabopt 25463@item -mmult-bug 25464@opindex mmult-bug 25465Generate code to avoid bugs in the multiply instructions for the MN10300 25466processors. This is the default. 25467 25468@item -mno-mult-bug 25469@opindex mno-mult-bug 25470Do not generate code to avoid bugs in the multiply instructions for the 25471MN10300 processors. 25472 25473@item -mam33 25474@opindex mam33 25475Generate code using features specific to the AM33 processor. 25476 25477@item -mno-am33 25478@opindex mno-am33 25479Do not generate code using features specific to the AM33 processor. This 25480is the default. 25481 25482@item -mam33-2 25483@opindex mam33-2 25484Generate code using features specific to the AM33/2.0 processor. 25485 25486@item -mam34 25487@opindex mam34 25488Generate code using features specific to the AM34 processor. 25489 25490@item -mtune=@var{cpu-type} 25491@opindex mtune 25492Use the timing characteristics of the indicated CPU type when 25493scheduling instructions. This does not change the targeted processor 25494type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 25495@samp{am33-2} or @samp{am34}. 25496 25497@item -mreturn-pointer-on-d0 25498@opindex mreturn-pointer-on-d0 25499When generating a function that returns a pointer, return the pointer 25500in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 25501only in @code{a0}, and attempts to call such functions without a prototype 25502result in errors. Note that this option is on by default; use 25503@option{-mno-return-pointer-on-d0} to disable it. 25504 25505@item -mno-crt0 25506@opindex mno-crt0 25507Do not link in the C run-time initialization object file. 25508 25509@item -mrelax 25510@opindex mrelax 25511Indicate to the linker that it should perform a relaxation optimization pass 25512to shorten branches, calls and absolute memory addresses. This option only 25513has an effect when used on the command line for the final link step. 25514 25515This option makes symbolic debugging impossible. 25516 25517@item -mliw 25518@opindex mliw 25519Allow the compiler to generate @emph{Long Instruction Word} 25520instructions if the target is the @samp{AM33} or later. This is the 25521default. This option defines the preprocessor macro @code{__LIW__}. 25522 25523@item -mno-liw 25524@opindex mno-liw 25525Do not allow the compiler to generate @emph{Long Instruction Word} 25526instructions. This option defines the preprocessor macro 25527@code{__NO_LIW__}. 25528 25529@item -msetlb 25530@opindex msetlb 25531Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 25532instructions if the target is the @samp{AM33} or later. This is the 25533default. This option defines the preprocessor macro @code{__SETLB__}. 25534 25535@item -mno-setlb 25536@opindex mno-setlb 25537Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 25538instructions. This option defines the preprocessor macro 25539@code{__NO_SETLB__}. 25540 25541@end table 25542 25543@node Moxie Options 25544@subsection Moxie Options 25545@cindex Moxie Options 25546 25547@table @gcctabopt 25548 25549@item -meb 25550@opindex meb 25551Generate big-endian code. This is the default for @samp{moxie-*-*} 25552configurations. 25553 25554@item -mel 25555@opindex mel 25556Generate little-endian code. 25557 25558@item -mmul.x 25559@opindex mmul.x 25560Generate mul.x and umul.x instructions. This is the default for 25561@samp{moxiebox-*-*} configurations. 25562 25563@item -mno-crt0 25564@opindex mno-crt0 25565Do not link in the C run-time initialization object file. 25566 25567@end table 25568 25569@node MSP430 Options 25570@subsection MSP430 Options 25571@cindex MSP430 Options 25572 25573These options are defined for the MSP430: 25574 25575@table @gcctabopt 25576 25577@item -masm-hex 25578@opindex masm-hex 25579Force assembly output to always use hex constants. Normally such 25580constants are signed decimals, but this option is available for 25581testsuite and/or aesthetic purposes. 25582 25583@item -mmcu= 25584@opindex mmcu= 25585Select the MCU to target. This is used to create a C preprocessor 25586symbol based upon the MCU name, converted to upper case and pre- and 25587post-fixed with @samp{__}. This in turn is used by the 25588@file{msp430.h} header file to select an MCU-specific supplementary 25589header file. 25590 25591The option also sets the ISA to use. If the MCU name is one that is 25592known to only support the 430 ISA then that is selected, otherwise the 25593430X ISA is selected. A generic MCU name of @samp{msp430} can also be 25594used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 25595name selects the 430X ISA. 25596 25597In addition an MCU-specific linker script is added to the linker 25598command line. The script's name is the name of the MCU with 25599@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 25600command line defines the C preprocessor symbol @code{__XXX__} and 25601cause the linker to search for a script called @file{xxx.ld}. 25602 25603The ISA and hardware multiply supported for the different MCUs is hard-coded 25604into GCC. However, an external @samp{devices.csv} file can be used to 25605extend device support beyond those that have been hard-coded. 25606 25607GCC searches for the @samp{devices.csv} file using the following methods in the 25608given precedence order, where the first method takes precendence over the 25609second which takes precedence over the third. 25610 25611@table @asis 25612@item Include path specified with @code{-I} and @code{-L} 25613@samp{devices.csv} will be searched for in each of the directories specified by 25614include paths and linker library search paths. 25615@item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR} 25616Define the value of the global environment variable 25617@samp{MSP430_GCC_INCLUDE_DIR} 25618to the full path to the directory containing devices.csv, and GCC will search 25619this directory for devices.csv. If devices.csv is found, this directory will 25620also be registered as an include path, and linker library path. Header files 25621and linker scripts in this directory can therefore be used without manually 25622specifying @code{-I} and @code{-L} on the command line. 25623@item The @samp{msp430-elf@{,bare@}/include/devices} directory 25624Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the 25625toolchain root directory. This directory does not exist in a default 25626installation, but if the user has created it and copied @samp{devices.csv} 25627there, then the MCU data will be read. As above, this directory will 25628also be registered as an include path, and linker library path. 25629 25630@end table 25631If none of the above search methods find @samp{devices.csv}, then the 25632hard-coded MCU data is used. 25633 25634 25635@item -mwarn-mcu 25636@itemx -mno-warn-mcu 25637@opindex mwarn-mcu 25638@opindex mno-warn-mcu 25639This option enables or disables warnings about conflicts between the 25640MCU name specified by the @option{-mmcu} option and the ISA set by the 25641@option{-mcpu} option and/or the hardware multiply support set by the 25642@option{-mhwmult} option. It also toggles warnings about unrecognized 25643MCU names. This option is on by default. 25644 25645@item -mcpu= 25646@opindex mcpu= 25647Specifies the ISA to use. Accepted values are @samp{msp430}, 25648@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 25649@option{-mmcu=} option should be used to select the ISA. 25650 25651@item -msim 25652@opindex msim 25653Link to the simulator runtime libraries and linker script. Overrides 25654any scripts that would be selected by the @option{-mmcu=} option. 25655 25656@item -mlarge 25657@opindex mlarge 25658Use large-model addressing (20-bit pointers, 20-bit @code{size_t}). 25659 25660@item -msmall 25661@opindex msmall 25662Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 25663 25664@item -mrelax 25665@opindex mrelax 25666This option is passed to the assembler and linker, and allows the 25667linker to perform certain optimizations that cannot be done until 25668the final link. 25669 25670@item mhwmult= 25671@opindex mhwmult= 25672Describes the type of hardware multiply supported by the target. 25673Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 25674for the original 16-bit-only multiply supported by early MCUs. 25675@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 25676@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 25677A value of @samp{auto} can also be given. This tells GCC to deduce 25678the hardware multiply support based upon the MCU name provided by the 25679@option{-mmcu} option. If no @option{-mmcu} option is specified or if 25680the MCU name is not recognized then no hardware multiply support is 25681assumed. @code{auto} is the default setting. 25682 25683Hardware multiplies are normally performed by calling a library 25684routine. This saves space in the generated code. When compiling at 25685@option{-O3} or higher however the hardware multiplier is invoked 25686inline. This makes for bigger, but faster code. 25687 25688The hardware multiply routines disable interrupts whilst running and 25689restore the previous interrupt state when they finish. This makes 25690them safe to use inside interrupt handlers as well as in normal code. 25691 25692@item -minrt 25693@opindex minrt 25694Enable the use of a minimum runtime environment - no static 25695initializers or constructors. This is intended for memory-constrained 25696devices. The compiler includes special symbols in some objects 25697that tell the linker and runtime which code fragments are required. 25698 25699@item -mtiny-printf 25700@opindex mtiny-printf 25701Enable reduced code size @code{printf} and @code{puts} library functions. 25702The @samp{tiny} implementations of these functions are not reentrant, so 25703must be used with caution in multi-threaded applications. 25704 25705Support for streams has been removed and the string to be printed will 25706always be sent to stdout via the @code{write} syscall. The string is not 25707buffered before it is sent to write. 25708 25709This option requires Newlib Nano IO, so GCC must be configured with 25710@samp{--enable-newlib-nano-formatted-io}. 25711 25712@item -mmax-inline-shift= 25713@opindex mmax-inline-shift= 25714This option takes an integer between 0 and 64 inclusive, and sets 25715the maximum number of inline shift instructions which should be emitted to 25716perform a shift operation by a constant amount. When this value needs to be 25717exceeded, an mspabi helper function is used instead. The default value is 4. 25718 25719This only affects cases where a shift by multiple positions cannot be 25720completed with a single instruction (e.g. all shifts >1 on the 430 ISA). 25721 25722Shifts of a 32-bit value are at least twice as costly, so the value passed for 25723this option is divided by 2 and the resulting value used instead. 25724 25725@item -mcode-region= 25726@itemx -mdata-region= 25727@opindex mcode-region 25728@opindex mdata-region 25729These options tell the compiler where to place functions and data that 25730do not have one of the @code{lower}, @code{upper}, @code{either} or 25731@code{section} attributes. Possible values are @code{lower}, 25732@code{upper}, @code{either} or @code{any}. The first three behave 25733like the corresponding attribute. The fourth possible value - 25734@code{any} - is the default. It leaves placement entirely up to the 25735linker script and how it assigns the standard sections 25736(@code{.text}, @code{.data}, etc) to the memory regions. 25737 25738@item -msilicon-errata= 25739@opindex msilicon-errata 25740This option passes on a request to assembler to enable the fixes for 25741the named silicon errata. 25742 25743@item -msilicon-errata-warn= 25744@opindex msilicon-errata-warn 25745This option passes on a request to the assembler to enable warning 25746messages when a silicon errata might need to be applied. 25747 25748@item -mwarn-devices-csv 25749@itemx -mno-warn-devices-csv 25750@opindex mwarn-devices-csv 25751@opindex mno-warn-devices-csv 25752Warn if @samp{devices.csv} is not found or there are problem parsing it 25753(default: on). 25754 25755@end table 25756 25757@node NDS32 Options 25758@subsection NDS32 Options 25759@cindex NDS32 Options 25760 25761These options are defined for NDS32 implementations: 25762 25763@table @gcctabopt 25764 25765@item -mbig-endian 25766@opindex mbig-endian 25767Generate code in big-endian mode. 25768 25769@item -mlittle-endian 25770@opindex mlittle-endian 25771Generate code in little-endian mode. 25772 25773@item -mreduced-regs 25774@opindex mreduced-regs 25775Use reduced-set registers for register allocation. 25776 25777@item -mfull-regs 25778@opindex mfull-regs 25779Use full-set registers for register allocation. 25780 25781@item -mcmov 25782@opindex mcmov 25783Generate conditional move instructions. 25784 25785@item -mno-cmov 25786@opindex mno-cmov 25787Do not generate conditional move instructions. 25788 25789@item -mext-perf 25790@opindex mext-perf 25791Generate performance extension instructions. 25792 25793@item -mno-ext-perf 25794@opindex mno-ext-perf 25795Do not generate performance extension instructions. 25796 25797@item -mext-perf2 25798@opindex mext-perf2 25799Generate performance extension 2 instructions. 25800 25801@item -mno-ext-perf2 25802@opindex mno-ext-perf2 25803Do not generate performance extension 2 instructions. 25804 25805@item -mext-string 25806@opindex mext-string 25807Generate string extension instructions. 25808 25809@item -mno-ext-string 25810@opindex mno-ext-string 25811Do not generate string extension instructions. 25812 25813@item -mv3push 25814@opindex mv3push 25815Generate v3 push25/pop25 instructions. 25816 25817@item -mno-v3push 25818@opindex mno-v3push 25819Do not generate v3 push25/pop25 instructions. 25820 25821@item -m16-bit 25822@opindex m16-bit 25823Generate 16-bit instructions. 25824 25825@item -mno-16-bit 25826@opindex mno-16-bit 25827Do not generate 16-bit instructions. 25828 25829@item -misr-vector-size=@var{num} 25830@opindex misr-vector-size 25831Specify the size of each interrupt vector, which must be 4 or 16. 25832 25833@item -mcache-block-size=@var{num} 25834@opindex mcache-block-size 25835Specify the size of each cache block, 25836which must be a power of 2 between 4 and 512. 25837 25838@item -march=@var{arch} 25839@opindex march 25840Specify the name of the target architecture. 25841 25842@item -mcmodel=@var{code-model} 25843@opindex mcmodel 25844Set the code model to one of 25845@table @asis 25846@item @samp{small} 25847All the data and read-only data segments must be within 512KB addressing space. 25848The text segment must be within 16MB addressing space. 25849@item @samp{medium} 25850The data segment must be within 512KB while the read-only data segment can be 25851within 4GB addressing space. The text segment should be still within 16MB 25852addressing space. 25853@item @samp{large} 25854All the text and data segments can be within 4GB addressing space. 25855@end table 25856 25857@item -mctor-dtor 25858@opindex mctor-dtor 25859Enable constructor/destructor feature. 25860 25861@item -mrelax 25862@opindex mrelax 25863Guide linker to relax instructions. 25864 25865@end table 25866 25867@node Nios II Options 25868@subsection Nios II Options 25869@cindex Nios II options 25870@cindex Altera Nios II options 25871 25872These are the options defined for the Altera Nios II processor. 25873 25874@table @gcctabopt 25875 25876@item -G @var{num} 25877@opindex G 25878@cindex smaller data references 25879Put global and static objects less than or equal to @var{num} bytes 25880into the small data or BSS sections instead of the normal data or BSS 25881sections. The default value of @var{num} is 8. 25882 25883@item -mgpopt=@var{option} 25884@itemx -mgpopt 25885@itemx -mno-gpopt 25886@opindex mgpopt 25887@opindex mno-gpopt 25888Generate (do not generate) GP-relative accesses. The following 25889@var{option} names are recognized: 25890 25891@table @samp 25892 25893@item none 25894Do not generate GP-relative accesses. 25895 25896@item local 25897Generate GP-relative accesses for small data objects that are not 25898external, weak, or uninitialized common symbols. 25899Also use GP-relative addressing for objects that 25900have been explicitly placed in a small data section via a @code{section} 25901attribute. 25902 25903@item global 25904As for @samp{local}, but also generate GP-relative accesses for 25905small data objects that are external, weak, or common. If you use this option, 25906you must ensure that all parts of your program (including libraries) are 25907compiled with the same @option{-G} setting. 25908 25909@item data 25910Generate GP-relative accesses for all data objects in the program. If you 25911use this option, the entire data and BSS segments 25912of your program must fit in 64K of memory and you must use an appropriate 25913linker script to allocate them within the addressable range of the 25914global pointer. 25915 25916@item all 25917Generate GP-relative addresses for function pointers as well as data 25918pointers. If you use this option, the entire text, data, and BSS segments 25919of your program must fit in 64K of memory and you must use an appropriate 25920linker script to allocate them within the addressable range of the 25921global pointer. 25922 25923@end table 25924 25925@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 25926@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 25927 25928The default is @option{-mgpopt} except when @option{-fpic} or 25929@option{-fPIC} is specified to generate position-independent code. 25930Note that the Nios II ABI does not permit GP-relative accesses from 25931shared libraries. 25932 25933You may need to specify @option{-mno-gpopt} explicitly when building 25934programs that include large amounts of small data, including large 25935GOT data sections. In this case, the 16-bit offset for GP-relative 25936addressing may not be large enough to allow access to the entire 25937small data section. 25938 25939@item -mgprel-sec=@var{regexp} 25940@opindex mgprel-sec 25941This option specifies additional section names that can be accessed via 25942GP-relative addressing. It is most useful in conjunction with 25943@code{section} attributes on variable declarations 25944(@pxref{Common Variable Attributes}) and a custom linker script. 25945The @var{regexp} is a POSIX Extended Regular Expression. 25946 25947This option does not affect the behavior of the @option{-G} option, and 25948the specified sections are in addition to the standard @code{.sdata} 25949and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}. 25950 25951@item -mr0rel-sec=@var{regexp} 25952@opindex mr0rel-sec 25953This option specifies names of sections that can be accessed via a 2595416-bit offset from @code{r0}; that is, in the low 32K or high 32K 25955of the 32-bit address space. It is most useful in conjunction with 25956@code{section} attributes on variable declarations 25957(@pxref{Common Variable Attributes}) and a custom linker script. 25958The @var{regexp} is a POSIX Extended Regular Expression. 25959 25960In contrast to the use of GP-relative addressing for small data, 25961zero-based addressing is never generated by default and there are no 25962conventional section names used in standard linker scripts for sections 25963in the low or high areas of memory. 25964 25965@item -mel 25966@itemx -meb 25967@opindex mel 25968@opindex meb 25969Generate little-endian (default) or big-endian (experimental) code, 25970respectively. 25971 25972@item -march=@var{arch} 25973@opindex march 25974This specifies the name of the target Nios II architecture. GCC uses this 25975name to determine what kind of instructions it can emit when generating 25976assembly code. Permissible names are: @samp{r1}, @samp{r2}. 25977 25978The preprocessor macro @code{__nios2_arch__} is available to programs, 25979with value 1 or 2, indicating the targeted ISA level. 25980 25981@item -mbypass-cache 25982@itemx -mno-bypass-cache 25983@opindex mno-bypass-cache 25984@opindex mbypass-cache 25985Force all load and store instructions to always bypass cache by 25986using I/O variants of the instructions. The default is not to 25987bypass the cache. 25988 25989@item -mno-cache-volatile 25990@itemx -mcache-volatile 25991@opindex mcache-volatile 25992@opindex mno-cache-volatile 25993Volatile memory access bypass the cache using the I/O variants of 25994the load and store instructions. The default is not to bypass the cache. 25995 25996@item -mno-fast-sw-div 25997@itemx -mfast-sw-div 25998@opindex mno-fast-sw-div 25999@opindex mfast-sw-div 26000Do not use table-based fast divide for small numbers. The default 26001is to use the fast divide at @option{-O3} and above. 26002 26003@item -mno-hw-mul 26004@itemx -mhw-mul 26005@itemx -mno-hw-mulx 26006@itemx -mhw-mulx 26007@itemx -mno-hw-div 26008@itemx -mhw-div 26009@opindex mno-hw-mul 26010@opindex mhw-mul 26011@opindex mno-hw-mulx 26012@opindex mhw-mulx 26013@opindex mno-hw-div 26014@opindex mhw-div 26015Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 26016instructions by the compiler. The default is to emit @code{mul} 26017and not emit @code{div} and @code{mulx}. 26018 26019@item -mbmx 26020@itemx -mno-bmx 26021@itemx -mcdx 26022@itemx -mno-cdx 26023Enable or disable generation of Nios II R2 BMX (bit manipulation) and 26024CDX (code density) instructions. Enabling these instructions also 26025requires @option{-march=r2}. Since these instructions are optional 26026extensions to the R2 architecture, the default is not to emit them. 26027 26028@item -mcustom-@var{insn}=@var{N} 26029@itemx -mno-custom-@var{insn} 26030@opindex mcustom-@var{insn} 26031@opindex mno-custom-@var{insn} 26032Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 26033custom instruction with encoding @var{N} when generating code that uses 26034@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 26035instruction 253 for single-precision floating-point add operations instead 26036of the default behavior of using a library call. 26037 26038The following values of @var{insn} are supported. Except as otherwise 26039noted, floating-point operations are expected to be implemented with 26040normal IEEE 754 semantics and correspond directly to the C operators or the 26041equivalent GCC built-in functions (@pxref{Other Builtins}). 26042 26043Single-precision floating point: 26044@table @asis 26045 26046@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 26047Binary arithmetic operations. 26048 26049@item @samp{fnegs} 26050Unary negation. 26051 26052@item @samp{fabss} 26053Unary absolute value. 26054 26055@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 26056Comparison operations. 26057 26058@item @samp{fmins}, @samp{fmaxs} 26059Floating-point minimum and maximum. These instructions are only 26060generated if @option{-ffinite-math-only} is specified. 26061 26062@item @samp{fsqrts} 26063Unary square root operation. 26064 26065@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 26066Floating-point trigonometric and exponential functions. These instructions 26067are only generated if @option{-funsafe-math-optimizations} is also specified. 26068 26069@end table 26070 26071Double-precision floating point: 26072@table @asis 26073 26074@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 26075Binary arithmetic operations. 26076 26077@item @samp{fnegd} 26078Unary negation. 26079 26080@item @samp{fabsd} 26081Unary absolute value. 26082 26083@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 26084Comparison operations. 26085 26086@item @samp{fmind}, @samp{fmaxd} 26087Double-precision minimum and maximum. These instructions are only 26088generated if @option{-ffinite-math-only} is specified. 26089 26090@item @samp{fsqrtd} 26091Unary square root operation. 26092 26093@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 26094Double-precision trigonometric and exponential functions. These instructions 26095are only generated if @option{-funsafe-math-optimizations} is also specified. 26096 26097@end table 26098 26099Conversions: 26100@table @asis 26101@item @samp{fextsd} 26102Conversion from single precision to double precision. 26103 26104@item @samp{ftruncds} 26105Conversion from double precision to single precision. 26106 26107@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 26108Conversion from floating point to signed or unsigned integer types, with 26109truncation towards zero. 26110 26111@item @samp{round} 26112Conversion from single-precision floating point to signed integer, 26113rounding to the nearest integer and ties away from zero. 26114This corresponds to the @code{__builtin_lroundf} function when 26115@option{-fno-math-errno} is used. 26116 26117@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 26118Conversion from signed or unsigned integer types to floating-point types. 26119 26120@end table 26121 26122In addition, all of the following transfer instructions for internal 26123registers X and Y must be provided to use any of the double-precision 26124floating-point instructions. Custom instructions taking two 26125double-precision source operands expect the first operand in the 2612664-bit register X. The other operand (or only operand of a unary 26127operation) is given to the custom arithmetic instruction with the 26128least significant half in source register @var{src1} and the most 26129significant half in @var{src2}. A custom instruction that returns a 26130double-precision result returns the most significant 32 bits in the 26131destination register and the other half in 32-bit register Y. 26132GCC automatically generates the necessary code sequences to write 26133register X and/or read register Y when double-precision floating-point 26134instructions are used. 26135 26136@table @asis 26137 26138@item @samp{fwrx} 26139Write @var{src1} into the least significant half of X and @var{src2} into 26140the most significant half of X. 26141 26142@item @samp{fwry} 26143Write @var{src1} into Y. 26144 26145@item @samp{frdxhi}, @samp{frdxlo} 26146Read the most or least (respectively) significant half of X and store it in 26147@var{dest}. 26148 26149@item @samp{frdy} 26150Read the value of Y and store it into @var{dest}. 26151@end table 26152 26153Note that you can gain more local control over generation of Nios II custom 26154instructions by using the @code{target("custom-@var{insn}=@var{N}")} 26155and @code{target("no-custom-@var{insn}")} function attributes 26156(@pxref{Function Attributes}) 26157or pragmas (@pxref{Function Specific Option Pragmas}). 26158 26159@item -mcustom-fpu-cfg=@var{name} 26160@opindex mcustom-fpu-cfg 26161 26162This option enables a predefined, named set of custom instruction encodings 26163(see @option{-mcustom-@var{insn}} above). 26164Currently, the following sets are defined: 26165 26166@option{-mcustom-fpu-cfg=60-1} is equivalent to: 26167@gccoptlist{-mcustom-fmuls=252 @gol 26168-mcustom-fadds=253 @gol 26169-mcustom-fsubs=254 @gol 26170-fsingle-precision-constant} 26171 26172@option{-mcustom-fpu-cfg=60-2} is equivalent to: 26173@gccoptlist{-mcustom-fmuls=252 @gol 26174-mcustom-fadds=253 @gol 26175-mcustom-fsubs=254 @gol 26176-mcustom-fdivs=255 @gol 26177-fsingle-precision-constant} 26178 26179@option{-mcustom-fpu-cfg=72-3} is equivalent to: 26180@gccoptlist{-mcustom-floatus=243 @gol 26181-mcustom-fixsi=244 @gol 26182-mcustom-floatis=245 @gol 26183-mcustom-fcmpgts=246 @gol 26184-mcustom-fcmples=249 @gol 26185-mcustom-fcmpeqs=250 @gol 26186-mcustom-fcmpnes=251 @gol 26187-mcustom-fmuls=252 @gol 26188-mcustom-fadds=253 @gol 26189-mcustom-fsubs=254 @gol 26190-mcustom-fdivs=255 @gol 26191-fsingle-precision-constant} 26192 26193@option{-mcustom-fpu-cfg=fph2} is equivalent to: 26194@gccoptlist{-mcustom-fabss=224 @gol 26195-mcustom-fnegs=225 @gol 26196-mcustom-fcmpnes=226 @gol 26197-mcustom-fcmpeqs=227 @gol 26198-mcustom-fcmpges=228 @gol 26199-mcustom-fcmpgts=229 @gol 26200-mcustom-fcmples=230 @gol 26201-mcustom-fcmplts=231 @gol 26202-mcustom-fmaxs=232 @gol 26203-mcustom-fmins=233 @gol 26204-mcustom-round=248 @gol 26205-mcustom-fixsi=249 @gol 26206-mcustom-floatis=250 @gol 26207-mcustom-fsqrts=251 @gol 26208-mcustom-fmuls=252 @gol 26209-mcustom-fadds=253 @gol 26210-mcustom-fsubs=254 @gol 26211-mcustom-fdivs=255 @gol} 26212 26213Custom instruction assignments given by individual 26214@option{-mcustom-@var{insn}=} options override those given by 26215@option{-mcustom-fpu-cfg=}, regardless of the 26216order of the options on the command line. 26217 26218Note that you can gain more local control over selection of a FPU 26219configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 26220function attribute (@pxref{Function Attributes}) 26221or pragma (@pxref{Function Specific Option Pragmas}). 26222 26223The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point 26224Hardware 2 Component}. Please note that the custom instructions enabled by 26225@option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated 26226if @option{-ffinite-math-only} is specified. The custom instruction enabled by 26227@option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is 26228specified. In contrast to the other configurations, 26229@option{-fsingle-precision-constant} is not set. 26230 26231@end table 26232 26233These additional @samp{-m} options are available for the Altera Nios II 26234ELF (bare-metal) target: 26235 26236@table @gcctabopt 26237 26238@item -mhal 26239@opindex mhal 26240Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 26241startup and termination code, and is typically used in conjunction with 26242@option{-msys-crt0=} to specify the location of the alternate startup code 26243provided by the HAL BSP. 26244 26245@item -msmallc 26246@opindex msmallc 26247Link with a limited version of the C library, @option{-lsmallc}, rather than 26248Newlib. 26249 26250@item -msys-crt0=@var{startfile} 26251@opindex msys-crt0 26252@var{startfile} is the file name of the startfile (crt0) to use 26253when linking. This option is only useful in conjunction with @option{-mhal}. 26254 26255@item -msys-lib=@var{systemlib} 26256@opindex msys-lib 26257@var{systemlib} is the library name of the library that provides 26258low-level system calls required by the C library, 26259e.g.@: @code{read} and @code{write}. 26260This option is typically used to link with a library provided by a HAL BSP. 26261 26262@end table 26263 26264@node Nvidia PTX Options 26265@subsection Nvidia PTX Options 26266@cindex Nvidia PTX options 26267@cindex nvptx options 26268 26269These options are defined for Nvidia PTX: 26270 26271@table @gcctabopt 26272 26273@item -m64 26274@opindex m64 26275Ignored, but preserved for backward compatibility. Only 64-bit ABI is 26276supported. 26277 26278@item -misa=@var{ISA-string} 26279@opindex march 26280Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA 26281strings must be lower-case. Valid ISA strings include @samp{sm_30} and 26282@samp{sm_35}. The default ISA is sm_35. 26283 26284@item -mmainkernel 26285@opindex mmainkernel 26286Link in code for a __main kernel. This is for stand-alone instead of 26287offloading execution. 26288 26289@item -moptimize 26290@opindex moptimize 26291Apply partitioned execution optimizations. This is the default when any 26292level of optimization is selected. 26293 26294@item -msoft-stack 26295@opindex msoft-stack 26296Generate code that does not use @code{.local} memory 26297directly for stack storage. Instead, a per-warp stack pointer is 26298maintained explicitly. This enables variable-length stack allocation (with 26299variable-length arrays or @code{alloca}), and when global memory is used for 26300underlying storage, makes it possible to access automatic variables from other 26301threads, or with atomic instructions. This code generation variant is used 26302for OpenMP offloading, but the option is exposed on its own for the purpose 26303of testing the compiler; to generate code suitable for linking into programs 26304using OpenMP offloading, use option @option{-mgomp}. 26305 26306@item -muniform-simt 26307@opindex muniform-simt 26308Switch to code generation variant that allows to execute all threads in each 26309warp, while maintaining memory state and side effects as if only one thread 26310in each warp was active outside of OpenMP SIMD regions. All atomic operations 26311and calls to runtime (malloc, free, vprintf) are conditionally executed (iff 26312current lane index equals the master lane index), and the register being 26313assigned is copied via a shuffle instruction from the master lane. Outside of 26314SIMD regions lane 0 is the master; inside, each thread sees itself as the 26315master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or 26316all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD 26317regions). Each thread can bitwise-and the bitmask at position @code{tid.y} 26318with current lane index to compute the master lane index. 26319 26320@item -mgomp 26321@opindex mgomp 26322Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and 26323@option{-muniform-simt} options, and selects corresponding multilib variant. 26324 26325@end table 26326 26327@node OpenRISC Options 26328@subsection OpenRISC Options 26329@cindex OpenRISC Options 26330 26331These options are defined for OpenRISC: 26332 26333@table @gcctabopt 26334 26335@item -mboard=@var{name} 26336@opindex mboard 26337Configure a board specific runtime. This will be passed to the linker for 26338newlib board library linking. The default is @code{or1ksim}. 26339 26340@item -mnewlib 26341@opindex mnewlib 26342This option is ignored; it is for compatibility purposes only. This used to 26343select linker and preprocessor options for use with newlib. 26344 26345@item -msoft-div 26346@itemx -mhard-div 26347@opindex msoft-div 26348@opindex mhard-div 26349Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions. 26350This default is hardware divide. 26351 26352@item -msoft-mul 26353@itemx -mhard-mul 26354@opindex msoft-mul 26355@opindex mhard-mul 26356Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions. 26357This default is hardware multiply. 26358 26359@item -msoft-float 26360@itemx -mhard-float 26361@opindex msoft-float 26362@opindex mhard-float 26363Select software or hardware for floating point operations. 26364The default is software. 26365 26366@item -mdouble-float 26367@opindex mdouble-float 26368When @option{-mhard-float} is selected, enables generation of double-precision 26369floating point instructions. By default functions from @file{libgcc} are used 26370to perform double-precision floating point operations. 26371 26372@item -munordered-float 26373@opindex munordered-float 26374When @option{-mhard-float} is selected, enables generation of unordered 26375floating point compare and set flag (@code{lf.sfun*}) instructions. By default 26376functions from @file{libgcc} are used to perform unordered floating point 26377compare and set flag operations. 26378 26379@item -mcmov 26380@opindex mcmov 26381Enable generation of conditional move (@code{l.cmov}) instructions. By 26382default the equivalent will be generated using set and branch. 26383 26384@item -mror 26385@opindex mror 26386Enable generation of rotate right (@code{l.ror}) instructions. By default 26387functions from @file{libgcc} are used to perform rotate right operations. 26388 26389@item -mrori 26390@opindex mrori 26391Enable generation of rotate right with immediate (@code{l.rori}) instructions. 26392By default functions from @file{libgcc} are used to perform rotate right with 26393immediate operations. 26394 26395@item -msext 26396@opindex msext 26397Enable generation of sign extension (@code{l.ext*}) instructions. By default 26398memory loads are used to perform sign extension. 26399 26400@item -msfimm 26401@opindex msfimm 26402Enable generation of compare and set flag with immediate (@code{l.sf*i}) 26403instructions. By default extra instructions will be generated to store the 26404immediate to a register first. 26405 26406@item -mshftimm 26407@opindex mshftimm 26408Enable generation of shift with immediate (@code{l.srai}, @code{l.srli}, 26409@code{l.slli}) instructions. By default extra instructions will be generated 26410to store the immediate to a register first. 26411 26412 26413@end table 26414 26415@node PDP-11 Options 26416@subsection PDP-11 Options 26417@cindex PDP-11 Options 26418 26419These options are defined for the PDP-11: 26420 26421@table @gcctabopt 26422@item -mfpu 26423@opindex mfpu 26424Use hardware FPP floating point. This is the default. (FIS floating 26425point on the PDP-11/40 is not supported.) Implies -m45. 26426 26427@item -msoft-float 26428@opindex msoft-float 26429Do not use hardware floating point. 26430 26431@item -mac0 26432@opindex mac0 26433Return floating-point results in ac0 (fr0 in Unix assembler syntax). 26434 26435@item -mno-ac0 26436@opindex mno-ac0 26437Return floating-point results in memory. This is the default. 26438 26439@item -m40 26440@opindex m40 26441Generate code for a PDP-11/40. Implies -msoft-float -mno-split. 26442 26443@item -m45 26444@opindex m45 26445Generate code for a PDP-11/45. This is the default. 26446 26447@item -m10 26448@opindex m10 26449Generate code for a PDP-11/10. Implies -msoft-float -mno-split. 26450 26451@item -mint16 26452@itemx -mno-int32 26453@opindex mint16 26454@opindex mno-int32 26455Use 16-bit @code{int}. This is the default. 26456 26457@item -mint32 26458@itemx -mno-int16 26459@opindex mint32 26460@opindex mno-int16 26461Use 32-bit @code{int}. 26462 26463@item -msplit 26464@opindex msplit 26465Target has split instruction and data space. Implies -m45. 26466 26467@item -munix-asm 26468@opindex munix-asm 26469Use Unix assembler syntax. 26470 26471@item -mdec-asm 26472@opindex mdec-asm 26473Use DEC assembler syntax. 26474 26475@item -mgnu-asm 26476@opindex mgnu-asm 26477Use GNU assembler syntax. This is the default. 26478 26479@item -mlra 26480@opindex mlra 26481Use the new LRA register allocator. By default, the old ``reload'' 26482allocator is used. 26483@end table 26484 26485@node picoChip Options 26486@subsection picoChip Options 26487@cindex picoChip options 26488 26489These @samp{-m} options are defined for picoChip implementations: 26490 26491@table @gcctabopt 26492 26493@item -mae=@var{ae_type} 26494@opindex mcpu 26495Set the instruction set, register set, and instruction scheduling 26496parameters for array element type @var{ae_type}. Supported values 26497for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 26498 26499@option{-mae=ANY} selects a completely generic AE type. Code 26500generated with this option runs on any of the other AE types. The 26501code is not as efficient as it would be if compiled for a specific 26502AE type, and some types of operation (e.g., multiplication) do not 26503work properly on all types of AE. 26504 26505@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 26506for compiled code, and is the default. 26507 26508@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 26509option may suffer from poor performance of byte (char) manipulation, 26510since the DSP AE does not provide hardware support for byte load/stores. 26511 26512@item -msymbol-as-address 26513Enable the compiler to directly use a symbol name as an address in a 26514load/store instruction, without first loading it into a 26515register. Typically, the use of this option generates larger 26516programs, which run faster than when the option isn't used. However, the 26517results vary from program to program, so it is left as a user option, 26518rather than being permanently enabled. 26519 26520@item -mno-inefficient-warnings 26521Disables warnings about the generation of inefficient code. These 26522warnings can be generated, for example, when compiling code that 26523performs byte-level memory operations on the MAC AE type. The MAC AE has 26524no hardware support for byte-level memory operations, so all byte 26525load/stores must be synthesized from word load/store operations. This is 26526inefficient and a warning is generated to indicate 26527that you should rewrite the code to avoid byte operations, or to target 26528an AE type that has the necessary hardware support. This option disables 26529these warnings. 26530 26531@end table 26532 26533@node PowerPC Options 26534@subsection PowerPC Options 26535@cindex PowerPC options 26536 26537These are listed under @xref{RS/6000 and PowerPC Options}. 26538 26539@node PRU Options 26540@subsection PRU Options 26541@cindex PRU Options 26542 26543These command-line options are defined for PRU target: 26544 26545@table @gcctabopt 26546@item -minrt 26547@opindex minrt 26548Link with a minimum runtime environment, with no support for static 26549initializers and constructors. Using this option can significantly reduce 26550the size of the final ELF binary. Beware that the compiler could still 26551generate code with static initializers and constructors. It is up to the 26552programmer to ensure that the source program will not use those features. 26553 26554@item -mmcu=@var{mcu} 26555@opindex mmcu 26556Specify the PRU MCU variant to use. Check Newlib for the exact list of 26557supported MCUs. 26558 26559@item -mno-relax 26560@opindex mno-relax 26561Make GCC pass the @option{--no-relax} command-line option to the linker 26562instead of the @option{--relax} option. 26563 26564@item -mloop 26565@opindex mloop 26566Allow (or do not allow) GCC to use the LOOP instruction. 26567 26568@item -mabi=@var{variant} 26569@opindex mabi 26570Specify the ABI variant to output code for. @option{-mabi=ti} selects the 26571unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes 26572more naturally with certain GCC assumptions. These are the differences: 26573 26574@table @samp 26575@item Function Pointer Size 26576TI ABI specifies that function (code) pointers are 16-bit, whereas GNU 26577supports only 32-bit data and code pointers. 26578 26579@item Optional Return Value Pointer 26580Function return values larger than 64 bits are passed by using a hidden 26581pointer as the first argument of the function. TI ABI, though, mandates that 26582the pointer can be NULL in case the caller is not using the returned value. 26583GNU always passes and expects a valid return value pointer. 26584 26585@end table 26586 26587The current @option{-mabi=ti} implementation simply raises a compile error 26588when any of the above code constructs is detected. As a consequence 26589the standard C library cannot be built and it is omitted when linking with 26590@option{-mabi=ti}. 26591 26592Relaxation is a GNU feature and for safety reasons is disabled when using 26593@option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx 26594instructions, so the GNU linker cannot adjust them when shortening adjacent 26595LDI32 pseudo instructions. 26596 26597@end table 26598 26599@node RISC-V Options 26600@subsection RISC-V Options 26601@cindex RISC-V Options 26602 26603These command-line options are defined for RISC-V targets: 26604 26605@table @gcctabopt 26606@item -mbranch-cost=@var{n} 26607@opindex mbranch-cost 26608Set the cost of branches to roughly @var{n} instructions. 26609 26610@item -mplt 26611@itemx -mno-plt 26612@opindex plt 26613When generating PIC code, do or don't allow the use of PLTs. Ignored for 26614non-PIC. The default is @option{-mplt}. 26615 26616@item -mabi=@var{ABI-string} 26617@opindex mabi 26618Specify integer and floating-point calling convention. @var{ABI-string} 26619contains two parts: the size of integer types and the registers used for 26620floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that 26621@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be 2662232-bit), and that floating-point values up to 64 bits wide are passed in F 26623registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still 26624allows the compiler to generate code that uses the F and D extensions but only 26625allows floating-point values up to 32 bits long to be passed in registers; or 26626@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be 26627passed in registers. 26628 26629The default for this argument is system dependent, users who want a specific 26630calling convention should specify one explicitly. The valid calling 26631conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64}, 26632@samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to 26633implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is 26634invalid because the ABI requires 64-bit values be passed in F registers, but F 26635registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can 26636only be used with the @samp{rv32e} architecture. This ABI is not well 26637specified at present, and is subject to change. 26638 26639@item -mfdiv 26640@itemx -mno-fdiv 26641@opindex mfdiv 26642Do or don't use hardware floating-point divide and square root instructions. 26643This requires the F or D extensions for floating-point registers. The default 26644is to use them if the specified architecture has these instructions. 26645 26646@item -mdiv 26647@itemx -mno-div 26648@opindex mdiv 26649Do or don't use hardware instructions for integer division. This requires the 26650M extension. The default is to use them if the specified architecture has 26651these instructions. 26652 26653@item -march=@var{ISA-string} 26654@opindex march 26655Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be 26656lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and 26657@samp{rv32imaf}. 26658 26659When @option{-march=} is not specified, use the setting from @option{-mcpu}. 26660 26661If both @option{-march} and @option{-mcpu=} are not specified, the default for 26662this argument is system dependent, users who want a specific architecture 26663extensions should specify one explicitly. 26664 26665@item -mcpu=@var{processor-string} 26666@opindex mcpu 26667Use architecture of and optimize the output for the given processor, specified 26668by particular CPU name. 26669Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21}, 26670@samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76}, 26671@samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76}, 26672@samp{sifive-u54}, and @samp{sifive-u74}. 26673 26674@item -mtune=@var{processor-string} 26675@opindex mtune 26676Optimize the output for the given processor, specified by microarchitecture or 26677particular CPU name. Permissible values for this option are: @samp{rocket}, 26678@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series}, 26679@samp{size}, and all valid options for @option{-mcpu=}. 26680 26681When @option{-mtune=} is not specified, use the setting from @option{-mcpu}, 26682the default is @samp{rocket} if both are not specified. 26683 26684The @samp{size} choice is not intended for use by end-users. This is used 26685when @option{-Os} is specified. It overrides the instruction cost info 26686provided by @option{-mtune=}, but does not override the pipeline info. This 26687helps reduce code size while still giving good performance. 26688 26689@item -mpreferred-stack-boundary=@var{num} 26690@opindex mpreferred-stack-boundary 26691Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 26692byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 26693the default is 4 (16 bytes or 128-bits). 26694 26695@strong{Warning:} If you use this switch, then you must build all modules with 26696the same value, including any libraries. This includes the system libraries 26697and startup modules. 26698 26699@item -msmall-data-limit=@var{n} 26700@opindex msmall-data-limit 26701Put global and static data smaller than @var{n} bytes into a special section 26702(on some targets). 26703 26704@item -msave-restore 26705@itemx -mno-save-restore 26706@opindex msave-restore 26707Do or don't use smaller but slower prologue and epilogue code that uses 26708library function calls. The default is to use fast inline prologues and 26709epilogues. 26710 26711@item -mshorten-memrefs 26712@itemx -mno-shorten-memrefs 26713@opindex mshorten-memrefs 26714Do or do not attempt to make more use of compressed load/store instructions by 26715replacing a load/store of 'base register + large offset' with a new load/store 26716of 'new base + small offset'. If the new base gets stored in a compressed 26717register, then the new load/store can be compressed. Currently targets 32-bit 26718integer load/stores only. 26719 26720@item -mstrict-align 26721@itemx -mno-strict-align 26722@opindex mstrict-align 26723Do not or do generate unaligned memory accesses. The default is set depending 26724on whether the processor we are optimizing for supports fast unaligned access 26725or not. 26726 26727@item -mcmodel=medlow 26728@opindex mcmodel=medlow 26729Generate code for the medium-low code model. The program and its statically 26730defined symbols must lie within a single 2 GiB address range and must lie 26731between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be 26732statically or dynamically linked. This is the default code model. 26733 26734@item -mcmodel=medany 26735@opindex mcmodel=medany 26736Generate code for the medium-any code model. The program and its statically 26737defined symbols must be within any single 2 GiB address range. Programs can be 26738statically or dynamically linked. 26739 26740@item -mexplicit-relocs 26741@itemx -mno-exlicit-relocs 26742Use or do not use assembler relocation operators when dealing with symbolic 26743addresses. The alternative is to use assembler macros instead, which may 26744limit optimization. 26745 26746@item -mrelax 26747@itemx -mno-relax 26748Take advantage of linker relaxations to reduce the number of instructions 26749required to materialize symbol addresses. The default is to take advantage of 26750linker relaxations. 26751 26752@item -memit-attribute 26753@itemx -mno-emit-attribute 26754Emit (do not emit) RISC-V attribute to record extra information into ELF 26755objects. This feature requires at least binutils 2.32. 26756 26757@item -malign-data=@var{type} 26758@opindex malign-data 26759Control how GCC aligns variables and constants of array, structure, or union 26760types. Supported values for @var{type} are @samp{xlen} which uses x register 26761width as the alignment value, and @samp{natural} which uses natural alignment. 26762@samp{xlen} is the default. 26763 26764@item -mbig-endian 26765@opindex mbig-endian 26766Generate big-endian code. This is the default when GCC is configured for a 26767@samp{riscv64be-*-*} or @samp{riscv32be-*-*} target. 26768 26769@item -mlittle-endian 26770@opindex mlittle-endian 26771Generate little-endian code. This is the default when GCC is configured for a 26772@samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or 26773@samp{riscv32be-*-*} target. 26774 26775@item -mstack-protector-guard=@var{guard} 26776@itemx -mstack-protector-guard-reg=@var{reg} 26777@itemx -mstack-protector-guard-offset=@var{offset} 26778@opindex mstack-protector-guard 26779@opindex mstack-protector-guard-reg 26780@opindex mstack-protector-guard-offset 26781Generate stack protection code using canary at @var{guard}. Supported 26782locations are @samp{global} for a global canary or @samp{tls} for per-thread 26783canary in the TLS block. 26784 26785With the latter choice the options 26786@option{-mstack-protector-guard-reg=@var{reg}} and 26787@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 26788which register to use as base register for reading the canary, 26789and from what offset from that base register. There is no default 26790register or offset as this is entirely for use within the Linux 26791kernel. 26792@end table 26793 26794@node RL78 Options 26795@subsection RL78 Options 26796@cindex RL78 Options 26797 26798@table @gcctabopt 26799 26800@item -msim 26801@opindex msim 26802Links in additional target libraries to support operation within a 26803simulator. 26804 26805@item -mmul=none 26806@itemx -mmul=g10 26807@itemx -mmul=g13 26808@itemx -mmul=g14 26809@itemx -mmul=rl78 26810@opindex mmul 26811Specifies the type of hardware multiplication and division support to 26812be used. The simplest is @code{none}, which uses software for both 26813multiplication and division. This is the default. The @code{g13} 26814value is for the hardware multiply/divide peripheral found on the 26815RL78/G13 (S2 core) targets. The @code{g14} value selects the use of 26816the multiplication and division instructions supported by the RL78/G14 26817(S3 core) parts. The value @code{rl78} is an alias for @code{g14} and 26818the value @code{mg10} is an alias for @code{none}. 26819 26820In addition a C preprocessor macro is defined, based upon the setting 26821of this option. Possible values are: @code{__RL78_MUL_NONE__}, 26822@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}. 26823 26824@item -mcpu=g10 26825@itemx -mcpu=g13 26826@itemx -mcpu=g14 26827@itemx -mcpu=rl78 26828@opindex mcpu 26829Specifies the RL78 core to target. The default is the G14 core, also 26830known as an S3 core or just RL78. The G13 or S2 core does not have 26831multiply or divide instructions, instead it uses a hardware peripheral 26832for these operations. The G10 or S1 core does not have register 26833banks, so it uses a different calling convention. 26834 26835If this option is set it also selects the type of hardware multiply 26836support to use, unless this is overridden by an explicit 26837@option{-mmul=none} option on the command line. Thus specifying 26838@option{-mcpu=g13} enables the use of the G13 hardware multiply 26839peripheral and specifying @option{-mcpu=g10} disables the use of 26840hardware multiplications altogether. 26841 26842Note, although the RL78/G14 core is the default target, specifying 26843@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does 26844change the behavior of the toolchain since it also enables G14 26845hardware multiply support. If these options are not specified on the 26846command line then software multiplication routines will be used even 26847though the code targets the RL78 core. This is for backwards 26848compatibility with older toolchains which did not have hardware 26849multiply and divide support. 26850 26851In addition a C preprocessor macro is defined, based upon the setting 26852of this option. Possible values are: @code{__RL78_G10__}, 26853@code{__RL78_G13__} or @code{__RL78_G14__}. 26854 26855@item -mg10 26856@itemx -mg13 26857@itemx -mg14 26858@itemx -mrl78 26859@opindex mg10 26860@opindex mg13 26861@opindex mg14 26862@opindex mrl78 26863These are aliases for the corresponding @option{-mcpu=} option. They 26864are provided for backwards compatibility. 26865 26866@item -mallregs 26867@opindex mallregs 26868Allow the compiler to use all of the available registers. By default 26869registers @code{r24..r31} are reserved for use in interrupt handlers. 26870With this option enabled these registers can be used in ordinary 26871functions as well. 26872 26873@item -m64bit-doubles 26874@itemx -m32bit-doubles 26875@opindex m64bit-doubles 26876@opindex m32bit-doubles 26877Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 26878or 32 bits (@option{-m32bit-doubles}) in size. The default is 26879@option{-m32bit-doubles}. 26880 26881@item -msave-mduc-in-interrupts 26882@itemx -mno-save-mduc-in-interrupts 26883@opindex msave-mduc-in-interrupts 26884@opindex mno-save-mduc-in-interrupts 26885Specifies that interrupt handler functions should preserve the 26886MDUC registers. This is only necessary if normal code might use 26887the MDUC registers, for example because it performs multiplication 26888and division operations. The default is to ignore the MDUC registers 26889as this makes the interrupt handlers faster. The target option -mg13 26890needs to be passed for this to work as this feature is only available 26891on the G13 target (S2 core). The MDUC registers will only be saved 26892if the interrupt handler performs a multiplication or division 26893operation or it calls another function. 26894 26895@end table 26896 26897@node RS/6000 and PowerPC Options 26898@subsection IBM RS/6000 and PowerPC Options 26899@cindex RS/6000 and PowerPC Options 26900@cindex IBM RS/6000 and PowerPC Options 26901 26902These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 26903@table @gcctabopt 26904@item -mpowerpc-gpopt 26905@itemx -mno-powerpc-gpopt 26906@itemx -mpowerpc-gfxopt 26907@itemx -mno-powerpc-gfxopt 26908@need 800 26909@itemx -mpowerpc64 26910@itemx -mno-powerpc64 26911@itemx -mmfcrf 26912@itemx -mno-mfcrf 26913@itemx -mpopcntb 26914@itemx -mno-popcntb 26915@itemx -mpopcntd 26916@itemx -mno-popcntd 26917@itemx -mfprnd 26918@itemx -mno-fprnd 26919@need 800 26920@itemx -mcmpb 26921@itemx -mno-cmpb 26922@itemx -mhard-dfp 26923@itemx -mno-hard-dfp 26924@opindex mpowerpc-gpopt 26925@opindex mno-powerpc-gpopt 26926@opindex mpowerpc-gfxopt 26927@opindex mno-powerpc-gfxopt 26928@opindex mpowerpc64 26929@opindex mno-powerpc64 26930@opindex mmfcrf 26931@opindex mno-mfcrf 26932@opindex mpopcntb 26933@opindex mno-popcntb 26934@opindex mpopcntd 26935@opindex mno-popcntd 26936@opindex mfprnd 26937@opindex mno-fprnd 26938@opindex mcmpb 26939@opindex mno-cmpb 26940@opindex mhard-dfp 26941@opindex mno-hard-dfp 26942You use these options to specify which instructions are available on the 26943processor you are using. The default value of these options is 26944determined when configuring GCC@. Specifying the 26945@option{-mcpu=@var{cpu_type}} overrides the specification of these 26946options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 26947rather than the options listed above. 26948 26949Specifying @option{-mpowerpc-gpopt} allows 26950GCC to use the optional PowerPC architecture instructions in the 26951General Purpose group, including floating-point square root. Specifying 26952@option{-mpowerpc-gfxopt} allows GCC to 26953use the optional PowerPC architecture instructions in the Graphics 26954group, including floating-point select. 26955 26956The @option{-mmfcrf} option allows GCC to generate the move from 26957condition register field instruction implemented on the POWER4 26958processor and other processors that support the PowerPC V2.01 26959architecture. 26960The @option{-mpopcntb} option allows GCC to generate the popcount and 26961double-precision FP reciprocal estimate instruction implemented on the 26962POWER5 processor and other processors that support the PowerPC V2.02 26963architecture. 26964The @option{-mpopcntd} option allows GCC to generate the popcount 26965instruction implemented on the POWER7 processor and other processors 26966that support the PowerPC V2.06 architecture. 26967The @option{-mfprnd} option allows GCC to generate the FP round to 26968integer instructions implemented on the POWER5+ processor and other 26969processors that support the PowerPC V2.03 architecture. 26970The @option{-mcmpb} option allows GCC to generate the compare bytes 26971instruction implemented on the POWER6 processor and other processors 26972that support the PowerPC V2.05 architecture. 26973The @option{-mhard-dfp} option allows GCC to generate the decimal 26974floating-point instructions implemented on some POWER processors. 26975 26976The @option{-mpowerpc64} option allows GCC to generate the additional 2697764-bit instructions that are found in the full PowerPC64 architecture 26978and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 26979@option{-mno-powerpc64}. 26980 26981@item -mcpu=@var{cpu_type} 26982@opindex mcpu 26983Set architecture type, register usage, and 26984instruction scheduling parameters for machine type @var{cpu_type}. 26985Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 26986@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 26987@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 26988@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 26989@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 26990@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 26991@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 26992@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 26993@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 26994@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, 26995@samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64}, 26996@samp{powerpc64le}, @samp{rs64}, and @samp{native}. 26997 26998@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 26999@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 27000endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 27001architecture machine types, with an appropriate, generic processor 27002model assumed for scheduling purposes. 27003 27004Specifying @samp{native} as cpu type detects and selects the 27005architecture option that corresponds to the host processor of the 27006system performing the compilation. 27007@option{-mcpu=native} has no effect if GCC does not recognize the 27008processor. 27009 27010The other options specify a specific processor. Code generated under 27011those options runs best on that processor, and may not run at all on 27012others. 27013 27014The @option{-mcpu} options automatically enable or disable the 27015following options: 27016 27017@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 27018-mpopcntb -mpopcntd -mpowerpc64 @gol 27019-mpowerpc-gpopt -mpowerpc-gfxopt @gol 27020-mmulhw -mdlmzb -mmfpgpr -mvsx @gol 27021-mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol 27022-mquad-memory -mquad-memory-atomic -mfloat128 @gol 27023-mfloat128-hardware -mprefixed -mpcrel -mmma @gol 27024-mrop-protect} 27025 27026The particular options set for any particular CPU varies between 27027compiler versions, depending on what setting seems to produce optimal 27028code for that CPU; it doesn't necessarily reflect the actual hardware's 27029capabilities. If you wish to set an individual option to a particular 27030value, you may specify it after the @option{-mcpu} option, like 27031@option{-mcpu=970 -mno-altivec}. 27032 27033On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 27034not enabled or disabled by the @option{-mcpu} option at present because 27035AIX does not have full support for these options. You may still 27036enable or disable them individually if you're sure it'll work in your 27037environment. 27038 27039@item -mtune=@var{cpu_type} 27040@opindex mtune 27041Set the instruction scheduling parameters for machine type 27042@var{cpu_type}, but do not set the architecture type or register usage, 27043as @option{-mcpu=@var{cpu_type}} does. The same 27044values for @var{cpu_type} are used for @option{-mtune} as for 27045@option{-mcpu}. If both are specified, the code generated uses the 27046architecture and registers set by @option{-mcpu}, but the 27047scheduling parameters set by @option{-mtune}. 27048 27049@item -mcmodel=small 27050@opindex mcmodel=small 27051Generate PowerPC64 code for the small model: The TOC is limited to 2705264k. 27053 27054@item -mcmodel=medium 27055@opindex mcmodel=medium 27056Generate PowerPC64 code for the medium model: The TOC and other static 27057data may be up to a total of 4G in size. This is the default for 64-bit 27058Linux. 27059 27060@item -mcmodel=large 27061@opindex mcmodel=large 27062Generate PowerPC64 code for the large model: The TOC may be up to 4G 27063in size. Other data and code is only limited by the 64-bit address 27064space. 27065 27066@item -maltivec 27067@itemx -mno-altivec 27068@opindex maltivec 27069@opindex mno-altivec 27070Generate code that uses (does not use) AltiVec instructions, and also 27071enable the use of built-in functions that allow more direct access to 27072the AltiVec instruction set. You may also need to set 27073@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 27074enhancements. 27075 27076When @option{-maltivec} is used, the element order for AltiVec intrinsics 27077such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 27078match array element order corresponding to the endianness of the 27079target. That is, element zero identifies the leftmost element in a 27080vector register when targeting a big-endian platform, and identifies 27081the rightmost element in a vector register when targeting a 27082little-endian platform. 27083 27084@item -mvrsave 27085@itemx -mno-vrsave 27086@opindex mvrsave 27087@opindex mno-vrsave 27088Generate VRSAVE instructions when generating AltiVec code. 27089 27090@item -msecure-plt 27091@opindex msecure-plt 27092Generate code that allows @command{ld} and @command{ld.so} 27093to build executables and shared 27094libraries with non-executable @code{.plt} and @code{.got} sections. 27095This is a PowerPC 2709632-bit SYSV ABI option. 27097 27098@item -mbss-plt 27099@opindex mbss-plt 27100Generate code that uses a BSS @code{.plt} section that @command{ld.so} 27101fills in, and 27102requires @code{.plt} and @code{.got} 27103sections that are both writable and executable. 27104This is a PowerPC 32-bit SYSV ABI option. 27105 27106@item -misel 27107@itemx -mno-isel 27108@opindex misel 27109@opindex mno-isel 27110This switch enables or disables the generation of ISEL instructions. 27111 27112@item -mvsx 27113@itemx -mno-vsx 27114@opindex mvsx 27115@opindex mno-vsx 27116Generate code that uses (does not use) vector/scalar (VSX) 27117instructions, and also enable the use of built-in functions that allow 27118more direct access to the VSX instruction set. 27119 27120@item -mcrypto 27121@itemx -mno-crypto 27122@opindex mcrypto 27123@opindex mno-crypto 27124Enable the use (disable) of the built-in functions that allow direct 27125access to the cryptographic instructions that were added in version 271262.07 of the PowerPC ISA. 27127 27128@item -mhtm 27129@itemx -mno-htm 27130@opindex mhtm 27131@opindex mno-htm 27132Enable (disable) the use of the built-in functions that allow direct 27133access to the Hardware Transactional Memory (HTM) instructions that 27134were added in version 2.07 of the PowerPC ISA. 27135 27136@item -mpower8-fusion 27137@itemx -mno-power8-fusion 27138@opindex mpower8-fusion 27139@opindex mno-power8-fusion 27140Generate code that keeps (does not keeps) some integer operations 27141adjacent so that the instructions can be fused together on power8 and 27142later processors. 27143 27144@item -mpower8-vector 27145@itemx -mno-power8-vector 27146@opindex mpower8-vector 27147@opindex mno-power8-vector 27148Generate code that uses (does not use) the vector and scalar 27149instructions that were added in version 2.07 of the PowerPC ISA. Also 27150enable the use of built-in functions that allow more direct access to 27151the vector instructions. 27152 27153@item -mquad-memory 27154@itemx -mno-quad-memory 27155@opindex mquad-memory 27156@opindex mno-quad-memory 27157Generate code that uses (does not use) the non-atomic quad word memory 27158instructions. The @option{-mquad-memory} option requires use of 2715964-bit mode. 27160 27161@item -mquad-memory-atomic 27162@itemx -mno-quad-memory-atomic 27163@opindex mquad-memory-atomic 27164@opindex mno-quad-memory-atomic 27165Generate code that uses (does not use) the atomic quad word memory 27166instructions. The @option{-mquad-memory-atomic} option requires use of 2716764-bit mode. 27168 27169@item -mfloat128 27170@itemx -mno-float128 27171@opindex mfloat128 27172@opindex mno-float128 27173Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point 27174and use either software emulation for IEEE 128-bit floating point or 27175hardware instructions. 27176 27177The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, 27178@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to 27179use the IEEE 128-bit floating point support. The IEEE 128-bit 27180floating point support only works on PowerPC Linux systems. 27181 27182The default for @option{-mfloat128} is enabled on PowerPC Linux 27183systems using the VSX instruction set, and disabled on other systems. 27184 27185If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or 27186@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating 27187point support will also enable the generation of ISA 3.0 IEEE 128-bit 27188floating point instructions. Otherwise, if you do not specify to 27189generate ISA 3.0 instructions or you are targeting a 32-bit big endian 27190system, IEEE 128-bit floating point will be done with software 27191emulation. 27192 27193@item -mfloat128-hardware 27194@itemx -mno-float128-hardware 27195@opindex mfloat128-hardware 27196@opindex mno-float128-hardware 27197Enable/disable using ISA 3.0 hardware instructions to support the 27198@var{__float128} data type. 27199 27200The default for @option{-mfloat128-hardware} is enabled on PowerPC 27201Linux systems using the ISA 3.0 instruction set, and disabled on other 27202systems. 27203 27204@item -m32 27205@itemx -m64 27206@opindex m32 27207@opindex m64 27208Generate code for 32-bit or 64-bit environments of Darwin and SVR4 27209targets (including GNU/Linux). The 32-bit environment sets int, long 27210and pointer to 32 bits and generates code that runs on any PowerPC 27211variant. The 64-bit environment sets int to 32 bits and long and 27212pointer to 64 bits, and generates code for PowerPC64, as for 27213@option{-mpowerpc64}. 27214 27215@item -mfull-toc 27216@itemx -mno-fp-in-toc 27217@itemx -mno-sum-in-toc 27218@itemx -mminimal-toc 27219@opindex mfull-toc 27220@opindex mno-fp-in-toc 27221@opindex mno-sum-in-toc 27222@opindex mminimal-toc 27223Modify generation of the TOC (Table Of Contents), which is created for 27224every executable file. The @option{-mfull-toc} option is selected by 27225default. In that case, GCC allocates at least one TOC entry for 27226each unique non-automatic variable reference in your program. GCC 27227also places floating-point constants in the TOC@. However, only 2722816,384 entries are available in the TOC@. 27229 27230If you receive a linker error message that saying you have overflowed 27231the available TOC space, you can reduce the amount of TOC space used 27232with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 27233@option{-mno-fp-in-toc} prevents GCC from putting floating-point 27234constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 27235generate code to calculate the sum of an address and a constant at 27236run time instead of putting that sum into the TOC@. You may specify one 27237or both of these options. Each causes GCC to produce very slightly 27238slower and larger code at the expense of conserving TOC space. 27239 27240If you still run out of space in the TOC even when you specify both of 27241these options, specify @option{-mminimal-toc} instead. This option causes 27242GCC to make only one TOC entry for every file. When you specify this 27243option, GCC produces code that is slower and larger but which 27244uses extremely little TOC space. You may wish to use this option 27245only on files that contain less frequently-executed code. 27246 27247@item -maix64 27248@itemx -maix32 27249@opindex maix64 27250@opindex maix32 27251Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 27252@code{long} type, and the infrastructure needed to support them. 27253Specifying @option{-maix64} implies @option{-mpowerpc64}, 27254while @option{-maix32} disables the 64-bit ABI and 27255implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 27256 27257@item -mxl-compat 27258@itemx -mno-xl-compat 27259@opindex mxl-compat 27260@opindex mno-xl-compat 27261Produce code that conforms more closely to IBM XL compiler semantics 27262when using AIX-compatible ABI@. Pass floating-point arguments to 27263prototyped functions beyond the register save area (RSA) on the stack 27264in addition to argument FPRs. Do not assume that most significant 27265double in 128-bit long double value is properly rounded when comparing 27266values and converting to double. Use XL symbol names for long double 27267support routines. 27268 27269The AIX calling convention was extended but not initially documented to 27270handle an obscure K&R C case of calling a function that takes the 27271address of its arguments with fewer arguments than declared. IBM XL 27272compilers access floating-point arguments that do not fit in the 27273RSA from the stack when a subroutine is compiled without 27274optimization. Because always storing floating-point arguments on the 27275stack is inefficient and rarely needed, this option is not enabled by 27276default and only is necessary when calling subroutines compiled by IBM 27277XL compilers without optimization. 27278 27279@item -mpe 27280@opindex mpe 27281Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 27282application written to use message passing with special startup code to 27283enable the application to run. The system must have PE installed in the 27284standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 27285must be overridden with the @option{-specs=} option to specify the 27286appropriate directory location. The Parallel Environment does not 27287support threads, so the @option{-mpe} option and the @option{-pthread} 27288option are incompatible. 27289 27290@item -malign-natural 27291@itemx -malign-power 27292@opindex malign-natural 27293@opindex malign-power 27294On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 27295@option{-malign-natural} overrides the ABI-defined alignment of larger 27296types, such as floating-point doubles, on their natural size-based boundary. 27297The option @option{-malign-power} instructs GCC to follow the ABI-specified 27298alignment rules. GCC defaults to the standard alignment defined in the ABI@. 27299 27300On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 27301is not supported. 27302 27303@item -msoft-float 27304@itemx -mhard-float 27305@opindex msoft-float 27306@opindex mhard-float 27307Generate code that does not use (uses) the floating-point register set. 27308Software floating-point emulation is provided if you use the 27309@option{-msoft-float} option, and pass the option to GCC when linking. 27310 27311@item -mmultiple 27312@itemx -mno-multiple 27313@opindex mmultiple 27314@opindex mno-multiple 27315Generate code that uses (does not use) the load multiple word 27316instructions and the store multiple word instructions. These 27317instructions are generated by default on POWER systems, and not 27318generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 27319PowerPC systems, since those instructions do not work when the 27320processor is in little-endian mode. The exceptions are PPC740 and 27321PPC750 which permit these instructions in little-endian mode. 27322 27323@item -mupdate 27324@itemx -mno-update 27325@opindex mupdate 27326@opindex mno-update 27327Generate code that uses (does not use) the load or store instructions 27328that update the base register to the address of the calculated memory 27329location. These instructions are generated by default. If you use 27330@option{-mno-update}, there is a small window between the time that the 27331stack pointer is updated and the address of the previous frame is 27332stored, which means code that walks the stack frame across interrupts or 27333signals may get corrupted data. 27334 27335@item -mavoid-indexed-addresses 27336@itemx -mno-avoid-indexed-addresses 27337@opindex mavoid-indexed-addresses 27338@opindex mno-avoid-indexed-addresses 27339Generate code that tries to avoid (not avoid) the use of indexed load 27340or store instructions. These instructions can incur a performance 27341penalty on Power6 processors in certain situations, such as when 27342stepping through large arrays that cross a 16M boundary. This option 27343is enabled by default when targeting Power6 and disabled otherwise. 27344 27345@item -mfused-madd 27346@itemx -mno-fused-madd 27347@opindex mfused-madd 27348@opindex mno-fused-madd 27349Generate code that uses (does not use) the floating-point multiply and 27350accumulate instructions. These instructions are generated by default 27351if hardware floating point is used. The machine-dependent 27352@option{-mfused-madd} option is now mapped to the machine-independent 27353@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 27354mapped to @option{-ffp-contract=off}. 27355 27356@item -mmulhw 27357@itemx -mno-mulhw 27358@opindex mmulhw 27359@opindex mno-mulhw 27360Generate code that uses (does not use) the half-word multiply and 27361multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 27362These instructions are generated by default when targeting those 27363processors. 27364 27365@item -mdlmzb 27366@itemx -mno-dlmzb 27367@opindex mdlmzb 27368@opindex mno-dlmzb 27369Generate code that uses (does not use) the string-search @samp{dlmzb} 27370instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 27371generated by default when targeting those processors. 27372 27373@item -mno-bit-align 27374@itemx -mbit-align 27375@opindex mno-bit-align 27376@opindex mbit-align 27377On System V.4 and embedded PowerPC systems do not (do) force structures 27378and unions that contain bit-fields to be aligned to the base type of the 27379bit-field. 27380 27381For example, by default a structure containing nothing but 8 27382@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 27383boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 27384the structure is aligned to a 1-byte boundary and is 1 byte in 27385size. 27386 27387@item -mno-strict-align 27388@itemx -mstrict-align 27389@opindex mno-strict-align 27390@opindex mstrict-align 27391On System V.4 and embedded PowerPC systems do not (do) assume that 27392unaligned memory references are handled by the system. 27393 27394@item -mrelocatable 27395@itemx -mno-relocatable 27396@opindex mrelocatable 27397@opindex mno-relocatable 27398Generate code that allows (does not allow) a static executable to be 27399relocated to a different address at run time. A simple embedded 27400PowerPC system loader should relocate the entire contents of 27401@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 27402a table of 32-bit addresses generated by this option. For this to 27403work, all objects linked together must be compiled with 27404@option{-mrelocatable} or @option{-mrelocatable-lib}. 27405@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 27406 27407@item -mrelocatable-lib 27408@itemx -mno-relocatable-lib 27409@opindex mrelocatable-lib 27410@opindex mno-relocatable-lib 27411Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 27412@code{.fixup} section to allow static executables to be relocated at 27413run time, but @option{-mrelocatable-lib} does not use the smaller stack 27414alignment of @option{-mrelocatable}. Objects compiled with 27415@option{-mrelocatable-lib} may be linked with objects compiled with 27416any combination of the @option{-mrelocatable} options. 27417 27418@item -mno-toc 27419@itemx -mtoc 27420@opindex mno-toc 27421@opindex mtoc 27422On System V.4 and embedded PowerPC systems do not (do) assume that 27423register 2 contains a pointer to a global area pointing to the addresses 27424used in the program. 27425 27426@item -mlittle 27427@itemx -mlittle-endian 27428@opindex mlittle 27429@opindex mlittle-endian 27430On System V.4 and embedded PowerPC systems compile code for the 27431processor in little-endian mode. The @option{-mlittle-endian} option is 27432the same as @option{-mlittle}. 27433 27434@item -mbig 27435@itemx -mbig-endian 27436@opindex mbig 27437@opindex mbig-endian 27438On System V.4 and embedded PowerPC systems compile code for the 27439processor in big-endian mode. The @option{-mbig-endian} option is 27440the same as @option{-mbig}. 27441 27442@item -mdynamic-no-pic 27443@opindex mdynamic-no-pic 27444On Darwin and Mac OS X systems, compile code so that it is not 27445relocatable, but that its external references are relocatable. The 27446resulting code is suitable for applications, but not shared 27447libraries. 27448 27449@item -msingle-pic-base 27450@opindex msingle-pic-base 27451Treat the register used for PIC addressing as read-only, rather than 27452loading it in the prologue for each function. The runtime system is 27453responsible for initializing this register with an appropriate value 27454before execution begins. 27455 27456@item -mprioritize-restricted-insns=@var{priority} 27457@opindex mprioritize-restricted-insns 27458This option controls the priority that is assigned to 27459dispatch-slot restricted instructions during the second scheduling 27460pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 27461or @samp{2} to assign no, highest, or second-highest (respectively) 27462priority to dispatch-slot restricted 27463instructions. 27464 27465@item -msched-costly-dep=@var{dependence_type} 27466@opindex msched-costly-dep 27467This option controls which dependences are considered costly 27468by the target during instruction scheduling. The argument 27469@var{dependence_type} takes one of the following values: 27470 27471@table @asis 27472@item @samp{no} 27473No dependence is costly. 27474 27475@item @samp{all} 27476All dependences are costly. 27477 27478@item @samp{true_store_to_load} 27479A true dependence from store to load is costly. 27480 27481@item @samp{store_to_load} 27482Any dependence from store to load is costly. 27483 27484@item @var{number} 27485Any dependence for which the latency is greater than or equal to 27486@var{number} is costly. 27487@end table 27488 27489@item -minsert-sched-nops=@var{scheme} 27490@opindex minsert-sched-nops 27491This option controls which NOP insertion scheme is used during 27492the second scheduling pass. The argument @var{scheme} takes one of the 27493following values: 27494 27495@table @asis 27496@item @samp{no} 27497Don't insert NOPs. 27498 27499@item @samp{pad} 27500Pad with NOPs any dispatch group that has vacant issue slots, 27501according to the scheduler's grouping. 27502 27503@item @samp{regroup_exact} 27504Insert NOPs to force costly dependent insns into 27505separate groups. Insert exactly as many NOPs as needed to force an insn 27506to a new group, according to the estimated processor grouping. 27507 27508@item @var{number} 27509Insert NOPs to force costly dependent insns into 27510separate groups. Insert @var{number} NOPs to force an insn to a new group. 27511@end table 27512 27513@item -mcall-sysv 27514@opindex mcall-sysv 27515On System V.4 and embedded PowerPC systems compile code using calling 27516conventions that adhere to the March 1995 draft of the System V 27517Application Binary Interface, PowerPC processor supplement. This is the 27518default unless you configured GCC using @samp{powerpc-*-eabiaix}. 27519 27520@item -mcall-sysv-eabi 27521@itemx -mcall-eabi 27522@opindex mcall-sysv-eabi 27523@opindex mcall-eabi 27524Specify both @option{-mcall-sysv} and @option{-meabi} options. 27525 27526@item -mcall-sysv-noeabi 27527@opindex mcall-sysv-noeabi 27528Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 27529 27530@item -mcall-aixdesc 27531@opindex m 27532On System V.4 and embedded PowerPC systems compile code for the AIX 27533operating system. 27534 27535@item -mcall-linux 27536@opindex mcall-linux 27537On System V.4 and embedded PowerPC systems compile code for the 27538Linux-based GNU system. 27539 27540@item -mcall-freebsd 27541@opindex mcall-freebsd 27542On System V.4 and embedded PowerPC systems compile code for the 27543FreeBSD operating system. 27544 27545@item -mcall-netbsd 27546@opindex mcall-netbsd 27547On System V.4 and embedded PowerPC systems compile code for the 27548NetBSD operating system. 27549 27550@item -mcall-openbsd 27551@opindex mcall-netbsd 27552On System V.4 and embedded PowerPC systems compile code for the 27553OpenBSD operating system. 27554 27555@item -mtraceback=@var{traceback_type} 27556@opindex mtraceback 27557Select the type of traceback table. Valid values for @var{traceback_type} 27558are @samp{full}, @samp{part}, and @samp{no}. 27559 27560@item -maix-struct-return 27561@opindex maix-struct-return 27562Return all structures in memory (as specified by the AIX ABI)@. 27563 27564@item -msvr4-struct-return 27565@opindex msvr4-struct-return 27566Return structures smaller than 8 bytes in registers (as specified by the 27567SVR4 ABI)@. 27568 27569@item -mabi=@var{abi-type} 27570@opindex mabi 27571Extend the current ABI with a particular extension, or remove such extension. 27572Valid values are: @samp{altivec}, @samp{no-altivec}, 27573@samp{ibmlongdouble}, @samp{ieeelongdouble}, 27574@samp{elfv1}, @samp{elfv2}, 27575and for AIX: @samp{vec-extabi}, @samp{vec-default}@. 27576 27577@item -mabi=ibmlongdouble 27578@opindex mabi=ibmlongdouble 27579Change the current ABI to use IBM extended-precision long double. 27580This is not likely to work if your system defaults to using IEEE 27581extended-precision long double. If you change the long double type 27582from IEEE extended-precision, the compiler will issue a warning unless 27583you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 27584to be enabled. 27585 27586@item -mabi=ieeelongdouble 27587@opindex mabi=ieeelongdouble 27588Change the current ABI to use IEEE extended-precision long double. 27589This is not likely to work if your system defaults to using IBM 27590extended-precision long double. If you change the long double type 27591from IBM extended-precision, the compiler will issue a warning unless 27592you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 27593to be enabled. 27594 27595@item -mabi=elfv1 27596@opindex mabi=elfv1 27597Change the current ABI to use the ELFv1 ABI. 27598This is the default ABI for big-endian PowerPC 64-bit Linux. 27599Overriding the default ABI requires special system support and is 27600likely to fail in spectacular ways. 27601 27602@item -mabi=elfv2 27603@opindex mabi=elfv2 27604Change the current ABI to use the ELFv2 ABI. 27605This is the default ABI for little-endian PowerPC 64-bit Linux. 27606Overriding the default ABI requires special system support and is 27607likely to fail in spectacular ways. 27608 27609@item -mgnu-attribute 27610@itemx -mno-gnu-attribute 27611@opindex mgnu-attribute 27612@opindex mno-gnu-attribute 27613Emit .gnu_attribute assembly directives to set tag/value pairs in a 27614.gnu.attributes section that specify ABI variations in function 27615parameters or return values. 27616 27617@item -mprototype 27618@itemx -mno-prototype 27619@opindex mprototype 27620@opindex mno-prototype 27621On System V.4 and embedded PowerPC systems assume that all calls to 27622variable argument functions are properly prototyped. Otherwise, the 27623compiler must insert an instruction before every non-prototyped call to 27624set or clear bit 6 of the condition code register (@code{CR}) to 27625indicate whether floating-point values are passed in the floating-point 27626registers in case the function takes variable arguments. With 27627@option{-mprototype}, only calls to prototyped variable argument functions 27628set or clear the bit. 27629 27630@item -msim 27631@opindex msim 27632On embedded PowerPC systems, assume that the startup module is called 27633@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 27634@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 27635configurations. 27636 27637@item -mmvme 27638@opindex mmvme 27639On embedded PowerPC systems, assume that the startup module is called 27640@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 27641@file{libc.a}. 27642 27643@item -mads 27644@opindex mads 27645On embedded PowerPC systems, assume that the startup module is called 27646@file{crt0.o} and the standard C libraries are @file{libads.a} and 27647@file{libc.a}. 27648 27649@item -myellowknife 27650@opindex myellowknife 27651On embedded PowerPC systems, assume that the startup module is called 27652@file{crt0.o} and the standard C libraries are @file{libyk.a} and 27653@file{libc.a}. 27654 27655@item -mvxworks 27656@opindex mvxworks 27657On System V.4 and embedded PowerPC systems, specify that you are 27658compiling for a VxWorks system. 27659 27660@item -memb 27661@opindex memb 27662On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 27663header to indicate that @samp{eabi} extended relocations are used. 27664 27665@item -meabi 27666@itemx -mno-eabi 27667@opindex meabi 27668@opindex mno-eabi 27669On System V.4 and embedded PowerPC systems do (do not) adhere to the 27670Embedded Applications Binary Interface (EABI), which is a set of 27671modifications to the System V.4 specifications. Selecting @option{-meabi} 27672means that the stack is aligned to an 8-byte boundary, a function 27673@code{__eabi} is called from @code{main} to set up the EABI 27674environment, and the @option{-msdata} option can use both @code{r2} and 27675@code{r13} to point to two separate small data areas. Selecting 27676@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 27677no EABI initialization function is called from @code{main}, and the 27678@option{-msdata} option only uses @code{r13} to point to a single 27679small data area. The @option{-meabi} option is on by default if you 27680configured GCC using one of the @samp{powerpc*-*-eabi*} options. 27681 27682@item -msdata=eabi 27683@opindex msdata=eabi 27684On System V.4 and embedded PowerPC systems, put small initialized 27685@code{const} global and static data in the @code{.sdata2} section, which 27686is pointed to by register @code{r2}. Put small initialized 27687non-@code{const} global and static data in the @code{.sdata} section, 27688which is pointed to by register @code{r13}. Put small uninitialized 27689global and static data in the @code{.sbss} section, which is adjacent to 27690the @code{.sdata} section. The @option{-msdata=eabi} option is 27691incompatible with the @option{-mrelocatable} option. The 27692@option{-msdata=eabi} option also sets the @option{-memb} option. 27693 27694@item -msdata=sysv 27695@opindex msdata=sysv 27696On System V.4 and embedded PowerPC systems, put small global and static 27697data in the @code{.sdata} section, which is pointed to by register 27698@code{r13}. Put small uninitialized global and static data in the 27699@code{.sbss} section, which is adjacent to the @code{.sdata} section. 27700The @option{-msdata=sysv} option is incompatible with the 27701@option{-mrelocatable} option. 27702 27703@item -msdata=default 27704@itemx -msdata 27705@opindex msdata=default 27706@opindex msdata 27707On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 27708compile code the same as @option{-msdata=eabi}, otherwise compile code the 27709same as @option{-msdata=sysv}. 27710 27711@item -msdata=data 27712@opindex msdata=data 27713On System V.4 and embedded PowerPC systems, put small global 27714data in the @code{.sdata} section. Put small uninitialized global 27715data in the @code{.sbss} section. Do not use register @code{r13} 27716to address small data however. This is the default behavior unless 27717other @option{-msdata} options are used. 27718 27719@item -msdata=none 27720@itemx -mno-sdata 27721@opindex msdata=none 27722@opindex mno-sdata 27723On embedded PowerPC systems, put all initialized global and static data 27724in the @code{.data} section, and all uninitialized data in the 27725@code{.bss} section. 27726 27727@item -mreadonly-in-sdata 27728@opindex mreadonly-in-sdata 27729@opindex mno-readonly-in-sdata 27730Put read-only objects in the @code{.sdata} section as well. This is the 27731default. 27732 27733@item -mblock-move-inline-limit=@var{num} 27734@opindex mblock-move-inline-limit 27735Inline all block moves (such as calls to @code{memcpy} or structure 27736copies) less than or equal to @var{num} bytes. The minimum value for 27737@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 27738targets. The default value is target-specific. 27739 27740@item -mblock-compare-inline-limit=@var{num} 27741@opindex mblock-compare-inline-limit 27742Generate non-looping inline code for all block compares (such as calls 27743to @code{memcmp} or structure compares) less than or equal to @var{num} 27744bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of 27745block compare is disabled. The default value is target-specific. 27746 27747@item -mblock-compare-inline-loop-limit=@var{num} 27748@opindex mblock-compare-inline-loop-limit 27749Generate an inline expansion using loop code for all block compares that 27750are less than or equal to @var{num} bytes, but greater than the limit 27751for non-loop inline block compare expansion. If the block length is not 27752constant, at most @var{num} bytes will be compared before @code{memcmp} 27753is called to compare the remainder of the block. The default value is 27754target-specific. 27755 27756@item -mstring-compare-inline-limit=@var{num} 27757@opindex mstring-compare-inline-limit 27758Compare at most @var{num} string bytes with inline code. 27759If the difference or end of string is not found at the 27760end of the inline compare a call to @code{strcmp} or @code{strncmp} will 27761take care of the rest of the comparison. The default is 64 bytes. 27762 27763@item -G @var{num} 27764@opindex G 27765@cindex smaller data references (PowerPC) 27766@cindex .sdata/.sdata2 references (PowerPC) 27767On embedded PowerPC systems, put global and static items less than or 27768equal to @var{num} bytes into the small data or BSS sections instead of 27769the normal data or BSS section. By default, @var{num} is 8. The 27770@option{-G @var{num}} switch is also passed to the linker. 27771All modules should be compiled with the same @option{-G @var{num}} value. 27772 27773@item -mregnames 27774@itemx -mno-regnames 27775@opindex mregnames 27776@opindex mno-regnames 27777On System V.4 and embedded PowerPC systems do (do not) emit register 27778names in the assembly language output using symbolic forms. 27779 27780@item -mlongcall 27781@itemx -mno-longcall 27782@opindex mlongcall 27783@opindex mno-longcall 27784By default assume that all calls are far away so that a longer and more 27785expensive calling sequence is required. This is required for calls 27786farther than 32 megabytes (33,554,432 bytes) from the current location. 27787A short call is generated if the compiler knows 27788the call cannot be that far away. This setting can be overridden by 27789the @code{shortcall} function attribute, or by @code{#pragma 27790longcall(0)}. 27791 27792Some linkers are capable of detecting out-of-range calls and generating 27793glue code on the fly. On these systems, long calls are unnecessary and 27794generate slower code. As of this writing, the AIX linker can do this, 27795as can the GNU linker for PowerPC/64. It is planned to add this feature 27796to the GNU linker for 32-bit PowerPC systems as well. 27797 27798On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers, 27799GCC can generate long calls using an inline PLT call sequence (see 27800@option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64 27801ELFv1 (big-endian) do not support inline PLT calls. 27802 27803On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 27804callee, L42}, plus a @dfn{branch island} (glue code). The two target 27805addresses represent the callee and the branch island. The 27806Darwin/PPC linker prefers the first address and generates a @code{bl 27807callee} if the PPC @code{bl} instruction reaches the callee directly; 27808otherwise, the linker generates @code{bl L42} to call the branch 27809island. The branch island is appended to the body of the 27810calling function; it computes the full 32-bit address of the callee 27811and jumps to it. 27812 27813On Mach-O (Darwin) systems, this option directs the compiler emit to 27814the glue for every direct call, and the Darwin linker decides whether 27815to use or discard it. 27816 27817In the future, GCC may ignore all longcall specifications 27818when the linker is known to generate glue. 27819 27820@item -mpltseq 27821@itemx -mno-pltseq 27822@opindex mpltseq 27823@opindex mno-pltseq 27824Implement (do not implement) -fno-plt and long calls using an inline 27825PLT call sequence that supports lazy linking and long calls to 27826functions in dlopen'd shared libraries. Inline PLT calls are only 27827supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU 27828linkers, and are enabled by default if the support is detected when 27829configuring GCC, and, in the case of 32-bit PowerPC, if GCC is 27830configured with @option{--enable-secureplt}. @option{-mpltseq} code 27831and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be 27832linked together. 27833 27834@item -mtls-markers 27835@itemx -mno-tls-markers 27836@opindex mtls-markers 27837@opindex mno-tls-markers 27838Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 27839specifying the function argument. The relocation allows the linker to 27840reliably associate function call with argument setup instructions for 27841TLS optimization, which in turn allows GCC to better schedule the 27842sequence. 27843 27844@item -mrecip 27845@itemx -mno-recip 27846@opindex mrecip 27847This option enables use of the reciprocal estimate and 27848reciprocal square root estimate instructions with additional 27849Newton-Raphson steps to increase precision instead of doing a divide or 27850square root and divide for floating-point arguments. You should use 27851the @option{-ffast-math} option when using @option{-mrecip} (or at 27852least @option{-funsafe-math-optimizations}, 27853@option{-ffinite-math-only}, @option{-freciprocal-math} and 27854@option{-fno-trapping-math}). Note that while the throughput of the 27855sequence is generally higher than the throughput of the non-reciprocal 27856instruction, the precision of the sequence can be decreased by up to 2 27857ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 27858roots. 27859 27860@item -mrecip=@var{opt} 27861@opindex mrecip=opt 27862This option controls which reciprocal estimate instructions 27863may be used. @var{opt} is a comma-separated list of options, which may 27864be preceded by a @code{!} to invert the option: 27865 27866@table @samp 27867 27868@item all 27869Enable all estimate instructions. 27870 27871@item default 27872Enable the default instructions, equivalent to @option{-mrecip}. 27873 27874@item none 27875Disable all estimate instructions, equivalent to @option{-mno-recip}. 27876 27877@item div 27878Enable the reciprocal approximation instructions for both 27879single and double precision. 27880 27881@item divf 27882Enable the single-precision reciprocal approximation instructions. 27883 27884@item divd 27885Enable the double-precision reciprocal approximation instructions. 27886 27887@item rsqrt 27888Enable the reciprocal square root approximation instructions for both 27889single and double precision. 27890 27891@item rsqrtf 27892Enable the single-precision reciprocal square root approximation instructions. 27893 27894@item rsqrtd 27895Enable the double-precision reciprocal square root approximation instructions. 27896 27897@end table 27898 27899So, for example, @option{-mrecip=all,!rsqrtd} enables 27900all of the reciprocal estimate instructions, except for the 27901@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 27902which handle the double-precision reciprocal square root calculations. 27903 27904@item -mrecip-precision 27905@itemx -mno-recip-precision 27906@opindex mrecip-precision 27907Assume (do not assume) that the reciprocal estimate instructions 27908provide higher-precision estimates than is mandated by the PowerPC 27909ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 27910@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 27911The double-precision square root estimate instructions are not generated by 27912default on low-precision machines, since they do not provide an 27913estimate that converges after three steps. 27914 27915@item -mveclibabi=@var{type} 27916@opindex mveclibabi 27917Specifies the ABI type to use for vectorizing intrinsics using an 27918external library. The only type supported at present is @samp{mass}, 27919which specifies to use IBM's Mathematical Acceleration Subsystem 27920(MASS) libraries for vectorizing intrinsics using external libraries. 27921GCC currently emits calls to @code{acosd2}, @code{acosf4}, 27922@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 27923@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 27924@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 27925@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 27926@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 27927@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 27928@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 27929@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 27930@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 27931@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 27932@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 27933@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 27934@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 27935for power7. Both @option{-ftree-vectorize} and 27936@option{-funsafe-math-optimizations} must also be enabled. The MASS 27937libraries must be specified at link time. 27938 27939@item -mfriz 27940@itemx -mno-friz 27941@opindex mfriz 27942Generate (do not generate) the @code{friz} instruction when the 27943@option{-funsafe-math-optimizations} option is used to optimize 27944rounding of floating-point values to 64-bit integer and back to floating 27945point. The @code{friz} instruction does not return the same value if 27946the floating-point number is too large to fit in an integer. 27947 27948@item -mpointers-to-nested-functions 27949@itemx -mno-pointers-to-nested-functions 27950@opindex mpointers-to-nested-functions 27951Generate (do not generate) code to load up the static chain register 27952(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 27953systems where a function pointer points to a 3-word descriptor giving 27954the function address, TOC value to be loaded in register @code{r2}, and 27955static chain value to be loaded in register @code{r11}. The 27956@option{-mpointers-to-nested-functions} is on by default. You cannot 27957call through pointers to nested functions or pointers 27958to functions compiled in other languages that use the static chain if 27959you use @option{-mno-pointers-to-nested-functions}. 27960 27961@item -msave-toc-indirect 27962@itemx -mno-save-toc-indirect 27963@opindex msave-toc-indirect 27964Generate (do not generate) code to save the TOC value in the reserved 27965stack location in the function prologue if the function calls through 27966a pointer on AIX and 64-bit Linux systems. If the TOC value is not 27967saved in the prologue, it is saved just before the call through the 27968pointer. The @option{-mno-save-toc-indirect} option is the default. 27969 27970@item -mcompat-align-parm 27971@itemx -mno-compat-align-parm 27972@opindex mcompat-align-parm 27973Generate (do not generate) code to pass structure parameters with a 27974maximum alignment of 64 bits, for compatibility with older versions 27975of GCC. 27976 27977Older versions of GCC (prior to 4.9.0) incorrectly did not align a 27978structure parameter on a 128-bit boundary when that structure contained 27979a member requiring 128-bit alignment. This is corrected in more 27980recent versions of GCC. This option may be used to generate code 27981that is compatible with functions compiled with older versions of 27982GCC. 27983 27984The @option{-mno-compat-align-parm} option is the default. 27985 27986@item -mstack-protector-guard=@var{guard} 27987@itemx -mstack-protector-guard-reg=@var{reg} 27988@itemx -mstack-protector-guard-offset=@var{offset} 27989@itemx -mstack-protector-guard-symbol=@var{symbol} 27990@opindex mstack-protector-guard 27991@opindex mstack-protector-guard-reg 27992@opindex mstack-protector-guard-offset 27993@opindex mstack-protector-guard-symbol 27994Generate stack protection code using canary at @var{guard}. Supported 27995locations are @samp{global} for global canary or @samp{tls} for per-thread 27996canary in the TLS block (the default with GNU libc version 2.4 or later). 27997 27998With the latter choice the options 27999@option{-mstack-protector-guard-reg=@var{reg}} and 28000@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 28001which register to use as base register for reading the canary, and from what 28002offset from that base register. The default for those is as specified in the 28003relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides 28004the offset with a symbol reference to a canary in the TLS block. 28005 28006@item -mpcrel 28007@itemx -mno-pcrel 28008@opindex mpcrel 28009@opindex mno-pcrel 28010Generate (do not generate) pc-relative addressing when the option 28011@option{-mcpu=future} is used. The @option{-mpcrel} option requires 28012that the medium code model (@option{-mcmodel=medium}) and prefixed 28013addressing (@option{-mprefixed}) options are enabled. 28014 28015@item -mprefixed 28016@itemx -mno-prefixed 28017@opindex mprefixed 28018@opindex mno-prefixed 28019Generate (do not generate) addressing modes using prefixed load and 28020store instructions when the option @option{-mcpu=future} is used. 28021 28022@item -mmma 28023@itemx -mno-mma 28024@opindex mmma 28025@opindex mno-mma 28026Generate (do not generate) the MMA instructions when the option 28027@option{-mcpu=future} is used. 28028 28029@item -mrop-protect 28030@itemx -mno-rop-protect 28031@opindex mrop-protect 28032@opindex mno-rop-protect 28033Generate (do not generate) ROP protection instructions when the target 28034processor supports them. Currently this option disables the shrink-wrap 28035optimization (@option{-fshrink-wrap}). 28036 28037@item -mprivileged 28038@itemx -mno-privileged 28039@opindex mprivileged 28040@opindex mno-privileged 28041Generate (do not generate) code that will run in privileged state. 28042 28043@item -mblock-ops-unaligned-vsx 28044@itemx -mno-block-ops-unaligned-vsx 28045@opindex block-ops-unaligned-vsx 28046@opindex no-block-ops-unaligned-vsx 28047Generate (do not generate) unaligned vsx loads and stores for 28048inline expansion of @code{memcpy} and @code{memmove}. 28049@end table 28050 28051@node RX Options 28052@subsection RX Options 28053@cindex RX Options 28054 28055These command-line options are defined for RX targets: 28056 28057@table @gcctabopt 28058@item -m64bit-doubles 28059@itemx -m32bit-doubles 28060@opindex m64bit-doubles 28061@opindex m32bit-doubles 28062Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 28063or 32 bits (@option{-m32bit-doubles}) in size. The default is 28064@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 28065works on 32-bit values, which is why the default is 28066@option{-m32bit-doubles}. 28067 28068@item -fpu 28069@itemx -nofpu 28070@opindex fpu 28071@opindex nofpu 28072Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 28073floating-point hardware. The default is enabled for the RX600 28074series and disabled for the RX200 series. 28075 28076Floating-point instructions are only generated for 32-bit floating-point 28077values, however, so the FPU hardware is not used for doubles if the 28078@option{-m64bit-doubles} option is used. 28079 28080@emph{Note} If the @option{-fpu} option is enabled then 28081@option{-funsafe-math-optimizations} is also enabled automatically. 28082This is because the RX FPU instructions are themselves unsafe. 28083 28084@item -mcpu=@var{name} 28085@opindex mcpu 28086Selects the type of RX CPU to be targeted. Currently three types are 28087supported, the generic @samp{RX600} and @samp{RX200} series hardware and 28088the specific @samp{RX610} CPU. The default is @samp{RX600}. 28089 28090The only difference between @samp{RX600} and @samp{RX610} is that the 28091@samp{RX610} does not support the @code{MVTIPL} instruction. 28092 28093The @samp{RX200} series does not have a hardware floating-point unit 28094and so @option{-nofpu} is enabled by default when this type is 28095selected. 28096 28097@item -mbig-endian-data 28098@itemx -mlittle-endian-data 28099@opindex mbig-endian-data 28100@opindex mlittle-endian-data 28101Store data (but not code) in the big-endian format. The default is 28102@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 28103format. 28104 28105@item -msmall-data-limit=@var{N} 28106@opindex msmall-data-limit 28107Specifies the maximum size in bytes of global and static variables 28108which can be placed into the small data area. Using the small data 28109area can lead to smaller and faster code, but the size of area is 28110limited and it is up to the programmer to ensure that the area does 28111not overflow. Also when the small data area is used one of the RX's 28112registers (usually @code{r13}) is reserved for use pointing to this 28113area, so it is no longer available for use by the compiler. This 28114could result in slower and/or larger code if variables are pushed onto 28115the stack instead of being held in this register. 28116 28117Note, common variables (variables that have not been initialized) and 28118constants are not placed into the small data area as they are assigned 28119to other sections in the output executable. 28120 28121The default value is zero, which disables this feature. Note, this 28122feature is not enabled by default with higher optimization levels 28123(@option{-O2} etc) because of the potentially detrimental effects of 28124reserving a register. It is up to the programmer to experiment and 28125discover whether this feature is of benefit to their program. See the 28126description of the @option{-mpid} option for a description of how the 28127actual register to hold the small data area pointer is chosen. 28128 28129@item -msim 28130@itemx -mno-sim 28131@opindex msim 28132@opindex mno-sim 28133Use the simulator runtime. The default is to use the libgloss 28134board-specific runtime. 28135 28136@item -mas100-syntax 28137@itemx -mno-as100-syntax 28138@opindex mas100-syntax 28139@opindex mno-as100-syntax 28140When generating assembler output use a syntax that is compatible with 28141Renesas's AS100 assembler. This syntax can also be handled by the GAS 28142assembler, but it has some restrictions so it is not generated by default. 28143 28144@item -mmax-constant-size=@var{N} 28145@opindex mmax-constant-size 28146Specifies the maximum size, in bytes, of a constant that can be used as 28147an operand in a RX instruction. Although the RX instruction set does 28148allow constants of up to 4 bytes in length to be used in instructions, 28149a longer value equates to a longer instruction. Thus in some 28150circumstances it can be beneficial to restrict the size of constants 28151that are used in instructions. Constants that are too big are instead 28152placed into a constant pool and referenced via register indirection. 28153 28154The value @var{N} can be between 0 and 4. A value of 0 (the default) 28155or 4 means that constants of any size are allowed. 28156 28157@item -mrelax 28158@opindex mrelax 28159Enable linker relaxation. Linker relaxation is a process whereby the 28160linker attempts to reduce the size of a program by finding shorter 28161versions of various instructions. Disabled by default. 28162 28163@item -mint-register=@var{N} 28164@opindex mint-register 28165Specify the number of registers to reserve for fast interrupt handler 28166functions. The value @var{N} can be between 0 and 4. A value of 1 28167means that register @code{r13} is reserved for the exclusive use 28168of fast interrupt handlers. A value of 2 reserves @code{r13} and 28169@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 28170@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 28171A value of 0, the default, does not reserve any registers. 28172 28173@item -msave-acc-in-interrupts 28174@opindex msave-acc-in-interrupts 28175Specifies that interrupt handler functions should preserve the 28176accumulator register. This is only necessary if normal code might use 28177the accumulator register, for example because it performs 64-bit 28178multiplications. The default is to ignore the accumulator as this 28179makes the interrupt handlers faster. 28180 28181@item -mpid 28182@itemx -mno-pid 28183@opindex mpid 28184@opindex mno-pid 28185Enables the generation of position independent data. When enabled any 28186access to constant data is done via an offset from a base address 28187held in a register. This allows the location of constant data to be 28188determined at run time without requiring the executable to be 28189relocated, which is a benefit to embedded applications with tight 28190memory constraints. Data that can be modified is not affected by this 28191option. 28192 28193Note, using this feature reserves a register, usually @code{r13}, for 28194the constant data base address. This can result in slower and/or 28195larger code, especially in complicated functions. 28196 28197The actual register chosen to hold the constant data base address 28198depends upon whether the @option{-msmall-data-limit} and/or the 28199@option{-mint-register} command-line options are enabled. Starting 28200with register @code{r13} and proceeding downwards, registers are 28201allocated first to satisfy the requirements of @option{-mint-register}, 28202then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 28203is possible for the small data area register to be @code{r8} if both 28204@option{-mint-register=4} and @option{-mpid} are specified on the 28205command line. 28206 28207By default this feature is not enabled. The default can be restored 28208via the @option{-mno-pid} command-line option. 28209 28210@item -mno-warn-multiple-fast-interrupts 28211@itemx -mwarn-multiple-fast-interrupts 28212@opindex mno-warn-multiple-fast-interrupts 28213@opindex mwarn-multiple-fast-interrupts 28214Prevents GCC from issuing a warning message if it finds more than one 28215fast interrupt handler when it is compiling a file. The default is to 28216issue a warning for each extra fast interrupt handler found, as the RX 28217only supports one such interrupt. 28218 28219@item -mallow-string-insns 28220@itemx -mno-allow-string-insns 28221@opindex mallow-string-insns 28222@opindex mno-allow-string-insns 28223Enables or disables the use of the string manipulation instructions 28224@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL} 28225@code{SWHILE} and also the @code{RMPA} instruction. These 28226instructions may prefetch data, which is not safe to do if accessing 28227an I/O register. (See section 12.2.7 of the RX62N Group User's Manual 28228for more information). 28229 28230The default is to allow these instructions, but it is not possible for 28231GCC to reliably detect all circumstances where a string instruction 28232might be used to access an I/O register, so their use cannot be 28233disabled automatically. Instead it is reliant upon the programmer to 28234use the @option{-mno-allow-string-insns} option if their program 28235accesses I/O space. 28236 28237When the instructions are enabled GCC defines the C preprocessor 28238symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the 28239symbol @code{__RX_DISALLOW_STRING_INSNS__}. 28240 28241@item -mjsr 28242@itemx -mno-jsr 28243@opindex mjsr 28244@opindex mno-jsr 28245Use only (or not only) @code{JSR} instructions to access functions. 28246This option can be used when code size exceeds the range of @code{BSR} 28247instructions. Note that @option{-mno-jsr} does not mean to not use 28248@code{JSR} but instead means that any type of branch may be used. 28249@end table 28250 28251@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 28252has special significance to the RX port when used with the 28253@code{interrupt} function attribute. This attribute indicates a 28254function intended to process fast interrupts. GCC ensures 28255that it only uses the registers @code{r10}, @code{r11}, @code{r12} 28256and/or @code{r13} and only provided that the normal use of the 28257corresponding registers have been restricted via the 28258@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 28259options. 28260 28261@node S/390 and zSeries Options 28262@subsection S/390 and zSeries Options 28263@cindex S/390 and zSeries Options 28264 28265These are the @samp{-m} options defined for the S/390 and zSeries architecture. 28266 28267@table @gcctabopt 28268@item -mhard-float 28269@itemx -msoft-float 28270@opindex mhard-float 28271@opindex msoft-float 28272Use (do not use) the hardware floating-point instructions and registers 28273for floating-point operations. When @option{-msoft-float} is specified, 28274functions in @file{libgcc.a} are used to perform floating-point 28275operations. When @option{-mhard-float} is specified, the compiler 28276generates IEEE floating-point instructions. This is the default. 28277 28278@item -mhard-dfp 28279@itemx -mno-hard-dfp 28280@opindex mhard-dfp 28281@opindex mno-hard-dfp 28282Use (do not use) the hardware decimal-floating-point instructions for 28283decimal-floating-point operations. When @option{-mno-hard-dfp} is 28284specified, functions in @file{libgcc.a} are used to perform 28285decimal-floating-point operations. When @option{-mhard-dfp} is 28286specified, the compiler generates decimal-floating-point hardware 28287instructions. This is the default for @option{-march=z9-ec} or higher. 28288 28289@item -mlong-double-64 28290@itemx -mlong-double-128 28291@opindex mlong-double-64 28292@opindex mlong-double-128 28293These switches control the size of @code{long double} type. A size 28294of 64 bits makes the @code{long double} type equivalent to the @code{double} 28295type. This is the default. 28296 28297@item -mbackchain 28298@itemx -mno-backchain 28299@opindex mbackchain 28300@opindex mno-backchain 28301Store (do not store) the address of the caller's frame as backchain pointer 28302into the callee's stack frame. 28303A backchain may be needed to allow debugging using tools that do not understand 28304DWARF call frame information. 28305When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 28306at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 28307the backchain is placed into the topmost word of the 96/160 byte register 28308save area. 28309 28310In general, code compiled with @option{-mbackchain} is call-compatible with 28311code compiled with @option{-mno-backchain}; however, use of the backchain 28312for debugging purposes usually requires that the whole binary is built with 28313@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 28314@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 28315to build a linux kernel use @option{-msoft-float}. 28316 28317The default is to not maintain the backchain. 28318 28319@item -mpacked-stack 28320@itemx -mno-packed-stack 28321@opindex mpacked-stack 28322@opindex mno-packed-stack 28323Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 28324specified, the compiler uses the all fields of the 96/160 byte register save 28325area only for their default purpose; unused fields still take up stack space. 28326When @option{-mpacked-stack} is specified, register save slots are densely 28327packed at the top of the register save area; unused space is reused for other 28328purposes, allowing for more efficient use of the available stack space. 28329However, when @option{-mbackchain} is also in effect, the topmost word of 28330the save area is always used to store the backchain, and the return address 28331register is always saved two words below the backchain. 28332 28333As long as the stack frame backchain is not used, code generated with 28334@option{-mpacked-stack} is call-compatible with code generated with 28335@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 28336S/390 or zSeries generated code that uses the stack frame backchain at run 28337time, not just for debugging purposes. Such code is not call-compatible 28338with code compiled with @option{-mpacked-stack}. Also, note that the 28339combination of @option{-mbackchain}, 28340@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 28341to build a linux kernel use @option{-msoft-float}. 28342 28343The default is to not use the packed stack layout. 28344 28345@item -msmall-exec 28346@itemx -mno-small-exec 28347@opindex msmall-exec 28348@opindex mno-small-exec 28349Generate (or do not generate) code using the @code{bras} instruction 28350to do subroutine calls. 28351This only works reliably if the total executable size does not 28352exceed 64k. The default is to use the @code{basr} instruction instead, 28353which does not have this limitation. 28354 28355@item -m64 28356@itemx -m31 28357@opindex m64 28358@opindex m31 28359When @option{-m31} is specified, generate code compliant to the 28360GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 28361code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 28362particular to generate 64-bit instructions. For the @samp{s390} 28363targets, the default is @option{-m31}, while the @samp{s390x} 28364targets default to @option{-m64}. 28365 28366@item -mzarch 28367@itemx -mesa 28368@opindex mzarch 28369@opindex mesa 28370When @option{-mzarch} is specified, generate code using the 28371instructions available on z/Architecture. 28372When @option{-mesa} is specified, generate code using the 28373instructions available on ESA/390. Note that @option{-mesa} is 28374not possible with @option{-m64}. 28375When generating code compliant to the GNU/Linux for S/390 ABI, 28376the default is @option{-mesa}. When generating code compliant 28377to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 28378 28379@item -mhtm 28380@itemx -mno-htm 28381@opindex mhtm 28382@opindex mno-htm 28383The @option{-mhtm} option enables a set of builtins making use of 28384instructions available with the transactional execution facility 28385introduced with the IBM zEnterprise EC12 machine generation 28386@ref{S/390 System z Built-in Functions}. 28387@option{-mhtm} is enabled by default when using @option{-march=zEC12}. 28388 28389@item -mvx 28390@itemx -mno-vx 28391@opindex mvx 28392@opindex mno-vx 28393When @option{-mvx} is specified, generate code using the instructions 28394available with the vector extension facility introduced with the IBM 28395z13 machine generation. 28396This option changes the ABI for some vector type values with regard to 28397alignment and calling conventions. In case vector type values are 28398being used in an ABI-relevant context a GAS @samp{.gnu_attribute} 28399command will be added to mark the resulting binary with the ABI used. 28400@option{-mvx} is enabled by default when using @option{-march=z13}. 28401 28402@item -mzvector 28403@itemx -mno-zvector 28404@opindex mzvector 28405@opindex mno-zvector 28406The @option{-mzvector} option enables vector language extensions and 28407builtins using instructions available with the vector extension 28408facility introduced with the IBM z13 machine generation. 28409This option adds support for @samp{vector} to be used as a keyword to 28410define vector type variables and arguments. @samp{vector} is only 28411available when GNU extensions are enabled. It will not be expanded 28412when requesting strict standard compliance e.g.@: with @option{-std=c99}. 28413In addition to the GCC low-level builtins @option{-mzvector} enables 28414a set of builtins added for compatibility with AltiVec-style 28415implementations like Power and Cell. In order to make use of these 28416builtins the header file @file{vecintrin.h} needs to be included. 28417@option{-mzvector} is disabled by default. 28418 28419@item -mmvcle 28420@itemx -mno-mvcle 28421@opindex mmvcle 28422@opindex mno-mvcle 28423Generate (or do not generate) code using the @code{mvcle} instruction 28424to perform block moves. When @option{-mno-mvcle} is specified, 28425use a @code{mvc} loop instead. This is the default unless optimizing for 28426size. 28427 28428@item -mdebug 28429@itemx -mno-debug 28430@opindex mdebug 28431@opindex mno-debug 28432Print (or do not print) additional debug information when compiling. 28433The default is to not print debug information. 28434 28435@item -march=@var{cpu-type} 28436@opindex march 28437Generate code that runs on @var{cpu-type}, which is the name of a 28438system representing a certain processor type. Possible values for 28439@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6}, 28440@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8}, 28441@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, 28442@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}. 28443 28444The default is @option{-march=z900}. 28445 28446Specifying @samp{native} as cpu type can be used to select the best 28447architecture option for the host processor. 28448@option{-march=native} has no effect if GCC does not recognize the 28449processor. 28450 28451@item -mtune=@var{cpu-type} 28452@opindex mtune 28453Tune to @var{cpu-type} everything applicable about the generated code, 28454except for the ABI and the set of available instructions. 28455The list of @var{cpu-type} values is the same as for @option{-march}. 28456The default is the value used for @option{-march}. 28457 28458@item -mtpf-trace 28459@itemx -mno-tpf-trace 28460@opindex mtpf-trace 28461@opindex mno-tpf-trace 28462Generate code that adds (does not add) in TPF OS specific branches to trace 28463routines in the operating system. This option is off by default, even 28464when compiling for the TPF OS@. 28465 28466@item -mtpf-trace-skip 28467@itemx -mno-tpf-trace-skip 28468@opindex mtpf-trace-skip 28469@opindex mno-tpf-trace-skip 28470Generate code that changes (does not change) the default branch 28471targets enabled by @option{-mtpf-trace} to point to specialized trace 28472routines providing the ability of selectively skipping function trace 28473entries for the TPF OS. This option is off by default, even when 28474compiling for the TPF OS and specifying @option{-mtpf-trace}. 28475 28476@item -mfused-madd 28477@itemx -mno-fused-madd 28478@opindex mfused-madd 28479@opindex mno-fused-madd 28480Generate code that uses (does not use) the floating-point multiply and 28481accumulate instructions. These instructions are generated by default if 28482hardware floating point is used. 28483 28484@item -mwarn-framesize=@var{framesize} 28485@opindex mwarn-framesize 28486Emit a warning if the current function exceeds the given frame size. Because 28487this is a compile-time check it doesn't need to be a real problem when the program 28488runs. It is intended to identify functions that most probably cause 28489a stack overflow. It is useful to be used in an environment with limited stack 28490size e.g.@: the linux kernel. 28491 28492@item -mwarn-dynamicstack 28493@opindex mwarn-dynamicstack 28494Emit a warning if the function calls @code{alloca} or uses dynamically-sized 28495arrays. This is generally a bad idea with a limited stack size. 28496 28497@item -mstack-guard=@var{stack-guard} 28498@itemx -mstack-size=@var{stack-size} 28499@opindex mstack-guard 28500@opindex mstack-size 28501If these options are provided the S/390 back end emits additional instructions in 28502the function prologue that trigger a trap if the stack size is @var{stack-guard} 28503bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 28504If the @var{stack-guard} option is omitted the smallest power of 2 larger than 28505the frame size of the compiled function is chosen. 28506These options are intended to be used to help debugging stack overflow problems. 28507The additionally emitted code causes only little overhead and hence can also be 28508used in production-like systems without greater performance degradation. The given 28509values have to be exact powers of 2 and @var{stack-size} has to be greater than 28510@var{stack-guard} without exceeding 64k. 28511In order to be efficient the extra code makes the assumption that the stack starts 28512at an address aligned to the value given by @var{stack-size}. 28513The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 28514 28515@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 28516@opindex mhotpatch 28517If the hotpatch option is enabled, a ``hot-patching'' function 28518prologue is generated for all functions in the compilation unit. 28519The funtion label is prepended with the given number of two-byte 28520NOP instructions (@var{pre-halfwords}, maximum 1000000). After 28521the label, 2 * @var{post-halfwords} bytes are appended, using the 28522largest NOP like instructions the architecture allows (maximum 285231000000). 28524 28525If both arguments are zero, hotpatching is disabled. 28526 28527This option can be overridden for individual functions with the 28528@code{hotpatch} attribute. 28529@end table 28530 28531@node Score Options 28532@subsection Score Options 28533@cindex Score Options 28534 28535These options are defined for Score implementations: 28536 28537@table @gcctabopt 28538@item -meb 28539@opindex meb 28540Compile code for big-endian mode. This is the default. 28541 28542@item -mel 28543@opindex mel 28544Compile code for little-endian mode. 28545 28546@item -mnhwloop 28547@opindex mnhwloop 28548Disable generation of @code{bcnz} instructions. 28549 28550@item -muls 28551@opindex muls 28552Enable generation of unaligned load and store instructions. 28553 28554@item -mmac 28555@opindex mmac 28556Enable the use of multiply-accumulate instructions. Disabled by default. 28557 28558@item -mscore5 28559@opindex mscore5 28560Specify the SCORE5 as the target architecture. 28561 28562@item -mscore5u 28563@opindex mscore5u 28564Specify the SCORE5U of the target architecture. 28565 28566@item -mscore7 28567@opindex mscore7 28568Specify the SCORE7 as the target architecture. This is the default. 28569 28570@item -mscore7d 28571@opindex mscore7d 28572Specify the SCORE7D as the target architecture. 28573@end table 28574 28575@node SH Options 28576@subsection SH Options 28577 28578These @samp{-m} options are defined for the SH implementations: 28579 28580@table @gcctabopt 28581@item -m1 28582@opindex m1 28583Generate code for the SH1. 28584 28585@item -m2 28586@opindex m2 28587Generate code for the SH2. 28588 28589@item -m2e 28590Generate code for the SH2e. 28591 28592@item -m2a-nofpu 28593@opindex m2a-nofpu 28594Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 28595that the floating-point unit is not used. 28596 28597@item -m2a-single-only 28598@opindex m2a-single-only 28599Generate code for the SH2a-FPU, in such a way that no double-precision 28600floating-point operations are used. 28601 28602@item -m2a-single 28603@opindex m2a-single 28604Generate code for the SH2a-FPU assuming the floating-point unit is in 28605single-precision mode by default. 28606 28607@item -m2a 28608@opindex m2a 28609Generate code for the SH2a-FPU assuming the floating-point unit is in 28610double-precision mode by default. 28611 28612@item -m3 28613@opindex m3 28614Generate code for the SH3. 28615 28616@item -m3e 28617@opindex m3e 28618Generate code for the SH3e. 28619 28620@item -m4-nofpu 28621@opindex m4-nofpu 28622Generate code for the SH4 without a floating-point unit. 28623 28624@item -m4-single-only 28625@opindex m4-single-only 28626Generate code for the SH4 with a floating-point unit that only 28627supports single-precision arithmetic. 28628 28629@item -m4-single 28630@opindex m4-single 28631Generate code for the SH4 assuming the floating-point unit is in 28632single-precision mode by default. 28633 28634@item -m4 28635@opindex m4 28636Generate code for the SH4. 28637 28638@item -m4-100 28639@opindex m4-100 28640Generate code for SH4-100. 28641 28642@item -m4-100-nofpu 28643@opindex m4-100-nofpu 28644Generate code for SH4-100 in such a way that the 28645floating-point unit is not used. 28646 28647@item -m4-100-single 28648@opindex m4-100-single 28649Generate code for SH4-100 assuming the floating-point unit is in 28650single-precision mode by default. 28651 28652@item -m4-100-single-only 28653@opindex m4-100-single-only 28654Generate code for SH4-100 in such a way that no double-precision 28655floating-point operations are used. 28656 28657@item -m4-200 28658@opindex m4-200 28659Generate code for SH4-200. 28660 28661@item -m4-200-nofpu 28662@opindex m4-200-nofpu 28663Generate code for SH4-200 without in such a way that the 28664floating-point unit is not used. 28665 28666@item -m4-200-single 28667@opindex m4-200-single 28668Generate code for SH4-200 assuming the floating-point unit is in 28669single-precision mode by default. 28670 28671@item -m4-200-single-only 28672@opindex m4-200-single-only 28673Generate code for SH4-200 in such a way that no double-precision 28674floating-point operations are used. 28675 28676@item -m4-300 28677@opindex m4-300 28678Generate code for SH4-300. 28679 28680@item -m4-300-nofpu 28681@opindex m4-300-nofpu 28682Generate code for SH4-300 without in such a way that the 28683floating-point unit is not used. 28684 28685@item -m4-300-single 28686@opindex m4-300-single 28687Generate code for SH4-300 in such a way that no double-precision 28688floating-point operations are used. 28689 28690@item -m4-300-single-only 28691@opindex m4-300-single-only 28692Generate code for SH4-300 in such a way that no double-precision 28693floating-point operations are used. 28694 28695@item -m4-340 28696@opindex m4-340 28697Generate code for SH4-340 (no MMU, no FPU). 28698 28699@item -m4-500 28700@opindex m4-500 28701Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 28702assembler. 28703 28704@item -m4a-nofpu 28705@opindex m4a-nofpu 28706Generate code for the SH4al-dsp, or for a SH4a in such a way that the 28707floating-point unit is not used. 28708 28709@item -m4a-single-only 28710@opindex m4a-single-only 28711Generate code for the SH4a, in such a way that no double-precision 28712floating-point operations are used. 28713 28714@item -m4a-single 28715@opindex m4a-single 28716Generate code for the SH4a assuming the floating-point unit is in 28717single-precision mode by default. 28718 28719@item -m4a 28720@opindex m4a 28721Generate code for the SH4a. 28722 28723@item -m4al 28724@opindex m4al 28725Same as @option{-m4a-nofpu}, except that it implicitly passes 28726@option{-dsp} to the assembler. GCC doesn't generate any DSP 28727instructions at the moment. 28728 28729@item -mb 28730@opindex mb 28731Compile code for the processor in big-endian mode. 28732 28733@item -ml 28734@opindex ml 28735Compile code for the processor in little-endian mode. 28736 28737@item -mdalign 28738@opindex mdalign 28739Align doubles at 64-bit boundaries. Note that this changes the calling 28740conventions, and thus some functions from the standard C library do 28741not work unless you recompile it first with @option{-mdalign}. 28742 28743@item -mrelax 28744@opindex mrelax 28745Shorten some address references at link time, when possible; uses the 28746linker option @option{-relax}. 28747 28748@item -mbigtable 28749@opindex mbigtable 28750Use 32-bit offsets in @code{switch} tables. The default is to use 2875116-bit offsets. 28752 28753@item -mbitops 28754@opindex mbitops 28755Enable the use of bit manipulation instructions on SH2A. 28756 28757@item -mfmovd 28758@opindex mfmovd 28759Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 28760alignment constraints. 28761 28762@item -mrenesas 28763@opindex mrenesas 28764Comply with the calling conventions defined by Renesas. 28765 28766@item -mno-renesas 28767@opindex mno-renesas 28768Comply with the calling conventions defined for GCC before the Renesas 28769conventions were available. This option is the default for all 28770targets of the SH toolchain. 28771 28772@item -mnomacsave 28773@opindex mnomacsave 28774Mark the @code{MAC} register as call-clobbered, even if 28775@option{-mrenesas} is given. 28776 28777@item -mieee 28778@itemx -mno-ieee 28779@opindex mieee 28780@opindex mno-ieee 28781Control the IEEE compliance of floating-point comparisons, which affects the 28782handling of cases where the result of a comparison is unordered. By default 28783@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 28784enabled @option{-mno-ieee} is implicitly set, which results in faster 28785floating-point greater-equal and less-equal comparisons. The implicit settings 28786can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 28787 28788@item -minline-ic_invalidate 28789@opindex minline-ic_invalidate 28790Inline code to invalidate instruction cache entries after setting up 28791nested function trampolines. 28792This option has no effect if @option{-musermode} is in effect and the selected 28793code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi} 28794instruction. 28795If the selected code generation option does not allow the use of the @code{icbi} 28796instruction, and @option{-musermode} is not in effect, the inlined code 28797manipulates the instruction cache address array directly with an associative 28798write. This not only requires privileged mode at run time, but it also 28799fails if the cache line had been mapped via the TLB and has become unmapped. 28800 28801@item -misize 28802@opindex misize 28803Dump instruction size and location in the assembly code. 28804 28805@item -mpadstruct 28806@opindex mpadstruct 28807This option is deprecated. It pads structures to multiple of 4 bytes, 28808which is incompatible with the SH ABI@. 28809 28810@item -matomic-model=@var{model} 28811@opindex matomic-model=@var{model} 28812Sets the model of atomic operations and additional parameters as a comma 28813separated list. For details on the atomic built-in functions see 28814@ref{__atomic Builtins}. The following models and parameters are supported: 28815 28816@table @samp 28817 28818@item none 28819Disable compiler generated atomic sequences and emit library calls for atomic 28820operations. This is the default if the target is not @code{sh*-*-linux*}. 28821 28822@item soft-gusa 28823Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 28824built-in functions. The generated atomic sequences require additional support 28825from the interrupt/exception handling code of the system and are only suitable 28826for SH3* and SH4* single-core systems. This option is enabled by default when 28827the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 28828this option also partially utilizes the hardware atomic instructions 28829@code{movli.l} and @code{movco.l} to create more efficient code, unless 28830@samp{strict} is specified. 28831 28832@item soft-tcb 28833Generate software atomic sequences that use a variable in the thread control 28834block. This is a variation of the gUSA sequences which can also be used on 28835SH1* and SH2* targets. The generated atomic sequences require additional 28836support from the interrupt/exception handling code of the system and are only 28837suitable for single-core systems. When using this model, the @samp{gbr-offset=} 28838parameter has to be specified as well. 28839 28840@item soft-imask 28841Generate software atomic sequences that temporarily disable interrupts by 28842setting @code{SR.IMASK = 1111}. This model works only when the program runs 28843in privileged mode and is only suitable for single-core systems. Additional 28844support from the interrupt/exception handling code of the system is not 28845required. This model is enabled by default when the target is 28846@code{sh*-*-linux*} and SH1* or SH2*. 28847 28848@item hard-llcs 28849Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 28850instructions only. This is only available on SH4A and is suitable for 28851multi-core systems. Since the hardware instructions support only 32 bit atomic 28852variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 28853Code compiled with this option is also compatible with other software 28854atomic model interrupt/exception handling systems if executed on an SH4A 28855system. Additional support from the interrupt/exception handling code of the 28856system is not required for this model. 28857 28858@item gbr-offset= 28859This parameter specifies the offset in bytes of the variable in the thread 28860control block structure that should be used by the generated atomic sequences 28861when the @samp{soft-tcb} model has been selected. For other models this 28862parameter is ignored. The specified value must be an integer multiple of four 28863and in the range 0-1020. 28864 28865@item strict 28866This parameter prevents mixed usage of multiple atomic models, even if they 28867are compatible, and makes the compiler generate atomic sequences of the 28868specified model only. 28869 28870@end table 28871 28872@item -mtas 28873@opindex mtas 28874Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 28875Notice that depending on the particular hardware and software configuration 28876this can degrade overall performance due to the operand cache line flushes 28877that are implied by the @code{tas.b} instruction. On multi-core SH4A 28878processors the @code{tas.b} instruction must be used with caution since it 28879can result in data corruption for certain cache configurations. 28880 28881@item -mprefergot 28882@opindex mprefergot 28883When generating position-independent code, emit function calls using 28884the Global Offset Table instead of the Procedure Linkage Table. 28885 28886@item -musermode 28887@itemx -mno-usermode 28888@opindex musermode 28889@opindex mno-usermode 28890Don't allow (allow) the compiler generating privileged mode code. Specifying 28891@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 28892inlined code would not work in user mode. @option{-musermode} is the default 28893when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 28894@option{-musermode} has no effect, since there is no user mode. 28895 28896@item -multcost=@var{number} 28897@opindex multcost=@var{number} 28898Set the cost to assume for a multiply insn. 28899 28900@item -mdiv=@var{strategy} 28901@opindex mdiv=@var{strategy} 28902Set the division strategy to be used for integer division operations. 28903@var{strategy} can be one of: 28904 28905@table @samp 28906 28907@item call-div1 28908Calls a library function that uses the single-step division instruction 28909@code{div1} to perform the operation. Division by zero calculates an 28910unspecified result and does not trap. This is the default except for SH4, 28911SH2A and SHcompact. 28912 28913@item call-fp 28914Calls a library function that performs the operation in double precision 28915floating point. Division by zero causes a floating-point exception. This is 28916the default for SHcompact with FPU. Specifying this for targets that do not 28917have a double precision FPU defaults to @code{call-div1}. 28918 28919@item call-table 28920Calls a library function that uses a lookup table for small divisors and 28921the @code{div1} instruction with case distinction for larger divisors. Division 28922by zero calculates an unspecified result and does not trap. This is the default 28923for SH4. Specifying this for targets that do not have dynamic shift 28924instructions defaults to @code{call-div1}. 28925 28926@end table 28927 28928When a division strategy has not been specified the default strategy is 28929selected based on the current target. For SH2A the default strategy is to 28930use the @code{divs} and @code{divu} instructions instead of library function 28931calls. 28932 28933@item -maccumulate-outgoing-args 28934@opindex maccumulate-outgoing-args 28935Reserve space once for outgoing arguments in the function prologue rather 28936than around each call. Generally beneficial for performance and size. Also 28937needed for unwinding to avoid changing the stack frame around conditional code. 28938 28939@item -mdivsi3_libfunc=@var{name} 28940@opindex mdivsi3_libfunc=@var{name} 28941Set the name of the library function used for 32-bit signed division to 28942@var{name}. 28943This only affects the name used in the @samp{call} division strategies, and 28944the compiler still expects the same sets of input/output/clobbered registers as 28945if this option were not present. 28946 28947@item -mfixed-range=@var{register-range} 28948@opindex mfixed-range 28949Generate code treating the given register range as fixed registers. 28950A fixed register is one that the register allocator cannot use. This is 28951useful when compiling kernel code. A register range is specified as 28952two registers separated by a dash. Multiple register ranges can be 28953specified separated by a comma. 28954 28955@item -mbranch-cost=@var{num} 28956@opindex mbranch-cost=@var{num} 28957Assume @var{num} to be the cost for a branch instruction. Higher numbers 28958make the compiler try to generate more branch-free code if possible. 28959If not specified the value is selected depending on the processor type that 28960is being compiled for. 28961 28962@item -mzdcbranch 28963@itemx -mno-zdcbranch 28964@opindex mzdcbranch 28965@opindex mno-zdcbranch 28966Assume (do not assume) that zero displacement conditional branch instructions 28967@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 28968compiler prefers zero displacement branch code sequences. This is 28969enabled by default when generating code for SH4 and SH4A. It can be explicitly 28970disabled by specifying @option{-mno-zdcbranch}. 28971 28972@item -mcbranch-force-delay-slot 28973@opindex mcbranch-force-delay-slot 28974Force the usage of delay slots for conditional branches, which stuffs the delay 28975slot with a @code{nop} if a suitable instruction cannot be found. By default 28976this option is disabled. It can be enabled to work around hardware bugs as 28977found in the original SH7055. 28978 28979@item -mfused-madd 28980@itemx -mno-fused-madd 28981@opindex mfused-madd 28982@opindex mno-fused-madd 28983Generate code that uses (does not use) the floating-point multiply and 28984accumulate instructions. These instructions are generated by default 28985if hardware floating point is used. The machine-dependent 28986@option{-mfused-madd} option is now mapped to the machine-independent 28987@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 28988mapped to @option{-ffp-contract=off}. 28989 28990@item -mfsca 28991@itemx -mno-fsca 28992@opindex mfsca 28993@opindex mno-fsca 28994Allow or disallow the compiler to emit the @code{fsca} instruction for sine 28995and cosine approximations. The option @option{-mfsca} must be used in 28996combination with @option{-funsafe-math-optimizations}. It is enabled by default 28997when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 28998approximations even if @option{-funsafe-math-optimizations} is in effect. 28999 29000@item -mfsrra 29001@itemx -mno-fsrra 29002@opindex mfsrra 29003@opindex mno-fsrra 29004Allow or disallow the compiler to emit the @code{fsrra} instruction for 29005reciprocal square root approximations. The option @option{-mfsrra} must be used 29006in combination with @option{-funsafe-math-optimizations} and 29007@option{-ffinite-math-only}. It is enabled by default when generating code for 29008SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 29009even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 29010in effect. 29011 29012@item -mpretend-cmove 29013@opindex mpretend-cmove 29014Prefer zero-displacement conditional branches for conditional move instruction 29015patterns. This can result in faster code on the SH4 processor. 29016 29017@item -mfdpic 29018@opindex fdpic 29019Generate code using the FDPIC ABI. 29020 29021@end table 29022 29023@node Solaris 2 Options 29024@subsection Solaris 2 Options 29025@cindex Solaris 2 options 29026 29027These @samp{-m} options are supported on Solaris 2: 29028 29029@table @gcctabopt 29030@item -mclear-hwcap 29031@opindex mclear-hwcap 29032@option{-mclear-hwcap} tells the compiler to remove the hardware 29033capabilities generated by the Solaris assembler. This is only necessary 29034when object files use ISA extensions not supported by the current 29035machine, but check at runtime whether or not to use them. 29036 29037@item -mimpure-text 29038@opindex mimpure-text 29039@option{-mimpure-text}, used in addition to @option{-shared}, tells 29040the compiler to not pass @option{-z text} to the linker when linking a 29041shared object. Using this option, you can link position-dependent 29042code into a shared object. 29043 29044@option{-mimpure-text} suppresses the ``relocations remain against 29045allocatable but non-writable sections'' linker error message. 29046However, the necessary relocations trigger copy-on-write, and the 29047shared object is not actually shared across processes. Instead of 29048using @option{-mimpure-text}, you should compile all source code with 29049@option{-fpic} or @option{-fPIC}. 29050 29051@end table 29052 29053These switches are supported in addition to the above on Solaris 2: 29054 29055@table @gcctabopt 29056@item -pthreads 29057@opindex pthreads 29058This is a synonym for @option{-pthread}. 29059@end table 29060 29061@node SPARC Options 29062@subsection SPARC Options 29063@cindex SPARC options 29064 29065These @samp{-m} options are supported on the SPARC: 29066 29067@table @gcctabopt 29068@item -mno-app-regs 29069@itemx -mapp-regs 29070@opindex mno-app-regs 29071@opindex mapp-regs 29072Specify @option{-mapp-regs} to generate output using the global registers 290732 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 29074global register 1, each global register 2 through 4 is then treated as an 29075allocable register that is clobbered by function calls. This is the default. 29076 29077To be fully SVR4 ABI-compliant at the cost of some performance loss, 29078specify @option{-mno-app-regs}. You should compile libraries and system 29079software with this option. 29080 29081@item -mflat 29082@itemx -mno-flat 29083@opindex mflat 29084@opindex mno-flat 29085With @option{-mflat}, the compiler does not generate save/restore instructions 29086and uses a ``flat'' or single register window model. This model is compatible 29087with the regular register window model. The local registers and the input 29088registers (0--5) are still treated as ``call-saved'' registers and are 29089saved on the stack as needed. 29090 29091With @option{-mno-flat} (the default), the compiler generates save/restore 29092instructions (except for leaf functions). This is the normal operating mode. 29093 29094@item -mfpu 29095@itemx -mhard-float 29096@opindex mfpu 29097@opindex mhard-float 29098Generate output containing floating-point instructions. This is the 29099default. 29100 29101@item -mno-fpu 29102@itemx -msoft-float 29103@opindex mno-fpu 29104@opindex msoft-float 29105Generate output containing library calls for floating point. 29106@strong{Warning:} the requisite libraries are not available for all SPARC 29107targets. Normally the facilities of the machine's usual C compiler are 29108used, but this cannot be done directly in cross-compilation. You must make 29109your own arrangements to provide suitable library functions for 29110cross-compilation. The embedded targets @samp{sparc-*-aout} and 29111@samp{sparclite-*-*} do provide software floating-point support. 29112 29113@option{-msoft-float} changes the calling convention in the output file; 29114therefore, it is only useful if you compile @emph{all} of a program with 29115this option. In particular, you need to compile @file{libgcc.a}, the 29116library that comes with GCC, with @option{-msoft-float} in order for 29117this to work. 29118 29119@item -mhard-quad-float 29120@opindex mhard-quad-float 29121Generate output containing quad-word (long double) floating-point 29122instructions. 29123 29124@item -msoft-quad-float 29125@opindex msoft-quad-float 29126Generate output containing library calls for quad-word (long double) 29127floating-point instructions. The functions called are those specified 29128in the SPARC ABI@. This is the default. 29129 29130As of this writing, there are no SPARC implementations that have hardware 29131support for the quad-word floating-point instructions. They all invoke 29132a trap handler for one of these instructions, and then the trap handler 29133emulates the effect of the instruction. Because of the trap handler overhead, 29134this is much slower than calling the ABI library routines. Thus the 29135@option{-msoft-quad-float} option is the default. 29136 29137@item -mno-unaligned-doubles 29138@itemx -munaligned-doubles 29139@opindex mno-unaligned-doubles 29140@opindex munaligned-doubles 29141Assume that doubles have 8-byte alignment. This is the default. 29142 29143With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 29144alignment only if they are contained in another type, or if they have an 29145absolute address. Otherwise, it assumes they have 4-byte alignment. 29146Specifying this option avoids some rare compatibility problems with code 29147generated by other compilers. It is not the default because it results 29148in a performance loss, especially for floating-point code. 29149 29150@item -muser-mode 29151@itemx -mno-user-mode 29152@opindex muser-mode 29153@opindex mno-user-mode 29154Do not generate code that can only run in supervisor mode. This is relevant 29155only for the @code{casa} instruction emitted for the LEON3 processor. This 29156is the default. 29157 29158@item -mfaster-structs 29159@itemx -mno-faster-structs 29160@opindex mfaster-structs 29161@opindex mno-faster-structs 29162With @option{-mfaster-structs}, the compiler assumes that structures 29163should have 8-byte alignment. This enables the use of pairs of 29164@code{ldd} and @code{std} instructions for copies in structure 29165assignment, in place of twice as many @code{ld} and @code{st} pairs. 29166However, the use of this changed alignment directly violates the SPARC 29167ABI@. Thus, it's intended only for use on targets where the developer 29168acknowledges that their resulting code is not directly in line with 29169the rules of the ABI@. 29170 29171@item -mstd-struct-return 29172@itemx -mno-std-struct-return 29173@opindex mstd-struct-return 29174@opindex mno-std-struct-return 29175With @option{-mstd-struct-return}, the compiler generates checking code 29176in functions returning structures or unions to detect size mismatches 29177between the two sides of function calls, as per the 32-bit ABI@. 29178 29179The default is @option{-mno-std-struct-return}. This option has no effect 29180in 64-bit mode. 29181 29182@item -mlra 29183@itemx -mno-lra 29184@opindex mlra 29185@opindex mno-lra 29186Enable Local Register Allocation. This is the default for SPARC since GCC 7 29187so @option{-mno-lra} needs to be passed to get old Reload. 29188 29189@item -mcpu=@var{cpu_type} 29190@opindex mcpu 29191Set the instruction set, register set, and instruction scheduling parameters 29192for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 29193@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 29194@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 29195@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 29196@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 29197@samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}. 29198 29199Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 29200which selects the best architecture option for the host processor. 29201@option{-mcpu=native} has no effect if GCC does not recognize 29202the processor. 29203 29204Default instruction scheduling parameters are used for values that select 29205an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 29206@samp{sparclite}, @samp{sparclet}, @samp{v9}. 29207 29208Here is a list of each supported architecture and their supported 29209implementations. 29210 29211@table @asis 29212@item v7 29213cypress, leon3v7 29214 29215@item v8 29216supersparc, hypersparc, leon, leon3 29217 29218@item sparclite 29219f930, f934, sparclite86x 29220 29221@item sparclet 29222tsc701 29223 29224@item v9 29225ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, 29226niagara7, m8 29227@end table 29228 29229By default (unless configured otherwise), GCC generates code for the V7 29230variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 29231additionally optimizes it for the Cypress CY7C602 chip, as used in the 29232SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 29233SPARCStation 1, 2, IPX etc. 29234 29235With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 29236architecture. The only difference from V7 code is that the compiler emits 29237the integer multiply and integer divide instructions which exist in SPARC-V8 29238but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 29239optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 292402000 series. 29241 29242With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 29243the SPARC architecture. This adds the integer multiply, integer divide step 29244and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 29245With @option{-mcpu=f930}, the compiler additionally optimizes it for the 29246Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 29247@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 29248MB86934 chip, which is the more recent SPARClite with FPU@. 29249 29250With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 29251the SPARC architecture. This adds the integer multiply, multiply/accumulate, 29252integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 29253but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 29254optimizes it for the TEMIC SPARClet chip. 29255 29256With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 29257architecture. This adds 64-bit integer and floating-point move instructions, 292583 additional floating-point condition code registers and conditional move 29259instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 29260optimizes it for the Sun UltraSPARC I/II/IIi chips. With 29261@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 29262Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 29263@option{-mcpu=niagara}, the compiler additionally optimizes it for 29264Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 29265additionally optimizes it for Sun UltraSPARC T2 chips. With 29266@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 29267UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 29268additionally optimizes it for Sun UltraSPARC T4 chips. With 29269@option{-mcpu=niagara7}, the compiler additionally optimizes it for 29270Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler 29271additionally optimizes it for Oracle M8 chips. 29272 29273@item -mtune=@var{cpu_type} 29274@opindex mtune 29275Set the instruction scheduling parameters for machine type 29276@var{cpu_type}, but do not set the instruction set or register set that the 29277option @option{-mcpu=@var{cpu_type}} does. 29278 29279The same values for @option{-mcpu=@var{cpu_type}} can be used for 29280@option{-mtune=@var{cpu_type}}, but the only useful values are those 29281that select a particular CPU implementation. Those are 29282@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon}, 29283@samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934}, 29284@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 29285@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3}, 29286@samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris 29287and GNU/Linux toolchains, @samp{native} can also be used. 29288 29289@item -mv8plus 29290@itemx -mno-v8plus 29291@opindex mv8plus 29292@opindex mno-v8plus 29293With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 29294difference from the V8 ABI is that the global and out registers are 29295considered 64 bits wide. This is enabled by default on Solaris in 32-bit 29296mode for all SPARC-V9 processors. 29297 29298@item -mvis 29299@itemx -mno-vis 29300@opindex mvis 29301@opindex mno-vis 29302With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 29303Visual Instruction Set extensions. The default is @option{-mno-vis}. 29304 29305@item -mvis2 29306@itemx -mno-vis2 29307@opindex mvis2 29308@opindex mno-vis2 29309With @option{-mvis2}, GCC generates code that takes advantage of 29310version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 29311default is @option{-mvis2} when targeting a cpu that supports such 29312instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 29313also sets @option{-mvis}. 29314 29315@item -mvis3 29316@itemx -mno-vis3 29317@opindex mvis3 29318@opindex mno-vis3 29319With @option{-mvis3}, GCC generates code that takes advantage of 29320version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 29321default is @option{-mvis3} when targeting a cpu that supports such 29322instructions, such as niagara-3 and later. Setting @option{-mvis3} 29323also sets @option{-mvis2} and @option{-mvis}. 29324 29325@item -mvis4 29326@itemx -mno-vis4 29327@opindex mvis4 29328@opindex mno-vis4 29329With @option{-mvis4}, GCC generates code that takes advantage of 29330version 4.0 of the UltraSPARC Visual Instruction Set extensions. The 29331default is @option{-mvis4} when targeting a cpu that supports such 29332instructions, such as niagara-7 and later. Setting @option{-mvis4} 29333also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}. 29334 29335@item -mvis4b 29336@itemx -mno-vis4b 29337@opindex mvis4b 29338@opindex mno-vis4b 29339With @option{-mvis4b}, GCC generates code that takes advantage of 29340version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus 29341the additional VIS instructions introduced in the Oracle SPARC 29342Architecture 2017. The default is @option{-mvis4b} when targeting a 29343cpu that supports such instructions, such as m8 and later. Setting 29344@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3}, 29345@option{-mvis2} and @option{-mvis}. 29346 29347@item -mcbcond 29348@itemx -mno-cbcond 29349@opindex mcbcond 29350@opindex mno-cbcond 29351With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC 29352Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond} 29353when targeting a CPU that supports such instructions, such as Niagara-4 and 29354later. 29355 29356@item -mfmaf 29357@itemx -mno-fmaf 29358@opindex mfmaf 29359@opindex mno-fmaf 29360With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 29361Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf} 29362when targeting a CPU that supports such instructions, such as Niagara-3 and 29363later. 29364 29365@item -mfsmuld 29366@itemx -mno-fsmuld 29367@opindex mfsmuld 29368@opindex mno-fsmuld 29369With @option{-mfsmuld}, GCC generates code that takes advantage of the 29370Floating-point Multiply Single to Double (FsMULd) instruction. The default is 29371@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8 29372or V9 with FPU except @option{-mcpu=leon}. 29373 29374@item -mpopc 29375@itemx -mno-popc 29376@opindex mpopc 29377@opindex mno-popc 29378With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 29379Population Count instruction. The default is @option{-mpopc} 29380when targeting a CPU that supports such an instruction, such as Niagara-2 and 29381later. 29382 29383@item -msubxc 29384@itemx -mno-subxc 29385@opindex msubxc 29386@opindex mno-subxc 29387With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC 29388Subtract-Extended-with-Carry instruction. The default is @option{-msubxc} 29389when targeting a CPU that supports such an instruction, such as Niagara-7 and 29390later. 29391 29392@item -mfix-at697f 29393@opindex mfix-at697f 29394Enable the documented workaround for the single erratum of the Atmel AT697F 29395processor (which corresponds to erratum #13 of the AT697E processor). 29396 29397@item -mfix-ut699 29398@opindex mfix-ut699 29399Enable the documented workarounds for the floating-point errata and the data 29400cache nullify errata of the UT699 processor. 29401 29402@item -mfix-ut700 29403@opindex mfix-ut700 29404Enable the documented workaround for the back-to-back store errata of 29405the UT699E/UT700 processor. 29406 29407@item -mfix-gr712rc 29408@opindex mfix-gr712rc 29409Enable the documented workaround for the back-to-back store errata of 29410the GR712RC processor. 29411@end table 29412 29413These @samp{-m} options are supported in addition to the above 29414on SPARC-V9 processors in 64-bit environments: 29415 29416@table @gcctabopt 29417@item -m32 29418@itemx -m64 29419@opindex m32 29420@opindex m64 29421Generate code for a 32-bit or 64-bit environment. 29422The 32-bit environment sets int, long and pointer to 32 bits. 29423The 64-bit environment sets int to 32 bits and long and pointer 29424to 64 bits. 29425 29426@item -mcmodel=@var{which} 29427@opindex mcmodel 29428Set the code model to one of 29429 29430@table @samp 29431@item medlow 29432The Medium/Low code model: 64-bit addresses, programs 29433must be linked in the low 32 bits of memory. Programs can be statically 29434or dynamically linked. 29435 29436@item medmid 29437The Medium/Middle code model: 64-bit addresses, programs 29438must be linked in the low 44 bits of memory, the text and data segments must 29439be less than 2GB in size and the data segment must be located within 2GB of 29440the text segment. 29441 29442@item medany 29443The Medium/Anywhere code model: 64-bit addresses, programs 29444may be linked anywhere in memory, the text and data segments must be less 29445than 2GB in size and the data segment must be located within 2GB of the 29446text segment. 29447 29448@item embmedany 29449The Medium/Anywhere code model for embedded systems: 2945064-bit addresses, the text and data segments must be less than 2GB in 29451size, both starting anywhere in memory (determined at link time). The 29452global register %g4 points to the base of the data segment. Programs 29453are statically linked and PIC is not supported. 29454@end table 29455 29456@item -mmemory-model=@var{mem-model} 29457@opindex mmemory-model 29458Set the memory model in force on the processor to one of 29459 29460@table @samp 29461@item default 29462The default memory model for the processor and operating system. 29463 29464@item rmo 29465Relaxed Memory Order 29466 29467@item pso 29468Partial Store Order 29469 29470@item tso 29471Total Store Order 29472 29473@item sc 29474Sequential Consistency 29475@end table 29476 29477These memory models are formally defined in Appendix D of the SPARC-V9 29478architecture manual, as set in the processor's @code{PSTATE.MM} field. 29479 29480@item -mstack-bias 29481@itemx -mno-stack-bias 29482@opindex mstack-bias 29483@opindex mno-stack-bias 29484With @option{-mstack-bias}, GCC assumes that the stack pointer, and 29485frame pointer if present, are offset by @minus{}2047 which must be added back 29486when making stack frame references. This is the default in 64-bit mode. 29487Otherwise, assume no such offset is present. 29488@end table 29489 29490@node System V Options 29491@subsection Options for System V 29492 29493These additional options are available on System V Release 4 for 29494compatibility with other compilers on those systems: 29495 29496@table @gcctabopt 29497@item -G 29498@opindex G 29499Create a shared object. 29500It is recommended that @option{-symbolic} or @option{-shared} be used instead. 29501 29502@item -Qy 29503@opindex Qy 29504Identify the versions of each tool used by the compiler, in a 29505@code{.ident} assembler directive in the output. 29506 29507@item -Qn 29508@opindex Qn 29509Refrain from adding @code{.ident} directives to the output file (this is 29510the default). 29511 29512@item -YP,@var{dirs} 29513@opindex YP 29514Search the directories @var{dirs}, and no others, for libraries 29515specified with @option{-l}. 29516 29517@item -Ym,@var{dir} 29518@opindex Ym 29519Look in the directory @var{dir} to find the M4 preprocessor. 29520The assembler uses this option. 29521@c This is supposed to go with a -Yd for predefined M4 macro files, but 29522@c the generic assembler that comes with Solaris takes just -Ym. 29523@end table 29524 29525@node TILE-Gx Options 29526@subsection TILE-Gx Options 29527@cindex TILE-Gx options 29528 29529These @samp{-m} options are supported on the TILE-Gx: 29530 29531@table @gcctabopt 29532@item -mcmodel=small 29533@opindex mcmodel=small 29534Generate code for the small model. The distance for direct calls is 29535limited to 500M in either direction. PC-relative addresses are 32 29536bits. Absolute addresses support the full address range. 29537 29538@item -mcmodel=large 29539@opindex mcmodel=large 29540Generate code for the large model. There is no limitation on call 29541distance, pc-relative addresses, or absolute addresses. 29542 29543@item -mcpu=@var{name} 29544@opindex mcpu 29545Selects the type of CPU to be targeted. Currently the only supported 29546type is @samp{tilegx}. 29547 29548@item -m32 29549@itemx -m64 29550@opindex m32 29551@opindex m64 29552Generate code for a 32-bit or 64-bit environment. The 32-bit 29553environment sets int, long, and pointer to 32 bits. The 64-bit 29554environment sets int to 32 bits and long and pointer to 64 bits. 29555 29556@item -mbig-endian 29557@itemx -mlittle-endian 29558@opindex mbig-endian 29559@opindex mlittle-endian 29560Generate code in big/little endian mode, respectively. 29561@end table 29562 29563@node TILEPro Options 29564@subsection TILEPro Options 29565@cindex TILEPro options 29566 29567These @samp{-m} options are supported on the TILEPro: 29568 29569@table @gcctabopt 29570@item -mcpu=@var{name} 29571@opindex mcpu 29572Selects the type of CPU to be targeted. Currently the only supported 29573type is @samp{tilepro}. 29574 29575@item -m32 29576@opindex m32 29577Generate code for a 32-bit environment, which sets int, long, and 29578pointer to 32 bits. This is the only supported behavior so the flag 29579is essentially ignored. 29580@end table 29581 29582@node V850 Options 29583@subsection V850 Options 29584@cindex V850 Options 29585 29586These @samp{-m} options are defined for V850 implementations: 29587 29588@table @gcctabopt 29589@item -mlong-calls 29590@itemx -mno-long-calls 29591@opindex mlong-calls 29592@opindex mno-long-calls 29593Treat all calls as being far away (near). If calls are assumed to be 29594far away, the compiler always loads the function's address into a 29595register, and calls indirect through the pointer. 29596 29597@item -mno-ep 29598@itemx -mep 29599@opindex mno-ep 29600@opindex mep 29601Do not optimize (do optimize) basic blocks that use the same index 29602pointer 4 or more times to copy pointer into the @code{ep} register, and 29603use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 29604option is on by default if you optimize. 29605 29606@item -mno-prolog-function 29607@itemx -mprolog-function 29608@opindex mno-prolog-function 29609@opindex mprolog-function 29610Do not use (do use) external functions to save and restore registers 29611at the prologue and epilogue of a function. The external functions 29612are slower, but use less code space if more than one function saves 29613the same number of registers. The @option{-mprolog-function} option 29614is on by default if you optimize. 29615 29616@item -mspace 29617@opindex mspace 29618Try to make the code as small as possible. At present, this just turns 29619on the @option{-mep} and @option{-mprolog-function} options. 29620 29621@item -mtda=@var{n} 29622@opindex mtda 29623Put static or global variables whose size is @var{n} bytes or less into 29624the tiny data area that register @code{ep} points to. The tiny data 29625area can hold up to 256 bytes in total (128 bytes for byte references). 29626 29627@item -msda=@var{n} 29628@opindex msda 29629Put static or global variables whose size is @var{n} bytes or less into 29630the small data area that register @code{gp} points to. The small data 29631area can hold up to 64 kilobytes. 29632 29633@item -mzda=@var{n} 29634@opindex mzda 29635Put static or global variables whose size is @var{n} bytes or less into 29636the first 32 kilobytes of memory. 29637 29638@item -mv850 29639@opindex mv850 29640Specify that the target processor is the V850. 29641 29642@item -mv850e3v5 29643@opindex mv850e3v5 29644Specify that the target processor is the V850E3V5. The preprocessor 29645constant @code{__v850e3v5__} is defined if this option is used. 29646 29647@item -mv850e2v4 29648@opindex mv850e2v4 29649Specify that the target processor is the V850E3V5. This is an alias for 29650the @option{-mv850e3v5} option. 29651 29652@item -mv850e2v3 29653@opindex mv850e2v3 29654Specify that the target processor is the V850E2V3. The preprocessor 29655constant @code{__v850e2v3__} is defined if this option is used. 29656 29657@item -mv850e2 29658@opindex mv850e2 29659Specify that the target processor is the V850E2. The preprocessor 29660constant @code{__v850e2__} is defined if this option is used. 29661 29662@item -mv850e1 29663@opindex mv850e1 29664Specify that the target processor is the V850E1. The preprocessor 29665constants @code{__v850e1__} and @code{__v850e__} are defined if 29666this option is used. 29667 29668@item -mv850es 29669@opindex mv850es 29670Specify that the target processor is the V850ES. This is an alias for 29671the @option{-mv850e1} option. 29672 29673@item -mv850e 29674@opindex mv850e 29675Specify that the target processor is the V850E@. The preprocessor 29676constant @code{__v850e__} is defined if this option is used. 29677 29678If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 29679nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 29680are defined then a default target processor is chosen and the 29681relevant @samp{__v850*__} preprocessor constant is defined. 29682 29683The preprocessor constants @code{__v850} and @code{__v851__} are always 29684defined, regardless of which processor variant is the target. 29685 29686@item -mdisable-callt 29687@itemx -mno-disable-callt 29688@opindex mdisable-callt 29689@opindex mno-disable-callt 29690This option suppresses generation of the @code{CALLT} instruction for the 29691v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 29692architecture. 29693 29694This option is enabled by default when the RH850 ABI is 29695in use (see @option{-mrh850-abi}), and disabled by default when the 29696GCC ABI is in use. If @code{CALLT} instructions are being generated 29697then the C preprocessor symbol @code{__V850_CALLT__} is defined. 29698 29699@item -mrelax 29700@itemx -mno-relax 29701@opindex mrelax 29702@opindex mno-relax 29703Pass on (or do not pass on) the @option{-mrelax} command-line option 29704to the assembler. 29705 29706@item -mlong-jumps 29707@itemx -mno-long-jumps 29708@opindex mlong-jumps 29709@opindex mno-long-jumps 29710Disable (or re-enable) the generation of PC-relative jump instructions. 29711 29712@item -msoft-float 29713@itemx -mhard-float 29714@opindex msoft-float 29715@opindex mhard-float 29716Disable (or re-enable) the generation of hardware floating point 29717instructions. This option is only significant when the target 29718architecture is @samp{V850E2V3} or higher. If hardware floating point 29719instructions are being generated then the C preprocessor symbol 29720@code{__FPU_OK__} is defined, otherwise the symbol 29721@code{__NO_FPU__} is defined. 29722 29723@item -mloop 29724@opindex mloop 29725Enables the use of the e3v5 LOOP instruction. The use of this 29726instruction is not enabled by default when the e3v5 architecture is 29727selected because its use is still experimental. 29728 29729@item -mrh850-abi 29730@itemx -mghs 29731@opindex mrh850-abi 29732@opindex mghs 29733Enables support for the RH850 version of the V850 ABI. This is the 29734default. With this version of the ABI the following rules apply: 29735 29736@itemize 29737@item 29738Integer sized structures and unions are returned via a memory pointer 29739rather than a register. 29740 29741@item 29742Large structures and unions (more than 8 bytes in size) are passed by 29743value. 29744 29745@item 29746Functions are aligned to 16-bit boundaries. 29747 29748@item 29749The @option{-m8byte-align} command-line option is supported. 29750 29751@item 29752The @option{-mdisable-callt} command-line option is enabled by 29753default. The @option{-mno-disable-callt} command-line option is not 29754supported. 29755@end itemize 29756 29757When this version of the ABI is enabled the C preprocessor symbol 29758@code{__V850_RH850_ABI__} is defined. 29759 29760@item -mgcc-abi 29761@opindex mgcc-abi 29762Enables support for the old GCC version of the V850 ABI. With this 29763version of the ABI the following rules apply: 29764 29765@itemize 29766@item 29767Integer sized structures and unions are returned in register @code{r10}. 29768 29769@item 29770Large structures and unions (more than 8 bytes in size) are passed by 29771reference. 29772 29773@item 29774Functions are aligned to 32-bit boundaries, unless optimizing for 29775size. 29776 29777@item 29778The @option{-m8byte-align} command-line option is not supported. 29779 29780@item 29781The @option{-mdisable-callt} command-line option is supported but not 29782enabled by default. 29783@end itemize 29784 29785When this version of the ABI is enabled the C preprocessor symbol 29786@code{__V850_GCC_ABI__} is defined. 29787 29788@item -m8byte-align 29789@itemx -mno-8byte-align 29790@opindex m8byte-align 29791@opindex mno-8byte-align 29792Enables support for @code{double} and @code{long long} types to be 29793aligned on 8-byte boundaries. The default is to restrict the 29794alignment of all objects to at most 4-bytes. When 29795@option{-m8byte-align} is in effect the C preprocessor symbol 29796@code{__V850_8BYTE_ALIGN__} is defined. 29797 29798@item -mbig-switch 29799@opindex mbig-switch 29800Generate code suitable for big switch tables. Use this option only if 29801the assembler/linker complain about out of range branches within a switch 29802table. 29803 29804@item -mapp-regs 29805@opindex mapp-regs 29806This option causes r2 and r5 to be used in the code generated by 29807the compiler. This setting is the default. 29808 29809@item -mno-app-regs 29810@opindex mno-app-regs 29811This option causes r2 and r5 to be treated as fixed registers. 29812 29813@end table 29814 29815@node VAX Options 29816@subsection VAX Options 29817@cindex VAX options 29818 29819These @samp{-m} options are defined for the VAX: 29820 29821@table @gcctabopt 29822@item -munix 29823@opindex munix 29824Do not output certain jump instructions (@code{aobleq} and so on) 29825that the Unix assembler for the VAX cannot handle across long 29826ranges. 29827 29828@item -mgnu 29829@opindex mgnu 29830Do output those jump instructions, on the assumption that the 29831GNU assembler is being used. 29832 29833@item -mg 29834@opindex mg 29835Output code for G-format floating-point numbers instead of D-format. 29836@end table 29837 29838@node Visium Options 29839@subsection Visium Options 29840@cindex Visium options 29841 29842@table @gcctabopt 29843 29844@item -mdebug 29845@opindex mdebug 29846A program which performs file I/O and is destined to run on an MCM target 29847should be linked with this option. It causes the libraries libc.a and 29848libdebug.a to be linked. The program should be run on the target under 29849the control of the GDB remote debugging stub. 29850 29851@item -msim 29852@opindex msim 29853A program which performs file I/O and is destined to run on the simulator 29854should be linked with option. This causes libraries libc.a and libsim.a to 29855be linked. 29856 29857@item -mfpu 29858@itemx -mhard-float 29859@opindex mfpu 29860@opindex mhard-float 29861Generate code containing floating-point instructions. This is the 29862default. 29863 29864@item -mno-fpu 29865@itemx -msoft-float 29866@opindex mno-fpu 29867@opindex msoft-float 29868Generate code containing library calls for floating-point. 29869 29870@option{-msoft-float} changes the calling convention in the output file; 29871therefore, it is only useful if you compile @emph{all} of a program with 29872this option. In particular, you need to compile @file{libgcc.a}, the 29873library that comes with GCC, with @option{-msoft-float} in order for 29874this to work. 29875 29876@item -mcpu=@var{cpu_type} 29877@opindex mcpu 29878Set the instruction set, register set, and instruction scheduling parameters 29879for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 29880@samp{mcm}, @samp{gr5} and @samp{gr6}. 29881 29882@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 29883 29884By default (unless configured otherwise), GCC generates code for the GR5 29885variant of the Visium architecture. 29886 29887With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 29888architecture. The only difference from GR5 code is that the compiler will 29889generate block move instructions. 29890 29891@item -mtune=@var{cpu_type} 29892@opindex mtune 29893Set the instruction scheduling parameters for machine type @var{cpu_type}, 29894but do not set the instruction set or register set that the option 29895@option{-mcpu=@var{cpu_type}} would. 29896 29897@item -msv-mode 29898@opindex msv-mode 29899Generate code for the supervisor mode, where there are no restrictions on 29900the access to general registers. This is the default. 29901 29902@item -muser-mode 29903@opindex muser-mode 29904Generate code for the user mode, where the access to some general registers 29905is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 29906mode; on the GR6, only registers r29 to r31 are affected. 29907@end table 29908 29909@node VMS Options 29910@subsection VMS Options 29911 29912These @samp{-m} options are defined for the VMS implementations: 29913 29914@table @gcctabopt 29915@item -mvms-return-codes 29916@opindex mvms-return-codes 29917Return VMS condition codes from @code{main}. The default is to return POSIX-style 29918condition (e.g.@: error) codes. 29919 29920@item -mdebug-main=@var{prefix} 29921@opindex mdebug-main=@var{prefix} 29922Flag the first routine whose name starts with @var{prefix} as the main 29923routine for the debugger. 29924 29925@item -mmalloc64 29926@opindex mmalloc64 29927Default to 64-bit memory allocation routines. 29928 29929@item -mpointer-size=@var{size} 29930@opindex mpointer-size=@var{size} 29931Set the default size of pointers. Possible options for @var{size} are 29932@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 29933for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 29934The later option disables @code{pragma pointer_size}. 29935@end table 29936 29937@node VxWorks Options 29938@subsection VxWorks Options 29939@cindex VxWorks Options 29940 29941The options in this section are defined for all VxWorks targets. 29942Options specific to the target hardware are listed with the other 29943options for that target. 29944 29945@table @gcctabopt 29946@item -mrtp 29947@opindex mrtp 29948GCC can generate code for both VxWorks kernels and real time processes 29949(RTPs). This option switches from the former to the latter. It also 29950defines the preprocessor macro @code{__RTP__}. 29951 29952@item -non-static 29953@opindex non-static 29954Link an RTP executable against shared libraries rather than static 29955libraries. The options @option{-static} and @option{-shared} can 29956also be used for RTPs (@pxref{Link Options}); @option{-static} 29957is the default. 29958 29959@item -Bstatic 29960@itemx -Bdynamic 29961@opindex Bstatic 29962@opindex Bdynamic 29963These options are passed down to the linker. They are defined for 29964compatibility with Diab. 29965 29966@item -Xbind-lazy 29967@opindex Xbind-lazy 29968Enable lazy binding of function calls. This option is equivalent to 29969@option{-Wl,-z,now} and is defined for compatibility with Diab. 29970 29971@item -Xbind-now 29972@opindex Xbind-now 29973Disable lazy binding of function calls. This option is the default and 29974is defined for compatibility with Diab. 29975@end table 29976 29977@node x86 Options 29978@subsection x86 Options 29979@cindex x86 Options 29980 29981These @samp{-m} options are defined for the x86 family of computers. 29982 29983@table @gcctabopt 29984 29985@item -march=@var{cpu-type} 29986@opindex march 29987Generate instructions for the machine type @var{cpu-type}. In contrast to 29988@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 29989for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 29990to generate code that may not run at all on processors other than the one 29991indicated. Specifying @option{-march=@var{cpu-type}} implies 29992@option{-mtune=@var{cpu-type}}, except where noted otherwise. 29993 29994The choices for @var{cpu-type} are: 29995 29996@table @samp 29997@item native 29998This selects the CPU to generate code for at compilation time by determining 29999the processor type of the compiling machine. Using @option{-march=native} 30000enables all instruction subsets supported by the local machine (hence 30001the result might not run on different machines). Using @option{-mtune=native} 30002produces code optimized for the local machine under the constraints 30003of the selected instruction set. 30004 30005@item x86-64 30006A generic CPU with 64-bit extensions. 30007 30008@item x86-64-v2 30009@itemx x86-64-v3 30010@itemx x86-64-v4 30011These choices for @var{cpu-type} select the corresponding 30012micro-architecture level from the x86-64 psABI. On ABIs other than 30013the x86-64 psABI they select the same CPU features as the x86-64 psABI 30014documents for the particular micro-architecture level. 30015 30016Since these @var{cpu-type} values do not have a corresponding 30017@option{-mtune} setting, using @option{-march} with these values enables 30018generic tuning. Specific tuning can be enabled using the 30019@option{-mtune=@var{other-cpu-type}} option with an appropriate 30020@var{other-cpu-type} value. 30021 30022@item i386 30023Original Intel i386 CPU@. 30024 30025@item i486 30026Intel i486 CPU@. (No scheduling is implemented for this chip.) 30027 30028@item i586 30029@itemx pentium 30030Intel Pentium CPU with no MMX support. 30031 30032@item lakemont 30033Intel Lakemont MCU, based on Intel Pentium CPU. 30034 30035@item pentium-mmx 30036Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 30037 30038@item pentiumpro 30039Intel Pentium Pro CPU@. 30040 30041@item i686 30042When used with @option{-march}, the Pentium Pro 30043instruction set is used, so the code runs on all i686 family chips. 30044When used with @option{-mtune}, it has the same meaning as @samp{generic}. 30045 30046@item pentium2 30047Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 30048support. 30049 30050@item pentium3 30051@itemx pentium3m 30052Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 30053set support. 30054 30055@item pentium-m 30056Intel Pentium M; low-power version of Intel Pentium III CPU 30057with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 30058 30059@item pentium4 30060@itemx pentium4m 30061Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 30062 30063@item prescott 30064Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 30065set support. 30066 30067@item nocona 30068Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 30069SSE2 and SSE3 instruction set support. 30070 30071@item core2 30072Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 30073instruction set support. 30074 30075@item nehalem 30076Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 30077SSE4.1, SSE4.2 and POPCNT instruction set support. 30078 30079@item westmere 30080Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 30081SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. 30082 30083@item sandybridge 30084Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 30085SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. 30086 30087@item ivybridge 30088Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 30089SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C 30090instruction set support. 30091 30092@item haswell 30093Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30094SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 30095BMI, BMI2 and F16C instruction set support. 30096 30097@item broadwell 30098Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30099SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, 30100F16C, RDSEED ADCX and PREFETCHW instruction set support. 30101 30102@item skylake 30103Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30104SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 30105BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES 30106instruction set support. 30107 30108@item bonnell 30109Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 30110instruction set support. 30111 30112@item silvermont 30113Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30114SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support. 30115 30116@item goldmont 30117Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30118SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, 30119XSAVEOPT and FSGSBASE instruction set support. 30120 30121@item goldmont-plus 30122Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 30123SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, 30124XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support. 30125 30126@item tremont 30127Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30128SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, 30129XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, 30130MOVDIR64B, CLDEMOTE and WAITPKG instruction set support. 30131 30132@item knl 30133Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 30134SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 30135BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, 30136AVX512ER and AVX512CD instruction set support. 30137 30138@item knm 30139Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 30140SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 30141BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, 30142AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction 30143set support. 30144 30145@item skylake-avx512 30146Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 30147SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 30148BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, 30149CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support. 30150 30151@item cannonlake 30152Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 30153SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 30154RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 30155XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 30156AVX512IFMA, SHA and UMIP instruction set support. 30157 30158@item icelake-client 30159Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 30160SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 30161RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 30162XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 30163AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 30164AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support. 30165 30166@item icelake-server 30167Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 30168SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 30169RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 30170XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 30171AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 30172AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction 30173set support. 30174 30175@item cascadelake 30176Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30177SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, 30178BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, 30179AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support. 30180 30181@item cooperlake 30182Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30183SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, 30184BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, 30185AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction 30186set support. 30187 30188@item tigerlake 30189Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30190SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, 30191BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, 30192AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP, 30193RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ, 30194VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER 30195instruction set support. 30196 30197@item sapphirerapids 30198Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 30199SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, 30200FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, 30201AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16, 30202MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, 30203SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8 and AVX-VNNI 30204instruction set support. 30205 30206@item alderlake 30207Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 30208SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, 30209XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, 30210MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, 30211PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI 30212instruction set support. 30213 30214@item rocketlake 30215Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 30216SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 30217RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 30218XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 30219AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 30220AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support. 30221 30222@item k6 30223AMD K6 CPU with MMX instruction set support. 30224 30225@item k6-2 30226@itemx k6-3 30227Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 30228 30229@item athlon 30230@itemx athlon-tbird 30231AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 30232support. 30233 30234@item athlon-4 30235@itemx athlon-xp 30236@itemx athlon-mp 30237Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 30238instruction set support. 30239 30240@item k8 30241@itemx opteron 30242@itemx athlon64 30243@itemx athlon-fx 30244Processors based on the AMD K8 core with x86-64 instruction set support, 30245including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 30246(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 30247instruction set extensions.) 30248 30249@item k8-sse3 30250@itemx opteron-sse3 30251@itemx athlon64-sse3 30252Improved versions of AMD K8 cores with SSE3 instruction set support. 30253 30254@item amdfam10 30255@itemx barcelona 30256CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 30257supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 30258instruction set extensions.) 30259 30260@item bdver1 30261CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 30262supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 30263SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 30264 30265@item bdver2 30266AMD Family 15h core based CPUs with x86-64 instruction set support. (This 30267supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, 30268SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 30269extensions.) 30270 30271@item bdver3 30272AMD Family 15h core based CPUs with x86-64 instruction set support. (This 30273supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 30274PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 3027564-bit instruction set extensions.) 30276 30277@item bdver4 30278AMD Family 15h core based CPUs with x86-64 instruction set support. (This 30279supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 30280AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 30281SSE4.2, ABM and 64-bit instruction set extensions.) 30282 30283@item znver1 30284AMD Family 17h core based CPUs with x86-64 instruction set support. (This 30285supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, 30286SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, 30287SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 30288instruction set extensions.) 30289 30290@item znver2 30291AMD Family 17h core based CPUs with x86-64 instruction set support. (This 30292supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 30293MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 30294SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, 30295WBNOINVD, and 64-bit instruction set extensions.) 30296 30297@item znver3 30298AMD Family 19h core based CPUs with x86-64 instruction set support. (This 30299supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 30300MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 30301SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, 30302WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.) 30303 30304@item btver1 30305CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 30306supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 30307instruction set extensions.) 30308 30309@item btver2 30310CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 30311includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM, 30312SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 30313 30314@item winchip-c6 30315IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 30316set support. 30317 30318@item winchip2 30319IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 30320instruction set support. 30321 30322@item c3 30323VIA C3 CPU with MMX and 3DNow!@: instruction set support. 30324(No scheduling is implemented for this chip.) 30325 30326@item c3-2 30327VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 30328(No scheduling is implemented for this chip.) 30329 30330@item c7 30331VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 30332(No scheduling is implemented for this chip.) 30333 30334@item samuel-2 30335VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support. 30336(No scheduling is implemented for this chip.) 30337 30338@item nehemiah 30339VIA Eden Nehemiah CPU with MMX and SSE instruction set support. 30340(No scheduling is implemented for this chip.) 30341 30342@item esther 30343VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 30344(No scheduling is implemented for this chip.) 30345 30346@item eden-x2 30347VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. 30348(No scheduling is implemented for this chip.) 30349 30350@item eden-x4 30351VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, 30352AVX and AVX2 instruction set support. 30353(No scheduling is implemented for this chip.) 30354 30355@item nano 30356Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 30357instruction set support. 30358(No scheduling is implemented for this chip.) 30359 30360@item nano-1000 30361VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 30362instruction set support. 30363(No scheduling is implemented for this chip.) 30364 30365@item nano-2000 30366VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 30367instruction set support. 30368(No scheduling is implemented for this chip.) 30369 30370@item nano-3000 30371VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 30372instruction set support. 30373(No scheduling is implemented for this chip.) 30374 30375@item nano-x2 30376VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 30377instruction set support. 30378(No scheduling is implemented for this chip.) 30379 30380@item nano-x4 30381VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 30382instruction set support. 30383(No scheduling is implemented for this chip.) 30384 30385@item geode 30386AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 30387@end table 30388 30389@item -mtune=@var{cpu-type} 30390@opindex mtune 30391Tune to @var{cpu-type} everything applicable about the generated code, except 30392for the ABI and the set of available instructions. 30393While picking a specific @var{cpu-type} schedules things appropriately 30394for that particular chip, the compiler does not generate any code that 30395cannot run on the default machine type unless you use a 30396@option{-march=@var{cpu-type}} option. 30397For example, if GCC is configured for i686-pc-linux-gnu 30398then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 30399but still runs on i686 machines. 30400 30401The choices for @var{cpu-type} are the same as for @option{-march}. 30402In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 30403 30404@table @samp 30405@item generic 30406Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 30407If you know the CPU on which your code will run, then you should use 30408the corresponding @option{-mtune} or @option{-march} option instead of 30409@option{-mtune=generic}. But, if you do not know exactly what CPU users 30410of your application will have, then you should use this option. 30411 30412As new processors are deployed in the marketplace, the behavior of this 30413option will change. Therefore, if you upgrade to a newer version of 30414GCC, code generation controlled by this option will change to reflect 30415the processors 30416that are most common at the time that version of GCC is released. 30417 30418There is no @option{-march=generic} option because @option{-march} 30419indicates the instruction set the compiler can use, and there is no 30420generic instruction set applicable to all processors. In contrast, 30421@option{-mtune} indicates the processor (or, in this case, collection of 30422processors) for which the code is optimized. 30423 30424@item intel 30425Produce code optimized for the most current Intel processors, which are 30426Haswell and Silvermont for this version of GCC. If you know the CPU 30427on which your code will run, then you should use the corresponding 30428@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 30429But, if you want your application performs better on both Haswell and 30430Silvermont, then you should use this option. 30431 30432As new Intel processors are deployed in the marketplace, the behavior of 30433this option will change. Therefore, if you upgrade to a newer version of 30434GCC, code generation controlled by this option will change to reflect 30435the most current Intel processors at the time that version of GCC is 30436released. 30437 30438There is no @option{-march=intel} option because @option{-march} indicates 30439the instruction set the compiler can use, and there is no common 30440instruction set applicable to all processors. In contrast, 30441@option{-mtune} indicates the processor (or, in this case, collection of 30442processors) for which the code is optimized. 30443@end table 30444 30445@item -mcpu=@var{cpu-type} 30446@opindex mcpu 30447A deprecated synonym for @option{-mtune}. 30448 30449@item -mfpmath=@var{unit} 30450@opindex mfpmath 30451Generate floating-point arithmetic for selected unit @var{unit}. The choices 30452for @var{unit} are: 30453 30454@table @samp 30455@item 387 30456Use the standard 387 floating-point coprocessor present on the majority of chips and 30457emulated otherwise. Code compiled with this option runs almost everywhere. 30458The temporary results are computed in 80-bit precision instead of the precision 30459specified by the type, resulting in slightly different results compared to most 30460of other chips. See @option{-ffloat-store} for more detailed description. 30461 30462This is the default choice for non-Darwin x86-32 targets. 30463 30464@item sse 30465Use scalar floating-point instructions present in the SSE instruction set. 30466This instruction set is supported by Pentium III and newer chips, 30467and in the AMD line 30468by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 30469instruction set supports only single-precision arithmetic, thus the double and 30470extended-precision arithmetic are still done using 387. A later version, present 30471only in Pentium 4 and AMD x86-64 chips, supports double-precision 30472arithmetic too. 30473 30474For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 30475or @option{-msse2} switches to enable SSE extensions and make this option 30476effective. For the x86-64 compiler, these extensions are enabled by default. 30477 30478The resulting code should be considerably faster in the majority of cases and avoid 30479the numerical instability problems of 387 code, but may break some existing 30480code that expects temporaries to be 80 bits. 30481 30482This is the default choice for the x86-64 compiler, Darwin x86-32 targets, 30483and the default choice for x86-32 targets with the SSE2 instruction set 30484when @option{-ffast-math} is enabled. 30485 30486@item sse,387 30487@itemx sse+387 30488@itemx both 30489Attempt to utilize both instruction sets at once. This effectively doubles the 30490amount of available registers, and on chips with separate execution units for 30491387 and SSE the execution resources too. Use this option with care, as it is 30492still experimental, because the GCC register allocator does not model separate 30493functional units well, resulting in unstable performance. 30494@end table 30495 30496@item -masm=@var{dialect} 30497@opindex masm=@var{dialect} 30498Output assembly instructions using selected @var{dialect}. Also affects 30499which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 30500extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 30501order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 30502not support @samp{intel}. 30503 30504@item -mieee-fp 30505@itemx -mno-ieee-fp 30506@opindex mieee-fp 30507@opindex mno-ieee-fp 30508Control whether or not the compiler uses IEEE floating-point 30509comparisons. These correctly handle the case where the result of a 30510comparison is unordered. 30511 30512@item -m80387 30513@itemx -mhard-float 30514@opindex 80387 30515@opindex mhard-float 30516Generate output containing 80387 instructions for floating point. 30517 30518@item -mno-80387 30519@itemx -msoft-float 30520@opindex no-80387 30521@opindex msoft-float 30522Generate output containing library calls for floating point. 30523 30524@strong{Warning:} the requisite libraries are not part of GCC@. 30525Normally the facilities of the machine's usual C compiler are used, but 30526this cannot be done directly in cross-compilation. You must make your 30527own arrangements to provide suitable library functions for 30528cross-compilation. 30529 30530On machines where a function returns floating-point results in the 80387 30531register stack, some floating-point opcodes may be emitted even if 30532@option{-msoft-float} is used. 30533 30534@item -mno-fp-ret-in-387 30535@opindex mno-fp-ret-in-387 30536@opindex mfp-ret-in-387 30537Do not use the FPU registers for return values of functions. 30538 30539The usual calling convention has functions return values of types 30540@code{float} and @code{double} in an FPU register, even if there 30541is no FPU@. The idea is that the operating system should emulate 30542an FPU@. 30543 30544The option @option{-mno-fp-ret-in-387} causes such values to be returned 30545in ordinary CPU registers instead. 30546 30547@item -mno-fancy-math-387 30548@opindex mno-fancy-math-387 30549@opindex mfancy-math-387 30550Some 387 emulators do not support the @code{sin}, @code{cos} and 30551@code{sqrt} instructions for the 387. Specify this option to avoid 30552generating those instructions. 30553This option is overridden when @option{-march} 30554indicates that the target CPU always has an FPU and so the 30555instruction does not need emulation. These 30556instructions are not generated unless you also use the 30557@option{-funsafe-math-optimizations} switch. 30558 30559@item -malign-double 30560@itemx -mno-align-double 30561@opindex malign-double 30562@opindex mno-align-double 30563Control whether GCC aligns @code{double}, @code{long double}, and 30564@code{long long} variables on a two-word boundary or a one-word 30565boundary. Aligning @code{double} variables on a two-word boundary 30566produces code that runs somewhat faster on a Pentium at the 30567expense of more memory. 30568 30569On x86-64, @option{-malign-double} is enabled by default. 30570 30571@strong{Warning:} if you use the @option{-malign-double} switch, 30572structures containing the above types are aligned differently than 30573the published application binary interface specifications for the x86-32 30574and are not binary compatible with structures in code compiled 30575without that switch. 30576 30577@item -m96bit-long-double 30578@itemx -m128bit-long-double 30579@opindex m96bit-long-double 30580@opindex m128bit-long-double 30581These switches control the size of @code{long double} type. The x86-32 30582application binary interface specifies the size to be 96 bits, 30583so @option{-m96bit-long-double} is the default in 32-bit mode. 30584 30585Modern architectures (Pentium and newer) prefer @code{long double} 30586to be aligned to an 8- or 16-byte boundary. In arrays or structures 30587conforming to the ABI, this is not possible. So specifying 30588@option{-m128bit-long-double} aligns @code{long double} 30589to a 16-byte boundary by padding the @code{long double} with an additional 3059032-bit zero. 30591 30592In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 30593its ABI specifies that @code{long double} is aligned on 16-byte boundary. 30594 30595Notice that neither of these options enable any extra precision over the x87 30596standard of 80 bits for a @code{long double}. 30597 30598@strong{Warning:} if you override the default value for your target ABI, this 30599changes the size of 30600structures and arrays containing @code{long double} variables, 30601as well as modifying the function calling convention for functions taking 30602@code{long double}. Hence they are not binary-compatible 30603with code compiled without that switch. 30604 30605@item -mlong-double-64 30606@itemx -mlong-double-80 30607@itemx -mlong-double-128 30608@opindex mlong-double-64 30609@opindex mlong-double-80 30610@opindex mlong-double-128 30611These switches control the size of @code{long double} type. A size 30612of 64 bits makes the @code{long double} type equivalent to the @code{double} 30613type. This is the default for 32-bit Bionic C library. A size 30614of 128 bits makes the @code{long double} type equivalent to the 30615@code{__float128} type. This is the default for 64-bit Bionic C library. 30616 30617@strong{Warning:} if you override the default value for your target ABI, this 30618changes the size of 30619structures and arrays containing @code{long double} variables, 30620as well as modifying the function calling convention for functions taking 30621@code{long double}. Hence they are not binary-compatible 30622with code compiled without that switch. 30623 30624@item -malign-data=@var{type} 30625@opindex malign-data 30626Control how GCC aligns variables. Supported values for @var{type} are 30627@samp{compat} uses increased alignment value compatible uses GCC 4.8 30628and earlier, @samp{abi} uses alignment value as specified by the 30629psABI, and @samp{cacheline} uses increased alignment value to match 30630the cache line size. @samp{compat} is the default. 30631 30632@item -mlarge-data-threshold=@var{threshold} 30633@opindex mlarge-data-threshold 30634When @option{-mcmodel=medium} is specified, data objects larger than 30635@var{threshold} are placed in the large data section. This value must be the 30636same across all objects linked into the binary, and defaults to 65535. 30637 30638@item -mrtd 30639@opindex mrtd 30640Use a different function-calling convention, in which functions that 30641take a fixed number of arguments return with the @code{ret @var{num}} 30642instruction, which pops their arguments while returning. This saves one 30643instruction in the caller since there is no need to pop the arguments 30644there. 30645 30646You can specify that an individual function is called with this calling 30647sequence with the function attribute @code{stdcall}. You can also 30648override the @option{-mrtd} option by using the function attribute 30649@code{cdecl}. @xref{Function Attributes}. 30650 30651@strong{Warning:} this calling convention is incompatible with the one 30652normally used on Unix, so you cannot use it if you need to call 30653libraries compiled with the Unix compiler. 30654 30655Also, you must provide function prototypes for all functions that 30656take variable numbers of arguments (including @code{printf}); 30657otherwise incorrect code is generated for calls to those 30658functions. 30659 30660In addition, seriously incorrect code results if you call a 30661function with too many arguments. (Normally, extra arguments are 30662harmlessly ignored.) 30663 30664@item -mregparm=@var{num} 30665@opindex mregparm 30666Control how many registers are used to pass integer arguments. By 30667default, no registers are used to pass arguments, and at most 3 30668registers can be used. You can control this behavior for a specific 30669function by using the function attribute @code{regparm}. 30670@xref{Function Attributes}. 30671 30672@strong{Warning:} if you use this switch, and 30673@var{num} is nonzero, then you must build all modules with the same 30674value, including any libraries. This includes the system libraries and 30675startup modules. 30676 30677@item -msseregparm 30678@opindex msseregparm 30679Use SSE register passing conventions for float and double arguments 30680and return values. You can control this behavior for a specific 30681function by using the function attribute @code{sseregparm}. 30682@xref{Function Attributes}. 30683 30684@strong{Warning:} if you use this switch then you must build all 30685modules with the same value, including any libraries. This includes 30686the system libraries and startup modules. 30687 30688@item -mvect8-ret-in-mem 30689@opindex mvect8-ret-in-mem 30690Return 8-byte vectors in memory instead of MMX registers. This is the 30691default on VxWorks to match the ABI of the Sun Studio compilers until 30692version 12. @emph{Only} use this option if you need to remain 30693compatible with existing code produced by those previous compiler 30694versions or older versions of GCC@. 30695 30696@item -mpc32 30697@itemx -mpc64 30698@itemx -mpc80 30699@opindex mpc32 30700@opindex mpc64 30701@opindex mpc80 30702 30703Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 30704is specified, the significands of results of floating-point operations are 30705rounded to 24 bits (single precision); @option{-mpc64} rounds the 30706significands of results of floating-point operations to 53 bits (double 30707precision) and @option{-mpc80} rounds the significands of results of 30708floating-point operations to 64 bits (extended double precision), which is 30709the default. When this option is used, floating-point operations in higher 30710precisions are not available to the programmer without setting the FPU 30711control word explicitly. 30712 30713Setting the rounding of floating-point operations to less than the default 3071480 bits can speed some programs by 2% or more. Note that some mathematical 30715libraries assume that extended-precision (80-bit) floating-point operations 30716are enabled by default; routines in such libraries could suffer significant 30717loss of accuracy, typically through so-called ``catastrophic cancellation'', 30718when this option is used to set the precision to less than extended precision. 30719 30720@item -mstackrealign 30721@opindex mstackrealign 30722Realign the stack at entry. On the x86, the @option{-mstackrealign} 30723option generates an alternate prologue and epilogue that realigns the 30724run-time stack if necessary. This supports mixing legacy codes that keep 307254-byte stack alignment with modern codes that keep 16-byte stack alignment for 30726SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 30727applicable to individual functions. 30728 30729@item -mpreferred-stack-boundary=@var{num} 30730@opindex mpreferred-stack-boundary 30731Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 30732byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 30733the default is 4 (16 bytes or 128 bits). 30734 30735@strong{Warning:} When generating code for the x86-64 architecture with 30736SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 30737used to keep the stack boundary aligned to 8 byte boundary. Since 30738x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 30739intended to be used in controlled environment where stack space is 30740important limitation. This option leads to wrong code when functions 30741compiled with 16 byte stack alignment (such as functions from a standard 30742library) are called with misaligned stack. In this case, SSE 30743instructions may lead to misaligned memory access traps. In addition, 30744variable arguments are handled incorrectly for 16 byte aligned 30745objects (including x87 long double and __int128), leading to wrong 30746results. You must build all modules with 30747@option{-mpreferred-stack-boundary=3}, including any libraries. This 30748includes the system libraries and startup modules. 30749 30750@item -mincoming-stack-boundary=@var{num} 30751@opindex mincoming-stack-boundary 30752Assume the incoming stack is aligned to a 2 raised to @var{num} byte 30753boundary. If @option{-mincoming-stack-boundary} is not specified, 30754the one specified by @option{-mpreferred-stack-boundary} is used. 30755 30756On Pentium and Pentium Pro, @code{double} and @code{long double} values 30757should be aligned to an 8-byte boundary (see @option{-malign-double}) or 30758suffer significant run time performance penalties. On Pentium III, the 30759Streaming SIMD Extension (SSE) data type @code{__m128} may not work 30760properly if it is not 16-byte aligned. 30761 30762To ensure proper alignment of this values on the stack, the stack boundary 30763must be as aligned as that required by any value stored on the stack. 30764Further, every function must be generated such that it keeps the stack 30765aligned. Thus calling a function compiled with a higher preferred 30766stack boundary from a function compiled with a lower preferred stack 30767boundary most likely misaligns the stack. It is recommended that 30768libraries that use callbacks always use the default setting. 30769 30770This extra alignment does consume extra stack space, and generally 30771increases code size. Code that is sensitive to stack space usage, such 30772as embedded systems and operating system kernels, may want to reduce the 30773preferred alignment to @option{-mpreferred-stack-boundary=2}. 30774 30775@need 200 30776@item -mmmx 30777@opindex mmmx 30778@need 200 30779@itemx -msse 30780@opindex msse 30781@need 200 30782@itemx -msse2 30783@opindex msse2 30784@need 200 30785@itemx -msse3 30786@opindex msse3 30787@need 200 30788@itemx -mssse3 30789@opindex mssse3 30790@need 200 30791@itemx -msse4 30792@opindex msse4 30793@need 200 30794@itemx -msse4a 30795@opindex msse4a 30796@need 200 30797@itemx -msse4.1 30798@opindex msse4.1 30799@need 200 30800@itemx -msse4.2 30801@opindex msse4.2 30802@need 200 30803@itemx -mavx 30804@opindex mavx 30805@need 200 30806@itemx -mavx2 30807@opindex mavx2 30808@need 200 30809@itemx -mavx512f 30810@opindex mavx512f 30811@need 200 30812@itemx -mavx512pf 30813@opindex mavx512pf 30814@need 200 30815@itemx -mavx512er 30816@opindex mavx512er 30817@need 200 30818@itemx -mavx512cd 30819@opindex mavx512cd 30820@need 200 30821@itemx -mavx512vl 30822@opindex mavx512vl 30823@need 200 30824@itemx -mavx512bw 30825@opindex mavx512bw 30826@need 200 30827@itemx -mavx512dq 30828@opindex mavx512dq 30829@need 200 30830@itemx -mavx512ifma 30831@opindex mavx512ifma 30832@need 200 30833@itemx -mavx512vbmi 30834@opindex mavx512vbmi 30835@need 200 30836@itemx -msha 30837@opindex msha 30838@need 200 30839@itemx -maes 30840@opindex maes 30841@need 200 30842@itemx -mpclmul 30843@opindex mpclmul 30844@need 200 30845@itemx -mclflushopt 30846@opindex mclflushopt 30847@need 200 30848@itemx -mclwb 30849@opindex mclwb 30850@need 200 30851@itemx -mfsgsbase 30852@opindex mfsgsbase 30853@need 200 30854@itemx -mptwrite 30855@opindex mptwrite 30856@need 200 30857@itemx -mrdrnd 30858@opindex mrdrnd 30859@need 200 30860@itemx -mf16c 30861@opindex mf16c 30862@need 200 30863@itemx -mfma 30864@opindex mfma 30865@need 200 30866@itemx -mpconfig 30867@opindex mpconfig 30868@need 200 30869@itemx -mwbnoinvd 30870@opindex mwbnoinvd 30871@need 200 30872@itemx -mfma4 30873@opindex mfma4 30874@need 200 30875@itemx -mprfchw 30876@opindex mprfchw 30877@need 200 30878@itemx -mrdpid 30879@opindex mrdpid 30880@need 200 30881@itemx -mprefetchwt1 30882@opindex mprefetchwt1 30883@need 200 30884@itemx -mrdseed 30885@opindex mrdseed 30886@need 200 30887@itemx -msgx 30888@opindex msgx 30889@need 200 30890@itemx -mxop 30891@opindex mxop 30892@need 200 30893@itemx -mlwp 30894@opindex mlwp 30895@need 200 30896@itemx -m3dnow 30897@opindex m3dnow 30898@need 200 30899@itemx -m3dnowa 30900@opindex m3dnowa 30901@need 200 30902@itemx -mpopcnt 30903@opindex mpopcnt 30904@need 200 30905@itemx -mabm 30906@opindex mabm 30907@need 200 30908@itemx -madx 30909@opindex madx 30910@need 200 30911@itemx -mbmi 30912@opindex mbmi 30913@need 200 30914@itemx -mbmi2 30915@opindex mbmi2 30916@need 200 30917@itemx -mlzcnt 30918@opindex mlzcnt 30919@need 200 30920@itemx -mfxsr 30921@opindex mfxsr 30922@need 200 30923@itemx -mxsave 30924@opindex mxsave 30925@need 200 30926@itemx -mxsaveopt 30927@opindex mxsaveopt 30928@need 200 30929@itemx -mxsavec 30930@opindex mxsavec 30931@need 200 30932@itemx -mxsaves 30933@opindex mxsaves 30934@need 200 30935@itemx -mrtm 30936@opindex mrtm 30937@need 200 30938@itemx -mhle 30939@opindex mhle 30940@need 200 30941@itemx -mtbm 30942@opindex mtbm 30943@need 200 30944@itemx -mmwaitx 30945@opindex mmwaitx 30946@need 200 30947@itemx -mclzero 30948@opindex mclzero 30949@need 200 30950@itemx -mpku 30951@opindex mpku 30952@need 200 30953@itemx -mavx512vbmi2 30954@opindex mavx512vbmi2 30955@need 200 30956@itemx -mavx512bf16 30957@opindex mavx512bf16 30958@need 200 30959@itemx -mgfni 30960@opindex mgfni 30961@need 200 30962@itemx -mvaes 30963@opindex mvaes 30964@need 200 30965@itemx -mwaitpkg 30966@opindex mwaitpkg 30967@need 200 30968@itemx -mvpclmulqdq 30969@opindex mvpclmulqdq 30970@need 200 30971@itemx -mavx512bitalg 30972@opindex mavx512bitalg 30973@need 200 30974@itemx -mmovdiri 30975@opindex mmovdiri 30976@need 200 30977@itemx -mmovdir64b 30978@opindex mmovdir64b 30979@need 200 30980@itemx -menqcmd 30981@opindex menqcmd 30982@itemx -muintr 30983@opindex muintr 30984@need 200 30985@itemx -mtsxldtrk 30986@opindex mtsxldtrk 30987@need 200 30988@itemx -mavx512vpopcntdq 30989@opindex mavx512vpopcntdq 30990@need 200 30991@itemx -mavx512vp2intersect 30992@opindex mavx512vp2intersect 30993@need 200 30994@itemx -mavx5124fmaps 30995@opindex mavx5124fmaps 30996@need 200 30997@itemx -mavx512vnni 30998@opindex mavx512vnni 30999@need 200 31000@itemx -mavxvnni 31001@opindex mavxvnni 31002@need 200 31003@itemx -mavx5124vnniw 31004@opindex mavx5124vnniw 31005@need 200 31006@itemx -mcldemote 31007@opindex mcldemote 31008@need 200 31009@itemx -mserialize 31010@opindex mserialize 31011@need 200 31012@itemx -mamx-tile 31013@opindex mamx-tile 31014@need 200 31015@itemx -mamx-int8 31016@opindex mamx-int8 31017@need 200 31018@itemx -mamx-bf16 31019@opindex mamx-bf16 31020@need 200 31021@itemx -mhreset 31022@opindex mhreset 31023@itemx -mkl 31024@opindex mkl 31025@need 200 31026@itemx -mwidekl 31027@opindex mwidekl 31028These switches enable the use of instructions in the MMX, SSE, 31029SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF, 31030AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA, 31031AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, 31032WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 310333DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE, 31034XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2, 31035GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16, 31036ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, 31037UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI or CLDEMOTE 31038extended instruction sets. Each has a corresponding @option{-mno-} option to 31039disable use of these instructions. 31040 31041These extensions are also available as built-in functions: see 31042@ref{x86 Built-in Functions}, for details of the functions enabled and 31043disabled by these switches. 31044 31045To generate SSE/SSE2 instructions automatically from floating-point 31046code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 31047 31048GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 31049generates new AVX instructions or AVX equivalence for all SSEx instructions 31050when needed. 31051 31052These options enable GCC to use these extended instructions in 31053generated code, even without @option{-mfpmath=sse}. Applications that 31054perform run-time CPU detection must compile separate files for each 31055supported architecture, using the appropriate flags. In particular, 31056the file containing the CPU detection code should be compiled without 31057these options. 31058 31059@item -mdump-tune-features 31060@opindex mdump-tune-features 31061This option instructs GCC to dump the names of the x86 performance 31062tuning features and default settings. The names can be used in 31063@option{-mtune-ctrl=@var{feature-list}}. 31064 31065@item -mtune-ctrl=@var{feature-list} 31066@opindex mtune-ctrl=@var{feature-list} 31067This option is used to do fine grain control of x86 code generation features. 31068@var{feature-list} is a comma separated list of @var{feature} names. See also 31069@option{-mdump-tune-features}. When specified, the @var{feature} is turned 31070on if it is not preceded with @samp{^}, otherwise, it is turned off. 31071@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 31072developers. Using it may lead to code paths not covered by testing and can 31073potentially result in compiler ICEs or runtime errors. 31074 31075@item -mno-default 31076@opindex mno-default 31077This option instructs GCC to turn off all tunable features. See also 31078@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 31079 31080@item -mcld 31081@opindex mcld 31082This option instructs GCC to emit a @code{cld} instruction in the prologue 31083of functions that use string instructions. String instructions depend on 31084the DF flag to select between autoincrement or autodecrement mode. While the 31085ABI specifies the DF flag to be cleared on function entry, some operating 31086systems violate this specification by not clearing the DF flag in their 31087exception dispatchers. The exception handler can be invoked with the DF flag 31088set, which leads to wrong direction mode when string instructions are used. 31089This option can be enabled by default on 32-bit x86 targets by configuring 31090GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 31091instructions can be suppressed with the @option{-mno-cld} compiler option 31092in this case. 31093 31094@item -mvzeroupper 31095@opindex mvzeroupper 31096This option instructs GCC to emit a @code{vzeroupper} instruction 31097before a transfer of control flow out of the function to minimize 31098the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 31099intrinsics. 31100 31101@item -mprefer-avx128 31102@opindex mprefer-avx128 31103This option instructs GCC to use 128-bit AVX instructions instead of 31104256-bit AVX instructions in the auto-vectorizer. 31105 31106@item -mprefer-vector-width=@var{opt} 31107@opindex mprefer-vector-width 31108This option instructs GCC to use @var{opt}-bit vector width in instructions 31109instead of default on the selected platform. 31110 31111@table @samp 31112@item none 31113No extra limitations applied to GCC other than defined by the selected platform. 31114 31115@item 128 31116Prefer 128-bit vector width for instructions. 31117 31118@item 256 31119Prefer 256-bit vector width for instructions. 31120 31121@item 512 31122Prefer 512-bit vector width for instructions. 31123@end table 31124 31125@item -mcx16 31126@opindex mcx16 31127This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit 31128code to implement compare-and-exchange operations on 16-byte aligned 128-bit 31129objects. This is useful for atomic updates of data structures exceeding one 31130machine word in size. The compiler uses this instruction to implement 31131@ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on 31132128-bit integers, a library call is always used. 31133 31134@item -msahf 31135@opindex msahf 31136This option enables generation of @code{SAHF} instructions in 64-bit code. 31137Early Intel Pentium 4 CPUs with Intel 64 support, 31138prior to the introduction of Pentium 4 G1 step in December 2005, 31139lacked the @code{LAHF} and @code{SAHF} instructions 31140which are supported by AMD64. 31141These are load and store instructions, respectively, for certain status flags. 31142In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 31143@code{drem}, and @code{remainder} built-in functions; 31144see @ref{Other Builtins} for details. 31145 31146@item -mmovbe 31147@opindex mmovbe 31148This option enables use of the @code{movbe} instruction to implement 31149@code{__builtin_bswap32} and @code{__builtin_bswap64}. 31150 31151@item -mshstk 31152@opindex mshstk 31153The @option{-mshstk} option enables shadow stack built-in functions 31154from x86 Control-flow Enforcement Technology (CET). 31155 31156@item -mcrc32 31157@opindex mcrc32 31158This option enables built-in functions @code{__builtin_ia32_crc32qi}, 31159@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 31160@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 31161 31162@item -mrecip 31163@opindex mrecip 31164This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 31165(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 31166with an additional Newton-Raphson step 31167to increase precision instead of @code{DIVSS} and @code{SQRTSS} 31168(and their vectorized 31169variants) for single-precision floating-point arguments. These instructions 31170are generated only when @option{-funsafe-math-optimizations} is enabled 31171together with @option{-ffinite-math-only} and @option{-fno-trapping-math}. 31172Note that while the throughput of the sequence is higher than the throughput 31173of the non-reciprocal instruction, the precision of the sequence can be 31174decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994). 31175 31176Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 31177(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 31178combination), and doesn't need @option{-mrecip}. 31179 31180Also note that GCC emits the above sequence with additional Newton-Raphson step 31181for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 31182already with @option{-ffast-math} (or the above option combination), and 31183doesn't need @option{-mrecip}. 31184 31185@item -mrecip=@var{opt} 31186@opindex mrecip=opt 31187This option controls which reciprocal estimate instructions 31188may be used. @var{opt} is a comma-separated list of options, which may 31189be preceded by a @samp{!} to invert the option: 31190 31191@table @samp 31192@item all 31193Enable all estimate instructions. 31194 31195@item default 31196Enable the default instructions, equivalent to @option{-mrecip}. 31197 31198@item none 31199Disable all estimate instructions, equivalent to @option{-mno-recip}. 31200 31201@item div 31202Enable the approximation for scalar division. 31203 31204@item vec-div 31205Enable the approximation for vectorized division. 31206 31207@item sqrt 31208Enable the approximation for scalar square root. 31209 31210@item vec-sqrt 31211Enable the approximation for vectorized square root. 31212@end table 31213 31214So, for example, @option{-mrecip=all,!sqrt} enables 31215all of the reciprocal approximations, except for square root. 31216 31217@item -mveclibabi=@var{type} 31218@opindex mveclibabi 31219Specifies the ABI type to use for vectorizing intrinsics using an 31220external library. Supported values for @var{type} are @samp{svml} 31221for the Intel short 31222vector math library and @samp{acml} for the AMD math core library. 31223To use this option, both @option{-ftree-vectorize} and 31224@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 31225ABI-compatible library must be specified at link time. 31226 31227GCC currently emits calls to @code{vmldExp2}, 31228@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2}, 31229@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 31230@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 31231@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 31232@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, 31233@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 31234@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 31235@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 31236@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 31237function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 31238@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 31239@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 31240@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 31241@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 31242when @option{-mveclibabi=acml} is used. 31243 31244@item -mabi=@var{name} 31245@opindex mabi 31246Generate code for the specified calling convention. Permissible values 31247are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 31248@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 31249ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 31250You can control this behavior for specific functions by 31251using the function attributes @code{ms_abi} and @code{sysv_abi}. 31252@xref{Function Attributes}. 31253 31254@item -mforce-indirect-call 31255@opindex mforce-indirect-call 31256Force all calls to functions to be indirect. This is useful 31257when using Intel Processor Trace where it generates more precise timing 31258information for function calls. 31259 31260@item -mmanual-endbr 31261@opindex mmanual-endbr 31262Insert ENDBR instruction at function entry only via the @code{cf_check} 31263function attribute. This is useful when used with the option 31264@option{-fcf-protection=branch} to control ENDBR insertion at the 31265function entry. 31266 31267@item -mcall-ms2sysv-xlogues 31268@opindex mcall-ms2sysv-xlogues 31269@opindex mno-call-ms2sysv-xlogues 31270Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a 31271System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By 31272default, the code for saving and restoring these registers is emitted inline, 31273resulting in fairly lengthy prologues and epilogues. Using 31274@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that 31275use stubs in the static portion of libgcc to perform these saves and restores, 31276thus reducing function size at the cost of a few extra instructions. 31277 31278@item -mtls-dialect=@var{type} 31279@opindex mtls-dialect 31280Generate code to access thread-local storage using the @samp{gnu} or 31281@samp{gnu2} conventions. @samp{gnu} is the conservative default; 31282@samp{gnu2} is more efficient, but it may add compile- and run-time 31283requirements that cannot be satisfied on all systems. 31284 31285@item -mpush-args 31286@itemx -mno-push-args 31287@opindex mpush-args 31288@opindex mno-push-args 31289Use PUSH operations to store outgoing parameters. This method is shorter 31290and usually equally fast as method using SUB/MOV operations and is enabled 31291by default. In some cases disabling it may improve performance because of 31292improved scheduling and reduced dependencies. 31293 31294@item -maccumulate-outgoing-args 31295@opindex maccumulate-outgoing-args 31296If enabled, the maximum amount of space required for outgoing arguments is 31297computed in the function prologue. This is faster on most modern CPUs 31298because of reduced dependencies, improved scheduling and reduced stack usage 31299when the preferred stack boundary is not equal to 2. The drawback is a notable 31300increase in code size. This switch implies @option{-mno-push-args}. 31301 31302@item -mthreads 31303@opindex mthreads 31304Support thread-safe exception handling on MinGW. Programs that rely 31305on thread-safe exception handling must compile and link all code with the 31306@option{-mthreads} option. When compiling, @option{-mthreads} defines 31307@option{-D_MT}; when linking, it links in a special thread helper library 31308@option{-lmingwthrd} which cleans up per-thread exception-handling data. 31309 31310@item -mms-bitfields 31311@itemx -mno-ms-bitfields 31312@opindex mms-bitfields 31313@opindex mno-ms-bitfields 31314 31315Enable/disable bit-field layout compatible with the native Microsoft 31316Windows compiler. 31317 31318If @code{packed} is used on a structure, or if bit-fields are used, 31319it may be that the Microsoft ABI lays out the structure differently 31320than the way GCC normally does. Particularly when moving packed 31321data between functions compiled with GCC and the native Microsoft compiler 31322(either via function call or as data in a file), it may be necessary to access 31323either format. 31324 31325This option is enabled by default for Microsoft Windows 31326targets. This behavior can also be controlled locally by use of variable 31327or type attributes. For more information, see @ref{x86 Variable Attributes} 31328and @ref{x86 Type Attributes}. 31329 31330The Microsoft structure layout algorithm is fairly simple with the exception 31331of the bit-field packing. 31332The padding and alignment of members of structures and whether a bit-field 31333can straddle a storage-unit boundary are determine by these rules: 31334 31335@enumerate 31336@item Structure members are stored sequentially in the order in which they are 31337declared: the first member has the lowest memory address and the last member 31338the highest. 31339 31340@item Every data object has an alignment requirement. The alignment requirement 31341for all data except structures, unions, and arrays is either the size of the 31342object or the current packing size (specified with either the 31343@code{aligned} attribute or the @code{pack} pragma), 31344whichever is less. For structures, unions, and arrays, 31345the alignment requirement is the largest alignment requirement of its members. 31346Every object is allocated an offset so that: 31347 31348@smallexample 31349offset % alignment_requirement == 0 31350@end smallexample 31351 31352@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation 31353unit if the integral types are the same size and if the next bit-field fits 31354into the current allocation unit without crossing the boundary imposed by the 31355common alignment requirements of the bit-fields. 31356@end enumerate 31357 31358MSVC interprets zero-length bit-fields in the following ways: 31359 31360@enumerate 31361@item If a zero-length bit-field is inserted between two bit-fields that 31362are normally coalesced, the bit-fields are not coalesced. 31363 31364For example: 31365 31366@smallexample 31367struct 31368 @{ 31369 unsigned long bf_1 : 12; 31370 unsigned long : 0; 31371 unsigned long bf_2 : 12; 31372 @} t1; 31373@end smallexample 31374 31375@noindent 31376The size of @code{t1} is 8 bytes with the zero-length bit-field. If the 31377zero-length bit-field were removed, @code{t1}'s size would be 4 bytes. 31378 31379@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the 31380alignment of the zero-length bit-field is greater than the member that follows it, 31381@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field. 31382 31383For example: 31384 31385@smallexample 31386struct 31387 @{ 31388 char foo : 4; 31389 short : 0; 31390 char bar; 31391 @} t2; 31392 31393struct 31394 @{ 31395 char foo : 4; 31396 short : 0; 31397 double bar; 31398 @} t3; 31399@end smallexample 31400 31401@noindent 31402For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1. 31403Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length 31404bit-field does not affect the alignment of @code{bar} or, as a result, the size 31405of the structure. 31406 31407Taking this into account, it is important to note the following: 31408 31409@enumerate 31410@item If a zero-length bit-field follows a normal bit-field, the type of the 31411zero-length bit-field may affect the alignment of the structure as whole. For 31412example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a 31413normal bit-field, and is of type short. 31414 31415@item Even if a zero-length bit-field is not followed by a normal bit-field, it may 31416still affect the alignment of the structure: 31417 31418@smallexample 31419struct 31420 @{ 31421 char foo : 6; 31422 long : 0; 31423 @} t4; 31424@end smallexample 31425 31426@noindent 31427Here, @code{t4} takes up 4 bytes. 31428@end enumerate 31429 31430@item Zero-length bit-fields following non-bit-field members are ignored: 31431 31432@smallexample 31433struct 31434 @{ 31435 char foo; 31436 long : 0; 31437 char bar; 31438 @} t5; 31439@end smallexample 31440 31441@noindent 31442Here, @code{t5} takes up 2 bytes. 31443@end enumerate 31444 31445 31446@item -mno-align-stringops 31447@opindex mno-align-stringops 31448@opindex malign-stringops 31449Do not align the destination of inlined string operations. This switch reduces 31450code size and improves performance in case the destination is already aligned, 31451but GCC doesn't know about it. 31452 31453@item -minline-all-stringops 31454@opindex minline-all-stringops 31455By default GCC inlines string operations only when the destination is 31456known to be aligned to least a 4-byte boundary. 31457This enables more inlining and increases code 31458size, but may improve performance of code that depends on fast 31459@code{memcpy} and @code{memset} for short lengths. 31460The option enables inline expansion of @code{strlen} for all 31461pointer alignments. 31462 31463@item -minline-stringops-dynamically 31464@opindex minline-stringops-dynamically 31465For string operations of unknown size, use run-time checks with 31466inline code for small blocks and a library call for large blocks. 31467 31468@item -mstringop-strategy=@var{alg} 31469@opindex mstringop-strategy=@var{alg} 31470Override the internal decision heuristic for the particular algorithm to use 31471for inlining string operations. The allowed values for @var{alg} are: 31472 31473@table @samp 31474@item rep_byte 31475@itemx rep_4byte 31476@itemx rep_8byte 31477Expand using i386 @code{rep} prefix of the specified size. 31478 31479@item byte_loop 31480@itemx loop 31481@itemx unrolled_loop 31482Expand into an inline loop. 31483 31484@item libcall 31485Always use a library call. 31486@end table 31487 31488@item -mmemcpy-strategy=@var{strategy} 31489@opindex mmemcpy-strategy=@var{strategy} 31490Override the internal decision heuristic to decide if @code{__builtin_memcpy} 31491should be inlined and what inline algorithm to use when the expected size 31492of the copy operation is known. @var{strategy} 31493is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 31494@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 31495the max byte size with which inline algorithm @var{alg} is allowed. For the last 31496triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 31497in the list must be specified in increasing order. The minimal byte size for 31498@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 31499preceding range. 31500 31501@item -mmemset-strategy=@var{strategy} 31502@opindex mmemset-strategy=@var{strategy} 31503The option is similar to @option{-mmemcpy-strategy=} except that it is to control 31504@code{__builtin_memset} expansion. 31505 31506@item -momit-leaf-frame-pointer 31507@opindex momit-leaf-frame-pointer 31508Don't keep the frame pointer in a register for leaf functions. This 31509avoids the instructions to save, set up, and restore frame pointers and 31510makes an extra register available in leaf functions. The option 31511@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 31512which might make debugging harder. 31513 31514@item -mtls-direct-seg-refs 31515@itemx -mno-tls-direct-seg-refs 31516@opindex mtls-direct-seg-refs 31517Controls whether TLS variables may be accessed with offsets from the 31518TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 31519or whether the thread base pointer must be added. Whether or not this 31520is valid depends on the operating system, and whether it maps the 31521segment to cover the entire TLS area. 31522 31523For systems that use the GNU C Library, the default is on. 31524 31525@item -msse2avx 31526@itemx -mno-sse2avx 31527@opindex msse2avx 31528Specify that the assembler should encode SSE instructions with VEX 31529prefix. The option @option{-mavx} turns this on by default. 31530 31531@item -mfentry 31532@itemx -mno-fentry 31533@opindex mfentry 31534If profiling is active (@option{-pg}), put the profiling 31535counter call before the prologue. 31536Note: On x86 architectures the attribute @code{ms_hook_prologue} 31537isn't possible at the moment for @option{-mfentry} and @option{-pg}. 31538 31539@item -mrecord-mcount 31540@itemx -mno-record-mcount 31541@opindex mrecord-mcount 31542If profiling is active (@option{-pg}), generate a __mcount_loc section 31543that contains pointers to each profiling call. This is useful for 31544automatically patching and out calls. 31545 31546@item -mnop-mcount 31547@itemx -mno-nop-mcount 31548@opindex mnop-mcount 31549If profiling is active (@option{-pg}), generate the calls to 31550the profiling functions as NOPs. This is useful when they 31551should be patched in later dynamically. This is likely only 31552useful together with @option{-mrecord-mcount}. 31553 31554@item -minstrument-return=@var{type} 31555@opindex minstrument-return 31556Instrument function exit in -pg -mfentry instrumented functions with 31557call to specified function. This only instruments true returns ending 31558with ret, but not sibling calls ending with jump. Valid types 31559are @var{none} to not instrument, @var{call} to generate a call to __return__, 31560or @var{nop5} to generate a 5 byte nop. 31561 31562@item -mrecord-return 31563@itemx -mno-record-return 31564@opindex mrecord-return 31565Generate a __return_loc section pointing to all return instrumentation code. 31566 31567@item -mfentry-name=@var{name} 31568@opindex mfentry-name 31569Set name of __fentry__ symbol called at function entry for -pg -mfentry functions. 31570 31571@item -mfentry-section=@var{name} 31572@opindex mfentry-section 31573Set name of section to record -mrecord-mcount calls (default __mcount_loc). 31574 31575@item -mskip-rax-setup 31576@itemx -mno-skip-rax-setup 31577@opindex mskip-rax-setup 31578When generating code for the x86-64 architecture with SSE extensions 31579disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 31580register when there are no variable arguments passed in vector registers. 31581 31582@strong{Warning:} Since RAX register is used to avoid unnecessarily 31583saving vector registers on stack when passing variable arguments, the 31584impacts of this option are callees may waste some stack space, 31585misbehave or jump to a random location. GCC 4.4 or newer don't have 31586those issues, regardless the RAX register value. 31587 31588@item -m8bit-idiv 31589@itemx -mno-8bit-idiv 31590@opindex m8bit-idiv 31591On some processors, like Intel Atom, 8-bit unsigned integer divide is 31592much faster than 32-bit/64-bit integer divide. This option generates a 31593run-time check. If both dividend and divisor are within range of 0 31594to 255, 8-bit unsigned integer divide is used instead of 3159532-bit/64-bit integer divide. 31596 31597@item -mavx256-split-unaligned-load 31598@itemx -mavx256-split-unaligned-store 31599@opindex mavx256-split-unaligned-load 31600@opindex mavx256-split-unaligned-store 31601Split 32-byte AVX unaligned load and store. 31602 31603@item -mstack-protector-guard=@var{guard} 31604@itemx -mstack-protector-guard-reg=@var{reg} 31605@itemx -mstack-protector-guard-offset=@var{offset} 31606@opindex mstack-protector-guard 31607@opindex mstack-protector-guard-reg 31608@opindex mstack-protector-guard-offset 31609Generate stack protection code using canary at @var{guard}. Supported 31610locations are @samp{global} for global canary or @samp{tls} for per-thread 31611canary in the TLS block (the default). This option has effect only when 31612@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 31613 31614With the latter choice the options 31615@option{-mstack-protector-guard-reg=@var{reg}} and 31616@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 31617which segment register (@code{%fs} or @code{%gs}) to use as base register 31618for reading the canary, and from what offset from that base register. 31619The default for those is as specified in the relevant ABI. 31620 31621@item -mgeneral-regs-only 31622@opindex mgeneral-regs-only 31623Generate code that uses only the general-purpose registers. This 31624prevents the compiler from using floating-point, vector, mask and bound 31625registers. 31626 31627@item -mindirect-branch=@var{choice} 31628@opindex mindirect-branch 31629Convert indirect call and jump with @var{choice}. The default is 31630@samp{keep}, which keeps indirect call and jump unmodified. 31631@samp{thunk} converts indirect call and jump to call and return thunk. 31632@samp{thunk-inline} converts indirect call and jump to inlined call 31633and return thunk. @samp{thunk-extern} converts indirect call and jump 31634to external call and return thunk provided in a separate object file. 31635You can control this behavior for a specific function by using the 31636function attribute @code{indirect_branch}. @xref{Function Attributes}. 31637 31638Note that @option{-mcmodel=large} is incompatible with 31639@option{-mindirect-branch=thunk} and 31640@option{-mindirect-branch=thunk-extern} since the thunk function may 31641not be reachable in the large code model. 31642 31643Note that @option{-mindirect-branch=thunk-extern} is compatible with 31644@option{-fcf-protection=branch} since the external thunk can be made 31645to enable control-flow check. 31646 31647@item -mfunction-return=@var{choice} 31648@opindex mfunction-return 31649Convert function return with @var{choice}. The default is @samp{keep}, 31650which keeps function return unmodified. @samp{thunk} converts function 31651return to call and return thunk. @samp{thunk-inline} converts function 31652return to inlined call and return thunk. @samp{thunk-extern} converts 31653function return to external call and return thunk provided in a separate 31654object file. You can control this behavior for a specific function by 31655using the function attribute @code{function_return}. 31656@xref{Function Attributes}. 31657 31658Note that @option{-mindirect-return=thunk-extern} is compatible with 31659@option{-fcf-protection=branch} since the external thunk can be made 31660to enable control-flow check. 31661 31662Note that @option{-mcmodel=large} is incompatible with 31663@option{-mfunction-return=thunk} and 31664@option{-mfunction-return=thunk-extern} since the thunk function may 31665not be reachable in the large code model. 31666 31667 31668@item -mindirect-branch-register 31669@opindex mindirect-branch-register 31670Force indirect call and jump via register. 31671 31672@end table 31673 31674These @samp{-m} switches are supported in addition to the above 31675on x86-64 processors in 64-bit environments. 31676 31677@table @gcctabopt 31678@item -m32 31679@itemx -m64 31680@itemx -mx32 31681@itemx -m16 31682@itemx -miamcu 31683@opindex m32 31684@opindex m64 31685@opindex mx32 31686@opindex m16 31687@opindex miamcu 31688Generate code for a 16-bit, 32-bit or 64-bit environment. 31689The @option{-m32} option sets @code{int}, @code{long}, and pointer types 31690to 32 bits, and 31691generates code that runs on any i386 system. 31692 31693The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 31694types to 64 bits, and generates code for the x86-64 architecture. 31695For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 31696and @option{-mdynamic-no-pic} options. 31697 31698The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 31699to 32 bits, and 31700generates code for the x86-64 architecture. 31701 31702The @option{-m16} option is the same as @option{-m32}, except for that 31703it outputs the @code{.code16gcc} assembly directive at the beginning of 31704the assembly output so that the binary can run in 16-bit mode. 31705 31706The @option{-miamcu} option generates code which conforms to Intel MCU 31707psABI. It requires the @option{-m32} option to be turned on. 31708 31709@item -mno-red-zone 31710@opindex mno-red-zone 31711@opindex mred-zone 31712Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 31713by the x86-64 ABI; it is a 128-byte area beyond the location of the 31714stack pointer that is not modified by signal or interrupt handlers 31715and therefore can be used for temporary data without adjusting the stack 31716pointer. The flag @option{-mno-red-zone} disables this red zone. 31717 31718@item -mcmodel=small 31719@opindex mcmodel=small 31720Generate code for the small code model: the program and its symbols must 31721be linked in the lower 2 GB of the address space. Pointers are 64 bits. 31722Programs can be statically or dynamically linked. This is the default 31723code model. 31724 31725@item -mcmodel=kernel 31726@opindex mcmodel=kernel 31727Generate code for the kernel code model. The kernel runs in the 31728negative 2 GB of the address space. 31729This model has to be used for Linux kernel code. 31730 31731@item -mcmodel=medium 31732@opindex mcmodel=medium 31733Generate code for the medium model: the program is linked in the lower 2 31734GB of the address space. Small symbols are also placed there. Symbols 31735with sizes larger than @option{-mlarge-data-threshold} are put into 31736large data or BSS sections and can be located above 2GB. Programs can 31737be statically or dynamically linked. 31738 31739@item -mcmodel=large 31740@opindex mcmodel=large 31741Generate code for the large model. This model makes no assumptions 31742about addresses and sizes of sections. 31743 31744@item -maddress-mode=long 31745@opindex maddress-mode=long 31746Generate code for long address mode. This is only supported for 64-bit 31747and x32 environments. It is the default address mode for 64-bit 31748environments. 31749 31750@item -maddress-mode=short 31751@opindex maddress-mode=short 31752Generate code for short address mode. This is only supported for 32-bit 31753and x32 environments. It is the default address mode for 32-bit and 31754x32 environments. 31755 31756@item -mneeded 31757@itemx -mno-needed 31758@opindex mneeded 31759Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to 31760indicate the micro-architecture ISA level required to execute the binary. 31761@end table 31762 31763@node x86 Windows Options 31764@subsection x86 Windows Options 31765@cindex x86 Windows Options 31766@cindex Windows Options for x86 31767 31768These additional options are available for Microsoft Windows targets: 31769 31770@table @gcctabopt 31771@item -mconsole 31772@opindex mconsole 31773This option 31774specifies that a console application is to be generated, by 31775instructing the linker to set the PE header subsystem type 31776required for console applications. 31777This option is available for Cygwin and MinGW targets and is 31778enabled by default on those targets. 31779 31780@item -mdll 31781@opindex mdll 31782This option is available for Cygwin and MinGW targets. It 31783specifies that a DLL---a dynamic link library---is to be 31784generated, enabling the selection of the required runtime 31785startup object and entry point. 31786 31787@item -mnop-fun-dllimport 31788@opindex mnop-fun-dllimport 31789This option is available for Cygwin and MinGW targets. It 31790specifies that the @code{dllimport} attribute should be ignored. 31791 31792@item -mthread 31793@opindex mthread 31794This option is available for MinGW targets. It specifies 31795that MinGW-specific thread support is to be used. 31796 31797@item -municode 31798@opindex municode 31799This option is available for MinGW-w64 targets. It causes 31800the @code{UNICODE} preprocessor macro to be predefined, and 31801chooses Unicode-capable runtime startup code. 31802 31803@item -mwin32 31804@opindex mwin32 31805This option is available for Cygwin and MinGW targets. It 31806specifies that the typical Microsoft Windows predefined macros are to 31807be set in the pre-processor, but does not influence the choice 31808of runtime library/startup code. 31809 31810@item -mwindows 31811@opindex mwindows 31812This option is available for Cygwin and MinGW targets. It 31813specifies that a GUI application is to be generated by 31814instructing the linker to set the PE header subsystem type 31815appropriately. 31816 31817@item -fno-set-stack-executable 31818@opindex fno-set-stack-executable 31819@opindex fset-stack-executable 31820This option is available for MinGW targets. It specifies that 31821the executable flag for the stack used by nested functions isn't 31822set. This is necessary for binaries running in kernel mode of 31823Microsoft Windows, as there the User32 API, which is used to set executable 31824privileges, isn't available. 31825 31826@item -fwritable-relocated-rdata 31827@opindex fno-writable-relocated-rdata 31828@opindex fwritable-relocated-rdata 31829This option is available for MinGW and Cygwin targets. It specifies 31830that relocated-data in read-only section is put into the @code{.data} 31831section. This is a necessary for older runtimes not supporting 31832modification of @code{.rdata} sections for pseudo-relocation. 31833 31834@item -mpe-aligned-commons 31835@opindex mpe-aligned-commons 31836This option is available for Cygwin and MinGW targets. It 31837specifies that the GNU extension to the PE file format that 31838permits the correct alignment of COMMON variables should be 31839used when generating code. It is enabled by default if 31840GCC detects that the target assembler found during configuration 31841supports the feature. 31842@end table 31843 31844See also under @ref{x86 Options} for standard options. 31845 31846@node Xstormy16 Options 31847@subsection Xstormy16 Options 31848@cindex Xstormy16 Options 31849 31850These options are defined for Xstormy16: 31851 31852@table @gcctabopt 31853@item -msim 31854@opindex msim 31855Choose startup files and linker script suitable for the simulator. 31856@end table 31857 31858@node Xtensa Options 31859@subsection Xtensa Options 31860@cindex Xtensa Options 31861 31862These options are supported for Xtensa targets: 31863 31864@table @gcctabopt 31865@item -mconst16 31866@itemx -mno-const16 31867@opindex mconst16 31868@opindex mno-const16 31869Enable or disable use of @code{CONST16} instructions for loading 31870constant values. The @code{CONST16} instruction is currently not a 31871standard option from Tensilica. When enabled, @code{CONST16} 31872instructions are always used in place of the standard @code{L32R} 31873instructions. The use of @code{CONST16} is enabled by default only if 31874the @code{L32R} instruction is not available. 31875 31876@item -mfused-madd 31877@itemx -mno-fused-madd 31878@opindex mfused-madd 31879@opindex mno-fused-madd 31880Enable or disable use of fused multiply/add and multiply/subtract 31881instructions in the floating-point option. This has no effect if the 31882floating-point option is not also enabled. Disabling fused multiply/add 31883and multiply/subtract instructions forces the compiler to use separate 31884instructions for the multiply and add/subtract operations. This may be 31885desirable in some cases where strict IEEE 754-compliant results are 31886required: the fused multiply add/subtract instructions do not round the 31887intermediate result, thereby producing results with @emph{more} bits of 31888precision than specified by the IEEE standard. Disabling fused multiply 31889add/subtract instructions also ensures that the program output is not 31890sensitive to the compiler's ability to combine multiply and add/subtract 31891operations. 31892 31893@item -mserialize-volatile 31894@itemx -mno-serialize-volatile 31895@opindex mserialize-volatile 31896@opindex mno-serialize-volatile 31897When this option is enabled, GCC inserts @code{MEMW} instructions before 31898@code{volatile} memory references to guarantee sequential consistency. 31899The default is @option{-mserialize-volatile}. Use 31900@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 31901 31902@item -mforce-no-pic 31903@opindex mforce-no-pic 31904For targets, like GNU/Linux, where all user-mode Xtensa code must be 31905position-independent code (PIC), this option disables PIC for compiling 31906kernel code. 31907 31908@item -mtext-section-literals 31909@itemx -mno-text-section-literals 31910@opindex mtext-section-literals 31911@opindex mno-text-section-literals 31912These options control the treatment of literal pools. The default is 31913@option{-mno-text-section-literals}, which places literals in a separate 31914section in the output file. This allows the literal pool to be placed 31915in a data RAM/ROM, and it also allows the linker to combine literal 31916pools from separate object files to remove redundant literals and 31917improve code size. With @option{-mtext-section-literals}, the literals 31918are interspersed in the text section in order to keep them as close as 31919possible to their references. This may be necessary for large assembly 31920files. Literals for each function are placed right before that function. 31921 31922@item -mauto-litpools 31923@itemx -mno-auto-litpools 31924@opindex mauto-litpools 31925@opindex mno-auto-litpools 31926These options control the treatment of literal pools. The default is 31927@option{-mno-auto-litpools}, which places literals in a separate 31928section in the output file unless @option{-mtext-section-literals} is 31929used. With @option{-mauto-litpools} the literals are interspersed in 31930the text section by the assembler. Compiler does not produce explicit 31931@code{.literal} directives and loads literals into registers with 31932@code{MOVI} instructions instead of @code{L32R} to let the assembler 31933do relaxation and place literals as necessary. This option allows 31934assembler to create several literal pools per function and assemble 31935very big functions, which may not be possible with 31936@option{-mtext-section-literals}. 31937 31938@item -mtarget-align 31939@itemx -mno-target-align 31940@opindex mtarget-align 31941@opindex mno-target-align 31942When this option is enabled, GCC instructs the assembler to 31943automatically align instructions to reduce branch penalties at the 31944expense of some code density. The assembler attempts to widen density 31945instructions to align branch targets and the instructions following call 31946instructions. If there are not enough preceding safe density 31947instructions to align a target, no widening is performed. The 31948default is @option{-mtarget-align}. These options do not affect the 31949treatment of auto-aligned instructions like @code{LOOP}, which the 31950assembler always aligns, either by widening density instructions or 31951by inserting NOP instructions. 31952 31953@item -mlongcalls 31954@itemx -mno-longcalls 31955@opindex mlongcalls 31956@opindex mno-longcalls 31957When this option is enabled, GCC instructs the assembler to translate 31958direct calls to indirect calls unless it can determine that the target 31959of a direct call is in the range allowed by the call instruction. This 31960translation typically occurs for calls to functions in other source 31961files. Specifically, the assembler translates a direct @code{CALL} 31962instruction into an @code{L32R} followed by a @code{CALLX} instruction. 31963The default is @option{-mno-longcalls}. This option should be used in 31964programs where the call target can potentially be out of range. This 31965option is implemented in the assembler, not the compiler, so the 31966assembly code generated by GCC still shows direct call 31967instructions---look at the disassembled object code to see the actual 31968instructions. Note that the assembler uses an indirect call for 31969every cross-file call, not just those that really are out of range. 31970 31971@item -mabi=@var{name} 31972@opindex mabi 31973Generate code for the specified ABI@. Permissible values are: @samp{call0}, 31974@samp{windowed}. Default ABI is chosen by the Xtensa core configuration. 31975 31976@item -mabi=call0 31977@opindex mabi=call0 31978When this option is enabled function parameters are passed in registers 31979@code{a2} through @code{a7}, registers @code{a12} through @code{a15} are 31980caller-saved, and register @code{a15} may be used as a frame pointer. 31981When this version of the ABI is enabled the C preprocessor symbol 31982@code{__XTENSA_CALL0_ABI__} is defined. 31983 31984@item -mabi=windowed 31985@opindex mabi=windowed 31986When this option is enabled function parameters are passed in registers 31987@code{a10} through @code{a15}, and called function rotates register window 31988by 8 registers on entry so that its arguments are found in registers 31989@code{a2} through @code{a7}. Register @code{a7} may be used as a frame 31990pointer. Register window is rotated 8 registers back upon return. 31991When this version of the ABI is enabled the C preprocessor symbol 31992@code{__XTENSA_WINDOWED_ABI__} is defined. 31993@end table 31994 31995@node zSeries Options 31996@subsection zSeries Options 31997@cindex zSeries options 31998 31999These are listed under @xref{S/390 and zSeries Options}. 32000 32001 32002@c man end 32003 32004@node Spec Files 32005@section Specifying Subprocesses and the Switches to Pass to Them 32006@cindex Spec Files 32007 32008@command{gcc} is a driver program. It performs its job by invoking a 32009sequence of other programs to do the work of compiling, assembling and 32010linking. GCC interprets its command-line parameters and uses these to 32011deduce which programs it should invoke, and which command-line options 32012it ought to place on their command lines. This behavior is controlled 32013by @dfn{spec strings}. In most cases there is one spec string for each 32014program that GCC can invoke, but a few programs have multiple spec 32015strings to control their behavior. The spec strings built into GCC can 32016be overridden by using the @option{-specs=} command-line switch to specify 32017a spec file. 32018 32019@dfn{Spec files} are plain-text files that are used to construct spec 32020strings. They consist of a sequence of directives separated by blank 32021lines. The type of directive is determined by the first non-whitespace 32022character on the line, which can be one of the following: 32023 32024@table @code 32025@item %@var{command} 32026Issues a @var{command} to the spec file processor. The commands that can 32027appear here are: 32028 32029@table @code 32030@item %include <@var{file}> 32031@cindex @code{%include} 32032Search for @var{file} and insert its text at the current point in the 32033specs file. 32034 32035@item %include_noerr <@var{file}> 32036@cindex @code{%include_noerr} 32037Just like @samp{%include}, but do not generate an error message if the include 32038file cannot be found. 32039 32040@item %rename @var{old_name} @var{new_name} 32041@cindex @code{%rename} 32042Rename the spec string @var{old_name} to @var{new_name}. 32043 32044@end table 32045 32046@item *[@var{spec_name}]: 32047This tells the compiler to create, override or delete the named spec 32048string. All lines after this directive up to the next directive or 32049blank line are considered to be the text for the spec string. If this 32050results in an empty string then the spec is deleted. (Or, if the 32051spec did not exist, then nothing happens.) Otherwise, if the spec 32052does not currently exist a new spec is created. If the spec does 32053exist then its contents are overridden by the text of this 32054directive, unless the first character of that text is the @samp{+} 32055character, in which case the text is appended to the spec. 32056 32057@item [@var{suffix}]: 32058Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 32059and up to the next directive or blank line are considered to make up the 32060spec string for the indicated suffix. When the compiler encounters an 32061input file with the named suffix, it processes the spec string in 32062order to work out how to compile that file. For example: 32063 32064@smallexample 32065.ZZ: 32066z-compile -input %i 32067@end smallexample 32068 32069This says that any input file whose name ends in @samp{.ZZ} should be 32070passed to the program @samp{z-compile}, which should be invoked with the 32071command-line switch @option{-input} and with the result of performing the 32072@samp{%i} substitution. (See below.) 32073 32074As an alternative to providing a spec string, the text following a 32075suffix directive can be one of the following: 32076 32077@table @code 32078@item @@@var{language} 32079This says that the suffix is an alias for a known @var{language}. This is 32080similar to using the @option{-x} command-line switch to GCC to specify a 32081language explicitly. For example: 32082 32083@smallexample 32084.ZZ: 32085@@c++ 32086@end smallexample 32087 32088Says that .ZZ files are, in fact, C++ source files. 32089 32090@item #@var{name} 32091This causes an error messages saying: 32092 32093@smallexample 32094@var{name} compiler not installed on this system. 32095@end smallexample 32096@end table 32097 32098GCC already has an extensive list of suffixes built into it. 32099This directive adds an entry to the end of the list of suffixes, but 32100since the list is searched from the end backwards, it is effectively 32101possible to override earlier entries using this technique. 32102 32103@end table 32104 32105GCC has the following spec strings built into it. Spec files can 32106override these strings or create their own. Note that individual 32107targets can also add their own spec strings to this list. 32108 32109@smallexample 32110asm Options to pass to the assembler 32111asm_final Options to pass to the assembler post-processor 32112cpp Options to pass to the C preprocessor 32113cc1 Options to pass to the C compiler 32114cc1plus Options to pass to the C++ compiler 32115endfile Object files to include at the end of the link 32116link Options to pass to the linker 32117lib Libraries to include on the command line to the linker 32118libgcc Decides which GCC support library to pass to the linker 32119linker Sets the name of the linker 32120predefines Defines to be passed to the C preprocessor 32121signed_char Defines to pass to CPP to say whether @code{char} is signed 32122 by default 32123startfile Object files to include at the start of the link 32124@end smallexample 32125 32126Here is a small example of a spec file: 32127 32128@smallexample 32129%rename lib old_lib 32130 32131*lib: 32132--start-group -lgcc -lc -leval1 --end-group %(old_lib) 32133@end smallexample 32134 32135This example renames the spec called @samp{lib} to @samp{old_lib} and 32136then overrides the previous definition of @samp{lib} with a new one. 32137The new definition adds in some extra command-line options before 32138including the text of the old definition. 32139 32140@dfn{Spec strings} are a list of command-line options to be passed to their 32141corresponding program. In addition, the spec strings can contain 32142@samp{%}-prefixed sequences to substitute variable text or to 32143conditionally insert text into the command line. Using these constructs 32144it is possible to generate quite complex command lines. 32145 32146Here is a table of all defined @samp{%}-sequences for spec 32147strings. Note that spaces are not generated automatically around the 32148results of expanding these sequences. Therefore you can concatenate them 32149together or combine them with constant text in a single argument. 32150 32151@table @code 32152@item %% 32153Substitute one @samp{%} into the program name or argument. 32154 32155@item %" 32156Substitute an empty argument. 32157 32158@item %i 32159Substitute the name of the input file being processed. 32160 32161@item %b 32162Substitute the basename for outputs related with the input file being 32163processed. This is often the substring up to (and not including) the 32164last period and not including the directory but, unless %w is active, it 32165expands to the basename for auxiliary outputs, which may be influenced 32166by an explicit output name, and by various other options that control 32167how auxiliary outputs are named. 32168 32169@item %B 32170This is the same as @samp{%b}, but include the file suffix (text after 32171the last period). Without %w, it expands to the basename for dump 32172outputs. 32173 32174@item %d 32175Marks the argument containing or following the @samp{%d} as a 32176temporary file name, so that that file is deleted if GCC exits 32177successfully. Unlike @samp{%g}, this contributes no text to the 32178argument. 32179 32180@item %g@var{suffix} 32181Substitute a file name that has suffix @var{suffix} and is chosen 32182once per compilation, and mark the argument in the same way as 32183@samp{%d}. To reduce exposure to denial-of-service attacks, the file 32184name is now chosen in a way that is hard to predict even when previously 32185chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 32186might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 32187the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 32188treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 32189was simply substituted with a file name chosen once per compilation, 32190without regard to any appended suffix (which was therefore treated 32191just like ordinary text), making such attacks more likely to succeed. 32192 32193@item %u@var{suffix} 32194Like @samp{%g}, but generates a new temporary file name 32195each time it appears instead of once per compilation. 32196 32197@item %U@var{suffix} 32198Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 32199new one if there is no such last file name. In the absence of any 32200@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 32201the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 32202involves the generation of two distinct file names, one 32203for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 32204simply substituted with a file name chosen for the previous @samp{%u}, 32205without regard to any appended suffix. 32206 32207@item %j@var{suffix} 32208Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 32209writable, and if @option{-save-temps} is not used; 32210otherwise, substitute the name 32211of a temporary file, just like @samp{%u}. This temporary file is not 32212meant for communication between processes, but rather as a junk 32213disposal mechanism. 32214 32215@item %|@var{suffix} 32216@itemx %m@var{suffix} 32217Like @samp{%g}, except if @option{-pipe} is in effect. In that case 32218@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 32219all. These are the two most common ways to instruct a program that it 32220should read from standard input or write to standard output. If you 32221need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 32222construct: see for example @file{gcc/fortran/lang-specs.h}. 32223 32224@item %.@var{SUFFIX} 32225Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 32226when it is subsequently output with @samp{%*}. @var{SUFFIX} is 32227terminated by the next space or %. 32228 32229@item %w 32230Marks the argument containing or following the @samp{%w} as the 32231designated output file of this compilation. This puts the argument 32232into the sequence of arguments that @samp{%o} substitutes. 32233 32234@item %V 32235Indicates that this compilation produces no output file. 32236 32237@item %o 32238Substitutes the names of all the output files, with spaces 32239automatically placed around them. You should write spaces 32240around the @samp{%o} as well or the results are undefined. 32241@samp{%o} is for use in the specs for running the linker. 32242Input files whose names have no recognized suffix are not compiled 32243at all, but they are included among the output files, so they are 32244linked. 32245 32246@item %O 32247Substitutes the suffix for object files. Note that this is 32248handled specially when it immediately follows @samp{%g, %u, or %U}, 32249because of the need for those to form complete file names. The 32250handling is such that @samp{%O} is treated exactly as if it had already 32251been substituted, except that @samp{%g, %u, and %U} do not currently 32252support additional @var{suffix} characters following @samp{%O} as they do 32253following, for example, @samp{.o}. 32254 32255@item %I 32256Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 32257@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 32258@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 32259and @option{-imultilib} as necessary. 32260 32261@item %s 32262Current argument is the name of a library or startup file of some sort. 32263Search for that file in a standard list of directories and substitute 32264the full name found. The current working directory is included in the 32265list of directories scanned. 32266 32267@item %T 32268Current argument is the name of a linker script. Search for that file 32269in the current list of directories to scan for libraries. If the file 32270is located insert a @option{--script} option into the command line 32271followed by the full path name found. If the file is not found then 32272generate an error message. Note: the current working directory is not 32273searched. 32274 32275@item %e@var{str} 32276Print @var{str} as an error message. @var{str} is terminated by a newline. 32277Use this when inconsistent options are detected. 32278 32279@item %n@var{str} 32280Print @var{str} as a notice. @var{str} is terminated by a newline. 32281 32282@item %(@var{name}) 32283Substitute the contents of spec string @var{name} at this point. 32284 32285@item %x@{@var{option}@} 32286Accumulate an option for @samp{%X}. 32287 32288@item %X 32289Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 32290spec string. 32291 32292@item %Y 32293Output the accumulated assembler options specified by @option{-Wa}. 32294 32295@item %Z 32296Output the accumulated preprocessor options specified by @option{-Wp}. 32297 32298@item %M 32299Output @code{multilib_os_dir}. 32300 32301@item %R 32302Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}. 32303 32304@item %a 32305Process the @code{asm} spec. This is used to compute the 32306switches to be passed to the assembler. 32307 32308@item %A 32309Process the @code{asm_final} spec. This is a spec string for 32310passing switches to an assembler post-processor, if such a program is 32311needed. 32312 32313@item %l 32314Process the @code{link} spec. This is the spec for computing the 32315command line passed to the linker. Typically it makes use of the 32316@samp{%L %G %S %D and %E} sequences. 32317 32318@item %D 32319Dump out a @option{-L} option for each directory that GCC believes might 32320contain startup files. If the target supports multilibs then the 32321current multilib directory is prepended to each of these paths. 32322 32323@item %L 32324Process the @code{lib} spec. This is a spec string for deciding which 32325libraries are included on the command line to the linker. 32326 32327@item %G 32328Process the @code{libgcc} spec. This is a spec string for deciding 32329which GCC support library is included on the command line to the linker. 32330 32331@item %S 32332Process the @code{startfile} spec. This is a spec for deciding which 32333object files are the first ones passed to the linker. Typically 32334this might be a file named @file{crt0.o}. 32335 32336@item %E 32337Process the @code{endfile} spec. This is a spec string that specifies 32338the last object files that are passed to the linker. 32339 32340@item %C 32341Process the @code{cpp} spec. This is used to construct the arguments 32342to be passed to the C preprocessor. 32343 32344@item %1 32345Process the @code{cc1} spec. This is used to construct the options to be 32346passed to the actual C compiler (@command{cc1}). 32347 32348@item %2 32349Process the @code{cc1plus} spec. This is used to construct the options to be 32350passed to the actual C++ compiler (@command{cc1plus}). 32351 32352@item %* 32353Substitute the variable part of a matched option. See below. 32354Note that each comma in the substituted string is replaced by 32355a single space. 32356 32357@item %<S 32358Remove all occurrences of @code{-S} from the command line. Note---this 32359command is position dependent. @samp{%} commands in the spec string 32360before this one see @code{-S}, @samp{%} commands in the spec string 32361after this one do not. 32362 32363@item %<S* 32364Similar to @samp{%<S}, but match all switches beginning with @code{-S}. 32365 32366@item %>S 32367Similar to @samp{%<S}, but keep @code{-S} in the GCC command line. 32368 32369@item %:@var{function}(@var{args}) 32370Call the named function @var{function}, passing it @var{args}. 32371@var{args} is first processed as a nested spec string, then split 32372into an argument vector in the usual fashion. The function returns 32373a string which is processed as if it had appeared literally as part 32374of the current spec. 32375 32376The following built-in spec functions are provided: 32377 32378@table @code 32379@item @code{getenv} 32380The @code{getenv} spec function takes two arguments: an environment 32381variable name and a string. If the environment variable is not 32382defined, a fatal error is issued. Otherwise, the return value is the 32383value of the environment variable concatenated with the string. For 32384example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 32385 32386@smallexample 32387%:getenv(TOPDIR /include) 32388@end smallexample 32389 32390expands to @file{/path/to/top/include}. 32391 32392@item @code{if-exists} 32393The @code{if-exists} spec function takes one argument, an absolute 32394pathname to a file. If the file exists, @code{if-exists} returns the 32395pathname. Here is a small example of its usage: 32396 32397@smallexample 32398*startfile: 32399crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 32400@end smallexample 32401 32402@item @code{if-exists-else} 32403The @code{if-exists-else} spec function is similar to the @code{if-exists} 32404spec function, except that it takes two arguments. The first argument is 32405an absolute pathname to a file. If the file exists, @code{if-exists-else} 32406returns the pathname. If it does not exist, it returns the second argument. 32407This way, @code{if-exists-else} can be used to select one file or another, 32408based on the existence of the first. Here is a small example of its usage: 32409 32410@smallexample 32411*startfile: 32412crt0%O%s %:if-exists(crti%O%s) \ 32413%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 32414@end smallexample 32415 32416@item @code{if-exists-then-else} 32417The @code{if-exists-then-else} spec function takes at least two arguments 32418and an optional third one. The first argument is an absolute pathname to a 32419file. If the file exists, the function returns the second argument. 32420If the file does not exist, the function returns the third argument if there 32421is one, or NULL otherwise. This can be used to expand one text, or optionally 32422another, based on the existence of a file. Here is a small example of its 32423usage: 32424 32425@smallexample 32426-l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net) 32427@end smallexample 32428 32429@item @code{sanitize} 32430The @code{sanitize} spec function takes no arguments. It returns non-NULL if 32431any address, thread or undefined behavior sanitizers are active. 32432 32433@smallexample 32434%@{%:sanitize(address):-funwind-tables@} 32435@end smallexample 32436 32437@item @code{replace-outfile} 32438The @code{replace-outfile} spec function takes two arguments. It looks for the 32439first argument in the outfiles array and replaces it with the second argument. Here 32440is a small example of its usage: 32441 32442@smallexample 32443%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 32444@end smallexample 32445 32446@item @code{remove-outfile} 32447The @code{remove-outfile} spec function takes one argument. It looks for the 32448first argument in the outfiles array and removes it. Here is a small example 32449its usage: 32450 32451@smallexample 32452%:remove-outfile(-lm) 32453@end smallexample 32454 32455@item @code{version-compare} 32456The @code{version-compare} spec function takes four or five arguments of the following 32457form: 32458 32459@smallexample 32460<comparison-op> <arg1> [<arg2>] <switch> <result> 32461@end smallexample 32462 32463It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't. 32464The supported @code{comparison-op} values are: 32465 32466@table @code 32467@item >= 32468True if @code{switch} is a later (or same) version than @code{arg1} 32469 32470@item !> 32471Opposite of @code{>=} 32472 32473@item < 32474True if @code{switch} is an earlier version than @code{arg1} 32475 32476@item !< 32477Opposite of @code{<} 32478 32479@item >< 32480True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2} 32481 32482@item <> 32483True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later 32484@end table 32485 32486If the @code{switch} is not present at all, the condition is false unless the first character 32487of the @code{comparison-op} is @code{!}. 32488 32489@smallexample 32490%:version-compare(>= 10.3 mmacosx-version-min= -lmx) 32491@end smallexample 32492 32493The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was 32494passed. 32495 32496@item @code{include} 32497The @code{include} spec function behaves much like @code{%include}, with the advantage 32498that it can be nested inside a spec and thus be conditionalized. It takes one argument, 32499the filename, and looks for it in the startfile path. It always returns NULL. 32500 32501@smallexample 32502%@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@} 32503@end smallexample 32504 32505@item @code{pass-through-libs} 32506The @code{pass-through-libs} spec function takes any number of arguments. It 32507finds any @option{-l} options and any non-options ending in @file{.a} (which it 32508assumes are the names of linker input library archive files) and returns a 32509result containing all the found arguments each prepended by 32510@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 32511intended to be passed to the LTO linker plugin. 32512 32513@smallexample 32514%:pass-through-libs(%G %L %G) 32515@end smallexample 32516 32517@item @code{print-asm-header} 32518The @code{print-asm-header} function takes no arguments and simply 32519prints a banner like: 32520 32521@smallexample 32522Assembler options 32523================= 32524 32525Use "-Wa,OPTION" to pass "OPTION" to the assembler. 32526@end smallexample 32527 32528It is used to separate compiler options from assembler options 32529in the @option{--target-help} output. 32530 32531@item @code{gt} 32532The @code{gt} spec function takes two or more arguments. It returns @code{""} (the 32533empty string) if the second-to-last argument is greater than the last argument, and NULL 32534otherwise. The following example inserts the @code{link_gomp} spec if the last 32535@option{-ftree-parallelize-loops=} option given on the command line is greater than 1: 32536 32537@smallexample 32538%@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@} 32539@end smallexample 32540 32541@item @code{debug-level-gt} 32542The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the 32543empty string) if @code{debug_info_level} is greater than the specified number, and NULL 32544otherwise. 32545 32546@smallexample 32547%@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@} 32548@end smallexample 32549@end table 32550 32551@item %@{S@} 32552Substitutes the @code{-S} switch, if that switch is given to GCC@. 32553If that switch is not specified, this substitutes nothing. Note that 32554the leading dash is omitted when specifying this option, and it is 32555automatically inserted if the substitution is performed. Thus the spec 32556string @samp{%@{foo@}} matches the command-line option @option{-foo} 32557and outputs the command-line option @option{-foo}. 32558 32559@item %W@{S@} 32560Like %@{@code{S}@} but mark last argument supplied within as a file to be 32561deleted on failure. 32562 32563@item %@@@{S@} 32564Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes 32565@code{@@FILE} if an @code{@@file} argument has been supplied. 32566 32567@item %@{S*@} 32568Substitutes all the switches specified to GCC whose names start 32569with @code{-S}, but which also take an argument. This is used for 32570switches like @option{-o}, @option{-D}, @option{-I}, etc. 32571GCC considers @option{-o foo} as being 32572one switch whose name starts with @samp{o}. %@{o*@} substitutes this 32573text, including the space. Thus two arguments are generated. 32574 32575@item %@{S*&T*@} 32576Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 32577(the order of @code{S} and @code{T} in the spec is not significant). 32578There can be any number of ampersand-separated variables; for each the 32579wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 32580 32581@item %@{S:X@} 32582Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 32583 32584@item %@{!S:X@} 32585Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 32586 32587@item %@{S*:X@} 32588Substitutes @code{X} if one or more switches whose names start with 32589@code{-S} are specified to GCC@. Normally @code{X} is substituted only 32590once, no matter how many such switches appeared. However, if @code{%*} 32591appears somewhere in @code{X}, then @code{X} is substituted once 32592for each matching switch, with the @code{%*} replaced by the part of 32593that switch matching the @code{*}. 32594 32595If @code{%*} appears as the last part of a spec sequence then a space 32596is added after the end of the last substitution. If there is more 32597text in the sequence, however, then a space is not generated. This 32598allows the @code{%*} substitution to be used as part of a larger 32599string. For example, a spec string like this: 32600 32601@smallexample 32602%@{mcu=*:--script=%*/memory.ld@} 32603@end smallexample 32604 32605@noindent 32606when matching an option like @option{-mcu=newchip} produces: 32607 32608@smallexample 32609--script=newchip/memory.ld 32610@end smallexample 32611 32612@item %@{.S:X@} 32613Substitutes @code{X}, if processing a file with suffix @code{S}. 32614 32615@item %@{!.S:X@} 32616Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 32617 32618@item %@{,S:X@} 32619Substitutes @code{X}, if processing a file for language @code{S}. 32620 32621@item %@{!,S:X@} 32622Substitutes @code{X}, if not processing a file for language @code{S}. 32623 32624@item %@{S|P:X@} 32625Substitutes @code{X} if either @code{-S} or @code{-P} is given to 32626GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 32627@code{*} sequences as well, although they have a stronger binding than 32628the @samp{|}. If @code{%*} appears in @code{X}, all of the 32629alternatives must be starred, and only the first matching alternative 32630is substituted. 32631 32632For example, a spec string like this: 32633 32634@smallexample 32635%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 32636@end smallexample 32637 32638@noindent 32639outputs the following command-line options from the following input 32640command-line options: 32641 32642@smallexample 32643fred.c -foo -baz 32644jim.d -bar -boggle 32645-d fred.c -foo -baz -boggle 32646-d jim.d -bar -baz -boggle 32647@end smallexample 32648 32649@item %@{%:@var{function}(@var{args}):X@} 32650 32651Call function named @var{function} with args @var{args}. If the 32652function returns non-NULL, then @code{X} is substituted, if it returns 32653NULL, it isn't substituted. 32654 32655@item %@{S:X; T:Y; :D@} 32656 32657If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 32658given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 32659be as many clauses as you need. This may be combined with @code{.}, 32660@code{,}, @code{!}, @code{|}, and @code{*} as needed. 32661 32662 32663@end table 32664 32665The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}} 32666or similar construct can use a backslash to ignore the special meaning 32667of the character following it, thus allowing literal matching of a 32668character that is otherwise specially treated. For example, 32669@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the 32670@option{-std=iso9899:1999} option is given. 32671 32672The conditional text @code{X} in a @samp{%@{S:X@}} or similar 32673construct may contain other nested @samp{%} constructs or spaces, or 32674even newlines. They are processed as usual, as described above. 32675Trailing white space in @code{X} is ignored. White space may also 32676appear anywhere on the left side of the colon in these constructs, 32677except between @code{.} or @code{*} and the corresponding word. 32678 32679The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 32680handled specifically in these constructs. If another value of 32681@option{-O} or the negated form of a @option{-f}, @option{-m}, or 32682@option{-W} switch is found later in the command line, the earlier 32683switch value is ignored, except with @{@code{S}*@} where @code{S} is 32684just one letter, which passes all matching options. 32685 32686The character @samp{|} at the beginning of the predicate text is used to 32687indicate that a command should be piped to the following command, but 32688only if @option{-pipe} is specified. 32689 32690It is built into GCC which switches take arguments and which do not. 32691(You might think it would be useful to generalize this to allow each 32692compiler's spec to say which switches take arguments. But this cannot 32693be done in a consistent fashion. GCC cannot even decide which input 32694files have been specified without knowing which switches take arguments, 32695and it must know which input files to compile in order to tell which 32696compilers to run). 32697 32698GCC also knows implicitly that arguments starting in @option{-l} are to be 32699treated as compiler output files, and passed to the linker in their 32700proper position among the other output files. 32701 32702@node Environment Variables 32703@section Environment Variables Affecting GCC 32704@cindex environment variables 32705 32706@c man begin ENVIRONMENT 32707This section describes several environment variables that affect how GCC 32708operates. Some of them work by specifying directories or prefixes to use 32709when searching for various kinds of files. Some are used to specify other 32710aspects of the compilation environment. 32711 32712Note that you can also specify places to search using options such as 32713@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 32714take precedence over places specified using environment variables, which 32715in turn take precedence over those specified by the configuration of GCC@. 32716@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 32717GNU Compiler Collection (GCC) Internals}. 32718 32719@table @env 32720@item LANG 32721@itemx LC_CTYPE 32722@c @itemx LC_COLLATE 32723@itemx LC_MESSAGES 32724@c @itemx LC_MONETARY 32725@c @itemx LC_NUMERIC 32726@c @itemx LC_TIME 32727@itemx LC_ALL 32728@findex LANG 32729@findex LC_CTYPE 32730@c @findex LC_COLLATE 32731@findex LC_MESSAGES 32732@c @findex LC_MONETARY 32733@c @findex LC_NUMERIC 32734@c @findex LC_TIME 32735@findex LC_ALL 32736@cindex locale 32737These environment variables control the way that GCC uses 32738localization information which allows GCC to work with different 32739national conventions. GCC inspects the locale categories 32740@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 32741so. These locale categories can be set to any value supported by your 32742installation. A typical value is @samp{en_GB.UTF-8} for English in the United 32743Kingdom encoded in UTF-8. 32744 32745The @env{LC_CTYPE} environment variable specifies character 32746classification. GCC uses it to determine the character boundaries in 32747a string; this is needed for some multibyte encodings that contain quote 32748and escape characters that are otherwise interpreted as a string 32749end or escape. 32750 32751The @env{LC_MESSAGES} environment variable specifies the language to 32752use in diagnostic messages. 32753 32754If the @env{LC_ALL} environment variable is set, it overrides the value 32755of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 32756and @env{LC_MESSAGES} default to the value of the @env{LANG} 32757environment variable. If none of these variables are set, GCC 32758defaults to traditional C English behavior. 32759 32760@item TMPDIR 32761@findex TMPDIR 32762If @env{TMPDIR} is set, it specifies the directory to use for temporary 32763files. GCC uses temporary files to hold the output of one stage of 32764compilation which is to be used as input to the next stage: for example, 32765the output of the preprocessor, which is the input to the compiler 32766proper. 32767 32768@item GCC_COMPARE_DEBUG 32769@findex GCC_COMPARE_DEBUG 32770Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 32771@option{-fcompare-debug} to the compiler driver. See the documentation 32772of this option for more details. 32773 32774@item GCC_EXEC_PREFIX 32775@findex GCC_EXEC_PREFIX 32776If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 32777names of the subprograms executed by the compiler. No slash is added 32778when this prefix is combined with the name of a subprogram, but you can 32779specify a prefix that ends with a slash if you wish. 32780 32781If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 32782an appropriate prefix to use based on the pathname it is invoked with. 32783 32784If GCC cannot find the subprogram using the specified prefix, it 32785tries looking in the usual places for the subprogram. 32786 32787The default value of @env{GCC_EXEC_PREFIX} is 32788@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 32789the installed compiler. In many cases @var{prefix} is the value 32790of @code{prefix} when you ran the @file{configure} script. 32791 32792Other prefixes specified with @option{-B} take precedence over this prefix. 32793 32794This prefix is also used for finding files such as @file{crt0.o} that are 32795used for linking. 32796 32797In addition, the prefix is used in an unusual way in finding the 32798directories to search for header files. For each of the standard 32799directories whose name normally begins with @samp{/usr/local/lib/gcc} 32800(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 32801replacing that beginning with the specified prefix to produce an 32802alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 32803@file{foo/bar} just before it searches the standard directory 32804@file{/usr/local/lib/bar}. 32805If a standard directory begins with the configured 32806@var{prefix} then the value of @var{prefix} is replaced by 32807@env{GCC_EXEC_PREFIX} when looking for header files. 32808 32809@item COMPILER_PATH 32810@findex COMPILER_PATH 32811The value of @env{COMPILER_PATH} is a colon-separated list of 32812directories, much like @env{PATH}. GCC tries the directories thus 32813specified when searching for subprograms, if it cannot find the 32814subprograms using @env{GCC_EXEC_PREFIX}. 32815 32816@item LIBRARY_PATH 32817@findex LIBRARY_PATH 32818The value of @env{LIBRARY_PATH} is a colon-separated list of 32819directories, much like @env{PATH}. When configured as a native compiler, 32820GCC tries the directories thus specified when searching for special 32821linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking 32822using GCC also uses these directories when searching for ordinary 32823libraries for the @option{-l} option (but directories specified with 32824@option{-L} come first). 32825 32826@item LANG 32827@findex LANG 32828@cindex locale definition 32829This variable is used to pass locale information to the compiler. One way in 32830which this information is used is to determine the character set to be used 32831when character literals, string literals and comments are parsed in C and C++. 32832When the compiler is configured to allow multibyte characters, 32833the following values for @env{LANG} are recognized: 32834 32835@table @samp 32836@item C-JIS 32837Recognize JIS characters. 32838@item C-SJIS 32839Recognize SJIS characters. 32840@item C-EUCJP 32841Recognize EUCJP characters. 32842@end table 32843 32844If @env{LANG} is not defined, or if it has some other value, then the 32845compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 32846recognize and translate multibyte characters. 32847 32848@item GCC_EXTRA_DIAGNOSTIC_OUTPUT 32849@findex GCC_EXTRA_DIAGNOSTIC_OUTPUT 32850If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values, 32851then additional text will be emitted to stderr when fix-it hints are 32852emitted. @option{-fdiagnostics-parseable-fixits} and 32853@option{-fno-diagnostics-parseable-fixits} take precedence over this 32854environment variable. 32855 32856@table @samp 32857@item fixits-v1 32858Emit parseable fix-it hints, equivalent to 32859@option{-fdiagnostics-parseable-fixits}. In particular, columns are 32860expressed as a count of bytes, starting at byte 1 for the initial column. 32861 32862@item fixits-v2 32863As @code{fixits-v1}, but columns are expressed as display columns, 32864as per @option{-fdiagnostics-column-unit=display}. 32865@end table 32866 32867@end table 32868 32869@noindent 32870Some additional environment variables affect the behavior of the 32871preprocessor. 32872 32873@include cppenv.texi 32874 32875@c man end 32876 32877@node Precompiled Headers 32878@section Using Precompiled Headers 32879@cindex precompiled headers 32880@cindex speed of compilation 32881 32882Often large projects have many header files that are included in every 32883source file. The time the compiler takes to process these header files 32884over and over again can account for nearly all of the time required to 32885build the project. To make builds faster, GCC allows you to 32886@dfn{precompile} a header file. 32887 32888To create a precompiled header file, simply compile it as you would any 32889other file, if necessary using the @option{-x} option to make the driver 32890treat it as a C or C++ header file. You may want to use a 32891tool like @command{make} to keep the precompiled header up-to-date when 32892the headers it contains change. 32893 32894A precompiled header file is searched for when @code{#include} is 32895seen in the compilation. As it searches for the included file 32896(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 32897compiler looks for a precompiled header in each directory just before it 32898looks for the include file in that directory. The name searched for is 32899the name specified in the @code{#include} with @samp{.gch} appended. If 32900the precompiled header file cannot be used, it is ignored. 32901 32902For instance, if you have @code{#include "all.h"}, and you have 32903@file{all.h.gch} in the same directory as @file{all.h}, then the 32904precompiled header file is used if possible, and the original 32905header is used otherwise. 32906 32907Alternatively, you might decide to put the precompiled header file in a 32908directory and use @option{-I} to ensure that directory is searched 32909before (or instead of) the directory containing the original header. 32910Then, if you want to check that the precompiled header file is always 32911used, you can put a file of the same name as the original header in this 32912directory containing an @code{#error} command. 32913 32914This also works with @option{-include}. So yet another way to use 32915precompiled headers, good for projects not designed with precompiled 32916header files in mind, is to simply take most of the header files used by 32917a project, include them from another header file, precompile that header 32918file, and @option{-include} the precompiled header. If the header files 32919have guards against multiple inclusion, they are skipped because 32920they've already been included (in the precompiled header). 32921 32922If you need to precompile the same header file for different 32923languages, targets, or compiler options, you can instead make a 32924@emph{directory} named like @file{all.h.gch}, and put each precompiled 32925header in the directory, perhaps using @option{-o}. It doesn't matter 32926what you call the files in the directory; every precompiled header in 32927the directory is considered. The first precompiled header 32928encountered in the directory that is valid for this compilation is 32929used; they're searched in no particular order. 32930 32931There are many other possibilities, limited only by your imagination, 32932good sense, and the constraints of your build system. 32933 32934A precompiled header file can be used only when these conditions apply: 32935 32936@itemize 32937@item 32938Only one precompiled header can be used in a particular compilation. 32939 32940@item 32941A precompiled header cannot be used once the first C token is seen. You 32942can have preprocessor directives before a precompiled header; you cannot 32943include a precompiled header from inside another header. 32944 32945@item 32946The precompiled header file must be produced for the same language as 32947the current compilation. You cannot use a C precompiled header for a C++ 32948compilation. 32949 32950@item 32951The precompiled header file must have been produced by the same compiler 32952binary as the current compilation is using. 32953 32954@item 32955Any macros defined before the precompiled header is included must 32956either be defined in the same way as when the precompiled header was 32957generated, or must not affect the precompiled header, which usually 32958means that they don't appear in the precompiled header at all. 32959 32960The @option{-D} option is one way to define a macro before a 32961precompiled header is included; using a @code{#define} can also do it. 32962There are also some options that define macros implicitly, like 32963@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 32964defined this way. 32965 32966@item If debugging information is output when using the precompiled 32967header, using @option{-g} or similar, the same kind of debugging information 32968must have been output when building the precompiled header. However, 32969a precompiled header built using @option{-g} can be used in a compilation 32970when no debugging information is being output. 32971 32972@item The same @option{-m} options must generally be used when building 32973and using the precompiled header. @xref{Submodel Options}, 32974for any cases where this rule is relaxed. 32975 32976@item Each of the following options must be the same when building and using 32977the precompiled header: 32978 32979@gccoptlist{-fexceptions} 32980 32981@item 32982Some other command-line options starting with @option{-f}, 32983@option{-p}, or @option{-O} must be defined in the same way as when 32984the precompiled header was generated. At present, it's not clear 32985which options are safe to change and which are not; the safest choice 32986is to use exactly the same options when generating and using the 32987precompiled header. The following are known to be safe: 32988 32989@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 32990-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 32991-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 32992-pedantic-errors} 32993 32994@item Address space layout randomization (ASLR) can lead to not binary identical 32995PCH files. If you rely on stable PCH file contents disable ASLR when generating 32996PCH files. 32997 32998@end itemize 32999 33000For all of these except the last, the compiler automatically 33001ignores the precompiled header if the conditions aren't met. If you 33002find an option combination that doesn't work and doesn't cause the 33003precompiled header to be ignored, please consider filing a bug report, 33004see @ref{Bugs}. 33005 33006If you do use differing options when generating and using the 33007precompiled header, the actual behavior is a mixture of the 33008behavior for the options. For instance, if you use @option{-g} to 33009generate the precompiled header but not when using it, you may or may 33010not get debugging information for routines in the precompiled header. 33011 33012@node C++ Modules 33013@section C++ Modules 33014@cindex speed of compilation 33015 33016Modules are a C++20 language feature. As the name suggests, they 33017provides a modular compilation system, intending to provide both 33018faster builds and better library isolation. The ``Merging Modules'' 33019paper @uref{https://wg21.link/p1103}, provides the easiest to read set 33020of changes to the standard, although it does not capture later 33021changes. That specification is now part of C++20, 33022@uref{git@@github.com:cplusplus/draft.git}, it is considered complete 33023(there may be defect reports to come). 33024 33025@emph{G++'s modules support is not complete.} Other than bugs, the 33026known missing pieces are: 33027 33028@table @emph 33029 33030@item Private Module Fragment 33031The Private Module Fragment is recognized, but an error is emitted. 33032 33033@item Partition definition visibility rules 33034Entities may be defined in implementation partitions, and those 33035definitions are not available outside of the module. This is not 33036implemented, and the definitions are available to extra-module use. 33037 33038@item Textual merging of reachable GM entities 33039Entities may be multiply defined across different header-units. 33040These must be de-duplicated, and this is implemented across imports, 33041or when an import redefines a textually-defined entity. However the 33042reverse is not implemented---textually redefining an entity that has 33043been defined in an imported header-unit. A redefinition error is 33044emitted. 33045 33046@item Translation-Unit local referencing rules 33047Papers p1815 (@uref{https://wg21.link/p1815}) and p2003 33048(@uref{https://wg21.link/p2003}) add limitations on which entities an 33049exported region may reference (for instance, the entities an exported 33050template definition may reference). These are not fully implemented. 33051 33052@item Language-linkage module attachment 33053Declarations with explicit language linkage (@code{extern "C"} or 33054@code{extern "C++"}) are attached to the global module, even when in 33055the purview of a named module. This is not implemented. Such 33056declarations will be attached to the module, if any, in which they are 33057declared. 33058 33059@item Standard Library Header Units 33060The Standard Library is not provided as importable header units. If 33061you want to import such units, you must explicitly build them first. 33062If you do not do this with care, you may have multiple declarations, 33063which the module machinery must merge---compiler resource usage can be 33064affected by how you partition header files into header units. 33065 33066@end table 33067 33068Modular compilation is @emph{not} enabled with just the 33069@option{-std=c++20} option. You must explicitly enable it with the 33070@option{-fmodules-ts} option. It is independent of the language 33071version selected, although in pre-C++20 versions, it is of course an 33072extension. 33073 33074No new source file suffixes are required or supported. If you wish to 33075use a non-standard suffix (@xref{Overall Options}), you also need 33076to provide a @option{-x c++} option too.@footnote{Some users like to 33077distinguish module interface files with a new suffix, such as naming 33078the source @code{module.cppm}, which involves 33079teaching all tools about the new suffix. A different scheme, such as 33080naming @code{module-m.cpp} would be less invasive.} 33081 33082Compiling a module interface unit produces an additional output (to 33083the assembly or object file), called a Compiled Module Interface 33084(CMI). This encodes the exported declarations of the module. 33085Importing a module reads in the CMI. The import graph is a Directed 33086Acyclic Graph (DAG). You must build imports before the importer. 33087 33088Header files may themselves be compiled to header units, which are a 33089transitional ability aiming at faster compilation. The 33090@option{-fmodule-header} option is used to enable this, and implies 33091the @option{-fmodules-ts} option. These CMIs are named by the fully 33092resolved underlying header file, and thus may be a complete pathname 33093containing subdirectories. If the header file is found at an absolute 33094pathname, the CMI location is still relative to a CMI root directory. 33095 33096As header files often have no suffix, you commonly have to specify a 33097@option{-x} option to tell the compiler the source is a header file. 33098You may use @option{-x c++-header}, @option{-x c++-user-header} or 33099@option{-x c++-system-header}. When used in conjunction with 33100@option{-fmodules-ts}, these all imply an appropriate 33101@option{-fmodule-header} option. The latter two variants use the 33102user or system include path to search for the file specified. This 33103allows you to, for instance, compile standard library header files as 33104header units, without needing to know exactly where they are 33105installed. Specifying the language as one of these variants also 33106inhibits output of the object file, as header files have no associated 33107object file. 33108 33109The @option{-fmodule-only} option disables generation of the 33110associated object file for compiling a module interface. Only the CMI 33111is generated. This option is implied when using the 33112@option{-fmodule-header} option. 33113 33114The @option{-flang-info-include-translate} and 33115@option{-flang-info-include-translate-not} options notes whether 33116include translation occurs or not. With no argument, the first will 33117note all include translation. The second will note all 33118non-translations of include files not known to intentionally be 33119textual. With an argument, queries about include translation of a 33120header files with that particular trailing pathname are noted. You 33121may repeat this form to cover several different header files. This 33122option may be helpful in determining whether include translation is 33123happening---if it is working correctly, it behaves as if it isn't 33124there at all. 33125 33126The @option{-flang-info-module-cmi} option can be used to determine 33127where the compiler is reading a CMI from. Without the option, the 33128compiler is silent when such a read is successful. This option has an 33129optional argument, which will restrict the notification to just the 33130set of named modules or header units specified. 33131 33132The @option{-Winvalid-imported-macros} option causes all imported macros 33133to be resolved at the end of compilation. Without this, imported 33134macros are only resolved when expanded or (re)defined. This option 33135detects conflicting import definitions for all macros. 33136 33137@xref{C++ Module Mapper} for details of the @option{-fmodule-mapper} 33138family of options. 33139 33140@menu 33141* C++ Module Mapper:: Module Mapper 33142* C++ Module Preprocessing:: Module Preprocessing 33143* C++ Compiled Module Interface:: Compiled Module Interface 33144@end menu 33145 33146@node C++ Module Mapper 33147@subsection Module Mapper 33148@cindex C++ Module Mapper 33149 33150A module mapper provides a server or file that the compiler queries to 33151determine the mapping between module names and CMI files. It is also 33152used to build CMIs on demand. @emph{Mapper functionality is in its 33153infancy and is intended for experimentation with build system 33154interactions.} 33155 33156You can specify a mapper with the @option{-fmodule-mapper=@var{val}} 33157option or @env{CXX_MODULE_MAPPER} environment variable. The value may 33158have one of the following forms: 33159 33160@table @gcctabopt 33161 33162@item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]} 33163An optional hostname and a numeric port number to connect to. If the 33164hostname is omitted, the loopback address is used. If the hostname 33165corresponds to multiple IPV6 addresses, these are tried in turn, until 33166one is successful. If your host lacks IPv6, this form is 33167non-functional. If you must use IPv4 use 33168@option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}. 33169 33170@item =@var{socket}@r{[}?@var{ident}@r{]} 33171A local domain socket. If your host lacks local domain sockets, this 33172form is non-functional. 33173 33174@item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]} 33175A program to spawn, and communicate with on its stdin/stdout streams. 33176Your @var{PATH} environment variable is searched for the program. 33177Arguments are separated by space characters, (it is not possible for 33178one of the arguments delivered to the program to contain a space). An 33179exception is if @var{program} begins with @@. In that case 33180@var{program} (sans @@) is looked for in the compiler's internal 33181binary directory. Thus the sample mapper-server can be specified 33182with @code{@@g++-mapper-server}. 33183 33184@item <>@r{[}?@var{ident}@r{]} 33185@item <>@var{inout}@r{[}?@var{ident}@r{]} 33186@item <@var{in}>@var{out}@r{[}?@var{ident}@r{]} 33187Named pipes or file descriptors to communicate over. The first form, 33188@option{<>}, communicates over stdin and stdout. The other forms 33189allow you to specify a file descriptor or name a pipe. A numeric value 33190is interpreted as a file descriptor, otherwise named pipe is opened. 33191The second form specifies a bidirectional pipe and the last form 33192allows specifying two independent pipes. Using file descriptors 33193directly in this manner is fragile in general, as it can require the 33194cooperation of intermediate processes. In particular using stdin & 33195stdout is fraught with danger as other compiler options might also 33196cause the compiler to read stdin or write stdout, and it can have 33197unfortunate interactions with signal delivery from the terminal. 33198 33199@item @var{file}@r{[}?@var{ident}@r{]} 33200A mapping file consisting of space-separated module-name, filename 33201pairs, one per line. Only the mappings for the direct imports and any 33202module export name need be provided. If other mappings are provided, 33203they override those stored in any imported CMI files. A repository 33204root may be specified in the mapping file by using @samp{$root} as the 33205module name in the first active line. Use of this option will disable 33206any default module->CMI name mapping. 33207 33208@end table 33209 33210As shown, an optional @var{ident} may suffix the first word of the 33211option, indicated by a @samp{?} prefix. The value is used in the 33212initial handshake with the module server, or to specify a prefix on 33213mapping file lines. In the server case, the main source file name is 33214used if no @var{ident} is specified. In the file case, all non-blank 33215lines are significant, unless a value is specified, in which case only 33216lines beginning with @var{ident} are significant. The @var{ident} 33217must be separated by whitespace from the module name. Be aware that 33218@samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often 33219significant to the shell, and therefore may need quoting. 33220 33221The mapper is connected to or loaded lazily, when the first module 33222mapping is required. The networking protocols are only supported on 33223hosts that provide networking. If no mapper is specified a default is 33224provided. 33225 33226A project-specific mapper is expected to be provided by the build 33227system that invokes the compiler. It is not expected that a 33228general-purpose server is provided for all compilations. As such, the 33229server will know the build configuration, the compiler it invoked, and 33230the environment (such as working directory) in which that is 33231operating. As it may parallelize builds, several compilations may 33232connect to the same socket. 33233 33234The default mapper generates CMI files in a @samp{gcm.cache} 33235directory. CMI files have a @samp{.gcm} suffix. The module unit name 33236is used directly to provide the basename. Header units construct a 33237relative path using the underlying header file name. If the path is 33238already relative, a @samp{,} directory is prepended. Internal 33239@samp{..} components are translated to @samp{,,}. No attempt is made 33240to canonicalize these filenames beyond that done by the preprocessor's 33241include search algorithm, as in general it is ambiguous when symbolic 33242links are present. 33243 33244The mapper protocol was published as ``A Module Mapper'' 33245@uref{https://wg21.link/p1184}. The implementation is provided by 33246@command{libcody}, @uref{https://github.com/urnathan/libcody}, 33247which specifies the canonical protocol definition. A proof of concept 33248server implementation embedded in @command{make} was described in 33249''Make Me A Module'', @uref{https://wg21.link/p1602}. 33250 33251@node C++ Module Preprocessing 33252@subsection Module Preprocessing 33253@cindex C++ Module Preprocessing 33254 33255Modules affect preprocessing because of header units and include 33256translation. Some uses of the preprocessor as a separate step either 33257do not produce a correct output, or require CMIs to be available. 33258 33259Header units import macros. These macros can affect later conditional 33260inclusion, which therefore can cascade to differing import sets. When 33261preprocessing, it is necessary to load the CMI. If a header unit is 33262unavailable, the preprocessor issues a warning and continue (when 33263not just preprocessing, an error is emitted). Detecting such imports 33264requires preprocessor tokenization of the input stream to phase 4 33265(macro expansion). 33266 33267Include translation converts @code{#include}, @code{#include_next} and 33268@code{#import} directives to internal @code{import} declarations. 33269Whether a particular directive is translated is controlled by the 33270module mapper. Header unit names are canonicalized during 33271preprocessing. 33272 33273Dependency information can be emitted for macro import, extending the 33274functionality of @option{-MD} and @option{-MMD} options. Detection of 33275import declarations also requires phase 4 preprocessing, and thus 33276requires full preprocessing (or compilation). 33277 33278The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt 33279preprocessing before phase 4. 33280 33281The @option{-save-temps} option uses @option{-fdirectives-only} for 33282preprocessing, and preserve the macro definitions in the preprocessed 33283output. Usually you also want to use this option when explicitly 33284preprocessing a header-unit, or consuming such preprocessed output: 33285 33286@smallexample 33287g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii 33288g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii 33289@end smallexample 33290 33291@node C++ Compiled Module Interface 33292@subsection Compiled Module Interface 33293@cindex C++ Compiled Module Interface 33294 33295CMIs are an additional artifact when compiling named module 33296interfaces, partitions or header units. These are read when 33297importing. CMI contents are implementation-specific, and in GCC's 33298case tied to the compiler version. Consider them a rebuildable cache 33299artifact, not a distributable object. 33300 33301When creating an output CMI, any missing directory components are 33302created in a manner that is safe for concurrent builds creating 33303multiple, different, CMIs within a common subdirectory tree. 33304 33305CMI contents are written to a temporary file, which is then atomically 33306renamed. Observers either see old contents (if there is an 33307existing file), or complete new contents. They do not observe the 33308CMI during its creation. This is unlike object file writing, which 33309may be observed by an external process. 33310 33311CMIs are read in lazily, if the host OS provides @code{mmap} 33312functionality. Generally blocks are read when name lookup or template 33313instantiation occurs. To inhibit this, the @option{-fno-module-lazy} 33314option may be used. 33315 33316The @option{--param lazy-modules=@var{n}} parameter controls the limit 33317on the number of concurrently open module files during lazy loading. 33318Should more modules be imported, an LRU algorithm is used to determine 33319which files to close---until that file is needed again. This limit 33320may be exceeded with deep module dependency hierarchies. With large 33321code bases there may be more imports than the process limit of file 33322descriptors. By default, the limit is a few less than the per-process 33323file descriptor hard limit, if that is determinable.@footnote{Where 33324applicable the soft limit is incremented as needed towards the hard limit.} 33325 33326GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism. 33327You may use @command{readelf} to inspect them, although section 33328contents are largely undecipherable. There is a section named 33329@code{.gnu.c++.README}, which contains human-readable text. Other 33330than the first line, each line consists of @code{@var{tag}: @code{value}} 33331tuples. 33332 33333@smallexample 33334> @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm} 33335 33336String dump of section '.gnu.c++.README': 33337 [ 0] GNU C++ primary module interface 33338 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454] 33339 [ 6f] version: 2020/11/16-04:54 33340 [ 89] module: foo 33341 [ 95] source: c_b.ii 33342 [ a4] dialect: C++20/coroutines 33343 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc 33344 [ ee] repository: gcm.cache 33345 [ 104] buildtime: 2020/11/16 15:03:21 UTC 33346 [ 127] localtime: 2020/11/16 07:03:21 PST 33347 [ 14a] export: foo:part1 foo-part1.gcm 33348@end smallexample 33349 33350Amongst other things, this lists the source that was built, C++ 33351dialect used and imports of the module.@footnote{The precise contents 33352of this output may change.} The timestamp is the same value as that 33353provided by the @code{__DATE__} & @code{__TIME__} macros, and may be 33354explicitly specified with the environment variable 33355@code{SOURCE_DATE_EPOCH}. @xref{Environment Variables} for further 33356details. 33357 33358A set of related CMIs may be copied, provided the relative pathnames 33359are preserved. 33360 33361The @code{.gnu.c++.README} contents do not affect CMI integrity, and 33362it may be removed or altered. The section numbering of the sections 33363whose names do not begin with @code{.gnu.c++.}, or are not the string 33364section is significant and must not be altered. 33365