1@c Copyright (C) 1988-2022 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-2022 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{https://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} -aux-info @var{filename} @gol 201-fallow-parameterless-variadic-functions -fno-asm @gol 202-fno-builtin -fno-builtin-@var{function} -fcond-mismatch @gol 203-ffreestanding -fgimple -fgnu-tm -fgnu89-inline -fhosted @gol 204-flax-vector-conversions -fms-extensions @gol 205-foffload=@var{arg} -foffload-options=@var{arg} @gol 206-fopenacc -fopenacc-dim=@var{geom} @gol 207-fopenmp -fopenmp-simd @gol 208-fpermitted-flt-eval-methods=@var{standard} @gol 209-fplan9-extensions -fsigned-bitfields -funsigned-bitfields @gol 210-fsigned-char -funsigned-char -fsso-struct=@var{endianness}} 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 -Wno-deprecated-array-compare @gol 253-Wdeprecated-copy -Wdeprecated-copy-dtor @gol 254-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol 255-Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base @gol 256-Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol 257-Winvalid-imported-macros @gol 258-Wno-invalid-offsetof -Wno-literal-suffix @gol 259-Wmismatched-new-delete -Wmismatched-tags @gol 260-Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol 261-Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol 262-Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol 263-Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol 264-Wreorder -Wregister @gol 265-Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol 266-Wno-non-template-friend -Wold-style-cast @gol 267-Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol 268-Wsized-deallocation -Wsuggest-final-methods @gol 269-Wsuggest-final-types -Wsuggest-override @gol 270-Wno-terminate -Wuseless-cast -Wno-vexing-parse @gol 271-Wvirtual-inheritance @gol 272-Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant} 273 274@item Objective-C and Objective-C++ Language Options 275@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling 276Objective-C and Objective-C++ Dialects}. 277@gccoptlist{-fconstant-string-class=@var{class-name} @gol 278-fgnu-runtime -fnext-runtime @gol 279-fno-nil-receivers @gol 280-fobjc-abi-version=@var{n} @gol 281-fobjc-call-cxx-cdtors @gol 282-fobjc-direct-dispatch @gol 283-fobjc-exceptions @gol 284-fobjc-gc @gol 285-fobjc-nilcheck @gol 286-fobjc-std=objc1 @gol 287-fno-local-ivars @gol 288-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol 289-freplace-objc-classes @gol 290-fzero-link @gol 291-gen-decls @gol 292-Wassign-intercept -Wno-property-assign-default @gol 293-Wno-protocol -Wobjc-root-class -Wselector @gol 294-Wstrict-selector-match @gol 295-Wundeclared-selector} 296 297@item Diagnostic Message Formatting Options 298@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}. 299@gccoptlist{-fmessage-length=@var{n} @gol 300-fdiagnostics-plain-output @gol 301-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 302-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol 303-fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol 304-fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol 305-fno-diagnostics-show-option -fno-diagnostics-show-caret @gol 306-fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol 307-fno-diagnostics-show-cwe @gol 308-fdiagnostics-minimum-margin-width=@var{width} @gol 309-fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol 310-fdiagnostics-show-template-tree -fno-elide-type @gol 311-fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol 312-fdiagnostics-show-path-depths @gol 313-fno-show-column @gol 314-fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol 315-fdiagnostics-column-origin=@var{origin} @gol 316-fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}} 317 318@item Warning Options 319@xref{Warning Options,,Options to Request or Suppress Warnings}. 320@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol 321-pedantic-errors @gol 322-w -Wextra -Wall -Wabi=@var{n} @gol 323-Waddress -Wno-address-of-packed-member -Waggregate-return @gol 324-Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol 325-Walloca -Walloca-larger-than=@var{byte-size} @gol 326-Wno-aggressive-loop-optimizations @gol 327-Warith-conversion @gol 328-Warray-bounds -Warray-bounds=@var{n} -Warray-compare @gol 329-Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol 330-Wno-attribute-warning @gol 331-Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]} @gol 332-Wbool-compare -Wbool-operation @gol 333-Wno-builtin-declaration-mismatch @gol 334-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol 335-Wc11-c2x-compat @gol 336-Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol 337-Wc++20-compat @gol 338-Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions @gol 339-Wno-c++20-extensions -Wno-c++23-extensions @gol 340-Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol 341-Wchar-subscripts @gol 342-Wclobbered -Wcomment @gol 343-Wconversion -Wno-coverage-mismatch -Wno-cpp @gol 344-Wdangling-else -Wdangling-pointer -Wdangling-pointer=@var{n} @gol 345-Wdate-time @gol 346-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol 347-Wdisabled-optimization @gol 348-Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol 349-Wno-div-by-zero -Wdouble-promotion @gol 350-Wduplicated-branches -Wduplicated-cond @gol 351-Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol 352-Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol 353-Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol 354-Wno-format-contains-nul -Wno-format-extra-args @gol 355-Wformat-nonliteral -Wformat-overflow=@var{n} @gol 356-Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol 357-Wformat-y2k -Wframe-address @gol 358-Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol 359-Wno-if-not-aligned -Wno-ignored-attributes @gol 360-Wignored-qualifiers -Wno-incompatible-pointer-types @gol 361-Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol 362-Wno-implicit-function-declaration -Wno-implicit-int @gol 363-Winfinite-recursion @gol 364-Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol 365-Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol 366-Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol 367-Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol 368-Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol 369-Wmemset-elt-size -Wmemset-transposed-args @gol 370-Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol 371-Wmissing-field-initializers -Wmissing-format-attribute @gol 372-Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol 373-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol 374-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol 375-Wnull-dereference -Wno-odr @gol 376-Wopenacc-parallelism @gol 377-Wopenmp-simd @gol 378-Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol 379-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol 380-Wparentheses -Wno-pedantic-ms-format @gol 381-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol 382-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol 383-Wrestrict -Wno-return-local-addr -Wreturn-type @gol 384-Wno-scalar-storage-order -Wsequence-point @gol 385-Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol 386-Wno-shadow-ivar @gol 387-Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol 388-Wno-shift-overflow -Wshift-overflow=@var{n} @gol 389-Wsign-compare -Wsign-conversion @gol 390-Wno-sizeof-array-argument @gol 391-Wsizeof-array-div @gol 392-Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol 393-Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol 394-Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol 395-Wstring-compare @gol 396-Wno-stringop-overflow -Wno-stringop-overread @gol 397-Wno-stringop-truncation @gol 398-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol 399-Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol 400-Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol 401-Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol 402-Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef @gol 403-Wuninitialized -Wunknown-pragmas @gol 404-Wunsuffixed-float-constants -Wunused @gol 405-Wunused-but-set-parameter -Wunused-but-set-variable @gol 406-Wunused-const-variable -Wunused-const-variable=@var{n} @gol 407-Wunused-function -Wunused-label -Wunused-local-typedefs @gol 408-Wunused-macros @gol 409-Wunused-parameter -Wno-unused-result @gol 410-Wunused-value -Wunused-variable @gol 411-Wno-varargs -Wvariadic-macros @gol 412-Wvector-operation-performance @gol 413-Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol 414-Wvolatile-register-var -Wwrite-strings @gol 415-Wzero-length-bounds} 416 417@item Static Analyzer Options 418@gccoptlist{ 419-fanalyzer @gol 420-fanalyzer-call-summaries @gol 421-fanalyzer-checker=@var{name} @gol 422-fno-analyzer-feasibility @gol 423-fanalyzer-fine-grained @gol 424-fno-analyzer-state-merge @gol 425-fno-analyzer-state-purge @gol 426-fanalyzer-transitivity @gol 427-fanalyzer-verbose-edges @gol 428-fanalyzer-verbose-state-changes @gol 429-fanalyzer-verbosity=@var{level} @gol 430-fdump-analyzer @gol 431-fdump-analyzer-callgraph @gol 432-fdump-analyzer-exploded-graph @gol 433-fdump-analyzer-exploded-nodes @gol 434-fdump-analyzer-exploded-nodes-2 @gol 435-fdump-analyzer-exploded-nodes-3 @gol 436-fdump-analyzer-exploded-paths @gol 437-fdump-analyzer-feasibility @gol 438-fdump-analyzer-json @gol 439-fdump-analyzer-state-purge @gol 440-fdump-analyzer-stderr @gol 441-fdump-analyzer-supergraph @gol 442-fdump-analyzer-untracked @gol 443-Wno-analyzer-double-fclose @gol 444-Wno-analyzer-double-free @gol 445-Wno-analyzer-exposure-through-output-file @gol 446-Wno-analyzer-file-leak @gol 447-Wno-analyzer-free-of-non-heap @gol 448-Wno-analyzer-malloc-leak @gol 449-Wno-analyzer-mismatching-deallocation @gol 450-Wno-analyzer-null-argument @gol 451-Wno-analyzer-null-dereference @gol 452-Wno-analyzer-possible-null-argument @gol 453-Wno-analyzer-possible-null-dereference @gol 454-Wno-analyzer-shift-count-negative @gol 455-Wno-analyzer-shift-count-overflow @gol 456-Wno-analyzer-stale-setjmp-buffer @gol 457-Wno-analyzer-tainted-allocation-size @gol 458-Wno-analyzer-tainted-array-index @gol 459-Wno-analyzer-tainted-divisor @gol 460-Wno-analyzer-tainted-offset @gol 461-Wno-analyzer-tainted-size @gol 462-Wanalyzer-too-complex @gol 463-Wno-analyzer-unsafe-call-within-signal-handler @gol 464-Wno-analyzer-use-after-free @gol 465-Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol 466-Wno-analyzer-use-of-uninitialized-value @gol 467-Wno-analyzer-write-to-const @gol 468-Wno-analyzer-write-to-string-literal @gol 469} 470 471@item C and Objective-C-only Warning Options 472@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 473-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol 474-Wold-style-declaration -Wold-style-definition @gol 475-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol 476-Wdeclaration-after-statement -Wpointer-sign} 477 478@item Debugging Options 479@xref{Debugging Options,,Options for Debugging Your Program}. 480@gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol 481-gbtf -gctf -gctf@var{level} @gol 482-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol 483-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol 484-gas-loc-support -gno-as-loc-support @gol 485-gas-locview-support -gno-as-locview-support @gol 486-gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol 487-gstatement-frontiers -gno-statement-frontiers @gol 488-gvariable-location-views -gno-variable-location-views @gol 489-ginternal-reset-location-views -gno-internal-reset-location-views @gol 490-ginline-points -gno-inline-points @gol 491-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol 492-gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol 493-fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol 494-fno-eliminate-unused-debug-types @gol 495-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 496-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 497-fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol 498-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol 499-fvar-tracking -fvar-tracking-assignments} 500 501@item Optimization Options 502@xref{Optimize Options,,Options that Control Optimization}. 503@gccoptlist{-faggressive-loop-optimizations @gol 504-falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 505-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 506-falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 507-falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol 508-fno-allocation-dce -fallow-store-data-races @gol 509-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol 510-fauto-inc-dec -fbranch-probabilities @gol 511-fcaller-saves @gol 512-fcombine-stack-adjustments -fconserve-stack @gol 513-fcompare-elim -fcprop-registers -fcrossjumping @gol 514-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol 515-fcx-limited-range @gol 516-fdata-sections -fdce -fdelayed-branch @gol 517-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol 518-fdevirtualize-at-ltrans -fdse @gol 519-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol 520-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol 521-ffinite-loops @gol 522-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol 523-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol 524-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol 525-fif-conversion2 -findirect-inlining @gol 526-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol 527-finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol 528-fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol 529-fipa-reference -fipa-reference-addressable @gol 530-fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol 531-flive-patching=@var{level} @gol 532-fira-region=@var{region} -fira-hoist-pressure @gol 533-fira-loop-pressure -fno-ira-share-save-slots @gol 534-fno-ira-share-spill-slots @gol 535-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol 536-fivopts -fkeep-inline-functions -fkeep-static-functions @gol 537-fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol 538-floop-block -floop-interchange -floop-strip-mine @gol 539-floop-unroll-and-jam -floop-nest-optimize @gol 540-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol 541-flto-partition=@var{alg} -fmerge-all-constants @gol 542-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol 543-fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg @gol 544-fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol 545-fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol 546-fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol 547-fno-sched-spec -fno-signed-zeros @gol 548-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 549-fomit-frame-pointer -foptimize-sibling-calls @gol 550-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol 551-fprefetch-loop-arrays @gol 552-fprofile-correction @gol 553-fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol 554-fprofile-values -fprofile-reorder-functions @gol 555-freciprocal-math -free -frename-registers -freorder-blocks @gol 556-freorder-blocks-algorithm=@var{algorithm} @gol 557-freorder-blocks-and-partition -freorder-functions @gol 558-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol 559-frounding-math -fsave-optimization-record @gol 560-fsched2-use-superblocks -fsched-pressure @gol 561-fsched-spec-load -fsched-spec-load-dangerous @gol 562-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol 563-fsched-group-heuristic -fsched-critical-path-heuristic @gol 564-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol 565-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol 566-fschedule-fusion @gol 567-fschedule-insns -fschedule-insns2 -fsection-anchors @gol 568-fselective-scheduling -fselective-scheduling2 @gol 569-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol 570-fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol 571-fsignaling-nans @gol 572-fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol 573-fsplit-paths @gol 574-fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol 575-fstdarg-opt -fstore-merging -fstrict-aliasing -fipa-strict-aliasing @gol 576-fthread-jumps -ftracer -ftree-bit-ccp @gol 577-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol 578-ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol 579-ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol 580-ftree-loop-if-convert -ftree-loop-im @gol 581-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol 582-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol 583-ftree-loop-vectorize @gol 584-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol 585-ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol 586-ftree-switch-conversion -ftree-tail-merge @gol 587-ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init @gol 588-funconstrained-commons -funit-at-a-time -funroll-all-loops @gol 589-funroll-loops -funsafe-math-optimizations -funswitch-loops @gol 590-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol 591-fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol 592--param @var{name}=@var{value} 593-O -O0 -O1 -O2 -O3 -Os -Ofast -Og -Oz} 594 595@item Program Instrumentation Options 596@xref{Instrumentation Options,,Program Instrumentation Options}. 597@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol 598-fprofile-abs-path @gol 599-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol 600-fprofile-info-section -fprofile-info-section=@var{name} @gol 601-fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol 602-fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol 603-fprofile-exclude-files=@var{regex} @gol 604-fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol 605-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol 606-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol 607-fsanitize-undefined-trap-on-error -fbounds-check @gol 608-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol 609-fharden-compares -fharden-conditional-branches @gol 610-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 611-fstack-protector-explicit -fstack-check @gol 612-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 613-fno-stack-limit -fsplit-stack @gol 614-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol 615-fvtv-counts -fvtv-debug @gol 616-finstrument-functions @gol 617-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 618-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} @gol 619-fprofile-prefix-map=@var{old}=@var{new} 620 621@item Preprocessor Options 622@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 623@gccoptlist{-A@var{question}=@var{answer} @gol 624-A-@var{question}@r{[}=@var{answer}@r{]} @gol 625-C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol 626-dD -dI -dM -dN -dU @gol 627-fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol 628-fexec-charset=@var{charset} -fextended-identifiers @gol 629-finput-charset=@var{charset} -flarge-source-files @gol 630-fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol 631-fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol 632-fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol 633-fwide-exec-charset=@var{charset} -fworking-directory @gol 634-H -imacros @var{file} -include @var{file} @gol 635-M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules @gol 636-no-integrated-cpp -P -pthread -remap @gol 637-iprefix @var{file} -iwithprefix @var{dir} @gol 638-traditional -traditional-cpp -trigraphs @gol 639-U@var{macro} -undef @gol 640-Wp,@var{option} -Xpreprocessor @var{option}} 641 642@item Assembler Options 643@xref{Assembler Options,,Passing Options to the Assembler}. 644@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 645 646@item Linker Options 647@xref{Link Options,,Options for Linking}. 648@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 649-nostartfiles -nodefaultlibs -nolibc -nostdlib @gol 650-e @var{entry} --entry=@var{entry} @gol 651-pie -pthread -r -rdynamic @gol 652-s -static -static-pie -static-libgcc -static-libstdc++ @gol 653-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 654-shared -shared-libgcc -symbolic @gol 655-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 656-u @var{symbol} -z @var{keyword}} 657 658@item Directory Options 659@xref{Directory Options,,Options for Directory Search}. 660@gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol 661-idirafter @var{dir} @gol 662-imacros @var{file} -imultilib @var{dir} @gol 663-iplugindir=@var{dir} @gol 664-iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol 665-iremap@var{src}:@var{dst} -cxx-isystem=@var{dir} @gol 666-iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol 667-L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol 668-nostdinc -nostdinc++ --sysroot=@var{dir}} 669 670@item Code Generation Options 671@xref{Code Gen Options,,Options for Code Generation Conventions}. 672@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 673-ffixed-@var{reg} -fexceptions @gol 674-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 675-fasynchronous-unwind-tables @gol 676-fno-gnu-unique @gol 677-finhibit-size-directive -fcommon -fno-ident @gol 678-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol 679-fno-jump-tables -fno-bit-tests @gol 680-frecord-gcc-switches @gol 681-freg-struct-return -fshort-enums -fshort-wchar @gol 682-fverbose-asm -fpack-struct[=@var{n}] @gol 683-fleading-underscore -ftls-model=@var{model} @gol 684-fstack-reuse=@var{reuse_level} @gol 685-ftrampolines -ftrapv -fwrapv @gol 686-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 687-fstrict-volatile-bitfields -fsync-libcalls} 688 689@item Developer Options 690@xref{Developer Options,,GCC Developer Options}. 691@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 692-dumpfullversion -fcallgraph-info@r{[}=su,da@r{]} 693-fchecking -fchecking=@var{n} 694-fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol 695-fdisable-ipa-@var{pass_name} @gol 696-fdisable-rtl-@var{pass_name} @gol 697-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 698-fdisable-tree-@var{pass_name} @gol 699-fdisable-tree-@var{pass-name}=@var{range-list} @gol 700-fdump-debug -fdump-earlydebug @gol 701-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 702-fdump-final-insns@r{[}=@var{file}@r{]} @gol 703-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 704-fdump-lang-all @gol 705-fdump-lang-@var{switch} @gol 706-fdump-lang-@var{switch}-@var{options} @gol 707-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol 708-fdump-passes @gol 709-fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol 710-fdump-statistics @gol 711-fdump-tree-all @gol 712-fdump-tree-@var{switch} @gol 713-fdump-tree-@var{switch}-@var{options} @gol 714-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol 715-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 716-fenable-@var{kind}-@var{pass} @gol 717-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 718-fira-verbose=@var{n} @gol 719-flto-report -flto-report-wpa -fmem-report-wpa @gol 720-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol 721-fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 722-fprofile-report @gol 723-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 724-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 725-fstats -fstack-usage -ftime-report -ftime-report-details @gol 726-fvar-tracking-assignments-toggle -gtoggle @gol 727-print-file-name=@var{library} -print-libgcc-file-name @gol 728-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 729-print-prog-name=@var{program} -print-search-dirs -Q @gol 730-print-sysroot -print-sysroot-headers-suffix @gol 731-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 732 733@item Machine-Dependent Options 734@xref{Submodel Options,,Machine-Dependent Options}. 735@c This list is ordered alphanumerically by subsection name. 736@c Try and put the significant identifier (CPU or system) first, 737@c so users have a clue at guessing where the ones they want will be. 738 739@emph{AArch64 Options} 740@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 741-mgeneral-regs-only @gol 742-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 743-mstrict-align -mno-strict-align @gol 744-momit-leaf-frame-pointer @gol 745-mtls-dialect=desc -mtls-dialect=traditional @gol 746-mtls-size=@var{size} @gol 747-mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol 748-mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol 749-mpc-relative-literal-loads @gol 750-msign-return-address=@var{scope} @gol 751-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf} 752+@var{b-key}]|@var{bti} @gol 753-mharden-sls=@var{opts} @gol 754-march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol 755-moverride=@var{string} -mverbose-cost-dump @gol 756-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol 757-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol 758-moutline-atomics } 759 760@emph{Adapteva Epiphany Options} 761@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 762-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 763-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 764-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 765-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 766-msplit-vecmove-early -m1reg-@var{reg}} 767 768@emph{AMD GCN Options} 769@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}} 770 771@emph{ARC Options} 772@gccoptlist{-mbarrel-shifter -mjli-always @gol 773-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol 774-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol 775-mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol 776-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol 777-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol 778-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol 779-mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol 780-mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol 781-mvolatile-cache -mtp-regno=@var{regno} @gol 782-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol 783-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol 784-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol 785-mlra-priority-compact -mlra-priority-noncompact -mmillicode @gol 786-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol 787-mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol 788-munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol 789-mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index} 790 791@emph{ARM Options} 792@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 793-mabi=@var{name} @gol 794-mapcs-stack-check -mno-apcs-stack-check @gol 795-mapcs-reentrant -mno-apcs-reentrant @gol 796-mgeneral-regs-only @gol 797-msched-prolog -mno-sched-prolog @gol 798-mlittle-endian -mbig-endian @gol 799-mbe8 -mbe32 @gol 800-mfloat-abi=@var{name} @gol 801-mfp16-format=@var{name} 802-mthumb-interwork -mno-thumb-interwork @gol 803-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 804-mtune=@var{name} -mprint-tune-info @gol 805-mstructure-size-boundary=@var{n} @gol 806-mabort-on-noreturn @gol 807-mlong-calls -mno-long-calls @gol 808-msingle-pic-base -mno-single-pic-base @gol 809-mpic-register=@var{reg} @gol 810-mnop-fun-dllimport @gol 811-mpoke-function-name @gol 812-mthumb -marm -mflip-thumb @gol 813-mtpcs-frame -mtpcs-leaf-frame @gol 814-mcaller-super-interworking -mcallee-super-interworking @gol 815-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 816-mword-relocations @gol 817-mfix-cortex-m3-ldrd @gol 818-mfix-cortex-a57-aes-1742098 @gol 819-mfix-cortex-a72-aes-1655431 @gol 820-munaligned-access @gol 821-mneon-for-64bits @gol 822-mslow-flash-data @gol 823-masm-syntax-unified @gol 824-mrestrict-it @gol 825-mverbose-cost-dump @gol 826-mpure-code @gol 827-mcmse @gol 828-mfix-cmse-cve-2021-35465 @gol 829-mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset} @gol 830-mfdpic} 831 832@emph{AVR Options} 833@gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol 834-mbranch-cost=@var{cost} @gol 835-mcall-prologues -mgas-isr-prologues -mint8 @gol 836-mdouble=@var{bits} -mlong-double=@var{bits} @gol 837-mn_flash=@var{size} -mno-interrupts @gol 838-mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol 839-mfract-convert-truncate @gol 840-mshort-calls -nodevicelib -nodevicespecs @gol 841-Waddr-space-convert -Wmisspelled-isr} 842 843@emph{Blackfin Options} 844@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 845-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 846-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 847-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 848-mno-id-shared-library -mshared-library-id=@var{n} @gol 849-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 850-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 851-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 852-micplb} 853 854@emph{C6X Options} 855@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 856-msim -msdata=@var{sdata-type}} 857 858@emph{CRIS Options} 859@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} 860-mtune=@var{cpu} -mmax-stack-frame=@var{n} @gol 861-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 862-mstack-align -mdata-align -mconst-align @gol 863-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue @gol 864-melf -maout -sim -sim2 @gol 865-mmul-bug-workaround -mno-mul-bug-workaround} 866 867@emph{CR16 Options} 868@gccoptlist{-mmac @gol 869-mcr16cplus -mcr16c @gol 870-msim -mint32 -mbit-ops 871-mdata-model=@var{model}} 872 873@emph{C-SKY Options} 874@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol 875-mbig-endian -EB -mlittle-endian -EL @gol 876-mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol 877-mfloat-abi=@var{name} @gol 878-melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol 879-mdsp -medsp -mvdsp @gol 880-mdiv -msmart -mhigh-registers -manchor @gol 881-mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol 882-mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim} 883 884@emph{Darwin Options} 885@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 886-arch_only -bind_at_load -bundle -bundle_loader @gol 887-client_name -compatibility_version -current_version @gol 888-dead_strip @gol 889-dependency-file -dylib_file -dylinker_install_name @gol 890-dynamic -dynamiclib -exported_symbols_list @gol 891-filelist -flat_namespace -force_cpusubtype_ALL @gol 892-force_flat_namespace -headerpad_max_install_names @gol 893-iframework @gol 894-image_base -init -install_name -keep_private_externs @gol 895-multi_module -multiply_defined -multiply_defined_unused @gol 896-noall_load -no_dead_strip_inits_and_terms @gol 897-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 898-pagezero_size -prebind -prebind_all_twolevel_modules @gol 899-private_bundle -read_only_relocs -sectalign @gol 900-sectobjectsymbols -whyload -seg1addr @gol 901-sectcreate -sectobjectsymbols -sectorder @gol 902-segaddr -segs_read_only_addr -segs_read_write_addr @gol 903-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 904-segprot -segs_read_only_addr -segs_read_write_addr @gol 905-single_module -static -sub_library -sub_umbrella @gol 906-twolevel_namespace -umbrella -undefined @gol 907-unexported_symbols_list -weak_reference_mismatches @gol 908-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 909-mkernel -mone-byte-bool} 910 911@emph{DEC Alpha Options} 912@gccoptlist{-mno-fp-regs -msoft-float @gol 913-mieee -mieee-with-inexact -mieee-conformant @gol 914-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 915-mtrap-precision=@var{mode} -mbuild-constants @gol 916-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 917-mbwx -mmax -mfix -mcix @gol 918-mfloat-vax -mfloat-ieee @gol 919-mexplicit-relocs -msmall-data -mlarge-data @gol 920-msmall-text -mlarge-text @gol 921-mmemory-latency=@var{time}} 922 923@emph{eBPF Options} 924@gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version} 925-mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re 926-mjmpext -mjmp32 -malu32 -mcpu=@var{version}} 927 928@emph{FR30 Options} 929@gccoptlist{-msmall-model -mno-lsim} 930 931@emph{FT32 Options} 932@gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm} 933 934@emph{FRV Options} 935@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 936-mhard-float -msoft-float @gol 937-malloc-cc -mfixed-cc -mdword -mno-dword @gol 938-mdouble -mno-double @gol 939-mmedia -mno-media -mmuladd -mno-muladd @gol 940-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 941-mlinked-fp -mlong-calls -malign-labels @gol 942-mlibrary-pic -macc-4 -macc-8 @gol 943-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 944-moptimize-membar -mno-optimize-membar @gol 945-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 946-mvliw-branch -mno-vliw-branch @gol 947-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 948-mno-nested-cond-exec -mtomcat-stats @gol 949-mTLS -mtls @gol 950-mcpu=@var{cpu}} 951 952@emph{GNU/Linux Options} 953@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol 954-tno-android-cc -tno-android-ld} 955 956@emph{H8/300 Options} 957@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 958 959@emph{HPPA Options} 960@gccoptlist{-march=@var{architecture-type} @gol 961-mcaller-copies -mdisable-fpregs -mdisable-indexing @gol 962-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 963-mfixed-range=@var{register-range} @gol 964-mjump-in-delay -mlinker-opt -mlong-calls @gol 965-mlong-load-store -mno-disable-fpregs @gol 966-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 967-mno-jump-in-delay -mno-long-load-store @gol 968-mno-portable-runtime -mno-soft-float @gol 969-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 970-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 971-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 972-munix=@var{unix-std} -nolibdld -static -threads} 973 974@emph{IA-64 Options} 975@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 976-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 977-mconstant-gp -mauto-pic -mfused-madd @gol 978-minline-float-divide-min-latency @gol 979-minline-float-divide-max-throughput @gol 980-mno-inline-float-divide @gol 981-minline-int-divide-min-latency @gol 982-minline-int-divide-max-throughput @gol 983-mno-inline-int-divide @gol 984-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 985-mno-inline-sqrt @gol 986-mdwarf2-asm -mearly-stop-bits @gol 987-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 988-mtune=@var{cpu-type} -milp32 -mlp64 @gol 989-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 990-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 991-msched-spec-ldc -msched-spec-control-ldc @gol 992-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 993-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 994-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 995-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 996 997@emph{LM32 Options} 998@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 999-msign-extend-enabled -muser-enabled} 1000 1001@emph{LoongArch Options} 1002@gccoptlist{-march=@var{cpu-type} -mtune=@var{cpu-type} -mabi=@var{base-abi-type} @gol 1003-mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float @gol 1004-mbranch-cost=@var{n} -mcheck-zero-division -mno-check-zero-division @gol 1005-mcond-move-int -mno-cond-move-int @gol 1006-mcond-move-float -mno-cond-move-float @gol 1007-memcpy -mno-memcpy -mstrict-align -mno-strict-align @gol 1008-mmax-inline-memcpy-size=@var{n} @gol 1009-mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as} 1010 1011@emph{M32R/D Options} 1012@gccoptlist{-m32r2 -m32rx -m32r @gol 1013-mdebug @gol 1014-malign-loops -mno-align-loops @gol 1015-missue-rate=@var{number} @gol 1016-mbranch-cost=@var{number} @gol 1017-mmodel=@var{code-size-model-type} @gol 1018-msdata=@var{sdata-type} @gol 1019-mno-flush-func -mflush-func=@var{name} @gol 1020-mno-flush-trap -mflush-trap=@var{number} @gol 1021-G @var{num}} 1022 1023@emph{M32C Options} 1024@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 1025 1026@emph{M680x0 Options} 1027@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol 1028-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 1029-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 1030-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 1031-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 1032-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 1033-malign-int -mstrict-align -msep-data -mno-sep-data @gol 1034-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 1035-mxgot -mno-xgot -mlong-jump-table-offsets} 1036 1037@emph{MCore Options} 1038@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 1039-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 1040-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 1041-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 1042-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 1043 1044@emph{MeP Options} 1045@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 1046-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 1047-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 1048-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 1049-mtiny=@var{n}} 1050 1051@emph{MicroBlaze Options} 1052@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 1053-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 1054-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 1055-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 1056-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol 1057-mpic-data-is-text-relative} 1058 1059@emph{MIPS Options} 1060@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 1061-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol 1062-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol 1063-mips16 -mno-mips16 -mflip-mips16 @gol 1064-minterlink-compressed -mno-interlink-compressed @gol 1065-minterlink-mips16 -mno-interlink-mips16 @gol 1066-mabi=@var{abi} -mabicalls -mno-abicalls @gol 1067-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 1068-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol 1069-mno-float -msingle-float -mdouble-float @gol 1070-modd-spreg -mno-odd-spreg @gol 1071-mabs=@var{mode} -mnan=@var{encoding} @gol 1072-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 1073-mmcu -mmno-mcu @gol 1074-meva -mno-eva @gol 1075-mvirt -mno-virt @gol 1076-mxpa -mno-xpa @gol 1077-mcrc -mno-crc @gol 1078-mginv -mno-ginv @gol 1079-mmicromips -mno-micromips @gol 1080-mmsa -mno-msa @gol 1081-mloongson-mmi -mno-loongson-mmi @gol 1082-mloongson-ext -mno-loongson-ext @gol 1083-mloongson-ext2 -mno-loongson-ext2 @gol 1084-mfpu=@var{fpu-type} @gol 1085-msmartmips -mno-smartmips @gol 1086-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 1087-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 1088-mlong64 -mlong32 -msym32 -mno-sym32 @gol 1089-G@var{num} -mlocal-sdata -mno-local-sdata @gol 1090-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 1091-membedded-data -mno-embedded-data @gol 1092-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 1093-mcode-readable=@var{setting} @gol 1094-msplit-addresses -mno-split-addresses @gol 1095-mexplicit-relocs -mno-explicit-relocs @gol 1096-mcheck-zero-division -mno-check-zero-division @gol 1097-mdivide-traps -mdivide-breaks @gol 1098-mload-store-pairs -mno-load-store-pairs @gol 1099-munaligned-access -mno-unaligned-access @gol 1100-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 1101-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol 1102-mfix-24k -mno-fix-24k @gol 1103-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 1104-mfix-r5900 -mno-fix-r5900 @gol 1105-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol 1106-mfix-vr4120 -mno-fix-vr4120 @gol 1107-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 1108-mflush-func=@var{func} -mno-flush-func @gol 1109-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 1110-mcompact-branches=@var{policy} @gol 1111-mfp-exceptions -mno-fp-exceptions @gol 1112-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 1113-mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol 1114-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol 1115-mframe-header-opt -mno-frame-header-opt} 1116 1117@emph{MMIX Options} 1118@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 1119-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 1120-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 1121-mno-base-addresses -msingle-exit -mno-single-exit} 1122 1123@emph{MN10300 Options} 1124@gccoptlist{-mmult-bug -mno-mult-bug @gol 1125-mno-am33 -mam33 -mam33-2 -mam34 @gol 1126-mtune=@var{cpu-type} @gol 1127-mreturn-pointer-on-d0 @gol 1128-mno-crt0 -mrelax -mliw -msetlb} 1129 1130@emph{Moxie Options} 1131@gccoptlist{-meb -mel -mmul.x -mno-crt0} 1132 1133@emph{MSP430 Options} 1134@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol 1135-mwarn-mcu @gol 1136-mcode-region= -mdata-region= @gol 1137-msilicon-errata= -msilicon-errata-warn= @gol 1138-mhwmult= -minrt -mtiny-printf -mmax-inline-shift=} 1139 1140@emph{NDS32 Options} 1141@gccoptlist{-mbig-endian -mlittle-endian @gol 1142-mreduced-regs -mfull-regs @gol 1143-mcmov -mno-cmov @gol 1144-mext-perf -mno-ext-perf @gol 1145-mext-perf2 -mno-ext-perf2 @gol 1146-mext-string -mno-ext-string @gol 1147-mv3push -mno-v3push @gol 1148-m16bit -mno-16bit @gol 1149-misr-vector-size=@var{num} @gol 1150-mcache-block-size=@var{num} @gol 1151-march=@var{arch} @gol 1152-mcmodel=@var{code-model} @gol 1153-mctor-dtor -mrelax} 1154 1155@emph{Nios II Options} 1156@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol 1157-mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol 1158-mel -meb @gol 1159-mno-bypass-cache -mbypass-cache @gol 1160-mno-cache-volatile -mcache-volatile @gol 1161-mno-fast-sw-div -mfast-sw-div @gol 1162-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol 1163-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol 1164-mcustom-fpu-cfg=@var{name} @gol 1165-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol 1166-march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx} 1167 1168@emph{Nvidia PTX Options} 1169@gccoptlist{-m64 -mmainkernel -moptimize} 1170 1171@emph{OpenRISC Options} 1172@gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol 1173-msoft-mul -msoft-div @gol 1174-msoft-float -mhard-float -mdouble-float -munordered-float @gol 1175-mcmov -mror -mrori -msext -msfimm -mshftimm @gol 1176-mcmodel=@var{code-model}} 1177 1178@emph{PDP-11 Options} 1179@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 1180-mint32 -mno-int16 -mint16 -mno-int32 @gol 1181-msplit -munix-asm -mdec-asm -mgnu-asm -mlra} 1182 1183@emph{picoChip Options} 1184@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 1185-msymbol-as-address -mno-inefficient-warnings} 1186 1187@emph{PowerPC Options} 1188See RS/6000 and PowerPC Options. 1189 1190@emph{PRU Options} 1191@gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol 1192-mabi=@var{variant} @gol} 1193 1194@emph{RISC-V Options} 1195@gccoptlist{-mbranch-cost=@var{N-instruction} @gol 1196-mplt -mno-plt @gol 1197-mabi=@var{ABI-string} @gol 1198-mfdiv -mno-fdiv @gol 1199-mdiv -mno-div @gol 1200-misa-spec=@var{ISA-spec-string} @gol 1201-march=@var{ISA-string} @gol 1202-mtune=@var{processor-string} @gol 1203-mpreferred-stack-boundary=@var{num} @gol 1204-msmall-data-limit=@var{N-bytes} @gol 1205-msave-restore -mno-save-restore @gol 1206-mshorten-memrefs -mno-shorten-memrefs @gol 1207-mstrict-align -mno-strict-align @gol 1208-mcmodel=medlow -mcmodel=medany @gol 1209-mexplicit-relocs -mno-explicit-relocs @gol 1210-mrelax -mno-relax @gol 1211-mriscv-attribute -mmo-riscv-attribute @gol 1212-malign-data=@var{type} @gol 1213-mbig-endian -mlittle-endian @gol 1214-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1215-mstack-protector-guard-offset=@var{offset}} 1216 1217@emph{RL78 Options} 1218@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol 1219-mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol 1220-m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts} 1221 1222@emph{RS/6000 and PowerPC Options} 1223@gccoptlist{-mcpu=@var{cpu-type} @gol 1224-mtune=@var{cpu-type} @gol 1225-mcmodel=@var{code-model} @gol 1226-mpowerpc64 @gol 1227-maltivec -mno-altivec @gol 1228-mpowerpc-gpopt -mno-powerpc-gpopt @gol 1229-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 1230-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 1231-mfprnd -mno-fprnd @gol 1232-mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol 1233-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 1234-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 1235-malign-power -malign-natural @gol 1236-msoft-float -mhard-float -mmultiple -mno-multiple @gol 1237-mupdate -mno-update @gol 1238-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 1239-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 1240-mstrict-align -mno-strict-align -mrelocatable @gol 1241-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 1242-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 1243-mdynamic-no-pic -mswdiv -msingle-pic-base @gol 1244-mprioritize-restricted-insns=@var{priority} @gol 1245-msched-costly-dep=@var{dependence_type} @gol 1246-minsert-sched-nops=@var{scheme} @gol 1247-mcall-aixdesc -mcall-eabi -mcall-freebsd @gol 1248-mcall-linux -mcall-netbsd -mcall-openbsd @gol 1249-mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol 1250-mtraceback=@var{traceback_type} @gol 1251-maix-struct-return -msvr4-struct-return @gol 1252-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 1253-mlongcall -mno-longcall -mpltseq -mno-pltseq @gol 1254-mblock-move-inline-limit=@var{num} @gol 1255-mblock-compare-inline-limit=@var{num} @gol 1256-mblock-compare-inline-loop-limit=@var{num} @gol 1257-mno-block-ops-unaligned-vsx @gol 1258-mstring-compare-inline-limit=@var{num} @gol 1259-misel -mno-isel @gol 1260-mvrsave -mno-vrsave @gol 1261-mmulhw -mno-mulhw @gol 1262-mdlmzb -mno-dlmzb @gol 1263-mprototype -mno-prototype @gol 1264-msim -mmvme -mads -myellowknife -memb -msdata @gol 1265-msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol 1266-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 1267-mno-recip-precision @gol 1268-mveclibabi=@var{type} -mfriz -mno-friz @gol 1269-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 1270-msave-toc-indirect -mno-save-toc-indirect @gol 1271-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 1272-mcrypto -mno-crypto -mhtm -mno-htm @gol 1273-mquad-memory -mno-quad-memory @gol 1274-mquad-memory-atomic -mno-quad-memory-atomic @gol 1275-mcompat-align-parm -mno-compat-align-parm @gol 1276-mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol 1277-mgnu-attribute -mno-gnu-attribute @gol 1278-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1279-mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol 1280-mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol 1281-mprivileged -mno-privileged} 1282 1283@emph{RX Options} 1284@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 1285-mcpu=@gol 1286-mbig-endian-data -mlittle-endian-data @gol 1287-msmall-data @gol 1288-msim -mno-sim@gol 1289-mas100-syntax -mno-as100-syntax@gol 1290-mrelax@gol 1291-mmax-constant-size=@gol 1292-mint-register=@gol 1293-mpid@gol 1294-mallow-string-insns -mno-allow-string-insns@gol 1295-mjsr@gol 1296-mno-warn-multiple-fast-interrupts@gol 1297-msave-acc-in-interrupts} 1298 1299@emph{S/390 and zSeries Options} 1300@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1301-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 1302-mlong-double-64 -mlong-double-128 @gol 1303-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 1304-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 1305-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 1306-mhtm -mvx -mzvector @gol 1307-mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol 1308-mfused-madd -mno-fused-madd @gol 1309-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 1310-mhotpatch=@var{halfwords},@var{halfwords}} 1311 1312@emph{Score Options} 1313@gccoptlist{-meb -mel @gol 1314-mnhwloop @gol 1315-muls @gol 1316-mmac @gol 1317-mscore5 -mscore5u -mscore7 -mscore7d} 1318 1319@emph{SH Options} 1320@gccoptlist{-m1 -m2 -m2e @gol 1321-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 1322-m3 -m3e @gol 1323-m4-nofpu -m4-single-only -m4-single -m4 @gol 1324-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 1325-mb -ml -mdalign -mrelax @gol 1326-mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol 1327-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 1328-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 1329-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 1330-maccumulate-outgoing-args @gol 1331-matomic-model=@var{atomic-model} @gol 1332-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol 1333-mcbranch-force-delay-slot @gol 1334-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 1335-mpretend-cmove -mtas} 1336 1337@emph{Solaris 2 Options} 1338@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol 1339-pthreads} 1340 1341@emph{SPARC Options} 1342@gccoptlist{-mcpu=@var{cpu-type} @gol 1343-mtune=@var{cpu-type} @gol 1344-mcmodel=@var{code-model} @gol 1345-mmemory-model=@var{mem-model} @gol 1346-m32 -m64 -mapp-regs -mno-app-regs @gol 1347-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 1348-mfpu -mno-fpu -mhard-float -msoft-float @gol 1349-mhard-quad-float -msoft-quad-float @gol 1350-mstack-bias -mno-stack-bias @gol 1351-mstd-struct-return -mno-std-struct-return @gol 1352-munaligned-doubles -mno-unaligned-doubles @gol 1353-muser-mode -mno-user-mode @gol 1354-mv8plus -mno-v8plus -mvis -mno-vis @gol 1355-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 1356-mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol 1357-mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol 1358-mpopc -mno-popc -msubxc -mno-subxc @gol 1359-mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol 1360-mlra -mno-lra} 1361 1362@emph{System V Options} 1363@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 1364 1365@emph{TILE-Gx Options} 1366@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol 1367-mcmodel=@var{code-model}} 1368 1369@emph{TILEPro Options} 1370@gccoptlist{-mcpu=@var{cpu} -m32} 1371 1372@emph{V850 Options} 1373@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 1374-mprolog-function -mno-prolog-function -mspace @gol 1375-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 1376-mapp-regs -mno-app-regs @gol 1377-mdisable-callt -mno-disable-callt @gol 1378-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 1379-mv850e -mv850 -mv850e3v5 @gol 1380-mloop @gol 1381-mrelax @gol 1382-mlong-jumps @gol 1383-msoft-float @gol 1384-mhard-float @gol 1385-mgcc-abi @gol 1386-mrh850-abi @gol 1387-mbig-switch} 1388 1389@emph{VAX Options} 1390@gccoptlist{-mg -mgnu -munix -mlra} 1391 1392@emph{Visium Options} 1393@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol 1394-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} 1395 1396@emph{VMS Options} 1397@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 1398-mpointer-size=@var{size}} 1399 1400@emph{VxWorks Options} 1401@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 1402-Xbind-lazy -Xbind-now} 1403 1404@emph{x86 Options} 1405@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1406-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol 1407-mfpmath=@var{unit} @gol 1408-masm=@var{dialect} -mno-fancy-math-387 @gol 1409-mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol 1410-mno-wide-multiply -mrtd -malign-double @gol 1411-mpreferred-stack-boundary=@var{num} @gol 1412-mincoming-stack-boundary=@var{num} @gol 1413-mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait @gol 1414-mrecip -mrecip=@var{opt} @gol 1415-mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol 1416-mmove-max=@var{bits} -mstore-max=@var{bits} @gol 1417-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 1418-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol 1419-mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol 1420-mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol 1421-mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol 1422-msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol 1423-madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol 1424-mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol 1425-mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol 1426-mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol 1427-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol 1428-mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol 1429-mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol 1430-mavx512fp16 @gol 1431-mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol 1432-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 1433-mkl -mwidekl @gol 1434-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol 1435-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 1436-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol 1437-mregparm=@var{num} -msseregparm @gol 1438-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 1439-mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign @gol 1440-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 1441-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 1442-m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol 1443-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol 1444-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol 1445-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol 1446-malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol 1447-mstack-protector-guard-reg=@var{reg} @gol 1448-mstack-protector-guard-offset=@var{offset} @gol 1449-mstack-protector-guard-symbol=@var{symbol} @gol 1450-mgeneral-regs-only -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop @gol 1451-mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol 1452-mindirect-branch-register -mharden-sls=@var{choice} @gol 1453-mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access} 1454 1455@emph{x86 Windows Options} 1456@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 1457-mnop-fun-dllimport -mthread @gol 1458-municode -mwin32 -mwindows -fno-set-stack-executable} 1459 1460@emph{Xstormy16 Options} 1461@gccoptlist{-msim} 1462 1463@emph{Xtensa Options} 1464@gccoptlist{-mconst16 -mno-const16 @gol 1465-mfused-madd -mno-fused-madd @gol 1466-mforce-no-pic @gol 1467-mserialize-volatile -mno-serialize-volatile @gol 1468-mtext-section-literals -mno-text-section-literals @gol 1469-mauto-litpools -mno-auto-litpools @gol 1470-mtarget-align -mno-target-align @gol 1471-mlongcalls -mno-longcalls @gol 1472-mabi=@var{abi-type}} 1473 1474@emph{zSeries Options} 1475See S/390 and zSeries Options. 1476@end table 1477 1478 1479@node Overall Options 1480@section Options Controlling the Kind of Output 1481 1482Compilation can involve up to four stages: preprocessing, compilation 1483proper, assembly and linking, always in that order. GCC is capable of 1484preprocessing and compiling several files either into several 1485assembler input files, or into one assembler input file; then each 1486assembler input file produces an object file, and linking combines all 1487the object files (those newly compiled, and those specified as input) 1488into an executable file. 1489 1490@cindex file name suffix 1491For any given input file, the file name suffix determines what kind of 1492compilation is done: 1493 1494@table @gcctabopt 1495@item @var{file}.c 1496C source code that must be preprocessed. 1497 1498@item @var{file}.i 1499C source code that should not be preprocessed. 1500 1501@item @var{file}.ii 1502C++ source code that should not be preprocessed. 1503 1504@item @var{file}.m 1505Objective-C source code. Note that you must link with the @file{libobjc} 1506library to make an Objective-C program work. 1507 1508@item @var{file}.mi 1509Objective-C source code that should not be preprocessed. 1510 1511@item @var{file}.mm 1512@itemx @var{file}.M 1513Objective-C++ source code. Note that you must link with the @file{libobjc} 1514library to make an Objective-C++ program work. Note that @samp{.M} refers 1515to a literal capital M@. 1516 1517@item @var{file}.mii 1518Objective-C++ source code that should not be preprocessed. 1519 1520@item @var{file}.h 1521C, C++, Objective-C or Objective-C++ header file to be turned into a 1522precompiled header (default), or C, C++ header file to be turned into an 1523Ada spec (via the @option{-fdump-ada-spec} switch). 1524 1525@item @var{file}.cc 1526@itemx @var{file}.cp 1527@itemx @var{file}.cxx 1528@itemx @var{file}.cpp 1529@itemx @var{file}.CPP 1530@itemx @var{file}.c++ 1531@itemx @var{file}.C 1532C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1533the last two letters must both be literally @samp{x}. Likewise, 1534@samp{.C} refers to a literal capital C@. 1535 1536@item @var{file}.mm 1537@itemx @var{file}.M 1538Objective-C++ source code that must be preprocessed. 1539 1540@item @var{file}.mii 1541Objective-C++ source code that should not be preprocessed. 1542 1543@item @var{file}.hh 1544@itemx @var{file}.H 1545@itemx @var{file}.hp 1546@itemx @var{file}.hxx 1547@itemx @var{file}.hpp 1548@itemx @var{file}.HPP 1549@itemx @var{file}.h++ 1550@itemx @var{file}.tcc 1551C++ header file to be turned into a precompiled header or Ada spec. 1552 1553@item @var{file}.f 1554@itemx @var{file}.for 1555@itemx @var{file}.ftn 1556Fixed form Fortran source code that should not be preprocessed. 1557 1558@item @var{file}.F 1559@itemx @var{file}.FOR 1560@itemx @var{file}.fpp 1561@itemx @var{file}.FPP 1562@itemx @var{file}.FTN 1563Fixed form Fortran source code that must be preprocessed (with the traditional 1564preprocessor). 1565 1566@item @var{file}.f90 1567@itemx @var{file}.f95 1568@itemx @var{file}.f03 1569@itemx @var{file}.f08 1570Free form Fortran source code that should not be preprocessed. 1571 1572@item @var{file}.F90 1573@itemx @var{file}.F95 1574@itemx @var{file}.F03 1575@itemx @var{file}.F08 1576Free form Fortran source code that must be preprocessed (with the 1577traditional preprocessor). 1578 1579@item @var{file}.go 1580Go source code. 1581 1582@item @var{file}.d 1583D source code. 1584 1585@item @var{file}.di 1586D interface file. 1587 1588@item @var{file}.dd 1589D documentation code (Ddoc). 1590 1591@item @var{file}.ads 1592Ada source code file that contains a library unit declaration (a 1593declaration of a package, subprogram, or generic, or a generic 1594instantiation), or a library unit renaming declaration (a package, 1595generic, or subprogram renaming declaration). Such files are also 1596called @dfn{specs}. 1597 1598@item @var{file}.adb 1599Ada source code file containing a library unit body (a subprogram or 1600package body). Such files are also called @dfn{bodies}. 1601 1602@c GCC also knows about some suffixes for languages not yet included: 1603@c Ratfor: 1604@c @var{file}.r 1605 1606@item @var{file}.s 1607Assembler code. 1608 1609@item @var{file}.S 1610@itemx @var{file}.sx 1611Assembler code that must be preprocessed. 1612 1613@item @var{other} 1614An object file to be fed straight into linking. 1615Any file name with no recognized suffix is treated this way. 1616@end table 1617 1618@opindex x 1619You can specify the input language explicitly with the @option{-x} option: 1620 1621@table @gcctabopt 1622@item -x @var{language} 1623Specify explicitly the @var{language} for the following input files 1624(rather than letting the compiler choose a default based on the file 1625name suffix). This option applies to all following input files until 1626the next @option{-x} option. Possible values for @var{language} are: 1627@smallexample 1628c c-header cpp-output 1629c++ c++-header c++-system-header c++-user-header c++-cpp-output 1630objective-c objective-c-header objective-c-cpp-output 1631objective-c++ objective-c++-header objective-c++-cpp-output 1632assembler assembler-with-cpp 1633ada 1634d 1635f77 f77-cpp-input f95 f95-cpp-input 1636go 1637@end smallexample 1638 1639@item -x none 1640Turn off any specification of a language, so that subsequent files are 1641handled according to their file name suffixes (as they are if @option{-x} 1642has not been used at all). 1643@end table 1644 1645If you only want some of the stages of compilation, you can use 1646@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1647one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1648@command{gcc} is to stop. Note that some combinations (for example, 1649@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1650 1651@table @gcctabopt 1652@item -c 1653@opindex c 1654Compile or assemble the source files, but do not link. The linking 1655stage simply is not done. The ultimate output is in the form of an 1656object file for each source file. 1657 1658By default, the object file name for a source file is made by replacing 1659the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1660 1661Unrecognized input files, not requiring compilation or assembly, are 1662ignored. 1663 1664@item -S 1665@opindex S 1666Stop after the stage of compilation proper; do not assemble. The output 1667is in the form of an assembler code file for each non-assembler input 1668file specified. 1669 1670By default, the assembler file name for a source file is made by 1671replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1672 1673Input files that don't require compilation are ignored. 1674 1675@item -E 1676@opindex E 1677Stop after the preprocessing stage; do not run the compiler proper. The 1678output is in the form of preprocessed source code, which is sent to the 1679standard output. 1680 1681Input files that don't require preprocessing are ignored. 1682 1683@cindex output file option 1684@item -o @var{file} 1685@opindex o 1686Place the primary output in file @var{file}. This applies to whatever 1687sort of output is being produced, whether it be an executable file, an 1688object file, an assembler file or preprocessed C code. 1689 1690If @option{-o} is not specified, the default is to put an executable 1691file in @file{a.out}, the object file for 1692@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1693assembler file in @file{@var{source}.s}, a precompiled header file in 1694@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1695standard output. 1696 1697Though @option{-o} names only the primary output, it also affects the 1698naming of auxiliary and dump outputs. See the examples below. Unless 1699overridden, both auxiliary outputs and dump outputs are placed in the 1700same directory as the primary output. In auxiliary outputs, the suffix 1701of the input file is replaced with that of the auxiliary output file 1702type; in dump outputs, the suffix of the dump file is appended to the 1703input file suffix. In compilation commands, the base name of both 1704auxiliary and dump outputs is that of the primary output; in compile and 1705link commands, the primary output name, minus the executable suffix, is 1706combined with the input file name. If both share the same base name, 1707disregarding the suffix, the result of the combination is that base 1708name, otherwise, they are concatenated, separated by a dash. 1709 1710@smallexample 1711gcc -c foo.c ... 1712@end smallexample 1713 1714will use @file{foo.o} as the primary output, and place aux outputs and 1715dumps next to it, e.g., aux file @file{foo.dwo} for 1716@option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for 1717@option{-fdump-rtl-final}. 1718 1719If a non-linker output file is explicitly specified, aux and dump files 1720by default take the same base name: 1721 1722@smallexample 1723gcc -c foo.c -o dir/foobar.o ... 1724@end smallexample 1725 1726will name aux outputs @file{dir/foobar.*} and dump outputs 1727@file{dir/foobar.c.*}. 1728 1729A linker output will instead prefix aux and dump outputs: 1730 1731@smallexample 1732gcc foo.c bar.c -o dir/foobar ... 1733@end smallexample 1734 1735will generally name aux outputs @file{dir/foobar-foo.*} and 1736@file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and 1737@file{dir/foobar-bar.c.*}. 1738 1739The one exception to the above is when the executable shares the base 1740name with the single input: 1741 1742@smallexample 1743gcc foo.c -o dir/foo ... 1744@end smallexample 1745 1746in which case aux outputs are named @file{dir/foo.*} and dump outputs 1747named @file{dir/foo.c.*}. 1748 1749The location and the names of auxiliary and dump outputs can be adjusted 1750by the options @option{-dumpbase}, @option{-dumpbase-ext}, 1751@option{-dumpdir}, @option{-save-temps=cwd}, and 1752@option{-save-temps=obj}. 1753 1754 1755@item -dumpbase @var{dumpbase} 1756@opindex dumpbase 1757This option sets the base name for auxiliary and dump output files. It 1758does not affect the name of the primary output file. Intermediate 1759outputs, when preserved, are not regarded as primary outputs, but as 1760auxiliary outputs: 1761 1762@smallexample 1763gcc -save-temps -S foo.c 1764@end smallexample 1765 1766saves the (no longer) temporary preprocessed file in @file{foo.i}, and 1767then compiles to the (implied) output file @file{foo.s}, whereas: 1768 1769@smallexample 1770gcc -save-temps -dumpbase save-foo -c foo.c 1771@end smallexample 1772 1773preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now 1774an intermediate, thus auxiliary output), and then assembles to the 1775(implied) output file @file{foo.o}. 1776 1777Absent this option, dump and aux files take their names from the input 1778file, or from the (non-linker) output file, if one is explicitly 1779specified: dump output files (e.g. those requested by @option{-fdump-*} 1780options) with the input name suffix, and aux output files (those 1781requested by other non-dump options, e.g. @code{-save-temps}, 1782@code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it. 1783 1784Similar suffix differentiation of dump and aux outputs can be attained 1785for explicitly-given @option{-dumpbase basename.suf} by also specifying 1786@option{-dumpbase-ext .suf}. 1787 1788If @var{dumpbase} is explicitly specified with any directory component, 1789any @var{dumppfx} specification (e.g. @option{-dumpdir} or 1790@option{-save-temps=*}) is ignored, and instead of appending to it, 1791@var{dumpbase} fully overrides it: 1792 1793@smallexample 1794gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \ 1795 -dumpdir pfx- -save-temps=cwd ... 1796@end smallexample 1797 1798creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding 1799@file{dir/} in @option{-o}, the @file{./} prefix implied by 1800@option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}. 1801 1802When @option{-dumpbase} is specified in a command that compiles multiple 1803inputs, or that compiles and then links, it may be combined with 1804@var{dumppfx}, as specified under @option{-dumpdir}. Then, each input 1805file is compiled using the combined @var{dumppfx}, and default values 1806for @var{dumpbase} and @var{auxdropsuf} are computed for each input 1807file: 1808 1809@smallexample 1810gcc foo.c bar.c -c -dumpbase main ... 1811@end smallexample 1812 1813creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids 1814overwriting the auxiliary and dump outputs by using the @var{dumpbase} 1815as a prefix, creating auxiliary and dump outputs named @file{main-foo.*} 1816and @file{main-bar.*}. 1817 1818An empty string specified as @var{dumpbase} avoids the influence of the 1819output basename in the naming of auxiliary and dump outputs during 1820compilation, computing default values : 1821 1822@smallexample 1823gcc -c foo.c -o dir/foobar.o -dumpbase '' ... 1824@end smallexample 1825 1826will name aux outputs @file{dir/foo.*} and dump outputs 1827@file{dir/foo.c.*}. Note how their basenames are taken from the input 1828name, but the directory still defaults to that of the output. 1829 1830The empty-string dumpbase does not prevent the use of the output 1831basename for outputs during linking: 1832 1833@smallexample 1834gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ... 1835@end smallexample 1836 1837The compilation of the source files will name auxiliary outputs 1838@file{dir/foo.*} and @file{dir/bar.*}, and dump outputs 1839@file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during 1840linking will use @file{dir/foobar.} as the prefix for dumps and 1841auxiliary files. 1842 1843 1844@item -dumpbase-ext @var{auxdropsuf} 1845@opindex dumpbase-ext 1846When forming the name of an auxiliary (but not a dump) output file, drop 1847trailing @var{auxdropsuf} from @var{dumpbase} before appending any 1848suffixes. If not specified, this option defaults to the suffix of a 1849default @var{dumpbase}, i.e., the suffix of the input file when 1850@option{-dumpbase} is not present in the command line, or @var{dumpbase} 1851is combined with @var{dumppfx}. 1852 1853@smallexample 1854gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ... 1855@end smallexample 1856 1857creates @file{dir/foo.o} as the main output, and generates auxiliary 1858outputs in @file{dir/x-foo.*}, taking the location of the primary 1859output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump 1860outputs retain the suffix: @file{dir/x-foo.c.*}. 1861 1862This option is disregarded if it does not match the suffix of a 1863specified @var{dumpbase}, except as an alternative to the executable 1864suffix when appending the linker output base name to @var{dumppfx}, as 1865specified below: 1866 1867@smallexample 1868gcc foo.c bar.c -o main.out -dumpbase-ext .out ... 1869@end smallexample 1870 1871creates @file{main.out} as the primary output, and avoids overwriting 1872the auxiliary and dump outputs by using the executable name minus 1873@var{auxdropsuf} as a prefix, creating auxiliary outputs named 1874@file{main-foo.*} and @file{main-bar.*} and dump outputs named 1875@file{main-foo.c.*} and @file{main-bar.c.*}. 1876 1877 1878@item -dumpdir @var{dumppfx} 1879@opindex dumpdir 1880When forming the name of an auxiliary or dump output file, use 1881@var{dumppfx} as a prefix: 1882 1883@smallexample 1884gcc -dumpdir pfx- -c foo.c ... 1885@end smallexample 1886 1887creates @file{foo.o} as the primary output, and auxiliary outputs named 1888@file{pfx-foo.*}, combining the given @var{dumppfx} with the default 1889@var{dumpbase} derived from the default primary output, derived in turn 1890from the input name. Dump outputs also take the input name suffix: 1891@file{pfx-foo.c.*}. 1892 1893If @var{dumppfx} is to be used as a directory name, it must end with a 1894directory separator: 1895 1896@smallexample 1897gcc -dumpdir dir/ -c foo.c -o obj/bar.o ... 1898@end smallexample 1899 1900creates @file{obj/bar.o} as the primary output, and auxiliary outputs 1901named @file{dir/bar.*}, combining the given @var{dumppfx} with the 1902default @var{dumpbase} derived from the primary output name. Dump 1903outputs also take the input name suffix: @file{dir/bar.c.*}. 1904 1905It defaults to the location of the output file, unless the output 1906file is a special file like @code{/dev/null}. Options 1907@option{-save-temps=cwd} and @option{-save-temps=obj} override this 1908default, just like an explicit @option{-dumpdir} option. In case 1909multiple such options are given, the last one prevails: 1910 1911@smallexample 1912gcc -dumpdir pfx- -c foo.c -save-temps=obj ... 1913@end smallexample 1914 1915outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because 1916@option{-save-temps=*} overrides the @var{dumppfx} given by the earlier 1917@option{-dumpdir} option. It does not matter that @option{=obj} is the 1918default for @option{-save-temps}, nor that the output directory is 1919implicitly the current directory. Dump outputs are named 1920@file{foo.c.*}. 1921 1922When compiling from multiple input files, if @option{-dumpbase} is 1923specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash 1924are appended to (or override, if containing any directory components) an 1925explicit or defaulted @var{dumppfx}, so that each of the multiple 1926compilations gets differently-named aux and dump outputs. 1927 1928@smallexample 1929gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ... 1930@end smallexample 1931 1932outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and 1933@file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}. 1934Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*} 1935and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the 1936single-input compilation: 1937 1938@smallexample 1939gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ... 1940@end smallexample 1941 1942that, applying @option{-dumpbase} to a single source, does not compute 1943and append a separate @var{dumpbase} per input file. Its auxiliary and 1944dump outputs go in @file{dir/pfx-main.*}. 1945 1946When compiling and then linking from multiple input files, a defaulted 1947or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}- 1948transformation above (e.g. the compilation of @file{foo.c} and 1949@file{bar.c} above, but without @option{-c}). If neither 1950@option{-dumpdir} nor @option{-dumpbase} are given, the linker output 1951base name, minus @var{auxdropsuf}, if specified, or the executable 1952suffix otherwise, plus a dash is appended to the default @var{dumppfx} 1953instead. Note, however, that unlike earlier cases of linking: 1954 1955@smallexample 1956gcc foo.c bar.c -dumpdir dir/pfx- -o main ... 1957@end smallexample 1958 1959does not append the output name @file{main} to @var{dumppfx}, because 1960@option{-dumpdir} is explicitly specified. The goal is that the 1961explicitly-specified @var{dumppfx} may contain the specified output name 1962as part of the prefix, if desired; only an explicitly-specified 1963@option{-dumpbase} would be combined with it, in order to avoid simply 1964discarding a meaningful option. 1965 1966When compiling and then linking from a single input file, the linker 1967output base name will only be appended to the default @var{dumppfx} as 1968above if it does not share the base name with the single input file 1969name. This has been covered in single-input linking cases above, but 1970not with an explicit @option{-dumpdir} that inhibits the combination, 1971even if overridden by @option{-save-temps=*}: 1972 1973@smallexample 1974gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ... 1975@end smallexample 1976 1977Auxiliary outputs are named @file{foo.*}, and dump outputs 1978@file{foo.c.*}, in the current working directory as ultimately requested 1979by @option{-save-temps=cwd}. 1980 1981Summing it all up for an intuitive though slightly imprecise data flow: 1982the primary output name is broken into a directory part and a basename 1983part; @var{dumppfx} is set to the former, unless overridden by 1984@option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set 1985to the latter, unless overriden by @option{-dumpbase}. If there are 1986multiple inputs or linking, this @var{dumpbase} may be combined with 1987@var{dumppfx} and taken from each input file. Auxiliary output names 1988for each input are formed by combining @var{dumppfx}, @var{dumpbase} 1989minus suffix, and the auxiliary output suffix; dump output names are 1990only different in that the suffix from @var{dumpbase} is retained. 1991 1992When it comes to auxiliary and dump outputs created during LTO 1993recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as 1994given or as derived from the linker output name but not from inputs, 1995even in cases in which this combination would not otherwise be used as 1996such, is passed down with a trailing period replacing the compiler-added 1997dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper}; 1998being involved in linking, this program does not normally get any 1999@option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them. 2000 2001When running sub-compilers, @command{lto-wrapper} appends LTO stage 2002names to the received @var{dumppfx}, ensures it contains a directory 2003component so that it overrides any @option{-dumpdir}, and passes that as 2004@option{-dumpbase} to sub-compilers. 2005 2006@item -v 2007@opindex v 2008Print (on standard error output) the commands executed to run the stages 2009of compilation. Also print the version number of the compiler driver 2010program and of the preprocessor and the compiler proper. 2011 2012@item -### 2013@opindex ### 2014Like @option{-v} except the commands are not executed and arguments 2015are quoted unless they contain only alphanumeric characters or @code{./-_}. 2016This is useful for shell scripts to capture the driver-generated command lines. 2017 2018@item --help 2019@opindex help 2020Print (on the standard output) a description of the command-line options 2021understood by @command{gcc}. If the @option{-v} option is also specified 2022then @option{--help} is also passed on to the various processes 2023invoked by @command{gcc}, so that they can display the command-line options 2024they accept. If the @option{-Wextra} option has also been specified 2025(prior to the @option{--help} option), then command-line options that 2026have no documentation associated with them are also displayed. 2027 2028@item --target-help 2029@opindex target-help 2030Print (on the standard output) a description of target-specific command-line 2031options for each tool. For some targets extra target-specific 2032information may also be printed. 2033 2034@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 2035Print (on the standard output) a description of the command-line 2036options understood by the compiler that fit into all specified classes 2037and qualifiers. These are the supported classes: 2038 2039@table @asis 2040@item @samp{optimizers} 2041Display all of the optimization options supported by the 2042compiler. 2043 2044@item @samp{warnings} 2045Display all of the options controlling warning messages 2046produced by the compiler. 2047 2048@item @samp{target} 2049Display target-specific options. Unlike the 2050@option{--target-help} option however, target-specific options of the 2051linker and assembler are not displayed. This is because those 2052tools do not currently support the extended @option{--help=} syntax. 2053 2054@item @samp{params} 2055Display the values recognized by the @option{--param} 2056option. 2057 2058@item @var{language} 2059Display the options supported for @var{language}, where 2060@var{language} is the name of one of the languages supported in this 2061version of GCC@. If an option is supported by all languages, one needs 2062to select @samp{common} class. 2063 2064@item @samp{common} 2065Display the options that are common to all languages. 2066@end table 2067 2068These are the supported qualifiers: 2069 2070@table @asis 2071@item @samp{undocumented} 2072Display only those options that are undocumented. 2073 2074@item @samp{joined} 2075Display options taking an argument that appears after an equal 2076sign in the same continuous piece of text, such as: 2077@samp{--help=target}. 2078 2079@item @samp{separate} 2080Display options taking an argument that appears as a separate word 2081following the original option, such as: @samp{-o output-file}. 2082@end table 2083 2084Thus for example to display all the undocumented target-specific 2085switches supported by the compiler, use: 2086 2087@smallexample 2088--help=target,undocumented 2089@end smallexample 2090 2091The sense of a qualifier can be inverted by prefixing it with the 2092@samp{^} character, so for example to display all binary warning 2093options (i.e., ones that are either on or off and that do not take an 2094argument) that have a description, use: 2095 2096@smallexample 2097--help=warnings,^joined,^undocumented 2098@end smallexample 2099 2100The argument to @option{--help=} should not consist solely of inverted 2101qualifiers. 2102 2103Combining several classes is possible, although this usually 2104restricts the output so much that there is nothing to display. One 2105case where it does work, however, is when one of the classes is 2106@var{target}. For example, to display all the target-specific 2107optimization options, use: 2108 2109@smallexample 2110--help=target,optimizers 2111@end smallexample 2112 2113The @option{--help=} option can be repeated on the command line. Each 2114successive use displays its requested class of options, skipping 2115those that have already been displayed. If @option{--help} is also 2116specified anywhere on the command line then this takes precedence 2117over any @option{--help=} option. 2118 2119If the @option{-Q} option appears on the command line before the 2120@option{--help=} option, then the descriptive text displayed by 2121@option{--help=} is changed. Instead of describing the displayed 2122options, an indication is given as to whether the option is enabled, 2123disabled or set to a specific value (assuming that the compiler 2124knows this at the point where the @option{--help=} option is used). 2125 2126Here is a truncated example from the ARM port of @command{gcc}: 2127 2128@smallexample 2129 % gcc -Q -mabi=2 --help=target -c 2130 The following options are target specific: 2131 -mabi= 2 2132 -mabort-on-noreturn [disabled] 2133 -mapcs [disabled] 2134@end smallexample 2135 2136The output is sensitive to the effects of previous command-line 2137options, so for example it is possible to find out which optimizations 2138are enabled at @option{-O2} by using: 2139 2140@smallexample 2141-Q -O2 --help=optimizers 2142@end smallexample 2143 2144Alternatively you can discover which binary optimizations are enabled 2145by @option{-O3} by using: 2146 2147@smallexample 2148gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 2149gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 2150diff /tmp/O2-opts /tmp/O3-opts | grep enabled 2151@end smallexample 2152 2153@item --version 2154@opindex version 2155Display the version number and copyrights of the invoked GCC@. 2156 2157@item -pass-exit-codes 2158@opindex pass-exit-codes 2159Normally the @command{gcc} program exits with the code of 1 if any 2160phase of the compiler returns a non-success return code. If you specify 2161@option{-pass-exit-codes}, the @command{gcc} program instead returns with 2162the numerically highest error produced by any phase returning an error 2163indication. The C, C++, and Fortran front ends return 4 if an internal 2164compiler error is encountered. 2165 2166@item -pipe 2167@opindex pipe 2168Use pipes rather than temporary files for communication between the 2169various stages of compilation. This fails to work on some systems where 2170the assembler is unable to read from a pipe; but the GNU assembler has 2171no trouble. 2172 2173@item -specs=@var{file} 2174@opindex specs 2175Process @var{file} after the compiler reads in the standard @file{specs} 2176file, in order to override the defaults which the @command{gcc} driver 2177program uses when determining what switches to pass to @command{cc1}, 2178@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 2179@option{-specs=@var{file}} can be specified on the command line, and they 2180are processed in order, from left to right. @xref{Spec Files}, for 2181information about the format of the @var{file}. 2182 2183@item -wrapper 2184@opindex wrapper 2185Invoke all subcommands under a wrapper program. The name of the 2186wrapper program and its parameters are passed as a comma separated 2187list. 2188 2189@smallexample 2190gcc -c t.c -wrapper gdb,--args 2191@end smallexample 2192 2193@noindent 2194This invokes all subprograms of @command{gcc} under 2195@samp{gdb --args}, thus the invocation of @command{cc1} is 2196@samp{gdb --args cc1 @dots{}}. 2197 2198@item -ffile-prefix-map=@var{old}=@var{new} 2199@opindex ffile-prefix-map 2200When compiling files residing in directory @file{@var{old}}, record 2201any references to them in the result of the compilation as if the 2202files resided in directory @file{@var{new}} instead. Specifying this 2203option is equivalent to specifying all the individual 2204@option{-f*-prefix-map} options. This can be used to make reproducible 2205builds that are location independent. See also 2206@option{-fmacro-prefix-map}, @option{-fdebug-prefix-map} and 2207@option{-fprofile-prefix-map}. 2208 2209@item -fplugin=@var{name}.so 2210@opindex fplugin 2211Load the plugin code in file @var{name}.so, assumed to be a 2212shared object to be dlopen'd by the compiler. The base name of 2213the shared object file is used to identify the plugin for the 2214purposes of argument parsing (See 2215@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 2216Each plugin should define the callback functions specified in the 2217Plugins API. 2218 2219@item -fplugin-arg-@var{name}-@var{key}=@var{value} 2220@opindex fplugin-arg 2221Define an argument called @var{key} with a value of @var{value} 2222for the plugin called @var{name}. 2223 2224@item -fdump-ada-spec@r{[}-slim@r{]} 2225@opindex fdump-ada-spec 2226For C and C++ source and include files, generate corresponding Ada specs. 2227@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 2228GNAT User's Guide}, which provides detailed documentation on this feature. 2229 2230@item -fada-spec-parent=@var{unit} 2231@opindex fada-spec-parent 2232In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 2233Ada specs as child units of parent @var{unit}. 2234 2235@item -fdump-go-spec=@var{file} 2236@opindex fdump-go-spec 2237For input files in any language, generate corresponding Go 2238declarations in @var{file}. This generates Go @code{const}, 2239@code{type}, @code{var}, and @code{func} declarations which may be a 2240useful way to start writing a Go interface to code written in some 2241other language. 2242 2243@include @value{srcdir}/../libiberty/at-file.texi 2244@end table 2245 2246@node Invoking G++ 2247@section Compiling C++ Programs 2248 2249@cindex suffixes for C++ source 2250@cindex C++ source file suffixes 2251C++ source files conventionally use one of the suffixes @samp{.C}, 2252@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 2253@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 2254@samp{.H}, or (for shared template code) @samp{.tcc}; and 2255preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 2256files with these names and compiles them as C++ programs even if you 2257call the compiler the same way as for compiling C programs (usually 2258with the name @command{gcc}). 2259 2260@findex g++ 2261@findex c++ 2262However, the use of @command{gcc} does not add the C++ library. 2263@command{g++} is a program that calls GCC and automatically specifies linking 2264against the C++ library. It treats @samp{.c}, 2265@samp{.h} and @samp{.i} files as C++ source files instead of C source 2266files unless @option{-x} is used. This program is also useful when 2267precompiling a C header file with a @samp{.h} extension for use in C++ 2268compilations. On many systems, @command{g++} is also installed with 2269the name @command{c++}. 2270 2271@cindex invoking @command{g++} 2272When you compile C++ programs, you may specify many of the same 2273command-line options that you use for compiling programs in any 2274language; or command-line options meaningful for C and related 2275languages; or options that are meaningful only for C++ programs. 2276@xref{C Dialect Options,,Options Controlling C Dialect}, for 2277explanations of options for languages related to C@. 2278@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 2279explanations of options that are meaningful only for C++ programs. 2280 2281@node C Dialect Options 2282@section Options Controlling C Dialect 2283@cindex dialect options 2284@cindex language dialect options 2285@cindex options, dialect 2286 2287The following options control the dialect of C (or languages derived 2288from C, such as C++, Objective-C and Objective-C++) that the compiler 2289accepts: 2290 2291@table @gcctabopt 2292@cindex ANSI support 2293@cindex ISO support 2294@item -ansi 2295@opindex ansi 2296In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 2297equivalent to @option{-std=c++98}. 2298 2299This turns off certain features of GCC that are incompatible with ISO 2300C90 (when compiling C code), or of standard C++ (when compiling C++ code), 2301such as the @code{asm} and @code{typeof} keywords, and 2302predefined macros such as @code{unix} and @code{vax} that identify the 2303type of system you are using. It also enables the undesirable and 2304rarely used ISO trigraph feature. For the C compiler, 2305it disables recognition of C++ style @samp{//} comments as well as 2306the @code{inline} keyword. 2307 2308The alternate keywords @code{__asm__}, @code{__extension__}, 2309@code{__inline__} and @code{__typeof__} continue to work despite 2310@option{-ansi}. You would not want to use them in an ISO C program, of 2311course, but it is useful to put them in header files that might be included 2312in compilations done with @option{-ansi}. Alternate predefined macros 2313such as @code{__unix__} and @code{__vax__} are also available, with or 2314without @option{-ansi}. 2315 2316The @option{-ansi} option does not cause non-ISO programs to be 2317rejected gratuitously. For that, @option{-Wpedantic} is required in 2318addition to @option{-ansi}. @xref{Warning Options}. 2319 2320The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 2321option is used. Some header files may notice this macro and refrain 2322from declaring certain functions or defining certain macros that the 2323ISO standard doesn't call for; this is to avoid interfering with any 2324programs that might use these names for other things. 2325 2326Functions that are normally built in but do not have semantics 2327defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 2328functions when @option{-ansi} is used. @xref{Other Builtins,,Other 2329built-in functions provided by GCC}, for details of the functions 2330affected. 2331 2332@item -std= 2333@opindex std 2334Determine the language standard. @xref{Standards,,Language Standards 2335Supported by GCC}, for details of these standard versions. This option 2336is currently only supported when compiling C or C++. 2337 2338The compiler can accept several base standards, such as @samp{c90} or 2339@samp{c++98}, and GNU dialects of those standards, such as 2340@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 2341compiler accepts all programs following that standard plus those 2342using GNU extensions that do not contradict it. For example, 2343@option{-std=c90} turns off certain features of GCC that are 2344incompatible with ISO C90, such as the @code{asm} and @code{typeof} 2345keywords, but not other GNU extensions that do not have a meaning in 2346ISO C90, such as omitting the middle term of a @code{?:} 2347expression. On the other hand, when a GNU dialect of a standard is 2348specified, all features supported by the compiler are enabled, even when 2349those features change the meaning of the base standard. As a result, some 2350strict-conforming programs may be rejected. The particular standard 2351is used by @option{-Wpedantic} to identify which features are GNU 2352extensions given that version of the standard. For example 2353@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 2354comments, while @option{-std=gnu99 -Wpedantic} does not. 2355 2356A value for this option must be provided; possible values are 2357 2358@table @samp 2359@item c90 2360@itemx c89 2361@itemx iso9899:1990 2362Support all ISO C90 programs (certain GNU extensions that conflict 2363with ISO C90 are disabled). Same as @option{-ansi} for C code. 2364 2365@item iso9899:199409 2366ISO C90 as modified in amendment 1. 2367 2368@item c99 2369@itemx c9x 2370@itemx iso9899:1999 2371@itemx iso9899:199x 2372ISO C99. This standard is substantially completely supported, modulo 2373bugs and floating-point issues 2374(mainly but not entirely relating to optional C99 features from 2375Annexes F and G). See 2376@w{@uref{https://gcc.gnu.org/c99status.html}} for more information. The 2377names @samp{c9x} and @samp{iso9899:199x} are deprecated. 2378 2379@item c11 2380@itemx c1x 2381@itemx iso9899:2011 2382ISO C11, the 2011 revision of the ISO C standard. This standard is 2383substantially completely supported, modulo bugs, floating-point issues 2384(mainly but not entirely relating to optional C11 features from 2385Annexes F and G) and the optional Annexes K (Bounds-checking 2386interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. 2387 2388@item c17 2389@itemx c18 2390@itemx iso9899:2017 2391@itemx iso9899:2018 2392ISO C17, the 2017 revision of the ISO C standard 2393(published in 2018). This standard is 2394same as C11 except for corrections of defects (all of which are also 2395applied with @option{-std=c11}) and a new value of 2396@code{__STDC_VERSION__}, and so is supported to the same extent as C11. 2397 2398@item c2x 2399The next version of the ISO C standard, still under development. The 2400support for this version is experimental and incomplete. 2401 2402@item gnu90 2403@itemx gnu89 2404GNU dialect of ISO C90 (including some C99 features). 2405 2406@item gnu99 2407@itemx gnu9x 2408GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. 2409 2410@item gnu11 2411@itemx gnu1x 2412GNU dialect of ISO C11. 2413The name @samp{gnu1x} is deprecated. 2414 2415@item gnu17 2416@itemx gnu18 2417GNU dialect of ISO C17. This is the default for C code. 2418 2419@item gnu2x 2420The next version of the ISO C standard, still under development, plus 2421GNU extensions. The support for this version is experimental and 2422incomplete. 2423 2424@item c++98 2425@itemx c++03 2426The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 2427additional defect reports. Same as @option{-ansi} for C++ code. 2428 2429@item gnu++98 2430@itemx gnu++03 2431GNU dialect of @option{-std=c++98}. 2432 2433@item c++11 2434@itemx c++0x 2435The 2011 ISO C++ standard plus amendments. 2436The name @samp{c++0x} is deprecated. 2437 2438@item gnu++11 2439@itemx gnu++0x 2440GNU dialect of @option{-std=c++11}. 2441The name @samp{gnu++0x} is deprecated. 2442 2443@item c++14 2444@itemx c++1y 2445The 2014 ISO C++ standard plus amendments. 2446The name @samp{c++1y} is deprecated. 2447 2448@item gnu++14 2449@itemx gnu++1y 2450GNU dialect of @option{-std=c++14}. 2451The name @samp{gnu++1y} is deprecated. 2452 2453@item c++17 2454@itemx c++1z 2455The 2017 ISO C++ standard plus amendments. 2456The name @samp{c++1z} is deprecated. 2457 2458@item gnu++17 2459@itemx gnu++1z 2460GNU dialect of @option{-std=c++17}. 2461This is the default for C++ code. 2462The name @samp{gnu++1z} is deprecated. 2463 2464@item c++20 2465@itemx c++2a 2466The 2020 ISO C++ standard plus amendments. 2467Support is experimental, and could change in incompatible ways in 2468future releases. 2469The name @samp{c++2a} is deprecated. 2470 2471@item gnu++20 2472@itemx gnu++2a 2473GNU dialect of @option{-std=c++20}. 2474Support is experimental, and could change in incompatible ways in 2475future releases. 2476The name @samp{gnu++2a} is deprecated. 2477 2478@item c++2b 2479@itemx c++23 2480The next revision of the ISO C++ standard, planned for 24812023. Support is highly experimental, and will almost certainly 2482change in incompatible ways in future releases. 2483 2484@item gnu++2b 2485@itemx gnu++23 2486GNU dialect of @option{-std=c++2b}. Support is highly experimental, 2487and will almost certainly change in incompatible ways in future 2488releases. 2489@end table 2490 2491@item -aux-info @var{filename} 2492@opindex aux-info 2493Output to the given filename prototyped declarations for all functions 2494declared and/or defined in a translation unit, including those in header 2495files. This option is silently ignored in any language other than C@. 2496 2497Besides declarations, the file indicates, in comments, the origin of 2498each declaration (source file and line), whether the declaration was 2499implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 2500@samp{O} for old, respectively, in the first character after the line 2501number and the colon), and whether it came from a declaration or a 2502definition (@samp{C} or @samp{F}, respectively, in the following 2503character). In the case of function definitions, a K&R-style list of 2504arguments followed by their declarations is also provided, inside 2505comments, after the declaration. 2506 2507@item -fallow-parameterless-variadic-functions 2508@opindex fallow-parameterless-variadic-functions 2509Accept variadic functions without named parameters. 2510 2511Although it is possible to define such a function, this is not very 2512useful as it is not possible to read the arguments. This is only 2513supported for C as this construct is allowed by C++. 2514 2515@item -fno-asm 2516@opindex fno-asm 2517@opindex fasm 2518Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 2519keyword, so that code can use these words as identifiers. You can use 2520the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 2521instead. In C, @option{-ansi} implies @option{-fno-asm}. 2522 2523In C++, @code{inline} is a standard keyword and is not affected by 2524this switch. You may want to use the @option{-fno-gnu-keywords} flag 2525instead, which disables @code{typeof} but not @code{asm} and 2526@code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), 2527this switch only affects the @code{asm} and @code{typeof} keywords, 2528since @code{inline} is a standard keyword in ISO C99. 2529 2530@item -fno-builtin 2531@itemx -fno-builtin-@var{function} 2532@opindex fno-builtin 2533@opindex fbuiltin 2534@cindex built-in functions 2535Don't recognize built-in functions that do not begin with 2536@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 2537functions provided by GCC}, for details of the functions affected, 2538including those which are not built-in functions when @option{-ansi} or 2539@option{-std} options for strict ISO C conformance are used because they 2540do not have an ISO standard meaning. 2541 2542GCC normally generates special code to handle certain built-in functions 2543more efficiently; for instance, calls to @code{alloca} may become single 2544instructions which adjust the stack directly, and calls to @code{memcpy} 2545may become inline copy loops. The resulting code is often both smaller 2546and faster, but since the function calls no longer appear as such, you 2547cannot set a breakpoint on those calls, nor can you change the behavior 2548of the functions by linking with a different library. In addition, 2549when a function is recognized as a built-in function, GCC may use 2550information about that function to warn about problems with calls to 2551that function, or to generate more efficient code, even if the 2552resulting code still contains calls to that function. For example, 2553warnings are given with @option{-Wformat} for bad calls to 2554@code{printf} when @code{printf} is built in and @code{strlen} is 2555known not to modify global memory. 2556 2557With the @option{-fno-builtin-@var{function}} option 2558only the built-in function @var{function} is 2559disabled. @var{function} must not begin with @samp{__builtin_}. If a 2560function is named that is not built-in in this version of GCC, this 2561option is ignored. There is no corresponding 2562@option{-fbuiltin-@var{function}} option; if you wish to enable 2563built-in functions selectively when using @option{-fno-builtin} or 2564@option{-ffreestanding}, you may define macros such as: 2565 2566@smallexample 2567#define abs(n) __builtin_abs ((n)) 2568#define strcpy(d, s) __builtin_strcpy ((d), (s)) 2569@end smallexample 2570 2571@item -fcond-mismatch 2572@opindex fcond-mismatch 2573Allow conditional expressions with mismatched types in the second and 2574third arguments. The value of such an expression is void. This option 2575is not supported for C++. 2576 2577@item -ffreestanding 2578@opindex ffreestanding 2579@cindex hosted environment 2580 2581Assert that compilation targets a freestanding environment. This 2582implies @option{-fno-builtin}. A freestanding environment 2583is one in which the standard library may not exist, and program startup may 2584not necessarily be at @code{main}. The most obvious example is an OS kernel. 2585This is equivalent to @option{-fno-hosted}. 2586 2587@xref{Standards,,Language Standards Supported by GCC}, for details of 2588freestanding and hosted environments. 2589 2590@item -fgimple 2591@opindex fgimple 2592 2593Enable parsing of function definitions marked with @code{__GIMPLE}. 2594This is an experimental feature that allows unit testing of GIMPLE 2595passes. 2596 2597@item -fgnu-tm 2598@opindex fgnu-tm 2599When the option @option{-fgnu-tm} is specified, the compiler 2600generates code for the Linux variant of Intel's current Transactional 2601Memory ABI specification document (Revision 1.1, May 6 2009). This is 2602an experimental feature whose interface may change in future versions 2603of GCC, as the official specification changes. Please note that not 2604all architectures are supported for this feature. 2605 2606For more information on GCC's support for transactional memory, 2607@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 2608Transactional Memory Library}. 2609 2610Note that the transactional memory feature is not supported with 2611non-call exceptions (@option{-fnon-call-exceptions}). 2612 2613@item -fgnu89-inline 2614@opindex fgnu89-inline 2615The option @option{-fgnu89-inline} tells GCC to use the traditional 2616GNU semantics for @code{inline} functions when in C99 mode. 2617@xref{Inline,,An Inline Function is As Fast As a Macro}. 2618Using this option is roughly equivalent to adding the 2619@code{gnu_inline} function attribute to all inline functions 2620(@pxref{Function Attributes}). 2621 2622The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 2623C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 2624specifies the default behavior). 2625This option is not supported in @option{-std=c90} or 2626@option{-std=gnu90} mode. 2627 2628The preprocessor macros @code{__GNUC_GNU_INLINE__} and 2629@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 2630in effect for @code{inline} functions. @xref{Common Predefined 2631Macros,,,cpp,The C Preprocessor}. 2632 2633@item -fhosted 2634@opindex fhosted 2635@cindex hosted environment 2636 2637Assert that compilation targets a hosted environment. This implies 2638@option{-fbuiltin}. A hosted environment is one in which the 2639entire standard library is available, and in which @code{main} has a return 2640type of @code{int}. Examples are nearly everything except a kernel. 2641This is equivalent to @option{-fno-freestanding}. 2642 2643@item -flax-vector-conversions 2644@opindex flax-vector-conversions 2645Allow implicit conversions between vectors with differing numbers of 2646elements and/or incompatible element types. This option should not be 2647used for new code. 2648 2649@item -fms-extensions 2650@opindex fms-extensions 2651Accept some non-standard constructs used in Microsoft header files. 2652 2653In C++ code, this allows member names in structures to be similar 2654to previous types declarations. 2655 2656@smallexample 2657typedef int UOW; 2658struct ABC @{ 2659 UOW UOW; 2660@}; 2661@end smallexample 2662 2663Some cases of unnamed fields in structures and unions are only 2664accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 2665fields within structs/unions}, for details. 2666 2667Note that this option is off for all targets except for x86 2668targets using ms-abi. 2669 2670@item -foffload=disable 2671@itemx -foffload=default 2672@itemx -foffload=@var{target-list} 2673@opindex foffload 2674@cindex Offloading targets 2675@cindex OpenACC offloading targets 2676@cindex OpenMP offloading targets 2677Specify for which OpenMP and OpenACC offload targets code should be generated. 2678The default behavior, equivalent to @option{-foffload=default}, is to generate 2679code for all supported offload targets. The @option{-foffload=disable} form 2680generates code only for the host fallback, while 2681@option{-foffload=@var{target-list}} generates code only for the specified 2682comma-separated list of offload targets. 2683 2684Offload targets are specified in GCC's internal target-triplet format. You can 2685run the compiler with @option{-v} to show the list of configured offload targets 2686under @code{OFFLOAD_TARGET_NAMES}. 2687 2688@item -foffload-options=@var{options} 2689@itemx -foffload-options=@var{target-triplet-list}=@var{options} 2690@opindex foffload-options 2691@cindex Offloading options 2692@cindex OpenACC offloading options 2693@cindex OpenMP offloading options 2694 2695With @option{-foffload-options=@var{options}}, GCC passes the specified 2696@var{options} to the compilers for all enabled offloading targets. You can 2697specify options that apply only to a specific target or targets by using 2698the @option{-foffload-options=@var{target-list}=@var{options}} form. The 2699@var{target-list} is a comma-separated list in the same format as for the 2700@option{-foffload=} option. 2701 2702Typical command lines are 2703 2704@smallexample 2705-foffload-options=-lgfortran -foffload-options=-lm 2706-foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic 2707-foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm 2708@end smallexample 2709 2710@item -fopenacc 2711@opindex fopenacc 2712@cindex OpenACC accelerator programming 2713Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and 2714@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the 2715compiler generates accelerated code according to the OpenACC Application 2716Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option 2717implies @option{-pthread}, and thus is only supported on targets that 2718have support for @option{-pthread}. 2719 2720@item -fopenacc-dim=@var{geom} 2721@opindex fopenacc-dim 2722@cindex OpenACC accelerator programming 2723Specify default compute dimensions for parallel offload regions that do 2724not explicitly specify. The @var{geom} value is a triple of 2725':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size 2726can be omitted, to use a target-specific default value. 2727 2728@item -fopenmp 2729@opindex fopenmp 2730@cindex OpenMP parallel 2731Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 2732@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 2733compiler generates parallel code according to the OpenMP Application 2734Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option 2735implies @option{-pthread}, and thus is only supported on targets that 2736have support for @option{-pthread}. @option{-fopenmp} implies 2737@option{-fopenmp-simd}. 2738 2739@item -fopenmp-simd 2740@opindex fopenmp-simd 2741@cindex OpenMP SIMD 2742@cindex SIMD 2743Enable handling of OpenMP's SIMD directives with @code{#pragma omp} 2744in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives 2745are ignored. 2746 2747@item -fpermitted-flt-eval-methods=@var{style} 2748@opindex fpermitted-flt-eval-methods 2749@opindex fpermitted-flt-eval-methods=c11 2750@opindex fpermitted-flt-eval-methods=ts-18661-3 2751ISO/IEC TS 18661-3 defines new permissible values for 2752@code{FLT_EVAL_METHOD} that indicate that operations and constants with 2753a semantic type that is an interchange or extended format should be 2754evaluated to the precision and range of that type. These new values are 2755a superset of those permitted under C99/C11, which does not specify the 2756meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code 2757conforming to C11 may not have been written expecting the possibility of 2758the new values. 2759 2760@option{-fpermitted-flt-eval-methods} specifies whether the compiler 2761should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11, 2762or the extended set of values specified in ISO/IEC TS 18661-3. 2763 2764@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate. 2765 2766The default when in a standards compliant mode (@option{-std=c11} or similar) 2767is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU 2768dialect (@option{-std=gnu11} or similar) is 2769@option{-fpermitted-flt-eval-methods=ts-18661-3}. 2770 2771@item -fplan9-extensions 2772@opindex fplan9-extensions 2773Accept some non-standard constructs used in Plan 9 code. 2774 2775This enables @option{-fms-extensions}, permits passing pointers to 2776structures with anonymous fields to functions that expect pointers to 2777elements of the type of the field, and permits referring to anonymous 2778fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 2779struct/union fields within structs/unions}, for details. This is only 2780supported for C, not C++. 2781 2782@item -fsigned-bitfields 2783@itemx -funsigned-bitfields 2784@itemx -fno-signed-bitfields 2785@itemx -fno-unsigned-bitfields 2786@opindex fsigned-bitfields 2787@opindex funsigned-bitfields 2788@opindex fno-signed-bitfields 2789@opindex fno-unsigned-bitfields 2790These options control whether a bit-field is signed or unsigned, when the 2791declaration does not use either @code{signed} or @code{unsigned}. By 2792default, such a bit-field is signed, because this is consistent: the 2793basic integer types such as @code{int} are signed types. 2794 2795@item -fsigned-char 2796@opindex fsigned-char 2797Let the type @code{char} be signed, like @code{signed char}. 2798 2799Note that this is equivalent to @option{-fno-unsigned-char}, which is 2800the negative form of @option{-funsigned-char}. Likewise, the option 2801@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 2802 2803@item -funsigned-char 2804@opindex funsigned-char 2805Let the type @code{char} be unsigned, like @code{unsigned char}. 2806 2807Each kind of machine has a default for what @code{char} should 2808be. It is either like @code{unsigned char} by default or like 2809@code{signed char} by default. 2810 2811Ideally, a portable program should always use @code{signed char} or 2812@code{unsigned char} when it depends on the signedness of an object. 2813But many programs have been written to use plain @code{char} and 2814expect it to be signed, or expect it to be unsigned, depending on the 2815machines they were written for. This option, and its inverse, let you 2816make such a program work with the opposite default. 2817 2818The type @code{char} is always a distinct type from each of 2819@code{signed char} or @code{unsigned char}, even though its behavior 2820is always just like one of those two. 2821 2822@item -fsso-struct=@var{endianness} 2823@opindex fsso-struct 2824Set the default scalar storage order of structures and unions to the 2825specified endianness. The accepted values are @samp{big-endian}, 2826@samp{little-endian} and @samp{native} for the native endianness of 2827the target (the default). This option is not supported for C++. 2828 2829@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate 2830code that is not binary compatible with code generated without it if the 2831specified endianness is not the native endianness of the target. 2832@end table 2833 2834@node C++ Dialect Options 2835@section Options Controlling C++ Dialect 2836 2837@cindex compiler options, C++ 2838@cindex C++ options, command-line 2839@cindex options, C++ 2840This section describes the command-line options that are only meaningful 2841for C++ programs. You can also use most of the GNU compiler options 2842regardless of what language your program is in. For example, you 2843might compile a file @file{firstClass.C} like this: 2844 2845@smallexample 2846g++ -g -fstrict-enums -O -c firstClass.C 2847@end smallexample 2848 2849@noindent 2850In this example, only @option{-fstrict-enums} is an option meant 2851only for C++ programs; you can use the other options with any 2852language supported by GCC@. 2853 2854Some options for compiling C programs, such as @option{-std}, are also 2855relevant for C++ programs. 2856@xref{C Dialect Options,,Options Controlling C Dialect}. 2857 2858Here is a list of options that are @emph{only} for compiling C++ programs: 2859 2860@table @gcctabopt 2861 2862@item -fabi-version=@var{n} 2863@opindex fabi-version 2864Use version @var{n} of the C++ ABI@. The default is version 0. 2865 2866Version 0 refers to the version conforming most closely to 2867the C++ ABI specification. Therefore, the ABI obtained using version 0 2868will change in different versions of G++ as ABI bugs are fixed. 2869 2870Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 2871 2872Version 2 is the version of the C++ ABI that first appeared in G++ 28733.4, and was the default through G++ 4.9. 2874 2875Version 3 corrects an error in mangling a constant address as a 2876template argument. 2877 2878Version 4, which first appeared in G++ 4.5, implements a standard 2879mangling for vector types. 2880 2881Version 5, which first appeared in G++ 4.6, corrects the mangling of 2882attribute const/volatile on function pointer types, decltype of a 2883plain decl, and use of a function parameter in the declaration of 2884another parameter. 2885 2886Version 6, which first appeared in G++ 4.7, corrects the promotion 2887behavior of C++11 scoped enums and the mangling of template argument 2888packs, const/static_cast, prefix ++ and --, and a class scope function 2889used as a template argument. 2890 2891Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a 2892builtin type and corrects the mangling of lambdas in default argument 2893scope. 2894 2895Version 8, which first appeared in G++ 4.9, corrects the substitution 2896behavior of function types with function-cv-qualifiers. 2897 2898Version 9, which first appeared in G++ 5.2, corrects the alignment of 2899@code{nullptr_t}. 2900 2901Version 10, which first appeared in G++ 6.1, adds mangling of 2902attributes that affect type identity, such as ia32 calling convention 2903attributes (e.g.@: @samp{stdcall}). 2904 2905Version 11, which first appeared in G++ 7, corrects the mangling of 2906sizeof... expressions and operator names. For multiple entities with 2907the same name within a function, that are declared in different scopes, 2908the mangling now changes starting with the twelfth occurrence. It also 2909implies @option{-fnew-inheriting-ctors}. 2910 2911Version 12, which first appeared in G++ 8, corrects the calling 2912conventions for empty classes on the x86_64 target and for classes 2913with only deleted copy/move constructors. It accidentally changes the 2914calling convention for classes with a deleted copy constructor and a 2915trivial move constructor. 2916 2917Version 13, which first appeared in G++ 8.2, fixes the accidental 2918change in version 12. 2919 2920Version 14, which first appeared in G++ 10, corrects the mangling of 2921the nullptr expression. 2922 2923Version 15, which first appeared in G++ 11, changes the mangling of 2924@code{__alignof__} to be distinct from that of @code{alignof}, and 2925dependent operator names. 2926 2927See also @option{-Wabi}. 2928 2929@item -fabi-compat-version=@var{n} 2930@opindex fabi-compat-version 2931On targets that support strong aliases, G++ 2932works around mangling changes by creating an alias with the correct 2933mangled name when defining a symbol with an incorrect mangled name. 2934This switch specifies which ABI version to use for the alias. 2935 2936With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7 2937compatibility). If another ABI version is explicitly selected, this 2938defaults to 0. For compatibility with GCC versions 3.2 through 4.9, 2939use @option{-fabi-compat-version=2}. 2940 2941If this option is not provided but @option{-Wabi=@var{n}} is, that 2942version is used for compatibility aliases. If this option is provided 2943along with @option{-Wabi} (without the version), the version from this 2944option is used for the warning. 2945 2946@item -fno-access-control 2947@opindex fno-access-control 2948@opindex faccess-control 2949Turn off all access checking. This switch is mainly useful for working 2950around bugs in the access control code. 2951 2952@item -faligned-new 2953@opindex faligned-new 2954Enable support for C++17 @code{new} of types that require more 2955alignment than @code{void* ::operator new(std::size_t)} provides. A 2956numeric argument such as @code{-faligned-new=32} can be used to 2957specify how much alignment (in bytes) is provided by that function, 2958but few users will need to override the default of 2959@code{alignof(std::max_align_t)}. 2960 2961This flag is enabled by default for @option{-std=c++17}. 2962 2963@item -fchar8_t 2964@itemx -fno-char8_t 2965@opindex fchar8_t 2966@opindex fno-char8_t 2967Enable support for @code{char8_t} as adopted for C++20. This includes 2968the addition of a new @code{char8_t} fundamental type, changes to the 2969types of UTF-8 string and character literals, new signatures for 2970user-defined literals, associated standard library updates, and new 2971@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros. 2972 2973This option enables functions to be overloaded for ordinary and UTF-8 2974strings: 2975 2976@smallexample 2977int f(const char *); // #1 2978int f(const char8_t *); // #2 2979int v1 = f("text"); // Calls #1 2980int v2 = f(u8"text"); // Calls #2 2981@end smallexample 2982 2983@noindent 2984and introduces new signatures for user-defined literals: 2985 2986@smallexample 2987int operator""_udl1(char8_t); 2988int v3 = u8'x'_udl1; 2989int operator""_udl2(const char8_t*, std::size_t); 2990int v4 = u8"text"_udl2; 2991template<typename T, T...> int operator""_udl3(); 2992int v5 = u8"text"_udl3; 2993@end smallexample 2994 2995@noindent 2996The change to the types of UTF-8 string and character literals introduces 2997incompatibilities with ISO C++11 and later standards. For example, the 2998following code is well-formed under ISO C++11, but is ill-formed when 2999@option{-fchar8_t} is specified. 3000 3001@smallexample 3002char ca[] = u8"xx"; // error: char-array initialized from wide 3003 // string 3004const char *cp = u8"xx";// error: invalid conversion from 3005 // `const char8_t*' to `const char*' 3006int f(const char*); 3007auto v = f(u8"xx"); // error: invalid conversion from 3008 // `const char8_t*' to `const char*' 3009std::string s@{u8"xx"@}; // error: no matching function for call to 3010 // `std::basic_string<char>::basic_string()' 3011using namespace std::literals; 3012s = u8"xx"s; // error: conversion from 3013 // `basic_string<char8_t>' to non-scalar 3014 // type `basic_string<char>' requested 3015@end smallexample 3016 3017@item -fcheck-new 3018@opindex fcheck-new 3019Check that the pointer returned by @code{operator new} is non-null 3020before attempting to modify the storage allocated. This check is 3021normally unnecessary because the C++ standard specifies that 3022@code{operator new} only returns @code{0} if it is declared 3023@code{throw()}, in which case the compiler always checks the 3024return value even without this option. In all other cases, when 3025@code{operator new} has a non-empty exception specification, memory 3026exhaustion is signalled by throwing @code{std::bad_alloc}. See also 3027@samp{new (nothrow)}. 3028 3029@item -fconcepts 3030@itemx -fconcepts-ts 3031@opindex fconcepts 3032@opindex fconcepts-ts 3033Below @option{-std=c++20}, @option{-fconcepts} enables support for the 3034C++ Extensions for Concepts Technical Specification, ISO 19217 (2015). 3035 3036With @option{-std=c++20} and above, Concepts are part of the language 3037standard, so @option{-fconcepts} defaults to on. But the standard 3038specification of Concepts differs significantly from the TS, so some 3039constructs that were allowed in the TS but didn't make it into the 3040standard can still be enabled by @option{-fconcepts-ts}. 3041 3042@item -fconstexpr-depth=@var{n} 3043@opindex fconstexpr-depth 3044Set the maximum nested evaluation depth for C++11 constexpr functions 3045to @var{n}. A limit is needed to detect endless recursion during 3046constant expression evaluation. The minimum specified by the standard 3047is 512. 3048 3049@item -fconstexpr-cache-depth=@var{n} 3050@opindex fconstexpr-cache-depth 3051Set the maximum level of nested evaluation depth for C++11 constexpr 3052functions that will be cached to @var{n}. This is a heuristic that 3053trades off compilation speed (when the cache avoids repeated 3054calculations) against memory consumption (when the cache grows very 3055large from highly recursive evaluations). The default is 8. Very few 3056users are likely to want to adjust it, but if your code does heavy 3057constexpr calculations you might want to experiment to find which 3058value works best for you. 3059 3060@item -fconstexpr-fp-except 3061@opindex fconstexpr-fp-except 3062Annex F of the C standard specifies that IEC559 floating point 3063exceptions encountered at compile time should not stop compilation. 3064C++ compilers have historically not followed this guidance, instead 3065treating floating point division by zero as non-constant even though 3066it has a well defined value. This flag tells the compiler to give 3067Annex F priority over other rules saying that a particular operation 3068is undefined. 3069 3070@smallexample 3071constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except 3072@end smallexample 3073 3074@item -fconstexpr-loop-limit=@var{n} 3075@opindex fconstexpr-loop-limit 3076Set the maximum number of iterations for a loop in C++14 constexpr functions 3077to @var{n}. A limit is needed to detect infinite loops during 3078constant expression evaluation. The default is 262144 (1<<18). 3079 3080@item -fconstexpr-ops-limit=@var{n} 3081@opindex fconstexpr-ops-limit 3082Set the maximum number of operations during a single constexpr evaluation. 3083Even when number of iterations of a single loop is limited with the above limit, 3084if there are several nested loops and each of them has many iterations but still 3085smaller than the above limit, or if in a body of some loop or even outside 3086of a loop too many expressions need to be evaluated, the resulting constexpr 3087evaluation might take too long. 3088The default is 33554432 (1<<25). 3089 3090@item -fcoroutines 3091@opindex fcoroutines 3092Enable support for the C++ coroutines extension (experimental). 3093 3094@item -fno-elide-constructors 3095@opindex fno-elide-constructors 3096@opindex felide-constructors 3097The C++ standard allows an implementation to omit creating a temporary 3098that is only used to initialize another object of the same type. 3099Specifying this option disables that optimization, and forces G++ to 3100call the copy constructor in all cases. This option also causes G++ 3101to call trivial member functions which otherwise would be expanded inline. 3102 3103In C++17, the compiler is required to omit these temporaries, but this 3104option still affects trivial member functions. 3105 3106@item -fno-enforce-eh-specs 3107@opindex fno-enforce-eh-specs 3108@opindex fenforce-eh-specs 3109Don't generate code to check for violation of exception specifications 3110at run time. This option violates the C++ standard, but may be useful 3111for reducing code size in production builds, much like defining 3112@code{NDEBUG}. This does not give user code permission to throw 3113exceptions in violation of the exception specifications; the compiler 3114still optimizes based on the specifications, so throwing an 3115unexpected exception results in undefined behavior at run time. 3116 3117@item -fextern-tls-init 3118@itemx -fno-extern-tls-init 3119@opindex fextern-tls-init 3120@opindex fno-extern-tls-init 3121The C++11 and OpenMP standards allow @code{thread_local} and 3122@code{threadprivate} variables to have dynamic (runtime) 3123initialization. To support this, any use of such a variable goes 3124through a wrapper function that performs any necessary initialization. 3125When the use and definition of the variable are in the same 3126translation unit, this overhead can be optimized away, but when the 3127use is in a different translation unit there is significant overhead 3128even if the variable doesn't actually need dynamic initialization. If 3129the programmer can be sure that no use of the variable in a 3130non-defining TU needs to trigger dynamic initialization (either 3131because the variable is statically initialized, or a use of the 3132variable in the defining TU will be executed before any uses in 3133another TU), they can avoid this overhead with the 3134@option{-fno-extern-tls-init} option. 3135 3136On targets that support symbol aliases, the default is 3137@option{-fextern-tls-init}. On targets that do not support symbol 3138aliases, the default is @option{-fno-extern-tls-init}. 3139 3140@item -ffold-simple-inlines 3141@itemx -fno-fold-simple-inlines 3142@opindex ffold-simple-inlines 3143@opindex fno-fold-simple-inlines 3144Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward}, 3145@code{std::addressof} and @code{std::as_const}. In contrast to inlining, this 3146means no debug information will be generated for such calls. Since these 3147functions are rarely interesting to debug, this flag is enabled by default 3148unless @option{-fno-inline} is active. 3149 3150@item -fno-gnu-keywords 3151@opindex fno-gnu-keywords 3152@opindex fgnu-keywords 3153Do not recognize @code{typeof} as a keyword, so that code can use this 3154word as an identifier. You can use the keyword @code{__typeof__} instead. 3155This option is implied by the strict ISO C++ dialects: @option{-ansi}, 3156@option{-std=c++98}, @option{-std=c++11}, etc. 3157 3158@item -fimplicit-constexpr 3159@opindex fimplicit-constexpr 3160Make inline functions implicitly constexpr, if they satisfy the 3161requirements for a constexpr function. This option can be used in 3162C++14 mode or later. This can result in initialization changing from 3163dynamic to static and other optimizations. 3164 3165@item -fno-implicit-templates 3166@opindex fno-implicit-templates 3167@opindex fimplicit-templates 3168Never emit code for non-inline templates that are instantiated 3169implicitly (i.e.@: by use); only emit code for explicit instantiations. 3170If you use this option, you must take care to structure your code to 3171include all the necessary explicit instantiations to avoid getting 3172undefined symbols at link time. 3173@xref{Template Instantiation}, for more information. 3174 3175@item -fno-implicit-inline-templates 3176@opindex fno-implicit-inline-templates 3177@opindex fimplicit-inline-templates 3178Don't emit code for implicit instantiations of inline templates, either. 3179The default is to handle inlines differently so that compiles with and 3180without optimization need the same set of explicit instantiations. 3181 3182@item -fno-implement-inlines 3183@opindex fno-implement-inlines 3184@opindex fimplement-inlines 3185To save space, do not emit out-of-line copies of inline functions 3186controlled by @code{#pragma implementation}. This causes linker 3187errors if these functions are not inlined everywhere they are called. 3188 3189@item -fmodules-ts 3190@itemx -fno-modules-ts 3191@opindex fmodules-ts 3192@opindex fno-modules-ts 3193Enable support for C++20 modules (@pxref{C++ Modules}). The 3194@option{-fno-modules-ts} is usually not needed, as that is the 3195default. Even though this is a C++20 feature, it is not currently 3196implicitly enabled by selecting that standard version. 3197 3198@item -fmodule-header 3199@itemx -fmodule-header=user 3200@itemx -fmodule-header=system 3201@opindex fmodule-header 3202Compile a header file to create an importable header unit. 3203 3204@item -fmodule-implicit-inline 3205@opindex fmodule-implicit-inline 3206Member functions defined in their class definitions are not implicitly 3207inline for modular code. This is different to traditional C++ 3208behavior, for good reasons. However, it may result in a difficulty 3209during code porting. This option makes such function definitions 3210implicitly inline. It does however generate an ABI incompatibility, 3211so you must use it everywhere or nowhere. (Such definitions outside 3212of a named module remain implicitly inline, regardless.) 3213 3214@item -fno-module-lazy 3215@opindex fno-module-lazy 3216@opindex fmodule-lazy 3217Disable lazy module importing and module mapper creation. 3218 3219@item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]} 3220@itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...} 3221@itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]} 3222@itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]} 3223@itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]} 3224@itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]} 3225@vindex CXX_MODULE_MAPPER @r{environment variable} 3226@opindex fmodule-mapper 3227An oracle to query for module name to filename mappings. If 3228unspecified the @env{CXX_MODULE_MAPPER} environment variable is used, 3229and if that is unset, an in-process default is provided. 3230 3231@item -fmodule-only 3232@opindex fmodule-only 3233Only emit the Compiled Module Interface, inhibiting any object file. 3234 3235@item -fms-extensions 3236@opindex fms-extensions 3237Disable Wpedantic warnings about constructs used in MFC, such as implicit 3238int and getting a pointer to member function via non-standard syntax. 3239 3240@item -fnew-inheriting-ctors 3241@opindex fnew-inheriting-ctors 3242Enable the P0136 adjustment to the semantics of C++11 constructor 3243inheritance. This is part of C++17 but also considered to be a Defect 3244Report against C++11 and C++14. This flag is enabled by default 3245unless @option{-fabi-version=10} or lower is specified. 3246 3247@item -fnew-ttp-matching 3248@opindex fnew-ttp-matching 3249Enable the P0522 resolution to Core issue 150, template template 3250parameters and default arguments: this allows a template with default 3251template arguments as an argument for a template template parameter 3252with fewer template parameters. This flag is enabled by default for 3253@option{-std=c++17}. 3254 3255@item -fno-nonansi-builtins 3256@opindex fno-nonansi-builtins 3257@opindex fnonansi-builtins 3258Disable built-in declarations of functions that are not mandated by 3259ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 3260@code{index}, @code{bzero}, @code{conjf}, and other related functions. 3261 3262@item -fnothrow-opt 3263@opindex fnothrow-opt 3264Treat a @code{throw()} exception specification as if it were a 3265@code{noexcept} specification to reduce or eliminate the text size 3266overhead relative to a function with no exception specification. If 3267the function has local variables of types with non-trivial 3268destructors, the exception specification actually makes the 3269function smaller because the EH cleanups for those variables can be 3270optimized away. The semantic effect is that an exception thrown out of 3271a function with such an exception specification results in a call 3272to @code{terminate} rather than @code{unexpected}. 3273 3274@item -fno-operator-names 3275@opindex fno-operator-names 3276@opindex foperator-names 3277Do not treat the operator name keywords @code{and}, @code{bitand}, 3278@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 3279synonyms as keywords. 3280 3281@item -fno-optional-diags 3282@opindex fno-optional-diags 3283@opindex foptional-diags 3284Disable diagnostics that the standard says a compiler does not need to 3285issue. Currently, the only such diagnostic issued by G++ is the one for 3286a name having multiple meanings within a class. 3287 3288@item -fpermissive 3289@opindex fpermissive 3290Downgrade some diagnostics about nonconformant code from errors to 3291warnings. Thus, using @option{-fpermissive} allows some 3292nonconforming code to compile. 3293 3294@item -fno-pretty-templates 3295@opindex fno-pretty-templates 3296@opindex fpretty-templates 3297When an error message refers to a specialization of a function 3298template, the compiler normally prints the signature of the 3299template followed by the template arguments and any typedefs or 3300typenames in the signature (e.g.@: @code{void f(T) [with T = int]} 3301rather than @code{void f(int)}) so that it's clear which template is 3302involved. When an error message refers to a specialization of a class 3303template, the compiler omits any template arguments that match 3304the default template arguments for that template. If either of these 3305behaviors make it harder to understand the error message rather than 3306easier, you can use @option{-fno-pretty-templates} to disable them. 3307 3308@item -fno-rtti 3309@opindex fno-rtti 3310@opindex frtti 3311Disable generation of information about every class with virtual 3312functions for use by the C++ run-time type identification features 3313(@code{dynamic_cast} and @code{typeid}). If you don't use those parts 3314of the language, you can save some space by using this flag. Note that 3315exception handling uses the same information, but G++ generates it as 3316needed. The @code{dynamic_cast} operator can still be used for casts that 3317do not require run-time type information, i.e.@: casts to @code{void *} or to 3318unambiguous base classes. 3319 3320Mixing code compiled with @option{-frtti} with that compiled with 3321@option{-fno-rtti} may not work. For example, programs may 3322fail to link if a class compiled with @option{-fno-rtti} is used as a base 3323for a class compiled with @option{-frtti}. 3324 3325@item -fsized-deallocation 3326@opindex fsized-deallocation 3327Enable the built-in global declarations 3328@smallexample 3329void operator delete (void *, std::size_t) noexcept; 3330void operator delete[] (void *, std::size_t) noexcept; 3331@end smallexample 3332as introduced in C++14. This is useful for user-defined replacement 3333deallocation functions that, for example, use the size of the object 3334to make deallocation faster. Enabled by default under 3335@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} 3336warns about places that might want to add a definition. 3337 3338@item -fstrict-enums 3339@opindex fstrict-enums 3340Allow the compiler to optimize using the assumption that a value of 3341enumerated type can only be one of the values of the enumeration (as 3342defined in the C++ standard; basically, a value that can be 3343represented in the minimum number of bits needed to represent all the 3344enumerators). This assumption may not be valid if the program uses a 3345cast to convert an arbitrary integer value to the enumerated type. 3346 3347@item -fstrong-eval-order 3348@opindex fstrong-eval-order 3349Evaluate member access, array subscripting, and shift expressions in 3350left-to-right order, and evaluate assignment in right-to-left order, 3351as adopted for C++17. Enabled by default with @option{-std=c++17}. 3352@option{-fstrong-eval-order=some} enables just the ordering of member 3353access and shift expressions, and is the default without 3354@option{-std=c++17}. 3355 3356@item -ftemplate-backtrace-limit=@var{n} 3357@opindex ftemplate-backtrace-limit 3358Set the maximum number of template instantiation notes for a single 3359warning or error to @var{n}. The default value is 10. 3360 3361@item -ftemplate-depth=@var{n} 3362@opindex ftemplate-depth 3363Set the maximum instantiation depth for template classes to @var{n}. 3364A limit on the template instantiation depth is needed to detect 3365endless recursions during template class instantiation. ANSI/ISO C++ 3366conforming programs must not rely on a maximum depth greater than 17 3367(changed to 1024 in C++11). The default value is 900, as the compiler 3368can run out of stack space before hitting 1024 in some situations. 3369 3370@item -fno-threadsafe-statics 3371@opindex fno-threadsafe-statics 3372@opindex fthreadsafe-statics 3373Do not emit the extra code to use the routines specified in the C++ 3374ABI for thread-safe initialization of local statics. You can use this 3375option to reduce code size slightly in code that doesn't need to be 3376thread-safe. 3377 3378@item -fuse-cxa-atexit 3379@opindex fuse-cxa-atexit 3380Register destructors for objects with static storage duration with the 3381@code{__cxa_atexit} function rather than the @code{atexit} function. 3382This option is required for fully standards-compliant handling of static 3383destructors, but only works if your C library supports 3384@code{__cxa_atexit}. 3385 3386@item -fno-use-cxa-get-exception-ptr 3387@opindex fno-use-cxa-get-exception-ptr 3388@opindex fuse-cxa-get-exception-ptr 3389Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 3390causes @code{std::uncaught_exception} to be incorrect, but is necessary 3391if the runtime routine is not available. 3392 3393@item -fvisibility-inlines-hidden 3394@opindex fvisibility-inlines-hidden 3395This switch declares that the user does not attempt to compare 3396pointers to inline functions or methods where the addresses of the two functions 3397are taken in different shared objects. 3398 3399The effect of this is that GCC may, effectively, mark inline methods with 3400@code{__attribute__ ((visibility ("hidden")))} so that they do not 3401appear in the export table of a DSO and do not require a PLT indirection 3402when used within the DSO@. Enabling this option can have a dramatic effect 3403on load and link times of a DSO as it massively reduces the size of the 3404dynamic export table when the library makes heavy use of templates. 3405 3406The behavior of this switch is not quite the same as marking the 3407methods as hidden directly, because it does not affect static variables 3408local to the function or cause the compiler to deduce that 3409the function is defined in only one shared object. 3410 3411You may mark a method as having a visibility explicitly to negate the 3412effect of the switch for that method. For example, if you do want to 3413compare pointers to a particular inline method, you might mark it as 3414having default visibility. Marking the enclosing class with explicit 3415visibility has no effect. 3416 3417Explicitly instantiated inline methods are unaffected by this option 3418as their linkage might otherwise cross a shared library boundary. 3419@xref{Template Instantiation}. 3420 3421@item -fvisibility-ms-compat 3422@opindex fvisibility-ms-compat 3423This flag attempts to use visibility settings to make GCC's C++ 3424linkage model compatible with that of Microsoft Visual Studio. 3425 3426The flag makes these changes to GCC's linkage model: 3427 3428@enumerate 3429@item 3430It sets the default visibility to @code{hidden}, like 3431@option{-fvisibility=hidden}. 3432 3433@item 3434Types, but not their members, are not hidden by default. 3435 3436@item 3437The One Definition Rule is relaxed for types without explicit 3438visibility specifications that are defined in more than one 3439shared object: those declarations are permitted if they are 3440permitted when this option is not used. 3441@end enumerate 3442 3443In new code it is better to use @option{-fvisibility=hidden} and 3444export those classes that are intended to be externally visible. 3445Unfortunately it is possible for code to rely, perhaps accidentally, 3446on the Visual Studio behavior. 3447 3448Among the consequences of these changes are that static data members 3449of the same type with the same name but defined in different shared 3450objects are different, so changing one does not change the other; 3451and that pointers to function members defined in different shared 3452objects may not compare equal. When this flag is given, it is a 3453violation of the ODR to define types with the same name differently. 3454 3455@item -fno-weak 3456@opindex fno-weak 3457@opindex fweak 3458Do not use weak symbol support, even if it is provided by the linker. 3459By default, G++ uses weak symbols if they are available. This 3460option exists only for testing, and should not be used by end-users; 3461it results in inferior code and has no benefits. This option may 3462be removed in a future release of G++. 3463 3464@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 3465@opindex fext-numeric-literals 3466@opindex fno-ext-numeric-literals 3467Accept imaginary, fixed-point, or machine-defined 3468literal number suffixes as GNU extensions. 3469When this option is turned off these suffixes are treated 3470as C++11 user-defined literal numeric suffixes. 3471This is on by default for all pre-C++11 dialects and all GNU dialects: 3472@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 3473@option{-std=gnu++14}. 3474This option is off by default 3475for ISO C++11 onwards (@option{-std=c++11}, ...). 3476 3477@item -nostdinc++ 3478@opindex nostdinc++ 3479Do not search for header files in the standard directories specific to 3480C++, but do still search the other standard directories. (This option 3481is used when building the C++ library.) 3482 3483@item -flang-info-include-translate 3484@itemx -flang-info-include-translate-not 3485@itemx -flang-info-include-translate=@var{header} 3486@opindex flang-info-include-translate 3487@opindex flang-info-include-translate-not 3488Inform of include translation events. The first will note accepted 3489include translations, the second will note declined include 3490translations. The @var{header} form will inform of include 3491translations relating to that specific header. If @var{header} is of 3492the form @code{"user"} or @code{<system>} it will be resolved to a 3493specific user or system header using the include path. 3494 3495@item -flang-info-module-cmi 3496@itemx -flang-info-module-cmi=@var{module} 3497@opindex flang-info-module-cmi 3498Inform of Compiled Module Interface pathnames. The first will note 3499all read CMI pathnames. The @var{module} form will not reading a 3500specific module's CMI. @var{module} may be a named module or a 3501header-unit (the latter indicated by either being a pathname containing 3502directory separators or enclosed in @code{<>} or @code{""}). 3503 3504@item -stdlib=@var{libstdc++,libc++} 3505@opindex stdlib 3506When G++ is configured to support this option, it allows specification of 3507alternate C++ runtime libraries. Two options are available: @var{libstdc++} 3508(the default, native C++ runtime for G++) and @var{libc++} which is the 3509C++ runtime installed on some operating systems (e.g. Darwin versions from 3510Darwin11 onwards). The option switches G++ to use the headers from the 3511specified library and to emit @code{-lstdc++} or @code{-lc++} respectively, 3512when a C++ runtime is required for linking. 3513@end table 3514 3515In addition, these warning options have meanings only for C++ programs: 3516 3517@table @gcctabopt 3518@item -Wabi-tag @r{(C++ and Objective-C++ only)} 3519@opindex Wabi-tag 3520Warn when a type with an ABI tag is used in a context that does not 3521have that ABI tag. See @ref{C++ Attributes} for more information 3522about ABI tags. 3523 3524@item -Wcomma-subscript @r{(C++ and Objective-C++ only)} 3525@opindex Wcomma-subscript 3526@opindex Wno-comma-subscript 3527Warn about uses of a comma expression within a subscripting expression. 3528This usage was deprecated in C++20 and is going to be removed in C++23. 3529However, a comma expression wrapped in @code{( )} is not deprecated. Example: 3530 3531@smallexample 3532@group 3533void f(int *a, int b, int c) @{ 3534 a[b,c]; // deprecated in C++20, invalid in C++23 3535 a[(b,c)]; // OK 3536@} 3537@end group 3538@end smallexample 3539 3540In C++23 it is valid to have comma separated expressions in a subscript 3541when an overloaded subscript operator is found and supports the right 3542number and types of arguments. G++ will accept the formerly valid syntax 3543for code that is not valid in C++23 but used to be valid but deprecated 3544in C++20 with a pedantic warning that can be disabled with 3545@option{-Wno-comma-subscript}. 3546 3547Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated}, 3548and with @option{-std=c++23} regardless of @option{-Wno-deprecated}. 3549 3550@item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)} 3551@opindex Wctad-maybe-unsupported 3552@opindex Wno-ctad-maybe-unsupported 3553Warn when performing class template argument deduction (CTAD) on a type with 3554no explicitly written deduction guides. This warning will point out cases 3555where CTAD succeeded only because the compiler synthesized the implicit 3556deduction guides, which might not be what the programmer intended. Certain 3557style guides allow CTAD only on types that specifically "opt-in"; i.e., on 3558types that are designed to support CTAD. This warning can be suppressed with 3559the following pattern: 3560 3561@smallexample 3562struct allow_ctad_t; // any name works 3563template <typename T> struct S @{ 3564 S(T) @{ @} 3565@}; 3566S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered 3567@end smallexample 3568 3569@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 3570@opindex Wctor-dtor-privacy 3571@opindex Wno-ctor-dtor-privacy 3572Warn when a class seems unusable because all the constructors or 3573destructors in that class are private, and it has neither friends nor 3574public static member functions. Also warn if there are no non-private 3575methods, and there's at least one private member function that isn't 3576a constructor or destructor. 3577 3578@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 3579@opindex Wdelete-non-virtual-dtor 3580@opindex Wno-delete-non-virtual-dtor 3581Warn when @code{delete} is used to destroy an instance of a class that 3582has virtual functions and non-virtual destructor. It is unsafe to delete 3583an instance of a derived class through a pointer to a base class if the 3584base class does not have a virtual destructor. This warning is enabled 3585by @option{-Wall}. 3586 3587@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)} 3588@opindex Wdeprecated-copy 3589@opindex Wno-deprecated-copy 3590Warn that the implicit declaration of a copy constructor or copy 3591assignment operator is deprecated if the class has a user-provided 3592copy constructor or copy assignment operator, in C++11 and up. This 3593warning is enabled by @option{-Wextra}. With 3594@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a 3595user-provided destructor. 3596 3597@item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)} 3598@opindex Wdeprecated-enum-enum-conversion 3599@opindex Wno-deprecated-enum-enum-conversion 3600Disable the warning about the case when the usual arithmetic conversions 3601are applied on operands where one is of enumeration type and the other is 3602of a different enumeration type. This conversion was deprecated in C++20. 3603For example: 3604 3605@smallexample 3606enum E1 @{ e @}; 3607enum E2 @{ f @}; 3608int k = f - e; 3609@end smallexample 3610 3611@option{-Wdeprecated-enum-enum-conversion} is enabled by default with 3612@option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled 3613by @option{-Wenum-conversion}. 3614 3615@item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)} 3616@opindex Wdeprecated-enum-float-conversion 3617@opindex Wno-deprecated-enum-float-conversion 3618Disable the warning about the case when the usual arithmetic conversions 3619are applied on operands where one is of enumeration type and the other is 3620of a floating-point type. This conversion was deprecated in C++20. For 3621example: 3622 3623@smallexample 3624enum E1 @{ e @}; 3625enum E2 @{ f @}; 3626bool b = e <= 3.7; 3627@end smallexample 3628 3629@option{-Wdeprecated-enum-float-conversion} is enabled by default with 3630@option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled 3631by @option{-Wenum-conversion}. 3632 3633@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)} 3634@opindex Winit-list-lifetime 3635@opindex Wno-init-list-lifetime 3636Do not warn about uses of @code{std::initializer_list} that are likely 3637to result in dangling pointers. Since the underlying array for an 3638@code{initializer_list} is handled like a normal C++ temporary object, 3639it is easy to inadvertently keep a pointer to the array past the end 3640of the array's lifetime. For example: 3641 3642@itemize @bullet 3643@item 3644If a function returns a temporary @code{initializer_list}, or a local 3645@code{initializer_list} variable, the array's lifetime ends at the end 3646of the return statement, so the value returned has a dangling pointer. 3647 3648@item 3649If a new-expression creates an @code{initializer_list}, the array only 3650lives until the end of the enclosing full-expression, so the 3651@code{initializer_list} in the heap has a dangling pointer. 3652 3653@item 3654When an @code{initializer_list} variable is assigned from a 3655brace-enclosed initializer list, the temporary array created for the 3656right side of the assignment only lives until the end of the 3657full-expression, so at the next statement the @code{initializer_list} 3658variable has a dangling pointer. 3659 3660@smallexample 3661// li's initial underlying array lives as long as li 3662std::initializer_list<int> li = @{ 1,2,3 @}; 3663// assignment changes li to point to a temporary array 3664li = @{ 4, 5 @}; 3665// now the temporary is gone and li has a dangling pointer 3666int i = li.begin()[0] // undefined behavior 3667@end smallexample 3668 3669@item 3670When a list constructor stores the @code{begin} pointer from the 3671@code{initializer_list} argument, this doesn't extend the lifetime of 3672the array, so if a class variable is constructed from a temporary 3673@code{initializer_list}, the pointer is left dangling by the end of 3674the variable declaration statement. 3675 3676@end itemize 3677 3678@item -Winvalid-imported-macros 3679@opindex Winvalid-imported-macros 3680@opindex Wno-invalid-imported-macros 3681Verify all imported macro definitions are valid at the end of 3682compilation. This is not enabled by default, as it requires 3683additional processing to determine. It may be useful when preparing 3684sets of header-units to ensure consistent macros. 3685 3686@item -Wno-literal-suffix @r{(C++ and Objective-C++ only)} 3687@opindex Wliteral-suffix 3688@opindex Wno-literal-suffix 3689Do not warn when a string or character literal is followed by a 3690ud-suffix which does not begin with an underscore. As a conforming 3691extension, GCC treats such suffixes as separate preprocessing tokens 3692in order to maintain backwards compatibility with code that uses 3693formatting macros from @code{<inttypes.h>}. For example: 3694 3695@smallexample 3696#define __STDC_FORMAT_MACROS 3697#include <inttypes.h> 3698#include <stdio.h> 3699 3700int main() @{ 3701 int64_t i64 = 123; 3702 printf("My int64: %" PRId64"\n", i64); 3703@} 3704@end smallexample 3705 3706In this case, @code{PRId64} is treated as a separate preprocessing token. 3707 3708This option also controls warnings when a user-defined literal 3709operator is declared with a literal suffix identifier that doesn't 3710begin with an underscore. Literal suffix identifiers that don't begin 3711with an underscore are reserved for future standardization. 3712 3713These warnings are enabled by default. 3714 3715@item -Wno-narrowing @r{(C++ and Objective-C++ only)} 3716@opindex Wnarrowing 3717@opindex Wno-narrowing 3718For C++11 and later standards, narrowing conversions are diagnosed by default, 3719as required by the standard. A narrowing conversion from a constant produces 3720an error, and a narrowing conversion from a non-constant produces a warning, 3721but @option{-Wno-narrowing} suppresses the diagnostic. 3722Note that this does not affect the meaning of well-formed code; 3723narrowing conversions are still considered ill-formed in SFINAE contexts. 3724 3725With @option{-Wnarrowing} in C++98, warn when a narrowing 3726conversion prohibited by C++11 occurs within 3727@samp{@{ @}}, e.g. 3728 3729@smallexample 3730int i = @{ 2.2 @}; // error: narrowing from double to int 3731@end smallexample 3732 3733This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 3734 3735@item -Wnoexcept @r{(C++ and Objective-C++ only)} 3736@opindex Wnoexcept 3737@opindex Wno-noexcept 3738Warn when a noexcept-expression evaluates to false because of a call 3739to a function that does not have a non-throwing exception 3740specification (i.e. @code{throw()} or @code{noexcept}) but is known by 3741the compiler to never throw an exception. 3742 3743@item -Wnoexcept-type @r{(C++ and Objective-C++ only)} 3744@opindex Wnoexcept-type 3745@opindex Wno-noexcept-type 3746Warn if the C++17 feature making @code{noexcept} part of a function 3747type changes the mangled name of a symbol relative to C++14. Enabled 3748by @option{-Wabi} and @option{-Wc++17-compat}. 3749 3750As an example: 3751 3752@smallexample 3753template <class T> void f(T t) @{ t(); @}; 3754void g() noexcept; 3755void h() @{ f(g); @} 3756@end smallexample 3757 3758@noindent 3759In C++14, @code{f} calls @code{f<void(*)()>}, but in 3760C++17 it calls @code{f<void(*)()noexcept>}. 3761 3762@item -Wclass-memaccess @r{(C++ and Objective-C++ only)} 3763@opindex Wclass-memaccess 3764@opindex Wno-class-memaccess 3765Warn when the destination of a call to a raw memory function such as 3766@code{memset} or @code{memcpy} is an object of class type, and when writing 3767into such an object might bypass the class non-trivial or deleted constructor 3768or copy assignment, violate const-correctness or encapsulation, or corrupt 3769virtual table pointers. Modifying the representation of such objects may 3770violate invariants maintained by member functions of the class. For example, 3771the call to @code{memset} below is undefined because it modifies a non-trivial 3772class object and is, therefore, diagnosed. The safe way to either initialize 3773or clear the storage of objects of such types is by using the appropriate 3774constructor or assignment operator, if one is available. 3775@smallexample 3776std::string str = "abc"; 3777memset (&str, 0, sizeof str); 3778@end smallexample 3779The @option{-Wclass-memaccess} option is enabled by @option{-Wall}. 3780Explicitly casting the pointer to the class object to @code{void *} or 3781to a type that can be safely accessed by the raw memory function suppresses 3782the warning. 3783 3784@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 3785@opindex Wnon-virtual-dtor 3786@opindex Wno-non-virtual-dtor 3787Warn when a class has virtual functions and an accessible non-virtual 3788destructor itself or in an accessible polymorphic base class, in which 3789case it is possible but unsafe to delete an instance of a derived 3790class through a pointer to the class itself or base class. This 3791warning is automatically enabled if @option{-Weffc++} is specified. 3792 3793@item -Wregister @r{(C++ and Objective-C++ only)} 3794@opindex Wregister 3795@opindex Wno-register 3796Warn on uses of the @code{register} storage class specifier, except 3797when it is part of the GNU @ref{Explicit Register Variables} extension. 3798The use of the @code{register} keyword as storage class specifier has 3799been deprecated in C++11 and removed in C++17. 3800Enabled by default with @option{-std=c++17}. 3801 3802@item -Wreorder @r{(C++ and Objective-C++ only)} 3803@opindex Wreorder 3804@opindex Wno-reorder 3805@cindex reordering, warning 3806@cindex warning for reordering of member initializers 3807Warn when the order of member initializers given in the code does not 3808match the order in which they must be executed. For instance: 3809 3810@smallexample 3811struct A @{ 3812 int i; 3813 int j; 3814 A(): j (0), i (1) @{ @} 3815@}; 3816@end smallexample 3817 3818@noindent 3819The compiler rearranges the member initializers for @code{i} 3820and @code{j} to match the declaration order of the members, emitting 3821a warning to that effect. This warning is enabled by @option{-Wall}. 3822 3823@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)} 3824@opindex Wpessimizing-move 3825@opindex Wno-pessimizing-move 3826This warning warns when a call to @code{std::move} prevents copy 3827elision. A typical scenario when copy elision can occur is when returning in 3828a function with a class return type, when the expression being returned is the 3829name of a non-volatile automatic object, and is not a function parameter, and 3830has the same type as the function return type. 3831 3832@smallexample 3833struct T @{ 3834@dots{} 3835@}; 3836T fn() 3837@{ 3838 T t; 3839 @dots{} 3840 return std::move (t); 3841@} 3842@end smallexample 3843 3844But in this example, the @code{std::move} call prevents copy elision. 3845 3846This warning is enabled by @option{-Wall}. 3847 3848@item -Wno-redundant-move @r{(C++ and Objective-C++ only)} 3849@opindex Wredundant-move 3850@opindex Wno-redundant-move 3851This warning warns about redundant calls to @code{std::move}; that is, when 3852a move operation would have been performed even without the @code{std::move} 3853call. This happens because the compiler is forced to treat the object as if 3854it were an rvalue in certain situations such as returning a local variable, 3855where copy elision isn't applicable. Consider: 3856 3857@smallexample 3858struct T @{ 3859@dots{} 3860@}; 3861T fn(T t) 3862@{ 3863 @dots{} 3864 return std::move (t); 3865@} 3866@end smallexample 3867 3868Here, the @code{std::move} call is redundant. Because G++ implements Core 3869Issue 1579, another example is: 3870 3871@smallexample 3872struct T @{ // convertible to U 3873@dots{} 3874@}; 3875struct U @{ 3876@dots{} 3877@}; 3878U fn() 3879@{ 3880 T t; 3881 @dots{} 3882 return std::move (t); 3883@} 3884@end smallexample 3885In this example, copy elision isn't applicable because the type of the 3886expression being returned and the function return type differ, yet G++ 3887treats the return value as if it were designated by an rvalue. 3888 3889This warning is enabled by @option{-Wextra}. 3890 3891@item -Wrange-loop-construct @r{(C++ and Objective-C++ only)} 3892@opindex Wrange-loop-construct 3893@opindex Wno-range-loop-construct 3894This warning warns when a C++ range-based for-loop is creating an unnecessary 3895copy. This can happen when the range declaration is not a reference, but 3896probably should be. For example: 3897 3898@smallexample 3899struct S @{ char arr[128]; @}; 3900void fn () @{ 3901 S arr[5]; 3902 for (const auto x : arr) @{ @dots{} @} 3903@} 3904@end smallexample 3905 3906It does not warn when the type being copied is a trivially-copyable type whose 3907size is less than 64 bytes. 3908 3909This warning also warns when a loop variable in a range-based for-loop is 3910initialized with a value of a different type resulting in a copy. For example: 3911 3912@smallexample 3913void fn() @{ 3914 int arr[10]; 3915 for (const double &x : arr) @{ @dots{} @} 3916@} 3917@end smallexample 3918 3919In the example above, in every iteration of the loop a temporary value of 3920type @code{double} is created and destroyed, to which the reference 3921@code{const double &} is bound. 3922 3923This warning is enabled by @option{-Wall}. 3924 3925@item -Wredundant-tags @r{(C++ and Objective-C++ only)} 3926@opindex Wredundant-tags 3927@opindex Wno-redundant-tags 3928Warn about redundant class-key and enum-key in references to class types 3929and enumerated types in contexts where the key can be eliminated without 3930causing an ambiguity. For example: 3931 3932@smallexample 3933struct foo; 3934struct foo *p; // warn that keyword struct can be eliminated 3935@end smallexample 3936 3937@noindent 3938On the other hand, in this example there is no warning: 3939 3940@smallexample 3941struct foo; 3942void foo (); // "hides" struct foo 3943void bar (struct foo&); // no warning, keyword struct is necessary 3944@end smallexample 3945 3946@item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)} 3947@opindex Wsubobject-linkage 3948@opindex Wno-subobject-linkage 3949Do not warn 3950if a class type has a base or a field whose type uses the anonymous 3951namespace or depends on a type with no linkage. If a type A depends on 3952a type B with no or internal linkage, defining it in multiple 3953translation units would be an ODR violation because the meaning of B 3954is different in each translation unit. If A only appears in a single 3955translation unit, the best way to silence the warning is to give it 3956internal linkage by putting it in an anonymous namespace as well. The 3957compiler doesn't give this warning for types defined in the main .C 3958file, as those are unlikely to have multiple definitions. 3959@option{-Wsubobject-linkage} is enabled by default. 3960 3961@item -Weffc++ @r{(C++ and Objective-C++ only)} 3962@opindex Weffc++ 3963@opindex Wno-effc++ 3964Warn about violations of the following style guidelines from Scott Meyers' 3965@cite{Effective C++} series of books: 3966 3967@itemize @bullet 3968@item 3969Define a copy constructor and an assignment operator for classes 3970with dynamically-allocated memory. 3971 3972@item 3973Prefer initialization to assignment in constructors. 3974 3975@item 3976Have @code{operator=} return a reference to @code{*this}. 3977 3978@item 3979Don't try to return a reference when you must return an object. 3980 3981@item 3982Distinguish between prefix and postfix forms of increment and 3983decrement operators. 3984 3985@item 3986Never overload @code{&&}, @code{||}, or @code{,}. 3987 3988@end itemize 3989 3990This option also enables @option{-Wnon-virtual-dtor}, which is also 3991one of the effective C++ recommendations. However, the check is 3992extended to warn about the lack of virtual destructor in accessible 3993non-polymorphic bases classes too. 3994 3995When selecting this option, be aware that the standard library 3996headers do not obey all of these guidelines; use @samp{grep -v} 3997to filter out those warnings. 3998 3999@item -Wno-exceptions @r{(C++ and Objective-C++ only)} 4000@opindex Wexceptions 4001@opindex Wno-exceptions 4002Disable the warning about the case when an exception handler is shadowed by 4003another handler, which can point out a wrong ordering of exception handlers. 4004 4005@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 4006@opindex Wstrict-null-sentinel 4007@opindex Wno-strict-null-sentinel 4008Warn about the use of an uncasted @code{NULL} as sentinel. When 4009compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 4010to @code{__null}. Although it is a null pointer constant rather than a 4011null pointer, it is guaranteed to be of the same size as a pointer. 4012But this use is not portable across different compilers. 4013 4014@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 4015@opindex Wno-non-template-friend 4016@opindex Wnon-template-friend 4017Disable warnings when non-template friend functions are declared 4018within a template. In very old versions of GCC that predate implementation 4019of the ISO standard, declarations such as 4020@samp{friend int foo(int)}, where the name of the friend is an unqualified-id, 4021could be interpreted as a particular specialization of a template 4022function; the warning exists to diagnose compatibility problems, 4023and is enabled by default. 4024 4025@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 4026@opindex Wold-style-cast 4027@opindex Wno-old-style-cast 4028Warn if an old-style (C-style) cast to a non-void type is used within 4029a C++ program. The new-style casts (@code{dynamic_cast}, 4030@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are 4031less vulnerable to unintended effects and much easier to search for. 4032 4033@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 4034@opindex Woverloaded-virtual 4035@opindex Wno-overloaded-virtual 4036@cindex overloaded virtual function, warning 4037@cindex warning for overloaded virtual function 4038Warn when a function declaration hides virtual functions from a 4039base class. For example, in: 4040 4041@smallexample 4042struct A @{ 4043 virtual void f(); 4044@}; 4045 4046struct B: public A @{ 4047 void f(int); 4048@}; 4049@end smallexample 4050 4051the @code{A} class version of @code{f} is hidden in @code{B}, and code 4052like: 4053 4054@smallexample 4055B* b; 4056b->f(); 4057@end smallexample 4058 4059@noindent 4060fails to compile. 4061 4062@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 4063@opindex Wno-pmf-conversions 4064@opindex Wpmf-conversions 4065Disable the diagnostic for converting a bound pointer to member function 4066to a plain pointer. 4067 4068@item -Wsign-promo @r{(C++ and Objective-C++ only)} 4069@opindex Wsign-promo 4070@opindex Wno-sign-promo 4071Warn when overload resolution chooses a promotion from unsigned or 4072enumerated type to a signed type, over a conversion to an unsigned type of 4073the same size. Previous versions of G++ tried to preserve 4074unsignedness, but the standard mandates the current behavior. 4075 4076@item -Wtemplates @r{(C++ and Objective-C++ only)} 4077@opindex Wtemplates 4078@opindex Wno-templates 4079Warn when a primary template declaration is encountered. Some coding 4080rules disallow templates, and this may be used to enforce that rule. 4081The warning is inactive inside a system header file, such as the STL, so 4082one can still use the STL. One may also instantiate or specialize 4083templates. 4084 4085@item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)} 4086@opindex Wmismatched-new-delete 4087@opindex Wno-mismatched-new-delete 4088Warn for mismatches between calls to @code{operator new} or @code{operator 4089delete} and the corresponding call to the allocation or deallocation function. 4090This includes invocations of C++ @code{operator delete} with pointers 4091returned from either mismatched forms of @code{operator new}, or from other 4092functions that allocate objects for which the @code{operator delete} isn't 4093a suitable deallocator, as well as calls to other deallocation functions 4094with pointers returned from @code{operator new} for which the deallocation 4095function isn't suitable. 4096 4097For example, the @code{delete} expression in the function below is diagnosed 4098because it doesn't match the array form of the @code{new} expression 4099the pointer argument was returned from. Similarly, the call to @code{free} 4100is also diagnosed. 4101 4102@smallexample 4103void f () 4104@{ 4105 int *a = new int[n]; 4106 delete a; // warning: mismatch in array forms of expressions 4107 4108 char *p = new char[n]; 4109 free (p); // warning: mismatch between new and free 4110@} 4111@end smallexample 4112 4113The related option @option{-Wmismatched-dealloc} diagnoses mismatches 4114involving allocation and deallocation functions other than @code{operator 4115new} and @code{operator delete}. 4116 4117@option{-Wmismatched-new-delete} is included in @option{-Wall}. 4118 4119@item -Wmismatched-tags @r{(C++ and Objective-C++ only)} 4120@opindex Wmismatched-tags 4121@opindex Wno-mismatched-tags 4122Warn for declarations of structs, classes, and class templates and their 4123specializations with a class-key that does not match either the definition 4124or the first declaration if no definition is provided. 4125 4126For example, the declaration of @code{struct Object} in the argument list 4127of @code{draw} triggers the warning. To avoid it, either remove the redundant 4128class-key @code{struct} or replace it with @code{class} to match its definition. 4129@smallexample 4130class Object @{ 4131public: 4132 virtual ~Object () = 0; 4133@}; 4134void draw (struct Object*); 4135@end smallexample 4136 4137It is not wrong to declare a class with the class-key @code{struct} as 4138the example above shows. The @option{-Wmismatched-tags} option is intended 4139to help achieve a consistent style of class declarations. In code that is 4140intended to be portable to Windows-based compilers the warning helps prevent 4141unresolved references due to the difference in the mangling of symbols 4142declared with different class-keys. The option can be used either on its 4143own or in conjunction with @option{-Wredundant-tags}. 4144 4145@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)} 4146@opindex Wmultiple-inheritance 4147@opindex Wno-multiple-inheritance 4148Warn when a class is defined with multiple direct base classes. Some 4149coding rules disallow multiple inheritance, and this may be used to 4150enforce that rule. The warning is inactive inside a system header file, 4151such as the STL, so one can still use the STL. One may also define 4152classes that indirectly use multiple inheritance. 4153 4154@item -Wvirtual-inheritance 4155@opindex Wvirtual-inheritance 4156@opindex Wno-virtual-inheritance 4157Warn when a class is defined with a virtual direct base class. Some 4158coding rules disallow multiple inheritance, and this may be used to 4159enforce that rule. The warning is inactive inside a system header file, 4160such as the STL, so one can still use the STL. One may also define 4161classes that indirectly use virtual inheritance. 4162 4163@item -Wno-virtual-move-assign 4164@opindex Wvirtual-move-assign 4165@opindex Wno-virtual-move-assign 4166Suppress warnings about inheriting from a virtual base with a 4167non-trivial C++11 move assignment operator. This is dangerous because 4168if the virtual base is reachable along more than one path, it is 4169moved multiple times, which can mean both objects end up in the 4170moved-from state. If the move assignment operator is written to avoid 4171moving from a moved-from object, this warning can be disabled. 4172 4173@item -Wnamespaces 4174@opindex Wnamespaces 4175@opindex Wno-namespaces 4176Warn when a namespace definition is opened. Some coding rules disallow 4177namespaces, and this may be used to enforce that rule. The warning is 4178inactive inside a system header file, such as the STL, so one can still 4179use the STL. One may also use using directives and qualified names. 4180 4181@item -Wno-terminate @r{(C++ and Objective-C++ only)} 4182@opindex Wterminate 4183@opindex Wno-terminate 4184Disable the warning about a throw-expression that will immediately 4185result in a call to @code{terminate}. 4186 4187@item -Wno-vexing-parse @r{(C++ and Objective-C++ only)} 4188@opindex Wvexing-parse 4189@opindex Wno-vexing-parse 4190Warn about the most vexing parse syntactic ambiguity. This warns about 4191the cases when a declaration looks like a variable definition, but the 4192C++ language requires it to be interpreted as a function declaration. 4193For instance: 4194 4195@smallexample 4196void f(double a) @{ 4197 int i(); // extern int i (void); 4198 int n(int(a)); // extern int n (int); 4199@} 4200@end smallexample 4201 4202Another example: 4203 4204@smallexample 4205struct S @{ S(int); @}; 4206void f(double a) @{ 4207 S x(int(a)); // extern struct S x (int); 4208 S y(int()); // extern struct S y (int (*) (void)); 4209 S z(); // extern struct S z (void); 4210@} 4211@end smallexample 4212 4213The warning will suggest options how to deal with such an ambiguity; e.g., 4214it can suggest removing the parentheses or using braces instead. 4215 4216This warning is enabled by default. 4217 4218@item -Wno-class-conversion @r{(C++ and Objective-C++ only)} 4219@opindex Wno-class-conversion 4220@opindex Wclass-conversion 4221Do not warn when a conversion function converts an 4222object to the same type, to a base class of that type, or to void; such 4223a conversion function will never be called. 4224 4225@item -Wvolatile @r{(C++ and Objective-C++ only)} 4226@opindex Wvolatile 4227@opindex Wno-volatile 4228Warn about deprecated uses of the @code{volatile} qualifier. This includes 4229postfix and prefix @code{++} and @code{--} expressions of 4230@code{volatile}-qualified types, using simple assignments where the left 4231operand is a @code{volatile}-qualified non-class type for their value, 4232compound assignments where the left operand is a @code{volatile}-qualified 4233non-class type, @code{volatile}-qualified function return type, 4234@code{volatile}-qualified parameter type, and structured bindings of a 4235@code{volatile}-qualified type. This usage was deprecated in C++20. 4236 4237Enabled by default with @option{-std=c++20}. 4238 4239@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 4240@opindex Wzero-as-null-pointer-constant 4241@opindex Wno-zero-as-null-pointer-constant 4242Warn when a literal @samp{0} is used as null pointer constant. This can 4243be useful to facilitate the conversion to @code{nullptr} in C++11. 4244 4245@item -Waligned-new 4246@opindex Waligned-new 4247@opindex Wno-aligned-new 4248Warn about a new-expression of a type that requires greater alignment 4249than the @code{alignof(std::max_align_t)} but uses an allocation 4250function without an explicit alignment parameter. This option is 4251enabled by @option{-Wall}. 4252 4253Normally this only warns about global allocation functions, but 4254@option{-Waligned-new=all} also warns about class member allocation 4255functions. 4256 4257@item -Wno-placement-new 4258@itemx -Wplacement-new=@var{n} 4259@opindex Wplacement-new 4260@opindex Wno-placement-new 4261Warn about placement new expressions with undefined behavior, such as 4262constructing an object in a buffer that is smaller than the type of 4263the object. For example, the placement new expression below is diagnosed 4264because it attempts to construct an array of 64 integers in a buffer only 426564 bytes large. 4266@smallexample 4267char buf [64]; 4268new (buf) int[64]; 4269@end smallexample 4270This warning is enabled by default. 4271 4272@table @gcctabopt 4273@item -Wplacement-new=1 4274This is the default warning level of @option{-Wplacement-new}. At this 4275level the warning is not issued for some strictly undefined constructs that 4276GCC allows as extensions for compatibility with legacy code. For example, 4277the following @code{new} expression is not diagnosed at this level even 4278though it has undefined behavior according to the C++ standard because 4279it writes past the end of the one-element array. 4280@smallexample 4281struct S @{ int n, a[1]; @}; 4282S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]); 4283new (s->a)int [32](); 4284@end smallexample 4285 4286@item -Wplacement-new=2 4287At this level, in addition to diagnosing all the same constructs as at level 42881, a diagnostic is also issued for placement new expressions that construct 4289an object in the last member of structure whose type is an array of a single 4290element and whose size is less than the size of the object being constructed. 4291While the previous example would be diagnosed, the following construct makes 4292use of the flexible member array extension to avoid the warning at level 2. 4293@smallexample 4294struct S @{ int n, a[]; @}; 4295S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]); 4296new (s->a)int [32](); 4297@end smallexample 4298 4299@end table 4300 4301@item -Wcatch-value 4302@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)} 4303@opindex Wcatch-value 4304@opindex Wno-catch-value 4305Warn about catch handlers that do not catch via reference. 4306With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short) 4307warn about polymorphic class types that are caught by value. 4308With @option{-Wcatch-value=2} warn about all class types that are caught 4309by value. With @option{-Wcatch-value=3} warn about all types that are 4310not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}. 4311 4312@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 4313@opindex Wconditionally-supported 4314@opindex Wno-conditionally-supported 4315Warn for conditionally-supported (C++11 [intro.defs]) constructs. 4316 4317@item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)} 4318@opindex Wdelete-incomplete 4319@opindex Wno-delete-incomplete 4320Do not warn when deleting a pointer to incomplete type, which may cause 4321undefined behavior at runtime. This warning is enabled by default. 4322 4323@item -Wextra-semi @r{(C++, Objective-C++ only)} 4324@opindex Wextra-semi 4325@opindex Wno-extra-semi 4326Warn about redundant semicolons after in-class function definitions. 4327 4328@item -Wno-inaccessible-base @r{(C++, Objective-C++ only)} 4329@opindex Winaccessible-base 4330@opindex Wno-inaccessible-base 4331This option controls warnings 4332when a base class is inaccessible in a class derived from it due to 4333ambiguity. The warning is enabled by default. 4334Note that the warning for ambiguous virtual 4335bases is enabled by the @option{-Wextra} option. 4336@smallexample 4337@group 4338struct A @{ int a; @}; 4339 4340struct B : A @{ @}; 4341 4342struct C : B, A @{ @}; 4343@end group 4344@end smallexample 4345 4346@item -Wno-inherited-variadic-ctor 4347@opindex Winherited-variadic-ctor 4348@opindex Wno-inherited-variadic-ctor 4349Suppress warnings about use of C++11 inheriting constructors when the 4350base class inherited from has a C variadic constructor; the warning is 4351on by default because the ellipsis is not inherited. 4352 4353@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 4354@opindex Wno-invalid-offsetof 4355@opindex Winvalid-offsetof 4356Suppress warnings from applying the @code{offsetof} macro to a non-POD 4357type. According to the 2014 ISO C++ standard, applying @code{offsetof} 4358to a non-standard-layout type is undefined. In existing C++ implementations, 4359however, @code{offsetof} typically gives meaningful results. 4360This flag is for users who are aware that they are 4361writing nonportable code and who have deliberately chosen to ignore the 4362warning about it. 4363 4364The restrictions on @code{offsetof} may be relaxed in a future version 4365of the C++ standard. 4366 4367@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 4368@opindex Wsized-deallocation 4369@opindex Wno-sized-deallocation 4370Warn about a definition of an unsized deallocation function 4371@smallexample 4372void operator delete (void *) noexcept; 4373void operator delete[] (void *) noexcept; 4374@end smallexample 4375without a definition of the corresponding sized deallocation function 4376@smallexample 4377void operator delete (void *, std::size_t) noexcept; 4378void operator delete[] (void *, std::size_t) noexcept; 4379@end smallexample 4380or vice versa. Enabled by @option{-Wextra} along with 4381@option{-fsized-deallocation}. 4382 4383@item -Wsuggest-final-types 4384@opindex Wno-suggest-final-types 4385@opindex Wsuggest-final-types 4386Warn about types with virtual methods where code quality would be improved 4387if the type were declared with the C++11 @code{final} specifier, 4388or, if possible, 4389declared in an anonymous namespace. This allows GCC to more aggressively 4390devirtualize the polymorphic calls. This warning is more effective with 4391link-time optimization, 4392where the information about the class hierarchy graph is 4393more complete. 4394 4395@item -Wsuggest-final-methods 4396@opindex Wno-suggest-final-methods 4397@opindex Wsuggest-final-methods 4398Warn about virtual methods where code quality would be improved if the method 4399were declared with the C++11 @code{final} specifier, 4400or, if possible, its type were 4401declared in an anonymous namespace or with the @code{final} specifier. 4402This warning is 4403more effective with link-time optimization, where the information about the 4404class hierarchy graph is more complete. It is recommended to first consider 4405suggestions of @option{-Wsuggest-final-types} and then rebuild with new 4406annotations. 4407 4408@item -Wsuggest-override 4409@opindex Wsuggest-override 4410@opindex Wno-suggest-override 4411Warn about overriding virtual functions that are not marked with the 4412@code{override} keyword. 4413 4414@item -Wuse-after-free 4415@itemx -Wuse-after-free=@var{n} 4416@opindex Wuse-after-free 4417@opindex Wno-use-after-free 4418Warn about uses of pointers to dynamically allocated objects that have 4419been rendered indeterminate by a call to a deallocation function. 4420The warning is enabled at all optimization levels but may yield different 4421results with optimization than without. 4422 4423@table @gcctabopt 4424@item -Wuse-after-free=1 4425At level 1 the warning attempts to diagnose only unconditional uses 4426of pointers made indeterminate by a deallocation call or a successful 4427call to @code{realloc}, regardless of whether or not the call resulted 4428in an actual reallocatio of memory. This includes double-@code{free} 4429calls as well as uses in arithmetic and relational expressions. Although 4430undefined, uses of indeterminate pointers in equality (or inequality) 4431expressions are not diagnosed at this level. 4432@item -Wuse-after-free=2 4433At level 2, in addition to unconditional uses, the warning also diagnoses 4434conditional uses of pointers made indeterminate by a deallocation call. 4435As at level 2, uses in equality (or inequality) expressions are not 4436diagnosed. For example, the second call to @code{free} in the following 4437function is diagnosed at this level: 4438@smallexample 4439struct A @{ int refcount; void *data; @}; 4440 4441void release (struct A *p) 4442@{ 4443 int refcount = --p->refcount; 4444 free (p); 4445 if (refcount == 0) 4446 free (p->data); // warning: p may be used after free 4447@} 4448@end smallexample 4449@item -Wuse-after-free=3 4450At level 3, the warning also diagnoses uses of indeterminate pointers in 4451equality expressions. All uses of indeterminate pointers are undefined 4452but equality tests sometimes appear after calls to @code{realloc} as 4453an attempt to determine whether the call resulted in relocating the object 4454to a different address. They are diagnosed at a separate level to aid 4455legacy code gradually transition to safe alternatives. For example, 4456the equality test in the function below is diagnosed at this level: 4457@smallexample 4458void adjust_pointers (int**, int); 4459 4460void grow (int **p, int n) 4461@{ 4462 int **q = (int**)realloc (p, n *= 2); 4463 if (q == p) 4464 return; 4465 adjust_pointers ((int**)q, n); 4466@} 4467@end smallexample 4468To avoid the warning at this level, store offsets into allocated memory 4469instead of pointers. This approach obviates needing to adjust the stored 4470pointers after reallocation. 4471@end table 4472 4473@option{-Wuse-after-free=2} is included in @option{-Wall}. 4474 4475@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 4476@opindex Wuseless-cast 4477@opindex Wno-useless-cast 4478Warn when an expression is casted to its own type. 4479 4480@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 4481@opindex Wconversion-null 4482@opindex Wno-conversion-null 4483Do not warn for conversions between @code{NULL} and non-pointer 4484types. @option{-Wconversion-null} is enabled by default. 4485 4486@end table 4487 4488@node Objective-C and Objective-C++ Dialect Options 4489@section Options Controlling Objective-C and Objective-C++ Dialects 4490 4491@cindex compiler options, Objective-C and Objective-C++ 4492@cindex Objective-C and Objective-C++ options, command-line 4493@cindex options, Objective-C and Objective-C++ 4494(NOTE: This manual does not describe the Objective-C and Objective-C++ 4495languages themselves. @xref{Standards,,Language Standards 4496Supported by GCC}, for references.) 4497 4498This section describes the command-line options that are only meaningful 4499for Objective-C and Objective-C++ programs. You can also use most of 4500the language-independent GNU compiler options. 4501For example, you might compile a file @file{some_class.m} like this: 4502 4503@smallexample 4504gcc -g -fgnu-runtime -O -c some_class.m 4505@end smallexample 4506 4507@noindent 4508In this example, @option{-fgnu-runtime} is an option meant only for 4509Objective-C and Objective-C++ programs; you can use the other options with 4510any language supported by GCC@. 4511 4512Note that since Objective-C is an extension of the C language, Objective-C 4513compilations may also use options specific to the C front-end (e.g., 4514@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 4515C++-specific options (e.g., @option{-Wabi}). 4516 4517Here is a list of options that are @emph{only} for compiling Objective-C 4518and Objective-C++ programs: 4519 4520@table @gcctabopt 4521@item -fconstant-string-class=@var{class-name} 4522@opindex fconstant-string-class 4523Use @var{class-name} as the name of the class to instantiate for each 4524literal string specified with the syntax @code{@@"@dots{}"}. The default 4525class name is @code{NXConstantString} if the GNU runtime is being used, and 4526@code{NSConstantString} if the NeXT runtime is being used (see below). On 4527Darwin (macOS, MacOS X) platforms, the @option{-fconstant-cfstrings} option, if 4528also present, overrides the @option{-fconstant-string-class} setting and cause 4529@code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings. 4530Note that @option{-fconstant-cfstrings} is an alias for the target-specific 4531@option{-mconstant-cfstrings} equivalent. 4532 4533@item -fgnu-runtime 4534@opindex fgnu-runtime 4535Generate object code compatible with the standard GNU Objective-C 4536runtime. This is the default for most types of systems. 4537 4538@item -fnext-runtime 4539@opindex fnext-runtime 4540Generate output compatible with the NeXT runtime. This is the default 4541for NeXT-based systems, including Darwin and Mac OS X@. The macro 4542@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 4543used. 4544 4545@item -fno-nil-receivers 4546@opindex fno-nil-receivers 4547@opindex fnil-receivers 4548Assume that all Objective-C message dispatches (@code{[receiver 4549message:arg]}) in this translation unit ensure that the receiver is 4550not @code{nil}. This allows for more efficient entry points in the 4551runtime to be used. This option is only available in conjunction with 4552the NeXT runtime and ABI version 0 or 1. 4553 4554@item -fobjc-abi-version=@var{n} 4555@opindex fobjc-abi-version 4556Use version @var{n} of the Objective-C ABI for the selected runtime. 4557This option is currently supported only for the NeXT runtime. In that 4558case, Version 0 is the traditional (32-bit) ABI without support for 4559properties and other Objective-C 2.0 additions. Version 1 is the 4560traditional (32-bit) ABI with support for properties and other 4561Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 4562nothing is specified, the default is Version 0 on 32-bit target 4563machines, and Version 2 on 64-bit target machines. 4564 4565@item -fobjc-call-cxx-cdtors 4566@opindex fobjc-call-cxx-cdtors 4567For each Objective-C class, check if any of its instance variables is a 4568C++ object with a non-trivial default constructor. If so, synthesize a 4569special @code{- (id) .cxx_construct} instance method which runs 4570non-trivial default constructors on any such instance variables, in order, 4571and then return @code{self}. Similarly, check if any instance variable 4572is a C++ object with a non-trivial destructor, and if so, synthesize a 4573special @code{- (void) .cxx_destruct} method which runs 4574all such default destructors, in reverse order. 4575 4576The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 4577methods thusly generated only operate on instance variables 4578declared in the current Objective-C class, and not those inherited 4579from superclasses. It is the responsibility of the Objective-C 4580runtime to invoke all such methods in an object's inheritance 4581hierarchy. The @code{- (id) .cxx_construct} methods are invoked 4582by the runtime immediately after a new object instance is allocated; 4583the @code{- (void) .cxx_destruct} methods are invoked immediately 4584before the runtime deallocates an object instance. 4585 4586As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 4587support for invoking the @code{- (id) .cxx_construct} and 4588@code{- (void) .cxx_destruct} methods. 4589 4590@item -fobjc-direct-dispatch 4591@opindex fobjc-direct-dispatch 4592Allow fast jumps to the message dispatcher. On Darwin this is 4593accomplished via the comm page. 4594 4595@item -fobjc-exceptions 4596@opindex fobjc-exceptions 4597Enable syntactic support for structured exception handling in 4598Objective-C, similar to what is offered by C++. This option 4599is required to use the Objective-C keywords @code{@@try}, 4600@code{@@throw}, @code{@@catch}, @code{@@finally} and 4601@code{@@synchronized}. This option is available with both the GNU 4602runtime and the NeXT runtime (but not available in conjunction with 4603the NeXT runtime on Mac OS X 10.2 and earlier). 4604 4605@item -fobjc-gc 4606@opindex fobjc-gc 4607Enable garbage collection (GC) in Objective-C and Objective-C++ 4608programs. This option is only available with the NeXT runtime; the 4609GNU runtime has a different garbage collection implementation that 4610does not require special compiler flags. 4611 4612@item -fobjc-nilcheck 4613@opindex fobjc-nilcheck 4614For the NeXT runtime with version 2 of the ABI, check for a nil 4615receiver in method invocations before doing the actual method call. 4616This is the default and can be disabled using 4617@option{-fno-objc-nilcheck}. Class methods and super calls are never 4618checked for nil in this way no matter what this flag is set to. 4619Currently this flag does nothing when the GNU runtime, or an older 4620version of the NeXT runtime ABI, is used. 4621 4622@item -fobjc-std=objc1 4623@opindex fobjc-std 4624Conform to the language syntax of Objective-C 1.0, the language 4625recognized by GCC 4.0. This only affects the Objective-C additions to 4626the C/C++ language; it does not affect conformance to C/C++ standards, 4627which is controlled by the separate C/C++ dialect option flags. When 4628this option is used with the Objective-C or Objective-C++ compiler, 4629any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 4630This is useful if you need to make sure that your Objective-C code can 4631be compiled with older versions of GCC@. 4632 4633@item -freplace-objc-classes 4634@opindex freplace-objc-classes 4635Emit a special marker instructing @command{ld(1)} not to statically link in 4636the resulting object file, and allow @command{dyld(1)} to load it in at 4637run time instead. This is used in conjunction with the Fix-and-Continue 4638debugging mode, where the object file in question may be recompiled and 4639dynamically reloaded in the course of program execution, without the need 4640to restart the program itself. Currently, Fix-and-Continue functionality 4641is only available in conjunction with the NeXT runtime on Mac OS X 10.3 4642and later. 4643 4644@item -fzero-link 4645@opindex fzero-link 4646When compiling for the NeXT runtime, the compiler ordinarily replaces calls 4647to @code{objc_getClass("@dots{}")} (when the name of the class is known at 4648compile time) with static class references that get initialized at load time, 4649which improves run-time performance. Specifying the @option{-fzero-link} flag 4650suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 4651to be retained. This is useful in Zero-Link debugging mode, since it allows 4652for individual class implementations to be modified during program execution. 4653The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 4654regardless of command-line options. 4655 4656@item -fno-local-ivars 4657@opindex fno-local-ivars 4658@opindex flocal-ivars 4659By default instance variables in Objective-C can be accessed as if 4660they were local variables from within the methods of the class they're 4661declared in. This can lead to shadowing between instance variables 4662and other variables declared either locally inside a class method or 4663globally with the same name. Specifying the @option{-fno-local-ivars} 4664flag disables this behavior thus avoiding variable shadowing issues. 4665 4666@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} 4667@opindex fivar-visibility 4668Set the default instance variable visibility to the specified option 4669so that instance variables declared outside the scope of any access 4670modifier directives default to the specified visibility. 4671 4672@item -gen-decls 4673@opindex gen-decls 4674Dump interface declarations for all classes seen in the source file to a 4675file named @file{@var{sourcename}.decl}. 4676 4677@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 4678@opindex Wassign-intercept 4679@opindex Wno-assign-intercept 4680Warn whenever an Objective-C assignment is being intercepted by the 4681garbage collector. 4682 4683@item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)} 4684@opindex Wproperty-assign-default 4685@opindex Wno-property-assign-default 4686Do not warn if a property for an Objective-C object has no assign 4687semantics specified. 4688 4689@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 4690@opindex Wno-protocol 4691@opindex Wprotocol 4692If a class is declared to implement a protocol, a warning is issued for 4693every method in the protocol that is not implemented by the class. The 4694default behavior is to issue a warning for every method not explicitly 4695implemented in the class, even if a method implementation is inherited 4696from the superclass. If you use the @option{-Wno-protocol} option, then 4697methods inherited from the superclass are considered to be implemented, 4698and no warning is issued for them. 4699 4700@item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)} 4701@opindex Wobjc-root-class 4702Warn if a class interface lacks a superclass. Most classes will inherit 4703from @code{NSObject} (or @code{Object}) for example. When declaring 4704classes intended to be root classes, the warning can be suppressed by 4705marking their interfaces with @code{__attribute__((objc_root_class))}. 4706 4707@item -Wselector @r{(Objective-C and Objective-C++ only)} 4708@opindex Wselector 4709@opindex Wno-selector 4710Warn if multiple methods of different types for the same selector are 4711found during compilation. The check is performed on the list of methods 4712in the final stage of compilation. Additionally, a check is performed 4713for each selector appearing in a @code{@@selector(@dots{})} 4714expression, and a corresponding method for that selector has been found 4715during compilation. Because these checks scan the method table only at 4716the end of compilation, these warnings are not produced if the final 4717stage of compilation is not reached, for example because an error is 4718found during compilation, or because the @option{-fsyntax-only} option is 4719being used. 4720 4721@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 4722@opindex Wstrict-selector-match 4723@opindex Wno-strict-selector-match 4724Warn if multiple methods with differing argument and/or return types are 4725found for a given selector when attempting to send a message using this 4726selector to a receiver of type @code{id} or @code{Class}. When this flag 4727is off (which is the default behavior), the compiler omits such warnings 4728if any differences found are confined to types that share the same size 4729and alignment. 4730 4731@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 4732@opindex Wundeclared-selector 4733@opindex Wno-undeclared-selector 4734Warn if a @code{@@selector(@dots{})} expression referring to an 4735undeclared selector is found. A selector is considered undeclared if no 4736method with that name has been declared before the 4737@code{@@selector(@dots{})} expression, either explicitly in an 4738@code{@@interface} or @code{@@protocol} declaration, or implicitly in 4739an @code{@@implementation} section. This option always performs its 4740checks as soon as a @code{@@selector(@dots{})} expression is found, 4741while @option{-Wselector} only performs its checks in the final stage of 4742compilation. This also enforces the coding style convention 4743that methods and selectors must be declared before being used. 4744 4745@item -print-objc-runtime-info 4746@opindex print-objc-runtime-info 4747Generate C header describing the largest structure that is passed by 4748value, if any. 4749 4750@end table 4751 4752@node Diagnostic Message Formatting Options 4753@section Options to Control Diagnostic Messages Formatting 4754@cindex options to control diagnostics formatting 4755@cindex diagnostic messages 4756@cindex message formatting 4757 4758Traditionally, diagnostic messages have been formatted irrespective of 4759the output device's aspect (e.g.@: its width, @dots{}). You can use the 4760options described below 4761to control the formatting algorithm for diagnostic messages, 4762e.g.@: how many characters per line, how often source location 4763information should be reported. Note that some language front ends may not 4764honor these options. 4765 4766@table @gcctabopt 4767@item -fmessage-length=@var{n} 4768@opindex fmessage-length 4769Try to format error messages so that they fit on lines of about 4770@var{n} characters. If @var{n} is zero, then no line-wrapping is 4771done; each error message appears on a single line. This is the 4772default for all front ends. 4773 4774Note - this option also affects the display of the @samp{#error} and 4775@samp{#warning} pre-processor directives, and the @samp{deprecated} 4776function/type/variable attribute. It does not however affect the 4777@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas. 4778 4779@item -fdiagnostics-plain-output 4780This option requests that diagnostic output look as plain as possible, which 4781may be useful when running @command{dejagnu} or other utilities that need to 4782parse diagnostics output and prefer that it remain more stable over time. 4783@option{-fdiagnostics-plain-output} is currently equivalent to the following 4784options: 4785@gccoptlist{-fno-diagnostics-show-caret @gol 4786-fno-diagnostics-show-line-numbers @gol 4787-fdiagnostics-color=never @gol 4788-fdiagnostics-urls=never @gol 4789-fdiagnostics-path-format=separate-events} 4790In the future, if GCC changes the default appearance of its diagnostics, the 4791corresponding option to disable the new behavior will be added to this list. 4792 4793@item -fdiagnostics-show-location=once 4794@opindex fdiagnostics-show-location 4795Only meaningful in line-wrapping mode. Instructs the diagnostic messages 4796reporter to emit source location information @emph{once}; that is, in 4797case the message is too long to fit on a single physical line and has to 4798be wrapped, the source location won't be emitted (as prefix) again, 4799over and over, in subsequent continuation lines. This is the default 4800behavior. 4801 4802@item -fdiagnostics-show-location=every-line 4803Only meaningful in line-wrapping mode. Instructs the diagnostic 4804messages reporter to emit the same source location information (as 4805prefix) for physical lines that result from the process of breaking 4806a message which is too long to fit on a single line. 4807 4808@item -fdiagnostics-color[=@var{WHEN}] 4809@itemx -fno-diagnostics-color 4810@opindex fdiagnostics-color 4811@cindex highlight, color 4812@vindex GCC_COLORS @r{environment variable} 4813Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, 4814or @samp{auto}. The default depends on how the compiler has been configured, 4815it can be any of the above @var{WHEN} options or also @samp{never} 4816if @env{GCC_COLORS} environment variable isn't present in the environment, 4817and @samp{auto} otherwise. 4818@samp{auto} makes GCC use color only when the standard error is a terminal, 4819and when not executing in an emacs shell. 4820The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are 4821aliases for @option{-fdiagnostics-color=always} and 4822@option{-fdiagnostics-color=never}, respectively. 4823 4824The colors are defined by the environment variable @env{GCC_COLORS}. 4825Its value is a colon-separated list of capabilities and Select Graphic 4826Rendition (SGR) substrings. SGR commands are interpreted by the 4827terminal or terminal emulator. (See the section in the documentation 4828of your text terminal for permitted values and their meanings as 4829character attributes.) These substring values are integers in decimal 4830representation and can be concatenated with semicolons. 4831Common values to concatenate include 4832@samp{1} for bold, 4833@samp{4} for underline, 4834@samp{5} for blink, 4835@samp{7} for inverse, 4836@samp{39} for default foreground color, 4837@samp{30} to @samp{37} for foreground colors, 4838@samp{90} to @samp{97} for 16-color mode foreground colors, 4839@samp{38;5;0} to @samp{38;5;255} 4840for 88-color and 256-color modes foreground colors, 4841@samp{49} for default background color, 4842@samp{40} to @samp{47} for background colors, 4843@samp{100} to @samp{107} for 16-color mode background colors, 4844and @samp{48;5;0} to @samp{48;5;255} 4845for 88-color and 256-color modes background colors. 4846 4847The default @env{GCC_COLORS} is 4848@smallexample 4849error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\ 4850quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\ 4851diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ 4852type-diff=01;32 4853@end smallexample 4854@noindent 4855where @samp{01;31} is bold red, @samp{01;35} is bold magenta, 4856@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue, 4857@samp{01} is bold, and @samp{31} is red. 4858Setting @env{GCC_COLORS} to the empty string disables colors. 4859Supported capabilities are as follows. 4860 4861@table @code 4862@item error= 4863@vindex error GCC_COLORS @r{capability} 4864SGR substring for error: markers. 4865 4866@item warning= 4867@vindex warning GCC_COLORS @r{capability} 4868SGR substring for warning: markers. 4869 4870@item note= 4871@vindex note GCC_COLORS @r{capability} 4872SGR substring for note: markers. 4873 4874@item path= 4875@vindex path GCC_COLORS @r{capability} 4876SGR substring for colorizing paths of control-flow events as printed 4877via @option{-fdiagnostics-path-format=}, such as the identifiers of 4878individual events and lines indicating interprocedural calls and returns. 4879 4880@item range1= 4881@vindex range1 GCC_COLORS @r{capability} 4882SGR substring for first additional range. 4883 4884@item range2= 4885@vindex range2 GCC_COLORS @r{capability} 4886SGR substring for second additional range. 4887 4888@item locus= 4889@vindex locus GCC_COLORS @r{capability} 4890SGR substring for location information, @samp{file:line} or 4891@samp{file:line:column} etc. 4892 4893@item quote= 4894@vindex quote GCC_COLORS @r{capability} 4895SGR substring for information printed within quotes. 4896 4897@item fixit-insert= 4898@vindex fixit-insert GCC_COLORS @r{capability} 4899SGR substring for fix-it hints suggesting text to 4900be inserted or replaced. 4901 4902@item fixit-delete= 4903@vindex fixit-delete GCC_COLORS @r{capability} 4904SGR substring for fix-it hints suggesting text to 4905be deleted. 4906 4907@item diff-filename= 4908@vindex diff-filename GCC_COLORS @r{capability} 4909SGR substring for filename headers within generated patches. 4910 4911@item diff-hunk= 4912@vindex diff-hunk GCC_COLORS @r{capability} 4913SGR substring for the starts of hunks within generated patches. 4914 4915@item diff-delete= 4916@vindex diff-delete GCC_COLORS @r{capability} 4917SGR substring for deleted lines within generated patches. 4918 4919@item diff-insert= 4920@vindex diff-insert GCC_COLORS @r{capability} 4921SGR substring for inserted lines within generated patches. 4922 4923@item type-diff= 4924@vindex type-diff GCC_COLORS @r{capability} 4925SGR substring for highlighting mismatching types within template 4926arguments in the C++ frontend. 4927@end table 4928 4929@item -fdiagnostics-urls[=@var{WHEN}] 4930@opindex fdiagnostics-urls 4931@cindex urls 4932@vindex GCC_URLS @r{environment variable} 4933@vindex TERM_URLS @r{environment variable} 4934Use escape sequences to embed URLs in diagnostics. For example, when 4935@option{-fdiagnostics-show-option} emits text showing the command-line 4936option controlling a diagnostic, embed a URL for documentation of that 4937option. 4938 4939@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}. 4940@samp{auto} makes GCC use URL escape sequences only when the standard error 4941is a terminal, and when not executing in an emacs shell or any graphical 4942terminal which is known to be incompatible with this feature, see below. 4943 4944The default depends on how the compiler has been configured. 4945It can be any of the above @var{WHEN} options. 4946 4947GCC can also be configured (via the 4948@option{--with-diagnostics-urls=auto-if-env} configure-time option) 4949so that the default is affected by environment variables. 4950Under such a configuration, GCC defaults to using @samp{auto} 4951if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are 4952present and non-empty in the environment of the compiler, or @samp{never} 4953if neither are. 4954 4955However, even with @option{-fdiagnostics-urls=always} the behavior is 4956dependent on those environment variables: 4957If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in 4958diagnostics. If set to @samp{st}, URLs use ST escape sequences. 4959If set to @samp{bel}, the default, URLs use BEL escape sequences. 4960Any other non-empty value enables the feature. 4961If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback. 4962Note: ST is an ANSI escape sequence, string terminator @samp{ESC \}, 4963BEL is an ASCII character, CTRL-G that usually sounds like a beep. 4964 4965At this time GCC tries to detect also a few terminals that are known to 4966not implement the URL feature, and have bugs or at least had bugs in 4967some versions that are still in use, where the URL escapes are likely 4968to misbehave, i.e. print garbage on the screen. 4969That list is currently xfce4-terminal, certain known to be buggy 4970gnome-terminal versions, the linux console, and mingw. 4971This check can be skipped with the @option{-fdiagnostics-urls=always}. 4972 4973@item -fno-diagnostics-show-option 4974@opindex fno-diagnostics-show-option 4975@opindex fdiagnostics-show-option 4976By default, each diagnostic emitted includes text indicating the 4977command-line option that directly controls the diagnostic (if such an 4978option is known to the diagnostic machinery). Specifying the 4979@option{-fno-diagnostics-show-option} flag suppresses that behavior. 4980 4981@item -fno-diagnostics-show-caret 4982@opindex fno-diagnostics-show-caret 4983@opindex fdiagnostics-show-caret 4984By default, each diagnostic emitted includes the original source line 4985and a caret @samp{^} indicating the column. This option suppresses this 4986information. The source line is truncated to @var{n} characters, if 4987the @option{-fmessage-length=n} option is given. When the output is done 4988to the terminal, the width is limited to the width given by the 4989@env{COLUMNS} environment variable or, if not set, to the terminal width. 4990 4991@item -fno-diagnostics-show-labels 4992@opindex fno-diagnostics-show-labels 4993@opindex fdiagnostics-show-labels 4994By default, when printing source code (via @option{-fdiagnostics-show-caret}), 4995diagnostics can label ranges of source code with pertinent information, such 4996as the types of expressions: 4997 4998@smallexample 4999 printf ("foo %s bar", long_i + long_j); 5000 ~^ ~~~~~~~~~~~~~~~ 5001 | | 5002 char * long int 5003@end smallexample 5004 5005This option suppresses the printing of these labels (in the example above, 5006the vertical bars and the ``char *'' and ``long int'' text). 5007 5008@item -fno-diagnostics-show-cwe 5009@opindex fno-diagnostics-show-cwe 5010@opindex fdiagnostics-show-cwe 5011Diagnostic messages can optionally have an associated 5012@url{https://cwe.mitre.org/index.html, CWE} identifier. 5013GCC itself only provides such metadata for some of the @option{-fanalyzer} 5014diagnostics. GCC plugins may also provide diagnostics with such metadata. 5015By default, if this information is present, it will be printed with 5016the diagnostic. This option suppresses the printing of this metadata. 5017 5018@item -fno-diagnostics-show-line-numbers 5019@opindex fno-diagnostics-show-line-numbers 5020@opindex fdiagnostics-show-line-numbers 5021By default, when printing source code (via @option{-fdiagnostics-show-caret}), 5022a left margin is printed, showing line numbers. This option suppresses this 5023left margin. 5024 5025@item -fdiagnostics-minimum-margin-width=@var{width} 5026@opindex fdiagnostics-minimum-margin-width 5027This option controls the minimum width of the left margin printed by 5028@option{-fdiagnostics-show-line-numbers}. It defaults to 6. 5029 5030@item -fdiagnostics-parseable-fixits 5031@opindex fdiagnostics-parseable-fixits 5032Emit fix-it hints in a machine-parseable format, suitable for consumption 5033by IDEs. For each fix-it, a line will be printed after the relevant 5034diagnostic, starting with the string ``fix-it:''. For example: 5035 5036@smallexample 5037fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all" 5038@end smallexample 5039 5040The location is expressed as a half-open range, expressed as a count of 5041bytes, starting at byte 1 for the initial column. In the above example, 5042bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the 5043given string: 5044 5045@smallexample 504600000000011111111112222222222 504712345678901234567890123456789 5048 gtk_widget_showall (dlg); 5049 ^^^^^^^^^^^^^^^^^^ 5050 gtk_widget_show_all 5051@end smallexample 5052 5053The filename and replacement string escape backslash as ``\\", tab as ``\t'', 5054newline as ``\n'', double quotes as ``\"'', non-printable characters as octal 5055(e.g. vertical tab as ``\013''). 5056 5057An empty replacement string indicates that the given range is to be removed. 5058An empty range (e.g. ``45:3-45:3'') indicates that the string is to 5059be inserted at the given position. 5060 5061@item -fdiagnostics-generate-patch 5062@opindex fdiagnostics-generate-patch 5063Print fix-it hints to stderr in unified diff format, after any diagnostics 5064are printed. For example: 5065 5066@smallexample 5067--- test.c 5068+++ test.c 5069@@ -42,5 +42,5 @@ 5070 5071 void show_cb(GtkDialog *dlg) 5072 @{ 5073- gtk_widget_showall(dlg); 5074+ gtk_widget_show_all(dlg); 5075 @} 5076 5077@end smallexample 5078 5079The diff may or may not be colorized, following the same rules 5080as for diagnostics (see @option{-fdiagnostics-color}). 5081 5082@item -fdiagnostics-show-template-tree 5083@opindex fdiagnostics-show-template-tree 5084 5085In the C++ frontend, when printing diagnostics showing mismatching 5086template types, such as: 5087 5088@smallexample 5089 could not convert 'std::map<int, std::vector<double> >()' 5090 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 5091@end smallexample 5092 5093the @option{-fdiagnostics-show-template-tree} flag enables printing a 5094tree-like structure showing the common and differing parts of the types, 5095such as: 5096 5097@smallexample 5098 map< 5099 [...], 5100 vector< 5101 [double != float]>> 5102@end smallexample 5103 5104The parts that differ are highlighted with color (``double'' and 5105``float'' in this case). 5106 5107@item -fno-elide-type 5108@opindex fno-elide-type 5109@opindex felide-type 5110By default when the C++ frontend prints diagnostics showing mismatching 5111template types, common parts of the types are printed as ``[...]'' to 5112simplify the error message. For example: 5113 5114@smallexample 5115 could not convert 'std::map<int, std::vector<double> >()' 5116 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 5117@end smallexample 5118 5119Specifying the @option{-fno-elide-type} flag suppresses that behavior. 5120This flag also affects the output of the 5121@option{-fdiagnostics-show-template-tree} flag. 5122 5123@item -fdiagnostics-path-format=@var{KIND} 5124@opindex fdiagnostics-path-format 5125Specify how to print paths of control-flow events for diagnostics that 5126have such a path associated with them. 5127 5128@var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events}, 5129the default. 5130 5131@samp{none} means to not print diagnostic paths. 5132 5133@samp{separate-events} means to print a separate ``note'' diagnostic for 5134each event within the diagnostic. For example: 5135 5136@smallexample 5137test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter 5138test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL 5139test.c:27:3: note: (2) when 'i < count' 5140test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1 5141@end smallexample 5142 5143@samp{inline-events} means to print the events ``inline'' within the source 5144code. This view attempts to consolidate the events into runs of 5145sufficiently-close events, printing them as labelled ranges within the source. 5146 5147For example, the same events as above might be printed as: 5148 5149@smallexample 5150 'test': events 1-3 5151 | 5152 | 25 | list = PyList_New(0); 5153 | | ^~~~~~~~~~~~~ 5154 | | | 5155 | | (1) when 'PyList_New' fails, returning NULL 5156 | 26 | 5157 | 27 | for (i = 0; i < count; i++) @{ 5158 | | ~~~ 5159 | | | 5160 | | (2) when 'i < count' 5161 | 28 | item = PyLong_FromLong(random()); 5162 | 29 | PyList_Append(list, item); 5163 | | ~~~~~~~~~~~~~~~~~~~~~~~~~ 5164 | | | 5165 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1 5166 | 5167@end smallexample 5168 5169Interprocedural control flow is shown by grouping the events by stack frame, 5170and using indentation to show how stack frames are nested, pushed, and popped. 5171 5172For example: 5173 5174@smallexample 5175 'test': events 1-2 5176 | 5177 | 133 | @{ 5178 | | ^ 5179 | | | 5180 | | (1) entering 'test' 5181 | 134 | boxed_int *obj = make_boxed_int (i); 5182 | | ~~~~~~~~~~~~~~~~~~ 5183 | | | 5184 | | (2) calling 'make_boxed_int' 5185 | 5186 +--> 'make_boxed_int': events 3-4 5187 | 5188 | 120 | @{ 5189 | | ^ 5190 | | | 5191 | | (3) entering 'make_boxed_int' 5192 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int)); 5193 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5194 | | | 5195 | | (4) calling 'wrapped_malloc' 5196 | 5197 +--> 'wrapped_malloc': events 5-6 5198 | 5199 | 7 | @{ 5200 | | ^ 5201 | | | 5202 | | (5) entering 'wrapped_malloc' 5203 | 8 | return malloc (size); 5204 | | ~~~~~~~~~~~~~ 5205 | | | 5206 | | (6) calling 'malloc' 5207 | 5208 <-------------+ 5209 | 5210 'test': event 7 5211 | 5212 | 138 | free_boxed_int (obj); 5213 | | ^~~~~~~~~~~~~~~~~~~~ 5214 | | | 5215 | | (7) calling 'free_boxed_int' 5216 | 5217(etc) 5218@end smallexample 5219 5220@item -fdiagnostics-show-path-depths 5221@opindex fdiagnostics-show-path-depths 5222This option provides additional information when printing control-flow paths 5223associated with a diagnostic. 5224 5225If this is option is provided then the stack depth will be printed for 5226each run of events within @option{-fdiagnostics-path-format=separate-events}. 5227 5228This is intended for use by GCC developers and plugin developers when 5229debugging diagnostics that report interprocedural control flow. 5230 5231@item -fno-show-column 5232@opindex fno-show-column 5233@opindex fshow-column 5234Do not print column numbers in diagnostics. This may be necessary if 5235diagnostics are being scanned by a program that does not understand the 5236column numbers, such as @command{dejagnu}. 5237 5238@item -fdiagnostics-column-unit=@var{UNIT} 5239@opindex fdiagnostics-column-unit 5240Select the units for the column number. This affects traditional diagnostics 5241(in the absence of @option{-fno-show-column}), as well as JSON format 5242diagnostics if requested. 5243 5244The default @var{UNIT}, @samp{display}, considers the number of display 5245columns occupied by each character. This may be larger than the number 5246of bytes required to encode the character, in the case of tab 5247characters, or it may be smaller, in the case of multibyte characters. 5248For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one 5249display column, and its UTF-8 encoding requires two bytes; the character 5250``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and 5251its UTF-8 encoding requires four bytes. 5252 5253Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte 5254count in all cases, as was traditionally output by GCC prior to version 11.1.0. 5255 5256@item -fdiagnostics-column-origin=@var{ORIGIN} 5257@opindex fdiagnostics-column-origin 5258Select the origin for column numbers, i.e. the column number assigned to the 5259first column. The default value of 1 corresponds to traditional GCC 5260behavior and to the GNU style guide. Some utilities may perform better with an 5261origin of 0; any non-negative value may be specified. 5262 5263@item -fdiagnostics-escape-format=@var{FORMAT} 5264@opindex fdiagnostics-escape-format 5265When GCC prints pertinent source lines for a diagnostic it normally attempts 5266to print the source bytes directly. However, some diagnostics relate to encoding 5267issues in the source file, such as malformed UTF-8, or issues with Unicode 5268normalization. These diagnostics are flagged so that GCC will escape bytes 5269that are not printable ASCII when printing their pertinent source lines. 5270 5271This option controls how such bytes should be escaped. 5272 5273The default @var{FORMAT}, @samp{unicode} displays Unicode characters that 5274are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not 5275correspond to a Unicode character validly-encoded in UTF-8-encoded will be 5276displayed as hexadecimal in the form @samp{<XX>}. 5277 5278For example, a source line containing the string @samp{before} followed by the 5279Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding 52800xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by 5281the string @samp{after} will be printed for such a diagnostic as: 5282 5283@smallexample 5284 before<U+03C0><BF>after 5285@end smallexample 5286 5287Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes 5288in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII 5289Unicode characters. For the example above, the following will be printed: 5290 5291@smallexample 5292 before<CF><80><BF>after 5293@end smallexample 5294 5295@item -fdiagnostics-format=@var{FORMAT} 5296@opindex fdiagnostics-format 5297Select a different format for printing diagnostics. 5298@var{FORMAT} is @samp{text} or @samp{json}. 5299The default is @samp{text}. 5300 5301The @samp{json} format consists of a top-level JSON array containing JSON 5302objects representing the diagnostics. 5303 5304The JSON is emitted as one line, without formatting; the examples below 5305have been formatted for clarity. 5306 5307Diagnostics can have child diagnostics. For example, this error and note: 5308 5309@smallexample 5310misleading-indentation.c:15:3: warning: this 'if' clause does not 5311 guard... [-Wmisleading-indentation] 5312 15 | if (flag) 5313 | ^~ 5314misleading-indentation.c:17:5: note: ...this statement, but the latter 5315 is misleadingly indented as if it were guarded by the 'if' 5316 17 | y = 2; 5317 | ^ 5318@end smallexample 5319 5320@noindent 5321might be printed in JSON form (after formatting) like this: 5322 5323@smallexample 5324[ 5325 @{ 5326 "kind": "warning", 5327 "locations": [ 5328 @{ 5329 "caret": @{ 5330 "display-column": 3, 5331 "byte-column": 3, 5332 "column": 3, 5333 "file": "misleading-indentation.c", 5334 "line": 15 5335 @}, 5336 "finish": @{ 5337 "display-column": 4, 5338 "byte-column": 4, 5339 "column": 4, 5340 "file": "misleading-indentation.c", 5341 "line": 15 5342 @} 5343 @} 5344 ], 5345 "message": "this \u2018if\u2019 clause does not guard...", 5346 "option": "-Wmisleading-indentation", 5347 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation", 5348 "children": [ 5349 @{ 5350 "kind": "note", 5351 "locations": [ 5352 @{ 5353 "caret": @{ 5354 "display-column": 5, 5355 "byte-column": 5, 5356 "column": 5, 5357 "file": "misleading-indentation.c", 5358 "line": 17 5359 @} 5360 @} 5361 ], 5362 "escape-source": false, 5363 "message": "...this statement, but the latter is @dots{}" 5364 @} 5365 ] 5366 "escape-source": false, 5367 "column-origin": 1, 5368 @} 5369] 5370@end smallexample 5371 5372@noindent 5373where the @code{note} is a child of the @code{warning}. 5374 5375A diagnostic has a @code{kind}. If this is @code{warning}, then there is 5376an @code{option} key describing the command-line option controlling the 5377warning. 5378 5379A diagnostic can contain zero or more locations. Each location has an 5380optional @code{label} string and up to three positions within it: a 5381@code{caret} position and optional @code{start} and @code{finish} positions. 5382A position is described by a @code{file} name, a @code{line} number, and 5383three numbers indicating a column position: 5384@itemize @bullet 5385 5386@item 5387@code{display-column} counts display columns, accounting for tabs and 5388multibyte characters. 5389 5390@item 5391@code{byte-column} counts raw bytes. 5392 5393@item 5394@code{column} is equal to one of 5395the previous two, as dictated by the @option{-fdiagnostics-column-unit} 5396option. 5397 5398@end itemize 5399All three columns are relative to the origin specified by 5400@option{-fdiagnostics-column-origin}, which is typically equal to 1 but may 5401be set, for instance, to 0 for compatibility with other utilities that 5402number columns from 0. The column origin is recorded in the JSON output in 5403the @code{column-origin} tag. In the remaining examples below, the extra 5404column number outputs have been omitted for brevity. 5405 5406For example, this error: 5407 5408@smallexample 5409bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka 5410 'struct s'@} and 'T' @{aka 'struct t'@}) 5411 64 | return callee_4a () + callee_4b (); 5412 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ 5413 | | | 5414 | | T @{aka struct t@} 5415 | S @{aka struct s@} 5416@end smallexample 5417 5418@noindent 5419has three locations. Its primary location is at the ``+'' token at column 542023. It has two secondary locations, describing the left and right-hand sides 5421of the expression, which have labels. It might be printed in JSON form as: 5422 5423@smallexample 5424 @{ 5425 "children": [], 5426 "kind": "error", 5427 "locations": [ 5428 @{ 5429 "caret": @{ 5430 "column": 23, "file": "bad-binary-ops.c", "line": 64 5431 @} 5432 @}, 5433 @{ 5434 "caret": @{ 5435 "column": 10, "file": "bad-binary-ops.c", "line": 64 5436 @}, 5437 "finish": @{ 5438 "column": 21, "file": "bad-binary-ops.c", "line": 64 5439 @}, 5440 "label": "S @{aka struct s@}" 5441 @}, 5442 @{ 5443 "caret": @{ 5444 "column": 25, "file": "bad-binary-ops.c", "line": 64 5445 @}, 5446 "finish": @{ 5447 "column": 36, "file": "bad-binary-ops.c", "line": 64 5448 @}, 5449 "label": "T @{aka struct t@}" 5450 @} 5451 ], 5452 "escape-source": false, 5453 "message": "invalid operands to binary + @dots{}" 5454 @} 5455@end smallexample 5456 5457If a diagnostic contains fix-it hints, it has a @code{fixits} array, 5458consisting of half-open intervals, similar to the output of 5459@option{-fdiagnostics-parseable-fixits}. For example, this diagnostic 5460with a replacement fix-it hint: 5461 5462@smallexample 5463demo.c:8:15: error: 'struct s' has no member named 'colour'; did you 5464 mean 'color'? 5465 8 | return ptr->colour; 5466 | ^~~~~~ 5467 | color 5468@end smallexample 5469 5470@noindent 5471might be printed in JSON form as: 5472 5473@smallexample 5474 @{ 5475 "children": [], 5476 "fixits": [ 5477 @{ 5478 "next": @{ 5479 "column": 21, 5480 "file": "demo.c", 5481 "line": 8 5482 @}, 5483 "start": @{ 5484 "column": 15, 5485 "file": "demo.c", 5486 "line": 8 5487 @}, 5488 "string": "color" 5489 @} 5490 ], 5491 "kind": "error", 5492 "locations": [ 5493 @{ 5494 "caret": @{ 5495 "column": 15, 5496 "file": "demo.c", 5497 "line": 8 5498 @}, 5499 "finish": @{ 5500 "column": 20, 5501 "file": "demo.c", 5502 "line": 8 5503 @} 5504 @} 5505 ], 5506 "escape-source": false, 5507 "message": "\u2018struct s\u2019 has no member named @dots{}" 5508 @} 5509@end smallexample 5510 5511@noindent 5512where the fix-it hint suggests replacing the text from @code{start} up 5513to but not including @code{next} with @code{string}'s value. Deletions 5514are expressed via an empty value for @code{string}, insertions by 5515having @code{start} equal @code{next}. 5516 5517If the diagnostic has a path of control-flow events associated with it, 5518it has a @code{path} array of objects representing the events. Each 5519event object has a @code{description} string, a @code{location} object, 5520along with a @code{function} string and a @code{depth} number for 5521representing interprocedural paths. The @code{function} represents the 5522current function at that event, and the @code{depth} represents the 5523stack depth relative to some baseline: the higher, the more frames are 5524within the stack. 5525 5526For example, the intraprocedural example shown for 5527@option{-fdiagnostics-path-format=} might have this JSON for its path: 5528 5529@smallexample 5530 "path": [ 5531 @{ 5532 "depth": 0, 5533 "description": "when 'PyList_New' fails, returning NULL", 5534 "function": "test", 5535 "location": @{ 5536 "column": 10, 5537 "file": "test.c", 5538 "line": 25 5539 @} 5540 @}, 5541 @{ 5542 "depth": 0, 5543 "description": "when 'i < count'", 5544 "function": "test", 5545 "location": @{ 5546 "column": 3, 5547 "file": "test.c", 5548 "line": 27 5549 @} 5550 @}, 5551 @{ 5552 "depth": 0, 5553 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1", 5554 "function": "test", 5555 "location": @{ 5556 "column": 5, 5557 "file": "test.c", 5558 "line": 29 5559 @} 5560 @} 5561 ] 5562@end smallexample 5563 5564Diagnostics have a boolean attribute @code{escape-source}, hinting whether 5565non-ASCII bytes should be escaped when printing the pertinent lines of 5566source code (@code{true} for diagnostics involving source encoding issues). 5567 5568@end table 5569 5570@node Warning Options 5571@section Options to Request or Suppress Warnings 5572@cindex options to control warnings 5573@cindex warning messages 5574@cindex messages, warning 5575@cindex suppressing warnings 5576 5577Warnings are diagnostic messages that report constructions that 5578are not inherently erroneous but that are risky or suggest there 5579may have been an error. 5580 5581The following language-independent options do not enable specific 5582warnings but control the kinds of diagnostics produced by GCC@. 5583 5584@table @gcctabopt 5585@cindex syntax checking 5586@item -fsyntax-only 5587@opindex fsyntax-only 5588Check the code for syntax errors, but don't do anything beyond that. 5589 5590@item -fmax-errors=@var{n} 5591@opindex fmax-errors 5592Limits the maximum number of error messages to @var{n}, at which point 5593GCC bails out rather than attempting to continue processing the source 5594code. If @var{n} is 0 (the default), there is no limit on the number 5595of error messages produced. If @option{-Wfatal-errors} is also 5596specified, then @option{-Wfatal-errors} takes precedence over this 5597option. 5598 5599@item -w 5600@opindex w 5601Inhibit all warning messages. 5602 5603@item -Werror 5604@opindex Werror 5605@opindex Wno-error 5606Make all warnings into errors. 5607 5608@item -Werror= 5609@opindex Werror= 5610@opindex Wno-error= 5611Make the specified warning into an error. The specifier for a warning 5612is appended; for example @option{-Werror=switch} turns the warnings 5613controlled by @option{-Wswitch} into errors. This switch takes a 5614negative form, to be used to negate @option{-Werror} for specific 5615warnings; for example @option{-Wno-error=switch} makes 5616@option{-Wswitch} warnings not be errors, even when @option{-Werror} 5617is in effect. 5618 5619The warning message for each controllable warning includes the 5620option that controls the warning. That option can then be used with 5621@option{-Werror=} and @option{-Wno-error=} as described above. 5622(Printing of the option in the warning message can be disabled using the 5623@option{-fno-diagnostics-show-option} flag.) 5624 5625Note that specifying @option{-Werror=}@var{foo} automatically implies 5626@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 5627imply anything. 5628 5629@item -Wfatal-errors 5630@opindex Wfatal-errors 5631@opindex Wno-fatal-errors 5632This option causes the compiler to abort compilation on the first error 5633occurred rather than trying to keep going and printing further error 5634messages. 5635 5636@end table 5637 5638You can request many specific warnings with options beginning with 5639@samp{-W}, for example @option{-Wimplicit} to request warnings on 5640implicit declarations. Each of these specific warning options also 5641has a negative form beginning @samp{-Wno-} to turn off warnings; for 5642example, @option{-Wno-implicit}. This manual lists only one of the 5643two forms, whichever is not the default. For further 5644language-specific options also refer to @ref{C++ Dialect Options} and 5645@ref{Objective-C and Objective-C++ Dialect Options}. 5646Additional warnings can be produced by enabling the static analyzer; 5647@xref{Static Analyzer Options}. 5648 5649Some options, such as @option{-Wall} and @option{-Wextra}, turn on other 5650options, such as @option{-Wunused}, which may turn on further options, 5651such as @option{-Wunused-value}. The combined effect of positive and 5652negative forms is that more specific options have priority over less 5653specific ones, independently of their position in the command-line. For 5654options of the same specificity, the last one takes effect. Options 5655enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect 5656as if they appeared at the end of the command-line. 5657 5658When an unrecognized warning option is requested (e.g., 5659@option{-Wunknown-warning}), GCC emits a diagnostic stating 5660that the option is not recognized. However, if the @option{-Wno-} form 5661is used, the behavior is slightly different: no diagnostic is 5662produced for @option{-Wno-unknown-warning} unless other diagnostics 5663are being produced. This allows the use of new @option{-Wno-} options 5664with old compilers, but if something goes wrong, the compiler 5665warns that an unrecognized option is present. 5666 5667The effectiveness of some warnings depends on optimizations also being 5668enabled. For example @option{-Wsuggest-final-types} is more effective 5669with link-time optimization and some instances of other warnings may 5670not be issued at all unless optimization is enabled. While optimization 5671in general improves the efficacy of control and data flow sensitive 5672warnings, in some cases it may also cause false positives. 5673 5674@table @gcctabopt 5675@item -Wpedantic 5676@itemx -pedantic 5677@opindex pedantic 5678@opindex Wpedantic 5679@opindex Wno-pedantic 5680Issue all the warnings demanded by strict ISO C and ISO C++; 5681reject all programs that use forbidden extensions, and some other 5682programs that do not follow ISO C and ISO C++. For ISO C, follows the 5683version of the ISO C standard specified by any @option{-std} option used. 5684 5685Valid ISO C and ISO C++ programs should compile properly with or without 5686this option (though a rare few require @option{-ansi} or a 5687@option{-std} option specifying the required version of ISO C)@. However, 5688without this option, certain GNU extensions and traditional C and C++ 5689features are supported as well. With this option, they are rejected. 5690 5691@option{-Wpedantic} does not cause warning messages for use of the 5692alternate keywords whose names begin and end with @samp{__}. This alternate 5693format can also be used to disable warnings for non-ISO @samp{__intN} types, 5694i.e. @samp{__intN__}. 5695Pedantic warnings are also disabled in the expression that follows 5696@code{__extension__}. However, only system header files should use 5697these escape routes; application programs should avoid them. 5698@xref{Alternate Keywords}. 5699 5700Some users try to use @option{-Wpedantic} to check programs for strict ISO 5701C conformance. They soon find that it does not do quite what they want: 5702it finds some non-ISO practices, but not all---only those for which 5703ISO C @emph{requires} a diagnostic, and some others for which 5704diagnostics have been added. 5705 5706A feature to report any failure to conform to ISO C might be useful in 5707some instances, but would require considerable additional work and would 5708be quite different from @option{-Wpedantic}. We don't have plans to 5709support such a feature in the near future. 5710 5711Where the standard specified with @option{-std} represents a GNU 5712extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 5713corresponding @dfn{base standard}, the version of ISO C on which the GNU 5714extended dialect is based. Warnings from @option{-Wpedantic} are given 5715where they are required by the base standard. (It does not make sense 5716for such warnings to be given only for features not in the specified GNU 5717C dialect, since by definition the GNU dialects of C include all 5718features the compiler supports with the given option, and there would be 5719nothing to warn about.) 5720 5721@item -pedantic-errors 5722@opindex pedantic-errors 5723Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 5724requires a diagnostic, in some cases where there is undefined behavior 5725at compile-time and in some other cases that do not prevent compilation 5726of programs that are valid according to the standard. This is not 5727equivalent to @option{-Werror=pedantic}, since there are errors enabled 5728by this option and not enabled by the latter and vice versa. 5729 5730@item -Wall 5731@opindex Wall 5732@opindex Wno-all 5733This enables all the warnings about constructions that some users 5734consider questionable, and that are easy to avoid (or modify to 5735prevent the warning), even in conjunction with macros. This also 5736enables some language-specific warnings described in @ref{C++ Dialect 5737Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 5738 5739@option{-Wall} turns on the following warning flags: 5740 5741@gccoptlist{-Waddress @gol 5742-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 5743-Warray-compare @gol 5744-Warray-parameter=2 @r{(C and Objective-C only)} @gol 5745-Wbool-compare @gol 5746-Wbool-operation @gol 5747-Wc++11-compat -Wc++14-compat @gol 5748-Wcatch-value @r{(C++ and Objective-C++ only)} @gol 5749-Wchar-subscripts @gol 5750-Wcomment @gol 5751-Wdangling-pointer=2 @gol 5752-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol 5753-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 5754-Wformat @gol 5755-Wformat-overflow @gol 5756-Wformat-truncation @gol 5757-Wint-in-bool-context @gol 5758-Wimplicit @r{(C and Objective-C only)} @gol 5759-Wimplicit-int @r{(C and Objective-C only)} @gol 5760-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 5761-Winit-self @r{(only for C++)} @gol 5762-Wlogical-not-parentheses @gol 5763-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 5764-Wmaybe-uninitialized @gol 5765-Wmemset-elt-size @gol 5766-Wmemset-transposed-args @gol 5767-Wmisleading-indentation @r{(only for C/C++)} @gol 5768-Wmismatched-dealloc @gol 5769-Wmismatched-new-delete @r{(only for C/C++)} @gol 5770-Wmissing-attributes @gol 5771-Wmissing-braces @r{(only for C/ObjC)} @gol 5772-Wmultistatement-macros @gol 5773-Wnarrowing @r{(only for C++)} @gol 5774-Wnonnull @gol 5775-Wnonnull-compare @gol 5776-Wopenmp-simd @gol 5777-Wparentheses @gol 5778-Wpessimizing-move @r{(only for C++)} @gol 5779-Wpointer-sign @gol 5780-Wrange-loop-construct @r{(only for C++)} @gol 5781-Wreorder @gol 5782-Wrestrict @gol 5783-Wreturn-type @gol 5784-Wsequence-point @gol 5785-Wsign-compare @r{(only in C++)} @gol 5786-Wsizeof-array-div @gol 5787-Wsizeof-pointer-div @gol 5788-Wsizeof-pointer-memaccess @gol 5789-Wstrict-aliasing @gol 5790-Wstrict-overflow=1 @gol 5791-Wswitch @gol 5792-Wtautological-compare @gol 5793-Wtrigraphs @gol 5794-Wuninitialized @gol 5795-Wunknown-pragmas @gol 5796-Wunused-function @gol 5797-Wunused-label @gol 5798-Wunused-value @gol 5799-Wunused-variable @gol 5800-Wuse-after-free=3 @gol 5801-Wvla-parameter @r{(C and Objective-C only)} @gol 5802-Wvolatile-register-var @gol 5803-Wzero-length-bounds} 5804 5805Note that some warning flags are not implied by @option{-Wall}. Some of 5806them warn about constructions that users generally do not consider 5807questionable, but which occasionally you might wish to check for; 5808others warn about constructions that are necessary or hard to avoid in 5809some cases, and there is no simple way to modify the code to suppress 5810the warning. Some of them are enabled by @option{-Wextra} but many of 5811them must be enabled individually. 5812 5813@item -Wextra 5814@opindex W 5815@opindex Wextra 5816@opindex Wno-extra 5817This enables some extra warning flags that are not enabled by 5818@option{-Wall}. (This option used to be called @option{-W}. The older 5819name is still supported, but the newer name is more descriptive.) 5820 5821@gccoptlist{-Wclobbered @gol 5822-Wcast-function-type @gol 5823-Wdeprecated-copy @r{(C++ only)} @gol 5824-Wempty-body @gol 5825-Wenum-conversion @r{(C only)} @gol 5826-Wignored-qualifiers @gol 5827-Wimplicit-fallthrough=3 @gol 5828-Wmissing-field-initializers @gol 5829-Wmissing-parameter-type @r{(C only)} @gol 5830-Wold-style-declaration @r{(C only)} @gol 5831-Woverride-init @gol 5832-Wsign-compare @r{(C only)} @gol 5833-Wstring-compare @gol 5834-Wredundant-move @r{(only for C++)} @gol 5835-Wtype-limits @gol 5836-Wuninitialized @gol 5837-Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)} @gol 5838-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 5839-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}} 5840 5841 5842The option @option{-Wextra} also prints warning messages for the 5843following cases: 5844 5845@itemize @bullet 5846 5847@item 5848A pointer is compared against integer zero with @code{<}, @code{<=}, 5849@code{>}, or @code{>=}. 5850 5851@item 5852(C++ only) An enumerator and a non-enumerator both appear in a 5853conditional expression. 5854 5855@item 5856(C++ only) Ambiguous virtual bases. 5857 5858@item 5859(C++ only) Subscripting an array that has been declared @code{register}. 5860 5861@item 5862(C++ only) Taking the address of a variable that has been declared 5863@code{register}. 5864 5865@item 5866(C++ only) A base class is not initialized in the copy constructor 5867of a derived class. 5868 5869@end itemize 5870 5871@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 5872@opindex Wabi 5873@opindex Wno-abi 5874 5875Warn about code affected by ABI changes. This includes code that may 5876not be compatible with the vendor-neutral C++ ABI as well as the psABI 5877for the particular target. 5878 5879Since G++ now defaults to updating the ABI with each major release, 5880normally @option{-Wabi} warns only about C++ ABI compatibility 5881problems if there is a check added later in a release series for an 5882ABI issue discovered since the initial release. @option{-Wabi} warns 5883about more things if an older ABI version is selected (with 5884@option{-fabi-version=@var{n}}). 5885 5886@option{-Wabi} can also be used with an explicit version number to 5887warn about C++ ABI compatibility with a particular @option{-fabi-version} 5888level, e.g.@: @option{-Wabi=2} to warn about changes relative to 5889@option{-fabi-version=2}. 5890 5891If an explicit version number is provided and 5892@option{-fabi-compat-version} is not specified, the version number 5893from this option is used for compatibility aliases. If no explicit 5894version number is provided with this option, but 5895@option{-fabi-compat-version} is specified, that version number is 5896used for C++ ABI warnings. 5897 5898Although an effort has been made to warn about 5899all such cases, there are probably some cases that are not warned about, 5900even though G++ is generating incompatible code. There may also be 5901cases where warnings are emitted even though the code that is generated 5902is compatible. 5903 5904You should rewrite your code to avoid these warnings if you are 5905concerned about the fact that code generated by G++ may not be binary 5906compatible with code generated by other compilers. 5907 5908Known incompatibilities in @option{-fabi-version=2} (which was the 5909default from GCC 3.4 to 4.9) include: 5910 5911@itemize @bullet 5912 5913@item 5914A template with a non-type template parameter of reference type was 5915mangled incorrectly: 5916@smallexample 5917extern int N; 5918template <int &> struct S @{@}; 5919void n (S<N>) @{2@} 5920@end smallexample 5921 5922This was fixed in @option{-fabi-version=3}. 5923 5924@item 5925SIMD vector types declared using @code{__attribute ((vector_size))} were 5926mangled in a non-standard way that does not allow for overloading of 5927functions taking vectors of different sizes. 5928 5929The mangling was changed in @option{-fabi-version=4}. 5930 5931@item 5932@code{__attribute ((const))} and @code{noreturn} were mangled as type 5933qualifiers, and @code{decltype} of a plain declaration was folded away. 5934 5935These mangling issues were fixed in @option{-fabi-version=5}. 5936 5937@item 5938Scoped enumerators passed as arguments to a variadic function are 5939promoted like unscoped enumerators, causing @code{va_arg} to complain. 5940On most targets this does not actually affect the parameter passing 5941ABI, as there is no way to pass an argument smaller than @code{int}. 5942 5943Also, the ABI changed the mangling of template argument packs, 5944@code{const_cast}, @code{static_cast}, prefix increment/decrement, and 5945a class scope function used as a template argument. 5946 5947These issues were corrected in @option{-fabi-version=6}. 5948 5949@item 5950Lambdas in default argument scope were mangled incorrectly, and the 5951ABI changed the mangling of @code{nullptr_t}. 5952 5953These issues were corrected in @option{-fabi-version=7}. 5954 5955@item 5956When mangling a function type with function-cv-qualifiers, the 5957un-qualified function type was incorrectly treated as a substitution 5958candidate. 5959 5960This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. 5961 5962@item 5963@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to 5964unaligned accesses. Note that this did not affect the ABI of a 5965function with a @code{nullptr_t} parameter, as parameters have a 5966minimum alignment. 5967 5968This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. 5969 5970@item 5971Target-specific attributes that affect the identity of a type, such as 5972ia32 calling conventions on a function type (stdcall, regparm, etc.), 5973did not affect the mangled name, leading to name collisions when 5974function pointers were used as template arguments. 5975 5976This was fixed in @option{-fabi-version=10}, the default for GCC 6.1. 5977 5978@end itemize 5979 5980This option also enables warnings about psABI-related changes. 5981The known psABI changes at this point include: 5982 5983@itemize @bullet 5984 5985@item 5986For SysV/x86-64, unions with @code{long double} members are 5987passed in memory as specified in psABI. Prior to GCC 4.4, this was not 5988the case. For example: 5989 5990@smallexample 5991union U @{ 5992 long double ld; 5993 int i; 5994@}; 5995@end smallexample 5996 5997@noindent 5998@code{union U} is now always passed in memory. 5999 6000@end itemize 6001 6002@item -Wchar-subscripts 6003@opindex Wchar-subscripts 6004@opindex Wno-char-subscripts 6005Warn if an array subscript has type @code{char}. This is a common cause 6006of error, as programmers often forget that this type is signed on some 6007machines. 6008This warning is enabled by @option{-Wall}. 6009 6010@item -Wno-coverage-mismatch 6011@opindex Wno-coverage-mismatch 6012@opindex Wcoverage-mismatch 6013Warn if feedback profiles do not match when using the 6014@option{-fprofile-use} option. 6015If a source file is changed between compiling with @option{-fprofile-generate} 6016and with @option{-fprofile-use}, the files with the profile feedback can fail 6017to match the source file and GCC cannot use the profile feedback 6018information. By default, this warning is enabled and is treated as an 6019error. @option{-Wno-coverage-mismatch} can be used to disable the 6020warning or @option{-Wno-error=coverage-mismatch} can be used to 6021disable the error. Disabling the error for this warning can result in 6022poorly optimized code and is useful only in the 6023case of very minor changes such as bug fixes to an existing code-base. 6024Completely disabling the warning is not recommended. 6025 6026@item -Wno-coverage-invalid-line-number 6027@opindex Wno-coverage-invalid-line-number 6028@opindex Wcoverage-invalid-line-number 6029Warn in case a function ends earlier than it begins due 6030to an invalid linenum macros. The warning is emitted only 6031with @option{--coverage} enabled. 6032 6033By default, this warning is enabled and is treated as an 6034error. @option{-Wno-coverage-invalid-line-number} can be used to disable the 6035warning or @option{-Wno-error=coverage-invalid-line-number} can be used to 6036disable the error. 6037 6038@item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 6039@opindex Wno-cpp 6040@opindex Wcpp 6041Suppress warning messages emitted by @code{#warning} directives. 6042 6043@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 6044@opindex Wdouble-promotion 6045@opindex Wno-double-promotion 6046Give a warning when a value of type @code{float} is implicitly 6047promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 6048floating-point unit implement @code{float} in hardware, but emulate 6049@code{double} in software. On such a machine, doing computations 6050using @code{double} values is much more expensive because of the 6051overhead required for software emulation. 6052 6053It is easy to accidentally do computations with @code{double} because 6054floating-point literals are implicitly of type @code{double}. For 6055example, in: 6056@smallexample 6057@group 6058float area(float radius) 6059@{ 6060 return 3.14159 * radius * radius; 6061@} 6062@end group 6063@end smallexample 6064the compiler performs the entire computation with @code{double} 6065because the floating-point literal is a @code{double}. 6066 6067@item -Wduplicate-decl-specifier @r{(C and Objective-C only)} 6068@opindex Wduplicate-decl-specifier 6069@opindex Wno-duplicate-decl-specifier 6070Warn if a declaration has duplicate @code{const}, @code{volatile}, 6071@code{restrict} or @code{_Atomic} specifier. This warning is enabled by 6072@option{-Wall}. 6073 6074@item -Wformat 6075@itemx -Wformat=@var{n} 6076@opindex Wformat 6077@opindex Wno-format 6078@opindex ffreestanding 6079@opindex fno-builtin 6080@opindex Wformat= 6081Check calls to @code{printf} and @code{scanf}, etc., to make sure that 6082the arguments supplied have types appropriate to the format string 6083specified, and that the conversions specified in the format string make 6084sense. This includes standard functions, and others specified by format 6085attributes (@pxref{Function Attributes}), in the @code{printf}, 6086@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 6087not in the C standard) families (or other target-specific families). 6088Which functions are checked without format attributes having been 6089specified depends on the standard version selected, and such checks of 6090functions without the attribute specified are disabled by 6091@option{-ffreestanding} or @option{-fno-builtin}. 6092 6093The formats are checked against the format features supported by GNU 6094libc version 2.2. These include all ISO C90 and C99 features, as well 6095as features from the Single Unix Specification and some BSD and GNU 6096extensions. Other library implementations may not support all these 6097features; GCC does not support warning about features that go beyond a 6098particular library's limitations. However, if @option{-Wpedantic} is used 6099with @option{-Wformat}, warnings are given about format features not 6100in the selected standard version (but not for @code{strfmon} formats, 6101since those are not in any version of the C standard). @xref{C Dialect 6102Options,,Options Controlling C Dialect}. 6103 6104@table @gcctabopt 6105@item -Wformat=1 6106@itemx -Wformat 6107@opindex Wformat 6108@opindex Wformat=1 6109Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 6110@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 6111@option{-Wformat} also checks for null format arguments for several 6112functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 6113aspects of this level of format checking can be disabled by the 6114options: @option{-Wno-format-contains-nul}, 6115@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 6116@option{-Wformat} is enabled by @option{-Wall}. 6117 6118@item -Wformat=2 6119@opindex Wformat=2 6120Enable @option{-Wformat} plus additional format checks. Currently 6121equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 6122-Wformat-y2k}. 6123@end table 6124 6125@item -Wno-format-contains-nul 6126@opindex Wno-format-contains-nul 6127@opindex Wformat-contains-nul 6128If @option{-Wformat} is specified, do not warn about format strings that 6129contain NUL bytes. 6130 6131@item -Wno-format-extra-args 6132@opindex Wno-format-extra-args 6133@opindex Wformat-extra-args 6134If @option{-Wformat} is specified, do not warn about excess arguments to a 6135@code{printf} or @code{scanf} format function. The C standard specifies 6136that such arguments are ignored. 6137 6138Where the unused arguments lie between used arguments that are 6139specified with @samp{$} operand number specifications, normally 6140warnings are still given, since the implementation could not know what 6141type to pass to @code{va_arg} to skip the unused arguments. However, 6142in the case of @code{scanf} formats, this option suppresses the 6143warning if the unused arguments are all pointers, since the Single 6144Unix Specification says that such unused arguments are allowed. 6145 6146@item -Wformat-overflow 6147@itemx -Wformat-overflow=@var{level} 6148@opindex Wformat-overflow 6149@opindex Wno-format-overflow 6150Warn about calls to formatted input/output functions such as @code{sprintf} 6151and @code{vsprintf} that might overflow the destination buffer. When the 6152exact number of bytes written by a format directive cannot be determined 6153at compile-time it is estimated based on heuristics that depend on the 6154@var{level} argument and on optimization. While enabling optimization 6155will in most cases improve the accuracy of the warning, it may also 6156result in false positives. 6157 6158@table @gcctabopt 6159@item -Wformat-overflow 6160@itemx -Wformat-overflow=1 6161@opindex Wformat-overflow 6162@opindex Wno-format-overflow 6163Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat} 6164employs a conservative approach that warns only about calls that most 6165likely overflow the buffer. At this level, numeric arguments to format 6166directives with unknown values are assumed to have the value of one, and 6167strings of unknown length to be empty. Numeric arguments that are known 6168to be bounded to a subrange of their type, or string arguments whose output 6169is bounded either by their directive's precision or by a finite set of 6170string literals, are assumed to take on the value within the range that 6171results in the most bytes on output. For example, the call to @code{sprintf} 6172below is diagnosed because even with both @var{a} and @var{b} equal to zero, 6173the terminating NUL character (@code{'\0'}) appended by the function 6174to the destination buffer will be written past its end. Increasing 6175the size of the buffer by a single byte is sufficient to avoid the 6176warning, though it may not be sufficient to avoid the overflow. 6177 6178@smallexample 6179void f (int a, int b) 6180@{ 6181 char buf [13]; 6182 sprintf (buf, "a = %i, b = %i\n", a, b); 6183@} 6184@end smallexample 6185 6186@item -Wformat-overflow=2 6187Level @var{2} warns also about calls that might overflow the destination 6188buffer given an argument of sufficient length or magnitude. At level 6189@var{2}, unknown numeric arguments are assumed to have the minimum 6190representable value for signed types with a precision greater than 1, and 6191the maximum representable value otherwise. Unknown string arguments whose 6192length cannot be assumed to be bounded either by the directive's precision, 6193or by a finite set of string literals they may evaluate to, or the character 6194array they may point to, are assumed to be 1 character long. 6195 6196At level @var{2}, the call in the example above is again diagnosed, but 6197this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first 6198@code{%i} directive will write some of its digits beyond the end of 6199the destination buffer. To make the call safe regardless of the values 6200of the two variables, the size of the destination buffer must be increased 6201to at least 34 bytes. GCC includes the minimum size of the buffer in 6202an informational note following the warning. 6203 6204An alternative to increasing the size of the destination buffer is to 6205constrain the range of formatted values. The maximum length of string 6206arguments can be bounded by specifying the precision in the format 6207directive. When numeric arguments of format directives can be assumed 6208to be bounded by less than the precision of their type, choosing 6209an appropriate length modifier to the format specifier will reduce 6210the required buffer size. For example, if @var{a} and @var{b} in the 6211example above can be assumed to be within the precision of 6212the @code{short int} type then using either the @code{%hi} format 6213directive or casting the argument to @code{short} reduces the maximum 6214required size of the buffer to 24 bytes. 6215 6216@smallexample 6217void f (int a, int b) 6218@{ 6219 char buf [23]; 6220 sprintf (buf, "a = %hi, b = %i\n", a, (short)b); 6221@} 6222@end smallexample 6223@end table 6224 6225@item -Wno-format-zero-length 6226@opindex Wno-format-zero-length 6227@opindex Wformat-zero-length 6228If @option{-Wformat} is specified, do not warn about zero-length formats. 6229The C standard specifies that zero-length formats are allowed. 6230 6231@item -Wformat-nonliteral 6232@opindex Wformat-nonliteral 6233@opindex Wno-format-nonliteral 6234If @option{-Wformat} is specified, also warn if the format string is not a 6235string literal and so cannot be checked, unless the format function 6236takes its format arguments as a @code{va_list}. 6237 6238@item -Wformat-security 6239@opindex Wformat-security 6240@opindex Wno-format-security 6241If @option{-Wformat} is specified, also warn about uses of format 6242functions that represent possible security problems. At present, this 6243warns about calls to @code{printf} and @code{scanf} functions where the 6244format string is not a string literal and there are no format arguments, 6245as in @code{printf (foo);}. This may be a security hole if the format 6246string came from untrusted input and contains @samp{%n}. (This is 6247currently a subset of what @option{-Wformat-nonliteral} warns about, but 6248in future warnings may be added to @option{-Wformat-security} that are not 6249included in @option{-Wformat-nonliteral}.) 6250 6251@item -Wformat-signedness 6252@opindex Wformat-signedness 6253@opindex Wno-format-signedness 6254If @option{-Wformat} is specified, also warn if the format string 6255requires an unsigned argument and the argument is signed and vice versa. 6256 6257@item -Wformat-truncation 6258@itemx -Wformat-truncation=@var{level} 6259@opindex Wformat-truncation 6260@opindex Wno-format-truncation 6261Warn about calls to formatted input/output functions such as @code{snprintf} 6262and @code{vsnprintf} that might result in output truncation. When the exact 6263number of bytes written by a format directive cannot be determined at 6264compile-time it is estimated based on heuristics that depend on 6265the @var{level} argument and on optimization. While enabling optimization 6266will in most cases improve the accuracy of the warning, it may also result 6267in false positives. Except as noted otherwise, the option uses the same 6268logic @option{-Wformat-overflow}. 6269 6270@table @gcctabopt 6271@item -Wformat-truncation 6272@itemx -Wformat-truncation=1 6273@opindex Wformat-truncation 6274@opindex Wno-format-truncation 6275Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat} 6276employs a conservative approach that warns only about calls to bounded 6277functions whose return value is unused and that will most likely result 6278in output truncation. 6279 6280@item -Wformat-truncation=2 6281Level @var{2} warns also about calls to bounded functions whose return 6282value is used and that might result in truncation given an argument of 6283sufficient length or magnitude. 6284@end table 6285 6286@item -Wformat-y2k 6287@opindex Wformat-y2k 6288@opindex Wno-format-y2k 6289If @option{-Wformat} is specified, also warn about @code{strftime} 6290formats that may yield only a two-digit year. 6291 6292@item -Wnonnull 6293@opindex Wnonnull 6294@opindex Wno-nonnull 6295Warn about passing a null pointer for arguments marked as 6296requiring a non-null value by the @code{nonnull} function attribute. 6297 6298@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 6299can be disabled with the @option{-Wno-nonnull} option. 6300 6301@item -Wnonnull-compare 6302@opindex Wnonnull-compare 6303@opindex Wno-nonnull-compare 6304Warn when comparing an argument marked with the @code{nonnull} 6305function attribute against null inside the function. 6306 6307@option{-Wnonnull-compare} is included in @option{-Wall}. It 6308can be disabled with the @option{-Wno-nonnull-compare} option. 6309 6310@item -Wnull-dereference 6311@opindex Wnull-dereference 6312@opindex Wno-null-dereference 6313Warn if the compiler detects paths that trigger erroneous or 6314undefined behavior due to dereferencing a null pointer. This option 6315is only active when @option{-fdelete-null-pointer-checks} is active, 6316which is enabled by optimizations in most targets. The precision of 6317the warnings depends on the optimization options used. 6318 6319@item -Winfinite-recursion 6320@opindex Winfinite-recursion 6321@opindex Wno-infinite-recursion 6322Warn about infinitely recursive calls. The warning is effective at all 6323optimization levels but requires optimization in order to detect infinite 6324recursion in calls between two or more functions. 6325@option{-Winfinite-recursion} is included in @option{-Wall}. 6326 6327@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 6328@opindex Winit-self 6329@opindex Wno-init-self 6330Warn about uninitialized variables that are initialized with themselves. 6331Note this option can only be used with the @option{-Wuninitialized} option. 6332 6333For example, GCC warns about @code{i} being uninitialized in the 6334following snippet only when @option{-Winit-self} has been specified: 6335@smallexample 6336@group 6337int f() 6338@{ 6339 int i = i; 6340 return i; 6341@} 6342@end group 6343@end smallexample 6344 6345This warning is enabled by @option{-Wall} in C++. 6346 6347@item -Wno-implicit-int @r{(C and Objective-C only)} 6348@opindex Wimplicit-int 6349@opindex Wno-implicit-int 6350This option controls warnings when a declaration does not specify a type. 6351This warning is enabled by default in C99 and later dialects of C, 6352and also by @option{-Wall}. 6353 6354@item -Wno-implicit-function-declaration @r{(C and Objective-C only)} 6355@opindex Wimplicit-function-declaration 6356@opindex Wno-implicit-function-declaration 6357This option controls warnings when a function is used before being declared. 6358This warning is enabled by default in C99 and later dialects of C, 6359and also by @option{-Wall}. 6360The warning is made into an error by @option{-pedantic-errors}. 6361 6362@item -Wimplicit @r{(C and Objective-C only)} 6363@opindex Wimplicit 6364@opindex Wno-implicit 6365Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 6366This warning is enabled by @option{-Wall}. 6367 6368@item -Wimplicit-fallthrough 6369@opindex Wimplicit-fallthrough 6370@opindex Wno-implicit-fallthrough 6371@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3} 6372and @option{-Wno-implicit-fallthrough} is the same as 6373@option{-Wimplicit-fallthrough=0}. 6374 6375@item -Wimplicit-fallthrough=@var{n} 6376@opindex Wimplicit-fallthrough= 6377Warn when a switch case falls through. For example: 6378 6379@smallexample 6380@group 6381switch (cond) 6382 @{ 6383 case 1: 6384 a = 1; 6385 break; 6386 case 2: 6387 a = 2; 6388 case 3: 6389 a = 3; 6390 break; 6391 @} 6392@end group 6393@end smallexample 6394 6395This warning does not warn when the last statement of a case cannot 6396fall through, e.g. when there is a return statement or a call to function 6397declared with the noreturn attribute. @option{-Wimplicit-fallthrough=} 6398also takes into account control flow statements, such as ifs, and only 6399warns when appropriate. E.g.@: 6400 6401@smallexample 6402@group 6403switch (cond) 6404 @{ 6405 case 1: 6406 if (i > 3) @{ 6407 bar (5); 6408 break; 6409 @} else if (i < 1) @{ 6410 bar (0); 6411 @} else 6412 return; 6413 default: 6414 @dots{} 6415 @} 6416@end group 6417@end smallexample 6418 6419Since there are occasions where a switch case fall through is desirable, 6420GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is 6421to be used along with a null statement to suppress this warning that 6422would normally occur: 6423 6424@smallexample 6425@group 6426switch (cond) 6427 @{ 6428 case 1: 6429 bar (0); 6430 __attribute__ ((fallthrough)); 6431 default: 6432 @dots{} 6433 @} 6434@end group 6435@end smallexample 6436 6437C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough} 6438warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11 6439or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension. 6440Instead of these attributes, it is also possible to add a fallthrough comment 6441to silence the warning. The whole body of the C or C++ style comment should 6442match the given regular expressions listed below. The option argument @var{n} 6443specifies what kind of comments are accepted: 6444 6445@itemize @bullet 6446 6447@item @option{-Wimplicit-fallthrough=0} disables the warning altogether. 6448 6449@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular 6450expression, any comment is used as fallthrough comment. 6451 6452@item @option{-Wimplicit-fallthrough=2} case insensitively matches 6453@code{.*falls?[ \t-]*thr(ough|u).*} regular expression. 6454 6455@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the 6456following regular expressions: 6457 6458@itemize @bullet 6459 6460@item @code{-fallthrough} 6461 6462@item @code{@@fallthrough@@} 6463 6464@item @code{lint -fallthrough[ \t]*} 6465 6466@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?} 6467 6468@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?} 6469 6470@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?} 6471 6472@end itemize 6473 6474@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the 6475following regular expressions: 6476 6477@itemize @bullet 6478 6479@item @code{-fallthrough} 6480 6481@item @code{@@fallthrough@@} 6482 6483@item @code{lint -fallthrough[ \t]*} 6484 6485@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*} 6486 6487@end itemize 6488 6489@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as 6490fallthrough comments, only attributes disable the warning. 6491 6492@end itemize 6493 6494The comment needs to be followed after optional whitespace and other comments 6495by @code{case} or @code{default} keywords or by a user label that precedes some 6496@code{case} or @code{default} label. 6497 6498@smallexample 6499@group 6500switch (cond) 6501 @{ 6502 case 1: 6503 bar (0); 6504 /* FALLTHRU */ 6505 default: 6506 @dots{} 6507 @} 6508@end group 6509@end smallexample 6510 6511The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}. 6512 6513@item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 6514@opindex Wif-not-aligned 6515@opindex Wno-if-not-aligned 6516Control if warnings triggered by the @code{warn_if_not_aligned} attribute 6517should be issued. These warnings are enabled by default. 6518 6519@item -Wignored-qualifiers @r{(C and C++ only)} 6520@opindex Wignored-qualifiers 6521@opindex Wno-ignored-qualifiers 6522Warn if the return type of a function has a type qualifier 6523such as @code{const}. For ISO C such a type qualifier has no effect, 6524since the value returned by a function is not an lvalue. 6525For C++, the warning is only emitted for scalar types or @code{void}. 6526ISO C prohibits qualified @code{void} return types on function 6527definitions, so such return types always receive a warning 6528even without this option. 6529 6530This warning is also enabled by @option{-Wextra}. 6531 6532@item -Wno-ignored-attributes @r{(C and C++ only)} 6533@opindex Wignored-attributes 6534@opindex Wno-ignored-attributes 6535This option controls warnings when an attribute is ignored. 6536This is different from the 6537@option{-Wattributes} option in that it warns whenever the compiler decides 6538to drop an attribute, not that the attribute is either unknown, used in a 6539wrong place, etc. This warning is enabled by default. 6540 6541@item -Wmain 6542@opindex Wmain 6543@opindex Wno-main 6544Warn if the type of @code{main} is suspicious. @code{main} should be 6545a function with external linkage, returning int, taking either zero 6546arguments, two, or three arguments of appropriate types. This warning 6547is enabled by default in C++ and is enabled by either @option{-Wall} 6548or @option{-Wpedantic}. 6549 6550@item -Wmisleading-indentation @r{(C and C++ only)} 6551@opindex Wmisleading-indentation 6552@opindex Wno-misleading-indentation 6553Warn when the indentation of the code does not reflect the block structure. 6554Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and 6555@code{for} clauses with a guarded statement that does not use braces, 6556followed by an unguarded statement with the same indentation. 6557 6558In the following example, the call to ``bar'' is misleadingly indented as 6559if it were guarded by the ``if'' conditional. 6560 6561@smallexample 6562 if (some_condition ()) 6563 foo (); 6564 bar (); /* Gotcha: this is not guarded by the "if". */ 6565@end smallexample 6566 6567In the case of mixed tabs and spaces, the warning uses the 6568@option{-ftabstop=} option to determine if the statements line up 6569(defaulting to 8). 6570 6571The warning is not issued for code involving multiline preprocessor logic 6572such as the following example. 6573 6574@smallexample 6575 if (flagA) 6576 foo (0); 6577#if SOME_CONDITION_THAT_DOES_NOT_HOLD 6578 if (flagB) 6579#endif 6580 foo (1); 6581@end smallexample 6582 6583The warning is not issued after a @code{#line} directive, since this 6584typically indicates autogenerated code, and no assumptions can be made 6585about the layout of the file that the directive references. 6586 6587This warning is enabled by @option{-Wall} in C and C++. 6588 6589@item -Wmissing-attributes 6590@opindex Wmissing-attributes 6591@opindex Wno-missing-attributes 6592Warn when a declaration of a function is missing one or more attributes 6593that a related function is declared with and whose absence may adversely 6594affect the correctness or efficiency of generated code. For example, 6595the warning is issued for declarations of aliases that use attributes 6596to specify less restrictive requirements than those of their targets. 6597This typically represents a potential optimization opportunity. 6598By contrast, the @option{-Wattribute-alias=2} option controls warnings 6599issued when the alias is more restrictive than the target, which could 6600lead to incorrect code generation. 6601Attributes considered include @code{alloc_align}, @code{alloc_size}, 6602@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 6603@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 6604@code{returns_nonnull}, and @code{returns_twice}. 6605 6606In C++, the warning is issued when an explicit specialization of a primary 6607template declared with attribute @code{alloc_align}, @code{alloc_size}, 6608@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc}, 6609or @code{nonnull} is declared without it. Attributes @code{deprecated}, 6610@code{error}, and @code{warning} suppress the warning. 6611(@pxref{Function Attributes}). 6612 6613You can use the @code{copy} attribute to apply the same 6614set of attributes to a declaration as that on another declaration without 6615explicitly enumerating the attributes. This attribute can be applied 6616to declarations of functions (@pxref{Common Function Attributes}), 6617variables (@pxref{Common Variable Attributes}), or types 6618(@pxref{Common Type Attributes}). 6619 6620@option{-Wmissing-attributes} is enabled by @option{-Wall}. 6621 6622For example, since the declaration of the primary function template 6623below makes use of both attribute @code{malloc} and @code{alloc_size} 6624the declaration of the explicit specialization of the template is 6625diagnosed because it is missing one of the attributes. 6626 6627@smallexample 6628template <class T> 6629T* __attribute__ ((malloc, alloc_size (1))) 6630allocate (size_t); 6631 6632template <> 6633void* __attribute__ ((malloc)) // missing alloc_size 6634allocate<void> (size_t); 6635@end smallexample 6636 6637@item -Wmissing-braces 6638@opindex Wmissing-braces 6639@opindex Wno-missing-braces 6640Warn if an aggregate or union initializer is not fully bracketed. In 6641the following example, the initializer for @code{a} is not fully 6642bracketed, but that for @code{b} is fully bracketed. 6643 6644@smallexample 6645int a[2][2] = @{ 0, 1, 2, 3 @}; 6646int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 6647@end smallexample 6648 6649This warning is enabled by @option{-Wall}. 6650 6651@item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)} 6652@opindex Wmissing-include-dirs 6653@opindex Wno-missing-include-dirs 6654Warn if a user-supplied include directory does not exist. This option is disabled 6655by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially 6656enabled by default by warning for -I and -J, only. 6657 6658@item -Wno-missing-profile 6659@opindex Wmissing-profile 6660@opindex Wno-missing-profile 6661This option controls warnings if feedback profiles are missing when using the 6662@option{-fprofile-use} option. 6663This option diagnoses those cases where a new function or a new file is added 6664between compiling with @option{-fprofile-generate} and with 6665@option{-fprofile-use}, without regenerating the profiles. 6666In these cases, the profile feedback data files do not contain any 6667profile feedback information for 6668the newly added function or file respectively. Also, in the case when profile 6669count data (.gcda) files are removed, GCC cannot use any profile feedback 6670information. In all these cases, warnings are issued to inform you that a 6671profile generation step is due. 6672Ignoring the warning can result in poorly optimized code. 6673@option{-Wno-missing-profile} can be used to 6674disable the warning, but this is not recommended and should be done only 6675when non-existent profile data is justified. 6676 6677@item -Wmismatched-dealloc 6678@opindex Wmismatched-dealloc 6679@opindex Wno-mismatched-dealloc 6680 6681Warn for calls to deallocation functions with pointer arguments returned 6682from from allocations functions for which the former isn't a suitable 6683deallocator. A pair of functions can be associated as matching allocators 6684and deallocators by use of attribute @code{malloc}. Unless disabled by 6685the @option{-fno-builtin} option the standard functions @code{calloc}, 6686@code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding 6687forms of C++ @code{operator new} and @code{operator delete} are implicitly 6688associated as matching allocators and deallocators. In the following 6689example @code{mydealloc} is the deallocator for pointers returned from 6690@code{myalloc}. 6691 6692@smallexample 6693void mydealloc (void*); 6694 6695__attribute__ ((malloc (mydealloc, 1))) void* 6696myalloc (size_t); 6697 6698void f (void) 6699@{ 6700 void *p = myalloc (32); 6701 // @dots{}use p@dots{} 6702 free (p); // warning: not a matching deallocator for myalloc 6703 mydealloc (p); // ok 6704@} 6705@end smallexample 6706 6707In C++, the related option @option{-Wmismatched-new-delete} diagnoses 6708mismatches involving either @code{operator new} or @code{operator delete}. 6709 6710Option @option{-Wmismatched-dealloc} is included in @option{-Wall}. 6711 6712@item -Wmultistatement-macros 6713@opindex Wmultistatement-macros 6714@opindex Wno-multistatement-macros 6715Warn about unsafe multiple statement macros that appear to be guarded 6716by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or 6717@code{while}, in which only the first statement is actually guarded after 6718the macro is expanded. 6719 6720For example: 6721 6722@smallexample 6723#define DOIT x++; y++ 6724if (c) 6725 DOIT; 6726@end smallexample 6727 6728will increment @code{y} unconditionally, not just when @code{c} holds. 6729The can usually be fixed by wrapping the macro in a do-while loop: 6730@smallexample 6731#define DOIT do @{ x++; y++; @} while (0) 6732if (c) 6733 DOIT; 6734@end smallexample 6735 6736This warning is enabled by @option{-Wall} in C and C++. 6737 6738@item -Wparentheses 6739@opindex Wparentheses 6740@opindex Wno-parentheses 6741Warn if parentheses are omitted in certain contexts, such 6742as when there is an assignment in a context where a truth value 6743is expected, or when operators are nested whose precedence people 6744often get confused about. 6745 6746Also warn if a comparison like @code{x<=y<=z} appears; this is 6747equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 6748interpretation from that of ordinary mathematical notation. 6749 6750Also warn for dangerous uses of the GNU extension to 6751@code{?:} with omitted middle operand. When the condition 6752in the @code{?}: operator is a boolean expression, the omitted value is 6753always 1. Often programmers expect it to be a value computed 6754inside the conditional expression instead. 6755 6756For C++ this also warns for some cases of unnecessary parentheses in 6757declarations, which can indicate an attempt at a function call instead 6758of a declaration: 6759@smallexample 6760@{ 6761 // Declares a local variable called mymutex. 6762 std::unique_lock<std::mutex> (mymutex); 6763 // User meant std::unique_lock<std::mutex> lock (mymutex); 6764@} 6765@end smallexample 6766 6767This warning is enabled by @option{-Wall}. 6768 6769@item -Wsequence-point 6770@opindex Wsequence-point 6771@opindex Wno-sequence-point 6772Warn about code that may have undefined semantics because of violations 6773of sequence point rules in the C and C++ standards. 6774 6775The C and C++ standards define the order in which expressions in a C/C++ 6776program are evaluated in terms of @dfn{sequence points}, which represent 6777a partial ordering between the execution of parts of the program: those 6778executed before the sequence point, and those executed after it. These 6779occur after the evaluation of a full expression (one which is not part 6780of a larger expression), after the evaluation of the first operand of a 6781@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 6782function is called (but after the evaluation of its arguments and the 6783expression denoting the called function), and in certain other places. 6784Other than as expressed by the sequence point rules, the order of 6785evaluation of subexpressions of an expression is not specified. All 6786these rules describe only a partial order rather than a total order, 6787since, for example, if two functions are called within one expression 6788with no sequence point between them, the order in which the functions 6789are called is not specified. However, the standards committee have 6790ruled that function calls do not overlap. 6791 6792It is not specified when between sequence points modifications to the 6793values of objects take effect. Programs whose behavior depends on this 6794have undefined behavior; the C and C++ standards specify that ``Between 6795the previous and next sequence point an object shall have its stored 6796value modified at most once by the evaluation of an expression. 6797Furthermore, the prior value shall be read only to determine the value 6798to be stored.''. If a program breaks these rules, the results on any 6799particular implementation are entirely unpredictable. 6800 6801Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 6802= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 6803diagnosed by this option, and it may give an occasional false positive 6804result, but in general it has been found fairly effective at detecting 6805this sort of problem in programs. 6806 6807The C++17 standard will define the order of evaluation of operands in 6808more cases: in particular it requires that the right-hand side of an 6809assignment be evaluated before the left-hand side, so the above 6810examples are no longer undefined. But this option will still warn 6811about them, to help people avoid writing code that is undefined in C 6812and earlier revisions of C++. 6813 6814The standard is worded confusingly, therefore there is some debate 6815over the precise meaning of the sequence point rules in subtle cases. 6816Links to discussions of the problem, including proposed formal 6817definitions, may be found on the GCC readings page, at 6818@uref{https://gcc.gnu.org/@/readings.html}. 6819 6820This warning is enabled by @option{-Wall} for C and C++. 6821 6822@item -Wno-return-local-addr 6823@opindex Wno-return-local-addr 6824@opindex Wreturn-local-addr 6825Do not warn about returning a pointer (or in C++, a reference) to a 6826variable that goes out of scope after the function returns. 6827 6828@item -Wreturn-type 6829@opindex Wreturn-type 6830@opindex Wno-return-type 6831Warn whenever a function is defined with a return type that defaults 6832to @code{int}. Also warn about any @code{return} statement with no 6833return value in a function whose return type is not @code{void} 6834(falling off the end of the function body is considered returning 6835without a value). 6836 6837For C only, warn about a @code{return} statement with an expression in a 6838function whose return type is @code{void}, unless the expression type is 6839also @code{void}. As a GNU extension, the latter case is accepted 6840without a warning unless @option{-Wpedantic} is used. Attempting 6841to use the return value of a non-@code{void} function other than @code{main} 6842that flows off the end by reaching the closing curly brace that terminates 6843the function is undefined. 6844 6845Unlike in C, in C++, flowing off the end of a non-@code{void} function other 6846than @code{main} results in undefined behavior even when the value of 6847the function is not used. 6848 6849This warning is enabled by default in C++ and by @option{-Wall} otherwise. 6850 6851@item -Wno-shift-count-negative 6852@opindex Wshift-count-negative 6853@opindex Wno-shift-count-negative 6854Controls warnings if a shift count is negative. 6855This warning is enabled by default. 6856 6857@item -Wno-shift-count-overflow 6858@opindex Wshift-count-overflow 6859@opindex Wno-shift-count-overflow 6860Controls warnings if a shift count is greater than or equal to the bit width 6861of the type. This warning is enabled by default. 6862 6863@item -Wshift-negative-value 6864@opindex Wshift-negative-value 6865@opindex Wno-shift-negative-value 6866Warn if left shifting a negative value. This warning is enabled by 6867@option{-Wextra} in C99 (and newer) and C++11 to C++17 modes. 6868 6869@item -Wno-shift-overflow 6870@itemx -Wshift-overflow=@var{n} 6871@opindex Wshift-overflow 6872@opindex Wno-shift-overflow 6873These options control warnings about left shift overflows. 6874 6875@table @gcctabopt 6876@item -Wshift-overflow=1 6877This is the warning level of @option{-Wshift-overflow} and is enabled 6878by default in C99 and C++11 modes (and newer). This warning level does 6879not warn about left-shifting 1 into the sign bit. (However, in C, such 6880an overflow is still rejected in contexts where an integer constant expression 6881is required.) No warning is emitted in C++20 mode (and newer), as signed left 6882shifts always wrap. 6883 6884@item -Wshift-overflow=2 6885This warning level also warns about left-shifting 1 into the sign bit, 6886unless C++14 mode (or newer) is active. 6887@end table 6888 6889@item -Wswitch 6890@opindex Wswitch 6891@opindex Wno-switch 6892Warn whenever a @code{switch} statement has an index of enumerated type 6893and lacks a @code{case} for one or more of the named codes of that 6894enumeration. (The presence of a @code{default} label prevents this 6895warning.) @code{case} labels outside the enumeration range also 6896provoke warnings when this option is used (even if there is a 6897@code{default} label). 6898This warning is enabled by @option{-Wall}. 6899 6900@item -Wswitch-default 6901@opindex Wswitch-default 6902@opindex Wno-switch-default 6903Warn whenever a @code{switch} statement does not have a @code{default} 6904case. 6905 6906@item -Wswitch-enum 6907@opindex Wswitch-enum 6908@opindex Wno-switch-enum 6909Warn whenever a @code{switch} statement has an index of enumerated type 6910and lacks a @code{case} for one or more of the named codes of that 6911enumeration. @code{case} labels outside the enumeration range also 6912provoke warnings when this option is used. The only difference 6913between @option{-Wswitch} and this option is that this option gives a 6914warning about an omitted enumeration code even if there is a 6915@code{default} label. 6916 6917@item -Wno-switch-bool 6918@opindex Wswitch-bool 6919@opindex Wno-switch-bool 6920Do not warn when a @code{switch} statement has an index of boolean type 6921and the case values are outside the range of a boolean type. 6922It is possible to suppress this warning by casting the controlling 6923expression to a type other than @code{bool}. For example: 6924@smallexample 6925@group 6926switch ((int) (a == 4)) 6927 @{ 6928 @dots{} 6929 @} 6930@end group 6931@end smallexample 6932This warning is enabled by default for C and C++ programs. 6933 6934@item -Wno-switch-outside-range 6935@opindex Wswitch-outside-range 6936@opindex Wno-switch-outside-range 6937This option controls warnings when a @code{switch} case has a value 6938that is outside of its 6939respective type range. This warning is enabled by default for 6940C and C++ programs. 6941 6942@item -Wno-switch-unreachable 6943@opindex Wswitch-unreachable 6944@opindex Wno-switch-unreachable 6945Do not warn when a @code{switch} statement contains statements between the 6946controlling expression and the first case label, which will never be 6947executed. For example: 6948@smallexample 6949@group 6950switch (cond) 6951 @{ 6952 i = 15; 6953 @dots{} 6954 case 5: 6955 @dots{} 6956 @} 6957@end group 6958@end smallexample 6959@option{-Wswitch-unreachable} does not warn if the statement between the 6960controlling expression and the first case label is just a declaration: 6961@smallexample 6962@group 6963switch (cond) 6964 @{ 6965 int i; 6966 @dots{} 6967 case 5: 6968 i = 5; 6969 @dots{} 6970 @} 6971@end group 6972@end smallexample 6973This warning is enabled by default for C and C++ programs. 6974 6975@item -Wsync-nand @r{(C and C++ only)} 6976@opindex Wsync-nand 6977@opindex Wno-sync-nand 6978Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 6979built-in functions are used. These functions changed semantics in GCC 4.4. 6980 6981@item -Wtrivial-auto-var-init 6982@opindex Wtrivial-auto-var-init 6983@opindex Wno-trivial-auto-var-init 6984Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic 6985variable. A common situation is an automatic variable that is declared 6986between the controlling expression and the first case label of a @code{switch} 6987statement. 6988 6989@item -Wunused-but-set-parameter 6990@opindex Wunused-but-set-parameter 6991@opindex Wno-unused-but-set-parameter 6992Warn whenever a function parameter is assigned to, but otherwise unused 6993(aside from its declaration). 6994 6995To suppress this warning use the @code{unused} attribute 6996(@pxref{Variable Attributes}). 6997 6998This warning is also enabled by @option{-Wunused} together with 6999@option{-Wextra}. 7000 7001@item -Wunused-but-set-variable 7002@opindex Wunused-but-set-variable 7003@opindex Wno-unused-but-set-variable 7004Warn whenever a local variable is assigned to, but otherwise unused 7005(aside from its declaration). 7006This warning is enabled by @option{-Wall}. 7007 7008To suppress this warning use the @code{unused} attribute 7009(@pxref{Variable Attributes}). 7010 7011This warning is also enabled by @option{-Wunused}, which is enabled 7012by @option{-Wall}. 7013 7014@item -Wunused-function 7015@opindex Wunused-function 7016@opindex Wno-unused-function 7017Warn whenever a static function is declared but not defined or a 7018non-inline static function is unused. 7019This warning is enabled by @option{-Wall}. 7020 7021@item -Wunused-label 7022@opindex Wunused-label 7023@opindex Wno-unused-label 7024Warn whenever a label is declared but not used. 7025This warning is enabled by @option{-Wall}. 7026 7027To suppress this warning use the @code{unused} attribute 7028(@pxref{Variable Attributes}). 7029 7030@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 7031@opindex Wunused-local-typedefs 7032@opindex Wno-unused-local-typedefs 7033Warn when a typedef locally defined in a function is not used. 7034This warning is enabled by @option{-Wall}. 7035 7036@item -Wunused-parameter 7037@opindex Wunused-parameter 7038@opindex Wno-unused-parameter 7039Warn whenever a function parameter is unused aside from its declaration. 7040 7041To suppress this warning use the @code{unused} attribute 7042(@pxref{Variable Attributes}). 7043 7044@item -Wno-unused-result 7045@opindex Wunused-result 7046@opindex Wno-unused-result 7047Do not warn if a caller of a function marked with attribute 7048@code{warn_unused_result} (@pxref{Function Attributes}) does not use 7049its return value. The default is @option{-Wunused-result}. 7050 7051@item -Wunused-variable 7052@opindex Wunused-variable 7053@opindex Wno-unused-variable 7054Warn whenever a local or static variable is unused aside from its 7055declaration. This option implies @option{-Wunused-const-variable=1} for C, 7056but not for C++. This warning is enabled by @option{-Wall}. 7057 7058To suppress this warning use the @code{unused} attribute 7059(@pxref{Variable Attributes}). 7060 7061@item -Wunused-const-variable 7062@itemx -Wunused-const-variable=@var{n} 7063@opindex Wunused-const-variable 7064@opindex Wno-unused-const-variable 7065Warn whenever a constant static variable is unused aside from its declaration. 7066@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable} 7067for C, but not for C++. In C this declares variable storage, but in C++ this 7068is not an error since const variables take the place of @code{#define}s. 7069 7070To suppress this warning use the @code{unused} attribute 7071(@pxref{Variable Attributes}). 7072 7073@table @gcctabopt 7074@item -Wunused-const-variable=1 7075This is the warning level that is enabled by @option{-Wunused-variable} for 7076C. It warns only about unused static const variables defined in the main 7077compilation unit, but not about static const variables declared in any 7078header included. 7079 7080@item -Wunused-const-variable=2 7081This warning level also warns for unused constant static variables in 7082headers (excluding system headers). This is the warning level of 7083@option{-Wunused-const-variable} and must be explicitly requested since 7084in C++ this isn't an error and in C it might be harder to clean up all 7085headers included. 7086@end table 7087 7088@item -Wunused-value 7089@opindex Wunused-value 7090@opindex Wno-unused-value 7091Warn whenever a statement computes a result that is explicitly not 7092used. To suppress this warning cast the unused expression to 7093@code{void}. This includes an expression-statement or the left-hand 7094side of a comma expression that contains no side effects. For example, 7095an expression such as @code{x[i,j]} causes a warning, while 7096@code{x[(void)i,j]} does not. 7097 7098This warning is enabled by @option{-Wall}. 7099 7100@item -Wunused 7101@opindex Wunused 7102@opindex Wno-unused 7103All the above @option{-Wunused} options combined. 7104 7105In order to get a warning about an unused function parameter, you must 7106either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 7107@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 7108 7109@item -Wuninitialized 7110@opindex Wuninitialized 7111@opindex Wno-uninitialized 7112Warn if an object with automatic or allocated storage duration is used 7113without having been initialized. In C++, also warn if a non-static 7114reference or non-static @code{const} member appears in a class without 7115constructors. 7116 7117In addition, passing a pointer (or in C++, a reference) to an uninitialized 7118object to a @code{const}-qualified argument of a built-in function known to 7119read the object is also diagnosed by this warning. 7120(@option{-Wmaybe-uninitialized} is issued for ordinary functions.) 7121 7122If you want to warn about code that uses the uninitialized value of the 7123variable in its own initializer, use the @option{-Winit-self} option. 7124 7125These warnings occur for individual uninitialized elements of 7126structure, union or array variables as well as for variables that are 7127uninitialized as a whole. They do not occur for variables or elements 7128declared @code{volatile}. Because these warnings depend on 7129optimization, the exact variables or elements for which there are 7130warnings depend on the precise optimization options and version of GCC 7131used. 7132 7133Note that there may be no warning about a variable that is used only 7134to compute a value that itself is never used, because such 7135computations may be deleted by data flow analysis before the warnings 7136are printed. 7137 7138In C++, this warning also warns about using uninitialized objects in 7139member-initializer-lists. For example, GCC warns about @code{b} being 7140uninitialized in the following snippet: 7141 7142@smallexample 7143struct A @{ 7144 int a; 7145 int b; 7146 A() : a(b) @{ @} 7147@}; 7148@end smallexample 7149 7150@item -Wno-invalid-memory-model 7151@opindex Winvalid-memory-model 7152@opindex Wno-invalid-memory-model 7153This option controls warnings 7154for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, 7155and the C11 atomic generic functions with a memory consistency argument 7156that is either invalid for the operation or outside the range of values 7157of the @code{memory_order} enumeration. For example, since the 7158@code{__atomic_store} and @code{__atomic_store_n} built-ins are only 7159defined for the relaxed, release, and sequentially consistent memory 7160orders the following code is diagnosed: 7161 7162@smallexample 7163void store (int *i) 7164@{ 7165 __atomic_store_n (i, 0, memory_order_consume); 7166@} 7167@end smallexample 7168 7169@option{-Winvalid-memory-model} is enabled by default. 7170 7171@item -Wmaybe-uninitialized 7172@opindex Wmaybe-uninitialized 7173@opindex Wno-maybe-uninitialized 7174For an object with automatic or allocated storage duration, if there exists 7175a path from the function entry to a use of the object that is initialized, 7176but there exist some other paths for which the object is not initialized, 7177the compiler emits a warning if it cannot prove the uninitialized paths 7178are not executed at run time. 7179 7180In addition, passing a pointer (or in C++, a reference) to an uninitialized 7181object to a @code{const}-qualified function argument is also diagnosed by 7182this warning. (@option{-Wuninitialized} is issued for built-in functions 7183known to read the object.) Annotating the function with attribute 7184@code{access (none)} indicates that the argument isn't used to access 7185the object and avoids the warning (@pxref{Common Function Attributes}). 7186 7187These warnings are only possible in optimizing compilation, because otherwise 7188GCC does not keep track of the state of variables. 7189 7190These warnings are made optional because GCC may not be able to determine when 7191the code is correct in spite of appearing to have an error. Here is one 7192example of how this can happen: 7193 7194@smallexample 7195@group 7196@{ 7197 int x; 7198 switch (y) 7199 @{ 7200 case 1: x = 1; 7201 break; 7202 case 2: x = 4; 7203 break; 7204 case 3: x = 5; 7205 @} 7206 foo (x); 7207@} 7208@end group 7209@end smallexample 7210 7211@noindent 7212If the value of @code{y} is always 1, 2 or 3, then @code{x} is 7213always initialized, but GCC doesn't know this. To suppress the 7214warning, you need to provide a default case with assert(0) or 7215similar code. 7216 7217@cindex @code{longjmp} warnings 7218This option also warns when a non-volatile automatic variable might be 7219changed by a call to @code{longjmp}. 7220The compiler sees only the calls to @code{setjmp}. It cannot know 7221where @code{longjmp} will be called; in fact, a signal handler could 7222call it at any point in the code. As a result, you may get a warning 7223even when there is in fact no problem because @code{longjmp} cannot 7224in fact be called at the place that would cause a problem. 7225 7226Some spurious warnings can be avoided if you declare all the functions 7227you use that never return as @code{noreturn}. @xref{Function 7228Attributes}. 7229 7230This warning is enabled by @option{-Wall} or @option{-Wextra}. 7231 7232@item -Wunknown-pragmas 7233@opindex Wunknown-pragmas 7234@opindex Wno-unknown-pragmas 7235@cindex warning for unknown pragmas 7236@cindex unknown pragmas, warning 7237@cindex pragmas, warning of unknown 7238Warn when a @code{#pragma} directive is encountered that is not understood by 7239GCC@. If this command-line option is used, warnings are even issued 7240for unknown pragmas in system header files. This is not the case if 7241the warnings are only enabled by the @option{-Wall} command-line option. 7242 7243@item -Wno-pragmas 7244@opindex Wno-pragmas 7245@opindex Wpragmas 7246Do not warn about misuses of pragmas, such as incorrect parameters, 7247invalid syntax, or conflicts between pragmas. See also 7248@option{-Wunknown-pragmas}. 7249 7250@item -Wno-prio-ctor-dtor 7251@opindex Wno-prio-ctor-dtor 7252@opindex Wprio-ctor-dtor 7253Do not warn if a priority from 0 to 100 is used for constructor or destructor. 7254The use of constructor and destructor attributes allow you to assign a 7255priority to the constructor/destructor to control its order of execution 7256before @code{main} is called or after it returns. The priority values must be 7257greater than 100 as the compiler reserves priority values between 0--100 for 7258the implementation. 7259 7260@item -Wstrict-aliasing 7261@opindex Wstrict-aliasing 7262@opindex Wno-strict-aliasing 7263This option is only active when @option{-fstrict-aliasing} is active. 7264It warns about code that might break the strict aliasing rules that the 7265compiler is using for optimization. The warning does not catch all 7266cases, but does attempt to catch the more common pitfalls. It is 7267included in @option{-Wall}. 7268It is equivalent to @option{-Wstrict-aliasing=3} 7269 7270@item -Wstrict-aliasing=n 7271@opindex Wstrict-aliasing=n 7272This option is only active when @option{-fstrict-aliasing} is active. 7273It warns about code that might break the strict aliasing rules that the 7274compiler is using for optimization. 7275Higher levels correspond to higher accuracy (fewer false positives). 7276Higher levels also correspond to more effort, similar to the way @option{-O} 7277works. 7278@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 7279 7280Level 1: Most aggressive, quick, least accurate. 7281Possibly useful when higher levels 7282do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 7283false negatives. However, it has many false positives. 7284Warns for all pointer conversions between possibly incompatible types, 7285even if never dereferenced. Runs in the front end only. 7286 7287Level 2: Aggressive, quick, not too precise. 7288May still have many false positives (not as many as level 1 though), 7289and few false negatives (but possibly more than level 1). 7290Unlike level 1, it only warns when an address is taken. Warns about 7291incomplete types. Runs in the front end only. 7292 7293Level 3 (default for @option{-Wstrict-aliasing}): 7294Should have very few false positives and few false 7295negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 7296Takes care of the common pun+dereference pattern in the front end: 7297@code{*(int*)&some_float}. 7298If optimization is enabled, it also runs in the back end, where it deals 7299with multiple statement cases using flow-sensitive points-to information. 7300Only warns when the converted pointer is dereferenced. 7301Does not warn about incomplete types. 7302 7303@item -Wstrict-overflow 7304@itemx -Wstrict-overflow=@var{n} 7305@opindex Wstrict-overflow 7306@opindex Wno-strict-overflow 7307This option is only active when signed overflow is undefined. 7308It warns about cases where the compiler optimizes based on the 7309assumption that signed overflow does not occur. Note that it does not 7310warn about all cases where the code might overflow: it only warns 7311about cases where the compiler implements some optimization. Thus 7312this warning depends on the optimization level. 7313 7314An optimization that assumes that signed overflow does not occur is 7315perfectly safe if the values of the variables involved are such that 7316overflow never does, in fact, occur. Therefore this warning can 7317easily give a false positive: a warning about code that is not 7318actually a problem. To help focus on important issues, several 7319warning levels are defined. No warnings are issued for the use of 7320undefined signed overflow when estimating how many iterations a loop 7321requires, in particular when determining whether a loop will be 7322executed at all. 7323 7324@table @gcctabopt 7325@item -Wstrict-overflow=1 7326Warn about cases that are both questionable and easy to avoid. For 7327example the compiler simplifies 7328@code{x + 1 > x} to @code{1}. This level of 7329@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 7330are not, and must be explicitly requested. 7331 7332@item -Wstrict-overflow=2 7333Also warn about other cases where a comparison is simplified to a 7334constant. For example: @code{abs (x) >= 0}. This can only be 7335simplified when signed integer overflow is undefined, because 7336@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 7337zero. @option{-Wstrict-overflow} (with no level) is the same as 7338@option{-Wstrict-overflow=2}. 7339 7340@item -Wstrict-overflow=3 7341Also warn about other cases where a comparison is simplified. For 7342example: @code{x + 1 > 1} is simplified to @code{x > 0}. 7343 7344@item -Wstrict-overflow=4 7345Also warn about other simplifications not covered by the above cases. 7346For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 7347 7348@item -Wstrict-overflow=5 7349Also warn about cases where the compiler reduces the magnitude of a 7350constant involved in a comparison. For example: @code{x + 2 > y} is 7351simplified to @code{x + 1 >= y}. This is reported only at the 7352highest warning level because this simplification applies to many 7353comparisons, so this warning level gives a very large number of 7354false positives. 7355@end table 7356 7357@item -Wstring-compare 7358@opindex Wstring-compare 7359@opindex Wno-string-compare 7360Warn for calls to @code{strcmp} and @code{strncmp} whose result is 7361determined to be either zero or non-zero in tests for such equality 7362owing to the length of one argument being greater than the size of 7363the array the other argument is stored in (or the bound in the case 7364of @code{strncmp}). Such calls could be mistakes. For example, 7365the call to @code{strcmp} below is diagnosed because its result is 7366necessarily non-zero irrespective of the contents of the array @code{a}. 7367 7368@smallexample 7369extern char a[4]; 7370void f (char *d) 7371@{ 7372 strcpy (d, "string"); 7373 @dots{} 7374 if (0 == strcmp (a, d)) // cannot be true 7375 puts ("a and d are the same"); 7376@} 7377@end smallexample 7378 7379@option{-Wstring-compare} is enabled by @option{-Wextra}. 7380 7381@item -Wno-stringop-overflow 7382@item -Wstringop-overflow 7383@itemx -Wstringop-overflow=@var{type} 7384@opindex Wstringop-overflow 7385@opindex Wno-stringop-overflow 7386Warn for calls to string manipulation functions such as @code{memcpy} and 7387@code{strcpy} that are determined to overflow the destination buffer. The 7388optional argument is one greater than the type of Object Size Checking to 7389perform to determine the size of the destination. @xref{Object Size Checking}. 7390The argument is meaningful only for functions that operate on character arrays 7391but not for raw memory functions like @code{memcpy} which always make use 7392of Object Size type-0. The option also warns for calls that specify a size 7393in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes. 7394The option produces the best results with optimization enabled but can detect 7395a small subset of simple buffer overflows even without optimization in 7396calls to the GCC built-in functions like @code{__builtin_memcpy} that 7397correspond to the standard functions. In any case, the option warns about 7398just a subset of buffer overflows detected by the corresponding overflow 7399checking built-ins. For example, the option issues a warning for 7400the @code{strcpy} call below because it copies at least 5 characters 7401(the string @code{"blue"} including the terminating NUL) into the buffer 7402of size 4. 7403 7404@smallexample 7405enum Color @{ blue, purple, yellow @}; 7406const char* f (enum Color clr) 7407@{ 7408 static char buf [4]; 7409 const char *str; 7410 switch (clr) 7411 @{ 7412 case blue: str = "blue"; break; 7413 case purple: str = "purple"; break; 7414 case yellow: str = "yellow"; break; 7415 @} 7416 7417 return strcpy (buf, str); // warning here 7418@} 7419@end smallexample 7420 7421Option @option{-Wstringop-overflow=2} is enabled by default. 7422 7423@table @gcctabopt 7424@item -Wstringop-overflow 7425@itemx -Wstringop-overflow=1 7426@opindex Wstringop-overflow 7427@opindex Wno-stringop-overflow 7428The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking 7429to determine the sizes of destination objects. At this setting the option 7430does not warn for writes past the end of subobjects of larger objects accessed 7431by pointers unless the size of the largest surrounding object is known. When 7432the destination may be one of several objects it is assumed to be the largest 7433one of them. On Linux systems, when optimization is enabled at this setting 7434the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro 7435is defined to a non-zero value. 7436 7437@item -Wstringop-overflow=2 7438The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking 7439to determine the sizes of destination objects. At this setting the option 7440warns about overflows when writing to members of the largest complete 7441objects whose exact size is known. However, it does not warn for excessive 7442writes to the same members of unknown objects referenced by pointers since 7443they may point to arrays containing unknown numbers of elements. This is 7444the default setting of the option. 7445 7446@item -Wstringop-overflow=3 7447The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking 7448to determine the sizes of destination objects. At this setting the option 7449warns about overflowing the smallest object or data member. This is the 7450most restrictive setting of the option that may result in warnings for safe 7451code. 7452 7453@item -Wstringop-overflow=4 7454The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking 7455to determine the sizes of destination objects. At this setting the option 7456warns about overflowing any data members, and when the destination is 7457one of several objects it uses the size of the largest of them to decide 7458whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this 7459setting of the option may result in warnings for benign code. 7460@end table 7461 7462@item -Wno-stringop-overread 7463@opindex Wstringop-overread 7464@opindex Wno-stringop-overread 7465Warn for calls to string manipulation functions such as @code{memchr}, or 7466@code{strcpy} that are determined to read past the end of the source 7467sequence. 7468 7469Option @option{-Wstringop-overread} is enabled by default. 7470 7471@item -Wno-stringop-truncation 7472@opindex Wstringop-truncation 7473@opindex Wno-stringop-truncation 7474Do not warn for calls to bounded string manipulation functions 7475such as @code{strncat}, 7476@code{strncpy}, and @code{stpncpy} that may either truncate the copied string 7477or leave the destination unchanged. 7478 7479In the following example, the call to @code{strncat} specifies a bound that 7480is less than the length of the source string. As a result, the copy of 7481the source will be truncated and so the call is diagnosed. To avoid the 7482warning use @code{bufsize - strlen (buf) - 1)} as the bound. 7483 7484@smallexample 7485void append (char *buf, size_t bufsize) 7486@{ 7487 strncat (buf, ".txt", 3); 7488@} 7489@end smallexample 7490 7491As another example, the following call to @code{strncpy} results in copying 7492to @code{d} just the characters preceding the terminating NUL, without 7493appending the NUL to the end. Assuming the result of @code{strncpy} is 7494necessarily a NUL-terminated string is a common mistake, and so the call 7495is diagnosed. To avoid the warning when the result is not expected to be 7496NUL-terminated, call @code{memcpy} instead. 7497 7498@smallexample 7499void copy (char *d, const char *s) 7500@{ 7501 strncpy (d, s, strlen (s)); 7502@} 7503@end smallexample 7504 7505In the following example, the call to @code{strncpy} specifies the size 7506of the destination buffer as the bound. If the length of the source 7507string is equal to or greater than this size the result of the copy will 7508not be NUL-terminated. Therefore, the call is also diagnosed. To avoid 7509the warning, specify @code{sizeof buf - 1} as the bound and set the last 7510element of the buffer to @code{NUL}. 7511 7512@smallexample 7513void copy (const char *s) 7514@{ 7515 char buf[80]; 7516 strncpy (buf, s, sizeof buf); 7517 @dots{} 7518@} 7519@end smallexample 7520 7521In situations where a character array is intended to store a sequence 7522of bytes with no terminating @code{NUL} such an array may be annotated 7523with attribute @code{nonstring} to avoid this warning. Such arrays, 7524however, are not suitable arguments to functions that expect 7525@code{NUL}-terminated strings. To help detect accidental misuses of 7526such arrays GCC issues warnings unless it can prove that the use is 7527safe. @xref{Common Variable Attributes}. 7528 7529@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]} 7530@opindex Wsuggest-attribute= 7531@opindex Wno-suggest-attribute= 7532Warn for cases where adding an attribute may be beneficial. The 7533attributes currently supported are listed below. 7534 7535@table @gcctabopt 7536@item -Wsuggest-attribute=pure 7537@itemx -Wsuggest-attribute=const 7538@itemx -Wsuggest-attribute=noreturn 7539@itemx -Wmissing-noreturn 7540@itemx -Wsuggest-attribute=malloc 7541@opindex Wsuggest-attribute=pure 7542@opindex Wno-suggest-attribute=pure 7543@opindex Wsuggest-attribute=const 7544@opindex Wno-suggest-attribute=const 7545@opindex Wsuggest-attribute=noreturn 7546@opindex Wno-suggest-attribute=noreturn 7547@opindex Wmissing-noreturn 7548@opindex Wno-missing-noreturn 7549@opindex Wsuggest-attribute=malloc 7550@opindex Wno-suggest-attribute=malloc 7551 7552Warn about functions that might be candidates for attributes 7553@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler 7554only warns for functions visible in other compilation units or (in the case of 7555@code{pure} and @code{const}) if it cannot prove that the function returns 7556normally. A function returns normally if it doesn't contain an infinite loop or 7557return abnormally by throwing, calling @code{abort} or trapping. This analysis 7558requires option @option{-fipa-pure-const}, which is enabled by default at 7559@option{-O} and higher. Higher optimization levels improve the accuracy 7560of the analysis. 7561 7562@item -Wsuggest-attribute=format 7563@itemx -Wmissing-format-attribute 7564@opindex Wsuggest-attribute=format 7565@opindex Wmissing-format-attribute 7566@opindex Wno-suggest-attribute=format 7567@opindex Wno-missing-format-attribute 7568@opindex Wformat 7569@opindex Wno-format 7570 7571Warn about function pointers that might be candidates for @code{format} 7572attributes. Note these are only possible candidates, not absolute ones. 7573GCC guesses that function pointers with @code{format} attributes that 7574are used in assignment, initialization, parameter passing or return 7575statements should have a corresponding @code{format} attribute in the 7576resulting type. I.e.@: the left-hand side of the assignment or 7577initialization, the type of the parameter variable, or the return type 7578of the containing function respectively should also have a @code{format} 7579attribute to avoid the warning. 7580 7581GCC also warns about function definitions that might be 7582candidates for @code{format} attributes. Again, these are only 7583possible candidates. GCC guesses that @code{format} attributes 7584might be appropriate for any function that calls a function like 7585@code{vprintf} or @code{vscanf}, but this might not always be the 7586case, and some functions for which @code{format} attributes are 7587appropriate may not be detected. 7588 7589@item -Wsuggest-attribute=cold 7590@opindex Wsuggest-attribute=cold 7591@opindex Wno-suggest-attribute=cold 7592 7593Warn about functions that might be candidates for @code{cold} attribute. This 7594is based on static detection and generally only warns about functions which 7595always leads to a call to another @code{cold} function such as wrappers of 7596C++ @code{throw} or fatal error reporting functions leading to @code{abort}. 7597@end table 7598 7599@item -Walloc-zero 7600@opindex Wno-alloc-zero 7601@opindex Walloc-zero 7602Warn about calls to allocation functions decorated with attribute 7603@code{alloc_size} that specify zero bytes, including those to the built-in 7604forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc}, 7605@code{malloc}, and @code{realloc}. Because the behavior of these functions 7606when called with a zero size differs among implementations (and in the case 7607of @code{realloc} has been deprecated) relying on it may result in subtle 7608portability bugs and should be avoided. 7609 7610@item -Walloc-size-larger-than=@var{byte-size} 7611@opindex Walloc-size-larger-than= 7612@opindex Wno-alloc-size-larger-than 7613Warn about calls to functions decorated with attribute @code{alloc_size} 7614that attempt to allocate objects larger than the specified number of bytes, 7615or where the result of the size computation in an integer type with infinite 7616precision would exceed the value of @samp{PTRDIFF_MAX} on the target. 7617@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 7618Warnings controlled by the option can be disabled either by specifying 7619@var{byte-size} of @samp{SIZE_MAX} or more or by 7620@option{-Wno-alloc-size-larger-than}. 7621@xref{Function Attributes}. 7622 7623@item -Wno-alloc-size-larger-than 7624@opindex Wno-alloc-size-larger-than 7625Disable @option{-Walloc-size-larger-than=} warnings. The option is 7626equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or 7627larger. 7628 7629@item -Walloca 7630@opindex Wno-alloca 7631@opindex Walloca 7632This option warns on all uses of @code{alloca} in the source. 7633 7634@item -Walloca-larger-than=@var{byte-size} 7635@opindex Walloca-larger-than= 7636@opindex Wno-alloca-larger-than 7637This option warns on calls to @code{alloca} with an integer argument whose 7638value is either zero, or that is not bounded by a controlling predicate 7639that limits its value to at most @var{byte-size}. It also warns for calls 7640to @code{alloca} where the bound value is unknown. Arguments of non-integer 7641types are considered unbounded even if they appear to be constrained to 7642the expected range. 7643 7644For example, a bounded case of @code{alloca} could be: 7645 7646@smallexample 7647void func (size_t n) 7648@{ 7649 void *p; 7650 if (n <= 1000) 7651 p = alloca (n); 7652 else 7653 p = malloc (n); 7654 f (p); 7655@} 7656@end smallexample 7657 7658In the above example, passing @code{-Walloca-larger-than=1000} would not 7659issue a warning because the call to @code{alloca} is known to be at most 76601000 bytes. However, if @code{-Walloca-larger-than=500} were passed, 7661the compiler would emit a warning. 7662 7663Unbounded uses, on the other hand, are uses of @code{alloca} with no 7664controlling predicate constraining its integer argument. For example: 7665 7666@smallexample 7667void func () 7668@{ 7669 void *p = alloca (n); 7670 f (p); 7671@} 7672@end smallexample 7673 7674If @code{-Walloca-larger-than=500} were passed, the above would trigger 7675a warning, but this time because of the lack of bounds checking. 7676 7677Note, that even seemingly correct code involving signed integers could 7678cause a warning: 7679 7680@smallexample 7681void func (signed int n) 7682@{ 7683 if (n < 500) 7684 @{ 7685 p = alloca (n); 7686 f (p); 7687 @} 7688@} 7689@end smallexample 7690 7691In the above example, @var{n} could be negative, causing a larger than 7692expected argument to be implicitly cast into the @code{alloca} call. 7693 7694This option also warns when @code{alloca} is used in a loop. 7695 7696@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default 7697but is usually only effective when @option{-ftree-vrp} is active (default 7698for @option{-O2} and above). 7699 7700See also @option{-Wvla-larger-than=}@samp{byte-size}. 7701 7702@item -Wno-alloca-larger-than 7703@opindex Wno-alloca-larger-than 7704Disable @option{-Walloca-larger-than=} warnings. The option is 7705equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger. 7706 7707@item -Warith-conversion 7708@opindex Warith-conversion 7709@opindex Wno-arith-conversion 7710Do warn about implicit conversions from arithmetic operations even 7711when conversion of the operands to the same type cannot change their 7712values. This affects warnings from @option{-Wconversion}, 7713@option{-Wfloat-conversion}, and @option{-Wsign-conversion}. 7714 7715@smallexample 7716@group 7717void f (char c, int i) 7718@{ 7719 c = c + i; // warns with @option{-Wconversion} 7720 c = c + 1; // only warns with @option{-Warith-conversion} 7721@} 7722@end group 7723@end smallexample 7724 7725@item -Warray-bounds 7726@itemx -Warray-bounds=@var{n} 7727@opindex Wno-array-bounds 7728@opindex Warray-bounds 7729Warn about out of bounds subscripts or offsets into arrays. This warning 7730is enabled by @option{-Wall}. It is more effective when @option{-ftree-vrp} 7731is active (the default for @option{-O2} and above) but a subset of instances 7732are issued even without optimization. 7733 7734@table @gcctabopt 7735@item -Warray-bounds=1 7736This is the default warning level of @option{-Warray-bounds} and is enabled 7737by @option{-Wall}; higher levels are not, and must be explicitly requested. 7738 7739@item -Warray-bounds=2 7740This warning level also warns about out of bounds accesses to trailing 7741struct members of one-element array types (@pxref{Zero Length}) and about 7742the intermediate results of pointer arithmetic that may yield out of bounds 7743values. This warning level may give a larger number of false positives and 7744is deactivated by default. 7745@end table 7746 7747@item -Warray-compare 7748@opindex Warray-compare 7749@opindex Wno-array-compare 7750Warn about equality and relational comparisons between two operands of array 7751type. This comparison was deprecated in C++20. For example: 7752 7753@smallexample 7754int arr1[5]; 7755int arr2[5]; 7756bool same = arr1 == arr2; 7757@end smallexample 7758 7759@option{-Warray-compare} is enabled by @option{-Wall}. 7760 7761@item -Warray-parameter 7762@itemx -Warray-parameter=@var{n} 7763@opindex Wno-array-parameter 7764Warn about redeclarations of functions involving arguments of array or 7765pointer types of inconsistent kinds or forms, and enable the detection 7766of out-of-bounds accesses to such parameters by warnings such as 7767@option{-Warray-bounds}. 7768 7769If the first function declaration uses the array form the bound specified 7770in the array is assumed to be the minimum number of elements expected to 7771be provided in calls to the function and the maximum number of elements 7772accessed by it. Failing to provide arguments of sufficient size or accessing 7773more than the maximum number of elements may be diagnosed by warnings such 7774as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies 7775involving array parameters declared using the @code{T[static N]} form. 7776 7777For example, the warning triggers for the following redeclarations because 7778the first one allows an array of any size to be passed to @code{f} while 7779the second one with the keyword @code{static} specifies that the array 7780argument must have at least four elements. 7781 7782@smallexample 7783void f (int[static 4]); 7784void f (int[]); // warning (inconsistent array form) 7785 7786void g (void) 7787@{ 7788 int *p = (int *)malloc (4); 7789 f (p); // warning (array too small) 7790 @dots{} 7791@} 7792@end smallexample 7793 7794At level 2 the warning also triggers for redeclarations involving any other 7795inconsistency in array or pointer argument forms denoting array sizes. 7796Pointers and arrays of unspecified bound are considered equivalent and do 7797not trigger a warning. 7798 7799@smallexample 7800void g (int*); 7801void g (int[]); // no warning 7802void g (int[8]); // warning (inconsistent array bound) 7803@end smallexample 7804 7805@option{-Warray-parameter=2} is included in @option{-Wall}. The 7806@option{-Wvla-parameter} option triggers warnings for similar inconsistencies 7807involving Variable Length Array arguments. 7808 7809@item -Wattribute-alias=@var{n} 7810@itemx -Wno-attribute-alias 7811@opindex Wattribute-alias 7812@opindex Wno-attribute-alias 7813Warn about declarations using the @code{alias} and similar attributes whose 7814target is incompatible with the type of the alias. 7815@xref{Function Attributes,,Declaring Attributes of Functions}. 7816 7817@table @gcctabopt 7818@item -Wattribute-alias=1 7819The default warning level of the @option{-Wattribute-alias} option diagnoses 7820incompatibilities between the type of the alias declaration and that of its 7821target. Such incompatibilities are typically indicative of bugs. 7822 7823@item -Wattribute-alias=2 7824 7825At this level @option{-Wattribute-alias} also diagnoses cases where 7826the attributes of the alias declaration are more restrictive than the 7827attributes applied to its target. These mismatches can potentially 7828result in incorrect code generation. In other cases they may be 7829benign and could be resolved simply by adding the missing attribute to 7830the target. For comparison, see the @option{-Wmissing-attributes} 7831option, which controls diagnostics when the alias declaration is less 7832restrictive than the target, rather than more restrictive. 7833 7834Attributes considered include @code{alloc_align}, @code{alloc_size}, 7835@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, 7836@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, 7837@code{returns_nonnull}, and @code{returns_twice}. 7838@end table 7839 7840@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}. 7841This is the default. You can disable these warnings with either 7842@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}. 7843 7844@item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]} 7845@opindex Wbidi-chars= 7846@opindex Wbidi-chars 7847@opindex Wno-bidi-chars 7848Warn about possibly misleading UTF-8 bidirectional control characters in 7849comments, string literals, character constants, and identifiers. Such 7850characters can change left-to-right writing direction into right-to-left 7851(and vice versa), which can cause confusion between the logical order and 7852visual order. This may be dangerous; for instance, it may seem that a piece 7853of code is not commented out, whereas it in fact is. 7854 7855There are three levels of warning supported by GCC@. The default is 7856@option{-Wbidi-chars=unpaired}, which warns about improperly terminated 7857bidi contexts. @option{-Wbidi-chars=none} turns the warning off. 7858@option{-Wbidi-chars=any} warns about any use of bidirectional control 7859characters. 7860 7861By default, this warning does not warn about UCNs. It is, however, possible 7862to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or 7863@option{-Wbidi-chars=any,ucn}. Using @option{-Wbidi-chars=ucn} is valid, 7864and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous 7865@option{-Wbidi-chars=any} was specified. 7866 7867@item -Wbool-compare 7868@opindex Wno-bool-compare 7869@opindex Wbool-compare 7870Warn about boolean expression compared with an integer value different from 7871@code{true}/@code{false}. For instance, the following comparison is 7872always false: 7873@smallexample 7874int n = 5; 7875@dots{} 7876if ((n > 1) == 2) @{ @dots{} @} 7877@end smallexample 7878This warning is enabled by @option{-Wall}. 7879 7880@item -Wbool-operation 7881@opindex Wno-bool-operation 7882@opindex Wbool-operation 7883Warn about suspicious operations on expressions of a boolean type. For 7884instance, bitwise negation of a boolean is very likely a bug in the program. 7885For C, this warning also warns about incrementing or decrementing a boolean, 7886which rarely makes sense. (In C++, decrementing a boolean is always invalid. 7887Incrementing a boolean is invalid in C++17, and deprecated otherwise.) 7888 7889This warning is enabled by @option{-Wall}. 7890 7891@item -Wduplicated-branches 7892@opindex Wno-duplicated-branches 7893@opindex Wduplicated-branches 7894Warn when an if-else has identical branches. This warning detects cases like 7895@smallexample 7896if (p != NULL) 7897 return 0; 7898else 7899 return 0; 7900@end smallexample 7901It doesn't warn when both branches contain just a null statement. This warning 7902also warn for conditional operators: 7903@smallexample 7904 int i = x ? *p : *p; 7905@end smallexample 7906 7907@item -Wduplicated-cond 7908@opindex Wno-duplicated-cond 7909@opindex Wduplicated-cond 7910Warn about duplicated conditions in an if-else-if chain. For instance, 7911warn for the following code: 7912@smallexample 7913if (p->q != NULL) @{ @dots{} @} 7914else if (p->q != NULL) @{ @dots{} @} 7915@end smallexample 7916 7917@item -Wframe-address 7918@opindex Wno-frame-address 7919@opindex Wframe-address 7920Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address} 7921is called with an argument greater than 0. Such calls may return indeterminate 7922values or crash the program. The warning is included in @option{-Wall}. 7923 7924@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 7925@opindex Wno-discarded-qualifiers 7926@opindex Wdiscarded-qualifiers 7927Do not warn if type qualifiers on pointers are being discarded. 7928Typically, the compiler warns if a @code{const char *} variable is 7929passed to a function that takes a @code{char *} parameter. This option 7930can be used to suppress such a warning. 7931 7932@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 7933@opindex Wno-discarded-array-qualifiers 7934@opindex Wdiscarded-array-qualifiers 7935Do not warn if type qualifiers on arrays which are pointer targets 7936are being discarded. Typically, the compiler warns if a 7937@code{const int (*)[]} variable is passed to a function that 7938takes a @code{int (*)[]} parameter. This option can be used to 7939suppress such a warning. 7940 7941@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 7942@opindex Wno-incompatible-pointer-types 7943@opindex Wincompatible-pointer-types 7944Do not warn when there is a conversion between pointers that have incompatible 7945types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 7946which warns for pointer argument passing or assignment with different 7947signedness. 7948 7949@item -Wno-int-conversion @r{(C and Objective-C only)} 7950@opindex Wno-int-conversion 7951@opindex Wint-conversion 7952Do not warn about incompatible integer to pointer and pointer to integer 7953conversions. This warning is about implicit conversions; for explicit 7954conversions the warnings @option{-Wno-int-to-pointer-cast} and 7955@option{-Wno-pointer-to-int-cast} may be used. 7956 7957@item -Wzero-length-bounds 7958@opindex Wzero-length-bounds 7959@opindex Wzero-length-bounds 7960Warn about accesses to elements of zero-length array members that might 7961overlap other members of the same object. Declaring interior zero-length 7962arrays is discouraged because accesses to them are undefined. See 7963@xref{Zero Length}. 7964 7965For example, the first two stores in function @code{bad} are diagnosed 7966because the array elements overlap the subsequent members @code{b} and 7967@code{c}. The third store is diagnosed by @option{-Warray-bounds} 7968because it is beyond the bounds of the enclosing object. 7969 7970@smallexample 7971struct X @{ int a[0]; int b, c; @}; 7972struct X x; 7973 7974void bad (void) 7975@{ 7976 x.a[0] = 0; // -Wzero-length-bounds 7977 x.a[1] = 1; // -Wzero-length-bounds 7978 x.a[2] = 2; // -Warray-bounds 7979@} 7980@end smallexample 7981 7982Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}. 7983 7984@item -Wno-div-by-zero 7985@opindex Wno-div-by-zero 7986@opindex Wdiv-by-zero 7987Do not warn about compile-time integer division by zero. Floating-point 7988division by zero is not warned about, as it can be a legitimate way of 7989obtaining infinities and NaNs. 7990 7991@item -Wsystem-headers 7992@opindex Wsystem-headers 7993@opindex Wno-system-headers 7994@cindex warnings from system headers 7995@cindex system headers, warnings from 7996Print warning messages for constructs found in system header files. 7997Warnings from system headers are normally suppressed, on the assumption 7998that they usually do not indicate real problems and would only make the 7999compiler output harder to read. Using this command-line option tells 8000GCC to emit warnings from system headers as if they occurred in user 8001code. However, note that using @option{-Wall} in conjunction with this 8002option does @emph{not} warn about unknown pragmas in system 8003headers---for that, @option{-Wunknown-pragmas} must also be used. 8004 8005@item -Wtautological-compare 8006@opindex Wtautological-compare 8007@opindex Wno-tautological-compare 8008Warn if a self-comparison always evaluates to true or false. This 8009warning detects various mistakes such as: 8010@smallexample 8011int i = 1; 8012@dots{} 8013if (i > i) @{ @dots{} @} 8014@end smallexample 8015 8016This warning also warns about bitwise comparisons that always evaluate 8017to true or false, for instance: 8018@smallexample 8019if ((a & 16) == 10) @{ @dots{} @} 8020@end smallexample 8021will always be false. 8022 8023This warning is enabled by @option{-Wall}. 8024 8025@item -Wtrampolines 8026@opindex Wtrampolines 8027@opindex Wno-trampolines 8028Warn about trampolines generated for pointers to nested functions. 8029A trampoline is a small piece of data or code that is created at run 8030time on the stack when the address of a nested function is taken, and is 8031used to call the nested function indirectly. For some targets, it is 8032made up of data only and thus requires no special treatment. But, for 8033most targets, it is made up of code and thus requires the stack to be 8034made executable in order for the program to work properly. 8035 8036@item -Wfloat-equal 8037@opindex Wfloat-equal 8038@opindex Wno-float-equal 8039Warn if floating-point values are used in equality comparisons. 8040 8041The idea behind this is that sometimes it is convenient (for the 8042programmer) to consider floating-point values as approximations to 8043infinitely precise real numbers. If you are doing this, then you need 8044to compute (by analyzing the code, or in some other way) the maximum or 8045likely maximum error that the computation introduces, and allow for it 8046when performing comparisons (and when producing output, but that's a 8047different problem). In particular, instead of testing for equality, you 8048should check to see whether the two values have ranges that overlap; and 8049this is done with the relational operators, so equality comparisons are 8050probably mistaken. 8051 8052@item -Wtraditional @r{(C and Objective-C only)} 8053@opindex Wtraditional 8054@opindex Wno-traditional 8055Warn about certain constructs that behave differently in traditional and 8056ISO C@. Also warn about ISO C constructs that have no traditional C 8057equivalent, and/or problematic constructs that should be avoided. 8058 8059@itemize @bullet 8060@item 8061Macro parameters that appear within string literals in the macro body. 8062In traditional C macro replacement takes place within string literals, 8063but in ISO C it does not. 8064 8065@item 8066In traditional C, some preprocessor directives did not exist. 8067Traditional preprocessors only considered a line to be a directive 8068if the @samp{#} appeared in column 1 on the line. Therefore 8069@option{-Wtraditional} warns about directives that traditional C 8070understands but ignores because the @samp{#} does not appear as the 8071first character on the line. It also suggests you hide directives like 8072@code{#pragma} not understood by traditional C by indenting them. Some 8073traditional implementations do not recognize @code{#elif}, so this option 8074suggests avoiding it altogether. 8075 8076@item 8077A function-like macro that appears without arguments. 8078 8079@item 8080The unary plus operator. 8081 8082@item 8083The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 8084constant suffixes. (Traditional C does support the @samp{L} suffix on integer 8085constants.) Note, these suffixes appear in macros defined in the system 8086headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 8087Use of these macros in user code might normally lead to spurious 8088warnings, however GCC's integrated preprocessor has enough context to 8089avoid warning in these cases. 8090 8091@item 8092A function declared external in one block and then used after the end of 8093the block. 8094 8095@item 8096A @code{switch} statement has an operand of type @code{long}. 8097 8098@item 8099A non-@code{static} function declaration follows a @code{static} one. 8100This construct is not accepted by some traditional C compilers. 8101 8102@item 8103The ISO type of an integer constant has a different width or 8104signedness from its traditional type. This warning is only issued if 8105the base of the constant is ten. I.e.@: hexadecimal or octal values, which 8106typically represent bit patterns, are not warned about. 8107 8108@item 8109Usage of ISO string concatenation is detected. 8110 8111@item 8112Initialization of automatic aggregates. 8113 8114@item 8115Identifier conflicts with labels. Traditional C lacks a separate 8116namespace for labels. 8117 8118@item 8119Initialization of unions. If the initializer is zero, the warning is 8120omitted. This is done under the assumption that the zero initializer in 8121user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 8122initializer warnings and relies on default initialization to zero in the 8123traditional C case. 8124 8125@item 8126Conversions by prototypes between fixed/floating-point values and vice 8127versa. The absence of these prototypes when compiling with traditional 8128C causes serious problems. This is a subset of the possible 8129conversion warnings; for the full set use @option{-Wtraditional-conversion}. 8130 8131@item 8132Use of ISO C style function definitions. This warning intentionally is 8133@emph{not} issued for prototype declarations or variadic functions 8134because these ISO C features appear in your code when using 8135libiberty's traditional C compatibility macros, @code{PARAMS} and 8136@code{VPARAMS}. This warning is also bypassed for nested functions 8137because that feature is already a GCC extension and thus not relevant to 8138traditional C compatibility. 8139@end itemize 8140 8141@item -Wtraditional-conversion @r{(C and Objective-C only)} 8142@opindex Wtraditional-conversion 8143@opindex Wno-traditional-conversion 8144Warn if a prototype causes a type conversion that is different from what 8145would happen to the same argument in the absence of a prototype. This 8146includes conversions of fixed point to floating and vice versa, and 8147conversions changing the width or signedness of a fixed-point argument 8148except when the same as the default promotion. 8149 8150@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 8151@opindex Wdeclaration-after-statement 8152@opindex Wno-declaration-after-statement 8153Warn when a declaration is found after a statement in a block. This 8154construct, known from C++, was introduced with ISO C99 and is by default 8155allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}. 8156 8157@item -Wshadow 8158@opindex Wshadow 8159@opindex Wno-shadow 8160Warn whenever a local variable or type declaration shadows another 8161variable, parameter, type, class member (in C++), or instance variable 8162(in Objective-C) or whenever a built-in function is shadowed. Note 8163that in C++, the compiler warns if a local variable shadows an 8164explicit typedef, but not if it shadows a struct/class/enum. 8165If this warning is enabled, it includes also all instances of 8166local shadowing. This means that @option{-Wno-shadow=local} 8167and @option{-Wno-shadow=compatible-local} are ignored when 8168@option{-Wshadow} is used. 8169Same as @option{-Wshadow=global}. 8170 8171@item -Wno-shadow-ivar @r{(Objective-C only)} 8172@opindex Wno-shadow-ivar 8173@opindex Wshadow-ivar 8174Do not warn whenever a local variable shadows an instance variable in an 8175Objective-C method. 8176 8177@item -Wshadow=global 8178@opindex Wshadow=global 8179Warn for any shadowing. 8180Same as @option{-Wshadow}. 8181 8182@item -Wshadow=local 8183@opindex Wshadow=local 8184Warn when a local variable shadows another local variable or parameter. 8185 8186@item -Wshadow=compatible-local 8187@opindex Wshadow=compatible-local 8188Warn when a local variable shadows another local variable or parameter 8189whose type is compatible with that of the shadowing variable. In C++, 8190type compatibility here means the type of the shadowing variable can be 8191converted to that of the shadowed variable. The creation of this flag 8192(in addition to @option{-Wshadow=local}) is based on the idea that when 8193a local variable shadows another one of incompatible type, it is most 8194likely intentional, not a bug or typo, as shown in the following example: 8195 8196@smallexample 8197@group 8198for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) 8199@{ 8200 for (int i = 0; i < N; ++i) 8201 @{ 8202 ... 8203 @} 8204 ... 8205@} 8206@end group 8207@end smallexample 8208 8209Since the two variable @code{i} in the example above have incompatible types, 8210enabling only @option{-Wshadow=compatible-local} does not emit a warning. 8211Because their types are incompatible, if a programmer accidentally uses one 8212in place of the other, type checking is expected to catch that and emit an 8213error or warning. Use of this flag instead of @option{-Wshadow=local} can 8214possibly reduce the number of warnings triggered by intentional shadowing. 8215Note that this also means that shadowing @code{const char *i} by 8216@code{char *i} does not emit a warning. 8217 8218This warning is also enabled by @option{-Wshadow=local}. 8219 8220@item -Wlarger-than=@var{byte-size} 8221@opindex Wlarger-than= 8222@opindex Wlarger-than-@var{byte-size} 8223Warn whenever an object is defined whose size exceeds @var{byte-size}. 8224@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default. 8225Warnings controlled by the option can be disabled either by specifying 8226@var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}. 8227 8228Also warn for calls to bounded functions such as @code{memchr} or 8229@code{strnlen} that specify a bound greater than the largest possible 8230object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings 8231can only be disabled by @option{-Wno-larger-than}. 8232 8233@item -Wno-larger-than 8234@opindex Wno-larger-than 8235Disable @option{-Wlarger-than=} warnings. The option is equivalent 8236to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger. 8237 8238@item -Wframe-larger-than=@var{byte-size} 8239@opindex Wframe-larger-than= 8240@opindex Wno-frame-larger-than 8241Warn if the size of a function frame exceeds @var{byte-size}. 8242The computation done to determine the stack frame size is approximate 8243and not conservative. 8244The actual requirements may be somewhat greater than @var{byte-size} 8245even if you do not get a warning. In addition, any space allocated 8246via @code{alloca}, variable-length arrays, or related constructs 8247is not included by the compiler when determining 8248whether or not to issue a warning. 8249@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default. 8250Warnings controlled by the option can be disabled either by specifying 8251@var{byte-size} of @samp{SIZE_MAX} or more or by 8252@option{-Wno-frame-larger-than}. 8253 8254@item -Wno-frame-larger-than 8255@opindex Wno-frame-larger-than 8256Disable @option{-Wframe-larger-than=} warnings. The option is equivalent 8257to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger. 8258 8259@item -Wfree-nonheap-object 8260@opindex Wfree-nonheap-object 8261@opindex Wno-free-nonheap-object 8262Warn when attempting to deallocate an object that was either not allocated 8263on the heap, or by using a pointer that was not returned from a prior call 8264to the corresponding allocation function. For example, because the call 8265to @code{stpcpy} returns a pointer to the terminating nul character and 8266not to the beginning of the object, the call to @code{free} below is 8267diagnosed. 8268 8269@smallexample 8270void f (char *p) 8271@{ 8272 p = stpcpy (p, "abc"); 8273 // ... 8274 free (p); // warning 8275@} 8276@end smallexample 8277 8278@option{-Wfree-nonheap-object} is included in @option{-Wall}. 8279 8280@item -Wstack-usage=@var{byte-size} 8281@opindex Wstack-usage 8282@opindex Wno-stack-usage 8283Warn if the stack usage of a function might exceed @var{byte-size}. 8284The computation done to determine the stack usage is conservative. 8285Any space allocated via @code{alloca}, variable-length arrays, or related 8286constructs is included by the compiler when determining whether or not to 8287issue a warning. 8288 8289The message is in keeping with the output of @option{-fstack-usage}. 8290 8291@itemize 8292@item 8293If the stack usage is fully static but exceeds the specified amount, it's: 8294 8295@smallexample 8296 warning: stack usage is 1120 bytes 8297@end smallexample 8298@item 8299If the stack usage is (partly) dynamic but bounded, it's: 8300 8301@smallexample 8302 warning: stack usage might be 1648 bytes 8303@end smallexample 8304@item 8305If the stack usage is (partly) dynamic and not bounded, it's: 8306 8307@smallexample 8308 warning: stack usage might be unbounded 8309@end smallexample 8310@end itemize 8311 8312@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default. 8313Warnings controlled by the option can be disabled either by specifying 8314@var{byte-size} of @samp{SIZE_MAX} or more or by 8315@option{-Wno-stack-usage}. 8316 8317@item -Wno-stack-usage 8318@opindex Wno-stack-usage 8319Disable @option{-Wstack-usage=} warnings. The option is equivalent 8320to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger. 8321 8322@item -Wunsafe-loop-optimizations 8323@opindex Wunsafe-loop-optimizations 8324@opindex Wno-unsafe-loop-optimizations 8325Warn if the loop cannot be optimized because the compiler cannot 8326assume anything on the bounds of the loop indices. With 8327@option{-funsafe-loop-optimizations} warn if the compiler makes 8328such assumptions. 8329 8330@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 8331@opindex Wno-pedantic-ms-format 8332@opindex Wpedantic-ms-format 8333When used in combination with @option{-Wformat} 8334and @option{-pedantic} without GNU extensions, this option 8335disables the warnings about non-ISO @code{printf} / @code{scanf} format 8336width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 8337which depend on the MS runtime. 8338 8339@item -Wpointer-arith 8340@opindex Wpointer-arith 8341@opindex Wno-pointer-arith 8342Warn about anything that depends on the ``size of'' a function type or 8343of @code{void}. GNU C assigns these types a size of 1, for 8344convenience in calculations with @code{void *} pointers and pointers 8345to functions. In C++, warn also when an arithmetic operation involves 8346@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 8347 8348@item -Wno-pointer-compare 8349@opindex Wpointer-compare 8350@opindex Wno-pointer-compare 8351Do not warn if a pointer is compared with a zero character constant. 8352This usually 8353means that the pointer was meant to be dereferenced. For example: 8354 8355@smallexample 8356const char *p = foo (); 8357if (p == '\0') 8358 return 42; 8359@end smallexample 8360 8361Note that the code above is invalid in C++11. 8362 8363This warning is enabled by default. 8364 8365@item -Wtsan 8366@opindex Wtsan 8367@opindex Wno-tsan 8368Warn about unsupported features in ThreadSanitizer. 8369 8370ThreadSanitizer does not support @code{std::atomic_thread_fence} and 8371can report false positives. 8372 8373This warning is enabled by default. 8374 8375@item -Wtype-limits 8376@opindex Wtype-limits 8377@opindex Wno-type-limits 8378Warn if a comparison is always true or always false due to the limited 8379range of the data type, but do not warn for constant expressions. For 8380example, warn if an unsigned variable is compared against zero with 8381@code{<} or @code{>=}. This warning is also enabled by 8382@option{-Wextra}. 8383 8384@item -Wabsolute-value @r{(C and Objective-C only)} 8385@opindex Wabsolute-value 8386@opindex Wno-absolute-value 8387Warn for calls to standard functions that compute the absolute value 8388of an argument when a more appropriate standard function is available. 8389For example, calling @code{abs(3.14)} triggers the warning because the 8390appropriate function to call to compute the absolute value of a double 8391argument is @code{fabs}. The option also triggers warnings when the 8392argument in a call to such a function has an unsigned type. This 8393warning can be suppressed with an explicit type cast and it is also 8394enabled by @option{-Wextra}. 8395 8396@include cppwarnopts.texi 8397 8398@item -Wbad-function-cast @r{(C and Objective-C only)} 8399@opindex Wbad-function-cast 8400@opindex Wno-bad-function-cast 8401Warn when a function call is cast to a non-matching type. 8402For example, warn if a call to a function returning an integer type 8403is cast to a pointer type. 8404 8405@item -Wc90-c99-compat @r{(C and Objective-C only)} 8406@opindex Wc90-c99-compat 8407@opindex Wno-c90-c99-compat 8408Warn about features not present in ISO C90, but present in ISO C99. 8409For instance, warn about use of variable length arrays, @code{long long} 8410type, @code{bool} type, compound literals, designated initializers, and so 8411on. This option is independent of the standards mode. Warnings are disabled 8412in the expression that follows @code{__extension__}. 8413 8414@item -Wc99-c11-compat @r{(C and Objective-C only)} 8415@opindex Wc99-c11-compat 8416@opindex Wno-c99-c11-compat 8417Warn about features not present in ISO C99, but present in ISO C11. 8418For instance, warn about use of anonymous structures and unions, 8419@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 8420@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 8421and so on. This option is independent of the standards mode. Warnings are 8422disabled in the expression that follows @code{__extension__}. 8423 8424@item -Wc11-c2x-compat @r{(C and Objective-C only)} 8425@opindex Wc11-c2x-compat 8426@opindex Wno-c11-c2x-compat 8427Warn about features not present in ISO C11, but present in ISO C2X. 8428For instance, warn about omitting the string in @code{_Static_assert}, 8429use of @samp{[[]]} syntax for attributes, use of decimal 8430floating-point types, and so on. This option is independent of the 8431standards mode. Warnings are disabled in the expression that follows 8432@code{__extension__}. 8433 8434@item -Wc++-compat @r{(C and Objective-C only)} 8435@opindex Wc++-compat 8436@opindex Wno-c++-compat 8437Warn about ISO C constructs that are outside of the common subset of 8438ISO C and ISO C++, e.g.@: request for implicit conversion from 8439@code{void *} to a pointer to non-@code{void} type. 8440 8441@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 8442@opindex Wc++11-compat 8443@opindex Wno-c++11-compat 8444Warn about C++ constructs whose meaning differs between ISO C++ 1998 8445and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 8446in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 8447enabled by @option{-Wall}. 8448 8449@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 8450@opindex Wc++14-compat 8451@opindex Wno-c++14-compat 8452Warn about C++ constructs whose meaning differs between ISO C++ 2011 8453and ISO C++ 2014. This warning is enabled by @option{-Wall}. 8454 8455@item -Wc++17-compat @r{(C++ and Objective-C++ only)} 8456@opindex Wc++17-compat 8457@opindex Wno-c++17-compat 8458Warn about C++ constructs whose meaning differs between ISO C++ 2014 8459and ISO C++ 2017. This warning is enabled by @option{-Wall}. 8460 8461@item -Wc++20-compat @r{(C++ and Objective-C++ only)} 8462@opindex Wc++20-compat 8463@opindex Wno-c++20-compat 8464Warn about C++ constructs whose meaning differs between ISO C++ 2017 8465and ISO C++ 2020. This warning is enabled by @option{-Wall}. 8466 8467@item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)} 8468@opindex Wc++11-extensions 8469@opindex Wno-c++11-extensions 8470Do not warn about C++11 constructs in code being compiled using 8471an older C++ standard. Even without this option, some C++11 constructs 8472will only be diagnosed if @option{-Wpedantic} is used. 8473 8474@item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)} 8475@opindex Wc++14-extensions 8476@opindex Wno-c++14-extensions 8477Do not warn about C++14 constructs in code being compiled using 8478an older C++ standard. Even without this option, some C++14 constructs 8479will only be diagnosed if @option{-Wpedantic} is used. 8480 8481@item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)} 8482@opindex Wc++17-extensions 8483@opindex Wno-c++17-extensions 8484Do not warn about C++17 constructs in code being compiled using 8485an older C++ standard. Even without this option, some C++17 constructs 8486will only be diagnosed if @option{-Wpedantic} is used. 8487 8488@item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)} 8489@opindex Wc++20-extensions 8490@opindex Wno-c++20-extensions 8491Do not warn about C++20 constructs in code being compiled using 8492an older C++ standard. Even without this option, some C++20 constructs 8493will only be diagnosed if @option{-Wpedantic} is used. 8494 8495@item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)} 8496@opindex Wc++23-extensions 8497@opindex Wno-c++23-extensions 8498Do not warn about C++23 constructs in code being compiled using 8499an older C++ standard. Even without this option, some C++23 constructs 8500will only be diagnosed if @option{-Wpedantic} is used. 8501 8502@item -Wcast-qual 8503@opindex Wcast-qual 8504@opindex Wno-cast-qual 8505Warn whenever a pointer is cast so as to remove a type qualifier from 8506the target type. For example, warn if a @code{const char *} is cast 8507to an ordinary @code{char *}. 8508 8509Also warn when making a cast that introduces a type qualifier in an 8510unsafe way. For example, casting @code{char **} to @code{const char **} 8511is unsafe, as in this example: 8512 8513@smallexample 8514 /* p is char ** value. */ 8515 const char **q = (const char **) p; 8516 /* Assignment of readonly string to const char * is OK. */ 8517 *q = "string"; 8518 /* Now char** pointer points to read-only memory. */ 8519 **p = 'b'; 8520@end smallexample 8521 8522@item -Wcast-align 8523@opindex Wcast-align 8524@opindex Wno-cast-align 8525Warn whenever a pointer is cast such that the required alignment of the 8526target is increased. For example, warn if a @code{char *} is cast to 8527an @code{int *} on machines where integers can only be accessed at 8528two- or four-byte boundaries. 8529 8530@item -Wcast-align=strict 8531@opindex Wcast-align=strict 8532Warn whenever a pointer is cast such that the required alignment of the 8533target is increased. For example, warn if a @code{char *} is cast to 8534an @code{int *} regardless of the target machine. 8535 8536@item -Wcast-function-type 8537@opindex Wcast-function-type 8538@opindex Wno-cast-function-type 8539Warn when a function pointer is cast to an incompatible function pointer. 8540In a cast involving function types with a variable argument list only 8541the types of initial arguments that are provided are considered. 8542Any parameter of pointer-type matches any other pointer-type. Any benign 8543differences in integral types are ignored, like @code{int} vs.@: @code{long} 8544on ILP32 targets. Likewise type qualifiers are ignored. The function 8545type @code{void (*) (void)} is special and matches everything, which can 8546be used to suppress this warning. 8547In a cast involving pointer to member types this warning warns whenever 8548the type cast is changing the pointer to member type. 8549This warning is enabled by @option{-Wextra}. 8550 8551@item -Wwrite-strings 8552@opindex Wwrite-strings 8553@opindex Wno-write-strings 8554When compiling C, give string constants the type @code{const 8555char[@var{length}]} so that copying the address of one into a 8556non-@code{const} @code{char *} pointer produces a warning. These 8557warnings help you find at compile time code that can try to write 8558into a string constant, but only if you have been very careful about 8559using @code{const} in declarations and prototypes. Otherwise, it is 8560just a nuisance. This is why we did not make @option{-Wall} request 8561these warnings. 8562 8563When compiling C++, warn about the deprecated conversion from string 8564literals to @code{char *}. This warning is enabled by default for C++ 8565programs. 8566 8567@item -Wclobbered 8568@opindex Wclobbered 8569@opindex Wno-clobbered 8570Warn for variables that might be changed by @code{longjmp} or 8571@code{vfork}. This warning is also enabled by @option{-Wextra}. 8572 8573@item -Wconversion 8574@opindex Wconversion 8575@opindex Wno-conversion 8576Warn for implicit conversions that may alter a value. This includes 8577conversions between real and integer, like @code{abs (x)} when 8578@code{x} is @code{double}; conversions between signed and unsigned, 8579like @code{unsigned ui = -1}; and conversions to smaller types, like 8580@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 8581((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 8582changed by the conversion like in @code{abs (2.0)}. Warnings about 8583conversions between signed and unsigned integers can be disabled by 8584using @option{-Wno-sign-conversion}. 8585 8586For C++, also warn for confusing overload resolution for user-defined 8587conversions; and conversions that never use a type conversion 8588operator: conversions to @code{void}, the same type, a base class or a 8589reference to them. Warnings about conversions between signed and 8590unsigned integers are disabled by default in C++ unless 8591@option{-Wsign-conversion} is explicitly enabled. 8592 8593Warnings about conversion from arithmetic on a small type back to that 8594type are only given with @option{-Warith-conversion}. 8595 8596@item -Wdangling-else 8597@opindex Wdangling-else 8598@opindex Wno-dangling-else 8599Warn about constructions where there may be confusion to which 8600@code{if} statement an @code{else} branch belongs. Here is an example of 8601such a case: 8602 8603@smallexample 8604@group 8605@{ 8606 if (a) 8607 if (b) 8608 foo (); 8609 else 8610 bar (); 8611@} 8612@end group 8613@end smallexample 8614 8615In C/C++, every @code{else} branch belongs to the innermost possible 8616@code{if} statement, which in this example is @code{if (b)}. This is 8617often not what the programmer expected, as illustrated in the above 8618example by indentation the programmer chose. When there is the 8619potential for this confusion, GCC issues a warning when this flag 8620is specified. To eliminate the warning, add explicit braces around 8621the innermost @code{if} statement so there is no way the @code{else} 8622can belong to the enclosing @code{if}. The resulting code 8623looks like this: 8624 8625@smallexample 8626@group 8627@{ 8628 if (a) 8629 @{ 8630 if (b) 8631 foo (); 8632 else 8633 bar (); 8634 @} 8635@} 8636@end group 8637@end smallexample 8638 8639This warning is enabled by @option{-Wparentheses}. 8640 8641@item -Wdangling-pointer 8642@itemx -Wdangling-pointer=@var{n} 8643@opindex Wdangling-pointer 8644@opindex Wno-dangling-pointer 8645Warn about uses of pointers (or C++ references) to objects with automatic 8646storage duration after their lifetime has ended. This includes local 8647variables declared in nested blocks, compound literals and other unnamed 8648temporary objects. In addition, warn about storing the address of such 8649objects in escaped pointers. The warning is enabled at all optimization 8650levels but may yield different results with optimization than without. 8651 8652@table @gcctabopt 8653@item -Wdangling-pointer=1 8654At level 1 the warning diagnoses only unconditional uses of dangling pointers. 8655For example 8656@smallexample 8657int f (int c1, int c2, x) 8658@{ 8659 char *p = strchr ((char[])@{ c1, c2 @}, c3); 8660 return p ? *p : 'x'; // warning: dangling pointer to a compound literal 8661@} 8662@end smallexample 8663In the following function the store of the address of the local variable 8664@code{x} in the escaped pointer @code{*p} also triggers the warning. 8665@smallexample 8666void g (int **p) 8667@{ 8668 int x = 7; 8669 *p = &x; // warning: storing the address of a local variable in *p 8670@} 8671@end smallexample 8672 8673@item -Wdangling-pointer=2 8674At level 2, in addition to unconditional uses the warning also diagnoses 8675conditional uses of dangling pointers. 8676 8677For example, because the array @var{a} in the following function is out of 8678scope when the pointer @var{s} that was set to point is used, the warning 8679triggers at this level. 8680 8681@smallexample 8682void f (char *s) 8683@{ 8684 if (!s) 8685 @{ 8686 char a[12] = "tmpname"; 8687 s = a; 8688 @} 8689 strcat (s, ".tmp"); // warning: dangling pointer to a may be used 8690 ... 8691@} 8692@end smallexample 8693@end table 8694 8695@option{-Wdangling-pointer=2} is included in @option{-Wall}. 8696 8697@item -Wdate-time 8698@opindex Wdate-time 8699@opindex Wno-date-time 8700Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 8701are encountered as they might prevent bit-wise-identical reproducible 8702compilations. 8703 8704@item -Wempty-body 8705@opindex Wempty-body 8706@opindex Wno-empty-body 8707Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 8708while} statement. This warning is also enabled by @option{-Wextra}. 8709 8710@item -Wno-endif-labels 8711@opindex Wendif-labels 8712@opindex Wno-endif-labels 8713Do not warn about stray tokens after @code{#else} and @code{#endif}. 8714 8715@item -Wenum-compare 8716@opindex Wenum-compare 8717@opindex Wno-enum-compare 8718Warn about a comparison between values of different enumerated types. 8719In C++ enumerated type mismatches in conditional expressions are also 8720diagnosed and the warning is enabled by default. In C this warning is 8721enabled by @option{-Wall}. 8722 8723@item -Wenum-conversion 8724@opindex Wenum-conversion 8725@opindex Wno-enum-conversion 8726Warn when a value of enumerated type is implicitly converted to a 8727different enumerated type. This warning is enabled by @option{-Wextra} 8728in C@. 8729 8730@item -Wjump-misses-init @r{(C, Objective-C only)} 8731@opindex Wjump-misses-init 8732@opindex Wno-jump-misses-init 8733Warn if a @code{goto} statement or a @code{switch} statement jumps 8734forward across the initialization of a variable, or jumps backward to a 8735label after the variable has been initialized. This only warns about 8736variables that are initialized when they are declared. This warning is 8737only supported for C and Objective-C; in C++ this sort of branch is an 8738error in any case. 8739 8740@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 8741can be disabled with the @option{-Wno-jump-misses-init} option. 8742 8743@item -Wsign-compare 8744@opindex Wsign-compare 8745@opindex Wno-sign-compare 8746@cindex warning for comparison of signed and unsigned values 8747@cindex comparison of signed and unsigned values, warning 8748@cindex signed and unsigned values, comparison warning 8749Warn when a comparison between signed and unsigned values could produce 8750an incorrect result when the signed value is converted to unsigned. 8751In C++, this warning is also enabled by @option{-Wall}. In C, it is 8752also enabled by @option{-Wextra}. 8753 8754@item -Wsign-conversion 8755@opindex Wsign-conversion 8756@opindex Wno-sign-conversion 8757Warn for implicit conversions that may change the sign of an integer 8758value, like assigning a signed integer expression to an unsigned 8759integer variable. An explicit cast silences the warning. In C, this 8760option is enabled also by @option{-Wconversion}. 8761 8762@item -Wfloat-conversion 8763@opindex Wfloat-conversion 8764@opindex Wno-float-conversion 8765Warn for implicit conversions that reduce the precision of a real value. 8766This includes conversions from real to integer, and from higher precision 8767real to lower precision real values. This option is also enabled by 8768@option{-Wconversion}. 8769 8770@item -Wno-scalar-storage-order 8771@opindex Wno-scalar-storage-order 8772@opindex Wscalar-storage-order 8773Do not warn on suspicious constructs involving reverse scalar storage order. 8774 8775@item -Wsizeof-array-div 8776@opindex Wsizeof-array-div 8777@opindex Wno-sizeof-array-div 8778Warn about divisions of two sizeof operators when the first one is applied 8779to an array and the divisor does not equal the size of the array element. 8780In such a case, the computation will not yield the number of elements in the 8781array, which is likely what the user intended. This warning warns e.g. about 8782@smallexample 8783int fn () 8784@{ 8785 int arr[10]; 8786 return sizeof (arr) / sizeof (short); 8787@} 8788@end smallexample 8789 8790This warning is enabled by @option{-Wall}. 8791 8792@item -Wsizeof-pointer-div 8793@opindex Wsizeof-pointer-div 8794@opindex Wno-sizeof-pointer-div 8795Warn for suspicious divisions of two sizeof expressions that divide 8796the pointer size by the element size, which is the usual way to compute 8797the array size but won't work out correctly with pointers. This warning 8798warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is 8799not an array, but a pointer. This warning is enabled by @option{-Wall}. 8800 8801@item -Wsizeof-pointer-memaccess 8802@opindex Wsizeof-pointer-memaccess 8803@opindex Wno-sizeof-pointer-memaccess 8804Warn for suspicious length parameters to certain string and memory built-in 8805functions if the argument uses @code{sizeof}. This warning triggers for 8806example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not 8807an array, but a pointer, and suggests a possible fix, or about 8808@code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess} 8809also warns about calls to bounded string copy functions like @code{strncat} 8810or @code{strncpy} that specify as the bound a @code{sizeof} expression of 8811the source array. For example, in the following function the call to 8812@code{strncat} specifies the size of the source string as the bound. That 8813is almost certainly a mistake and so the call is diagnosed. 8814@smallexample 8815void make_file (const char *name) 8816@{ 8817 char path[PATH_MAX]; 8818 strncpy (path, name, sizeof path - 1); 8819 strncat (path, ".text", sizeof ".text"); 8820 @dots{} 8821@} 8822@end smallexample 8823 8824The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}. 8825 8826@item -Wno-sizeof-array-argument 8827@opindex Wsizeof-array-argument 8828@opindex Wno-sizeof-array-argument 8829Do not warn when the @code{sizeof} operator is applied to a parameter that is 8830declared as an array in a function definition. This warning is enabled by 8831default for C and C++ programs. 8832 8833@item -Wmemset-elt-size 8834@opindex Wmemset-elt-size 8835@opindex Wno-memset-elt-size 8836Warn for suspicious calls to the @code{memset} built-in function, if the 8837first argument references an array, and the third argument is a number 8838equal to the number of elements, but not equal to the size of the array 8839in memory. This indicates that the user has omitted a multiplication by 8840the element size. This warning is enabled by @option{-Wall}. 8841 8842@item -Wmemset-transposed-args 8843@opindex Wmemset-transposed-args 8844@opindex Wno-memset-transposed-args 8845Warn for suspicious calls to the @code{memset} built-in function where 8846the second argument is not zero and the third argument is zero. For 8847example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because 8848@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic 8849is only emitted if the third argument is a literal zero. Otherwise, if 8850it is an expression that is folded to zero, or a cast of zero to some 8851type, it is far less likely that the arguments have been mistakenly 8852transposed and no warning is emitted. This warning is enabled 8853by @option{-Wall}. 8854 8855@item -Waddress 8856@opindex Waddress 8857@opindex Wno-address 8858Warn about suspicious uses of address expressions. These include comparing 8859the address of a function or a declared object to the null pointer constant 8860such as in 8861@smallexample 8862void f (void); 8863void g (void) 8864@{ 8865 if (!func) // warning: expression evaluates to false 8866 abort (); 8867@} 8868@end smallexample 8869comparisons of a pointer to a string literal, such as in 8870@smallexample 8871void f (const char *x) 8872@{ 8873 if (x == "abc") // warning: expression evaluates to false 8874 puts ("equal"); 8875@} 8876@end smallexample 8877and tests of the results of pointer addition or subtraction for equality 8878to null, such as in 8879@smallexample 8880void f (const int *p, int i) 8881@{ 8882 return p + i == NULL; 8883@} 8884@end smallexample 8885Such uses typically indicate a programmer error: the address of most 8886functions and objects necessarily evaluates to true (the exception are 8887weak symbols), so their use in a conditional might indicate missing 8888parentheses in a function call or a missing dereference in an array 8889expression. The subset of the warning for object pointers can be 8890suppressed by casting the pointer operand to an integer type such 8891as @code{inptr_t} or @code{uinptr_t}. 8892Comparisons against string literals result in unspecified behavior 8893and are not portable, and suggest the intent was to call @code{strcmp}. 8894The warning is suppressed if the suspicious expression is the result 8895of macro expansion. 8896@option{-Waddress} warning is enabled by @option{-Wall}. 8897 8898@item -Wno-address-of-packed-member 8899@opindex Waddress-of-packed-member 8900@opindex Wno-address-of-packed-member 8901Do not warn when the address of packed member of struct or union is taken, 8902which usually results in an unaligned pointer value. This is 8903enabled by default. 8904 8905@item -Wlogical-op 8906@opindex Wlogical-op 8907@opindex Wno-logical-op 8908Warn about suspicious uses of logical operators in expressions. 8909This includes using logical operators in contexts where a 8910bit-wise operator is likely to be expected. Also warns when 8911the operands of a logical operator are the same: 8912@smallexample 8913extern int a; 8914if (a < 0 && a < 0) @{ @dots{} @} 8915@end smallexample 8916 8917@item -Wlogical-not-parentheses 8918@opindex Wlogical-not-parentheses 8919@opindex Wno-logical-not-parentheses 8920Warn about logical not used on the left hand side operand of a comparison. 8921This option does not warn if the right operand is considered to be a boolean 8922expression. Its purpose is to detect suspicious code like the following: 8923@smallexample 8924int a; 8925@dots{} 8926if (!a > 1) @{ @dots{} @} 8927@end smallexample 8928 8929It is possible to suppress the warning by wrapping the LHS into 8930parentheses: 8931@smallexample 8932if ((!a) > 1) @{ @dots{} @} 8933@end smallexample 8934 8935This warning is enabled by @option{-Wall}. 8936 8937@item -Waggregate-return 8938@opindex Waggregate-return 8939@opindex Wno-aggregate-return 8940Warn if any functions that return structures or unions are defined or 8941called. (In languages where you can return an array, this also elicits 8942a warning.) 8943 8944@item -Wno-aggressive-loop-optimizations 8945@opindex Wno-aggressive-loop-optimizations 8946@opindex Waggressive-loop-optimizations 8947Warn if in a loop with constant number of iterations the compiler detects 8948undefined behavior in some statement during one or more of the iterations. 8949 8950@item -Wno-attributes 8951@opindex Wno-attributes 8952@opindex Wattributes 8953Do not warn if an unexpected @code{__attribute__} is used, such as 8954unrecognized attributes, function attributes applied to variables, 8955etc. This does not stop errors for incorrect use of supported 8956attributes. 8957 8958Additionally, using @option{-Wno-attributes=}, it is possible to suppress 8959warnings about unknown scoped attributes (in C++11 and C2X). For example, 8960@option{-Wno-attributes=vendor::attr} disables warning about the following 8961declaration: 8962 8963@smallexample 8964[[vendor::attr]] void f(); 8965@end smallexample 8966 8967It is also possible to disable warning about all attributes in a namespace 8968using @option{-Wno-attributes=vendor::} which prevents warning about both 8969of these declarations: 8970 8971@smallexample 8972[[vendor::safe]] void f(); 8973[[vendor::unsafe]] void f2(); 8974@end smallexample 8975 8976Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}. 8977 8978@item -Wno-builtin-declaration-mismatch 8979@opindex Wno-builtin-declaration-mismatch 8980@opindex Wbuiltin-declaration-mismatch 8981Warn if a built-in function is declared with an incompatible signature 8982or as a non-function, or when a built-in function declared with a type 8983that does not include a prototype is called with arguments whose promoted 8984types do not match those expected by the function. When @option{-Wextra} 8985is specified, also warn when a built-in function that takes arguments is 8986declared without a prototype. The @option{-Wbuiltin-declaration-mismatch} 8987warning is enabled by default. To avoid the warning include the appropriate 8988header to bring the prototypes of built-in functions into scope. 8989 8990For example, the call to @code{memset} below is diagnosed by the warning 8991because the function expects a value of type @code{size_t} as its argument 8992but the type of @code{32} is @code{int}. With @option{-Wextra}, 8993the declaration of the function is diagnosed as well. 8994@smallexample 8995extern void* memset (); 8996void f (void *d) 8997@{ 8998 memset (d, '\0', 32); 8999@} 9000@end smallexample 9001 9002@item -Wno-builtin-macro-redefined 9003@opindex Wno-builtin-macro-redefined 9004@opindex Wbuiltin-macro-redefined 9005Do not warn if certain built-in macros are redefined. This suppresses 9006warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 9007@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 9008 9009@item -Wstrict-prototypes @r{(C and Objective-C only)} 9010@opindex Wstrict-prototypes 9011@opindex Wno-strict-prototypes 9012Warn if a function is declared or defined without specifying the 9013argument types. (An old-style function definition is permitted without 9014a warning if preceded by a declaration that specifies the argument 9015types.) 9016 9017@item -Wold-style-declaration @r{(C and Objective-C only)} 9018@opindex Wold-style-declaration 9019@opindex Wno-old-style-declaration 9020Warn for obsolescent usages, according to the C Standard, in a 9021declaration. For example, warn if storage-class specifiers like 9022@code{static} are not the first things in a declaration. This warning 9023is also enabled by @option{-Wextra}. 9024 9025@item -Wold-style-definition @r{(C and Objective-C only)} 9026@opindex Wold-style-definition 9027@opindex Wno-old-style-definition 9028Warn if an old-style function definition is used. A warning is given 9029even if there is a previous prototype. A definition using @samp{()} 9030is not considered an old-style definition in C2X mode, because it is 9031equivalent to @samp{(void)} in that case, but is considered an 9032old-style definition for older standards. 9033 9034@item -Wmissing-parameter-type @r{(C and Objective-C only)} 9035@opindex Wmissing-parameter-type 9036@opindex Wno-missing-parameter-type 9037A function parameter is declared without a type specifier in K&R-style 9038functions: 9039 9040@smallexample 9041void foo(bar) @{ @} 9042@end smallexample 9043 9044This warning is also enabled by @option{-Wextra}. 9045 9046@item -Wmissing-prototypes @r{(C and Objective-C only)} 9047@opindex Wmissing-prototypes 9048@opindex Wno-missing-prototypes 9049Warn if a global function is defined without a previous prototype 9050declaration. This warning is issued even if the definition itself 9051provides a prototype. Use this option to detect global functions 9052that do not have a matching prototype declaration in a header file. 9053This option is not valid for C++ because all function declarations 9054provide prototypes and a non-matching declaration declares an 9055overload rather than conflict with an earlier declaration. 9056Use @option{-Wmissing-declarations} to detect missing declarations in C++. 9057 9058@item -Wmissing-declarations 9059@opindex Wmissing-declarations 9060@opindex Wno-missing-declarations 9061Warn if a global function is defined without a previous declaration. 9062Do so even if the definition itself provides a prototype. 9063Use this option to detect global functions that are not declared in 9064header files. In C, no warnings are issued for functions with previous 9065non-prototype declarations; use @option{-Wmissing-prototypes} to detect 9066missing prototypes. In C++, no warnings are issued for function templates, 9067or for inline functions, or for functions in anonymous namespaces. 9068 9069@item -Wmissing-field-initializers 9070@opindex Wmissing-field-initializers 9071@opindex Wno-missing-field-initializers 9072@opindex W 9073@opindex Wextra 9074@opindex Wno-extra 9075Warn if a structure's initializer has some fields missing. For 9076example, the following code causes such a warning, because 9077@code{x.h} is implicitly zero: 9078 9079@smallexample 9080struct s @{ int f, g, h; @}; 9081struct s x = @{ 3, 4 @}; 9082@end smallexample 9083 9084This option does not warn about designated initializers, so the following 9085modification does not trigger a warning: 9086 9087@smallexample 9088struct s @{ int f, g, h; @}; 9089struct s x = @{ .f = 3, .g = 4 @}; 9090@end smallexample 9091 9092In C this option does not warn about the universal zero initializer 9093@samp{@{ 0 @}}: 9094 9095@smallexample 9096struct s @{ int f, g, h; @}; 9097struct s x = @{ 0 @}; 9098@end smallexample 9099 9100Likewise, in C++ this option does not warn about the empty @{ @} 9101initializer, for example: 9102 9103@smallexample 9104struct s @{ int f, g, h; @}; 9105s x = @{ @}; 9106@end smallexample 9107 9108This warning is included in @option{-Wextra}. To get other @option{-Wextra} 9109warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 9110 9111@item -Wno-missing-requires 9112@opindex Wmissing-requires 9113@opindex Wno-missing-requires 9114 9115By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement: 9116 9117@smallexample 9118bool satisfied = requires @{ C<T> @}; 9119@end smallexample 9120 9121Here @samp{satisfied} will be true if @samp{C<T>} is a valid 9122expression, which it is for all T. Presumably the user meant to write 9123 9124@smallexample 9125bool satisfied = requires @{ requires C<T> @}; 9126@end smallexample 9127 9128so @samp{satisfied} is only true if concept @samp{C} is satisfied for 9129type @samp{T}. 9130 9131This warning can be disabled with @option{-Wno-missing-requires}. 9132 9133@item -Wno-missing-template-keyword 9134@opindex Wmissing-template-keyword 9135@opindex Wno-missing-template-keyword 9136 9137The member access tokens ., -> and :: must be followed by the @code{template} 9138keyword if the parent object is dependent and the member being named is a 9139template. 9140 9141@smallexample 9142template <class X> 9143void DoStuff (X x) 9144@{ 9145 x.template DoSomeOtherStuff<X>(); // Good. 9146 x.DoMoreStuff<X>(); // Warning, x is dependent. 9147@} 9148@end smallexample 9149 9150In rare cases it is possible to get false positives. To silence this, wrap 9151the expression in parentheses. For example, the following is treated as a 9152template, even where m and N are integers: 9153 9154@smallexample 9155void NotATemplate (my_class t) 9156@{ 9157 int N = 5; 9158 9159 bool test = t.m < N > (0); // Treated as a template. 9160 test = (t.m < N) > (0); // Same meaning, but not treated as a template. 9161@} 9162@end smallexample 9163 9164This warning can be disabled with @option{-Wno-missing-template-keyword}. 9165 9166@item -Wno-multichar 9167@opindex Wno-multichar 9168@opindex Wmultichar 9169Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 9170Usually they indicate a typo in the user's code, as they have 9171implementation-defined values, and should not be used in portable code. 9172 9173@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} 9174@opindex Wnormalized= 9175@opindex Wnormalized 9176@opindex Wno-normalized 9177@cindex NFC 9178@cindex NFKC 9179@cindex character set, input normalization 9180In ISO C and ISO C++, two identifiers are different if they are 9181different sequences of characters. However, sometimes when characters 9182outside the basic ASCII character set are used, you can have two 9183different character sequences that look the same. To avoid confusion, 9184the ISO 10646 standard sets out some @dfn{normalization rules} which 9185when applied ensure that two sequences that look the same are turned into 9186the same sequence. GCC can warn you if you are using identifiers that 9187have not been normalized; this option controls that warning. 9188 9189There are four levels of warning supported by GCC@. The default is 9190@option{-Wnormalized=nfc}, which warns about any identifier that is 9191not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 9192recommended form for most uses. It is equivalent to 9193@option{-Wnormalized}. 9194 9195Unfortunately, there are some characters allowed in identifiers by 9196ISO C and ISO C++ that, when turned into NFC, are not allowed in 9197identifiers. That is, there's no way to use these symbols in portable 9198ISO C or C++ and have all your identifiers in NFC@. 9199@option{-Wnormalized=id} suppresses the warning for these characters. 9200It is hoped that future versions of the standards involved will correct 9201this, which is why this option is not the default. 9202 9203You can switch the warning off for all characters by writing 9204@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 9205only do this if you are using some other normalization scheme (like 9206``D''), because otherwise you can easily create bugs that are 9207literally impossible to see. 9208 9209Some characters in ISO 10646 have distinct meanings but look identical 9210in some fonts or display methodologies, especially once formatting has 9211been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 9212LETTER N'', displays just like a regular @code{n} that has been 9213placed in a superscript. ISO 10646 defines the @dfn{NFKC} 9214normalization scheme to convert all these into a standard form as 9215well, and GCC warns if your code is not in NFKC if you use 9216@option{-Wnormalized=nfkc}. This warning is comparable to warning 9217about every identifier that contains the letter O because it might be 9218confused with the digit 0, and so is not the default, but may be 9219useful as a local coding convention if the programming environment 9220cannot be fixed to display these characters distinctly. 9221 9222@item -Wno-attribute-warning 9223@opindex Wno-attribute-warning 9224@opindex Wattribute-warning 9225Do not warn about usage of functions (@pxref{Function Attributes}) 9226declared with @code{warning} attribute. By default, this warning is 9227enabled. @option{-Wno-attribute-warning} can be used to disable the 9228warning or @option{-Wno-error=attribute-warning} can be used to 9229disable the error when compiled with @option{-Werror} flag. 9230 9231@item -Wno-deprecated 9232@opindex Wno-deprecated 9233@opindex Wdeprecated 9234Do not warn about usage of deprecated features. @xref{Deprecated Features}. 9235 9236@item -Wno-deprecated-declarations 9237@opindex Wno-deprecated-declarations 9238@opindex Wdeprecated-declarations 9239Do not warn about uses of functions (@pxref{Function Attributes}), 9240variables (@pxref{Variable Attributes}), and types (@pxref{Type 9241Attributes}) marked as deprecated by using the @code{deprecated} 9242attribute. 9243 9244@item -Wno-overflow 9245@opindex Wno-overflow 9246@opindex Woverflow 9247Do not warn about compile-time overflow in constant expressions. 9248 9249@item -Wno-odr 9250@opindex Wno-odr 9251@opindex Wodr 9252Warn about One Definition Rule violations during link-time optimization. 9253Enabled by default. 9254 9255@item -Wopenacc-parallelism 9256@opindex Wopenacc-parallelism 9257@opindex Wno-openacc-parallelism 9258@cindex OpenACC accelerator programming 9259Warn about potentially suboptimal choices related to OpenACC parallelism. 9260 9261@item -Wopenmp-simd 9262@opindex Wopenmp-simd 9263@opindex Wno-openmp-simd 9264Warn if the vectorizer cost model overrides the OpenMP 9265simd directive set by user. The @option{-fsimd-cost-model=unlimited} 9266option can be used to relax the cost model. 9267 9268@item -Woverride-init @r{(C and Objective-C only)} 9269@opindex Woverride-init 9270@opindex Wno-override-init 9271@opindex W 9272@opindex Wextra 9273@opindex Wno-extra 9274Warn if an initialized field without side effects is overridden when 9275using designated initializers (@pxref{Designated Inits, , Designated 9276Initializers}). 9277 9278This warning is included in @option{-Wextra}. To get other 9279@option{-Wextra} warnings without this one, use @option{-Wextra 9280-Wno-override-init}. 9281 9282@item -Wno-override-init-side-effects @r{(C and Objective-C only)} 9283@opindex Woverride-init-side-effects 9284@opindex Wno-override-init-side-effects 9285Do not warn if an initialized field with side effects is overridden when 9286using designated initializers (@pxref{Designated Inits, , Designated 9287Initializers}). This warning is enabled by default. 9288 9289@item -Wpacked 9290@opindex Wpacked 9291@opindex Wno-packed 9292Warn if a structure is given the packed attribute, but the packed 9293attribute has no effect on the layout or size of the structure. 9294Such structures may be mis-aligned for little benefit. For 9295instance, in this code, the variable @code{f.x} in @code{struct bar} 9296is misaligned even though @code{struct bar} does not itself 9297have the packed attribute: 9298 9299@smallexample 9300@group 9301struct foo @{ 9302 int x; 9303 char a, b, c, d; 9304@} __attribute__((packed)); 9305struct bar @{ 9306 char z; 9307 struct foo f; 9308@}; 9309@end group 9310@end smallexample 9311 9312@item -Wnopacked-bitfield-compat 9313@opindex Wpacked-bitfield-compat 9314@opindex Wno-packed-bitfield-compat 9315The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 9316on bit-fields of type @code{char}. This was fixed in GCC 4.4 but 9317the change can lead to differences in the structure layout. GCC 9318informs you when the offset of such a field has changed in GCC 4.4. 9319For example there is no longer a 4-bit padding between field @code{a} 9320and @code{b} in this structure: 9321 9322@smallexample 9323struct foo 9324@{ 9325 char a:4; 9326 char b:8; 9327@} __attribute__ ((packed)); 9328@end smallexample 9329 9330This warning is enabled by default. Use 9331@option{-Wno-packed-bitfield-compat} to disable this warning. 9332 9333@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 9334@opindex Wpacked-not-aligned 9335@opindex Wno-packed-not-aligned 9336Warn if a structure field with explicitly specified alignment in a 9337packed struct or union is misaligned. For example, a warning will 9338be issued on @code{struct S}, like, @code{warning: alignment 1 of 9339'struct S' is less than 8}, in this code: 9340 9341@smallexample 9342@group 9343struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @}; 9344struct __attribute__ ((packed)) S @{ 9345 struct S8 s8; 9346@}; 9347@end group 9348@end smallexample 9349 9350This warning is enabled by @option{-Wall}. 9351 9352@item -Wpadded 9353@opindex Wpadded 9354@opindex Wno-padded 9355Warn if padding is included in a structure, either to align an element 9356of the structure or to align the whole structure. Sometimes when this 9357happens it is possible to rearrange the fields of the structure to 9358reduce the padding and so make the structure smaller. 9359 9360@item -Wredundant-decls 9361@opindex Wredundant-decls 9362@opindex Wno-redundant-decls 9363Warn if anything is declared more than once in the same scope, even in 9364cases where multiple declaration is valid and changes nothing. 9365 9366@item -Wrestrict 9367@opindex Wrestrict 9368@opindex Wno-restrict 9369Warn when an object referenced by a @code{restrict}-qualified parameter 9370(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another 9371argument, or when copies between such objects overlap. For example, 9372the call to the @code{strcpy} function below attempts to truncate the string 9373by replacing its initial characters with the last four. However, because 9374the call writes the terminating NUL into @code{a[4]}, the copies overlap and 9375the call is diagnosed. 9376 9377@smallexample 9378void foo (void) 9379@{ 9380 char a[] = "abcd1234"; 9381 strcpy (a, a + 4); 9382 @dots{} 9383@} 9384@end smallexample 9385The @option{-Wrestrict} option detects some instances of simple overlap 9386even without optimization but works best at @option{-O2} and above. It 9387is included in @option{-Wall}. 9388 9389@item -Wnested-externs @r{(C and Objective-C only)} 9390@opindex Wnested-externs 9391@opindex Wno-nested-externs 9392Warn if an @code{extern} declaration is encountered within a function. 9393 9394@item -Winline 9395@opindex Winline 9396@opindex Wno-inline 9397Warn if a function that is declared as inline cannot be inlined. 9398Even with this option, the compiler does not warn about failures to 9399inline functions declared in system headers. 9400 9401The compiler uses a variety of heuristics to determine whether or not 9402to inline a function. For example, the compiler takes into account 9403the size of the function being inlined and the amount of inlining 9404that has already been done in the current function. Therefore, 9405seemingly insignificant changes in the source program can cause the 9406warnings produced by @option{-Winline} to appear or disappear. 9407 9408@item -Winterference-size 9409@opindex Winterference-size 9410Warn about use of C++17 @code{std::hardware_destructive_interference_size} 9411without specifying its value with @option{--param destructive-interference-size}. 9412Also warn about questionable values for that option. 9413 9414This variable is intended to be used for controlling class layout, to 9415avoid false sharing in concurrent code: 9416 9417@smallexample 9418struct independent_fields @{ 9419 alignas(std::hardware_destructive_interference_size) std::atomic<int> one; 9420 alignas(std::hardware_destructive_interference_size) std::atomic<int> two; 9421@}; 9422@end smallexample 9423 9424Here @samp{one} and @samp{two} are intended to be far enough apart 9425that stores to one won't require accesses to the other to reload the 9426cache line. 9427 9428By default, @option{--param destructive-interference-size} and 9429@option{--param constructive-interference-size} are set based on the 9430current @option{-mtune} option, typically to the L1 cache line size 9431for the particular target CPU, sometimes to a range if tuning for a 9432generic target. So all translation units that depend on ABI 9433compatibility for the use of these variables must be compiled with 9434the same @option{-mtune} (or @option{-mcpu}). 9435 9436If ABI stability is important, such as if the use is in a header for a 9437library, you should probably not use the hardware interference size 9438variables at all. Alternatively, you can force a particular value 9439with @option{--param}. 9440 9441If you are confident that your use of the variable does not affect ABI 9442outside a single build of your project, you can turn off the warning 9443with @option{-Wno-interference-size}. 9444 9445@item -Wint-in-bool-context 9446@opindex Wint-in-bool-context 9447@opindex Wno-int-in-bool-context 9448Warn for suspicious use of integer values where boolean values are expected, 9449such as conditional expressions (?:) using non-boolean integer constants in 9450boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed 9451integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise 9452for all kinds of multiplications regardless of the data type. 9453This warning is enabled by @option{-Wall}. 9454 9455@item -Wno-int-to-pointer-cast 9456@opindex Wno-int-to-pointer-cast 9457@opindex Wint-to-pointer-cast 9458Suppress warnings from casts to pointer type of an integer of a 9459different size. In C++, casting to a pointer type of smaller size is 9460an error. @option{Wint-to-pointer-cast} is enabled by default. 9461 9462 9463@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 9464@opindex Wno-pointer-to-int-cast 9465@opindex Wpointer-to-int-cast 9466Suppress warnings from casts from a pointer to an integer type of a 9467different size. 9468 9469@item -Winvalid-pch 9470@opindex Winvalid-pch 9471@opindex Wno-invalid-pch 9472Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 9473the search path but cannot be used. 9474 9475@item -Wlong-long 9476@opindex Wlong-long 9477@opindex Wno-long-long 9478Warn if @code{long long} type is used. This is enabled by either 9479@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 9480modes. To inhibit the warning messages, use @option{-Wno-long-long}. 9481 9482@item -Wvariadic-macros 9483@opindex Wvariadic-macros 9484@opindex Wno-variadic-macros 9485Warn if variadic macros are used in ISO C90 mode, or if the GNU 9486alternate syntax is used in ISO C99 mode. This is enabled by either 9487@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 9488messages, use @option{-Wno-variadic-macros}. 9489 9490@item -Wno-varargs 9491@opindex Wvarargs 9492@opindex Wno-varargs 9493Do not warn upon questionable usage of the macros used to handle variable 9494arguments like @code{va_start}. These warnings are enabled by default. 9495 9496@item -Wvector-operation-performance 9497@opindex Wvector-operation-performance 9498@opindex Wno-vector-operation-performance 9499Warn if vector operation is not implemented via SIMD capabilities of the 9500architecture. Mainly useful for the performance tuning. 9501Vector operation can be implemented @code{piecewise}, which means that the 9502scalar operation is performed on every vector element; 9503@code{in parallel}, which means that the vector operation is implemented 9504using scalars of wider type, which normally is more performance efficient; 9505and @code{as a single scalar}, which means that vector fits into a 9506scalar type. 9507 9508@item -Wvla 9509@opindex Wvla 9510@opindex Wno-vla 9511Warn if a variable-length array is used in the code. 9512@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 9513the variable-length array. 9514 9515@item -Wvla-larger-than=@var{byte-size} 9516@opindex Wvla-larger-than= 9517@opindex Wno-vla-larger-than 9518If this option is used, the compiler warns for declarations of 9519variable-length arrays whose size is either unbounded, or bounded 9520by an argument that allows the array size to exceed @var{byte-size} 9521bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size} 9522works, but with variable-length arrays. 9523 9524Note that GCC may optimize small variable-length arrays of a known 9525value into plain arrays, so this warning may not get triggered for 9526such arrays. 9527 9528@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but 9529is typically only effective when @option{-ftree-vrp} is active (default 9530for @option{-O2} and above). 9531 9532See also @option{-Walloca-larger-than=@var{byte-size}}. 9533 9534@item -Wno-vla-larger-than 9535@opindex Wno-vla-larger-than 9536Disable @option{-Wvla-larger-than=} warnings. The option is equivalent 9537to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger. 9538 9539@item -Wvla-parameter 9540@opindex Wno-vla-parameter 9541Warn about redeclarations of functions involving arguments of Variable 9542Length Array types of inconsistent kinds or forms, and enable the detection 9543of out-of-bounds accesses to such parameters by warnings such as 9544@option{-Warray-bounds}. 9545 9546If the first function declaration uses the VLA form the bound specified 9547in the array is assumed to be the minimum number of elements expected to 9548be provided in calls to the function and the maximum number of elements 9549accessed by it. Failing to provide arguments of sufficient size or 9550accessing more than the maximum number of elements may be diagnosed. 9551 9552For example, the warning triggers for the following redeclarations because 9553the first one allows an array of any size to be passed to @code{f} while 9554the second one specifies that the array argument must have at least @code{n} 9555elements. In addition, calling @code{f} with the associated VLA bound 9556parameter in excess of the actual VLA bound triggers a warning as well. 9557 9558@smallexample 9559void f (int n, int[n]); 9560void f (int, int[]); // warning: argument 2 previously declared as a VLA 9561 9562void g (int n) 9563@{ 9564 if (n > 4) 9565 return; 9566 int a[n]; 9567 f (sizeof a, a); // warning: access to a by f may be out of bounds 9568 @dots{} 9569@} 9570 9571@end smallexample 9572 9573@option{-Wvla-parameter} is included in @option{-Wall}. The 9574@option{-Warray-parameter} option triggers warnings for similar problems 9575involving ordinary array arguments. 9576 9577@item -Wvolatile-register-var 9578@opindex Wvolatile-register-var 9579@opindex Wno-volatile-register-var 9580Warn if a register variable is declared volatile. The volatile 9581modifier does not inhibit all optimizations that may eliminate reads 9582and/or writes to register variables. This warning is enabled by 9583@option{-Wall}. 9584 9585@item -Wdisabled-optimization 9586@opindex Wdisabled-optimization 9587@opindex Wno-disabled-optimization 9588Warn if a requested optimization pass is disabled. This warning does 9589not generally indicate that there is anything wrong with your code; it 9590merely indicates that GCC's optimizers are unable to handle the code 9591effectively. Often, the problem is that your code is too big or too 9592complex; GCC refuses to optimize programs when the optimization 9593itself is likely to take inordinate amounts of time. 9594 9595@item -Wpointer-sign @r{(C and Objective-C only)} 9596@opindex Wpointer-sign 9597@opindex Wno-pointer-sign 9598Warn for pointer argument passing or assignment with different signedness. 9599This option is only supported for C and Objective-C@. It is implied by 9600@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 9601@option{-Wno-pointer-sign}. 9602 9603@item -Wstack-protector 9604@opindex Wstack-protector 9605@opindex Wno-stack-protector 9606This option is only active when @option{-fstack-protector} is active. It 9607warns about functions that are not protected against stack smashing. 9608 9609@item -Woverlength-strings 9610@opindex Woverlength-strings 9611@opindex Wno-overlength-strings 9612Warn about string constants that are longer than the ``minimum 9613maximum'' length specified in the C standard. Modern compilers 9614generally allow string constants that are much longer than the 9615standard's minimum limit, but very portable programs should avoid 9616using longer strings. 9617 9618The limit applies @emph{after} string constant concatenation, and does 9619not count the trailing NUL@. In C90, the limit was 509 characters; in 9620C99, it was raised to 4095. C++98 does not specify a normative 9621minimum maximum, so we do not diagnose overlength strings in C++@. 9622 9623This option is implied by @option{-Wpedantic}, and can be disabled with 9624@option{-Wno-overlength-strings}. 9625 9626@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 9627@opindex Wunsuffixed-float-constants 9628@opindex Wno-unsuffixed-float-constants 9629 9630Issue a warning for any floating constant that does not have 9631a suffix. When used together with @option{-Wsystem-headers} it 9632warns about such constants in system header files. This can be useful 9633when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 9634from the decimal floating-point extension to C99. 9635 9636@item -Wno-lto-type-mismatch 9637@opindex Wlto-type-mismatch 9638@opindex Wno-lto-type-mismatch 9639 9640During the link-time optimization, do not warn about type mismatches in 9641global declarations from different compilation units. 9642Requires @option{-flto} to be enabled. Enabled by default. 9643 9644@item -Wno-designated-init @r{(C and Objective-C only)} 9645@opindex Wdesignated-init 9646@opindex Wno-designated-init 9647Suppress warnings when a positional initializer is used to initialize 9648a structure that has been marked with the @code{designated_init} 9649attribute. 9650 9651@end table 9652 9653@node Static Analyzer Options 9654@section Options That Control Static Analysis 9655 9656@table @gcctabopt 9657@item -fanalyzer 9658@opindex analyzer 9659@opindex fanalyzer 9660@opindex fno-analyzer 9661This option enables an static analysis of program flow which looks 9662for ``interesting'' interprocedural paths through the 9663code, and issues warnings for problems found on them. 9664 9665This analysis is much more expensive than other GCC warnings. 9666 9667In technical terms, it performs coverage-guided symbolic execution of 9668the code being compiled. It is neither sound nor complete: it can 9669have false positives and false negatives. It is a bug-finding tool, 9670rather than a tool for proving program correctness. 9671 9672The analyzer is only suitable for use on C code in this release. 9673 9674Enabling this option effectively enables the following warnings: 9675 9676@gccoptlist{ @gol 9677-Wanalyzer-double-fclose @gol 9678-Wanalyzer-double-free @gol 9679-Wanalyzer-exposure-through-output-file @gol 9680-Wanalyzer-file-leak @gol 9681-Wanalyzer-free-of-non-heap @gol 9682-Wanalyzer-malloc-leak @gol 9683-Wanalyzer-mismatching-deallocation @gol 9684-Wanalyzer-null-argument @gol 9685-Wanalyzer-null-dereference @gol 9686-Wanalyzer-possible-null-argument @gol 9687-Wanalyzer-possible-null-dereference @gol 9688-Wanalyzer-shift-count-negative @gol 9689-Wanalyzer-shift-count-overflow @gol 9690-Wanalyzer-stale-setjmp-buffer @gol 9691-Wanalyzer-unsafe-call-within-signal-handler @gol 9692-Wanalyzer-use-after-free @gol 9693-Wanalyzer-use-of-pointer-in-stale-stack-frame @gol 9694-Wanalyzer-use-of-uninitialized-value @gol 9695-Wanalyzer-write-to-const @gol 9696-Wanalyzer-write-to-string-literal @gol 9697} 9698@ignore 9699-Wanalyzer-tainted-allocation-size @gol 9700-Wanalyzer-tainted-array-index @gol 9701-Wanalyzer-tainted-divisor @gol 9702-Wanalyzer-tainted-offset @gol 9703-Wanalyzer-tainted-size @gol 9704@end ignore 9705 9706This option is only available if GCC was configured with analyzer 9707support enabled. 9708 9709@item -Wanalyzer-too-complex 9710@opindex Wanalyzer-too-complex 9711@opindex Wno-analyzer-too-complex 9712If @option{-fanalyzer} is enabled, the analyzer uses various heuristics 9713to attempt to explore the control flow and data flow in the program, 9714but these can be defeated by sufficiently complicated code. 9715 9716By default, the analysis silently stops if the code is too 9717complicated for the analyzer to fully explore and it reaches an internal 9718limit. The @option{-Wanalyzer-too-complex} option warns if this occurs. 9719 9720@item -Wno-analyzer-double-fclose 9721@opindex Wanalyzer-double-fclose 9722@opindex Wno-analyzer-double-fclose 9723This warning requires @option{-fanalyzer}, which enables it; use 9724@option{-Wno-analyzer-double-fclose} to disable it. 9725 9726This diagnostic warns for paths through the code in which a @code{FILE *} 9727can have @code{fclose} called on it more than once. 9728 9729@item -Wno-analyzer-double-free 9730@opindex Wanalyzer-double-free 9731@opindex Wno-analyzer-double-free 9732This warning requires @option{-fanalyzer}, which enables it; use 9733@option{-Wno-analyzer-double-free} to disable it. 9734 9735This diagnostic warns for paths through the code in which a pointer 9736can have a deallocator called on it more than once, either @code{free}, 9737or a deallocator referenced by attribute @code{malloc}. 9738 9739@item -Wno-analyzer-exposure-through-output-file 9740@opindex Wanalyzer-exposure-through-output-file 9741@opindex Wno-analyzer-exposure-through-output-file 9742This warning requires @option{-fanalyzer}, which enables it; use 9743@option{-Wno-analyzer-exposure-through-output-file} 9744to disable it. 9745 9746This diagnostic warns for paths through the code in which a 9747security-sensitive value is written to an output file 9748(such as writing a password to a log file). 9749 9750@item -Wno-analyzer-file-leak 9751@opindex Wanalyzer-file-leak 9752@opindex Wno-analyzer-file-leak 9753This warning requires @option{-fanalyzer}, which enables it; use 9754@option{-Wno-analyzer-file-leak} 9755to disable it. 9756 9757This diagnostic warns for paths through the code in which a 9758@code{<stdio.h>} @code{FILE *} stream object is leaked. 9759 9760@item -Wno-analyzer-free-of-non-heap 9761@opindex Wanalyzer-free-of-non-heap 9762@opindex Wno-analyzer-free-of-non-heap 9763This warning requires @option{-fanalyzer}, which enables it; use 9764@option{-Wno-analyzer-free-of-non-heap} 9765to disable it. 9766 9767This diagnostic warns for paths through the code in which @code{free} 9768is called on a non-heap pointer (e.g. an on-stack buffer, or a global). 9769 9770@item -Wno-analyzer-malloc-leak 9771@opindex Wanalyzer-malloc-leak 9772@opindex Wno-analyzer-malloc-leak 9773This warning requires @option{-fanalyzer}, which enables it; use 9774@option{-Wno-analyzer-malloc-leak} 9775to disable it. 9776 9777This diagnostic warns for paths through the code in which a 9778pointer allocated via an allocator is leaked: either @code{malloc}, 9779or a function marked with attribute @code{malloc}. 9780 9781@item -Wno-analyzer-mismatching-deallocation 9782@opindex Wanalyzer-mismatching-deallocation 9783@opindex Wno-analyzer-mismatching-deallocation 9784This warning requires @option{-fanalyzer}, which enables it; use 9785@option{-Wno-analyzer-mismatching-deallocation} 9786to disable it. 9787 9788This diagnostic warns for paths through the code in which the 9789wrong deallocation function is called on a pointer value, based on 9790which function was used to allocate the pointer value. The diagnostic 9791will warn about mismatches between @code{free}, scalar @code{delete} 9792and vector @code{delete[]}, and those marked as allocator/deallocator 9793pairs using attribute @code{malloc}. 9794 9795@item -Wno-analyzer-possible-null-argument 9796@opindex Wanalyzer-possible-null-argument 9797@opindex Wno-analyzer-possible-null-argument 9798This warning requires @option{-fanalyzer}, which enables it; use 9799@option{-Wno-analyzer-possible-null-argument} to disable it. 9800 9801This diagnostic warns for paths through the code in which a 9802possibly-NULL value is passed to a function argument marked 9803with @code{__attribute__((nonnull))} as requiring a non-NULL 9804value. 9805 9806@item -Wno-analyzer-possible-null-dereference 9807@opindex Wanalyzer-possible-null-dereference 9808@opindex Wno-analyzer-possible-null-dereference 9809This warning requires @option{-fanalyzer}, which enables it; use 9810@option{-Wno-analyzer-possible-null-dereference} to disable it. 9811 9812This diagnostic warns for paths through the code in which a 9813possibly-NULL value is dereferenced. 9814 9815@item -Wno-analyzer-null-argument 9816@opindex Wanalyzer-null-argument 9817@opindex Wno-analyzer-null-argument 9818This warning requires @option{-fanalyzer}, which enables it; use 9819@option{-Wno-analyzer-null-argument} to disable it. 9820 9821This diagnostic warns for paths through the code in which a 9822value known to be NULL is passed to a function argument marked 9823with @code{__attribute__((nonnull))} as requiring a non-NULL 9824value. 9825 9826@item -Wno-analyzer-null-dereference 9827@opindex Wanalyzer-null-dereference 9828@opindex Wno-analyzer-null-dereference 9829This warning requires @option{-fanalyzer}, which enables it; use 9830@option{-Wno-analyzer-null-dereference} to disable it. 9831 9832This diagnostic warns for paths through the code in which a 9833value known to be NULL is dereferenced. 9834 9835@item -Wno-analyzer-shift-count-negative 9836@opindex Wanalyzer-shift-count-negative 9837@opindex Wno-analyzer-shift-count-negative 9838This warning requires @option{-fanalyzer}, which enables it; use 9839@option{-Wno-analyzer-shift-count-negative} to disable it. 9840 9841This diagnostic warns for paths through the code in which a 9842shift is attempted with a negative count. It is analogous to 9843the @option{-Wshift-count-negative} diagnostic implemented in 9844the C/C++ front ends, but is implemented based on analyzing 9845interprocedural paths, rather than merely parsing the syntax tree. 9846However, the analyzer does not prioritize detection of such paths, so 9847false negatives are more likely relative to other warnings. 9848 9849@item -Wno-analyzer-shift-count-overflow 9850@opindex Wanalyzer-shift-count-overflow 9851@opindex Wno-analyzer-shift-count-overflow 9852This warning requires @option{-fanalyzer}, which enables it; use 9853@option{-Wno-analyzer-shift-count-overflow} to disable it. 9854 9855This diagnostic warns for paths through the code in which a 9856shift is attempted with a count greater than or equal to the 9857precision of the operand's type. It is analogous to 9858the @option{-Wshift-count-overflow} diagnostic implemented in 9859the C/C++ front ends, but is implemented based on analyzing 9860interprocedural paths, rather than merely parsing the syntax tree. 9861However, the analyzer does not prioritize detection of such paths, so 9862false negatives are more likely relative to other warnings. 9863 9864@item -Wno-analyzer-stale-setjmp-buffer 9865@opindex Wanalyzer-stale-setjmp-buffer 9866@opindex Wno-analyzer-stale-setjmp-buffer 9867This warning requires @option{-fanalyzer}, which enables it; use 9868@option{-Wno-analyzer-stale-setjmp-buffer} to disable it. 9869 9870This diagnostic warns for paths through the code in which 9871@code{longjmp} is called to rewind to a @code{jmp_buf} relating 9872to a @code{setjmp} call in a function that has returned. 9873 9874When @code{setjmp} is called on a @code{jmp_buf} to record a rewind 9875location, it records the stack frame. The stack frame becomes invalid 9876when the function containing the @code{setjmp} call returns. Attempting 9877to rewind to it via @code{longjmp} would reference a stack frame that 9878no longer exists, and likely lead to a crash (or worse). 9879 9880@item -Wno-analyzer-tainted-allocation-size 9881@opindex Wanalyzer-tainted-allocation-size 9882@opindex Wno-analyzer-tainted-allocation-size 9883This warning requires both @option{-fanalyzer} and 9884@option{-fanalyzer-checker=taint} to enable it; 9885use @option{-Wno-analyzer-tainted-allocation-size} to disable it. 9886 9887This diagnostic warns for paths through the code in which a value 9888that could be under an attacker's control is used as the size 9889of an allocation without being sanitized, so that an attacker could 9890inject an excessively large allocation and potentially cause a denial 9891of service attack. 9892 9893See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}. 9894 9895@item -Wno-analyzer-tainted-array-index 9896@opindex Wanalyzer-tainted-array-index 9897@opindex Wno-analyzer-tainted-array-index 9898This warning requires both @option{-fanalyzer} and 9899@option{-fanalyzer-checker=taint} to enable it; 9900use @option{-Wno-analyzer-tainted-array-index} to disable it. 9901 9902This diagnostic warns for paths through the code in which a value 9903that could be under an attacker's control is used as the index 9904of an array access without being sanitized, so that an attacker 9905could inject an out-of-bounds access. 9906 9907See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}. 9908 9909@item -Wno-analyzer-tainted-divisor 9910@opindex Wanalyzer-tainted-divisor 9911@opindex Wno-analyzer-tainted-divisor 9912This warning requires both @option{-fanalyzer} and 9913@option{-fanalyzer-checker=taint} to enable it; 9914use @option{-Wno-analyzer-tainted-divisor} to disable it. 9915 9916This diagnostic warns for paths through the code in which a value 9917that could be under an attacker's control is used as the divisor 9918in a division or modulus operation without being sanitized, so that 9919an attacker could inject a division-by-zero. 9920 9921@item -Wno-analyzer-tainted-offset 9922@opindex Wanalyzer-tainted-offset 9923@opindex Wno-analyzer-tainted-offset 9924This warning requires both @option{-fanalyzer} and 9925@option{-fanalyzer-checker=taint} to enable it; 9926use @option{-Wno-analyzer-tainted-offset} to disable it. 9927 9928This diagnostic warns for paths through the code in which a value 9929that could be under an attacker's control is used as a pointer offset 9930without being sanitized, so that an attacker could inject an out-of-bounds 9931access. 9932 9933See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}. 9934 9935@item -Wno-analyzer-tainted-size 9936@opindex Wanalyzer-tainted-size 9937@opindex Wno-analyzer-tainted-size 9938This warning requires both @option{-fanalyzer} and 9939@option{-fanalyzer-checker=taint} to enable it; 9940use @option{-Wno-analyzer-tainted-size} to disable it. 9941 9942This diagnostic warns for paths through the code in which a value 9943that could be under an attacker's control is used as the size of 9944an operation such as @code{memset} without being sanitized, so that an 9945attacker could inject an out-of-bounds access. 9946 9947@item -Wno-analyzer-unsafe-call-within-signal-handler 9948@opindex Wanalyzer-unsafe-call-within-signal-handler 9949@opindex Wno-analyzer-unsafe-call-within-signal-handler 9950This warning requires @option{-fanalyzer}, which enables it; use 9951@option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it. 9952 9953This diagnostic warns for paths through the code in which a 9954function known to be async-signal-unsafe (such as @code{fprintf}) is 9955called from a signal handler. 9956 9957@item -Wno-analyzer-use-after-free 9958@opindex Wanalyzer-use-after-free 9959@opindex Wno-analyzer-use-after-free 9960This warning requires @option{-fanalyzer}, which enables it; use 9961@option{-Wno-analyzer-use-after-free} to disable it. 9962 9963This diagnostic warns for paths through the code in which a 9964pointer is used after a deallocator is called on it: either @code{free}, 9965or a deallocator referenced by attribute @code{malloc}. 9966 9967@item -Wno-analyzer-use-of-pointer-in-stale-stack-frame 9968@opindex Wanalyzer-use-of-pointer-in-stale-stack-frame 9969@opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame 9970This warning requires @option{-fanalyzer}, which enables it; use 9971@option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame} 9972to disable it. 9973 9974This diagnostic warns for paths through the code in which a pointer 9975is dereferenced that points to a variable in a stale stack frame. 9976 9977@item -Wno-analyzer-write-to-const 9978@opindex Wanalyzer-write-to-const 9979@opindex Wno-analyzer-write-to-const 9980This warning requires @option{-fanalyzer}, which enables it; use 9981@option{-Wno-analyzer-write-to-const} 9982to disable it. 9983 9984This diagnostic warns for paths through the code in which the analyzer 9985detects an attempt to write through a pointer to a @code{const} object. 9986However, the analyzer does not prioritize detection of such paths, so 9987false negatives are more likely relative to other warnings. 9988 9989@item -Wno-analyzer-write-to-string-literal 9990@opindex Wanalyzer-write-to-string-literal 9991@opindex Wno-analyzer-write-to-string-literal 9992This warning requires @option{-fanalyzer}, which enables it; use 9993@option{-Wno-analyzer-write-to-string-literal} 9994to disable it. 9995 9996This diagnostic warns for paths through the code in which the analyzer 9997detects an attempt to write through a pointer to a string literal. 9998However, the analyzer does not prioritize detection of such paths, so 9999false negatives are more likely relative to other warnings. 10000 10001@item -Wno-analyzer-use-of-uninitialized-value 10002@opindex Wanalyzer-use-of-uninitialized-value 10003@opindex Wno-analyzer-use-of-uninitialized-value 10004This warning requires @option{-fanalyzer}, which enables it; use 10005@option{-Wno-analyzer-use-of-uninitialized-value} to disable it. 10006 10007This diagnostic warns for paths through the code in which an uninitialized 10008value is used. 10009 10010@end table 10011 10012Pertinent parameters for controlling the exploration are: 10013@option{--param analyzer-bb-explosion-factor=@var{value}}, 10014@option{--param analyzer-max-enodes-per-program-point=@var{value}}, 10015@option{--param analyzer-max-recursion-depth=@var{value}}, and 10016@option{--param analyzer-min-snodes-for-call-summary=@var{value}}. 10017 10018The following options control the analyzer. 10019 10020@table @gcctabopt 10021 10022@item -fanalyzer-call-summaries 10023@opindex fanalyzer-call-summaries 10024@opindex fno-analyzer-call-summaries 10025Simplify interprocedural analysis by computing the effect of certain calls, 10026rather than exploring all paths through the function from callsite to each 10027possible return. 10028 10029If enabled, call summaries are only used for functions with more than one 10030call site, and that are sufficiently complicated (as per 10031@option{--param analyzer-min-snodes-for-call-summary=@var{value}}). 10032 10033@item -fanalyzer-checker=@var{name} 10034@opindex fanalyzer-checker 10035Restrict the analyzer to run just the named checker, and enable it. 10036 10037Some checkers are disabled by default (even with @option{-fanalyzer}), 10038such as the @code{taint} checker that implements 10039@option{-Wanalyzer-tainted-array-index}, and this option is required 10040to enable them. 10041 10042@emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the 10043following warnings from @option{-fanalyzer}: 10044 10045@gccoptlist{ @gol 10046-Wanalyzer-double-fclose @gol 10047-Wanalyzer-double-free @gol 10048-Wanalyzer-exposure-through-output-file @gol 10049-Wanalyzer-file-leak @gol 10050-Wanalyzer-free-of-non-heap @gol 10051-Wanalyzer-malloc-leak @gol 10052-Wanalyzer-mismatching-deallocation @gol 10053-Wanalyzer-null-argument @gol 10054-Wanalyzer-null-dereference @gol 10055-Wanalyzer-possible-null-argument @gol 10056-Wanalyzer-possible-null-dereference @gol 10057-Wanalyzer-unsafe-call-within-signal-handler @gol 10058-Wanalyzer-use-after-free @gol 10059} 10060 10061@item -fno-analyzer-feasibility 10062@opindex fanalyzer-feasibility 10063@opindex fno-analyzer-feasibility 10064This option is intended for analyzer developers. 10065 10066By default the analyzer verifies that there is a feasible control flow path 10067for each diagnostic it emits: that the conditions that hold are not mutually 10068exclusive. Diagnostics for which no feasible path can be found are rejected. 10069This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for 10070debugging issues in this code. 10071 10072@item -fanalyzer-fine-grained 10073@opindex fanalyzer-fine-grained 10074@opindex fno-analyzer-fine-grained 10075This option is intended for analyzer developers. 10076 10077Internally the analyzer builds an ``exploded graph'' that combines 10078control flow graphs with data flow information. 10079 10080By default, an edge in this graph can contain the effects of a run 10081of multiple statements within a basic block. With 10082@option{-fanalyzer-fine-grained}, each statement gets its own edge. 10083 10084@item -fanalyzer-show-duplicate-count 10085@opindex fanalyzer-show-duplicate-count 10086@opindex fno-analyzer-show-duplicate-count 10087This option is intended for analyzer developers: if multiple diagnostics 10088have been detected as being duplicates of each other, it emits a note when 10089reporting the best diagnostic, giving the number of additional diagnostics 10090that were suppressed by the deduplication logic. 10091 10092@item -fno-analyzer-state-merge 10093@opindex fanalyzer-state-merge 10094@opindex fno-analyzer-state-merge 10095This option is intended for analyzer developers. 10096 10097By default the analyzer attempts to simplify analysis by merging 10098sufficiently similar states at each program point as it builds its 10099``exploded graph''. With @option{-fno-analyzer-state-merge} this 10100merging can be suppressed, for debugging state-handling issues. 10101 10102@item -fno-analyzer-state-purge 10103@opindex fanalyzer-state-purge 10104@opindex fno-analyzer-state-purge 10105This option is intended for analyzer developers. 10106 10107By default the analyzer attempts to simplify analysis by purging 10108aspects of state at a program point that appear to no longer be relevant 10109e.g. the values of locals that aren't accessed later in the function 10110and which aren't relevant to leak analysis. 10111 10112With @option{-fno-analyzer-state-purge} this purging of state can 10113be suppressed, for debugging state-handling issues. 10114 10115@item -fanalyzer-transitivity 10116@opindex fanalyzer-transitivity 10117@opindex fno-analyzer-transitivity 10118This option enables transitivity of constraints within the analyzer. 10119 10120@item -fanalyzer-verbose-edges 10121This option is intended for analyzer developers. It enables more 10122verbose, lower-level detail in the descriptions of control flow 10123within diagnostic paths. 10124 10125@item -fanalyzer-verbose-state-changes 10126This option is intended for analyzer developers. It enables more 10127verbose, lower-level detail in the descriptions of events relating 10128to state machines within diagnostic paths. 10129 10130@item -fanalyzer-verbosity=@var{level} 10131This option controls the complexity of the control flow paths that are 10132emitted for analyzer diagnostics. 10133 10134The @var{level} can be one of: 10135 10136@table @samp 10137@item 0 10138At this level, interprocedural call and return events are displayed, 10139along with the most pertinent state-change events relating to 10140a diagnostic. For example, for a double-@code{free} diagnostic, 10141both calls to @code{free} will be shown. 10142 10143@item 1 10144As per the previous level, but also show events for the entry 10145to each function. 10146 10147@item 2 10148As per the previous level, but also show events relating to 10149control flow that are significant to triggering the issue 10150(e.g. ``true path taken'' at a conditional). 10151 10152This level is the default. 10153 10154@item 3 10155As per the previous level, but show all control flow events, not 10156just significant ones. 10157 10158@item 4 10159This level is intended for analyzer developers; it adds various 10160other events intended for debugging the analyzer. 10161 10162@end table 10163 10164@item -fdump-analyzer 10165@opindex fdump-analyzer 10166Dump internal details about what the analyzer is doing to 10167@file{@var{file}.analyzer.txt}. 10168This option is overridden by @option{-fdump-analyzer-stderr}. 10169 10170@item -fdump-analyzer-stderr 10171@opindex fdump-analyzer-stderr 10172Dump internal details about what the analyzer is doing to stderr. 10173This option overrides @option{-fdump-analyzer}. 10174 10175@item -fdump-analyzer-callgraph 10176@opindex fdump-analyzer-callgraph 10177Dump a representation of the call graph suitable for viewing with 10178GraphViz to @file{@var{file}.callgraph.dot}. 10179 10180@item -fdump-analyzer-exploded-graph 10181@opindex fdump-analyzer-exploded-graph 10182Dump a representation of the ``exploded graph'' suitable for viewing with 10183GraphViz to @file{@var{file}.eg.dot}. 10184Nodes are color-coded based on state-machine states to emphasize 10185state changes. 10186 10187@item -fdump-analyzer-exploded-nodes 10188@opindex dump-analyzer-exploded-nodes 10189Emit diagnostics showing where nodes in the ``exploded graph'' are 10190in relation to the program source. 10191 10192@item -fdump-analyzer-exploded-nodes-2 10193@opindex dump-analyzer-exploded-nodes-2 10194Dump a textual representation of the ``exploded graph'' to 10195@file{@var{file}.eg.txt}. 10196 10197@item -fdump-analyzer-exploded-nodes-3 10198@opindex dump-analyzer-exploded-nodes-3 10199Dump a textual representation of the ``exploded graph'' to 10200one dump file per node, to @file{@var{file}.eg-@var{id}.txt}. 10201This is typically a large number of dump files. 10202 10203@item -fdump-analyzer-exploded-paths 10204@opindex fdump-analyzer-exploded-paths 10205Dump a textual representation of the ``exploded path'' for each 10206diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}. 10207 10208@item -fdump-analyzer-feasibility 10209@opindex dump-analyzer-feasibility 10210Dump internal details about the analyzer's search for feasible paths. 10211The details are written in a form suitable for viewing with GraphViz 10212to filenames of the form @file{@var{file}.*.fg.dot}, 10213@file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}. 10214 10215@item -fdump-analyzer-json 10216@opindex fdump-analyzer-json 10217Dump a compressed JSON representation of analyzer internals to 10218@file{@var{file}.analyzer.json.gz}. The precise format is subject 10219to change. 10220 10221@item -fdump-analyzer-state-purge 10222@opindex fdump-analyzer-state-purge 10223As per @option{-fdump-analyzer-supergraph}, dump a representation of the 10224``supergraph'' suitable for viewing with GraphViz, but annotate the 10225graph with information on what state will be purged at each node. 10226The graph is written to @file{@var{file}.state-purge.dot}. 10227 10228@item -fdump-analyzer-supergraph 10229@opindex fdump-analyzer-supergraph 10230Dump representations of the ``supergraph'' suitable for viewing with 10231GraphViz to @file{@var{file}.supergraph.dot} and to 10232@file{@var{file}.supergraph-eg.dot}. These show all of the 10233control flow graphs in the program, with interprocedural edges for 10234calls and returns. The second dump contains annotations showing nodes 10235in the ``exploded graph'' and diagnostics associated with them. 10236 10237@item -fdump-analyzer-untracked 10238@opindex fdump-analyzer-untracked 10239Emit custom warnings with internal details intended for analyzer developers. 10240 10241@end table 10242 10243@node Debugging Options 10244@section Options for Debugging Your Program 10245@cindex options, debugging 10246@cindex debugging information options 10247 10248To tell GCC to emit extra information for use by a debugger, in almost 10249all cases you need only to add @option{-g} to your other options. Some debug 10250formats can co-exist (like DWARF with CTF) when each of them is enabled 10251explicitly by adding the respective command line option to your other options. 10252 10253GCC allows you to use @option{-g} with 10254@option{-O}. The shortcuts taken by optimized code may occasionally 10255be surprising: some variables you declared may not exist 10256at all; flow of control may briefly move where you did not expect it; 10257some statements may not be executed because they compute constant 10258results or their values are already at hand; some statements may 10259execute in different places because they have been moved out of loops. 10260Nevertheless it is possible to debug optimized output. This makes 10261it reasonable to use the optimizer for programs that might have bugs. 10262 10263If you are not using some other optimization option, consider 10264using @option{-Og} (@pxref{Optimize Options}) with @option{-g}. 10265With no @option{-O} option at all, some compiler passes that collect 10266information useful for debugging do not run at all, so that 10267@option{-Og} may result in a better debugging experience. 10268 10269@table @gcctabopt 10270@item -g 10271@opindex g 10272Produce debugging information in the operating system's native format 10273(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 10274information. 10275 10276On most systems that use stabs format, @option{-g} enables use of extra 10277debugging information that only GDB can use; this extra information 10278makes debugging work better in GDB but probably makes other debuggers 10279crash or 10280refuse to read the program. If you want to control for certain whether 10281to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 10282@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 10283 10284@item -ggdb 10285@opindex ggdb 10286Produce debugging information for use by GDB@. This means to use the 10287most expressive format available (DWARF, stabs, or the native format 10288if neither of those are supported), including GDB extensions if at all 10289possible. 10290 10291@item -gdwarf 10292@itemx -gdwarf-@var{version} 10293@opindex gdwarf 10294Produce debugging information in DWARF format (if that is supported). 10295The value of @var{version} may be either 2, 3, 4 or 5; the default 10296version for most targets is 5 (with the exception of VxWorks, TPF and 10297Darwin/Mac OS X, which default to version 2, and AIX, which defaults 10298to version 4). 10299 10300Note that with DWARF Version 2, some ports require and always 10301use some non-conflicting DWARF 3 extensions in the unwind tables. 10302 10303Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 10304for maximum benefit. Version 5 requires GDB 8.0 or higher. 10305 10306GCC no longer supports DWARF Version 1, which is substantially 10307different than Version 2 and later. For historical reasons, some 10308other DWARF-related options such as 10309@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2 10310in their names, but apply to all currently-supported versions of DWARF. 10311 10312@item -gbtf 10313@opindex gbtf 10314Request BTF debug information. BTF is the default debugging format for the 10315eBPF target. On other targets, like x86, BTF debug information can be 10316generated along with DWARF debug information when both of the debug formats are 10317enabled explicitly via their respective command line options. 10318 10319@item -gctf 10320@itemx -gctf@var{level} 10321@opindex gctf 10322Request CTF debug information and use level to specify how much CTF debug 10323information should be produced. If @option{-gctf} is specified 10324without a value for level, the default level of CTF debug information is 2. 10325 10326CTF debug information can be generated along with DWARF debug information when 10327both of the debug formats are enabled explicitly via their respective command 10328line options. 10329 10330Level 0 produces no CTF debug information at all. Thus, @option{-gctf0} 10331negates @option{-gctf}. 10332 10333Level 1 produces CTF information for tracebacks only. This includes callsite 10334information, but does not include type information. 10335 10336Level 2 produces type information for entities (functions, data objects etc.) 10337at file-scope or global-scope only. 10338 10339@item -gstabs 10340@opindex gstabs 10341Produce debugging information in stabs format (if that is supported), 10342without GDB extensions. This is the format used by DBX on most BSD 10343systems. On MIPS, Alpha and System V Release 4 systems this option 10344produces stabs debugging output that is not understood by DBX@. 10345On System V Release 4 systems this option requires the GNU assembler. 10346 10347@item -gstabs+ 10348@opindex gstabs+ 10349Produce debugging information in stabs format (if that is supported), 10350using GNU extensions understood only by the GNU debugger (GDB)@. The 10351use of these extensions is likely to make other debuggers crash or 10352refuse to read the program. 10353 10354@item -gxcoff 10355@opindex gxcoff 10356Produce debugging information in XCOFF format (if that is supported). 10357This is the format used by the DBX debugger on IBM RS/6000 systems. 10358 10359@item -gxcoff+ 10360@opindex gxcoff+ 10361Produce debugging information in XCOFF format (if that is supported), 10362using GNU extensions understood only by the GNU debugger (GDB)@. The 10363use of these extensions is likely to make other debuggers crash or 10364refuse to read the program, and may cause assemblers other than the GNU 10365assembler (GAS) to fail with an error. 10366 10367@item -gvms 10368@opindex gvms 10369Produce debugging information in Alpha/VMS debug format (if that is 10370supported). This is the format used by DEBUG on Alpha/VMS systems. 10371 10372@item -g@var{level} 10373@itemx -ggdb@var{level} 10374@itemx -gstabs@var{level} 10375@itemx -gxcoff@var{level} 10376@itemx -gvms@var{level} 10377Request debugging information and also use @var{level} to specify how 10378much information. The default level is 2. 10379 10380Level 0 produces no debug information at all. Thus, @option{-g0} negates 10381@option{-g}. 10382 10383Level 1 produces minimal information, enough for making backtraces in 10384parts of the program that you don't plan to debug. This includes 10385descriptions of functions and external variables, and line number 10386tables, but no information about local variables. 10387 10388Level 3 includes extra information, such as all the macro definitions 10389present in the program. Some debuggers support macro expansion when 10390you use @option{-g3}. 10391 10392If you use multiple @option{-g} options, with or without level numbers, 10393the last such option is the one that is effective. 10394 10395@option{-gdwarf} does not accept a concatenated debug level, to avoid 10396confusion with @option{-gdwarf-@var{level}}. 10397Instead use an additional @option{-g@var{level}} option to change the 10398debug level for DWARF. 10399 10400@item -fno-eliminate-unused-debug-symbols 10401@opindex feliminate-unused-debug-symbols 10402@opindex fno-eliminate-unused-debug-symbols 10403By default, no debug information is produced for symbols that are not actually 10404used. Use this option if you want debug information for all symbols. 10405 10406@item -femit-class-debug-always 10407@opindex femit-class-debug-always 10408Instead of emitting debugging information for a C++ class in only one 10409object file, emit it in all object files using the class. This option 10410should be used only with debuggers that are unable to handle the way GCC 10411normally emits debugging information for classes because using this 10412option increases the size of debugging information by as much as a 10413factor of two. 10414 10415@item -fno-merge-debug-strings 10416@opindex fmerge-debug-strings 10417@opindex fno-merge-debug-strings 10418Direct the linker to not merge together strings in the debugging 10419information that are identical in different object files. Merging is 10420not supported by all assemblers or linkers. Merging decreases the size 10421of the debug information in the output file at the cost of increasing 10422link processing time. Merging is enabled by default. 10423 10424@item -fdebug-prefix-map=@var{old}=@var{new} 10425@opindex fdebug-prefix-map 10426When compiling files residing in directory @file{@var{old}}, record 10427debugging information describing them as if the files resided in 10428directory @file{@var{new}} instead. This can be used to replace a 10429build-time path with an install-time path in the debug info. It can 10430also be used to change an absolute path to a relative path by using 10431@file{.} for @var{new}. This can give more reproducible builds, which 10432are location independent, but may require an extra command to tell GDB 10433where to find the source files. See also @option{-ffile-prefix-map}. 10434 10435@item -fvar-tracking 10436@opindex fvar-tracking 10437Run variable tracking pass. It computes where variables are stored at each 10438position in code. Better debugging information is then generated 10439(if the debugging information format supports this information). 10440 10441It is enabled by default when compiling with optimization (@option{-Os}, 10442@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 10443the debug info format supports it. 10444 10445@item -fvar-tracking-assignments 10446@opindex fvar-tracking-assignments 10447@opindex fno-var-tracking-assignments 10448Annotate assignments to user variables early in the compilation and 10449attempt to carry the annotations over throughout the compilation all the 10450way to the end, in an attempt to improve debug information while 10451optimizing. Use of @option{-gdwarf-4} is recommended along with it. 10452 10453It can be enabled even if var-tracking is disabled, in which case 10454annotations are created and maintained, but discarded at the end. 10455By default, this flag is enabled together with @option{-fvar-tracking}, 10456except when selective scheduling is enabled. 10457 10458@item -gsplit-dwarf 10459@opindex gsplit-dwarf 10460If DWARF debugging information is enabled, separate as much debugging 10461information as possible into a separate output file with the extension 10462@file{.dwo}. This option allows the build system to avoid linking files with 10463debug information. To be useful, this option requires a debugger capable of 10464reading @file{.dwo} files. 10465 10466@item -gdwarf32 10467@itemx -gdwarf64 10468@opindex gdwarf32 10469@opindex gdwarf64 10470If DWARF debugging information is enabled, the @option{-gdwarf32} selects 10471the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit 10472DWARF format. The default is target specific, on most targets it is 10473@option{-gdwarf32} though. The 32-bit DWARF format is smaller, but 10474can't support more than 2GiB of debug information in any of the DWARF 10475debug information sections. The 64-bit DWARF format allows larger debug 10476information and might not be well supported by all consumers yet. 10477 10478@item -gdescribe-dies 10479@opindex gdescribe-dies 10480Add description attributes to some DWARF DIEs that have no name attribute, 10481such as artificial variables, external references and call site 10482parameter DIEs. 10483 10484@item -gpubnames 10485@opindex gpubnames 10486Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections. 10487 10488@item -ggnu-pubnames 10489@opindex ggnu-pubnames 10490Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format 10491suitable for conversion into a GDB@ index. This option is only useful 10492with a linker that can produce GDB@ index version 7. 10493 10494@item -fdebug-types-section 10495@opindex fdebug-types-section 10496@opindex fno-debug-types-section 10497When using DWARF Version 4 or higher, type DIEs can be put into 10498their own @code{.debug_types} section instead of making them part of the 10499@code{.debug_info} section. It is more efficient to put them in a separate 10500comdat section since the linker can then remove duplicates. 10501But not all DWARF consumers support @code{.debug_types} sections yet 10502and on some objects @code{.debug_types} produces larger instead of smaller 10503debugging information. 10504 10505@item -grecord-gcc-switches 10506@itemx -gno-record-gcc-switches 10507@opindex grecord-gcc-switches 10508@opindex gno-record-gcc-switches 10509This switch causes the command-line options used to invoke the 10510compiler that may affect code generation to be appended to the 10511DW_AT_producer attribute in DWARF debugging information. The options 10512are concatenated with spaces separating them from each other and from 10513the compiler version. 10514It is enabled by default. 10515See also @option{-frecord-gcc-switches} for another 10516way of storing compiler options into the object file. 10517 10518@item -gstrict-dwarf 10519@opindex gstrict-dwarf 10520Disallow using extensions of later DWARF standard version than selected 10521with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 10522DWARF extensions from later standard versions is allowed. 10523 10524@item -gno-strict-dwarf 10525@opindex gno-strict-dwarf 10526Allow using extensions of later DWARF standard version than selected with 10527@option{-gdwarf-@var{version}}. 10528 10529@item -gas-loc-support 10530@opindex gas-loc-support 10531Inform the compiler that the assembler supports @code{.loc} directives. 10532It may then use them for the assembler to generate DWARF2+ line number 10533tables. 10534 10535This is generally desirable, because assembler-generated line-number 10536tables are a lot more compact than those the compiler can generate 10537itself. 10538 10539This option will be enabled by default if, at GCC configure time, the 10540assembler was found to support such directives. 10541 10542@item -gno-as-loc-support 10543@opindex gno-as-loc-support 10544Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ 10545line number tables are to be generated. 10546 10547@item -gas-locview-support 10548@opindex gas-locview-support 10549Inform the compiler that the assembler supports @code{view} assignment 10550and reset assertion checking in @code{.loc} directives. 10551 10552This option will be enabled by default if, at GCC configure time, the 10553assembler was found to support them. 10554 10555@item -gno-as-locview-support 10556Force GCC to assign view numbers internally, if 10557@option{-gvariable-location-views} are explicitly requested. 10558 10559@item -gcolumn-info 10560@itemx -gno-column-info 10561@opindex gcolumn-info 10562@opindex gno-column-info 10563Emit location column information into DWARF debugging information, rather 10564than just file and line. 10565This option is enabled by default. 10566 10567@item -gstatement-frontiers 10568@itemx -gno-statement-frontiers 10569@opindex gstatement-frontiers 10570@opindex gno-statement-frontiers 10571This option causes GCC to create markers in the internal representation 10572at the beginning of statements, and to keep them roughly in place 10573throughout compilation, using them to guide the output of @code{is_stmt} 10574markers in the line number table. This is enabled by default when 10575compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2}, 10576@dots{}), and outputting DWARF 2 debug information at the normal level. 10577 10578@item -gvariable-location-views 10579@itemx -gvariable-location-views=incompat5 10580@itemx -gno-variable-location-views 10581@opindex gvariable-location-views 10582@opindex gvariable-location-views=incompat5 10583@opindex gno-variable-location-views 10584Augment variable location lists with progressive view numbers implied 10585from the line number table. This enables debug information consumers to 10586inspect state at certain points of the program, even if no instructions 10587associated with the corresponding source locations are present at that 10588point. If the assembler lacks support for view numbers in line number 10589tables, this will cause the compiler to emit the line number table, 10590which generally makes them somewhat less compact. The augmented line 10591number tables and location lists are fully backward-compatible, so they 10592can be consumed by debug information consumers that are not aware of 10593these augmentations, but they won't derive any benefit from them either. 10594 10595This is enabled by default when outputting DWARF 2 debug information at 10596the normal level, as long as there is assembler support, 10597@option{-fvar-tracking-assignments} is enabled and 10598@option{-gstrict-dwarf} is not. When assembler support is not 10599available, this may still be enabled, but it will force GCC to output 10600internal line number tables, and if 10601@option{-ginternal-reset-location-views} is not enabled, that will most 10602certainly lead to silently mismatching location views. 10603 10604There is a proposed representation for view numbers that is not backward 10605compatible with the location list format introduced in DWARF 5, that can 10606be enabled with @option{-gvariable-location-views=incompat5}. This 10607option may be removed in the future, is only provided as a reference 10608implementation of the proposed representation. Debug information 10609consumers are not expected to support this extended format, and they 10610would be rendered unable to decode location lists using it. 10611 10612@item -ginternal-reset-location-views 10613@itemx -gno-internal-reset-location-views 10614@opindex ginternal-reset-location-views 10615@opindex gno-internal-reset-location-views 10616Attempt to determine location views that can be omitted from location 10617view lists. This requires the compiler to have very accurate insn 10618length estimates, which isn't always the case, and it may cause 10619incorrect view lists to be generated silently when using an assembler 10620that does not support location view lists. The GNU assembler will flag 10621any such error as a @code{view number mismatch}. This is only enabled 10622on ports that define a reliable estimation function. 10623 10624@item -ginline-points 10625@itemx -gno-inline-points 10626@opindex ginline-points 10627@opindex gno-inline-points 10628Generate extended debug information for inlined functions. Location 10629view tracking markers are inserted at inlined entry points, so that 10630address and view numbers can be computed and output in debug 10631information. This can be enabled independently of location views, in 10632which case the view numbers won't be output, but it can only be enabled 10633along with statement frontiers, and it is only enabled by default if 10634location views are enabled. 10635 10636@item -gz@r{[}=@var{type}@r{]} 10637@opindex gz 10638Produce compressed debug sections in DWARF format, if that is supported. 10639If @var{type} is not given, the default type depends on the capabilities 10640of the assembler and linker used. @var{type} may be one of 10641@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 10642compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 10643compression in traditional GNU format). If the linker doesn't support 10644writing compressed debug sections, the option is rejected. Otherwise, 10645if the assembler does not support them, @option{-gz} is silently ignored 10646when producing object files. 10647 10648@item -femit-struct-debug-baseonly 10649@opindex femit-struct-debug-baseonly 10650Emit debug information for struct-like types 10651only when the base name of the compilation source file 10652matches the base name of file in which the struct is defined. 10653 10654This option substantially reduces the size of debugging information, 10655but at significant potential loss in type information to the debugger. 10656See @option{-femit-struct-debug-reduced} for a less aggressive option. 10657See @option{-femit-struct-debug-detailed} for more detailed control. 10658 10659This option works only with DWARF debug output. 10660 10661@item -femit-struct-debug-reduced 10662@opindex femit-struct-debug-reduced 10663Emit debug information for struct-like types 10664only when the base name of the compilation source file 10665matches the base name of file in which the type is defined, 10666unless the struct is a template or defined in a system header. 10667 10668This option significantly reduces the size of debugging information, 10669with some potential loss in type information to the debugger. 10670See @option{-femit-struct-debug-baseonly} for a more aggressive option. 10671See @option{-femit-struct-debug-detailed} for more detailed control. 10672 10673This option works only with DWARF debug output. 10674 10675@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 10676@opindex femit-struct-debug-detailed 10677Specify the struct-like types 10678for which the compiler generates debug information. 10679The intent is to reduce duplicate struct debug information 10680between different object files within the same program. 10681 10682This option is a detailed version of 10683@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 10684which serves for most needs. 10685 10686A specification has the syntax@* 10687[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 10688 10689The optional first word limits the specification to 10690structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 10691A struct type is used directly when it is the type of a variable, member. 10692Indirect uses arise through pointers to structs. 10693That is, when use of an incomplete struct is valid, the use is indirect. 10694An example is 10695@samp{struct one direct; struct two * indirect;}. 10696 10697The optional second word limits the specification to 10698ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 10699Generic structs are a bit complicated to explain. 10700For C++, these are non-explicit specializations of template classes, 10701or non-template classes within the above. 10702Other programming languages have generics, 10703but @option{-femit-struct-debug-detailed} does not yet implement them. 10704 10705The third word specifies the source files for those 10706structs for which the compiler should emit debug information. 10707The values @samp{none} and @samp{any} have the normal meaning. 10708The value @samp{base} means that 10709the base of name of the file in which the type declaration appears 10710must match the base of the name of the main compilation file. 10711In practice, this means that when compiling @file{foo.c}, debug information 10712is generated for types declared in that file and @file{foo.h}, 10713but not other header files. 10714The value @samp{sys} means those types satisfying @samp{base} 10715or declared in system or compiler headers. 10716 10717You may need to experiment to determine the best settings for your application. 10718 10719The default is @option{-femit-struct-debug-detailed=all}. 10720 10721This option works only with DWARF debug output. 10722 10723@item -fno-dwarf2-cfi-asm 10724@opindex fdwarf2-cfi-asm 10725@opindex fno-dwarf2-cfi-asm 10726Emit DWARF unwind info as compiler generated @code{.eh_frame} section 10727instead of using GAS @code{.cfi_*} directives. 10728 10729@item -fno-eliminate-unused-debug-types 10730@opindex feliminate-unused-debug-types 10731@opindex fno-eliminate-unused-debug-types 10732Normally, when producing DWARF output, GCC avoids producing debug symbol 10733output for types that are nowhere used in the source file being compiled. 10734Sometimes it is useful to have GCC emit debugging 10735information for all types declared in a compilation 10736unit, regardless of whether or not they are actually used 10737in that compilation unit, for example 10738if, in the debugger, you want to cast a value to a type that is 10739not actually used in your program (but is declared). More often, 10740however, this results in a significant amount of wasted space. 10741@end table 10742 10743@node Optimize Options 10744@section Options That Control Optimization 10745@cindex optimize options 10746@cindex options, optimization 10747 10748These options control various sorts of optimizations. 10749 10750Without any optimization option, the compiler's goal is to reduce the 10751cost of compilation and to make debugging produce the expected 10752results. Statements are independent: if you stop the program with a 10753breakpoint between statements, you can then assign a new value to any 10754variable or change the program counter to any other statement in the 10755function and get exactly the results you expect from the source 10756code. 10757 10758Turning on optimization flags makes the compiler attempt to improve 10759the performance and/or code size at the expense of compilation time 10760and possibly the ability to debug the program. 10761 10762The compiler performs optimization based on the knowledge it has of the 10763program. Compiling multiple files at once to a single output file mode allows 10764the compiler to use information gained from all of the files when compiling 10765each of them. 10766 10767Not all optimizations are controlled directly by a flag. Only 10768optimizations that have a flag are listed in this section. 10769 10770Most optimizations are completely disabled at @option{-O0} or if an 10771@option{-O} level is not set on the command line, even if individual 10772optimization flags are specified. Similarly, @option{-Og} suppresses 10773many optimization passes. 10774 10775Depending on the target and how GCC was configured, a slightly different 10776set of optimizations may be enabled at each @option{-O} level than 10777those listed here. You can invoke GCC with @option{-Q --help=optimizers} 10778to find out the exact set of optimizations that are enabled at each level. 10779@xref{Overall Options}, for examples. 10780 10781@table @gcctabopt 10782@item -O 10783@itemx -O1 10784@opindex O 10785@opindex O1 10786Optimize. Optimizing compilation takes somewhat more time, and a lot 10787more memory for a large function. 10788 10789With @option{-O}, the compiler tries to reduce code size and execution 10790time, without performing any optimizations that take a great deal of 10791compilation time. 10792 10793@c Note that in addition to the default_options_table list in opts.cc, 10794@c several optimization flags default to true but control optimization 10795@c passes that are explicitly disabled at -O0. 10796 10797@option{-O} turns on the following optimization flags: 10798 10799@c Please keep the following list alphabetized. 10800@gccoptlist{-fauto-inc-dec @gol 10801-fbranch-count-reg @gol 10802-fcombine-stack-adjustments @gol 10803-fcompare-elim @gol 10804-fcprop-registers @gol 10805-fdce @gol 10806-fdefer-pop @gol 10807-fdelayed-branch @gol 10808-fdse @gol 10809-fforward-propagate @gol 10810-fguess-branch-probability @gol 10811-fif-conversion @gol 10812-fif-conversion2 @gol 10813-finline-functions-called-once @gol 10814-fipa-modref @gol 10815-fipa-profile @gol 10816-fipa-pure-const @gol 10817-fipa-reference @gol 10818-fipa-reference-addressable @gol 10819-fmerge-constants @gol 10820-fmove-loop-invariants @gol 10821-fmove-loop-stores@gol 10822-fomit-frame-pointer @gol 10823-freorder-blocks @gol 10824-fshrink-wrap @gol 10825-fshrink-wrap-separate @gol 10826-fsplit-wide-types @gol 10827-fssa-backprop @gol 10828-fssa-phiopt @gol 10829-ftree-bit-ccp @gol 10830-ftree-ccp @gol 10831-ftree-ch @gol 10832-ftree-coalesce-vars @gol 10833-ftree-copy-prop @gol 10834-ftree-dce @gol 10835-ftree-dominator-opts @gol 10836-ftree-dse @gol 10837-ftree-forwprop @gol 10838-ftree-fre @gol 10839-ftree-phiprop @gol 10840-ftree-pta @gol 10841-ftree-scev-cprop @gol 10842-ftree-sink @gol 10843-ftree-slsr @gol 10844-ftree-sra @gol 10845-ftree-ter @gol 10846-funit-at-a-time} 10847 10848@item -O2 10849@opindex O2 10850Optimize even more. GCC performs nearly all supported optimizations 10851that do not involve a space-speed tradeoff. 10852As compared to @option{-O}, this option increases both compilation time 10853and the performance of the generated code. 10854 10855@option{-O2} turns on all optimization flags specified by @option{-O1}. It 10856also turns on the following optimization flags: 10857 10858@c Please keep the following list alphabetized! 10859@gccoptlist{-falign-functions -falign-jumps @gol 10860-falign-labels -falign-loops @gol 10861-fcaller-saves @gol 10862-fcode-hoisting @gol 10863-fcrossjumping @gol 10864-fcse-follow-jumps -fcse-skip-blocks @gol 10865-fdelete-null-pointer-checks @gol 10866-fdevirtualize -fdevirtualize-speculatively @gol 10867-fexpensive-optimizations @gol 10868-ffinite-loops @gol 10869-fgcse -fgcse-lm @gol 10870-fhoist-adjacent-loads @gol 10871-finline-functions @gol 10872-finline-small-functions @gol 10873-findirect-inlining @gol 10874-fipa-bit-cp -fipa-cp -fipa-icf @gol 10875-fipa-ra -fipa-sra -fipa-vrp @gol 10876-fisolate-erroneous-paths-dereference @gol 10877-flra-remat @gol 10878-foptimize-sibling-calls @gol 10879-foptimize-strlen @gol 10880-fpartial-inlining @gol 10881-fpeephole2 @gol 10882-freorder-blocks-algorithm=stc @gol 10883-freorder-blocks-and-partition -freorder-functions @gol 10884-frerun-cse-after-loop @gol 10885-fschedule-insns -fschedule-insns2 @gol 10886-fsched-interblock -fsched-spec @gol 10887-fstore-merging @gol 10888-fstrict-aliasing @gol 10889-fthread-jumps @gol 10890-ftree-builtin-call-dce @gol 10891-ftree-loop-vectorize @gol 10892-ftree-pre @gol 10893-ftree-slp-vectorize @gol 10894-ftree-switch-conversion -ftree-tail-merge @gol 10895-ftree-vrp @gol 10896-fvect-cost-model=very-cheap} 10897 10898Please note the warning under @option{-fgcse} about 10899invoking @option{-O2} on programs that use computed gotos. 10900 10901@item -O3 10902@opindex O3 10903Optimize yet more. @option{-O3} turns on all optimizations specified 10904by @option{-O2} and also turns on the following optimization flags: 10905 10906@c Please keep the following list alphabetized! 10907@gccoptlist{-fgcse-after-reload @gol 10908-fipa-cp-clone 10909-floop-interchange @gol 10910-floop-unroll-and-jam @gol 10911-fpeel-loops @gol 10912-fpredictive-commoning @gol 10913-fsplit-loops @gol 10914-fsplit-paths @gol 10915-ftree-loop-distribution @gol 10916-ftree-partial-pre @gol 10917-funswitch-loops @gol 10918-fvect-cost-model=dynamic @gol 10919-fversion-loops-for-strides} 10920 10921@item -O0 10922@opindex O0 10923Reduce compilation time and make debugging produce the expected 10924results. This is the default. 10925 10926@item -Os 10927@opindex Os 10928Optimize for size. @option{-Os} enables all @option{-O2} optimizations 10929except those that often increase code size: 10930 10931@gccoptlist{-falign-functions -falign-jumps @gol 10932-falign-labels -falign-loops @gol 10933-fprefetch-loop-arrays -freorder-blocks-algorithm=stc} 10934 10935It also enables @option{-finline-functions}, causes the compiler to tune for 10936code size rather than execution speed, and performs further optimizations 10937designed to reduce code size. 10938 10939@item -Ofast 10940@opindex Ofast 10941Disregard strict standards compliance. @option{-Ofast} enables all 10942@option{-O3} optimizations. It also enables optimizations that are not 10943valid for all standard-compliant programs. 10944It turns on @option{-ffast-math}, @option{-fallow-store-data-races} 10945and the Fortran-specific @option{-fstack-arrays}, unless 10946@option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}. 10947It turns off @option{-fsemantic-interposition}. 10948 10949@item -Og 10950@opindex Og 10951Optimize debugging experience. @option{-Og} should be the optimization 10952level of choice for the standard edit-compile-debug cycle, offering 10953a reasonable level of optimization while maintaining fast compilation 10954and a good debugging experience. It is a better choice than @option{-O0} 10955for producing debuggable code because some compiler passes 10956that collect debug information are disabled at @option{-O0}. 10957 10958Like @option{-O0}, @option{-Og} completely disables a number of 10959optimization passes so that individual options controlling them have 10960no effect. Otherwise @option{-Og} enables all @option{-O1} 10961optimization flags except for those that may interfere with debugging: 10962 10963@gccoptlist{-fbranch-count-reg -fdelayed-branch @gol 10964-fdse -fif-conversion -fif-conversion2 @gol 10965-finline-functions-called-once @gol 10966-fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol 10967-ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra} 10968 10969@item -Oz 10970@opindex Oz 10971Optimize aggressively for size rather than speed. This may increase 10972the number of instructions executed if those instructions require 10973fewer bytes to encode. @option{-Oz} behaves similarly to @option{-Os} 10974including enabling most @option{-O2} optimizations. 10975 10976@end table 10977 10978If you use multiple @option{-O} options, with or without level numbers, 10979the last such option is the one that is effective. 10980 10981Options of the form @option{-f@var{flag}} specify machine-independent 10982flags. Most flags have both positive and negative forms; the negative 10983form of @option{-ffoo} is @option{-fno-foo}. In the table 10984below, only one of the forms is listed---the one you typically 10985use. You can figure out the other form by either removing @samp{no-} 10986or adding it. 10987 10988The following options control specific optimizations. They are either 10989activated by @option{-O} options or are related to ones that are. You 10990can use the following flags in the rare cases when ``fine-tuning'' of 10991optimizations to be performed is desired. 10992 10993@table @gcctabopt 10994@item -fno-defer-pop 10995@opindex fno-defer-pop 10996@opindex fdefer-pop 10997For machines that must pop arguments after a function call, always pop 10998the arguments as soon as each function returns. 10999At levels @option{-O1} and higher, @option{-fdefer-pop} is the default; 11000this allows the compiler to let arguments accumulate on the stack for several 11001function calls and pop them all at once. 11002 11003@item -fforward-propagate 11004@opindex fforward-propagate 11005Perform a forward propagation pass on RTL@. The pass tries to combine two 11006instructions and checks if the result can be simplified. If loop unrolling 11007is active, two passes are performed and the second is scheduled after 11008loop unrolling. 11009 11010This option is enabled by default at optimization levels @option{-O1}, 11011@option{-O2}, @option{-O3}, @option{-Os}. 11012 11013@item -ffp-contract=@var{style} 11014@opindex ffp-contract 11015@option{-ffp-contract=off} disables floating-point expression contraction. 11016@option{-ffp-contract=fast} enables floating-point expression contraction 11017such as forming of fused multiply-add operations if the target has 11018native support for them. 11019@option{-ffp-contract=on} enables floating-point expression contraction 11020if allowed by the language standard. This is currently not implemented 11021and treated equal to @option{-ffp-contract=off}. 11022 11023The default is @option{-ffp-contract=fast}. 11024 11025@item -fomit-frame-pointer 11026@opindex fomit-frame-pointer 11027Omit the frame pointer in functions that don't need one. This avoids the 11028instructions to save, set up and restore the frame pointer; on many targets 11029it also makes an extra register available. 11030 11031On some targets this flag has no effect because the standard calling sequence 11032always uses a frame pointer, so it cannot be omitted. 11033 11034Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer 11035is used in all functions. Several targets always omit the frame pointer in 11036leaf functions. 11037 11038Enabled by default at @option{-O1} and higher. 11039 11040@item -foptimize-sibling-calls 11041@opindex foptimize-sibling-calls 11042Optimize sibling and tail recursive calls. 11043 11044Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11045 11046@item -foptimize-strlen 11047@opindex foptimize-strlen 11048Optimize various standard C string functions (e.g.@: @code{strlen}, 11049@code{strchr} or @code{strcpy}) and 11050their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 11051 11052Enabled at levels @option{-O2}, @option{-O3}. 11053 11054@item -fno-inline 11055@opindex fno-inline 11056@opindex finline 11057Do not expand any functions inline apart from those marked with 11058the @code{always_inline} attribute. This is the default when not 11059optimizing. 11060 11061Single functions can be exempted from inlining by marking them 11062with the @code{noinline} attribute. 11063 11064@item -finline-small-functions 11065@opindex finline-small-functions 11066Integrate functions into their callers when their body is smaller than expected 11067function call code (so overall size of program gets smaller). The compiler 11068heuristically decides which functions are simple enough to be worth integrating 11069in this way. This inlining applies to all functions, even those not declared 11070inline. 11071 11072Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11073 11074@item -findirect-inlining 11075@opindex findirect-inlining 11076Inline also indirect calls that are discovered to be known at compile 11077time thanks to previous inlining. This option has any effect only 11078when inlining itself is turned on by the @option{-finline-functions} 11079or @option{-finline-small-functions} options. 11080 11081Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11082 11083@item -finline-functions 11084@opindex finline-functions 11085Consider all functions for inlining, even if they are not declared inline. 11086The compiler heuristically decides which functions are worth integrating 11087in this way. 11088 11089If all calls to a given function are integrated, and the function is 11090declared @code{static}, then the function is normally not output as 11091assembler code in its own right. 11092 11093Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled 11094by @option{-fprofile-use} and @option{-fauto-profile}. 11095 11096@item -finline-functions-called-once 11097@opindex finline-functions-called-once 11098Consider all @code{static} functions called once for inlining into their 11099caller even if they are not marked @code{inline}. If a call to a given 11100function is integrated, then the function is not output as assembler code 11101in its own right. 11102 11103Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}, 11104but not @option{-Og}. 11105 11106@item -fearly-inlining 11107@opindex fearly-inlining 11108Inline functions marked by @code{always_inline} and functions whose body seems 11109smaller than the function call overhead early before doing 11110@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 11111makes profiling significantly cheaper and usually inlining faster on programs 11112having large chains of nested wrapper functions. 11113 11114Enabled by default. 11115 11116@item -fipa-sra 11117@opindex fipa-sra 11118Perform interprocedural scalar replacement of aggregates, removal of 11119unused parameters and replacement of parameters passed by reference 11120by parameters passed by value. 11121 11122Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 11123 11124@item -finline-limit=@var{n} 11125@opindex finline-limit 11126By default, GCC limits the size of functions that can be inlined. This flag 11127allows coarse control of this limit. @var{n} is the size of functions that 11128can be inlined in number of pseudo instructions. 11129 11130Inlining is actually controlled by a number of parameters, which may be 11131specified individually by using @option{--param @var{name}=@var{value}}. 11132The @option{-finline-limit=@var{n}} option sets some of these parameters 11133as follows: 11134 11135@table @gcctabopt 11136@item max-inline-insns-single 11137is set to @var{n}/2. 11138@item max-inline-insns-auto 11139is set to @var{n}/2. 11140@end table 11141 11142See below for a documentation of the individual 11143parameters controlling inlining and for the defaults of these parameters. 11144 11145@emph{Note:} there may be no value to @option{-finline-limit} that results 11146in default behavior. 11147 11148@emph{Note:} pseudo instruction represents, in this particular context, an 11149abstract measurement of function's size. In no way does it represent a count 11150of assembly instructions and as such its exact meaning might change from one 11151release to an another. 11152 11153@item -fno-keep-inline-dllexport 11154@opindex fno-keep-inline-dllexport 11155@opindex fkeep-inline-dllexport 11156This is a more fine-grained version of @option{-fkeep-inline-functions}, 11157which applies only to functions that are declared using the @code{dllexport} 11158attribute or declspec. @xref{Function Attributes,,Declaring Attributes of 11159Functions}. 11160 11161@item -fkeep-inline-functions 11162@opindex fkeep-inline-functions 11163In C, emit @code{static} functions that are declared @code{inline} 11164into the object file, even if the function has been inlined into all 11165of its callers. This switch does not affect functions using the 11166@code{extern inline} extension in GNU C90@. In C++, emit any and all 11167inline functions into the object file. 11168 11169@item -fkeep-static-functions 11170@opindex fkeep-static-functions 11171Emit @code{static} functions into the object file, even if the function 11172is never used. 11173 11174@item -fkeep-static-consts 11175@opindex fkeep-static-consts 11176Emit variables declared @code{static const} when optimization isn't turned 11177on, even if the variables aren't referenced. 11178 11179GCC enables this option by default. If you want to force the compiler to 11180check if a variable is referenced, regardless of whether or not 11181optimization is turned on, use the @option{-fno-keep-static-consts} option. 11182 11183@item -fmerge-constants 11184@opindex fmerge-constants 11185Attempt to merge identical constants (string constants and floating-point 11186constants) across compilation units. 11187 11188This option is the default for optimized compilation if the assembler and 11189linker support it. Use @option{-fno-merge-constants} to inhibit this 11190behavior. 11191 11192Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}. 11193 11194@item -fmerge-all-constants 11195@opindex fmerge-all-constants 11196Attempt to merge identical constants and identical variables. 11197 11198This option implies @option{-fmerge-constants}. In addition to 11199@option{-fmerge-constants} this considers e.g.@: even constant initialized 11200arrays or initialized constant variables with integral or floating-point 11201types. Languages like C or C++ require each variable, including multiple 11202instances of the same variable in recursive calls, to have distinct locations, 11203so using this option results in non-conforming 11204behavior. 11205 11206@item -fmodulo-sched 11207@opindex fmodulo-sched 11208Perform swing modulo scheduling immediately before the first scheduling 11209pass. This pass looks at innermost loops and reorders their 11210instructions by overlapping different iterations. 11211 11212@item -fmodulo-sched-allow-regmoves 11213@opindex fmodulo-sched-allow-regmoves 11214Perform more aggressive SMS-based modulo scheduling with register moves 11215allowed. By setting this flag certain anti-dependences edges are 11216deleted, which triggers the generation of reg-moves based on the 11217life-range analysis. This option is effective only with 11218@option{-fmodulo-sched} enabled. 11219 11220@item -fno-branch-count-reg 11221@opindex fno-branch-count-reg 11222@opindex fbranch-count-reg 11223Disable the optimization pass that scans for opportunities to use 11224``decrement and branch'' instructions on a count register instead of 11225instruction sequences that decrement a register, compare it against zero, and 11226then branch based upon the result. This option is only meaningful on 11227architectures that support such instructions, which include x86, PowerPC, 11228IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option 11229doesn't remove the decrement and branch instructions from the generated 11230instruction stream introduced by other optimization passes. 11231 11232The default is @option{-fbranch-count-reg} at @option{-O1} and higher, 11233except for @option{-Og}. 11234 11235@item -fno-function-cse 11236@opindex fno-function-cse 11237@opindex ffunction-cse 11238Do not put function addresses in registers; make each instruction that 11239calls a constant function contain the function's address explicitly. 11240 11241This option results in less efficient code, but some strange hacks 11242that alter the assembler output may be confused by the optimizations 11243performed when this option is not used. 11244 11245The default is @option{-ffunction-cse} 11246 11247@item -fno-zero-initialized-in-bss 11248@opindex fno-zero-initialized-in-bss 11249@opindex fzero-initialized-in-bss 11250If the target supports a BSS section, GCC by default puts variables that 11251are initialized to zero into BSS@. This can save space in the resulting 11252code. 11253 11254This option turns off this behavior because some programs explicitly 11255rely on variables going to the data section---e.g., so that the 11256resulting executable can find the beginning of that section and/or make 11257assumptions based on that. 11258 11259The default is @option{-fzero-initialized-in-bss}. 11260 11261@item -fthread-jumps 11262@opindex fthread-jumps 11263Perform optimizations that check to see if a jump branches to a 11264location where another comparison subsumed by the first is found. If 11265so, the first branch is redirected to either the destination of the 11266second branch or a point immediately following it, depending on whether 11267the condition is known to be true or false. 11268 11269Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}. 11270 11271@item -fsplit-wide-types 11272@opindex fsplit-wide-types 11273When using a type that occupies multiple registers, such as @code{long 11274long} on a 32-bit system, split the registers apart and allocate them 11275independently. This normally generates better code for those types, 11276but may make debugging more difficult. 11277 11278Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, 11279@option{-Os}. 11280 11281@item -fsplit-wide-types-early 11282@opindex fsplit-wide-types-early 11283Fully split wide types early, instead of very late. 11284This option has no effect unless @option{-fsplit-wide-types} is turned on. 11285 11286This is the default on some targets. 11287 11288@item -fcse-follow-jumps 11289@opindex fcse-follow-jumps 11290In common subexpression elimination (CSE), scan through jump instructions 11291when the target of the jump is not reached by any other path. For 11292example, when CSE encounters an @code{if} statement with an 11293@code{else} clause, CSE follows the jump when the condition 11294tested is false. 11295 11296Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11297 11298@item -fcse-skip-blocks 11299@opindex fcse-skip-blocks 11300This is similar to @option{-fcse-follow-jumps}, but causes CSE to 11301follow jumps that conditionally skip over blocks. When CSE 11302encounters a simple @code{if} statement with no else clause, 11303@option{-fcse-skip-blocks} causes CSE to follow the jump around the 11304body of the @code{if}. 11305 11306Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11307 11308@item -frerun-cse-after-loop 11309@opindex frerun-cse-after-loop 11310Re-run common subexpression elimination after loop optimizations are 11311performed. 11312 11313Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11314 11315@item -fgcse 11316@opindex fgcse 11317Perform a global common subexpression elimination pass. 11318This pass also performs global constant and copy propagation. 11319 11320@emph{Note:} When compiling a program using computed gotos, a GCC 11321extension, you may get better run-time performance if you disable 11322the global common subexpression elimination pass by adding 11323@option{-fno-gcse} to the command line. 11324 11325Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11326 11327@item -fgcse-lm 11328@opindex fgcse-lm 11329When @option{-fgcse-lm} is enabled, global common subexpression elimination 11330attempts to move loads that are only killed by stores into themselves. This 11331allows a loop containing a load/store sequence to be changed to a load outside 11332the loop, and a copy/store within the loop. 11333 11334Enabled by default when @option{-fgcse} is enabled. 11335 11336@item -fgcse-sm 11337@opindex fgcse-sm 11338When @option{-fgcse-sm} is enabled, a store motion pass is run after 11339global common subexpression elimination. This pass attempts to move 11340stores out of loops. When used in conjunction with @option{-fgcse-lm}, 11341loops containing a load/store sequence can be changed to a load before 11342the loop and a store after the loop. 11343 11344Not enabled at any optimization level. 11345 11346@item -fgcse-las 11347@opindex fgcse-las 11348When @option{-fgcse-las} is enabled, the global common subexpression 11349elimination pass eliminates redundant loads that come after stores to the 11350same memory location (both partial and full redundancies). 11351 11352Not enabled at any optimization level. 11353 11354@item -fgcse-after-reload 11355@opindex fgcse-after-reload 11356When @option{-fgcse-after-reload} is enabled, a redundant load elimination 11357pass is performed after reload. The purpose of this pass is to clean up 11358redundant spilling. 11359 11360Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}. 11361 11362@item -faggressive-loop-optimizations 11363@opindex faggressive-loop-optimizations 11364This option tells the loop optimizer to use language constraints to 11365derive bounds for the number of iterations of a loop. This assumes that 11366loop code does not invoke undefined behavior by for example causing signed 11367integer overflows or out-of-bound array accesses. The bounds for the 11368number of iterations of a loop are used to guide loop unrolling and peeling 11369and loop exit test optimizations. 11370This option is enabled by default. 11371 11372@item -funconstrained-commons 11373@opindex funconstrained-commons 11374This option tells the compiler that variables declared in common blocks 11375(e.g.@: Fortran) may later be overridden with longer trailing arrays. This 11376prevents certain optimizations that depend on knowing the array bounds. 11377 11378@item -fcrossjumping 11379@opindex fcrossjumping 11380Perform cross-jumping transformation. 11381This transformation unifies equivalent code and saves code size. The 11382resulting code may or may not perform better than without cross-jumping. 11383 11384Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11385 11386@item -fauto-inc-dec 11387@opindex fauto-inc-dec 11388Combine increments or decrements of addresses with memory accesses. 11389This pass is always skipped on architectures that do not have 11390instructions to support this. Enabled by default at @option{-O1} and 11391higher on architectures that support this. 11392 11393@item -fdce 11394@opindex fdce 11395Perform dead code elimination (DCE) on RTL@. 11396Enabled by default at @option{-O1} and higher. 11397 11398@item -fdse 11399@opindex fdse 11400Perform dead store elimination (DSE) on RTL@. 11401Enabled by default at @option{-O1} and higher. 11402 11403@item -fif-conversion 11404@opindex fif-conversion 11405Attempt to transform conditional jumps into branch-less equivalents. This 11406includes use of conditional moves, min, max, set flags and abs instructions, and 11407some tricks doable by standard arithmetics. The use of conditional execution 11408on chips where it is available is controlled by @option{-fif-conversion2}. 11409 11410Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but 11411not with @option{-Og}. 11412 11413@item -fif-conversion2 11414@opindex fif-conversion2 11415Use conditional execution (where available) to transform conditional jumps into 11416branch-less equivalents. 11417 11418Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but 11419not with @option{-Og}. 11420 11421@item -fdeclone-ctor-dtor 11422@opindex fdeclone-ctor-dtor 11423The C++ ABI requires multiple entry points for constructors and 11424destructors: one for a base subobject, one for a complete object, and 11425one for a virtual destructor that calls operator delete afterwards. 11426For a hierarchy with virtual bases, the base and complete variants are 11427clones, which means two copies of the function. With this option, the 11428base and complete variants are changed to be thunks that call a common 11429implementation. 11430 11431Enabled by @option{-Os}. 11432 11433@item -fdelete-null-pointer-checks 11434@opindex fdelete-null-pointer-checks 11435Assume that programs cannot safely dereference null pointers, and that 11436no code or data element resides at address zero. 11437This option enables simple constant 11438folding optimizations at all optimization levels. In addition, other 11439optimization passes in GCC use this flag to control global dataflow 11440analyses that eliminate useless checks for null pointers; these assume 11441that a memory access to address zero always results in a trap, so 11442that if a pointer is checked after it has already been dereferenced, 11443it cannot be null. 11444 11445Note however that in some environments this assumption is not true. 11446Use @option{-fno-delete-null-pointer-checks} to disable this optimization 11447for programs that depend on that behavior. 11448 11449This option is enabled by default on most targets. On Nios II ELF, it 11450defaults to off. On AVR, CR16, and MSP430, this option is completely disabled. 11451 11452Passes that use the dataflow information 11453are enabled independently at different optimization levels. 11454 11455@item -fdevirtualize 11456@opindex fdevirtualize 11457Attempt to convert calls to virtual functions to direct calls. This 11458is done both within a procedure and interprocedurally as part of 11459indirect inlining (@option{-findirect-inlining}) and interprocedural constant 11460propagation (@option{-fipa-cp}). 11461Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11462 11463@item -fdevirtualize-speculatively 11464@opindex fdevirtualize-speculatively 11465Attempt to convert calls to virtual functions to speculative direct calls. 11466Based on the analysis of the type inheritance graph, determine for a given call 11467the set of likely targets. If the set is small, preferably of size 1, change 11468the call into a conditional deciding between direct and indirect calls. The 11469speculative calls enable more optimizations, such as inlining. When they seem 11470useless after further optimization, they are converted back into original form. 11471 11472@item -fdevirtualize-at-ltrans 11473@opindex fdevirtualize-at-ltrans 11474Stream extra information needed for aggressive devirtualization when running 11475the link-time optimizer in local transformation mode. 11476This option enables more devirtualization but 11477significantly increases the size of streamed data. For this reason it is 11478disabled by default. 11479 11480@item -fexpensive-optimizations 11481@opindex fexpensive-optimizations 11482Perform a number of minor optimizations that are relatively expensive. 11483 11484Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11485 11486@item -free 11487@opindex free 11488Attempt to remove redundant extension instructions. This is especially 11489helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 11490registers after writing to their lower 32-bit half. 11491 11492Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 11493@option{-O3}, @option{-Os}. 11494 11495@item -fno-lifetime-dse 11496@opindex fno-lifetime-dse 11497@opindex flifetime-dse 11498In C++ the value of an object is only affected by changes within its 11499lifetime: when the constructor begins, the object has an indeterminate 11500value, and any changes during the lifetime of the object are dead when 11501the object is destroyed. Normally dead store elimination will take 11502advantage of this; if your code relies on the value of the object 11503storage persisting beyond the lifetime of the object, you can use this 11504flag to disable this optimization. To preserve stores before the 11505constructor starts (e.g.@: because your operator new clears the object 11506storage) but still treat the object as dead after the destructor, you 11507can use @option{-flifetime-dse=1}. The default behavior can be 11508explicitly selected with @option{-flifetime-dse=2}. 11509@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}. 11510 11511@item -flive-range-shrinkage 11512@opindex flive-range-shrinkage 11513Attempt to decrease register pressure through register live range 11514shrinkage. This is helpful for fast processors with small or moderate 11515size register sets. 11516 11517@item -fira-algorithm=@var{algorithm} 11518@opindex fira-algorithm 11519Use the specified coloring algorithm for the integrated register 11520allocator. The @var{algorithm} argument can be @samp{priority}, which 11521specifies Chow's priority coloring, or @samp{CB}, which specifies 11522Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 11523for all architectures, but for those targets that do support it, it is 11524the default because it generates better code. 11525 11526@item -fira-region=@var{region} 11527@opindex fira-region 11528Use specified regions for the integrated register allocator. The 11529@var{region} argument should be one of the following: 11530 11531@table @samp 11532 11533@item all 11534Use all loops as register allocation regions. 11535This can give the best results for machines with a small and/or 11536irregular register set. 11537 11538@item mixed 11539Use all loops except for loops with small register pressure 11540as the regions. This value usually gives 11541the best results in most cases and for most architectures, 11542and is enabled by default when compiling with optimization for speed 11543(@option{-O}, @option{-O2}, @dots{}). 11544 11545@item one 11546Use all functions as a single region. 11547This typically results in the smallest code size, and is enabled by default for 11548@option{-Os} or @option{-O0}. 11549 11550@end table 11551 11552@item -fira-hoist-pressure 11553@opindex fira-hoist-pressure 11554Use IRA to evaluate register pressure in the code hoisting pass for 11555decisions to hoist expressions. This option usually results in smaller 11556code, but it can slow the compiler down. 11557 11558This option is enabled at level @option{-Os} for all targets. 11559 11560@item -fira-loop-pressure 11561@opindex fira-loop-pressure 11562Use IRA to evaluate register pressure in loops for decisions to move 11563loop invariants. This option usually results in generation 11564of faster and smaller code on machines with large register files (>= 32 11565registers), but it can slow the compiler down. 11566 11567This option is enabled at level @option{-O3} for some targets. 11568 11569@item -fno-ira-share-save-slots 11570@opindex fno-ira-share-save-slots 11571@opindex fira-share-save-slots 11572Disable sharing of stack slots used for saving call-used hard 11573registers living through a call. Each hard register gets a 11574separate stack slot, and as a result function stack frames are 11575larger. 11576 11577@item -fno-ira-share-spill-slots 11578@opindex fno-ira-share-spill-slots 11579@opindex fira-share-spill-slots 11580Disable sharing of stack slots allocated for pseudo-registers. Each 11581pseudo-register that does not get a hard register gets a separate 11582stack slot, and as a result function stack frames are larger. 11583 11584@item -flra-remat 11585@opindex flra-remat 11586Enable CFG-sensitive rematerialization in LRA. Instead of loading 11587values of spilled pseudos, LRA tries to rematerialize (recalculate) 11588values if it is profitable. 11589 11590Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11591 11592@item -fdelayed-branch 11593@opindex fdelayed-branch 11594If supported for the target machine, attempt to reorder instructions 11595to exploit instruction slots available after delayed branch 11596instructions. 11597 11598Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, 11599but not at @option{-Og}. 11600 11601@item -fschedule-insns 11602@opindex fschedule-insns 11603If supported for the target machine, attempt to reorder instructions to 11604eliminate execution stalls due to required data being unavailable. This 11605helps machines that have slow floating point or memory load instructions 11606by allowing other instructions to be issued until the result of the load 11607or floating-point instruction is required. 11608 11609Enabled at levels @option{-O2}, @option{-O3}. 11610 11611@item -fschedule-insns2 11612@opindex fschedule-insns2 11613Similar to @option{-fschedule-insns}, but requests an additional pass of 11614instruction scheduling after register allocation has been done. This is 11615especially useful on machines with a relatively small number of 11616registers and where memory load instructions take more than one cycle. 11617 11618Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11619 11620@item -fno-sched-interblock 11621@opindex fno-sched-interblock 11622@opindex fsched-interblock 11623Disable instruction scheduling across basic blocks, which 11624is normally enabled when scheduling before register allocation, i.e.@: 11625with @option{-fschedule-insns} or at @option{-O2} or higher. 11626 11627@item -fno-sched-spec 11628@opindex fno-sched-spec 11629@opindex fsched-spec 11630Disable speculative motion of non-load instructions, which 11631is normally enabled when scheduling before register allocation, i.e.@: 11632with @option{-fschedule-insns} or at @option{-O2} or higher. 11633 11634@item -fsched-pressure 11635@opindex fsched-pressure 11636Enable register pressure sensitive insn scheduling before register 11637allocation. This only makes sense when scheduling before register 11638allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 11639@option{-O2} or higher. Usage of this option can improve the 11640generated code and decrease its size by preventing register pressure 11641increase above the number of available hard registers and subsequent 11642spills in register allocation. 11643 11644@item -fsched-spec-load 11645@opindex fsched-spec-load 11646Allow speculative motion of some load instructions. This only makes 11647sense when scheduling before register allocation, i.e.@: with 11648@option{-fschedule-insns} or at @option{-O2} or higher. 11649 11650@item -fsched-spec-load-dangerous 11651@opindex fsched-spec-load-dangerous 11652Allow speculative motion of more load instructions. This only makes 11653sense when scheduling before register allocation, i.e.@: with 11654@option{-fschedule-insns} or at @option{-O2} or higher. 11655 11656@item -fsched-stalled-insns 11657@itemx -fsched-stalled-insns=@var{n} 11658@opindex fsched-stalled-insns 11659Define how many insns (if any) can be moved prematurely from the queue 11660of stalled insns into the ready list during the second scheduling pass. 11661@option{-fno-sched-stalled-insns} means that no insns are moved 11662prematurely, @option{-fsched-stalled-insns=0} means there is no limit 11663on how many queued insns can be moved prematurely. 11664@option{-fsched-stalled-insns} without a value is equivalent to 11665@option{-fsched-stalled-insns=1}. 11666 11667@item -fsched-stalled-insns-dep 11668@itemx -fsched-stalled-insns-dep=@var{n} 11669@opindex fsched-stalled-insns-dep 11670Define how many insn groups (cycles) are examined for a dependency 11671on a stalled insn that is a candidate for premature removal from the queue 11672of stalled insns. This has an effect only during the second scheduling pass, 11673and only if @option{-fsched-stalled-insns} is used. 11674@option{-fno-sched-stalled-insns-dep} is equivalent to 11675@option{-fsched-stalled-insns-dep=0}. 11676@option{-fsched-stalled-insns-dep} without a value is equivalent to 11677@option{-fsched-stalled-insns-dep=1}. 11678 11679@item -fsched2-use-superblocks 11680@opindex fsched2-use-superblocks 11681When scheduling after register allocation, use superblock scheduling. 11682This allows motion across basic block boundaries, 11683resulting in faster schedules. This option is experimental, as not all machine 11684descriptions used by GCC model the CPU closely enough to avoid unreliable 11685results from the algorithm. 11686 11687This only makes sense when scheduling after register allocation, i.e.@: with 11688@option{-fschedule-insns2} or at @option{-O2} or higher. 11689 11690@item -fsched-group-heuristic 11691@opindex fsched-group-heuristic 11692Enable the group heuristic in the scheduler. This heuristic favors 11693the instruction that belongs to a schedule group. This is enabled 11694by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 11695or @option{-fschedule-insns2} or at @option{-O2} or higher. 11696 11697@item -fsched-critical-path-heuristic 11698@opindex fsched-critical-path-heuristic 11699Enable the critical-path heuristic in the scheduler. This heuristic favors 11700instructions on the critical path. This is enabled by default when 11701scheduling is enabled, i.e.@: with @option{-fschedule-insns} 11702or @option{-fschedule-insns2} or at @option{-O2} or higher. 11703 11704@item -fsched-spec-insn-heuristic 11705@opindex fsched-spec-insn-heuristic 11706Enable the speculative instruction heuristic in the scheduler. This 11707heuristic favors speculative instructions with greater dependency weakness. 11708This is enabled by default when scheduling is enabled, i.e.@: 11709with @option{-fschedule-insns} or @option{-fschedule-insns2} 11710or at @option{-O2} or higher. 11711 11712@item -fsched-rank-heuristic 11713@opindex fsched-rank-heuristic 11714Enable the rank heuristic in the scheduler. This heuristic favors 11715the instruction belonging to a basic block with greater size or frequency. 11716This is enabled by default when scheduling is enabled, i.e.@: 11717with @option{-fschedule-insns} or @option{-fschedule-insns2} or 11718at @option{-O2} or higher. 11719 11720@item -fsched-last-insn-heuristic 11721@opindex fsched-last-insn-heuristic 11722Enable the last-instruction heuristic in the scheduler. This heuristic 11723favors the instruction that is less dependent on the last instruction 11724scheduled. This is enabled by default when scheduling is enabled, 11725i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 11726at @option{-O2} or higher. 11727 11728@item -fsched-dep-count-heuristic 11729@opindex fsched-dep-count-heuristic 11730Enable the dependent-count heuristic in the scheduler. This heuristic 11731favors the instruction that has more instructions depending on it. 11732This is enabled by default when scheduling is enabled, i.e.@: 11733with @option{-fschedule-insns} or @option{-fschedule-insns2} or 11734at @option{-O2} or higher. 11735 11736@item -freschedule-modulo-scheduled-loops 11737@opindex freschedule-modulo-scheduled-loops 11738Modulo scheduling is performed before traditional scheduling. If a loop 11739is modulo scheduled, later scheduling passes may change its schedule. 11740Use this option to control that behavior. 11741 11742@item -fselective-scheduling 11743@opindex fselective-scheduling 11744Schedule instructions using selective scheduling algorithm. Selective 11745scheduling runs instead of the first scheduler pass. 11746 11747@item -fselective-scheduling2 11748@opindex fselective-scheduling2 11749Schedule instructions using selective scheduling algorithm. Selective 11750scheduling runs instead of the second scheduler pass. 11751 11752@item -fsel-sched-pipelining 11753@opindex fsel-sched-pipelining 11754Enable software pipelining of innermost loops during selective scheduling. 11755This option has no effect unless one of @option{-fselective-scheduling} or 11756@option{-fselective-scheduling2} is turned on. 11757 11758@item -fsel-sched-pipelining-outer-loops 11759@opindex fsel-sched-pipelining-outer-loops 11760When pipelining loops during selective scheduling, also pipeline outer loops. 11761This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 11762 11763@item -fsemantic-interposition 11764@opindex fsemantic-interposition 11765Some object formats, like ELF, allow interposing of symbols by the 11766dynamic linker. 11767This means that for symbols exported from the DSO, the compiler cannot perform 11768interprocedural propagation, inlining and other optimizations in anticipation 11769that the function or variable in question may change. While this feature is 11770useful, for example, to rewrite memory allocation functions by a debugging 11771implementation, it is expensive in the terms of code quality. 11772With @option{-fno-semantic-interposition} the compiler assumes that 11773if interposition happens for functions the overwriting function will have 11774precisely the same semantics (and side effects). 11775Similarly if interposition happens 11776for variables, the constructor of the variable will be the same. The flag 11777has no effect for functions explicitly declared inline 11778(where it is never allowed for interposition to change semantics) 11779and for symbols explicitly declared weak. 11780 11781@item -fshrink-wrap 11782@opindex fshrink-wrap 11783Emit function prologues only before parts of the function that need it, 11784rather than at the top of the function. This flag is enabled by default at 11785@option{-O} and higher. 11786 11787@item -fshrink-wrap-separate 11788@opindex fshrink-wrap-separate 11789Shrink-wrap separate parts of the prologue and epilogue separately, so that 11790those parts are only executed when needed. 11791This option is on by default, but has no effect unless @option{-fshrink-wrap} 11792is also turned on and the target supports this. 11793 11794@item -fcaller-saves 11795@opindex fcaller-saves 11796Enable allocation of values to registers that are clobbered by 11797function calls, by emitting extra instructions to save and restore the 11798registers around such calls. Such allocation is done only when it 11799seems to result in better code. 11800 11801This option is always enabled by default on certain machines, usually 11802those which have no call-preserved registers to use instead. 11803 11804Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 11805 11806@item -fcombine-stack-adjustments 11807@opindex fcombine-stack-adjustments 11808Tracks stack adjustments (pushes and pops) and stack memory references 11809and then tries to find ways to combine them. 11810 11811Enabled by default at @option{-O1} and higher. 11812 11813@item -fipa-ra 11814@opindex fipa-ra 11815Use caller save registers for allocation if those registers are not used by 11816any called function. In that case it is not necessary to save and restore 11817them around calls. This is only possible if called functions are part of 11818same compilation unit as current function and they are compiled before it. 11819 11820Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option 11821is disabled if generated code will be instrumented for profiling 11822(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known 11823exactly (this happens on targets that do not expose prologues 11824and epilogues in RTL). 11825 11826@item -fconserve-stack 11827@opindex fconserve-stack 11828Attempt to minimize stack usage. The compiler attempts to use less 11829stack space, even if that makes the program slower. This option 11830implies setting the @option{large-stack-frame} parameter to 100 11831and the @option{large-stack-frame-growth} parameter to 400. 11832 11833@item -ftree-reassoc 11834@opindex ftree-reassoc 11835Perform reassociation on trees. This flag is enabled by default 11836at @option{-O1} and higher. 11837 11838@item -fcode-hoisting 11839@opindex fcode-hoisting 11840Perform code hoisting. Code hoisting tries to move the 11841evaluation of expressions executed on all paths to the function exit 11842as early as possible. This is especially useful as a code size 11843optimization, but it often helps for code speed as well. 11844This flag is enabled by default at @option{-O2} and higher. 11845 11846@item -ftree-pre 11847@opindex ftree-pre 11848Perform partial redundancy elimination (PRE) on trees. This flag is 11849enabled by default at @option{-O2} and @option{-O3}. 11850 11851@item -ftree-partial-pre 11852@opindex ftree-partial-pre 11853Make partial redundancy elimination (PRE) more aggressive. This flag is 11854enabled by default at @option{-O3}. 11855 11856@item -ftree-forwprop 11857@opindex ftree-forwprop 11858Perform forward propagation on trees. This flag is enabled by default 11859at @option{-O1} and higher. 11860 11861@item -ftree-fre 11862@opindex ftree-fre 11863Perform full redundancy elimination (FRE) on trees. The difference 11864between FRE and PRE is that FRE only considers expressions 11865that are computed on all paths leading to the redundant computation. 11866This analysis is faster than PRE, though it exposes fewer redundancies. 11867This flag is enabled by default at @option{-O1} and higher. 11868 11869@item -ftree-phiprop 11870@opindex ftree-phiprop 11871Perform hoisting of loads from conditional pointers on trees. This 11872pass is enabled by default at @option{-O1} and higher. 11873 11874@item -fhoist-adjacent-loads 11875@opindex fhoist-adjacent-loads 11876Speculatively hoist loads from both branches of an if-then-else if the 11877loads are from adjacent locations in the same structure and the target 11878architecture has a conditional move instruction. This flag is enabled 11879by default at @option{-O2} and higher. 11880 11881@item -ftree-copy-prop 11882@opindex ftree-copy-prop 11883Perform copy propagation on trees. This pass eliminates unnecessary 11884copy operations. This flag is enabled by default at @option{-O1} and 11885higher. 11886 11887@item -fipa-pure-const 11888@opindex fipa-pure-const 11889Discover which functions are pure or constant. 11890Enabled by default at @option{-O1} and higher. 11891 11892@item -fipa-reference 11893@opindex fipa-reference 11894Discover which static variables do not escape the 11895compilation unit. 11896Enabled by default at @option{-O1} and higher. 11897 11898@item -fipa-reference-addressable 11899@opindex fipa-reference-addressable 11900Discover read-only, write-only and non-addressable static variables. 11901Enabled by default at @option{-O1} and higher. 11902 11903@item -fipa-stack-alignment 11904@opindex fipa-stack-alignment 11905Reduce stack alignment on call sites if possible. 11906Enabled by default. 11907 11908@item -fipa-pta 11909@opindex fipa-pta 11910Perform interprocedural pointer analysis and interprocedural modification 11911and reference analysis. This option can cause excessive memory and 11912compile-time usage on large compilation units. It is not enabled by 11913default at any optimization level. 11914 11915@item -fipa-profile 11916@opindex fipa-profile 11917Perform interprocedural profile propagation. The functions called only from 11918cold functions are marked as cold. Also functions executed once (such as 11919@code{cold}, @code{noreturn}, static constructors or destructors) are 11920identified. Cold functions and loop less parts of functions executed once are 11921then optimized for size. 11922Enabled by default at @option{-O1} and higher. 11923 11924@item -fipa-modref 11925@opindex fipa-modref 11926Perform interprocedural mod/ref analysis. This optimization analyzes the side 11927effects of functions (memory locations that are modified or referenced) and 11928enables better optimization across the function call boundary. This flag is 11929enabled by default at @option{-O1} and higher. 11930 11931@item -fipa-cp 11932@opindex fipa-cp 11933Perform interprocedural constant propagation. 11934This optimization analyzes the program to determine when values passed 11935to functions are constants and then optimizes accordingly. 11936This optimization can substantially increase performance 11937if the application has constants passed to functions. 11938This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 11939It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11940 11941@item -fipa-cp-clone 11942@opindex fipa-cp-clone 11943Perform function cloning to make interprocedural constant propagation stronger. 11944When enabled, interprocedural constant propagation performs function cloning 11945when externally visible function can be called with constant arguments. 11946Because this optimization can create multiple copies of functions, 11947it may significantly increase code size 11948(see @option{--param ipa-cp-unit-growth=@var{value}}). 11949This flag is enabled by default at @option{-O3}. 11950It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 11951 11952@item -fipa-bit-cp 11953@opindex fipa-bit-cp 11954When enabled, perform interprocedural bitwise constant 11955propagation. This flag is enabled by default at @option{-O2} and 11956by @option{-fprofile-use} and @option{-fauto-profile}. 11957It requires that @option{-fipa-cp} is enabled. 11958 11959@item -fipa-vrp 11960@opindex fipa-vrp 11961When enabled, perform interprocedural propagation of value 11962ranges. This flag is enabled by default at @option{-O2}. It requires 11963that @option{-fipa-cp} is enabled. 11964 11965@item -fipa-icf 11966@opindex fipa-icf 11967Perform Identical Code Folding for functions and read-only variables. 11968The optimization reduces code size and may disturb unwind stacks by replacing 11969a function by equivalent one with a different name. The optimization works 11970more effectively with link-time optimization enabled. 11971 11972Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF 11973works on different levels and thus the optimizations are not same - there are 11974equivalences that are found only by GCC and equivalences found only by Gold. 11975 11976This flag is enabled by default at @option{-O2} and @option{-Os}. 11977 11978@item -flive-patching=@var{level} 11979@opindex flive-patching 11980Control GCC's optimizations to produce output suitable for live-patching. 11981 11982If the compiler's optimization uses a function's body or information extracted 11983from its body to optimize/change another function, the latter is called an 11984impacted function of the former. If a function is patched, its impacted 11985functions should be patched too. 11986 11987The impacted functions are determined by the compiler's interprocedural 11988optimizations. For example, a caller is impacted when inlining a function 11989into its caller, 11990cloning a function and changing its caller to call this new clone, 11991or extracting a function's pureness/constness information to optimize 11992its direct or indirect callers, etc. 11993 11994Usually, the more IPA optimizations enabled, the larger the number of 11995impacted functions for each function. In order to control the number of 11996impacted functions and more easily compute the list of impacted function, 11997IPA optimizations can be partially enabled at two different levels. 11998 11999The @var{level} argument should be one of the following: 12000 12001@table @samp 12002 12003@item inline-clone 12004 12005Only enable inlining and cloning optimizations, which includes inlining, 12006cloning, interprocedural scalar replacement of aggregates and partial inlining. 12007As a result, when patching a function, all its callers and its clones' 12008callers are impacted, therefore need to be patched as well. 12009 12010@option{-flive-patching=inline-clone} disables the following optimization flags: 12011@gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol 12012-fipa-icf -fipa-icf-functions -fipa-icf-variables @gol 12013-fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol 12014-fipa-stack-alignment -fipa-modref} 12015 12016@item inline-only-static 12017 12018Only enable inlining of static functions. 12019As a result, when patching a static function, all its callers are impacted 12020and so need to be patched as well. 12021 12022In addition to all the flags that @option{-flive-patching=inline-clone} 12023disables, 12024@option{-flive-patching=inline-only-static} disables the following additional 12025optimization flags: 12026@gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp} 12027 12028@end table 12029 12030When @option{-flive-patching} is specified without any value, the default value 12031is @var{inline-clone}. 12032 12033This flag is disabled by default. 12034 12035Note that @option{-flive-patching} is not supported with link-time optimization 12036(@option{-flto}). 12037 12038@item -fisolate-erroneous-paths-dereference 12039@opindex fisolate-erroneous-paths-dereference 12040Detect paths that trigger erroneous or undefined behavior due to 12041dereferencing a null pointer. Isolate those paths from the main control 12042flow and turn the statement with erroneous or undefined behavior into a trap. 12043This flag is enabled by default at @option{-O2} and higher and depends on 12044@option{-fdelete-null-pointer-checks} also being enabled. 12045 12046@item -fisolate-erroneous-paths-attribute 12047@opindex fisolate-erroneous-paths-attribute 12048Detect paths that trigger erroneous or undefined behavior due to a null value 12049being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 12050attribute. Isolate those paths from the main control flow and turn the 12051statement with erroneous or undefined behavior into a trap. This is not 12052currently enabled, but may be enabled by @option{-O2} in the future. 12053 12054@item -ftree-sink 12055@opindex ftree-sink 12056Perform forward store motion on trees. This flag is 12057enabled by default at @option{-O1} and higher. 12058 12059@item -ftree-bit-ccp 12060@opindex ftree-bit-ccp 12061Perform sparse conditional bit constant propagation on trees and propagate 12062pointer alignment information. 12063This pass only operates on local scalar variables and is enabled by default 12064at @option{-O1} and higher, except for @option{-Og}. 12065It requires that @option{-ftree-ccp} is enabled. 12066 12067@item -ftree-ccp 12068@opindex ftree-ccp 12069Perform sparse conditional constant propagation (CCP) on trees. This 12070pass only operates on local scalar variables and is enabled by default 12071at @option{-O1} and higher. 12072 12073@item -fssa-backprop 12074@opindex fssa-backprop 12075Propagate information about uses of a value up the definition chain 12076in order to simplify the definitions. For example, this pass strips 12077sign operations if the sign of a value never matters. The flag is 12078enabled by default at @option{-O1} and higher. 12079 12080@item -fssa-phiopt 12081@opindex fssa-phiopt 12082Perform pattern matching on SSA PHI nodes to optimize conditional 12083code. This pass is enabled by default at @option{-O1} and higher, 12084except for @option{-Og}. 12085 12086@item -ftree-switch-conversion 12087@opindex ftree-switch-conversion 12088Perform conversion of simple initializations in a switch to 12089initializations from a scalar array. This flag is enabled by default 12090at @option{-O2} and higher. 12091 12092@item -ftree-tail-merge 12093@opindex ftree-tail-merge 12094Look for identical code sequences. When found, replace one with a jump to the 12095other. This optimization is known as tail merging or cross jumping. This flag 12096is enabled by default at @option{-O2} and higher. The compilation time 12097in this pass can 12098be limited using @option{max-tail-merge-comparisons} parameter and 12099@option{max-tail-merge-iterations} parameter. 12100 12101@item -ftree-dce 12102@opindex ftree-dce 12103Perform dead code elimination (DCE) on trees. This flag is enabled by 12104default at @option{-O1} and higher. 12105 12106@item -ftree-builtin-call-dce 12107@opindex ftree-builtin-call-dce 12108Perform conditional dead code elimination (DCE) for calls to built-in functions 12109that may set @code{errno} but are otherwise free of side effects. This flag is 12110enabled by default at @option{-O2} and higher if @option{-Os} is not also 12111specified. 12112 12113@item -ffinite-loops 12114@opindex ffinite-loops 12115@opindex fno-finite-loops 12116Assume that a loop with an exit will eventually take the exit and not loop 12117indefinitely. This allows the compiler to remove loops that otherwise have 12118no side-effects, not considering eventual endless looping as such. 12119 12120This option is enabled by default at @option{-O2} for C++ with -std=c++11 12121or higher. 12122 12123@item -ftree-dominator-opts 12124@opindex ftree-dominator-opts 12125Perform a variety of simple scalar cleanups (constant/copy 12126propagation, redundancy elimination, range propagation and expression 12127simplification) based on a dominator tree traversal. This also 12128performs jump threading (to reduce jumps to jumps). This flag is 12129enabled by default at @option{-O1} and higher. 12130 12131@item -ftree-dse 12132@opindex ftree-dse 12133Perform dead store elimination (DSE) on trees. A dead store is a store into 12134a memory location that is later overwritten by another store without 12135any intervening loads. In this case the earlier store can be deleted. This 12136flag is enabled by default at @option{-O1} and higher. 12137 12138@item -ftree-ch 12139@opindex ftree-ch 12140Perform loop header copying on trees. This is beneficial since it increases 12141effectiveness of code motion optimizations. It also saves one jump. This flag 12142is enabled by default at @option{-O1} and higher. It is not enabled 12143for @option{-Os}, since it usually increases code size. 12144 12145@item -ftree-loop-optimize 12146@opindex ftree-loop-optimize 12147Perform loop optimizations on trees. This flag is enabled by default 12148at @option{-O1} and higher. 12149 12150@item -ftree-loop-linear 12151@itemx -floop-strip-mine 12152@itemx -floop-block 12153@opindex ftree-loop-linear 12154@opindex floop-strip-mine 12155@opindex floop-block 12156Perform loop nest optimizations. Same as 12157@option{-floop-nest-optimize}. To use this code transformation, GCC has 12158to be configured with @option{--with-isl} to enable the Graphite loop 12159transformation infrastructure. 12160 12161@item -fgraphite-identity 12162@opindex fgraphite-identity 12163Enable the identity transformation for graphite. For every SCoP we generate 12164the polyhedral representation and transform it back to gimple. Using 12165@option{-fgraphite-identity} we can check the costs or benefits of the 12166GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 12167are also performed by the code generator isl, like index splitting and 12168dead code elimination in loops. 12169 12170@item -floop-nest-optimize 12171@opindex floop-nest-optimize 12172Enable the isl based loop nest optimizer. This is a generic loop nest 12173optimizer based on the Pluto optimization algorithms. It calculates a loop 12174structure optimized for data-locality and parallelism. This option 12175is experimental. 12176 12177@item -floop-parallelize-all 12178@opindex floop-parallelize-all 12179Use the Graphite data dependence analysis to identify loops that can 12180be parallelized. Parallelize all the loops that can be analyzed to 12181not contain loop carried dependences without checking that it is 12182profitable to parallelize the loops. 12183 12184@item -ftree-coalesce-vars 12185@opindex ftree-coalesce-vars 12186While transforming the program out of the SSA representation, attempt to 12187reduce copying by coalescing versions of different user-defined 12188variables, instead of just compiler temporaries. This may severely 12189limit the ability to debug an optimized program compiled with 12190@option{-fno-var-tracking-assignments}. In the negated form, this flag 12191prevents SSA coalescing of user variables. This option is enabled by 12192default if optimization is enabled, and it does very little otherwise. 12193 12194@item -ftree-loop-if-convert 12195@opindex ftree-loop-if-convert 12196Attempt to transform conditional jumps in the innermost loops to 12197branch-less equivalents. The intent is to remove control-flow from 12198the innermost loops in order to improve the ability of the 12199vectorization pass to handle these loops. This is enabled by default 12200if vectorization is enabled. 12201 12202@item -ftree-loop-distribution 12203@opindex ftree-loop-distribution 12204Perform loop distribution. This flag can improve cache performance on 12205big loop bodies and allow further loop optimizations, like 12206parallelization or vectorization, to take place. For example, the loop 12207@smallexample 12208DO I = 1, N 12209 A(I) = B(I) + C 12210 D(I) = E(I) * F 12211ENDDO 12212@end smallexample 12213is transformed to 12214@smallexample 12215DO I = 1, N 12216 A(I) = B(I) + C 12217ENDDO 12218DO I = 1, N 12219 D(I) = E(I) * F 12220ENDDO 12221@end smallexample 12222This flag is enabled by default at @option{-O3}. 12223It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12224 12225@item -ftree-loop-distribute-patterns 12226@opindex ftree-loop-distribute-patterns 12227Perform loop distribution of patterns that can be code generated with 12228calls to a library. This flag is enabled by default at @option{-O2} and 12229higher, and by @option{-fprofile-use} and @option{-fauto-profile}. 12230 12231This pass distributes the initialization loops and generates a call to 12232memset zero. For example, the loop 12233@smallexample 12234DO I = 1, N 12235 A(I) = 0 12236 B(I) = A(I) + I 12237ENDDO 12238@end smallexample 12239is transformed to 12240@smallexample 12241DO I = 1, N 12242 A(I) = 0 12243ENDDO 12244DO I = 1, N 12245 B(I) = A(I) + I 12246ENDDO 12247@end smallexample 12248and the initialization loop is transformed into a call to memset zero. 12249This flag is enabled by default at @option{-O3}. 12250It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12251 12252@item -floop-interchange 12253@opindex floop-interchange 12254Perform loop interchange outside of graphite. This flag can improve cache 12255performance on loop nest and allow further loop optimizations, like 12256vectorization, to take place. For example, the loop 12257@smallexample 12258for (int i = 0; i < N; i++) 12259 for (int j = 0; j < N; j++) 12260 for (int k = 0; k < N; k++) 12261 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 12262@end smallexample 12263is transformed to 12264@smallexample 12265for (int i = 0; i < N; i++) 12266 for (int k = 0; k < N; k++) 12267 for (int j = 0; j < N; j++) 12268 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 12269@end smallexample 12270This flag is enabled by default at @option{-O3}. 12271It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12272 12273@item -floop-unroll-and-jam 12274@opindex floop-unroll-and-jam 12275Apply unroll and jam transformations on feasible loops. In a loop 12276nest this unrolls the outer loop by some factor and fuses the resulting 12277multiple inner loops. This flag is enabled by default at @option{-O3}. 12278It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12279 12280@item -ftree-loop-im 12281@opindex ftree-loop-im 12282Perform loop invariant motion on trees. This pass moves only invariants that 12283are hard to handle at RTL level (function calls, operations that expand to 12284nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 12285operands of conditions that are invariant out of the loop, so that we can use 12286just trivial invariantness analysis in loop unswitching. The pass also includes 12287store motion. 12288 12289@item -ftree-loop-ivcanon 12290@opindex ftree-loop-ivcanon 12291Create a canonical counter for number of iterations in loops for which 12292determining number of iterations requires complicated analysis. Later 12293optimizations then may determine the number easily. Useful especially 12294in connection with unrolling. 12295 12296@item -ftree-scev-cprop 12297@opindex ftree-scev-cprop 12298Perform final value replacement. If a variable is modified in a loop 12299in such a way that its value when exiting the loop can be determined using 12300only its initial value and the number of loop iterations, replace uses of 12301the final value by such a computation, provided it is sufficiently cheap. 12302This reduces data dependencies and may allow further simplifications. 12303Enabled by default at @option{-O1} and higher. 12304 12305@item -fivopts 12306@opindex fivopts 12307Perform induction variable optimizations (strength reduction, induction 12308variable merging and induction variable elimination) on trees. 12309 12310@item -ftree-parallelize-loops=n 12311@opindex ftree-parallelize-loops 12312Parallelize loops, i.e., split their iteration space to run in n threads. 12313This is only possible for loops whose iterations are independent 12314and can be arbitrarily reordered. The optimization is only 12315profitable on multiprocessor machines, for loops that are CPU-intensive, 12316rather than constrained e.g.@: by memory bandwidth. This option 12317implies @option{-pthread}, and thus is only supported on targets 12318that have support for @option{-pthread}. 12319 12320@item -ftree-pta 12321@opindex ftree-pta 12322Perform function-local points-to analysis on trees. This flag is 12323enabled by default at @option{-O1} and higher, except for @option{-Og}. 12324 12325@item -ftree-sra 12326@opindex ftree-sra 12327Perform scalar replacement of aggregates. This pass replaces structure 12328references with scalars to prevent committing structures to memory too 12329early. This flag is enabled by default at @option{-O1} and higher, 12330except for @option{-Og}. 12331 12332@item -fstore-merging 12333@opindex fstore-merging 12334Perform merging of narrow stores to consecutive memory addresses. This pass 12335merges contiguous stores of immediate values narrower than a word into fewer 12336wider stores to reduce the number of instructions. This is enabled by default 12337at @option{-O2} and higher as well as @option{-Os}. 12338 12339@item -ftree-ter 12340@opindex ftree-ter 12341Perform temporary expression replacement during the SSA->normal phase. Single 12342use/single def temporaries are replaced at their use location with their 12343defining expression. This results in non-GIMPLE code, but gives the expanders 12344much more complex trees to work on resulting in better RTL generation. This is 12345enabled by default at @option{-O1} and higher. 12346 12347@item -ftree-slsr 12348@opindex ftree-slsr 12349Perform straight-line strength reduction on trees. This recognizes related 12350expressions involving multiplications and replaces them by less expensive 12351calculations when possible. This is enabled by default at @option{-O1} and 12352higher. 12353 12354@item -ftree-vectorize 12355@opindex ftree-vectorize 12356Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 12357and @option{-ftree-slp-vectorize} if not explicitly specified. 12358 12359@item -ftree-loop-vectorize 12360@opindex ftree-loop-vectorize 12361Perform loop vectorization on trees. This flag is enabled by default at 12362@option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 12363and @option{-fauto-profile}. 12364 12365@item -ftree-slp-vectorize 12366@opindex ftree-slp-vectorize 12367Perform basic block vectorization on trees. This flag is enabled by default at 12368@option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use}, 12369and @option{-fauto-profile}. 12370 12371@item -ftrivial-auto-var-init=@var{choice} 12372@opindex ftrivial-auto-var-init 12373Initialize automatic variables with either a pattern or with zeroes to increase 12374the security and predictability of a program by preventing uninitialized memory 12375disclosure and use. 12376GCC still considers an automatic variable that doesn't have an explicit 12377initializer as uninitialized, @option{-Wuninitialized} and 12378@option{-Wanalyzer-use-of-uninitialized-value} will still report 12379warning messages on such automatic variables. 12380With this option, GCC will also initialize any padding of automatic variables 12381that have structure or union types to zeroes. 12382However, the current implementation cannot initialize automatic variables that 12383are declared between the controlling expression and the first case of a 12384@code{switch} statement. Using @option{-Wtrivial-auto-var-init} to report all 12385such cases. 12386 12387The three values of @var{choice} are: 12388 12389@itemize @bullet 12390@item 12391@samp{uninitialized} doesn't initialize any automatic variables. 12392This is C and C++'s default. 12393 12394@item 12395@samp{pattern} Initialize automatic variables with values which will likely 12396transform logic bugs into crashes down the line, are easily recognized in a 12397crash dump and without being values that programmers can rely on for useful 12398program semantics. 12399The current value is byte-repeatable pattern with byte "0xFE". 12400The values used for pattern initialization might be changed in the future. 12401 12402@item 12403@samp{zero} Initialize automatic variables with zeroes. 12404@end itemize 12405 12406The default is @samp{uninitialized}. 12407 12408You can control this behavior for a specific variable by using the variable 12409attribute @code{uninitialized} (@pxref{Variable Attributes}). 12410 12411@item -fvect-cost-model=@var{model} 12412@opindex fvect-cost-model 12413Alter the cost model used for vectorization. The @var{model} argument 12414should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or 12415@samp{very-cheap}. 12416With the @samp{unlimited} model the vectorized code-path is assumed 12417to be profitable while with the @samp{dynamic} model a runtime check 12418guards the vectorized code-path to enable it only for iteration 12419counts that will likely execute faster than when executing the original 12420scalar loop. The @samp{cheap} model disables vectorization of 12421loops where doing so would be cost prohibitive for example due to 12422required runtime checks for data dependence or alignment but otherwise 12423is equal to the @samp{dynamic} model. The @samp{very-cheap} model only 12424allows vectorization if the vector code would entirely replace the 12425scalar code that is being vectorized. For example, if each iteration 12426of a vectorized loop would only be able to handle exactly four iterations 12427of the scalar loop, the @samp{very-cheap} model would only allow 12428vectorization if the scalar iteration count is known to be a multiple 12429of four. 12430 12431The default cost model depends on other optimization flags and is 12432either @samp{dynamic} or @samp{cheap}. 12433 12434@item -fsimd-cost-model=@var{model} 12435@opindex fsimd-cost-model 12436Alter the cost model used for vectorization of loops marked with the OpenMP 12437simd directive. The @var{model} argument should be one of 12438@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 12439have the same meaning as described in @option{-fvect-cost-model} and by 12440default a cost model defined with @option{-fvect-cost-model} is used. 12441 12442@item -ftree-vrp 12443@opindex ftree-vrp 12444Perform Value Range Propagation on trees. This is similar to the 12445constant propagation pass, but instead of values, ranges of values are 12446propagated. This allows the optimizers to remove unnecessary range 12447checks like array bound checks and null pointer checks. This is 12448enabled by default at @option{-O2} and higher. Null pointer check 12449elimination is only done if @option{-fdelete-null-pointer-checks} is 12450enabled. 12451 12452@item -fsplit-paths 12453@opindex fsplit-paths 12454Split paths leading to loop backedges. This can improve dead code 12455elimination and common subexpression elimination. This is enabled by 12456default at @option{-O3} and above. 12457 12458@item -fsplit-ivs-in-unroller 12459@opindex fsplit-ivs-in-unroller 12460Enables expression of values of induction variables in later iterations 12461of the unrolled loop using the value in the first iteration. This breaks 12462long dependency chains, thus improving efficiency of the scheduling passes. 12463 12464A combination of @option{-fweb} and CSE is often sufficient to obtain the 12465same effect. However, that is not reliable in cases where the loop body 12466is more complicated than a single basic block. It also does not work at all 12467on some architectures due to restrictions in the CSE pass. 12468 12469This optimization is enabled by default. 12470 12471@item -fvariable-expansion-in-unroller 12472@opindex fvariable-expansion-in-unroller 12473With this option, the compiler creates multiple copies of some 12474local variables when unrolling a loop, which can result in superior code. 12475 12476This optimization is enabled by default for PowerPC targets, but disabled 12477by default otherwise. 12478 12479@item -fpartial-inlining 12480@opindex fpartial-inlining 12481Inline parts of functions. This option has any effect only 12482when inlining itself is turned on by the @option{-finline-functions} 12483or @option{-finline-small-functions} options. 12484 12485Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 12486 12487@item -fpredictive-commoning 12488@opindex fpredictive-commoning 12489Perform predictive commoning optimization, i.e., reusing computations 12490(especially memory loads and stores) performed in previous 12491iterations of loops. 12492 12493This option is enabled at level @option{-O3}. 12494It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 12495 12496@item -fprefetch-loop-arrays 12497@opindex fprefetch-loop-arrays 12498If supported by the target machine, generate instructions to prefetch 12499memory to improve the performance of loops that access large arrays. 12500 12501This option may generate better or worse code; results are highly 12502dependent on the structure of loops within the source code. 12503 12504Disabled at level @option{-Os}. 12505 12506@item -fno-printf-return-value 12507@opindex fno-printf-return-value 12508@opindex fprintf-return-value 12509Do not substitute constants for known return value of formatted output 12510functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and 12511@code{vsnprintf} (but not @code{printf} of @code{fprintf}). This 12512transformation allows GCC to optimize or even eliminate branches based 12513on the known return value of these functions called with arguments that 12514are either constant, or whose values are known to be in a range that 12515makes determining the exact return value possible. For example, when 12516@option{-fprintf-return-value} is in effect, both the branch and the 12517body of the @code{if} statement (but not the call to @code{snprint}) 12518can be optimized away when @code{i} is a 32-bit or smaller integer 12519because the return value is guaranteed to be at most 8. 12520 12521@smallexample 12522char buf[9]; 12523if (snprintf (buf, "%08x", i) >= sizeof buf) 12524 @dots{} 12525@end smallexample 12526 12527The @option{-fprintf-return-value} option relies on other optimizations 12528and yields best results with @option{-O2} and above. It works in tandem 12529with the @option{-Wformat-overflow} and @option{-Wformat-truncation} 12530options. The @option{-fprintf-return-value} option is enabled by default. 12531 12532@item -fno-peephole 12533@itemx -fno-peephole2 12534@opindex fno-peephole 12535@opindex fpeephole 12536@opindex fno-peephole2 12537@opindex fpeephole2 12538Disable any machine-specific peephole optimizations. The difference 12539between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 12540are implemented in the compiler; some targets use one, some use the 12541other, a few use both. 12542 12543@option{-fpeephole} is enabled by default. 12544@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 12545 12546@item -fno-guess-branch-probability 12547@opindex fno-guess-branch-probability 12548@opindex fguess-branch-probability 12549Do not guess branch probabilities using heuristics. 12550 12551GCC uses heuristics to guess branch probabilities if they are 12552not provided by profiling feedback (@option{-fprofile-arcs}). These 12553heuristics are based on the control flow graph. If some branch probabilities 12554are specified by @code{__builtin_expect}, then the heuristics are 12555used to guess branch probabilities for the rest of the control flow graph, 12556taking the @code{__builtin_expect} info into account. The interactions 12557between the heuristics and @code{__builtin_expect} can be complex, and in 12558some cases, it may be useful to disable the heuristics so that the effects 12559of @code{__builtin_expect} are easier to understand. 12560 12561It is also possible to specify expected probability of the expression 12562with @code{__builtin_expect_with_probability} built-in function. 12563 12564The default is @option{-fguess-branch-probability} at levels 12565@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 12566 12567@item -freorder-blocks 12568@opindex freorder-blocks 12569Reorder basic blocks in the compiled function in order to reduce number of 12570taken branches and improve code locality. 12571 12572Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}. 12573 12574@item -freorder-blocks-algorithm=@var{algorithm} 12575@opindex freorder-blocks-algorithm 12576Use the specified algorithm for basic block reordering. The 12577@var{algorithm} argument can be @samp{simple}, which does not increase 12578code size (except sometimes due to secondary effects like alignment), 12579or @samp{stc}, the ``software trace cache'' algorithm, which tries to 12580put all often executed code together, minimizing the number of branches 12581executed by making extra copies of code. 12582 12583The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and 12584@samp{stc} at levels @option{-O2}, @option{-O3}. 12585 12586@item -freorder-blocks-and-partition 12587@opindex freorder-blocks-and-partition 12588In addition to reordering basic blocks in the compiled function, in order 12589to reduce number of taken branches, partitions hot and cold basic blocks 12590into separate sections of the assembly and @file{.o} files, to improve 12591paging and cache locality performance. 12592 12593This optimization is automatically turned off in the presence of 12594exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined 12595section attribute and on any architecture that does not support named 12596sections. When @option{-fsplit-stack} is used this option is not 12597enabled by default (to avoid linker errors), but may be enabled 12598explicitly (if using a working linker). 12599 12600Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}. 12601 12602@item -freorder-functions 12603@opindex freorder-functions 12604Reorder functions in the object file in order to 12605improve code locality. This is implemented by using special 12606subsections @code{.text.hot} for most frequently executed functions and 12607@code{.text.unlikely} for unlikely executed functions. Reordering is done by 12608the linker so object file format must support named sections and linker must 12609place them in a reasonable way. 12610 12611This option isn't effective unless you either provide profile feedback 12612(see @option{-fprofile-arcs} for details) or manually annotate functions with 12613@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}). 12614 12615Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 12616 12617@item -fstrict-aliasing 12618@opindex fstrict-aliasing 12619Allow the compiler to assume the strictest aliasing rules applicable to 12620the language being compiled. For C (and C++), this activates 12621optimizations based on the type of expressions. In particular, an 12622object of one type is assumed never to reside at the same address as an 12623object of a different type, unless the types are almost the same. For 12624example, an @code{unsigned int} can alias an @code{int}, but not a 12625@code{void*} or a @code{double}. A character type may alias any other 12626type. 12627 12628@anchor{Type-punning}Pay special attention to code like this: 12629@smallexample 12630union a_union @{ 12631 int i; 12632 double d; 12633@}; 12634 12635int f() @{ 12636 union a_union t; 12637 t.d = 3.0; 12638 return t.i; 12639@} 12640@end smallexample 12641The practice of reading from a different union member than the one most 12642recently written to (called ``type-punning'') is common. Even with 12643@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 12644is accessed through the union type. So, the code above works as 12645expected. @xref{Structures unions enumerations and bit-fields 12646implementation}. However, this code might not: 12647@smallexample 12648int f() @{ 12649 union a_union t; 12650 int* ip; 12651 t.d = 3.0; 12652 ip = &t.i; 12653 return *ip; 12654@} 12655@end smallexample 12656 12657Similarly, access by taking the address, casting the resulting pointer 12658and dereferencing the result has undefined behavior, even if the cast 12659uses a union type, e.g.: 12660@smallexample 12661int f() @{ 12662 double d = 3.0; 12663 return ((union a_union *) &d)->i; 12664@} 12665@end smallexample 12666 12667The @option{-fstrict-aliasing} option is enabled at levels 12668@option{-O2}, @option{-O3}, @option{-Os}. 12669 12670@item -fipa-strict-aliasing 12671@opindex fipa-strict-aliasing 12672Controls whether rules of @option{-fstrict-aliasing} are applied across 12673function boundaries. Note that if multiple functions gets inlined into a 12674single function the memory accesses are no longer considered to be crossing a 12675function boundary. 12676 12677The @option{-fipa-strict-aliasing} option is enabled by default and is 12678effective only in combination with @option{-fstrict-aliasing}. 12679 12680@item -falign-functions 12681@itemx -falign-functions=@var{n} 12682@itemx -falign-functions=@var{n}:@var{m} 12683@itemx -falign-functions=@var{n}:@var{m}:@var{n2} 12684@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2} 12685@opindex falign-functions 12686Align the start of functions to the next power-of-two greater than or 12687equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at 12688least the first @var{m} bytes of the function can be fetched by the CPU 12689without crossing an @var{n}-byte alignment boundary. 12690 12691If @var{m} is not specified, it defaults to @var{n}. 12692 12693Examples: @option{-falign-functions=32} aligns functions to the next 1269432-byte boundary, @option{-falign-functions=24} aligns to the next 1269532-byte boundary only if this can be done by skipping 23 bytes or less, 12696@option{-falign-functions=32:7} aligns to the next 1269732-byte boundary only if this can be done by skipping 6 bytes or less. 12698 12699The second pair of @var{n2}:@var{m2} values allows you to specify 12700a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to 12701the next 64-byte boundary if this can be done by skipping 6 bytes or less, 12702otherwise aligns to the next 32-byte boundary if this can be done 12703by skipping 2 bytes or less. 12704If @var{m2} is not specified, it defaults to @var{n2}. 12705 12706Some assemblers only support this flag when @var{n} is a power of two; 12707in that case, it is rounded up. 12708 12709@option{-fno-align-functions} and @option{-falign-functions=1} are 12710equivalent and mean that functions are not aligned. 12711 12712If @var{n} is not specified or is zero, use a machine-dependent default. 12713The maximum allowed @var{n} option value is 65536. 12714 12715Enabled at levels @option{-O2}, @option{-O3}. 12716 12717@item -flimit-function-alignment 12718If this option is enabled, the compiler tries to avoid unnecessarily 12719overaligning functions. It attempts to instruct the assembler to align 12720by the amount specified by @option{-falign-functions}, but not to 12721skip more bytes than the size of the function. 12722 12723@item -falign-labels 12724@itemx -falign-labels=@var{n} 12725@itemx -falign-labels=@var{n}:@var{m} 12726@itemx -falign-labels=@var{n}:@var{m}:@var{n2} 12727@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2} 12728@opindex falign-labels 12729Align all branch targets to a power-of-two boundary. 12730 12731Parameters of this option are analogous to the @option{-falign-functions} option. 12732@option{-fno-align-labels} and @option{-falign-labels=1} are 12733equivalent and mean that labels are not aligned. 12734 12735If @option{-falign-loops} or @option{-falign-jumps} are applicable and 12736are greater than this value, then their values are used instead. 12737 12738If @var{n} is not specified or is zero, use a machine-dependent default 12739which is very likely to be @samp{1}, meaning no alignment. 12740The maximum allowed @var{n} option value is 65536. 12741 12742Enabled at levels @option{-O2}, @option{-O3}. 12743 12744@item -falign-loops 12745@itemx -falign-loops=@var{n} 12746@itemx -falign-loops=@var{n}:@var{m} 12747@itemx -falign-loops=@var{n}:@var{m}:@var{n2} 12748@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2} 12749@opindex falign-loops 12750Align loops to a power-of-two boundary. If the loops are executed 12751many times, this makes up for any execution of the dummy padding 12752instructions. 12753 12754If @option{-falign-labels} is greater than this value, then its value 12755is used instead. 12756 12757Parameters of this option are analogous to the @option{-falign-functions} option. 12758@option{-fno-align-loops} and @option{-falign-loops=1} are 12759equivalent and mean that loops are not aligned. 12760The maximum allowed @var{n} option value is 65536. 12761 12762If @var{n} is not specified or is zero, use a machine-dependent default. 12763 12764Enabled at levels @option{-O2}, @option{-O3}. 12765 12766@item -falign-jumps 12767@itemx -falign-jumps=@var{n} 12768@itemx -falign-jumps=@var{n}:@var{m} 12769@itemx -falign-jumps=@var{n}:@var{m}:@var{n2} 12770@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2} 12771@opindex falign-jumps 12772Align branch targets to a power-of-two boundary, for branch targets 12773where the targets can only be reached by jumping. In this case, 12774no dummy operations need be executed. 12775 12776If @option{-falign-labels} is greater than this value, then its value 12777is used instead. 12778 12779Parameters of this option are analogous to the @option{-falign-functions} option. 12780@option{-fno-align-jumps} and @option{-falign-jumps=1} are 12781equivalent and mean that loops are not aligned. 12782 12783If @var{n} is not specified or is zero, use a machine-dependent default. 12784The maximum allowed @var{n} option value is 65536. 12785 12786Enabled at levels @option{-O2}, @option{-O3}. 12787 12788@item -fno-allocation-dce 12789@opindex fno-allocation-dce 12790Do not remove unused C++ allocations in dead code elimination. 12791 12792@item -fallow-store-data-races 12793@opindex fallow-store-data-races 12794Allow the compiler to perform optimizations that may introduce new data races 12795on stores, without proving that the variable cannot be concurrently accessed 12796by other threads. Does not affect optimization of local data. It is safe to 12797use this option if it is known that global data will not be accessed by 12798multiple threads. 12799 12800Examples of optimizations enabled by @option{-fallow-store-data-races} include 12801hoisting or if-conversions that may cause a value that was already in memory 12802to be re-written with that same value. Such re-writing is safe in a single 12803threaded context but may be unsafe in a multi-threaded context. Note that on 12804some processors, if-conversions may be required in order to enable 12805vectorization. 12806 12807Enabled at level @option{-Ofast}. 12808 12809@item -funit-at-a-time 12810@opindex funit-at-a-time 12811This option is left for compatibility reasons. @option{-funit-at-a-time} 12812has no effect, while @option{-fno-unit-at-a-time} implies 12813@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 12814 12815Enabled by default. 12816 12817@item -fno-toplevel-reorder 12818@opindex fno-toplevel-reorder 12819@opindex ftoplevel-reorder 12820Do not reorder top-level functions, variables, and @code{asm} 12821statements. Output them in the same order that they appear in the 12822input file. When this option is used, unreferenced static variables 12823are not removed. This option is intended to support existing code 12824that relies on a particular ordering. For new code, it is better to 12825use attributes when possible. 12826 12827@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and 12828also at @option{-O0} if @option{-fsection-anchors} is explicitly requested. 12829Additionally @option{-fno-toplevel-reorder} implies 12830@option{-fno-section-anchors}. 12831 12832@item -fweb 12833@opindex fweb 12834Constructs webs as commonly used for register allocation purposes and assign 12835each web individual pseudo register. This allows the register allocation pass 12836to operate on pseudos directly, but also strengthens several other optimization 12837passes, such as CSE, loop optimizer and trivial dead code remover. It can, 12838however, make debugging impossible, since variables no longer stay in a 12839``home register''. 12840 12841Enabled by default with @option{-funroll-loops}. 12842 12843@item -fwhole-program 12844@opindex fwhole-program 12845Assume that the current compilation unit represents the whole program being 12846compiled. All public functions and variables with the exception of @code{main} 12847and those merged by attribute @code{externally_visible} become static functions 12848and in effect are optimized more aggressively by interprocedural optimizers. 12849 12850This option should not be used in combination with @option{-flto}. 12851Instead relying on a linker plugin should provide safer and more precise 12852information. 12853 12854@item -flto[=@var{n}] 12855@opindex flto 12856This option runs the standard link-time optimizer. When invoked 12857with source code, it generates GIMPLE (one of GCC's internal 12858representations) and writes it to special ELF sections in the object 12859file. When the object files are linked together, all the function 12860bodies are read from these ELF sections and instantiated as if they 12861had been part of the same translation unit. 12862 12863To use the link-time optimizer, @option{-flto} and optimization 12864options should be specified at compile time and during the final link. 12865It is recommended that you compile all the files participating in the 12866same link with the same options and also specify those options at 12867link time. 12868For example: 12869 12870@smallexample 12871gcc -c -O2 -flto foo.c 12872gcc -c -O2 -flto bar.c 12873gcc -o myprog -flto -O2 foo.o bar.o 12874@end smallexample 12875 12876The first two invocations to GCC save a bytecode representation 12877of GIMPLE into special ELF sections inside @file{foo.o} and 12878@file{bar.o}. The final invocation reads the GIMPLE bytecode from 12879@file{foo.o} and @file{bar.o}, merges the two files into a single 12880internal image, and compiles the result as usual. Since both 12881@file{foo.o} and @file{bar.o} are merged into a single image, this 12882causes all the interprocedural analyses and optimizations in GCC to 12883work across the two files as if they were a single one. This means, 12884for example, that the inliner is able to inline functions in 12885@file{bar.o} into functions in @file{foo.o} and vice-versa. 12886 12887Another (simpler) way to enable link-time optimization is: 12888 12889@smallexample 12890gcc -o myprog -flto -O2 foo.c bar.c 12891@end smallexample 12892 12893The above generates bytecode for @file{foo.c} and @file{bar.c}, 12894merges them together into a single GIMPLE representation and optimizes 12895them as usual to produce @file{myprog}. 12896 12897The important thing to keep in mind is that to enable link-time 12898optimizations you need to use the GCC driver to perform the link step. 12899GCC automatically performs link-time optimization if any of the 12900objects involved were compiled with the @option{-flto} command-line option. 12901You can always override 12902the automatic decision to do link-time optimization 12903by passing @option{-fno-lto} to the link command. 12904 12905To make whole program optimization effective, it is necessary to make 12906certain whole program assumptions. The compiler needs to know 12907what functions and variables can be accessed by libraries and runtime 12908outside of the link-time optimized unit. When supported by the linker, 12909the linker plugin (see @option{-fuse-linker-plugin}) passes information 12910to the compiler about used and externally visible symbols. When 12911the linker plugin is not available, @option{-fwhole-program} should be 12912used to allow the compiler to make these assumptions, which leads 12913to more aggressive optimization decisions. 12914 12915When a file is compiled with @option{-flto} without 12916@option{-fuse-linker-plugin}, the generated object file is larger than 12917a regular object file because it contains GIMPLE bytecodes and the usual 12918final code (see @option{-ffat-lto-objects}). This means that 12919object files with LTO information can be linked as normal object 12920files; if @option{-fno-lto} is passed to the linker, no 12921interprocedural optimizations are applied. Note that when 12922@option{-fno-fat-lto-objects} is enabled the compile stage is faster 12923but you cannot perform a regular, non-LTO link on them. 12924 12925When producing the final binary, GCC only 12926applies link-time optimizations to those files that contain bytecode. 12927Therefore, you can mix and match object files and libraries with 12928GIMPLE bytecodes and final object code. GCC automatically selects 12929which files to optimize in LTO mode and which files to link without 12930further processing. 12931 12932Generally, options specified at link time override those 12933specified at compile time, although in some cases GCC attempts to infer 12934link-time options from the settings used to compile the input files. 12935 12936If you do not specify an optimization level option @option{-O} at 12937link time, then GCC uses the highest optimization level 12938used when compiling the object files. Note that it is generally 12939ineffective to specify an optimization level option only at link time and 12940not at compile time, for two reasons. First, compiling without 12941optimization suppresses compiler passes that gather information 12942needed for effective optimization at link time. Second, some early 12943optimization passes can be performed only at compile time and 12944not at link time. 12945 12946There are some code generation flags preserved by GCC when 12947generating bytecodes, as they need to be used during the final link. 12948Currently, the following options and their settings are taken from 12949the first object file that explicitly specifies them: 12950@option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions}, 12951@option{-fgnu-tm} and all the @option{-m} target flags. 12952 12953The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and 12954@option{-fPIE} are combined based on the following scheme: 12955 12956@smallexample 12957@option{-fPIC} + @option{-fpic} = @option{-fpic} 12958@option{-fPIC} + @option{-fno-pic} = @option{-fno-pic} 12959@option{-fpic/-fPIC} + (no option) = (no option) 12960@option{-fPIC} + @option{-fPIE} = @option{-fPIE} 12961@option{-fpic} + @option{-fPIE} = @option{-fpie} 12962@option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie} 12963@end smallexample 12964 12965Certain ABI-changing flags are required to match in all compilation units, 12966and trying to override this at link time with a conflicting value 12967is ignored. This includes options such as @option{-freg-struct-return} 12968and @option{-fpcc-struct-return}. 12969 12970Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 12971@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 12972are passed through to the link stage and merged conservatively for 12973conflicting translation units. Specifically 12974@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 12975precedence; and for example @option{-ffp-contract=off} takes precedence 12976over @option{-ffp-contract=fast}. You can override them at link time. 12977 12978Diagnostic options such as @option{-Wstringop-overflow} are passed 12979through to the link stage and their setting matches that of the 12980compile-step at function granularity. Note that this matters only 12981for diagnostics emitted during optimization. Note that code 12982transforms such as inlining can lead to warnings being enabled 12983or disabled for regions if code not consistent with the setting 12984at compile time. 12985 12986When you need to pass options to the assembler via @option{-Wa} or 12987@option{-Xassembler} make sure to either compile such translation 12988units with @option{-fno-lto} or consistently use the same assembler 12989options on all translation units. You can alternatively also 12990specify assembler options at LTO link time. 12991 12992To enable debug info generation you need to supply @option{-g} at 12993compile time. If any of the input files at link time were built 12994with debug info generation enabled the link will enable debug info 12995generation as well. Any elaborate debug info settings 12996like the dwarf level @option{-gdwarf-5} need to be explicitly repeated 12997at the linker command line and mixing different settings in different 12998translation units is discouraged. 12999 13000If LTO encounters objects with C linkage declared with incompatible 13001types in separate translation units to be linked together (undefined 13002behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 13003issued. The behavior is still undefined at run time. Similar 13004diagnostics may be raised for other languages. 13005 13006Another feature of LTO is that it is possible to apply interprocedural 13007optimizations on files written in different languages: 13008 13009@smallexample 13010gcc -c -flto foo.c 13011g++ -c -flto bar.cc 13012gfortran -c -flto baz.f90 13013g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 13014@end smallexample 13015 13016Notice that the final link is done with @command{g++} to get the C++ 13017runtime libraries and @option{-lgfortran} is added to get the Fortran 13018runtime libraries. In general, when mixing languages in LTO mode, you 13019should use the same link command options as when mixing languages in a 13020regular (non-LTO) compilation. 13021 13022If object files containing GIMPLE bytecode are stored in a library archive, say 13023@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 13024are using a linker with plugin support. To create static libraries suitable 13025for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 13026and @command{ranlib}; 13027to show the symbols of object files with GIMPLE bytecode, use 13028@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 13029and @command{nm} have been compiled with plugin support. At link time, use the 13030flag @option{-fuse-linker-plugin} to ensure that the library participates in 13031the LTO optimization process: 13032 13033@smallexample 13034gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 13035@end smallexample 13036 13037With the linker plugin enabled, the linker extracts the needed 13038GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 13039to make them part of the aggregated GIMPLE image to be optimized. 13040 13041If you are not using a linker with plugin support and/or do not 13042enable the linker plugin, then the objects inside @file{libfoo.a} 13043are extracted and linked as usual, but they do not participate 13044in the LTO optimization process. In order to make a static library suitable 13045for both LTO optimization and usual linkage, compile its object files with 13046@option{-flto} @option{-ffat-lto-objects}. 13047 13048Link-time optimizations do not require the presence of the whole program to 13049operate. If the program does not require any symbols to be exported, it is 13050possible to combine @option{-flto} and @option{-fwhole-program} to allow 13051the interprocedural optimizers to use more aggressive assumptions which may 13052lead to improved optimization opportunities. 13053Use of @option{-fwhole-program} is not needed when linker plugin is 13054active (see @option{-fuse-linker-plugin}). 13055 13056The current implementation of LTO makes no 13057attempt to generate bytecode that is portable between different 13058types of hosts. The bytecode files are versioned and there is a 13059strict version check, so bytecode files generated in one version of 13060GCC do not work with an older or newer version of GCC. 13061 13062Link-time optimization does not work well with generation of debugging 13063information on systems other than those using a combination of ELF and 13064DWARF. 13065 13066If you specify the optional @var{n}, the optimization and code 13067generation done at link time is executed in parallel using @var{n} 13068parallel jobs by utilizing an installed @command{make} program. The 13069environment variable @env{MAKE} may be used to override the program 13070used. 13071 13072You can also specify @option{-flto=jobserver} to use GNU make's 13073job server mode to determine the number of parallel jobs. This 13074is useful when the Makefile calling GCC is already executing in parallel. 13075You must prepend a @samp{+} to the command recipe in the parent Makefile 13076for this to work. This option likely only works if @env{MAKE} is 13077GNU make. Even without the option value, GCC tries to automatically 13078detect a running GNU make's job server. 13079 13080Use @option{-flto=auto} to use GNU make's job server, if available, 13081or otherwise fall back to autodetection of the number of CPU threads 13082present in your system. 13083 13084@item -flto-partition=@var{alg} 13085@opindex flto-partition 13086Specify the partitioning algorithm used by the link-time optimizer. 13087The value is either @samp{1to1} to specify a partitioning mirroring 13088the original source files or @samp{balanced} to specify partitioning 13089into equally sized chunks (whenever possible) or @samp{max} to create 13090new partition for every symbol where possible. Specifying @samp{none} 13091as an algorithm disables partitioning and streaming completely. 13092The default value is @samp{balanced}. While @samp{1to1} can be used 13093as an workaround for various code ordering issues, the @samp{max} 13094partitioning is intended for internal testing only. 13095The value @samp{one} specifies that exactly one partition should be 13096used while the value @samp{none} bypasses partitioning and executes 13097the link-time optimization step directly from the WPA phase. 13098 13099@item -flto-compression-level=@var{n} 13100@opindex flto-compression-level 13101This option specifies the level of compression used for intermediate 13102language written to LTO object files, and is only meaningful in 13103conjunction with LTO mode (@option{-flto}). GCC currently supports two 13104LTO compression algorithms. For zstd, valid values are 0 (no compression) 13105to 19 (maximum compression), while zlib supports values from 0 to 9. 13106Values outside this range are clamped to either minimum or maximum 13107of the supported values. If the option is not given, 13108a default balanced compression setting is used. 13109 13110@item -fuse-linker-plugin 13111@opindex fuse-linker-plugin 13112Enables the use of a linker plugin during link-time optimization. This 13113option relies on plugin support in the linker, which is available in gold 13114or in GNU ld 2.21 or newer. 13115 13116This option enables the extraction of object files with GIMPLE bytecode out 13117of library archives. This improves the quality of optimization by exposing 13118more code to the link-time optimizer. This information specifies what 13119symbols can be accessed externally (by non-LTO object or during dynamic 13120linking). Resulting code quality improvements on binaries (and shared 13121libraries that use hidden visibility) are similar to @option{-fwhole-program}. 13122See @option{-flto} for a description of the effect of this flag and how to 13123use it. 13124 13125This option is enabled by default when LTO support in GCC is enabled 13126and GCC was configured for use with 13127a linker supporting plugins (GNU ld 2.21 or newer or gold). 13128 13129@item -ffat-lto-objects 13130@opindex ffat-lto-objects 13131Fat LTO objects are object files that contain both the intermediate language 13132and the object code. This makes them usable for both LTO linking and normal 13133linking. This option is effective only when compiling with @option{-flto} 13134and is ignored at link time. 13135 13136@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 13137requires the complete toolchain to be aware of LTO. It requires a linker with 13138linker plugin support for basic functionality. Additionally, 13139@command{nm}, @command{ar} and @command{ranlib} 13140need to support linker plugins to allow a full-featured build environment 13141(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 13142@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 13143to these tools. With non fat LTO makefiles need to be modified to use them. 13144 13145Note that modern binutils provide plugin auto-load mechanism. 13146Installing the linker plugin into @file{$libdir/bfd-plugins} has the same 13147effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and 13148@command{gcc-ranlib}). 13149 13150The default is @option{-fno-fat-lto-objects} on targets with linker plugin 13151support. 13152 13153@item -fcompare-elim 13154@opindex fcompare-elim 13155After register allocation and post-register allocation instruction splitting, 13156identify arithmetic instructions that compute processor flags similar to a 13157comparison operation based on that arithmetic. If possible, eliminate the 13158explicit comparison operation. 13159 13160This pass only applies to certain targets that cannot explicitly represent 13161the comparison operation before register allocation is complete. 13162 13163Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}. 13164 13165@item -fcprop-registers 13166@opindex fcprop-registers 13167After register allocation and post-register allocation instruction splitting, 13168perform a copy-propagation pass to try to reduce scheduling dependencies 13169and occasionally eliminate the copy. 13170 13171Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}. 13172 13173@item -fprofile-correction 13174@opindex fprofile-correction 13175Profiles collected using an instrumented binary for multi-threaded programs may 13176be inconsistent due to missed counter updates. When this option is specified, 13177GCC uses heuristics to correct or smooth out such inconsistencies. By 13178default, GCC emits an error message when an inconsistent profile is detected. 13179 13180This option is enabled by @option{-fauto-profile}. 13181 13182@item -fprofile-partial-training 13183@opindex fprofile-partial-training 13184With @code{-fprofile-use} all portions of programs not executed during train 13185run are optimized agressively for size rather than speed. In some cases it is 13186not practical to train all possible hot paths in the program. (For 13187example, program may contain functions specific for a given hardware and 13188trianing may not cover all hardware configurations program is run on.) With 13189@code{-fprofile-partial-training} profile feedback will be ignored for all 13190functions not executed during the train run leading them to be optimized as if 13191they were compiled without profile feedback. This leads to better performance 13192when train run is not representative but also leads to significantly bigger 13193code. 13194 13195@item -fprofile-use 13196@itemx -fprofile-use=@var{path} 13197@opindex fprofile-use 13198Enable profile feedback-directed optimizations, 13199and the following optimizations, many of which 13200are generally profitable only with profile feedback available: 13201 13202@gccoptlist{-fbranch-probabilities -fprofile-values @gol 13203-funroll-loops -fpeel-loops -ftracer -fvpt @gol 13204-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 13205-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 13206-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 13207-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 13208-fprofile-reorder-functions} 13209 13210Before you can use this option, you must first generate profiling information. 13211@xref{Instrumentation Options}, for information about the 13212@option{-fprofile-generate} option. 13213 13214By default, GCC emits an error message if the feedback profiles do not 13215match the source code. This error can be turned into a warning by using 13216@option{-Wno-error=coverage-mismatch}. Note this may result in poorly 13217optimized code. Additionally, by default, GCC also emits a warning message if 13218the feedback profiles do not exist (see @option{-Wmissing-profile}). 13219 13220If @var{path} is specified, GCC looks at the @var{path} to find 13221the profile feedback data files. See @option{-fprofile-dir}. 13222 13223@item -fauto-profile 13224@itemx -fauto-profile=@var{path} 13225@opindex fauto-profile 13226Enable sampling-based feedback-directed optimizations, 13227and the following optimizations, 13228many of which are generally profitable only with profile feedback available: 13229 13230@gccoptlist{-fbranch-probabilities -fprofile-values @gol 13231-funroll-loops -fpeel-loops -ftracer -fvpt @gol 13232-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol 13233-fpredictive-commoning -fsplit-loops -funswitch-loops @gol 13234-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol 13235-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol 13236-fprofile-correction} 13237 13238@var{path} is the name of a file containing AutoFDO profile information. 13239If omitted, it defaults to @file{fbdata.afdo} in the current directory. 13240 13241Producing an AutoFDO profile data file requires running your program 13242with the @command{perf} utility on a supported GNU/Linux target system. 13243For more information, see @uref{https://perf.wiki.kernel.org/}. 13244 13245E.g. 13246@smallexample 13247perf record -e br_inst_retired:near_taken -b -o perf.data \ 13248 -- your_program 13249@end smallexample 13250 13251Then use the @command{create_gcov} tool to convert the raw profile data 13252to a format that can be used by GCC.@ You must also supply the 13253unstripped binary for your program to this tool. 13254See @uref{https://github.com/google/autofdo}. 13255 13256E.g. 13257@smallexample 13258create_gcov --binary=your_program.unstripped --profile=perf.data \ 13259 --gcov=profile.afdo 13260@end smallexample 13261@end table 13262 13263The following options control compiler behavior regarding floating-point 13264arithmetic. These options trade off between speed and 13265correctness. All must be specifically enabled. 13266 13267@table @gcctabopt 13268@item -ffloat-store 13269@opindex ffloat-store 13270Do not store floating-point variables in registers, and inhibit other 13271options that might change whether a floating-point value is taken from a 13272register or memory. 13273 13274@cindex floating-point precision 13275This option prevents undesirable excess precision on machines such as 13276the 68000 where the floating registers (of the 68881) keep more 13277precision than a @code{double} is supposed to have. Similarly for the 13278x86 architecture. For most programs, the excess precision does only 13279good, but a few programs rely on the precise definition of IEEE floating 13280point. Use @option{-ffloat-store} for such programs, after modifying 13281them to store all pertinent intermediate computations into variables. 13282 13283@item -fexcess-precision=@var{style} 13284@opindex fexcess-precision 13285This option allows further control over excess precision on machines 13286where floating-point operations occur in a format with more precision or 13287range than the IEEE standard and interchange floating-point types. By 13288default, @option{-fexcess-precision=fast} is in effect; this means that 13289operations may be carried out in a wider precision than the types specified 13290in the source if that would result in faster code, and it is unpredictable 13291when rounding to the types specified in the source code takes place. 13292When compiling C, if @option{-fexcess-precision=standard} is specified then 13293excess precision follows the rules specified in ISO C99; in particular, 13294both casts and assignments cause values to be rounded to their 13295semantic types (whereas @option{-ffloat-store} only affects 13296assignments). This option is enabled by default for C if a strict 13297conformance option such as @option{-std=c99} is used. 13298@option{-ffast-math} enables @option{-fexcess-precision=fast} by default 13299regardless of whether a strict conformance option is used. 13300 13301@opindex mfpmath 13302@option{-fexcess-precision=standard} is not implemented for languages 13303other than C. On the x86, it has no effect if @option{-mfpmath=sse} 13304or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 13305semantics apply without excess precision, and in the latter, rounding 13306is unpredictable. 13307 13308@item -ffast-math 13309@opindex ffast-math 13310Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 13311@option{-ffinite-math-only}, @option{-fno-rounding-math}, 13312@option{-fno-signaling-nans}, @option{-fcx-limited-range} and 13313@option{-fexcess-precision=fast}. 13314 13315This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 13316 13317This option is not turned on by any @option{-O} option besides 13318@option{-Ofast} since it can result in incorrect output for programs 13319that depend on an exact implementation of IEEE or ISO rules/specifications 13320for math functions. It may, however, yield faster code for programs 13321that do not require the guarantees of these specifications. 13322 13323@item -fno-math-errno 13324@opindex fno-math-errno 13325@opindex fmath-errno 13326Do not set @code{errno} after calling math functions that are executed 13327with a single instruction, e.g., @code{sqrt}. A program that relies on 13328IEEE exceptions for math error handling may want to use this flag 13329for speed while maintaining IEEE arithmetic compatibility. 13330 13331This option is not turned on by any @option{-O} option since 13332it can result in incorrect output for programs that depend on 13333an exact implementation of IEEE or ISO rules/specifications for 13334math functions. It may, however, yield faster code for programs 13335that do not require the guarantees of these specifications. 13336 13337The default is @option{-fmath-errno}. 13338 13339On Darwin systems, the math library never sets @code{errno}. There is 13340therefore no reason for the compiler to consider the possibility that 13341it might, and @option{-fno-math-errno} is the default. 13342 13343@item -funsafe-math-optimizations 13344@opindex funsafe-math-optimizations 13345 13346Allow optimizations for floating-point arithmetic that (a) assume 13347that arguments and results are valid and (b) may violate IEEE or 13348ANSI standards. When used at link time, it may include libraries 13349or startup files that change the default FPU control word or other 13350similar optimizations. 13351 13352This option is not turned on by any @option{-O} option since 13353it can result in incorrect output for programs that depend on 13354an exact implementation of IEEE or ISO rules/specifications for 13355math functions. It may, however, yield faster code for programs 13356that do not require the guarantees of these specifications. 13357Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 13358@option{-fassociative-math} and @option{-freciprocal-math}. 13359 13360The default is @option{-fno-unsafe-math-optimizations}. 13361 13362@item -fassociative-math 13363@opindex fassociative-math 13364 13365Allow re-association of operands in series of floating-point operations. 13366This violates the ISO C and C++ language standard by possibly changing 13367computation result. NOTE: re-ordering may change the sign of zero as 13368well as ignore NaNs and inhibit or create underflow or overflow (and 13369thus cannot be used on code that relies on rounding behavior like 13370@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 13371and thus may not be used when ordered comparisons are required. 13372This option requires that both @option{-fno-signed-zeros} and 13373@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 13374much sense with @option{-frounding-math}. For Fortran the option 13375is automatically enabled when both @option{-fno-signed-zeros} and 13376@option{-fno-trapping-math} are in effect. 13377 13378The default is @option{-fno-associative-math}. 13379 13380@item -freciprocal-math 13381@opindex freciprocal-math 13382 13383Allow the reciprocal of a value to be used instead of dividing by 13384the value if this enables optimizations. For example @code{x / y} 13385can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 13386is subject to common subexpression elimination. Note that this loses 13387precision and increases the number of flops operating on the value. 13388 13389The default is @option{-fno-reciprocal-math}. 13390 13391@item -ffinite-math-only 13392@opindex ffinite-math-only 13393Allow optimizations for floating-point arithmetic that assume 13394that arguments and results are not NaNs or +-Infs. 13395 13396This option is not turned on by any @option{-O} option since 13397it can result in incorrect output for programs that depend on 13398an exact implementation of IEEE or ISO rules/specifications for 13399math functions. It may, however, yield faster code for programs 13400that do not require the guarantees of these specifications. 13401 13402The default is @option{-fno-finite-math-only}. 13403 13404@item -fno-signed-zeros 13405@opindex fno-signed-zeros 13406@opindex fsigned-zeros 13407Allow optimizations for floating-point arithmetic that ignore the 13408signedness of zero. IEEE arithmetic specifies the behavior of 13409distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 13410of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 13411This option implies that the sign of a zero result isn't significant. 13412 13413The default is @option{-fsigned-zeros}. 13414 13415@item -fno-trapping-math 13416@opindex fno-trapping-math 13417@opindex ftrapping-math 13418Compile code assuming that floating-point operations cannot generate 13419user-visible traps. These traps include division by zero, overflow, 13420underflow, inexact result and invalid operation. This option requires 13421that @option{-fno-signaling-nans} be in effect. Setting this option may 13422allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 13423 13424This option should never be turned on by any @option{-O} option since 13425it can result in incorrect output for programs that depend on 13426an exact implementation of IEEE or ISO rules/specifications for 13427math functions. 13428 13429The default is @option{-ftrapping-math}. 13430 13431@item -frounding-math 13432@opindex frounding-math 13433Disable transformations and optimizations that assume default floating-point 13434rounding behavior. This is round-to-zero for all floating point 13435to integer conversions, and round-to-nearest for all other arithmetic 13436truncations. This option should be specified for programs that change 13437the FP rounding mode dynamically, or that may be executed with a 13438non-default rounding mode. This option disables constant folding of 13439floating-point expressions at compile time (which may be affected by 13440rounding mode) and arithmetic transformations that are unsafe in the 13441presence of sign-dependent rounding modes. 13442 13443The default is @option{-fno-rounding-math}. 13444 13445This option is experimental and does not currently guarantee to 13446disable all GCC optimizations that are affected by rounding mode. 13447Future versions of GCC may provide finer control of this setting 13448using C99's @code{FENV_ACCESS} pragma. This command-line option 13449will be used to specify the default state for @code{FENV_ACCESS}. 13450 13451@item -fsignaling-nans 13452@opindex fsignaling-nans 13453Compile code assuming that IEEE signaling NaNs may generate user-visible 13454traps during floating-point operations. Setting this option disables 13455optimizations that may change the number of exceptions visible with 13456signaling NaNs. This option implies @option{-ftrapping-math}. 13457 13458This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 13459be defined. 13460 13461The default is @option{-fno-signaling-nans}. 13462 13463This option is experimental and does not currently guarantee to 13464disable all GCC optimizations that affect signaling NaN behavior. 13465 13466@item -fno-fp-int-builtin-inexact 13467@opindex fno-fp-int-builtin-inexact 13468@opindex ffp-int-builtin-inexact 13469Do not allow the built-in functions @code{ceil}, @code{floor}, 13470@code{round} and @code{trunc}, and their @code{float} and @code{long 13471double} variants, to generate code that raises the ``inexact'' 13472floating-point exception for noninteger arguments. ISO C99 and C11 13473allow these functions to raise the ``inexact'' exception, but ISO/IEC 13474TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into 13475ISO C2X, does not allow these functions to do so. 13476 13477The default is @option{-ffp-int-builtin-inexact}, allowing the 13478exception to be raised, unless C2X or a later C standard is selected. 13479This option does nothing unless @option{-ftrapping-math} is in effect. 13480 13481Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions 13482generate a call to a library function then the ``inexact'' exception 13483may be raised if the library implementation does not follow TS 18661. 13484 13485@item -fsingle-precision-constant 13486@opindex fsingle-precision-constant 13487Treat floating-point constants as single precision instead of 13488implicitly converting them to double-precision constants. 13489 13490@item -fcx-limited-range 13491@opindex fcx-limited-range 13492When enabled, this option states that a range reduction step is not 13493needed when performing complex division. Also, there is no checking 13494whether the result of a complex multiplication or division is @code{NaN 13495+ I*NaN}, with an attempt to rescue the situation in that case. The 13496default is @option{-fno-cx-limited-range}, but is enabled by 13497@option{-ffast-math}. 13498 13499This option controls the default setting of the ISO C99 13500@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 13501all languages. 13502 13503@item -fcx-fortran-rules 13504@opindex fcx-fortran-rules 13505Complex multiplication and division follow Fortran rules. Range 13506reduction is done as part of complex division, but there is no checking 13507whether the result of a complex multiplication or division is @code{NaN 13508+ I*NaN}, with an attempt to rescue the situation in that case. 13509 13510The default is @option{-fno-cx-fortran-rules}. 13511 13512@end table 13513 13514The following options control optimizations that may improve 13515performance, but are not enabled by any @option{-O} options. This 13516section includes experimental options that may produce broken code. 13517 13518@table @gcctabopt 13519@item -fbranch-probabilities 13520@opindex fbranch-probabilities 13521After running a program compiled with @option{-fprofile-arcs} 13522(@pxref{Instrumentation Options}), 13523you can compile it a second time using 13524@option{-fbranch-probabilities}, to improve optimizations based on 13525the number of times each branch was taken. When a program 13526compiled with @option{-fprofile-arcs} exits, it saves arc execution 13527counts to a file called @file{@var{sourcename}.gcda} for each source 13528file. The information in this data file is very dependent on the 13529structure of the generated code, so you must use the same source code 13530and the same optimization options for both compilations. 13531See details about the file naming in @option{-fprofile-arcs}. 13532 13533With @option{-fbranch-probabilities}, GCC puts a 13534@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 13535These can be used to improve optimization. Currently, they are only 13536used in one place: in @file{reorg.cc}, instead of guessing which path a 13537branch is most likely to take, the @samp{REG_BR_PROB} values are used to 13538exactly determine which path is taken more often. 13539 13540Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 13541 13542@item -fprofile-values 13543@opindex fprofile-values 13544If combined with @option{-fprofile-arcs}, it adds code so that some 13545data about values of expressions in the program is gathered. 13546 13547With @option{-fbranch-probabilities}, it reads back the data gathered 13548from profiling values of expressions for usage in optimizations. 13549 13550Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and 13551@option{-fauto-profile}. 13552 13553@item -fprofile-reorder-functions 13554@opindex fprofile-reorder-functions 13555Function reordering based on profile instrumentation collects 13556first time of execution of a function and orders these functions 13557in ascending order. 13558 13559Enabled with @option{-fprofile-use}. 13560 13561@item -fvpt 13562@opindex fvpt 13563If combined with @option{-fprofile-arcs}, this option instructs the compiler 13564to add code to gather information about values of expressions. 13565 13566With @option{-fbranch-probabilities}, it reads back the data gathered 13567and actually performs the optimizations based on them. 13568Currently the optimizations include specialization of division operations 13569using the knowledge about the value of the denominator. 13570 13571Enabled with @option{-fprofile-use} and @option{-fauto-profile}. 13572 13573@item -frename-registers 13574@opindex frename-registers 13575Attempt to avoid false dependencies in scheduled code by making use 13576of registers left over after register allocation. This optimization 13577most benefits processors with lots of registers. Depending on the 13578debug information format adopted by the target, however, it can 13579make debugging impossible, since variables no longer stay in 13580a ``home register''. 13581 13582Enabled by default with @option{-funroll-loops}. 13583 13584@item -fschedule-fusion 13585@opindex fschedule-fusion 13586Performs a target dependent pass over the instruction stream to schedule 13587instructions of same type together because target machine can execute them 13588more efficiently if they are adjacent to each other in the instruction flow. 13589 13590Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 13591 13592@item -ftracer 13593@opindex ftracer 13594Perform tail duplication to enlarge superblock size. This transformation 13595simplifies the control flow of the function allowing other optimizations to do 13596a better job. 13597 13598Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 13599 13600@item -funroll-loops 13601@opindex funroll-loops 13602Unroll loops whose number of iterations can be determined at compile time or 13603upon entry to the loop. @option{-funroll-loops} implies 13604@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 13605It also turns on complete loop peeling (i.e.@: complete removal of loops with 13606a small constant number of iterations). This option makes code larger, and may 13607or may not make it run faster. 13608 13609Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 13610 13611@item -funroll-all-loops 13612@opindex funroll-all-loops 13613Unroll all loops, even if their number of iterations is uncertain when 13614the loop is entered. This usually makes programs run more slowly. 13615@option{-funroll-all-loops} implies the same options as 13616@option{-funroll-loops}. 13617 13618@item -fpeel-loops 13619@opindex fpeel-loops 13620Peels loops for which there is enough information that they do not 13621roll much (from profile feedback or static analysis). It also turns on 13622complete loop peeling (i.e.@: complete removal of loops with small constant 13623number of iterations). 13624 13625Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}. 13626 13627@item -fmove-loop-invariants 13628@opindex fmove-loop-invariants 13629Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 13630at level @option{-O1} and higher, except for @option{-Og}. 13631 13632@item -fmove-loop-stores 13633@opindex fmove-loop-stores 13634Enables the loop store motion pass in the GIMPLE loop optimizer. This 13635moves invariant stores to after the end of the loop in exchange for 13636carrying the stored value in a register across the iteration. 13637Note for this option to have an effect @option{-ftree-loop-im} has to 13638be enabled as well. Enabled at level @option{-O1} and higher, except 13639for @option{-Og}. 13640 13641@item -fsplit-loops 13642@opindex fsplit-loops 13643Split a loop into two if it contains a condition that's always true 13644for one side of the iteration space and false for the other. 13645 13646Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 13647 13648@item -funswitch-loops 13649@opindex funswitch-loops 13650Move branches with loop invariant conditions out of the loop, with duplicates 13651of the loop on both branches (modified according to result of the condition). 13652 13653Enabled by @option{-fprofile-use} and @option{-fauto-profile}. 13654 13655@item -fversion-loops-for-strides 13656@opindex fversion-loops-for-strides 13657If a loop iterates over an array with a variable stride, create another 13658version of the loop that assumes the stride is always one. For example: 13659 13660@smallexample 13661for (int i = 0; i < n; ++i) 13662 x[i * stride] = @dots{}; 13663@end smallexample 13664 13665becomes: 13666 13667@smallexample 13668if (stride == 1) 13669 for (int i = 0; i < n; ++i) 13670 x[i] = @dots{}; 13671else 13672 for (int i = 0; i < n; ++i) 13673 x[i * stride] = @dots{}; 13674@end smallexample 13675 13676This is particularly useful for assumed-shape arrays in Fortran where 13677(for example) it allows better vectorization assuming contiguous accesses. 13678This flag is enabled by default at @option{-O3}. 13679It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. 13680 13681@item -ffunction-sections 13682@itemx -fdata-sections 13683@opindex ffunction-sections 13684@opindex fdata-sections 13685Place each function or data item into its own section in the output 13686file if the target supports arbitrary sections. The name of the 13687function or the name of the data item determines the section's name 13688in the output file. 13689 13690Use these options on systems where the linker can perform optimizations to 13691improve locality of reference in the instruction space. Most systems using the 13692ELF object format have linkers with such optimizations. On AIX, the linker 13693rearranges sections (CSECTs) based on the call graph. The performance impact 13694varies. 13695 13696Together with a linker garbage collection (linker @option{--gc-sections} 13697option) these options may lead to smaller statically-linked executables (after 13698stripping). 13699 13700On ELF/DWARF systems these options do not degenerate the quality of the debug 13701information. There could be issues with other object files/debug info formats. 13702 13703Only use these options when there are significant benefits from doing so. When 13704you specify these options, the assembler and linker create larger object and 13705executable files and are also slower. These options affect code generation. 13706They prevent optimizations by the compiler and assembler using relative 13707locations inside a translation unit since the locations are unknown until 13708link time. An example of such an optimization is relaxing calls to short call 13709instructions. 13710 13711@item -fstdarg-opt 13712@opindex fstdarg-opt 13713Optimize the prologue of variadic argument functions with respect to usage of 13714those arguments. 13715 13716@item -fsection-anchors 13717@opindex fsection-anchors 13718Try to reduce the number of symbolic address calculations by using 13719shared ``anchor'' symbols to address nearby objects. This transformation 13720can help to reduce the number of GOT entries and GOT accesses on some 13721targets. 13722 13723For example, the implementation of the following function @code{foo}: 13724 13725@smallexample 13726static int a, b, c; 13727int foo (void) @{ return a + b + c; @} 13728@end smallexample 13729 13730@noindent 13731usually calculates the addresses of all three variables, but if you 13732compile it with @option{-fsection-anchors}, it accesses the variables 13733from a common anchor point instead. The effect is similar to the 13734following pseudocode (which isn't valid C): 13735 13736@smallexample 13737int foo (void) 13738@{ 13739 register int *xr = &x; 13740 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 13741@} 13742@end smallexample 13743 13744Not all targets support this option. 13745 13746@item -fzero-call-used-regs=@var{choice} 13747@opindex fzero-call-used-regs 13748Zero call-used registers at function return to increase program 13749security by either mitigating Return-Oriented Programming (ROP) 13750attacks or preventing information leakage through registers. 13751 13752The possible values of @var{choice} are the same as for the 13753@code{zero_call_used_regs} attribute (@pxref{Function Attributes}). 13754The default is @samp{skip}. 13755 13756You can control this behavior for a specific function by using the function 13757attribute @code{zero_call_used_regs} (@pxref{Function Attributes}). 13758 13759@item --param @var{name}=@var{value} 13760@opindex param 13761In some places, GCC uses various constants to control the amount of 13762optimization that is done. For example, GCC does not inline functions 13763that contain more than a certain number of instructions. You can 13764control some of these constants on the command line using the 13765@option{--param} option. 13766 13767The names of specific parameters, and the meaning of the values, are 13768tied to the internals of the compiler, and are subject to change 13769without notice in future releases. 13770 13771In order to get minimal, maximal and default value of a parameter, 13772one can use @option{--help=param -Q} options. 13773 13774In each case, the @var{value} is an integer. The following choices 13775of @var{name} are recognized for all targets: 13776 13777@table @gcctabopt 13778@item predictable-branch-outcome 13779When branch is predicted to be taken with probability lower than this threshold 13780(in percent), then it is considered well predictable. 13781 13782@item max-rtl-if-conversion-insns 13783RTL if-conversion tries to remove conditional branches around a block and 13784replace them with conditionally executed instructions. This parameter 13785gives the maximum number of instructions in a block which should be 13786considered for if-conversion. The compiler will 13787also use other heuristics to decide whether if-conversion is likely to be 13788profitable. 13789 13790@item max-rtl-if-conversion-predictable-cost 13791RTL if-conversion will try to remove conditional branches around a block 13792and replace them with conditionally executed instructions. These parameters 13793give the maximum permissible cost for the sequence that would be generated 13794by if-conversion depending on whether the branch is statically determined 13795to be predictable or not. The units for this parameter are the same as 13796those for the GCC internal seq_cost metric. The compiler will try to 13797provide a reasonable default for this parameter using the BRANCH_COST 13798target macro. 13799 13800@item max-crossjump-edges 13801The maximum number of incoming edges to consider for cross-jumping. 13802The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 13803the number of edges incoming to each block. Increasing values mean 13804more aggressive optimization, making the compilation time increase with 13805probably small improvement in executable size. 13806 13807@item min-crossjump-insns 13808The minimum number of instructions that must be matched at the end 13809of two blocks before cross-jumping is performed on them. This 13810value is ignored in the case where all instructions in the block being 13811cross-jumped from are matched. 13812 13813@item max-grow-copy-bb-insns 13814The maximum code size expansion factor when copying basic blocks 13815instead of jumping. The expansion is relative to a jump instruction. 13816 13817@item max-goto-duplication-insns 13818The maximum number of instructions to duplicate to a block that jumps 13819to a computed goto. To avoid @math{O(N^2)} behavior in a number of 13820passes, GCC factors computed gotos early in the compilation process, 13821and unfactors them as late as possible. Only computed jumps at the 13822end of a basic blocks with no more than max-goto-duplication-insns are 13823unfactored. 13824 13825@item max-delay-slot-insn-search 13826The maximum number of instructions to consider when looking for an 13827instruction to fill a delay slot. If more than this arbitrary number of 13828instructions are searched, the time savings from filling the delay slot 13829are minimal, so stop searching. Increasing values mean more 13830aggressive optimization, making the compilation time increase with probably 13831small improvement in execution time. 13832 13833@item max-delay-slot-live-search 13834When trying to fill delay slots, the maximum number of instructions to 13835consider when searching for a block with valid live register 13836information. Increasing this arbitrarily chosen value means more 13837aggressive optimization, increasing the compilation time. This parameter 13838should be removed when the delay slot code is rewritten to maintain the 13839control-flow graph. 13840 13841@item max-gcse-memory 13842The approximate maximum amount of memory in @code{kB} that can be allocated in 13843order to perform the global common subexpression elimination 13844optimization. If more memory than specified is required, the 13845optimization is not done. 13846 13847@item max-gcse-insertion-ratio 13848If the ratio of expression insertions to deletions is larger than this value 13849for any expression, then RTL PRE inserts or removes the expression and thus 13850leaves partially redundant computations in the instruction stream. 13851 13852@item max-pending-list-length 13853The maximum number of pending dependencies scheduling allows 13854before flushing the current state and starting over. Large functions 13855with few branches or calls can create excessively large lists which 13856needlessly consume memory and resources. 13857 13858@item max-modulo-backtrack-attempts 13859The maximum number of backtrack attempts the scheduler should make 13860when modulo scheduling a loop. Larger values can exponentially increase 13861compilation time. 13862 13863@item max-inline-functions-called-once-loop-depth 13864Maximal loop depth of a call considered by inline heuristics that tries to 13865inline all functions called once. 13866 13867@item max-inline-functions-called-once-insns 13868Maximal estimated size of functions produced while inlining functions called 13869once. 13870 13871@item max-inline-insns-single 13872Several parameters control the tree inliner used in GCC@. This number sets the 13873maximum number of instructions (counted in GCC's internal representation) in a 13874single function that the tree inliner considers for inlining. This only 13875affects functions declared inline and methods implemented in a class 13876declaration (C++). 13877 13878 13879@item max-inline-insns-auto 13880When you use @option{-finline-functions} (included in @option{-O3}), 13881a lot of functions that would otherwise not be considered for inlining 13882by the compiler are investigated. To those functions, a different 13883(more restrictive) limit compared to functions declared inline can 13884be applied (@option{--param max-inline-insns-auto}). 13885 13886@item max-inline-insns-small 13887This is bound applied to calls which are considered relevant with 13888@option{-finline-small-functions}. 13889 13890@item max-inline-insns-size 13891This is bound applied to calls which are optimized for size. Small growth 13892may be desirable to anticipate optimization oppurtunities exposed by inlining. 13893 13894@item uninlined-function-insns 13895Number of instructions accounted by inliner for function overhead such as 13896function prologue and epilogue. 13897 13898@item uninlined-function-time 13899Extra time accounted by inliner for function overhead such as time needed to 13900execute function prologue and epilogue. 13901 13902@item inline-heuristics-hint-percent 13903The scale (in percents) applied to @option{inline-insns-single}, 13904@option{inline-insns-single-O2}, @option{inline-insns-auto} 13905when inline heuristics hints that inlining is 13906very profitable (will enable later optimizations). 13907 13908@item uninlined-thunk-insns 13909@item uninlined-thunk-time 13910Same as @option{--param uninlined-function-insns} and 13911@option{--param uninlined-function-time} but applied to function thunks. 13912 13913@item inline-min-speedup 13914When estimated performance improvement of caller + callee runtime exceeds this 13915threshold (in percent), the function can be inlined regardless of the limit on 13916@option{--param max-inline-insns-single} and @option{--param 13917max-inline-insns-auto}. 13918 13919@item large-function-insns 13920The limit specifying really large functions. For functions larger than this 13921limit after inlining, inlining is constrained by 13922@option{--param large-function-growth}. This parameter is useful primarily 13923to avoid extreme compilation time caused by non-linear algorithms used by the 13924back end. 13925 13926@item large-function-growth 13927Specifies maximal growth of large function caused by inlining in percents. 13928For example, parameter value 100 limits large function growth to 2.0 times 13929the original size. 13930 13931@item large-unit-insns 13932The limit specifying large translation unit. Growth caused by inlining of 13933units larger than this limit is limited by @option{--param inline-unit-growth}. 13934For small units this might be too tight. 13935For example, consider a unit consisting of function A 13936that is inline and B that just calls A three times. If B is small relative to 13937A, the growth of unit is 300\% and yet such inlining is very sane. For very 13938large units consisting of small inlineable functions, however, the overall unit 13939growth limit is needed to avoid exponential explosion of code size. Thus for 13940smaller units, the size is increased to @option{--param large-unit-insns} 13941before applying @option{--param inline-unit-growth}. 13942 13943@item lazy-modules 13944Maximum number of concurrently open C++ module files when lazy loading. 13945 13946@item inline-unit-growth 13947Specifies maximal overall growth of the compilation unit caused by inlining. 13948For example, parameter value 20 limits unit growth to 1.2 times the original 13949size. Cold functions (either marked cold via an attribute or by profile 13950feedback) are not accounted into the unit size. 13951 13952@item ipa-cp-unit-growth 13953Specifies maximal overall growth of the compilation unit caused by 13954interprocedural constant propagation. For example, parameter value 10 limits 13955unit growth to 1.1 times the original size. 13956 13957@item ipa-cp-large-unit-insns 13958The size of translation unit that IPA-CP pass considers large. 13959 13960@item large-stack-frame 13961The limit specifying large stack frames. While inlining the algorithm is trying 13962to not grow past this limit too much. 13963 13964@item large-stack-frame-growth 13965Specifies maximal growth of large stack frames caused by inlining in percents. 13966For example, parameter value 1000 limits large stack frame growth to 11 times 13967the original size. 13968 13969@item max-inline-insns-recursive 13970@itemx max-inline-insns-recursive-auto 13971Specifies the maximum number of instructions an out-of-line copy of a 13972self-recursive inline 13973function can grow into by performing recursive inlining. 13974 13975@option{--param max-inline-insns-recursive} applies to functions 13976declared inline. 13977For functions not declared inline, recursive inlining 13978happens only when @option{-finline-functions} (included in @option{-O3}) is 13979enabled; @option{--param max-inline-insns-recursive-auto} applies instead. 13980 13981@item max-inline-recursive-depth 13982@itemx max-inline-recursive-depth-auto 13983Specifies the maximum recursion depth used for recursive inlining. 13984 13985@option{--param max-inline-recursive-depth} applies to functions 13986declared inline. For functions not declared inline, recursive inlining 13987happens only when @option{-finline-functions} (included in @option{-O3}) is 13988enabled; @option{--param max-inline-recursive-depth-auto} applies instead. 13989 13990@item min-inline-recursive-probability 13991Recursive inlining is profitable only for function having deep recursion 13992in average and can hurt for function having little recursion depth by 13993increasing the prologue size or complexity of function body to other 13994optimizers. 13995 13996When profile feedback is available (see @option{-fprofile-generate}) the actual 13997recursion depth can be guessed from the probability that function recurses 13998via a given call expression. This parameter limits inlining only to call 13999expressions whose probability exceeds the given threshold (in percents). 14000 14001@item early-inlining-insns 14002Specify growth that the early inliner can make. In effect it increases 14003the amount of inlining for code having a large abstraction penalty. 14004 14005@item max-early-inliner-iterations 14006Limit of iterations of the early inliner. This basically bounds 14007the number of nested indirect calls the early inliner can resolve. 14008Deeper chains are still handled by late inlining. 14009 14010@item comdat-sharing-probability 14011Probability (in percent) that C++ inline function with comdat visibility 14012are shared across multiple compilation units. 14013 14014@item modref-max-bases 14015@item modref-max-refs 14016@item modref-max-accesses 14017Specifies the maximal number of base pointers, references and accesses stored 14018for a single function by mod/ref analysis. 14019 14020@item modref-max-tests 14021Specifies the maxmal number of tests alias oracle can perform to disambiguate 14022memory locations using the mod/ref information. This parameter ought to be 14023bigger than @option{--param modref-max-bases} and @option{--param 14024modref-max-refs}. 14025 14026@item modref-max-depth 14027Specifies the maximum depth of DFS walk used by modref escape analysis. 14028Setting to 0 disables the analysis completely. 14029 14030@item modref-max-escape-points 14031Specifies the maximum number of escape points tracked by modref per SSA-name. 14032 14033@item modref-max-adjustments 14034Specifies the maximum number the access range is enlarged during modref dataflow 14035analysis. 14036 14037@item profile-func-internal-id 14038A parameter to control whether to use function internal id in profile 14039database lookup. If the value is 0, the compiler uses an id that 14040is based on function assembler name and filename, which makes old profile 14041data more tolerant to source changes such as function reordering etc. 14042 14043@item min-vect-loop-bound 14044The minimum number of iterations under which loops are not vectorized 14045when @option{-ftree-vectorize} is used. The number of iterations after 14046vectorization needs to be greater than the value specified by this option 14047to allow vectorization. 14048 14049@item gcse-cost-distance-ratio 14050Scaling factor in calculation of maximum distance an expression 14051can be moved by GCSE optimizations. This is currently supported only in the 14052code hoisting pass. The bigger the ratio, the more aggressive code hoisting 14053is with simple expressions, i.e., the expressions that have cost 14054less than @option{gcse-unrestricted-cost}. Specifying 0 disables 14055hoisting of simple expressions. 14056 14057@item gcse-unrestricted-cost 14058Cost, roughly measured as the cost of a single typical machine 14059instruction, at which GCSE optimizations do not constrain 14060the distance an expression can travel. This is currently 14061supported only in the code hoisting pass. The lesser the cost, 14062the more aggressive code hoisting is. Specifying 0 14063allows all expressions to travel unrestricted distances. 14064 14065@item max-hoist-depth 14066The depth of search in the dominator tree for expressions to hoist. 14067This is used to avoid quadratic behavior in hoisting algorithm. 14068The value of 0 does not limit on the search, but may slow down compilation 14069of huge functions. 14070 14071@item max-tail-merge-comparisons 14072The maximum amount of similar bbs to compare a bb with. This is used to 14073avoid quadratic behavior in tree tail merging. 14074 14075@item max-tail-merge-iterations 14076The maximum amount of iterations of the pass over the function. This is used to 14077limit compilation time in tree tail merging. 14078 14079@item store-merging-allow-unaligned 14080Allow the store merging pass to introduce unaligned stores if it is legal to 14081do so. 14082 14083@item max-stores-to-merge 14084The maximum number of stores to attempt to merge into wider stores in the store 14085merging pass. 14086 14087@item max-store-chains-to-track 14088The maximum number of store chains to track at the same time in the attempt 14089to merge them into wider stores in the store merging pass. 14090 14091@item max-stores-to-track 14092The maximum number of stores to track at the same time in the attemt to 14093to merge them into wider stores in the store merging pass. 14094 14095@item max-unrolled-insns 14096The maximum number of instructions that a loop may have to be unrolled. 14097If a loop is unrolled, this parameter also determines how many times 14098the loop code is unrolled. 14099 14100@item max-average-unrolled-insns 14101The maximum number of instructions biased by probabilities of their execution 14102that a loop may have to be unrolled. If a loop is unrolled, 14103this parameter also determines how many times the loop code is unrolled. 14104 14105@item max-unroll-times 14106The maximum number of unrollings of a single loop. 14107 14108@item max-peeled-insns 14109The maximum number of instructions that a loop may have to be peeled. 14110If a loop is peeled, this parameter also determines how many times 14111the loop code is peeled. 14112 14113@item max-peel-times 14114The maximum number of peelings of a single loop. 14115 14116@item max-peel-branches 14117The maximum number of branches on the hot path through the peeled sequence. 14118 14119@item max-completely-peeled-insns 14120The maximum number of insns of a completely peeled loop. 14121 14122@item max-completely-peel-times 14123The maximum number of iterations of a loop to be suitable for complete peeling. 14124 14125@item max-completely-peel-loop-nest-depth 14126The maximum depth of a loop nest suitable for complete peeling. 14127 14128@item max-unswitch-insns 14129The maximum number of insns of an unswitched loop. 14130 14131@item max-unswitch-level 14132The maximum number of branches unswitched in a single loop. 14133 14134@item lim-expensive 14135The minimum cost of an expensive expression in the loop invariant motion. 14136 14137@item min-loop-cond-split-prob 14138When FDO profile information is available, @option{min-loop-cond-split-prob} 14139specifies minimum threshold for probability of semi-invariant condition 14140statement to trigger loop split. 14141 14142@item iv-consider-all-candidates-bound 14143Bound on number of candidates for induction variables, below which 14144all candidates are considered for each use in induction variable 14145optimizations. If there are more candidates than this, 14146only the most relevant ones are considered to avoid quadratic time complexity. 14147 14148@item iv-max-considered-uses 14149The induction variable optimizations give up on loops that contain more 14150induction variable uses. 14151 14152@item iv-always-prune-cand-set-bound 14153If the number of candidates in the set is smaller than this value, 14154always try to remove unnecessary ivs from the set 14155when adding a new one. 14156 14157@item avg-loop-niter 14158Average number of iterations of a loop. 14159 14160@item dse-max-object-size 14161Maximum size (in bytes) of objects tracked bytewise by dead store elimination. 14162Larger values may result in larger compilation times. 14163 14164@item dse-max-alias-queries-per-store 14165Maximum number of queries into the alias oracle per store. 14166Larger values result in larger compilation times and may result in more 14167removed dead stores. 14168 14169@item scev-max-expr-size 14170Bound on size of expressions used in the scalar evolutions analyzer. 14171Large expressions slow the analyzer. 14172 14173@item scev-max-expr-complexity 14174Bound on the complexity of the expressions in the scalar evolutions analyzer. 14175Complex expressions slow the analyzer. 14176 14177@item max-tree-if-conversion-phi-args 14178Maximum number of arguments in a PHI supported by TREE if conversion 14179unless the loop is marked with simd pragma. 14180 14181@item vect-max-version-for-alignment-checks 14182The maximum number of run-time checks that can be performed when 14183doing loop versioning for alignment in the vectorizer. 14184 14185@item vect-max-version-for-alias-checks 14186The maximum number of run-time checks that can be performed when 14187doing loop versioning for alias in the vectorizer. 14188 14189@item vect-max-peeling-for-alignment 14190The maximum number of loop peels to enhance access alignment 14191for vectorizer. Value -1 means no limit. 14192 14193@item max-iterations-to-track 14194The maximum number of iterations of a loop the brute-force algorithm 14195for analysis of the number of iterations of the loop tries to evaluate. 14196 14197@item hot-bb-count-fraction 14198The denominator n of fraction 1/n of the maximal execution count of a 14199basic block in the entire program that a basic block needs to at least 14200have in order to be considered hot. The default is 10000, which means 14201that a basic block is considered hot if its execution count is greater 14202than 1/10000 of the maximal execution count. 0 means that it is never 14203considered hot. Used in non-LTO mode. 14204 14205@item hot-bb-count-ws-permille 14206The number of most executed permilles, ranging from 0 to 1000, of the 14207profiled execution of the entire program to which the execution count 14208of a basic block must be part of in order to be considered hot. The 14209default is 990, which means that a basic block is considered hot if 14210its execution count contributes to the upper 990 permilles, or 99.0%, 14211of the profiled execution of the entire program. 0 means that it is 14212never considered hot. Used in LTO mode. 14213 14214@item hot-bb-frequency-fraction 14215The denominator n of fraction 1/n of the execution frequency of the 14216entry block of a function that a basic block of this function needs 14217to at least have in order to be considered hot. The default is 1000, 14218which means that a basic block is considered hot in a function if it 14219is executed more frequently than 1/1000 of the frequency of the entry 14220block of the function. 0 means that it is never considered hot. 14221 14222@item unlikely-bb-count-fraction 14223The denominator n of fraction 1/n of the number of profiled runs of 14224the entire program below which the execution count of a basic block 14225must be in order for the basic block to be considered unlikely executed. 14226The default is 20, which means that a basic block is considered unlikely 14227executed if it is executed in fewer than 1/20, or 5%, of the runs of 14228the program. 0 means that it is always considered unlikely executed. 14229 14230@item max-predicted-iterations 14231The maximum number of loop iterations we predict statically. This is useful 14232in cases where a function contains a single loop with known bound and 14233another loop with unknown bound. 14234The known number of iterations is predicted correctly, while 14235the unknown number of iterations average to roughly 10. This means that the 14236loop without bounds appears artificially cold relative to the other one. 14237 14238@item builtin-expect-probability 14239Control the probability of the expression having the specified value. This 14240parameter takes a percentage (i.e.@: 0 ... 100) as input. 14241 14242@item builtin-string-cmp-inline-length 14243The maximum length of a constant string for a builtin string cmp call 14244eligible for inlining. 14245 14246@item align-threshold 14247 14248Select fraction of the maximal frequency of executions of a basic block in 14249a function to align the basic block. 14250 14251@item align-loop-iterations 14252 14253A loop expected to iterate at least the selected number of iterations is 14254aligned. 14255 14256@item tracer-dynamic-coverage 14257@itemx tracer-dynamic-coverage-feedback 14258 14259This value is used to limit superblock formation once the given percentage of 14260executed instructions is covered. This limits unnecessary code size 14261expansion. 14262 14263The @option{tracer-dynamic-coverage-feedback} parameter 14264is used only when profile 14265feedback is available. The real profiles (as opposed to statically estimated 14266ones) are much less balanced allowing the threshold to be larger value. 14267 14268@item tracer-max-code-growth 14269Stop tail duplication once code growth has reached given percentage. This is 14270a rather artificial limit, as most of the duplicates are eliminated later in 14271cross jumping, so it may be set to much higher values than is the desired code 14272growth. 14273 14274@item tracer-min-branch-ratio 14275 14276Stop reverse growth when the reverse probability of best edge is less than this 14277threshold (in percent). 14278 14279@item tracer-min-branch-probability 14280@itemx tracer-min-branch-probability-feedback 14281 14282Stop forward growth if the best edge has probability lower than this 14283threshold. 14284 14285Similarly to @option{tracer-dynamic-coverage} two parameters are 14286provided. @option{tracer-min-branch-probability-feedback} is used for 14287compilation with profile feedback and @option{tracer-min-branch-probability} 14288compilation without. The value for compilation with profile feedback 14289needs to be more conservative (higher) in order to make tracer 14290effective. 14291 14292@item stack-clash-protection-guard-size 14293Specify the size of the operating system provided stack guard as 142942 raised to @var{num} bytes. Higher values may reduce the 14295number of explicit probes, but a value larger than the operating system 14296provided guard will leave code vulnerable to stack clash style attacks. 14297 14298@item stack-clash-protection-probe-interval 14299Stack clash protection involves probing stack space as it is allocated. This 14300param controls the maximum distance between probes into the stack as 2 raised 14301to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value 14302larger than the operating system provided guard will leave code vulnerable to 14303stack clash style attacks. 14304 14305@item max-cse-path-length 14306 14307The maximum number of basic blocks on path that CSE considers. 14308 14309@item max-cse-insns 14310The maximum number of instructions CSE processes before flushing. 14311 14312@item ggc-min-expand 14313 14314GCC uses a garbage collector to manage its own memory allocation. This 14315parameter specifies the minimum percentage by which the garbage 14316collector's heap should be allowed to expand between collections. 14317Tuning this may improve compilation speed; it has no effect on code 14318generation. 14319 14320The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 14321RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 14322the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 14323GCC is not able to calculate RAM on a particular platform, the lower 14324bound of 30% is used. Setting this parameter and 14325@option{ggc-min-heapsize} to zero causes a full collection to occur at 14326every opportunity. This is extremely slow, but can be useful for 14327debugging. 14328 14329@item ggc-min-heapsize 14330 14331Minimum size of the garbage collector's heap before it begins bothering 14332to collect garbage. The first collection occurs after the heap expands 14333by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 14334tuning this may improve compilation speed, and has no effect on code 14335generation. 14336 14337The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 14338tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 14339with a lower bound of 4096 (four megabytes) and an upper bound of 14340131072 (128 megabytes). If GCC is not able to calculate RAM on a 14341particular platform, the lower bound is used. Setting this parameter 14342very large effectively disables garbage collection. Setting this 14343parameter and @option{ggc-min-expand} to zero causes a full collection 14344to occur at every opportunity. 14345 14346@item max-reload-search-insns 14347The maximum number of instruction reload should look backward for equivalent 14348register. Increasing values mean more aggressive optimization, making the 14349compilation time increase with probably slightly better performance. 14350 14351@item max-cselib-memory-locations 14352The maximum number of memory locations cselib should take into account. 14353Increasing values mean more aggressive optimization, making the compilation time 14354increase with probably slightly better performance. 14355 14356@item max-sched-ready-insns 14357The maximum number of instructions ready to be issued the scheduler should 14358consider at any given time during the first scheduling pass. Increasing 14359values mean more thorough searches, making the compilation time increase 14360with probably little benefit. 14361 14362@item max-sched-region-blocks 14363The maximum number of blocks in a region to be considered for 14364interblock scheduling. 14365 14366@item max-pipeline-region-blocks 14367The maximum number of blocks in a region to be considered for 14368pipelining in the selective scheduler. 14369 14370@item max-sched-region-insns 14371The maximum number of insns in a region to be considered for 14372interblock scheduling. 14373 14374@item max-pipeline-region-insns 14375The maximum number of insns in a region to be considered for 14376pipelining in the selective scheduler. 14377 14378@item min-spec-prob 14379The minimum probability (in percents) of reaching a source block 14380for interblock speculative scheduling. 14381 14382@item max-sched-extend-regions-iters 14383The maximum number of iterations through CFG to extend regions. 14384A value of 0 disables region extensions. 14385 14386@item max-sched-insn-conflict-delay 14387The maximum conflict delay for an insn to be considered for speculative motion. 14388 14389@item sched-spec-prob-cutoff 14390The minimal probability of speculation success (in percents), so that 14391speculative insns are scheduled. 14392 14393@item sched-state-edge-prob-cutoff 14394The minimum probability an edge must have for the scheduler to save its 14395state across it. 14396 14397@item sched-mem-true-dep-cost 14398Minimal distance (in CPU cycles) between store and load targeting same 14399memory locations. 14400 14401@item selsched-max-lookahead 14402The maximum size of the lookahead window of selective scheduling. It is a 14403depth of search for available instructions. 14404 14405@item selsched-max-sched-times 14406The maximum number of times that an instruction is scheduled during 14407selective scheduling. This is the limit on the number of iterations 14408through which the instruction may be pipelined. 14409 14410@item selsched-insns-to-rename 14411The maximum number of best instructions in the ready list that are considered 14412for renaming in the selective scheduler. 14413 14414@item sms-min-sc 14415The minimum value of stage count that swing modulo scheduler 14416generates. 14417 14418@item max-last-value-rtl 14419The maximum size measured as number of RTLs that can be recorded in an expression 14420in combiner for a pseudo register as last known value of that register. 14421 14422@item max-combine-insns 14423The maximum number of instructions the RTL combiner tries to combine. 14424 14425@item integer-share-limit 14426Small integer constants can use a shared data structure, reducing the 14427compiler's memory usage and increasing its speed. This sets the maximum 14428value of a shared integer constant. 14429 14430@item ssp-buffer-size 14431The minimum size of buffers (i.e.@: arrays) that receive stack smashing 14432protection when @option{-fstack-protector} is used. 14433 14434@item min-size-for-stack-sharing 14435The minimum size of variables taking part in stack slot sharing when not 14436optimizing. 14437 14438@item max-jump-thread-duplication-stmts 14439Maximum number of statements allowed in a block that needs to be 14440duplicated when threading jumps. 14441 14442@item max-fields-for-field-sensitive 14443Maximum number of fields in a structure treated in 14444a field sensitive manner during pointer analysis. 14445 14446@item prefetch-latency 14447Estimate on average number of instructions that are executed before 14448prefetch finishes. The distance prefetched ahead is proportional 14449to this constant. Increasing this number may also lead to less 14450streams being prefetched (see @option{simultaneous-prefetches}). 14451 14452@item simultaneous-prefetches 14453Maximum number of prefetches that can run at the same time. 14454 14455@item l1-cache-line-size 14456The size of cache line in L1 data cache, in bytes. 14457 14458@item l1-cache-size 14459The size of L1 data cache, in kilobytes. 14460 14461@item l2-cache-size 14462The size of L2 data cache, in kilobytes. 14463 14464@item prefetch-dynamic-strides 14465Whether the loop array prefetch pass should issue software prefetch hints 14466for strides that are non-constant. In some cases this may be 14467beneficial, though the fact the stride is non-constant may make it 14468hard to predict when there is clear benefit to issuing these hints. 14469 14470Set to 1 if the prefetch hints should be issued for non-constant 14471strides. Set to 0 if prefetch hints should be issued only for strides that 14472are known to be constant and below @option{prefetch-minimum-stride}. 14473 14474@item prefetch-minimum-stride 14475Minimum constant stride, in bytes, to start using prefetch hints for. If 14476the stride is less than this threshold, prefetch hints will not be issued. 14477 14478This setting is useful for processors that have hardware prefetchers, in 14479which case there may be conflicts between the hardware prefetchers and 14480the software prefetchers. If the hardware prefetchers have a maximum 14481stride they can handle, it should be used here to improve the use of 14482software prefetchers. 14483 14484A value of -1 means we don't have a threshold and therefore 14485prefetch hints can be issued for any constant stride. 14486 14487This setting is only useful for strides that are known and constant. 14488 14489@item destructive-interference-size 14490@item constructive-interference-size 14491The values for the C++17 variables 14492@code{std::hardware_destructive_interference_size} and 14493@code{std::hardware_constructive_interference_size}. The destructive 14494interference size is the minimum recommended offset between two 14495independent concurrently-accessed objects; the constructive 14496interference size is the maximum recommended size of contiguous memory 14497accessed together. Typically both will be the size of an L1 cache 14498line for the target, in bytes. For a generic target covering a range of L1 14499cache line sizes, typically the constructive interference size will be 14500the small end of the range and the destructive size will be the large 14501end. 14502 14503The destructive interference size is intended to be used for layout, 14504and thus has ABI impact. The default value is not expected to be 14505stable, and on some targets varies with @option{-mtune}, so use of 14506this variable in a context where ABI stability is important, such as 14507the public interface of a library, is strongly discouraged; if it is 14508used in that context, users can stabilize the value using this 14509option. 14510 14511The constructive interference size is less sensitive, as it is 14512typically only used in a @samp{static_assert} to make sure that a type 14513fits within a cache line. 14514 14515See also @option{-Winterference-size}. 14516 14517@item loop-interchange-max-num-stmts 14518The maximum number of stmts in a loop to be interchanged. 14519 14520@item loop-interchange-stride-ratio 14521The minimum ratio between stride of two loops for interchange to be profitable. 14522 14523@item min-insn-to-prefetch-ratio 14524The minimum ratio between the number of instructions and the 14525number of prefetches to enable prefetching in a loop. 14526 14527@item prefetch-min-insn-to-mem-ratio 14528The minimum ratio between the number of instructions and the 14529number of memory references to enable prefetching in a loop. 14530 14531@item use-canonical-types 14532Whether the compiler should use the ``canonical'' type system. 14533Should always be 1, which uses a more efficient internal 14534mechanism for comparing types in C++ and Objective-C++. However, if 14535bugs in the canonical type system are causing compilation failures, 14536set this value to 0 to disable canonical types. 14537 14538@item switch-conversion-max-branch-ratio 14539Switch initialization conversion refuses to create arrays that are 14540bigger than @option{switch-conversion-max-branch-ratio} times the number of 14541branches in the switch. 14542 14543@item max-partial-antic-length 14544Maximum length of the partial antic set computed during the tree 14545partial redundancy elimination optimization (@option{-ftree-pre}) when 14546optimizing at @option{-O3} and above. For some sorts of source code 14547the enhanced partial redundancy elimination optimization can run away, 14548consuming all of the memory available on the host machine. This 14549parameter sets a limit on the length of the sets that are computed, 14550which prevents the runaway behavior. Setting a value of 0 for 14551this parameter allows an unlimited set length. 14552 14553@item rpo-vn-max-loop-depth 14554Maximum loop depth that is value-numbered optimistically. 14555When the limit hits the innermost 14556@var{rpo-vn-max-loop-depth} loops and the outermost loop in the 14557loop nest are value-numbered optimistically and the remaining ones not. 14558 14559@item sccvn-max-alias-queries-per-access 14560Maximum number of alias-oracle queries we perform when looking for 14561redundancies for loads and stores. If this limit is hit the search 14562is aborted and the load or store is not considered redundant. The 14563number of queries is algorithmically limited to the number of 14564stores on all paths from the load to the function entry. 14565 14566@item ira-max-loops-num 14567IRA uses regional register allocation by default. If a function 14568contains more loops than the number given by this parameter, only at most 14569the given number of the most frequently-executed loops form regions 14570for regional register allocation. 14571 14572@item ira-max-conflict-table-size 14573Although IRA uses a sophisticated algorithm to compress the conflict 14574table, the table can still require excessive amounts of memory for 14575huge functions. If the conflict table for a function could be more 14576than the size in MB given by this parameter, the register allocator 14577instead uses a faster, simpler, and lower-quality 14578algorithm that does not require building a pseudo-register conflict table. 14579 14580@item ira-loop-reserved-regs 14581IRA can be used to evaluate more accurate register pressure in loops 14582for decisions to move loop invariants (see @option{-O3}). The number 14583of available registers reserved for some other purposes is given 14584by this parameter. Default of the parameter 14585is the best found from numerous experiments. 14586 14587@item ira-consider-dup-in-all-alts 14588Make IRA to consider matching constraint (duplicated operand number) 14589heavily in all available alternatives for preferred register class. 14590If it is set as zero, it means IRA only respects the matching 14591constraint when it's in the only available alternative with an 14592appropriate register class. Otherwise, it means IRA will check all 14593available alternatives for preferred register class even if it has 14594found some choice with an appropriate register class and respect the 14595found qualified matching constraint. 14596 14597@item lra-inheritance-ebb-probability-cutoff 14598LRA tries to reuse values reloaded in registers in subsequent insns. 14599This optimization is called inheritance. EBB is used as a region to 14600do this optimization. The parameter defines a minimal fall-through 14601edge probability in percentage used to add BB to inheritance EBB in 14602LRA. The default value was chosen 14603from numerous runs of SPEC2000 on x86-64. 14604 14605@item loop-invariant-max-bbs-in-loop 14606Loop invariant motion can be very expensive, both in compilation time and 14607in amount of needed compile-time memory, with very large loops. Loops 14608with more basic blocks than this parameter won't have loop invariant 14609motion optimization performed on them. 14610 14611@item loop-max-datarefs-for-datadeps 14612Building data dependencies is expensive for very large loops. This 14613parameter limits the number of data references in loops that are 14614considered for data dependence analysis. These large loops are no 14615handled by the optimizations using loop data dependencies. 14616 14617@item max-vartrack-size 14618Sets a maximum number of hash table slots to use during variable 14619tracking dataflow analysis of any function. If this limit is exceeded 14620with variable tracking at assignments enabled, analysis for that 14621function is retried without it, after removing all debug insns from 14622the function. If the limit is exceeded even without debug insns, var 14623tracking analysis is completely disabled for the function. Setting 14624the parameter to zero makes it unlimited. 14625 14626@item max-vartrack-expr-depth 14627Sets a maximum number of recursion levels when attempting to map 14628variable names or debug temporaries to value expressions. This trades 14629compilation time for more complete debug information. If this is set too 14630low, value expressions that are available and could be represented in 14631debug information may end up not being used; setting this higher may 14632enable the compiler to find more complex debug expressions, but compile 14633time and memory use may grow. 14634 14635@item max-debug-marker-count 14636Sets a threshold on the number of debug markers (e.g.@: begin stmt 14637markers) to avoid complexity explosion at inlining or expanding to RTL. 14638If a function has more such gimple stmts than the set limit, such stmts 14639will be dropped from the inlined copy of a function, and from its RTL 14640expansion. 14641 14642@item min-nondebug-insn-uid 14643Use uids starting at this parameter for nondebug insns. The range below 14644the parameter is reserved exclusively for debug insns created by 14645@option{-fvar-tracking-assignments}, but debug insns may get 14646(non-overlapping) uids above it if the reserved range is exhausted. 14647 14648@item ipa-sra-ptr-growth-factor 14649IPA-SRA replaces a pointer to an aggregate with one or more new 14650parameters only when their cumulative size is less or equal to 14651@option{ipa-sra-ptr-growth-factor} times the size of the original 14652pointer parameter. 14653 14654@item ipa-sra-max-replacements 14655Maximum pieces of an aggregate that IPA-SRA tracks. As a 14656consequence, it is also the maximum number of replacements of a formal 14657parameter. 14658 14659@item sra-max-scalarization-size-Ospeed 14660@itemx sra-max-scalarization-size-Osize 14661The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 14662replace scalar parts of aggregates with uses of independent scalar 14663variables. These parameters control the maximum size, in storage units, 14664of aggregate which is considered for replacement when compiling for 14665speed 14666(@option{sra-max-scalarization-size-Ospeed}) or size 14667(@option{sra-max-scalarization-size-Osize}) respectively. 14668 14669@item sra-max-propagations 14670The maximum number of artificial accesses that Scalar Replacement of 14671Aggregates (SRA) will track, per one local variable, in order to 14672facilitate copy propagation. 14673 14674@item tm-max-aggregate-size 14675When making copies of thread-local variables in a transaction, this 14676parameter specifies the size in bytes after which variables are 14677saved with the logging functions as opposed to save/restore code 14678sequence pairs. This option only applies when using 14679@option{-fgnu-tm}. 14680 14681@item graphite-max-nb-scop-params 14682To avoid exponential effects in the Graphite loop transforms, the 14683number of parameters in a Static Control Part (SCoP) is bounded. 14684A value of zero can be used to lift 14685the bound. A variable whose value is unknown at compilation time and 14686defined outside a SCoP is a parameter of the SCoP. 14687 14688@item loop-block-tile-size 14689Loop blocking or strip mining transforms, enabled with 14690@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 14691loop in the loop nest by a given number of iterations. The strip 14692length can be changed using the @option{loop-block-tile-size} 14693parameter. 14694 14695@item ipa-jump-function-lookups 14696Specifies number of statements visited during jump function offset discovery. 14697 14698@item ipa-cp-value-list-size 14699IPA-CP attempts to track all possible values and types passed to a function's 14700parameter in order to propagate them and perform devirtualization. 14701@option{ipa-cp-value-list-size} is the maximum number of values and types it 14702stores per one formal parameter of a function. 14703 14704@item ipa-cp-eval-threshold 14705IPA-CP calculates its own score of cloning profitability heuristics 14706and performs those cloning opportunities with scores that exceed 14707@option{ipa-cp-eval-threshold}. 14708 14709@item ipa-cp-max-recursive-depth 14710Maximum depth of recursive cloning for self-recursive function. 14711 14712@item ipa-cp-min-recursive-probability 14713Recursive cloning only when the probability of call being executed exceeds 14714the parameter. 14715 14716@item ipa-cp-profile-count-base 14717When using @option{-fprofile-use} option, IPA-CP will consider the measured 14718execution count of a call graph edge at this percentage position in their 14719histogram as the basis for its heuristics calculation. 14720 14721@item ipa-cp-recursive-freq-factor 14722The number of times interprocedural copy propagation expects recursive 14723functions to call themselves. 14724 14725@item ipa-cp-recursion-penalty 14726Percentage penalty the recursive functions will receive when they 14727are evaluated for cloning. 14728 14729@item ipa-cp-single-call-penalty 14730Percentage penalty functions containing a single call to another 14731function will receive when they are evaluated for cloning. 14732 14733@item ipa-max-agg-items 14734IPA-CP is also capable to propagate a number of scalar values passed 14735in an aggregate. @option{ipa-max-agg-items} controls the maximum 14736number of such values per one parameter. 14737 14738@item ipa-cp-loop-hint-bonus 14739When IPA-CP determines that a cloning candidate would make the number 14740of iterations of a loop known, it adds a bonus of 14741@option{ipa-cp-loop-hint-bonus} to the profitability score of 14742the candidate. 14743 14744@item ipa-max-loop-predicates 14745The maximum number of different predicates IPA will use to describe when 14746loops in a function have known properties. 14747 14748@item ipa-max-aa-steps 14749During its analysis of function bodies, IPA-CP employs alias analysis 14750in order to track values pointed to by function parameters. In order 14751not spend too much time analyzing huge functions, it gives up and 14752consider all memory clobbered after examining 14753@option{ipa-max-aa-steps} statements modifying memory. 14754 14755@item ipa-max-switch-predicate-bounds 14756Maximal number of boundary endpoints of case ranges of switch statement. 14757For switch exceeding this limit, IPA-CP will not construct cloning cost 14758predicate, which is used to estimate cloning benefit, for default case 14759of the switch statement. 14760 14761@item ipa-max-param-expr-ops 14762IPA-CP will analyze conditional statement that references some function 14763parameter to estimate benefit for cloning upon certain constant value. 14764But if number of operations in a parameter expression exceeds 14765@option{ipa-max-param-expr-ops}, the expression is treated as complicated 14766one, and is not handled by IPA analysis. 14767 14768@item lto-partitions 14769Specify desired number of partitions produced during WHOPR compilation. 14770The number of partitions should exceed the number of CPUs used for compilation. 14771 14772@item lto-min-partition 14773Size of minimal partition for WHOPR (in estimated instructions). 14774This prevents expenses of splitting very small programs into too many 14775partitions. 14776 14777@item lto-max-partition 14778Size of max partition for WHOPR (in estimated instructions). 14779to provide an upper bound for individual size of partition. 14780Meant to be used only with balanced partitioning. 14781 14782@item lto-max-streaming-parallelism 14783Maximal number of parallel processes used for LTO streaming. 14784 14785@item cxx-max-namespaces-for-diagnostic-help 14786The maximum number of namespaces to consult for suggestions when C++ 14787name lookup fails for an identifier. 14788 14789@item sink-frequency-threshold 14790The maximum relative execution frequency (in percents) of the target block 14791relative to a statement's original block to allow statement sinking of a 14792statement. Larger numbers result in more aggressive statement sinking. 14793A small positive adjustment is applied for 14794statements with memory operands as those are even more profitable so sink. 14795 14796@item max-stores-to-sink 14797The maximum number of conditional store pairs that can be sunk. Set to 0 14798if either vectorization (@option{-ftree-vectorize}) or if-conversion 14799(@option{-ftree-loop-if-convert}) is disabled. 14800 14801@item case-values-threshold 14802The smallest number of different values for which it is best to use a 14803jump-table instead of a tree of conditional branches. If the value is 148040, use the default for the machine. 14805 14806@item jump-table-max-growth-ratio-for-size 14807The maximum code size growth ratio when expanding 14808into a jump table (in percent). The parameter is used when 14809optimizing for size. 14810 14811@item jump-table-max-growth-ratio-for-speed 14812The maximum code size growth ratio when expanding 14813into a jump table (in percent). The parameter is used when 14814optimizing for speed. 14815 14816@item tree-reassoc-width 14817Set the maximum number of instructions executed in parallel in 14818reassociated tree. This parameter overrides target dependent 14819heuristics used by default if has non zero value. 14820 14821@item sched-pressure-algorithm 14822Choose between the two available implementations of 14823@option{-fsched-pressure}. Algorithm 1 is the original implementation 14824and is the more likely to prevent instructions from being reordered. 14825Algorithm 2 was designed to be a compromise between the relatively 14826conservative approach taken by algorithm 1 and the rather aggressive 14827approach taken by the default scheduler. It relies more heavily on 14828having a regular register file and accurate register pressure classes. 14829See @file{haifa-sched.cc} in the GCC sources for more details. 14830 14831The default choice depends on the target. 14832 14833@item max-slsr-cand-scan 14834Set the maximum number of existing candidates that are considered when 14835seeking a basis for a new straight-line strength reduction candidate. 14836 14837@item asan-globals 14838Enable buffer overflow detection for global objects. This kind 14839of protection is enabled by default if you are using 14840@option{-fsanitize=address} option. 14841To disable global objects protection use @option{--param asan-globals=0}. 14842 14843@item asan-stack 14844Enable buffer overflow detection for stack objects. This kind of 14845protection is enabled by default when using @option{-fsanitize=address}. 14846To disable stack protection use @option{--param asan-stack=0} option. 14847 14848@item asan-instrument-reads 14849Enable buffer overflow detection for memory reads. This kind of 14850protection is enabled by default when using @option{-fsanitize=address}. 14851To disable memory reads protection use 14852@option{--param asan-instrument-reads=0}. 14853 14854@item asan-instrument-writes 14855Enable buffer overflow detection for memory writes. This kind of 14856protection is enabled by default when using @option{-fsanitize=address}. 14857To disable memory writes protection use 14858@option{--param asan-instrument-writes=0} option. 14859 14860@item asan-memintrin 14861Enable detection for built-in functions. This kind of protection 14862is enabled by default when using @option{-fsanitize=address}. 14863To disable built-in functions protection use 14864@option{--param asan-memintrin=0}. 14865 14866@item asan-use-after-return 14867Enable detection of use-after-return. This kind of protection 14868is enabled by default when using the @option{-fsanitize=address} option. 14869To disable it use @option{--param asan-use-after-return=0}. 14870 14871Note: By default the check is disabled at run time. To enable it, 14872add @code{detect_stack_use_after_return=1} to the environment variable 14873@env{ASAN_OPTIONS}. 14874 14875@item asan-instrumentation-with-call-threshold 14876If number of memory accesses in function being instrumented 14877is greater or equal to this number, use callbacks instead of inline checks. 14878E.g. to disable inline code use 14879@option{--param asan-instrumentation-with-call-threshold=0}. 14880 14881@item hwasan-instrument-stack 14882Enable hwasan instrumentation of statically sized stack-allocated variables. 14883This kind of instrumentation is enabled by default when using 14884@option{-fsanitize=hwaddress} and disabled by default when using 14885@option{-fsanitize=kernel-hwaddress}. 14886To disable stack instrumentation use 14887@option{--param hwasan-instrument-stack=0}, and to enable it use 14888@option{--param hwasan-instrument-stack=1}. 14889 14890@item hwasan-random-frame-tag 14891When using stack instrumentation, decide tags for stack variables using a 14892deterministic sequence beginning at a random tag for each frame. With this 14893parameter unset tags are chosen using the same sequence but beginning from 1. 14894This is enabled by default for @option{-fsanitize=hwaddress} and unavailable 14895for @option{-fsanitize=kernel-hwaddress}. 14896To disable it use @option{--param hwasan-random-frame-tag=0}. 14897 14898@item hwasan-instrument-allocas 14899Enable hwasan instrumentation of dynamically sized stack-allocated variables. 14900This kind of instrumentation is enabled by default when using 14901@option{-fsanitize=hwaddress} and disabled by default when using 14902@option{-fsanitize=kernel-hwaddress}. 14903To disable instrumentation of such variables use 14904@option{--param hwasan-instrument-allocas=0}, and to enable it use 14905@option{--param hwasan-instrument-allocas=1}. 14906 14907@item hwasan-instrument-reads 14908Enable hwasan checks on memory reads. Instrumentation of reads is enabled by 14909default for both @option{-fsanitize=hwaddress} and 14910@option{-fsanitize=kernel-hwaddress}. 14911To disable checking memory reads use 14912@option{--param hwasan-instrument-reads=0}. 14913 14914@item hwasan-instrument-writes 14915Enable hwasan checks on memory writes. Instrumentation of writes is enabled by 14916default for both @option{-fsanitize=hwaddress} and 14917@option{-fsanitize=kernel-hwaddress}. 14918To disable checking memory writes use 14919@option{--param hwasan-instrument-writes=0}. 14920 14921@item hwasan-instrument-mem-intrinsics 14922Enable hwasan instrumentation of builtin functions. Instrumentation of these 14923builtin functions is enabled by default for both @option{-fsanitize=hwaddress} 14924and @option{-fsanitize=kernel-hwaddress}. 14925To disable instrumentation of builtin functions use 14926@option{--param hwasan-instrument-mem-intrinsics=0}. 14927 14928@item use-after-scope-direct-emission-threshold 14929If the size of a local variable in bytes is smaller or equal to this 14930number, directly poison (or unpoison) shadow memory instead of using 14931run-time callbacks. 14932 14933@item tsan-distinguish-volatile 14934Emit special instrumentation for accesses to volatiles. 14935 14936@item tsan-instrument-func-entry-exit 14937Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit(). 14938 14939@item max-fsm-thread-path-insns 14940Maximum number of instructions to copy when duplicating blocks on a 14941finite state automaton jump thread path. 14942 14943@item max-fsm-thread-length 14944Maximum number of basic blocks on a jump thread path. 14945 14946@item threader-debug 14947threader-debug=[none|all] Enables verbose dumping of the threader solver. 14948 14949@item parloops-chunk-size 14950Chunk size of omp schedule for loops parallelized by parloops. 14951 14952@item parloops-schedule 14953Schedule type of omp schedule for loops parallelized by parloops (static, 14954dynamic, guided, auto, runtime). 14955 14956@item parloops-min-per-thread 14957The minimum number of iterations per thread of an innermost parallelized 14958loop for which the parallelized variant is preferred over the single threaded 14959one. Note that for a parallelized loop nest the 14960minimum number of iterations of the outermost loop per thread is two. 14961 14962@item max-ssa-name-query-depth 14963Maximum depth of recursion when querying properties of SSA names in things 14964like fold routines. One level of recursion corresponds to following a 14965use-def chain. 14966 14967@item max-speculative-devirt-maydefs 14968The maximum number of may-defs we analyze when looking for a must-def 14969specifying the dynamic type of an object that invokes a virtual call 14970we may be able to devirtualize speculatively. 14971 14972@item max-vrp-switch-assertions 14973The maximum number of assertions to add along the default edge of a switch 14974statement during VRP. 14975 14976@item evrp-sparse-threshold 14977Maximum number of basic blocks before EVRP uses a sparse cache. 14978 14979@item evrp-mode 14980Specifies the mode Early VRP should operate in. 14981 14982@item vrp1-mode 14983Specifies the mode VRP pass 1 should operate in. 14984 14985@item vrp2-mode 14986Specifies the mode VRP pass 2 should operate in. 14987 14988@item ranger-debug 14989Specifies the type of debug output to be issued for ranges. 14990 14991@item evrp-switch-limit 14992Specifies the maximum number of switch cases before EVRP ignores a switch. 14993 14994@item unroll-jam-min-percent 14995The minimum percentage of memory references that must be optimized 14996away for the unroll-and-jam transformation to be considered profitable. 14997 14998@item unroll-jam-max-unroll 14999The maximum number of times the outer loop should be unrolled by 15000the unroll-and-jam transformation. 15001 15002@item max-rtl-if-conversion-unpredictable-cost 15003Maximum permissible cost for the sequence that would be generated 15004by the RTL if-conversion pass for a branch that is considered unpredictable. 15005 15006@item max-variable-expansions-in-unroller 15007If @option{-fvariable-expansion-in-unroller} is used, the maximum number 15008of times that an individual variable will be expanded during loop unrolling. 15009 15010@item partial-inlining-entry-probability 15011Maximum probability of the entry BB of split region 15012(in percent relative to entry BB of the function) 15013to make partial inlining happen. 15014 15015@item max-tracked-strlens 15016Maximum number of strings for which strlen optimization pass will 15017track string lengths. 15018 15019@item gcse-after-reload-partial-fraction 15020The threshold ratio for performing partial redundancy 15021elimination after reload. 15022 15023@item gcse-after-reload-critical-fraction 15024The threshold ratio of critical edges execution count that 15025permit performing redundancy elimination after reload. 15026 15027@item max-loop-header-insns 15028The maximum number of insns in loop header duplicated 15029by the copy loop headers pass. 15030 15031@item vect-epilogues-nomask 15032Enable loop epilogue vectorization using smaller vector size. 15033 15034@item vect-partial-vector-usage 15035Controls when the loop vectorizer considers using partial vector loads 15036and stores as an alternative to falling back to scalar code. 0 stops 15037the vectorizer from ever using partial vector loads and stores. 1 allows 15038partial vector loads and stores if vectorization removes the need for the 15039code to iterate. 2 allows partial vector loads and stores in all loops. 15040The parameter only has an effect on targets that support partial 15041vector loads and stores. 15042 15043@item vect-inner-loop-cost-factor 15044The maximum factor which the loop vectorizer applies to the cost of statements 15045in an inner loop relative to the loop being vectorized. The factor applied 15046is the maximum of the estimated number of iterations of the inner loop and 15047this parameter. The default value of this parameter is 50. 15048 15049@item vect-induction-float 15050Enable loop vectorization of floating point inductions. 15051 15052@item avoid-fma-max-bits 15053Maximum number of bits for which we avoid creating FMAs. 15054 15055@item sms-loop-average-count-threshold 15056A threshold on the average loop count considered by the swing modulo scheduler. 15057 15058@item sms-dfa-history 15059The number of cycles the swing modulo scheduler considers when checking 15060conflicts using DFA. 15061 15062@item graphite-allow-codegen-errors 15063Whether codegen errors should be ICEs when @option{-fchecking}. 15064 15065@item sms-max-ii-factor 15066A factor for tuning the upper bound that swing modulo scheduler 15067uses for scheduling a loop. 15068 15069@item lra-max-considered-reload-pseudos 15070The max number of reload pseudos which are considered during 15071spilling a non-reload pseudo. 15072 15073@item max-pow-sqrt-depth 15074Maximum depth of sqrt chains to use when synthesizing exponentiation 15075by a real constant. 15076 15077@item max-dse-active-local-stores 15078Maximum number of active local stores in RTL dead store elimination. 15079 15080@item asan-instrument-allocas 15081Enable asan allocas/VLAs protection. 15082 15083@item max-iterations-computation-cost 15084Bound on the cost of an expression to compute the number of iterations. 15085 15086@item max-isl-operations 15087Maximum number of isl operations, 0 means unlimited. 15088 15089@item graphite-max-arrays-per-scop 15090Maximum number of arrays per scop. 15091 15092@item max-vartrack-reverse-op-size 15093Max. size of loc list for which reverse ops should be added. 15094 15095@item fsm-scale-path-stmts 15096Scale factor to apply to the number of statements in a threading path 15097when comparing to the number of (scaled) blocks. 15098 15099@item uninit-control-dep-attempts 15100Maximum number of nested calls to search for control dependencies 15101during uninitialized variable analysis. 15102 15103@item fsm-scale-path-blocks 15104Scale factor to apply to the number of blocks in a threading path 15105when comparing to the number of (scaled) statements. 15106 15107@item sched-autopref-queue-depth 15108Hardware autoprefetcher scheduler model control flag. 15109Number of lookahead cycles the model looks into; at ' 15110' only enable instruction sorting heuristic. 15111 15112@item loop-versioning-max-inner-insns 15113The maximum number of instructions that an inner loop can have 15114before the loop versioning pass considers it too big to copy. 15115 15116@item loop-versioning-max-outer-insns 15117The maximum number of instructions that an outer loop can have 15118before the loop versioning pass considers it too big to copy, 15119discounting any instructions in inner loops that directly benefit 15120from versioning. 15121 15122@item ssa-name-def-chain-limit 15123The maximum number of SSA_NAME assignments to follow in determining 15124a property of a variable such as its value. This limits the number 15125of iterations or recursive calls GCC performs when optimizing certain 15126statements or when determining their validity prior to issuing 15127diagnostics. 15128 15129@item store-merging-max-size 15130Maximum size of a single store merging region in bytes. 15131 15132@item hash-table-verification-limit 15133The number of elements for which hash table verification is done 15134for each searched element. 15135 15136@item max-find-base-term-values 15137Maximum number of VALUEs handled during a single find_base_term call. 15138 15139@item analyzer-max-enodes-per-program-point 15140The maximum number of exploded nodes per program point within 15141the analyzer, before terminating analysis of that point. 15142 15143@item analyzer-max-constraints 15144The maximum number of constraints per state. 15145 15146@item analyzer-min-snodes-for-call-summary 15147The minimum number of supernodes within a function for the 15148analyzer to consider summarizing its effects at call sites. 15149 15150@item analyzer-max-enodes-for-full-dump 15151The maximum depth of exploded nodes that should appear in a dot dump 15152before switching to a less verbose format. 15153 15154@item analyzer-max-recursion-depth 15155The maximum number of times a callsite can appear in a call stack 15156within the analyzer, before terminating analysis of a call that would 15157recurse deeper. 15158 15159@item analyzer-max-svalue-depth 15160The maximum depth of a symbolic value, before approximating 15161the value as unknown. 15162 15163@item analyzer-max-infeasible-edges 15164The maximum number of infeasible edges to reject before declaring 15165a diagnostic as infeasible. 15166 15167@item gimple-fe-computed-hot-bb-threshold 15168The number of executions of a basic block which is considered hot. 15169The parameter is used only in GIMPLE FE. 15170 15171@item analyzer-bb-explosion-factor 15172The maximum number of 'after supernode' exploded nodes within the analyzer 15173per supernode, before terminating analysis. 15174 15175@item ranger-logical-depth 15176Maximum depth of logical expression evaluation ranger will look through 15177when evaluating outgoing edge ranges. 15178 15179@item relation-block-limit 15180Maximum number of relations the oracle will register in a basic block. 15181 15182@item min-pagesize 15183Minimum page size for warning purposes. 15184 15185@item openacc-kernels 15186Specify mode of OpenACC `kernels' constructs handling. 15187With @option{--param=openacc-kernels=decompose}, OpenACC `kernels' 15188constructs are decomposed into parts, a sequence of compute 15189constructs, each then handled individually. 15190This is work in progress. 15191With @option{--param=openacc-kernels=parloops}, OpenACC `kernels' 15192constructs are handled by the @samp{parloops} pass, en bloc. 15193This is the current default. 15194 15195@item openacc-privatization 15196Specify mode of OpenACC privatization diagnostics for 15197@option{-fopt-info-omp-note} and applicable 15198@option{-fdump-tree-*-details}. 15199With @option{--param=openacc-privatization=quiet}, don't diagnose. 15200This is the current default. 15201With @option{--param=openacc-privatization=noisy}, do diagnose. 15202 15203@end table 15204 15205The following choices of @var{name} are available on AArch64 targets: 15206 15207@table @gcctabopt 15208@item aarch64-sve-compare-costs 15209When vectorizing for SVE, consider using ``unpacked'' vectors for 15210smaller elements and use the cost model to pick the cheapest approach. 15211Also use the cost model to choose between SVE and Advanced SIMD vectorization. 15212 15213Using unpacked vectors includes storing smaller elements in larger 15214containers and accessing elements with extending loads and truncating 15215stores. 15216 15217@item aarch64-float-recp-precision 15218The number of Newton iterations for calculating the reciprocal for float type. 15219The precision of division is proportional to this param when division 15220approximation is enabled. The default value is 1. 15221 15222@item aarch64-double-recp-precision 15223The number of Newton iterations for calculating the reciprocal for double type. 15224The precision of division is propotional to this param when division 15225approximation is enabled. The default value is 2. 15226 15227@item aarch64-autovec-preference 15228Force an ISA selection strategy for auto-vectorization. Accepts values from 152290 to 4, inclusive. 15230@table @samp 15231@item 0 15232Use the default heuristics. 15233@item 1 15234Use only Advanced SIMD for auto-vectorization. 15235@item 2 15236Use only SVE for auto-vectorization. 15237@item 3 15238Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are 15239deemed equal. 15240@item 4 15241Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal. 15242@end table 15243The default value is 0. 15244 15245@item aarch64-loop-vect-issue-rate-niters 15246The tuning for some AArch64 CPUs tries to take both latencies and issue 15247rates into account when deciding whether a loop should be vectorized 15248using SVE, vectorized using Advanced SIMD, or not vectorized at all. 15249If this parameter is set to @var{n}, GCC will not use this heuristic 15250for loops that are known to execute in fewer than @var{n} Advanced 15251SIMD iterations. 15252 15253@item aarch64-vect-unroll-limit 15254The vectorizer will use available tuning information to determine whether it 15255would be beneficial to unroll the main vectorized loop and by how much. This 15256parameter set's the upper bound of how much the vectorizer will unroll the main 15257loop. The default value is four. 15258 15259@end table 15260 15261The following choices of @var{name} are available on i386 and x86_64 targets: 15262 15263@table @gcctabopt 15264@item x86-stlf-window-ninsns 15265Instructions number above which STFL stall penalty can be compensated. 15266 15267@end table 15268 15269@end table 15270 15271@node Instrumentation Options 15272@section Program Instrumentation Options 15273@cindex instrumentation options 15274@cindex program instrumentation options 15275@cindex run-time error checking options 15276@cindex profiling options 15277@cindex options, program instrumentation 15278@cindex options, run-time error checking 15279@cindex options, profiling 15280 15281GCC supports a number of command-line options that control adding 15282run-time instrumentation to the code it normally generates. 15283For example, one purpose of instrumentation is collect profiling 15284statistics for use in finding program hot spots, code coverage 15285analysis, or profile-guided optimizations. 15286Another class of program instrumentation is adding run-time checking 15287to detect programming errors like invalid pointer 15288dereferences or out-of-bounds array accesses, as well as deliberately 15289hostile attacks such as stack smashing or C++ vtable hijacking. 15290There is also a general hook which can be used to implement other 15291forms of tracing or function-level instrumentation for debug or 15292program analysis purposes. 15293 15294@table @gcctabopt 15295@cindex @command{prof} 15296@cindex @command{gprof} 15297@item -p 15298@itemx -pg 15299@opindex p 15300@opindex pg 15301Generate extra code to write profile information suitable for the 15302analysis program @command{prof} (for @option{-p}) or @command{gprof} 15303(for @option{-pg}). You must use this option when compiling 15304the source files you want data about, and you must also use it when 15305linking. 15306 15307You can use the function attribute @code{no_instrument_function} to 15308suppress profiling of individual functions when compiling with these options. 15309@xref{Common Function Attributes}. 15310 15311@item -fprofile-arcs 15312@opindex fprofile-arcs 15313Add code so that program flow @dfn{arcs} are instrumented. During 15314execution the program records how many times each branch and call is 15315executed and how many times it is taken or returns. On targets that support 15316constructors with priority support, profiling properly handles constructors, 15317destructors and C++ constructors (and destructors) of classes which are used 15318as a type of a global variable. 15319 15320When the compiled 15321program exits it saves this data to a file called 15322@file{@var{auxname}.gcda} for each source file. The data may be used for 15323profile-directed optimizations (@option{-fbranch-probabilities}), or for 15324test coverage analysis (@option{-ftest-coverage}). Each object file's 15325@var{auxname} is generated from the name of the output file, if 15326explicitly specified and it is not the final executable, otherwise it is 15327the basename of the source file. In both cases any suffix is removed 15328(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 15329@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 15330 15331Note that if a command line directly links source files, the corresponding 15332@var{.gcda} files will be prefixed with the unsuffixed name of the output file. 15333E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and 15334@file{binary-b.gcda} files. 15335 15336@xref{Cross-profiling}. 15337 15338@cindex @command{gcov} 15339@item --coverage 15340@opindex coverage 15341 15342This option is used to compile and link code instrumented for coverage 15343analysis. The option is a synonym for @option{-fprofile-arcs} 15344@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 15345linking). See the documentation for those options for more details. 15346 15347@itemize 15348 15349@item 15350Compile the source files with @option{-fprofile-arcs} plus optimization 15351and code generation options. For test coverage analysis, use the 15352additional @option{-ftest-coverage} option. You do not need to profile 15353every source file in a program. 15354 15355@item 15356Compile the source files additionally with @option{-fprofile-abs-path} 15357to create absolute path names in the @file{.gcno} files. This allows 15358@command{gcov} to find the correct sources in projects where compilations 15359occur with different working directories. 15360 15361@item 15362Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 15363(the latter implies the former). 15364 15365@item 15366Run the program on a representative workload to generate the arc profile 15367information. This may be repeated any number of times. You can run 15368concurrent instances of your program, and provided that the file system 15369supports locking, the data files will be correctly updated. Unless 15370a strict ISO C dialect option is in effect, @code{fork} calls are 15371detected and correctly handled without double counting. 15372 15373Moreover, an object file can be recompiled multiple times 15374and the corresponding @file{.gcda} file merges as long as 15375the source file and the compiler options are unchanged. 15376 15377@item 15378For profile-directed optimizations, compile the source files again with 15379the same optimization and code generation options plus 15380@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 15381Control Optimization}). 15382 15383@item 15384For test coverage analysis, use @command{gcov} to produce human readable 15385information from the @file{.gcno} and @file{.gcda} files. Refer to the 15386@command{gcov} documentation for further information. 15387 15388@end itemize 15389 15390With @option{-fprofile-arcs}, for each function of your program GCC 15391creates a program flow graph, then finds a spanning tree for the graph. 15392Only arcs that are not on the spanning tree have to be instrumented: the 15393compiler adds code to count the number of times that these arcs are 15394executed. When an arc is the only exit or only entrance to a block, the 15395instrumentation code can be added to the block; otherwise, a new basic 15396block must be created to hold the instrumentation code. 15397 15398@need 2000 15399@item -ftest-coverage 15400@opindex ftest-coverage 15401Produce a notes file that the @command{gcov} code-coverage utility 15402(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 15403show program coverage. Each source file's note file is called 15404@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 15405above for a description of @var{auxname} and instructions on how to 15406generate test coverage data. Coverage data matches the source files 15407more closely if you do not optimize. 15408 15409@item -fprofile-abs-path 15410@opindex fprofile-abs-path 15411Automatically convert relative source file names to absolute path names 15412in the @file{.gcno} files. This allows @command{gcov} to find the correct 15413sources in projects where compilations occur with different working 15414directories. 15415 15416@item -fprofile-dir=@var{path} 15417@opindex fprofile-dir 15418 15419Set the directory to search for the profile data files in to @var{path}. 15420This option affects only the profile data generated by 15421@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 15422and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 15423and its related options. Both absolute and relative paths can be used. 15424By default, GCC uses the current directory as @var{path}, thus the 15425profile data file appears in the same directory as the object file. 15426In order to prevent the file name clashing, if the object file name is 15427not an absolute path, we mangle the absolute path of the 15428@file{@var{sourcename}.gcda} file and use it as the file name of a 15429@file{.gcda} file. See details about the file naming in @option{-fprofile-arcs}. 15430See similar option @option{-fprofile-note}. 15431 15432When an executable is run in a massive parallel environment, it is recommended 15433to save profile to different folders. That can be done with variables 15434in @var{path} that are exported during run-time: 15435 15436@table @gcctabopt 15437 15438@item %p 15439process ID. 15440 15441@item %q@{VAR@} 15442value of environment variable @var{VAR} 15443 15444@end table 15445 15446@item -fprofile-generate 15447@itemx -fprofile-generate=@var{path} 15448@opindex fprofile-generate 15449 15450Enable options usually used for instrumenting application to produce 15451profile useful for later recompilation with profile feedback based 15452optimization. You must use @option{-fprofile-generate} both when 15453compiling and when linking your program. 15454 15455The following options are enabled: 15456@option{-fprofile-arcs}, @option{-fprofile-values}, 15457@option{-finline-functions}, and @option{-fipa-bit-cp}. 15458 15459If @var{path} is specified, GCC looks at the @var{path} to find 15460the profile feedback data files. See @option{-fprofile-dir}. 15461 15462To optimize the program based on the collected profile information, use 15463@option{-fprofile-use}. @xref{Optimize Options}, for more information. 15464 15465@item -fprofile-info-section 15466@itemx -fprofile-info-section=@var{name} 15467@opindex fprofile-info-section 15468 15469Register the profile information in the specified section instead of using a 15470constructor/destructor. The section name is @var{name} if it is specified, 15471otherwise the section name defaults to @code{.gcov_info}. A pointer to the 15472profile information generated by @option{-fprofile-arcs} is placed in the 15473specified section for each translation unit. This option disables the profile 15474information registration through a constructor and it disables the profile 15475information processing through a destructor. This option is not intended to be 15476used in hosted environments such as GNU/Linux. It targets free-standing 15477environments (for example embedded systems) with limited resources which do not 15478support constructors/destructors or the C library file I/O. 15479 15480The linker could collect the input sections in a continuous memory block and 15481define start and end symbols. A GNU linker script example which defines a 15482linker output section follows: 15483 15484@smallexample 15485 .gcov_info : 15486 @{ 15487 PROVIDE (__gcov_info_start = .); 15488 KEEP (*(.gcov_info)) 15489 PROVIDE (__gcov_info_end = .); 15490 @} 15491@end smallexample 15492 15493The program could dump the profiling information registered in this linker set 15494for example like this: 15495 15496@smallexample 15497#include <gcov.h> 15498#include <stdio.h> 15499#include <stdlib.h> 15500 15501extern const struct gcov_info *__gcov_info_start[]; 15502extern const struct gcov_info *__gcov_info_end[]; 15503 15504static void 15505filename (const char *f, void *arg) 15506@{ 15507 puts (f); 15508@} 15509 15510static void 15511dump (const void *d, unsigned n, void *arg) 15512@{ 15513 const unsigned char *c = d; 15514 15515 for (unsigned i = 0; i < n; ++i) 15516 printf ("%02x", c[i]); 15517@} 15518 15519static void * 15520allocate (unsigned length, void *arg) 15521@{ 15522 return malloc (length); 15523@} 15524 15525static void 15526dump_gcov_info (void) 15527@{ 15528 const struct gcov_info **info = __gcov_info_start; 15529 const struct gcov_info **end = __gcov_info_end; 15530 15531 /* Obfuscate variable to prevent compiler optimizations. */ 15532 __asm__ ("" : "+r" (info)); 15533 15534 while (info != end) 15535 @{ 15536 void *arg = NULL; 15537 __gcov_info_to_gcda (*info, filename, dump, allocate, arg); 15538 putchar ('\n'); 15539 ++info; 15540 @} 15541@} 15542 15543int 15544main() 15545@{ 15546 dump_gcov_info(); 15547 return 0; 15548@} 15549@end smallexample 15550 15551@item -fprofile-note=@var{path} 15552@opindex fprofile-note 15553 15554If @var{path} is specified, GCC saves @file{.gcno} file into @var{path} 15555location. If you combine the option with multiple source files, 15556the @file{.gcno} file will be overwritten. 15557 15558@item -fprofile-prefix-path=@var{path} 15559@opindex fprofile-prefix-path 15560 15561This option can be used in combination with 15562@option{profile-generate=}@var{profile_dir} and 15563@option{profile-use=}@var{profile_dir} to inform GCC where is the base 15564directory of built source tree. By default @var{profile_dir} will contain 15565files with mangled absolute paths of all object files in the built project. 15566This is not desirable when directory used to build the instrumented binary 15567differs from the directory used to build the binary optimized with profile 15568feedback because the profile data will not be found during the optimized build. 15569In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path} 15570pointing to the base directory of the build can be used to strip the irrelevant 15571part of the path and keep all file names relative to the main build directory. 15572 15573@item -fprofile-prefix-map=@var{old}=@var{new} 15574@opindex fprofile-prefix-map 15575When compiling files residing in directory @file{@var{old}}, record 15576profiling information (with @option{--coverage}) 15577describing them as if the files resided in 15578directory @file{@var{new}} instead. 15579See also @option{-ffile-prefix-map}. 15580 15581@item -fprofile-update=@var{method} 15582@opindex fprofile-update 15583 15584Alter the update method for an application instrumented for profile 15585feedback based optimization. The @var{method} argument should be one of 15586@samp{single}, @samp{atomic} or @samp{prefer-atomic}. 15587The first one is useful for single-threaded applications, 15588while the second one prevents profile corruption by emitting thread-safe code. 15589 15590@strong{Warning:} When an application does not properly join all threads 15591(or creates an detached thread), a profile file can be still corrupted. 15592 15593Using @samp{prefer-atomic} would be transformed either to @samp{atomic}, 15594when supported by a target, or to @samp{single} otherwise. The GCC driver 15595automatically selects @samp{prefer-atomic} when @option{-pthread} 15596is present in the command line. 15597 15598@item -fprofile-filter-files=@var{regex} 15599@opindex fprofile-filter-files 15600 15601Instrument only functions from files whose name matches 15602any of the regular expressions (separated by semi-colons). 15603 15604For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument 15605only @file{main.c} and all C files starting with 'module'. 15606 15607@item -fprofile-exclude-files=@var{regex} 15608@opindex fprofile-exclude-files 15609 15610Instrument only functions from files whose name does not match 15611any of the regular expressions (separated by semi-colons). 15612 15613For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation 15614of all files that are located in the @file{/usr/} folder. 15615 15616@item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} 15617@opindex fprofile-reproducible 15618Control level of reproducibility of profile gathered by 15619@code{-fprofile-generate}. This makes it possible to rebuild program 15620with same outcome which is useful, for example, for distribution 15621packages. 15622 15623With @option{-fprofile-reproducible=serial} the profile gathered by 15624@option{-fprofile-generate} is reproducible provided the trained program 15625behaves the same at each invocation of the train run, it is not 15626multi-threaded and profile data streaming is always done in the same 15627order. Note that profile streaming happens at the end of program run but 15628also before @code{fork} function is invoked. 15629 15630Note that it is quite common that execution counts of some part of 15631programs depends, for example, on length of temporary file names or 15632memory space randomization (that may affect hash-table collision rate). 15633Such non-reproducible part of programs may be annotated by 15634@code{no_instrument_function} function attribute. @command{gcov-dump} with 15635@option{-l} can be used to dump gathered data and verify that they are 15636indeed reproducible. 15637 15638With @option{-fprofile-reproducible=parallel-runs} collected profile 15639stays reproducible regardless the order of streaming of the data into 15640gcda files. This setting makes it possible to run multiple instances of 15641instrumented program in parallel (such as with @code{make -j}). This 15642reduces quality of gathered data, in particular of indirect call 15643profiling. 15644 15645@item -fsanitize=address 15646@opindex fsanitize=address 15647Enable AddressSanitizer, a fast memory error detector. 15648Memory access instructions are instrumented to detect 15649out-of-bounds and use-after-free bugs. 15650The option enables @option{-fsanitize-address-use-after-scope}. 15651See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 15652more details. The run-time behavior can be influenced using the 15653@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 15654the available options are shown at startup of the instrumented program. See 15655@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 15656for a list of supported options. 15657The option cannot be combined with @option{-fsanitize=thread} or 15658@option{-fsanitize=hwaddress}. Note that the only target 15659@option{-fsanitize=hwaddress} is currently supported on is AArch64. 15660 15661@item -fsanitize=kernel-address 15662@opindex fsanitize=kernel-address 15663Enable AddressSanitizer for Linux kernel. 15664See @uref{https://github.com/google/kasan} for more details. 15665 15666@item -fsanitize=hwaddress 15667@opindex fsanitize=hwaddress 15668Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to 15669ignore the top byte of a pointer to allow the detection of memory errors with 15670a low memory overhead. 15671Memory access instructions are instrumented to detect out-of-bounds and 15672use-after-free bugs. 15673The option enables @option{-fsanitize-address-use-after-scope}. 15674See 15675@uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html} 15676for more details. The run-time behavior can be influenced using the 15677@env{HWASAN_OPTIONS} environment variable. When set to @code{help=1}, 15678the available options are shown at startup of the instrumented program. 15679The option cannot be combined with @option{-fsanitize=thread} or 15680@option{-fsanitize=address}, and is currently only available on AArch64. 15681 15682@item -fsanitize=kernel-hwaddress 15683@opindex fsanitize=kernel-hwaddress 15684Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel. 15685Similar to @option{-fsanitize=kernel-address} but using an alternate 15686instrumentation method, and similar to @option{-fsanitize=hwaddress} but with 15687instrumentation differences necessary for compiling the Linux kernel. 15688These differences are to avoid hwasan library initialization calls and to 15689account for the stack pointer having a different value in its top byte. 15690 15691@emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}. 15692Instrumenting the stack and alloca calls are not on by default but are still 15693possible by specifying the command-line options 15694@option{--param hwasan-instrument-stack=1} and 15695@option{--param hwasan-instrument-allocas=1} respectively. Using a random frame 15696tag is not implemented for kernel instrumentation. 15697 15698@item -fsanitize=pointer-compare 15699@opindex fsanitize=pointer-compare 15700Instrument comparison operation (<, <=, >, >=) with pointer operands. 15701The option must be combined with either @option{-fsanitize=kernel-address} or 15702@option{-fsanitize=address} 15703The option cannot be combined with @option{-fsanitize=thread}. 15704Note: By default the check is disabled at run time. To enable it, 15705add @code{detect_invalid_pointer_pairs=2} to the environment variable 15706@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 15707invalid operation only when both pointers are non-null. 15708 15709@item -fsanitize=pointer-subtract 15710@opindex fsanitize=pointer-subtract 15711Instrument subtraction with pointer operands. 15712The option must be combined with either @option{-fsanitize=kernel-address} or 15713@option{-fsanitize=address} 15714The option cannot be combined with @option{-fsanitize=thread}. 15715Note: By default the check is disabled at run time. To enable it, 15716add @code{detect_invalid_pointer_pairs=2} to the environment variable 15717@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 15718invalid operation only when both pointers are non-null. 15719 15720@item -fsanitize=shadow-call-stack 15721@opindex fsanitize=shadow-call-stack 15722Enable ShadowCallStack, a security enhancement mechanism used to protect 15723programs against return address overwrites (e.g. stack buffer overflows.) 15724It works by saving a function's return address to a separately allocated 15725shadow call stack in the function prologue and restoring the return address 15726from the shadow call stack in the function epilogue. Instrumentation only 15727occurs in functions that need to save the return address to the stack. 15728 15729Currently it only supports the aarch64 platform. It is specifically 15730designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option. 15731For the user space programs, runtime support is not currently provided 15732in libc and libgcc. Users who want to use this feature in user space need 15733to provide their own support for the runtime. It should be noted that 15734this may cause the ABI rules to be broken. 15735 15736On aarch64, the instrumentation makes use of the platform register @code{x18}. 15737This generally means that any code that may run on the same thread as code 15738compiled with ShadowCallStack must be compiled with the flag 15739@option{-ffixed-x18}, otherwise functions compiled without 15740@option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow 15741stack pointer. 15742 15743Also, because there is no userspace runtime support, code compiled with 15744ShadowCallStack cannot use exception handling. Use @option{-fno-exceptions} 15745to turn off exceptions. 15746 15747See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more 15748details. 15749 15750@item -fsanitize=thread 15751@opindex fsanitize=thread 15752Enable ThreadSanitizer, a fast data race detector. 15753Memory access instructions are instrumented to detect 15754data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 15755details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 15756environment variable; see 15757@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 15758supported options. 15759The option cannot be combined with @option{-fsanitize=address}, 15760@option{-fsanitize=leak}. 15761 15762Note that sanitized atomic builtins cannot throw exceptions when 15763operating on invalid memory addresses with non-call exceptions 15764(@option{-fnon-call-exceptions}). 15765 15766@item -fsanitize=leak 15767@opindex fsanitize=leak 15768Enable LeakSanitizer, a memory leak detector. 15769This option only matters for linking of executables and 15770the executable is linked against a library that overrides @code{malloc} 15771and other allocator functions. See 15772@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 15773details. The run-time behavior can be influenced using the 15774@env{LSAN_OPTIONS} environment variable. 15775The option cannot be combined with @option{-fsanitize=thread}. 15776 15777@item -fsanitize=undefined 15778@opindex fsanitize=undefined 15779Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 15780Various computations are instrumented to detect undefined behavior 15781at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the 15782@env{UBSAN_OPTIONS} environment variable. Current suboptions are: 15783 15784@table @gcctabopt 15785 15786@item -fsanitize=shift 15787@opindex fsanitize=shift 15788This option enables checking that the result of a shift operation is 15789not undefined. Note that what exactly is considered undefined differs 15790slightly between C and C++, as well as between ISO C90 and C99, etc. 15791This option has two suboptions, @option{-fsanitize=shift-base} and 15792@option{-fsanitize=shift-exponent}. 15793 15794@item -fsanitize=shift-exponent 15795@opindex fsanitize=shift-exponent 15796This option enables checking that the second argument of a shift operation 15797is not negative and is smaller than the precision of the promoted first 15798argument. 15799 15800@item -fsanitize=shift-base 15801@opindex fsanitize=shift-base 15802If the second argument of a shift operation is within range, check that the 15803result of a shift operation is not undefined. Note that what exactly is 15804considered undefined differs slightly between C and C++, as well as between 15805ISO C90 and C99, etc. 15806 15807@item -fsanitize=integer-divide-by-zero 15808@opindex fsanitize=integer-divide-by-zero 15809Detect integer division by zero. 15810 15811@item -fsanitize=unreachable 15812@opindex fsanitize=unreachable 15813With this option, the compiler turns the @code{__builtin_unreachable} 15814call into a diagnostics message call instead. When reaching the 15815@code{__builtin_unreachable} call, the behavior is undefined. 15816 15817@item -fsanitize=vla-bound 15818@opindex fsanitize=vla-bound 15819This option instructs the compiler to check that the size of a variable 15820length array is positive. 15821 15822@item -fsanitize=null 15823@opindex fsanitize=null 15824This option enables pointer checking. Particularly, the application 15825built with this option turned on will issue an error message when it 15826tries to dereference a NULL pointer, or if a reference (possibly an 15827rvalue reference) is bound to a NULL pointer, or if a method is invoked 15828on an object pointed by a NULL pointer. 15829 15830@item -fsanitize=return 15831@opindex fsanitize=return 15832This option enables return statement checking. Programs 15833built with this option turned on will issue an error message 15834when the end of a non-void function is reached without actually 15835returning a value. This option works in C++ only. 15836 15837@item -fsanitize=signed-integer-overflow 15838@opindex fsanitize=signed-integer-overflow 15839This option enables signed integer overflow checking. We check that 15840the result of @code{+}, @code{*}, and both unary and binary @code{-} 15841does not overflow in the signed arithmetics. This also detects 15842@code{INT_MIN / -1} signed division. Note, integer promotion 15843rules must be taken into account. That is, the following is not an 15844overflow: 15845@smallexample 15846signed char a = SCHAR_MAX; 15847a++; 15848@end smallexample 15849 15850@item -fsanitize=bounds 15851@opindex fsanitize=bounds 15852This option enables instrumentation of array bounds. Various out of bounds 15853accesses are detected. Flexible array members, flexible array member-like 15854arrays, and initializers of variables with static storage are not instrumented. 15855 15856@item -fsanitize=bounds-strict 15857@opindex fsanitize=bounds-strict 15858This option enables strict instrumentation of array bounds. Most out of bounds 15859accesses are detected, including flexible array members and flexible array 15860member-like arrays. Initializers of variables with static storage are not 15861instrumented. 15862 15863@item -fsanitize=alignment 15864@opindex fsanitize=alignment 15865 15866This option enables checking of alignment of pointers when they are 15867dereferenced, or when a reference is bound to insufficiently aligned target, 15868or when a method or constructor is invoked on insufficiently aligned object. 15869 15870@item -fsanitize=object-size 15871@opindex fsanitize=object-size 15872This option enables instrumentation of memory references using the 15873@code{__builtin_object_size} function. Various out of bounds pointer 15874accesses are detected. 15875 15876@item -fsanitize=float-divide-by-zero 15877@opindex fsanitize=float-divide-by-zero 15878Detect floating-point division by zero. Unlike other similar options, 15879@option{-fsanitize=float-divide-by-zero} is not enabled by 15880@option{-fsanitize=undefined}, since floating-point division by zero can 15881be a legitimate way of obtaining infinities and NaNs. 15882 15883@item -fsanitize=float-cast-overflow 15884@opindex fsanitize=float-cast-overflow 15885This option enables floating-point type to integer conversion checking. 15886We check that the result of the conversion does not overflow. 15887Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 15888not enabled by @option{-fsanitize=undefined}. 15889This option does not work well with @code{FE_INVALID} exceptions enabled. 15890 15891@item -fsanitize=nonnull-attribute 15892@opindex fsanitize=nonnull-attribute 15893 15894This option enables instrumentation of calls, checking whether null values 15895are not passed to arguments marked as requiring a non-null value by the 15896@code{nonnull} function attribute. 15897 15898@item -fsanitize=returns-nonnull-attribute 15899@opindex fsanitize=returns-nonnull-attribute 15900 15901This option enables instrumentation of return statements in functions 15902marked with @code{returns_nonnull} function attribute, to detect returning 15903of null values from such functions. 15904 15905@item -fsanitize=bool 15906@opindex fsanitize=bool 15907 15908This option enables instrumentation of loads from bool. If a value other 15909than 0/1 is loaded, a run-time error is issued. 15910 15911@item -fsanitize=enum 15912@opindex fsanitize=enum 15913 15914This option enables instrumentation of loads from an enum type. If 15915a value outside the range of values for the enum type is loaded, 15916a run-time error is issued. 15917 15918@item -fsanitize=vptr 15919@opindex fsanitize=vptr 15920 15921This option enables instrumentation of C++ member function calls, member 15922accesses and some conversions between pointers to base and derived classes, 15923to verify the referenced object has the correct dynamic type. 15924 15925@item -fsanitize=pointer-overflow 15926@opindex fsanitize=pointer-overflow 15927 15928This option enables instrumentation of pointer arithmetics. If the pointer 15929arithmetics overflows, a run-time error is issued. 15930 15931@item -fsanitize=builtin 15932@opindex fsanitize=builtin 15933 15934This option enables instrumentation of arguments to selected builtin 15935functions. If an invalid value is passed to such arguments, a run-time 15936error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz} 15937or @code{__builtin_clz} invokes undefined behavior and is diagnosed 15938by this option. 15939 15940@end table 15941 15942While @option{-ftrapv} causes traps for signed overflows to be emitted, 15943@option{-fsanitize=undefined} gives a diagnostic message. 15944This currently works only for the C family of languages. 15945 15946@item -fno-sanitize=all 15947@opindex fno-sanitize=all 15948 15949This option disables all previously enabled sanitizers. 15950@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 15951together. 15952 15953@item -fasan-shadow-offset=@var{number} 15954@opindex fasan-shadow-offset 15955This option forces GCC to use custom shadow offset in AddressSanitizer checks. 15956It is useful for experimenting with different shadow memory layouts in 15957Kernel AddressSanitizer. 15958 15959@item -fsanitize-sections=@var{s1},@var{s2},... 15960@opindex fsanitize-sections 15961Sanitize global variables in selected user-defined sections. @var{si} may 15962contain wildcards. 15963 15964@item -fsanitize-recover@r{[}=@var{opts}@r{]} 15965@opindex fsanitize-recover 15966@opindex fno-sanitize-recover 15967@option{-fsanitize-recover=} controls error recovery mode for sanitizers 15968mentioned in comma-separated list of @var{opts}. Enabling this option 15969for a sanitizer component causes it to attempt to continue 15970running the program as if no error happened. This means multiple 15971runtime errors can be reported in a single program run, and the exit 15972code of the program may indicate success even when errors 15973have been reported. The @option{-fno-sanitize-recover=} option 15974can be used to alter 15975this behavior: only the first detected error is reported 15976and program then exits with a non-zero exit code. 15977 15978Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 15979except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 15980@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero}, 15981@option{-fsanitize=bounds-strict}, 15982@option{-fsanitize=kernel-address} and @option{-fsanitize=address}. 15983For these sanitizers error recovery is turned on by default, 15984except @option{-fsanitize=address}, for which this feature is experimental. 15985@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 15986accepted, the former enables recovery for all sanitizers that support it, 15987the latter disables recovery for all sanitizers that support it. 15988 15989Even if a recovery mode is turned on the compiler side, it needs to be also 15990enabled on the runtime library side, otherwise the failures are still fatal. 15991The runtime library defaults to @code{halt_on_error=0} for 15992ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for 15993AddressSanitizer is @code{halt_on_error=1}. This can be overridden through 15994setting the @code{halt_on_error} flag in the corresponding environment variable. 15995 15996Syntax without an explicit @var{opts} parameter is deprecated. It is 15997equivalent to specifying an @var{opts} list of: 15998 15999@smallexample 16000undefined,float-cast-overflow,float-divide-by-zero,bounds-strict 16001@end smallexample 16002 16003@item -fsanitize-address-use-after-scope 16004@opindex fsanitize-address-use-after-scope 16005Enable sanitization of local variables to detect use-after-scope bugs. 16006The option sets @option{-fstack-reuse} to @samp{none}. 16007 16008@item -fsanitize-undefined-trap-on-error 16009@opindex fsanitize-undefined-trap-on-error 16010The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 16011report undefined behavior using @code{__builtin_trap} rather than 16012a @code{libubsan} library routine. The advantage of this is that the 16013@code{libubsan} library is not needed and is not linked in, so this 16014is usable even in freestanding environments. 16015 16016@item -fsanitize-coverage=trace-pc 16017@opindex fsanitize-coverage=trace-pc 16018Enable coverage-guided fuzzing code instrumentation. 16019Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block. 16020 16021@item -fsanitize-coverage=trace-cmp 16022@opindex fsanitize-coverage=trace-cmp 16023Enable dataflow guided fuzzing code instrumentation. 16024Inserts a call to @code{__sanitizer_cov_trace_cmp1}, 16025@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or 16026@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands 16027variable or @code{__sanitizer_cov_trace_const_cmp1}, 16028@code{__sanitizer_cov_trace_const_cmp2}, 16029@code{__sanitizer_cov_trace_const_cmp4} or 16030@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one 16031operand constant, @code{__sanitizer_cov_trace_cmpf} or 16032@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and 16033@code{__sanitizer_cov_trace_switch} for switch statements. 16034 16035@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} 16036@opindex fcf-protection 16037Enable code instrumentation of control-flow transfers to increase 16038program security by checking that target addresses of control-flow 16039transfer instructions (such as indirect function call, function return, 16040indirect jump) are valid. This prevents diverting the flow of control 16041to an unexpected target. This is intended to protect against such 16042threats as Return-oriented Programming (ROP), and similarly 16043call/jmp-oriented programming (COP/JOP). 16044 16045The value @code{branch} tells the compiler to implement checking of 16046validity of control-flow transfer at the point of indirect branch 16047instructions, i.e.@: call/jmp instructions. The value @code{return} 16048implements checking of validity at the point of returning from a 16049function. The value @code{full} is an alias for specifying both 16050@code{branch} and @code{return}. The value @code{none} turns off 16051instrumentation. 16052 16053The value @code{check} is used for the final link with link-time 16054optimization (LTO). An error is issued if LTO object files are 16055compiled with different @option{-fcf-protection} values. The 16056value @code{check} is ignored at the compile time. 16057 16058The macro @code{__CET__} is defined when @option{-fcf-protection} is 16059used. The first bit of @code{__CET__} is set to 1 for the value 16060@code{branch} and the second bit of @code{__CET__} is set to 1 for 16061the @code{return}. 16062 16063You can also use the @code{nocf_check} attribute to identify 16064which functions and calls should be skipped from instrumentation 16065(@pxref{Function Attributes}). 16066 16067Currently the x86 GNU/Linux target provides an implementation based 16068on Intel Control-flow Enforcement Technology (CET) which works for 16069i686 processor or newer. 16070 16071@item -fharden-compares 16072@opindex fharden-compares 16073For every logical test that survives gimple optimizations and is 16074@emph{not} the condition in a conditional branch (for example, 16075conditions tested for conditional moves, or to store in boolean 16076variables), emit extra code to compute and verify the reversed 16077condition, and to call @code{__builtin_trap} if the results do not 16078match. Use with @samp{-fharden-conditional-branches} to cover all 16079conditionals. 16080 16081@item -fharden-conditional-branches 16082@opindex fharden-conditional-branches 16083For every non-vectorized conditional branch that survives gimple 16084optimizations, emit extra code to compute and verify the reversed 16085condition, and to call @code{__builtin_trap} if the result is 16086unexpected. Use with @samp{-fharden-compares} to cover all 16087conditionals. 16088 16089@item -fstack-protector 16090@opindex fstack-protector 16091Emit extra code to check for buffer overflows, such as stack smashing 16092attacks. This is done by adding a guard variable to functions with 16093vulnerable objects. This includes functions that call @code{alloca}, and 16094functions with buffers larger than or equal to 8 bytes. The guards are 16095initialized when a function is entered and then checked when the function 16096exits. If a guard check fails, an error message is printed and the program 16097exits. Only variables that are actually allocated on the stack are 16098considered, optimized away variables or variables allocated in registers 16099don't count. 16100 16101@item -fstack-protector-all 16102@opindex fstack-protector-all 16103Like @option{-fstack-protector} except that all functions are protected. 16104 16105@item -fstack-protector-strong 16106@opindex fstack-protector-strong 16107Like @option{-fstack-protector} but includes additional functions to 16108be protected --- those that have local array definitions, or have 16109references to local frame addresses. Only variables that are actually 16110allocated on the stack are considered, optimized away variables or variables 16111allocated in registers don't count. 16112 16113@item -fstack-protector-explicit 16114@opindex fstack-protector-explicit 16115Like @option{-fstack-protector} but only protects those functions which 16116have the @code{stack_protect} attribute. 16117 16118@item -fstack-check 16119@opindex fstack-check 16120Generate code to verify that you do not go beyond the boundary of the 16121stack. You should specify this flag if you are running in an 16122environment with multiple threads, but you only rarely need to specify it in 16123a single-threaded environment since stack overflow is automatically 16124detected on nearly all systems if there is only one stack. 16125 16126Note that this switch does not actually cause checking to be done; the 16127operating system or the language runtime must do that. The switch causes 16128generation of code to ensure that they see the stack being extended. 16129 16130You can additionally specify a string parameter: @samp{no} means no 16131checking, @samp{generic} means force the use of old-style checking, 16132@samp{specific} means use the best checking method and is equivalent 16133to bare @option{-fstack-check}. 16134 16135Old-style checking is a generic mechanism that requires no specific 16136target support in the compiler but comes with the following drawbacks: 16137 16138@enumerate 16139@item 16140Modified allocation strategy for large objects: they are always 16141allocated dynamically if their size exceeds a fixed threshold. Note this 16142may change the semantics of some code. 16143 16144@item 16145Fixed limit on the size of the static frame of functions: when it is 16146topped by a particular function, stack checking is not reliable and 16147a warning is issued by the compiler. 16148 16149@item 16150Inefficiency: because of both the modified allocation strategy and the 16151generic implementation, code performance is hampered. 16152@end enumerate 16153 16154Note that old-style stack checking is also the fallback method for 16155@samp{specific} if no target support has been added in the compiler. 16156 16157@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion 16158and stack overflows. @samp{specific} is an excellent choice when compiling 16159Ada code. It is not generally sufficient to protect against stack-clash 16160attacks. To protect against those you want @samp{-fstack-clash-protection}. 16161 16162@item -fstack-clash-protection 16163@opindex fstack-clash-protection 16164Generate code to prevent stack clash style attacks. When this option is 16165enabled, the compiler will only allocate one page of stack space at a time 16166and each page is accessed immediately after allocation. Thus, it prevents 16167allocations from jumping over any stack guard page provided by the 16168operating system. 16169 16170Most targets do not fully support stack clash protection. However, on 16171those targets @option{-fstack-clash-protection} will protect dynamic stack 16172allocations. @option{-fstack-clash-protection} may also provide limited 16173protection for static stack allocations if the target supports 16174@option{-fstack-check=specific}. 16175 16176@item -fstack-limit-register=@var{reg} 16177@itemx -fstack-limit-symbol=@var{sym} 16178@itemx -fno-stack-limit 16179@opindex fstack-limit-register 16180@opindex fstack-limit-symbol 16181@opindex fno-stack-limit 16182Generate code to ensure that the stack does not grow beyond a certain value, 16183either the value of a register or the address of a symbol. If a larger 16184stack is required, a signal is raised at run time. For most targets, 16185the signal is raised before the stack overruns the boundary, so 16186it is possible to catch the signal without taking special precautions. 16187 16188For instance, if the stack starts at absolute address @samp{0x80000000} 16189and grows downwards, you can use the flags 16190@option{-fstack-limit-symbol=__stack_limit} and 16191@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 16192of 128KB@. Note that this may only work with the GNU linker. 16193 16194You can locally override stack limit checking by using the 16195@code{no_stack_limit} function attribute (@pxref{Function Attributes}). 16196 16197@item -fsplit-stack 16198@opindex fsplit-stack 16199Generate code to automatically split the stack before it overflows. 16200The resulting program has a discontiguous stack which can only 16201overflow if the program is unable to allocate any more memory. This 16202is most useful when running threaded programs, as it is no longer 16203necessary to calculate a good stack size to use for each thread. This 16204is currently only implemented for the x86 targets running 16205GNU/Linux. 16206 16207When code compiled with @option{-fsplit-stack} calls code compiled 16208without @option{-fsplit-stack}, there may not be much stack space 16209available for the latter code to run. If compiling all code, 16210including library code, with @option{-fsplit-stack} is not an option, 16211then the linker can fix up these calls so that the code compiled 16212without @option{-fsplit-stack} always has a large stack. Support for 16213this is implemented in the gold linker in GNU binutils release 2.21 16214and later. 16215 16216@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 16217@opindex fvtable-verify 16218This option is only available when compiling C++ code. 16219It turns on (or off, if using @option{-fvtable-verify=none}) the security 16220feature that verifies at run time, for every virtual call, that 16221the vtable pointer through which the call is made is valid for the type of 16222the object, and has not been corrupted or overwritten. If an invalid vtable 16223pointer is detected at run time, an error is reported and execution of the 16224program is immediately halted. 16225 16226This option causes run-time data structures to be built at program startup, 16227which are used for verifying the vtable pointers. 16228The options @samp{std} and @samp{preinit} 16229control the timing of when these data structures are built. In both cases the 16230data structures are built before execution reaches @code{main}. Using 16231@option{-fvtable-verify=std} causes the data structures to be built after 16232shared libraries have been loaded and initialized. 16233@option{-fvtable-verify=preinit} causes them to be built before shared 16234libraries have been loaded and initialized. 16235 16236If this option appears multiple times in the command line with different 16237values specified, @samp{none} takes highest priority over both @samp{std} and 16238@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 16239 16240@item -fvtv-debug 16241@opindex fvtv-debug 16242When used in conjunction with @option{-fvtable-verify=std} or 16243@option{-fvtable-verify=preinit}, causes debug versions of the 16244runtime functions for the vtable verification feature to be called. 16245This flag also causes the compiler to log information about which 16246vtable pointers it finds for each class. 16247This information is written to a file named @file{vtv_set_ptr_data.log} 16248in the directory named by the environment variable @env{VTV_LOGS_DIR} 16249if that is defined or the current working directory otherwise. 16250 16251Note: This feature @emph{appends} data to the log file. If you want a fresh log 16252file, be sure to delete any existing one. 16253 16254@item -fvtv-counts 16255@opindex fvtv-counts 16256This is a debugging flag. When used in conjunction with 16257@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 16258causes the compiler to keep track of the total number of virtual calls 16259it encounters and the number of verifications it inserts. It also 16260counts the number of calls to certain run-time library functions 16261that it inserts and logs this information for each compilation unit. 16262The compiler writes this information to a file named 16263@file{vtv_count_data.log} in the directory named by the environment 16264variable @env{VTV_LOGS_DIR} if that is defined or the current working 16265directory otherwise. It also counts the size of the vtable pointer sets 16266for each class, and writes this information to @file{vtv_class_set_sizes.log} 16267in the same directory. 16268 16269Note: This feature @emph{appends} data to the log files. To get fresh log 16270files, be sure to delete any existing ones. 16271 16272@item -finstrument-functions 16273@opindex finstrument-functions 16274Generate instrumentation calls for entry and exit to functions. Just 16275after function entry and just before function exit, the following 16276profiling functions are called with the address of the current 16277function and its call site. (On some platforms, 16278@code{__builtin_return_address} does not work beyond the current 16279function, so the call site information may not be available to the 16280profiling functions otherwise.) 16281 16282@smallexample 16283void __cyg_profile_func_enter (void *this_fn, 16284 void *call_site); 16285void __cyg_profile_func_exit (void *this_fn, 16286 void *call_site); 16287@end smallexample 16288 16289The first argument is the address of the start of the current function, 16290which may be looked up exactly in the symbol table. 16291 16292This instrumentation is also done for functions expanded inline in other 16293functions. The profiling calls indicate where, conceptually, the 16294inline function is entered and exited. This means that addressable 16295versions of such functions must be available. If all your uses of a 16296function are expanded inline, this may mean an additional expansion of 16297code size. If you use @code{extern inline} in your C code, an 16298addressable version of such functions must be provided. (This is 16299normally the case anyway, but if you get lucky and the optimizer always 16300expands the functions inline, you might have gotten away without 16301providing static copies.) 16302 16303A function may be given the attribute @code{no_instrument_function}, in 16304which case this instrumentation is not done. This can be used, for 16305example, for the profiling functions listed above, high-priority 16306interrupt routines, and any functions from which the profiling functions 16307cannot safely be called (perhaps signal handlers, if the profiling 16308routines generate output or allocate memory). 16309@xref{Common Function Attributes}. 16310 16311@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 16312@opindex finstrument-functions-exclude-file-list 16313 16314Set the list of functions that are excluded from instrumentation (see 16315the description of @option{-finstrument-functions}). If the file that 16316contains a function definition matches with one of @var{file}, then 16317that function is not instrumented. The match is done on substrings: 16318if the @var{file} parameter is a substring of the file name, it is 16319considered to be a match. 16320 16321For example: 16322 16323@smallexample 16324-finstrument-functions-exclude-file-list=/bits/stl,include/sys 16325@end smallexample 16326 16327@noindent 16328excludes any inline function defined in files whose pathnames 16329contain @file{/bits/stl} or @file{include/sys}. 16330 16331If, for some reason, you want to include letter @samp{,} in one of 16332@var{sym}, write @samp{\,}. For example, 16333@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 16334(note the single quote surrounding the option). 16335 16336@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 16337@opindex finstrument-functions-exclude-function-list 16338 16339This is similar to @option{-finstrument-functions-exclude-file-list}, 16340but this option sets the list of function names to be excluded from 16341instrumentation. The function name to be matched is its user-visible 16342name, such as @code{vector<int> blah(const vector<int> &)}, not the 16343internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 16344match is done on substrings: if the @var{sym} parameter is a substring 16345of the function name, it is considered to be a match. For C99 and C++ 16346extended identifiers, the function name must be given in UTF-8, not 16347using universal character names. 16348 16349@item -fpatchable-function-entry=@var{N}[,@var{M}] 16350@opindex fpatchable-function-entry 16351Generate @var{N} NOPs right at the beginning 16352of each function, with the function entry point before the @var{M}th NOP. 16353If @var{M} is omitted, it defaults to @code{0} so the 16354function entry points to the address just at the first NOP. 16355The NOP instructions reserve extra space which can be used to patch in 16356any desired instrumentation at run time, provided that the code segment 16357is writable. The amount of space is controllable indirectly via 16358the number of NOPs; the NOP instruction used corresponds to the instruction 16359emitted by the internal GCC back-end interface @code{gen_nop}. This behavior 16360is target-specific and may also depend on the architecture variant and/or 16361other compilation options. 16362 16363For run-time identification, the starting addresses of these areas, 16364which correspond to their respective function entries minus @var{M}, 16365are additionally collected in the @code{__patchable_function_entries} 16366section of the resulting binary. 16367 16368Note that the value of @code{__attribute__ ((patchable_function_entry 16369(N,M)))} takes precedence over command-line option 16370@option{-fpatchable-function-entry=N,M}. This can be used to increase 16371the area size or to remove it completely on a single function. 16372If @code{N=0}, no pad location is recorded. 16373 16374The NOP instructions are inserted at---and maybe before, depending on 16375@var{M}---the function entry address, even before the prologue. 16376 16377The maximum value of @var{N} and @var{M} is 65535. 16378@end table 16379 16380 16381@node Preprocessor Options 16382@section Options Controlling the Preprocessor 16383@cindex preprocessor options 16384@cindex options, preprocessor 16385 16386These options control the C preprocessor, which is run on each C source 16387file before actual compilation. 16388 16389If you use the @option{-E} option, nothing is done except preprocessing. 16390Some of these options make sense only together with @option{-E} because 16391they cause the preprocessor output to be unsuitable for actual 16392compilation. 16393 16394In addition to the options listed here, there are a number of options 16395to control search paths for include files documented in 16396@ref{Directory Options}. 16397Options to control preprocessor diagnostics are listed in 16398@ref{Warning Options}. 16399 16400@table @gcctabopt 16401@include cppopts.texi 16402 16403@item -Wp,@var{option} 16404@opindex Wp 16405You can use @option{-Wp,@var{option}} to bypass the compiler driver 16406and pass @var{option} directly through to the preprocessor. If 16407@var{option} contains commas, it is split into multiple options at the 16408commas. However, many options are modified, translated or interpreted 16409by the compiler driver before being passed to the preprocessor, and 16410@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 16411interface is undocumented and subject to change, so whenever possible 16412you should avoid using @option{-Wp} and let the driver handle the 16413options instead. 16414 16415@item -Xpreprocessor @var{option} 16416@opindex Xpreprocessor 16417Pass @var{option} as an option to the preprocessor. You can use this to 16418supply system-specific preprocessor options that GCC does not 16419recognize. 16420 16421If you want to pass an option that takes an argument, you must use 16422@option{-Xpreprocessor} twice, once for the option and once for the argument. 16423 16424@item -no-integrated-cpp 16425@opindex no-integrated-cpp 16426Perform preprocessing as a separate pass before compilation. 16427By default, GCC performs preprocessing as an integrated part of 16428input tokenization and parsing. 16429If this option is provided, the appropriate language front end 16430(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 16431and Objective-C, respectively) is instead invoked twice, 16432once for preprocessing only and once for actual compilation 16433of the preprocessed input. 16434This option may be useful in conjunction with the @option{-B} or 16435@option{-wrapper} options to specify an alternate preprocessor or 16436perform additional processing of the program source between 16437normal preprocessing and compilation. 16438 16439@item -flarge-source-files 16440@opindex flarge-source-files 16441Adjust GCC to expect large source files, at the expense of slower 16442compilation and higher memory usage. 16443 16444Specifically, GCC normally tracks both column numbers and line numbers 16445within source files and it normally prints both of these numbers in 16446diagnostics. However, once it has processed a certain number of source 16447lines, it stops tracking column numbers and only tracks line numbers. 16448This means that diagnostics for later lines do not include column numbers. 16449It also means that options like @option{-Wmisleading-indentation} cease to work 16450at that point, although the compiler prints a note if this happens. 16451Passing @option{-flarge-source-files} significantly increases the number 16452of source lines that GCC can process before it stops tracking columns. 16453 16454@end table 16455 16456@node Assembler Options 16457@section Passing Options to the Assembler 16458 16459@c prevent bad page break with this line 16460You can pass options to the assembler. 16461 16462@table @gcctabopt 16463@item -Wa,@var{option} 16464@opindex Wa 16465Pass @var{option} as an option to the assembler. If @var{option} 16466contains commas, it is split into multiple options at the commas. 16467 16468@item -Xassembler @var{option} 16469@opindex Xassembler 16470Pass @var{option} as an option to the assembler. You can use this to 16471supply system-specific assembler options that GCC does not 16472recognize. 16473 16474If you want to pass an option that takes an argument, you must use 16475@option{-Xassembler} twice, once for the option and once for the argument. 16476 16477@end table 16478 16479@node Link Options 16480@section Options for Linking 16481@cindex link options 16482@cindex options, linking 16483 16484These options come into play when the compiler links object files into 16485an executable output file. They are meaningless if the compiler is 16486not doing a link step. 16487 16488@table @gcctabopt 16489@cindex file names 16490@item @var{object-file-name} 16491A file name that does not end in a special recognized suffix is 16492considered to name an object file or library. (Object files are 16493distinguished from libraries by the linker according to the file 16494contents.) If linking is done, these object files are used as input 16495to the linker. 16496 16497@item -c 16498@itemx -S 16499@itemx -E 16500@opindex c 16501@opindex S 16502@opindex E 16503If any of these options is used, then the linker is not run, and 16504object file names should not be used as arguments. @xref{Overall 16505Options}. 16506 16507@item -flinker-output=@var{type} 16508@opindex flinker-output 16509This option controls code generation of the link-time optimizer. By 16510default the linker output is automatically determined by the linker 16511plugin. For debugging the compiler and if incremental linking with a 16512non-LTO object file is desired, it may be useful to control the type 16513manually. 16514 16515If @var{type} is @samp{exec}, code generation produces a static 16516binary. In this case @option{-fpic} and @option{-fpie} are both 16517disabled. 16518 16519If @var{type} is @samp{dyn}, code generation produces a shared 16520library. In this case @option{-fpic} or @option{-fPIC} is preserved, 16521but not enabled automatically. This allows to build shared libraries 16522without position-independent code on architectures where this is 16523possible, i.e.@: on x86. 16524 16525If @var{type} is @samp{pie}, code generation produces an @option{-fpie} 16526executable. This results in similar optimizations as @samp{exec} 16527except that @option{-fpie} is not disabled if specified at compilation 16528time. 16529 16530If @var{type} is @samp{rel}, the compiler assumes that incremental linking is 16531done. The sections containing intermediate code for link-time optimization are 16532merged, pre-optimized, and output to the resulting object file. In addition, if 16533@option{-ffat-lto-objects} is specified, binary code is produced for future 16534non-LTO linking. The object file produced by incremental linking is smaller 16535than a static library produced from the same object files. At link time the 16536result of incremental linking also loads faster than a static 16537library assuming that the majority of objects in the library are used. 16538 16539Finally @samp{nolto-rel} configures the compiler for incremental linking where 16540code generation is forced, a final binary is produced, and the intermediate 16541code for later link-time optimization is stripped. When multiple object files 16542are linked together the resulting code is better optimized than with 16543link-time optimizations disabled (for example, cross-module inlining 16544happens), but most of benefits of whole program optimizations are lost. 16545 16546During the incremental link (by @option{-r}) the linker plugin defaults to 16547@option{rel}. With current interfaces to GNU Binutils it is however not 16548possible to incrementally link LTO objects and non-LTO objects into a single 16549mixed object file. If any of object files in incremental link cannot 16550be used for link-time optimization, the linker plugin issues a warning and 16551uses @samp{nolto-rel}. To maintain whole program optimization, it is 16552recommended to link such objects into static library instead. Alternatively it 16553is possible to use H.J. Lu's binutils with support for mixed objects. 16554 16555@item -fuse-ld=bfd 16556@opindex fuse-ld=bfd 16557Use the @command{bfd} linker instead of the default linker. 16558 16559@item -fuse-ld=gold 16560@opindex fuse-ld=gold 16561Use the @command{gold} linker instead of the default linker. 16562 16563@item -fuse-ld=lld 16564@opindex fuse-ld=lld 16565Use the LLVM @command{lld} linker instead of the default linker. 16566 16567@item -fuse-ld=mold 16568@opindex fuse-ld=mold 16569Use the Modern Linker (@command{mold}) instead of the default linker. 16570 16571@cindex Libraries 16572@item -l@var{library} 16573@itemx -l @var{library} 16574@opindex l 16575Search the library named @var{library} when linking. (The second 16576alternative with the library as a separate argument is only for 16577POSIX compliance and is not recommended.) 16578 16579The @option{-l} option is passed directly to the linker by GCC. Refer 16580to your linker documentation for exact details. The general 16581description below applies to the GNU linker. 16582 16583The linker searches a standard list of directories for the library. 16584The directories searched include several standard system directories 16585plus any that you specify with @option{-L}. 16586 16587Static libraries are archives of object files, and have file names 16588like @file{lib@var{library}.a}. Some targets also support shared 16589libraries, which typically have names like @file{lib@var{library}.so}. 16590If both static and shared libraries are found, the linker gives 16591preference to linking with the shared library unless the 16592@option{-static} option is used. 16593 16594It makes a difference where in the command you write this option; the 16595linker searches and processes libraries and object files in the order they 16596are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 16597after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 16598to functions in @samp{z}, those functions may not be loaded. 16599 16600@item -lobjc 16601@opindex lobjc 16602You need this special case of the @option{-l} option in order to 16603link an Objective-C or Objective-C++ program. 16604 16605@item -nostartfiles 16606@opindex nostartfiles 16607Do not use the standard system startup files when linking. 16608The standard system libraries are used normally, unless @option{-nostdlib}, 16609@option{-nolibc}, or @option{-nodefaultlibs} is used. 16610 16611@item -nodefaultlibs 16612@opindex nodefaultlibs 16613Do not use the standard system libraries when linking. 16614Only the libraries you specify are passed to the linker, and options 16615specifying linkage of the system libraries, such as @option{-static-libgcc} 16616or @option{-shared-libgcc}, are ignored. 16617The standard startup files are used normally, unless @option{-nostartfiles} 16618is used. 16619 16620The compiler may generate calls to @code{memcmp}, 16621@code{memset}, @code{memcpy} and @code{memmove}. 16622These entries are usually resolved by entries in 16623libc. These entry points should be supplied through some other 16624mechanism when this option is specified. 16625 16626@item -nolibc 16627@opindex nolibc 16628Do not use the C library or system libraries tightly coupled with it when 16629linking. Still link with the startup files, @file{libgcc} or toolchain 16630provided language support libraries such as @file{libgnat}, @file{libgfortran} 16631or @file{libstdc++} unless options preventing their inclusion are used as 16632well. This typically removes @option{-lc} from the link command line, as well 16633as system libraries that normally go with it and become meaningless when 16634absence of a C library is assumed, for example @option{-lpthread} or 16635@option{-lm} in some configurations. This is intended for bare-board 16636targets when there is indeed no C library available. 16637 16638@item -nostdlib 16639@opindex nostdlib 16640Do not use the standard system startup files or libraries when linking. 16641No startup files and only the libraries you specify are passed to 16642the linker, and options specifying linkage of the system libraries, such as 16643@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 16644 16645The compiler may generate calls to @code{memcmp}, @code{memset}, 16646@code{memcpy} and @code{memmove}. 16647These entries are usually resolved by entries in 16648libc. These entry points should be supplied through some other 16649mechanism when this option is specified. 16650 16651@cindex @option{-lgcc}, use with @option{-nostdlib} 16652@cindex @option{-nostdlib} and unresolved references 16653@cindex unresolved references and @option{-nostdlib} 16654@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 16655@cindex @option{-nodefaultlibs} and unresolved references 16656@cindex unresolved references and @option{-nodefaultlibs} 16657One of the standard libraries bypassed by @option{-nostdlib} and 16658@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 16659which GCC uses to overcome shortcomings of particular machines, or special 16660needs for some languages. 16661(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 16662Collection (GCC) Internals}, 16663for more discussion of @file{libgcc.a}.) 16664In most cases, you need @file{libgcc.a} even when you want to avoid 16665other standard libraries. In other words, when you specify @option{-nostdlib} 16666or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 16667This ensures that you have no unresolved references to internal GCC 16668library subroutines. 16669(An example of such an internal subroutine is @code{__main}, used to ensure C++ 16670constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 16671GNU Compiler Collection (GCC) Internals}.) 16672 16673@item -e @var{entry} 16674@itemx --entry=@var{entry} 16675@opindex e 16676@opindex entry 16677 16678Specify that the program entry point is @var{entry}. The argument is 16679interpreted by the linker; the GNU linker accepts either a symbol name 16680or an address. 16681 16682@item -pie 16683@opindex pie 16684Produce a dynamically linked position independent executable on targets 16685that support it. For predictable results, you must also specify the same 16686set of options used for compilation (@option{-fpie}, @option{-fPIE}, 16687or model suboptions) when you specify this linker option. 16688 16689@item -no-pie 16690@opindex no-pie 16691Don't produce a dynamically linked position independent executable. 16692 16693@item -static-pie 16694@opindex static-pie 16695Produce a static position independent executable on targets that support 16696it. A static position independent executable is similar to a static 16697executable, but can be loaded at any address without a dynamic linker. 16698For predictable results, you must also specify the same set of options 16699used for compilation (@option{-fpie}, @option{-fPIE}, or model 16700suboptions) when you specify this linker option. 16701 16702@item -pthread 16703@opindex pthread 16704Link with the POSIX threads library. This option is supported on 16705GNU/Linux targets, most other Unix derivatives, and also on 16706x86 Cygwin and MinGW targets. On some targets this option also sets 16707flags for the preprocessor, so it should be used consistently for both 16708compilation and linking. 16709 16710@item -r 16711@opindex r 16712Produce a relocatable object as output. This is also known as partial 16713linking. 16714 16715@item -rdynamic 16716@opindex rdynamic 16717Pass the flag @option{-export-dynamic} to the ELF linker, on targets 16718that support it. This instructs the linker to add all symbols, not 16719only used ones, to the dynamic symbol table. This option is needed 16720for some uses of @code{dlopen} or to allow obtaining backtraces 16721from within a program. 16722 16723@item -s 16724@opindex s 16725Remove all symbol table and relocation information from the executable. 16726 16727@item -static 16728@opindex static 16729On systems that support dynamic linking, this overrides @option{-pie} 16730and prevents linking with the shared libraries. On other systems, this 16731option has no effect. 16732 16733@item -shared 16734@opindex shared 16735Produce a shared object which can then be linked with other objects to 16736form an executable. Not all systems support this option. For predictable 16737results, you must also specify the same set of options used for compilation 16738(@option{-fpic}, @option{-fPIC}, or model suboptions) when 16739you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 16740needs to build supplementary stub code for constructors to work. On 16741multi-libbed systems, @samp{gcc -shared} must select the correct support 16742libraries to link against. Failing to supply the correct flags may lead 16743to subtle defects. Supplying them in cases where they are not necessary 16744is innocuous.} 16745 16746@item -shared-libgcc 16747@itemx -static-libgcc 16748@opindex shared-libgcc 16749@opindex static-libgcc 16750On systems that provide @file{libgcc} as a shared library, these options 16751force the use of either the shared or static version, respectively. 16752If no shared version of @file{libgcc} was built when the compiler was 16753configured, these options have no effect. 16754 16755There are several situations in which an application should use the 16756shared @file{libgcc} instead of the static version. The most common 16757of these is when the application wishes to throw and catch exceptions 16758across different shared libraries. In that case, each of the libraries 16759as well as the application itself should use the shared @file{libgcc}. 16760 16761Therefore, the G++ driver automatically adds @option{-shared-libgcc} 16762whenever you build a shared library or a main executable, because C++ 16763programs typically use exceptions, so this is the right thing to do. 16764 16765If, instead, you use the GCC driver to create shared libraries, you may 16766find that they are not always linked with the shared @file{libgcc}. 16767If GCC finds, at its configuration time, that you have a non-GNU linker 16768or a GNU linker that does not support option @option{--eh-frame-hdr}, 16769it links the shared version of @file{libgcc} into shared libraries 16770by default. Otherwise, it takes advantage of the linker and optimizes 16771away the linking with the shared version of @file{libgcc}, linking with 16772the static version of libgcc by default. This allows exceptions to 16773propagate through such shared libraries, without incurring relocation 16774costs at library load time. 16775 16776However, if a library or main executable is supposed to throw or catch 16777exceptions, you must link it using the G++ driver, or using the option 16778@option{-shared-libgcc}, such that it is linked with the shared 16779@file{libgcc}. 16780 16781@item -static-libasan 16782@opindex static-libasan 16783When the @option{-fsanitize=address} option is used to link a program, 16784the GCC driver automatically links against @option{libasan}. If 16785@file{libasan} is available as a shared library, and the @option{-static} 16786option is not used, then this links against the shared version of 16787@file{libasan}. The @option{-static-libasan} option directs the GCC 16788driver to link @file{libasan} statically, without necessarily linking 16789other libraries statically. 16790 16791@item -static-libtsan 16792@opindex static-libtsan 16793When the @option{-fsanitize=thread} option is used to link a program, 16794the GCC driver automatically links against @option{libtsan}. If 16795@file{libtsan} is available as a shared library, and the @option{-static} 16796option is not used, then this links against the shared version of 16797@file{libtsan}. The @option{-static-libtsan} option directs the GCC 16798driver to link @file{libtsan} statically, without necessarily linking 16799other libraries statically. 16800 16801@item -static-liblsan 16802@opindex static-liblsan 16803When the @option{-fsanitize=leak} option is used to link a program, 16804the GCC driver automatically links against @option{liblsan}. If 16805@file{liblsan} is available as a shared library, and the @option{-static} 16806option is not used, then this links against the shared version of 16807@file{liblsan}. The @option{-static-liblsan} option directs the GCC 16808driver to link @file{liblsan} statically, without necessarily linking 16809other libraries statically. 16810 16811@item -static-libubsan 16812@opindex static-libubsan 16813When the @option{-fsanitize=undefined} option is used to link a program, 16814the GCC driver automatically links against @option{libubsan}. If 16815@file{libubsan} is available as a shared library, and the @option{-static} 16816option is not used, then this links against the shared version of 16817@file{libubsan}. The @option{-static-libubsan} option directs the GCC 16818driver to link @file{libubsan} statically, without necessarily linking 16819other libraries statically. 16820 16821@item -static-libstdc++ 16822@opindex static-libstdc++ 16823When the @command{g++} program is used to link a C++ program, it 16824normally automatically links against @option{libstdc++}. If 16825@file{libstdc++} is available as a shared library, and the 16826@option{-static} option is not used, then this links against the 16827shared version of @file{libstdc++}. That is normally fine. However, it 16828is sometimes useful to freeze the version of @file{libstdc++} used by 16829the program without going all the way to a fully static link. The 16830@option{-static-libstdc++} option directs the @command{g++} driver to 16831link @file{libstdc++} statically, without necessarily linking other 16832libraries statically. 16833 16834@item -symbolic 16835@opindex symbolic 16836Bind references to global symbols when building a shared object. Warn 16837about any unresolved references (unless overridden by the link editor 16838option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 16839this option. 16840 16841@item -T @var{script} 16842@opindex T 16843@cindex linker script 16844Use @var{script} as the linker script. This option is supported by most 16845systems using the GNU linker. On some targets, such as bare-board 16846targets without an operating system, the @option{-T} option may be required 16847when linking to avoid references to undefined symbols. 16848 16849@item -Xlinker @var{option} 16850@opindex Xlinker 16851Pass @var{option} as an option to the linker. You can use this to 16852supply system-specific linker options that GCC does not recognize. 16853 16854If you want to pass an option that takes a separate argument, you must use 16855@option{-Xlinker} twice, once for the option and once for the argument. 16856For example, to pass @option{-assert definitions}, you must write 16857@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 16858@option{-Xlinker "-assert definitions"}, because this passes the entire 16859string as a single argument, which is not what the linker expects. 16860 16861When using the GNU linker, it is usually more convenient to pass 16862arguments to linker options using the @option{@var{option}=@var{value}} 16863syntax than as separate arguments. For example, you can specify 16864@option{-Xlinker -Map=output.map} rather than 16865@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 16866this syntax for command-line options. 16867 16868@item -Wl,@var{option} 16869@opindex Wl 16870Pass @var{option} as an option to the linker. If @var{option} contains 16871commas, it is split into multiple options at the commas. You can use this 16872syntax to pass an argument to the option. 16873For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 16874linker. When using the GNU linker, you can also get the same effect with 16875@option{-Wl,-Map=output.map}. 16876 16877@item -u @var{symbol} 16878@opindex u 16879Pretend the symbol @var{symbol} is undefined, to force linking of 16880library modules to define it. You can use @option{-u} multiple times with 16881different symbols to force loading of additional library modules. 16882 16883@item -z @var{keyword} 16884@opindex z 16885@option{-z} is passed directly on to the linker along with the keyword 16886@var{keyword}. See the section in the documentation of your linker for 16887permitted values and their meanings. 16888@end table 16889 16890@node Directory Options 16891@section Options for Directory Search 16892@cindex directory options 16893@cindex options, directory search 16894@cindex search path 16895 16896These options specify directories to search for header files, for 16897libraries and for parts of the compiler: 16898 16899@table @gcctabopt 16900@include cppdiropts.texi 16901 16902@item -iplugindir=@var{dir} 16903@opindex iplugindir= 16904Set the directory to search for plugins that are passed 16905by @option{-fplugin=@var{name}} instead of 16906@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 16907to be used by the user, but only passed by the driver. 16908 16909@item -L@var{dir} 16910@opindex L 16911Add directory @var{dir} to the list of directories to be searched 16912for @option{-l}. 16913 16914@item -B@var{prefix} 16915@opindex B 16916This option specifies where to find the executables, libraries, 16917include files, and data files of the compiler itself. 16918 16919The compiler driver program runs one or more of the subprograms 16920@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 16921@var{prefix} as a prefix for each program it tries to run, both with and 16922without @samp{@var{machine}/@var{version}/} for the corresponding target 16923machine and compiler version. 16924 16925For each subprogram to be run, the compiler driver first tries the 16926@option{-B} prefix, if any. If that name is not found, or if @option{-B} 16927is not specified, the driver tries two standard prefixes, 16928@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 16929those results in a file name that is found, the unmodified program 16930name is searched for using the directories specified in your 16931@env{PATH} environment variable. 16932 16933The compiler checks to see if the path provided by @option{-B} 16934refers to a directory, and if necessary it adds a directory 16935separator character at the end of the path. 16936 16937@option{-B} prefixes that effectively specify directory names also apply 16938to libraries in the linker, because the compiler translates these 16939options into @option{-L} options for the linker. They also apply to 16940include files in the preprocessor, because the compiler translates these 16941options into @option{-isystem} options for the preprocessor. In this case, 16942the compiler appends @samp{include} to the prefix. 16943 16944The runtime support file @file{libgcc.a} can also be searched for using 16945the @option{-B} prefix, if needed. If it is not found there, the two 16946standard prefixes above are tried, and that is all. The file is left 16947out of the link if it is not found by those means. 16948 16949Another way to specify a prefix much like the @option{-B} prefix is to use 16950the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 16951Variables}. 16952 16953As a special kludge, if the path provided by @option{-B} is 16954@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 169559, then it is replaced by @file{[dir/]include}. This is to help 16956with boot-strapping the compiler. 16957 16958@item -no-canonical-prefixes 16959@opindex no-canonical-prefixes 16960Do not expand any symbolic links, resolve references to @samp{/../} 16961or @samp{/./}, or make the path absolute when generating a relative 16962prefix. 16963 16964@item --sysroot=@var{dir} 16965@opindex sysroot 16966Use @var{dir} as the logical root directory for headers and libraries. 16967For example, if the compiler normally searches for headers in 16968@file{/usr/include} and libraries in @file{/usr/lib}, it instead 16969searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 16970 16971If you use both this option and the @option{-isysroot} option, then 16972the @option{--sysroot} option applies to libraries, but the 16973@option{-isysroot} option applies to header files. 16974 16975The GNU linker (beginning with version 2.16) has the necessary support 16976for this option. If your linker does not support this option, the 16977header file aspect of @option{--sysroot} still works, but the 16978library aspect does not. 16979 16980@item --no-sysroot-suffix 16981@opindex no-sysroot-suffix 16982For some targets, a suffix is added to the root directory specified 16983with @option{--sysroot}, depending on the other options used, so that 16984headers may for example be found in 16985@file{@var{dir}/@var{suffix}/usr/include} instead of 16986@file{@var{dir}/usr/include}. This option disables the addition of 16987such a suffix. 16988 16989@end table 16990 16991@node Code Gen Options 16992@section Options for Code Generation Conventions 16993@cindex code generation conventions 16994@cindex options, code generation 16995@cindex run-time options 16996 16997These machine-independent options control the interface conventions 16998used in code generation. 16999 17000Most of them have both positive and negative forms; the negative form 17001of @option{-ffoo} is @option{-fno-foo}. In the table below, only 17002one of the forms is listed---the one that is not the default. You 17003can figure out the other form by either removing @samp{no-} or adding 17004it. 17005 17006@table @gcctabopt 17007@item -fstack-reuse=@var{reuse-level} 17008@opindex fstack_reuse 17009This option controls stack space reuse for user declared local/auto variables 17010and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 17011@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 17012local variables and temporaries, @samp{named_vars} enables the reuse only for 17013user defined local variables with names, and @samp{none} disables stack reuse 17014completely. The default value is @samp{all}. The option is needed when the 17015program extends the lifetime of a scoped local variable or a compiler generated 17016temporary beyond the end point defined by the language. When a lifetime of 17017a variable ends, and if the variable lives in memory, the optimizing compiler 17018has the freedom to reuse its stack space with other temporaries or scoped 17019local variables whose live range does not overlap with it. Legacy code extending 17020local lifetime is likely to break with the stack reuse optimization. 17021 17022For example, 17023 17024@smallexample 17025 int *p; 17026 @{ 17027 int local1; 17028 17029 p = &local1; 17030 local1 = 10; 17031 .... 17032 @} 17033 @{ 17034 int local2; 17035 local2 = 20; 17036 ... 17037 @} 17038 17039 if (*p == 10) // out of scope use of local1 17040 @{ 17041 17042 @} 17043@end smallexample 17044 17045Another example: 17046@smallexample 17047 17048 struct A 17049 @{ 17050 A(int k) : i(k), j(k) @{ @} 17051 int i; 17052 int j; 17053 @}; 17054 17055 A *ap; 17056 17057 void foo(const A& ar) 17058 @{ 17059 ap = &ar; 17060 @} 17061 17062 void bar() 17063 @{ 17064 foo(A(10)); // temp object's lifetime ends when foo returns 17065 17066 @{ 17067 A a(20); 17068 .... 17069 @} 17070 ap->i+= 10; // ap references out of scope temp whose space 17071 // is reused with a. What is the value of ap->i? 17072 @} 17073 17074@end smallexample 17075 17076The lifetime of a compiler generated temporary is well defined by the C++ 17077standard. When a lifetime of a temporary ends, and if the temporary lives 17078in memory, the optimizing compiler has the freedom to reuse its stack 17079space with other temporaries or scoped local variables whose live range 17080does not overlap with it. However some of the legacy code relies on 17081the behavior of older compilers in which temporaries' stack space is 17082not reused, the aggressive stack reuse can lead to runtime errors. This 17083option is used to control the temporary stack reuse optimization. 17084 17085@item -ftrapv 17086@opindex ftrapv 17087This option generates traps for signed overflow on addition, subtraction, 17088multiplication operations. 17089The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 17090@option{-ftrapv} @option{-fwrapv} on the command-line results in 17091@option{-fwrapv} being effective. Note that only active options override, so 17092using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 17093results in @option{-ftrapv} being effective. 17094 17095@item -fwrapv 17096@opindex fwrapv 17097This option instructs the compiler to assume that signed arithmetic 17098overflow of addition, subtraction and multiplication wraps around 17099using twos-complement representation. This flag enables some optimizations 17100and disables others. 17101The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 17102@option{-ftrapv} @option{-fwrapv} on the command-line results in 17103@option{-fwrapv} being effective. Note that only active options override, so 17104using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 17105results in @option{-ftrapv} being effective. 17106 17107@item -fwrapv-pointer 17108@opindex fwrapv-pointer 17109This option instructs the compiler to assume that pointer arithmetic 17110overflow on addition and subtraction wraps around using twos-complement 17111representation. This flag disables some optimizations which assume 17112pointer overflow is invalid. 17113 17114@item -fstrict-overflow 17115@opindex fstrict-overflow 17116This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when 17117negated implies @option{-fwrapv} @option{-fwrapv-pointer}. 17118 17119@item -fexceptions 17120@opindex fexceptions 17121Enable exception handling. Generates extra code needed to propagate 17122exceptions. For some targets, this implies GCC generates frame 17123unwind information for all functions, which can produce significant data 17124size overhead, although it does not affect execution. If you do not 17125specify this option, GCC enables it by default for languages like 17126C++ that normally require exception handling, and disables it for 17127languages like C that do not normally require it. However, you may need 17128to enable this option when compiling C code that needs to interoperate 17129properly with exception handlers written in C++. You may also wish to 17130disable this option if you are compiling older C++ programs that don't 17131use exception handling. 17132 17133@item -fnon-call-exceptions 17134@opindex fnon-call-exceptions 17135Generate code that allows trapping instructions to throw exceptions. 17136Note that this requires platform-specific runtime support that does 17137not exist everywhere. Moreover, it only allows @emph{trapping} 17138instructions to throw exceptions, i.e.@: memory references or floating-point 17139instructions. It does not allow exceptions to be thrown from 17140arbitrary signal handlers such as @code{SIGALRM}. This enables 17141@option{-fexceptions}. 17142 17143@item -fdelete-dead-exceptions 17144@opindex fdelete-dead-exceptions 17145Consider that instructions that may throw exceptions but don't otherwise 17146contribute to the execution of the program can be optimized away. 17147This does not affect calls to functions except those with the 17148@code{pure} or @code{const} attributes. 17149This option is enabled by default for the Ada and C++ compilers, as permitted by 17150the language specifications. 17151Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 17152 17153@item -funwind-tables 17154@opindex funwind-tables 17155Similar to @option{-fexceptions}, except that it just generates any needed 17156static data, but does not affect the generated code in any other way. 17157You normally do not need to enable this option; instead, a language processor 17158that needs this handling enables it on your behalf. 17159 17160@item -fasynchronous-unwind-tables 17161@opindex fasynchronous-unwind-tables 17162Generate unwind table in DWARF format, if supported by target machine. The 17163table is exact at each instruction boundary, so it can be used for stack 17164unwinding from asynchronous events (such as debugger or garbage collector). 17165 17166@item -fno-gnu-unique 17167@opindex fno-gnu-unique 17168@opindex fgnu-unique 17169On systems with recent GNU assembler and C library, the C++ compiler 17170uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 17171of template static data members and static local variables in inline 17172functions are unique even in the presence of @code{RTLD_LOCAL}; this 17173is necessary to avoid problems with a library used by two different 17174@code{RTLD_LOCAL} plugins depending on a definition in one of them and 17175therefore disagreeing with the other one about the binding of the 17176symbol. But this causes @code{dlclose} to be ignored for affected 17177DSOs; if your program relies on reinitialization of a DSO via 17178@code{dlclose} and @code{dlopen}, you can use 17179@option{-fno-gnu-unique}. 17180 17181@item -fpcc-struct-return 17182@opindex fpcc-struct-return 17183Return ``short'' @code{struct} and @code{union} values in memory like 17184longer ones, rather than in registers. This convention is less 17185efficient, but it has the advantage of allowing intercallability between 17186GCC-compiled files and files compiled with other compilers, particularly 17187the Portable C Compiler (pcc). 17188 17189The precise convention for returning structures in memory depends 17190on the target configuration macros. 17191 17192Short structures and unions are those whose size and alignment match 17193that of some integer type. 17194 17195@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 17196switch is not binary compatible with code compiled with the 17197@option{-freg-struct-return} switch. 17198Use it to conform to a non-default application binary interface. 17199 17200@item -freg-struct-return 17201@opindex freg-struct-return 17202Return @code{struct} and @code{union} values in registers when possible. 17203This is more efficient for small structures than 17204@option{-fpcc-struct-return}. 17205 17206If you specify neither @option{-fpcc-struct-return} nor 17207@option{-freg-struct-return}, GCC defaults to whichever convention is 17208standard for the target. If there is no standard convention, GCC 17209defaults to @option{-fpcc-struct-return}, except on targets where GCC is 17210the principal compiler. In those cases, we can choose the standard, and 17211we chose the more efficient register return alternative. 17212 17213@strong{Warning:} code compiled with the @option{-freg-struct-return} 17214switch is not binary compatible with code compiled with the 17215@option{-fpcc-struct-return} switch. 17216Use it to conform to a non-default application binary interface. 17217 17218@item -fshort-enums 17219@opindex fshort-enums 17220Allocate to an @code{enum} type only as many bytes as it needs for the 17221declared range of possible values. Specifically, the @code{enum} type 17222is equivalent to the smallest integer type that has enough room. 17223 17224@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 17225code that is not binary compatible with code generated without that switch. 17226Use it to conform to a non-default application binary interface. 17227 17228@item -fshort-wchar 17229@opindex fshort-wchar 17230Override the underlying type for @code{wchar_t} to be @code{short 17231unsigned int} instead of the default for the target. This option is 17232useful for building programs to run under WINE@. 17233 17234@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 17235code that is not binary compatible with code generated without that switch. 17236Use it to conform to a non-default application binary interface. 17237 17238@item -fcommon 17239@opindex fcommon 17240@opindex fno-common 17241@cindex tentative definitions 17242In C code, this option controls the placement of global variables 17243defined without an initializer, known as @dfn{tentative definitions} 17244in the C standard. Tentative definitions are distinct from declarations 17245of a variable with the @code{extern} keyword, which do not allocate storage. 17246 17247The default is @option{-fno-common}, which specifies that the compiler places 17248uninitialized global variables in the BSS section of the object file. 17249This inhibits the merging of tentative definitions by the linker so you get a 17250multiple-definition error if the same variable is accidentally defined in more 17251than one compilation unit. 17252 17253The @option{-fcommon} places uninitialized global variables in a common block. 17254This allows the linker to resolve all tentative definitions of the same variable 17255in different compilation units to the same object, or to a non-tentative 17256definition. This behavior is inconsistent with C++, and on many targets implies 17257a speed and code size penalty on global variable references. It is mainly 17258useful to enable legacy code to link without errors. 17259 17260@item -fno-ident 17261@opindex fno-ident 17262@opindex fident 17263Ignore the @code{#ident} directive. 17264 17265@item -finhibit-size-directive 17266@opindex finhibit-size-directive 17267Don't output a @code{.size} assembler directive, or anything else that 17268would cause trouble if the function is split in the middle, and the 17269two halves are placed at locations far apart in memory. This option is 17270used when compiling @file{crtstuff.c}; you should not need to use it 17271for anything else. 17272 17273@item -fverbose-asm 17274@opindex fverbose-asm 17275Put extra commentary information in the generated assembly code to 17276make it more readable. This option is generally only of use to those 17277who actually need to read the generated assembly code (perhaps while 17278debugging the compiler itself). 17279 17280@option{-fno-verbose-asm}, the default, causes the 17281extra information to be omitted and is useful when comparing two assembler 17282files. 17283 17284The added comments include: 17285 17286@itemize @bullet 17287 17288@item 17289information on the compiler version and command-line options, 17290 17291@item 17292the source code lines associated with the assembly instructions, 17293in the form FILENAME:LINENUMBER:CONTENT OF LINE, 17294 17295@item 17296hints on which high-level expressions correspond to 17297the various assembly instruction operands. 17298 17299@end itemize 17300 17301For example, given this C source file: 17302 17303@smallexample 17304int test (int n) 17305@{ 17306 int i; 17307 int total = 0; 17308 17309 for (i = 0; i < n; i++) 17310 total += i * i; 17311 17312 return total; 17313@} 17314@end smallexample 17315 17316compiling to (x86_64) assembly via @option{-S} and emitting the result 17317direct to stdout via @option{-o} @option{-} 17318 17319@smallexample 17320gcc -S test.c -fverbose-asm -Os -o - 17321@end smallexample 17322 17323gives output similar to this: 17324 17325@smallexample 17326 .file "test.c" 17327# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu) 17328 [...snip...] 17329# options passed: 17330 [...snip...] 17331 17332 .text 17333 .globl test 17334 .type test, @@function 17335test: 17336.LFB0: 17337 .cfi_startproc 17338# test.c:4: int total = 0; 17339 xorl %eax, %eax # <retval> 17340# test.c:6: for (i = 0; i < n; i++) 17341 xorl %edx, %edx # i 17342.L2: 17343# test.c:6: for (i = 0; i < n; i++) 17344 cmpl %edi, %edx # n, i 17345 jge .L5 #, 17346# test.c:7: total += i * i; 17347 movl %edx, %ecx # i, tmp92 17348 imull %edx, %ecx # i, tmp92 17349# test.c:6: for (i = 0; i < n; i++) 17350 incl %edx # i 17351# test.c:7: total += i * i; 17352 addl %ecx, %eax # tmp92, <retval> 17353 jmp .L2 # 17354.L5: 17355# test.c:10: @} 17356 ret 17357 .cfi_endproc 17358.LFE0: 17359 .size test, .-test 17360 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)" 17361 .section .note.GNU-stack,"",@@progbits 17362@end smallexample 17363 17364The comments are intended for humans rather than machines and hence the 17365precise format of the comments is subject to change. 17366 17367@item -frecord-gcc-switches 17368@opindex frecord-gcc-switches 17369This switch causes the command line used to invoke the 17370compiler to be recorded into the object file that is being created. 17371This switch is only implemented on some targets and the exact format 17372of the recording is target and binary file format dependent, but it 17373usually takes the form of a section containing ASCII text. This 17374switch is related to the @option{-fverbose-asm} switch, but that 17375switch only records information in the assembler output file as 17376comments, so it never reaches the object file. 17377See also @option{-grecord-gcc-switches} for another 17378way of storing compiler options into the object file. 17379 17380@item -fpic 17381@opindex fpic 17382@cindex global offset table 17383@cindex PIC 17384Generate position-independent code (PIC) suitable for use in a shared 17385library, if supported for the target machine. Such code accesses all 17386constant addresses through a global offset table (GOT)@. The dynamic 17387loader resolves the GOT entries when the program starts (the dynamic 17388loader is not part of GCC; it is part of the operating system). If 17389the GOT size for the linked executable exceeds a machine-specific 17390maximum size, you get an error message from the linker indicating that 17391@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 17392instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k 17393on the m68k and RS/6000. The x86 has no such limit.) 17394 17395Position-independent code requires special support, and therefore works 17396only on certain machines. For the x86, GCC supports PIC for System V 17397but not for the Sun 386i. Code generated for the IBM RS/6000 is always 17398position-independent. 17399 17400When this flag is set, the macros @code{__pic__} and @code{__PIC__} 17401are defined to 1. 17402 17403@item -fPIC 17404@opindex fPIC 17405If supported for the target machine, emit position-independent code, 17406suitable for dynamic linking and avoiding any limit on the size of the 17407global offset table. This option makes a difference on AArch64, m68k, 17408PowerPC and SPARC@. 17409 17410Position-independent code requires special support, and therefore works 17411only on certain machines. 17412 17413When this flag is set, the macros @code{__pic__} and @code{__PIC__} 17414are defined to 2. 17415 17416@item -fpie 17417@itemx -fPIE 17418@opindex fpie 17419@opindex fPIE 17420These options are similar to @option{-fpic} and @option{-fPIC}, but the 17421generated position-independent code can be only linked into executables. 17422Usually these options are used to compile code that will be linked using 17423the @option{-pie} GCC option. 17424 17425@option{-fpie} and @option{-fPIE} both define the macros 17426@code{__pie__} and @code{__PIE__}. The macros have the value 1 17427for @option{-fpie} and 2 for @option{-fPIE}. 17428 17429@item -fno-plt 17430@opindex fno-plt 17431@opindex fplt 17432Do not use the PLT for external function calls in position-independent code. 17433Instead, load the callee address at call sites from the GOT and branch to it. 17434This leads to more efficient code by eliminating PLT stubs and exposing 17435GOT loads to optimizations. On architectures such as 32-bit x86 where 17436PLT stubs expect the GOT pointer in a specific register, this gives more 17437register allocation freedom to the compiler. 17438Lazy binding requires use of the PLT; 17439with @option{-fno-plt} all external symbols are resolved at load time. 17440 17441Alternatively, the function attribute @code{noplt} can be used to avoid calls 17442through the PLT for specific external functions. 17443 17444In position-dependent code, a few targets also convert calls to 17445functions that are marked to not use the PLT to use the GOT instead. 17446 17447@item -fno-jump-tables 17448@opindex fno-jump-tables 17449@opindex fjump-tables 17450Do not use jump tables for switch statements even where it would be 17451more efficient than other code generation strategies. This option is 17452of use in conjunction with @option{-fpic} or @option{-fPIC} for 17453building code that forms part of a dynamic linker and cannot 17454reference the address of a jump table. On some targets, jump tables 17455do not require a GOT and this option is not needed. 17456 17457@item -fno-bit-tests 17458@opindex fno-bit-tests 17459@opindex fbit-tests 17460Do not use bit tests for switch statements even where it would be 17461more efficient than other code generation strategies. 17462 17463@item -ffixed-@var{reg} 17464@opindex ffixed 17465Treat the register named @var{reg} as a fixed register; generated code 17466should never refer to it (except perhaps as a stack pointer, frame 17467pointer or in some other fixed role). 17468 17469@var{reg} must be the name of a register. The register names accepted 17470are machine-specific and are defined in the @code{REGISTER_NAMES} 17471macro in the machine description macro file. 17472 17473This flag does not have a negative form, because it specifies a 17474three-way choice. 17475 17476@item -fcall-used-@var{reg} 17477@opindex fcall-used 17478Treat the register named @var{reg} as an allocable register that is 17479clobbered by function calls. It may be allocated for temporaries or 17480variables that do not live across a call. Functions compiled this way 17481do not save and restore the register @var{reg}. 17482 17483It is an error to use this flag with the frame pointer or stack pointer. 17484Use of this flag for other registers that have fixed pervasive roles in 17485the machine's execution model produces disastrous results. 17486 17487This flag does not have a negative form, because it specifies a 17488three-way choice. 17489 17490@item -fcall-saved-@var{reg} 17491@opindex fcall-saved 17492Treat the register named @var{reg} as an allocable register saved by 17493functions. It may be allocated even for temporaries or variables that 17494live across a call. Functions compiled this way save and restore 17495the register @var{reg} if they use it. 17496 17497It is an error to use this flag with the frame pointer or stack pointer. 17498Use of this flag for other registers that have fixed pervasive roles in 17499the machine's execution model produces disastrous results. 17500 17501A different sort of disaster results from the use of this flag for 17502a register in which function values may be returned. 17503 17504This flag does not have a negative form, because it specifies a 17505three-way choice. 17506 17507@item -fpack-struct[=@var{n}] 17508@opindex fpack-struct 17509Without a value specified, pack all structure members together without 17510holes. When a value is specified (which must be a small power of two), pack 17511structure members according to this value, representing the maximum 17512alignment (that is, objects with default alignment requirements larger than 17513this are output potentially unaligned at the next fitting location. 17514 17515@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 17516code that is not binary compatible with code generated without that switch. 17517Additionally, it makes the code suboptimal. 17518Use it to conform to a non-default application binary interface. 17519 17520@item -fleading-underscore 17521@opindex fleading-underscore 17522This option and its counterpart, @option{-fno-leading-underscore}, forcibly 17523change the way C symbols are represented in the object file. One use 17524is to help link with legacy assembly code. 17525 17526@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 17527generate code that is not binary compatible with code generated without that 17528switch. Use it to conform to a non-default application binary interface. 17529Not all targets provide complete support for this switch. 17530 17531@item -ftls-model=@var{model} 17532@opindex ftls-model 17533Alter the thread-local storage model to be used (@pxref{Thread-Local}). 17534The @var{model} argument should be one of @samp{global-dynamic}, 17535@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 17536Note that the choice is subject to optimization: the compiler may use 17537a more efficient model for symbols not visible outside of the translation 17538unit, or if @option{-fpic} is not given on the command line. 17539 17540The default without @option{-fpic} is @samp{initial-exec}; with 17541@option{-fpic} the default is @samp{global-dynamic}. 17542 17543@item -ftrampolines 17544@opindex ftrampolines 17545For targets that normally need trampolines for nested functions, always 17546generate them instead of using descriptors. Otherwise, for targets that 17547do not need them, like for example HP-PA or IA-64, do nothing. 17548 17549A trampoline is a small piece of code that is created at run time on the 17550stack when the address of a nested function is taken, and is used to call 17551the nested function indirectly. Therefore, it requires the stack to be 17552made executable in order for the program to work properly. 17553 17554@option{-fno-trampolines} is enabled by default on a language by language 17555basis to let the compiler avoid generating them, if it computes that this 17556is safe, and replace them with descriptors. Descriptors are made up of data 17557only, but the generated code must be prepared to deal with them. As of this 17558writing, @option{-fno-trampolines} is enabled by default only for Ada. 17559 17560Moreover, code compiled with @option{-ftrampolines} and code compiled with 17561@option{-fno-trampolines} are not binary compatible if nested functions are 17562present. This option must therefore be used on a program-wide basis and be 17563manipulated with extreme care. 17564 17565For languages other than Ada, the @code{-ftrampolines} and 17566@code{-fno-trampolines} options currently have no effect, and 17567trampolines are always generated on platforms that need them 17568for nested functions. 17569 17570@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 17571@opindex fvisibility 17572Set the default ELF image symbol visibility to the specified option---all 17573symbols are marked with this unless overridden within the code. 17574Using this feature can very substantially improve linking and 17575load times of shared object libraries, produce more optimized 17576code, provide near-perfect API export and prevent symbol clashes. 17577It is @strong{strongly} recommended that you use this in any shared objects 17578you distribute. 17579 17580Despite the nomenclature, @samp{default} always means public; i.e., 17581available to be linked against from outside the shared object. 17582@samp{protected} and @samp{internal} are pretty useless in real-world 17583usage so the only other commonly used option is @samp{hidden}. 17584The default if @option{-fvisibility} isn't specified is 17585@samp{default}, i.e., make every symbol public. 17586 17587A good explanation of the benefits offered by ensuring ELF 17588symbols have the correct visibility is given by ``How To Write 17589Shared Libraries'' by Ulrich Drepper (which can be found at 17590@w{@uref{https://www.akkadia.org/drepper/}})---however a superior 17591solution made possible by this option to marking things hidden when 17592the default is public is to make the default hidden and mark things 17593public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 17594and @code{__attribute__ ((visibility("default")))} instead of 17595@code{__declspec(dllexport)} you get almost identical semantics with 17596identical syntax. This is a great boon to those working with 17597cross-platform projects. 17598 17599For those adding visibility support to existing code, you may find 17600@code{#pragma GCC visibility} of use. This works by you enclosing 17601the declarations you wish to set visibility for with (for example) 17602@code{#pragma GCC visibility push(hidden)} and 17603@code{#pragma GCC visibility pop}. 17604Bear in mind that symbol visibility should be viewed @strong{as 17605part of the API interface contract} and thus all new code should 17606always specify visibility when it is not the default; i.e., declarations 17607only for use within the local DSO should @strong{always} be marked explicitly 17608as hidden as so to avoid PLT indirection overheads---making this 17609abundantly clear also aids readability and self-documentation of the code. 17610Note that due to ISO C++ specification requirements, @code{operator new} and 17611@code{operator delete} must always be of default visibility. 17612 17613Be aware that headers from outside your project, in particular system 17614headers and headers from any other library you use, may not be 17615expecting to be compiled with visibility other than the default. You 17616may need to explicitly say @code{#pragma GCC visibility push(default)} 17617before including any such headers. 17618 17619@code{extern} declarations are not affected by @option{-fvisibility}, so 17620a lot of code can be recompiled with @option{-fvisibility=hidden} with 17621no modifications. However, this means that calls to @code{extern} 17622functions with no explicit visibility use the PLT, so it is more 17623effective to use @code{__attribute ((visibility))} and/or 17624@code{#pragma GCC visibility} to tell the compiler which @code{extern} 17625declarations should be treated as hidden. 17626 17627Note that @option{-fvisibility} does affect C++ vague linkage 17628entities. This means that, for instance, an exception class that is 17629be thrown between DSOs must be explicitly marked with default 17630visibility so that the @samp{type_info} nodes are unified between 17631the DSOs. 17632 17633An overview of these techniques, their benefits and how to use them 17634is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}. 17635 17636@item -fstrict-volatile-bitfields 17637@opindex fstrict-volatile-bitfields 17638This option should be used if accesses to volatile bit-fields (or other 17639structure fields, although the compiler usually honors those types 17640anyway) should use a single access of the width of the 17641field's type, aligned to a natural alignment if possible. For 17642example, targets with memory-mapped peripheral registers might require 17643all such accesses to be 16 bits wide; with this flag you can 17644declare all peripheral bit-fields as @code{unsigned short} (assuming short 17645is 16 bits on these targets) to force GCC to use 16-bit accesses 17646instead of, perhaps, a more efficient 32-bit access. 17647 17648If this option is disabled, the compiler uses the most efficient 17649instruction. In the previous example, that might be a 32-bit load 17650instruction, even though that accesses bytes that do not contain 17651any portion of the bit-field, or memory-mapped registers unrelated to 17652the one being updated. 17653 17654In some cases, such as when the @code{packed} attribute is applied to a 17655structure field, it may not be possible to access the field with a single 17656read or write that is correctly aligned for the target machine. In this 17657case GCC falls back to generating multiple accesses rather than code that 17658will fault or truncate the result at run time. 17659 17660Note: Due to restrictions of the C/C++11 memory model, write accesses are 17661not allowed to touch non bit-field members. It is therefore recommended 17662to define all bits of the field's type as bit-field members. 17663 17664The default value of this option is determined by the application binary 17665interface for the target processor. 17666 17667@item -fsync-libcalls 17668@opindex fsync-libcalls 17669This option controls whether any out-of-line instance of the @code{__sync} 17670family of functions may be used to implement the C++11 @code{__atomic} 17671family of functions. 17672 17673The default value of this option is enabled, thus the only useful form 17674of the option is @option{-fno-sync-libcalls}. This option is used in 17675the implementation of the @file{libatomic} runtime library. 17676 17677@end table 17678 17679@node Developer Options 17680@section GCC Developer Options 17681@cindex developer options 17682@cindex debugging GCC 17683@cindex debug dump options 17684@cindex dump options 17685@cindex compilation statistics 17686 17687This section describes command-line options that are primarily of 17688interest to GCC developers, including options to support compiler 17689testing and investigation of compiler bugs and compile-time 17690performance problems. This includes options that produce debug dumps 17691at various points in the compilation; that print statistics such as 17692memory use and execution time; and that print information about GCC's 17693configuration, such as where it searches for libraries. You should 17694rarely need to use any of these options for ordinary compilation and 17695linking tasks. 17696 17697Many developer options that cause GCC to dump output to a file take an 17698optional @samp{=@var{filename}} suffix. You can specify @samp{stdout} 17699or @samp{-} to dump to standard output, and @samp{stderr} for standard 17700error. 17701 17702If @samp{=@var{filename}} is omitted, a default dump file name is 17703constructed by concatenating the base dump file name, a pass number, 17704phase letter, and pass name. The base dump file name is the name of 17705output file produced by the compiler if explicitly specified and not 17706an executable; otherwise it is the source file name. 17707The pass number is determined by the order passes are registered with 17708the compiler's pass manager. 17709This is generally the same as the order of execution, but passes 17710registered by plugins, target-specific passes, or passes that are 17711otherwise registered late are numbered higher than the pass named 17712@samp{final}, even if they are executed earlier. The phase letter is 17713one of @samp{i} (inter-procedural analysis), @samp{l} 17714(language-specific), @samp{r} (RTL), or @samp{t} (tree). 17715The files are created in the directory of the output file. 17716 17717@table @gcctabopt 17718 17719@item -fcallgraph-info 17720@itemx -fcallgraph-info=@var{MARKERS} 17721@opindex fcallgraph-info 17722Makes the compiler output callgraph information for the program, on a 17723per-object-file basis. The information is generated in the common VCG 17724format. It can be decorated with additional, per-node and/or per-edge 17725information, if a list of comma-separated markers is additionally 17726specified. When the @code{su} marker is specified, the callgraph is 17727decorated with stack usage information; it is equivalent to 17728@option{-fstack-usage}. When the @code{da} marker is specified, the 17729callgraph is decorated with information about dynamically allocated 17730objects. 17731 17732When compiling with @option{-flto}, no callgraph information is output 17733along with the object file. At LTO link time, @option{-fcallgraph-info} 17734may generate multiple callgraph information files next to intermediate 17735LTO output files. 17736 17737@item -d@var{letters} 17738@itemx -fdump-rtl-@var{pass} 17739@itemx -fdump-rtl-@var{pass}=@var{filename} 17740@opindex d 17741@opindex fdump-rtl-@var{pass} 17742Says to make debugging dumps during compilation at times specified by 17743@var{letters}. This is used for debugging the RTL-based passes of the 17744compiler. 17745 17746Some @option{-d@var{letters}} switches have different meaning when 17747@option{-E} is used for preprocessing. @xref{Preprocessor Options}, 17748for information about preprocessor-specific dump options. 17749 17750Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 17751@option{-d} option @var{letters}. Here are the possible 17752letters for use in @var{pass} and @var{letters}, and their meanings: 17753 17754@table @gcctabopt 17755 17756@item -fdump-rtl-alignments 17757@opindex fdump-rtl-alignments 17758Dump after branch alignments have been computed. 17759 17760@item -fdump-rtl-asmcons 17761@opindex fdump-rtl-asmcons 17762Dump after fixing rtl statements that have unsatisfied in/out constraints. 17763 17764@item -fdump-rtl-auto_inc_dec 17765@opindex fdump-rtl-auto_inc_dec 17766Dump after auto-inc-dec discovery. This pass is only run on 17767architectures that have auto inc or auto dec instructions. 17768 17769@item -fdump-rtl-barriers 17770@opindex fdump-rtl-barriers 17771Dump after cleaning up the barrier instructions. 17772 17773@item -fdump-rtl-bbpart 17774@opindex fdump-rtl-bbpart 17775Dump after partitioning hot and cold basic blocks. 17776 17777@item -fdump-rtl-bbro 17778@opindex fdump-rtl-bbro 17779Dump after block reordering. 17780 17781@item -fdump-rtl-btl1 17782@itemx -fdump-rtl-btl2 17783@opindex fdump-rtl-btl2 17784@opindex fdump-rtl-btl2 17785@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 17786after the two branch 17787target load optimization passes. 17788 17789@item -fdump-rtl-bypass 17790@opindex fdump-rtl-bypass 17791Dump after jump bypassing and control flow optimizations. 17792 17793@item -fdump-rtl-combine 17794@opindex fdump-rtl-combine 17795Dump after the RTL instruction combination pass. 17796 17797@item -fdump-rtl-compgotos 17798@opindex fdump-rtl-compgotos 17799Dump after duplicating the computed gotos. 17800 17801@item -fdump-rtl-ce1 17802@itemx -fdump-rtl-ce2 17803@itemx -fdump-rtl-ce3 17804@opindex fdump-rtl-ce1 17805@opindex fdump-rtl-ce2 17806@opindex fdump-rtl-ce3 17807@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 17808@option{-fdump-rtl-ce3} enable dumping after the three 17809if conversion passes. 17810 17811@item -fdump-rtl-cprop_hardreg 17812@opindex fdump-rtl-cprop_hardreg 17813Dump after hard register copy propagation. 17814 17815@item -fdump-rtl-csa 17816@opindex fdump-rtl-csa 17817Dump after combining stack adjustments. 17818 17819@item -fdump-rtl-cse1 17820@itemx -fdump-rtl-cse2 17821@opindex fdump-rtl-cse1 17822@opindex fdump-rtl-cse2 17823@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 17824the two common subexpression elimination passes. 17825 17826@item -fdump-rtl-dce 17827@opindex fdump-rtl-dce 17828Dump after the standalone dead code elimination passes. 17829 17830@item -fdump-rtl-dbr 17831@opindex fdump-rtl-dbr 17832Dump after delayed branch scheduling. 17833 17834@item -fdump-rtl-dce1 17835@itemx -fdump-rtl-dce2 17836@opindex fdump-rtl-dce1 17837@opindex fdump-rtl-dce2 17838@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 17839the two dead store elimination passes. 17840 17841@item -fdump-rtl-eh 17842@opindex fdump-rtl-eh 17843Dump after finalization of EH handling code. 17844 17845@item -fdump-rtl-eh_ranges 17846@opindex fdump-rtl-eh_ranges 17847Dump after conversion of EH handling range regions. 17848 17849@item -fdump-rtl-expand 17850@opindex fdump-rtl-expand 17851Dump after RTL generation. 17852 17853@item -fdump-rtl-fwprop1 17854@itemx -fdump-rtl-fwprop2 17855@opindex fdump-rtl-fwprop1 17856@opindex fdump-rtl-fwprop2 17857@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 17858dumping after the two forward propagation passes. 17859 17860@item -fdump-rtl-gcse1 17861@itemx -fdump-rtl-gcse2 17862@opindex fdump-rtl-gcse1 17863@opindex fdump-rtl-gcse2 17864@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 17865after global common subexpression elimination. 17866 17867@item -fdump-rtl-init-regs 17868@opindex fdump-rtl-init-regs 17869Dump after the initialization of the registers. 17870 17871@item -fdump-rtl-initvals 17872@opindex fdump-rtl-initvals 17873Dump after the computation of the initial value sets. 17874 17875@item -fdump-rtl-into_cfglayout 17876@opindex fdump-rtl-into_cfglayout 17877Dump after converting to cfglayout mode. 17878 17879@item -fdump-rtl-ira 17880@opindex fdump-rtl-ira 17881Dump after iterated register allocation. 17882 17883@item -fdump-rtl-jump 17884@opindex fdump-rtl-jump 17885Dump after the second jump optimization. 17886 17887@item -fdump-rtl-loop2 17888@opindex fdump-rtl-loop2 17889@option{-fdump-rtl-loop2} enables dumping after the rtl 17890loop optimization passes. 17891 17892@item -fdump-rtl-mach 17893@opindex fdump-rtl-mach 17894Dump after performing the machine dependent reorganization pass, if that 17895pass exists. 17896 17897@item -fdump-rtl-mode_sw 17898@opindex fdump-rtl-mode_sw 17899Dump after removing redundant mode switches. 17900 17901@item -fdump-rtl-rnreg 17902@opindex fdump-rtl-rnreg 17903Dump after register renumbering. 17904 17905@item -fdump-rtl-outof_cfglayout 17906@opindex fdump-rtl-outof_cfglayout 17907Dump after converting from cfglayout mode. 17908 17909@item -fdump-rtl-peephole2 17910@opindex fdump-rtl-peephole2 17911Dump after the peephole pass. 17912 17913@item -fdump-rtl-postreload 17914@opindex fdump-rtl-postreload 17915Dump after post-reload optimizations. 17916 17917@item -fdump-rtl-pro_and_epilogue 17918@opindex fdump-rtl-pro_and_epilogue 17919Dump after generating the function prologues and epilogues. 17920 17921@item -fdump-rtl-sched1 17922@itemx -fdump-rtl-sched2 17923@opindex fdump-rtl-sched1 17924@opindex fdump-rtl-sched2 17925@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 17926after the basic block scheduling passes. 17927 17928@item -fdump-rtl-ree 17929@opindex fdump-rtl-ree 17930Dump after sign/zero extension elimination. 17931 17932@item -fdump-rtl-seqabstr 17933@opindex fdump-rtl-seqabstr 17934Dump after common sequence discovery. 17935 17936@item -fdump-rtl-shorten 17937@opindex fdump-rtl-shorten 17938Dump after shortening branches. 17939 17940@item -fdump-rtl-sibling 17941@opindex fdump-rtl-sibling 17942Dump after sibling call optimizations. 17943 17944@item -fdump-rtl-split1 17945@itemx -fdump-rtl-split2 17946@itemx -fdump-rtl-split3 17947@itemx -fdump-rtl-split4 17948@itemx -fdump-rtl-split5 17949@opindex fdump-rtl-split1 17950@opindex fdump-rtl-split2 17951@opindex fdump-rtl-split3 17952@opindex fdump-rtl-split4 17953@opindex fdump-rtl-split5 17954These options enable dumping after five rounds of 17955instruction splitting. 17956 17957@item -fdump-rtl-sms 17958@opindex fdump-rtl-sms 17959Dump after modulo scheduling. This pass is only run on some 17960architectures. 17961 17962@item -fdump-rtl-stack 17963@opindex fdump-rtl-stack 17964Dump after conversion from GCC's ``flat register file'' registers to the 17965x87's stack-like registers. This pass is only run on x86 variants. 17966 17967@item -fdump-rtl-subreg1 17968@itemx -fdump-rtl-subreg2 17969@opindex fdump-rtl-subreg1 17970@opindex fdump-rtl-subreg2 17971@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 17972the two subreg expansion passes. 17973 17974@item -fdump-rtl-unshare 17975@opindex fdump-rtl-unshare 17976Dump after all rtl has been unshared. 17977 17978@item -fdump-rtl-vartrack 17979@opindex fdump-rtl-vartrack 17980Dump after variable tracking. 17981 17982@item -fdump-rtl-vregs 17983@opindex fdump-rtl-vregs 17984Dump after converting virtual registers to hard registers. 17985 17986@item -fdump-rtl-web 17987@opindex fdump-rtl-web 17988Dump after live range splitting. 17989 17990@item -fdump-rtl-regclass 17991@itemx -fdump-rtl-subregs_of_mode_init 17992@itemx -fdump-rtl-subregs_of_mode_finish 17993@itemx -fdump-rtl-dfinit 17994@itemx -fdump-rtl-dfinish 17995@opindex fdump-rtl-regclass 17996@opindex fdump-rtl-subregs_of_mode_init 17997@opindex fdump-rtl-subregs_of_mode_finish 17998@opindex fdump-rtl-dfinit 17999@opindex fdump-rtl-dfinish 18000These dumps are defined but always produce empty files. 18001 18002@item -da 18003@itemx -fdump-rtl-all 18004@opindex da 18005@opindex fdump-rtl-all 18006Produce all the dumps listed above. 18007 18008@item -dA 18009@opindex dA 18010Annotate the assembler output with miscellaneous debugging information. 18011 18012@item -dD 18013@opindex dD 18014Dump all macro definitions, at the end of preprocessing, in addition to 18015normal output. 18016 18017@item -dH 18018@opindex dH 18019Produce a core dump whenever an error occurs. 18020 18021@item -dp 18022@opindex dp 18023Annotate the assembler output with a comment indicating which 18024pattern and alternative is used. The length and cost of each instruction are 18025also printed. 18026 18027@item -dP 18028@opindex dP 18029Dump the RTL in the assembler output as a comment before each instruction. 18030Also turns on @option{-dp} annotation. 18031 18032@item -dx 18033@opindex dx 18034Just generate RTL for a function instead of compiling it. Usually used 18035with @option{-fdump-rtl-expand}. 18036@end table 18037 18038@item -fdump-debug 18039@opindex fdump-debug 18040Dump debugging information generated during the debug 18041generation phase. 18042 18043@item -fdump-earlydebug 18044@opindex fdump-earlydebug 18045Dump debugging information generated during the early debug 18046generation phase. 18047 18048@item -fdump-noaddr 18049@opindex fdump-noaddr 18050When doing debugging dumps, suppress address output. This makes it more 18051feasible to use diff on debugging dumps for compiler invocations with 18052different compiler binaries and/or different 18053text / bss / data / heap / stack / dso start locations. 18054 18055@item -freport-bug 18056@opindex freport-bug 18057Collect and dump debug information into a temporary file if an 18058internal compiler error (ICE) occurs. 18059 18060@item -fdump-unnumbered 18061@opindex fdump-unnumbered 18062When doing debugging dumps, suppress instruction numbers and address output. 18063This makes it more feasible to use diff on debugging dumps for compiler 18064invocations with different options, in particular with and without 18065@option{-g}. 18066 18067@item -fdump-unnumbered-links 18068@opindex fdump-unnumbered-links 18069When doing debugging dumps (see @option{-d} option above), suppress 18070instruction numbers for the links to the previous and next instructions 18071in a sequence. 18072 18073@item -fdump-ipa-@var{switch} 18074@itemx -fdump-ipa-@var{switch}-@var{options} 18075@opindex fdump-ipa 18076Control the dumping at various stages of inter-procedural analysis 18077language tree to a file. The file name is generated by appending a 18078switch specific suffix to the source file name, and the file is created 18079in the same directory as the output file. The following dumps are 18080possible: 18081 18082@table @samp 18083@item all 18084Enables all inter-procedural analysis dumps. 18085 18086@item cgraph 18087Dumps information about call-graph optimization, unused function removal, 18088and inlining decisions. 18089 18090@item inline 18091Dump after function inlining. 18092 18093@end table 18094 18095Additionally, the options @option{-optimized}, @option{-missed}, 18096@option{-note}, and @option{-all} can be provided, with the same meaning 18097as for @option{-fopt-info}, defaulting to @option{-optimized}. 18098 18099For example, @option{-fdump-ipa-inline-optimized-missed} will emit 18100information on callsites that were inlined, along with callsites 18101that were not inlined. 18102 18103By default, the dump will contain messages about successful 18104optimizations (equivalent to @option{-optimized}) together with 18105low-level details about the analysis. 18106 18107@item -fdump-lang 18108@opindex fdump-lang 18109Dump language-specific information. The file name is made by appending 18110@file{.lang} to the source file name. 18111 18112@item -fdump-lang-all 18113@itemx -fdump-lang-@var{switch} 18114@itemx -fdump-lang-@var{switch}-@var{options} 18115@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename} 18116@opindex fdump-lang-all 18117@opindex fdump-lang 18118Control the dumping of language-specific information. The @var{options} 18119and @var{filename} portions behave as described in the 18120@option{-fdump-tree} option. The following @var{switch} values are 18121accepted: 18122 18123@table @samp 18124@item all 18125 18126Enable all language-specific dumps. 18127 18128@item class 18129Dump class hierarchy information. Virtual table information is emitted 18130unless '@option{slim}' is specified. This option is applicable to C++ only. 18131 18132@item module 18133Dump module information. Options @option{lineno} (locations), 18134@option{graph} (reachability), @option{blocks} (clusters), 18135@option{uid} (serialization), @option{alias} (mergeable), 18136@option{asmname} (Elrond), @option{eh} (mapper) & @option{vops} 18137(macros) may provide additional information. This option is 18138applicable to C++ only. 18139 18140@item raw 18141Dump the raw internal tree data. This option is applicable to C++ only. 18142 18143@end table 18144 18145@item -fdump-passes 18146@opindex fdump-passes 18147Print on @file{stderr} the list of optimization passes that are turned 18148on and off by the current command-line options. 18149 18150@item -fdump-statistics-@var{option} 18151@opindex fdump-statistics 18152Enable and control dumping of pass statistics in a separate file. The 18153file name is generated by appending a suffix ending in 18154@samp{.statistics} to the source file name, and the file is created in 18155the same directory as the output file. If the @samp{-@var{option}} 18156form is used, @samp{-stats} causes counters to be summed over the 18157whole compilation unit while @samp{-details} dumps every event as 18158the passes generate them. The default with no option is to sum 18159counters for each function compiled. 18160 18161@item -fdump-tree-all 18162@itemx -fdump-tree-@var{switch} 18163@itemx -fdump-tree-@var{switch}-@var{options} 18164@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 18165@opindex fdump-tree-all 18166@opindex fdump-tree 18167Control the dumping at various stages of processing the intermediate 18168language tree to a file. If the @samp{-@var{options}} 18169form is used, @var{options} is a list of @samp{-} separated options 18170which control the details of the dump. Not all options are applicable 18171to all dumps; those that are not meaningful are ignored. The 18172following options are available 18173 18174@table @samp 18175@item address 18176Print the address of each node. Usually this is not meaningful as it 18177changes according to the environment and source file. Its primary use 18178is for tying up a dump file with a debug environment. 18179@item asmname 18180If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 18181in the dump instead of @code{DECL_NAME}. Its primary use is ease of 18182use working backward from mangled names in the assembly file. 18183@item slim 18184When dumping front-end intermediate representations, inhibit dumping 18185of members of a scope or body of a function merely because that scope 18186has been reached. Only dump such items when they are directly reachable 18187by some other path. 18188 18189When dumping pretty-printed trees, this option inhibits dumping the 18190bodies of control structures. 18191 18192When dumping RTL, print the RTL in slim (condensed) form instead of 18193the default LISP-like representation. 18194@item raw 18195Print a raw representation of the tree. By default, trees are 18196pretty-printed into a C-like representation. 18197@item details 18198Enable more detailed dumps (not honored by every dump option). Also 18199include information from the optimization passes. 18200@item stats 18201Enable dumping various statistics about the pass (not honored by every dump 18202option). 18203@item blocks 18204Enable showing basic block boundaries (disabled in raw dumps). 18205@item graph 18206For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 18207dump a representation of the control flow graph suitable for viewing with 18208GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 18209the file is pretty-printed as a subgraph, so that GraphViz can render them 18210all in a single plot. 18211 18212This option currently only works for RTL dumps, and the RTL is always 18213dumped in slim form. 18214@item vops 18215Enable showing virtual operands for every statement. 18216@item lineno 18217Enable showing line numbers for statements. 18218@item uid 18219Enable showing the unique ID (@code{DECL_UID}) for each variable. 18220@item verbose 18221Enable showing the tree dump for each statement. 18222@item eh 18223Enable showing the EH region number holding each statement. 18224@item scev 18225Enable showing scalar evolution analysis details. 18226@item optimized 18227Enable showing optimization information (only available in certain 18228passes). 18229@item missed 18230Enable showing missed optimization information (only available in certain 18231passes). 18232@item note 18233Enable other detailed optimization information (only available in 18234certain passes). 18235@item all 18236Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 18237and @option{lineno}. 18238@item optall 18239Turn on all optimization options, i.e., @option{optimized}, 18240@option{missed}, and @option{note}. 18241@end table 18242 18243To determine what tree dumps are available or find the dump for a pass 18244of interest follow the steps below. 18245 18246@enumerate 18247@item 18248Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output 18249look for a code that corresponds to the pass you are interested in. 18250For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and 18251@code{tree-vrp2} correspond to the three Value Range Propagation passes. 18252The number at the end distinguishes distinct invocations of the same pass. 18253@item 18254To enable the creation of the dump file, append the pass code to 18255the @option{-fdump-} option prefix and invoke GCC with it. For example, 18256to enable the dump from the Early Value Range Propagation pass, invoke 18257GCC with the @option{-fdump-tree-evrp} option. Optionally, you may 18258specify the name of the dump file. If you don't specify one, GCC 18259creates as described below. 18260@item 18261Find the pass dump in a file whose name is composed of three components 18262separated by a period: the name of the source file GCC was invoked to 18263compile, a numeric suffix indicating the pass number followed by the 18264letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes), 18265and finally the pass code. For example, the Early VRP pass dump might 18266be in a file named @file{myfile.c.038t.evrp} in the current working 18267directory. Note that the numeric codes are not stable and may change 18268from one version of GCC to another. 18269@end enumerate 18270 18271@item -fopt-info 18272@itemx -fopt-info-@var{options} 18273@itemx -fopt-info-@var{options}=@var{filename} 18274@opindex fopt-info 18275Controls optimization dumps from various optimization passes. If the 18276@samp{-@var{options}} form is used, @var{options} is a list of 18277@samp{-} separated option keywords to select the dump details and 18278optimizations. 18279 18280The @var{options} can be divided into three groups: 18281@enumerate 18282@item 18283options describing what kinds of messages should be emitted, 18284@item 18285options describing the verbosity of the dump, and 18286@item 18287options describing which optimizations should be included. 18288@end enumerate 18289The options from each group can be freely mixed as they are 18290non-overlapping. However, in case of any conflicts, 18291the later options override the earlier options on the command 18292line. 18293 18294The following options control which kinds of messages should be emitted: 18295 18296@table @samp 18297@item optimized 18298Print information when an optimization is successfully applied. It is 18299up to a pass to decide which information is relevant. For example, the 18300vectorizer passes print the source location of loops which are 18301successfully vectorized. 18302@item missed 18303Print information about missed optimizations. Individual passes 18304control which information to include in the output. 18305@item note 18306Print verbose information about optimizations, such as certain 18307transformations, more detailed messages about decisions etc. 18308@item all 18309Print detailed optimization information. This includes 18310@samp{optimized}, @samp{missed}, and @samp{note}. 18311@end table 18312 18313The following option controls the dump verbosity: 18314 18315@table @samp 18316@item internals 18317By default, only ``high-level'' messages are emitted. This option enables 18318additional, more detailed, messages, which are likely to only be of interest 18319to GCC developers. 18320@end table 18321 18322One or more of the following option keywords can be used to describe a 18323group of optimizations: 18324 18325@table @samp 18326@item ipa 18327Enable dumps from all interprocedural optimizations. 18328@item loop 18329Enable dumps from all loop optimizations. 18330@item inline 18331Enable dumps from all inlining optimizations. 18332@item omp 18333Enable dumps from all OMP (Offloading and Multi Processing) optimizations. 18334@item vec 18335Enable dumps from all vectorization optimizations. 18336@item optall 18337Enable dumps from all optimizations. This is a superset of 18338the optimization groups listed above. 18339@end table 18340 18341If @var{options} is 18342omitted, it defaults to @samp{optimized-optall}, which means to dump messages 18343about successful optimizations from all the passes, omitting messages 18344that are treated as ``internals''. 18345 18346If the @var{filename} is provided, then the dumps from all the 18347applicable optimizations are concatenated into the @var{filename}. 18348Otherwise the dump is output onto @file{stderr}. Though multiple 18349@option{-fopt-info} options are accepted, only one of them can include 18350a @var{filename}. If other filenames are provided then all but the 18351first such option are ignored. 18352 18353Note that the output @var{filename} is overwritten 18354in case of multiple translation units. If a combined output from 18355multiple translation units is desired, @file{stderr} should be used 18356instead. 18357 18358In the following example, the optimization info is output to 18359@file{stderr}: 18360 18361@smallexample 18362gcc -O3 -fopt-info 18363@end smallexample 18364 18365This example: 18366@smallexample 18367gcc -O3 -fopt-info-missed=missed.all 18368@end smallexample 18369 18370@noindent 18371outputs missed optimization report from all the passes into 18372@file{missed.all}, and this one: 18373 18374@smallexample 18375gcc -O2 -ftree-vectorize -fopt-info-vec-missed 18376@end smallexample 18377 18378@noindent 18379prints information about missed optimization opportunities from 18380vectorization passes on @file{stderr}. 18381Note that @option{-fopt-info-vec-missed} is equivalent to 18382@option{-fopt-info-missed-vec}. The order of the optimization group 18383names and message types listed after @option{-fopt-info} does not matter. 18384 18385As another example, 18386@smallexample 18387gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 18388@end smallexample 18389 18390@noindent 18391outputs information about missed optimizations as well as 18392optimized locations from all the inlining passes into 18393@file{inline.txt}. 18394 18395Finally, consider: 18396 18397@smallexample 18398gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 18399@end smallexample 18400 18401@noindent 18402Here the two output filenames @file{vec.miss} and @file{loop.opt} are 18403in conflict since only one output file is allowed. In this case, only 18404the first option takes effect and the subsequent options are 18405ignored. Thus only @file{vec.miss} is produced which contains 18406dumps from the vectorizer about missed opportunities. 18407 18408@item -fsave-optimization-record 18409@opindex fsave-optimization-record 18410Write a SRCFILE.opt-record.json.gz file detailing what optimizations 18411were performed, for those optimizations that support @option{-fopt-info}. 18412 18413This option is experimental and the format of the data within the 18414compressed JSON file is subject to change. 18415 18416It is roughly equivalent to a machine-readable version of 18417@option{-fopt-info-all}, as a collection of messages with source file, 18418line number and column number, with the following additional data for 18419each message: 18420 18421@itemize @bullet 18422 18423@item 18424the execution count of the code being optimized, along with metadata about 18425whether this was from actual profile data, or just an estimate, allowing 18426consumers to prioritize messages by code hotness, 18427 18428@item 18429the function name of the code being optimized, where applicable, 18430 18431@item 18432the ``inlining chain'' for the code being optimized, so that when 18433a function is inlined into several different places (which might 18434themselves be inlined), the reader can distinguish between the copies, 18435 18436@item 18437objects identifying those parts of the message that refer to expressions, 18438statements or symbol-table nodes, which of these categories they are, and, 18439when available, their source code location, 18440 18441@item 18442the GCC pass that emitted the message, and 18443 18444@item 18445the location in GCC's own code from which the message was emitted 18446 18447@end itemize 18448 18449Additionally, some messages are logically nested within other 18450messages, reflecting implementation details of the optimization 18451passes. 18452 18453@item -fsched-verbose=@var{n} 18454@opindex fsched-verbose 18455On targets that use instruction scheduling, this option controls the 18456amount of debugging output the scheduler prints to the dump files. 18457 18458For @var{n} greater than zero, @option{-fsched-verbose} outputs the 18459same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 18460For @var{n} greater than one, it also output basic block probabilities, 18461detailed ready list information and unit/insn info. For @var{n} greater 18462than two, it includes RTL at abort point, control-flow and regions info. 18463And for @var{n} over four, @option{-fsched-verbose} also includes 18464dependence info. 18465 18466 18467 18468@item -fenable-@var{kind}-@var{pass} 18469@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 18470@opindex fdisable- 18471@opindex fenable- 18472 18473This is a set of options that are used to explicitly disable/enable 18474optimization passes. These options are intended for use for debugging GCC. 18475Compiler users should use regular options for enabling/disabling 18476passes instead. 18477 18478@table @gcctabopt 18479 18480@item -fdisable-ipa-@var{pass} 18481Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 18482statically invoked in the compiler multiple times, the pass name should be 18483appended with a sequential number starting from 1. 18484 18485@item -fdisable-rtl-@var{pass} 18486@itemx -fdisable-rtl-@var{pass}=@var{range-list} 18487Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 18488statically invoked in the compiler multiple times, the pass name should be 18489appended with a sequential number starting from 1. @var{range-list} is a 18490comma-separated list of function ranges or assembler names. Each range is a number 18491pair separated by a colon. The range is inclusive in both ends. If the range 18492is trivial, the number pair can be simplified as a single number. If the 18493function's call graph node's @var{uid} falls within one of the specified ranges, 18494the @var{pass} is disabled for that function. The @var{uid} is shown in the 18495function header of a dump file, and the pass names can be dumped by using 18496option @option{-fdump-passes}. 18497 18498@item -fdisable-tree-@var{pass} 18499@itemx -fdisable-tree-@var{pass}=@var{range-list} 18500Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 18501option arguments. 18502 18503@item -fenable-ipa-@var{pass} 18504Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 18505statically invoked in the compiler multiple times, the pass name should be 18506appended with a sequential number starting from 1. 18507 18508@item -fenable-rtl-@var{pass} 18509@itemx -fenable-rtl-@var{pass}=@var{range-list} 18510Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 18511description and examples. 18512 18513@item -fenable-tree-@var{pass} 18514@itemx -fenable-tree-@var{pass}=@var{range-list} 18515Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 18516of option arguments. 18517 18518@end table 18519 18520Here are some examples showing uses of these options. 18521 18522@smallexample 18523 18524# disable ccp1 for all functions 18525 -fdisable-tree-ccp1 18526# disable complete unroll for function whose cgraph node uid is 1 18527 -fenable-tree-cunroll=1 18528# disable gcse2 for functions at the following ranges [1,1], 18529# [300,400], and [400,1000] 18530# disable gcse2 for functions foo and foo2 18531 -fdisable-rtl-gcse2=foo,foo2 18532# disable early inlining 18533 -fdisable-tree-einline 18534# disable ipa inlining 18535 -fdisable-ipa-inline 18536# enable tree full unroll 18537 -fenable-tree-unroll 18538 18539@end smallexample 18540 18541@item -fchecking 18542@itemx -fchecking=@var{n} 18543@opindex fchecking 18544@opindex fno-checking 18545Enable internal consistency checking. The default depends on 18546the compiler configuration. @option{-fchecking=2} enables further 18547internal consistency checking that might affect code generation. 18548 18549@item -frandom-seed=@var{string} 18550@opindex frandom-seed 18551This option provides a seed that GCC uses in place of 18552random numbers in generating certain symbol names 18553that have to be different in every compiled file. It is also used to 18554place unique stamps in coverage data files and the object files that 18555produce them. You can use the @option{-frandom-seed} option to produce 18556reproducibly identical object files. 18557 18558The @var{string} can either be a number (decimal, octal or hex) or an 18559arbitrary string (in which case it's converted to a number by 18560computing CRC32). 18561 18562The @var{string} should be different for every file you compile. 18563 18564@item -save-temps 18565@opindex save-temps 18566Store the usual ``temporary'' intermediate files permanently; name them 18567as auxiliary output files, as specified described under 18568@option{-dumpbase} and @option{-dumpdir}. 18569 18570When used in combination with the @option{-x} command-line option, 18571@option{-save-temps} is sensible enough to avoid overwriting an 18572input source file with the same extension as an intermediate file. 18573The corresponding intermediate file may be obtained by renaming the 18574source file before using @option{-save-temps}. 18575 18576@item -save-temps=cwd 18577@opindex save-temps=cwd 18578Equivalent to @option{-save-temps -dumpdir ./}. 18579 18580@item -save-temps=obj 18581@opindex save-temps=obj 18582Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where 18583@file{outdir/} is the directory of the output file specified after the 18584@option{-o} option, including any directory separators. If the 18585@option{-o} option is not used, the @option{-save-temps=obj} switch 18586behaves like @option{-save-temps=cwd}. 18587 18588@item -time@r{[}=@var{file}@r{]} 18589@opindex time 18590Report the CPU time taken by each subprocess in the compilation 18591sequence. For C source files, this is the compiler proper and assembler 18592(plus the linker if linking is done). 18593 18594Without the specification of an output file, the output looks like this: 18595 18596@smallexample 18597# cc1 0.12 0.01 18598# as 0.00 0.01 18599@end smallexample 18600 18601The first number on each line is the ``user time'', that is time spent 18602executing the program itself. The second number is ``system time'', 18603time spent executing operating system routines on behalf of the program. 18604Both numbers are in seconds. 18605 18606With the specification of an output file, the output is appended to the 18607named file, and it looks like this: 18608 18609@smallexample 186100.12 0.01 cc1 @var{options} 186110.00 0.01 as @var{options} 18612@end smallexample 18613 18614The ``user time'' and the ``system time'' are moved before the program 18615name, and the options passed to the program are displayed, so that one 18616can later tell what file was being compiled, and with which options. 18617 18618@item -fdump-final-insns@r{[}=@var{file}@r{]} 18619@opindex fdump-final-insns 18620Dump the final internal representation (RTL) to @var{file}. If the 18621optional argument is omitted (or if @var{file} is @code{.}), the name 18622of the dump file is determined by appending @code{.gkd} to the 18623dump base name, see @option{-dumpbase}. 18624 18625@item -fcompare-debug@r{[}=@var{opts}@r{]} 18626@opindex fcompare-debug 18627@opindex fno-compare-debug 18628If no error occurs during compilation, run the compiler a second time, 18629adding @var{opts} and @option{-fcompare-debug-second} to the arguments 18630passed to the second compilation. Dump the final internal 18631representation in both compilations, and print an error if they differ. 18632 18633If the equal sign is omitted, the default @option{-gtoggle} is used. 18634 18635The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 18636and nonzero, implicitly enables @option{-fcompare-debug}. If 18637@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 18638then it is used for @var{opts}, otherwise the default @option{-gtoggle} 18639is used. 18640 18641@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 18642is equivalent to @option{-fno-compare-debug}, which disables the dumping 18643of the final representation and the second compilation, preventing even 18644@env{GCC_COMPARE_DEBUG} from taking effect. 18645 18646To verify full coverage during @option{-fcompare-debug} testing, set 18647@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 18648which GCC rejects as an invalid option in any actual compilation 18649(rather than preprocessing, assembly or linking). To get just a 18650warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 18651not overridden} will do. 18652 18653@item -fcompare-debug-second 18654@opindex fcompare-debug-second 18655This option is implicitly passed to the compiler for the second 18656compilation requested by @option{-fcompare-debug}, along with options to 18657silence warnings, and omitting other options that would cause the compiler 18658to produce output to files or to standard output as a side effect. Dump 18659files and preserved temporary files are renamed so as to contain the 18660@code{.gk} additional extension during the second compilation, to avoid 18661overwriting those generated by the first. 18662 18663When this option is passed to the compiler driver, it causes the 18664@emph{first} compilation to be skipped, which makes it useful for little 18665other than debugging the compiler proper. 18666 18667@item -gtoggle 18668@opindex gtoggle 18669Turn off generation of debug info, if leaving out this option 18670generates it, or turn it on at level 2 otherwise. The position of this 18671argument in the command line does not matter; it takes effect after all 18672other options are processed, and it does so only once, no matter how 18673many times it is given. This is mainly intended to be used with 18674@option{-fcompare-debug}. 18675 18676@item -fvar-tracking-assignments-toggle 18677@opindex fvar-tracking-assignments-toggle 18678@opindex fno-var-tracking-assignments-toggle 18679Toggle @option{-fvar-tracking-assignments}, in the same way that 18680@option{-gtoggle} toggles @option{-g}. 18681 18682@item -Q 18683@opindex Q 18684Makes the compiler print out each function name as it is compiled, and 18685print some statistics about each pass when it finishes. 18686 18687@item -ftime-report 18688@opindex ftime-report 18689Makes the compiler print some statistics about the time consumed by each 18690pass when it finishes. 18691 18692@item -ftime-report-details 18693@opindex ftime-report-details 18694Record the time consumed by infrastructure parts separately for each pass. 18695 18696@item -fira-verbose=@var{n} 18697@opindex fira-verbose 18698Control the verbosity of the dump file for the integrated register allocator. 18699The default value is 5. If the value @var{n} is greater or equal to 10, 18700the dump output is sent to stderr using the same format as @var{n} minus 10. 18701 18702@item -flto-report 18703@opindex flto-report 18704Prints a report with internal details on the workings of the link-time 18705optimizer. The contents of this report vary from version to version. 18706It is meant to be useful to GCC developers when processing object 18707files in LTO mode (via @option{-flto}). 18708 18709Disabled by default. 18710 18711@item -flto-report-wpa 18712@opindex flto-report-wpa 18713Like @option{-flto-report}, but only print for the WPA phase of link-time 18714optimization. 18715 18716@item -fmem-report 18717@opindex fmem-report 18718Makes the compiler print some statistics about permanent memory 18719allocation when it finishes. 18720 18721@item -fmem-report-wpa 18722@opindex fmem-report-wpa 18723Makes the compiler print some statistics about permanent memory 18724allocation for the WPA phase only. 18725 18726@item -fpre-ipa-mem-report 18727@opindex fpre-ipa-mem-report 18728@item -fpost-ipa-mem-report 18729@opindex fpost-ipa-mem-report 18730Makes the compiler print some statistics about permanent memory 18731allocation before or after interprocedural optimization. 18732 18733@item -fprofile-report 18734@opindex fprofile-report 18735Makes the compiler print some statistics about consistency of the 18736(estimated) profile and effect of individual passes. 18737 18738@item -fstack-usage 18739@opindex fstack-usage 18740Makes the compiler output stack usage information for the program, on a 18741per-function basis. The filename for the dump is made by appending 18742@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 18743the output file, if explicitly specified and it is not an executable, 18744otherwise it is the basename of the source file. An entry is made up 18745of three fields: 18746 18747@itemize 18748@item 18749The name of the function. 18750@item 18751A number of bytes. 18752@item 18753One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 18754@end itemize 18755 18756The qualifier @code{static} means that the function manipulates the stack 18757statically: a fixed number of bytes are allocated for the frame on function 18758entry and released on function exit; no stack adjustments are otherwise made 18759in the function. The second field is this fixed number of bytes. 18760 18761The qualifier @code{dynamic} means that the function manipulates the stack 18762dynamically: in addition to the static allocation described above, stack 18763adjustments are made in the body of the function, for example to push/pop 18764arguments around function calls. If the qualifier @code{bounded} is also 18765present, the amount of these adjustments is bounded at compile time and 18766the second field is an upper bound of the total amount of stack used by 18767the function. If it is not present, the amount of these adjustments is 18768not bounded at compile time and the second field only represents the 18769bounded part. 18770 18771@item -fstats 18772@opindex fstats 18773Emit statistics about front-end processing at the end of the compilation. 18774This option is supported only by the C++ front end, and 18775the information is generally only useful to the G++ development team. 18776 18777@item -fdbg-cnt-list 18778@opindex fdbg-cnt-list 18779Print the name and the counter upper bound for all debug counters. 18780 18781 18782@item -fdbg-cnt=@var{counter-value-list} 18783@opindex fdbg-cnt 18784Set the internal debug counter lower and upper bound. @var{counter-value-list} 18785is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1} 18786[:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets 18787the name of the counter and list of closed intervals. 18788The @var{lower_bound} is optional and is zero 18789initialized if not set. 18790For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10}, 18791@code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and 18792eleventh invocation. 18793For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations. 18794 18795@item -print-file-name=@var{library} 18796@opindex print-file-name 18797Print the full absolute name of the library file @var{library} that 18798would be used when linking---and don't do anything else. With this 18799option, GCC does not compile or link anything; it just prints the 18800file name. 18801 18802@item -print-multi-directory 18803@opindex print-multi-directory 18804Print the directory name corresponding to the multilib selected by any 18805other switches present in the command line. This directory is supposed 18806to exist in @env{GCC_EXEC_PREFIX}. 18807 18808@item -print-multi-lib 18809@opindex print-multi-lib 18810Print the mapping from multilib directory names to compiler switches 18811that enable them. The directory name is separated from the switches by 18812@samp{;}, and each switch starts with an @samp{@@} instead of the 18813@samp{-}, without spaces between multiple switches. This is supposed to 18814ease shell processing. 18815 18816@item -print-multi-os-directory 18817@opindex print-multi-os-directory 18818Print the path to OS libraries for the selected 18819multilib, relative to some @file{lib} subdirectory. If OS libraries are 18820present in the @file{lib} subdirectory and no multilibs are used, this is 18821usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 18822sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 18823@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 18824subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 18825 18826@item -print-multiarch 18827@opindex print-multiarch 18828Print the path to OS libraries for the selected multiarch, 18829relative to some @file{lib} subdirectory. 18830 18831@item -print-prog-name=@var{program} 18832@opindex print-prog-name 18833Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 18834 18835@item -print-libgcc-file-name 18836@opindex print-libgcc-file-name 18837Same as @option{-print-file-name=libgcc.a}. 18838 18839This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 18840but you do want to link with @file{libgcc.a}. You can do: 18841 18842@smallexample 18843gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 18844@end smallexample 18845 18846@item -print-search-dirs 18847@opindex print-search-dirs 18848Print the name of the configured installation directory and a list of 18849program and library directories @command{gcc} searches---and don't do anything else. 18850 18851This is useful when @command{gcc} prints the error message 18852@samp{installation problem, cannot exec cpp0: No such file or directory}. 18853To resolve this you either need to put @file{cpp0} and the other compiler 18854components where @command{gcc} expects to find them, or you can set the environment 18855variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 18856Don't forget the trailing @samp{/}. 18857@xref{Environment Variables}. 18858 18859@item -print-sysroot 18860@opindex print-sysroot 18861Print the target sysroot directory that is used during 18862compilation. This is the target sysroot specified either at configure 18863time or using the @option{--sysroot} option, possibly with an extra 18864suffix that depends on compilation options. If no target sysroot is 18865specified, the option prints nothing. 18866 18867@item -print-sysroot-headers-suffix 18868@opindex print-sysroot-headers-suffix 18869Print the suffix added to the target sysroot when searching for 18870headers, or give an error if the compiler is not configured with such 18871a suffix---and don't do anything else. 18872 18873@item -dumpmachine 18874@opindex dumpmachine 18875Print the compiler's target machine (for example, 18876@samp{i686-pc-linux-gnu})---and don't do anything else. 18877 18878@item -dumpversion 18879@opindex dumpversion 18880Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do 18881anything else. This is the compiler version used in filesystem paths and 18882specs. Depending on how the compiler has been configured it can be just 18883a single number (major version), two numbers separated by a dot (major and 18884minor version) or three numbers separated by dots (major, minor and patchlevel 18885version). 18886 18887@item -dumpfullversion 18888@opindex dumpfullversion 18889Print the full compiler version---and don't do anything else. The output is 18890always three numbers separated by dots, major, minor and patchlevel version. 18891 18892@item -dumpspecs 18893@opindex dumpspecs 18894Print the compiler's built-in specs---and don't do anything else. (This 18895is used when GCC itself is being built.) @xref{Spec Files}. 18896@end table 18897 18898@node Submodel Options 18899@section Machine-Dependent Options 18900@cindex submodel options 18901@cindex specifying hardware config 18902@cindex hardware models and configurations, specifying 18903@cindex target-dependent options 18904@cindex machine-dependent options 18905 18906Each target machine supported by GCC can have its own options---for 18907example, to allow you to compile for a particular processor variant or 18908ABI, or to control optimizations specific to that machine. By 18909convention, the names of machine-specific options start with 18910@samp{-m}. 18911 18912Some configurations of the compiler also support additional target-specific 18913options, usually for compatibility with other compilers on the same 18914platform. 18915 18916@c This list is ordered alphanumerically by subsection name. 18917@c It should be the same order and spelling as these options are listed 18918@c in Machine Dependent Options 18919 18920@menu 18921* AArch64 Options:: 18922* Adapteva Epiphany Options:: 18923* AMD GCN Options:: 18924* ARC Options:: 18925* ARM Options:: 18926* AVR Options:: 18927* Blackfin Options:: 18928* C6X Options:: 18929* CRIS Options:: 18930* CR16 Options:: 18931* C-SKY Options:: 18932* Darwin Options:: 18933* DEC Alpha Options:: 18934* eBPF Options:: 18935* FR30 Options:: 18936* FT32 Options:: 18937* FRV Options:: 18938* GNU/Linux Options:: 18939* H8/300 Options:: 18940* HPPA Options:: 18941* IA-64 Options:: 18942* LM32 Options:: 18943* LoongArch Options:: 18944* M32C Options:: 18945* M32R/D Options:: 18946* M680x0 Options:: 18947* MCore Options:: 18948* MeP Options:: 18949* MicroBlaze Options:: 18950* MIPS Options:: 18951* MMIX Options:: 18952* MN10300 Options:: 18953* Moxie Options:: 18954* MSP430 Options:: 18955* NDS32 Options:: 18956* Nios II Options:: 18957* Nvidia PTX Options:: 18958* OpenRISC Options:: 18959* PDP-11 Options:: 18960* picoChip Options:: 18961* PowerPC Options:: 18962* PRU Options:: 18963* RISC-V Options:: 18964* RL78 Options:: 18965* RS/6000 and PowerPC Options:: 18966* RX Options:: 18967* S/390 and zSeries Options:: 18968* Score Options:: 18969* SH Options:: 18970* Solaris 2 Options:: 18971* SPARC Options:: 18972* System V Options:: 18973* TILE-Gx Options:: 18974* TILEPro Options:: 18975* V850 Options:: 18976* VAX Options:: 18977* Visium Options:: 18978* VMS Options:: 18979* VxWorks Options:: 18980* x86 Options:: 18981* x86 Windows Options:: 18982* Xstormy16 Options:: 18983* Xtensa Options:: 18984* zSeries Options:: 18985@end menu 18986 18987@node AArch64 Options 18988@subsection AArch64 Options 18989@cindex AArch64 Options 18990 18991These options are defined for AArch64 implementations: 18992 18993@table @gcctabopt 18994 18995@item -mabi=@var{name} 18996@opindex mabi 18997Generate code for the specified data model. Permissible values 18998are @samp{ilp32} for SysV-like data model where int, long int and pointers 18999are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits, 19000but long int and pointers are 64 bits. 19001 19002The default depends on the specific target configuration. Note that 19003the LP64 and ILP32 ABIs are not link-compatible; you must compile your 19004entire program with the same ABI, and link with a compatible set of libraries. 19005 19006@item -mbig-endian 19007@opindex mbig-endian 19008Generate big-endian code. This is the default when GCC is configured for an 19009@samp{aarch64_be-*-*} target. 19010 19011@item -mgeneral-regs-only 19012@opindex mgeneral-regs-only 19013Generate code which uses only the general-purpose registers. This will prevent 19014the compiler from using floating-point and Advanced SIMD registers but will not 19015impose any restrictions on the assembler. 19016 19017@item -mlittle-endian 19018@opindex mlittle-endian 19019Generate little-endian code. This is the default when GCC is configured for an 19020@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 19021 19022@item -mcmodel=tiny 19023@opindex mcmodel=tiny 19024Generate code for the tiny code model. The program and its statically defined 19025symbols must be within 1MB of each other. Programs can be statically or 19026dynamically linked. 19027 19028@item -mcmodel=small 19029@opindex mcmodel=small 19030Generate code for the small code model. The program and its statically defined 19031symbols must be within 4GB of each other. Programs can be statically or 19032dynamically linked. This is the default code model. 19033 19034@item -mcmodel=large 19035@opindex mcmodel=large 19036Generate code for the large code model. This makes no assumptions about 19037addresses and sizes of sections. Programs can be statically linked only. The 19038@option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32}, 19039@option{-fpic} and @option{-fPIC}. 19040 19041@item -mstrict-align 19042@itemx -mno-strict-align 19043@opindex mstrict-align 19044@opindex mno-strict-align 19045Avoid or allow generating memory accesses that may not be aligned on a natural 19046object boundary as described in the architecture specification. 19047 19048@item -momit-leaf-frame-pointer 19049@itemx -mno-omit-leaf-frame-pointer 19050@opindex momit-leaf-frame-pointer 19051@opindex mno-omit-leaf-frame-pointer 19052Omit or keep the frame pointer in leaf functions. The former behavior is the 19053default. 19054 19055@item -mstack-protector-guard=@var{guard} 19056@itemx -mstack-protector-guard-reg=@var{reg} 19057@itemx -mstack-protector-guard-offset=@var{offset} 19058@opindex mstack-protector-guard 19059@opindex mstack-protector-guard-reg 19060@opindex mstack-protector-guard-offset 19061Generate stack protection code using canary at @var{guard}. Supported 19062locations are @samp{global} for a global canary or @samp{sysreg} for a 19063canary in an appropriate system register. 19064 19065With the latter choice the options 19066@option{-mstack-protector-guard-reg=@var{reg}} and 19067@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 19068which system register to use as base register for reading the canary, 19069and from what offset from that base register. There is no default 19070register or offset as this is entirely for use within the Linux 19071kernel. 19072 19073@item -mtls-dialect=desc 19074@opindex mtls-dialect=desc 19075Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 19076of TLS variables. This is the default. 19077 19078@item -mtls-dialect=traditional 19079@opindex mtls-dialect=traditional 19080Use traditional TLS as the thread-local storage mechanism for dynamic accesses 19081of TLS variables. 19082 19083@item -mtls-size=@var{size} 19084@opindex mtls-size 19085Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48. 19086This option requires binutils 2.26 or newer. 19087 19088@item -mfix-cortex-a53-835769 19089@itemx -mno-fix-cortex-a53-835769 19090@opindex mfix-cortex-a53-835769 19091@opindex mno-fix-cortex-a53-835769 19092Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 19093This involves inserting a NOP instruction between memory instructions and 1909464-bit integer multiply-accumulate instructions. 19095 19096@item -mfix-cortex-a53-843419 19097@itemx -mno-fix-cortex-a53-843419 19098@opindex mfix-cortex-a53-843419 19099@opindex mno-fix-cortex-a53-843419 19100Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 19101This erratum workaround is made at link time and this will only pass the 19102corresponding flag to the linker. 19103 19104@item -mlow-precision-recip-sqrt 19105@itemx -mno-low-precision-recip-sqrt 19106@opindex mlow-precision-recip-sqrt 19107@opindex mno-low-precision-recip-sqrt 19108Enable or disable the reciprocal square root approximation. 19109This option only has an effect if @option{-ffast-math} or 19110@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 19111precision of reciprocal square root results to about 16 bits for 19112single precision and to 32 bits for double precision. 19113 19114@item -mlow-precision-sqrt 19115@itemx -mno-low-precision-sqrt 19116@opindex mlow-precision-sqrt 19117@opindex mno-low-precision-sqrt 19118Enable or disable the square root approximation. 19119This option only has an effect if @option{-ffast-math} or 19120@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 19121precision of square root results to about 16 bits for 19122single precision and to 32 bits for double precision. 19123If enabled, it implies @option{-mlow-precision-recip-sqrt}. 19124 19125@item -mlow-precision-div 19126@itemx -mno-low-precision-div 19127@opindex mlow-precision-div 19128@opindex mno-low-precision-div 19129Enable or disable the division approximation. 19130This option only has an effect if @option{-ffast-math} or 19131@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 19132precision of division results to about 16 bits for 19133single precision and to 32 bits for double precision. 19134 19135@item -mtrack-speculation 19136@itemx -mno-track-speculation 19137Enable or disable generation of additional code to track speculative 19138execution through conditional branches. The tracking state can then 19139be used by the compiler when expanding calls to 19140@code{__builtin_speculation_safe_copy} to permit a more efficient code 19141sequence to be generated. 19142 19143@item -moutline-atomics 19144@itemx -mno-outline-atomics 19145Enable or disable calls to out-of-line helpers to implement atomic operations. 19146These helpers will, at runtime, determine if the LSE instructions from 19147ARMv8.1-A can be used; if not, they will use the load/store-exclusive 19148instructions that are present in the base ARMv8.0 ISA. 19149 19150This option is only applicable when compiling for the base ARMv8.0 19151instruction set. If using a later revision, e.g. @option{-march=armv8.1-a} 19152or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be 19153used directly. The same applies when using @option{-mcpu=} when the 19154selected cpu supports the @samp{lse} feature. 19155This option is on by default. 19156 19157@item -march=@var{name} 19158@opindex march 19159Specify the name of the target architecture and, optionally, one or 19160more feature modifiers. This option has the form 19161@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}. 19162 19163The table below summarizes the permissible values for @var{arch} 19164and the features that they enable by default: 19165 19166@multitable @columnfractions 0.20 0.20 0.60 19167@headitem @var{arch} value @tab Architecture @tab Includes by default 19168@item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd} 19169@item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma} 19170@item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a} 19171@item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth} 19172@item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod} 19173@item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres} 19174@item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm} 19175@item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64} 19176@item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops} 19177@item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2} 19178@item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r} 19179@end multitable 19180 19181The value @samp{native} is available on native AArch64 GNU/Linux and 19182causes the compiler to pick the architecture of the host system. This 19183option has no effect if the compiler is unable to recognize the 19184architecture of the host system, 19185 19186The permissible values for @var{feature} are listed in the sub-section 19187on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 19188Feature Modifiers}. Where conflicting feature modifiers are 19189specified, the right-most feature is used. 19190 19191GCC uses @var{name} to determine what kind of instructions it can emit 19192when generating assembly code. If @option{-march} is specified 19193without either of @option{-mtune} or @option{-mcpu} also being 19194specified, the code is tuned to perform well across a range of target 19195processors implementing the target architecture. 19196 19197@item -mtune=@var{name} 19198@opindex mtune 19199Specify the name of the target processor for which GCC should tune the 19200performance of the code. Permissible values for this option are: 19201@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 19202@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 19203@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77}, 19204@samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34}, 19205@samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, 19206@samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor}, 19207@samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1}, 19208@samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx}, 19209@samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, 19210@samp{octeontx}, @samp{octeontx81}, @samp{octeontx83}, 19211@samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96} 19212@samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n}, 19213@samp{octeontx2f95mm}, 19214@samp{a64fx}, 19215@samp{thunderx}, @samp{thunderxt88}, 19216@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110}, 19217@samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus}, 19218@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 19219@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 19220@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}, 19221@samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x2}, 19222@samp{cortex-a510}, @samp{cortex-a710}, @samp{ampere1}, 19223@samp{ampere1a}, @samp{cobalt-100} and @samp{native}. 19224 19225The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 19226@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 19227@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC 19228should tune for a big.LITTLE system. 19229 19230The value @samp{neoverse-512tvb} specifies that GCC should tune 19231for Neoverse cores that (a) implement SVE and (b) have a total vector 19232bandwidth of 512 bits per cycle. In other words, the option tells GCC to 19233tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic 19234instructions a cycle and that can execute an equivalent number of SVE 19235arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE). 19236This is more general than tuning for a specific core like Neoverse V1 19237but is more specific than the default tuning described below. 19238 19239Additionally on native AArch64 GNU/Linux systems the value 19240@samp{native} tunes performance to the host system. This option has no effect 19241if the compiler is unable to recognize the processor of the host system. 19242 19243Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 19244are specified, the code is tuned to perform well across a range 19245of target processors. 19246 19247This option cannot be suffixed by feature modifiers. 19248 19249@item -mcpu=@var{name} 19250@opindex mcpu 19251Specify the name of the target processor, optionally suffixed by one 19252or more feature modifiers. This option has the form 19253@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where 19254the permissible values for @var{cpu} are the same as those available 19255for @option{-mtune}. The permissible values for @var{feature} are 19256documented in the sub-section on 19257@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 19258Feature Modifiers}. Where conflicting feature modifiers are 19259specified, the right-most feature is used. 19260 19261GCC uses @var{name} to determine what kind of instructions it can emit when 19262generating assembly code (as if by @option{-march}) and to determine 19263the target processor for which to tune for performance (as if 19264by @option{-mtune}). Where this option is used in conjunction 19265with @option{-march} or @option{-mtune}, those options take precedence 19266over the appropriate part of this option. 19267 19268@option{-mcpu=neoverse-512tvb} is special in that it does not refer 19269to a specific core, but instead refers to all Neoverse cores that 19270(a) implement SVE and (b) have a total vector bandwidth of 512 bits 19271a cycle. Unless overridden by @option{-march}, 19272@option{-mcpu=neoverse-512tvb} generates code that can run on a 19273Neoverse V1 core, since Neoverse V1 is the first Neoverse core with 19274these properties. Unless overridden by @option{-mtune}, 19275@option{-mcpu=neoverse-512tvb} tunes code in the same way as for 19276@option{-mtune=neoverse-512tvb}. 19277 19278@item -moverride=@var{string} 19279@opindex moverride 19280Override tuning decisions made by the back-end in response to a 19281@option{-mtune=} switch. The syntax, semantics, and accepted values 19282for @var{string} in this option are not guaranteed to be consistent 19283across releases. 19284 19285This option is only intended to be useful when developing GCC. 19286 19287@item -mverbose-cost-dump 19288@opindex mverbose-cost-dump 19289Enable verbose cost model dumping in the debug dump files. This option is 19290provided for use in debugging the compiler. 19291 19292@item -mpc-relative-literal-loads 19293@itemx -mno-pc-relative-literal-loads 19294@opindex mpc-relative-literal-loads 19295@opindex mno-pc-relative-literal-loads 19296Enable or disable PC-relative literal loads. With this option literal pools are 19297accessed using a single instruction and emitted after each function. This 19298limits the maximum size of functions to 1MB. This is enabled by default for 19299@option{-mcmodel=tiny}. 19300 19301@item -msign-return-address=@var{scope} 19302@opindex msign-return-address 19303Select the function scope on which return address signing will be applied. 19304Permissible values are @samp{none}, which disables return address signing, 19305@samp{non-leaf}, which enables pointer signing for functions which are not leaf 19306functions, and @samp{all}, which enables pointer signing for all functions. The 19307default value is @samp{none}. This option has been deprecated by 19308-mbranch-protection. 19309 19310@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti} 19311@opindex mbranch-protection 19312Select the branch protection features to use. 19313@samp{none} is the default and turns off all types of branch protection. 19314@samp{standard} turns on all types of branch protection features. If a feature 19315has additional tuning options, then @samp{standard} sets it to its standard 19316level. 19317@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard 19318level: signing functions that save the return address to memory (non-leaf 19319functions will practically always do this) using the a-key. The optional 19320argument @samp{leaf} can be used to extend the signing to include leaf 19321functions. The optional argument @samp{b-key} can be used to sign the functions 19322with the B-key instead of the A-key. 19323@samp{bti} turns on branch target identification mechanism. 19324 19325@item -mharden-sls=@var{opts} 19326@opindex mharden-sls 19327Enable compiler hardening against straight line speculation (SLS). 19328@var{opts} is a comma-separated list of the following options: 19329@table @samp 19330@item retbr 19331@item blr 19332@end table 19333In addition, @samp{-mharden-sls=all} enables all SLS hardening while 19334@samp{-mharden-sls=none} disables all SLS hardening. 19335 19336@item -msve-vector-bits=@var{bits} 19337@opindex msve-vector-bits 19338Specify the number of bits in an SVE vector register. This option only has 19339an effect when SVE is enabled. 19340 19341GCC supports two forms of SVE code generation: ``vector-length 19342agnostic'' output that works with any size of vector register and 19343``vector-length specific'' output that allows GCC to make assumptions 19344about the vector length when it is useful for optimization reasons. 19345The possible values of @samp{bits} are: @samp{scalable}, @samp{128}, 19346@samp{256}, @samp{512}, @samp{1024} and @samp{2048}. 19347Specifying @samp{scalable} selects vector-length agnostic 19348output. At present @samp{-msve-vector-bits=128} also generates vector-length 19349agnostic output for big-endian targets. All other values generate 19350vector-length specific code. The behavior of these values may change 19351in future releases and no value except @samp{scalable} should be 19352relied on for producing code that is portable across different 19353hardware SVE vector lengths. 19354 19355The default is @samp{-msve-vector-bits=scalable}, which produces 19356vector-length agnostic code. 19357@end table 19358 19359@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 19360@anchor{aarch64-feature-modifiers} 19361@cindex @option{-march} feature modifiers 19362@cindex @option{-mcpu} feature modifiers 19363Feature modifiers used with @option{-march} and @option{-mcpu} can be any of 19364the following and their inverses @option{no@var{feature}}: 19365 19366@table @samp 19367@item crc 19368Enable CRC extension. This is on by default for 19369@option{-march=armv8.1-a}. 19370@item crypto 19371Enable Crypto extension. This also enables Advanced SIMD and floating-point 19372instructions. 19373@item fp 19374Enable floating-point instructions. This is on by default for all possible 19375values for options @option{-march} and @option{-mcpu}. 19376@item simd 19377Enable Advanced SIMD instructions. This also enables floating-point 19378instructions. This is on by default for all possible values for options 19379@option{-march} and @option{-mcpu}. 19380@item sve 19381Enable Scalable Vector Extension instructions. This also enables Advanced 19382SIMD and floating-point instructions. 19383@item lse 19384Enable Large System Extension instructions. This is on by default for 19385@option{-march=armv8.1-a}. 19386@item rdma 19387Enable Round Double Multiply Accumulate instructions. This is on by default 19388for @option{-march=armv8.1-a}. 19389@item fp16 19390Enable FP16 extension. This also enables floating-point instructions. 19391@item fp16fml 19392Enable FP16 fmla extension. This also enables FP16 extensions and 19393floating-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. 19394 19395@item rcpc 19396Enable the RcPc extension. This does not change code generation from GCC, 19397but is passed on to the assembler, enabling inline asm statements to use 19398instructions from the RcPc extension. 19399@item dotprod 19400Enable the Dot Product extension. This also enables Advanced SIMD instructions. 19401@item aes 19402Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced 19403SIMD instructions. 19404@item sha2 19405Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions. 19406@item sha3 19407Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD 19408instructions. Use of this option with architectures prior to Armv8.2-A is not supported. 19409@item sm4 19410Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. 19411Use of this option with architectures prior to Armv8.2-A is not supported. 19412@item profile 19413Enable the Statistical Profiling extension. This option is only to enable the 19414extension at the assembler level and does not affect code generation. 19415@item rng 19416Enable the Armv8.5-a Random Number instructions. This option is only to 19417enable the extension at the assembler level and does not affect code 19418generation. 19419@item memtag 19420Enable the Armv8.5-a Memory Tagging Extensions. 19421Use of this option with architectures prior to Armv8.5-A is not supported. 19422@item sb 19423Enable the Armv8-a Speculation Barrier instruction. This option is only to 19424enable the extension at the assembler level and does not affect code 19425generation. This option is enabled by default for @option{-march=armv8.5-a}. 19426@item ssbs 19427Enable the Armv8-a Speculative Store Bypass Safe instruction. This option 19428is only to enable the extension at the assembler level and does not affect code 19429generation. This option is enabled by default for @option{-march=armv8.5-a}. 19430@item predres 19431Enable the Armv8-a Execution and Data Prediction Restriction instructions. 19432This option is only to enable the extension at the assembler level and does 19433not affect code generation. This option is enabled by default for 19434@option{-march=armv8.5-a}. 19435@item sve2 19436Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE 19437instructions. 19438@item sve2-bitperm 19439Enable SVE2 bitperm instructions. This also enables SVE2 instructions. 19440@item sve2-sm4 19441Enable SVE2 sm4 instructions. This also enables SVE2 instructions. 19442@item sve2-aes 19443Enable SVE2 aes instructions. This also enables SVE2 instructions. 19444@item sve2-sha3 19445Enable SVE2 sha3 instructions. This also enables SVE2 instructions. 19446@item tme 19447Enable the Transactional Memory Extension. 19448@item i8mm 19449Enable 8-bit Integer Matrix Multiply instructions. This also enables 19450Advanced SIMD and floating-point instructions. This option is enabled by 19451default for @option{-march=armv8.6-a}. Use of this option with architectures 19452prior to Armv8.2-A is not supported. 19453@item f32mm 19454Enable 32-bit Floating point Matrix Multiply instructions. This also enables 19455SVE instructions. Use of this option with architectures prior to Armv8.2-A is 19456not supported. 19457@item f64mm 19458Enable 64-bit Floating point Matrix Multiply instructions. This also enables 19459SVE instructions. Use of this option with architectures prior to Armv8.2-A is 19460not supported. 19461@item bf16 19462Enable brain half-precision floating-point instructions. This also enables 19463Advanced SIMD and floating-point instructions. This option is enabled by 19464default for @option{-march=armv8.6-a}. Use of this option with architectures 19465prior to Armv8.2-A is not supported. 19466@item ls64 19467Enable the 64-byte atomic load and store instructions for accelerators. 19468This option is enabled by default for @option{-march=armv8.7-a}. 19469@item mops 19470Enable the instructions to accelerate memory operations like @code{memcpy}, 19471@code{memmove}, @code{memset}. This option is enabled by default for 19472@option{-march=armv8.8-a} 19473@item flagm 19474Enable the Flag Manipulation instructions Extension. 19475@item pauth 19476Enable the Pointer Authentication Extension. 19477 19478@end table 19479 19480Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd}, 19481which implies @option{fp}. 19482Conversely, @option{nofp} implies @option{nosimd}, which implies 19483@option{nocrypto}, @option{noaes} and @option{nosha2}. 19484 19485@node Adapteva Epiphany Options 19486@subsection Adapteva Epiphany Options 19487 19488These @samp{-m} options are defined for Adapteva Epiphany: 19489 19490@table @gcctabopt 19491@item -mhalf-reg-file 19492@opindex mhalf-reg-file 19493Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 19494That allows code to run on hardware variants that lack these registers. 19495 19496@item -mprefer-short-insn-regs 19497@opindex mprefer-short-insn-regs 19498Preferentially allocate registers that allow short instruction generation. 19499This can result in increased instruction count, so this may either reduce or 19500increase overall code size. 19501 19502@item -mbranch-cost=@var{num} 19503@opindex mbranch-cost 19504Set the cost of branches to roughly @var{num} ``simple'' instructions. 19505This cost is only a heuristic and is not guaranteed to produce 19506consistent results across releases. 19507 19508@item -mcmove 19509@opindex mcmove 19510Enable the generation of conditional moves. 19511 19512@item -mnops=@var{num} 19513@opindex mnops 19514Emit @var{num} NOPs before every other generated instruction. 19515 19516@item -mno-soft-cmpsf 19517@opindex mno-soft-cmpsf 19518@opindex msoft-cmpsf 19519For single-precision floating-point comparisons, emit an @code{fsub} instruction 19520and test the flags. This is faster than a software comparison, but can 19521get incorrect results in the presence of NaNs, or when two different small 19522numbers are compared such that their difference is calculated as zero. 19523The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 19524software comparisons. 19525 19526@item -mstack-offset=@var{num} 19527@opindex mstack-offset 19528Set the offset between the top of the stack and the stack pointer. 19529E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 19530can be used by leaf functions without stack allocation. 19531Values other than @samp{8} or @samp{16} are untested and unlikely to work. 19532Note also that this option changes the ABI; compiling a program with a 19533different stack offset than the libraries have been compiled with 19534generally does not work. 19535This option can be useful if you want to evaluate if a different stack 19536offset would give you better code, but to actually use a different stack 19537offset to build working programs, it is recommended to configure the 19538toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 19539 19540@item -mno-round-nearest 19541@opindex mno-round-nearest 19542@opindex mround-nearest 19543Make the scheduler assume that the rounding mode has been set to 19544truncating. The default is @option{-mround-nearest}. 19545 19546@item -mlong-calls 19547@opindex mlong-calls 19548If not otherwise specified by an attribute, assume all calls might be beyond 19549the offset range of the @code{b} / @code{bl} instructions, and therefore load the 19550function address into a register before performing a (otherwise direct) call. 19551This is the default. 19552 19553@item -mshort-calls 19554@opindex short-calls 19555If not otherwise specified by an attribute, assume all direct calls are 19556in the range of the @code{b} / @code{bl} instructions, so use these instructions 19557for direct calls. The default is @option{-mlong-calls}. 19558 19559@item -msmall16 19560@opindex msmall16 19561Assume addresses can be loaded as 16-bit unsigned values. This does not 19562apply to function addresses for which @option{-mlong-calls} semantics 19563are in effect. 19564 19565@item -mfp-mode=@var{mode} 19566@opindex mfp-mode 19567Set the prevailing mode of the floating-point unit. 19568This determines the floating-point mode that is provided and expected 19569at function call and return time. Making this mode match the mode you 19570predominantly need at function start can make your programs smaller and 19571faster by avoiding unnecessary mode switches. 19572 19573@var{mode} can be set to one the following values: 19574 19575@table @samp 19576@item caller 19577Any mode at function entry is valid, and retained or restored when 19578the function returns, and when it calls other functions. 19579This mode is useful for compiling libraries or other compilation units 19580you might want to incorporate into different programs with different 19581prevailing FPU modes, and the convenience of being able to use a single 19582object file outweighs the size and speed overhead for any extra 19583mode switching that might be needed, compared with what would be needed 19584with a more specific choice of prevailing FPU mode. 19585 19586@item truncate 19587This is the mode used for floating-point calculations with 19588truncating (i.e.@: round towards zero) rounding mode. That includes 19589conversion from floating point to integer. 19590 19591@item round-nearest 19592This is the mode used for floating-point calculations with 19593round-to-nearest-or-even rounding mode. 19594 19595@item int 19596This is the mode used to perform integer calculations in the FPU, e.g.@: 19597integer multiply, or integer multiply-and-accumulate. 19598@end table 19599 19600The default is @option{-mfp-mode=caller} 19601 19602@item -mno-split-lohi 19603@itemx -mno-postinc 19604@itemx -mno-postmodify 19605@opindex mno-split-lohi 19606@opindex msplit-lohi 19607@opindex mno-postinc 19608@opindex mpostinc 19609@opindex mno-postmodify 19610@opindex mpostmodify 19611Code generation tweaks that disable, respectively, splitting of 32-bit 19612loads, generation of post-increment addresses, and generation of 19613post-modify addresses. The defaults are @option{msplit-lohi}, 19614@option{-mpost-inc}, and @option{-mpost-modify}. 19615 19616@item -mnovect-double 19617@opindex mno-vect-double 19618@opindex mvect-double 19619Change the preferred SIMD mode to SImode. The default is 19620@option{-mvect-double}, which uses DImode as preferred SIMD mode. 19621 19622@item -max-vect-align=@var{num} 19623@opindex max-vect-align 19624The maximum alignment for SIMD vector mode types. 19625@var{num} may be 4 or 8. The default is 8. 19626Note that this is an ABI change, even though many library function 19627interfaces are unaffected if they don't use SIMD vector modes 19628in places that affect size and/or alignment of relevant types. 19629 19630@item -msplit-vecmove-early 19631@opindex msplit-vecmove-early 19632Split vector moves into single word moves before reload. In theory this 19633can give better register allocation, but so far the reverse seems to be 19634generally the case. 19635 19636@item -m1reg-@var{reg} 19637@opindex m1reg- 19638Specify a register to hold the constant @minus{}1, which makes loading small negative 19639constants and certain bitmasks faster. 19640Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 19641which specify use of that register as a fixed register, 19642and @samp{none}, which means that no register is used for this 19643purpose. The default is @option{-m1reg-none}. 19644 19645@end table 19646 19647@node AMD GCN Options 19648@subsection AMD GCN Options 19649@cindex AMD GCN Options 19650 19651These options are defined specifically for the AMD GCN port. 19652 19653@table @gcctabopt 19654 19655@item -march=@var{gpu} 19656@opindex march 19657@itemx -mtune=@var{gpu} 19658@opindex mtune 19659Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu} 19660are 19661 19662@table @samp 19663@opindex fiji 19664@item fiji 19665Compile for GCN3 Fiji devices (gfx803). 19666 19667@item gfx900 19668Compile for GCN5 Vega 10 devices (gfx900). 19669 19670@item gfx906 19671Compile for GCN5 Vega 20 devices (gfx906). 19672 19673@end table 19674 19675@item -msram-ecc=on 19676@itemx -msram-ecc=off 19677@itemx -msram-ecc=any 19678@opindex msram-ecc 19679Compile binaries suitable for devices with the SRAM-ECC feature enabled, 19680disabled, or either mode. This feature can be enabled per-process on some 19681devices. The compiled code must match the device mode. The default is 19682@samp{any}, for devices that support it. 19683 19684@item -mstack-size=@var{bytes} 19685@opindex mstack-size 19686Specify how many @var{bytes} of stack space will be requested for each GPU 19687thread (wave-front). Beware that there may be many threads and limited memory 19688available. The size of the stack allocation may also have an impact on 19689run-time performance. The default is 32KB when using OpenACC or OpenMP, and 196901MB otherwise. 19691 19692@item -mxnack 19693@opindex mxnack 19694Compile binaries suitable for devices with the XNACK feature enabled. Some 19695devices always require XNACK and some allow the user to configure XNACK. The 19696compiled code must match the device mode. The default is @samp{-mno-xnack}. 19697At present this option is a placeholder for support that is not yet 19698implemented. 19699 19700@end table 19701 19702@node ARC Options 19703@subsection ARC Options 19704@cindex ARC options 19705 19706The following options control the architecture variant for which code 19707is being compiled: 19708 19709@c architecture variants 19710@table @gcctabopt 19711 19712@item -mbarrel-shifter 19713@opindex mbarrel-shifter 19714Generate instructions supported by barrel shifter. This is the default 19715unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect. 19716 19717@item -mjli-always 19718@opindex mjli-always 19719Force to call a function using jli_s instruction. This option is 19720valid only for ARCv2 architecture. 19721 19722@item -mcpu=@var{cpu} 19723@opindex mcpu 19724Set architecture type, register usage, and instruction scheduling 19725parameters for @var{cpu}. There are also shortcut alias options 19726available for backward compatibility and convenience. Supported 19727values for @var{cpu} are 19728 19729@table @samp 19730@opindex mA6 19731@opindex mARC600 19732@item arc600 19733Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 19734 19735@item arc601 19736@opindex mARC601 19737Compile for ARC601. Alias: @option{-mARC601}. 19738 19739@item arc700 19740@opindex mA7 19741@opindex mARC700 19742Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 19743This is the default when configured with @option{--with-cpu=arc700}@. 19744 19745@item arcem 19746Compile for ARC EM. 19747 19748@item archs 19749Compile for ARC HS. 19750 19751@item em 19752Compile for ARC EM CPU with no hardware extensions. 19753 19754@item em4 19755Compile for ARC EM4 CPU. 19756 19757@item em4_dmips 19758Compile for ARC EM4 DMIPS CPU. 19759 19760@item em4_fpus 19761Compile for ARC EM4 DMIPS CPU with the single-precision floating-point 19762extension. 19763 19764@item em4_fpuda 19765Compile for ARC EM4 DMIPS CPU with single-precision floating-point and 19766double assist instructions. 19767 19768@item hs 19769Compile for ARC HS CPU with no hardware extensions except the atomic 19770instructions. 19771 19772@item hs34 19773Compile for ARC HS34 CPU. 19774 19775@item hs38 19776Compile for ARC HS38 CPU. 19777 19778@item hs38_linux 19779Compile for ARC HS38 CPU with all hardware extensions on. 19780 19781@item arc600_norm 19782Compile for ARC 600 CPU with @code{norm} instructions enabled. 19783 19784@item arc600_mul32x16 19785Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 19786instructions enabled. 19787 19788@item arc600_mul64 19789Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 19790instructions enabled. 19791 19792@item arc601_norm 19793Compile for ARC 601 CPU with @code{norm} instructions enabled. 19794 19795@item arc601_mul32x16 19796Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply 19797instructions enabled. 19798 19799@item arc601_mul64 19800Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family 19801instructions enabled. 19802 19803@item nps400 19804Compile for ARC 700 on NPS400 chip. 19805 19806@item em_mini 19807Compile for ARC EM minimalist configuration featuring reduced register 19808set. 19809 19810@end table 19811 19812@item -mdpfp 19813@opindex mdpfp 19814@itemx -mdpfp-compact 19815@opindex mdpfp-compact 19816Generate double-precision FPX instructions, tuned for the compact 19817implementation. 19818 19819@item -mdpfp-fast 19820@opindex mdpfp-fast 19821Generate double-precision FPX instructions, tuned for the fast 19822implementation. 19823 19824@item -mno-dpfp-lrsr 19825@opindex mno-dpfp-lrsr 19826Disable @code{lr} and @code{sr} instructions from using FPX extension 19827aux registers. 19828 19829@item -mea 19830@opindex mea 19831Generate extended arithmetic instructions. Currently only 19832@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 19833supported. Only valid for @option{-mcpu=ARC700}. 19834 19835@item -mno-mpy 19836@opindex mno-mpy 19837@opindex mmpy 19838Do not generate @code{mpy}-family instructions for ARC700. This option is 19839deprecated. 19840 19841@item -mmul32x16 19842@opindex mmul32x16 19843Generate 32x16-bit multiply and multiply-accumulate instructions. 19844 19845@item -mmul64 19846@opindex mmul64 19847Generate @code{mul64} and @code{mulu64} instructions. 19848Only valid for @option{-mcpu=ARC600}. 19849 19850@item -mnorm 19851@opindex mnorm 19852Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700} 19853is in effect. 19854 19855@item -mspfp 19856@opindex mspfp 19857@itemx -mspfp-compact 19858@opindex mspfp-compact 19859Generate single-precision FPX instructions, tuned for the compact 19860implementation. 19861 19862@item -mspfp-fast 19863@opindex mspfp-fast 19864Generate single-precision FPX instructions, tuned for the fast 19865implementation. 19866 19867@item -msimd 19868@opindex msimd 19869Enable generation of ARC SIMD instructions via target-specific 19870builtins. Only valid for @option{-mcpu=ARC700}. 19871 19872@item -msoft-float 19873@opindex msoft-float 19874This option ignored; it is provided for compatibility purposes only. 19875Software floating-point code is emitted by default, and this default 19876can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or 19877@option{-mspfp-fast} for single precision, and @option{-mdpfp}, 19878@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision. 19879 19880@item -mswap 19881@opindex mswap 19882Generate @code{swap} instructions. 19883 19884@item -matomic 19885@opindex matomic 19886This enables use of the locked load/store conditional extension to implement 19887atomic memory built-in functions. Not available for ARC 6xx or ARC 19888EM cores. 19889 19890@item -mdiv-rem 19891@opindex mdiv-rem 19892Enable @code{div} and @code{rem} instructions for ARCv2 cores. 19893 19894@item -mcode-density 19895@opindex mcode-density 19896Enable code density instructions for ARC EM. 19897This option is on by default for ARC HS. 19898 19899@item -mll64 19900@opindex mll64 19901Enable double load/store operations for ARC HS cores. 19902 19903@item -mtp-regno=@var{regno} 19904@opindex mtp-regno 19905Specify thread pointer register number. 19906 19907@item -mmpy-option=@var{multo} 19908@opindex mmpy-option 19909Compile ARCv2 code with a multiplier design option. You can specify 19910the option using either a string or numeric value for @var{multo}. 19911@samp{wlh1} is the default value. The recognized values are: 19912 19913@table @samp 19914@item 0 19915@itemx none 19916No multiplier available. 19917 19918@item 1 19919@itemx w 1992016x16 multiplier, fully pipelined. 19921The following instructions are enabled: @code{mpyw} and @code{mpyuw}. 19922 19923@item 2 19924@itemx wlh1 1992532x32 multiplier, fully 19926pipelined (1 stage). The following instructions are additionally 19927enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 19928 19929@item 3 19930@itemx wlh2 1993132x32 multiplier, fully pipelined 19932(2 stages). The following instructions are additionally enabled: @code{mpy}, 19933@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 19934 19935@item 4 19936@itemx wlh3 19937Two 16x16 multipliers, blocking, 19938sequential. The following instructions are additionally enabled: @code{mpy}, 19939@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 19940 19941@item 5 19942@itemx wlh4 19943One 16x16 multiplier, blocking, 19944sequential. The following instructions are additionally enabled: @code{mpy}, 19945@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 19946 19947@item 6 19948@itemx wlh5 19949One 32x4 multiplier, blocking, 19950sequential. The following instructions are additionally enabled: @code{mpy}, 19951@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 19952 19953@item 7 19954@itemx plus_dmpy 19955ARC HS SIMD support. 19956 19957@item 8 19958@itemx plus_macd 19959ARC HS SIMD support. 19960 19961@item 9 19962@itemx plus_qmacw 19963ARC HS SIMD support. 19964 19965@end table 19966 19967This option is only available for ARCv2 cores@. 19968 19969@item -mfpu=@var{fpu} 19970@opindex mfpu 19971Enables support for specific floating-point hardware extensions for ARCv2 19972cores. Supported values for @var{fpu} are: 19973 19974@table @samp 19975 19976@item fpus 19977Enables support for single-precision floating-point hardware 19978extensions@. 19979 19980@item fpud 19981Enables support for double-precision floating-point hardware 19982extensions. The single-precision floating-point extension is also 19983enabled. Not available for ARC EM@. 19984 19985@item fpuda 19986Enables support for double-precision floating-point hardware 19987extensions using double-precision assist instructions. The single-precision 19988floating-point extension is also enabled. This option is 19989only available for ARC EM@. 19990 19991@item fpuda_div 19992Enables support for double-precision floating-point hardware 19993extensions using double-precision assist instructions. 19994The single-precision floating-point, square-root, and divide 19995extensions are also enabled. This option is 19996only available for ARC EM@. 19997 19998@item fpuda_fma 19999Enables support for double-precision floating-point hardware 20000extensions using double-precision assist instructions. 20001The single-precision floating-point and fused multiply and add 20002hardware extensions are also enabled. This option is 20003only available for ARC EM@. 20004 20005@item fpuda_all 20006Enables support for double-precision floating-point hardware 20007extensions using double-precision assist instructions. 20008All single-precision floating-point hardware extensions are also 20009enabled. This option is only available for ARC EM@. 20010 20011@item fpus_div 20012Enables support for single-precision floating-point, square-root and divide 20013hardware extensions@. 20014 20015@item fpud_div 20016Enables support for double-precision floating-point, square-root and divide 20017hardware extensions. This option 20018includes option @samp{fpus_div}. Not available for ARC EM@. 20019 20020@item fpus_fma 20021Enables support for single-precision floating-point and 20022fused multiply and add hardware extensions@. 20023 20024@item fpud_fma 20025Enables support for double-precision floating-point and 20026fused multiply and add hardware extensions. This option 20027includes option @samp{fpus_fma}. Not available for ARC EM@. 20028 20029@item fpus_all 20030Enables support for all single-precision floating-point hardware 20031extensions@. 20032 20033@item fpud_all 20034Enables support for all single- and double-precision floating-point 20035hardware extensions. Not available for ARC EM@. 20036 20037@end table 20038 20039@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count} 20040@opindex mirq-ctrl-saved 20041Specifies general-purposes registers that the processor automatically 20042saves/restores on interrupt entry and exit. @var{register-range} is 20043specified as two registers separated by a dash. The register range 20044always starts with @code{r0}, the upper limit is @code{fp} register. 20045@var{blink} and @var{lp_count} are optional. This option is only 20046valid for ARC EM and ARC HS cores. 20047 20048@item -mrgf-banked-regs=@var{number} 20049@opindex mrgf-banked-regs 20050Specifies the number of registers replicated in second register bank 20051on entry to fast interrupt. Fast interrupts are interrupts with the 20052highest priority level P0. These interrupts save only PC and STATUS32 20053registers to avoid memory transactions during interrupt entry and exit 20054sequences. Use this option when you are using fast interrupts in an 20055ARC V2 family processor. Permitted values are 4, 8, 16, and 32. 20056 20057@item -mlpc-width=@var{width} 20058@opindex mlpc-width 20059Specify the width of the @code{lp_count} register. Valid values for 20060@var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is 20061fixed to 32 bits. If the width is less than 32, the compiler does not 20062attempt to transform loops in your program to use the zero-delay loop 20063mechanism unless it is known that the @code{lp_count} register can 20064hold the required loop-counter value. Depending on the width 20065specified, the compiler and run-time library might continue to use the 20066loop mechanism for various needs. This option defines macro 20067@code{__ARC_LPC_WIDTH__} with the value of @var{width}. 20068 20069@item -mrf16 20070@opindex mrf16 20071This option instructs the compiler to generate code for a 16-entry 20072register file. This option defines the @code{__ARC_RF16__} 20073preprocessor macro. 20074 20075@item -mbranch-index 20076@opindex mbranch-index 20077Enable use of @code{bi} or @code{bih} instructions to implement jump 20078tables. 20079 20080@end table 20081 20082The following options are passed through to the assembler, and also 20083define preprocessor macro symbols. 20084 20085@c Flags used by the assembler, but for which we define preprocessor 20086@c macro symbols as well. 20087@table @gcctabopt 20088@item -mdsp-packa 20089@opindex mdsp-packa 20090Passed down to the assembler to enable the DSP Pack A extensions. 20091Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is 20092deprecated. 20093 20094@item -mdvbf 20095@opindex mdvbf 20096Passed down to the assembler to enable the dual Viterbi butterfly 20097extension. Also sets the preprocessor symbol @code{__Xdvbf}. This 20098option is deprecated. 20099 20100@c ARC700 4.10 extension instruction 20101@item -mlock 20102@opindex mlock 20103Passed down to the assembler to enable the locked load/store 20104conditional extension. Also sets the preprocessor symbol 20105@code{__Xlock}. 20106 20107@item -mmac-d16 20108@opindex mmac-d16 20109Passed down to the assembler. Also sets the preprocessor symbol 20110@code{__Xxmac_d16}. This option is deprecated. 20111 20112@item -mmac-24 20113@opindex mmac-24 20114Passed down to the assembler. Also sets the preprocessor symbol 20115@code{__Xxmac_24}. This option is deprecated. 20116 20117@c ARC700 4.10 extension instruction 20118@item -mrtsc 20119@opindex mrtsc 20120Passed down to the assembler to enable the 64-bit time-stamp counter 20121extension instruction. Also sets the preprocessor symbol 20122@code{__Xrtsc}. This option is deprecated. 20123 20124@c ARC700 4.10 extension instruction 20125@item -mswape 20126@opindex mswape 20127Passed down to the assembler to enable the swap byte ordering 20128extension instruction. Also sets the preprocessor symbol 20129@code{__Xswape}. 20130 20131@item -mtelephony 20132@opindex mtelephony 20133Passed down to the assembler to enable dual- and single-operand 20134instructions for telephony. Also sets the preprocessor symbol 20135@code{__Xtelephony}. This option is deprecated. 20136 20137@item -mxy 20138@opindex mxy 20139Passed down to the assembler to enable the XY memory extension. Also 20140sets the preprocessor symbol @code{__Xxy}. 20141 20142@end table 20143 20144The following options control how the assembly code is annotated: 20145 20146@c Assembly annotation options 20147@table @gcctabopt 20148@item -misize 20149@opindex misize 20150Annotate assembler instructions with estimated addresses. 20151 20152@item -mannotate-align 20153@opindex mannotate-align 20154Explain what alignment considerations lead to the decision to make an 20155instruction short or long. 20156 20157@end table 20158 20159The following options are passed through to the linker: 20160 20161@c options passed through to the linker 20162@table @gcctabopt 20163@item -marclinux 20164@opindex marclinux 20165Passed through to the linker, to specify use of the @code{arclinux} emulation. 20166This option is enabled by default in tool chains built for 20167@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 20168when profiling is not requested. 20169 20170@item -marclinux_prof 20171@opindex marclinux_prof 20172Passed through to the linker, to specify use of the 20173@code{arclinux_prof} emulation. This option is enabled by default in 20174tool chains built for @w{@code{arc-linux-uclibc}} and 20175@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 20176 20177@end table 20178 20179The following options control the semantics of generated code: 20180 20181@c semantically relevant code generation options 20182@table @gcctabopt 20183@item -mlong-calls 20184@opindex mlong-calls 20185Generate calls as register indirect calls, thus providing access 20186to the full 32-bit address range. 20187 20188@item -mmedium-calls 20189@opindex mmedium-calls 20190Don't use less than 25-bit addressing range for calls, which is the 20191offset available for an unconditional branch-and-link 20192instruction. Conditional execution of function calls is suppressed, to 20193allow use of the 25-bit range, rather than the 21-bit range with 20194conditional branch-and-link. This is the default for tool chains built 20195for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 20196 20197@item -G @var{num} 20198@opindex G 20199Put definitions of externally-visible data in a small data section if 20200that data is no bigger than @var{num} bytes. The default value of 20201@var{num} is 4 for any ARC configuration, or 8 when we have double 20202load/store operations. 20203 20204@item -mno-sdata 20205@opindex mno-sdata 20206@opindex msdata 20207Do not generate sdata references. This is the default for tool chains 20208built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 20209targets. 20210 20211@item -mvolatile-cache 20212@opindex mvolatile-cache 20213Use ordinarily cached memory accesses for volatile references. This is the 20214default. 20215 20216@item -mno-volatile-cache 20217@opindex mno-volatile-cache 20218@opindex mvolatile-cache 20219Enable cache bypass for volatile references. 20220 20221@end table 20222 20223The following options fine tune code generation: 20224@c code generation tuning options 20225@table @gcctabopt 20226@item -malign-call 20227@opindex malign-call 20228Does nothing. Preserved for backward compatibility. 20229 20230@item -mauto-modify-reg 20231@opindex mauto-modify-reg 20232Enable the use of pre/post modify with register displacement. 20233 20234@item -mbbit-peephole 20235@opindex mbbit-peephole 20236Enable bbit peephole2. 20237 20238@item -mno-brcc 20239@opindex mno-brcc 20240This option disables a target-specific pass in @file{arc_reorg} to 20241generate compare-and-branch (@code{br@var{cc}}) instructions. 20242It has no effect on 20243generation of these instructions driven by the combiner pass. 20244 20245@item -mcase-vector-pcrel 20246@opindex mcase-vector-pcrel 20247Use PC-relative switch case tables to enable case table shortening. 20248This is the default for @option{-Os}. 20249 20250@item -mcompact-casesi 20251@opindex mcompact-casesi 20252Enable compact @code{casesi} pattern. This is the default for @option{-Os}, 20253and only available for ARCv1 cores. This option is deprecated. 20254 20255@item -mno-cond-exec 20256@opindex mno-cond-exec 20257Disable the ARCompact-specific pass to generate conditional 20258execution instructions. 20259 20260Due to delay slot scheduling and interactions between operand numbers, 20261literal sizes, instruction lengths, and the support for conditional execution, 20262the target-independent pass to generate conditional execution is often lacking, 20263so the ARC port has kept a special pass around that tries to find more 20264conditional execution generation opportunities after register allocation, 20265branch shortening, and delay slot scheduling have been done. This pass 20266generally, but not always, improves performance and code size, at the cost of 20267extra compilation time, which is why there is an option to switch it off. 20268If you have a problem with call instructions exceeding their allowable 20269offset range because they are conditionalized, you should consider using 20270@option{-mmedium-calls} instead. 20271 20272@item -mearly-cbranchsi 20273@opindex mearly-cbranchsi 20274Enable pre-reload use of the @code{cbranchsi} pattern. 20275 20276@item -mexpand-adddi 20277@opindex mexpand-adddi 20278Expand @code{adddi3} and @code{subdi3} at RTL generation time into 20279@code{add.f}, @code{adc} etc. This option is deprecated. 20280 20281@item -mindexed-loads 20282@opindex mindexed-loads 20283Enable the use of indexed loads. This can be problematic because some 20284optimizers then assume that indexed stores exist, which is not 20285the case. 20286 20287@item -mlra 20288@opindex mlra 20289Enable Local Register Allocation. This is still experimental for ARC, 20290so by default the compiler uses standard reload 20291(i.e.@: @option{-mno-lra}). 20292 20293@item -mlra-priority-none 20294@opindex mlra-priority-none 20295Don't indicate any priority for target registers. 20296 20297@item -mlra-priority-compact 20298@opindex mlra-priority-compact 20299Indicate target register priority for r0..r3 / r12..r15. 20300 20301@item -mlra-priority-noncompact 20302@opindex mlra-priority-noncompact 20303Reduce target register priority for r0..r3 / r12..r15. 20304 20305@item -mmillicode 20306@opindex mmillicode 20307When optimizing for size (using @option{-Os}), prologues and epilogues 20308that have to save or restore a large number of registers are often 20309shortened by using call to a special function in libgcc; this is 20310referred to as a @emph{millicode} call. As these calls can pose 20311performance issues, and/or cause linking issues when linking in a 20312nonstandard way, this option is provided to turn on or off millicode 20313call generation. 20314 20315@item -mcode-density-frame 20316@opindex mcode-density-frame 20317This option enable the compiler to emit @code{enter} and @code{leave} 20318instructions. These instructions are only valid for CPUs with 20319code-density feature. 20320 20321@item -mmixed-code 20322@opindex mmixed-code 20323Does nothing. Preserved for backward compatibility. 20324 20325@item -mq-class 20326@opindex mq-class 20327Ths option is deprecated. Enable @samp{q} instruction alternatives. 20328This is the default for @option{-Os}. 20329 20330@item -mRcq 20331@opindex mRcq 20332Enable @samp{Rcq} constraint handling. 20333Most short code generation depends on this. 20334This is the default. 20335 20336@item -mRcw 20337@opindex mRcw 20338Enable @samp{Rcw} constraint handling. 20339Most ccfsm condexec mostly depends on this. 20340This is the default. 20341 20342@item -msize-level=@var{level} 20343@opindex msize-level 20344Fine-tune size optimization with regards to instruction lengths and alignment. 20345The recognized values for @var{level} are: 20346@table @samp 20347@item 0 20348No size optimization. This level is deprecated and treated like @samp{1}. 20349 20350@item 1 20351Short instructions are used opportunistically. 20352 20353@item 2 20354In addition, alignment of loops and of code after barriers are dropped. 20355 20356@item 3 20357In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 20358 20359@end table 20360 20361This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 20362the behavior when this is not set is equivalent to level @samp{1}. 20363 20364@item -mtune=@var{cpu} 20365@opindex mtune 20366Set instruction scheduling parameters for @var{cpu}, overriding any implied 20367by @option{-mcpu=}. 20368 20369Supported values for @var{cpu} are 20370 20371@table @samp 20372@item ARC600 20373Tune for ARC600 CPU. 20374 20375@item ARC601 20376Tune for ARC601 CPU. 20377 20378@item ARC700 20379Tune for ARC700 CPU with standard multiplier block. 20380 20381@item ARC700-xmac 20382Tune for ARC700 CPU with XMAC block. 20383 20384@item ARC725D 20385Tune for ARC725D CPU. 20386 20387@item ARC750D 20388Tune for ARC750D CPU. 20389 20390@end table 20391 20392@item -mmultcost=@var{num} 20393@opindex mmultcost 20394Cost to assume for a multiply instruction, with @samp{4} being equal to a 20395normal instruction. 20396 20397@item -munalign-prob-threshold=@var{probability} 20398@opindex munalign-prob-threshold 20399Does nothing. Preserved for backward compatibility. 20400 20401@end table 20402 20403The following options are maintained for backward compatibility, but 20404are now deprecated and will be removed in a future release: 20405 20406@c Deprecated options 20407@table @gcctabopt 20408 20409@item -margonaut 20410@opindex margonaut 20411Obsolete FPX. 20412 20413@item -mbig-endian 20414@opindex mbig-endian 20415@itemx -EB 20416@opindex EB 20417Compile code for big-endian targets. Use of these options is now 20418deprecated. Big-endian code is supported by configuring GCC to build 20419@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets, 20420for which big endian is the default. 20421 20422@item -mlittle-endian 20423@opindex mlittle-endian 20424@itemx -EL 20425@opindex EL 20426Compile code for little-endian targets. Use of these options is now 20427deprecated. Little-endian code is supported by configuring GCC to build 20428@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets, 20429for which little endian is the default. 20430 20431@item -mbarrel_shifter 20432@opindex mbarrel_shifter 20433Replaced by @option{-mbarrel-shifter}. 20434 20435@item -mdpfp_compact 20436@opindex mdpfp_compact 20437Replaced by @option{-mdpfp-compact}. 20438 20439@item -mdpfp_fast 20440@opindex mdpfp_fast 20441Replaced by @option{-mdpfp-fast}. 20442 20443@item -mdsp_packa 20444@opindex mdsp_packa 20445Replaced by @option{-mdsp-packa}. 20446 20447@item -mEA 20448@opindex mEA 20449Replaced by @option{-mea}. 20450 20451@item -mmac_24 20452@opindex mmac_24 20453Replaced by @option{-mmac-24}. 20454 20455@item -mmac_d16 20456@opindex mmac_d16 20457Replaced by @option{-mmac-d16}. 20458 20459@item -mspfp_compact 20460@opindex mspfp_compact 20461Replaced by @option{-mspfp-compact}. 20462 20463@item -mspfp_fast 20464@opindex mspfp_fast 20465Replaced by @option{-mspfp-fast}. 20466 20467@item -mtune=@var{cpu} 20468@opindex mtune 20469Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 20470@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 20471@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively. 20472 20473@item -multcost=@var{num} 20474@opindex multcost 20475Replaced by @option{-mmultcost}. 20476 20477@end table 20478 20479@node ARM Options 20480@subsection ARM Options 20481@cindex ARM options 20482 20483These @samp{-m} options are defined for the ARM port: 20484 20485@table @gcctabopt 20486@item -mabi=@var{name} 20487@opindex mabi 20488Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 20489@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 20490 20491@item -mapcs-frame 20492@opindex mapcs-frame 20493Generate a stack frame that is compliant with the ARM Procedure Call 20494Standard for all functions, even if this is not strictly necessary for 20495correct execution of the code. Specifying @option{-fomit-frame-pointer} 20496with this option causes the stack frames not to be generated for 20497leaf functions. The default is @option{-mno-apcs-frame}. 20498This option is deprecated. 20499 20500@item -mapcs 20501@opindex mapcs 20502This is a synonym for @option{-mapcs-frame} and is deprecated. 20503 20504@ignore 20505@c not currently implemented 20506@item -mapcs-stack-check 20507@opindex mapcs-stack-check 20508Generate code to check the amount of stack space available upon entry to 20509every function (that actually uses some stack space). If there is 20510insufficient space available then either the function 20511@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 20512called, depending upon the amount of stack space required. The runtime 20513system is required to provide these functions. The default is 20514@option{-mno-apcs-stack-check}, since this produces smaller code. 20515 20516@c not currently implemented 20517@item -mapcs-reentrant 20518@opindex mapcs-reentrant 20519Generate reentrant, position-independent code. The default is 20520@option{-mno-apcs-reentrant}. 20521@end ignore 20522 20523@item -mthumb-interwork 20524@opindex mthumb-interwork 20525Generate code that supports calling between the ARM and Thumb 20526instruction sets. Without this option, on pre-v5 architectures, the 20527two instruction sets cannot be reliably used inside one program. The 20528default is @option{-mno-thumb-interwork}, since slightly larger code 20529is generated when @option{-mthumb-interwork} is specified. In AAPCS 20530configurations this option is meaningless. 20531 20532@item -mno-sched-prolog 20533@opindex mno-sched-prolog 20534@opindex msched-prolog 20535Prevent the reordering of instructions in the function prologue, or the 20536merging of those instruction with the instructions in the function's 20537body. This means that all functions start with a recognizable set 20538of instructions (or in fact one of a choice from a small set of 20539different function prologues), and this information can be used to 20540locate the start of functions inside an executable piece of code. The 20541default is @option{-msched-prolog}. 20542 20543@item -mfloat-abi=@var{name} 20544@opindex mfloat-abi 20545Specifies which floating-point ABI to use. Permissible values 20546are: @samp{soft}, @samp{softfp} and @samp{hard}. 20547 20548Specifying @samp{soft} causes GCC to generate output containing 20549library calls for floating-point operations. 20550@samp{softfp} allows the generation of code using hardware floating-point 20551instructions, but still uses the soft-float calling conventions. 20552@samp{hard} allows generation of floating-point instructions 20553and uses FPU-specific calling conventions. 20554 20555The default depends on the specific target configuration. Note that 20556the hard-float and soft-float ABIs are not link-compatible; you must 20557compile your entire program with the same ABI, and link with a 20558compatible set of libraries. 20559 20560@item -mgeneral-regs-only 20561@opindex mgeneral-regs-only 20562Generate code which uses only the general-purpose registers. This will prevent 20563the compiler from using floating-point and Advanced SIMD registers but will not 20564impose any restrictions on the assembler. 20565 20566@item -mlittle-endian 20567@opindex mlittle-endian 20568Generate code for a processor running in little-endian mode. This is 20569the default for all standard configurations. 20570 20571@item -mbig-endian 20572@opindex mbig-endian 20573Generate code for a processor running in big-endian mode; the default is 20574to compile code for a little-endian processor. 20575 20576@item -mbe8 20577@itemx -mbe32 20578@opindex mbe8 20579When linking a big-endian image select between BE8 and BE32 formats. 20580The option has no effect for little-endian images and is ignored. The 20581default is dependent on the selected target architecture. For ARMv6 20582and later architectures the default is BE8, for older architectures 20583the default is BE32. BE32 format has been deprecated by ARM. 20584 20585@item -march=@var{name}@r{[}+extension@dots{}@r{]} 20586@opindex march 20587This specifies the name of the target ARM architecture. GCC uses this 20588name to determine what kind of instructions it can emit when generating 20589assembly code. This option can be used in conjunction with or instead 20590of the @option{-mcpu=} option. 20591 20592Permissible names are: 20593@samp{armv4t}, 20594@samp{armv5t}, @samp{armv5te}, 20595@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2}, 20596@samp{armv6z}, @samp{armv6zk}, 20597@samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 20598@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, 20599@samp{armv8.4-a}, 20600@samp{armv8.5-a}, 20601@samp{armv8.6-a}, 20602@samp{armv9-a}, 20603@samp{armv7-r}, 20604@samp{armv8-r}, 20605@samp{armv6-m}, @samp{armv6s-m}, 20606@samp{armv7-m}, @samp{armv7e-m}, 20607@samp{armv8-m.base}, @samp{armv8-m.main}, 20608@samp{armv8.1-m.main}, 20609@samp{armv9-a}, 20610@samp{iwmmxt} and @samp{iwmmxt2}. 20611 20612Additionally, the following architectures, which lack support for the 20613Thumb execution state, are recognized but support is deprecated: @samp{armv4}. 20614 20615Many of the architectures support extensions. These can be added by 20616appending @samp{+@var{extension}} to the architecture name. Extension 20617options are processed in order and capabilities accumulate. An extension 20618will also enable any necessary base extensions 20619upon which it depends. For example, the @samp{+crypto} extension 20620will always enable the @samp{+simd} extension. The exception to the 20621additive construction is for extensions that are prefixed with 20622@samp{+no@dots{}}: these extensions disable the specified option and 20623any other extensions that may depend on the presence of that 20624extension. 20625 20626For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to 20627writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is 20628entirely disabled by the @samp{+nofp} option that follows it. 20629 20630Most extension names are generically named, but have an effect that is 20631dependent upon the architecture to which it is applied. For example, 20632the @samp{+simd} option can be applied to both @samp{armv7-a} and 20633@samp{armv8-a} architectures, but will enable the original ARMv7-A 20634Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A 20635variant for @samp{armv8-a}. 20636 20637The table below lists the supported extensions for each architecture. 20638Architectures not mentioned do not support any extensions. 20639 20640@table @samp 20641@item armv5te 20642@itemx armv6 20643@itemx armv6j 20644@itemx armv6k 20645@itemx armv6kz 20646@itemx armv6t2 20647@itemx armv6z 20648@itemx armv6zk 20649@table @samp 20650@item +fp 20651The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be 20652used as an alias for this extension. 20653 20654@item +nofp 20655Disable the floating-point instructions. 20656@end table 20657 20658@item armv7 20659The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures. 20660@table @samp 20661@item +fp 20662The VFPv3 floating-point instructions, with 16 double-precision 20663registers. The extension @samp{+vfpv3-d16} can be used as an alias 20664for this extension. Note that floating-point is not supported by the 20665base ARMv7-M architecture, but is compatible with both the ARMv7-A and 20666ARMv7-R architectures. 20667 20668@item +nofp 20669Disable the floating-point instructions. 20670@end table 20671 20672@item armv7-a 20673@table @samp 20674@item +mp 20675The multiprocessing extension. 20676 20677@item +sec 20678The security extension. 20679 20680@item +fp 20681The VFPv3 floating-point instructions, with 16 double-precision 20682registers. The extension @samp{+vfpv3-d16} can be used as an alias 20683for this extension. 20684 20685@item +simd 20686The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 20687The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases 20688for this extension. 20689 20690@item +vfpv3 20691The VFPv3 floating-point instructions, with 32 double-precision 20692registers. 20693 20694@item +vfpv3-d16-fp16 20695The VFPv3 floating-point instructions, with 16 double-precision 20696registers and the half-precision floating-point conversion operations. 20697 20698@item +vfpv3-fp16 20699The VFPv3 floating-point instructions, with 32 double-precision 20700registers and the half-precision floating-point conversion operations. 20701 20702@item +vfpv4-d16 20703The VFPv4 floating-point instructions, with 16 double-precision 20704registers. 20705 20706@item +vfpv4 20707The VFPv4 floating-point instructions, with 32 double-precision 20708registers. 20709 20710@item +neon-fp16 20711The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 20712the half-precision floating-point conversion operations. 20713 20714@item +neon-vfpv4 20715The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. 20716 20717@item +nosimd 20718Disable the Advanced SIMD instructions (does not disable floating point). 20719 20720@item +nofp 20721Disable the floating-point and Advanced SIMD instructions. 20722@end table 20723 20724@item armv7ve 20725The extended version of the ARMv7-A architecture with support for 20726virtualization. 20727@table @samp 20728@item +fp 20729The VFPv4 floating-point instructions, with 16 double-precision registers. 20730The extension @samp{+vfpv4-d16} can be used as an alias for this extension. 20731 20732@item +simd 20733The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The 20734extension @samp{+neon-vfpv4} can be used as an alias for this extension. 20735 20736@item +vfpv3-d16 20737The VFPv3 floating-point instructions, with 16 double-precision 20738registers. 20739 20740@item +vfpv3 20741The VFPv3 floating-point instructions, with 32 double-precision 20742registers. 20743 20744@item +vfpv3-d16-fp16 20745The VFPv3 floating-point instructions, with 16 double-precision 20746registers and the half-precision floating-point conversion operations. 20747 20748@item +vfpv3-fp16 20749The VFPv3 floating-point instructions, with 32 double-precision 20750registers and the half-precision floating-point conversion operations. 20751 20752@item +vfpv4-d16 20753The VFPv4 floating-point instructions, with 16 double-precision 20754registers. 20755 20756@item +vfpv4 20757The VFPv4 floating-point instructions, with 32 double-precision 20758registers. 20759 20760@item +neon 20761The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 20762The extension @samp{+neon-vfpv3} can be used as an alias for this extension. 20763 20764@item +neon-fp16 20765The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 20766the half-precision floating-point conversion operations. 20767 20768@item +nosimd 20769Disable the Advanced SIMD instructions (does not disable floating point). 20770 20771@item +nofp 20772Disable the floating-point and Advanced SIMD instructions. 20773@end table 20774 20775@item armv8-a 20776@table @samp 20777@item +crc 20778The Cyclic Redundancy Check (CRC) instructions. 20779@item +simd 20780The ARMv8-A Advanced SIMD and floating-point instructions. 20781@item +crypto 20782The cryptographic instructions. 20783@item +nocrypto 20784Disable the cryptographic instructions. 20785@item +nofp 20786Disable the floating-point, Advanced SIMD and cryptographic instructions. 20787@item +sb 20788Speculation Barrier Instruction. 20789@item +predres 20790Execution and Data Prediction Restriction Instructions. 20791@end table 20792 20793@item armv8.1-a 20794@table @samp 20795@item +simd 20796The ARMv8.1-A Advanced SIMD and floating-point instructions. 20797 20798@item +crypto 20799The cryptographic instructions. This also enables the Advanced SIMD and 20800floating-point instructions. 20801 20802@item +nocrypto 20803Disable the cryptographic instructions. 20804 20805@item +nofp 20806Disable the floating-point, Advanced SIMD and cryptographic instructions. 20807 20808@item +sb 20809Speculation Barrier Instruction. 20810 20811@item +predres 20812Execution and Data Prediction Restriction Instructions. 20813@end table 20814 20815@item armv8.2-a 20816@itemx armv8.3-a 20817@table @samp 20818@item +fp16 20819The half-precision floating-point data processing instructions. 20820This also enables the Advanced SIMD and floating-point instructions. 20821 20822@item +fp16fml 20823The half-precision floating-point fmla extension. This also enables 20824the half-precision floating-point extension and Advanced SIMD and 20825floating-point instructions. 20826 20827@item +simd 20828The ARMv8.1-A Advanced SIMD and floating-point instructions. 20829 20830@item +crypto 20831The cryptographic instructions. This also enables the Advanced SIMD and 20832floating-point instructions. 20833 20834@item +dotprod 20835Enable the Dot Product extension. This also enables Advanced SIMD instructions. 20836 20837@item +nocrypto 20838Disable the cryptographic extension. 20839 20840@item +nofp 20841Disable the floating-point, Advanced SIMD and cryptographic instructions. 20842 20843@item +sb 20844Speculation Barrier Instruction. 20845 20846@item +predres 20847Execution and Data Prediction Restriction Instructions. 20848 20849@item +i8mm 208508-bit Integer Matrix Multiply instructions. 20851This also enables Advanced SIMD and floating-point instructions. 20852 20853@item +bf16 20854Brain half-precision floating-point instructions. 20855This also enables Advanced SIMD and floating-point instructions. 20856@end table 20857 20858@item armv8.4-a 20859@table @samp 20860@item +fp16 20861The half-precision floating-point data processing instructions. 20862This also enables the Advanced SIMD and floating-point instructions as well 20863as the Dot Product extension and the half-precision floating-point fmla 20864extension. 20865 20866@item +simd 20867The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 20868Dot Product extension. 20869 20870@item +crypto 20871The cryptographic instructions. This also enables the Advanced SIMD and 20872floating-point instructions as well as the Dot Product extension. 20873 20874@item +nocrypto 20875Disable the cryptographic extension. 20876 20877@item +nofp 20878Disable the floating-point, Advanced SIMD and cryptographic instructions. 20879 20880@item +sb 20881Speculation Barrier Instruction. 20882 20883@item +predres 20884Execution and Data Prediction Restriction Instructions. 20885 20886@item +i8mm 208878-bit Integer Matrix Multiply instructions. 20888This also enables Advanced SIMD and floating-point instructions. 20889 20890@item +bf16 20891Brain half-precision floating-point instructions. 20892This also enables Advanced SIMD and floating-point instructions. 20893@end table 20894 20895@item armv8.5-a 20896@table @samp 20897@item +fp16 20898The half-precision floating-point data processing instructions. 20899This also enables the Advanced SIMD and floating-point instructions as well 20900as the Dot Product extension and the half-precision floating-point fmla 20901extension. 20902 20903@item +simd 20904The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 20905Dot Product extension. 20906 20907@item +crypto 20908The cryptographic instructions. This also enables the Advanced SIMD and 20909floating-point instructions as well as the Dot Product extension. 20910 20911@item +nocrypto 20912Disable the cryptographic extension. 20913 20914@item +nofp 20915Disable the floating-point, Advanced SIMD and cryptographic instructions. 20916 20917@item +i8mm 209188-bit Integer Matrix Multiply instructions. 20919This also enables Advanced SIMD and floating-point instructions. 20920 20921@item +bf16 20922Brain half-precision floating-point instructions. 20923This also enables Advanced SIMD and floating-point instructions. 20924@end table 20925 20926@item armv8.6-a 20927@table @samp 20928@item +fp16 20929The half-precision floating-point data processing instructions. 20930This also enables the Advanced SIMD and floating-point instructions as well 20931as the Dot Product extension and the half-precision floating-point fmla 20932extension. 20933 20934@item +simd 20935The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 20936Dot Product extension. 20937 20938@item +crypto 20939The cryptographic instructions. This also enables the Advanced SIMD and 20940floating-point instructions as well as the Dot Product extension. 20941 20942@item +nocrypto 20943Disable the cryptographic extension. 20944 20945@item +nofp 20946Disable the floating-point, Advanced SIMD and cryptographic instructions. 20947 20948@item +i8mm 209498-bit Integer Matrix Multiply instructions. 20950This also enables Advanced SIMD and floating-point instructions. 20951 20952@item +bf16 20953Brain half-precision floating-point instructions. 20954This also enables Advanced SIMD and floating-point instructions. 20955@end table 20956 20957@item armv7-r 20958@table @samp 20959@item +fp.sp 20960The single-precision VFPv3 floating-point instructions. The extension 20961@samp{+vfpv3xd} can be used as an alias for this extension. 20962 20963@item +fp 20964The VFPv3 floating-point instructions with 16 double-precision registers. 20965The extension +vfpv3-d16 can be used as an alias for this extension. 20966 20967@item +vfpv3xd-d16-fp16 20968The single-precision VFPv3 floating-point instructions with 16 double-precision 20969registers and the half-precision floating-point conversion operations. 20970 20971@item +vfpv3-d16-fp16 20972The VFPv3 floating-point instructions with 16 double-precision 20973registers and the half-precision floating-point conversion operations. 20974 20975@item +nofp 20976Disable the floating-point extension. 20977 20978@item +idiv 20979The ARM-state integer division instructions. 20980 20981@item +noidiv 20982Disable the ARM-state integer division extension. 20983@end table 20984 20985@item armv7e-m 20986@table @samp 20987@item +fp 20988The single-precision VFPv4 floating-point instructions. 20989 20990@item +fpv5 20991The single-precision FPv5 floating-point instructions. 20992 20993@item +fp.dp 20994The single- and double-precision FPv5 floating-point instructions. 20995 20996@item +nofp 20997Disable the floating-point extensions. 20998@end table 20999 21000@item armv8.1-m.main 21001@table @samp 21002 21003@item +dsp 21004The DSP instructions. 21005 21006@item +mve 21007The M-Profile Vector Extension (MVE) integer instructions. 21008 21009@item +mve.fp 21010The M-Profile Vector Extension (MVE) integer and single precision 21011floating-point instructions. 21012 21013@item +fp 21014The single-precision floating-point instructions. 21015 21016@item +fp.dp 21017The single- and double-precision floating-point instructions. 21018 21019@item +nofp 21020Disable the floating-point extension. 21021 21022@item +cdecp0, +cdecp1, ... , +cdecp7 21023Enable the Custom Datapath Extension (CDE) on selected coprocessors according 21024to the numbers given in the options in the range 0 to 7. 21025@end table 21026 21027@item armv8-m.main 21028@table @samp 21029@item +dsp 21030The DSP instructions. 21031 21032@item +nodsp 21033Disable the DSP extension. 21034 21035@item +fp 21036The single-precision floating-point instructions. 21037 21038@item +fp.dp 21039The single- and double-precision floating-point instructions. 21040 21041@item +nofp 21042Disable the floating-point extension. 21043 21044@item +cdecp0, +cdecp1, ... , +cdecp7 21045Enable the Custom Datapath Extension (CDE) on selected coprocessors according 21046to the numbers given in the options in the range 0 to 7. 21047@end table 21048 21049@item armv8-r 21050@table @samp 21051@item +crc 21052The Cyclic Redundancy Check (CRC) instructions. 21053@item +fp.sp 21054The single-precision FPv5 floating-point instructions. 21055@item +simd 21056The ARMv8-A Advanced SIMD and floating-point instructions. 21057@item +crypto 21058The cryptographic instructions. 21059@item +nocrypto 21060Disable the cryptographic instructions. 21061@item +nofp 21062Disable the floating-point, Advanced SIMD and cryptographic instructions. 21063@end table 21064 21065@end table 21066 21067@option{-march=native} causes the compiler to auto-detect the architecture 21068of the build computer. At present, this feature is only supported on 21069GNU/Linux, and not all architectures are recognized. If the auto-detect 21070is unsuccessful the option has no effect. 21071 21072@item -mtune=@var{name} 21073@opindex mtune 21074This option specifies the name of the target ARM processor for 21075which GCC should tune the performance of the code. 21076For some ARM implementations better performance can be obtained by using 21077this option. 21078Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t}, 21079@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110}, 21080@samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810}, 21081@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t}, 21082@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s}, 21083@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t}, 21084@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 21085@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 21086@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 21087@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, 21088@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17}, 21089@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 21090@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 21091@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77}, 21092@samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710}, 21093@samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, 21094@samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus}, 21095@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3}, 21096@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33}, 21097@samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1}, 21098@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply}, 21099@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4}, 21100@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale}, 21101@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626}, 21102@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}. 21103 21104Additionally, this option can specify that GCC should tune the performance 21105of the code for a big.LITTLE system. Permissible names are: 21106@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7}, 21107@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 21108@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}, 21109@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}. 21110 21111@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 21112performance for a blend of processors within architecture @var{arch}. 21113The aim is to generate code that run well on the current most popular 21114processors, balancing between optimizations that benefit some CPUs in the 21115range, and avoiding performance pitfalls of other CPUs. The effects of 21116this option may change in future GCC versions as CPU models come and go. 21117 21118@option{-mtune} permits the same extension options as @option{-mcpu}, but 21119the extension options do not affect the tuning of the generated code. 21120 21121@option{-mtune=native} causes the compiler to auto-detect the CPU 21122of the build computer. At present, this feature is only supported on 21123GNU/Linux, and not all architectures are recognized. If the auto-detect is 21124unsuccessful the option has no effect. 21125 21126@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]} 21127@opindex mcpu 21128This specifies the name of the target ARM processor. GCC uses this name 21129to derive the name of the target ARM architecture (as if specified 21130by @option{-march}) and the ARM processor type for which to tune for 21131performance (as if specified by @option{-mtune}). Where this option 21132is used in conjunction with @option{-march} or @option{-mtune}, 21133those options take precedence over the appropriate part of this option. 21134 21135Many of the supported CPUs implement optional architectural 21136extensions. Where this is so the architectural extensions are 21137normally enabled by default. If implementations that lack the 21138extension exist, then the extension syntax can be used to disable 21139those extensions that have been omitted. For floating-point and 21140Advanced SIMD (Neon) instructions, the settings of the options 21141@option{-mfloat-abi} and @option{-mfpu} must also be considered: 21142floating-point and Advanced SIMD instructions will only be used if 21143@option{-mfloat-abi} is not set to @samp{soft}; and any setting of 21144@option{-mfpu} other than @samp{auto} will override the available 21145floating-point and SIMD extension instructions. 21146 21147For example, @samp{cortex-a9} can be found in three major 21148configurations: integer only, with just a floating-point unit or with 21149floating-point and Advanced SIMD. The default is to enable all the 21150instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can 21151be used to disable just the SIMD or both the SIMD and floating-point 21152instructions respectively. 21153 21154Permissible names for this option are the same as those for 21155@option{-mtune}. 21156 21157The following extension options are common to the listed CPUs: 21158 21159@table @samp 21160@item +nodsp 21161Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}. 21162 21163@item +nofp 21164Disables the floating-point instructions on @samp{arm9e}, 21165@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e}, 21166@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s}, 21167@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, 21168@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}. 21169Disables the floating-point and SIMD instructions on 21170@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, 21171@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12}, 21172@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7}, 21173@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35}, 21174@samp{cortex-a53} and @samp{cortex-a55}. 21175 21176@item +nofp.dp 21177Disables the double-precision component of the floating-point instructions 21178on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, 21179@samp{cortex-r52plus} and @samp{cortex-m7}. 21180 21181@item +nosimd 21182Disables the SIMD (but not floating-point) instructions on 21183@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7} 21184and @samp{cortex-a9}. 21185 21186@item +crypto 21187Enables the cryptographic instructions on @samp{cortex-a32}, 21188@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57}, 21189@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1}, 21190@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 21191@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and 21192@samp{cortex-a75.cortex-a55}. 21193@end table 21194 21195Additionally the @samp{generic-armv7-a} pseudo target defaults to 21196VFPv3 with 16 double-precision registers. It supports the following 21197extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16}, 21198@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, 21199@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, 21200@samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for 21201the extensions to @option{-march=armv7-a}. 21202 21203@option{-mcpu=generic-@var{arch}} is also permissible, and is 21204equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 21205See @option{-mtune} for more information. 21206 21207@option{-mcpu=native} causes the compiler to auto-detect the CPU 21208of the build computer. At present, this feature is only supported on 21209GNU/Linux, and not all architectures are recognized. If the auto-detect 21210is unsuccessful the option has no effect. 21211 21212@item -mfpu=@var{name} 21213@opindex mfpu 21214This specifies what floating-point hardware (or hardware emulation) is 21215available on the target. Permissible names are: @samp{auto}, @samp{vfpv2}, 21216@samp{vfpv3}, 21217@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 21218@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4}, 21219@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 21220@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 21221@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}. 21222Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp} 21223is an alias for @samp{vfpv2}. 21224 21225The setting @samp{auto} is the default and is special. It causes the 21226compiler to select the floating-point and Advanced SIMD instructions 21227based on the settings of @option{-mcpu} and @option{-march}. 21228 21229If the selected floating-point hardware includes the NEON extension 21230(e.g.@: @option{-mfpu=neon}), note that floating-point 21231operations are not generated by GCC's auto-vectorization pass unless 21232@option{-funsafe-math-optimizations} is also specified. This is 21233because NEON hardware does not fully implement the IEEE 754 standard for 21234floating-point arithmetic (in particular denormal values are treated as 21235zero), so the use of NEON instructions may lead to a loss of precision. 21236 21237You 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}). 21238 21239@item -mfp16-format=@var{name} 21240@opindex mfp16-format 21241Specify the format of the @code{__fp16} half-precision floating-point type. 21242Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 21243the default is @samp{none}, in which case the @code{__fp16} type is not 21244defined. @xref{Half-Precision}, for more information. 21245 21246@item -mstructure-size-boundary=@var{n} 21247@opindex mstructure-size-boundary 21248The sizes of all structures and unions are rounded up to a multiple 21249of the number of bits set by this option. Permissible values are 8, 32 21250and 64. The default value varies for different toolchains. For the COFF 21251targeted toolchain the default value is 8. A value of 64 is only allowed 21252if the underlying ABI supports it. 21253 21254Specifying a larger number can produce faster, more efficient code, but 21255can also increase the size of the program. Different values are potentially 21256incompatible. Code compiled with one value cannot necessarily expect to 21257work with code or libraries compiled with another value, if they exchange 21258information using structures or unions. 21259 21260This option is deprecated. 21261 21262@item -mabort-on-noreturn 21263@opindex mabort-on-noreturn 21264Generate a call to the function @code{abort} at the end of a 21265@code{noreturn} function. It is executed if the function tries to 21266return. 21267 21268@item -mlong-calls 21269@itemx -mno-long-calls 21270@opindex mlong-calls 21271@opindex mno-long-calls 21272Tells the compiler to perform function calls by first loading the 21273address of the function into a register and then performing a subroutine 21274call on this register. This switch is needed if the target function 21275lies outside of the 64-megabyte addressing range of the offset-based 21276version of subroutine call instruction. 21277 21278Even if this switch is enabled, not all function calls are turned 21279into long calls. The heuristic is that static functions, functions 21280that have the @code{short_call} attribute, functions that are inside 21281the scope of a @code{#pragma no_long_calls} directive, and functions whose 21282definitions have already been compiled within the current compilation 21283unit are not turned into long calls. The exceptions to this rule are 21284that weak function definitions, functions with the @code{long_call} 21285attribute or the @code{section} attribute, and functions that are within 21286the scope of a @code{#pragma long_calls} directive are always 21287turned into long calls. 21288 21289This feature is not enabled by default. Specifying 21290@option{-mno-long-calls} restores the default behavior, as does 21291placing the function calls within the scope of a @code{#pragma 21292long_calls_off} directive. Note these switches have no effect on how 21293the compiler generates code to handle function calls via function 21294pointers. 21295 21296@item -msingle-pic-base 21297@opindex msingle-pic-base 21298Treat the register used for PIC addressing as read-only, rather than 21299loading it in the prologue for each function. The runtime system is 21300responsible for initializing this register with an appropriate value 21301before execution begins. 21302 21303@item -mpic-register=@var{reg} 21304@opindex mpic-register 21305Specify the register to be used for PIC addressing. 21306For standard PIC base case, the default is any suitable register 21307determined by compiler. For single PIC base case, the default is 21308@samp{R9} if target is EABI based or stack-checking is enabled, 21309otherwise the default is @samp{R10}. 21310 21311@item -mpic-data-is-text-relative 21312@opindex mpic-data-is-text-relative 21313Assume that the displacement between the text and data segments is fixed 21314at static link time. This permits using PC-relative addressing 21315operations to access data known to be in the data segment. For 21316non-VxWorks RTP targets, this option is enabled by default. When 21317disabled on such targets, it will enable @option{-msingle-pic-base} by 21318default. 21319 21320@item -mpoke-function-name 21321@opindex mpoke-function-name 21322Write the name of each function into the text section, directly 21323preceding the function prologue. The generated code is similar to this: 21324 21325@smallexample 21326 t0 21327 .ascii "arm_poke_function_name", 0 21328 .align 21329 t1 21330 .word 0xff000000 + (t1 - t0) 21331 arm_poke_function_name 21332 mov ip, sp 21333 stmfd sp!, @{fp, ip, lr, pc@} 21334 sub fp, ip, #4 21335@end smallexample 21336 21337When performing a stack backtrace, code can inspect the value of 21338@code{pc} stored at @code{fp + 0}. If the trace function then looks at 21339location @code{pc - 12} and the top 8 bits are set, then we know that 21340there is a function name embedded immediately preceding this location 21341and has length @code{((pc[-3]) & 0xff000000)}. 21342 21343@item -mthumb 21344@itemx -marm 21345@opindex marm 21346@opindex mthumb 21347 21348Select between generating code that executes in ARM and Thumb 21349states. The default for most configurations is to generate code 21350that executes in ARM state, but the default can be changed by 21351configuring GCC with the @option{--with-mode=}@var{state} 21352configure option. 21353 21354You can also override the ARM and Thumb mode for each function 21355by using the @code{target("thumb")} and @code{target("arm")} function attributes 21356(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}). 21357 21358@item -mflip-thumb 21359@opindex mflip-thumb 21360Switch ARM/Thumb modes on alternating functions. 21361This option is provided for regression testing of mixed Thumb/ARM code 21362generation, and is not intended for ordinary use in compiling code. 21363 21364@item -mtpcs-frame 21365@opindex mtpcs-frame 21366Generate a stack frame that is compliant with the Thumb Procedure Call 21367Standard for all non-leaf functions. (A leaf function is one that does 21368not call any other functions.) The default is @option{-mno-tpcs-frame}. 21369 21370@item -mtpcs-leaf-frame 21371@opindex mtpcs-leaf-frame 21372Generate a stack frame that is compliant with the Thumb Procedure Call 21373Standard for all leaf functions. (A leaf function is one that does 21374not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 21375 21376@item -mcallee-super-interworking 21377@opindex mcallee-super-interworking 21378Gives all externally visible functions in the file being compiled an ARM 21379instruction set header which switches to Thumb mode before executing the 21380rest of the function. This allows these functions to be called from 21381non-interworking code. This option is not valid in AAPCS configurations 21382because interworking is enabled by default. 21383 21384@item -mcaller-super-interworking 21385@opindex mcaller-super-interworking 21386Allows calls via function pointers (including virtual functions) to 21387execute correctly regardless of whether the target code has been 21388compiled for interworking or not. There is a small overhead in the cost 21389of executing a function pointer if this option is enabled. This option 21390is not valid in AAPCS configurations because interworking is enabled 21391by default. 21392 21393@item -mtp=@var{name} 21394@opindex mtp 21395Specify the access model for the thread local storage pointer. The valid 21396models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 21397@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 21398(supported in the arm6k architecture), and @samp{auto}, which uses the 21399best available method for the selected processor. The default setting is 21400@samp{auto}. 21401 21402@item -mtls-dialect=@var{dialect} 21403@opindex mtls-dialect 21404Specify the dialect to use for accessing thread local storage. Two 21405@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 21406@samp{gnu} dialect selects the original GNU scheme for supporting 21407local and global dynamic TLS models. The @samp{gnu2} dialect 21408selects the GNU descriptor scheme, which provides better performance 21409for shared libraries. The GNU descriptor scheme is compatible with 21410the original scheme, but does require new assembler, linker and 21411library support. Initial and local exec TLS models are unaffected by 21412this option and always use the original scheme. 21413 21414@item -mword-relocations 21415@opindex mword-relocations 21416Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32). 21417This is enabled by default on targets (uClinux, SymbianOS) where the runtime 21418loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 21419is specified. This option conflicts with @option{-mslow-flash-data}. 21420 21421@item -mfix-cortex-m3-ldrd 21422@opindex mfix-cortex-m3-ldrd 21423Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 21424with overlapping destination and base registers are used. This option avoids 21425generating these instructions. This option is enabled by default when 21426@option{-mcpu=cortex-m3} is specified. 21427 21428@item -mfix-cortex-a57-aes-1742098 21429@itemx -mno-fix-cortex-a57-aes-1742098 21430@itemx -mfix-cortex-a72-aes-1655431 21431@itemx -mno-fix-cortex-a72-aes-1655431 21432Enable (disable) mitigation for an erratum on Cortex-A57 and 21433Cortex-A72 that affects the AES cryptographic instructions. This 21434option is enabled by default when either @option{-mcpu=cortex-a57} or 21435@option{-mcpu=cortex-a72} is specified. 21436 21437@item -munaligned-access 21438@itemx -mno-unaligned-access 21439@opindex munaligned-access 21440@opindex mno-unaligned-access 21441Enables (or disables) reading and writing of 16- and 32- bit values 21442from addresses that are not 16- or 32- bit aligned. By default 21443unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for 21444ARMv8-M Baseline architectures, and enabled for all other 21445architectures. If unaligned access is not enabled then words in packed 21446data structures are accessed a byte at a time. 21447 21448The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 21449generated object file to either true or false, depending upon the 21450setting of this option. If unaligned access is enabled then the 21451preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 21452defined. 21453 21454@item -mneon-for-64bits 21455@opindex mneon-for-64bits 21456This option is deprecated and has no effect. 21457 21458@item -mslow-flash-data 21459@opindex mslow-flash-data 21460Assume loading data from flash is slower than fetching instruction. 21461Therefore literal load is minimized for better performance. 21462This option is only supported when compiling for ARMv7 M-profile and 21463off by default. It conflicts with @option{-mword-relocations}. 21464 21465@item -masm-syntax-unified 21466@opindex masm-syntax-unified 21467Assume inline assembler is using unified asm syntax. The default is 21468currently off which implies divided syntax. This option has no impact 21469on Thumb2. However, this may change in future releases of GCC. 21470Divided syntax should be considered deprecated. 21471 21472@item -mrestrict-it 21473@opindex mrestrict-it 21474Restricts generation of IT blocks to conform to the rules of ARMv8-A. 21475IT blocks can only contain a single 16-bit instruction from a select 21476set of instructions. This option is on by default for ARMv8-A Thumb mode. 21477 21478@item -mprint-tune-info 21479@opindex mprint-tune-info 21480Print CPU tuning information as comment in assembler file. This is 21481an option used only for regression testing of the compiler and not 21482intended for ordinary use in compiling code. This option is disabled 21483by default. 21484 21485@item -mverbose-cost-dump 21486@opindex mverbose-cost-dump 21487Enable verbose cost model dumping in the debug dump files. This option is 21488provided for use in debugging the compiler. 21489 21490@item -mpure-code 21491@opindex mpure-code 21492Do not allow constant data to be placed in code sections. 21493Additionally, when compiling for ELF object format give all text sections the 21494ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option 21495is only available when generating non-pic code for M-profile targets. 21496 21497@item -mcmse 21498@opindex mcmse 21499Generate secure code as per the "ARMv8-M Security Extensions: Requirements on 21500Development Tools Engineering Specification", which can be found on 21501@url{https://developer.arm.com/documentation/ecm0359818/latest/}. 21502 21503@item -mfix-cmse-cve-2021-35465 21504@opindex mfix-cmse-cve-2021-35465 21505Mitigate against a potential security issue with the @code{VLLDM} instruction 21506in some M-profile devices when using CMSE (CVE-2021-365465). This option is 21507enabled by default when the option @option{-mcpu=} is used with 21508@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option 21509@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation. 21510 21511@item -mstack-protector-guard=@var{guard} 21512@itemx -mstack-protector-guard-offset=@var{offset} 21513@opindex mstack-protector-guard 21514@opindex mstack-protector-guard-offset 21515Generate stack protection code using canary at @var{guard}. Supported 21516locations are @samp{global} for a global canary or @samp{tls} for a 21517canary accessible via the TLS register. The option 21518@option{-mstack-protector-guard-offset=} is for use with 21519@option{-fstack-protector-guard=tls} and not for use in user-land code. 21520 21521@item -mfdpic 21522@itemx -mno-fdpic 21523@opindex mfdpic 21524@opindex mno-fdpic 21525Select the FDPIC ABI, which uses 64-bit function descriptors to 21526represent pointers to functions. When the compiler is configured for 21527@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default 21528and implies @option{-fPIE} if none of the PIC/PIE-related options is 21529provided. On other targets, it only enables the FDPIC-specific code 21530generation features, and the user should explicitly provide the 21531PIC/PIE-related options as needed. 21532 21533Note that static linking is not supported because it would still 21534involve the dynamic linker when the program self-relocates. If such 21535behavior is acceptable, use -static and -Wl,-dynamic-linker options. 21536 21537The opposite @option{-mno-fdpic} option is useful (and required) to 21538build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi}) 21539toolchain as the one used to build the userland programs. 21540 21541@end table 21542 21543@node AVR Options 21544@subsection AVR Options 21545@cindex AVR Options 21546 21547These options are defined for AVR implementations: 21548 21549@table @gcctabopt 21550@item -mmcu=@var{mcu} 21551@opindex mmcu 21552Specify Atmel AVR instruction set architectures (ISA) or MCU type. 21553 21554The default for this option is@tie{}@samp{avr2}. 21555 21556GCC supports the following AVR devices and ISAs: 21557 21558@include avr-mmcu.texi 21559 21560@item -mabsdata 21561@opindex mabsdata 21562 21563Assume that all data in static storage can be accessed by LDS / STS 21564instructions. This option has only an effect on reduced Tiny devices like 21565ATtiny40. See also the @code{absdata} 21566@ref{AVR Variable Attributes,variable attribute}. 21567 21568@item -maccumulate-args 21569@opindex maccumulate-args 21570Accumulate outgoing function arguments and acquire/release the needed 21571stack space for outgoing function arguments once in function 21572prologue/epilogue. Without this option, outgoing arguments are pushed 21573before calling a function and popped afterwards. 21574 21575Popping the arguments after the function call can be expensive on 21576AVR so that accumulating the stack space might lead to smaller 21577executables because arguments need not be removed from the 21578stack after such a function call. 21579 21580This option can lead to reduced code size for functions that perform 21581several calls to functions that get their arguments on the stack like 21582calls to printf-like functions. 21583 21584@item -mbranch-cost=@var{cost} 21585@opindex mbranch-cost 21586Set the branch costs for conditional branch instructions to 21587@var{cost}. Reasonable values for @var{cost} are small, non-negative 21588integers. The default branch cost is 0. 21589 21590@item -mcall-prologues 21591@opindex mcall-prologues 21592Functions prologues/epilogues are expanded as calls to appropriate 21593subroutines. Code size is smaller. 21594 21595@item -mdouble=@var{bits} 21596@itemx -mlong-double=@var{bits} 21597@opindex mdouble 21598@opindex mlong-double 21599Set the size (in bits) of the @code{double} or @code{long double} type, 21600respectively. Possible values for @var{bits} are 32 and 64. 21601Whether or not a specific value for @var{bits} is allowed depends on 21602the @code{--with-double=} and @code{--with-long-double=} 21603@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}}, 21604and the same applies for the default values of the options. 21605 21606@item -mgas-isr-prologues 21607@opindex mgas-isr-prologues 21608Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo 21609instruction supported by GNU Binutils. 21610If this option is on, the feature can still be disabled for individual 21611ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}} 21612function attribute. This feature is activated per default 21613if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}), 21614and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}. 21615 21616@item -mint8 21617@opindex mint8 21618Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 21619@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 21620and @code{long long} is 4 bytes. Please note that this option does not 21621conform to the C standards, but it results in smaller code 21622size. 21623 21624@item -mmain-is-OS_task 21625@opindex mmain-is-OS_task 21626Do not save registers in @code{main}. The effect is the same like 21627attaching attribute @ref{AVR Function Attributes,,@code{OS_task}} 21628to @code{main}. It is activated per default if optimization is on. 21629 21630@item -mn-flash=@var{num} 21631@opindex mn-flash 21632Assume that the flash memory has a size of 21633@var{num} times 64@tie{}KiB. 21634 21635@item -mno-interrupts 21636@opindex mno-interrupts 21637Generated code is not compatible with hardware interrupts. 21638Code size is smaller. 21639 21640@item -mrelax 21641@opindex mrelax 21642Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 21643@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 21644Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 21645the assembler's command line and the @option{--relax} option to the 21646linker's command line. 21647 21648Jump relaxing is performed by the linker because jump offsets are not 21649known before code is located. Therefore, the assembler code generated by the 21650compiler is the same, but the instructions in the executable may 21651differ from instructions in the assembler code. 21652 21653Relaxing must be turned on if linker stubs are needed, see the 21654section on @code{EIND} and linker stubs below. 21655 21656@item -mrmw 21657@opindex mrmw 21658Assume that the device supports the Read-Modify-Write 21659instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 21660 21661@item -mshort-calls 21662@opindex mshort-calls 21663 21664Assume that @code{RJMP} and @code{RCALL} can target the whole 21665program memory. 21666 21667This option is used internally for multilib selection. It is 21668not an optimization option, and you don't need to set it by hand. 21669 21670@item -msp8 21671@opindex msp8 21672Treat the stack pointer register as an 8-bit register, 21673i.e.@: assume the high byte of the stack pointer is zero. 21674In general, you don't need to set this option by hand. 21675 21676This option is used internally by the compiler to select and 21677build multilibs for architectures @code{avr2} and @code{avr25}. 21678These architectures mix devices with and without @code{SPH}. 21679For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 21680the compiler driver adds or removes this option from the compiler 21681proper's command line, because the compiler then knows if the device 21682or architecture has an 8-bit stack pointer and thus no @code{SPH} 21683register or not. 21684 21685@item -mstrict-X 21686@opindex mstrict-X 21687Use address register @code{X} in a way proposed by the hardware. This means 21688that @code{X} is only used in indirect, post-increment or 21689pre-decrement addressing. 21690 21691Without this option, the @code{X} register may be used in the same way 21692as @code{Y} or @code{Z} which then is emulated by additional 21693instructions. 21694For example, loading a value with @code{X+const} addressing with a 21695small non-negative @code{const < 64} to a register @var{Rn} is 21696performed as 21697 21698@example 21699adiw r26, const ; X += const 21700ld @var{Rn}, X ; @var{Rn} = *X 21701sbiw r26, const ; X -= const 21702@end example 21703 21704@item -mtiny-stack 21705@opindex mtiny-stack 21706Only change the lower 8@tie{}bits of the stack pointer. 21707 21708@item -mfract-convert-truncate 21709@opindex mfract-convert-truncate 21710Allow to use truncation instead of rounding towards zero for fractional fixed-point types. 21711 21712@item -nodevicelib 21713@opindex nodevicelib 21714Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. 21715 21716@item -nodevicespecs 21717@opindex nodevicespecs 21718Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's 21719command line. The user takes responsibility for supplying the sub-processes 21720like compiler proper, assembler and linker with appropriate command line 21721options. This means that the user has to supply her private device specs 21722file by means of @option{-specs=@var{path-to-specs-file}}. There is no 21723more need for option @option{-mmcu=@var{mcu}}. 21724 21725This option can also serve as a replacement for the older way of 21726specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory 21727which contains a folder named @code{device-specs} which contains a specs file named 21728@code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}. 21729 21730@item -Waddr-space-convert 21731@opindex Waddr-space-convert 21732@opindex Wno-addr-space-convert 21733Warn about conversions between address spaces in the case where the 21734resulting address space is not contained in the incoming address space. 21735 21736@item -Wmisspelled-isr 21737@opindex Wmisspelled-isr 21738@opindex Wno-misspelled-isr 21739Warn if the ISR is misspelled, i.e.@: without __vector prefix. 21740Enabled by default. 21741@end table 21742 21743@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 21744@cindex @code{EIND} 21745Pointers in the implementation are 16@tie{}bits wide. 21746The address of a function or label is represented as word address so 21747that indirect jumps and calls can target any code address in the 21748range of 64@tie{}Ki words. 21749 21750In order to facilitate indirect jump on devices with more than 128@tie{}Ki 21751bytes of program memory space, there is a special function register called 21752@code{EIND} that serves as most significant part of the target address 21753when @code{EICALL} or @code{EIJMP} instructions are used. 21754 21755Indirect jumps and calls on these devices are handled as follows by 21756the compiler and are subject to some limitations: 21757 21758@itemize @bullet 21759 21760@item 21761The compiler never sets @code{EIND}. 21762 21763@item 21764The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP} 21765instructions or might read @code{EIND} directly in order to emulate an 21766indirect call/jump by means of a @code{RET} instruction. 21767 21768@item 21769The compiler assumes that @code{EIND} never changes during the startup 21770code or during the application. In particular, @code{EIND} is not 21771saved/restored in function or interrupt service routine 21772prologue/epilogue. 21773 21774@item 21775For indirect calls to functions and computed goto, the linker 21776generates @emph{stubs}. Stubs are jump pads sometimes also called 21777@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 21778The stub contains a direct jump to the desired address. 21779 21780@item 21781Linker relaxation must be turned on so that the linker generates 21782the stubs correctly in all situations. See the compiler option 21783@option{-mrelax} and the linker option @option{--relax}. 21784There are corner cases where the linker is supposed to generate stubs 21785but aborts without relaxation and without a helpful error message. 21786 21787@item 21788The default linker script is arranged for code with @code{EIND = 0}. 21789If code is supposed to work for a setup with @code{EIND != 0}, a custom 21790linker script has to be used in order to place the sections whose 21791name start with @code{.trampolines} into the segment where @code{EIND} 21792points to. 21793 21794@item 21795The startup code from libgcc never sets @code{EIND}. 21796Notice that startup code is a blend of code from libgcc and AVR-LibC. 21797For the impact of AVR-LibC on @code{EIND}, see the 21798@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 21799 21800@item 21801It is legitimate for user-specific startup code to set up @code{EIND} 21802early, for example by means of initialization code located in 21803section @code{.init3}. Such code runs prior to general startup code 21804that initializes RAM and calls constructors, but after the bit 21805of startup code from AVR-LibC that sets @code{EIND} to the segment 21806where the vector table is located. 21807@example 21808#include <avr/io.h> 21809 21810static void 21811__attribute__((section(".init3"),naked,used,no_instrument_function)) 21812init3_set_eind (void) 21813@{ 21814 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 21815 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 21816@} 21817@end example 21818 21819@noindent 21820The @code{__trampolines_start} symbol is defined in the linker script. 21821 21822@item 21823Stubs are generated automatically by the linker if 21824the following two conditions are met: 21825@itemize @minus 21826 21827@item The address of a label is taken by means of the @code{gs} modifier 21828(short for @emph{generate stubs}) like so: 21829@example 21830LDI r24, lo8(gs(@var{func})) 21831LDI r25, hi8(gs(@var{func})) 21832@end example 21833@item The final location of that label is in a code segment 21834@emph{outside} the segment where the stubs are located. 21835@end itemize 21836 21837@item 21838The compiler emits such @code{gs} modifiers for code labels in the 21839following situations: 21840@itemize @minus 21841@item Taking address of a function or code label. 21842@item Computed goto. 21843@item If prologue-save function is used, see @option{-mcall-prologues} 21844command-line option. 21845@item Switch/case dispatch tables. If you do not want such dispatch 21846tables you can specify the @option{-fno-jump-tables} command-line option. 21847@item C and C++ constructors/destructors called during startup/shutdown. 21848@item If the tools hit a @code{gs()} modifier explained above. 21849@end itemize 21850 21851@item 21852Jumping to non-symbolic addresses like so is @emph{not} supported: 21853 21854@example 21855int main (void) 21856@{ 21857 /* Call function at word address 0x2 */ 21858 return ((int(*)(void)) 0x2)(); 21859@} 21860@end example 21861 21862Instead, a stub has to be set up, i.e.@: the function has to be called 21863through a symbol (@code{func_4} in the example): 21864 21865@example 21866int main (void) 21867@{ 21868 extern int func_4 (void); 21869 21870 /* Call function at byte address 0x4 */ 21871 return func_4(); 21872@} 21873@end example 21874 21875and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 21876Alternatively, @code{func_4} can be defined in the linker script. 21877@end itemize 21878 21879@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 21880@cindex @code{RAMPD} 21881@cindex @code{RAMPX} 21882@cindex @code{RAMPY} 21883@cindex @code{RAMPZ} 21884Some AVR devices support memories larger than the 64@tie{}KiB range 21885that can be accessed with 16-bit pointers. To access memory locations 21886outside this 64@tie{}KiB range, the content of a @code{RAMP} 21887register is used as high part of the address: 21888The @code{X}, @code{Y}, @code{Z} address register is concatenated 21889with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 21890register, respectively, to get a wide address. Similarly, 21891@code{RAMPD} is used together with direct addressing. 21892 21893@itemize 21894@item 21895The startup code initializes the @code{RAMP} special function 21896registers with zero. 21897 21898@item 21899If a @ref{AVR Named Address Spaces,named address space} other than 21900generic or @code{__flash} is used, then @code{RAMPZ} is set 21901as needed before the operation. 21902 21903@item 21904If the device supports RAM larger than 64@tie{}KiB and the compiler 21905needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 21906is reset to zero after the operation. 21907 21908@item 21909If the device comes with a specific @code{RAMP} register, the ISR 21910prologue/epilogue saves/restores that SFR and initializes it with 21911zero in case the ISR code might (implicitly) use it. 21912 21913@item 21914RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 21915If you use inline assembler to read from locations outside the 2191616-bit address range and change one of the @code{RAMP} registers, 21917you must reset it to zero after the access. 21918 21919@end itemize 21920 21921@subsubsection AVR Built-in Macros 21922 21923GCC defines several built-in macros so that the user code can test 21924for the presence or absence of features. Almost any of the following 21925built-in macros are deduced from device capabilities and thus 21926triggered by the @option{-mmcu=} command-line option. 21927 21928For even more AVR-specific built-in macros see 21929@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 21930 21931@table @code 21932 21933@item __AVR_ARCH__ 21934Build-in macro that resolves to a decimal number that identifies the 21935architecture and depends on the @option{-mmcu=@var{mcu}} option. 21936Possible values are: 21937 21938@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 21939@code{4}, @code{5}, @code{51}, @code{6} 21940 21941for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 21942@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 21943 21944respectively and 21945 21946@code{100}, 21947@code{102}, @code{103}, @code{104}, 21948@code{105}, @code{106}, @code{107} 21949 21950for @var{mcu}=@code{avrtiny}, 21951@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4}, 21952@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 21953If @var{mcu} specifies a device, this built-in macro is set 21954accordingly. For example, with @option{-mmcu=atmega8} the macro is 21955defined to @code{4}. 21956 21957@item __AVR_@var{Device}__ 21958Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 21959the device's name. For example, @option{-mmcu=atmega8} defines the 21960built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 21961@code{__AVR_ATtiny261A__}, etc. 21962 21963The built-in macros' names follow 21964the scheme @code{__AVR_@var{Device}__} where @var{Device} is 21965the device name as from the AVR user manual. The difference between 21966@var{Device} in the built-in macro and @var{device} in 21967@option{-mmcu=@var{device}} is that the latter is always lowercase. 21968 21969If @var{device} is not a device but only a core architecture like 21970@samp{avr51}, this macro is not defined. 21971 21972@item __AVR_DEVICE_NAME__ 21973Setting @option{-mmcu=@var{device}} defines this built-in macro to 21974the device's name. For example, with @option{-mmcu=atmega8} the macro 21975is defined to @code{atmega8}. 21976 21977If @var{device} is not a device but only a core architecture like 21978@samp{avr51}, this macro is not defined. 21979 21980@item __AVR_XMEGA__ 21981The device / architecture belongs to the XMEGA family of devices. 21982 21983@item __AVR_HAVE_ELPM__ 21984The device has the @code{ELPM} instruction. 21985 21986@item __AVR_HAVE_ELPMX__ 21987The device has the @code{ELPM R@var{n},Z} and @code{ELPM 21988R@var{n},Z+} instructions. 21989 21990@item __AVR_HAVE_MOVW__ 21991The device has the @code{MOVW} instruction to perform 16-bit 21992register-register moves. 21993 21994@item __AVR_HAVE_LPMX__ 21995The device has the @code{LPM R@var{n},Z} and 21996@code{LPM R@var{n},Z+} instructions. 21997 21998@item __AVR_HAVE_MUL__ 21999The device has a hardware multiplier. 22000 22001@item __AVR_HAVE_JMP_CALL__ 22002The device has the @code{JMP} and @code{CALL} instructions. 22003This is the case for devices with more than 8@tie{}KiB of program 22004memory. 22005 22006@item __AVR_HAVE_EIJMP_EICALL__ 22007@itemx __AVR_3_BYTE_PC__ 22008The device has the @code{EIJMP} and @code{EICALL} instructions. 22009This is the case for devices with more than 128@tie{}KiB of program memory. 22010This also means that the program counter 22011(PC) is 3@tie{}bytes wide. 22012 22013@item __AVR_2_BYTE_PC__ 22014The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 22015with up to 128@tie{}KiB of program memory. 22016 22017@item __AVR_HAVE_8BIT_SP__ 22018@itemx __AVR_HAVE_16BIT_SP__ 22019The stack pointer (SP) register is treated as 8-bit respectively 2202016-bit register by the compiler. 22021The definition of these macros is affected by @option{-mtiny-stack}. 22022 22023@item __AVR_HAVE_SPH__ 22024@itemx __AVR_SP8__ 22025The device has the SPH (high part of stack pointer) special function 22026register or has an 8-bit stack pointer, respectively. 22027The definition of these macros is affected by @option{-mmcu=} and 22028in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 22029by @option{-msp8}. 22030 22031@item __AVR_HAVE_RAMPD__ 22032@itemx __AVR_HAVE_RAMPX__ 22033@itemx __AVR_HAVE_RAMPY__ 22034@itemx __AVR_HAVE_RAMPZ__ 22035The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 22036@code{RAMPZ} special function register, respectively. 22037 22038@item __NO_INTERRUPTS__ 22039This macro reflects the @option{-mno-interrupts} command-line option. 22040 22041@item __AVR_ERRATA_SKIP__ 22042@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 22043Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 22044instructions because of a hardware erratum. Skip instructions are 22045@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 22046The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 22047set. 22048 22049@item __AVR_ISA_RMW__ 22050The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 22051 22052@item __AVR_SFR_OFFSET__=@var{offset} 22053Instructions that can address I/O special function registers directly 22054like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 22055address as if addressed by an instruction to access RAM like @code{LD} 22056or @code{STS}. This offset depends on the device architecture and has 22057to be subtracted from the RAM address in order to get the 22058respective I/O@tie{}address. 22059 22060@item __AVR_SHORT_CALLS__ 22061The @option{-mshort-calls} command line option is set. 22062 22063@item __AVR_PM_BASE_ADDRESS__=@var{addr} 22064Some devices support reading from flash memory by means of @code{LD*} 22065instructions. The flash memory is seen in the data address space 22066at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro 22067is not defined, this feature is not available. If defined, 22068the address space is linear and there is no need to put 22069@code{.rodata} into RAM. This is handled by the default linker 22070description file, and is currently available for 22071@code{avrtiny} and @code{avrxmega3}. Even more convenient, 22072there is no need to use address spaces like @code{__flash} or 22073features like attribute @code{progmem} and @code{pgm_read_*}. 22074 22075@item __WITH_AVRLIBC__ 22076The compiler is configured to be used together with AVR-Libc. 22077See the @option{--with-avrlibc} configure option. 22078 22079@item __HAVE_DOUBLE_MULTILIB__ 22080Defined if @option{-mdouble=} acts as a multilib option. 22081 22082@item __HAVE_DOUBLE32__ 22083@itemx __HAVE_DOUBLE64__ 22084Defined if the compiler supports 32-bit double resp. 64-bit double. 22085The actual layout is specified by option @option{-mdouble=}. 22086 22087@item __DEFAULT_DOUBLE__ 22088The size in bits of @code{double} if @option{-mdouble=} is not set. 22089To test the layout of @code{double} in a program, use the built-in 22090macro @code{__SIZEOF_DOUBLE__}. 22091 22092@item __HAVE_LONG_DOUBLE32__ 22093@itemx __HAVE_LONG_DOUBLE64__ 22094@itemx __HAVE_LONG_DOUBLE_MULTILIB__ 22095@itemx __DEFAULT_LONG_DOUBLE__ 22096Same as above, but for @code{long double} instead of @code{double}. 22097 22098@item __WITH_DOUBLE_COMPARISON__ 22099Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}} 22100@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}} 22101and is defined to @code{2} or @code{3}. 22102 22103@item __WITH_LIBF7_LIBGCC__ 22104@itemx __WITH_LIBF7_MATH__ 22105@itemx __WITH_LIBF7_MATH_SYMBOLS__ 22106Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}} 22107@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}. 22108 22109@end table 22110 22111@node Blackfin Options 22112@subsection Blackfin Options 22113@cindex Blackfin Options 22114 22115@table @gcctabopt 22116@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 22117@opindex mcpu= 22118Specifies the name of the target Blackfin processor. Currently, @var{cpu} 22119can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 22120@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 22121@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 22122@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 22123@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 22124@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 22125@samp{bf561}, @samp{bf592}. 22126 22127The optional @var{sirevision} specifies the silicon revision of the target 22128Blackfin processor. Any workarounds available for the targeted silicon revision 22129are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 22130If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 22131are enabled. The @code{__SILICON_REVISION__} macro is defined to two 22132hexadecimal digits representing the major and minor numbers in the silicon 22133revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 22134is not defined. If @var{sirevision} is @samp{any}, the 22135@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 22136If this optional @var{sirevision} is not used, GCC assumes the latest known 22137silicon revision of the targeted Blackfin processor. 22138 22139GCC defines a preprocessor macro for the specified @var{cpu}. 22140For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 22141provided by libgloss to be linked in if @option{-msim} is not given. 22142 22143Without this option, @samp{bf532} is used as the processor by default. 22144 22145Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 22146only the preprocessor macro is defined. 22147 22148@item -msim 22149@opindex msim 22150Specifies that the program will be run on the simulator. This causes 22151the simulator BSP provided by libgloss to be linked in. This option 22152has effect only for @samp{bfin-elf} toolchain. 22153Certain other options, such as @option{-mid-shared-library} and 22154@option{-mfdpic}, imply @option{-msim}. 22155 22156@item -momit-leaf-frame-pointer 22157@opindex momit-leaf-frame-pointer 22158Don't keep the frame pointer in a register for leaf functions. This 22159avoids the instructions to save, set up and restore frame pointers and 22160makes an extra register available in leaf functions. 22161 22162@item -mspecld-anomaly 22163@opindex mspecld-anomaly 22164When enabled, the compiler ensures that the generated code does not 22165contain speculative loads after jump instructions. If this option is used, 22166@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 22167 22168@item -mno-specld-anomaly 22169@opindex mno-specld-anomaly 22170@opindex mspecld-anomaly 22171Don't generate extra code to prevent speculative loads from occurring. 22172 22173@item -mcsync-anomaly 22174@opindex mcsync-anomaly 22175When enabled, the compiler ensures that the generated code does not 22176contain CSYNC or SSYNC instructions too soon after conditional branches. 22177If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 22178 22179@item -mno-csync-anomaly 22180@opindex mno-csync-anomaly 22181@opindex mcsync-anomaly 22182Don't generate extra code to prevent CSYNC or SSYNC instructions from 22183occurring too soon after a conditional branch. 22184 22185@item -mlow64k 22186@opindex mlow64k 22187When enabled, the compiler is free to take advantage of the knowledge that 22188the entire program fits into the low 64k of memory. 22189 22190@item -mno-low64k 22191@opindex mno-low64k 22192Assume that the program is arbitrarily large. This is the default. 22193 22194@item -mstack-check-l1 22195@opindex mstack-check-l1 22196Do stack checking using information placed into L1 scratchpad memory by the 22197uClinux kernel. 22198 22199@item -mid-shared-library 22200@opindex mid-shared-library 22201Generate code that supports shared libraries via the library ID method. 22202This allows for execute in place and shared libraries in an environment 22203without virtual memory management. This option implies @option{-fPIC}. 22204With a @samp{bfin-elf} target, this option implies @option{-msim}. 22205 22206@item -mno-id-shared-library 22207@opindex mno-id-shared-library 22208@opindex mid-shared-library 22209Generate code that doesn't assume ID-based shared libraries are being used. 22210This is the default. 22211 22212@item -mleaf-id-shared-library 22213@opindex mleaf-id-shared-library 22214Generate code that supports shared libraries via the library ID method, 22215but assumes that this library or executable won't link against any other 22216ID shared libraries. That allows the compiler to use faster code for jumps 22217and calls. 22218 22219@item -mno-leaf-id-shared-library 22220@opindex mno-leaf-id-shared-library 22221@opindex mleaf-id-shared-library 22222Do not assume that the code being compiled won't link against any ID shared 22223libraries. Slower code is generated for jump and call insns. 22224 22225@item -mshared-library-id=n 22226@opindex mshared-library-id 22227Specifies the identification number of the ID-based shared library being 22228compiled. Specifying a value of 0 generates more compact code; specifying 22229other values forces the allocation of that number to the current 22230library but is no more space- or time-efficient than omitting this option. 22231 22232@item -msep-data 22233@opindex msep-data 22234Generate code that allows the data segment to be located in a different 22235area of memory from the text segment. This allows for execute in place in 22236an environment without virtual memory management by eliminating relocations 22237against the text section. 22238 22239@item -mno-sep-data 22240@opindex mno-sep-data 22241@opindex msep-data 22242Generate code that assumes that the data segment follows the text segment. 22243This is the default. 22244 22245@item -mlong-calls 22246@itemx -mno-long-calls 22247@opindex mlong-calls 22248@opindex mno-long-calls 22249Tells the compiler to perform function calls by first loading the 22250address of the function into a register and then performing a subroutine 22251call on this register. This switch is needed if the target function 22252lies outside of the 24-bit addressing range of the offset-based 22253version of subroutine call instruction. 22254 22255This feature is not enabled by default. Specifying 22256@option{-mno-long-calls} restores the default behavior. Note these 22257switches have no effect on how the compiler generates code to handle 22258function calls via function pointers. 22259 22260@item -mfast-fp 22261@opindex mfast-fp 22262Link with the fast floating-point library. This library relaxes some of 22263the IEEE floating-point standard's rules for checking inputs against 22264Not-a-Number (NAN), in the interest of performance. 22265 22266@item -minline-plt 22267@opindex minline-plt 22268Enable inlining of PLT entries in function calls to functions that are 22269not known to bind locally. It has no effect without @option{-mfdpic}. 22270 22271@item -mmulticore 22272@opindex mmulticore 22273Build a standalone application for multicore Blackfin processors. 22274This option causes proper start files and link scripts supporting 22275multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 22276It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 22277 22278This option can be used with @option{-mcorea} or @option{-mcoreb}, which 22279selects the one-application-per-core programming model. Without 22280@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 22281programming model is used. In this model, the main function of Core B 22282should be named as @code{coreb_main}. 22283 22284If this option is not used, the single-core application programming 22285model is used. 22286 22287@item -mcorea 22288@opindex mcorea 22289Build a standalone application for Core A of BF561 when using 22290the one-application-per-core programming model. Proper start files 22291and link scripts are used to support Core A, and the macro 22292@code{__BFIN_COREA} is defined. 22293This option can only be used in conjunction with @option{-mmulticore}. 22294 22295@item -mcoreb 22296@opindex mcoreb 22297Build a standalone application for Core B of BF561 when using 22298the one-application-per-core programming model. Proper start files 22299and link scripts are used to support Core B, and the macro 22300@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 22301should be used instead of @code{main}. 22302This option can only be used in conjunction with @option{-mmulticore}. 22303 22304@item -msdram 22305@opindex msdram 22306Build a standalone application for SDRAM. Proper start files and 22307link scripts are used to put the application into SDRAM, and the macro 22308@code{__BFIN_SDRAM} is defined. 22309The loader should initialize SDRAM before loading the application. 22310 22311@item -micplb 22312@opindex micplb 22313Assume that ICPLBs are enabled at run time. This has an effect on certain 22314anomaly workarounds. For Linux targets, the default is to assume ICPLBs 22315are enabled; for standalone applications the default is off. 22316@end table 22317 22318@node C6X Options 22319@subsection C6X Options 22320@cindex C6X Options 22321 22322@table @gcctabopt 22323@item -march=@var{name} 22324@opindex march 22325This specifies the name of the target architecture. GCC uses this 22326name to determine what kind of instructions it can emit when generating 22327assembly code. Permissible names are: @samp{c62x}, 22328@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 22329 22330@item -mbig-endian 22331@opindex mbig-endian 22332Generate code for a big-endian target. 22333 22334@item -mlittle-endian 22335@opindex mlittle-endian 22336Generate code for a little-endian target. This is the default. 22337 22338@item -msim 22339@opindex msim 22340Choose startup files and linker script suitable for the simulator. 22341 22342@item -msdata=default 22343@opindex msdata=default 22344Put small global and static data in the @code{.neardata} section, 22345which is pointed to by register @code{B14}. Put small uninitialized 22346global and static data in the @code{.bss} section, which is adjacent 22347to the @code{.neardata} section. Put small read-only data into the 22348@code{.rodata} section. The corresponding sections used for large 22349pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 22350 22351@item -msdata=all 22352@opindex msdata=all 22353Put all data, not just small objects, into the sections reserved for 22354small data, and use addressing relative to the @code{B14} register to 22355access them. 22356 22357@item -msdata=none 22358@opindex msdata=none 22359Make no use of the sections reserved for small data, and use absolute 22360addresses to access all data. Put all initialized global and static 22361data in the @code{.fardata} section, and all uninitialized data in the 22362@code{.far} section. Put all constant data into the @code{.const} 22363section. 22364@end table 22365 22366@node CRIS Options 22367@subsection CRIS Options 22368@cindex CRIS Options 22369 22370These options are defined specifically for the CRIS ports. 22371 22372@table @gcctabopt 22373@item -march=@var{architecture-type} 22374@itemx -mcpu=@var{architecture-type} 22375@opindex march 22376@opindex mcpu 22377Generate code for the specified architecture. The choices for 22378@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 22379respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 22380Default is @samp{v0}. 22381 22382@item -mtune=@var{architecture-type} 22383@opindex mtune 22384Tune to @var{architecture-type} everything applicable about the generated 22385code, except for the ABI and the set of available instructions. The 22386choices for @var{architecture-type} are the same as for 22387@option{-march=@var{architecture-type}}. 22388 22389@item -mmax-stack-frame=@var{n} 22390@opindex mmax-stack-frame 22391Warn when the stack frame of a function exceeds @var{n} bytes. 22392 22393@item -metrax4 22394@itemx -metrax100 22395@opindex metrax4 22396@opindex metrax100 22397The options @option{-metrax4} and @option{-metrax100} are synonyms for 22398@option{-march=v3} and @option{-march=v8} respectively. 22399 22400@item -mmul-bug-workaround 22401@itemx -mno-mul-bug-workaround 22402@opindex mmul-bug-workaround 22403@opindex mno-mul-bug-workaround 22404Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 22405models where it applies. This option is disabled by default. 22406 22407@item -mpdebug 22408@opindex mpdebug 22409Enable CRIS-specific verbose debug-related information in the assembly 22410code. This option also has the effect of turning off the @samp{#NO_APP} 22411formatted-code indicator to the assembler at the beginning of the 22412assembly file. 22413 22414@item -mcc-init 22415@opindex mcc-init 22416Do not use condition-code results from previous instruction; always emit 22417compare and test instructions before use of condition codes. 22418 22419@item -mno-side-effects 22420@opindex mno-side-effects 22421@opindex mside-effects 22422Do not emit instructions with side effects in addressing modes other than 22423post-increment. 22424 22425@item -mstack-align 22426@itemx -mno-stack-align 22427@itemx -mdata-align 22428@itemx -mno-data-align 22429@itemx -mconst-align 22430@itemx -mno-const-align 22431@opindex mstack-align 22432@opindex mno-stack-align 22433@opindex mdata-align 22434@opindex mno-data-align 22435@opindex mconst-align 22436@opindex mno-const-align 22437These options (@samp{no-} options) arrange (eliminate arrangements) for the 22438stack frame, individual data and constants to be aligned for the maximum 22439single data access size for the chosen CPU model. The default is to 22440arrange for 32-bit alignment. ABI details such as structure layout are 22441not affected by these options. 22442 22443@item -m32-bit 22444@itemx -m16-bit 22445@itemx -m8-bit 22446@opindex m32-bit 22447@opindex m16-bit 22448@opindex m8-bit 22449Similar to the stack- data- and const-align options above, these options 22450arrange for stack frame, writable data and constants to all be 32-bit, 2245116-bit or 8-bit aligned. The default is 32-bit alignment. 22452 22453@item -mno-prologue-epilogue 22454@itemx -mprologue-epilogue 22455@opindex mno-prologue-epilogue 22456@opindex mprologue-epilogue 22457With @option{-mno-prologue-epilogue}, the normal function prologue and 22458epilogue which set up the stack frame are omitted and no return 22459instructions or return sequences are generated in the code. Use this 22460option only together with visual inspection of the compiled code: no 22461warnings or errors are generated when call-saved registers must be saved, 22462or storage for local variables needs to be allocated. 22463 22464@item -melf 22465@opindex melf 22466Legacy no-op option. 22467 22468@item -sim 22469@opindex sim 22470This option arranges 22471to link with input-output functions from a simulator library. Code, 22472initialized data and zero-initialized data are allocated consecutively. 22473 22474@item -sim2 22475@opindex sim2 22476Like @option{-sim}, but pass linker options to locate initialized data at 224770x40000000 and zero-initialized data at 0x80000000. 22478@end table 22479 22480@node CR16 Options 22481@subsection CR16 Options 22482@cindex CR16 Options 22483 22484These options are defined specifically for the CR16 ports. 22485 22486@table @gcctabopt 22487 22488@item -mmac 22489@opindex mmac 22490Enable the use of multiply-accumulate instructions. Disabled by default. 22491 22492@item -mcr16cplus 22493@itemx -mcr16c 22494@opindex mcr16cplus 22495@opindex mcr16c 22496Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 22497is default. 22498 22499@item -msim 22500@opindex msim 22501Links the library libsim.a which is in compatible with simulator. Applicable 22502to ELF compiler only. 22503 22504@item -mint32 22505@opindex mint32 22506Choose integer type as 32-bit wide. 22507 22508@item -mbit-ops 22509@opindex mbit-ops 22510Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 22511 22512@item -mdata-model=@var{model} 22513@opindex mdata-model 22514Choose a data model. The choices for @var{model} are @samp{near}, 22515@samp{far} or @samp{medium}. @samp{medium} is default. 22516However, @samp{far} is not valid with @option{-mcr16c}, as the 22517CR16C architecture does not support the far data model. 22518@end table 22519 22520@node C-SKY Options 22521@subsection C-SKY Options 22522@cindex C-SKY Options 22523 22524GCC supports these options when compiling for C-SKY V2 processors. 22525 22526@table @gcctabopt 22527 22528@item -march=@var{arch} 22529@opindex march= 22530Specify the C-SKY target architecture. Valid values for @var{arch} are: 22531@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}. 22532The default is @samp{ck810}. 22533 22534@item -mcpu=@var{cpu} 22535@opindex mcpu= 22536Specify the C-SKY target processor. Valid values for @var{cpu} are: 22537@samp{ck801}, @samp{ck801t}, 22538@samp{ck802}, @samp{ck802t}, @samp{ck802j}, 22539@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht}, 22540@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh}, 22541@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh}, 22542@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1}, 22543@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1}, 22544@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1}, 22545@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1}, 22546@samp{ck803eftr1}, @samp{ck803efhtr1}, 22547@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf}, 22548@samp{ck803sef}, @samp{ck803seft}, 22549@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f}, 22550@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft}, 22551@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv}, 22552@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}. 22553 22554@item -mbig-endian 22555@opindex mbig-endian 22556@itemx -EB 22557@opindex EB 22558@itemx -mlittle-endian 22559@opindex mlittle-endian 22560@itemx -EL 22561@opindex EL 22562 22563Select big- or little-endian code. The default is little-endian. 22564 22565@item -mfloat-abi=@var{name} 22566@opindex mfloat-abi 22567Specifies which floating-point ABI to use. Permissible values 22568are: @samp{soft}, @samp{softfp} and @samp{hard}. 22569 22570Specifying @samp{soft} causes GCC to generate output containing 22571library calls for floating-point operations. 22572@samp{softfp} allows the generation of code using hardware floating-point 22573instructions, but still uses the soft-float calling conventions. 22574@samp{hard} allows generation of floating-point instructions 22575and uses FPU-specific calling conventions. 22576 22577The default depends on the specific target configuration. Note that 22578the hard-float and soft-float ABIs are not link-compatible; you must 22579compile your entire program with the same ABI, and link with a 22580compatible set of libraries. 22581 22582@item -mhard-float 22583@opindex mhard-float 22584@itemx -msoft-float 22585@opindex msoft-float 22586 22587Select hardware or software floating-point implementations. 22588The default is soft float. 22589 22590@item -mdouble-float 22591@itemx -mno-double-float 22592@opindex mdouble-float 22593When @option{-mhard-float} is in effect, enable generation of 22594double-precision float instructions. This is the default except 22595when compiling for CK803. 22596 22597@item -mfdivdu 22598@itemx -mno-fdivdu 22599@opindex mfdivdu 22600When @option{-mhard-float} is in effect, enable generation of 22601@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions. 22602This is the default except when compiling for CK803. 22603 22604@item -mfpu=@var{fpu} 22605@opindex mfpu= 22606Select the floating-point processor. This option can only be used with 22607@option{-mhard-float}. 22608Values for @var{fpu} are 22609@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}), 22610@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and 22611@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}). 22612 22613@item -melrw 22614@itemx -mno-elrw 22615@opindex melrw 22616Enable the extended @code{lrw} instruction. This option defaults to on 22617for CK801 and off otherwise. 22618 22619@item -mistack 22620@itemx -mno-istack 22621@opindex mistack 22622Enable interrupt stack instructions; the default is off. 22623 22624The @option{-mistack} option is required to handle the 22625@code{interrupt} and @code{isr} function attributes 22626(@pxref{C-SKY Function Attributes}). 22627 22628@item -mmp 22629@opindex mmp 22630Enable multiprocessor instructions; the default is off. 22631 22632@item -mcp 22633@opindex mcp 22634Enable coprocessor instructions; the default is off. 22635 22636@item -mcache 22637@opindex mcache 22638Enable coprocessor instructions; the default is off. 22639 22640@item -msecurity 22641@opindex msecurity 22642Enable C-SKY security instructions; the default is off. 22643 22644@item -mtrust 22645@opindex mtrust 22646Enable C-SKY trust instructions; the default is off. 22647 22648@item -mdsp 22649@opindex mdsp 22650@itemx -medsp 22651@opindex medsp 22652@itemx -mvdsp 22653@opindex mvdsp 22654Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively. 22655All of these options default to off. 22656 22657@item -mdiv 22658@itemx -mno-div 22659@opindex mdiv 22660Generate divide instructions. Default is off. 22661 22662@item -msmart 22663@itemx -mno-smart 22664@opindex msmart 22665Generate code for Smart Mode, using only registers numbered 0-7 to allow 22666use of 16-bit instructions. This option is ignored for CK801 where this 22667is the required behavior, and it defaults to on for CK802. 22668For other targets, the default is off. 22669 22670@item -mhigh-registers 22671@itemx -mno-high-registers 22672@opindex mhigh-registers 22673Generate code using the high registers numbered 16-31. This option 22674is not supported on CK801, CK802, or CK803, and is enabled by default 22675for other processors. 22676 22677@item -manchor 22678@itemx -mno-anchor 22679@opindex manchor 22680Generate code using global anchor symbol addresses. 22681 22682@item -mpushpop 22683@itemx -mno-pushpop 22684@opindex mpushpop 22685Generate code using @code{push} and @code{pop} instructions. This option 22686defaults to on. 22687 22688@item -mmultiple-stld 22689@itemx -mstm 22690@itemx -mno-multiple-stld 22691@itemx -mno-stm 22692@opindex mmultiple-stld 22693Generate code using @code{stm} and @code{ldm} instructions. This option 22694isn't supported on CK801 but is enabled by default on other processors. 22695 22696@item -mconstpool 22697@itemx -mno-constpool 22698@opindex mconstpool 22699Create constant pools in the compiler instead of deferring it to the 22700assembler. This option is the default and required for correct code 22701generation on CK801 and CK802, and is optional on other processors. 22702 22703@item -mstack-size 22704@item -mno-stack-size 22705@opindex mstack-size 22706Emit @code{.stack_size} directives for each function in the assembly 22707output. This option defaults to off. 22708 22709@item -mccrt 22710@itemx -mno-ccrt 22711@opindex mccrt 22712Generate code for the C-SKY compiler runtime instead of libgcc. This 22713option defaults to off. 22714 22715@item -mbranch-cost=@var{n} 22716@opindex mbranch-cost= 22717Set the branch costs to roughly @code{n} instructions. The default is 1. 22718 22719@item -msched-prolog 22720@itemx -mno-sched-prolog 22721@opindex msched-prolog 22722Permit scheduling of function prologue and epilogue sequences. Using 22723this option can result in code that is not compliant with the C-SKY V2 ABI 22724prologue requirements and that cannot be debugged or backtraced. 22725It is disabled by default. 22726 22727@item -msim 22728@opindex msim 22729Links the library libsemi.a which is in compatible with simulator. Applicable 22730to ELF compiler only. 22731 22732@end table 22733 22734@node Darwin Options 22735@subsection Darwin Options 22736@cindex Darwin options 22737 22738These options are defined for all architectures running the Darwin operating 22739system. 22740 22741FSF GCC on Darwin does not create ``fat'' object files; it creates 22742an object file for the single architecture that GCC was built to 22743target. Apple's GCC on Darwin does create ``fat'' files if multiple 22744@option{-arch} options are used; it does so by running the compiler or 22745linker multiple times and joining the results together with 22746@file{lipo}. 22747 22748The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 22749@samp{i686}) is determined by the flags that specify the ISA 22750that GCC is targeting, like @option{-mcpu} or @option{-march}. The 22751@option{-force_cpusubtype_ALL} option can be used to override this. 22752 22753The Darwin tools vary in their behavior when presented with an ISA 22754mismatch. The assembler, @file{as}, only permits instructions to 22755be used that are valid for the subtype of the file it is generating, 22756so you cannot put 64-bit instructions in a @samp{ppc750} object file. 22757The linker for shared libraries, @file{/usr/bin/libtool}, fails 22758and prints an error if asked to create a shared library with a less 22759restrictive subtype than its input files (for instance, trying to put 22760a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 22761for executables, @command{ld}, quietly gives the executable the most 22762restrictive subtype of any of its input files. 22763 22764@table @gcctabopt 22765@item -F@var{dir} 22766@opindex F 22767Add the framework directory @var{dir} to the head of the list of 22768directories to be searched for header files. These directories are 22769interleaved with those specified by @option{-I} options and are 22770scanned in a left-to-right order. 22771 22772A framework directory is a directory with frameworks in it. A 22773framework is a directory with a @file{Headers} and/or 22774@file{PrivateHeaders} directory contained directly in it that ends 22775in @file{.framework}. The name of a framework is the name of this 22776directory excluding the @file{.framework}. Headers associated with 22777the framework are found in one of those two directories, with 22778@file{Headers} being searched first. A subframework is a framework 22779directory that is in a framework's @file{Frameworks} directory. 22780Includes of subframework headers can only appear in a header of a 22781framework that contains the subframework, or in a sibling subframework 22782header. Two subframeworks are siblings if they occur in the same 22783framework. A subframework should not have the same name as a 22784framework; a warning is issued if this is violated. Currently a 22785subframework cannot have subframeworks; in the future, the mechanism 22786may be extended to support this. The standard frameworks can be found 22787in @file{/System/Library/Frameworks} and 22788@file{/Library/Frameworks}. An example include looks like 22789@code{#include <Framework/header.h>}, where @file{Framework} denotes 22790the name of the framework and @file{header.h} is found in the 22791@file{PrivateHeaders} or @file{Headers} directory. 22792 22793@item -iframework@var{dir} 22794@opindex iframework 22795Like @option{-F} except the directory is a treated as a system 22796directory. The main difference between this @option{-iframework} and 22797@option{-F} is that with @option{-iframework} the compiler does not 22798warn about constructs contained within header files found via 22799@var{dir}. This option is valid only for the C family of languages. 22800 22801@item -gused 22802@opindex gused 22803Emit debugging information for symbols that are used. For stabs 22804debugging format, this enables @option{-feliminate-unused-debug-symbols}. 22805This is by default ON@. 22806 22807@item -gfull 22808@opindex gfull 22809Emit debugging information for all symbols and types. 22810 22811@opindex fconstant-cfstrings 22812@item -fconstant-cfstrings 22813The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}. 22814 22815@opindex mconstant-cfstrings 22816@item -mconstant-cfstrings 22817When the NeXT runtime is being used (the default on these systems), override 22818any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} 22819literals to be laid out as constant CoreFoundation strings. 22820 22821@opindex mmacosx-version-min 22822@item -mmacosx-version-min=@var{version} 22823The earliest version of MacOS X that this executable will run on is 22824@var{version}. Typical values supported for @var{version} include @code{12}, 22825@code{10.12}, and @code{10.5.8}. 22826 22827If the compiler was built to use the system's headers by default, 22828then the default for this option is the system version on which the 22829compiler is running, otherwise the default is to make choices that 22830are compatible with as many systems and code bases as possible. 22831 22832@item -mkernel 22833@opindex mkernel 22834Enable kernel development mode. The @option{-mkernel} option sets 22835@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 22836@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 22837@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 22838applicable. This mode also sets @option{-mno-altivec}, 22839@option{-msoft-float}, @option{-fno-builtin} and 22840@option{-mlong-branch} for PowerPC targets. 22841 22842@item -mone-byte-bool 22843@opindex mone-byte-bool 22844Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 22845By default @code{sizeof(bool)} is @code{4} when compiling for 22846Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 22847option has no effect on x86. 22848 22849@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 22850to generate code that is not binary compatible with code generated 22851without that switch. Using this switch may require recompiling all 22852other modules in a program, including system libraries. Use this 22853switch to conform to a non-default data model. 22854 22855@item -mfix-and-continue 22856@itemx -ffix-and-continue 22857@itemx -findirect-data 22858@opindex mfix-and-continue 22859@opindex ffix-and-continue 22860@opindex findirect-data 22861Generate code suitable for fast turnaround development, such as to 22862allow GDB to dynamically load @file{.o} files into already-running 22863programs. @option{-findirect-data} and @option{-ffix-and-continue} 22864are provided for backwards compatibility. 22865 22866@item -all_load 22867@opindex all_load 22868Loads all members of static archive libraries. 22869See man ld(1) for more information. 22870 22871@item -arch_errors_fatal 22872@opindex arch_errors_fatal 22873Cause the errors having to do with files that have the wrong architecture 22874to be fatal. 22875 22876@item -bind_at_load 22877@opindex bind_at_load 22878Causes the output file to be marked such that the dynamic linker will 22879bind all undefined references when the file is loaded or launched. 22880 22881@item -bundle 22882@opindex bundle 22883Produce a Mach-o bundle format file. 22884See man ld(1) for more information. 22885 22886@item -bundle_loader @var{executable} 22887@opindex bundle_loader 22888This option specifies the @var{executable} that will load the build 22889output file being linked. See man ld(1) for more information. 22890 22891@item -dynamiclib 22892@opindex dynamiclib 22893When passed this option, GCC produces a dynamic library instead of 22894an executable when linking, using the Darwin @file{libtool} command. 22895 22896@item -force_cpusubtype_ALL 22897@opindex force_cpusubtype_ALL 22898This causes GCC's output file to have the @samp{ALL} subtype, instead of 22899one controlled by the @option{-mcpu} or @option{-march} option. 22900 22901@item -allowable_client @var{client_name} 22902@itemx -client_name 22903@itemx -compatibility_version 22904@itemx -current_version 22905@itemx -dead_strip 22906@itemx -dependency-file 22907@itemx -dylib_file 22908@itemx -dylinker_install_name 22909@itemx -dynamic 22910@itemx -exported_symbols_list 22911@itemx -filelist 22912@need 800 22913@itemx -flat_namespace 22914@itemx -force_flat_namespace 22915@itemx -headerpad_max_install_names 22916@itemx -image_base 22917@itemx -init 22918@itemx -install_name 22919@itemx -keep_private_externs 22920@itemx -multi_module 22921@itemx -multiply_defined 22922@itemx -multiply_defined_unused 22923@need 800 22924@itemx -noall_load 22925@itemx -no_dead_strip_inits_and_terms 22926@itemx -nofixprebinding 22927@itemx -nomultidefs 22928@itemx -noprebind 22929@itemx -noseglinkedit 22930@itemx -pagezero_size 22931@itemx -prebind 22932@itemx -prebind_all_twolevel_modules 22933@itemx -private_bundle 22934@need 800 22935@itemx -read_only_relocs 22936@itemx -sectalign 22937@itemx -sectobjectsymbols 22938@itemx -whyload 22939@itemx -seg1addr 22940@itemx -sectcreate 22941@itemx -sectobjectsymbols 22942@itemx -sectorder 22943@itemx -segaddr 22944@itemx -segs_read_only_addr 22945@need 800 22946@itemx -segs_read_write_addr 22947@itemx -seg_addr_table 22948@itemx -seg_addr_table_filename 22949@itemx -seglinkedit 22950@itemx -segprot 22951@itemx -segs_read_only_addr 22952@itemx -segs_read_write_addr 22953@itemx -single_module 22954@itemx -static 22955@itemx -sub_library 22956@need 800 22957@itemx -sub_umbrella 22958@itemx -twolevel_namespace 22959@itemx -umbrella 22960@itemx -undefined 22961@itemx -unexported_symbols_list 22962@itemx -weak_reference_mismatches 22963@itemx -whatsloaded 22964@opindex allowable_client 22965@opindex client_name 22966@opindex compatibility_version 22967@opindex current_version 22968@opindex dead_strip 22969@opindex dependency-file 22970@opindex dylib_file 22971@opindex dylinker_install_name 22972@opindex dynamic 22973@opindex exported_symbols_list 22974@opindex filelist 22975@opindex flat_namespace 22976@opindex force_flat_namespace 22977@opindex headerpad_max_install_names 22978@opindex image_base 22979@opindex init 22980@opindex install_name 22981@opindex keep_private_externs 22982@opindex multi_module 22983@opindex multiply_defined 22984@opindex multiply_defined_unused 22985@opindex noall_load 22986@opindex no_dead_strip_inits_and_terms 22987@opindex nofixprebinding 22988@opindex nomultidefs 22989@opindex noprebind 22990@opindex noseglinkedit 22991@opindex pagezero_size 22992@opindex prebind 22993@opindex prebind_all_twolevel_modules 22994@opindex private_bundle 22995@opindex read_only_relocs 22996@opindex sectalign 22997@opindex sectobjectsymbols 22998@opindex whyload 22999@opindex seg1addr 23000@opindex sectcreate 23001@opindex sectobjectsymbols 23002@opindex sectorder 23003@opindex segaddr 23004@opindex segs_read_only_addr 23005@opindex segs_read_write_addr 23006@opindex seg_addr_table 23007@opindex seg_addr_table_filename 23008@opindex seglinkedit 23009@opindex segprot 23010@opindex segs_read_only_addr 23011@opindex segs_read_write_addr 23012@opindex single_module 23013@opindex static 23014@opindex sub_library 23015@opindex sub_umbrella 23016@opindex twolevel_namespace 23017@opindex umbrella 23018@opindex undefined 23019@opindex unexported_symbols_list 23020@opindex weak_reference_mismatches 23021@opindex whatsloaded 23022These options are passed to the Darwin linker. The Darwin linker man page 23023describes them in detail. 23024@end table 23025 23026@node DEC Alpha Options 23027@subsection DEC Alpha Options 23028 23029These @samp{-m} options are defined for the DEC Alpha implementations: 23030 23031@table @gcctabopt 23032@item -mno-soft-float 23033@itemx -msoft-float 23034@opindex mno-soft-float 23035@opindex msoft-float 23036Use (do not use) the hardware floating-point instructions for 23037floating-point operations. When @option{-msoft-float} is specified, 23038functions in @file{libgcc.a} are used to perform floating-point 23039operations. Unless they are replaced by routines that emulate the 23040floating-point operations, or compiled in such a way as to call such 23041emulations routines, these routines issue floating-point 23042operations. If you are compiling for an Alpha without floating-point 23043operations, you must ensure that the library is built so as not to call 23044them. 23045 23046Note that Alpha implementations without floating-point operations are 23047required to have floating-point registers. 23048 23049@item -mfp-reg 23050@itemx -mno-fp-regs 23051@opindex mfp-reg 23052@opindex mno-fp-regs 23053Generate code that uses (does not use) the floating-point register set. 23054@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 23055register set is not used, floating-point operands are passed in integer 23056registers as if they were integers and floating-point results are passed 23057in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 23058so any function with a floating-point argument or return value called by code 23059compiled with @option{-mno-fp-regs} must also be compiled with that 23060option. 23061 23062A typical use of this option is building a kernel that does not use, 23063and hence need not save and restore, any floating-point registers. 23064 23065@item -mieee 23066@opindex mieee 23067The Alpha architecture implements floating-point hardware optimized for 23068maximum performance. It is mostly compliant with the IEEE floating-point 23069standard. However, for full compliance, software assistance is 23070required. This option generates code fully IEEE-compliant code 23071@emph{except} that the @var{inexact-flag} is not maintained (see below). 23072If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 23073defined during compilation. The resulting code is less efficient but is 23074able to correctly support denormalized numbers and exceptional IEEE 23075values such as not-a-number and plus/minus infinity. Other Alpha 23076compilers call this option @option{-ieee_with_no_inexact}. 23077 23078@item -mieee-with-inexact 23079@opindex mieee-with-inexact 23080This is like @option{-mieee} except the generated code also maintains 23081the IEEE @var{inexact-flag}. Turning on this option causes the 23082generated code to implement fully-compliant IEEE math. In addition to 23083@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 23084macro. On some Alpha implementations the resulting code may execute 23085significantly slower than the code generated by default. Since there is 23086very little code that depends on the @var{inexact-flag}, you should 23087normally not specify this option. Other Alpha compilers call this 23088option @option{-ieee_with_inexact}. 23089 23090@item -mfp-trap-mode=@var{trap-mode} 23091@opindex mfp-trap-mode 23092This option controls what floating-point related traps are enabled. 23093Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 23094The trap mode can be set to one of four values: 23095 23096@table @samp 23097@item n 23098This is the default (normal) setting. The only traps that are enabled 23099are the ones that cannot be disabled in software (e.g., division by zero 23100trap). 23101 23102@item u 23103In addition to the traps enabled by @samp{n}, underflow traps are enabled 23104as well. 23105 23106@item su 23107Like @samp{u}, but the instructions are marked to be safe for software 23108completion (see Alpha architecture manual for details). 23109 23110@item sui 23111Like @samp{su}, but inexact traps are enabled as well. 23112@end table 23113 23114@item -mfp-rounding-mode=@var{rounding-mode} 23115@opindex mfp-rounding-mode 23116Selects the IEEE rounding mode. Other Alpha compilers call this option 23117@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 23118of: 23119 23120@table @samp 23121@item n 23122Normal IEEE rounding mode. Floating-point numbers are rounded towards 23123the nearest machine number or towards the even machine number in case 23124of a tie. 23125 23126@item m 23127Round towards minus infinity. 23128 23129@item c 23130Chopped rounding mode. Floating-point numbers are rounded towards zero. 23131 23132@item d 23133Dynamic rounding mode. A field in the floating-point control register 23134(@var{fpcr}, see Alpha architecture reference manual) controls the 23135rounding mode in effect. The C library initializes this register for 23136rounding towards plus infinity. Thus, unless your program modifies the 23137@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 23138@end table 23139 23140@item -mtrap-precision=@var{trap-precision} 23141@opindex mtrap-precision 23142In the Alpha architecture, floating-point traps are imprecise. This 23143means without software assistance it is impossible to recover from a 23144floating trap and program execution normally needs to be terminated. 23145GCC can generate code that can assist operating system trap handlers 23146in determining the exact location that caused a floating-point trap. 23147Depending on the requirements of an application, different levels of 23148precisions can be selected: 23149 23150@table @samp 23151@item p 23152Program precision. This option is the default and means a trap handler 23153can only identify which program caused a floating-point exception. 23154 23155@item f 23156Function precision. The trap handler can determine the function that 23157caused a floating-point exception. 23158 23159@item i 23160Instruction precision. The trap handler can determine the exact 23161instruction that caused a floating-point exception. 23162@end table 23163 23164Other Alpha compilers provide the equivalent options called 23165@option{-scope_safe} and @option{-resumption_safe}. 23166 23167@item -mieee-conformant 23168@opindex mieee-conformant 23169This option marks the generated code as IEEE conformant. You must not 23170use this option unless you also specify @option{-mtrap-precision=i} and either 23171@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 23172is to emit the line @samp{.eflag 48} in the function prologue of the 23173generated assembly file. 23174 23175@item -mbuild-constants 23176@opindex mbuild-constants 23177Normally GCC examines a 32- or 64-bit integer constant to 23178see if it can construct it from smaller constants in two or three 23179instructions. If it cannot, it outputs the constant as a literal and 23180generates code to load it from the data segment at run time. 23181 23182Use this option to require GCC to construct @emph{all} integer constants 23183using code, even if it takes more instructions (the maximum is six). 23184 23185You typically use this option to build a shared library dynamic 23186loader. Itself a shared library, it must relocate itself in memory 23187before it can find the variables and constants in its own data segment. 23188 23189@item -mbwx 23190@itemx -mno-bwx 23191@itemx -mcix 23192@itemx -mno-cix 23193@itemx -mfix 23194@itemx -mno-fix 23195@itemx -mmax 23196@itemx -mno-max 23197@opindex mbwx 23198@opindex mno-bwx 23199@opindex mcix 23200@opindex mno-cix 23201@opindex mfix 23202@opindex mno-fix 23203@opindex mmax 23204@opindex mno-max 23205Indicate whether GCC should generate code to use the optional BWX, 23206CIX, FIX and MAX instruction sets. The default is to use the instruction 23207sets supported by the CPU type specified via @option{-mcpu=} option or that 23208of the CPU on which GCC was built if none is specified. 23209 23210@item -mfloat-vax 23211@itemx -mfloat-ieee 23212@opindex mfloat-vax 23213@opindex mfloat-ieee 23214Generate code that uses (does not use) VAX F and G floating-point 23215arithmetic instead of IEEE single and double precision. 23216 23217@item -mexplicit-relocs 23218@itemx -mno-explicit-relocs 23219@opindex mexplicit-relocs 23220@opindex mno-explicit-relocs 23221Older Alpha assemblers provided no way to generate symbol relocations 23222except via assembler macros. Use of these macros does not allow 23223optimal instruction scheduling. GNU binutils as of version 2.12 23224supports a new syntax that allows the compiler to explicitly mark 23225which relocations should apply to which instructions. This option 23226is mostly useful for debugging, as GCC detects the capabilities of 23227the assembler when it is built and sets the default accordingly. 23228 23229@item -msmall-data 23230@itemx -mlarge-data 23231@opindex msmall-data 23232@opindex mlarge-data 23233When @option{-mexplicit-relocs} is in effect, static data is 23234accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 23235is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 23236(the @code{.sdata} and @code{.sbss} sections) and are accessed via 2323716-bit relocations off of the @code{$gp} register. This limits the 23238size of the small data area to 64KB, but allows the variables to be 23239directly accessed via a single instruction. 23240 23241The default is @option{-mlarge-data}. With this option the data area 23242is limited to just below 2GB@. Programs that require more than 2GB of 23243data must use @code{malloc} or @code{mmap} to allocate the data in the 23244heap instead of in the program's data segment. 23245 23246When generating code for shared libraries, @option{-fpic} implies 23247@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 23248 23249@item -msmall-text 23250@itemx -mlarge-text 23251@opindex msmall-text 23252@opindex mlarge-text 23253When @option{-msmall-text} is used, the compiler assumes that the 23254code of the entire program (or shared library) fits in 4MB, and is 23255thus reachable with a branch instruction. When @option{-msmall-data} 23256is used, the compiler can assume that all local symbols share the 23257same @code{$gp} value, and thus reduce the number of instructions 23258required for a function call from 4 to 1. 23259 23260The default is @option{-mlarge-text}. 23261 23262@item -mcpu=@var{cpu_type} 23263@opindex mcpu 23264Set the instruction set and instruction scheduling parameters for 23265machine type @var{cpu_type}. You can specify either the @samp{EV} 23266style name or the corresponding chip number. GCC supports scheduling 23267parameters for the EV4, EV5 and EV6 family of processors and 23268chooses the default values for the instruction set from the processor 23269you specify. If you do not specify a processor type, GCC defaults 23270to the processor on which the compiler was built. 23271 23272Supported values for @var{cpu_type} are 23273 23274@table @samp 23275@item ev4 23276@itemx ev45 23277@itemx 21064 23278Schedules as an EV4 and has no instruction set extensions. 23279 23280@item ev5 23281@itemx 21164 23282Schedules as an EV5 and has no instruction set extensions. 23283 23284@item ev56 23285@itemx 21164a 23286Schedules as an EV5 and supports the BWX extension. 23287 23288@item pca56 23289@itemx 21164pc 23290@itemx 21164PC 23291Schedules as an EV5 and supports the BWX and MAX extensions. 23292 23293@item ev6 23294@itemx 21264 23295Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 23296 23297@item ev67 23298@itemx 21264a 23299Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 23300@end table 23301 23302Native toolchains also support the value @samp{native}, 23303which selects the best architecture option for the host processor. 23304@option{-mcpu=native} has no effect if GCC does not recognize 23305the processor. 23306 23307@item -mtune=@var{cpu_type} 23308@opindex mtune 23309Set only the instruction scheduling parameters for machine type 23310@var{cpu_type}. The instruction set is not changed. 23311 23312Native toolchains also support the value @samp{native}, 23313which selects the best architecture option for the host processor. 23314@option{-mtune=native} has no effect if GCC does not recognize 23315the processor. 23316 23317@item -mmemory-latency=@var{time} 23318@opindex mmemory-latency 23319Sets the latency the scheduler should assume for typical memory 23320references as seen by the application. This number is highly 23321dependent on the memory access patterns used by the application 23322and the size of the external cache on the machine. 23323 23324Valid options for @var{time} are 23325 23326@table @samp 23327@item @var{number} 23328A decimal number representing clock cycles. 23329 23330@item L1 23331@itemx L2 23332@itemx L3 23333@itemx main 23334The compiler contains estimates of the number of clock cycles for 23335``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 23336(also called Dcache, Scache, and Bcache), as well as to main memory. 23337Note that L3 is only valid for EV5. 23338 23339@end table 23340@end table 23341 23342@node eBPF Options 23343@subsection eBPF Options 23344@cindex eBPF Options 23345 23346@table @gcctabopt 23347@item -mframe-limit=@var{bytes} 23348This specifies the hard limit for frame sizes, in bytes. Currently, 23349the value that can be specified should be less than or equal to 23350@samp{32767}. Defaults to whatever limit is imposed by the version of 23351the Linux kernel targeted. 23352 23353@item -mkernel=@var{version} 23354@opindex mkernel 23355This specifies the minimum version of the kernel that will run the 23356compiled program. GCC uses this version to determine which 23357instructions to use, what kernel helpers to allow, etc. Currently, 23358@var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2}, 23359@samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7}, 23360@samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12}, 23361@samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17}, 23362@samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1}, 23363@samp{5.2}, @samp{latest} and @samp{native}. 23364 23365@item -mbig-endian 23366@opindex mbig-endian 23367Generate code for a big-endian target. 23368 23369@item -mlittle-endian 23370@opindex mlittle-endian 23371Generate code for a little-endian target. This is the default. 23372 23373@item -mjmpext 23374@opindex mjmpext 23375Enable generation of extra conditional-branch instructions. 23376Enabled for CPU v2 and above. 23377 23378@item -mjmp32 23379@opindex mjmp32 23380Enable 32-bit jump instructions. Enabled for CPU v3 and above. 23381 23382@item -malu32 23383@opindex malu32 23384Enable 32-bit ALU instructions. Enabled for CPU v3 and above. 23385 23386@item -mcpu=@var{version} 23387@opindex mcpu 23388This specifies which version of the eBPF ISA to target. Newer versions 23389may not be supported by all kernels. The default is @samp{v3}. 23390 23391Supported values for @var{version} are: 23392 23393@table @samp 23394@item v1 23395The first stable eBPF ISA with no special features or extensions. 23396 23397@item v2 23398Supports the jump extensions, as in @option{-mjmpext}. 23399 23400@item v3 23401All features of v2, plus: 23402@itemize @minus 23403@item 32-bit jump operations, as in @option{-mjmp32} 23404@item 32-bit ALU operations, as in @option{-malu32} 23405@end itemize 23406 23407@end table 23408 23409@item -mco-re 23410@opindex mco-re 23411Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and 23412is implied by @option{-gbtf}. 23413 23414@item -mno-co-re 23415@opindex mno-co-re 23416Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE 23417support is enabled by default when generating BTF debug information for 23418the BPF target. 23419 23420@item -mxbpf 23421Generate code for an expanded version of BPF, which relaxes some of 23422the restrictions imposed by the BPF architecture: 23423@itemize @minus 23424@item Save and restore callee-saved registers at function entry and 23425exit, respectively. 23426@end itemize 23427@end table 23428 23429@node FR30 Options 23430@subsection FR30 Options 23431@cindex FR30 Options 23432 23433These options are defined specifically for the FR30 port. 23434 23435@table @gcctabopt 23436 23437@item -msmall-model 23438@opindex msmall-model 23439Use the small address space model. This can produce smaller code, but 23440it does assume that all symbolic values and addresses fit into a 2344120-bit range. 23442 23443@item -mno-lsim 23444@opindex mno-lsim 23445Assume that runtime support has been provided and so there is no need 23446to include the simulator library (@file{libsim.a}) on the linker 23447command line. 23448 23449@end table 23450 23451@node FT32 Options 23452@subsection FT32 Options 23453@cindex FT32 Options 23454 23455These options are defined specifically for the FT32 port. 23456 23457@table @gcctabopt 23458 23459@item -msim 23460@opindex msim 23461Specifies that the program will be run on the simulator. This causes 23462an alternate runtime startup and library to be linked. 23463You must not use this option when generating programs that will run on 23464real hardware; you must provide your own runtime library for whatever 23465I/O functions are needed. 23466 23467@item -mlra 23468@opindex mlra 23469Enable Local Register Allocation. This is still experimental for FT32, 23470so by default the compiler uses standard reload. 23471 23472@item -mnodiv 23473@opindex mnodiv 23474Do not use div and mod instructions. 23475 23476@item -mft32b 23477@opindex mft32b 23478Enable use of the extended instructions of the FT32B processor. 23479 23480@item -mcompress 23481@opindex mcompress 23482Compress all code using the Ft32B code compression scheme. 23483 23484@item -mnopm 23485@opindex mnopm 23486Do not generate code that reads program memory. 23487 23488@end table 23489 23490@node FRV Options 23491@subsection FRV Options 23492@cindex FRV Options 23493 23494@table @gcctabopt 23495@item -mgpr-32 23496@opindex mgpr-32 23497 23498Only use the first 32 general-purpose registers. 23499 23500@item -mgpr-64 23501@opindex mgpr-64 23502 23503Use all 64 general-purpose registers. 23504 23505@item -mfpr-32 23506@opindex mfpr-32 23507 23508Use only the first 32 floating-point registers. 23509 23510@item -mfpr-64 23511@opindex mfpr-64 23512 23513Use all 64 floating-point registers. 23514 23515@item -mhard-float 23516@opindex mhard-float 23517 23518Use hardware instructions for floating-point operations. 23519 23520@item -msoft-float 23521@opindex msoft-float 23522 23523Use library routines for floating-point operations. 23524 23525@item -malloc-cc 23526@opindex malloc-cc 23527 23528Dynamically allocate condition code registers. 23529 23530@item -mfixed-cc 23531@opindex mfixed-cc 23532 23533Do not try to dynamically allocate condition code registers, only 23534use @code{icc0} and @code{fcc0}. 23535 23536@item -mdword 23537@opindex mdword 23538 23539Change ABI to use double word insns. 23540 23541@item -mno-dword 23542@opindex mno-dword 23543@opindex mdword 23544 23545Do not use double word instructions. 23546 23547@item -mdouble 23548@opindex mdouble 23549 23550Use floating-point double instructions. 23551 23552@item -mno-double 23553@opindex mno-double 23554 23555Do not use floating-point double instructions. 23556 23557@item -mmedia 23558@opindex mmedia 23559 23560Use media instructions. 23561 23562@item -mno-media 23563@opindex mno-media 23564 23565Do not use media instructions. 23566 23567@item -mmuladd 23568@opindex mmuladd 23569 23570Use multiply and add/subtract instructions. 23571 23572@item -mno-muladd 23573@opindex mno-muladd 23574 23575Do not use multiply and add/subtract instructions. 23576 23577@item -mfdpic 23578@opindex mfdpic 23579 23580Select the FDPIC ABI, which uses function descriptors to represent 23581pointers to functions. Without any PIC/PIE-related options, it 23582implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 23583assumes GOT entries and small data are within a 12-bit range from the 23584GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 23585are computed with 32 bits. 23586With a @samp{bfin-elf} target, this option implies @option{-msim}. 23587 23588@item -minline-plt 23589@opindex minline-plt 23590 23591Enable inlining of PLT entries in function calls to functions that are 23592not known to bind locally. It has no effect without @option{-mfdpic}. 23593It's enabled by default if optimizing for speed and compiling for 23594shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 23595optimization option such as @option{-O3} or above is present in the 23596command line. 23597 23598@item -mTLS 23599@opindex mTLS 23600 23601Assume a large TLS segment when generating thread-local code. 23602 23603@item -mtls 23604@opindex mtls 23605 23606Do not assume a large TLS segment when generating thread-local code. 23607 23608@item -mgprel-ro 23609@opindex mgprel-ro 23610 23611Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 23612that is known to be in read-only sections. It's enabled by default, 23613except for @option{-fpic} or @option{-fpie}: even though it may help 23614make the global offset table smaller, it trades 1 instruction for 4. 23615With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 23616one of which may be shared by multiple symbols, and it avoids the need 23617for a GOT entry for the referenced symbol, so it's more likely to be a 23618win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 23619 23620@item -multilib-library-pic 23621@opindex multilib-library-pic 23622 23623Link with the (library, not FD) pic libraries. It's implied by 23624@option{-mlibrary-pic}, as well as by @option{-fPIC} and 23625@option{-fpic} without @option{-mfdpic}. You should never have to use 23626it explicitly. 23627 23628@item -mlinked-fp 23629@opindex mlinked-fp 23630 23631Follow the EABI requirement of always creating a frame pointer whenever 23632a stack frame is allocated. This option is enabled by default and can 23633be disabled with @option{-mno-linked-fp}. 23634 23635@item -mlong-calls 23636@opindex mlong-calls 23637 23638Use indirect addressing to call functions outside the current 23639compilation unit. This allows the functions to be placed anywhere 23640within the 32-bit address space. 23641 23642@item -malign-labels 23643@opindex malign-labels 23644 23645Try to align labels to an 8-byte boundary by inserting NOPs into the 23646previous packet. This option only has an effect when VLIW packing 23647is enabled. It doesn't create new packets; it merely adds NOPs to 23648existing ones. 23649 23650@item -mlibrary-pic 23651@opindex mlibrary-pic 23652 23653Generate position-independent EABI code. 23654 23655@item -macc-4 23656@opindex macc-4 23657 23658Use only the first four media accumulator registers. 23659 23660@item -macc-8 23661@opindex macc-8 23662 23663Use all eight media accumulator registers. 23664 23665@item -mpack 23666@opindex mpack 23667 23668Pack VLIW instructions. 23669 23670@item -mno-pack 23671@opindex mno-pack 23672 23673Do not pack VLIW instructions. 23674 23675@item -mno-eflags 23676@opindex mno-eflags 23677 23678Do not mark ABI switches in e_flags. 23679 23680@item -mcond-move 23681@opindex mcond-move 23682 23683Enable the use of conditional-move instructions (default). 23684 23685This switch is mainly for debugging the compiler and will likely be removed 23686in a future version. 23687 23688@item -mno-cond-move 23689@opindex mno-cond-move 23690 23691Disable the use of conditional-move instructions. 23692 23693This switch is mainly for debugging the compiler and will likely be removed 23694in a future version. 23695 23696@item -mscc 23697@opindex mscc 23698 23699Enable the use of conditional set instructions (default). 23700 23701This switch is mainly for debugging the compiler and will likely be removed 23702in a future version. 23703 23704@item -mno-scc 23705@opindex mno-scc 23706 23707Disable the use of conditional set instructions. 23708 23709This switch is mainly for debugging the compiler and will likely be removed 23710in a future version. 23711 23712@item -mcond-exec 23713@opindex mcond-exec 23714 23715Enable the use of conditional execution (default). 23716 23717This switch is mainly for debugging the compiler and will likely be removed 23718in a future version. 23719 23720@item -mno-cond-exec 23721@opindex mno-cond-exec 23722 23723Disable the use of conditional execution. 23724 23725This switch is mainly for debugging the compiler and will likely be removed 23726in a future version. 23727 23728@item -mvliw-branch 23729@opindex mvliw-branch 23730 23731Run a pass to pack branches into VLIW instructions (default). 23732 23733This switch is mainly for debugging the compiler and will likely be removed 23734in a future version. 23735 23736@item -mno-vliw-branch 23737@opindex mno-vliw-branch 23738 23739Do not run a pass to pack branches into VLIW instructions. 23740 23741This switch is mainly for debugging the compiler and will likely be removed 23742in a future version. 23743 23744@item -mmulti-cond-exec 23745@opindex mmulti-cond-exec 23746 23747Enable optimization of @code{&&} and @code{||} in conditional execution 23748(default). 23749 23750This switch is mainly for debugging the compiler and will likely be removed 23751in a future version. 23752 23753@item -mno-multi-cond-exec 23754@opindex mno-multi-cond-exec 23755 23756Disable optimization of @code{&&} and @code{||} in conditional execution. 23757 23758This switch is mainly for debugging the compiler and will likely be removed 23759in a future version. 23760 23761@item -mnested-cond-exec 23762@opindex mnested-cond-exec 23763 23764Enable nested conditional execution optimizations (default). 23765 23766This switch is mainly for debugging the compiler and will likely be removed 23767in a future version. 23768 23769@item -mno-nested-cond-exec 23770@opindex mno-nested-cond-exec 23771 23772Disable nested conditional execution optimizations. 23773 23774This switch is mainly for debugging the compiler and will likely be removed 23775in a future version. 23776 23777@item -moptimize-membar 23778@opindex moptimize-membar 23779 23780This switch removes redundant @code{membar} instructions from the 23781compiler-generated code. It is enabled by default. 23782 23783@item -mno-optimize-membar 23784@opindex mno-optimize-membar 23785@opindex moptimize-membar 23786 23787This switch disables the automatic removal of redundant @code{membar} 23788instructions from the generated code. 23789 23790@item -mtomcat-stats 23791@opindex mtomcat-stats 23792 23793Cause gas to print out tomcat statistics. 23794 23795@item -mcpu=@var{cpu} 23796@opindex mcpu 23797 23798Select the processor type for which to generate code. Possible values are 23799@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 23800@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 23801 23802@end table 23803 23804@node GNU/Linux Options 23805@subsection GNU/Linux Options 23806 23807These @samp{-m} options are defined for GNU/Linux targets: 23808 23809@table @gcctabopt 23810@item -mglibc 23811@opindex mglibc 23812Use the GNU C library. This is the default except 23813on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and 23814@samp{*-*-linux-*android*} targets. 23815 23816@item -muclibc 23817@opindex muclibc 23818Use uClibc C library. This is the default on 23819@samp{*-*-linux-*uclibc*} targets. 23820 23821@item -mmusl 23822@opindex mmusl 23823Use the musl C library. This is the default on 23824@samp{*-*-linux-*musl*} targets. 23825 23826@item -mbionic 23827@opindex mbionic 23828Use Bionic C library. This is the default on 23829@samp{*-*-linux-*android*} targets. 23830 23831@item -mandroid 23832@opindex mandroid 23833Compile code compatible with Android platform. This is the default on 23834@samp{*-*-linux-*android*} targets. 23835 23836When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 23837@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 23838this option makes the GCC driver pass Android-specific options to the linker. 23839Finally, this option causes the preprocessor macro @code{__ANDROID__} 23840to be defined. 23841 23842@item -tno-android-cc 23843@opindex tno-android-cc 23844Disable compilation effects of @option{-mandroid}, i.e., do not enable 23845@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 23846@option{-fno-rtti} by default. 23847 23848@item -tno-android-ld 23849@opindex tno-android-ld 23850Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 23851linking options to the linker. 23852 23853@end table 23854 23855@node H8/300 Options 23856@subsection H8/300 Options 23857 23858These @samp{-m} options are defined for the H8/300 implementations: 23859 23860@table @gcctabopt 23861@item -mrelax 23862@opindex mrelax 23863Shorten some address references at link time, when possible; uses the 23864linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 23865ld, Using ld}, for a fuller description. 23866 23867@item -mh 23868@opindex mh 23869Generate code for the H8/300H@. 23870 23871@item -ms 23872@opindex ms 23873Generate code for the H8S@. 23874 23875@item -mn 23876@opindex mn 23877Generate code for the H8S and H8/300H in the normal mode. This switch 23878must be used either with @option{-mh} or @option{-ms}. 23879 23880@item -ms2600 23881@opindex ms2600 23882Generate code for the H8S/2600. This switch must be used with @option{-ms}. 23883 23884@item -mexr 23885@opindex mexr 23886Extended registers are stored on stack before execution of function 23887with monitor attribute. Default option is @option{-mexr}. 23888This option is valid only for H8S targets. 23889 23890@item -mno-exr 23891@opindex mno-exr 23892@opindex mexr 23893Extended registers are not stored on stack before execution of function 23894with monitor attribute. Default option is @option{-mno-exr}. 23895This option is valid only for H8S targets. 23896 23897@item -mint32 23898@opindex mint32 23899Make @code{int} data 32 bits by default. 23900 23901@item -malign-300 23902@opindex malign-300 23903On the H8/300H and H8S, use the same alignment rules as for the H8/300. 23904The default for the H8/300H and H8S is to align longs and floats on 239054-byte boundaries. 23906@option{-malign-300} causes them to be aligned on 2-byte boundaries. 23907This option has no effect on the H8/300. 23908@end table 23909 23910@node HPPA Options 23911@subsection HPPA Options 23912@cindex HPPA Options 23913 23914These @samp{-m} options are defined for the HPPA family of computers: 23915 23916@table @gcctabopt 23917@item -march=@var{architecture-type} 23918@opindex march 23919Generate code for the specified architecture. The choices for 23920@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 239211.1, and @samp{2.0} for PA 2.0 processors. Refer to 23922@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 23923architecture option for your machine. Code compiled for lower numbered 23924architectures runs on higher numbered architectures, but not the 23925other way around. 23926 23927@item -mpa-risc-1-0 23928@itemx -mpa-risc-1-1 23929@itemx -mpa-risc-2-0 23930@opindex mpa-risc-1-0 23931@opindex mpa-risc-1-1 23932@opindex mpa-risc-2-0 23933Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 23934 23935@item -mcaller-copies 23936@opindex mcaller-copies 23937The caller copies function arguments passed by hidden reference. This 23938option should be used with care as it is not compatible with the default 2393932-bit runtime. However, only aggregates larger than eight bytes are 23940passed by hidden reference and the option provides better compatibility 23941with OpenMP. 23942 23943@item -mjump-in-delay 23944@opindex mjump-in-delay 23945This option is ignored and provided for compatibility purposes only. 23946 23947@item -mdisable-fpregs 23948@opindex mdisable-fpregs 23949Prevent floating-point registers from being used in any manner. This is 23950necessary for compiling kernels that perform lazy context switching of 23951floating-point registers. If you use this option and attempt to perform 23952floating-point operations, the compiler aborts. 23953 23954@item -mdisable-indexing 23955@opindex mdisable-indexing 23956Prevent the compiler from using indexing address modes. This avoids some 23957rather obscure problems when compiling MIG generated code under MACH@. 23958 23959@item -mno-space-regs 23960@opindex mno-space-regs 23961@opindex mspace-regs 23962Generate code that assumes the target has no space registers. This allows 23963GCC to generate faster indirect calls and use unscaled index address modes. 23964 23965Such code is suitable for level 0 PA systems and kernels. 23966 23967@item -mfast-indirect-calls 23968@opindex mfast-indirect-calls 23969Generate code that assumes calls never cross space boundaries. This 23970allows GCC to emit code that performs faster indirect calls. 23971 23972This option does not work in the presence of shared libraries or nested 23973functions. 23974 23975@item -mfixed-range=@var{register-range} 23976@opindex mfixed-range 23977Generate code treating the given register range as fixed registers. 23978A fixed register is one that the register allocator cannot use. This is 23979useful when compiling kernel code. A register range is specified as 23980two registers separated by a dash. Multiple register ranges can be 23981specified separated by a comma. 23982 23983@item -mlong-load-store 23984@opindex mlong-load-store 23985Generate 3-instruction load and store sequences as sometimes required by 23986the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 23987the HP compilers. 23988 23989@item -mportable-runtime 23990@opindex mportable-runtime 23991Use the portable calling conventions proposed by HP for ELF systems. 23992 23993@item -mgas 23994@opindex mgas 23995Enable the use of assembler directives only GAS understands. 23996 23997@item -mschedule=@var{cpu-type} 23998@opindex mschedule 23999Schedule code according to the constraints for the machine type 24000@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 24001@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 24002to @file{/usr/lib/sched.models} on an HP-UX system to determine the 24003proper scheduling option for your machine. The default scheduling is 24004@samp{8000}. 24005 24006@item -mlinker-opt 24007@opindex mlinker-opt 24008Enable the optimization pass in the HP-UX linker. Note this makes symbolic 24009debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 24010linkers in which they give bogus error messages when linking some programs. 24011 24012@item -msoft-float 24013@opindex msoft-float 24014Generate output containing library calls for floating point. 24015@strong{Warning:} the requisite libraries are not available for all HPPA 24016targets. Normally the facilities of the machine's usual C compiler are 24017used, but this cannot be done directly in cross-compilation. You must make 24018your own arrangements to provide suitable library functions for 24019cross-compilation. 24020 24021@option{-msoft-float} changes the calling convention in the output file; 24022therefore, it is only useful if you compile @emph{all} of a program with 24023this option. In particular, you need to compile @file{libgcc.a}, the 24024library that comes with GCC, with @option{-msoft-float} in order for 24025this to work. 24026 24027@item -msio 24028@opindex msio 24029Generate the predefine, @code{_SIO}, for server IO@. The default is 24030@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 24031@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 24032options are available under HP-UX and HI-UX@. 24033 24034@item -mgnu-ld 24035@opindex mgnu-ld 24036Use options specific to GNU @command{ld}. 24037This passes @option{-shared} to @command{ld} when 24038building a shared library. It is the default when GCC is configured, 24039explicitly or implicitly, with the GNU linker. This option does not 24040affect which @command{ld} is called; it only changes what parameters 24041are passed to that @command{ld}. 24042The @command{ld} that is called is determined by the 24043@option{--with-ld} configure option, GCC's program search path, and 24044finally by the user's @env{PATH}. The linker used by GCC can be printed 24045using @samp{which `gcc -print-prog-name=ld`}. This option is only available 24046on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 24047 24048@item -mhp-ld 24049@opindex mhp-ld 24050Use options specific to HP @command{ld}. 24051This passes @option{-b} to @command{ld} when building 24052a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 24053links. It is the default when GCC is configured, explicitly or 24054implicitly, with the HP linker. This option does not affect 24055which @command{ld} is called; it only changes what parameters are passed to that 24056@command{ld}. 24057The @command{ld} that is called is determined by the @option{--with-ld} 24058configure option, GCC's program search path, and finally by the user's 24059@env{PATH}. The linker used by GCC can be printed using @samp{which 24060`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 24061HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 24062 24063@item -mlong-calls 24064@opindex mno-long-calls 24065@opindex mlong-calls 24066Generate code that uses long call sequences. This ensures that a call 24067is always able to reach linker generated stubs. The default is to generate 24068long calls only when the distance from the call site to the beginning 24069of the function or translation unit, as the case may be, exceeds a 24070predefined limit set by the branch type being used. The limits for 24071normal calls are 7,600,000 and 240,000 bytes, respectively for the 24072PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 24073240,000 bytes. 24074 24075Distances are measured from the beginning of functions when using the 24076@option{-ffunction-sections} option, or when using the @option{-mgas} 24077and @option{-mno-portable-runtime} options together under HP-UX with 24078the SOM linker. 24079 24080It is normally not desirable to use this option as it degrades 24081performance. However, it may be useful in large applications, 24082particularly when partial linking is used to build the application. 24083 24084The types of long calls used depends on the capabilities of the 24085assembler and linker, and the type of code being generated. The 24086impact on systems that support long absolute calls, and long pic 24087symbol-difference or pc-relative calls should be relatively small. 24088However, an indirect call is used on 32-bit ELF systems in pic code 24089and it is quite long. 24090 24091@item -munix=@var{unix-std} 24092@opindex march 24093Generate compiler predefines and select a startfile for the specified 24094UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 24095and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 24096is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 2409711.11 and later. The default values are @samp{93} for HP-UX 10.00, 24098@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 24099and later. 24100 24101@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 24102@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 24103and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 24104@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 24105@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 24106@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 24107 24108It is @emph{important} to note that this option changes the interfaces 24109for various library routines. It also affects the operational behavior 24110of the C library. Thus, @emph{extreme} care is needed in using this 24111option. 24112 24113Library code that is intended to operate with more than one UNIX 24114standard must test, set and restore the variable @code{__xpg4_extended_mask} 24115as appropriate. Most GNU software doesn't provide this capability. 24116 24117@item -nolibdld 24118@opindex nolibdld 24119Suppress the generation of link options to search libdld.sl when the 24120@option{-static} option is specified on HP-UX 10 and later. 24121 24122@item -static 24123@opindex static 24124The HP-UX implementation of setlocale in libc has a dependency on 24125libdld.sl. There isn't an archive version of libdld.sl. Thus, 24126when the @option{-static} option is specified, special link options 24127are needed to resolve this dependency. 24128 24129On HP-UX 10 and later, the GCC driver adds the necessary options to 24130link with libdld.sl when the @option{-static} option is specified. 24131This causes the resulting binary to be dynamic. On the 64-bit port, 24132the linkers generate dynamic binaries by default in any case. The 24133@option{-nolibdld} option can be used to prevent the GCC driver from 24134adding these link options. 24135 24136@item -threads 24137@opindex threads 24138Add support for multithreading with the @dfn{dce thread} library 24139under HP-UX@. This option sets flags for both the preprocessor and 24140linker. 24141@end table 24142 24143@node IA-64 Options 24144@subsection IA-64 Options 24145@cindex IA-64 Options 24146 24147These are the @samp{-m} options defined for the Intel IA-64 architecture. 24148 24149@table @gcctabopt 24150@item -mbig-endian 24151@opindex mbig-endian 24152Generate code for a big-endian target. This is the default for HP-UX@. 24153 24154@item -mlittle-endian 24155@opindex mlittle-endian 24156Generate code for a little-endian target. This is the default for AIX5 24157and GNU/Linux. 24158 24159@item -mgnu-as 24160@itemx -mno-gnu-as 24161@opindex mgnu-as 24162@opindex mno-gnu-as 24163Generate (or don't) code for the GNU assembler. This is the default. 24164@c Also, this is the default if the configure option @option{--with-gnu-as} 24165@c is used. 24166 24167@item -mgnu-ld 24168@itemx -mno-gnu-ld 24169@opindex mgnu-ld 24170@opindex mno-gnu-ld 24171Generate (or don't) code for the GNU linker. This is the default. 24172@c Also, this is the default if the configure option @option{--with-gnu-ld} 24173@c is used. 24174 24175@item -mno-pic 24176@opindex mno-pic 24177Generate code that does not use a global pointer register. The result 24178is not position independent code, and violates the IA-64 ABI@. 24179 24180@item -mvolatile-asm-stop 24181@itemx -mno-volatile-asm-stop 24182@opindex mvolatile-asm-stop 24183@opindex mno-volatile-asm-stop 24184Generate (or don't) a stop bit immediately before and after volatile asm 24185statements. 24186 24187@item -mregister-names 24188@itemx -mno-register-names 24189@opindex mregister-names 24190@opindex mno-register-names 24191Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 24192the stacked registers. This may make assembler output more readable. 24193 24194@item -mno-sdata 24195@itemx -msdata 24196@opindex mno-sdata 24197@opindex msdata 24198Disable (or enable) optimizations that use the small data section. This may 24199be useful for working around optimizer bugs. 24200 24201@item -mconstant-gp 24202@opindex mconstant-gp 24203Generate code that uses a single constant global pointer value. This is 24204useful when compiling kernel code. 24205 24206@item -mauto-pic 24207@opindex mauto-pic 24208Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 24209This is useful when compiling firmware code. 24210 24211@item -minline-float-divide-min-latency 24212@opindex minline-float-divide-min-latency 24213Generate code for inline divides of floating-point values 24214using the minimum latency algorithm. 24215 24216@item -minline-float-divide-max-throughput 24217@opindex minline-float-divide-max-throughput 24218Generate code for inline divides of floating-point values 24219using the maximum throughput algorithm. 24220 24221@item -mno-inline-float-divide 24222@opindex mno-inline-float-divide 24223Do not generate inline code for divides of floating-point values. 24224 24225@item -minline-int-divide-min-latency 24226@opindex minline-int-divide-min-latency 24227Generate code for inline divides of integer values 24228using the minimum latency algorithm. 24229 24230@item -minline-int-divide-max-throughput 24231@opindex minline-int-divide-max-throughput 24232Generate code for inline divides of integer values 24233using the maximum throughput algorithm. 24234 24235@item -mno-inline-int-divide 24236@opindex mno-inline-int-divide 24237@opindex minline-int-divide 24238Do not generate inline code for divides of integer values. 24239 24240@item -minline-sqrt-min-latency 24241@opindex minline-sqrt-min-latency 24242Generate code for inline square roots 24243using the minimum latency algorithm. 24244 24245@item -minline-sqrt-max-throughput 24246@opindex minline-sqrt-max-throughput 24247Generate code for inline square roots 24248using the maximum throughput algorithm. 24249 24250@item -mno-inline-sqrt 24251@opindex mno-inline-sqrt 24252Do not generate inline code for @code{sqrt}. 24253 24254@item -mfused-madd 24255@itemx -mno-fused-madd 24256@opindex mfused-madd 24257@opindex mno-fused-madd 24258Do (don't) generate code that uses the fused multiply/add or multiply/subtract 24259instructions. The default is to use these instructions. 24260 24261@item -mno-dwarf2-asm 24262@itemx -mdwarf2-asm 24263@opindex mno-dwarf2-asm 24264@opindex mdwarf2-asm 24265Don't (or do) generate assembler code for the DWARF line number debugging 24266info. This may be useful when not using the GNU assembler. 24267 24268@item -mearly-stop-bits 24269@itemx -mno-early-stop-bits 24270@opindex mearly-stop-bits 24271@opindex mno-early-stop-bits 24272Allow stop bits to be placed earlier than immediately preceding the 24273instruction that triggered the stop bit. This can improve instruction 24274scheduling, but does not always do so. 24275 24276@item -mfixed-range=@var{register-range} 24277@opindex mfixed-range 24278Generate code treating the given register range as fixed registers. 24279A fixed register is one that the register allocator cannot use. This is 24280useful when compiling kernel code. A register range is specified as 24281two registers separated by a dash. Multiple register ranges can be 24282specified separated by a comma. 24283 24284@item -mtls-size=@var{tls-size} 24285@opindex mtls-size 24286Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 2428764. 24288 24289@item -mtune=@var{cpu-type} 24290@opindex mtune 24291Tune the instruction scheduling for a particular CPU, Valid values are 24292@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 24293and @samp{mckinley}. 24294 24295@item -milp32 24296@itemx -mlp64 24297@opindex milp32 24298@opindex mlp64 24299Generate code for a 32-bit or 64-bit environment. 24300The 32-bit environment sets int, long and pointer to 32 bits. 24301The 64-bit environment sets int to 32 bits and long and pointer 24302to 64 bits. These are HP-UX specific flags. 24303 24304@item -mno-sched-br-data-spec 24305@itemx -msched-br-data-spec 24306@opindex mno-sched-br-data-spec 24307@opindex msched-br-data-spec 24308(Dis/En)able data speculative scheduling before reload. 24309This results in generation of @code{ld.a} instructions and 24310the corresponding check instructions (@code{ld.c} / @code{chk.a}). 24311The default setting is disabled. 24312 24313@item -msched-ar-data-spec 24314@itemx -mno-sched-ar-data-spec 24315@opindex msched-ar-data-spec 24316@opindex mno-sched-ar-data-spec 24317(En/Dis)able data speculative scheduling after reload. 24318This results in generation of @code{ld.a} instructions and 24319the corresponding check instructions (@code{ld.c} / @code{chk.a}). 24320The default setting is enabled. 24321 24322@item -mno-sched-control-spec 24323@itemx -msched-control-spec 24324@opindex mno-sched-control-spec 24325@opindex msched-control-spec 24326(Dis/En)able control speculative scheduling. This feature is 24327available only during region scheduling (i.e.@: before reload). 24328This results in generation of the @code{ld.s} instructions and 24329the corresponding check instructions @code{chk.s}. 24330The default setting is disabled. 24331 24332@item -msched-br-in-data-spec 24333@itemx -mno-sched-br-in-data-spec 24334@opindex msched-br-in-data-spec 24335@opindex mno-sched-br-in-data-spec 24336(En/Dis)able speculative scheduling of the instructions that 24337are dependent on the data speculative loads before reload. 24338This is effective only with @option{-msched-br-data-spec} enabled. 24339The default setting is enabled. 24340 24341@item -msched-ar-in-data-spec 24342@itemx -mno-sched-ar-in-data-spec 24343@opindex msched-ar-in-data-spec 24344@opindex mno-sched-ar-in-data-spec 24345(En/Dis)able speculative scheduling of the instructions that 24346are dependent on the data speculative loads after reload. 24347This is effective only with @option{-msched-ar-data-spec} enabled. 24348The default setting is enabled. 24349 24350@item -msched-in-control-spec 24351@itemx -mno-sched-in-control-spec 24352@opindex msched-in-control-spec 24353@opindex mno-sched-in-control-spec 24354(En/Dis)able speculative scheduling of the instructions that 24355are dependent on the control speculative loads. 24356This is effective only with @option{-msched-control-spec} enabled. 24357The default setting is enabled. 24358 24359@item -mno-sched-prefer-non-data-spec-insns 24360@itemx -msched-prefer-non-data-spec-insns 24361@opindex mno-sched-prefer-non-data-spec-insns 24362@opindex msched-prefer-non-data-spec-insns 24363If enabled, data-speculative instructions are chosen for schedule 24364only if there are no other choices at the moment. This makes 24365the use of the data speculation much more conservative. 24366The default setting is disabled. 24367 24368@item -mno-sched-prefer-non-control-spec-insns 24369@itemx -msched-prefer-non-control-spec-insns 24370@opindex mno-sched-prefer-non-control-spec-insns 24371@opindex msched-prefer-non-control-spec-insns 24372If enabled, control-speculative instructions are chosen for schedule 24373only if there are no other choices at the moment. This makes 24374the use of the control speculation much more conservative. 24375The default setting is disabled. 24376 24377@item -mno-sched-count-spec-in-critical-path 24378@itemx -msched-count-spec-in-critical-path 24379@opindex mno-sched-count-spec-in-critical-path 24380@opindex msched-count-spec-in-critical-path 24381If enabled, speculative dependencies are considered during 24382computation of the instructions priorities. This makes the use of the 24383speculation a bit more conservative. 24384The default setting is disabled. 24385 24386@item -msched-spec-ldc 24387@opindex msched-spec-ldc 24388Use a simple data speculation check. This option is on by default. 24389 24390@item -msched-control-spec-ldc 24391@opindex msched-spec-ldc 24392Use a simple check for control speculation. This option is on by default. 24393 24394@item -msched-stop-bits-after-every-cycle 24395@opindex msched-stop-bits-after-every-cycle 24396Place a stop bit after every cycle when scheduling. This option is on 24397by default. 24398 24399@item -msched-fp-mem-deps-zero-cost 24400@opindex msched-fp-mem-deps-zero-cost 24401Assume that floating-point stores and loads are not likely to cause a conflict 24402when placed into the same instruction group. This option is disabled by 24403default. 24404 24405@item -msel-sched-dont-check-control-spec 24406@opindex msel-sched-dont-check-control-spec 24407Generate checks for control speculation in selective scheduling. 24408This flag is disabled by default. 24409 24410@item -msched-max-memory-insns=@var{max-insns} 24411@opindex msched-max-memory-insns 24412Limit on the number of memory insns per instruction group, giving lower 24413priority to subsequent memory insns attempting to schedule in the same 24414instruction group. Frequently useful to prevent cache bank conflicts. 24415The default value is 1. 24416 24417@item -msched-max-memory-insns-hard-limit 24418@opindex msched-max-memory-insns-hard-limit 24419Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 24420disallowing more than that number in an instruction group. 24421Otherwise, the limit is ``soft'', meaning that non-memory operations 24422are preferred when the limit is reached, but memory operations may still 24423be scheduled. 24424 24425@end table 24426 24427@node LM32 Options 24428@subsection LM32 Options 24429@cindex LM32 options 24430 24431These @option{-m} options are defined for the LatticeMico32 architecture: 24432 24433@table @gcctabopt 24434@item -mbarrel-shift-enabled 24435@opindex mbarrel-shift-enabled 24436Enable barrel-shift instructions. 24437 24438@item -mdivide-enabled 24439@opindex mdivide-enabled 24440Enable divide and modulus instructions. 24441 24442@item -mmultiply-enabled 24443@opindex multiply-enabled 24444Enable multiply instructions. 24445 24446@item -msign-extend-enabled 24447@opindex msign-extend-enabled 24448Enable sign extend instructions. 24449 24450@item -muser-enabled 24451@opindex muser-enabled 24452Enable user-defined instructions. 24453 24454@end table 24455 24456@node LoongArch Options 24457@subsection LoongArch Options 24458@cindex LoongArch Options 24459 24460These command-line options are defined for LoongArch targets: 24461 24462@table @gcctabopt 24463@item -march=@var{cpu-type} 24464@opindex -march 24465Generate instructions for the machine type @var{cpu-type}. In contrast to 24466@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 24467for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 24468to generate code that may not run at all on processors other than the one 24469indicated. Specifying @option{-march=@var{cpu-type}} implies 24470@option{-mtune=@var{cpu-type}}, except where noted otherwise. 24471 24472The choices for @var{cpu-type} are: 24473 24474@table @samp 24475@item native 24476This selects the CPU to generate code for at compilation time by determining 24477the processor type of the compiling machine. Using @option{-march=native} 24478enables all instruction subsets supported by the local machine (hence 24479the result might not run on different machines). Using @option{-mtune=native} 24480produces code optimized for the local machine under the constraints 24481of the selected instruction set. 24482@item loongarch64 24483A generic CPU with 64-bit extensions. 24484@item la464 24485LoongArch LA464 CPU with LBT, LSX, LASX, LVZ. 24486@end table 24487 24488@item -mtune=@var{cpu-type} 24489@opindex mtune 24490Optimize the output for the given processor, specified by microarchitecture 24491name. 24492 24493@item -mabi=@var{base-abi-type} 24494@opindex mabi 24495Generate code for the specified calling convention. 24496@var{base-abi-type} can be one of: 24497@table @samp 24498@item lp64d 24499Uses 64-bit general purpose registers and 32/64-bit floating-point 24500registers for parameter passing. Data model is LP64, where @samp{int} 24501is 32 bits, while @samp{long int} and pointers are 64 bits. 24502@item lp64f 24503Uses 64-bit general purpose registers and 32-bit floating-point 24504registers for parameter passing. Data model is LP64, where @samp{int} 24505is 32 bits, while @samp{long int} and pointers are 64 bits. 24506@item lp64s 24507Uses 64-bit general purpose registers and no floating-point 24508registers for parameter passing. Data model is LP64, where @samp{int} 24509is 32 bits, while @samp{long int} and pointers are 64 bits. 24510@end table 24511 24512@item -mfpu=@var{fpu-type} 24513@opindex mfpu 24514Generate code for the specified FPU type, which can be one of: 24515@table @samp 24516@item 64 24517Allow the use of hardware floating-point instructions for 32-bit 24518and 64-bit operations. 24519@item 32 24520Allow the use of hardware floating-point instructions for 32-bit 24521operations. 24522@item none 24523@item 0 24524Prevent the use of hardware floating-point instructions. 24525@end table 24526 24527@item -msoft-float 24528@opindex msoft-float 24529Force @option{-mfpu=none} and prevents the use of floating-point 24530registers for parameter passing. This option may change the target 24531ABI. 24532 24533@item -msingle-float 24534@opindex -msingle-float 24535Force @option{-mfpu=32} and allow the use of 32-bit floating-point 24536registers for parameter passing. This option may change the target 24537ABI. 24538 24539@item -mdouble-float 24540@opindex -mdouble-float 24541Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point 24542registers for parameter passing. This option may change the target 24543ABI. 24544 24545@item -mbranch-cost=@var{n} 24546@opindex -mbranch-cost 24547Set the cost of branches to roughly @var{n} instructions. 24548 24549@item -mcheck-zero-division 24550@itemx -mno-check-zero-divison 24551@opindex -mcheck-zero-division 24552Trap (do not trap) on integer division by zero. The default is 24553@option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and 24554@option{-mno-check-zero-division} for other optimization levels. 24555 24556@item -mcond-move-int 24557@itemx -mno-cond-move-int 24558@opindex -mcond-move-int 24559Conditional moves for integral data in general-purpose registers 24560are enabled (disabled). The default is @option{-mcond-move-int}. 24561 24562@item -mcond-move-float 24563@itemx -mno-cond-move-float 24564@opindex -mcond-move-float 24565Conditional moves for floating-point registers are enabled (disabled). 24566The default is @option{-mcond-move-float}. 24567 24568@item -mmemcpy 24569@itemx -mno-memcpy 24570@opindex -mmemcpy 24571Force (do not force) the use of @code{memcpy} for non-trivial block moves. 24572The default is @option{-mno-memcpy}, which allows GCC to inline most 24573constant-sized copies. Setting optimization level to @option{-Os} also 24574forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this 24575behavior if explicitly specified, regardless of the order these options on 24576the command line. 24577 24578@item -mstrict-align 24579@itemx -mno-strict-align 24580@opindex -mstrict-align 24581Avoid or allow generating memory accesses that may not be aligned on a natural 24582object boundary as described in the architecture specification. The default is 24583@option{-mno-strict-align}. 24584 24585@item -msmall-data-limit=@var{number} 24586@opindex -msmall-data-limit 24587Put global and static data smaller than @var{number} bytes into a special 24588section (on some targets). The default value is 0. 24589 24590@item -mmax-inline-memcpy-size=@var{n} 24591@opindex -mmax-inline-memcpy-size 24592Inline all block moves (such as calls to @code{memcpy} or structure copies) 24593less than or equal to @var{n} bytes. The default value of @var{n} is 1024. 24594 24595@item -mcmodel=@var{code-model} 24596Set the code model to one of: 24597@table @samp 24598@item tiny-static 24599@itemize @bullet 24600@item 24601local symbol and global strong symbol: The data section must be within +/-2MiB addressing space. 24602The text section must be within +/-128MiB addressing space. 24603@item 24604global weak symbol: The got table must be within +/-2GiB addressing space. 24605@end itemize 24606 24607@item tiny 24608@itemize @bullet 24609@item 24610local symbol: The data section must be within +/-2MiB addressing space. 24611The text section must be within +/-128MiB 24612addressing space. 24613@item 24614global symbol: The got table must be within +/-2GiB addressing space. 24615@end itemize 24616 24617@item normal 24618@itemize @bullet 24619@item 24620local symbol: The data section must be within +/-2GiB addressing space. 24621The text section must be within +/-128MiB addressing space. 24622@item 24623global symbol: The got table must be within +/-2GiB addressing space. 24624@end itemize 24625 24626@item large 24627@itemize @bullet 24628@item 24629local symbol: The data section must be within +/-2GiB addressing space. 24630The text section must be within +/-128GiB addressing space. 24631@item 24632global symbol: The got table must be within +/-2GiB addressing space. 24633@end itemize 24634 24635@item extreme(Not implemented yet) 24636@itemize @bullet 24637@item 24638local symbol: The data and text section must be within +/-8EiB addressing space. 24639@item 24640global symbol: The data got table must be within +/-8EiB addressing space. 24641@end itemize 24642@end table 24643The default code model is @code{normal}. 24644 24645@item -mrelax 24646@itemx -mno-relax 24647Take (do not take) advantage of linker relaxations. If 24648@option{-mpass-mrelax-to-as} is enabled, this option is also passed to 24649the assembler. The default is determined during GCC build-time by 24650detecting corresponding assembler support: 24651@option{-mrelax} if the assembler supports both the @option{-mrelax} 24652option and the conditional branch relaxation (it's required or the 24653@code{.align} directives and conditional branch instructions in the 24654assembly code outputted by GCC may be rejected by the assembler because 24655of a relocation overflow), @option{-mno-relax} otherwise. 24656 24657@item -mpass-mrelax-to-as 24658@itemx -mno-pass-mrelax-to-as 24659Pass (do not pass) the @option{-mrelax} or @option{-mno-relax} option 24660to the assembler. The default is determined during GCC build-time by 24661detecting corresponding assembler support: 24662@option{-mpass-mrelax-to-as} if the assembler supports the 24663@option{-mrelax} option, @option{-mno-pass-mrelax-to-as} otherwise. 24664This option is mostly useful for debugging, or interoperation with 24665assemblers different from the build-time one. 24666@end table 24667 24668@node M32C Options 24669@subsection M32C Options 24670@cindex M32C options 24671 24672@table @gcctabopt 24673@item -mcpu=@var{name} 24674@opindex mcpu= 24675Select the CPU for which code is generated. @var{name} may be one of 24676@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 24677/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 24678the M32C/80 series. 24679 24680@item -msim 24681@opindex msim 24682Specifies that the program will be run on the simulator. This causes 24683an alternate runtime library to be linked in which supports, for 24684example, file I/O@. You must not use this option when generating 24685programs that will run on real hardware; you must provide your own 24686runtime library for whatever I/O functions are needed. 24687 24688@item -memregs=@var{number} 24689@opindex memregs= 24690Specifies the number of memory-based pseudo-registers GCC uses 24691during code generation. These pseudo-registers are used like real 24692registers, so there is a tradeoff between GCC's ability to fit the 24693code into available registers, and the performance penalty of using 24694memory instead of registers. Note that all modules in a program must 24695be compiled with the same value for this option. Because of that, you 24696must not use this option with GCC's default runtime libraries. 24697 24698@end table 24699 24700@node M32R/D Options 24701@subsection M32R/D Options 24702@cindex M32R/D options 24703 24704These @option{-m} options are defined for Renesas M32R/D architectures: 24705 24706@table @gcctabopt 24707@item -m32r2 24708@opindex m32r2 24709Generate code for the M32R/2@. 24710 24711@item -m32rx 24712@opindex m32rx 24713Generate code for the M32R/X@. 24714 24715@item -m32r 24716@opindex m32r 24717Generate code for the M32R@. This is the default. 24718 24719@item -mmodel=small 24720@opindex mmodel=small 24721Assume all objects live in the lower 16MB of memory (so that their addresses 24722can be loaded with the @code{ld24} instruction), and assume all subroutines 24723are reachable with the @code{bl} instruction. 24724This is the default. 24725 24726The addressability of a particular object can be set with the 24727@code{model} attribute. 24728 24729@item -mmodel=medium 24730@opindex mmodel=medium 24731Assume objects may be anywhere in the 32-bit address space (the compiler 24732generates @code{seth/add3} instructions to load their addresses), and 24733assume all subroutines are reachable with the @code{bl} instruction. 24734 24735@item -mmodel=large 24736@opindex mmodel=large 24737Assume objects may be anywhere in the 32-bit address space (the compiler 24738generates @code{seth/add3} instructions to load their addresses), and 24739assume subroutines may not be reachable with the @code{bl} instruction 24740(the compiler generates the much slower @code{seth/add3/jl} 24741instruction sequence). 24742 24743@item -msdata=none 24744@opindex msdata=none 24745Disable use of the small data area. Variables are put into 24746one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 24747@code{section} attribute has been specified). 24748This is the default. 24749 24750The small data area consists of sections @code{.sdata} and @code{.sbss}. 24751Objects may be explicitly put in the small data area with the 24752@code{section} attribute using one of these sections. 24753 24754@item -msdata=sdata 24755@opindex msdata=sdata 24756Put small global and static data in the small data area, but do not 24757generate special code to reference them. 24758 24759@item -msdata=use 24760@opindex msdata=use 24761Put small global and static data in the small data area, and generate 24762special instructions to reference them. 24763 24764@item -G @var{num} 24765@opindex G 24766@cindex smaller data references 24767Put global and static objects less than or equal to @var{num} bytes 24768into the small data or BSS sections instead of the normal data or BSS 24769sections. The default value of @var{num} is 8. 24770The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 24771for this option to have any effect. 24772 24773All modules should be compiled with the same @option{-G @var{num}} value. 24774Compiling with different values of @var{num} may or may not work; if it 24775doesn't the linker gives an error message---incorrect code is not 24776generated. 24777 24778@item -mdebug 24779@opindex mdebug 24780Makes the M32R-specific code in the compiler display some statistics 24781that might help in debugging programs. 24782 24783@item -malign-loops 24784@opindex malign-loops 24785Align all loops to a 32-byte boundary. 24786 24787@item -mno-align-loops 24788@opindex mno-align-loops 24789Do not enforce a 32-byte alignment for loops. This is the default. 24790 24791@item -missue-rate=@var{number} 24792@opindex missue-rate=@var{number} 24793Issue @var{number} instructions per cycle. @var{number} can only be 1 24794or 2. 24795 24796@item -mbranch-cost=@var{number} 24797@opindex mbranch-cost=@var{number} 24798@var{number} can only be 1 or 2. If it is 1 then branches are 24799preferred over conditional code, if it is 2, then the opposite applies. 24800 24801@item -mflush-trap=@var{number} 24802@opindex mflush-trap=@var{number} 24803Specifies the trap number to use to flush the cache. The default is 2480412. Valid numbers are between 0 and 15 inclusive. 24805 24806@item -mno-flush-trap 24807@opindex mno-flush-trap 24808Specifies that the cache cannot be flushed by using a trap. 24809 24810@item -mflush-func=@var{name} 24811@opindex mflush-func=@var{name} 24812Specifies the name of the operating system function to call to flush 24813the cache. The default is @samp{_flush_cache}, but a function call 24814is only used if a trap is not available. 24815 24816@item -mno-flush-func 24817@opindex mno-flush-func 24818Indicates that there is no OS function for flushing the cache. 24819 24820@end table 24821 24822@node M680x0 Options 24823@subsection M680x0 Options 24824@cindex M680x0 options 24825 24826These are the @samp{-m} options defined for M680x0 and ColdFire processors. 24827The default settings depend on which architecture was selected when 24828the compiler was configured; the defaults for the most common choices 24829are given below. 24830 24831@table @gcctabopt 24832@item -march=@var{arch} 24833@opindex march 24834Generate code for a specific M680x0 or ColdFire instruction set 24835architecture. Permissible values of @var{arch} for M680x0 24836architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 24837@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 24838architectures are selected according to Freescale's ISA classification 24839and the permissible values are: @samp{isaa}, @samp{isaaplus}, 24840@samp{isab} and @samp{isac}. 24841 24842GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 24843code for a ColdFire target. The @var{arch} in this macro is one of the 24844@option{-march} arguments given above. 24845 24846When used together, @option{-march} and @option{-mtune} select code 24847that runs on a family of similar processors but that is optimized 24848for a particular microarchitecture. 24849 24850@item -mcpu=@var{cpu} 24851@opindex mcpu 24852Generate code for a specific M680x0 or ColdFire processor. 24853The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 24854@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 24855and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 24856below, which also classifies the CPUs into families: 24857 24858@multitable @columnfractions 0.20 0.80 24859@headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments} 24860@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} 24861@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 24862@item @samp{5206e} @tab @samp{5206e} 24863@item @samp{5208} @tab @samp{5207} @samp{5208} 24864@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 24865@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 24866@item @samp{5216} @tab @samp{5214} @samp{5216} 24867@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 24868@item @samp{5225} @tab @samp{5224} @samp{5225} 24869@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 24870@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 24871@item @samp{5249} @tab @samp{5249} 24872@item @samp{5250} @tab @samp{5250} 24873@item @samp{5271} @tab @samp{5270} @samp{5271} 24874@item @samp{5272} @tab @samp{5272} 24875@item @samp{5275} @tab @samp{5274} @samp{5275} 24876@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 24877@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 24878@item @samp{5307} @tab @samp{5307} 24879@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 24880@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 24881@item @samp{5407} @tab @samp{5407} 24882@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} 24883@end multitable 24884 24885@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 24886@var{arch} is compatible with @var{cpu}. Other combinations of 24887@option{-mcpu} and @option{-march} are rejected. 24888 24889GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 24890@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 24891where the value of @var{family} is given by the table above. 24892 24893@item -mtune=@var{tune} 24894@opindex mtune 24895Tune the code for a particular microarchitecture within the 24896constraints set by @option{-march} and @option{-mcpu}. 24897The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 24898@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 24899and @samp{cpu32}. The ColdFire microarchitectures 24900are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 24901 24902You can also use @option{-mtune=68020-40} for code that needs 24903to run relatively well on 68020, 68030 and 68040 targets. 24904@option{-mtune=68020-60} is similar but includes 68060 targets 24905as well. These two options select the same tuning decisions as 24906@option{-m68020-40} and @option{-m68020-60} respectively. 24907 24908GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 24909when tuning for 680x0 architecture @var{arch}. It also defines 24910@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 24911option is used. If GCC is tuning for a range of architectures, 24912as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 24913it defines the macros for every architecture in the range. 24914 24915GCC also defines the macro @code{__m@var{uarch}__} when tuning for 24916ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 24917of the arguments given above. 24918 24919@item -m68000 24920@itemx -mc68000 24921@opindex m68000 24922@opindex mc68000 24923Generate output for a 68000. This is the default 24924when the compiler is configured for 68000-based systems. 24925It is equivalent to @option{-march=68000}. 24926 24927Use this option for microcontrollers with a 68000 or EC000 core, 24928including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 24929 24930@item -m68010 24931@opindex m68010 24932Generate output for a 68010. This is the default 24933when the compiler is configured for 68010-based systems. 24934It is equivalent to @option{-march=68010}. 24935 24936@item -m68020 24937@itemx -mc68020 24938@opindex m68020 24939@opindex mc68020 24940Generate output for a 68020. This is the default 24941when the compiler is configured for 68020-based systems. 24942It is equivalent to @option{-march=68020}. 24943 24944@item -m68030 24945@opindex m68030 24946Generate output for a 68030. This is the default when the compiler is 24947configured for 68030-based systems. It is equivalent to 24948@option{-march=68030}. 24949 24950@item -m68040 24951@opindex m68040 24952Generate output for a 68040. This is the default when the compiler is 24953configured for 68040-based systems. It is equivalent to 24954@option{-march=68040}. 24955 24956This option inhibits the use of 68881/68882 instructions that have to be 24957emulated by software on the 68040. Use this option if your 68040 does not 24958have code to emulate those instructions. 24959 24960@item -m68060 24961@opindex m68060 24962Generate output for a 68060. This is the default when the compiler is 24963configured for 68060-based systems. It is equivalent to 24964@option{-march=68060}. 24965 24966This option inhibits the use of 68020 and 68881/68882 instructions that 24967have to be emulated by software on the 68060. Use this option if your 68060 24968does not have code to emulate those instructions. 24969 24970@item -mcpu32 24971@opindex mcpu32 24972Generate output for a CPU32. This is the default 24973when the compiler is configured for CPU32-based systems. 24974It is equivalent to @option{-march=cpu32}. 24975 24976Use this option for microcontrollers with a 24977CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 2497868336, 68340, 68341, 68349 and 68360. 24979 24980@item -m5200 24981@opindex m5200 24982Generate output for a 520X ColdFire CPU@. This is the default 24983when the compiler is configured for 520X-based systems. 24984It is equivalent to @option{-mcpu=5206}, and is now deprecated 24985in favor of that option. 24986 24987Use this option for microcontroller with a 5200 core, including 24988the MCF5202, MCF5203, MCF5204 and MCF5206. 24989 24990@item -m5206e 24991@opindex m5206e 24992Generate output for a 5206e ColdFire CPU@. The option is now 24993deprecated in favor of the equivalent @option{-mcpu=5206e}. 24994 24995@item -m528x 24996@opindex m528x 24997Generate output for a member of the ColdFire 528X family. 24998The option is now deprecated in favor of the equivalent 24999@option{-mcpu=528x}. 25000 25001@item -m5307 25002@opindex m5307 25003Generate output for a ColdFire 5307 CPU@. The option is now deprecated 25004in favor of the equivalent @option{-mcpu=5307}. 25005 25006@item -m5407 25007@opindex m5407 25008Generate output for a ColdFire 5407 CPU@. The option is now deprecated 25009in favor of the equivalent @option{-mcpu=5407}. 25010 25011@item -mcfv4e 25012@opindex mcfv4e 25013Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 25014This includes use of hardware floating-point instructions. 25015The option is equivalent to @option{-mcpu=547x}, and is now 25016deprecated in favor of that option. 25017 25018@item -m68020-40 25019@opindex m68020-40 25020Generate output for a 68040, without using any of the new instructions. 25021This results in code that can run relatively efficiently on either a 2502268020/68881 or a 68030 or a 68040. The generated code does use the 2502368881 instructions that are emulated on the 68040. 25024 25025The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 25026 25027@item -m68020-60 25028@opindex m68020-60 25029Generate output for a 68060, without using any of the new instructions. 25030This results in code that can run relatively efficiently on either a 2503168020/68881 or a 68030 or a 68040. The generated code does use the 2503268881 instructions that are emulated on the 68060. 25033 25034The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 25035 25036@item -mhard-float 25037@itemx -m68881 25038@opindex mhard-float 25039@opindex m68881 25040Generate floating-point instructions. This is the default for 68020 25041and above, and for ColdFire devices that have an FPU@. It defines the 25042macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 25043on ColdFire targets. 25044 25045@item -msoft-float 25046@opindex msoft-float 25047Do not generate floating-point instructions; use library calls instead. 25048This is the default for 68000, 68010, and 68832 targets. It is also 25049the default for ColdFire devices that have no FPU. 25050 25051@item -mdiv 25052@itemx -mno-div 25053@opindex mdiv 25054@opindex mno-div 25055Generate (do not generate) ColdFire hardware divide and remainder 25056instructions. If @option{-march} is used without @option{-mcpu}, 25057the default is ``on'' for ColdFire architectures and ``off'' for M680x0 25058architectures. Otherwise, the default is taken from the target CPU 25059(either the default CPU, or the one specified by @option{-mcpu}). For 25060example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 25061@option{-mcpu=5206e}. 25062 25063GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 25064 25065@item -mshort 25066@opindex mshort 25067Consider type @code{int} to be 16 bits wide, like @code{short int}. 25068Additionally, parameters passed on the stack are also aligned to a 2506916-bit boundary even on targets whose API mandates promotion to 32-bit. 25070 25071@item -mno-short 25072@opindex mno-short 25073Do not consider type @code{int} to be 16 bits wide. This is the default. 25074 25075@item -mnobitfield 25076@itemx -mno-bitfield 25077@opindex mnobitfield 25078@opindex mno-bitfield 25079Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 25080and @option{-m5200} options imply @w{@option{-mnobitfield}}. 25081 25082@item -mbitfield 25083@opindex mbitfield 25084Do use the bit-field instructions. The @option{-m68020} option implies 25085@option{-mbitfield}. This is the default if you use a configuration 25086designed for a 68020. 25087 25088@item -mrtd 25089@opindex mrtd 25090Use a different function-calling convention, in which functions 25091that take a fixed number of arguments return with the @code{rtd} 25092instruction, which pops their arguments while returning. This 25093saves one instruction in the caller since there is no need to pop 25094the arguments there. 25095 25096This calling convention is incompatible with the one normally 25097used on Unix, so you cannot use it if you need to call libraries 25098compiled with the Unix compiler. 25099 25100Also, you must provide function prototypes for all functions that 25101take variable numbers of arguments (including @code{printf}); 25102otherwise incorrect code is generated for calls to those 25103functions. 25104 25105In addition, seriously incorrect code results if you call a 25106function with too many arguments. (Normally, extra arguments are 25107harmlessly ignored.) 25108 25109The @code{rtd} instruction is supported by the 68010, 68020, 68030, 2511068040, 68060 and CPU32 processors, but not by the 68000 or 5200. 25111 25112The default is @option{-mno-rtd}. 25113 25114@item -malign-int 25115@itemx -mno-align-int 25116@opindex malign-int 25117@opindex mno-align-int 25118Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 25119@code{float}, @code{double}, and @code{long double} variables on a 32-bit 25120boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 25121Aligning variables on 32-bit boundaries produces code that runs somewhat 25122faster on processors with 32-bit busses at the expense of more memory. 25123 25124@strong{Warning:} if you use the @option{-malign-int} switch, GCC 25125aligns structures containing the above types differently than 25126most published application binary interface specifications for the m68k. 25127 25128@opindex mpcrel 25129Use the pc-relative addressing mode of the 68000 directly, instead of 25130using a global offset table. At present, this option implies @option{-fpic}, 25131allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 25132not presently supported with @option{-mpcrel}, though this could be supported for 2513368020 and higher processors. 25134 25135@item -mno-strict-align 25136@itemx -mstrict-align 25137@opindex mno-strict-align 25138@opindex mstrict-align 25139Do not (do) assume that unaligned memory references are handled by 25140the system. 25141 25142@item -msep-data 25143Generate code that allows the data segment to be located in a different 25144area of memory from the text segment. This allows for execute-in-place in 25145an environment without virtual memory management. This option implies 25146@option{-fPIC}. 25147 25148@item -mno-sep-data 25149Generate code that assumes that the data segment follows the text segment. 25150This is the default. 25151 25152@item -mid-shared-library 25153Generate code that supports shared libraries via the library ID method. 25154This allows for execute-in-place and shared libraries in an environment 25155without virtual memory management. This option implies @option{-fPIC}. 25156 25157@item -mno-id-shared-library 25158Generate code that doesn't assume ID-based shared libraries are being used. 25159This is the default. 25160 25161@item -mshared-library-id=n 25162Specifies the identification number of the ID-based shared library being 25163compiled. Specifying a value of 0 generates more compact code; specifying 25164other values forces the allocation of that number to the current 25165library, but is no more space- or time-efficient than omitting this option. 25166 25167@item -mxgot 25168@itemx -mno-xgot 25169@opindex mxgot 25170@opindex mno-xgot 25171When generating position-independent code for ColdFire, generate code 25172that works if the GOT has more than 8192 entries. This code is 25173larger and slower than code generated without this option. On M680x0 25174processors, this option is not needed; @option{-fPIC} suffices. 25175 25176GCC normally uses a single instruction to load values from the GOT@. 25177While this is relatively efficient, it only works if the GOT 25178is smaller than about 64k. Anything larger causes the linker 25179to report an error such as: 25180 25181@cindex relocation truncated to fit (ColdFire) 25182@smallexample 25183relocation truncated to fit: R_68K_GOT16O foobar 25184@end smallexample 25185 25186If this happens, you should recompile your code with @option{-mxgot}. 25187It should then work with very large GOTs. However, code generated with 25188@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 25189the value of a global symbol. 25190 25191Note that some linkers, including newer versions of the GNU linker, 25192can create multiple GOTs and sort GOT entries. If you have such a linker, 25193you should only need to use @option{-mxgot} when compiling a single 25194object file that accesses more than 8192 GOT entries. Very few do. 25195 25196These options have no effect unless GCC is generating 25197position-independent code. 25198 25199@item -mlong-jump-table-offsets 25200@opindex mlong-jump-table-offsets 25201Use 32-bit offsets in @code{switch} tables. The default is to use 2520216-bit offsets. 25203 25204@end table 25205 25206@node MCore Options 25207@subsection MCore Options 25208@cindex MCore options 25209 25210These are the @samp{-m} options defined for the Motorola M*Core 25211processors. 25212 25213@table @gcctabopt 25214 25215@item -mhardlit 25216@itemx -mno-hardlit 25217@opindex mhardlit 25218@opindex mno-hardlit 25219Inline constants into the code stream if it can be done in two 25220instructions or less. 25221 25222@item -mdiv 25223@itemx -mno-div 25224@opindex mdiv 25225@opindex mno-div 25226Use the divide instruction. (Enabled by default). 25227 25228@item -mrelax-immediate 25229@itemx -mno-relax-immediate 25230@opindex mrelax-immediate 25231@opindex mno-relax-immediate 25232Allow arbitrary-sized immediates in bit operations. 25233 25234@item -mwide-bitfields 25235@itemx -mno-wide-bitfields 25236@opindex mwide-bitfields 25237@opindex mno-wide-bitfields 25238Always treat bit-fields as @code{int}-sized. 25239 25240@item -m4byte-functions 25241@itemx -mno-4byte-functions 25242@opindex m4byte-functions 25243@opindex mno-4byte-functions 25244Force all functions to be aligned to a 4-byte boundary. 25245 25246@item -mcallgraph-data 25247@itemx -mno-callgraph-data 25248@opindex mcallgraph-data 25249@opindex mno-callgraph-data 25250Emit callgraph information. 25251 25252@item -mslow-bytes 25253@itemx -mno-slow-bytes 25254@opindex mslow-bytes 25255@opindex mno-slow-bytes 25256Prefer word access when reading byte quantities. 25257 25258@item -mlittle-endian 25259@itemx -mbig-endian 25260@opindex mlittle-endian 25261@opindex mbig-endian 25262Generate code for a little-endian target. 25263 25264@item -m210 25265@itemx -m340 25266@opindex m210 25267@opindex m340 25268Generate code for the 210 processor. 25269 25270@item -mno-lsim 25271@opindex mno-lsim 25272Assume that runtime support has been provided and so omit the 25273simulator library (@file{libsim.a)} from the linker command line. 25274 25275@item -mstack-increment=@var{size} 25276@opindex mstack-increment 25277Set the maximum amount for a single stack increment operation. Large 25278values can increase the speed of programs that contain functions 25279that need a large amount of stack space, but they can also trigger a 25280segmentation fault if the stack is extended too much. The default 25281value is 0x1000. 25282 25283@end table 25284 25285@node MeP Options 25286@subsection MeP Options 25287@cindex MeP options 25288 25289@table @gcctabopt 25290 25291@item -mabsdiff 25292@opindex mabsdiff 25293Enables the @code{abs} instruction, which is the absolute difference 25294between two registers. 25295 25296@item -mall-opts 25297@opindex mall-opts 25298Enables all the optional instructions---average, multiply, divide, bit 25299operations, leading zero, absolute difference, min/max, clip, and 25300saturation. 25301 25302 25303@item -maverage 25304@opindex maverage 25305Enables the @code{ave} instruction, which computes the average of two 25306registers. 25307 25308@item -mbased=@var{n} 25309@opindex mbased= 25310Variables of size @var{n} bytes or smaller are placed in the 25311@code{.based} section by default. Based variables use the @code{$tp} 25312register as a base register, and there is a 128-byte limit to the 25313@code{.based} section. 25314 25315@item -mbitops 25316@opindex mbitops 25317Enables the bit operation instructions---bit test (@code{btstm}), set 25318(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 25319test-and-set (@code{tas}). 25320 25321@item -mc=@var{name} 25322@opindex mc= 25323Selects which section constant data is placed in. @var{name} may 25324be @samp{tiny}, @samp{near}, or @samp{far}. 25325 25326@item -mclip 25327@opindex mclip 25328Enables the @code{clip} instruction. Note that @option{-mclip} is not 25329useful unless you also provide @option{-mminmax}. 25330 25331@item -mconfig=@var{name} 25332@opindex mconfig= 25333Selects one of the built-in core configurations. Each MeP chip has 25334one or more modules in it; each module has a core CPU and a variety of 25335coprocessors, optional instructions, and peripherals. The 25336@code{MeP-Integrator} tool, not part of GCC, provides these 25337configurations through this option; using this option is the same as 25338using all the corresponding command-line options. The default 25339configuration is @samp{default}. 25340 25341@item -mcop 25342@opindex mcop 25343Enables the coprocessor instructions. By default, this is a 32-bit 25344coprocessor. Note that the coprocessor is normally enabled via the 25345@option{-mconfig=} option. 25346 25347@item -mcop32 25348@opindex mcop32 25349Enables the 32-bit coprocessor's instructions. 25350 25351@item -mcop64 25352@opindex mcop64 25353Enables the 64-bit coprocessor's instructions. 25354 25355@item -mivc2 25356@opindex mivc2 25357Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 25358 25359@item -mdc 25360@opindex mdc 25361Causes constant variables to be placed in the @code{.near} section. 25362 25363@item -mdiv 25364@opindex mdiv 25365Enables the @code{div} and @code{divu} instructions. 25366 25367@item -meb 25368@opindex meb 25369Generate big-endian code. 25370 25371@item -mel 25372@opindex mel 25373Generate little-endian code. 25374 25375@item -mio-volatile 25376@opindex mio-volatile 25377Tells the compiler that any variable marked with the @code{io} 25378attribute is to be considered volatile. 25379 25380@item -ml 25381@opindex ml 25382Causes variables to be assigned to the @code{.far} section by default. 25383 25384@item -mleadz 25385@opindex mleadz 25386Enables the @code{leadz} (leading zero) instruction. 25387 25388@item -mm 25389@opindex mm 25390Causes variables to be assigned to the @code{.near} section by default. 25391 25392@item -mminmax 25393@opindex mminmax 25394Enables the @code{min} and @code{max} instructions. 25395 25396@item -mmult 25397@opindex mmult 25398Enables the multiplication and multiply-accumulate instructions. 25399 25400@item -mno-opts 25401@opindex mno-opts 25402Disables all the optional instructions enabled by @option{-mall-opts}. 25403 25404@item -mrepeat 25405@opindex mrepeat 25406Enables the @code{repeat} and @code{erepeat} instructions, used for 25407low-overhead looping. 25408 25409@item -ms 25410@opindex ms 25411Causes all variables to default to the @code{.tiny} section. Note 25412that there is a 65536-byte limit to this section. Accesses to these 25413variables use the @code{%gp} base register. 25414 25415@item -msatur 25416@opindex msatur 25417Enables the saturation instructions. Note that the compiler does not 25418currently generate these itself, but this option is included for 25419compatibility with other tools, like @code{as}. 25420 25421@item -msdram 25422@opindex msdram 25423Link the SDRAM-based runtime instead of the default ROM-based runtime. 25424 25425@item -msim 25426@opindex msim 25427Link the simulator run-time libraries. 25428 25429@item -msimnovec 25430@opindex msimnovec 25431Link the simulator runtime libraries, excluding built-in support 25432for reset and exception vectors and tables. 25433 25434@item -mtf 25435@opindex mtf 25436Causes all functions to default to the @code{.far} section. Without 25437this option, functions default to the @code{.near} section. 25438 25439@item -mtiny=@var{n} 25440@opindex mtiny= 25441Variables that are @var{n} bytes or smaller are allocated to the 25442@code{.tiny} section. These variables use the @code{$gp} base 25443register. The default for this option is 4, but note that there's a 2544465536-byte limit to the @code{.tiny} section. 25445 25446@end table 25447 25448@node MicroBlaze Options 25449@subsection MicroBlaze Options 25450@cindex MicroBlaze Options 25451 25452@table @gcctabopt 25453 25454@item -msoft-float 25455@opindex msoft-float 25456Use software emulation for floating point (default). 25457 25458@item -mhard-float 25459@opindex mhard-float 25460Use hardware floating-point instructions. 25461 25462@item -mmemcpy 25463@opindex mmemcpy 25464Do not optimize block moves, use @code{memcpy}. 25465 25466@item -mno-clearbss 25467@opindex mno-clearbss 25468This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 25469 25470@item -mcpu=@var{cpu-type} 25471@opindex mcpu= 25472Use features of, and schedule code for, the given CPU. 25473Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 25474where @var{X} is a major version, @var{YY} is the minor version, and 25475@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 25476@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}. 25477 25478@item -mxl-soft-mul 25479@opindex mxl-soft-mul 25480Use software multiply emulation (default). 25481 25482@item -mxl-soft-div 25483@opindex mxl-soft-div 25484Use software emulation for divides (default). 25485 25486@item -mxl-barrel-shift 25487@opindex mxl-barrel-shift 25488Use the hardware barrel shifter. 25489 25490@item -mxl-pattern-compare 25491@opindex mxl-pattern-compare 25492Use pattern compare instructions. 25493 25494@item -msmall-divides 25495@opindex msmall-divides 25496Use table lookup optimization for small signed integer divisions. 25497 25498@item -mxl-stack-check 25499@opindex mxl-stack-check 25500This option is deprecated. Use @option{-fstack-check} instead. 25501 25502@item -mxl-gp-opt 25503@opindex mxl-gp-opt 25504Use GP-relative @code{.sdata}/@code{.sbss} sections. 25505 25506@item -mxl-multiply-high 25507@opindex mxl-multiply-high 25508Use multiply high instructions for high part of 32x32 multiply. 25509 25510@item -mxl-float-convert 25511@opindex mxl-float-convert 25512Use hardware floating-point conversion instructions. 25513 25514@item -mxl-float-sqrt 25515@opindex mxl-float-sqrt 25516Use hardware floating-point square root instruction. 25517 25518@item -mbig-endian 25519@opindex mbig-endian 25520Generate code for a big-endian target. 25521 25522@item -mlittle-endian 25523@opindex mlittle-endian 25524Generate code for a little-endian target. 25525 25526@item -mxl-reorder 25527@opindex mxl-reorder 25528Use reorder instructions (swap and byte reversed load/store). 25529 25530@item -mxl-mode-@var{app-model} 25531Select application model @var{app-model}. Valid models are 25532@table @samp 25533@item executable 25534normal executable (default), uses startup code @file{crt0.o}. 25535 25536@item xmdstub 25537for use with Xilinx Microprocessor Debugger (XMD) based 25538software intrusive debug agent called xmdstub. This uses startup file 25539@file{crt1.o} and sets the start address of the program to 0x800. 25540 25541@item bootstrap 25542for applications that are loaded using a bootloader. 25543This model uses startup file @file{crt2.o} which does not contain a processor 25544reset vector handler. This is suitable for transferring control on a 25545processor reset to the bootloader rather than the application. 25546 25547@item novectors 25548for applications that do not require any of the 25549MicroBlaze vectors. This option may be useful for applications running 25550within a monitoring application. This model uses @file{crt3.o} as a startup file. 25551@end table 25552 25553Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 25554@option{-mxl-mode-@var{app-model}}. 25555 25556@item -mpic-data-is-text-relative 25557@opindex mpic-data-is-text-relative 25558Assume that the displacement between the text and data segments is fixed 25559at static link time. This allows data to be referenced by offset from start of 25560text address instead of GOT since PC-relative addressing is not supported. 25561 25562@end table 25563 25564@node MIPS Options 25565@subsection MIPS Options 25566@cindex MIPS options 25567 25568@table @gcctabopt 25569 25570@item -EB 25571@opindex EB 25572Generate big-endian code. 25573 25574@item -EL 25575@opindex EL 25576Generate little-endian code. This is the default for @samp{mips*el-*-*} 25577configurations. 25578 25579@item -march=@var{arch} 25580@opindex march 25581Generate code that runs on @var{arch}, which can be the name of a 25582generic MIPS ISA, or the name of a particular processor. 25583The ISA names are: 25584@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 25585@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 25586@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 25587@samp{mips64r5} and @samp{mips64r6}. 25588The processor names are: 25589@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 25590@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 25591@samp{5kc}, @samp{5kf}, 25592@samp{20kc}, 25593@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 25594@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 25595@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 25596@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 25597@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 25598@samp{i6400}, @samp{i6500}, 25599@samp{interaptiv}, 25600@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464}, 25601@samp{gs464e}, @samp{gs264e}, 25602@samp{m4k}, 25603@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 25604@samp{m5100}, @samp{m5101}, 25605@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 25606@samp{orion}, 25607@samp{p5600}, @samp{p6600}, 25608@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 25609@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900}, 25610@samp{r6000}, @samp{r8000}, 25611@samp{rm7000}, @samp{rm9000}, 25612@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 25613@samp{sb1}, 25614@samp{sr71000}, 25615@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 25616@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 25617@samp{xlr} and @samp{xlp}. 25618The special value @samp{from-abi} selects the 25619most compatible architecture for the selected ABI (that is, 25620@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 25621 25622The native Linux/GNU toolchain also supports the value @samp{native}, 25623which selects the best architecture option for the host processor. 25624@option{-march=native} has no effect if GCC does not recognize 25625the processor. 25626 25627In processor names, a final @samp{000} can be abbreviated as @samp{k} 25628(for example, @option{-march=r2k}). Prefixes are optional, and 25629@samp{vr} may be written @samp{r}. 25630 25631Names of the form @samp{@var{n}f2_1} refer to processors with 25632FPUs clocked at half the rate of the core, names of the form 25633@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 25634rate as the core, and names of the form @samp{@var{n}f3_2} refer to 25635processors with FPUs clocked a ratio of 3:2 with respect to the core. 25636For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 25637for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 25638accepted as synonyms for @samp{@var{n}f1_1}. 25639 25640GCC defines two macros based on the value of this option. The first 25641is @code{_MIPS_ARCH}, which gives the name of target architecture, as 25642a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 25643where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 25644For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 25645to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 25646 25647Note that the @code{_MIPS_ARCH} macro uses the processor names given 25648above. In other words, it has the full prefix and does not 25649abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 25650the macro names the resolved architecture (either @code{"mips1"} or 25651@code{"mips3"}). It names the default architecture when no 25652@option{-march} option is given. 25653 25654@item -mtune=@var{arch} 25655@opindex mtune 25656Optimize for @var{arch}. Among other things, this option controls 25657the way instructions are scheduled, and the perceived cost of arithmetic 25658operations. The list of @var{arch} values is the same as for 25659@option{-march}. 25660 25661When this option is not used, GCC optimizes for the processor 25662specified by @option{-march}. By using @option{-march} and 25663@option{-mtune} together, it is possible to generate code that 25664runs on a family of processors, but optimize the code for one 25665particular member of that family. 25666 25667@option{-mtune} defines the macros @code{_MIPS_TUNE} and 25668@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 25669@option{-march} ones described above. 25670 25671@item -mips1 25672@opindex mips1 25673Equivalent to @option{-march=mips1}. 25674 25675@item -mips2 25676@opindex mips2 25677Equivalent to @option{-march=mips2}. 25678 25679@item -mips3 25680@opindex mips3 25681Equivalent to @option{-march=mips3}. 25682 25683@item -mips4 25684@opindex mips4 25685Equivalent to @option{-march=mips4}. 25686 25687@item -mips32 25688@opindex mips32 25689Equivalent to @option{-march=mips32}. 25690 25691@item -mips32r3 25692@opindex mips32r3 25693Equivalent to @option{-march=mips32r3}. 25694 25695@item -mips32r5 25696@opindex mips32r5 25697Equivalent to @option{-march=mips32r5}. 25698 25699@item -mips32r6 25700@opindex mips32r6 25701Equivalent to @option{-march=mips32r6}. 25702 25703@item -mips64 25704@opindex mips64 25705Equivalent to @option{-march=mips64}. 25706 25707@item -mips64r2 25708@opindex mips64r2 25709Equivalent to @option{-march=mips64r2}. 25710 25711@item -mips64r3 25712@opindex mips64r3 25713Equivalent to @option{-march=mips64r3}. 25714 25715@item -mips64r5 25716@opindex mips64r5 25717Equivalent to @option{-march=mips64r5}. 25718 25719@item -mips64r6 25720@opindex mips64r6 25721Equivalent to @option{-march=mips64r6}. 25722 25723@item -mips16 25724@itemx -mno-mips16 25725@opindex mips16 25726@opindex mno-mips16 25727Generate (do not generate) MIPS16 code. If GCC is targeting a 25728MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 25729 25730MIPS16 code generation can also be controlled on a per-function basis 25731by means of @code{mips16} and @code{nomips16} attributes. 25732@xref{Function Attributes}, for more information. 25733 25734@item -mflip-mips16 25735@opindex mflip-mips16 25736Generate MIPS16 code on alternating functions. This option is provided 25737for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 25738not intended for ordinary use in compiling user code. 25739 25740@item -minterlink-compressed 25741@itemx -mno-interlink-compressed 25742@opindex minterlink-compressed 25743@opindex mno-interlink-compressed 25744Require (do not require) that code using the standard (uncompressed) MIPS ISA 25745be link-compatible with MIPS16 and microMIPS code, and vice versa. 25746 25747For example, code using the standard ISA encoding cannot jump directly 25748to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 25749@option{-minterlink-compressed} therefore disables direct jumps unless GCC 25750knows that the target of the jump is not compressed. 25751 25752@item -minterlink-mips16 25753@itemx -mno-interlink-mips16 25754@opindex minterlink-mips16 25755@opindex mno-interlink-mips16 25756Aliases of @option{-minterlink-compressed} and 25757@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 25758and are retained for backwards compatibility. 25759 25760@item -mabi=32 25761@itemx -mabi=o64 25762@itemx -mabi=n32 25763@itemx -mabi=64 25764@itemx -mabi=eabi 25765@opindex mabi=32 25766@opindex mabi=o64 25767@opindex mabi=n32 25768@opindex mabi=64 25769@opindex mabi=eabi 25770Generate code for the given ABI@. 25771 25772Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 25773generates 64-bit code when you select a 64-bit architecture, but you 25774can use @option{-mgp32} to get 32-bit code instead. 25775 25776For information about the O64 ABI, see 25777@uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 25778 25779GCC supports a variant of the o32 ABI in which floating-point registers 25780are 64 rather than 32 bits wide. You can select this combination with 25781@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 25782and @code{mfhc1} instructions and is therefore only supported for 25783MIPS32R2, MIPS32R3 and MIPS32R5 processors. 25784 25785The register assignments for arguments and return values remain the 25786same, but each scalar value is passed in a single 64-bit register 25787rather than a pair of 32-bit registers. For example, scalar 25788floating-point values are returned in @samp{$f0} only, not a 25789@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 25790remains the same in that the even-numbered double-precision registers 25791are saved. 25792 25793Two additional variants of the o32 ABI are supported to enable 25794a transition from 32-bit to 64-bit registers. These are FPXX 25795(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 25796The FPXX extension mandates that all code must execute correctly 25797when run using 32-bit or 64-bit registers. The code can be interlinked 25798with either FP32 or FP64, but not both. 25799The FP64A extension is similar to the FP64 extension but forbids the 25800use of odd-numbered single-precision registers. This can be used 25801in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 25802processors and allows both FP32 and FP64A code to interlink and 25803run in the same process without changing FPU modes. 25804 25805@item -mabicalls 25806@itemx -mno-abicalls 25807@opindex mabicalls 25808@opindex mno-abicalls 25809Generate (do not generate) code that is suitable for SVR4-style 25810dynamic objects. @option{-mabicalls} is the default for SVR4-based 25811systems. 25812 25813@item -mshared 25814@itemx -mno-shared 25815Generate (do not generate) code that is fully position-independent, 25816and that can therefore be linked into shared libraries. This option 25817only affects @option{-mabicalls}. 25818 25819All @option{-mabicalls} code has traditionally been position-independent, 25820regardless of options like @option{-fPIC} and @option{-fpic}. However, 25821as an extension, the GNU toolchain allows executables to use absolute 25822accesses for locally-binding symbols. It can also use shorter GP 25823initialization sequences and generate direct calls to locally-defined 25824functions. This mode is selected by @option{-mno-shared}. 25825 25826@option{-mno-shared} depends on binutils 2.16 or higher and generates 25827objects that can only be linked by the GNU linker. However, the option 25828does not affect the ABI of the final executable; it only affects the ABI 25829of relocatable objects. Using @option{-mno-shared} generally makes 25830executables both smaller and quicker. 25831 25832@option{-mshared} is the default. 25833 25834@item -mplt 25835@itemx -mno-plt 25836@opindex mplt 25837@opindex mno-plt 25838Assume (do not assume) that the static and dynamic linkers 25839support PLTs and copy relocations. This option only affects 25840@option{-mno-shared -mabicalls}. For the n64 ABI, this option 25841has no effect without @option{-msym32}. 25842 25843You can make @option{-mplt} the default by configuring 25844GCC with @option{--with-mips-plt}. The default is 25845@option{-mno-plt} otherwise. 25846 25847@item -mxgot 25848@itemx -mno-xgot 25849@opindex mxgot 25850@opindex mno-xgot 25851Lift (do not lift) the usual restrictions on the size of the global 25852offset table. 25853 25854GCC normally uses a single instruction to load values from the GOT@. 25855While this is relatively efficient, it only works if the GOT 25856is smaller than about 64k. Anything larger causes the linker 25857to report an error such as: 25858 25859@cindex relocation truncated to fit (MIPS) 25860@smallexample 25861relocation truncated to fit: R_MIPS_GOT16 foobar 25862@end smallexample 25863 25864If this happens, you should recompile your code with @option{-mxgot}. 25865This works with very large GOTs, although the code is also 25866less efficient, since it takes three instructions to fetch the 25867value of a global symbol. 25868 25869Note that some linkers can create multiple GOTs. If you have such a 25870linker, you should only need to use @option{-mxgot} when a single object 25871file accesses more than 64k's worth of GOT entries. Very few do. 25872 25873These options have no effect unless GCC is generating position 25874independent code. 25875 25876@item -mgp32 25877@opindex mgp32 25878Assume that general-purpose registers are 32 bits wide. 25879 25880@item -mgp64 25881@opindex mgp64 25882Assume that general-purpose registers are 64 bits wide. 25883 25884@item -mfp32 25885@opindex mfp32 25886Assume that floating-point registers are 32 bits wide. 25887 25888@item -mfp64 25889@opindex mfp64 25890Assume that floating-point registers are 64 bits wide. 25891 25892@item -mfpxx 25893@opindex mfpxx 25894Do not assume the width of floating-point registers. 25895 25896@item -mhard-float 25897@opindex mhard-float 25898Use floating-point coprocessor instructions. 25899 25900@item -msoft-float 25901@opindex msoft-float 25902Do not use floating-point coprocessor instructions. Implement 25903floating-point calculations using library calls instead. 25904 25905@item -mno-float 25906@opindex mno-float 25907Equivalent to @option{-msoft-float}, but additionally asserts that the 25908program being compiled does not perform any floating-point operations. 25909This option is presently supported only by some bare-metal MIPS 25910configurations, where it may select a special set of libraries 25911that lack all floating-point support (including, for example, the 25912floating-point @code{printf} formats). 25913If code compiled with @option{-mno-float} accidentally contains 25914floating-point operations, it is likely to suffer a link-time 25915or run-time failure. 25916 25917@item -msingle-float 25918@opindex msingle-float 25919Assume that the floating-point coprocessor only supports single-precision 25920operations. 25921 25922@item -mdouble-float 25923@opindex mdouble-float 25924Assume that the floating-point coprocessor supports double-precision 25925operations. This is the default. 25926 25927@item -modd-spreg 25928@itemx -mno-odd-spreg 25929@opindex modd-spreg 25930@opindex mno-odd-spreg 25931Enable the use of odd-numbered single-precision floating-point registers 25932for the o32 ABI. This is the default for processors that are known to 25933support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 25934is set by default. 25935 25936@item -mabs=2008 25937@itemx -mabs=legacy 25938@opindex mabs=2008 25939@opindex mabs=legacy 25940These options control the treatment of the special not-a-number (NaN) 25941IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 25942@code{neg.@i{fmt}} machine instructions. 25943 25944By default or when @option{-mabs=legacy} is used the legacy 25945treatment is selected. In this case these instructions are considered 25946arithmetic and avoided where correct operation is required and the 25947input operand might be a NaN. A longer sequence of instructions that 25948manipulate the sign bit of floating-point datum manually is used 25949instead unless the @option{-ffinite-math-only} option has also been 25950specified. 25951 25952The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 25953this case these instructions are considered non-arithmetic and therefore 25954operating correctly in all cases, including in particular where the 25955input operand is a NaN. These instructions are therefore always used 25956for the respective operations. 25957 25958@item -mnan=2008 25959@itemx -mnan=legacy 25960@opindex mnan=2008 25961@opindex mnan=legacy 25962These options control the encoding of the special not-a-number (NaN) 25963IEEE 754 floating-point data. 25964 25965The @option{-mnan=legacy} option selects the legacy encoding. In this 25966case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 25967significand field being 0, whereas signaling NaNs (sNaNs) are denoted 25968by the first bit of their trailing significand field being 1. 25969 25970The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 25971this case qNaNs are denoted by the first bit of their trailing 25972significand field being 1, whereas sNaNs are denoted by the first bit of 25973their trailing significand field being 0. 25974 25975The default is @option{-mnan=legacy} unless GCC has been configured with 25976@option{--with-nan=2008}. 25977 25978@item -mllsc 25979@itemx -mno-llsc 25980@opindex mllsc 25981@opindex mno-llsc 25982Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 25983implement atomic memory built-in functions. When neither option is 25984specified, GCC uses the instructions if the target architecture 25985supports them. 25986 25987@option{-mllsc} is useful if the runtime environment can emulate the 25988instructions and @option{-mno-llsc} can be useful when compiling for 25989nonstandard ISAs. You can make either option the default by 25990configuring GCC with @option{--with-llsc} and @option{--without-llsc} 25991respectively. @option{--with-llsc} is the default for some 25992configurations; see the installation documentation for details. 25993 25994@item -mdsp 25995@itemx -mno-dsp 25996@opindex mdsp 25997@opindex mno-dsp 25998Use (do not use) revision 1 of the MIPS DSP ASE@. 25999@xref{MIPS DSP Built-in Functions}. This option defines the 26000preprocessor macro @code{__mips_dsp}. It also defines 26001@code{__mips_dsp_rev} to 1. 26002 26003@item -mdspr2 26004@itemx -mno-dspr2 26005@opindex mdspr2 26006@opindex mno-dspr2 26007Use (do not use) revision 2 of the MIPS DSP ASE@. 26008@xref{MIPS DSP Built-in Functions}. This option defines the 26009preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 26010It also defines @code{__mips_dsp_rev} to 2. 26011 26012@item -msmartmips 26013@itemx -mno-smartmips 26014@opindex msmartmips 26015@opindex mno-smartmips 26016Use (do not use) the MIPS SmartMIPS ASE. 26017 26018@item -mpaired-single 26019@itemx -mno-paired-single 26020@opindex mpaired-single 26021@opindex mno-paired-single 26022Use (do not use) paired-single floating-point instructions. 26023@xref{MIPS Paired-Single Support}. This option requires 26024hardware floating-point support to be enabled. 26025 26026@item -mdmx 26027@itemx -mno-mdmx 26028@opindex mdmx 26029@opindex mno-mdmx 26030Use (do not use) MIPS Digital Media Extension instructions. 26031This option can only be used when generating 64-bit code and requires 26032hardware floating-point support to be enabled. 26033 26034@item -mips3d 26035@itemx -mno-mips3d 26036@opindex mips3d 26037@opindex mno-mips3d 26038Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 26039The option @option{-mips3d} implies @option{-mpaired-single}. 26040 26041@item -mmicromips 26042@itemx -mno-micromips 26043@opindex mmicromips 26044@opindex mno-mmicromips 26045Generate (do not generate) microMIPS code. 26046 26047MicroMIPS code generation can also be controlled on a per-function basis 26048by means of @code{micromips} and @code{nomicromips} attributes. 26049@xref{Function Attributes}, for more information. 26050 26051@item -mmt 26052@itemx -mno-mt 26053@opindex mmt 26054@opindex mno-mt 26055Use (do not use) MT Multithreading instructions. 26056 26057@item -mmcu 26058@itemx -mno-mcu 26059@opindex mmcu 26060@opindex mno-mcu 26061Use (do not use) the MIPS MCU ASE instructions. 26062 26063@item -meva 26064@itemx -mno-eva 26065@opindex meva 26066@opindex mno-eva 26067Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 26068 26069@item -mvirt 26070@itemx -mno-virt 26071@opindex mvirt 26072@opindex mno-virt 26073Use (do not use) the MIPS Virtualization (VZ) instructions. 26074 26075@item -mxpa 26076@itemx -mno-xpa 26077@opindex mxpa 26078@opindex mno-xpa 26079Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 26080 26081@item -mcrc 26082@itemx -mno-crc 26083@opindex mcrc 26084@opindex mno-crc 26085Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions. 26086 26087@item -mginv 26088@itemx -mno-ginv 26089@opindex mginv 26090@opindex mno-ginv 26091Use (do not use) the MIPS Global INValidate (GINV) instructions. 26092 26093@item -mloongson-mmi 26094@itemx -mno-loongson-mmi 26095@opindex mloongson-mmi 26096@opindex mno-loongson-mmi 26097Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI). 26098 26099@item -mloongson-ext 26100@itemx -mno-loongson-ext 26101@opindex mloongson-ext 26102@opindex mno-loongson-ext 26103Use (do not use) the MIPS Loongson EXTensions (EXT) instructions. 26104 26105@item -mloongson-ext2 26106@itemx -mno-loongson-ext2 26107@opindex mloongson-ext2 26108@opindex mno-loongson-ext2 26109Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions. 26110 26111@item -mlong64 26112@opindex mlong64 26113Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 26114an explanation of the default and the way that the pointer size is 26115determined. 26116 26117@item -mlong32 26118@opindex mlong32 26119Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 26120 26121The default size of @code{int}s, @code{long}s and pointers depends on 26122the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 26123uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 2612432-bit @code{long}s. Pointers are the same size as @code{long}s, 26125or the same size as integer registers, whichever is smaller. 26126 26127@item -msym32 26128@itemx -mno-sym32 26129@opindex msym32 26130@opindex mno-sym32 26131Assume (do not assume) that all symbols have 32-bit values, regardless 26132of the selected ABI@. This option is useful in combination with 26133@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 26134to generate shorter and faster references to symbolic addresses. 26135 26136@item -G @var{num} 26137@opindex G 26138Put definitions of externally-visible data in a small data section 26139if that data is no bigger than @var{num} bytes. GCC can then generate 26140more efficient accesses to the data; see @option{-mgpopt} for details. 26141 26142The default @option{-G} option depends on the configuration. 26143 26144@item -mlocal-sdata 26145@itemx -mno-local-sdata 26146@opindex mlocal-sdata 26147@opindex mno-local-sdata 26148Extend (do not extend) the @option{-G} behavior to local data too, 26149such as to static variables in C@. @option{-mlocal-sdata} is the 26150default for all configurations. 26151 26152If the linker complains that an application is using too much small data, 26153you might want to try rebuilding the less performance-critical parts with 26154@option{-mno-local-sdata}. You might also want to build large 26155libraries with @option{-mno-local-sdata}, so that the libraries leave 26156more room for the main program. 26157 26158@item -mextern-sdata 26159@itemx -mno-extern-sdata 26160@opindex mextern-sdata 26161@opindex mno-extern-sdata 26162Assume (do not assume) that externally-defined data is in 26163a small data section if the size of that data is within the @option{-G} limit. 26164@option{-mextern-sdata} is the default for all configurations. 26165 26166If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 26167@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 26168that is no bigger than @var{num} bytes, you must make sure that @var{Var} 26169is placed in a small data section. If @var{Var} is defined by another 26170module, you must either compile that module with a high-enough 26171@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 26172definition. If @var{Var} is common, you must link the application 26173with a high-enough @option{-G} setting. 26174 26175The easiest way of satisfying these restrictions is to compile 26176and link every module with the same @option{-G} option. However, 26177you may wish to build a library that supports several different 26178small data limits. You can do this by compiling the library with 26179the highest supported @option{-G} setting and additionally using 26180@option{-mno-extern-sdata} to stop the library from making assumptions 26181about externally-defined data. 26182 26183@item -mgpopt 26184@itemx -mno-gpopt 26185@opindex mgpopt 26186@opindex mno-gpopt 26187Use (do not use) GP-relative accesses for symbols that are known to be 26188in a small data section; see @option{-G}, @option{-mlocal-sdata} and 26189@option{-mextern-sdata}. @option{-mgpopt} is the default for all 26190configurations. 26191 26192@option{-mno-gpopt} is useful for cases where the @code{$gp} register 26193might not hold the value of @code{_gp}. For example, if the code is 26194part of a library that might be used in a boot monitor, programs that 26195call boot monitor routines pass an unknown value in @code{$gp}. 26196(In such situations, the boot monitor itself is usually compiled 26197with @option{-G0}.) 26198 26199@option{-mno-gpopt} implies @option{-mno-local-sdata} and 26200@option{-mno-extern-sdata}. 26201 26202@item -membedded-data 26203@itemx -mno-embedded-data 26204@opindex membedded-data 26205@opindex mno-embedded-data 26206Allocate variables to the read-only data section first if possible, then 26207next in the small data section if possible, otherwise in data. This gives 26208slightly slower code than the default, but reduces the amount of RAM required 26209when executing, and thus may be preferred for some embedded systems. 26210 26211@item -muninit-const-in-rodata 26212@itemx -mno-uninit-const-in-rodata 26213@opindex muninit-const-in-rodata 26214@opindex mno-uninit-const-in-rodata 26215Put uninitialized @code{const} variables in the read-only data section. 26216This option is only meaningful in conjunction with @option{-membedded-data}. 26217 26218@item -mcode-readable=@var{setting} 26219@opindex mcode-readable 26220Specify whether GCC may generate code that reads from executable sections. 26221There are three possible settings: 26222 26223@table @gcctabopt 26224@item -mcode-readable=yes 26225Instructions may freely access executable sections. This is the 26226default setting. 26227 26228@item -mcode-readable=pcrel 26229MIPS16 PC-relative load instructions can access executable sections, 26230but other instructions must not do so. This option is useful on 4KSc 26231and 4KSd processors when the code TLBs have the Read Inhibit bit set. 26232It is also useful on processors that can be configured to have a dual 26233instruction/data SRAM interface and that, like the M4K, automatically 26234redirect PC-relative loads to the instruction RAM. 26235 26236@item -mcode-readable=no 26237Instructions must not access executable sections. This option can be 26238useful on targets that are configured to have a dual instruction/data 26239SRAM interface but that (unlike the M4K) do not automatically redirect 26240PC-relative loads to the instruction RAM. 26241@end table 26242 26243@item -msplit-addresses 26244@itemx -mno-split-addresses 26245@opindex msplit-addresses 26246@opindex mno-split-addresses 26247Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 26248relocation operators. This option has been superseded by 26249@option{-mexplicit-relocs} but is retained for backwards compatibility. 26250 26251@item -mexplicit-relocs 26252@itemx -mno-explicit-relocs 26253@opindex mexplicit-relocs 26254@opindex mno-explicit-relocs 26255Use (do not use) assembler relocation operators when dealing with symbolic 26256addresses. The alternative, selected by @option{-mno-explicit-relocs}, 26257is to use assembler macros instead. 26258 26259@option{-mexplicit-relocs} is the default if GCC was configured 26260to use an assembler that supports relocation operators. 26261 26262@item -mcheck-zero-division 26263@itemx -mno-check-zero-division 26264@opindex mcheck-zero-division 26265@opindex mno-check-zero-division 26266Trap (do not trap) on integer division by zero. 26267 26268The default is @option{-mcheck-zero-division}. 26269 26270@item -mdivide-traps 26271@itemx -mdivide-breaks 26272@opindex mdivide-traps 26273@opindex mdivide-breaks 26274MIPS systems check for division by zero by generating either a 26275conditional trap or a break instruction. Using traps results in 26276smaller code, but is only supported on MIPS II and later. Also, some 26277versions of the Linux kernel have a bug that prevents trap from 26278generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 26279allow conditional traps on architectures that support them and 26280@option{-mdivide-breaks} to force the use of breaks. 26281 26282The default is usually @option{-mdivide-traps}, but this can be 26283overridden at configure time using @option{--with-divide=breaks}. 26284Divide-by-zero checks can be completely disabled using 26285@option{-mno-check-zero-division}. 26286 26287@item -mload-store-pairs 26288@itemx -mno-load-store-pairs 26289@opindex mload-store-pairs 26290@opindex mno-load-store-pairs 26291Enable (disable) an optimization that pairs consecutive load or store 26292instructions to enable load/store bonding. This option is enabled by 26293default but only takes effect when the selected architecture is known 26294to support bonding. 26295 26296@item -munaligned-access 26297@itemx -mno-unaligned-access 26298@opindex munaligned-access 26299@opindex mno-unaligned-access 26300Enable (disable) direct unaligned access for MIPS Release 6. 26301MIPSr6 requires load/store unaligned-access support, 26302by hardware or trap&emulate. 26303So @option{-mno-unaligned-access} may be needed by kernel. 26304 26305@item -mmemcpy 26306@itemx -mno-memcpy 26307@opindex mmemcpy 26308@opindex mno-memcpy 26309Force (do not force) the use of @code{memcpy} for non-trivial block 26310moves. The default is @option{-mno-memcpy}, which allows GCC to inline 26311most constant-sized copies. 26312 26313@item -mlong-calls 26314@itemx -mno-long-calls 26315@opindex mlong-calls 26316@opindex mno-long-calls 26317Disable (do not disable) use of the @code{jal} instruction. Calling 26318functions using @code{jal} is more efficient but requires the caller 26319and callee to be in the same 256 megabyte segment. 26320 26321This option has no effect on abicalls code. The default is 26322@option{-mno-long-calls}. 26323 26324@item -mmad 26325@itemx -mno-mad 26326@opindex mmad 26327@opindex mno-mad 26328Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 26329instructions, as provided by the R4650 ISA@. 26330 26331@item -mimadd 26332@itemx -mno-imadd 26333@opindex mimadd 26334@opindex mno-imadd 26335Enable (disable) use of the @code{madd} and @code{msub} integer 26336instructions. The default is @option{-mimadd} on architectures 26337that support @code{madd} and @code{msub} except for the 74k 26338architecture where it was found to generate slower code. 26339 26340@item -mfused-madd 26341@itemx -mno-fused-madd 26342@opindex mfused-madd 26343@opindex mno-fused-madd 26344Enable (disable) use of the floating-point multiply-accumulate 26345instructions, when they are available. The default is 26346@option{-mfused-madd}. 26347 26348On the R8000 CPU when multiply-accumulate instructions are used, 26349the intermediate product is calculated to infinite precision 26350and is not subject to the FCSR Flush to Zero bit. This may be 26351undesirable in some circumstances. On other processors the result 26352is numerically identical to the equivalent computation using 26353separate multiply, add, subtract and negate instructions. 26354 26355@item -nocpp 26356@opindex nocpp 26357Tell the MIPS assembler to not run its preprocessor over user 26358assembler files (with a @samp{.s} suffix) when assembling them. 26359 26360@item -mfix-24k 26361@itemx -mno-fix-24k 26362@opindex mfix-24k 26363@opindex mno-fix-24k 26364Work around the 24K E48 (lost data on stores during refill) errata. 26365The workarounds are implemented by the assembler rather than by GCC@. 26366 26367@item -mfix-r4000 26368@itemx -mno-fix-r4000 26369@opindex mfix-r4000 26370@opindex mno-fix-r4000 26371Work around certain R4000 CPU errata: 26372@itemize @minus 26373@item 26374A double-word or a variable shift may give an incorrect result if executed 26375immediately after starting an integer division. 26376@item 26377A double-word or a variable shift may give an incorrect result if executed 26378while an integer multiplication is in progress. 26379@item 26380An integer division may give an incorrect result if started in a delay slot 26381of a taken branch or a jump. 26382@end itemize 26383 26384@item -mfix-r4400 26385@itemx -mno-fix-r4400 26386@opindex mfix-r4400 26387@opindex mno-fix-r4400 26388Work around certain R4400 CPU errata: 26389@itemize @minus 26390@item 26391A double-word or a variable shift may give an incorrect result if executed 26392immediately after starting an integer division. 26393@end itemize 26394 26395@item -mfix-r10000 26396@itemx -mno-fix-r10000 26397@opindex mfix-r10000 26398@opindex mno-fix-r10000 26399Work around certain R10000 errata: 26400@itemize @minus 26401@item 26402@code{ll}/@code{sc} sequences may not behave atomically on revisions 26403prior to 3.0. They may deadlock on revisions 2.6 and earlier. 26404@end itemize 26405 26406This option can only be used if the target architecture supports 26407branch-likely instructions. @option{-mfix-r10000} is the default when 26408@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 26409otherwise. 26410 26411@item -mfix-r5900 26412@itemx -mno-fix-r5900 26413@opindex mfix-r5900 26414Do not attempt to schedule the preceding instruction into the delay slot 26415of a branch instruction placed at the end of a short loop of six 26416instructions or fewer and always schedule a @code{nop} instruction there 26417instead. The short loop bug under certain conditions causes loops to 26418execute only once or twice, due to a hardware bug in the R5900 chip. The 26419workaround is implemented by the assembler rather than by GCC@. 26420 26421@item -mfix-rm7000 26422@itemx -mno-fix-rm7000 26423@opindex mfix-rm7000 26424Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 26425workarounds are implemented by the assembler rather than by GCC@. 26426 26427@item -mfix-vr4120 26428@itemx -mno-fix-vr4120 26429@opindex mfix-vr4120 26430Work around certain VR4120 errata: 26431@itemize @minus 26432@item 26433@code{dmultu} does not always produce the correct result. 26434@item 26435@code{div} and @code{ddiv} do not always produce the correct result if one 26436of the operands is negative. 26437@end itemize 26438The workarounds for the division errata rely on special functions in 26439@file{libgcc.a}. At present, these functions are only provided by 26440the @code{mips64vr*-elf} configurations. 26441 26442Other VR4120 errata require a NOP to be inserted between certain pairs of 26443instructions. These errata are handled by the assembler, not by GCC itself. 26444 26445@item -mfix-vr4130 26446@opindex mfix-vr4130 26447Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 26448workarounds are implemented by the assembler rather than by GCC, 26449although GCC avoids using @code{mflo} and @code{mfhi} if the 26450VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 26451instructions are available instead. 26452 26453@item -mfix-sb1 26454@itemx -mno-fix-sb1 26455@opindex mfix-sb1 26456Work around certain SB-1 CPU core errata. 26457(This flag currently works around the SB-1 revision 2 26458``F1'' and ``F2'' floating-point errata.) 26459 26460@item -mr10k-cache-barrier=@var{setting} 26461@opindex mr10k-cache-barrier 26462Specify whether GCC should insert cache barriers to avoid the 26463side effects of speculation on R10K processors. 26464 26465In common with many processors, the R10K tries to predict the outcome 26466of a conditional branch and speculatively executes instructions from 26467the ``taken'' branch. It later aborts these instructions if the 26468predicted outcome is wrong. However, on the R10K, even aborted 26469instructions can have side effects. 26470 26471This problem only affects kernel stores and, depending on the system, 26472kernel loads. As an example, a speculatively-executed store may load 26473the target memory into cache and mark the cache line as dirty, even if 26474the store itself is later aborted. If a DMA operation writes to the 26475same area of memory before the ``dirty'' line is flushed, the cached 26476data overwrites the DMA-ed data. See the R10K processor manual 26477for a full description, including other potential problems. 26478 26479One workaround is to insert cache barrier instructions before every memory 26480access that might be speculatively executed and that might have side 26481effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 26482controls GCC's implementation of this workaround. It assumes that 26483aborted accesses to any byte in the following regions does not have 26484side effects: 26485 26486@enumerate 26487@item 26488the memory occupied by the current function's stack frame; 26489 26490@item 26491the memory occupied by an incoming stack argument; 26492 26493@item 26494the memory occupied by an object with a link-time-constant address. 26495@end enumerate 26496 26497It is the kernel's responsibility to ensure that speculative 26498accesses to these regions are indeed safe. 26499 26500If the input program contains a function declaration such as: 26501 26502@smallexample 26503void foo (void); 26504@end smallexample 26505 26506then the implementation of @code{foo} must allow @code{j foo} and 26507@code{jal foo} to be executed speculatively. GCC honors this 26508restriction for functions it compiles itself. It expects non-GCC 26509functions (such as hand-written assembly code) to do the same. 26510 26511The option has three forms: 26512 26513@table @gcctabopt 26514@item -mr10k-cache-barrier=load-store 26515Insert a cache barrier before a load or store that might be 26516speculatively executed and that might have side effects even 26517if aborted. 26518 26519@item -mr10k-cache-barrier=store 26520Insert a cache barrier before a store that might be speculatively 26521executed and that might have side effects even if aborted. 26522 26523@item -mr10k-cache-barrier=none 26524Disable the insertion of cache barriers. This is the default setting. 26525@end table 26526 26527@item -mflush-func=@var{func} 26528@itemx -mno-flush-func 26529@opindex mflush-func 26530Specifies the function to call to flush the I and D caches, or to not 26531call any such function. If called, the function must take the same 26532arguments as the common @code{_flush_func}, that is, the address of the 26533memory range for which the cache is being flushed, the size of the 26534memory range, and the number 3 (to flush both caches). The default 26535depends on the target GCC was configured for, but commonly is either 26536@code{_flush_func} or @code{__cpu_flush}. 26537 26538@item mbranch-cost=@var{num} 26539@opindex mbranch-cost 26540Set the cost of branches to roughly @var{num} ``simple'' instructions. 26541This cost is only a heuristic and is not guaranteed to produce 26542consistent results across releases. A zero cost redundantly selects 26543the default, which is based on the @option{-mtune} setting. 26544 26545@item -mbranch-likely 26546@itemx -mno-branch-likely 26547@opindex mbranch-likely 26548@opindex mno-branch-likely 26549Enable or disable use of Branch Likely instructions, regardless of the 26550default for the selected architecture. By default, Branch Likely 26551instructions may be generated if they are supported by the selected 26552architecture. An exception is for the MIPS32 and MIPS64 architectures 26553and processors that implement those architectures; for those, Branch 26554Likely instructions are not be generated by default because the MIPS32 26555and MIPS64 architectures specifically deprecate their use. 26556 26557@item -mcompact-branches=never 26558@itemx -mcompact-branches=optimal 26559@itemx -mcompact-branches=always 26560@opindex mcompact-branches=never 26561@opindex mcompact-branches=optimal 26562@opindex mcompact-branches=always 26563These options control which form of branches will be generated. The 26564default is @option{-mcompact-branches=optimal}. 26565 26566The @option{-mcompact-branches=never} option ensures that compact branch 26567instructions will never be generated. 26568 26569The @option{-mcompact-branches=always} option ensures that a compact 26570branch instruction will be generated if available. If a compact branch 26571instruction is not available, a delay slot form of the branch will be 26572used instead. 26573 26574This option is supported from MIPS Release 6 onwards. 26575 26576The @option{-mcompact-branches=optimal} option will cause a delay slot 26577branch to be used if one is available in the current ISA and the delay 26578slot is successfully filled. If the delay slot is not filled, a compact 26579branch will be chosen if one is available. 26580 26581@item -mfp-exceptions 26582@itemx -mno-fp-exceptions 26583@opindex mfp-exceptions 26584Specifies whether FP exceptions are enabled. This affects how 26585FP instructions are scheduled for some processors. 26586The default is that FP exceptions are 26587enabled. 26588 26589For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 2659064-bit code, then we can use both FP pipes. Otherwise, we can only use one 26591FP pipe. 26592 26593@item -mvr4130-align 26594@itemx -mno-vr4130-align 26595@opindex mvr4130-align 26596The VR4130 pipeline is two-way superscalar, but can only issue two 26597instructions together if the first one is 8-byte aligned. When this 26598option is enabled, GCC aligns pairs of instructions that it 26599thinks should execute in parallel. 26600 26601This option only has an effect when optimizing for the VR4130. 26602It normally makes code faster, but at the expense of making it bigger. 26603It is enabled by default at optimization level @option{-O3}. 26604 26605@item -msynci 26606@itemx -mno-synci 26607@opindex msynci 26608Enable (disable) generation of @code{synci} instructions on 26609architectures that support it. The @code{synci} instructions (if 26610enabled) are generated when @code{__builtin___clear_cache} is 26611compiled. 26612 26613This option defaults to @option{-mno-synci}, but the default can be 26614overridden by configuring GCC with @option{--with-synci}. 26615 26616When compiling code for single processor systems, it is generally safe 26617to use @code{synci}. However, on many multi-core (SMP) systems, it 26618does not invalidate the instruction caches on all cores and may lead 26619to undefined behavior. 26620 26621@item -mrelax-pic-calls 26622@itemx -mno-relax-pic-calls 26623@opindex mrelax-pic-calls 26624Try to turn PIC calls that are normally dispatched via register 26625@code{$25} into direct calls. This is only possible if the linker can 26626resolve the destination at link time and if the destination is within 26627range for a direct call. 26628 26629@option{-mrelax-pic-calls} is the default if GCC was configured to use 26630an assembler and a linker that support the @code{.reloc} assembly 26631directive and @option{-mexplicit-relocs} is in effect. With 26632@option{-mno-explicit-relocs}, this optimization can be performed by the 26633assembler and the linker alone without help from the compiler. 26634 26635@item -mmcount-ra-address 26636@itemx -mno-mcount-ra-address 26637@opindex mmcount-ra-address 26638@opindex mno-mcount-ra-address 26639Emit (do not emit) code that allows @code{_mcount} to modify the 26640calling function's return address. When enabled, this option extends 26641the usual @code{_mcount} interface with a new @var{ra-address} 26642parameter, which has type @code{intptr_t *} and is passed in register 26643@code{$12}. @code{_mcount} can then modify the return address by 26644doing both of the following: 26645@itemize 26646@item 26647Returning the new address in register @code{$31}. 26648@item 26649Storing the new address in @code{*@var{ra-address}}, 26650if @var{ra-address} is nonnull. 26651@end itemize 26652 26653The default is @option{-mno-mcount-ra-address}. 26654 26655@item -mframe-header-opt 26656@itemx -mno-frame-header-opt 26657@opindex mframe-header-opt 26658Enable (disable) frame header optimization in the o32 ABI. When using the 26659o32 ABI, calling functions will allocate 16 bytes on the stack for the called 26660function to write out register arguments. When enabled, this optimization 26661will suppress the allocation of the frame header if it can be determined that 26662it is unused. 26663 26664This optimization is off by default at all optimization levels. 26665 26666@item -mlxc1-sxc1 26667@itemx -mno-lxc1-sxc1 26668@opindex mlxc1-sxc1 26669When applicable, enable (disable) the generation of @code{lwxc1}, 26670@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default. 26671 26672@item -mmadd4 26673@itemx -mno-madd4 26674@opindex mmadd4 26675When applicable, enable (disable) the generation of 4-operand @code{madd.s}, 26676@code{madd.d} and related instructions. Enabled by default. 26677 26678@end table 26679 26680@node MMIX Options 26681@subsection MMIX Options 26682@cindex MMIX Options 26683 26684These options are defined for the MMIX: 26685 26686@table @gcctabopt 26687@item -mlibfuncs 26688@itemx -mno-libfuncs 26689@opindex mlibfuncs 26690@opindex mno-libfuncs 26691Specify that intrinsic library functions are being compiled, passing all 26692values in registers, no matter the size. 26693 26694@item -mepsilon 26695@itemx -mno-epsilon 26696@opindex mepsilon 26697@opindex mno-epsilon 26698Generate floating-point comparison instructions that compare with respect 26699to the @code{rE} epsilon register. 26700 26701@item -mabi=mmixware 26702@itemx -mabi=gnu 26703@opindex mabi=mmixware 26704@opindex mabi=gnu 26705Generate code that passes function parameters and return values that (in 26706the called function) are seen as registers @code{$0} and up, as opposed to 26707the GNU ABI which uses global registers @code{$231} and up. 26708 26709@item -mzero-extend 26710@itemx -mno-zero-extend 26711@opindex mzero-extend 26712@opindex mno-zero-extend 26713When reading data from memory in sizes shorter than 64 bits, use (do not 26714use) zero-extending load instructions by default, rather than 26715sign-extending ones. 26716 26717@item -mknuthdiv 26718@itemx -mno-knuthdiv 26719@opindex mknuthdiv 26720@opindex mno-knuthdiv 26721Make the result of a division yielding a remainder have the same sign as 26722the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 26723remainder follows the sign of the dividend. Both methods are 26724arithmetically valid, the latter being almost exclusively used. 26725 26726@item -mtoplevel-symbols 26727@itemx -mno-toplevel-symbols 26728@opindex mtoplevel-symbols 26729@opindex mno-toplevel-symbols 26730Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 26731code can be used with the @code{PREFIX} assembly directive. 26732 26733@item -melf 26734@opindex melf 26735Generate an executable in the ELF format, rather than the default 26736@samp{mmo} format used by the @command{mmix} simulator. 26737 26738@item -mbranch-predict 26739@itemx -mno-branch-predict 26740@opindex mbranch-predict 26741@opindex mno-branch-predict 26742Use (do not use) the probable-branch instructions, when static branch 26743prediction indicates a probable branch. 26744 26745@item -mbase-addresses 26746@itemx -mno-base-addresses 26747@opindex mbase-addresses 26748@opindex mno-base-addresses 26749Generate (do not generate) code that uses @emph{base addresses}. Using a 26750base address automatically generates a request (handled by the assembler 26751and the linker) for a constant to be set up in a global register. The 26752register is used for one or more base address requests within the range 0 26753to 255 from the value held in the register. The generally leads to short 26754and fast code, but the number of different data items that can be 26755addressed is limited. This means that a program that uses lots of static 26756data may require @option{-mno-base-addresses}. 26757 26758@item -msingle-exit 26759@itemx -mno-single-exit 26760@opindex msingle-exit 26761@opindex mno-single-exit 26762Force (do not force) generated code to have a single exit point in each 26763function. 26764@end table 26765 26766@node MN10300 Options 26767@subsection MN10300 Options 26768@cindex MN10300 options 26769 26770These @option{-m} options are defined for Matsushita MN10300 architectures: 26771 26772@table @gcctabopt 26773@item -mmult-bug 26774@opindex mmult-bug 26775Generate code to avoid bugs in the multiply instructions for the MN10300 26776processors. This is the default. 26777 26778@item -mno-mult-bug 26779@opindex mno-mult-bug 26780Do not generate code to avoid bugs in the multiply instructions for the 26781MN10300 processors. 26782 26783@item -mam33 26784@opindex mam33 26785Generate code using features specific to the AM33 processor. 26786 26787@item -mno-am33 26788@opindex mno-am33 26789Do not generate code using features specific to the AM33 processor. This 26790is the default. 26791 26792@item -mam33-2 26793@opindex mam33-2 26794Generate code using features specific to the AM33/2.0 processor. 26795 26796@item -mam34 26797@opindex mam34 26798Generate code using features specific to the AM34 processor. 26799 26800@item -mtune=@var{cpu-type} 26801@opindex mtune 26802Use the timing characteristics of the indicated CPU type when 26803scheduling instructions. This does not change the targeted processor 26804type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 26805@samp{am33-2} or @samp{am34}. 26806 26807@item -mreturn-pointer-on-d0 26808@opindex mreturn-pointer-on-d0 26809When generating a function that returns a pointer, return the pointer 26810in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 26811only in @code{a0}, and attempts to call such functions without a prototype 26812result in errors. Note that this option is on by default; use 26813@option{-mno-return-pointer-on-d0} to disable it. 26814 26815@item -mno-crt0 26816@opindex mno-crt0 26817Do not link in the C run-time initialization object file. 26818 26819@item -mrelax 26820@opindex mrelax 26821Indicate to the linker that it should perform a relaxation optimization pass 26822to shorten branches, calls and absolute memory addresses. This option only 26823has an effect when used on the command line for the final link step. 26824 26825This option makes symbolic debugging impossible. 26826 26827@item -mliw 26828@opindex mliw 26829Allow the compiler to generate @emph{Long Instruction Word} 26830instructions if the target is the @samp{AM33} or later. This is the 26831default. This option defines the preprocessor macro @code{__LIW__}. 26832 26833@item -mno-liw 26834@opindex mno-liw 26835Do not allow the compiler to generate @emph{Long Instruction Word} 26836instructions. This option defines the preprocessor macro 26837@code{__NO_LIW__}. 26838 26839@item -msetlb 26840@opindex msetlb 26841Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 26842instructions if the target is the @samp{AM33} or later. This is the 26843default. This option defines the preprocessor macro @code{__SETLB__}. 26844 26845@item -mno-setlb 26846@opindex mno-setlb 26847Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 26848instructions. This option defines the preprocessor macro 26849@code{__NO_SETLB__}. 26850 26851@end table 26852 26853@node Moxie Options 26854@subsection Moxie Options 26855@cindex Moxie Options 26856 26857@table @gcctabopt 26858 26859@item -meb 26860@opindex meb 26861Generate big-endian code. This is the default for @samp{moxie-*-*} 26862configurations. 26863 26864@item -mel 26865@opindex mel 26866Generate little-endian code. 26867 26868@item -mmul.x 26869@opindex mmul.x 26870Generate mul.x and umul.x instructions. This is the default for 26871@samp{moxiebox-*-*} configurations. 26872 26873@item -mno-crt0 26874@opindex mno-crt0 26875Do not link in the C run-time initialization object file. 26876 26877@end table 26878 26879@node MSP430 Options 26880@subsection MSP430 Options 26881@cindex MSP430 Options 26882 26883These options are defined for the MSP430: 26884 26885@table @gcctabopt 26886 26887@item -masm-hex 26888@opindex masm-hex 26889Force assembly output to always use hex constants. Normally such 26890constants are signed decimals, but this option is available for 26891testsuite and/or aesthetic purposes. 26892 26893@item -mmcu= 26894@opindex mmcu= 26895Select the MCU to target. This is used to create a C preprocessor 26896symbol based upon the MCU name, converted to upper case and pre- and 26897post-fixed with @samp{__}. This in turn is used by the 26898@file{msp430.h} header file to select an MCU-specific supplementary 26899header file. 26900 26901The option also sets the ISA to use. If the MCU name is one that is 26902known to only support the 430 ISA then that is selected, otherwise the 26903430X ISA is selected. A generic MCU name of @samp{msp430} can also be 26904used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 26905name selects the 430X ISA. 26906 26907In addition an MCU-specific linker script is added to the linker 26908command line. The script's name is the name of the MCU with 26909@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 26910command line defines the C preprocessor symbol @code{__XXX__} and 26911cause the linker to search for a script called @file{xxx.ld}. 26912 26913The ISA and hardware multiply supported for the different MCUs is hard-coded 26914into GCC. However, an external @samp{devices.csv} file can be used to 26915extend device support beyond those that have been hard-coded. 26916 26917GCC searches for the @samp{devices.csv} file using the following methods in the 26918given precedence order, where the first method takes precendence over the 26919second which takes precedence over the third. 26920 26921@table @asis 26922@item Include path specified with @code{-I} and @code{-L} 26923@samp{devices.csv} will be searched for in each of the directories specified by 26924include paths and linker library search paths. 26925@item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR} 26926Define the value of the global environment variable 26927@samp{MSP430_GCC_INCLUDE_DIR} 26928to the full path to the directory containing devices.csv, and GCC will search 26929this directory for devices.csv. If devices.csv is found, this directory will 26930also be registered as an include path, and linker library path. Header files 26931and linker scripts in this directory can therefore be used without manually 26932specifying @code{-I} and @code{-L} on the command line. 26933@item The @samp{msp430-elf@{,bare@}/include/devices} directory 26934Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the 26935toolchain root directory. This directory does not exist in a default 26936installation, but if the user has created it and copied @samp{devices.csv} 26937there, then the MCU data will be read. As above, this directory will 26938also be registered as an include path, and linker library path. 26939 26940@end table 26941If none of the above search methods find @samp{devices.csv}, then the 26942hard-coded MCU data is used. 26943 26944 26945@item -mwarn-mcu 26946@itemx -mno-warn-mcu 26947@opindex mwarn-mcu 26948@opindex mno-warn-mcu 26949This option enables or disables warnings about conflicts between the 26950MCU name specified by the @option{-mmcu} option and the ISA set by the 26951@option{-mcpu} option and/or the hardware multiply support set by the 26952@option{-mhwmult} option. It also toggles warnings about unrecognized 26953MCU names. This option is on by default. 26954 26955@item -mcpu= 26956@opindex mcpu= 26957Specifies the ISA to use. Accepted values are @samp{msp430}, 26958@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 26959@option{-mmcu=} option should be used to select the ISA. 26960 26961@item -msim 26962@opindex msim 26963Link to the simulator runtime libraries and linker script. Overrides 26964any scripts that would be selected by the @option{-mmcu=} option. 26965 26966@item -mlarge 26967@opindex mlarge 26968Use large-model addressing (20-bit pointers, 20-bit @code{size_t}). 26969 26970@item -msmall 26971@opindex msmall 26972Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 26973 26974@item -mrelax 26975@opindex mrelax 26976This option is passed to the assembler and linker, and allows the 26977linker to perform certain optimizations that cannot be done until 26978the final link. 26979 26980@item mhwmult= 26981@opindex mhwmult= 26982Describes the type of hardware multiply supported by the target. 26983Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 26984for the original 16-bit-only multiply supported by early MCUs. 26985@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 26986@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 26987A value of @samp{auto} can also be given. This tells GCC to deduce 26988the hardware multiply support based upon the MCU name provided by the 26989@option{-mmcu} option. If no @option{-mmcu} option is specified or if 26990the MCU name is not recognized then no hardware multiply support is 26991assumed. @code{auto} is the default setting. 26992 26993Hardware multiplies are normally performed by calling a library 26994routine. This saves space in the generated code. When compiling at 26995@option{-O3} or higher however the hardware multiplier is invoked 26996inline. This makes for bigger, but faster code. 26997 26998The hardware multiply routines disable interrupts whilst running and 26999restore the previous interrupt state when they finish. This makes 27000them safe to use inside interrupt handlers as well as in normal code. 27001 27002@item -minrt 27003@opindex minrt 27004Enable the use of a minimum runtime environment - no static 27005initializers or constructors. This is intended for memory-constrained 27006devices. The compiler includes special symbols in some objects 27007that tell the linker and runtime which code fragments are required. 27008 27009@item -mtiny-printf 27010@opindex mtiny-printf 27011Enable reduced code size @code{printf} and @code{puts} library functions. 27012The @samp{tiny} implementations of these functions are not reentrant, so 27013must be used with caution in multi-threaded applications. 27014 27015Support for streams has been removed and the string to be printed will 27016always be sent to stdout via the @code{write} syscall. The string is not 27017buffered before it is sent to write. 27018 27019This option requires Newlib Nano IO, so GCC must be configured with 27020@samp{--enable-newlib-nano-formatted-io}. 27021 27022@item -mmax-inline-shift= 27023@opindex mmax-inline-shift= 27024This option takes an integer between 0 and 64 inclusive, and sets 27025the maximum number of inline shift instructions which should be emitted to 27026perform a shift operation by a constant amount. When this value needs to be 27027exceeded, an mspabi helper function is used instead. The default value is 4. 27028 27029This only affects cases where a shift by multiple positions cannot be 27030completed with a single instruction (e.g. all shifts >1 on the 430 ISA). 27031 27032Shifts of a 32-bit value are at least twice as costly, so the value passed for 27033this option is divided by 2 and the resulting value used instead. 27034 27035@item -mcode-region= 27036@itemx -mdata-region= 27037@opindex mcode-region 27038@opindex mdata-region 27039These options tell the compiler where to place functions and data that 27040do not have one of the @code{lower}, @code{upper}, @code{either} or 27041@code{section} attributes. Possible values are @code{lower}, 27042@code{upper}, @code{either} or @code{any}. The first three behave 27043like the corresponding attribute. The fourth possible value - 27044@code{any} - is the default. It leaves placement entirely up to the 27045linker script and how it assigns the standard sections 27046(@code{.text}, @code{.data}, etc) to the memory regions. 27047 27048@item -msilicon-errata= 27049@opindex msilicon-errata 27050This option passes on a request to assembler to enable the fixes for 27051the named silicon errata. 27052 27053@item -msilicon-errata-warn= 27054@opindex msilicon-errata-warn 27055This option passes on a request to the assembler to enable warning 27056messages when a silicon errata might need to be applied. 27057 27058@item -mwarn-devices-csv 27059@itemx -mno-warn-devices-csv 27060@opindex mwarn-devices-csv 27061@opindex mno-warn-devices-csv 27062Warn if @samp{devices.csv} is not found or there are problem parsing it 27063(default: on). 27064 27065@end table 27066 27067@node NDS32 Options 27068@subsection NDS32 Options 27069@cindex NDS32 Options 27070 27071These options are defined for NDS32 implementations: 27072 27073@table @gcctabopt 27074 27075@item -mbig-endian 27076@opindex mbig-endian 27077Generate code in big-endian mode. 27078 27079@item -mlittle-endian 27080@opindex mlittle-endian 27081Generate code in little-endian mode. 27082 27083@item -mreduced-regs 27084@opindex mreduced-regs 27085Use reduced-set registers for register allocation. 27086 27087@item -mfull-regs 27088@opindex mfull-regs 27089Use full-set registers for register allocation. 27090 27091@item -mcmov 27092@opindex mcmov 27093Generate conditional move instructions. 27094 27095@item -mno-cmov 27096@opindex mno-cmov 27097Do not generate conditional move instructions. 27098 27099@item -mext-perf 27100@opindex mext-perf 27101Generate performance extension instructions. 27102 27103@item -mno-ext-perf 27104@opindex mno-ext-perf 27105Do not generate performance extension instructions. 27106 27107@item -mext-perf2 27108@opindex mext-perf2 27109Generate performance extension 2 instructions. 27110 27111@item -mno-ext-perf2 27112@opindex mno-ext-perf2 27113Do not generate performance extension 2 instructions. 27114 27115@item -mext-string 27116@opindex mext-string 27117Generate string extension instructions. 27118 27119@item -mno-ext-string 27120@opindex mno-ext-string 27121Do not generate string extension instructions. 27122 27123@item -mv3push 27124@opindex mv3push 27125Generate v3 push25/pop25 instructions. 27126 27127@item -mno-v3push 27128@opindex mno-v3push 27129Do not generate v3 push25/pop25 instructions. 27130 27131@item -m16-bit 27132@opindex m16-bit 27133Generate 16-bit instructions. 27134 27135@item -mno-16-bit 27136@opindex mno-16-bit 27137Do not generate 16-bit instructions. 27138 27139@item -misr-vector-size=@var{num} 27140@opindex misr-vector-size 27141Specify the size of each interrupt vector, which must be 4 or 16. 27142 27143@item -mcache-block-size=@var{num} 27144@opindex mcache-block-size 27145Specify the size of each cache block, 27146which must be a power of 2 between 4 and 512. 27147 27148@item -march=@var{arch} 27149@opindex march 27150Specify the name of the target architecture. 27151 27152@item -mcmodel=@var{code-model} 27153@opindex mcmodel 27154Set the code model to one of 27155@table @asis 27156@item @samp{small} 27157All the data and read-only data segments must be within 512KB addressing space. 27158The text segment must be within 16MB addressing space. 27159@item @samp{medium} 27160The data segment must be within 512KB while the read-only data segment can be 27161within 4GB addressing space. The text segment should be still within 16MB 27162addressing space. 27163@item @samp{large} 27164All the text and data segments can be within 4GB addressing space. 27165@end table 27166 27167@item -mctor-dtor 27168@opindex mctor-dtor 27169Enable constructor/destructor feature. 27170 27171@item -mrelax 27172@opindex mrelax 27173Guide linker to relax instructions. 27174 27175@end table 27176 27177@node Nios II Options 27178@subsection Nios II Options 27179@cindex Nios II options 27180@cindex Altera Nios II options 27181 27182These are the options defined for the Altera Nios II processor. 27183 27184@table @gcctabopt 27185 27186@item -G @var{num} 27187@opindex G 27188@cindex smaller data references 27189Put global and static objects less than or equal to @var{num} bytes 27190into the small data or BSS sections instead of the normal data or BSS 27191sections. The default value of @var{num} is 8. 27192 27193@item -mgpopt=@var{option} 27194@itemx -mgpopt 27195@itemx -mno-gpopt 27196@opindex mgpopt 27197@opindex mno-gpopt 27198Generate (do not generate) GP-relative accesses. The following 27199@var{option} names are recognized: 27200 27201@table @samp 27202 27203@item none 27204Do not generate GP-relative accesses. 27205 27206@item local 27207Generate GP-relative accesses for small data objects that are not 27208external, weak, or uninitialized common symbols. 27209Also use GP-relative addressing for objects that 27210have been explicitly placed in a small data section via a @code{section} 27211attribute. 27212 27213@item global 27214As for @samp{local}, but also generate GP-relative accesses for 27215small data objects that are external, weak, or common. If you use this option, 27216you must ensure that all parts of your program (including libraries) are 27217compiled with the same @option{-G} setting. 27218 27219@item data 27220Generate GP-relative accesses for all data objects in the program. If you 27221use this option, the entire data and BSS segments 27222of your program must fit in 64K of memory and you must use an appropriate 27223linker script to allocate them within the addressable range of the 27224global pointer. 27225 27226@item all 27227Generate GP-relative addresses for function pointers as well as data 27228pointers. If you use this option, the entire text, data, and BSS segments 27229of your program must fit in 64K of memory and you must use an appropriate 27230linker script to allocate them within the addressable range of the 27231global pointer. 27232 27233@end table 27234 27235@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 27236@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 27237 27238The default is @option{-mgpopt} except when @option{-fpic} or 27239@option{-fPIC} is specified to generate position-independent code. 27240Note that the Nios II ABI does not permit GP-relative accesses from 27241shared libraries. 27242 27243You may need to specify @option{-mno-gpopt} explicitly when building 27244programs that include large amounts of small data, including large 27245GOT data sections. In this case, the 16-bit offset for GP-relative 27246addressing may not be large enough to allow access to the entire 27247small data section. 27248 27249@item -mgprel-sec=@var{regexp} 27250@opindex mgprel-sec 27251This option specifies additional section names that can be accessed via 27252GP-relative addressing. It is most useful in conjunction with 27253@code{section} attributes on variable declarations 27254(@pxref{Common Variable Attributes}) and a custom linker script. 27255The @var{regexp} is a POSIX Extended Regular Expression. 27256 27257This option does not affect the behavior of the @option{-G} option, and 27258the specified sections are in addition to the standard @code{.sdata} 27259and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}. 27260 27261@item -mr0rel-sec=@var{regexp} 27262@opindex mr0rel-sec 27263This option specifies names of sections that can be accessed via a 2726416-bit offset from @code{r0}; that is, in the low 32K or high 32K 27265of the 32-bit address space. It is most useful in conjunction with 27266@code{section} attributes on variable declarations 27267(@pxref{Common Variable Attributes}) and a custom linker script. 27268The @var{regexp} is a POSIX Extended Regular Expression. 27269 27270In contrast to the use of GP-relative addressing for small data, 27271zero-based addressing is never generated by default and there are no 27272conventional section names used in standard linker scripts for sections 27273in the low or high areas of memory. 27274 27275@item -mel 27276@itemx -meb 27277@opindex mel 27278@opindex meb 27279Generate little-endian (default) or big-endian (experimental) code, 27280respectively. 27281 27282@item -march=@var{arch} 27283@opindex march 27284This specifies the name of the target Nios II architecture. GCC uses this 27285name to determine what kind of instructions it can emit when generating 27286assembly code. Permissible names are: @samp{r1}, @samp{r2}. 27287 27288The preprocessor macro @code{__nios2_arch__} is available to programs, 27289with value 1 or 2, indicating the targeted ISA level. 27290 27291@item -mbypass-cache 27292@itemx -mno-bypass-cache 27293@opindex mno-bypass-cache 27294@opindex mbypass-cache 27295Force all load and store instructions to always bypass cache by 27296using I/O variants of the instructions. The default is not to 27297bypass the cache. 27298 27299@item -mno-cache-volatile 27300@itemx -mcache-volatile 27301@opindex mcache-volatile 27302@opindex mno-cache-volatile 27303Volatile memory access bypass the cache using the I/O variants of 27304the load and store instructions. The default is not to bypass the cache. 27305 27306@item -mno-fast-sw-div 27307@itemx -mfast-sw-div 27308@opindex mno-fast-sw-div 27309@opindex mfast-sw-div 27310Do not use table-based fast divide for small numbers. The default 27311is to use the fast divide at @option{-O3} and above. 27312 27313@item -mno-hw-mul 27314@itemx -mhw-mul 27315@itemx -mno-hw-mulx 27316@itemx -mhw-mulx 27317@itemx -mno-hw-div 27318@itemx -mhw-div 27319@opindex mno-hw-mul 27320@opindex mhw-mul 27321@opindex mno-hw-mulx 27322@opindex mhw-mulx 27323@opindex mno-hw-div 27324@opindex mhw-div 27325Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 27326instructions by the compiler. The default is to emit @code{mul} 27327and not emit @code{div} and @code{mulx}. 27328 27329@item -mbmx 27330@itemx -mno-bmx 27331@itemx -mcdx 27332@itemx -mno-cdx 27333Enable or disable generation of Nios II R2 BMX (bit manipulation) and 27334CDX (code density) instructions. Enabling these instructions also 27335requires @option{-march=r2}. Since these instructions are optional 27336extensions to the R2 architecture, the default is not to emit them. 27337 27338@item -mcustom-@var{insn}=@var{N} 27339@itemx -mno-custom-@var{insn} 27340@opindex mcustom-@var{insn} 27341@opindex mno-custom-@var{insn} 27342Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 27343custom instruction with encoding @var{N} when generating code that uses 27344@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 27345instruction 253 for single-precision floating-point add operations instead 27346of the default behavior of using a library call. 27347 27348The following values of @var{insn} are supported. Except as otherwise 27349noted, floating-point operations are expected to be implemented with 27350normal IEEE 754 semantics and correspond directly to the C operators or the 27351equivalent GCC built-in functions (@pxref{Other Builtins}). 27352 27353Single-precision floating point: 27354@table @asis 27355 27356@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 27357Binary arithmetic operations. 27358 27359@item @samp{fnegs} 27360Unary negation. 27361 27362@item @samp{fabss} 27363Unary absolute value. 27364 27365@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 27366Comparison operations. 27367 27368@item @samp{fmins}, @samp{fmaxs} 27369Floating-point minimum and maximum. These instructions are only 27370generated if @option{-ffinite-math-only} is specified. 27371 27372@item @samp{fsqrts} 27373Unary square root operation. 27374 27375@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 27376Floating-point trigonometric and exponential functions. These instructions 27377are only generated if @option{-funsafe-math-optimizations} is also specified. 27378 27379@end table 27380 27381Double-precision floating point: 27382@table @asis 27383 27384@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 27385Binary arithmetic operations. 27386 27387@item @samp{fnegd} 27388Unary negation. 27389 27390@item @samp{fabsd} 27391Unary absolute value. 27392 27393@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 27394Comparison operations. 27395 27396@item @samp{fmind}, @samp{fmaxd} 27397Double-precision minimum and maximum. These instructions are only 27398generated if @option{-ffinite-math-only} is specified. 27399 27400@item @samp{fsqrtd} 27401Unary square root operation. 27402 27403@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 27404Double-precision trigonometric and exponential functions. These instructions 27405are only generated if @option{-funsafe-math-optimizations} is also specified. 27406 27407@end table 27408 27409Conversions: 27410@table @asis 27411@item @samp{fextsd} 27412Conversion from single precision to double precision. 27413 27414@item @samp{ftruncds} 27415Conversion from double precision to single precision. 27416 27417@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 27418Conversion from floating point to signed or unsigned integer types, with 27419truncation towards zero. 27420 27421@item @samp{round} 27422Conversion from single-precision floating point to signed integer, 27423rounding to the nearest integer and ties away from zero. 27424This corresponds to the @code{__builtin_lroundf} function when 27425@option{-fno-math-errno} is used. 27426 27427@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 27428Conversion from signed or unsigned integer types to floating-point types. 27429 27430@end table 27431 27432In addition, all of the following transfer instructions for internal 27433registers X and Y must be provided to use any of the double-precision 27434floating-point instructions. Custom instructions taking two 27435double-precision source operands expect the first operand in the 2743664-bit register X. The other operand (or only operand of a unary 27437operation) is given to the custom arithmetic instruction with the 27438least significant half in source register @var{src1} and the most 27439significant half in @var{src2}. A custom instruction that returns a 27440double-precision result returns the most significant 32 bits in the 27441destination register and the other half in 32-bit register Y. 27442GCC automatically generates the necessary code sequences to write 27443register X and/or read register Y when double-precision floating-point 27444instructions are used. 27445 27446@table @asis 27447 27448@item @samp{fwrx} 27449Write @var{src1} into the least significant half of X and @var{src2} into 27450the most significant half of X. 27451 27452@item @samp{fwry} 27453Write @var{src1} into Y. 27454 27455@item @samp{frdxhi}, @samp{frdxlo} 27456Read the most or least (respectively) significant half of X and store it in 27457@var{dest}. 27458 27459@item @samp{frdy} 27460Read the value of Y and store it into @var{dest}. 27461@end table 27462 27463Note that you can gain more local control over generation of Nios II custom 27464instructions by using the @code{target("custom-@var{insn}=@var{N}")} 27465and @code{target("no-custom-@var{insn}")} function attributes 27466(@pxref{Function Attributes}) 27467or pragmas (@pxref{Function Specific Option Pragmas}). 27468 27469@item -mcustom-fpu-cfg=@var{name} 27470@opindex mcustom-fpu-cfg 27471 27472This option enables a predefined, named set of custom instruction encodings 27473(see @option{-mcustom-@var{insn}} above). 27474Currently, the following sets are defined: 27475 27476@option{-mcustom-fpu-cfg=60-1} is equivalent to: 27477@gccoptlist{-mcustom-fmuls=252 @gol 27478-mcustom-fadds=253 @gol 27479-mcustom-fsubs=254 @gol 27480-fsingle-precision-constant} 27481 27482@option{-mcustom-fpu-cfg=60-2} is equivalent to: 27483@gccoptlist{-mcustom-fmuls=252 @gol 27484-mcustom-fadds=253 @gol 27485-mcustom-fsubs=254 @gol 27486-mcustom-fdivs=255 @gol 27487-fsingle-precision-constant} 27488 27489@option{-mcustom-fpu-cfg=72-3} is equivalent to: 27490@gccoptlist{-mcustom-floatus=243 @gol 27491-mcustom-fixsi=244 @gol 27492-mcustom-floatis=245 @gol 27493-mcustom-fcmpgts=246 @gol 27494-mcustom-fcmples=249 @gol 27495-mcustom-fcmpeqs=250 @gol 27496-mcustom-fcmpnes=251 @gol 27497-mcustom-fmuls=252 @gol 27498-mcustom-fadds=253 @gol 27499-mcustom-fsubs=254 @gol 27500-mcustom-fdivs=255 @gol 27501-fsingle-precision-constant} 27502 27503@option{-mcustom-fpu-cfg=fph2} is equivalent to: 27504@gccoptlist{-mcustom-fabss=224 @gol 27505-mcustom-fnegs=225 @gol 27506-mcustom-fcmpnes=226 @gol 27507-mcustom-fcmpeqs=227 @gol 27508-mcustom-fcmpges=228 @gol 27509-mcustom-fcmpgts=229 @gol 27510-mcustom-fcmples=230 @gol 27511-mcustom-fcmplts=231 @gol 27512-mcustom-fmaxs=232 @gol 27513-mcustom-fmins=233 @gol 27514-mcustom-round=248 @gol 27515-mcustom-fixsi=249 @gol 27516-mcustom-floatis=250 @gol 27517-mcustom-fsqrts=251 @gol 27518-mcustom-fmuls=252 @gol 27519-mcustom-fadds=253 @gol 27520-mcustom-fsubs=254 @gol 27521-mcustom-fdivs=255 @gol} 27522 27523Custom instruction assignments given by individual 27524@option{-mcustom-@var{insn}=} options override those given by 27525@option{-mcustom-fpu-cfg=}, regardless of the 27526order of the options on the command line. 27527 27528Note that you can gain more local control over selection of a FPU 27529configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 27530function attribute (@pxref{Function Attributes}) 27531or pragma (@pxref{Function Specific Option Pragmas}). 27532 27533The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point 27534Hardware 2 Component}. Please note that the custom instructions enabled by 27535@option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated 27536if @option{-ffinite-math-only} is specified. The custom instruction enabled by 27537@option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is 27538specified. In contrast to the other configurations, 27539@option{-fsingle-precision-constant} is not set. 27540 27541@end table 27542 27543These additional @samp{-m} options are available for the Altera Nios II 27544ELF (bare-metal) target: 27545 27546@table @gcctabopt 27547 27548@item -mhal 27549@opindex mhal 27550Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 27551startup and termination code, and is typically used in conjunction with 27552@option{-msys-crt0=} to specify the location of the alternate startup code 27553provided by the HAL BSP. 27554 27555@item -msmallc 27556@opindex msmallc 27557Link with a limited version of the C library, @option{-lsmallc}, rather than 27558Newlib. 27559 27560@item -msys-crt0=@var{startfile} 27561@opindex msys-crt0 27562@var{startfile} is the file name of the startfile (crt0) to use 27563when linking. This option is only useful in conjunction with @option{-mhal}. 27564 27565@item -msys-lib=@var{systemlib} 27566@opindex msys-lib 27567@var{systemlib} is the library name of the library that provides 27568low-level system calls required by the C library, 27569e.g.@: @code{read} and @code{write}. 27570This option is typically used to link with a library provided by a HAL BSP. 27571 27572@end table 27573 27574@node Nvidia PTX Options 27575@subsection Nvidia PTX Options 27576@cindex Nvidia PTX options 27577@cindex nvptx options 27578 27579These options are defined for Nvidia PTX: 27580 27581@table @gcctabopt 27582 27583@item -m64 27584@opindex m64 27585Ignored, but preserved for backward compatibility. Only 64-bit ABI is 27586supported. 27587 27588@item -march=@var{architecture-string} 27589@opindex march 27590Generate code for the specified PTX ISA target architecture 27591(e.g.@: @samp{sm_35}). Valid architecture strings are @samp{sm_30}, 27592@samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and 27593@samp{sm_80}. The default target architecture is sm_30. 27594 27595This option sets the value of the preprocessor macro 27596@code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value 27597@samp{350}. 27598 27599@item -misa=@var{architecture-string} 27600@opindex misa 27601Alias of @option{-march=}. 27602 27603@item -march-map=@var{architecture-string} 27604@opindex march 27605Select the closest available @option{-march=} value that is not more 27606capable. For instance, for @option{-march-map=sm_50} select 27607@option{-march=sm_35}, and for @option{-march-map=sm_53} select 27608@option{-march=sm_53}. 27609 27610@item -mptx=@var{version-string} 27611@opindex mptx 27612Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}). 27613Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and 27614@samp{7.0}. The default PTX ISA version is 6.0, unless a higher 27615version is required for specified PTX ISA target architecture via 27616option @option{-march=}. 27617 27618This option sets the values of the preprocessor macros 27619@code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__}; 27620for instance, for @samp{3.1} the macros have the values @samp{3} and 27621@samp{1}, respectively. 27622 27623@item -mmainkernel 27624@opindex mmainkernel 27625Link in code for a __main kernel. This is for stand-alone instead of 27626offloading execution. 27627 27628@item -moptimize 27629@opindex moptimize 27630Apply partitioned execution optimizations. This is the default when any 27631level of optimization is selected. 27632 27633@item -msoft-stack 27634@opindex msoft-stack 27635Generate code that does not use @code{.local} memory 27636directly for stack storage. Instead, a per-warp stack pointer is 27637maintained explicitly. This enables variable-length stack allocation (with 27638variable-length arrays or @code{alloca}), and when global memory is used for 27639underlying storage, makes it possible to access automatic variables from other 27640threads, or with atomic instructions. This code generation variant is used 27641for OpenMP offloading, but the option is exposed on its own for the purpose 27642of testing the compiler; to generate code suitable for linking into programs 27643using OpenMP offloading, use option @option{-mgomp}. 27644 27645@item -muniform-simt 27646@opindex muniform-simt 27647Switch to code generation variant that allows to execute all threads in each 27648warp, while maintaining memory state and side effects as if only one thread 27649in each warp was active outside of OpenMP SIMD regions. All atomic operations 27650and calls to runtime (malloc, free, vprintf) are conditionally executed (iff 27651current lane index equals the master lane index), and the register being 27652assigned is copied via a shuffle instruction from the master lane. Outside of 27653SIMD regions lane 0 is the master; inside, each thread sees itself as the 27654master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or 27655all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD 27656regions). Each thread can bitwise-and the bitmask at position @code{tid.y} 27657with current lane index to compute the master lane index. 27658 27659@item -mgomp 27660@opindex mgomp 27661Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and 27662@option{-muniform-simt} options, and selects corresponding multilib variant. 27663 27664@end table 27665 27666@node OpenRISC Options 27667@subsection OpenRISC Options 27668@cindex OpenRISC Options 27669 27670These options are defined for OpenRISC: 27671 27672@table @gcctabopt 27673 27674@item -mboard=@var{name} 27675@opindex mboard 27676Configure a board specific runtime. This will be passed to the linker for 27677newlib board library linking. The default is @code{or1ksim}. 27678 27679@item -mnewlib 27680@opindex mnewlib 27681This option is ignored; it is for compatibility purposes only. This used to 27682select linker and preprocessor options for use with newlib. 27683 27684@item -msoft-div 27685@itemx -mhard-div 27686@opindex msoft-div 27687@opindex mhard-div 27688Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions. 27689This default is hardware divide. 27690 27691@item -msoft-mul 27692@itemx -mhard-mul 27693@opindex msoft-mul 27694@opindex mhard-mul 27695Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions. 27696This default is hardware multiply. 27697 27698@item -msoft-float 27699@itemx -mhard-float 27700@opindex msoft-float 27701@opindex mhard-float 27702Select software or hardware for floating point operations. 27703The default is software. 27704 27705@item -mdouble-float 27706@opindex mdouble-float 27707When @option{-mhard-float} is selected, enables generation of double-precision 27708floating point instructions. By default functions from @file{libgcc} are used 27709to perform double-precision floating point operations. 27710 27711@item -munordered-float 27712@opindex munordered-float 27713When @option{-mhard-float} is selected, enables generation of unordered 27714floating point compare and set flag (@code{lf.sfun*}) instructions. By default 27715functions from @file{libgcc} are used to perform unordered floating point 27716compare and set flag operations. 27717 27718@item -mcmov 27719@opindex mcmov 27720Enable generation of conditional move (@code{l.cmov}) instructions. By 27721default the equivalent will be generated using set and branch. 27722 27723@item -mror 27724@opindex mror 27725Enable generation of rotate right (@code{l.ror}) instructions. By default 27726functions from @file{libgcc} are used to perform rotate right operations. 27727 27728@item -mrori 27729@opindex mrori 27730Enable generation of rotate right with immediate (@code{l.rori}) instructions. 27731By default functions from @file{libgcc} are used to perform rotate right with 27732immediate operations. 27733 27734@item -msext 27735@opindex msext 27736Enable generation of sign extension (@code{l.ext*}) instructions. By default 27737memory loads are used to perform sign extension. 27738 27739@item -msfimm 27740@opindex msfimm 27741Enable generation of compare and set flag with immediate (@code{l.sf*i}) 27742instructions. By default extra instructions will be generated to store the 27743immediate to a register first. 27744 27745@item -mshftimm 27746@opindex mshftimm 27747Enable generation of shift with immediate (@code{l.srai}, @code{l.srli}, 27748@code{l.slli}) instructions. By default extra instructions will be generated 27749to store the immediate to a register first. 27750 27751@item -mcmodel=small 27752@opindex mcmodel=small 27753Generate OpenRISC code for the small model: The GOT is limited to 64k. This is 27754the default model. 27755 27756@item -mcmodel=large 27757@opindex mcmodel=large 27758Generate OpenRISC code for the large model: The GOT may grow up to 4G in size. 27759 27760 27761@end table 27762 27763@node PDP-11 Options 27764@subsection PDP-11 Options 27765@cindex PDP-11 Options 27766 27767These options are defined for the PDP-11: 27768 27769@table @gcctabopt 27770@item -mfpu 27771@opindex mfpu 27772Use hardware FPP floating point. This is the default. (FIS floating 27773point on the PDP-11/40 is not supported.) Implies -m45. 27774 27775@item -msoft-float 27776@opindex msoft-float 27777Do not use hardware floating point. 27778 27779@item -mac0 27780@opindex mac0 27781Return floating-point results in ac0 (fr0 in Unix assembler syntax). 27782 27783@item -mno-ac0 27784@opindex mno-ac0 27785Return floating-point results in memory. This is the default. 27786 27787@item -m40 27788@opindex m40 27789Generate code for a PDP-11/40. Implies -msoft-float -mno-split. 27790 27791@item -m45 27792@opindex m45 27793Generate code for a PDP-11/45. This is the default. 27794 27795@item -m10 27796@opindex m10 27797Generate code for a PDP-11/10. Implies -msoft-float -mno-split. 27798 27799@item -mint16 27800@itemx -mno-int32 27801@opindex mint16 27802@opindex mno-int32 27803Use 16-bit @code{int}. This is the default. 27804 27805@item -mint32 27806@itemx -mno-int16 27807@opindex mint32 27808@opindex mno-int16 27809Use 32-bit @code{int}. 27810 27811@item -msplit 27812@opindex msplit 27813Target has split instruction and data space. Implies -m45. 27814 27815@item -munix-asm 27816@opindex munix-asm 27817Use Unix assembler syntax. 27818 27819@item -mdec-asm 27820@opindex mdec-asm 27821Use DEC assembler syntax. 27822 27823@item -mgnu-asm 27824@opindex mgnu-asm 27825Use GNU assembler syntax. This is the default. 27826 27827@item -mlra 27828@opindex mlra 27829Use the new LRA register allocator. By default, the old ``reload'' 27830allocator is used. 27831@end table 27832 27833@node picoChip Options 27834@subsection picoChip Options 27835@cindex picoChip options 27836 27837These @samp{-m} options are defined for picoChip implementations: 27838 27839@table @gcctabopt 27840 27841@item -mae=@var{ae_type} 27842@opindex mcpu 27843Set the instruction set, register set, and instruction scheduling 27844parameters for array element type @var{ae_type}. Supported values 27845for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 27846 27847@option{-mae=ANY} selects a completely generic AE type. Code 27848generated with this option runs on any of the other AE types. The 27849code is not as efficient as it would be if compiled for a specific 27850AE type, and some types of operation (e.g., multiplication) do not 27851work properly on all types of AE. 27852 27853@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 27854for compiled code, and is the default. 27855 27856@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 27857option may suffer from poor performance of byte (char) manipulation, 27858since the DSP AE does not provide hardware support for byte load/stores. 27859 27860@item -msymbol-as-address 27861Enable the compiler to directly use a symbol name as an address in a 27862load/store instruction, without first loading it into a 27863register. Typically, the use of this option generates larger 27864programs, which run faster than when the option isn't used. However, the 27865results vary from program to program, so it is left as a user option, 27866rather than being permanently enabled. 27867 27868@item -mno-inefficient-warnings 27869Disables warnings about the generation of inefficient code. These 27870warnings can be generated, for example, when compiling code that 27871performs byte-level memory operations on the MAC AE type. The MAC AE has 27872no hardware support for byte-level memory operations, so all byte 27873load/stores must be synthesized from word load/store operations. This is 27874inefficient and a warning is generated to indicate 27875that you should rewrite the code to avoid byte operations, or to target 27876an AE type that has the necessary hardware support. This option disables 27877these warnings. 27878 27879@end table 27880 27881@node PowerPC Options 27882@subsection PowerPC Options 27883@cindex PowerPC options 27884 27885These are listed under @xref{RS/6000 and PowerPC Options}. 27886 27887@node PRU Options 27888@subsection PRU Options 27889@cindex PRU Options 27890 27891These command-line options are defined for PRU target: 27892 27893@table @gcctabopt 27894@item -minrt 27895@opindex minrt 27896Link with a minimum runtime environment, with no support for static 27897initializers and constructors. Using this option can significantly reduce 27898the size of the final ELF binary. Beware that the compiler could still 27899generate code with static initializers and constructors. It is up to the 27900programmer to ensure that the source program will not use those features. 27901 27902@item -mmcu=@var{mcu} 27903@opindex mmcu 27904Specify the PRU MCU variant to use. Check Newlib for the exact list of 27905supported MCUs. 27906 27907@item -mno-relax 27908@opindex mno-relax 27909Make GCC pass the @option{--no-relax} command-line option to the linker 27910instead of the @option{--relax} option. 27911 27912@item -mloop 27913@opindex mloop 27914Allow (or do not allow) GCC to use the LOOP instruction. 27915 27916@item -mabi=@var{variant} 27917@opindex mabi 27918Specify the ABI variant to output code for. @option{-mabi=ti} selects the 27919unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes 27920more naturally with certain GCC assumptions. These are the differences: 27921 27922@table @samp 27923@item Function Pointer Size 27924TI ABI specifies that function (code) pointers are 16-bit, whereas GNU 27925supports only 32-bit data and code pointers. 27926 27927@item Optional Return Value Pointer 27928Function return values larger than 64 bits are passed by using a hidden 27929pointer as the first argument of the function. TI ABI, though, mandates that 27930the pointer can be NULL in case the caller is not using the returned value. 27931GNU always passes and expects a valid return value pointer. 27932 27933@end table 27934 27935The current @option{-mabi=ti} implementation simply raises a compile error 27936when any of the above code constructs is detected. As a consequence 27937the standard C library cannot be built and it is omitted when linking with 27938@option{-mabi=ti}. 27939 27940Relaxation is a GNU feature and for safety reasons is disabled when using 27941@option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx 27942instructions, so the GNU linker cannot adjust them when shortening adjacent 27943LDI32 pseudo instructions. 27944 27945@end table 27946 27947@node RISC-V Options 27948@subsection RISC-V Options 27949@cindex RISC-V Options 27950 27951These command-line options are defined for RISC-V targets: 27952 27953@table @gcctabopt 27954@item -mbranch-cost=@var{n} 27955@opindex mbranch-cost 27956Set the cost of branches to roughly @var{n} instructions. 27957 27958@item -mplt 27959@itemx -mno-plt 27960@opindex plt 27961When generating PIC code, do or don't allow the use of PLTs. Ignored for 27962non-PIC. The default is @option{-mplt}. 27963 27964@item -mabi=@var{ABI-string} 27965@opindex mabi 27966Specify integer and floating-point calling convention. @var{ABI-string} 27967contains two parts: the size of integer types and the registers used for 27968floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that 27969@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be 2797032-bit), and that floating-point values up to 64 bits wide are passed in F 27971registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still 27972allows the compiler to generate code that uses the F and D extensions but only 27973allows floating-point values up to 32 bits long to be passed in registers; or 27974@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be 27975passed in registers. 27976 27977The default for this argument is system dependent, users who want a specific 27978calling convention should specify one explicitly. The valid calling 27979conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64}, 27980@samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to 27981implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is 27982invalid because the ABI requires 64-bit values be passed in F registers, but F 27983registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can 27984only be used with the @samp{rv32e} architecture. This ABI is not well 27985specified at present, and is subject to change. 27986 27987@item -mfdiv 27988@itemx -mno-fdiv 27989@opindex mfdiv 27990Do or don't use hardware floating-point divide and square root instructions. 27991This requires the F or D extensions for floating-point registers. The default 27992is to use them if the specified architecture has these instructions. 27993 27994@item -mdiv 27995@itemx -mno-div 27996@opindex mdiv 27997Do or don't use hardware instructions for integer division. This requires the 27998M extension. The default is to use them if the specified architecture has 27999these instructions. 28000 28001@item -misa-spec=@var{ISA-spec-string} 28002@opindex misa-spec 28003Specify the version of the RISC-V Unprivileged (formerly User-Level) 28004ISA specification to produce code conforming to. The possibilities 28005for @var{ISA-spec-string} are: 28006@table @code 28007@item 2.2 28008Produce code conforming to version 2.2. 28009@item 20190608 28010Produce code conforming to version 20190608. 28011@item 20191213 28012Produce code conforming to version 20191213. 28013@end table 28014The default is @option{-misa-spec=20191213} unless GCC has been configured 28015with @option{--with-isa-spec=} specifying a different default version. 28016 28017@item -march=@var{ISA-string} 28018@opindex march 28019Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be 28020lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and 28021@samp{rv32imaf}. 28022 28023When @option{-march=} is not specified, use the setting from @option{-mcpu}. 28024 28025If both @option{-march} and @option{-mcpu=} are not specified, the default for 28026this argument is system dependent, users who want a specific architecture 28027extensions should specify one explicitly. 28028 28029@item -mcpu=@var{processor-string} 28030@opindex mcpu 28031Use architecture of and optimize the output for the given processor, specified 28032by particular CPU name. 28033Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21}, 28034@samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76}, 28035@samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76}, 28036@samp{sifive-u54}, and @samp{sifive-u74}. 28037 28038@item -mtune=@var{processor-string} 28039@opindex mtune 28040Optimize the output for the given processor, specified by microarchitecture or 28041particular CPU name. Permissible values for this option are: @samp{rocket}, 28042@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series}, 28043@samp{size}, and all valid options for @option{-mcpu=}. 28044 28045When @option{-mtune=} is not specified, use the setting from @option{-mcpu}, 28046the default is @samp{rocket} if both are not specified. 28047 28048The @samp{size} choice is not intended for use by end-users. This is used 28049when @option{-Os} is specified. It overrides the instruction cost info 28050provided by @option{-mtune=}, but does not override the pipeline info. This 28051helps reduce code size while still giving good performance. 28052 28053@item -mpreferred-stack-boundary=@var{num} 28054@opindex mpreferred-stack-boundary 28055Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 28056byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 28057the default is 4 (16 bytes or 128-bits). 28058 28059@strong{Warning:} If you use this switch, then you must build all modules with 28060the same value, including any libraries. This includes the system libraries 28061and startup modules. 28062 28063@item -msmall-data-limit=@var{n} 28064@opindex msmall-data-limit 28065Put global and static data smaller than @var{n} bytes into a special section 28066(on some targets). 28067 28068@item -msave-restore 28069@itemx -mno-save-restore 28070@opindex msave-restore 28071Do or don't use smaller but slower prologue and epilogue code that uses 28072library function calls. The default is to use fast inline prologues and 28073epilogues. 28074 28075@item -mshorten-memrefs 28076@itemx -mno-shorten-memrefs 28077@opindex mshorten-memrefs 28078Do or do not attempt to make more use of compressed load/store instructions by 28079replacing a load/store of 'base register + large offset' with a new load/store 28080of 'new base + small offset'. If the new base gets stored in a compressed 28081register, then the new load/store can be compressed. Currently targets 32-bit 28082integer load/stores only. 28083 28084@item -mstrict-align 28085@itemx -mno-strict-align 28086@opindex mstrict-align 28087Do not or do generate unaligned memory accesses. The default is set depending 28088on whether the processor we are optimizing for supports fast unaligned access 28089or not. 28090 28091@item -mcmodel=medlow 28092@opindex mcmodel=medlow 28093Generate code for the medium-low code model. The program and its statically 28094defined symbols must lie within a single 2 GiB address range and must lie 28095between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be 28096statically or dynamically linked. This is the default code model. 28097 28098@item -mcmodel=medany 28099@opindex mcmodel=medany 28100Generate code for the medium-any code model. The program and its statically 28101defined symbols must be within any single 2 GiB address range. Programs can be 28102statically or dynamically linked. 28103 28104The code generated by the medium-any code model is position-independent, but is 28105not guaranteed to function correctly when linked into position-independent 28106executables or libraries. 28107 28108@item -mexplicit-relocs 28109@itemx -mno-exlicit-relocs 28110Use or do not use assembler relocation operators when dealing with symbolic 28111addresses. The alternative is to use assembler macros instead, which may 28112limit optimization. 28113 28114@item -mrelax 28115@itemx -mno-relax 28116Take advantage of linker relaxations to reduce the number of instructions 28117required to materialize symbol addresses. The default is to take advantage of 28118linker relaxations. 28119 28120@item -memit-attribute 28121@itemx -mno-emit-attribute 28122Emit (do not emit) RISC-V attribute to record extra information into ELF 28123objects. This feature requires at least binutils 2.32. 28124 28125@item -malign-data=@var{type} 28126@opindex malign-data 28127Control how GCC aligns variables and constants of array, structure, or union 28128types. Supported values for @var{type} are @samp{xlen} which uses x register 28129width as the alignment value, and @samp{natural} which uses natural alignment. 28130@samp{xlen} is the default. 28131 28132@item -mbig-endian 28133@opindex mbig-endian 28134Generate big-endian code. This is the default when GCC is configured for a 28135@samp{riscv64be-*-*} or @samp{riscv32be-*-*} target. 28136 28137@item -mlittle-endian 28138@opindex mlittle-endian 28139Generate little-endian code. This is the default when GCC is configured for a 28140@samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or 28141@samp{riscv32be-*-*} target. 28142 28143@item -mstack-protector-guard=@var{guard} 28144@itemx -mstack-protector-guard-reg=@var{reg} 28145@itemx -mstack-protector-guard-offset=@var{offset} 28146@opindex mstack-protector-guard 28147@opindex mstack-protector-guard-reg 28148@opindex mstack-protector-guard-offset 28149Generate stack protection code using canary at @var{guard}. Supported 28150locations are @samp{global} for a global canary or @samp{tls} for per-thread 28151canary in the TLS block. 28152 28153With the latter choice the options 28154@option{-mstack-protector-guard-reg=@var{reg}} and 28155@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 28156which register to use as base register for reading the canary, 28157and from what offset from that base register. There is no default 28158register or offset as this is entirely for use within the Linux 28159kernel. 28160@end table 28161 28162@node RL78 Options 28163@subsection RL78 Options 28164@cindex RL78 Options 28165 28166@table @gcctabopt 28167 28168@item -msim 28169@opindex msim 28170Links in additional target libraries to support operation within a 28171simulator. 28172 28173@item -mmul=none 28174@itemx -mmul=g10 28175@itemx -mmul=g13 28176@itemx -mmul=g14 28177@itemx -mmul=rl78 28178@opindex mmul 28179Specifies the type of hardware multiplication and division support to 28180be used. The simplest is @code{none}, which uses software for both 28181multiplication and division. This is the default. The @code{g13} 28182value is for the hardware multiply/divide peripheral found on the 28183RL78/G13 (S2 core) targets. The @code{g14} value selects the use of 28184the multiplication and division instructions supported by the RL78/G14 28185(S3 core) parts. The value @code{rl78} is an alias for @code{g14} and 28186the value @code{mg10} is an alias for @code{none}. 28187 28188In addition a C preprocessor macro is defined, based upon the setting 28189of this option. Possible values are: @code{__RL78_MUL_NONE__}, 28190@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}. 28191 28192@item -mcpu=g10 28193@itemx -mcpu=g13 28194@itemx -mcpu=g14 28195@itemx -mcpu=rl78 28196@opindex mcpu 28197Specifies the RL78 core to target. The default is the G14 core, also 28198known as an S3 core or just RL78. The G13 or S2 core does not have 28199multiply or divide instructions, instead it uses a hardware peripheral 28200for these operations. The G10 or S1 core does not have register 28201banks, so it uses a different calling convention. 28202 28203If this option is set it also selects the type of hardware multiply 28204support to use, unless this is overridden by an explicit 28205@option{-mmul=none} option on the command line. Thus specifying 28206@option{-mcpu=g13} enables the use of the G13 hardware multiply 28207peripheral and specifying @option{-mcpu=g10} disables the use of 28208hardware multiplications altogether. 28209 28210Note, although the RL78/G14 core is the default target, specifying 28211@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does 28212change the behavior of the toolchain since it also enables G14 28213hardware multiply support. If these options are not specified on the 28214command line then software multiplication routines will be used even 28215though the code targets the RL78 core. This is for backwards 28216compatibility with older toolchains which did not have hardware 28217multiply and divide support. 28218 28219In addition a C preprocessor macro is defined, based upon the setting 28220of this option. Possible values are: @code{__RL78_G10__}, 28221@code{__RL78_G13__} or @code{__RL78_G14__}. 28222 28223@item -mg10 28224@itemx -mg13 28225@itemx -mg14 28226@itemx -mrl78 28227@opindex mg10 28228@opindex mg13 28229@opindex mg14 28230@opindex mrl78 28231These are aliases for the corresponding @option{-mcpu=} option. They 28232are provided for backwards compatibility. 28233 28234@item -mallregs 28235@opindex mallregs 28236Allow the compiler to use all of the available registers. By default 28237registers @code{r24..r31} are reserved for use in interrupt handlers. 28238With this option enabled these registers can be used in ordinary 28239functions as well. 28240 28241@item -m64bit-doubles 28242@itemx -m32bit-doubles 28243@opindex m64bit-doubles 28244@opindex m32bit-doubles 28245Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 28246or 32 bits (@option{-m32bit-doubles}) in size. The default is 28247@option{-m32bit-doubles}. 28248 28249@item -msave-mduc-in-interrupts 28250@itemx -mno-save-mduc-in-interrupts 28251@opindex msave-mduc-in-interrupts 28252@opindex mno-save-mduc-in-interrupts 28253Specifies that interrupt handler functions should preserve the 28254MDUC registers. This is only necessary if normal code might use 28255the MDUC registers, for example because it performs multiplication 28256and division operations. The default is to ignore the MDUC registers 28257as this makes the interrupt handlers faster. The target option -mg13 28258needs to be passed for this to work as this feature is only available 28259on the G13 target (S2 core). The MDUC registers will only be saved 28260if the interrupt handler performs a multiplication or division 28261operation or it calls another function. 28262 28263@end table 28264 28265@node RS/6000 and PowerPC Options 28266@subsection IBM RS/6000 and PowerPC Options 28267@cindex RS/6000 and PowerPC Options 28268@cindex IBM RS/6000 and PowerPC Options 28269 28270These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 28271@table @gcctabopt 28272@item -mpowerpc-gpopt 28273@itemx -mno-powerpc-gpopt 28274@itemx -mpowerpc-gfxopt 28275@itemx -mno-powerpc-gfxopt 28276@need 800 28277@itemx -mpowerpc64 28278@itemx -mno-powerpc64 28279@itemx -mmfcrf 28280@itemx -mno-mfcrf 28281@itemx -mpopcntb 28282@itemx -mno-popcntb 28283@itemx -mpopcntd 28284@itemx -mno-popcntd 28285@itemx -mfprnd 28286@itemx -mno-fprnd 28287@need 800 28288@itemx -mcmpb 28289@itemx -mno-cmpb 28290@itemx -mhard-dfp 28291@itemx -mno-hard-dfp 28292@opindex mpowerpc-gpopt 28293@opindex mno-powerpc-gpopt 28294@opindex mpowerpc-gfxopt 28295@opindex mno-powerpc-gfxopt 28296@opindex mpowerpc64 28297@opindex mno-powerpc64 28298@opindex mmfcrf 28299@opindex mno-mfcrf 28300@opindex mpopcntb 28301@opindex mno-popcntb 28302@opindex mpopcntd 28303@opindex mno-popcntd 28304@opindex mfprnd 28305@opindex mno-fprnd 28306@opindex mcmpb 28307@opindex mno-cmpb 28308@opindex mhard-dfp 28309@opindex mno-hard-dfp 28310You use these options to specify which instructions are available on the 28311processor you are using. The default value of these options is 28312determined when configuring GCC@. Specifying the 28313@option{-mcpu=@var{cpu_type}} overrides the specification of these 28314options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 28315rather than the options listed above. 28316 28317Specifying @option{-mpowerpc-gpopt} allows 28318GCC to use the optional PowerPC architecture instructions in the 28319General Purpose group, including floating-point square root. Specifying 28320@option{-mpowerpc-gfxopt} allows GCC to 28321use the optional PowerPC architecture instructions in the Graphics 28322group, including floating-point select. 28323 28324The @option{-mmfcrf} option allows GCC to generate the move from 28325condition register field instruction implemented on the POWER4 28326processor and other processors that support the PowerPC V2.01 28327architecture. 28328The @option{-mpopcntb} option allows GCC to generate the popcount and 28329double-precision FP reciprocal estimate instruction implemented on the 28330POWER5 processor and other processors that support the PowerPC V2.02 28331architecture. 28332The @option{-mpopcntd} option allows GCC to generate the popcount 28333instruction implemented on the POWER7 processor and other processors 28334that support the PowerPC V2.06 architecture. 28335The @option{-mfprnd} option allows GCC to generate the FP round to 28336integer instructions implemented on the POWER5+ processor and other 28337processors that support the PowerPC V2.03 architecture. 28338The @option{-mcmpb} option allows GCC to generate the compare bytes 28339instruction implemented on the POWER6 processor and other processors 28340that support the PowerPC V2.05 architecture. 28341The @option{-mhard-dfp} option allows GCC to generate the decimal 28342floating-point instructions implemented on some POWER processors. 28343 28344The @option{-mpowerpc64} option allows GCC to generate the additional 2834564-bit instructions that are found in the full PowerPC64 architecture 28346and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 28347@option{-mno-powerpc64}. 28348 28349@item -mcpu=@var{cpu_type} 28350@opindex mcpu 28351Set architecture type, register usage, and 28352instruction scheduling parameters for machine type @var{cpu_type}. 28353Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 28354@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 28355@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 28356@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 28357@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 28358@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 28359@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 28360@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 28361@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 28362@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, 28363@samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64}, 28364@samp{powerpc64le}, @samp{rs64}, and @samp{native}. 28365 28366@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 28367@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 28368endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 28369architecture machine types, with an appropriate, generic processor 28370model assumed for scheduling purposes. 28371 28372Specifying @samp{native} as cpu type detects and selects the 28373architecture option that corresponds to the host processor of the 28374system performing the compilation. 28375@option{-mcpu=native} has no effect if GCC does not recognize the 28376processor. 28377 28378The other options specify a specific processor. Code generated under 28379those options runs best on that processor, and may not run at all on 28380others. 28381 28382The @option{-mcpu} options automatically enable or disable the 28383following options: 28384 28385@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 28386-mpopcntb -mpopcntd -mpowerpc64 @gol 28387-mpowerpc-gpopt -mpowerpc-gfxopt @gol 28388-mmulhw -mdlmzb -mmfpgpr -mvsx @gol 28389-mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol 28390-mquad-memory -mquad-memory-atomic -mfloat128 @gol 28391-mfloat128-hardware -mprefixed -mpcrel -mmma @gol 28392-mrop-protect} 28393 28394The particular options set for any particular CPU varies between 28395compiler versions, depending on what setting seems to produce optimal 28396code for that CPU; it doesn't necessarily reflect the actual hardware's 28397capabilities. If you wish to set an individual option to a particular 28398value, you may specify it after the @option{-mcpu} option, like 28399@option{-mcpu=970 -mno-altivec}. 28400 28401On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 28402not enabled or disabled by the @option{-mcpu} option at present because 28403AIX does not have full support for these options. You may still 28404enable or disable them individually if you're sure it'll work in your 28405environment. 28406 28407@item -mtune=@var{cpu_type} 28408@opindex mtune 28409Set the instruction scheduling parameters for machine type 28410@var{cpu_type}, but do not set the architecture type or register usage, 28411as @option{-mcpu=@var{cpu_type}} does. The same 28412values for @var{cpu_type} are used for @option{-mtune} as for 28413@option{-mcpu}. If both are specified, the code generated uses the 28414architecture and registers set by @option{-mcpu}, but the 28415scheduling parameters set by @option{-mtune}. 28416 28417@item -mcmodel=small 28418@opindex mcmodel=small 28419Generate PowerPC64 code for the small model: The TOC is limited to 2842064k. 28421 28422@item -mcmodel=medium 28423@opindex mcmodel=medium 28424Generate PowerPC64 code for the medium model: The TOC and other static 28425data may be up to a total of 4G in size. This is the default for 64-bit 28426Linux. 28427 28428@item -mcmodel=large 28429@opindex mcmodel=large 28430Generate PowerPC64 code for the large model: The TOC may be up to 4G 28431in size. Other data and code is only limited by the 64-bit address 28432space. 28433 28434@item -maltivec 28435@itemx -mno-altivec 28436@opindex maltivec 28437@opindex mno-altivec 28438Generate code that uses (does not use) AltiVec instructions, and also 28439enable the use of built-in functions that allow more direct access to 28440the AltiVec instruction set. You may also need to set 28441@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 28442enhancements. 28443 28444When @option{-maltivec} is used, the element order for AltiVec intrinsics 28445such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 28446match array element order corresponding to the endianness of the 28447target. That is, element zero identifies the leftmost element in a 28448vector register when targeting a big-endian platform, and identifies 28449the rightmost element in a vector register when targeting a 28450little-endian platform. 28451 28452@item -mvrsave 28453@itemx -mno-vrsave 28454@opindex mvrsave 28455@opindex mno-vrsave 28456Generate VRSAVE instructions when generating AltiVec code. 28457 28458@item -msecure-plt 28459@opindex msecure-plt 28460Generate code that allows @command{ld} and @command{ld.so} 28461to build executables and shared 28462libraries with non-executable @code{.plt} and @code{.got} sections. 28463This is a PowerPC 2846432-bit SYSV ABI option. 28465 28466@item -mbss-plt 28467@opindex mbss-plt 28468Generate code that uses a BSS @code{.plt} section that @command{ld.so} 28469fills in, and 28470requires @code{.plt} and @code{.got} 28471sections that are both writable and executable. 28472This is a PowerPC 32-bit SYSV ABI option. 28473 28474@item -misel 28475@itemx -mno-isel 28476@opindex misel 28477@opindex mno-isel 28478This switch enables or disables the generation of ISEL instructions. 28479 28480@item -mvsx 28481@itemx -mno-vsx 28482@opindex mvsx 28483@opindex mno-vsx 28484Generate code that uses (does not use) vector/scalar (VSX) 28485instructions, and also enable the use of built-in functions that allow 28486more direct access to the VSX instruction set. 28487 28488@item -mcrypto 28489@itemx -mno-crypto 28490@opindex mcrypto 28491@opindex mno-crypto 28492Enable the use (disable) of the built-in functions that allow direct 28493access to the cryptographic instructions that were added in version 284942.07 of the PowerPC ISA. 28495 28496@item -mhtm 28497@itemx -mno-htm 28498@opindex mhtm 28499@opindex mno-htm 28500Enable (disable) the use of the built-in functions that allow direct 28501access to the Hardware Transactional Memory (HTM) instructions that 28502were added in version 2.07 of the PowerPC ISA. 28503 28504@item -mpower8-fusion 28505@itemx -mno-power8-fusion 28506@opindex mpower8-fusion 28507@opindex mno-power8-fusion 28508Generate code that keeps (does not keeps) some integer operations 28509adjacent so that the instructions can be fused together on power8 and 28510later processors. 28511 28512@item -mpower8-vector 28513@itemx -mno-power8-vector 28514@opindex mpower8-vector 28515@opindex mno-power8-vector 28516Generate code that uses (does not use) the vector and scalar 28517instructions that were added in version 2.07 of the PowerPC ISA. Also 28518enable the use of built-in functions that allow more direct access to 28519the vector instructions. 28520 28521@item -mquad-memory 28522@itemx -mno-quad-memory 28523@opindex mquad-memory 28524@opindex mno-quad-memory 28525Generate code that uses (does not use) the non-atomic quad word memory 28526instructions. The @option{-mquad-memory} option requires use of 2852764-bit mode. 28528 28529@item -mquad-memory-atomic 28530@itemx -mno-quad-memory-atomic 28531@opindex mquad-memory-atomic 28532@opindex mno-quad-memory-atomic 28533Generate code that uses (does not use) the atomic quad word memory 28534instructions. The @option{-mquad-memory-atomic} option requires use of 2853564-bit mode. 28536 28537@item -mfloat128 28538@itemx -mno-float128 28539@opindex mfloat128 28540@opindex mno-float128 28541Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point 28542and use either software emulation for IEEE 128-bit floating point or 28543hardware instructions. 28544 28545The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE 28546128-bit floating point support. The IEEE 128-bit floating point is only 28547supported on Linux. 28548 28549The default for @option{-mfloat128} is enabled on PowerPC Linux 28550systems using the VSX instruction set, and disabled on other systems. 28551 28552If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or 28553@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating 28554point support will also enable the generation of ISA 3.0 IEEE 128-bit 28555floating point instructions. Otherwise, if you do not specify to 28556generate ISA 3.0 instructions or you are targeting a 32-bit big endian 28557system, IEEE 128-bit floating point will be done with software 28558emulation. 28559 28560@item -mfloat128-hardware 28561@itemx -mno-float128-hardware 28562@opindex mfloat128-hardware 28563@opindex mno-float128-hardware 28564Enable/disable using ISA 3.0 hardware instructions to support the 28565@var{__float128} data type. 28566 28567The default for @option{-mfloat128-hardware} is enabled on PowerPC 28568Linux systems using the ISA 3.0 instruction set, and disabled on other 28569systems. 28570 28571@item -m32 28572@itemx -m64 28573@opindex m32 28574@opindex m64 28575Generate code for 32-bit or 64-bit environments of Darwin and SVR4 28576targets (including GNU/Linux). The 32-bit environment sets int, long 28577and pointer to 32 bits and generates code that runs on any PowerPC 28578variant. The 64-bit environment sets int to 32 bits and long and 28579pointer to 64 bits, and generates code for PowerPC64, as for 28580@option{-mpowerpc64}. 28581 28582@item -mfull-toc 28583@itemx -mno-fp-in-toc 28584@itemx -mno-sum-in-toc 28585@itemx -mminimal-toc 28586@opindex mfull-toc 28587@opindex mno-fp-in-toc 28588@opindex mno-sum-in-toc 28589@opindex mminimal-toc 28590Modify generation of the TOC (Table Of Contents), which is created for 28591every executable file. The @option{-mfull-toc} option is selected by 28592default. In that case, GCC allocates at least one TOC entry for 28593each unique non-automatic variable reference in your program. GCC 28594also places floating-point constants in the TOC@. However, only 2859516,384 entries are available in the TOC@. 28596 28597If you receive a linker error message that saying you have overflowed 28598the available TOC space, you can reduce the amount of TOC space used 28599with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 28600@option{-mno-fp-in-toc} prevents GCC from putting floating-point 28601constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 28602generate code to calculate the sum of an address and a constant at 28603run time instead of putting that sum into the TOC@. You may specify one 28604or both of these options. Each causes GCC to produce very slightly 28605slower and larger code at the expense of conserving TOC space. 28606 28607If you still run out of space in the TOC even when you specify both of 28608these options, specify @option{-mminimal-toc} instead. This option causes 28609GCC to make only one TOC entry for every file. When you specify this 28610option, GCC produces code that is slower and larger but which 28611uses extremely little TOC space. You may wish to use this option 28612only on files that contain less frequently-executed code. 28613 28614@item -maix64 28615@itemx -maix32 28616@opindex maix64 28617@opindex maix32 28618Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 28619@code{long} type, and the infrastructure needed to support them. 28620Specifying @option{-maix64} implies @option{-mpowerpc64}, 28621while @option{-maix32} disables the 64-bit ABI and 28622implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 28623 28624@item -mxl-compat 28625@itemx -mno-xl-compat 28626@opindex mxl-compat 28627@opindex mno-xl-compat 28628Produce code that conforms more closely to IBM XL compiler semantics 28629when using AIX-compatible ABI@. Pass floating-point arguments to 28630prototyped functions beyond the register save area (RSA) on the stack 28631in addition to argument FPRs. Do not assume that most significant 28632double in 128-bit long double value is properly rounded when comparing 28633values and converting to double. Use XL symbol names for long double 28634support routines. 28635 28636The AIX calling convention was extended but not initially documented to 28637handle an obscure K&R C case of calling a function that takes the 28638address of its arguments with fewer arguments than declared. IBM XL 28639compilers access floating-point arguments that do not fit in the 28640RSA from the stack when a subroutine is compiled without 28641optimization. Because always storing floating-point arguments on the 28642stack is inefficient and rarely needed, this option is not enabled by 28643default and only is necessary when calling subroutines compiled by IBM 28644XL compilers without optimization. 28645 28646@item -mpe 28647@opindex mpe 28648Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 28649application written to use message passing with special startup code to 28650enable the application to run. The system must have PE installed in the 28651standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 28652must be overridden with the @option{-specs=} option to specify the 28653appropriate directory location. The Parallel Environment does not 28654support threads, so the @option{-mpe} option and the @option{-pthread} 28655option are incompatible. 28656 28657@item -malign-natural 28658@itemx -malign-power 28659@opindex malign-natural 28660@opindex malign-power 28661On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 28662@option{-malign-natural} overrides the ABI-defined alignment of larger 28663types, such as floating-point doubles, on their natural size-based boundary. 28664The option @option{-malign-power} instructs GCC to follow the ABI-specified 28665alignment rules. GCC defaults to the standard alignment defined in the ABI@. 28666 28667On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 28668is not supported. 28669 28670@item -msoft-float 28671@itemx -mhard-float 28672@opindex msoft-float 28673@opindex mhard-float 28674Generate code that does not use (uses) the floating-point register set. 28675Software floating-point emulation is provided if you use the 28676@option{-msoft-float} option, and pass the option to GCC when linking. 28677 28678@item -mmultiple 28679@itemx -mno-multiple 28680@opindex mmultiple 28681@opindex mno-multiple 28682Generate code that uses (does not use) the load multiple word 28683instructions and the store multiple word instructions. These 28684instructions are generated by default on POWER systems, and not 28685generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 28686PowerPC systems, since those instructions do not work when the 28687processor is in little-endian mode. The exceptions are PPC740 and 28688PPC750 which permit these instructions in little-endian mode. 28689 28690@item -mupdate 28691@itemx -mno-update 28692@opindex mupdate 28693@opindex mno-update 28694Generate code that uses (does not use) the load or store instructions 28695that update the base register to the address of the calculated memory 28696location. These instructions are generated by default. If you use 28697@option{-mno-update}, there is a small window between the time that the 28698stack pointer is updated and the address of the previous frame is 28699stored, which means code that walks the stack frame across interrupts or 28700signals may get corrupted data. 28701 28702@item -mavoid-indexed-addresses 28703@itemx -mno-avoid-indexed-addresses 28704@opindex mavoid-indexed-addresses 28705@opindex mno-avoid-indexed-addresses 28706Generate code that tries to avoid (not avoid) the use of indexed load 28707or store instructions. These instructions can incur a performance 28708penalty on Power6 processors in certain situations, such as when 28709stepping through large arrays that cross a 16M boundary. This option 28710is enabled by default when targeting Power6 and disabled otherwise. 28711 28712@item -mfused-madd 28713@itemx -mno-fused-madd 28714@opindex mfused-madd 28715@opindex mno-fused-madd 28716Generate code that uses (does not use) the floating-point multiply and 28717accumulate instructions. These instructions are generated by default 28718if hardware floating point is used. The machine-dependent 28719@option{-mfused-madd} option is now mapped to the machine-independent 28720@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 28721mapped to @option{-ffp-contract=off}. 28722 28723@item -mmulhw 28724@itemx -mno-mulhw 28725@opindex mmulhw 28726@opindex mno-mulhw 28727Generate code that uses (does not use) the half-word multiply and 28728multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 28729These instructions are generated by default when targeting those 28730processors. 28731 28732@item -mdlmzb 28733@itemx -mno-dlmzb 28734@opindex mdlmzb 28735@opindex mno-dlmzb 28736Generate code that uses (does not use) the string-search @samp{dlmzb} 28737instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 28738generated by default when targeting those processors. 28739 28740@item -mno-bit-align 28741@itemx -mbit-align 28742@opindex mno-bit-align 28743@opindex mbit-align 28744On System V.4 and embedded PowerPC systems do not (do) force structures 28745and unions that contain bit-fields to be aligned to the base type of the 28746bit-field. 28747 28748For example, by default a structure containing nothing but 8 28749@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 28750boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 28751the structure is aligned to a 1-byte boundary and is 1 byte in 28752size. 28753 28754@item -mno-strict-align 28755@itemx -mstrict-align 28756@opindex mno-strict-align 28757@opindex mstrict-align 28758On System V.4 and embedded PowerPC systems do not (do) assume that 28759unaligned memory references are handled by the system. 28760 28761@item -mrelocatable 28762@itemx -mno-relocatable 28763@opindex mrelocatable 28764@opindex mno-relocatable 28765Generate code that allows (does not allow) a static executable to be 28766relocated to a different address at run time. A simple embedded 28767PowerPC system loader should relocate the entire contents of 28768@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 28769a table of 32-bit addresses generated by this option. For this to 28770work, all objects linked together must be compiled with 28771@option{-mrelocatable} or @option{-mrelocatable-lib}. 28772@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 28773 28774@item -mrelocatable-lib 28775@itemx -mno-relocatable-lib 28776@opindex mrelocatable-lib 28777@opindex mno-relocatable-lib 28778Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 28779@code{.fixup} section to allow static executables to be relocated at 28780run time, but @option{-mrelocatable-lib} does not use the smaller stack 28781alignment of @option{-mrelocatable}. Objects compiled with 28782@option{-mrelocatable-lib} may be linked with objects compiled with 28783any combination of the @option{-mrelocatable} options. 28784 28785@item -mno-toc 28786@itemx -mtoc 28787@opindex mno-toc 28788@opindex mtoc 28789On System V.4 and embedded PowerPC systems do not (do) assume that 28790register 2 contains a pointer to a global area pointing to the addresses 28791used in the program. 28792 28793@item -mlittle 28794@itemx -mlittle-endian 28795@opindex mlittle 28796@opindex mlittle-endian 28797On System V.4 and embedded PowerPC systems compile code for the 28798processor in little-endian mode. The @option{-mlittle-endian} option is 28799the same as @option{-mlittle}. 28800 28801@item -mbig 28802@itemx -mbig-endian 28803@opindex mbig 28804@opindex mbig-endian 28805On System V.4 and embedded PowerPC systems compile code for the 28806processor in big-endian mode. The @option{-mbig-endian} option is 28807the same as @option{-mbig}. 28808 28809@item -mdynamic-no-pic 28810@opindex mdynamic-no-pic 28811On Darwin and Mac OS X systems, compile code so that it is not 28812relocatable, but that its external references are relocatable. The 28813resulting code is suitable for applications, but not shared 28814libraries. 28815 28816@item -msingle-pic-base 28817@opindex msingle-pic-base 28818Treat the register used for PIC addressing as read-only, rather than 28819loading it in the prologue for each function. The runtime system is 28820responsible for initializing this register with an appropriate value 28821before execution begins. 28822 28823@item -mprioritize-restricted-insns=@var{priority} 28824@opindex mprioritize-restricted-insns 28825This option controls the priority that is assigned to 28826dispatch-slot restricted instructions during the second scheduling 28827pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 28828or @samp{2} to assign no, highest, or second-highest (respectively) 28829priority to dispatch-slot restricted 28830instructions. 28831 28832@item -msched-costly-dep=@var{dependence_type} 28833@opindex msched-costly-dep 28834This option controls which dependences are considered costly 28835by the target during instruction scheduling. The argument 28836@var{dependence_type} takes one of the following values: 28837 28838@table @asis 28839@item @samp{no} 28840No dependence is costly. 28841 28842@item @samp{all} 28843All dependences are costly. 28844 28845@item @samp{true_store_to_load} 28846A true dependence from store to load is costly. 28847 28848@item @samp{store_to_load} 28849Any dependence from store to load is costly. 28850 28851@item @var{number} 28852Any dependence for which the latency is greater than or equal to 28853@var{number} is costly. 28854@end table 28855 28856@item -minsert-sched-nops=@var{scheme} 28857@opindex minsert-sched-nops 28858This option controls which NOP insertion scheme is used during 28859the second scheduling pass. The argument @var{scheme} takes one of the 28860following values: 28861 28862@table @asis 28863@item @samp{no} 28864Don't insert NOPs. 28865 28866@item @samp{pad} 28867Pad with NOPs any dispatch group that has vacant issue slots, 28868according to the scheduler's grouping. 28869 28870@item @samp{regroup_exact} 28871Insert NOPs to force costly dependent insns into 28872separate groups. Insert exactly as many NOPs as needed to force an insn 28873to a new group, according to the estimated processor grouping. 28874 28875@item @var{number} 28876Insert NOPs to force costly dependent insns into 28877separate groups. Insert @var{number} NOPs to force an insn to a new group. 28878@end table 28879 28880@item -mcall-sysv 28881@opindex mcall-sysv 28882On System V.4 and embedded PowerPC systems compile code using calling 28883conventions that adhere to the March 1995 draft of the System V 28884Application Binary Interface, PowerPC processor supplement. This is the 28885default unless you configured GCC using @samp{powerpc-*-eabiaix}. 28886 28887@item -mcall-sysv-eabi 28888@itemx -mcall-eabi 28889@opindex mcall-sysv-eabi 28890@opindex mcall-eabi 28891Specify both @option{-mcall-sysv} and @option{-meabi} options. 28892 28893@item -mcall-sysv-noeabi 28894@opindex mcall-sysv-noeabi 28895Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 28896 28897@item -mcall-aixdesc 28898@opindex m 28899On System V.4 and embedded PowerPC systems compile code for the AIX 28900operating system. 28901 28902@item -mcall-linux 28903@opindex mcall-linux 28904On System V.4 and embedded PowerPC systems compile code for the 28905Linux-based GNU system. 28906 28907@item -mcall-freebsd 28908@opindex mcall-freebsd 28909On System V.4 and embedded PowerPC systems compile code for the 28910FreeBSD operating system. 28911 28912@item -mcall-netbsd 28913@opindex mcall-netbsd 28914On System V.4 and embedded PowerPC systems compile code for the 28915NetBSD operating system. 28916 28917@item -mcall-openbsd 28918@opindex mcall-netbsd 28919On System V.4 and embedded PowerPC systems compile code for the 28920OpenBSD operating system. 28921 28922@item -mtraceback=@var{traceback_type} 28923@opindex mtraceback 28924Select the type of traceback table. Valid values for @var{traceback_type} 28925are @samp{full}, @samp{part}, and @samp{no}. 28926 28927@item -maix-struct-return 28928@opindex maix-struct-return 28929Return all structures in memory (as specified by the AIX ABI)@. 28930 28931@item -msvr4-struct-return 28932@opindex msvr4-struct-return 28933Return structures smaller than 8 bytes in registers (as specified by the 28934SVR4 ABI)@. 28935 28936@item -mabi=@var{abi-type} 28937@opindex mabi 28938Extend the current ABI with a particular extension, or remove such extension. 28939Valid values are: @samp{altivec}, @samp{no-altivec}, 28940@samp{ibmlongdouble}, @samp{ieeelongdouble}, 28941@samp{elfv1}, @samp{elfv2}, 28942and for AIX: @samp{vec-extabi}, @samp{vec-default}@. 28943 28944@item -mabi=ibmlongdouble 28945@opindex mabi=ibmlongdouble 28946Change the current ABI to use IBM extended-precision long double. 28947This is not likely to work if your system defaults to using IEEE 28948extended-precision long double. If you change the long double type 28949from IEEE extended-precision, the compiler will issue a warning unless 28950you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 28951to be enabled. 28952 28953@item -mabi=ieeelongdouble 28954@opindex mabi=ieeelongdouble 28955Change the current ABI to use IEEE extended-precision long double. 28956This is not likely to work if your system defaults to using IBM 28957extended-precision long double. If you change the long double type 28958from IBM extended-precision, the compiler will issue a warning unless 28959you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 28960to be enabled. 28961 28962@item -mabi=elfv1 28963@opindex mabi=elfv1 28964Change the current ABI to use the ELFv1 ABI. 28965This is the default ABI for big-endian PowerPC 64-bit Linux. 28966Overriding the default ABI requires special system support and is 28967likely to fail in spectacular ways. 28968 28969@item -mabi=elfv2 28970@opindex mabi=elfv2 28971Change the current ABI to use the ELFv2 ABI. 28972This is the default ABI for little-endian PowerPC 64-bit Linux. 28973Overriding the default ABI requires special system support and is 28974likely to fail in spectacular ways. 28975 28976@item -mgnu-attribute 28977@itemx -mno-gnu-attribute 28978@opindex mgnu-attribute 28979@opindex mno-gnu-attribute 28980Emit .gnu_attribute assembly directives to set tag/value pairs in a 28981.gnu.attributes section that specify ABI variations in function 28982parameters or return values. 28983 28984@item -mprototype 28985@itemx -mno-prototype 28986@opindex mprototype 28987@opindex mno-prototype 28988On System V.4 and embedded PowerPC systems assume that all calls to 28989variable argument functions are properly prototyped. Otherwise, the 28990compiler must insert an instruction before every non-prototyped call to 28991set or clear bit 6 of the condition code register (@code{CR}) to 28992indicate whether floating-point values are passed in the floating-point 28993registers in case the function takes variable arguments. With 28994@option{-mprototype}, only calls to prototyped variable argument functions 28995set or clear the bit. 28996 28997@item -msim 28998@opindex msim 28999On embedded PowerPC systems, assume that the startup module is called 29000@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 29001@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 29002configurations. 29003 29004@item -mmvme 29005@opindex mmvme 29006On embedded PowerPC systems, assume that the startup module is called 29007@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 29008@file{libc.a}. 29009 29010@item -mads 29011@opindex mads 29012On embedded PowerPC systems, assume that the startup module is called 29013@file{crt0.o} and the standard C libraries are @file{libads.a} and 29014@file{libc.a}. 29015 29016@item -myellowknife 29017@opindex myellowknife 29018On embedded PowerPC systems, assume that the startup module is called 29019@file{crt0.o} and the standard C libraries are @file{libyk.a} and 29020@file{libc.a}. 29021 29022@item -mvxworks 29023@opindex mvxworks 29024On System V.4 and embedded PowerPC systems, specify that you are 29025compiling for a VxWorks system. 29026 29027@item -memb 29028@opindex memb 29029On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 29030header to indicate that @samp{eabi} extended relocations are used. 29031 29032@item -meabi 29033@itemx -mno-eabi 29034@opindex meabi 29035@opindex mno-eabi 29036On System V.4 and embedded PowerPC systems do (do not) adhere to the 29037Embedded Applications Binary Interface (EABI), which is a set of 29038modifications to the System V.4 specifications. Selecting @option{-meabi} 29039means that the stack is aligned to an 8-byte boundary, a function 29040@code{__eabi} is called from @code{main} to set up the EABI 29041environment, and the @option{-msdata} option can use both @code{r2} and 29042@code{r13} to point to two separate small data areas. Selecting 29043@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 29044no EABI initialization function is called from @code{main}, and the 29045@option{-msdata} option only uses @code{r13} to point to a single 29046small data area. The @option{-meabi} option is on by default if you 29047configured GCC using one of the @samp{powerpc*-*-eabi*} options. 29048 29049@item -msdata=eabi 29050@opindex msdata=eabi 29051On System V.4 and embedded PowerPC systems, put small initialized 29052@code{const} global and static data in the @code{.sdata2} section, which 29053is pointed to by register @code{r2}. Put small initialized 29054non-@code{const} global and static data in the @code{.sdata} section, 29055which is pointed to by register @code{r13}. Put small uninitialized 29056global and static data in the @code{.sbss} section, which is adjacent to 29057the @code{.sdata} section. The @option{-msdata=eabi} option is 29058incompatible with the @option{-mrelocatable} option. The 29059@option{-msdata=eabi} option also sets the @option{-memb} option. 29060 29061@item -msdata=sysv 29062@opindex msdata=sysv 29063On System V.4 and embedded PowerPC systems, put small global and static 29064data in the @code{.sdata} section, which is pointed to by register 29065@code{r13}. Put small uninitialized global and static data in the 29066@code{.sbss} section, which is adjacent to the @code{.sdata} section. 29067The @option{-msdata=sysv} option is incompatible with the 29068@option{-mrelocatable} option. 29069 29070@item -msdata=default 29071@itemx -msdata 29072@opindex msdata=default 29073@opindex msdata 29074On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 29075compile code the same as @option{-msdata=eabi}, otherwise compile code the 29076same as @option{-msdata=sysv}. 29077 29078@item -msdata=data 29079@opindex msdata=data 29080On System V.4 and embedded PowerPC systems, put small global 29081data in the @code{.sdata} section. Put small uninitialized global 29082data in the @code{.sbss} section. Do not use register @code{r13} 29083to address small data however. This is the default behavior unless 29084other @option{-msdata} options are used. 29085 29086@item -msdata=none 29087@itemx -mno-sdata 29088@opindex msdata=none 29089@opindex mno-sdata 29090On embedded PowerPC systems, put all initialized global and static data 29091in the @code{.data} section, and all uninitialized data in the 29092@code{.bss} section. 29093 29094@item -mreadonly-in-sdata 29095@opindex mreadonly-in-sdata 29096@opindex mno-readonly-in-sdata 29097Put read-only objects in the @code{.sdata} section as well. This is the 29098default. 29099 29100@item -mblock-move-inline-limit=@var{num} 29101@opindex mblock-move-inline-limit 29102Inline all block moves (such as calls to @code{memcpy} or structure 29103copies) less than or equal to @var{num} bytes. The minimum value for 29104@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 29105targets. The default value is target-specific. 29106 29107@item -mblock-compare-inline-limit=@var{num} 29108@opindex mblock-compare-inline-limit 29109Generate non-looping inline code for all block compares (such as calls 29110to @code{memcmp} or structure compares) less than or equal to @var{num} 29111bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of 29112block compare is disabled. The default value is target-specific. 29113 29114@item -mblock-compare-inline-loop-limit=@var{num} 29115@opindex mblock-compare-inline-loop-limit 29116Generate an inline expansion using loop code for all block compares that 29117are less than or equal to @var{num} bytes, but greater than the limit 29118for non-loop inline block compare expansion. If the block length is not 29119constant, at most @var{num} bytes will be compared before @code{memcmp} 29120is called to compare the remainder of the block. The default value is 29121target-specific. 29122 29123@item -mstring-compare-inline-limit=@var{num} 29124@opindex mstring-compare-inline-limit 29125Compare at most @var{num} string bytes with inline code. 29126If the difference or end of string is not found at the 29127end of the inline compare a call to @code{strcmp} or @code{strncmp} will 29128take care of the rest of the comparison. The default is 64 bytes. 29129 29130@item -G @var{num} 29131@opindex G 29132@cindex smaller data references (PowerPC) 29133@cindex .sdata/.sdata2 references (PowerPC) 29134On embedded PowerPC systems, put global and static items less than or 29135equal to @var{num} bytes into the small data or BSS sections instead of 29136the normal data or BSS section. By default, @var{num} is 8. The 29137@option{-G @var{num}} switch is also passed to the linker. 29138All modules should be compiled with the same @option{-G @var{num}} value. 29139 29140@item -mregnames 29141@itemx -mno-regnames 29142@opindex mregnames 29143@opindex mno-regnames 29144On System V.4 and embedded PowerPC systems do (do not) emit register 29145names in the assembly language output using symbolic forms. 29146 29147@item -mlongcall 29148@itemx -mno-longcall 29149@opindex mlongcall 29150@opindex mno-longcall 29151By default assume that all calls are far away so that a longer and more 29152expensive calling sequence is required. This is required for calls 29153farther than 32 megabytes (33,554,432 bytes) from the current location. 29154A short call is generated if the compiler knows 29155the call cannot be that far away. This setting can be overridden by 29156the @code{shortcall} function attribute, or by @code{#pragma 29157longcall(0)}. 29158 29159Some linkers are capable of detecting out-of-range calls and generating 29160glue code on the fly. On these systems, long calls are unnecessary and 29161generate slower code. As of this writing, the AIX linker can do this, 29162as can the GNU linker for PowerPC/64. It is planned to add this feature 29163to the GNU linker for 32-bit PowerPC systems as well. 29164 29165On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers, 29166GCC can generate long calls using an inline PLT call sequence (see 29167@option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64 29168ELFv1 (big-endian) do not support inline PLT calls. 29169 29170On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 29171callee, L42}, plus a @dfn{branch island} (glue code). The two target 29172addresses represent the callee and the branch island. The 29173Darwin/PPC linker prefers the first address and generates a @code{bl 29174callee} if the PPC @code{bl} instruction reaches the callee directly; 29175otherwise, the linker generates @code{bl L42} to call the branch 29176island. The branch island is appended to the body of the 29177calling function; it computes the full 32-bit address of the callee 29178and jumps to it. 29179 29180On Mach-O (Darwin) systems, this option directs the compiler emit to 29181the glue for every direct call, and the Darwin linker decides whether 29182to use or discard it. 29183 29184In the future, GCC may ignore all longcall specifications 29185when the linker is known to generate glue. 29186 29187@item -mpltseq 29188@itemx -mno-pltseq 29189@opindex mpltseq 29190@opindex mno-pltseq 29191Implement (do not implement) -fno-plt and long calls using an inline 29192PLT call sequence that supports lazy linking and long calls to 29193functions in dlopen'd shared libraries. Inline PLT calls are only 29194supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU 29195linkers, and are enabled by default if the support is detected when 29196configuring GCC, and, in the case of 32-bit PowerPC, if GCC is 29197configured with @option{--enable-secureplt}. @option{-mpltseq} code 29198and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be 29199linked together. 29200 29201@item -mtls-markers 29202@itemx -mno-tls-markers 29203@opindex mtls-markers 29204@opindex mno-tls-markers 29205Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 29206specifying the function argument. The relocation allows the linker to 29207reliably associate function call with argument setup instructions for 29208TLS optimization, which in turn allows GCC to better schedule the 29209sequence. 29210 29211@item -mrecip 29212@itemx -mno-recip 29213@opindex mrecip 29214This option enables use of the reciprocal estimate and 29215reciprocal square root estimate instructions with additional 29216Newton-Raphson steps to increase precision instead of doing a divide or 29217square root and divide for floating-point arguments. You should use 29218the @option{-ffast-math} option when using @option{-mrecip} (or at 29219least @option{-funsafe-math-optimizations}, 29220@option{-ffinite-math-only}, @option{-freciprocal-math} and 29221@option{-fno-trapping-math}). Note that while the throughput of the 29222sequence is generally higher than the throughput of the non-reciprocal 29223instruction, the precision of the sequence can be decreased by up to 2 29224ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 29225roots. 29226 29227@item -mrecip=@var{opt} 29228@opindex mrecip=opt 29229This option controls which reciprocal estimate instructions 29230may be used. @var{opt} is a comma-separated list of options, which may 29231be preceded by a @code{!} to invert the option: 29232 29233@table @samp 29234 29235@item all 29236Enable all estimate instructions. 29237 29238@item default 29239Enable the default instructions, equivalent to @option{-mrecip}. 29240 29241@item none 29242Disable all estimate instructions, equivalent to @option{-mno-recip}. 29243 29244@item div 29245Enable the reciprocal approximation instructions for both 29246single and double precision. 29247 29248@item divf 29249Enable the single-precision reciprocal approximation instructions. 29250 29251@item divd 29252Enable the double-precision reciprocal approximation instructions. 29253 29254@item rsqrt 29255Enable the reciprocal square root approximation instructions for both 29256single and double precision. 29257 29258@item rsqrtf 29259Enable the single-precision reciprocal square root approximation instructions. 29260 29261@item rsqrtd 29262Enable the double-precision reciprocal square root approximation instructions. 29263 29264@end table 29265 29266So, for example, @option{-mrecip=all,!rsqrtd} enables 29267all of the reciprocal estimate instructions, except for the 29268@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 29269which handle the double-precision reciprocal square root calculations. 29270 29271@item -mrecip-precision 29272@itemx -mno-recip-precision 29273@opindex mrecip-precision 29274Assume (do not assume) that the reciprocal estimate instructions 29275provide higher-precision estimates than is mandated by the PowerPC 29276ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 29277@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 29278The double-precision square root estimate instructions are not generated by 29279default on low-precision machines, since they do not provide an 29280estimate that converges after three steps. 29281 29282@item -mveclibabi=@var{type} 29283@opindex mveclibabi 29284Specifies the ABI type to use for vectorizing intrinsics using an 29285external library. The only type supported at present is @samp{mass}, 29286which specifies to use IBM's Mathematical Acceleration Subsystem 29287(MASS) libraries for vectorizing intrinsics using external libraries. 29288GCC currently emits calls to @code{acosd2}, @code{acosf4}, 29289@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 29290@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 29291@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 29292@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 29293@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 29294@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 29295@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 29296@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 29297@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 29298@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 29299@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 29300@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 29301@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 29302for power7. Both @option{-ftree-vectorize} and 29303@option{-funsafe-math-optimizations} must also be enabled. The MASS 29304libraries must be specified at link time. 29305 29306@item -mfriz 29307@itemx -mno-friz 29308@opindex mfriz 29309Generate (do not generate) the @code{friz} instruction when the 29310@option{-funsafe-math-optimizations} option is used to optimize 29311rounding of floating-point values to 64-bit integer and back to floating 29312point. The @code{friz} instruction does not return the same value if 29313the floating-point number is too large to fit in an integer. 29314 29315@item -mpointers-to-nested-functions 29316@itemx -mno-pointers-to-nested-functions 29317@opindex mpointers-to-nested-functions 29318Generate (do not generate) code to load up the static chain register 29319(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 29320systems where a function pointer points to a 3-word descriptor giving 29321the function address, TOC value to be loaded in register @code{r2}, and 29322static chain value to be loaded in register @code{r11}. The 29323@option{-mpointers-to-nested-functions} is on by default. You cannot 29324call through pointers to nested functions or pointers 29325to functions compiled in other languages that use the static chain if 29326you use @option{-mno-pointers-to-nested-functions}. 29327 29328@item -msave-toc-indirect 29329@itemx -mno-save-toc-indirect 29330@opindex msave-toc-indirect 29331Generate (do not generate) code to save the TOC value in the reserved 29332stack location in the function prologue if the function calls through 29333a pointer on AIX and 64-bit Linux systems. If the TOC value is not 29334saved in the prologue, it is saved just before the call through the 29335pointer. The @option{-mno-save-toc-indirect} option is the default. 29336 29337@item -mcompat-align-parm 29338@itemx -mno-compat-align-parm 29339@opindex mcompat-align-parm 29340Generate (do not generate) code to pass structure parameters with a 29341maximum alignment of 64 bits, for compatibility with older versions 29342of GCC. 29343 29344Older versions of GCC (prior to 4.9.0) incorrectly did not align a 29345structure parameter on a 128-bit boundary when that structure contained 29346a member requiring 128-bit alignment. This is corrected in more 29347recent versions of GCC. This option may be used to generate code 29348that is compatible with functions compiled with older versions of 29349GCC. 29350 29351The @option{-mno-compat-align-parm} option is the default. 29352 29353@item -mstack-protector-guard=@var{guard} 29354@itemx -mstack-protector-guard-reg=@var{reg} 29355@itemx -mstack-protector-guard-offset=@var{offset} 29356@itemx -mstack-protector-guard-symbol=@var{symbol} 29357@opindex mstack-protector-guard 29358@opindex mstack-protector-guard-reg 29359@opindex mstack-protector-guard-offset 29360@opindex mstack-protector-guard-symbol 29361Generate stack protection code using canary at @var{guard}. Supported 29362locations are @samp{global} for global canary or @samp{tls} for per-thread 29363canary in the TLS block (the default with GNU libc version 2.4 or later). 29364 29365With the latter choice the options 29366@option{-mstack-protector-guard-reg=@var{reg}} and 29367@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 29368which register to use as base register for reading the canary, and from what 29369offset from that base register. The default for those is as specified in the 29370relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides 29371the offset with a symbol reference to a canary in the TLS block. 29372 29373@item -mpcrel 29374@itemx -mno-pcrel 29375@opindex mpcrel 29376@opindex mno-pcrel 29377Generate (do not generate) pc-relative addressing. The @option{-mpcrel} 29378option requires that the medium code model (@option{-mcmodel=medium}) 29379and prefixed addressing (@option{-mprefixed}) options are enabled. 29380 29381@item -mprefixed 29382@itemx -mno-prefixed 29383@opindex mprefixed 29384@opindex mno-prefixed 29385Generate (do not generate) addressing modes using prefixed load and 29386store instructions. The @option{-mprefixed} option requires that 29387the option @option{-mcpu=power10} (or later) is enabled. 29388 29389@item -mmma 29390@itemx -mno-mma 29391@opindex mmma 29392@opindex mno-mma 29393Generate (do not generate) the MMA instructions. The @option{-mma} 29394option requires that the option @option{-mcpu=power10} (or later) 29395is enabled. 29396 29397@item -mrop-protect 29398@itemx -mno-rop-protect 29399@opindex mrop-protect 29400@opindex mno-rop-protect 29401Generate (do not generate) ROP protection instructions when the target 29402processor supports them. Currently this option disables the shrink-wrap 29403optimization (@option{-fshrink-wrap}). 29404 29405@item -mprivileged 29406@itemx -mno-privileged 29407@opindex mprivileged 29408@opindex mno-privileged 29409Generate (do not generate) code that will run in privileged state. 29410 29411@item -mblock-ops-unaligned-vsx 29412@itemx -mno-block-ops-unaligned-vsx 29413@opindex block-ops-unaligned-vsx 29414@opindex no-block-ops-unaligned-vsx 29415Generate (do not generate) unaligned vsx loads and stores for 29416inline expansion of @code{memcpy} and @code{memmove}. 29417@end table 29418 29419@node RX Options 29420@subsection RX Options 29421@cindex RX Options 29422 29423These command-line options are defined for RX targets: 29424 29425@table @gcctabopt 29426@item -m64bit-doubles 29427@itemx -m32bit-doubles 29428@opindex m64bit-doubles 29429@opindex m32bit-doubles 29430Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 29431or 32 bits (@option{-m32bit-doubles}) in size. The default is 29432@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 29433works on 32-bit values, which is why the default is 29434@option{-m32bit-doubles}. 29435 29436@item -fpu 29437@itemx -nofpu 29438@opindex fpu 29439@opindex nofpu 29440Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 29441floating-point hardware. The default is enabled for the RX600 29442series and disabled for the RX200 series. 29443 29444Floating-point instructions are only generated for 32-bit floating-point 29445values, however, so the FPU hardware is not used for doubles if the 29446@option{-m64bit-doubles} option is used. 29447 29448@emph{Note} If the @option{-fpu} option is enabled then 29449@option{-funsafe-math-optimizations} is also enabled automatically. 29450This is because the RX FPU instructions are themselves unsafe. 29451 29452@item -mcpu=@var{name} 29453@opindex mcpu 29454Selects the type of RX CPU to be targeted. Currently three types are 29455supported, the generic @samp{RX600} and @samp{RX200} series hardware and 29456the specific @samp{RX610} CPU. The default is @samp{RX600}. 29457 29458The only difference between @samp{RX600} and @samp{RX610} is that the 29459@samp{RX610} does not support the @code{MVTIPL} instruction. 29460 29461The @samp{RX200} series does not have a hardware floating-point unit 29462and so @option{-nofpu} is enabled by default when this type is 29463selected. 29464 29465@item -mbig-endian-data 29466@itemx -mlittle-endian-data 29467@opindex mbig-endian-data 29468@opindex mlittle-endian-data 29469Store data (but not code) in the big-endian format. The default is 29470@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 29471format. 29472 29473@item -msmall-data-limit=@var{N} 29474@opindex msmall-data-limit 29475Specifies the maximum size in bytes of global and static variables 29476which can be placed into the small data area. Using the small data 29477area can lead to smaller and faster code, but the size of area is 29478limited and it is up to the programmer to ensure that the area does 29479not overflow. Also when the small data area is used one of the RX's 29480registers (usually @code{r13}) is reserved for use pointing to this 29481area, so it is no longer available for use by the compiler. This 29482could result in slower and/or larger code if variables are pushed onto 29483the stack instead of being held in this register. 29484 29485Note, common variables (variables that have not been initialized) and 29486constants are not placed into the small data area as they are assigned 29487to other sections in the output executable. 29488 29489The default value is zero, which disables this feature. Note, this 29490feature is not enabled by default with higher optimization levels 29491(@option{-O2} etc) because of the potentially detrimental effects of 29492reserving a register. It is up to the programmer to experiment and 29493discover whether this feature is of benefit to their program. See the 29494description of the @option{-mpid} option for a description of how the 29495actual register to hold the small data area pointer is chosen. 29496 29497@item -msim 29498@itemx -mno-sim 29499@opindex msim 29500@opindex mno-sim 29501Use the simulator runtime. The default is to use the libgloss 29502board-specific runtime. 29503 29504@item -mas100-syntax 29505@itemx -mno-as100-syntax 29506@opindex mas100-syntax 29507@opindex mno-as100-syntax 29508When generating assembler output use a syntax that is compatible with 29509Renesas's AS100 assembler. This syntax can also be handled by the GAS 29510assembler, but it has some restrictions so it is not generated by default. 29511 29512@item -mmax-constant-size=@var{N} 29513@opindex mmax-constant-size 29514Specifies the maximum size, in bytes, of a constant that can be used as 29515an operand in a RX instruction. Although the RX instruction set does 29516allow constants of up to 4 bytes in length to be used in instructions, 29517a longer value equates to a longer instruction. Thus in some 29518circumstances it can be beneficial to restrict the size of constants 29519that are used in instructions. Constants that are too big are instead 29520placed into a constant pool and referenced via register indirection. 29521 29522The value @var{N} can be between 0 and 4. A value of 0 (the default) 29523or 4 means that constants of any size are allowed. 29524 29525@item -mrelax 29526@opindex mrelax 29527Enable linker relaxation. Linker relaxation is a process whereby the 29528linker attempts to reduce the size of a program by finding shorter 29529versions of various instructions. Disabled by default. 29530 29531@item -mint-register=@var{N} 29532@opindex mint-register 29533Specify the number of registers to reserve for fast interrupt handler 29534functions. The value @var{N} can be between 0 and 4. A value of 1 29535means that register @code{r13} is reserved for the exclusive use 29536of fast interrupt handlers. A value of 2 reserves @code{r13} and 29537@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 29538@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 29539A value of 0, the default, does not reserve any registers. 29540 29541@item -msave-acc-in-interrupts 29542@opindex msave-acc-in-interrupts 29543Specifies that interrupt handler functions should preserve the 29544accumulator register. This is only necessary if normal code might use 29545the accumulator register, for example because it performs 64-bit 29546multiplications. The default is to ignore the accumulator as this 29547makes the interrupt handlers faster. 29548 29549@item -mpid 29550@itemx -mno-pid 29551@opindex mpid 29552@opindex mno-pid 29553Enables the generation of position independent data. When enabled any 29554access to constant data is done via an offset from a base address 29555held in a register. This allows the location of constant data to be 29556determined at run time without requiring the executable to be 29557relocated, which is a benefit to embedded applications with tight 29558memory constraints. Data that can be modified is not affected by this 29559option. 29560 29561Note, using this feature reserves a register, usually @code{r13}, for 29562the constant data base address. This can result in slower and/or 29563larger code, especially in complicated functions. 29564 29565The actual register chosen to hold the constant data base address 29566depends upon whether the @option{-msmall-data-limit} and/or the 29567@option{-mint-register} command-line options are enabled. Starting 29568with register @code{r13} and proceeding downwards, registers are 29569allocated first to satisfy the requirements of @option{-mint-register}, 29570then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 29571is possible for the small data area register to be @code{r8} if both 29572@option{-mint-register=4} and @option{-mpid} are specified on the 29573command line. 29574 29575By default this feature is not enabled. The default can be restored 29576via the @option{-mno-pid} command-line option. 29577 29578@item -mno-warn-multiple-fast-interrupts 29579@itemx -mwarn-multiple-fast-interrupts 29580@opindex mno-warn-multiple-fast-interrupts 29581@opindex mwarn-multiple-fast-interrupts 29582Prevents GCC from issuing a warning message if it finds more than one 29583fast interrupt handler when it is compiling a file. The default is to 29584issue a warning for each extra fast interrupt handler found, as the RX 29585only supports one such interrupt. 29586 29587@item -mallow-string-insns 29588@itemx -mno-allow-string-insns 29589@opindex mallow-string-insns 29590@opindex mno-allow-string-insns 29591Enables or disables the use of the string manipulation instructions 29592@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL} 29593@code{SWHILE} and also the @code{RMPA} instruction. These 29594instructions may prefetch data, which is not safe to do if accessing 29595an I/O register. (See section 12.2.7 of the RX62N Group User's Manual 29596for more information). 29597 29598The default is to allow these instructions, but it is not possible for 29599GCC to reliably detect all circumstances where a string instruction 29600might be used to access an I/O register, so their use cannot be 29601disabled automatically. Instead it is reliant upon the programmer to 29602use the @option{-mno-allow-string-insns} option if their program 29603accesses I/O space. 29604 29605When the instructions are enabled GCC defines the C preprocessor 29606symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the 29607symbol @code{__RX_DISALLOW_STRING_INSNS__}. 29608 29609@item -mjsr 29610@itemx -mno-jsr 29611@opindex mjsr 29612@opindex mno-jsr 29613Use only (or not only) @code{JSR} instructions to access functions. 29614This option can be used when code size exceeds the range of @code{BSR} 29615instructions. Note that @option{-mno-jsr} does not mean to not use 29616@code{JSR} but instead means that any type of branch may be used. 29617@end table 29618 29619@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 29620has special significance to the RX port when used with the 29621@code{interrupt} function attribute. This attribute indicates a 29622function intended to process fast interrupts. GCC ensures 29623that it only uses the registers @code{r10}, @code{r11}, @code{r12} 29624and/or @code{r13} and only provided that the normal use of the 29625corresponding registers have been restricted via the 29626@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 29627options. 29628 29629@node S/390 and zSeries Options 29630@subsection S/390 and zSeries Options 29631@cindex S/390 and zSeries Options 29632 29633These are the @samp{-m} options defined for the S/390 and zSeries architecture. 29634 29635@table @gcctabopt 29636@item -mhard-float 29637@itemx -msoft-float 29638@opindex mhard-float 29639@opindex msoft-float 29640Use (do not use) the hardware floating-point instructions and registers 29641for floating-point operations. When @option{-msoft-float} is specified, 29642functions in @file{libgcc.a} are used to perform floating-point 29643operations. When @option{-mhard-float} is specified, the compiler 29644generates IEEE floating-point instructions. This is the default. 29645 29646@item -mhard-dfp 29647@itemx -mno-hard-dfp 29648@opindex mhard-dfp 29649@opindex mno-hard-dfp 29650Use (do not use) the hardware decimal-floating-point instructions for 29651decimal-floating-point operations. When @option{-mno-hard-dfp} is 29652specified, functions in @file{libgcc.a} are used to perform 29653decimal-floating-point operations. When @option{-mhard-dfp} is 29654specified, the compiler generates decimal-floating-point hardware 29655instructions. This is the default for @option{-march=z9-ec} or higher. 29656 29657@item -mlong-double-64 29658@itemx -mlong-double-128 29659@opindex mlong-double-64 29660@opindex mlong-double-128 29661These switches control the size of @code{long double} type. A size 29662of 64 bits makes the @code{long double} type equivalent to the @code{double} 29663type. This is the default. 29664 29665@item -mbackchain 29666@itemx -mno-backchain 29667@opindex mbackchain 29668@opindex mno-backchain 29669Store (do not store) the address of the caller's frame as backchain pointer 29670into the callee's stack frame. 29671A backchain may be needed to allow debugging using tools that do not understand 29672DWARF call frame information. 29673When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 29674at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 29675the backchain is placed into the topmost word of the 96/160 byte register 29676save area. 29677 29678In general, code compiled with @option{-mbackchain} is call-compatible with 29679code compiled with @option{-mno-backchain}; however, use of the backchain 29680for debugging purposes usually requires that the whole binary is built with 29681@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 29682@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 29683to build a linux kernel use @option{-msoft-float}. 29684 29685The default is to not maintain the backchain. 29686 29687@item -mpacked-stack 29688@itemx -mno-packed-stack 29689@opindex mpacked-stack 29690@opindex mno-packed-stack 29691Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 29692specified, the compiler uses the all fields of the 96/160 byte register save 29693area only for their default purpose; unused fields still take up stack space. 29694When @option{-mpacked-stack} is specified, register save slots are densely 29695packed at the top of the register save area; unused space is reused for other 29696purposes, allowing for more efficient use of the available stack space. 29697However, when @option{-mbackchain} is also in effect, the topmost word of 29698the save area is always used to store the backchain, and the return address 29699register is always saved two words below the backchain. 29700 29701As long as the stack frame backchain is not used, code generated with 29702@option{-mpacked-stack} is call-compatible with code generated with 29703@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 29704S/390 or zSeries generated code that uses the stack frame backchain at run 29705time, not just for debugging purposes. Such code is not call-compatible 29706with code compiled with @option{-mpacked-stack}. Also, note that the 29707combination of @option{-mbackchain}, 29708@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 29709to build a linux kernel use @option{-msoft-float}. 29710 29711The default is to not use the packed stack layout. 29712 29713@item -msmall-exec 29714@itemx -mno-small-exec 29715@opindex msmall-exec 29716@opindex mno-small-exec 29717Generate (or do not generate) code using the @code{bras} instruction 29718to do subroutine calls. 29719This only works reliably if the total executable size does not 29720exceed 64k. The default is to use the @code{basr} instruction instead, 29721which does not have this limitation. 29722 29723@item -m64 29724@itemx -m31 29725@opindex m64 29726@opindex m31 29727When @option{-m31} is specified, generate code compliant to the 29728GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 29729code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 29730particular to generate 64-bit instructions. For the @samp{s390} 29731targets, the default is @option{-m31}, while the @samp{s390x} 29732targets default to @option{-m64}. 29733 29734@item -mzarch 29735@itemx -mesa 29736@opindex mzarch 29737@opindex mesa 29738When @option{-mzarch} is specified, generate code using the 29739instructions available on z/Architecture. 29740When @option{-mesa} is specified, generate code using the 29741instructions available on ESA/390. Note that @option{-mesa} is 29742not possible with @option{-m64}. 29743When generating code compliant to the GNU/Linux for S/390 ABI, 29744the default is @option{-mesa}. When generating code compliant 29745to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 29746 29747@item -mhtm 29748@itemx -mno-htm 29749@opindex mhtm 29750@opindex mno-htm 29751The @option{-mhtm} option enables a set of builtins making use of 29752instructions available with the transactional execution facility 29753introduced with the IBM zEnterprise EC12 machine generation 29754@ref{S/390 System z Built-in Functions}. 29755@option{-mhtm} is enabled by default when using @option{-march=zEC12}. 29756 29757@item -mvx 29758@itemx -mno-vx 29759@opindex mvx 29760@opindex mno-vx 29761When @option{-mvx} is specified, generate code using the instructions 29762available with the vector extension facility introduced with the IBM 29763z13 machine generation. 29764This option changes the ABI for some vector type values with regard to 29765alignment and calling conventions. In case vector type values are 29766being used in an ABI-relevant context a GAS @samp{.gnu_attribute} 29767command will be added to mark the resulting binary with the ABI used. 29768@option{-mvx} is enabled by default when using @option{-march=z13}. 29769 29770@item -mzvector 29771@itemx -mno-zvector 29772@opindex mzvector 29773@opindex mno-zvector 29774The @option{-mzvector} option enables vector language extensions and 29775builtins using instructions available with the vector extension 29776facility introduced with the IBM z13 machine generation. 29777This option adds support for @samp{vector} to be used as a keyword to 29778define vector type variables and arguments. @samp{vector} is only 29779available when GNU extensions are enabled. It will not be expanded 29780when requesting strict standard compliance e.g.@: with @option{-std=c99}. 29781In addition to the GCC low-level builtins @option{-mzvector} enables 29782a set of builtins added for compatibility with AltiVec-style 29783implementations like Power and Cell. In order to make use of these 29784builtins the header file @file{vecintrin.h} needs to be included. 29785@option{-mzvector} is disabled by default. 29786 29787@item -mmvcle 29788@itemx -mno-mvcle 29789@opindex mmvcle 29790@opindex mno-mvcle 29791Generate (or do not generate) code using the @code{mvcle} instruction 29792to perform block moves. When @option{-mno-mvcle} is specified, 29793use a @code{mvc} loop instead. This is the default unless optimizing for 29794size. 29795 29796@item -mdebug 29797@itemx -mno-debug 29798@opindex mdebug 29799@opindex mno-debug 29800Print (or do not print) additional debug information when compiling. 29801The default is to not print debug information. 29802 29803@item -march=@var{cpu-type} 29804@opindex march 29805Generate code that runs on @var{cpu-type}, which is the name of a 29806system representing a certain processor type. Possible values for 29807@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6}, 29808@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8}, 29809@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, 29810@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, 29811@samp{z16}/@samp{arch14}, and @samp{native}. 29812 29813The default is @option{-march=z900}. 29814 29815Specifying @samp{native} as cpu type can be used to select the best 29816architecture option for the host processor. 29817@option{-march=native} has no effect if GCC does not recognize the 29818processor. 29819 29820@item -mtune=@var{cpu-type} 29821@opindex mtune 29822Tune to @var{cpu-type} everything applicable about the generated code, 29823except for the ABI and the set of available instructions. 29824The list of @var{cpu-type} values is the same as for @option{-march}. 29825The default is the value used for @option{-march}. 29826 29827@item -mtpf-trace 29828@itemx -mno-tpf-trace 29829@opindex mtpf-trace 29830@opindex mno-tpf-trace 29831Generate code that adds (does not add) in TPF OS specific branches to trace 29832routines in the operating system. This option is off by default, even 29833when compiling for the TPF OS@. 29834 29835@item -mtpf-trace-skip 29836@itemx -mno-tpf-trace-skip 29837@opindex mtpf-trace-skip 29838@opindex mno-tpf-trace-skip 29839Generate code that changes (does not change) the default branch 29840targets enabled by @option{-mtpf-trace} to point to specialized trace 29841routines providing the ability of selectively skipping function trace 29842entries for the TPF OS. This option is off by default, even when 29843compiling for the TPF OS and specifying @option{-mtpf-trace}. 29844 29845@item -mfused-madd 29846@itemx -mno-fused-madd 29847@opindex mfused-madd 29848@opindex mno-fused-madd 29849Generate code that uses (does not use) the floating-point multiply and 29850accumulate instructions. These instructions are generated by default if 29851hardware floating point is used. 29852 29853@item -mwarn-framesize=@var{framesize} 29854@opindex mwarn-framesize 29855Emit a warning if the current function exceeds the given frame size. Because 29856this is a compile-time check it doesn't need to be a real problem when the program 29857runs. It is intended to identify functions that most probably cause 29858a stack overflow. It is useful to be used in an environment with limited stack 29859size e.g.@: the linux kernel. 29860 29861@item -mwarn-dynamicstack 29862@opindex mwarn-dynamicstack 29863Emit a warning if the function calls @code{alloca} or uses dynamically-sized 29864arrays. This is generally a bad idea with a limited stack size. 29865 29866@item -mstack-guard=@var{stack-guard} 29867@itemx -mstack-size=@var{stack-size} 29868@opindex mstack-guard 29869@opindex mstack-size 29870If these options are provided the S/390 back end emits additional instructions in 29871the function prologue that trigger a trap if the stack size is @var{stack-guard} 29872bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 29873If the @var{stack-guard} option is omitted the smallest power of 2 larger than 29874the frame size of the compiled function is chosen. 29875These options are intended to be used to help debugging stack overflow problems. 29876The additionally emitted code causes only little overhead and hence can also be 29877used in production-like systems without greater performance degradation. The given 29878values have to be exact powers of 2 and @var{stack-size} has to be greater than 29879@var{stack-guard} without exceeding 64k. 29880In order to be efficient the extra code makes the assumption that the stack starts 29881at an address aligned to the value given by @var{stack-size}. 29882The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 29883 29884@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 29885@opindex mhotpatch 29886If the hotpatch option is enabled, a ``hot-patching'' function 29887prologue is generated for all functions in the compilation unit. 29888The funtion label is prepended with the given number of two-byte 29889NOP instructions (@var{pre-halfwords}, maximum 1000000). After 29890the label, 2 * @var{post-halfwords} bytes are appended, using the 29891largest NOP like instructions the architecture allows (maximum 298921000000). 29893 29894If both arguments are zero, hotpatching is disabled. 29895 29896This option can be overridden for individual functions with the 29897@code{hotpatch} attribute. 29898@end table 29899 29900@node Score Options 29901@subsection Score Options 29902@cindex Score Options 29903 29904These options are defined for Score implementations: 29905 29906@table @gcctabopt 29907@item -meb 29908@opindex meb 29909Compile code for big-endian mode. This is the default. 29910 29911@item -mel 29912@opindex mel 29913Compile code for little-endian mode. 29914 29915@item -mnhwloop 29916@opindex mnhwloop 29917Disable generation of @code{bcnz} instructions. 29918 29919@item -muls 29920@opindex muls 29921Enable generation of unaligned load and store instructions. 29922 29923@item -mmac 29924@opindex mmac 29925Enable the use of multiply-accumulate instructions. Disabled by default. 29926 29927@item -mscore5 29928@opindex mscore5 29929Specify the SCORE5 as the target architecture. 29930 29931@item -mscore5u 29932@opindex mscore5u 29933Specify the SCORE5U of the target architecture. 29934 29935@item -mscore7 29936@opindex mscore7 29937Specify the SCORE7 as the target architecture. This is the default. 29938 29939@item -mscore7d 29940@opindex mscore7d 29941Specify the SCORE7D as the target architecture. 29942@end table 29943 29944@node SH Options 29945@subsection SH Options 29946 29947These @samp{-m} options are defined for the SH implementations: 29948 29949@table @gcctabopt 29950@item -m1 29951@opindex m1 29952Generate code for the SH1. 29953 29954@item -m2 29955@opindex m2 29956Generate code for the SH2. 29957 29958@item -m2e 29959Generate code for the SH2e. 29960 29961@item -m2a-nofpu 29962@opindex m2a-nofpu 29963Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 29964that the floating-point unit is not used. 29965 29966@item -m2a-single-only 29967@opindex m2a-single-only 29968Generate code for the SH2a-FPU, in such a way that no double-precision 29969floating-point operations are used. 29970 29971@item -m2a-single 29972@opindex m2a-single 29973Generate code for the SH2a-FPU assuming the floating-point unit is in 29974single-precision mode by default. 29975 29976@item -m2a 29977@opindex m2a 29978Generate code for the SH2a-FPU assuming the floating-point unit is in 29979double-precision mode by default. 29980 29981@item -m3 29982@opindex m3 29983Generate code for the SH3. 29984 29985@item -m3e 29986@opindex m3e 29987Generate code for the SH3e. 29988 29989@item -m4-nofpu 29990@opindex m4-nofpu 29991Generate code for the SH4 without a floating-point unit. 29992 29993@item -m4-single-only 29994@opindex m4-single-only 29995Generate code for the SH4 with a floating-point unit that only 29996supports single-precision arithmetic. 29997 29998@item -m4-single 29999@opindex m4-single 30000Generate code for the SH4 assuming the floating-point unit is in 30001single-precision mode by default. 30002 30003@item -m4 30004@opindex m4 30005Generate code for the SH4. 30006 30007@item -m4-100 30008@opindex m4-100 30009Generate code for SH4-100. 30010 30011@item -m4-100-nofpu 30012@opindex m4-100-nofpu 30013Generate code for SH4-100 in such a way that the 30014floating-point unit is not used. 30015 30016@item -m4-100-single 30017@opindex m4-100-single 30018Generate code for SH4-100 assuming the floating-point unit is in 30019single-precision mode by default. 30020 30021@item -m4-100-single-only 30022@opindex m4-100-single-only 30023Generate code for SH4-100 in such a way that no double-precision 30024floating-point operations are used. 30025 30026@item -m4-200 30027@opindex m4-200 30028Generate code for SH4-200. 30029 30030@item -m4-200-nofpu 30031@opindex m4-200-nofpu 30032Generate code for SH4-200 without in such a way that the 30033floating-point unit is not used. 30034 30035@item -m4-200-single 30036@opindex m4-200-single 30037Generate code for SH4-200 assuming the floating-point unit is in 30038single-precision mode by default. 30039 30040@item -m4-200-single-only 30041@opindex m4-200-single-only 30042Generate code for SH4-200 in such a way that no double-precision 30043floating-point operations are used. 30044 30045@item -m4-300 30046@opindex m4-300 30047Generate code for SH4-300. 30048 30049@item -m4-300-nofpu 30050@opindex m4-300-nofpu 30051Generate code for SH4-300 without in such a way that the 30052floating-point unit is not used. 30053 30054@item -m4-300-single 30055@opindex m4-300-single 30056Generate code for SH4-300 in such a way that no double-precision 30057floating-point operations are used. 30058 30059@item -m4-300-single-only 30060@opindex m4-300-single-only 30061Generate code for SH4-300 in such a way that no double-precision 30062floating-point operations are used. 30063 30064@item -m4-340 30065@opindex m4-340 30066Generate code for SH4-340 (no MMU, no FPU). 30067 30068@item -m4-500 30069@opindex m4-500 30070Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 30071assembler. 30072 30073@item -m4a-nofpu 30074@opindex m4a-nofpu 30075Generate code for the SH4al-dsp, or for a SH4a in such a way that the 30076floating-point unit is not used. 30077 30078@item -m4a-single-only 30079@opindex m4a-single-only 30080Generate code for the SH4a, in such a way that no double-precision 30081floating-point operations are used. 30082 30083@item -m4a-single 30084@opindex m4a-single 30085Generate code for the SH4a assuming the floating-point unit is in 30086single-precision mode by default. 30087 30088@item -m4a 30089@opindex m4a 30090Generate code for the SH4a. 30091 30092@item -m4al 30093@opindex m4al 30094Same as @option{-m4a-nofpu}, except that it implicitly passes 30095@option{-dsp} to the assembler. GCC doesn't generate any DSP 30096instructions at the moment. 30097 30098@item -mb 30099@opindex mb 30100Compile code for the processor in big-endian mode. 30101 30102@item -ml 30103@opindex ml 30104Compile code for the processor in little-endian mode. 30105 30106@item -mdalign 30107@opindex mdalign 30108Align doubles at 64-bit boundaries. Note that this changes the calling 30109conventions, and thus some functions from the standard C library do 30110not work unless you recompile it first with @option{-mdalign}. 30111 30112@item -mrelax 30113@opindex mrelax 30114Shorten some address references at link time, when possible; uses the 30115linker option @option{-relax}. 30116 30117@item -mbigtable 30118@opindex mbigtable 30119Use 32-bit offsets in @code{switch} tables. The default is to use 3012016-bit offsets. 30121 30122@item -mbitops 30123@opindex mbitops 30124Enable the use of bit manipulation instructions on SH2A. 30125 30126@item -mfmovd 30127@opindex mfmovd 30128Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 30129alignment constraints. 30130 30131@item -mrenesas 30132@opindex mrenesas 30133Comply with the calling conventions defined by Renesas. 30134 30135@item -mno-renesas 30136@opindex mno-renesas 30137Comply with the calling conventions defined for GCC before the Renesas 30138conventions were available. This option is the default for all 30139targets of the SH toolchain. 30140 30141@item -mnomacsave 30142@opindex mnomacsave 30143Mark the @code{MAC} register as call-clobbered, even if 30144@option{-mrenesas} is given. 30145 30146@item -mieee 30147@itemx -mno-ieee 30148@opindex mieee 30149@opindex mno-ieee 30150Control the IEEE compliance of floating-point comparisons, which affects the 30151handling of cases where the result of a comparison is unordered. By default 30152@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 30153enabled @option{-mno-ieee} is implicitly set, which results in faster 30154floating-point greater-equal and less-equal comparisons. The implicit settings 30155can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 30156 30157@item -minline-ic_invalidate 30158@opindex minline-ic_invalidate 30159Inline code to invalidate instruction cache entries after setting up 30160nested function trampolines. 30161This option has no effect if @option{-musermode} is in effect and the selected 30162code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi} 30163instruction. 30164If the selected code generation option does not allow the use of the @code{icbi} 30165instruction, and @option{-musermode} is not in effect, the inlined code 30166manipulates the instruction cache address array directly with an associative 30167write. This not only requires privileged mode at run time, but it also 30168fails if the cache line had been mapped via the TLB and has become unmapped. 30169 30170@item -misize 30171@opindex misize 30172Dump instruction size and location in the assembly code. 30173 30174@item -mpadstruct 30175@opindex mpadstruct 30176This option is deprecated. It pads structures to multiple of 4 bytes, 30177which is incompatible with the SH ABI@. 30178 30179@item -matomic-model=@var{model} 30180@opindex matomic-model=@var{model} 30181Sets the model of atomic operations and additional parameters as a comma 30182separated list. For details on the atomic built-in functions see 30183@ref{__atomic Builtins}. The following models and parameters are supported: 30184 30185@table @samp 30186 30187@item none 30188Disable compiler generated atomic sequences and emit library calls for atomic 30189operations. This is the default if the target is not @code{sh*-*-linux*}. 30190 30191@item soft-gusa 30192Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 30193built-in functions. The generated atomic sequences require additional support 30194from the interrupt/exception handling code of the system and are only suitable 30195for SH3* and SH4* single-core systems. This option is enabled by default when 30196the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 30197this option also partially utilizes the hardware atomic instructions 30198@code{movli.l} and @code{movco.l} to create more efficient code, unless 30199@samp{strict} is specified. 30200 30201@item soft-tcb 30202Generate software atomic sequences that use a variable in the thread control 30203block. This is a variation of the gUSA sequences which can also be used on 30204SH1* and SH2* targets. The generated atomic sequences require additional 30205support from the interrupt/exception handling code of the system and are only 30206suitable for single-core systems. When using this model, the @samp{gbr-offset=} 30207parameter has to be specified as well. 30208 30209@item soft-imask 30210Generate software atomic sequences that temporarily disable interrupts by 30211setting @code{SR.IMASK = 1111}. This model works only when the program runs 30212in privileged mode and is only suitable for single-core systems. Additional 30213support from the interrupt/exception handling code of the system is not 30214required. This model is enabled by default when the target is 30215@code{sh*-*-linux*} and SH1* or SH2*. 30216 30217@item hard-llcs 30218Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 30219instructions only. This is only available on SH4A and is suitable for 30220multi-core systems. Since the hardware instructions support only 32 bit atomic 30221variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 30222Code compiled with this option is also compatible with other software 30223atomic model interrupt/exception handling systems if executed on an SH4A 30224system. Additional support from the interrupt/exception handling code of the 30225system is not required for this model. 30226 30227@item gbr-offset= 30228This parameter specifies the offset in bytes of the variable in the thread 30229control block structure that should be used by the generated atomic sequences 30230when the @samp{soft-tcb} model has been selected. For other models this 30231parameter is ignored. The specified value must be an integer multiple of four 30232and in the range 0-1020. 30233 30234@item strict 30235This parameter prevents mixed usage of multiple atomic models, even if they 30236are compatible, and makes the compiler generate atomic sequences of the 30237specified model only. 30238 30239@end table 30240 30241@item -mtas 30242@opindex mtas 30243Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 30244Notice that depending on the particular hardware and software configuration 30245this can degrade overall performance due to the operand cache line flushes 30246that are implied by the @code{tas.b} instruction. On multi-core SH4A 30247processors the @code{tas.b} instruction must be used with caution since it 30248can result in data corruption for certain cache configurations. 30249 30250@item -mprefergot 30251@opindex mprefergot 30252When generating position-independent code, emit function calls using 30253the Global Offset Table instead of the Procedure Linkage Table. 30254 30255@item -musermode 30256@itemx -mno-usermode 30257@opindex musermode 30258@opindex mno-usermode 30259Don't allow (allow) the compiler generating privileged mode code. Specifying 30260@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 30261inlined code would not work in user mode. @option{-musermode} is the default 30262when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 30263@option{-musermode} has no effect, since there is no user mode. 30264 30265@item -multcost=@var{number} 30266@opindex multcost=@var{number} 30267Set the cost to assume for a multiply insn. 30268 30269@item -mdiv=@var{strategy} 30270@opindex mdiv=@var{strategy} 30271Set the division strategy to be used for integer division operations. 30272@var{strategy} can be one of: 30273 30274@table @samp 30275 30276@item call-div1 30277Calls a library function that uses the single-step division instruction 30278@code{div1} to perform the operation. Division by zero calculates an 30279unspecified result and does not trap. This is the default except for SH4, 30280SH2A and SHcompact. 30281 30282@item call-fp 30283Calls a library function that performs the operation in double precision 30284floating point. Division by zero causes a floating-point exception. This is 30285the default for SHcompact with FPU. Specifying this for targets that do not 30286have a double precision FPU defaults to @code{call-div1}. 30287 30288@item call-table 30289Calls a library function that uses a lookup table for small divisors and 30290the @code{div1} instruction with case distinction for larger divisors. Division 30291by zero calculates an unspecified result and does not trap. This is the default 30292for SH4. Specifying this for targets that do not have dynamic shift 30293instructions defaults to @code{call-div1}. 30294 30295@end table 30296 30297When a division strategy has not been specified the default strategy is 30298selected based on the current target. For SH2A the default strategy is to 30299use the @code{divs} and @code{divu} instructions instead of library function 30300calls. 30301 30302@item -maccumulate-outgoing-args 30303@opindex maccumulate-outgoing-args 30304Reserve space once for outgoing arguments in the function prologue rather 30305than around each call. Generally beneficial for performance and size. Also 30306needed for unwinding to avoid changing the stack frame around conditional code. 30307 30308@item -mdivsi3_libfunc=@var{name} 30309@opindex mdivsi3_libfunc=@var{name} 30310Set the name of the library function used for 32-bit signed division to 30311@var{name}. 30312This only affects the name used in the @samp{call} division strategies, and 30313the compiler still expects the same sets of input/output/clobbered registers as 30314if this option were not present. 30315 30316@item -mfixed-range=@var{register-range} 30317@opindex mfixed-range 30318Generate code treating the given register range as fixed registers. 30319A fixed register is one that the register allocator cannot use. This is 30320useful when compiling kernel code. A register range is specified as 30321two registers separated by a dash. Multiple register ranges can be 30322specified separated by a comma. 30323 30324@item -mbranch-cost=@var{num} 30325@opindex mbranch-cost=@var{num} 30326Assume @var{num} to be the cost for a branch instruction. Higher numbers 30327make the compiler try to generate more branch-free code if possible. 30328If not specified the value is selected depending on the processor type that 30329is being compiled for. 30330 30331@item -mzdcbranch 30332@itemx -mno-zdcbranch 30333@opindex mzdcbranch 30334@opindex mno-zdcbranch 30335Assume (do not assume) that zero displacement conditional branch instructions 30336@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 30337compiler prefers zero displacement branch code sequences. This is 30338enabled by default when generating code for SH4 and SH4A. It can be explicitly 30339disabled by specifying @option{-mno-zdcbranch}. 30340 30341@item -mcbranch-force-delay-slot 30342@opindex mcbranch-force-delay-slot 30343Force the usage of delay slots for conditional branches, which stuffs the delay 30344slot with a @code{nop} if a suitable instruction cannot be found. By default 30345this option is disabled. It can be enabled to work around hardware bugs as 30346found in the original SH7055. 30347 30348@item -mfused-madd 30349@itemx -mno-fused-madd 30350@opindex mfused-madd 30351@opindex mno-fused-madd 30352Generate code that uses (does not use) the floating-point multiply and 30353accumulate instructions. These instructions are generated by default 30354if hardware floating point is used. The machine-dependent 30355@option{-mfused-madd} option is now mapped to the machine-independent 30356@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 30357mapped to @option{-ffp-contract=off}. 30358 30359@item -mfsca 30360@itemx -mno-fsca 30361@opindex mfsca 30362@opindex mno-fsca 30363Allow or disallow the compiler to emit the @code{fsca} instruction for sine 30364and cosine approximations. The option @option{-mfsca} must be used in 30365combination with @option{-funsafe-math-optimizations}. It is enabled by default 30366when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 30367approximations even if @option{-funsafe-math-optimizations} is in effect. 30368 30369@item -mfsrra 30370@itemx -mno-fsrra 30371@opindex mfsrra 30372@opindex mno-fsrra 30373Allow or disallow the compiler to emit the @code{fsrra} instruction for 30374reciprocal square root approximations. The option @option{-mfsrra} must be used 30375in combination with @option{-funsafe-math-optimizations} and 30376@option{-ffinite-math-only}. It is enabled by default when generating code for 30377SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 30378even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 30379in effect. 30380 30381@item -mpretend-cmove 30382@opindex mpretend-cmove 30383Prefer zero-displacement conditional branches for conditional move instruction 30384patterns. This can result in faster code on the SH4 processor. 30385 30386@item -mfdpic 30387@opindex fdpic 30388Generate code using the FDPIC ABI. 30389 30390@end table 30391 30392@node Solaris 2 Options 30393@subsection Solaris 2 Options 30394@cindex Solaris 2 options 30395 30396These @samp{-m} options are supported on Solaris 2: 30397 30398@table @gcctabopt 30399@item -mclear-hwcap 30400@opindex mclear-hwcap 30401@option{-mclear-hwcap} tells the compiler to remove the hardware 30402capabilities generated by the Solaris assembler. This is only necessary 30403when object files use ISA extensions not supported by the current 30404machine, but check at runtime whether or not to use them. 30405 30406@item -mimpure-text 30407@opindex mimpure-text 30408@option{-mimpure-text}, used in addition to @option{-shared}, tells 30409the compiler to not pass @option{-z text} to the linker when linking a 30410shared object. Using this option, you can link position-dependent 30411code into a shared object. 30412 30413@option{-mimpure-text} suppresses the ``relocations remain against 30414allocatable but non-writable sections'' linker error message. 30415However, the necessary relocations trigger copy-on-write, and the 30416shared object is not actually shared across processes. Instead of 30417using @option{-mimpure-text}, you should compile all source code with 30418@option{-fpic} or @option{-fPIC}. 30419 30420@end table 30421 30422These switches are supported in addition to the above on Solaris 2: 30423 30424@table @gcctabopt 30425@item -pthreads 30426@opindex pthreads 30427This is a synonym for @option{-pthread}. 30428@end table 30429 30430@node SPARC Options 30431@subsection SPARC Options 30432@cindex SPARC options 30433 30434These @samp{-m} options are supported on the SPARC: 30435 30436@table @gcctabopt 30437@item -mno-app-regs 30438@itemx -mapp-regs 30439@opindex mno-app-regs 30440@opindex mapp-regs 30441Specify @option{-mapp-regs} to generate output using the global registers 304422 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 30443global register 1, each global register 2 through 4 is then treated as an 30444allocable register that is clobbered by function calls. This is the default. 30445 30446To be fully SVR4 ABI-compliant at the cost of some performance loss, 30447specify @option{-mno-app-regs}. You should compile libraries and system 30448software with this option. 30449 30450@item -mflat 30451@itemx -mno-flat 30452@opindex mflat 30453@opindex mno-flat 30454With @option{-mflat}, the compiler does not generate save/restore instructions 30455and uses a ``flat'' or single register window model. This model is compatible 30456with the regular register window model. The local registers and the input 30457registers (0--5) are still treated as ``call-saved'' registers and are 30458saved on the stack as needed. 30459 30460With @option{-mno-flat} (the default), the compiler generates save/restore 30461instructions (except for leaf functions). This is the normal operating mode. 30462 30463@item -mfpu 30464@itemx -mhard-float 30465@opindex mfpu 30466@opindex mhard-float 30467Generate output containing floating-point instructions. This is the 30468default. 30469 30470@item -mno-fpu 30471@itemx -msoft-float 30472@opindex mno-fpu 30473@opindex msoft-float 30474Generate output containing library calls for floating point. 30475@strong{Warning:} the requisite libraries are not available for all SPARC 30476targets. Normally the facilities of the machine's usual C compiler are 30477used, but this cannot be done directly in cross-compilation. You must make 30478your own arrangements to provide suitable library functions for 30479cross-compilation. The embedded targets @samp{sparc-*-aout} and 30480@samp{sparclite-*-*} do provide software floating-point support. 30481 30482@option{-msoft-float} changes the calling convention in the output file; 30483therefore, it is only useful if you compile @emph{all} of a program with 30484this option. In particular, you need to compile @file{libgcc.a}, the 30485library that comes with GCC, with @option{-msoft-float} in order for 30486this to work. 30487 30488@item -mhard-quad-float 30489@opindex mhard-quad-float 30490Generate output containing quad-word (long double) floating-point 30491instructions. 30492 30493@item -msoft-quad-float 30494@opindex msoft-quad-float 30495Generate output containing library calls for quad-word (long double) 30496floating-point instructions. The functions called are those specified 30497in the SPARC ABI@. This is the default. 30498 30499As of this writing, there are no SPARC implementations that have hardware 30500support for the quad-word floating-point instructions. They all invoke 30501a trap handler for one of these instructions, and then the trap handler 30502emulates the effect of the instruction. Because of the trap handler overhead, 30503this is much slower than calling the ABI library routines. Thus the 30504@option{-msoft-quad-float} option is the default. 30505 30506@item -mno-unaligned-doubles 30507@itemx -munaligned-doubles 30508@opindex mno-unaligned-doubles 30509@opindex munaligned-doubles 30510Assume that doubles have 8-byte alignment. This is the default. 30511 30512With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 30513alignment only if they are contained in another type, or if they have an 30514absolute address. Otherwise, it assumes they have 4-byte alignment. 30515Specifying this option avoids some rare compatibility problems with code 30516generated by other compilers. It is not the default because it results 30517in a performance loss, especially for floating-point code. 30518 30519@item -muser-mode 30520@itemx -mno-user-mode 30521@opindex muser-mode 30522@opindex mno-user-mode 30523Do not generate code that can only run in supervisor mode. This is relevant 30524only for the @code{casa} instruction emitted for the LEON3 processor. This 30525is the default. 30526 30527@item -mfaster-structs 30528@itemx -mno-faster-structs 30529@opindex mfaster-structs 30530@opindex mno-faster-structs 30531With @option{-mfaster-structs}, the compiler assumes that structures 30532should have 8-byte alignment. This enables the use of pairs of 30533@code{ldd} and @code{std} instructions for copies in structure 30534assignment, in place of twice as many @code{ld} and @code{st} pairs. 30535However, the use of this changed alignment directly violates the SPARC 30536ABI@. Thus, it's intended only for use on targets where the developer 30537acknowledges that their resulting code is not directly in line with 30538the rules of the ABI@. 30539 30540@item -mstd-struct-return 30541@itemx -mno-std-struct-return 30542@opindex mstd-struct-return 30543@opindex mno-std-struct-return 30544With @option{-mstd-struct-return}, the compiler generates checking code 30545in functions returning structures or unions to detect size mismatches 30546between the two sides of function calls, as per the 32-bit ABI@. 30547 30548The default is @option{-mno-std-struct-return}. This option has no effect 30549in 64-bit mode. 30550 30551@item -mlra 30552@itemx -mno-lra 30553@opindex mlra 30554@opindex mno-lra 30555Enable Local Register Allocation. This is the default for SPARC since GCC 7 30556so @option{-mno-lra} needs to be passed to get old Reload. 30557 30558@item -mcpu=@var{cpu_type} 30559@opindex mcpu 30560Set the instruction set, register set, and instruction scheduling parameters 30561for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 30562@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 30563@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite}, 30564@samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, 30565@samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, 30566@samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and 30567@samp{m8}. 30568 30569Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 30570which selects the best architecture option for the host processor. 30571@option{-mcpu=native} has no effect if GCC does not recognize 30572the processor. 30573 30574Default instruction scheduling parameters are used for values that select 30575an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 30576@samp{sparclite}, @samp{sparclet}, @samp{v9}. 30577 30578Here is a list of each supported architecture and their supported 30579implementations. 30580 30581@table @asis 30582@item v7 30583cypress, leon3v7 30584 30585@item v8 30586supersparc, hypersparc, leon, leon3, leon5 30587 30588@item sparclite 30589f930, f934, sparclite86x 30590 30591@item sparclet 30592tsc701 30593 30594@item v9 30595ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, 30596niagara7, m8 30597@end table 30598 30599By default (unless configured otherwise), GCC generates code for the V7 30600variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 30601additionally optimizes it for the Cypress CY7C602 chip, as used in the 30602SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 30603SPARCStation 1, 2, IPX etc. 30604 30605With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 30606architecture. The only difference from V7 code is that the compiler emits 30607the integer multiply and integer divide instructions which exist in SPARC-V8 30608but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 30609optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 306102000 series. 30611 30612With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 30613the SPARC architecture. This adds the integer multiply, integer divide step 30614and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 30615With @option{-mcpu=f930}, the compiler additionally optimizes it for the 30616Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 30617@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 30618MB86934 chip, which is the more recent SPARClite with FPU@. 30619 30620With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 30621the SPARC architecture. This adds the integer multiply, multiply/accumulate, 30622integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 30623but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 30624optimizes it for the TEMIC SPARClet chip. 30625 30626With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 30627architecture. This adds 64-bit integer and floating-point move instructions, 306283 additional floating-point condition code registers and conditional move 30629instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 30630optimizes it for the Sun UltraSPARC I/II/IIi chips. With 30631@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 30632Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 30633@option{-mcpu=niagara}, the compiler additionally optimizes it for 30634Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 30635additionally optimizes it for Sun UltraSPARC T2 chips. With 30636@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 30637UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 30638additionally optimizes it for Sun UltraSPARC T4 chips. With 30639@option{-mcpu=niagara7}, the compiler additionally optimizes it for 30640Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler 30641additionally optimizes it for Oracle M8 chips. 30642 30643@item -mtune=@var{cpu_type} 30644@opindex mtune 30645Set the instruction scheduling parameters for machine type 30646@var{cpu_type}, but do not set the instruction set or register set that the 30647option @option{-mcpu=@var{cpu_type}} does. 30648 30649The same values for @option{-mcpu=@var{cpu_type}} can be used for 30650@option{-mtune=@var{cpu_type}}, but the only useful values are those 30651that select a particular CPU implementation. Those are 30652@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon}, 30653@samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934}, 30654@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 30655@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3}, 30656@samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris 30657and GNU/Linux toolchains, @samp{native} can also be used. 30658 30659@item -mv8plus 30660@itemx -mno-v8plus 30661@opindex mv8plus 30662@opindex mno-v8plus 30663With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 30664difference from the V8 ABI is that the global and out registers are 30665considered 64 bits wide. This is enabled by default on Solaris in 32-bit 30666mode for all SPARC-V9 processors. 30667 30668@item -mvis 30669@itemx -mno-vis 30670@opindex mvis 30671@opindex mno-vis 30672With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 30673Visual Instruction Set extensions. The default is @option{-mno-vis}. 30674 30675@item -mvis2 30676@itemx -mno-vis2 30677@opindex mvis2 30678@opindex mno-vis2 30679With @option{-mvis2}, GCC generates code that takes advantage of 30680version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 30681default is @option{-mvis2} when targeting a cpu that supports such 30682instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 30683also sets @option{-mvis}. 30684 30685@item -mvis3 30686@itemx -mno-vis3 30687@opindex mvis3 30688@opindex mno-vis3 30689With @option{-mvis3}, GCC generates code that takes advantage of 30690version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 30691default is @option{-mvis3} when targeting a cpu that supports such 30692instructions, such as niagara-3 and later. Setting @option{-mvis3} 30693also sets @option{-mvis2} and @option{-mvis}. 30694 30695@item -mvis4 30696@itemx -mno-vis4 30697@opindex mvis4 30698@opindex mno-vis4 30699With @option{-mvis4}, GCC generates code that takes advantage of 30700version 4.0 of the UltraSPARC Visual Instruction Set extensions. The 30701default is @option{-mvis4} when targeting a cpu that supports such 30702instructions, such as niagara-7 and later. Setting @option{-mvis4} 30703also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}. 30704 30705@item -mvis4b 30706@itemx -mno-vis4b 30707@opindex mvis4b 30708@opindex mno-vis4b 30709With @option{-mvis4b}, GCC generates code that takes advantage of 30710version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus 30711the additional VIS instructions introduced in the Oracle SPARC 30712Architecture 2017. The default is @option{-mvis4b} when targeting a 30713cpu that supports such instructions, such as m8 and later. Setting 30714@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3}, 30715@option{-mvis2} and @option{-mvis}. 30716 30717@item -mcbcond 30718@itemx -mno-cbcond 30719@opindex mcbcond 30720@opindex mno-cbcond 30721With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC 30722Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond} 30723when targeting a CPU that supports such instructions, such as Niagara-4 and 30724later. 30725 30726@item -mfmaf 30727@itemx -mno-fmaf 30728@opindex mfmaf 30729@opindex mno-fmaf 30730With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 30731Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf} 30732when targeting a CPU that supports such instructions, such as Niagara-3 and 30733later. 30734 30735@item -mfsmuld 30736@itemx -mno-fsmuld 30737@opindex mfsmuld 30738@opindex mno-fsmuld 30739With @option{-mfsmuld}, GCC generates code that takes advantage of the 30740Floating-point Multiply Single to Double (FsMULd) instruction. The default is 30741@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8 30742or V9 with FPU except @option{-mcpu=leon}. 30743 30744@item -mpopc 30745@itemx -mno-popc 30746@opindex mpopc 30747@opindex mno-popc 30748With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 30749Population Count instruction. The default is @option{-mpopc} 30750when targeting a CPU that supports such an instruction, such as Niagara-2 and 30751later. 30752 30753@item -msubxc 30754@itemx -mno-subxc 30755@opindex msubxc 30756@opindex mno-subxc 30757With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC 30758Subtract-Extended-with-Carry instruction. The default is @option{-msubxc} 30759when targeting a CPU that supports such an instruction, such as Niagara-7 and 30760later. 30761 30762@item -mfix-at697f 30763@opindex mfix-at697f 30764Enable the documented workaround for the single erratum of the Atmel AT697F 30765processor (which corresponds to erratum #13 of the AT697E processor). 30766 30767@item -mfix-ut699 30768@opindex mfix-ut699 30769Enable the documented workarounds for the floating-point errata and the data 30770cache nullify errata of the UT699 processor. 30771 30772@item -mfix-ut700 30773@opindex mfix-ut700 30774Enable the documented workaround for the back-to-back store errata of 30775the UT699E/UT700 processor. 30776 30777@item -mfix-gr712rc 30778@opindex mfix-gr712rc 30779Enable the documented workaround for the back-to-back store errata of 30780the GR712RC processor. 30781@end table 30782 30783These @samp{-m} options are supported in addition to the above 30784on SPARC-V9 processors in 64-bit environments: 30785 30786@table @gcctabopt 30787@item -m32 30788@itemx -m64 30789@opindex m32 30790@opindex m64 30791Generate code for a 32-bit or 64-bit environment. 30792The 32-bit environment sets int, long and pointer to 32 bits. 30793The 64-bit environment sets int to 32 bits and long and pointer 30794to 64 bits. 30795 30796@item -mcmodel=@var{which} 30797@opindex mcmodel 30798Set the code model to one of 30799 30800@table @samp 30801@item medlow 30802The Medium/Low code model: 64-bit addresses, programs 30803must be linked in the low 32 bits of memory. Programs can be statically 30804or dynamically linked. 30805 30806@item medmid 30807The Medium/Middle code model: 64-bit addresses, programs 30808must be linked in the low 44 bits of memory, the text and data segments must 30809be less than 2GB in size and the data segment must be located within 2GB of 30810the text segment. 30811 30812@item medany 30813The Medium/Anywhere code model: 64-bit addresses, programs 30814may be linked anywhere in memory, the text and data segments must be less 30815than 2GB in size and the data segment must be located within 2GB of the 30816text segment. 30817 30818@item embmedany 30819The Medium/Anywhere code model for embedded systems: 3082064-bit addresses, the text and data segments must be less than 2GB in 30821size, both starting anywhere in memory (determined at link time). The 30822global register %g4 points to the base of the data segment. Programs 30823are statically linked and PIC is not supported. 30824@end table 30825 30826@item -mmemory-model=@var{mem-model} 30827@opindex mmemory-model 30828Set the memory model in force on the processor to one of 30829 30830@table @samp 30831@item default 30832The default memory model for the processor and operating system. 30833 30834@item rmo 30835Relaxed Memory Order 30836 30837@item pso 30838Partial Store Order 30839 30840@item tso 30841Total Store Order 30842 30843@item sc 30844Sequential Consistency 30845@end table 30846 30847These memory models are formally defined in Appendix D of the SPARC-V9 30848architecture manual, as set in the processor's @code{PSTATE.MM} field. 30849 30850@item -mstack-bias 30851@itemx -mno-stack-bias 30852@opindex mstack-bias 30853@opindex mno-stack-bias 30854With @option{-mstack-bias}, GCC assumes that the stack pointer, and 30855frame pointer if present, are offset by @minus{}2047 which must be added back 30856when making stack frame references. This is the default in 64-bit mode. 30857Otherwise, assume no such offset is present. 30858@end table 30859 30860@node System V Options 30861@subsection Options for System V 30862 30863These additional options are available on System V Release 4 for 30864compatibility with other compilers on those systems: 30865 30866@table @gcctabopt 30867@item -G 30868@opindex G 30869Create a shared object. 30870It is recommended that @option{-symbolic} or @option{-shared} be used instead. 30871 30872@item -Qy 30873@opindex Qy 30874Identify the versions of each tool used by the compiler, in a 30875@code{.ident} assembler directive in the output. 30876 30877@item -Qn 30878@opindex Qn 30879Refrain from adding @code{.ident} directives to the output file (this is 30880the default). 30881 30882@item -YP,@var{dirs} 30883@opindex YP 30884Search the directories @var{dirs}, and no others, for libraries 30885specified with @option{-l}. 30886 30887@item -Ym,@var{dir} 30888@opindex Ym 30889Look in the directory @var{dir} to find the M4 preprocessor. 30890The assembler uses this option. 30891@c This is supposed to go with a -Yd for predefined M4 macro files, but 30892@c the generic assembler that comes with Solaris takes just -Ym. 30893@end table 30894 30895@node TILE-Gx Options 30896@subsection TILE-Gx Options 30897@cindex TILE-Gx options 30898 30899These @samp{-m} options are supported on the TILE-Gx: 30900 30901@table @gcctabopt 30902@item -mcmodel=small 30903@opindex mcmodel=small 30904Generate code for the small model. The distance for direct calls is 30905limited to 500M in either direction. PC-relative addresses are 32 30906bits. Absolute addresses support the full address range. 30907 30908@item -mcmodel=large 30909@opindex mcmodel=large 30910Generate code for the large model. There is no limitation on call 30911distance, pc-relative addresses, or absolute addresses. 30912 30913@item -mcpu=@var{name} 30914@opindex mcpu 30915Selects the type of CPU to be targeted. Currently the only supported 30916type is @samp{tilegx}. 30917 30918@item -m32 30919@itemx -m64 30920@opindex m32 30921@opindex m64 30922Generate code for a 32-bit or 64-bit environment. The 32-bit 30923environment sets int, long, and pointer to 32 bits. The 64-bit 30924environment sets int to 32 bits and long and pointer to 64 bits. 30925 30926@item -mbig-endian 30927@itemx -mlittle-endian 30928@opindex mbig-endian 30929@opindex mlittle-endian 30930Generate code in big/little endian mode, respectively. 30931@end table 30932 30933@node TILEPro Options 30934@subsection TILEPro Options 30935@cindex TILEPro options 30936 30937These @samp{-m} options are supported on the TILEPro: 30938 30939@table @gcctabopt 30940@item -mcpu=@var{name} 30941@opindex mcpu 30942Selects the type of CPU to be targeted. Currently the only supported 30943type is @samp{tilepro}. 30944 30945@item -m32 30946@opindex m32 30947Generate code for a 32-bit environment, which sets int, long, and 30948pointer to 32 bits. This is the only supported behavior so the flag 30949is essentially ignored. 30950@end table 30951 30952@node V850 Options 30953@subsection V850 Options 30954@cindex V850 Options 30955 30956These @samp{-m} options are defined for V850 implementations: 30957 30958@table @gcctabopt 30959@item -mlong-calls 30960@itemx -mno-long-calls 30961@opindex mlong-calls 30962@opindex mno-long-calls 30963Treat all calls as being far away (near). If calls are assumed to be 30964far away, the compiler always loads the function's address into a 30965register, and calls indirect through the pointer. 30966 30967@item -mno-ep 30968@itemx -mep 30969@opindex mno-ep 30970@opindex mep 30971Do not optimize (do optimize) basic blocks that use the same index 30972pointer 4 or more times to copy pointer into the @code{ep} register, and 30973use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 30974option is on by default if you optimize. 30975 30976@item -mno-prolog-function 30977@itemx -mprolog-function 30978@opindex mno-prolog-function 30979@opindex mprolog-function 30980Do not use (do use) external functions to save and restore registers 30981at the prologue and epilogue of a function. The external functions 30982are slower, but use less code space if more than one function saves 30983the same number of registers. The @option{-mprolog-function} option 30984is on by default if you optimize. 30985 30986@item -mspace 30987@opindex mspace 30988Try to make the code as small as possible. At present, this just turns 30989on the @option{-mep} and @option{-mprolog-function} options. 30990 30991@item -mtda=@var{n} 30992@opindex mtda 30993Put static or global variables whose size is @var{n} bytes or less into 30994the tiny data area that register @code{ep} points to. The tiny data 30995area can hold up to 256 bytes in total (128 bytes for byte references). 30996 30997@item -msda=@var{n} 30998@opindex msda 30999Put static or global variables whose size is @var{n} bytes or less into 31000the small data area that register @code{gp} points to. The small data 31001area can hold up to 64 kilobytes. 31002 31003@item -mzda=@var{n} 31004@opindex mzda 31005Put static or global variables whose size is @var{n} bytes or less into 31006the first 32 kilobytes of memory. 31007 31008@item -mv850 31009@opindex mv850 31010Specify that the target processor is the V850. 31011 31012@item -mv850e3v5 31013@opindex mv850e3v5 31014Specify that the target processor is the V850E3V5. The preprocessor 31015constant @code{__v850e3v5__} is defined if this option is used. 31016 31017@item -mv850e2v4 31018@opindex mv850e2v4 31019Specify that the target processor is the V850E3V5. This is an alias for 31020the @option{-mv850e3v5} option. 31021 31022@item -mv850e2v3 31023@opindex mv850e2v3 31024Specify that the target processor is the V850E2V3. The preprocessor 31025constant @code{__v850e2v3__} is defined if this option is used. 31026 31027@item -mv850e2 31028@opindex mv850e2 31029Specify that the target processor is the V850E2. The preprocessor 31030constant @code{__v850e2__} is defined if this option is used. 31031 31032@item -mv850e1 31033@opindex mv850e1 31034Specify that the target processor is the V850E1. The preprocessor 31035constants @code{__v850e1__} and @code{__v850e__} are defined if 31036this option is used. 31037 31038@item -mv850es 31039@opindex mv850es 31040Specify that the target processor is the V850ES. This is an alias for 31041the @option{-mv850e1} option. 31042 31043@item -mv850e 31044@opindex mv850e 31045Specify that the target processor is the V850E@. The preprocessor 31046constant @code{__v850e__} is defined if this option is used. 31047 31048If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 31049nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 31050are defined then a default target processor is chosen and the 31051relevant @samp{__v850*__} preprocessor constant is defined. 31052 31053The preprocessor constants @code{__v850} and @code{__v851__} are always 31054defined, regardless of which processor variant is the target. 31055 31056@item -mdisable-callt 31057@itemx -mno-disable-callt 31058@opindex mdisable-callt 31059@opindex mno-disable-callt 31060This option suppresses generation of the @code{CALLT} instruction for the 31061v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 31062architecture. 31063 31064This option is enabled by default when the RH850 ABI is 31065in use (see @option{-mrh850-abi}), and disabled by default when the 31066GCC ABI is in use. If @code{CALLT} instructions are being generated 31067then the C preprocessor symbol @code{__V850_CALLT__} is defined. 31068 31069@item -mrelax 31070@itemx -mno-relax 31071@opindex mrelax 31072@opindex mno-relax 31073Pass on (or do not pass on) the @option{-mrelax} command-line option 31074to the assembler. 31075 31076@item -mlong-jumps 31077@itemx -mno-long-jumps 31078@opindex mlong-jumps 31079@opindex mno-long-jumps 31080Disable (or re-enable) the generation of PC-relative jump instructions. 31081 31082@item -msoft-float 31083@itemx -mhard-float 31084@opindex msoft-float 31085@opindex mhard-float 31086Disable (or re-enable) the generation of hardware floating point 31087instructions. This option is only significant when the target 31088architecture is @samp{V850E2V3} or higher. If hardware floating point 31089instructions are being generated then the C preprocessor symbol 31090@code{__FPU_OK__} is defined, otherwise the symbol 31091@code{__NO_FPU__} is defined. 31092 31093@item -mloop 31094@opindex mloop 31095Enables the use of the e3v5 LOOP instruction. The use of this 31096instruction is not enabled by default when the e3v5 architecture is 31097selected because its use is still experimental. 31098 31099@item -mrh850-abi 31100@itemx -mghs 31101@opindex mrh850-abi 31102@opindex mghs 31103Enables support for the RH850 version of the V850 ABI. This is the 31104default. With this version of the ABI the following rules apply: 31105 31106@itemize 31107@item 31108Integer sized structures and unions are returned via a memory pointer 31109rather than a register. 31110 31111@item 31112Large structures and unions (more than 8 bytes in size) are passed by 31113value. 31114 31115@item 31116Functions are aligned to 16-bit boundaries. 31117 31118@item 31119The @option{-m8byte-align} command-line option is supported. 31120 31121@item 31122The @option{-mdisable-callt} command-line option is enabled by 31123default. The @option{-mno-disable-callt} command-line option is not 31124supported. 31125@end itemize 31126 31127When this version of the ABI is enabled the C preprocessor symbol 31128@code{__V850_RH850_ABI__} is defined. 31129 31130@item -mgcc-abi 31131@opindex mgcc-abi 31132Enables support for the old GCC version of the V850 ABI. With this 31133version of the ABI the following rules apply: 31134 31135@itemize 31136@item 31137Integer sized structures and unions are returned in register @code{r10}. 31138 31139@item 31140Large structures and unions (more than 8 bytes in size) are passed by 31141reference. 31142 31143@item 31144Functions are aligned to 32-bit boundaries, unless optimizing for 31145size. 31146 31147@item 31148The @option{-m8byte-align} command-line option is not supported. 31149 31150@item 31151The @option{-mdisable-callt} command-line option is supported but not 31152enabled by default. 31153@end itemize 31154 31155When this version of the ABI is enabled the C preprocessor symbol 31156@code{__V850_GCC_ABI__} is defined. 31157 31158@item -m8byte-align 31159@itemx -mno-8byte-align 31160@opindex m8byte-align 31161@opindex mno-8byte-align 31162Enables support for @code{double} and @code{long long} types to be 31163aligned on 8-byte boundaries. The default is to restrict the 31164alignment of all objects to at most 4-bytes. When 31165@option{-m8byte-align} is in effect the C preprocessor symbol 31166@code{__V850_8BYTE_ALIGN__} is defined. 31167 31168@item -mbig-switch 31169@opindex mbig-switch 31170Generate code suitable for big switch tables. Use this option only if 31171the assembler/linker complain about out of range branches within a switch 31172table. 31173 31174@item -mapp-regs 31175@opindex mapp-regs 31176This option causes r2 and r5 to be used in the code generated by 31177the compiler. This setting is the default. 31178 31179@item -mno-app-regs 31180@opindex mno-app-regs 31181This option causes r2 and r5 to be treated as fixed registers. 31182 31183@end table 31184 31185@node VAX Options 31186@subsection VAX Options 31187@cindex VAX options 31188 31189These @samp{-m} options are defined for the VAX: 31190 31191@table @gcctabopt 31192@item -munix 31193@opindex munix 31194Do not output certain jump instructions (@code{aobleq} and so on) 31195that the Unix assembler for the VAX cannot handle across long 31196ranges. 31197 31198@item -mgnu 31199@opindex mgnu 31200Do output those jump instructions, on the assumption that the 31201GNU assembler is being used. 31202 31203@item -mg 31204@opindex mg 31205Output code for G-format floating-point numbers instead of D-format. 31206 31207@item -mlra 31208@itemx -mno-lra 31209@opindex mlra 31210@opindex mno-lra 31211Enable Local Register Allocation. This is still experimental for the VAX, 31212so by default the compiler uses standard reload. 31213@end table 31214 31215@node Visium Options 31216@subsection Visium Options 31217@cindex Visium options 31218 31219@table @gcctabopt 31220 31221@item -mdebug 31222@opindex mdebug 31223A program which performs file I/O and is destined to run on an MCM target 31224should be linked with this option. It causes the libraries libc.a and 31225libdebug.a to be linked. The program should be run on the target under 31226the control of the GDB remote debugging stub. 31227 31228@item -msim 31229@opindex msim 31230A program which performs file I/O and is destined to run on the simulator 31231should be linked with option. This causes libraries libc.a and libsim.a to 31232be linked. 31233 31234@item -mfpu 31235@itemx -mhard-float 31236@opindex mfpu 31237@opindex mhard-float 31238Generate code containing floating-point instructions. This is the 31239default. 31240 31241@item -mno-fpu 31242@itemx -msoft-float 31243@opindex mno-fpu 31244@opindex msoft-float 31245Generate code containing library calls for floating-point. 31246 31247@option{-msoft-float} changes the calling convention in the output file; 31248therefore, it is only useful if you compile @emph{all} of a program with 31249this option. In particular, you need to compile @file{libgcc.a}, the 31250library that comes with GCC, with @option{-msoft-float} in order for 31251this to work. 31252 31253@item -mcpu=@var{cpu_type} 31254@opindex mcpu 31255Set the instruction set, register set, and instruction scheduling parameters 31256for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 31257@samp{mcm}, @samp{gr5} and @samp{gr6}. 31258 31259@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 31260 31261By default (unless configured otherwise), GCC generates code for the GR5 31262variant of the Visium architecture. 31263 31264With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 31265architecture. The only difference from GR5 code is that the compiler will 31266generate block move instructions. 31267 31268@item -mtune=@var{cpu_type} 31269@opindex mtune 31270Set the instruction scheduling parameters for machine type @var{cpu_type}, 31271but do not set the instruction set or register set that the option 31272@option{-mcpu=@var{cpu_type}} would. 31273 31274@item -msv-mode 31275@opindex msv-mode 31276Generate code for the supervisor mode, where there are no restrictions on 31277the access to general registers. This is the default. 31278 31279@item -muser-mode 31280@opindex muser-mode 31281Generate code for the user mode, where the access to some general registers 31282is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 31283mode; on the GR6, only registers r29 to r31 are affected. 31284@end table 31285 31286@node VMS Options 31287@subsection VMS Options 31288 31289These @samp{-m} options are defined for the VMS implementations: 31290 31291@table @gcctabopt 31292@item -mvms-return-codes 31293@opindex mvms-return-codes 31294Return VMS condition codes from @code{main}. The default is to return POSIX-style 31295condition (e.g.@: error) codes. 31296 31297@item -mdebug-main=@var{prefix} 31298@opindex mdebug-main=@var{prefix} 31299Flag the first routine whose name starts with @var{prefix} as the main 31300routine for the debugger. 31301 31302@item -mmalloc64 31303@opindex mmalloc64 31304Default to 64-bit memory allocation routines. 31305 31306@item -mpointer-size=@var{size} 31307@opindex mpointer-size=@var{size} 31308Set the default size of pointers. Possible options for @var{size} are 31309@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 31310for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 31311The later option disables @code{pragma pointer_size}. 31312@end table 31313 31314@node VxWorks Options 31315@subsection VxWorks Options 31316@cindex VxWorks Options 31317 31318The options in this section are defined for all VxWorks targets. 31319Options specific to the target hardware are listed with the other 31320options for that target. 31321 31322@table @gcctabopt 31323@item -mrtp 31324@opindex mrtp 31325GCC can generate code for both VxWorks kernels and real time processes 31326(RTPs). This option switches from the former to the latter. It also 31327defines the preprocessor macro @code{__RTP__}. 31328 31329@item -non-static 31330@opindex non-static 31331Link an RTP executable against shared libraries rather than static 31332libraries. The options @option{-static} and @option{-shared} can 31333also be used for RTPs (@pxref{Link Options}); @option{-static} 31334is the default. 31335 31336@item -Bstatic 31337@itemx -Bdynamic 31338@opindex Bstatic 31339@opindex Bdynamic 31340These options are passed down to the linker. They are defined for 31341compatibility with Diab. 31342 31343@item -Xbind-lazy 31344@opindex Xbind-lazy 31345Enable lazy binding of function calls. This option is equivalent to 31346@option{-Wl,-z,now} and is defined for compatibility with Diab. 31347 31348@item -Xbind-now 31349@opindex Xbind-now 31350Disable lazy binding of function calls. This option is the default and 31351is defined for compatibility with Diab. 31352@end table 31353 31354@node x86 Options 31355@subsection x86 Options 31356@cindex x86 Options 31357 31358These @samp{-m} options are defined for the x86 family of computers. 31359 31360@table @gcctabopt 31361 31362@item -march=@var{cpu-type} 31363@opindex march 31364Generate instructions for the machine type @var{cpu-type}. In contrast to 31365@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 31366for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 31367to generate code that may not run at all on processors other than the one 31368indicated. Specifying @option{-march=@var{cpu-type}} implies 31369@option{-mtune=@var{cpu-type}}, except where noted otherwise. 31370 31371The choices for @var{cpu-type} are: 31372 31373@table @samp 31374@item native 31375This selects the CPU to generate code for at compilation time by determining 31376the processor type of the compiling machine. Using @option{-march=native} 31377enables all instruction subsets supported by the local machine (hence 31378the result might not run on different machines). Using @option{-mtune=native} 31379produces code optimized for the local machine under the constraints 31380of the selected instruction set. 31381 31382@item x86-64 31383A generic CPU with 64-bit extensions. 31384 31385@item x86-64-v2 31386@itemx x86-64-v3 31387@itemx x86-64-v4 31388These choices for @var{cpu-type} select the corresponding 31389micro-architecture level from the x86-64 psABI. On ABIs other than 31390the x86-64 psABI they select the same CPU features as the x86-64 psABI 31391documents for the particular micro-architecture level. 31392 31393Since these @var{cpu-type} values do not have a corresponding 31394@option{-mtune} setting, using @option{-march} with these values enables 31395generic tuning. Specific tuning can be enabled using the 31396@option{-mtune=@var{other-cpu-type}} option with an appropriate 31397@var{other-cpu-type} value. 31398 31399@item i386 31400Original Intel i386 CPU@. 31401 31402@item i486 31403Intel i486 CPU@. (No scheduling is implemented for this chip.) 31404 31405@item i586 31406@itemx pentium 31407Intel Pentium CPU with no MMX support. 31408 31409@item lakemont 31410Intel Lakemont MCU, based on Intel Pentium CPU. 31411 31412@item pentium-mmx 31413Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 31414 31415@item pentiumpro 31416Intel Pentium Pro CPU@. 31417 31418@item i686 31419When used with @option{-march}, the Pentium Pro 31420instruction set is used, so the code runs on all i686 family chips. 31421When used with @option{-mtune}, it has the same meaning as @samp{generic}. 31422 31423@item pentium2 31424Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction 31425set support. 31426 31427@item pentium3 31428@itemx pentium3m 31429Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE 31430instruction set support. 31431 31432@item pentium-m 31433Intel Pentium M; low-power version of Intel Pentium III CPU 31434with MMX, SSE, SSE2 and FXSR instruction set support. Used by Centrino 31435notebooks. 31436 31437@item pentium4 31438@itemx pentium4m 31439Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support. 31440 31441@item prescott 31442Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR 31443instruction set support. 31444 31445@item nocona 31446Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 31447SSE2, SSE3 and FXSR instruction set support. 31448 31449@item core2 31450Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16, 31451SAHF and FXSR instruction set support. 31452 31453@item nehalem 31454Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 31455SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support. 31456 31457@item westmere 31458Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 31459SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support. 31460 31461@item sandybridge 31462Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 31463SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set 31464support. 31465 31466@item ivybridge 31467Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 31468SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND 31469and F16C instruction set support. 31470 31471@item haswell 31472Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31473SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31474F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support. 31475 31476@item broadwell 31477Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31478SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31479F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW 31480instruction set support. 31481 31482@item skylake 31483Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31484SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31485F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, 31486CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support. 31487 31488@item bonnell 31489Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 31490instruction set support. 31491 31492@item silvermont 31493Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31494SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND 31495instruction set support. 31496 31497@item goldmont 31498Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31499SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, 31500RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction 31501set support. 31502 31503@item goldmont-plus 31504Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31505SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, 31506SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, 31507RDPID and SGX instruction set support. 31508 31509@item tremont 31510Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31511SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, 31512RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, 31513SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set 31514support. 31515 31516@item knl 31517Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31518SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, 31519RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, 31520AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support. 31521 31522@item knm 31523Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31524SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, 31525RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, 31526AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW, 31527AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support. 31528 31529@item skylake-avx512 31530Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31531SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, 31532RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, 31533AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, 31534AVX512DQ and AVX512CD instruction set support. 31535 31536@item cannonlake 31537Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 31538SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, 31539FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, 31540PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, 31541AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set 31542support. 31543 31544@item icelake-client 31545Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31546SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, 31547RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, 31548AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, 31549AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2 31550, VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support. 31551 31552@item icelake-server 31553Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31554SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, 31555RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, 31556AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, 31557AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2 31558, VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB 31559instruction set support. 31560 31561@item cascadelake 31562Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31563SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31564F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, 31565CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, 31566AVX512CD and AVX512VNNI instruction set support. 31567 31568@item cooperlake 31569Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31570SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31571F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, 31572CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, 31573AVX512CD, AVX512VNNI and AVX512BF16 instruction set support. 31574 31575@item tigerlake 31576Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31577SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31578F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, 31579CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD 31580PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, 31581VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB, 31582AVX512VP2INTERSECT and KEYLOCKER instruction set support. 31583 31584@item sapphirerapids 31585Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 31586SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, 31587RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, 31588AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, 31589AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, 31590VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, 31591MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, 31592UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16 31593instruction set support. 31594 31595@item alderlake 31596Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 31597SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, 31598XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B, 31599CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU, 31600VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set 31601support. 31602 31603@item rocketlake 31604Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3 31605, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, 31606F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, 31607CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD 31608PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, 31609VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support. 31610 31611@item k6 31612AMD K6 CPU with MMX instruction set support. 31613 31614@item k6-2 31615@itemx k6-3 31616Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 31617 31618@item athlon 31619@itemx athlon-tbird 31620AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 31621support. 31622 31623@item athlon-4 31624@itemx athlon-xp 31625@itemx athlon-mp 31626Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 31627instruction set support. 31628 31629@item k8 31630@itemx opteron 31631@itemx athlon64 31632@itemx athlon-fx 31633Processors based on the AMD K8 core with x86-64 instruction set support, 31634including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 31635(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 31636instruction set extensions.) 31637 31638@item k8-sse3 31639@itemx opteron-sse3 31640@itemx athlon64-sse3 31641Improved versions of AMD K8 cores with SSE3 instruction set support. 31642 31643@item amdfam10 31644@itemx barcelona 31645CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 31646supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 31647instruction set extensions.) 31648 31649@item bdver1 31650CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 31651supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 31652SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 31653 31654@item bdver2 31655AMD Family 15h core based CPUs with x86-64 instruction set support. (This 31656supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, 31657SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 31658extensions.) 31659 31660@item bdver3 31661AMD Family 15h core based CPUs with x86-64 instruction set support. (This 31662supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 31663PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 3166464-bit instruction set extensions.) 31665 31666@item bdver4 31667AMD Family 15h core based CPUs with x86-64 instruction set support. (This 31668supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 31669AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 31670SSE4.2, ABM and 64-bit instruction set extensions.) 31671 31672@item znver1 31673AMD Family 17h core based CPUs with x86-64 instruction set support. (This 31674supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, 31675SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, 31676SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 31677instruction set extensions.) 31678 31679@item znver2 31680AMD Family 17h core based CPUs with x86-64 instruction set support. (This 31681supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 31682MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 31683SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, 31684WBNOINVD, and 64-bit instruction set extensions.) 31685 31686@item znver3 31687AMD Family 19h core based CPUs with x86-64 instruction set support. (This 31688supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 31689MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 31690SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, 31691WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.) 31692 31693@item znver4 31694AMD Family 19h core based CPUs with x86-64 instruction set support. (This 31695supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, 31696MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, 31697SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, 31698WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD, 31699AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI, 31700AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.) 31701 31702@item btver1 31703CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 31704supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 31705instruction set extensions.) 31706 31707@item btver2 31708CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 31709includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM, 31710SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 31711 31712@item winchip-c6 31713IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 31714set support. 31715 31716@item winchip2 31717IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 31718instruction set support. 31719 31720@item c3 31721VIA C3 CPU with MMX and 3DNow!@: instruction set support. 31722(No scheduling is implemented for this chip.) 31723 31724@item c3-2 31725VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 31726(No scheduling is implemented for this chip.) 31727 31728@item c7 31729VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 31730(No scheduling is implemented for this chip.) 31731 31732@item samuel-2 31733VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support. 31734(No scheduling is implemented for this chip.) 31735 31736@item nehemiah 31737VIA Eden Nehemiah CPU with MMX and SSE instruction set support. 31738(No scheduling is implemented for this chip.) 31739 31740@item esther 31741VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 31742(No scheduling is implemented for this chip.) 31743 31744@item eden-x2 31745VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. 31746(No scheduling is implemented for this chip.) 31747 31748@item eden-x4 31749VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, 31750AVX and AVX2 instruction set support. 31751(No scheduling is implemented for this chip.) 31752 31753@item nano 31754Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 31755instruction set support. 31756(No scheduling is implemented for this chip.) 31757 31758@item nano-1000 31759VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 31760instruction set support. 31761(No scheduling is implemented for this chip.) 31762 31763@item nano-2000 31764VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 31765instruction set support. 31766(No scheduling is implemented for this chip.) 31767 31768@item nano-3000 31769VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 31770instruction set support. 31771(No scheduling is implemented for this chip.) 31772 31773@item nano-x2 31774VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 31775instruction set support. 31776(No scheduling is implemented for this chip.) 31777 31778@item nano-x4 31779VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 31780instruction set support. 31781(No scheduling is implemented for this chip.) 31782 31783@item geode 31784AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 31785@end table 31786 31787@item -mtune=@var{cpu-type} 31788@opindex mtune 31789Tune to @var{cpu-type} everything applicable about the generated code, except 31790for the ABI and the set of available instructions. 31791While picking a specific @var{cpu-type} schedules things appropriately 31792for that particular chip, the compiler does not generate any code that 31793cannot run on the default machine type unless you use a 31794@option{-march=@var{cpu-type}} option. 31795For example, if GCC is configured for i686-pc-linux-gnu 31796then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 31797but still runs on i686 machines. 31798 31799The choices for @var{cpu-type} are the same as for @option{-march}. 31800In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 31801 31802@table @samp 31803@item generic 31804Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 31805If you know the CPU on which your code will run, then you should use 31806the corresponding @option{-mtune} or @option{-march} option instead of 31807@option{-mtune=generic}. But, if you do not know exactly what CPU users 31808of your application will have, then you should use this option. 31809 31810As new processors are deployed in the marketplace, the behavior of this 31811option will change. Therefore, if you upgrade to a newer version of 31812GCC, code generation controlled by this option will change to reflect 31813the processors 31814that are most common at the time that version of GCC is released. 31815 31816There is no @option{-march=generic} option because @option{-march} 31817indicates the instruction set the compiler can use, and there is no 31818generic instruction set applicable to all processors. In contrast, 31819@option{-mtune} indicates the processor (or, in this case, collection of 31820processors) for which the code is optimized. 31821 31822@item intel 31823Produce code optimized for the most current Intel processors, which are 31824Haswell and Silvermont for this version of GCC. If you know the CPU 31825on which your code will run, then you should use the corresponding 31826@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 31827But, if you want your application performs better on both Haswell and 31828Silvermont, then you should use this option. 31829 31830As new Intel processors are deployed in the marketplace, the behavior of 31831this option will change. Therefore, if you upgrade to a newer version of 31832GCC, code generation controlled by this option will change to reflect 31833the most current Intel processors at the time that version of GCC is 31834released. 31835 31836There is no @option{-march=intel} option because @option{-march} indicates 31837the instruction set the compiler can use, and there is no common 31838instruction set applicable to all processors. In contrast, 31839@option{-mtune} indicates the processor (or, in this case, collection of 31840processors) for which the code is optimized. 31841@end table 31842 31843@item -mcpu=@var{cpu-type} 31844@opindex mcpu 31845A deprecated synonym for @option{-mtune}. 31846 31847@item -mfpmath=@var{unit} 31848@opindex mfpmath 31849Generate floating-point arithmetic for selected unit @var{unit}. The choices 31850for @var{unit} are: 31851 31852@table @samp 31853@item 387 31854Use the standard 387 floating-point coprocessor present on the majority of chips and 31855emulated otherwise. Code compiled with this option runs almost everywhere. 31856The temporary results are computed in 80-bit precision instead of the precision 31857specified by the type, resulting in slightly different results compared to most 31858of other chips. See @option{-ffloat-store} for more detailed description. 31859 31860This is the default choice for non-Darwin x86-32 targets. 31861 31862@item sse 31863Use scalar floating-point instructions present in the SSE instruction set. 31864This instruction set is supported by Pentium III and newer chips, 31865and in the AMD line 31866by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 31867instruction set supports only single-precision arithmetic, thus the double and 31868extended-precision arithmetic are still done using 387. A later version, present 31869only in Pentium 4 and AMD x86-64 chips, supports double-precision 31870arithmetic too. 31871 31872For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 31873or @option{-msse2} switches to enable SSE extensions and make this option 31874effective. For the x86-64 compiler, these extensions are enabled by default. 31875 31876The resulting code should be considerably faster in the majority of cases and avoid 31877the numerical instability problems of 387 code, but may break some existing 31878code that expects temporaries to be 80 bits. 31879 31880This is the default choice for the x86-64 compiler, Darwin x86-32 targets, 31881and the default choice for x86-32 targets with the SSE2 instruction set 31882when @option{-ffast-math} is enabled. 31883 31884@item sse,387 31885@itemx sse+387 31886@itemx both 31887Attempt to utilize both instruction sets at once. This effectively doubles the 31888amount of available registers, and on chips with separate execution units for 31889387 and SSE the execution resources too. Use this option with care, as it is 31890still experimental, because the GCC register allocator does not model separate 31891functional units well, resulting in unstable performance. 31892@end table 31893 31894@item -masm=@var{dialect} 31895@opindex masm=@var{dialect} 31896Output assembly instructions using selected @var{dialect}. Also affects 31897which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 31898extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 31899order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 31900not support @samp{intel}. 31901 31902@item -mieee-fp 31903@itemx -mno-ieee-fp 31904@opindex mieee-fp 31905@opindex mno-ieee-fp 31906Control whether or not the compiler uses IEEE floating-point 31907comparisons. These correctly handle the case where the result of a 31908comparison is unordered. 31909 31910@item -m80387 31911@itemx -mhard-float 31912@opindex 80387 31913@opindex mhard-float 31914Generate output containing 80387 instructions for floating point. 31915 31916@item -mno-80387 31917@itemx -msoft-float 31918@opindex no-80387 31919@opindex msoft-float 31920Generate output containing library calls for floating point. 31921 31922@strong{Warning:} the requisite libraries are not part of GCC@. 31923Normally the facilities of the machine's usual C compiler are used, but 31924this cannot be done directly in cross-compilation. You must make your 31925own arrangements to provide suitable library functions for 31926cross-compilation. 31927 31928On machines where a function returns floating-point results in the 80387 31929register stack, some floating-point opcodes may be emitted even if 31930@option{-msoft-float} is used. 31931 31932@item -mno-fp-ret-in-387 31933@opindex mno-fp-ret-in-387 31934@opindex mfp-ret-in-387 31935Do not use the FPU registers for return values of functions. 31936 31937The usual calling convention has functions return values of types 31938@code{float} and @code{double} in an FPU register, even if there 31939is no FPU@. The idea is that the operating system should emulate 31940an FPU@. 31941 31942The option @option{-mno-fp-ret-in-387} causes such values to be returned 31943in ordinary CPU registers instead. 31944 31945@item -mno-fancy-math-387 31946@opindex mno-fancy-math-387 31947@opindex mfancy-math-387 31948Some 387 emulators do not support the @code{sin}, @code{cos} and 31949@code{sqrt} instructions for the 387. Specify this option to avoid 31950generating those instructions. 31951This option is overridden when @option{-march} 31952indicates that the target CPU always has an FPU and so the 31953instruction does not need emulation. These 31954instructions are not generated unless you also use the 31955@option{-funsafe-math-optimizations} switch. 31956 31957@item -malign-double 31958@itemx -mno-align-double 31959@opindex malign-double 31960@opindex mno-align-double 31961Control whether GCC aligns @code{double}, @code{long double}, and 31962@code{long long} variables on a two-word boundary or a one-word 31963boundary. Aligning @code{double} variables on a two-word boundary 31964produces code that runs somewhat faster on a Pentium at the 31965expense of more memory. 31966 31967On x86-64, @option{-malign-double} is enabled by default. 31968 31969@strong{Warning:} if you use the @option{-malign-double} switch, 31970structures containing the above types are aligned differently than 31971the published application binary interface specifications for the x86-32 31972and are not binary compatible with structures in code compiled 31973without that switch. 31974 31975@item -m96bit-long-double 31976@itemx -m128bit-long-double 31977@opindex m96bit-long-double 31978@opindex m128bit-long-double 31979These switches control the size of @code{long double} type. The x86-32 31980application binary interface specifies the size to be 96 bits, 31981so @option{-m96bit-long-double} is the default in 32-bit mode. 31982 31983Modern architectures (Pentium and newer) prefer @code{long double} 31984to be aligned to an 8- or 16-byte boundary. In arrays or structures 31985conforming to the ABI, this is not possible. So specifying 31986@option{-m128bit-long-double} aligns @code{long double} 31987to a 16-byte boundary by padding the @code{long double} with an additional 3198832-bit zero. 31989 31990In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 31991its ABI specifies that @code{long double} is aligned on 16-byte boundary. 31992 31993Notice that neither of these options enable any extra precision over the x87 31994standard of 80 bits for a @code{long double}. 31995 31996@strong{Warning:} if you override the default value for your target ABI, this 31997changes the size of 31998structures and arrays containing @code{long double} variables, 31999as well as modifying the function calling convention for functions taking 32000@code{long double}. Hence they are not binary-compatible 32001with code compiled without that switch. 32002 32003@item -mlong-double-64 32004@itemx -mlong-double-80 32005@itemx -mlong-double-128 32006@opindex mlong-double-64 32007@opindex mlong-double-80 32008@opindex mlong-double-128 32009These switches control the size of @code{long double} type. A size 32010of 64 bits makes the @code{long double} type equivalent to the @code{double} 32011type. This is the default for 32-bit Bionic C library. A size 32012of 128 bits makes the @code{long double} type equivalent to the 32013@code{__float128} type. This is the default for 64-bit Bionic C library. 32014 32015@strong{Warning:} if you override the default value for your target ABI, this 32016changes the size of 32017structures and arrays containing @code{long double} variables, 32018as well as modifying the function calling convention for functions taking 32019@code{long double}. Hence they are not binary-compatible 32020with code compiled without that switch. 32021 32022@item -malign-data=@var{type} 32023@opindex malign-data 32024Control how GCC aligns variables. Supported values for @var{type} are 32025@samp{compat} uses increased alignment value compatible uses GCC 4.8 32026and earlier, @samp{abi} uses alignment value as specified by the 32027psABI, and @samp{cacheline} uses increased alignment value to match 32028the cache line size. @samp{compat} is the default. 32029 32030@item -mlarge-data-threshold=@var{threshold} 32031@opindex mlarge-data-threshold 32032When @option{-mcmodel=medium} is specified, data objects larger than 32033@var{threshold} are placed in the large data section. This value must be the 32034same across all objects linked into the binary, and defaults to 65535. 32035 32036@item -mrtd 32037@opindex mrtd 32038Use a different function-calling convention, in which functions that 32039take a fixed number of arguments return with the @code{ret @var{num}} 32040instruction, which pops their arguments while returning. This saves one 32041instruction in the caller since there is no need to pop the arguments 32042there. 32043 32044You can specify that an individual function is called with this calling 32045sequence with the function attribute @code{stdcall}. You can also 32046override the @option{-mrtd} option by using the function attribute 32047@code{cdecl}. @xref{Function Attributes}. 32048 32049@strong{Warning:} this calling convention is incompatible with the one 32050normally used on Unix, so you cannot use it if you need to call 32051libraries compiled with the Unix compiler. 32052 32053Also, you must provide function prototypes for all functions that 32054take variable numbers of arguments (including @code{printf}); 32055otherwise incorrect code is generated for calls to those 32056functions. 32057 32058In addition, seriously incorrect code results if you call a 32059function with too many arguments. (Normally, extra arguments are 32060harmlessly ignored.) 32061 32062@item -mregparm=@var{num} 32063@opindex mregparm 32064Control how many registers are used to pass integer arguments. By 32065default, no registers are used to pass arguments, and at most 3 32066registers can be used. You can control this behavior for a specific 32067function by using the function attribute @code{regparm}. 32068@xref{Function Attributes}. 32069 32070@strong{Warning:} if you use this switch, and 32071@var{num} is nonzero, then you must build all modules with the same 32072value, including any libraries. This includes the system libraries and 32073startup modules. 32074 32075@item -msseregparm 32076@opindex msseregparm 32077Use SSE register passing conventions for float and double arguments 32078and return values. You can control this behavior for a specific 32079function by using the function attribute @code{sseregparm}. 32080@xref{Function Attributes}. 32081 32082@strong{Warning:} if you use this switch then you must build all 32083modules with the same value, including any libraries. This includes 32084the system libraries and startup modules. 32085 32086@item -mvect8-ret-in-mem 32087@opindex mvect8-ret-in-mem 32088Return 8-byte vectors in memory instead of MMX registers. This is the 32089default on VxWorks to match the ABI of the Sun Studio compilers until 32090version 12. @emph{Only} use this option if you need to remain 32091compatible with existing code produced by those previous compiler 32092versions or older versions of GCC@. 32093 32094@item -mpc32 32095@itemx -mpc64 32096@itemx -mpc80 32097@opindex mpc32 32098@opindex mpc64 32099@opindex mpc80 32100 32101Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 32102is specified, the significands of results of floating-point operations are 32103rounded to 24 bits (single precision); @option{-mpc64} rounds the 32104significands of results of floating-point operations to 53 bits (double 32105precision) and @option{-mpc80} rounds the significands of results of 32106floating-point operations to 64 bits (extended double precision), which is 32107the default. When this option is used, floating-point operations in higher 32108precisions are not available to the programmer without setting the FPU 32109control word explicitly. 32110 32111Setting the rounding of floating-point operations to less than the default 3211280 bits can speed some programs by 2% or more. Note that some mathematical 32113libraries assume that extended-precision (80-bit) floating-point operations 32114are enabled by default; routines in such libraries could suffer significant 32115loss of accuracy, typically through so-called ``catastrophic cancellation'', 32116when this option is used to set the precision to less than extended precision. 32117 32118@item -mdaz-ftz 32119@opindex mdaz-ftz 32120 32121The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register 32122are used to control floating-point calculations.SSE and AVX instructions 32123including scalar and vector instructions could benefit from enabling the FTZ 32124and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags 32125when @option{-mno-daz-ftz} is specified. 32126 32127@item -mstackrealign 32128@opindex mstackrealign 32129Realign the stack at entry. On the x86, the @option{-mstackrealign} 32130option generates an alternate prologue and epilogue that realigns the 32131run-time stack if necessary. This supports mixing legacy codes that keep 321324-byte stack alignment with modern codes that keep 16-byte stack alignment for 32133SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 32134applicable to individual functions. 32135 32136@item -mpreferred-stack-boundary=@var{num} 32137@opindex mpreferred-stack-boundary 32138Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 32139byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 32140the default is 4 (16 bytes or 128 bits). 32141 32142@strong{Warning:} When generating code for the x86-64 architecture with 32143SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 32144used to keep the stack boundary aligned to 8 byte boundary. Since 32145x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 32146intended to be used in controlled environment where stack space is 32147important limitation. This option leads to wrong code when functions 32148compiled with 16 byte stack alignment (such as functions from a standard 32149library) are called with misaligned stack. In this case, SSE 32150instructions may lead to misaligned memory access traps. In addition, 32151variable arguments are handled incorrectly for 16 byte aligned 32152objects (including x87 long double and __int128), leading to wrong 32153results. You must build all modules with 32154@option{-mpreferred-stack-boundary=3}, including any libraries. This 32155includes the system libraries and startup modules. 32156 32157@item -mincoming-stack-boundary=@var{num} 32158@opindex mincoming-stack-boundary 32159Assume the incoming stack is aligned to a 2 raised to @var{num} byte 32160boundary. If @option{-mincoming-stack-boundary} is not specified, 32161the one specified by @option{-mpreferred-stack-boundary} is used. 32162 32163On Pentium and Pentium Pro, @code{double} and @code{long double} values 32164should be aligned to an 8-byte boundary (see @option{-malign-double}) or 32165suffer significant run time performance penalties. On Pentium III, the 32166Streaming SIMD Extension (SSE) data type @code{__m128} may not work 32167properly if it is not 16-byte aligned. 32168 32169To ensure proper alignment of this values on the stack, the stack boundary 32170must be as aligned as that required by any value stored on the stack. 32171Further, every function must be generated such that it keeps the stack 32172aligned. Thus calling a function compiled with a higher preferred 32173stack boundary from a function compiled with a lower preferred stack 32174boundary most likely misaligns the stack. It is recommended that 32175libraries that use callbacks always use the default setting. 32176 32177This extra alignment does consume extra stack space, and generally 32178increases code size. Code that is sensitive to stack space usage, such 32179as embedded systems and operating system kernels, may want to reduce the 32180preferred alignment to @option{-mpreferred-stack-boundary=2}. 32181 32182@need 200 32183@item -mmmx 32184@opindex mmmx 32185@need 200 32186@itemx -msse 32187@opindex msse 32188@need 200 32189@itemx -msse2 32190@opindex msse2 32191@need 200 32192@itemx -msse3 32193@opindex msse3 32194@need 200 32195@itemx -mssse3 32196@opindex mssse3 32197@need 200 32198@itemx -msse4 32199@opindex msse4 32200@need 200 32201@itemx -msse4a 32202@opindex msse4a 32203@need 200 32204@itemx -msse4.1 32205@opindex msse4.1 32206@need 200 32207@itemx -msse4.2 32208@opindex msse4.2 32209@need 200 32210@itemx -mavx 32211@opindex mavx 32212@need 200 32213@itemx -mavx2 32214@opindex mavx2 32215@need 200 32216@itemx -mavx512f 32217@opindex mavx512f 32218@need 200 32219@itemx -mavx512pf 32220@opindex mavx512pf 32221@need 200 32222@itemx -mavx512er 32223@opindex mavx512er 32224@need 200 32225@itemx -mavx512cd 32226@opindex mavx512cd 32227@need 200 32228@itemx -mavx512vl 32229@opindex mavx512vl 32230@need 200 32231@itemx -mavx512bw 32232@opindex mavx512bw 32233@need 200 32234@itemx -mavx512dq 32235@opindex mavx512dq 32236@need 200 32237@itemx -mavx512ifma 32238@opindex mavx512ifma 32239@need 200 32240@itemx -mavx512vbmi 32241@opindex mavx512vbmi 32242@need 200 32243@itemx -msha 32244@opindex msha 32245@need 200 32246@itemx -maes 32247@opindex maes 32248@need 200 32249@itemx -mpclmul 32250@opindex mpclmul 32251@need 200 32252@itemx -mclflushopt 32253@opindex mclflushopt 32254@need 200 32255@itemx -mclwb 32256@opindex mclwb 32257@need 200 32258@itemx -mfsgsbase 32259@opindex mfsgsbase 32260@need 200 32261@itemx -mptwrite 32262@opindex mptwrite 32263@need 200 32264@itemx -mrdrnd 32265@opindex mrdrnd 32266@need 200 32267@itemx -mf16c 32268@opindex mf16c 32269@need 200 32270@itemx -mfma 32271@opindex mfma 32272@need 200 32273@itemx -mpconfig 32274@opindex mpconfig 32275@need 200 32276@itemx -mwbnoinvd 32277@opindex mwbnoinvd 32278@need 200 32279@itemx -mfma4 32280@opindex mfma4 32281@need 200 32282@itemx -mprfchw 32283@opindex mprfchw 32284@need 200 32285@itemx -mrdpid 32286@opindex mrdpid 32287@need 200 32288@itemx -mprefetchwt1 32289@opindex mprefetchwt1 32290@need 200 32291@itemx -mrdseed 32292@opindex mrdseed 32293@need 200 32294@itemx -msgx 32295@opindex msgx 32296@need 200 32297@itemx -mxop 32298@opindex mxop 32299@need 200 32300@itemx -mlwp 32301@opindex mlwp 32302@need 200 32303@itemx -m3dnow 32304@opindex m3dnow 32305@need 200 32306@itemx -m3dnowa 32307@opindex m3dnowa 32308@need 200 32309@itemx -mpopcnt 32310@opindex mpopcnt 32311@need 200 32312@itemx -mabm 32313@opindex mabm 32314@need 200 32315@itemx -madx 32316@opindex madx 32317@need 200 32318@itemx -mbmi 32319@opindex mbmi 32320@need 200 32321@itemx -mbmi2 32322@opindex mbmi2 32323@need 200 32324@itemx -mlzcnt 32325@opindex mlzcnt 32326@need 200 32327@itemx -mfxsr 32328@opindex mfxsr 32329@need 200 32330@itemx -mxsave 32331@opindex mxsave 32332@need 200 32333@itemx -mxsaveopt 32334@opindex mxsaveopt 32335@need 200 32336@itemx -mxsavec 32337@opindex mxsavec 32338@need 200 32339@itemx -mxsaves 32340@opindex mxsaves 32341@need 200 32342@itemx -mrtm 32343@opindex mrtm 32344@need 200 32345@itemx -mhle 32346@opindex mhle 32347@need 200 32348@itemx -mtbm 32349@opindex mtbm 32350@need 200 32351@itemx -mmwaitx 32352@opindex mmwaitx 32353@need 200 32354@itemx -mclzero 32355@opindex mclzero 32356@need 200 32357@itemx -mpku 32358@opindex mpku 32359@need 200 32360@itemx -mavx512vbmi2 32361@opindex mavx512vbmi2 32362@need 200 32363@itemx -mavx512bf16 32364@opindex mavx512bf16 32365@need 200 32366@itemx -mavx512fp16 32367@opindex mavx512fp16 32368@need 200 32369@itemx -mgfni 32370@opindex mgfni 32371@need 200 32372@itemx -mvaes 32373@opindex mvaes 32374@need 200 32375@itemx -mwaitpkg 32376@opindex mwaitpkg 32377@need 200 32378@itemx -mvpclmulqdq 32379@opindex mvpclmulqdq 32380@need 200 32381@itemx -mavx512bitalg 32382@opindex mavx512bitalg 32383@need 200 32384@itemx -mmovdiri 32385@opindex mmovdiri 32386@need 200 32387@itemx -mmovdir64b 32388@opindex mmovdir64b 32389@need 200 32390@itemx -menqcmd 32391@opindex menqcmd 32392@itemx -muintr 32393@opindex muintr 32394@need 200 32395@itemx -mtsxldtrk 32396@opindex mtsxldtrk 32397@need 200 32398@itemx -mavx512vpopcntdq 32399@opindex mavx512vpopcntdq 32400@need 200 32401@itemx -mavx512vp2intersect 32402@opindex mavx512vp2intersect 32403@need 200 32404@itemx -mavx5124fmaps 32405@opindex mavx5124fmaps 32406@need 200 32407@itemx -mavx512vnni 32408@opindex mavx512vnni 32409@need 200 32410@itemx -mavxvnni 32411@opindex mavxvnni 32412@need 200 32413@itemx -mavx5124vnniw 32414@opindex mavx5124vnniw 32415@need 200 32416@itemx -mcldemote 32417@opindex mcldemote 32418@need 200 32419@itemx -mserialize 32420@opindex mserialize 32421@need 200 32422@itemx -mamx-tile 32423@opindex mamx-tile 32424@need 200 32425@itemx -mamx-int8 32426@opindex mamx-int8 32427@need 200 32428@itemx -mamx-bf16 32429@opindex mamx-bf16 32430@need 200 32431@itemx -mhreset 32432@opindex mhreset 32433@itemx -mkl 32434@opindex mkl 32435@need 200 32436@itemx -mwidekl 32437@opindex mwidekl 32438These switches enable the use of instructions in the MMX, SSE, 32439SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF, 32440AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA, 32441AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, 32442WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 324433DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE, 32444XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2, 32445GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16, 32446ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, 32447UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16 32448or CLDEMOTE extended instruction sets. Each has a corresponding 32449@option{-mno-} option to disable use of these instructions. 32450 32451These extensions are also available as built-in functions: see 32452@ref{x86 Built-in Functions}, for details of the functions enabled and 32453disabled by these switches. 32454 32455To generate SSE/SSE2 instructions automatically from floating-point 32456code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 32457 32458GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 32459generates new AVX instructions or AVX equivalence for all SSEx instructions 32460when needed. 32461 32462These options enable GCC to use these extended instructions in 32463generated code, even without @option{-mfpmath=sse}. Applications that 32464perform run-time CPU detection must compile separate files for each 32465supported architecture, using the appropriate flags. In particular, 32466the file containing the CPU detection code should be compiled without 32467these options. 32468 32469@item -mdump-tune-features 32470@opindex mdump-tune-features 32471This option instructs GCC to dump the names of the x86 performance 32472tuning features and default settings. The names can be used in 32473@option{-mtune-ctrl=@var{feature-list}}. 32474 32475@item -mtune-ctrl=@var{feature-list} 32476@opindex mtune-ctrl=@var{feature-list} 32477This option is used to do fine grain control of x86 code generation features. 32478@var{feature-list} is a comma separated list of @var{feature} names. See also 32479@option{-mdump-tune-features}. When specified, the @var{feature} is turned 32480on if it is not preceded with @samp{^}, otherwise, it is turned off. 32481@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 32482developers. Using it may lead to code paths not covered by testing and can 32483potentially result in compiler ICEs or runtime errors. 32484 32485@item -mno-default 32486@opindex mno-default 32487This option instructs GCC to turn off all tunable features. See also 32488@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 32489 32490@item -mcld 32491@opindex mcld 32492This option instructs GCC to emit a @code{cld} instruction in the prologue 32493of functions that use string instructions. String instructions depend on 32494the DF flag to select between autoincrement or autodecrement mode. While the 32495ABI specifies the DF flag to be cleared on function entry, some operating 32496systems violate this specification by not clearing the DF flag in their 32497exception dispatchers. The exception handler can be invoked with the DF flag 32498set, which leads to wrong direction mode when string instructions are used. 32499This option can be enabled by default on 32-bit x86 targets by configuring 32500GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 32501instructions can be suppressed with the @option{-mno-cld} compiler option 32502in this case. 32503 32504@item -mvzeroupper 32505@opindex mvzeroupper 32506This option instructs GCC to emit a @code{vzeroupper} instruction 32507before a transfer of control flow out of the function to minimize 32508the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 32509intrinsics. 32510 32511@item -mprefer-avx128 32512@opindex mprefer-avx128 32513This option instructs GCC to use 128-bit AVX instructions instead of 32514256-bit AVX instructions in the auto-vectorizer. 32515 32516@item -mprefer-vector-width=@var{opt} 32517@opindex mprefer-vector-width 32518This option instructs GCC to use @var{opt}-bit vector width in instructions 32519instead of default on the selected platform. 32520 32521@item -mmove-max=@var{bits} 32522@opindex mmove-max 32523This option instructs GCC to set the maximum number of bits can be 32524moved from memory to memory efficiently to @var{bits}. The valid 32525@var{bits} are 128, 256 and 512. 32526 32527@item -mstore-max=@var{bits} 32528@opindex mstore-max 32529This option instructs GCC to set the maximum number of bits can be 32530stored to memory efficiently to @var{bits}. The valid @var{bits} are 32531128, 256 and 512. 32532 32533@table @samp 32534@item none 32535No extra limitations applied to GCC other than defined by the selected platform. 32536 32537@item 128 32538Prefer 128-bit vector width for instructions. 32539 32540@item 256 32541Prefer 256-bit vector width for instructions. 32542 32543@item 512 32544Prefer 512-bit vector width for instructions. 32545@end table 32546 32547@item -mcx16 32548@opindex mcx16 32549This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit 32550code to implement compare-and-exchange operations on 16-byte aligned 128-bit 32551objects. This is useful for atomic updates of data structures exceeding one 32552machine word in size. The compiler uses this instruction to implement 32553@ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on 32554128-bit integers, a library call is always used. 32555 32556@item -msahf 32557@opindex msahf 32558This option enables generation of @code{SAHF} instructions in 64-bit code. 32559Early Intel Pentium 4 CPUs with Intel 64 support, 32560prior to the introduction of Pentium 4 G1 step in December 2005, 32561lacked the @code{LAHF} and @code{SAHF} instructions 32562which are supported by AMD64. 32563These are load and store instructions, respectively, for certain status flags. 32564In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 32565@code{drem}, and @code{remainder} built-in functions; 32566see @ref{Other Builtins} for details. 32567 32568@item -mmovbe 32569@opindex mmovbe 32570This option enables use of the @code{movbe} instruction to implement 32571@code{__builtin_bswap32} and @code{__builtin_bswap64}. 32572 32573@item -mshstk 32574@opindex mshstk 32575The @option{-mshstk} option enables shadow stack built-in functions 32576from x86 Control-flow Enforcement Technology (CET). 32577 32578@item -mcrc32 32579@opindex mcrc32 32580This option enables built-in functions @code{__builtin_ia32_crc32qi}, 32581@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 32582@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 32583 32584@item -mmwait 32585@opindex mmwait 32586This option enables built-in functions @code{__builtin_ia32_monitor}, 32587and @code{__builtin_ia32_mwait} to generate the @code{monitor} and 32588@code{mwait} machine instructions. 32589 32590@item -mrecip 32591@opindex mrecip 32592This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 32593(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 32594with an additional Newton-Raphson step 32595to increase precision instead of @code{DIVSS} and @code{SQRTSS} 32596(and their vectorized 32597variants) for single-precision floating-point arguments. These instructions 32598are generated only when @option{-funsafe-math-optimizations} is enabled 32599together with @option{-ffinite-math-only} and @option{-fno-trapping-math}. 32600Note that while the throughput of the sequence is higher than the throughput 32601of the non-reciprocal instruction, the precision of the sequence can be 32602decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994). 32603 32604Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 32605(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 32606combination), and doesn't need @option{-mrecip}. 32607 32608Also note that GCC emits the above sequence with additional Newton-Raphson step 32609for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 32610already with @option{-ffast-math} (or the above option combination), and 32611doesn't need @option{-mrecip}. 32612 32613@item -mrecip=@var{opt} 32614@opindex mrecip=opt 32615This option controls which reciprocal estimate instructions 32616may be used. @var{opt} is a comma-separated list of options, which may 32617be preceded by a @samp{!} to invert the option: 32618 32619@table @samp 32620@item all 32621Enable all estimate instructions. 32622 32623@item default 32624Enable the default instructions, equivalent to @option{-mrecip}. 32625 32626@item none 32627Disable all estimate instructions, equivalent to @option{-mno-recip}. 32628 32629@item div 32630Enable the approximation for scalar division. 32631 32632@item vec-div 32633Enable the approximation for vectorized division. 32634 32635@item sqrt 32636Enable the approximation for scalar square root. 32637 32638@item vec-sqrt 32639Enable the approximation for vectorized square root. 32640@end table 32641 32642So, for example, @option{-mrecip=all,!sqrt} enables 32643all of the reciprocal approximations, except for square root. 32644 32645@item -mveclibabi=@var{type} 32646@opindex mveclibabi 32647Specifies the ABI type to use for vectorizing intrinsics using an 32648external library. Supported values for @var{type} are @samp{svml} 32649for the Intel short 32650vector math library and @samp{acml} for the AMD math core library. 32651To use this option, both @option{-ftree-vectorize} and 32652@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 32653ABI-compatible library must be specified at link time. 32654 32655GCC currently emits calls to @code{vmldExp2}, 32656@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2}, 32657@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 32658@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 32659@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 32660@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, 32661@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 32662@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 32663@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 32664@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 32665function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 32666@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 32667@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 32668@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 32669@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 32670when @option{-mveclibabi=acml} is used. 32671 32672@item -mabi=@var{name} 32673@opindex mabi 32674Generate code for the specified calling convention. Permissible values 32675are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 32676@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 32677ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 32678You can control this behavior for specific functions by 32679using the function attributes @code{ms_abi} and @code{sysv_abi}. 32680@xref{Function Attributes}. 32681 32682@item -mforce-indirect-call 32683@opindex mforce-indirect-call 32684Force all calls to functions to be indirect. This is useful 32685when using Intel Processor Trace where it generates more precise timing 32686information for function calls. 32687 32688@item -mmanual-endbr 32689@opindex mmanual-endbr 32690Insert ENDBR instruction at function entry only via the @code{cf_check} 32691function attribute. This is useful when used with the option 32692@option{-fcf-protection=branch} to control ENDBR insertion at the 32693function entry. 32694 32695@item -mcall-ms2sysv-xlogues 32696@opindex mcall-ms2sysv-xlogues 32697@opindex mno-call-ms2sysv-xlogues 32698Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a 32699System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By 32700default, the code for saving and restoring these registers is emitted inline, 32701resulting in fairly lengthy prologues and epilogues. Using 32702@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that 32703use stubs in the static portion of libgcc to perform these saves and restores, 32704thus reducing function size at the cost of a few extra instructions. 32705 32706@item -mtls-dialect=@var{type} 32707@opindex mtls-dialect 32708Generate code to access thread-local storage using the @samp{gnu} or 32709@samp{gnu2} conventions. @samp{gnu} is the conservative default; 32710@samp{gnu2} is more efficient, but it may add compile- and run-time 32711requirements that cannot be satisfied on all systems. 32712 32713@item -mpush-args 32714@itemx -mno-push-args 32715@opindex mpush-args 32716@opindex mno-push-args 32717Use PUSH operations to store outgoing parameters. This method is shorter 32718and usually equally fast as method using SUB/MOV operations and is enabled 32719by default. In some cases disabling it may improve performance because of 32720improved scheduling and reduced dependencies. 32721 32722@item -maccumulate-outgoing-args 32723@opindex maccumulate-outgoing-args 32724If enabled, the maximum amount of space required for outgoing arguments is 32725computed in the function prologue. This is faster on most modern CPUs 32726because of reduced dependencies, improved scheduling and reduced stack usage 32727when the preferred stack boundary is not equal to 2. The drawback is a notable 32728increase in code size. This switch implies @option{-mno-push-args}. 32729 32730@item -mthreads 32731@opindex mthreads 32732Support thread-safe exception handling on MinGW. Programs that rely 32733on thread-safe exception handling must compile and link all code with the 32734@option{-mthreads} option. When compiling, @option{-mthreads} defines 32735@option{-D_MT}; when linking, it links in a special thread helper library 32736@option{-lmingwthrd} which cleans up per-thread exception-handling data. 32737 32738@item -mms-bitfields 32739@itemx -mno-ms-bitfields 32740@opindex mms-bitfields 32741@opindex mno-ms-bitfields 32742 32743Enable/disable bit-field layout compatible with the native Microsoft 32744Windows compiler. 32745 32746If @code{packed} is used on a structure, or if bit-fields are used, 32747it may be that the Microsoft ABI lays out the structure differently 32748than the way GCC normally does. Particularly when moving packed 32749data between functions compiled with GCC and the native Microsoft compiler 32750(either via function call or as data in a file), it may be necessary to access 32751either format. 32752 32753This option is enabled by default for Microsoft Windows 32754targets. This behavior can also be controlled locally by use of variable 32755or type attributes. For more information, see @ref{x86 Variable Attributes} 32756and @ref{x86 Type Attributes}. 32757 32758The Microsoft structure layout algorithm is fairly simple with the exception 32759of the bit-field packing. 32760The padding and alignment of members of structures and whether a bit-field 32761can straddle a storage-unit boundary are determine by these rules: 32762 32763@enumerate 32764@item Structure members are stored sequentially in the order in which they are 32765declared: the first member has the lowest memory address and the last member 32766the highest. 32767 32768@item Every data object has an alignment requirement. The alignment requirement 32769for all data except structures, unions, and arrays is either the size of the 32770object or the current packing size (specified with either the 32771@code{aligned} attribute or the @code{pack} pragma), 32772whichever is less. For structures, unions, and arrays, 32773the alignment requirement is the largest alignment requirement of its members. 32774Every object is allocated an offset so that: 32775 32776@smallexample 32777offset % alignment_requirement == 0 32778@end smallexample 32779 32780@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation 32781unit if the integral types are the same size and if the next bit-field fits 32782into the current allocation unit without crossing the boundary imposed by the 32783common alignment requirements of the bit-fields. 32784@end enumerate 32785 32786MSVC interprets zero-length bit-fields in the following ways: 32787 32788@enumerate 32789@item If a zero-length bit-field is inserted between two bit-fields that 32790are normally coalesced, the bit-fields are not coalesced. 32791 32792For example: 32793 32794@smallexample 32795struct 32796 @{ 32797 unsigned long bf_1 : 12; 32798 unsigned long : 0; 32799 unsigned long bf_2 : 12; 32800 @} t1; 32801@end smallexample 32802 32803@noindent 32804The size of @code{t1} is 8 bytes with the zero-length bit-field. If the 32805zero-length bit-field were removed, @code{t1}'s size would be 4 bytes. 32806 32807@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the 32808alignment of the zero-length bit-field is greater than the member that follows it, 32809@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field. 32810 32811For example: 32812 32813@smallexample 32814struct 32815 @{ 32816 char foo : 4; 32817 short : 0; 32818 char bar; 32819 @} t2; 32820 32821struct 32822 @{ 32823 char foo : 4; 32824 short : 0; 32825 double bar; 32826 @} t3; 32827@end smallexample 32828 32829@noindent 32830For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1. 32831Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length 32832bit-field does not affect the alignment of @code{bar} or, as a result, the size 32833of the structure. 32834 32835Taking this into account, it is important to note the following: 32836 32837@enumerate 32838@item If a zero-length bit-field follows a normal bit-field, the type of the 32839zero-length bit-field may affect the alignment of the structure as whole. For 32840example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a 32841normal bit-field, and is of type short. 32842 32843@item Even if a zero-length bit-field is not followed by a normal bit-field, it may 32844still affect the alignment of the structure: 32845 32846@smallexample 32847struct 32848 @{ 32849 char foo : 6; 32850 long : 0; 32851 @} t4; 32852@end smallexample 32853 32854@noindent 32855Here, @code{t4} takes up 4 bytes. 32856@end enumerate 32857 32858@item Zero-length bit-fields following non-bit-field members are ignored: 32859 32860@smallexample 32861struct 32862 @{ 32863 char foo; 32864 long : 0; 32865 char bar; 32866 @} t5; 32867@end smallexample 32868 32869@noindent 32870Here, @code{t5} takes up 2 bytes. 32871@end enumerate 32872 32873 32874@item -mno-align-stringops 32875@opindex mno-align-stringops 32876@opindex malign-stringops 32877Do not align the destination of inlined string operations. This switch reduces 32878code size and improves performance in case the destination is already aligned, 32879but GCC doesn't know about it. 32880 32881@item -minline-all-stringops 32882@opindex minline-all-stringops 32883By default GCC inlines string operations only when the destination is 32884known to be aligned to least a 4-byte boundary. 32885This enables more inlining and increases code 32886size, but may improve performance of code that depends on fast 32887@code{memcpy} and @code{memset} for short lengths. 32888The option enables inline expansion of @code{strlen} for all 32889pointer alignments. 32890 32891@item -minline-stringops-dynamically 32892@opindex minline-stringops-dynamically 32893For string operations of unknown size, use run-time checks with 32894inline code for small blocks and a library call for large blocks. 32895 32896@item -mstringop-strategy=@var{alg} 32897@opindex mstringop-strategy=@var{alg} 32898Override the internal decision heuristic for the particular algorithm to use 32899for inlining string operations. The allowed values for @var{alg} are: 32900 32901@table @samp 32902@item rep_byte 32903@itemx rep_4byte 32904@itemx rep_8byte 32905Expand using i386 @code{rep} prefix of the specified size. 32906 32907@item byte_loop 32908@itemx loop 32909@itemx unrolled_loop 32910Expand into an inline loop. 32911 32912@item libcall 32913Always use a library call. 32914@end table 32915 32916@item -mmemcpy-strategy=@var{strategy} 32917@opindex mmemcpy-strategy=@var{strategy} 32918Override the internal decision heuristic to decide if @code{__builtin_memcpy} 32919should be inlined and what inline algorithm to use when the expected size 32920of the copy operation is known. @var{strategy} 32921is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 32922@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 32923the max byte size with which inline algorithm @var{alg} is allowed. For the last 32924triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 32925in the list must be specified in increasing order. The minimal byte size for 32926@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 32927preceding range. 32928 32929@item -mmemset-strategy=@var{strategy} 32930@opindex mmemset-strategy=@var{strategy} 32931The option is similar to @option{-mmemcpy-strategy=} except that it is to control 32932@code{__builtin_memset} expansion. 32933 32934@item -momit-leaf-frame-pointer 32935@opindex momit-leaf-frame-pointer 32936Don't keep the frame pointer in a register for leaf functions. This 32937avoids the instructions to save, set up, and restore frame pointers and 32938makes an extra register available in leaf functions. The option 32939@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 32940which might make debugging harder. 32941 32942@item -mtls-direct-seg-refs 32943@itemx -mno-tls-direct-seg-refs 32944@opindex mtls-direct-seg-refs 32945Controls whether TLS variables may be accessed with offsets from the 32946TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 32947or whether the thread base pointer must be added. Whether or not this 32948is valid depends on the operating system, and whether it maps the 32949segment to cover the entire TLS area. 32950 32951For systems that use the GNU C Library, the default is on. 32952 32953@item -msse2avx 32954@itemx -mno-sse2avx 32955@opindex msse2avx 32956Specify that the assembler should encode SSE instructions with VEX 32957prefix. The option @option{-mavx} turns this on by default. 32958 32959@item -mfentry 32960@itemx -mno-fentry 32961@opindex mfentry 32962If profiling is active (@option{-pg}), put the profiling 32963counter call before the prologue. 32964Note: On x86 architectures the attribute @code{ms_hook_prologue} 32965isn't possible at the moment for @option{-mfentry} and @option{-pg}. 32966 32967@item -mrecord-mcount 32968@itemx -mno-record-mcount 32969@opindex mrecord-mcount 32970If profiling is active (@option{-pg}), generate a __mcount_loc section 32971that contains pointers to each profiling call. This is useful for 32972automatically patching and out calls. 32973 32974@item -mnop-mcount 32975@itemx -mno-nop-mcount 32976@opindex mnop-mcount 32977If profiling is active (@option{-pg}), generate the calls to 32978the profiling functions as NOPs. This is useful when they 32979should be patched in later dynamically. This is likely only 32980useful together with @option{-mrecord-mcount}. 32981 32982@item -minstrument-return=@var{type} 32983@opindex minstrument-return 32984Instrument function exit in -pg -mfentry instrumented functions with 32985call to specified function. This only instruments true returns ending 32986with ret, but not sibling calls ending with jump. Valid types 32987are @var{none} to not instrument, @var{call} to generate a call to __return__, 32988or @var{nop5} to generate a 5 byte nop. 32989 32990@item -mrecord-return 32991@itemx -mno-record-return 32992@opindex mrecord-return 32993Generate a __return_loc section pointing to all return instrumentation code. 32994 32995@item -mfentry-name=@var{name} 32996@opindex mfentry-name 32997Set name of __fentry__ symbol called at function entry for -pg -mfentry functions. 32998 32999@item -mfentry-section=@var{name} 33000@opindex mfentry-section 33001Set name of section to record -mrecord-mcount calls (default __mcount_loc). 33002 33003@item -mskip-rax-setup 33004@itemx -mno-skip-rax-setup 33005@opindex mskip-rax-setup 33006When generating code for the x86-64 architecture with SSE extensions 33007disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 33008register when there are no variable arguments passed in vector registers. 33009 33010@strong{Warning:} Since RAX register is used to avoid unnecessarily 33011saving vector registers on stack when passing variable arguments, the 33012impacts of this option are callees may waste some stack space, 33013misbehave or jump to a random location. GCC 4.4 or newer don't have 33014those issues, regardless the RAX register value. 33015 33016@item -m8bit-idiv 33017@itemx -mno-8bit-idiv 33018@opindex m8bit-idiv 33019On some processors, like Intel Atom, 8-bit unsigned integer divide is 33020much faster than 32-bit/64-bit integer divide. This option generates a 33021run-time check. If both dividend and divisor are within range of 0 33022to 255, 8-bit unsigned integer divide is used instead of 3302332-bit/64-bit integer divide. 33024 33025@item -mavx256-split-unaligned-load 33026@itemx -mavx256-split-unaligned-store 33027@opindex mavx256-split-unaligned-load 33028@opindex mavx256-split-unaligned-store 33029Split 32-byte AVX unaligned load and store. 33030 33031@item -mstack-protector-guard=@var{guard} 33032@itemx -mstack-protector-guard-reg=@var{reg} 33033@itemx -mstack-protector-guard-offset=@var{offset} 33034@opindex mstack-protector-guard 33035@opindex mstack-protector-guard-reg 33036@opindex mstack-protector-guard-offset 33037Generate stack protection code using canary at @var{guard}. Supported 33038locations are @samp{global} for global canary or @samp{tls} for per-thread 33039canary in the TLS block (the default). This option has effect only when 33040@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 33041 33042With the latter choice the options 33043@option{-mstack-protector-guard-reg=@var{reg}} and 33044@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 33045which segment register (@code{%fs} or @code{%gs}) to use as base register 33046for reading the canary, and from what offset from that base register. 33047The default for those is as specified in the relevant ABI. 33048 33049@item -mgeneral-regs-only 33050@opindex mgeneral-regs-only 33051Generate code that uses only the general-purpose registers. This 33052prevents the compiler from using floating-point, vector, mask and bound 33053registers. 33054 33055@item -mrelax-cmpxchg-loop 33056@opindex mrelax-cmpxchg-loop 33057Relax cmpxchg loop by emitting an early load and compare before cmpxchg, 33058execute pause if load value is not expected. This reduces excessive 33059cachline bouncing when and works for all atomic logic fetch builtins 33060that generates compare and swap loop. 33061 33062@item -mindirect-branch=@var{choice} 33063@opindex mindirect-branch 33064Convert indirect call and jump with @var{choice}. The default is 33065@samp{keep}, which keeps indirect call and jump unmodified. 33066@samp{thunk} converts indirect call and jump to call and return thunk. 33067@samp{thunk-inline} converts indirect call and jump to inlined call 33068and return thunk. @samp{thunk-extern} converts indirect call and jump 33069to external call and return thunk provided in a separate object file. 33070You can control this behavior for a specific function by using the 33071function attribute @code{indirect_branch}. @xref{Function Attributes}. 33072 33073Note that @option{-mcmodel=large} is incompatible with 33074@option{-mindirect-branch=thunk} and 33075@option{-mindirect-branch=thunk-extern} since the thunk function may 33076not be reachable in the large code model. 33077 33078Note that @option{-mindirect-branch=thunk-extern} is compatible with 33079@option{-fcf-protection=branch} since the external thunk can be made 33080to enable control-flow check. 33081 33082@item -mfunction-return=@var{choice} 33083@opindex mfunction-return 33084Convert function return with @var{choice}. The default is @samp{keep}, 33085which keeps function return unmodified. @samp{thunk} converts function 33086return to call and return thunk. @samp{thunk-inline} converts function 33087return to inlined call and return thunk. @samp{thunk-extern} converts 33088function return to external call and return thunk provided in a separate 33089object file. You can control this behavior for a specific function by 33090using the function attribute @code{function_return}. 33091@xref{Function Attributes}. 33092 33093Note that @option{-mindirect-return=thunk-extern} is compatible with 33094@option{-fcf-protection=branch} since the external thunk can be made 33095to enable control-flow check. 33096 33097Note that @option{-mcmodel=large} is incompatible with 33098@option{-mfunction-return=thunk} and 33099@option{-mfunction-return=thunk-extern} since the thunk function may 33100not be reachable in the large code model. 33101 33102 33103@item -mindirect-branch-register 33104@opindex mindirect-branch-register 33105Force indirect call and jump via register. 33106 33107@item -mharden-sls=@var{choice} 33108@opindex mharden-sls 33109Generate code to mitigate against straight line speculation (SLS) with 33110@var{choice}. The default is @samp{none} which disables all SLS 33111hardening. @samp{return} enables SLS hardening for function returns. 33112@samp{indirect-jmp} enables SLS hardening for indirect jumps. 33113@samp{all} enables all SLS hardening. 33114 33115@item -mindirect-branch-cs-prefix 33116@opindex mindirect-branch-cs-prefix 33117Add CS prefix to call and jmp to indirect thunk with branch target in 33118r8-r15 registers so that the call and jmp instruction length is 6 bytes 33119to allow them to be replaced with @samp{lfence; call *%r8-r15} or 33120@samp{lfence; jmp *%r8-r15} at run-time. 33121 33122@end table 33123 33124These @samp{-m} switches are supported in addition to the above 33125on x86-64 processors in 64-bit environments. 33126 33127@table @gcctabopt 33128@item -m32 33129@itemx -m64 33130@itemx -mx32 33131@itemx -m16 33132@itemx -miamcu 33133@opindex m32 33134@opindex m64 33135@opindex mx32 33136@opindex m16 33137@opindex miamcu 33138Generate code for a 16-bit, 32-bit or 64-bit environment. 33139The @option{-m32} option sets @code{int}, @code{long}, and pointer types 33140to 32 bits, and 33141generates code that runs in 32-bit mode. 33142 33143The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 33144types to 64 bits, and generates code for the x86-64 architecture. 33145For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 33146and @option{-mdynamic-no-pic} options. 33147 33148The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 33149to 32 bits, and 33150generates code for the x86-64 architecture. 33151 33152The @option{-m16} option is the same as @option{-m32}, except for that 33153it outputs the @code{.code16gcc} assembly directive at the beginning of 33154the assembly output so that the binary can run in 16-bit mode. 33155 33156The @option{-miamcu} option generates code which conforms to Intel MCU 33157psABI. It requires the @option{-m32} option to be turned on. 33158 33159@item -mno-red-zone 33160@opindex mno-red-zone 33161@opindex mred-zone 33162Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 33163by the x86-64 ABI; it is a 128-byte area beyond the location of the 33164stack pointer that is not modified by signal or interrupt handlers 33165and therefore can be used for temporary data without adjusting the stack 33166pointer. The flag @option{-mno-red-zone} disables this red zone. 33167 33168@item -mcmodel=small 33169@opindex mcmodel=small 33170Generate code for the small code model: the program and its symbols must 33171be linked in the lower 2 GB of the address space. Pointers are 64 bits. 33172Programs can be statically or dynamically linked. This is the default 33173code model. 33174 33175@item -mcmodel=kernel 33176@opindex mcmodel=kernel 33177Generate code for the kernel code model. The kernel runs in the 33178negative 2 GB of the address space. 33179This model has to be used for Linux kernel code. 33180 33181@item -mcmodel=medium 33182@opindex mcmodel=medium 33183Generate code for the medium model: the program is linked in the lower 2 33184GB of the address space. Small symbols are also placed there. Symbols 33185with sizes larger than @option{-mlarge-data-threshold} are put into 33186large data or BSS sections and can be located above 2GB. Programs can 33187be statically or dynamically linked. 33188 33189@item -mcmodel=large 33190@opindex mcmodel=large 33191Generate code for the large model. This model makes no assumptions 33192about addresses and sizes of sections. 33193 33194@item -maddress-mode=long 33195@opindex maddress-mode=long 33196Generate code for long address mode. This is only supported for 64-bit 33197and x32 environments. It is the default address mode for 64-bit 33198environments. 33199 33200@item -maddress-mode=short 33201@opindex maddress-mode=short 33202Generate code for short address mode. This is only supported for 32-bit 33203and x32 environments. It is the default address mode for 32-bit and 33204x32 environments. 33205 33206@item -mneeded 33207@itemx -mno-needed 33208@opindex mneeded 33209Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to 33210indicate the micro-architecture ISA level required to execute the binary. 33211 33212@item -mno-direct-extern-access 33213@opindex mno-direct-extern-access 33214@opindex mdirect-extern-access 33215Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer 33216to access external symbols. With @option{-fpic} or @option{-fPIC}, 33217treat access to protected symbols as local symbols. The default is 33218@option{-mdirect-extern-access}. 33219 33220@strong{Warning:} shared libraries compiled with 33221@option{-mno-direct-extern-access} and executable compiled with 33222@option{-mdirect-extern-access} may not be binary compatible if 33223protected symbols are used in shared libraries and executable. 33224@end table 33225 33226@node x86 Windows Options 33227@subsection x86 Windows Options 33228@cindex x86 Windows Options 33229@cindex Windows Options for x86 33230 33231These additional options are available for Microsoft Windows targets: 33232 33233@table @gcctabopt 33234@item -mconsole 33235@opindex mconsole 33236This option 33237specifies that a console application is to be generated, by 33238instructing the linker to set the PE header subsystem type 33239required for console applications. 33240This option is available for Cygwin and MinGW targets and is 33241enabled by default on those targets. 33242 33243@item -mdll 33244@opindex mdll 33245This option is available for Cygwin and MinGW targets. It 33246specifies that a DLL---a dynamic link library---is to be 33247generated, enabling the selection of the required runtime 33248startup object and entry point. 33249 33250@item -mnop-fun-dllimport 33251@opindex mnop-fun-dllimport 33252This option is available for Cygwin and MinGW targets. It 33253specifies that the @code{dllimport} attribute should be ignored. 33254 33255@item -mthreads 33256@opindex mthreads 33257This option is available for MinGW targets. It specifies 33258that MinGW-specific thread support is to be used. 33259 33260@item -municode 33261@opindex municode 33262This option is available for MinGW-w64 targets. It causes 33263the @code{UNICODE} preprocessor macro to be predefined, and 33264chooses Unicode-capable runtime startup code. 33265 33266@item -mwin32 33267@opindex mwin32 33268This option is available for Cygwin and MinGW targets. It 33269specifies that the typical Microsoft Windows predefined macros are to 33270be set in the pre-processor, but does not influence the choice 33271of runtime library/startup code. 33272 33273@item -mwindows 33274@opindex mwindows 33275This option is available for Cygwin and MinGW targets. It 33276specifies that a GUI application is to be generated by 33277instructing the linker to set the PE header subsystem type 33278appropriately. 33279 33280@item -fno-set-stack-executable 33281@opindex fno-set-stack-executable 33282@opindex fset-stack-executable 33283This option is available for MinGW targets. It specifies that 33284the executable flag for the stack used by nested functions isn't 33285set. This is necessary for binaries running in kernel mode of 33286Microsoft Windows, as there the User32 API, which is used to set executable 33287privileges, isn't available. 33288 33289@item -fwritable-relocated-rdata 33290@opindex fno-writable-relocated-rdata 33291@opindex fwritable-relocated-rdata 33292This option is available for MinGW and Cygwin targets. It specifies 33293that relocated-data in read-only section is put into the @code{.data} 33294section. This is a necessary for older runtimes not supporting 33295modification of @code{.rdata} sections for pseudo-relocation. 33296 33297@item -mpe-aligned-commons 33298@opindex mpe-aligned-commons 33299This option is available for Cygwin and MinGW targets. It 33300specifies that the GNU extension to the PE file format that 33301permits the correct alignment of COMMON variables should be 33302used when generating code. It is enabled by default if 33303GCC detects that the target assembler found during configuration 33304supports the feature. 33305 33306@item -mindirect-branch=@var{choice} 33307@opindex -mindirect-branch 33308Convert indirect call and jump with @var{choice}. The default is 33309@samp{keep}, which keeps indirect call and jump unmodified. 33310@samp{thunk} converts indirect call and jump to call and return thunk. 33311@samp{thunk-inline} converts indirect call and jump to inlined call 33312and return thunk. @samp{thunk-extern} converts indirect call and jump 33313to external call and return thunk provided in a separate object file. 33314You can control this behavior for a specific function by using the 33315function attribute @code{indirect_branch}. @xref{Function Attributes}. 33316 33317Note that @option{-mcmodel=large} is incompatible with 33318@option{-mindirect-branch=thunk} nor 33319@option{-mindirect-branch=thunk-extern} since the thunk function may 33320not be reachable in large code model. 33321 33322@item -mfunction-return=@var{choice} 33323@opindex -mfunction-return 33324Convert function return with @var{choice}. The default is @samp{keep}, 33325which keeps function return unmodified. @samp{thunk} converts function 33326return to call and return thunk. @samp{thunk-inline} converts function 33327return to inlined call and return thunk. @samp{thunk-extern} converts 33328function return to external call and return thunk provided in a separate 33329object file. You can control this behavior for a specific function by 33330using the function attribute @code{function_return}. 33331@xref{Function Attributes}. 33332 33333Note that @option{-mcmodel=large} is incompatible with 33334@option{-mfunction-return=thunk} nor 33335@option{-mfunction-return=thunk-extern} since the thunk function may 33336not be reachable in large code model. 33337 33338@item -mindirect-branch-register 33339@opindex -mindirect-branch-register 33340Force indirect call and jump via register. 33341@end table 33342 33343See also under @ref{x86 Options} for standard options. 33344 33345@node Xstormy16 Options 33346@subsection Xstormy16 Options 33347@cindex Xstormy16 Options 33348 33349These options are defined for Xstormy16: 33350 33351@table @gcctabopt 33352@item -msim 33353@opindex msim 33354Choose startup files and linker script suitable for the simulator. 33355@end table 33356 33357@node Xtensa Options 33358@subsection Xtensa Options 33359@cindex Xtensa Options 33360 33361These options are supported for Xtensa targets: 33362 33363@table @gcctabopt 33364@item -mconst16 33365@itemx -mno-const16 33366@opindex mconst16 33367@opindex mno-const16 33368Enable or disable use of @code{CONST16} instructions for loading 33369constant values. The @code{CONST16} instruction is currently not a 33370standard option from Tensilica. When enabled, @code{CONST16} 33371instructions are always used in place of the standard @code{L32R} 33372instructions. The use of @code{CONST16} is enabled by default only if 33373the @code{L32R} instruction is not available. 33374 33375@item -mfused-madd 33376@itemx -mno-fused-madd 33377@opindex mfused-madd 33378@opindex mno-fused-madd 33379Enable or disable use of fused multiply/add and multiply/subtract 33380instructions in the floating-point option. This has no effect if the 33381floating-point option is not also enabled. Disabling fused multiply/add 33382and multiply/subtract instructions forces the compiler to use separate 33383instructions for the multiply and add/subtract operations. This may be 33384desirable in some cases where strict IEEE 754-compliant results are 33385required: the fused multiply add/subtract instructions do not round the 33386intermediate result, thereby producing results with @emph{more} bits of 33387precision than specified by the IEEE standard. Disabling fused multiply 33388add/subtract instructions also ensures that the program output is not 33389sensitive to the compiler's ability to combine multiply and add/subtract 33390operations. 33391 33392@item -mserialize-volatile 33393@itemx -mno-serialize-volatile 33394@opindex mserialize-volatile 33395@opindex mno-serialize-volatile 33396When this option is enabled, GCC inserts @code{MEMW} instructions before 33397@code{volatile} memory references to guarantee sequential consistency. 33398The default is @option{-mserialize-volatile}. Use 33399@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 33400 33401@item -mforce-no-pic 33402@opindex mforce-no-pic 33403For targets, like GNU/Linux, where all user-mode Xtensa code must be 33404position-independent code (PIC), this option disables PIC for compiling 33405kernel code. 33406 33407@item -mtext-section-literals 33408@itemx -mno-text-section-literals 33409@opindex mtext-section-literals 33410@opindex mno-text-section-literals 33411These options control the treatment of literal pools. The default is 33412@option{-mno-text-section-literals}, which places literals in a separate 33413section in the output file. This allows the literal pool to be placed 33414in a data RAM/ROM, and it also allows the linker to combine literal 33415pools from separate object files to remove redundant literals and 33416improve code size. With @option{-mtext-section-literals}, the literals 33417are interspersed in the text section in order to keep them as close as 33418possible to their references. This may be necessary for large assembly 33419files. Literals for each function are placed right before that function. 33420 33421@item -mauto-litpools 33422@itemx -mno-auto-litpools 33423@opindex mauto-litpools 33424@opindex mno-auto-litpools 33425These options control the treatment of literal pools. The default is 33426@option{-mno-auto-litpools}, which places literals in a separate 33427section in the output file unless @option{-mtext-section-literals} is 33428used. With @option{-mauto-litpools} the literals are interspersed in 33429the text section by the assembler. Compiler does not produce explicit 33430@code{.literal} directives and loads literals into registers with 33431@code{MOVI} instructions instead of @code{L32R} to let the assembler 33432do relaxation and place literals as necessary. This option allows 33433assembler to create several literal pools per function and assemble 33434very big functions, which may not be possible with 33435@option{-mtext-section-literals}. 33436 33437@item -mtarget-align 33438@itemx -mno-target-align 33439@opindex mtarget-align 33440@opindex mno-target-align 33441When this option is enabled, GCC instructs the assembler to 33442automatically align instructions to reduce branch penalties at the 33443expense of some code density. The assembler attempts to widen density 33444instructions to align branch targets and the instructions following call 33445instructions. If there are not enough preceding safe density 33446instructions to align a target, no widening is performed. The 33447default is @option{-mtarget-align}. These options do not affect the 33448treatment of auto-aligned instructions like @code{LOOP}, which the 33449assembler always aligns, either by widening density instructions or 33450by inserting NOP instructions. 33451 33452@item -mlongcalls 33453@itemx -mno-longcalls 33454@opindex mlongcalls 33455@opindex mno-longcalls 33456When this option is enabled, GCC instructs the assembler to translate 33457direct calls to indirect calls unless it can determine that the target 33458of a direct call is in the range allowed by the call instruction. This 33459translation typically occurs for calls to functions in other source 33460files. Specifically, the assembler translates a direct @code{CALL} 33461instruction into an @code{L32R} followed by a @code{CALLX} instruction. 33462The default is @option{-mno-longcalls}. This option should be used in 33463programs where the call target can potentially be out of range. This 33464option is implemented in the assembler, not the compiler, so the 33465assembly code generated by GCC still shows direct call 33466instructions---look at the disassembled object code to see the actual 33467instructions. Note that the assembler uses an indirect call for 33468every cross-file call, not just those that really are out of range. 33469 33470@item -mabi=@var{name} 33471@opindex mabi 33472Generate code for the specified ABI@. Permissible values are: @samp{call0}, 33473@samp{windowed}. Default ABI is chosen by the Xtensa core configuration. 33474 33475@item -mabi=call0 33476@opindex mabi=call0 33477When this option is enabled function parameters are passed in registers 33478@code{a2} through @code{a7}, registers @code{a12} through @code{a15} are 33479caller-saved, and register @code{a15} may be used as a frame pointer. 33480When this version of the ABI is enabled the C preprocessor symbol 33481@code{__XTENSA_CALL0_ABI__} is defined. 33482 33483@item -mabi=windowed 33484@opindex mabi=windowed 33485When this option is enabled function parameters are passed in registers 33486@code{a10} through @code{a15}, and called function rotates register window 33487by 8 registers on entry so that its arguments are found in registers 33488@code{a2} through @code{a7}. Register @code{a7} may be used as a frame 33489pointer. Register window is rotated 8 registers back upon return. 33490When this version of the ABI is enabled the C preprocessor symbol 33491@code{__XTENSA_WINDOWED_ABI__} is defined. 33492@end table 33493 33494@node zSeries Options 33495@subsection zSeries Options 33496@cindex zSeries options 33497 33498These are listed under @xref{S/390 and zSeries Options}. 33499 33500 33501@c man end 33502 33503@node Spec Files 33504@section Specifying Subprocesses and the Switches to Pass to Them 33505@cindex Spec Files 33506 33507@command{gcc} is a driver program. It performs its job by invoking a 33508sequence of other programs to do the work of compiling, assembling and 33509linking. GCC interprets its command-line parameters and uses these to 33510deduce which programs it should invoke, and which command-line options 33511it ought to place on their command lines. This behavior is controlled 33512by @dfn{spec strings}. In most cases there is one spec string for each 33513program that GCC can invoke, but a few programs have multiple spec 33514strings to control their behavior. The spec strings built into GCC can 33515be overridden by using the @option{-specs=} command-line switch to specify 33516a spec file. 33517 33518@dfn{Spec files} are plain-text files that are used to construct spec 33519strings. They consist of a sequence of directives separated by blank 33520lines. The type of directive is determined by the first non-whitespace 33521character on the line, which can be one of the following: 33522 33523@table @code 33524@item %@var{command} 33525Issues a @var{command} to the spec file processor. The commands that can 33526appear here are: 33527 33528@table @code 33529@item %include <@var{file}> 33530@cindex @code{%include} 33531Search for @var{file} and insert its text at the current point in the 33532specs file. 33533 33534@item %include_noerr <@var{file}> 33535@cindex @code{%include_noerr} 33536Just like @samp{%include}, but do not generate an error message if the include 33537file cannot be found. 33538 33539@item %rename @var{old_name} @var{new_name} 33540@cindex @code{%rename} 33541Rename the spec string @var{old_name} to @var{new_name}. 33542 33543@end table 33544 33545@item *[@var{spec_name}]: 33546This tells the compiler to create, override or delete the named spec 33547string. All lines after this directive up to the next directive or 33548blank line are considered to be the text for the spec string. If this 33549results in an empty string then the spec is deleted. (Or, if the 33550spec did not exist, then nothing happens.) Otherwise, if the spec 33551does not currently exist a new spec is created. If the spec does 33552exist then its contents are overridden by the text of this 33553directive, unless the first character of that text is the @samp{+} 33554character, in which case the text is appended to the spec. 33555 33556@item [@var{suffix}]: 33557Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 33558and up to the next directive or blank line are considered to make up the 33559spec string for the indicated suffix. When the compiler encounters an 33560input file with the named suffix, it processes the spec string in 33561order to work out how to compile that file. For example: 33562 33563@smallexample 33564.ZZ: 33565z-compile -input %i 33566@end smallexample 33567 33568This says that any input file whose name ends in @samp{.ZZ} should be 33569passed to the program @samp{z-compile}, which should be invoked with the 33570command-line switch @option{-input} and with the result of performing the 33571@samp{%i} substitution. (See below.) 33572 33573As an alternative to providing a spec string, the text following a 33574suffix directive can be one of the following: 33575 33576@table @code 33577@item @@@var{language} 33578This says that the suffix is an alias for a known @var{language}. This is 33579similar to using the @option{-x} command-line switch to GCC to specify a 33580language explicitly. For example: 33581 33582@smallexample 33583.ZZ: 33584@@c++ 33585@end smallexample 33586 33587Says that .ZZ files are, in fact, C++ source files. 33588 33589@item #@var{name} 33590This causes an error messages saying: 33591 33592@smallexample 33593@var{name} compiler not installed on this system. 33594@end smallexample 33595@end table 33596 33597GCC already has an extensive list of suffixes built into it. 33598This directive adds an entry to the end of the list of suffixes, but 33599since the list is searched from the end backwards, it is effectively 33600possible to override earlier entries using this technique. 33601 33602@end table 33603 33604GCC has the following spec strings built into it. Spec files can 33605override these strings or create their own. Note that individual 33606targets can also add their own spec strings to this list. 33607 33608@smallexample 33609asm Options to pass to the assembler 33610asm_final Options to pass to the assembler post-processor 33611cpp Options to pass to the C preprocessor 33612cc1 Options to pass to the C compiler 33613cc1plus Options to pass to the C++ compiler 33614endfile Object files to include at the end of the link 33615link Options to pass to the linker 33616lib Libraries to include on the command line to the linker 33617libgcc Decides which GCC support library to pass to the linker 33618linker Sets the name of the linker 33619predefines Defines to be passed to the C preprocessor 33620signed_char Defines to pass to CPP to say whether @code{char} is signed 33621 by default 33622startfile Object files to include at the start of the link 33623@end smallexample 33624 33625Here is a small example of a spec file: 33626 33627@smallexample 33628%rename lib old_lib 33629 33630*lib: 33631--start-group -lgcc -lc -leval1 --end-group %(old_lib) 33632@end smallexample 33633 33634This example renames the spec called @samp{lib} to @samp{old_lib} and 33635then overrides the previous definition of @samp{lib} with a new one. 33636The new definition adds in some extra command-line options before 33637including the text of the old definition. 33638 33639@dfn{Spec strings} are a list of command-line options to be passed to their 33640corresponding program. In addition, the spec strings can contain 33641@samp{%}-prefixed sequences to substitute variable text or to 33642conditionally insert text into the command line. Using these constructs 33643it is possible to generate quite complex command lines. 33644 33645Here is a table of all defined @samp{%}-sequences for spec 33646strings. Note that spaces are not generated automatically around the 33647results of expanding these sequences. Therefore you can concatenate them 33648together or combine them with constant text in a single argument. 33649 33650@table @code 33651@item %% 33652Substitute one @samp{%} into the program name or argument. 33653 33654@item %" 33655Substitute an empty argument. 33656 33657@item %i 33658Substitute the name of the input file being processed. 33659 33660@item %b 33661Substitute the basename for outputs related with the input file being 33662processed. This is often the substring up to (and not including) the 33663last period and not including the directory but, unless %w is active, it 33664expands to the basename for auxiliary outputs, which may be influenced 33665by an explicit output name, and by various other options that control 33666how auxiliary outputs are named. 33667 33668@item %B 33669This is the same as @samp{%b}, but include the file suffix (text after 33670the last period). Without %w, it expands to the basename for dump 33671outputs. 33672 33673@item %d 33674Marks the argument containing or following the @samp{%d} as a 33675temporary file name, so that that file is deleted if GCC exits 33676successfully. Unlike @samp{%g}, this contributes no text to the 33677argument. 33678 33679@item %g@var{suffix} 33680Substitute a file name that has suffix @var{suffix} and is chosen 33681once per compilation, and mark the argument in the same way as 33682@samp{%d}. To reduce exposure to denial-of-service attacks, the file 33683name is now chosen in a way that is hard to predict even when previously 33684chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 33685might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 33686the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 33687treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 33688was simply substituted with a file name chosen once per compilation, 33689without regard to any appended suffix (which was therefore treated 33690just like ordinary text), making such attacks more likely to succeed. 33691 33692@item %u@var{suffix} 33693Like @samp{%g}, but generates a new temporary file name 33694each time it appears instead of once per compilation. 33695 33696@item %U@var{suffix} 33697Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 33698new one if there is no such last file name. In the absence of any 33699@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 33700the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 33701involves the generation of two distinct file names, one 33702for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 33703simply substituted with a file name chosen for the previous @samp{%u}, 33704without regard to any appended suffix. 33705 33706@item %j@var{suffix} 33707Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 33708writable, and if @option{-save-temps} is not used; 33709otherwise, substitute the name 33710of a temporary file, just like @samp{%u}. This temporary file is not 33711meant for communication between processes, but rather as a junk 33712disposal mechanism. 33713 33714@item %|@var{suffix} 33715@itemx %m@var{suffix} 33716Like @samp{%g}, except if @option{-pipe} is in effect. In that case 33717@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 33718all. These are the two most common ways to instruct a program that it 33719should read from standard input or write to standard output. If you 33720need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 33721construct: see for example @file{gcc/fortran/lang-specs.h}. 33722 33723@item %.@var{SUFFIX} 33724Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 33725when it is subsequently output with @samp{%*}. @var{SUFFIX} is 33726terminated by the next space or %. 33727 33728@item %w 33729Marks the argument containing or following the @samp{%w} as the 33730designated output file of this compilation. This puts the argument 33731into the sequence of arguments that @samp{%o} substitutes. 33732 33733@item %V 33734Indicates that this compilation produces no output file. 33735 33736@item %o 33737Substitutes the names of all the output files, with spaces 33738automatically placed around them. You should write spaces 33739around the @samp{%o} as well or the results are undefined. 33740@samp{%o} is for use in the specs for running the linker. 33741Input files whose names have no recognized suffix are not compiled 33742at all, but they are included among the output files, so they are 33743linked. 33744 33745@item %O 33746Substitutes the suffix for object files. Note that this is 33747handled specially when it immediately follows @samp{%g, %u, or %U}, 33748because of the need for those to form complete file names. The 33749handling is such that @samp{%O} is treated exactly as if it had already 33750been substituted, except that @samp{%g, %u, and %U} do not currently 33751support additional @var{suffix} characters following @samp{%O} as they do 33752following, for example, @samp{.o}. 33753 33754@item %I 33755Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 33756@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 33757@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 33758and @option{-imultilib} as necessary. 33759 33760@item %s 33761Current argument is the name of a library or startup file of some sort. 33762Search for that file in a standard list of directories and substitute 33763the full name found. The current working directory is included in the 33764list of directories scanned. 33765 33766@item %T 33767Current argument is the name of a linker script. Search for that file 33768in the current list of directories to scan for libraries. If the file 33769is located insert a @option{--script} option into the command line 33770followed by the full path name found. If the file is not found then 33771generate an error message. Note: the current working directory is not 33772searched. 33773 33774@item %e@var{str} 33775Print @var{str} as an error message. @var{str} is terminated by a newline. 33776Use this when inconsistent options are detected. 33777 33778@item %n@var{str} 33779Print @var{str} as a notice. @var{str} is terminated by a newline. 33780 33781@item %(@var{name}) 33782Substitute the contents of spec string @var{name} at this point. 33783 33784@item %x@{@var{option}@} 33785Accumulate an option for @samp{%X}. 33786 33787@item %X 33788Output the accumulated linker options specified by a @samp{%x} spec string. 33789 33790@item %Y 33791Output the accumulated assembler options specified by @option{-Wa}. 33792 33793@item %Z 33794Output the accumulated preprocessor options specified by @option{-Wp}. 33795 33796@item %M 33797Output @code{multilib_os_dir}. 33798 33799@item %R 33800Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}. 33801 33802@item %a 33803Process the @code{asm} spec. This is used to compute the 33804switches to be passed to the assembler. 33805 33806@item %A 33807Process the @code{asm_final} spec. This is a spec string for 33808passing switches to an assembler post-processor, if such a program is 33809needed. 33810 33811@item %l 33812Process the @code{link} spec. This is the spec for computing the 33813command line passed to the linker. Typically it makes use of the 33814@samp{%L %G %S %D and %E} sequences. 33815 33816@item %D 33817Dump out a @option{-L} option for each directory that GCC believes might 33818contain startup files. If the target supports multilibs then the 33819current multilib directory is prepended to each of these paths. 33820 33821@item %L 33822Process the @code{lib} spec. This is a spec string for deciding which 33823libraries are included on the command line to the linker. 33824 33825@item %G 33826Process the @code{libgcc} spec. This is a spec string for deciding 33827which GCC support library is included on the command line to the linker. 33828 33829@item %S 33830Process the @code{startfile} spec. This is a spec for deciding which 33831object files are the first ones passed to the linker. Typically 33832this might be a file named @file{crt0.o}. 33833 33834@item %E 33835Process the @code{endfile} spec. This is a spec string that specifies 33836the last object files that are passed to the linker. 33837 33838@item %C 33839Process the @code{cpp} spec. This is used to construct the arguments 33840to be passed to the C preprocessor. 33841 33842@item %1 33843Process the @code{cc1} spec. This is used to construct the options to be 33844passed to the actual C compiler (@command{cc1}). 33845 33846@item %2 33847Process the @code{cc1plus} spec. This is used to construct the options to be 33848passed to the actual C++ compiler (@command{cc1plus}). 33849 33850@item %* 33851Substitute the variable part of a matched option. See below. 33852Note that each comma in the substituted string is replaced by 33853a single space. 33854 33855@item %<S 33856Remove all occurrences of @code{-S} from the command line. Note---this 33857command is position dependent. @samp{%} commands in the spec string 33858before this one see @code{-S}, @samp{%} commands in the spec string 33859after this one do not. 33860 33861@item %<S* 33862Similar to @samp{%<S}, but match all switches beginning with @code{-S}. 33863 33864@item %>S 33865Similar to @samp{%<S}, but keep @code{-S} in the GCC command line. 33866 33867@item %:@var{function}(@var{args}) 33868Call the named function @var{function}, passing it @var{args}. 33869@var{args} is first processed as a nested spec string, then split 33870into an argument vector in the usual fashion. The function returns 33871a string which is processed as if it had appeared literally as part 33872of the current spec. 33873 33874The following built-in spec functions are provided: 33875 33876@table @code 33877@item @code{getenv} 33878The @code{getenv} spec function takes two arguments: an environment 33879variable name and a string. If the environment variable is not 33880defined, a fatal error is issued. Otherwise, the return value is the 33881value of the environment variable concatenated with the string. For 33882example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 33883 33884@smallexample 33885%:getenv(TOPDIR /include) 33886@end smallexample 33887 33888expands to @file{/path/to/top/include}. 33889 33890@item @code{if-exists} 33891The @code{if-exists} spec function takes one argument, an absolute 33892pathname to a file. If the file exists, @code{if-exists} returns the 33893pathname. Here is a small example of its usage: 33894 33895@smallexample 33896*startfile: 33897crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 33898@end smallexample 33899 33900@item @code{if-exists-else} 33901The @code{if-exists-else} spec function is similar to the @code{if-exists} 33902spec function, except that it takes two arguments. The first argument is 33903an absolute pathname to a file. If the file exists, @code{if-exists-else} 33904returns the pathname. If it does not exist, it returns the second argument. 33905This way, @code{if-exists-else} can be used to select one file or another, 33906based on the existence of the first. Here is a small example of its usage: 33907 33908@smallexample 33909*startfile: 33910crt0%O%s %:if-exists(crti%O%s) \ 33911%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 33912@end smallexample 33913 33914@item @code{if-exists-then-else} 33915The @code{if-exists-then-else} spec function takes at least two arguments 33916and an optional third one. The first argument is an absolute pathname to a 33917file. If the file exists, the function returns the second argument. 33918If the file does not exist, the function returns the third argument if there 33919is one, or NULL otherwise. This can be used to expand one text, or optionally 33920another, based on the existence of a file. Here is a small example of its 33921usage: 33922 33923@smallexample 33924-l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net) 33925@end smallexample 33926 33927@item @code{sanitize} 33928The @code{sanitize} spec function takes no arguments. It returns non-NULL if 33929any address, thread or undefined behavior sanitizers are active. 33930 33931@smallexample 33932%@{%:sanitize(address):-funwind-tables@} 33933@end smallexample 33934 33935@item @code{replace-outfile} 33936The @code{replace-outfile} spec function takes two arguments. It looks for the 33937first argument in the outfiles array and replaces it with the second argument. Here 33938is a small example of its usage: 33939 33940@smallexample 33941%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 33942@end smallexample 33943 33944@item @code{remove-outfile} 33945The @code{remove-outfile} spec function takes one argument. It looks for the 33946first argument in the outfiles array and removes it. Here is a small example 33947its usage: 33948 33949@smallexample 33950%:remove-outfile(-lm) 33951@end smallexample 33952 33953@item @code{version-compare} 33954The @code{version-compare} spec function takes four or five arguments of the following 33955form: 33956 33957@smallexample 33958<comparison-op> <arg1> [<arg2>] <switch> <result> 33959@end smallexample 33960 33961It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't. 33962The supported @code{comparison-op} values are: 33963 33964@table @code 33965@item >= 33966True if @code{switch} is a later (or same) version than @code{arg1} 33967 33968@item !> 33969Opposite of @code{>=} 33970 33971@item < 33972True if @code{switch} is an earlier version than @code{arg1} 33973 33974@item !< 33975Opposite of @code{<} 33976 33977@item >< 33978True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2} 33979 33980@item <> 33981True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later 33982@end table 33983 33984If the @code{switch} is not present at all, the condition is false unless the first character 33985of the @code{comparison-op} is @code{!}. 33986 33987@smallexample 33988%:version-compare(>= 10.3 mmacosx-version-min= -lmx) 33989@end smallexample 33990 33991The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was 33992passed. 33993 33994@item @code{include} 33995The @code{include} spec function behaves much like @code{%include}, with the advantage 33996that it can be nested inside a spec and thus be conditionalized. It takes one argument, 33997the filename, and looks for it in the startfile path. It always returns NULL. 33998 33999@smallexample 34000%@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@} 34001@end smallexample 34002 34003@item @code{pass-through-libs} 34004The @code{pass-through-libs} spec function takes any number of arguments. It 34005finds any @option{-l} options and any non-options ending in @file{.a} (which it 34006assumes are the names of linker input library archive files) and returns a 34007result containing all the found arguments each prepended by 34008@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 34009intended to be passed to the LTO linker plugin. 34010 34011@smallexample 34012%:pass-through-libs(%G %L %G) 34013@end smallexample 34014 34015@item @code{print-asm-header} 34016The @code{print-asm-header} function takes no arguments and simply 34017prints a banner like: 34018 34019@smallexample 34020Assembler options 34021================= 34022 34023Use "-Wa,OPTION" to pass "OPTION" to the assembler. 34024@end smallexample 34025 34026It is used to separate compiler options from assembler options 34027in the @option{--target-help} output. 34028 34029@item @code{gt} 34030The @code{gt} spec function takes two or more arguments. It returns @code{""} (the 34031empty string) if the second-to-last argument is greater than the last argument, and NULL 34032otherwise. The following example inserts the @code{link_gomp} spec if the last 34033@option{-ftree-parallelize-loops=} option given on the command line is greater than 1: 34034 34035@smallexample 34036%@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@} 34037@end smallexample 34038 34039@item @code{debug-level-gt} 34040The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the 34041empty string) if @code{debug_info_level} is greater than the specified number, and NULL 34042otherwise. 34043 34044@smallexample 34045%@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@} 34046@end smallexample 34047@end table 34048 34049@item %@{S@} 34050Substitutes the @code{-S} switch, if that switch is given to GCC@. 34051If that switch is not specified, this substitutes nothing. Note that 34052the leading dash is omitted when specifying this option, and it is 34053automatically inserted if the substitution is performed. Thus the spec 34054string @samp{%@{foo@}} matches the command-line option @option{-foo} 34055and outputs the command-line option @option{-foo}. 34056 34057@item %W@{S@} 34058Like %@{@code{S}@} but mark last argument supplied within as a file to be 34059deleted on failure. 34060 34061@item %@@@{S@} 34062Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes 34063@code{@@FILE} if an @code{@@file} argument has been supplied. 34064 34065@item %@{S*@} 34066Substitutes all the switches specified to GCC whose names start 34067with @code{-S}, but which also take an argument. This is used for 34068switches like @option{-o}, @option{-D}, @option{-I}, etc. 34069GCC considers @option{-o foo} as being 34070one switch whose name starts with @samp{o}. %@{o*@} substitutes this 34071text, including the space. Thus two arguments are generated. 34072 34073@item %@{S*&T*@} 34074Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 34075(the order of @code{S} and @code{T} in the spec is not significant). 34076There can be any number of ampersand-separated variables; for each the 34077wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 34078 34079@item %@{S:X@} 34080Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 34081 34082@item %@{!S:X@} 34083Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 34084 34085@item %@{S*:X@} 34086Substitutes @code{X} if one or more switches whose names start with 34087@code{-S} are specified to GCC@. Normally @code{X} is substituted only 34088once, no matter how many such switches appeared. However, if @code{%*} 34089appears somewhere in @code{X}, then @code{X} is substituted once 34090for each matching switch, with the @code{%*} replaced by the part of 34091that switch matching the @code{*}. 34092 34093If @code{%*} appears as the last part of a spec sequence then a space 34094is added after the end of the last substitution. If there is more 34095text in the sequence, however, then a space is not generated. This 34096allows the @code{%*} substitution to be used as part of a larger 34097string. For example, a spec string like this: 34098 34099@smallexample 34100%@{mcu=*:--script=%*/memory.ld@} 34101@end smallexample 34102 34103@noindent 34104when matching an option like @option{-mcu=newchip} produces: 34105 34106@smallexample 34107--script=newchip/memory.ld 34108@end smallexample 34109 34110@item %@{.S:X@} 34111Substitutes @code{X}, if processing a file with suffix @code{S}. 34112 34113@item %@{!.S:X@} 34114Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 34115 34116@item %@{,S:X@} 34117Substitutes @code{X}, if processing a file for language @code{S}. 34118 34119@item %@{!,S:X@} 34120Substitutes @code{X}, if not processing a file for language @code{S}. 34121 34122@item %@{S|P:X@} 34123Substitutes @code{X} if either @code{-S} or @code{-P} is given to 34124GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 34125@code{*} sequences as well, although they have a stronger binding than 34126the @samp{|}. If @code{%*} appears in @code{X}, all of the 34127alternatives must be starred, and only the first matching alternative 34128is substituted. 34129 34130For example, a spec string like this: 34131 34132@smallexample 34133%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 34134@end smallexample 34135 34136@noindent 34137outputs the following command-line options from the following input 34138command-line options: 34139 34140@smallexample 34141fred.c -foo -baz 34142jim.d -bar -boggle 34143-d fred.c -foo -baz -boggle 34144-d jim.d -bar -baz -boggle 34145@end smallexample 34146 34147@item %@{%:@var{function}(@var{args}):X@} 34148 34149Call function named @var{function} with args @var{args}. If the 34150function returns non-NULL, then @code{X} is substituted, if it returns 34151NULL, it isn't substituted. 34152 34153@item %@{S:X; T:Y; :D@} 34154 34155If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 34156given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 34157be as many clauses as you need. This may be combined with @code{.}, 34158@code{,}, @code{!}, @code{|}, and @code{*} as needed. 34159 34160 34161@end table 34162 34163The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}} 34164or similar construct can use a backslash to ignore the special meaning 34165of the character following it, thus allowing literal matching of a 34166character that is otherwise specially treated. For example, 34167@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the 34168@option{-std=iso9899:1999} option is given. 34169 34170The conditional text @code{X} in a @samp{%@{S:X@}} or similar 34171construct may contain other nested @samp{%} constructs or spaces, or 34172even newlines. They are processed as usual, as described above. 34173Trailing white space in @code{X} is ignored. White space may also 34174appear anywhere on the left side of the colon in these constructs, 34175except between @code{.} or @code{*} and the corresponding word. 34176 34177The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 34178handled specifically in these constructs. If another value of 34179@option{-O} or the negated form of a @option{-f}, @option{-m}, or 34180@option{-W} switch is found later in the command line, the earlier 34181switch value is ignored, except with @{@code{S}*@} where @code{S} is 34182just one letter, which passes all matching options. 34183 34184The character @samp{|} at the beginning of the predicate text is used to 34185indicate that a command should be piped to the following command, but 34186only if @option{-pipe} is specified. 34187 34188It is built into GCC which switches take arguments and which do not. 34189(You might think it would be useful to generalize this to allow each 34190compiler's spec to say which switches take arguments. But this cannot 34191be done in a consistent fashion. GCC cannot even decide which input 34192files have been specified without knowing which switches take arguments, 34193and it must know which input files to compile in order to tell which 34194compilers to run). 34195 34196GCC also knows implicitly that arguments starting in @option{-l} are to be 34197treated as compiler output files, and passed to the linker in their 34198proper position among the other output files. 34199 34200@node Environment Variables 34201@section Environment Variables Affecting GCC 34202@cindex environment variables 34203 34204@c man begin ENVIRONMENT 34205This section describes several environment variables that affect how GCC 34206operates. Some of them work by specifying directories or prefixes to use 34207when searching for various kinds of files. Some are used to specify other 34208aspects of the compilation environment. 34209 34210Note that you can also specify places to search using options such as 34211@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 34212take precedence over places specified using environment variables, which 34213in turn take precedence over those specified by the configuration of GCC@. 34214@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 34215GNU Compiler Collection (GCC) Internals}. 34216 34217@table @env 34218@item LANG 34219@itemx LC_CTYPE 34220@c @itemx LC_COLLATE 34221@itemx LC_MESSAGES 34222@c @itemx LC_MONETARY 34223@c @itemx LC_NUMERIC 34224@c @itemx LC_TIME 34225@itemx LC_ALL 34226@findex LANG 34227@findex LC_CTYPE 34228@c @findex LC_COLLATE 34229@findex LC_MESSAGES 34230@c @findex LC_MONETARY 34231@c @findex LC_NUMERIC 34232@c @findex LC_TIME 34233@findex LC_ALL 34234@cindex locale 34235These environment variables control the way that GCC uses 34236localization information which allows GCC to work with different 34237national conventions. GCC inspects the locale categories 34238@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 34239so. These locale categories can be set to any value supported by your 34240installation. A typical value is @samp{en_GB.UTF-8} for English in the United 34241Kingdom encoded in UTF-8. 34242 34243The @env{LC_CTYPE} environment variable specifies character 34244classification. GCC uses it to determine the character boundaries in 34245a string; this is needed for some multibyte encodings that contain quote 34246and escape characters that are otherwise interpreted as a string 34247end or escape. 34248 34249The @env{LC_MESSAGES} environment variable specifies the language to 34250use in diagnostic messages. 34251 34252If the @env{LC_ALL} environment variable is set, it overrides the value 34253of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 34254and @env{LC_MESSAGES} default to the value of the @env{LANG} 34255environment variable. If none of these variables are set, GCC 34256defaults to traditional C English behavior. 34257 34258@item TMPDIR 34259@findex TMPDIR 34260If @env{TMPDIR} is set, it specifies the directory to use for temporary 34261files. GCC uses temporary files to hold the output of one stage of 34262compilation which is to be used as input to the next stage: for example, 34263the output of the preprocessor, which is the input to the compiler 34264proper. 34265 34266@item GCC_COMPARE_DEBUG 34267@findex GCC_COMPARE_DEBUG 34268Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 34269@option{-fcompare-debug} to the compiler driver. See the documentation 34270of this option for more details. 34271 34272@item GCC_EXEC_PREFIX 34273@findex GCC_EXEC_PREFIX 34274If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 34275names of the subprograms executed by the compiler. No slash is added 34276when this prefix is combined with the name of a subprogram, but you can 34277specify a prefix that ends with a slash if you wish. 34278 34279If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 34280an appropriate prefix to use based on the pathname it is invoked with. 34281 34282If GCC cannot find the subprogram using the specified prefix, it 34283tries looking in the usual places for the subprogram. 34284 34285The default value of @env{GCC_EXEC_PREFIX} is 34286@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 34287the installed compiler. In many cases @var{prefix} is the value 34288of @code{prefix} when you ran the @file{configure} script. 34289 34290Other prefixes specified with @option{-B} take precedence over this prefix. 34291 34292This prefix is also used for finding files such as @file{crt0.o} that are 34293used for linking. 34294 34295In addition, the prefix is used in an unusual way in finding the 34296directories to search for header files. For each of the standard 34297directories whose name normally begins with @samp{/usr/local/lib/gcc} 34298(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 34299replacing that beginning with the specified prefix to produce an 34300alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 34301@file{foo/bar} just before it searches the standard directory 34302@file{/usr/local/lib/bar}. 34303If a standard directory begins with the configured 34304@var{prefix} then the value of @var{prefix} is replaced by 34305@env{GCC_EXEC_PREFIX} when looking for header files. 34306 34307@item COMPILER_PATH 34308@findex COMPILER_PATH 34309The value of @env{COMPILER_PATH} is a colon-separated list of 34310directories, much like @env{PATH}. GCC tries the directories thus 34311specified when searching for subprograms, if it cannot find the 34312subprograms using @env{GCC_EXEC_PREFIX}. 34313 34314@item LIBRARY_PATH 34315@findex LIBRARY_PATH 34316The value of @env{LIBRARY_PATH} is a colon-separated list of 34317directories, much like @env{PATH}. When configured as a native compiler, 34318GCC tries the directories thus specified when searching for special 34319linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking 34320using GCC also uses these directories when searching for ordinary 34321libraries for the @option{-l} option (but directories specified with 34322@option{-L} come first). 34323 34324@item LANG 34325@findex LANG 34326@cindex locale definition 34327This variable is used to pass locale information to the compiler. One way in 34328which this information is used is to determine the character set to be used 34329when character literals, string literals and comments are parsed in C and C++. 34330When the compiler is configured to allow multibyte characters, 34331the following values for @env{LANG} are recognized: 34332 34333@table @samp 34334@item C-JIS 34335Recognize JIS characters. 34336@item C-SJIS 34337Recognize SJIS characters. 34338@item C-EUCJP 34339Recognize EUCJP characters. 34340@end table 34341 34342If @env{LANG} is not defined, or if it has some other value, then the 34343compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 34344recognize and translate multibyte characters. 34345 34346@item GCC_EXTRA_DIAGNOSTIC_OUTPUT 34347@findex GCC_EXTRA_DIAGNOSTIC_OUTPUT 34348If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values, 34349then additional text will be emitted to stderr when fix-it hints are 34350emitted. @option{-fdiagnostics-parseable-fixits} and 34351@option{-fno-diagnostics-parseable-fixits} take precedence over this 34352environment variable. 34353 34354@table @samp 34355@item fixits-v1 34356Emit parseable fix-it hints, equivalent to 34357@option{-fdiagnostics-parseable-fixits}. In particular, columns are 34358expressed as a count of bytes, starting at byte 1 for the initial column. 34359 34360@item fixits-v2 34361As @code{fixits-v1}, but columns are expressed as display columns, 34362as per @option{-fdiagnostics-column-unit=display}. 34363@end table 34364 34365@end table 34366 34367@noindent 34368Some additional environment variables affect the behavior of the 34369preprocessor. 34370 34371@include cppenv.texi 34372 34373@c man end 34374 34375@node Precompiled Headers 34376@section Using Precompiled Headers 34377@cindex precompiled headers 34378@cindex speed of compilation 34379 34380Often large projects have many header files that are included in every 34381source file. The time the compiler takes to process these header files 34382over and over again can account for nearly all of the time required to 34383build the project. To make builds faster, GCC allows you to 34384@dfn{precompile} a header file. 34385 34386To create a precompiled header file, simply compile it as you would any 34387other file, if necessary using the @option{-x} option to make the driver 34388treat it as a C or C++ header file. You may want to use a 34389tool like @command{make} to keep the precompiled header up-to-date when 34390the headers it contains change. 34391 34392A precompiled header file is searched for when @code{#include} is 34393seen in the compilation. As it searches for the included file 34394(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 34395compiler looks for a precompiled header in each directory just before it 34396looks for the include file in that directory. The name searched for is 34397the name specified in the @code{#include} with @samp{.gch} appended. If 34398the precompiled header file cannot be used, it is ignored. 34399 34400For instance, if you have @code{#include "all.h"}, and you have 34401@file{all.h.gch} in the same directory as @file{all.h}, then the 34402precompiled header file is used if possible, and the original 34403header is used otherwise. 34404 34405Alternatively, you might decide to put the precompiled header file in a 34406directory and use @option{-I} to ensure that directory is searched 34407before (or instead of) the directory containing the original header. 34408Then, if you want to check that the precompiled header file is always 34409used, you can put a file of the same name as the original header in this 34410directory containing an @code{#error} command. 34411 34412This also works with @option{-include}. So yet another way to use 34413precompiled headers, good for projects not designed with precompiled 34414header files in mind, is to simply take most of the header files used by 34415a project, include them from another header file, precompile that header 34416file, and @option{-include} the precompiled header. If the header files 34417have guards against multiple inclusion, they are skipped because 34418they've already been included (in the precompiled header). 34419 34420If you need to precompile the same header file for different 34421languages, targets, or compiler options, you can instead make a 34422@emph{directory} named like @file{all.h.gch}, and put each precompiled 34423header in the directory, perhaps using @option{-o}. It doesn't matter 34424what you call the files in the directory; every precompiled header in 34425the directory is considered. The first precompiled header 34426encountered in the directory that is valid for this compilation is 34427used; they're searched in no particular order. 34428 34429There are many other possibilities, limited only by your imagination, 34430good sense, and the constraints of your build system. 34431 34432A precompiled header file can be used only when these conditions apply: 34433 34434@itemize 34435@item 34436Only one precompiled header can be used in a particular compilation. 34437 34438@item 34439A precompiled header cannot be used once the first C token is seen. You 34440can have preprocessor directives before a precompiled header; you cannot 34441include a precompiled header from inside another header. 34442 34443@item 34444The precompiled header file must be produced for the same language as 34445the current compilation. You cannot use a C precompiled header for a C++ 34446compilation. 34447 34448@item 34449The precompiled header file must have been produced by the same compiler 34450binary as the current compilation is using. 34451 34452@item 34453Any macros defined before the precompiled header is included must 34454either be defined in the same way as when the precompiled header was 34455generated, or must not affect the precompiled header, which usually 34456means that they don't appear in the precompiled header at all. 34457 34458The @option{-D} option is one way to define a macro before a 34459precompiled header is included; using a @code{#define} can also do it. 34460There are also some options that define macros implicitly, like 34461@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 34462defined this way. 34463 34464@item If debugging information is output when using the precompiled 34465header, using @option{-g} or similar, the same kind of debugging information 34466must have been output when building the precompiled header. However, 34467a precompiled header built using @option{-g} can be used in a compilation 34468when no debugging information is being output. 34469 34470@item The same @option{-m} options must generally be used when building 34471and using the precompiled header. @xref{Submodel Options}, 34472for any cases where this rule is relaxed. 34473 34474@item Each of the following options must be the same when building and using 34475the precompiled header: 34476 34477@gccoptlist{-fexceptions} 34478 34479@item 34480Some other command-line options starting with @option{-f}, 34481@option{-p}, or @option{-O} must be defined in the same way as when 34482the precompiled header was generated. At present, it's not clear 34483which options are safe to change and which are not; the safest choice 34484is to use exactly the same options when generating and using the 34485precompiled header. The following are known to be safe: 34486 34487@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 34488-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 34489-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 34490-pedantic-errors} 34491 34492@item Address space layout randomization (ASLR) can lead to not binary identical 34493PCH files. If you rely on stable PCH file contents disable ASLR when generating 34494PCH files. 34495 34496@end itemize 34497 34498For all of these except the last, the compiler automatically 34499ignores the precompiled header if the conditions aren't met. If you 34500find an option combination that doesn't work and doesn't cause the 34501precompiled header to be ignored, please consider filing a bug report, 34502see @ref{Bugs}. 34503 34504If you do use differing options when generating and using the 34505precompiled header, the actual behavior is a mixture of the 34506behavior for the options. For instance, if you use @option{-g} to 34507generate the precompiled header but not when using it, you may or may 34508not get debugging information for routines in the precompiled header. 34509 34510@node C++ Modules 34511@section C++ Modules 34512@cindex speed of compilation 34513 34514Modules are a C++20 language feature. As the name suggests, they 34515provides a modular compilation system, intending to provide both 34516faster builds and better library isolation. The ``Merging Modules'' 34517paper @uref{https://wg21.link/p1103}, provides the easiest to read set 34518of changes to the standard, although it does not capture later 34519changes. 34520 34521@emph{G++'s modules support is not complete.} Other than bugs, the 34522known missing pieces are: 34523 34524@table @emph 34525 34526@item Private Module Fragment 34527The Private Module Fragment is recognized, but an error is emitted. 34528 34529@item Partition definition visibility rules 34530Entities may be defined in implementation partitions, and those 34531definitions are not available outside of the module. This is not 34532implemented, and the definitions are available to extra-module use. 34533 34534@item Textual merging of reachable GM entities 34535Entities may be multiply defined across different header-units. 34536These must be de-duplicated, and this is implemented across imports, 34537or when an import redefines a textually-defined entity. However the 34538reverse is not implemented---textually redefining an entity that has 34539been defined in an imported header-unit. A redefinition error is 34540emitted. 34541 34542@item Translation-Unit local referencing rules 34543Papers p1815 (@uref{https://wg21.link/p1815}) and p2003 34544(@uref{https://wg21.link/p2003}) add limitations on which entities an 34545exported region may reference (for instance, the entities an exported 34546template definition may reference). These are not fully implemented. 34547 34548@item Language-linkage module attachment 34549Declarations with explicit language linkage (@code{extern "C"} or 34550@code{extern "C++"}) are attached to the global module, even when in 34551the purview of a named module. This is not implemented. Such 34552declarations will be attached to the module, if any, in which they are 34553declared. 34554 34555@item Standard Library Header Units 34556The Standard Library is not provided as importable header units. If 34557you want to import such units, you must explicitly build them first. 34558If you do not do this with care, you may have multiple declarations, 34559which the module machinery must merge---compiler resource usage can be 34560affected by how you partition header files into header units. 34561 34562@end table 34563 34564Modular compilation is @emph{not} enabled with just the 34565@option{-std=c++20} option. You must explicitly enable it with the 34566@option{-fmodules-ts} option. It is independent of the language 34567version selected, although in pre-C++20 versions, it is of course an 34568extension. 34569 34570No new source file suffixes are required or supported. If you wish to 34571use a non-standard suffix (@pxref{Overall Options}), you also need 34572to provide a @option{-x c++} option too.@footnote{Some users like to 34573distinguish module interface files with a new suffix, such as naming 34574the source @code{module.cppm}, which involves 34575teaching all tools about the new suffix. A different scheme, such as 34576naming @code{module-m.cpp} would be less invasive.} 34577 34578Compiling a module interface unit produces an additional output (to 34579the assembly or object file), called a Compiled Module Interface 34580(CMI). This encodes the exported declarations of the module. 34581Importing a module reads in the CMI. The import graph is a Directed 34582Acyclic Graph (DAG). You must build imports before the importer. 34583 34584Header files may themselves be compiled to header units, which are a 34585transitional ability aiming at faster compilation. The 34586@option{-fmodule-header} option is used to enable this, and implies 34587the @option{-fmodules-ts} option. These CMIs are named by the fully 34588resolved underlying header file, and thus may be a complete pathname 34589containing subdirectories. If the header file is found at an absolute 34590pathname, the CMI location is still relative to a CMI root directory. 34591 34592As header files often have no suffix, you commonly have to specify a 34593@option{-x} option to tell the compiler the source is a header file. 34594You may use @option{-x c++-header}, @option{-x c++-user-header} or 34595@option{-x c++-system-header}. When used in conjunction with 34596@option{-fmodules-ts}, these all imply an appropriate 34597@option{-fmodule-header} option. The latter two variants use the 34598user or system include path to search for the file specified. This 34599allows you to, for instance, compile standard library header files as 34600header units, without needing to know exactly where they are 34601installed. Specifying the language as one of these variants also 34602inhibits output of the object file, as header files have no associated 34603object file. 34604 34605The @option{-fmodule-only} option disables generation of the 34606associated object file for compiling a module interface. Only the CMI 34607is generated. This option is implied when using the 34608@option{-fmodule-header} option. 34609 34610The @option{-flang-info-include-translate} and 34611@option{-flang-info-include-translate-not} options notes whether 34612include translation occurs or not. With no argument, the first will 34613note all include translation. The second will note all 34614non-translations of include files not known to intentionally be 34615textual. With an argument, queries about include translation of a 34616header files with that particular trailing pathname are noted. You 34617may repeat this form to cover several different header files. This 34618option may be helpful in determining whether include translation is 34619happening---if it is working correctly, it behaves as if it isn't 34620there at all. 34621 34622The @option{-flang-info-module-cmi} option can be used to determine 34623where the compiler is reading a CMI from. Without the option, the 34624compiler is silent when such a read is successful. This option has an 34625optional argument, which will restrict the notification to just the 34626set of named modules or header units specified. 34627 34628The @option{-Winvalid-imported-macros} option causes all imported macros 34629to be resolved at the end of compilation. Without this, imported 34630macros are only resolved when expanded or (re)defined. This option 34631detects conflicting import definitions for all macros. 34632 34633For details of the @option{-fmodule-mapper} family of options, 34634@pxref{C++ Module Mapper}. 34635 34636@menu 34637* C++ Module Mapper:: Module Mapper 34638* C++ Module Preprocessing:: Module Preprocessing 34639* C++ Compiled Module Interface:: Compiled Module Interface 34640@end menu 34641 34642@node C++ Module Mapper 34643@subsection Module Mapper 34644@cindex C++ Module Mapper 34645 34646A module mapper provides a server or file that the compiler queries to 34647determine the mapping between module names and CMI files. It is also 34648used to build CMIs on demand. @emph{Mapper functionality is in its 34649infancy and is intended for experimentation with build system 34650interactions.} 34651 34652You can specify a mapper with the @option{-fmodule-mapper=@var{val}} 34653option or @env{CXX_MODULE_MAPPER} environment variable. The value may 34654have one of the following forms: 34655 34656@table @gcctabopt 34657 34658@item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]} 34659An optional hostname and a numeric port number to connect to. If the 34660hostname is omitted, the loopback address is used. If the hostname 34661corresponds to multiple IPV6 addresses, these are tried in turn, until 34662one is successful. If your host lacks IPv6, this form is 34663non-functional. If you must use IPv4 use 34664@option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}. 34665 34666@item =@var{socket}@r{[}?@var{ident}@r{]} 34667A local domain socket. If your host lacks local domain sockets, this 34668form is non-functional. 34669 34670@item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]} 34671A program to spawn, and communicate with on its stdin/stdout streams. 34672Your @var{PATH} environment variable is searched for the program. 34673Arguments are separated by space characters, (it is not possible for 34674one of the arguments delivered to the program to contain a space). An 34675exception is if @var{program} begins with @@. In that case 34676@var{program} (sans @@) is looked for in the compiler's internal 34677binary directory. Thus the sample mapper-server can be specified 34678with @code{@@g++-mapper-server}. 34679 34680@item <>@r{[}?@var{ident}@r{]} 34681@item <>@var{inout}@r{[}?@var{ident}@r{]} 34682@item <@var{in}>@var{out}@r{[}?@var{ident}@r{]} 34683Named pipes or file descriptors to communicate over. The first form, 34684@option{<>}, communicates over stdin and stdout. The other forms 34685allow you to specify a file descriptor or name a pipe. A numeric value 34686is interpreted as a file descriptor, otherwise named pipe is opened. 34687The second form specifies a bidirectional pipe and the last form 34688allows specifying two independent pipes. Using file descriptors 34689directly in this manner is fragile in general, as it can require the 34690cooperation of intermediate processes. In particular using stdin & 34691stdout is fraught with danger as other compiler options might also 34692cause the compiler to read stdin or write stdout, and it can have 34693unfortunate interactions with signal delivery from the terminal. 34694 34695@item @var{file}@r{[}?@var{ident}@r{]} 34696A mapping file consisting of space-separated module-name, filename 34697pairs, one per line. Only the mappings for the direct imports and any 34698module export name need be provided. If other mappings are provided, 34699they override those stored in any imported CMI files. A repository 34700root may be specified in the mapping file by using @samp{$root} as the 34701module name in the first active line. Use of this option will disable 34702any default module->CMI name mapping. 34703 34704@end table 34705 34706As shown, an optional @var{ident} may suffix the first word of the 34707option, indicated by a @samp{?} prefix. The value is used in the 34708initial handshake with the module server, or to specify a prefix on 34709mapping file lines. In the server case, the main source file name is 34710used if no @var{ident} is specified. In the file case, all non-blank 34711lines are significant, unless a value is specified, in which case only 34712lines beginning with @var{ident} are significant. The @var{ident} 34713must be separated by whitespace from the module name. Be aware that 34714@samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often 34715significant to the shell, and therefore may need quoting. 34716 34717The mapper is connected to or loaded lazily, when the first module 34718mapping is required. The networking protocols are only supported on 34719hosts that provide networking. If no mapper is specified a default is 34720provided. 34721 34722A project-specific mapper is expected to be provided by the build 34723system that invokes the compiler. It is not expected that a 34724general-purpose server is provided for all compilations. As such, the 34725server will know the build configuration, the compiler it invoked, and 34726the environment (such as working directory) in which that is 34727operating. As it may parallelize builds, several compilations may 34728connect to the same socket. 34729 34730The default mapper generates CMI files in a @samp{gcm.cache} 34731directory. CMI files have a @samp{.gcm} suffix. The module unit name 34732is used directly to provide the basename. Header units construct a 34733relative path using the underlying header file name. If the path is 34734already relative, a @samp{,} directory is prepended. Internal 34735@samp{..} components are translated to @samp{,,}. No attempt is made 34736to canonicalize these filenames beyond that done by the preprocessor's 34737include search algorithm, as in general it is ambiguous when symbolic 34738links are present. 34739 34740The mapper protocol was published as ``A Module Mapper'' 34741@uref{https://wg21.link/p1184}. The implementation is provided by 34742@command{libcody}, @uref{https://github.com/urnathan/libcody}, 34743which specifies the canonical protocol definition. A proof of concept 34744server implementation embedded in @command{make} was described in 34745''Make Me A Module'', @uref{https://wg21.link/p1602}. 34746 34747@node C++ Module Preprocessing 34748@subsection Module Preprocessing 34749@cindex C++ Module Preprocessing 34750 34751Modules affect preprocessing because of header units and include 34752translation. Some uses of the preprocessor as a separate step either 34753do not produce a correct output, or require CMIs to be available. 34754 34755Header units import macros. These macros can affect later conditional 34756inclusion, which therefore can cascade to differing import sets. When 34757preprocessing, it is necessary to load the CMI. If a header unit is 34758unavailable, the preprocessor issues a warning and continue (when 34759not just preprocessing, an error is emitted). Detecting such imports 34760requires preprocessor tokenization of the input stream to phase 4 34761(macro expansion). 34762 34763Include translation converts @code{#include}, @code{#include_next} and 34764@code{#import} directives to internal @code{import} declarations. 34765Whether a particular directive is translated is controlled by the 34766module mapper. Header unit names are canonicalized during 34767preprocessing. 34768 34769Dependency information can be emitted for macro import, extending the 34770functionality of @option{-MD} and @option{-MMD} options. Detection of 34771import declarations also requires phase 4 preprocessing, and thus 34772requires full preprocessing (or compilation). 34773 34774The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt 34775preprocessing before phase 4. 34776 34777The @option{-save-temps} option uses @option{-fdirectives-only} for 34778preprocessing, and preserve the macro definitions in the preprocessed 34779output. Usually you also want to use this option when explicitly 34780preprocessing a header-unit, or consuming such preprocessed output: 34781 34782@smallexample 34783g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii 34784g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii 34785@end smallexample 34786 34787@node C++ Compiled Module Interface 34788@subsection Compiled Module Interface 34789@cindex C++ Compiled Module Interface 34790 34791CMIs are an additional artifact when compiling named module 34792interfaces, partitions or header units. These are read when 34793importing. CMI contents are implementation-specific, and in GCC's 34794case tied to the compiler version. Consider them a rebuildable cache 34795artifact, not a distributable object. 34796 34797When creating an output CMI, any missing directory components are 34798created in a manner that is safe for concurrent builds creating 34799multiple, different, CMIs within a common subdirectory tree. 34800 34801CMI contents are written to a temporary file, which is then atomically 34802renamed. Observers either see old contents (if there is an 34803existing file), or complete new contents. They do not observe the 34804CMI during its creation. This is unlike object file writing, which 34805may be observed by an external process. 34806 34807CMIs are read in lazily, if the host OS provides @code{mmap} 34808functionality. Generally blocks are read when name lookup or template 34809instantiation occurs. To inhibit this, the @option{-fno-module-lazy} 34810option may be used. 34811 34812The @option{--param lazy-modules=@var{n}} parameter controls the limit 34813on the number of concurrently open module files during lazy loading. 34814Should more modules be imported, an LRU algorithm is used to determine 34815which files to close---until that file is needed again. This limit 34816may be exceeded with deep module dependency hierarchies. With large 34817code bases there may be more imports than the process limit of file 34818descriptors. By default, the limit is a few less than the per-process 34819file descriptor hard limit, if that is determinable.@footnote{Where 34820applicable the soft limit is incremented as needed towards the hard limit.} 34821 34822GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism. 34823You may use @command{readelf} to inspect them, although section 34824contents are largely undecipherable. There is a section named 34825@code{.gnu.c++.README}, which contains human-readable text. Other 34826than the first line, each line consists of @code{@var{tag}: @code{value}} 34827tuples. 34828 34829@smallexample 34830> @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm} 34831 34832String dump of section '.gnu.c++.README': 34833 [ 0] GNU C++ primary module interface 34834 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454] 34835 [ 6f] version: 2020/11/16-04:54 34836 [ 89] module: foo 34837 [ 95] source: c_b.ii 34838 [ a4] dialect: C++20/coroutines 34839 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc 34840 [ ee] repository: gcm.cache 34841 [ 104] buildtime: 2020/11/16 15:03:21 UTC 34842 [ 127] localtime: 2020/11/16 07:03:21 PST 34843 [ 14a] export: foo:part1 foo-part1.gcm 34844@end smallexample 34845 34846Amongst other things, this lists the source that was built, C++ 34847dialect used and imports of the module.@footnote{The precise contents 34848of this output may change.} The timestamp is the same value as that 34849provided by the @code{__DATE__} & @code{__TIME__} macros, and may be 34850explicitly specified with the environment variable 34851@code{SOURCE_DATE_EPOCH}. For further details 34852@pxref{Environment Variables}. 34853 34854A set of related CMIs may be copied, provided the relative pathnames 34855are preserved. 34856 34857The @code{.gnu.c++.README} contents do not affect CMI integrity, and 34858it may be removed or altered. The section numbering of the sections 34859whose names do not begin with @code{.gnu.c++.}, or are not the string 34860section is significant and must not be altered. 34861