1@c Copyright (C) 1988-2018 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-2018 Free Software Foundation, Inc. 12 13Permission is granted to copy, distribute and/or modify this document 14under the terms of the GNU Free Documentation License, Version 1.3 or 15any later version published by the Free Software Foundation; with the 16Invariant Sections being ``GNU General Public License'' and ``Funding 17Free Software'', the Front-Cover texts being (a) (see below), and with 18the Back-Cover Texts being (b) (see below). A copy of the license is 19included in the gfdl(7) man page. 20 21(a) The FSF's Front-Cover Text is: 22 23 A GNU Manual 24 25(b) The FSF's Back-Cover Text is: 26 27 You have freedom to copy and modify this GNU Manual, like GNU 28 software. Copies published by the Free Software Foundation raise 29 funds for GNU development. 30@c man end 31@c Set file name and title for the man page. 32@setfilename gcc 33@settitle GNU project C and C++ compiler 34@c man begin SYNOPSIS 35gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}] 38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} 42 43Only the most useful options are listed here; see below for the 44remainder. @command{g++} accepts mostly the same options as @command{gcc}. 45@c man end 46@c man begin SEEALSO 47gpl(7), gfdl(7), fsf-funding(7), 48cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1) 49and the Info entries for @file{gcc}, @file{cpp}, @file{as}, 50@file{ld}, @file{binutils} and @file{gdb}. 51@c man end 52@c man begin BUGS 53For instructions on reporting bugs, see 54@w{@value{BUGURL}}. 55@c man end 56@c man begin AUTHOR 57See the Info entry for @command{gcc}, or 58@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 59for contributors to GCC@. 60@c man end 61@end ignore 62 63@node Invoking GCC 64@chapter GCC Command Options 65@cindex GCC command options 66@cindex command options 67@cindex options, GCC command 68 69@c man begin DESCRIPTION 70When you invoke GCC, it normally does preprocessing, compilation, 71assembly and linking. The ``overall options'' allow you to stop this 72process at an intermediate stage. For example, the @option{-c} option 73says not to run the linker. Then the output consists of object files 74output by the assembler. 75@xref{Overall Options,,Options Controlling the Kind of Output}. 76 77Other options are passed on to one or more stages of processing. Some options 78control the preprocessor and others the compiler itself. Yet other 79options control the assembler and linker; most of these are not 80documented here, since you rarely need to use any of them. 81 82@cindex C compilation options 83Most of the command-line options that you can use with GCC are useful 84for C programs; when an option is only useful with another language 85(usually C++), the explanation says so explicitly. If the description 86for a particular option does not mention a source language, you can use 87that option with all supported languages. 88 89@cindex cross compiling 90@cindex specifying machine version 91@cindex specifying compiler version and target machine 92@cindex compiler version, specifying 93@cindex target machine, specifying 94The usual way to run GCC is to run the executable called @command{gcc}, or 95@command{@var{machine}-gcc} when cross-compiling, or 96@command{@var{machine}-gcc-@var{version}} to run a specific version of GCC. 97When you compile C++ programs, you should invoke GCC as @command{g++} 98instead. @xref{Invoking G++,,Compiling C++ Programs}, 99for information about the differences in behavior between @command{gcc} 100and @code{g++} when compiling C++ programs. 101 102@cindex grouping options 103@cindex options, grouping 104The @command{gcc} program accepts options and file names as operands. Many 105options have multi-letter names; therefore multiple single-letter options 106may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d 107-v}}. 108 109@cindex order of options 110@cindex options, order 111You can mix options and other arguments. For the most part, the order 112you use doesn't matter. Order does matter when you use several 113options of the same kind; for example, if you specify @option{-L} more 114than once, the directories are searched in the order specified. Also, 115the placement of the @option{-l} option is significant. 116 117Many options have long names starting with @samp{-f} or with 118@samp{-W}---for example, 119@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of 120these have both positive and negative forms; the negative form of 121@option{-ffoo} is @option{-fno-foo}. This manual documents 122only one of these two forms, whichever one is not the default. 123 124@c man end 125 126@xref{Option Index}, for an index to GCC's options. 127 128@menu 129* Option Summary:: Brief list of all options, without explanations. 130* Overall Options:: Controlling the kind of output: 131 an executable, object files, assembler files, 132 or preprocessed source. 133* Invoking G++:: Compiling C++ programs. 134* C Dialect Options:: Controlling the variant of C language compiled. 135* C++ Dialect Options:: Variations on C++. 136* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C 137 and Objective-C++. 138* Diagnostic Message Formatting Options:: Controlling how diagnostics should 139 be formatted. 140* Warning Options:: How picky should the compiler be? 141* Debugging Options:: Producing debuggable code. 142* Optimize Options:: How much optimization? 143* Instrumentation Options:: Enabling profiling and extra run-time error checking. 144* Preprocessor Options:: Controlling header files and macro definitions. 145 Also, getting dependency information for Make. 146* Assembler Options:: Passing options to the assembler. 147* Link Options:: Specifying libraries and so on. 148* Directory Options:: Where to find header files and libraries. 149 Where to find the compiler executable files. 150* Code Gen Options:: Specifying conventions for function calls, data layout 151 and register usage. 152* Developer Options:: Printing GCC configuration info, statistics, and 153 debugging dumps. 154* Submodel Options:: Target-specific options, such as compiling for a 155 specific processor variant. 156* Spec Files:: How to pass switches to sub-processes. 157* Environment Variables:: Env vars that affect GCC. 158* Precompiled Headers:: Compiling a header once, and using it many times. 159@end menu 160 161@c man begin OPTIONS 162 163@node Option Summary 164@section Option Summary 165 166Here is a summary of all the options, grouped by type. Explanations are 167in the following sections. 168 169@table @emph 170@item Overall Options 171@xref{Overall Options,,Options Controlling the Kind of Output}. 172@gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol 173-v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol 174-pass-exit-codes -pipe -specs=@var{file} -wrapper @gol 175@@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol 176-fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol 177-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}} 178 179@item C Language Options 180@xref{C Dialect Options,,Options Controlling C Dialect}. 181@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 182-fpermitted-flt-eval-methods=@var{standard} @gol 183-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol 184-fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol 185-fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol 186-fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol 187-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 188-fsigned-bitfields -fsigned-char @gol 189-funsigned-bitfields -funsigned-char} 190 191@item C++ Language Options 192@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 193@gccoptlist{-fabi-version=@var{n} -fno-access-control @gol 194-faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol 195-fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol 196-ffriend-injection @gol 197-fno-elide-constructors @gol 198-fno-enforce-eh-specs @gol 199-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 200-fno-implicit-templates @gol 201-fno-implicit-inline-templates @gol 202-fno-implement-inlines -fms-extensions @gol 203-fnew-inheriting-ctors @gol 204-fnew-ttp-matching @gol 205-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol 206-fno-optional-diags -fpermissive @gol 207-fno-pretty-templates @gol 208-frepo -fno-rtti -fsized-deallocation @gol 209-ftemplate-backtrace-limit=@var{n} @gol 210-ftemplate-depth=@var{n} @gol 211-fno-threadsafe-statics -fuse-cxa-atexit @gol 212-fno-weak -nostdinc++ @gol 213-fvisibility-inlines-hidden @gol 214-fvisibility-ms-compat @gol 215-fext-numeric-literals @gol 216-Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol 217-Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol 218-Wnamespaces -Wnarrowing @gol 219-Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol 220-Wnon-virtual-dtor -Wreorder -Wregister @gol 221-Weffc++ -Wstrict-null-sentinel -Wtemplates @gol 222-Wno-non-template-friend -Wold-style-cast @gol 223-Woverloaded-virtual -Wno-pmf-conversions @gol 224-Wsign-promo -Wvirtual-inheritance} 225 226@item Objective-C and Objective-C++ Language Options 227@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling 228Objective-C and Objective-C++ Dialects}. 229@gccoptlist{-fconstant-string-class=@var{class-name} @gol 230-fgnu-runtime -fnext-runtime @gol 231-fno-nil-receivers @gol 232-fobjc-abi-version=@var{n} @gol 233-fobjc-call-cxx-cdtors @gol 234-fobjc-direct-dispatch @gol 235-fobjc-exceptions @gol 236-fobjc-gc @gol 237-fobjc-nilcheck @gol 238-fobjc-std=objc1 @gol 239-fno-local-ivars @gol 240-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol 241-freplace-objc-classes @gol 242-fzero-link @gol 243-gen-decls @gol 244-Wassign-intercept @gol 245-Wno-protocol -Wselector @gol 246-Wstrict-selector-match @gol 247-Wundeclared-selector} 248 249@item Diagnostic Message Formatting Options 250@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}. 251@gccoptlist{-fmessage-length=@var{n} @gol 252-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 253-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol 254-fno-diagnostics-show-option -fno-diagnostics-show-caret @gol 255-fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol 256-fdiagnostics-show-template-tree -fno-elide-type @gol 257-fno-show-column} 258 259@item Warning Options 260@xref{Warning Options,,Options to Request or Suppress Warnings}. 261@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol 262-pedantic-errors @gol 263-w -Wextra -Wall -Waddress -Waggregate-return -Waligned-new @gol 264-Walloc-zero -Walloc-size-larger-than=@var{n} 265-Walloca -Walloca-larger-than=@var{n} @gol 266-Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol 267-Wno-attributes -Wbool-compare -Wbool-operation @gol 268-Wno-builtin-declaration-mismatch @gol 269-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol 270-Wc++-compat -Wc++11-compat -Wc++14-compat @gol 271-Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol 272-Wchar-subscripts -Wchkp -Wcatch-value -Wcatch-value=@var{n} @gol 273-Wclobbered -Wcomment -Wconditionally-supported @gol 274-Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol 275-Wdelete-incomplete @gol 276-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol 277-Wdisabled-optimization @gol 278-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol 279-Wno-div-by-zero -Wdouble-promotion @gol 280-Wduplicated-branches -Wduplicated-cond @gol 281-Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol 282-Werror -Werror=* -Wextra-semi -Wfatal-errors @gol 283-Wfloat-equal -Wformat -Wformat=2 @gol 284-Wno-format-contains-nul -Wno-format-extra-args @gol 285-Wformat-nonliteral -Wformat-overflow=@var{n} @gol 286-Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol 287-Wformat-y2k -Wframe-address @gol 288-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol 289-Wif-not-aligned @gol 290-Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol 291-Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol 292-Wimplicit-function-declaration -Wimplicit-int @gol 293-Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol 294-Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol 295-Winvalid-pch -Wlarger-than=@var{len} @gol 296-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol 297-Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol 298-Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol 299-Wmissing-field-initializers -Wmissing-include-dirs @gol 300-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol 301-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol 302-Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol 303-Woverride-init-side-effects -Woverlength-strings @gol 304-Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol 305-Wparentheses -Wno-pedantic-ms-format @gol 306-Wplacement-new -Wplacement-new=@var{n} @gol 307-Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol 308-Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol 309-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol 310-Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol 311-Wshift-overflow -Wshift-overflow=@var{n} @gol 312-Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol 313-Wsign-compare -Wsign-conversion -Wfloat-conversion @gol 314-Wno-scalar-storage-order -Wsizeof-pointer-div @gol 315-Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol 316-Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol 317-Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol 318-Wstringop-overflow=@var{n} -Wstringop-truncation @gol 319-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol 320-Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol 321-Wmissing-format-attribute -Wsubobject-linkage @gol 322-Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol 323-Wswitch-unreachable -Wsync-nand @gol 324-Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol 325-Wtype-limits -Wundef @gol 326-Wuninitialized -Wunknown-pragmas @gol 327-Wunsuffixed-float-constants -Wunused -Wunused-function @gol 328-Wunused-label -Wunused-local-typedefs -Wunused-macros @gol 329-Wunused-parameter -Wno-unused-result @gol 330-Wunused-value -Wunused-variable @gol 331-Wunused-const-variable -Wunused-const-variable=@var{n} @gol 332-Wunused-but-set-parameter -Wunused-but-set-variable @gol 333-Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol 334-Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol 335-Wzero-as-null-pointer-constant -Whsa} 336 337@item C and Objective-C-only Warning Options 338@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 339-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol 340-Wold-style-declaration -Wold-style-definition @gol 341-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol 342-Wdeclaration-after-statement -Wpointer-sign} 343 344@item Debugging Options 345@xref{Debugging Options,,Options for Debugging Your Program}. 346@gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol 347-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol 348-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol 349-gas-loc-support -gno-as-loc-support @gol 350-gas-locview-support -gno-as-locview-support @gol 351-gcolumn-info -gno-column-info @gol 352-gstatement-frontiers -gno-statement-frontiers @gol 353-gvariable-location-views -gno-variable-location-views @gol 354-ginternal-reset-location-views -gno-internal-reset-location-views @gol 355-ginline-points -gno-inline-points @gol 356-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol 357-fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol 358-fno-eliminate-unused-debug-types @gol 359-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 360-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 361-feliminate-unused-debug-symbols -femit-class-debug-always @gol 362-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol 363-fvar-tracking -fvar-tracking-assignments} 364 365@item Optimization Options 366@xref{Optimize Options,,Options that Control Optimization}. 367@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol 368-falign-jumps[=@var{n}] @gol 369-falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol 370-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol 371-fauto-inc-dec -fbranch-probabilities @gol 372-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol 373-fbtr-bb-exclusive -fcaller-saves @gol 374-fcombine-stack-adjustments -fconserve-stack @gol 375-fcompare-elim -fcprop-registers -fcrossjumping @gol 376-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol 377-fcx-limited-range @gol 378-fdata-sections -fdce -fdelayed-branch @gol 379-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol 380-fdevirtualize-at-ltrans -fdse @gol 381-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol 382-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol 383-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol 384-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol 385-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol 386-fif-conversion2 -findirect-inlining @gol 387-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol 388-finline-small-functions -fipa-cp -fipa-cp-clone @gol 389-fipa-bit-cp -fipa-vrp @gol 390-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol 391-fira-algorithm=@var{algorithm} @gol 392-fira-region=@var{region} -fira-hoist-pressure @gol 393-fira-loop-pressure -fno-ira-share-save-slots @gol 394-fno-ira-share-spill-slots @gol 395-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol 396-fivopts -fkeep-inline-functions -fkeep-static-functions @gol 397-fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol 398-floop-block -floop-interchange -floop-strip-mine @gol 399-floop-unroll-and-jam -floop-nest-optimize @gol 400-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol 401-flto-partition=@var{alg} -fmerge-all-constants @gol 402-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol 403-fmove-loop-invariants -fno-branch-count-reg @gol 404-fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol 405-fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol 406-fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol 407-fno-sched-spec -fno-signed-zeros @gol 408-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 409-fomit-frame-pointer -foptimize-sibling-calls @gol 410-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol 411-fprefetch-loop-arrays @gol 412-fprofile-correction @gol 413-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol 414-fprofile-reorder-functions @gol 415-freciprocal-math -free -frename-registers -freorder-blocks @gol 416-freorder-blocks-algorithm=@var{algorithm} @gol 417-freorder-blocks-and-partition -freorder-functions @gol 418-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol 419-frounding-math -fsched2-use-superblocks -fsched-pressure @gol 420-fsched-spec-load -fsched-spec-load-dangerous @gol 421-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol 422-fsched-group-heuristic -fsched-critical-path-heuristic @gol 423-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol 424-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol 425-fschedule-fusion @gol 426-fschedule-insns -fschedule-insns2 -fsection-anchors @gol 427-fselective-scheduling -fselective-scheduling2 @gol 428-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol 429-fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol 430-fsignaling-nans @gol 431-fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol 432-fsplit-paths @gol 433-fsplit-wide-types -fssa-backprop -fssa-phiopt @gol 434-fstdarg-opt -fstore-merging -fstrict-aliasing @gol 435-fthread-jumps -ftracer -ftree-bit-ccp @gol 436-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol 437-ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol 438-ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol 439-ftree-loop-if-convert -ftree-loop-im @gol 440-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol 441-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol 442-ftree-loop-vectorize @gol 443-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol 444-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol 445-ftree-switch-conversion -ftree-tail-merge @gol 446-ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol 447-funit-at-a-time -funroll-all-loops -funroll-loops @gol 448-funsafe-math-optimizations -funswitch-loops @gol 449-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol 450-fweb -fwhole-program -fwpa -fuse-linker-plugin @gol 451--param @var{name}=@var{value} 452-O -O0 -O1 -O2 -O3 -Os -Ofast -Og} 453 454@item Program Instrumentation Options 455@xref{Instrumentation Options,,Program Instrumentation Options}. 456@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol 457-fprofile-abs-path @gol 458-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol 459-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol 460-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol 461-fsanitize-undefined-trap-on-error -fbounds-check @gol 462-fcheck-pointer-bounds -fchkp-check-incomplete-type @gol 463-fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol 464-fchkp-narrow-to-innermost-array -fchkp-optimize @gol 465-fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol 466-fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol 467-fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol 468-fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol 469-fchkp-instrument-calls -fchkp-instrument-marked-only @gol 470-fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol 471-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol 472-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 473-fstack-protector-explicit -fstack-check @gol 474-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 475-fno-stack-limit -fsplit-stack @gol 476-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol 477-fvtv-counts -fvtv-debug @gol 478-finstrument-functions @gol 479-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 480-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} 481 482@item Preprocessor Options 483@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 484@gccoptlist{-A@var{question}=@var{answer} @gol 485-A-@var{question}@r{[}=@var{answer}@r{]} @gol 486-C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol 487-dD -dI -dM -dN -dU @gol 488-fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol 489-fexec-charset=@var{charset} -fextended-identifiers @gol 490-finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol 491-fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol 492-fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol 493-fwide-exec-charset=@var{charset} -fworking-directory @gol 494-H -imacros @var{file} -include @var{file} @gol 495-M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol 496-no-integrated-cpp -P -pthread -remap @gol 497-traditional -traditional-cpp -trigraphs @gol 498-U@var{macro} -undef @gol 499-Wp,@var{option} -Xpreprocessor @var{option}} 500 501@item Assembler Options 502@xref{Assembler Options,,Passing Options to the Assembler}. 503@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 504 505@item Linker Options 506@xref{Link Options,,Options for Linking}. 507@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 508-nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol 509-s -static -static-pie -static-libgcc -static-libstdc++ @gol 510-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 511-static-libmpx -static-libmpxwrappers @gol 512-shared -shared-libgcc -symbolic @gol 513-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 514-u @var{symbol} -z @var{keyword}} 515 516@item Directory Options 517@xref{Directory Options,,Options for Directory Search}. 518@gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol 519-idirafter @var{dir} @gol 520-imacros @var{file} -imultilib @var{dir} @gol 521-iplugindir=@var{dir} -iprefix @var{file} @gol 522-iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol 523-iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol 524-L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol 525-nostdinc -nostdinc++ --sysroot=@var{dir}} 526 527@item Code Generation Options 528@xref{Code Gen Options,,Options for Code Generation Conventions}. 529@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 530-ffixed-@var{reg} -fexceptions @gol 531-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 532-fasynchronous-unwind-tables @gol 533-fno-gnu-unique @gol 534-finhibit-size-directive -fno-common -fno-ident @gol 535-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol 536-fno-jump-tables @gol 537-frecord-gcc-switches @gol 538-freg-struct-return -fshort-enums -fshort-wchar @gol 539-fverbose-asm -fpack-struct[=@var{n}] @gol 540-fleading-underscore -ftls-model=@var{model} @gol 541-fstack-reuse=@var{reuse_level} @gol 542-ftrampolines -ftrapv -fwrapv @gol 543-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 544-fstrict-volatile-bitfields -fsync-libcalls} 545 546@item Developer Options 547@xref{Developer Options,,GCC Developer Options}. 548@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 549-dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol 550-fdbg-cnt=@var{counter-value-list} @gol 551-fdisable-ipa-@var{pass_name} @gol 552-fdisable-rtl-@var{pass_name} @gol 553-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 554-fdisable-tree-@var{pass_name} @gol 555-fdisable-tree-@var{pass-name}=@var{range-list} @gol 556-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 557-fdump-final-insns@r{[}=@var{file}@r{]} @gol 558-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 559-fdump-lang-all @gol 560-fdump-lang-@var{switch} @gol 561-fdump-lang-@var{switch}-@var{options} @gol 562-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol 563-fdump-passes @gol 564-fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol 565-fdump-statistics @gol 566-fdump-tree-all @gol 567-fdump-tree-@var{switch} @gol 568-fdump-tree-@var{switch}-@var{options} @gol 569-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol 570-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 571-fenable-@var{kind}-@var{pass} @gol 572-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 573-fira-verbose=@var{n} @gol 574-flto-report -flto-report-wpa -fmem-report-wpa @gol 575-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol 576-fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 577-fprofile-report @gol 578-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 579-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 580-fstats -fstack-usage -ftime-report -ftime-report-details @gol 581-fvar-tracking-assignments-toggle -gtoggle @gol 582-print-file-name=@var{library} -print-libgcc-file-name @gol 583-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 584-print-prog-name=@var{program} -print-search-dirs -Q @gol 585-print-sysroot -print-sysroot-headers-suffix @gol 586-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 587 588@item Machine-Dependent Options 589@xref{Submodel Options,,Machine-Dependent Options}. 590@c This list is ordered alphanumerically by subsection name. 591@c Try and put the significant identifier (CPU or system) first, 592@c so users have a clue at guessing where the ones they want will be. 593 594@emph{AArch64 Options} 595@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 596-mgeneral-regs-only @gol 597-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 598-mstrict-align @gol 599-momit-leaf-frame-pointer @gol 600-mtls-dialect=desc -mtls-dialect=traditional @gol 601-mtls-size=@var{size} @gol 602-mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol 603-mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol 604-mpc-relative-literal-loads @gol 605-msign-return-address=@var{scope} @gol 606-march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol 607-moverride=@var{string} -mverbose-cost-dump} 608 609@emph{Adapteva Epiphany Options} 610@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 611-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 612-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 613-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 614-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 615-msplit-vecmove-early -m1reg-@var{reg}} 616 617@emph{ARC Options} 618@gccoptlist{-mbarrel-shifter -mjli-always @gol 619-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol 620-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol 621-mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol 622-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol 623-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol 624-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol 625-mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol 626-mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol 627-mvolatile-cache -mtp-regno=@var{regno} @gol 628-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol 629-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol 630-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol 631-mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol 632-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol 633-mtune=@var{cpu} -mmultcost=@var{num} @gol 634-munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol 635-mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16} 636 637@emph{ARM Options} 638@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 639-mabi=@var{name} @gol 640-mapcs-stack-check -mno-apcs-stack-check @gol 641-mapcs-reentrant -mno-apcs-reentrant @gol 642-msched-prolog -mno-sched-prolog @gol 643-mlittle-endian -mbig-endian @gol 644-mbe8 -mbe32 @gol 645-mfloat-abi=@var{name} @gol 646-mfp16-format=@var{name} 647-mthumb-interwork -mno-thumb-interwork @gol 648-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 649-mtune=@var{name} -mprint-tune-info @gol 650-mstructure-size-boundary=@var{n} @gol 651-mabort-on-noreturn @gol 652-mlong-calls -mno-long-calls @gol 653-msingle-pic-base -mno-single-pic-base @gol 654-mpic-register=@var{reg} @gol 655-mnop-fun-dllimport @gol 656-mpoke-function-name @gol 657-mthumb -marm -mflip-thumb @gol 658-mtpcs-frame -mtpcs-leaf-frame @gol 659-mcaller-super-interworking -mcallee-super-interworking @gol 660-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 661-mword-relocations @gol 662-mfix-cortex-m3-ldrd @gol 663-munaligned-access @gol 664-mneon-for-64bits @gol 665-mslow-flash-data @gol 666-masm-syntax-unified @gol 667-mrestrict-it @gol 668-mverbose-cost-dump @gol 669-mpure-code @gol 670-mcmse} 671 672@emph{AVR Options} 673@gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol 674-mbranch-cost=@var{cost} @gol 675-mcall-prologues -mgas-isr-prologues -mint8 @gol 676-mn_flash=@var{size} -mno-interrupts @gol 677-mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol 678-mfract-convert-truncate @gol 679-mshort-calls -nodevicelib -nodevicespecs @gol 680-Waddr-space-convert -Wmisspelled-isr} 681 682@emph{Blackfin Options} 683@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 684-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 685-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 686-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 687-mno-id-shared-library -mshared-library-id=@var{n} @gol 688-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 689-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 690-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 691-micplb} 692 693@emph{C6X Options} 694@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 695-msim -msdata=@var{sdata-type}} 696 697@emph{CRIS Options} 698@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 699-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 700-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 701-mstack-align -mdata-align -mconst-align @gol 702-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 703-melf -maout -melinux -mlinux -sim -sim2 @gol 704-mmul-bug-workaround -mno-mul-bug-workaround} 705 706@emph{CR16 Options} 707@gccoptlist{-mmac @gol 708-mcr16cplus -mcr16c @gol 709-msim -mint32 -mbit-ops 710-mdata-model=@var{model}} 711 712@emph{Darwin Options} 713@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 714-arch_only -bind_at_load -bundle -bundle_loader @gol 715-client_name -compatibility_version -current_version @gol 716-dead_strip @gol 717-dependency-file -dylib_file -dylinker_install_name @gol 718-dynamic -dynamiclib -exported_symbols_list @gol 719-filelist -flat_namespace -force_cpusubtype_ALL @gol 720-force_flat_namespace -headerpad_max_install_names @gol 721-iframework @gol 722-image_base -init -install_name -keep_private_externs @gol 723-multi_module -multiply_defined -multiply_defined_unused @gol 724-noall_load -no_dead_strip_inits_and_terms @gol 725-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 726-pagezero_size -prebind -prebind_all_twolevel_modules @gol 727-private_bundle -read_only_relocs -sectalign @gol 728-sectobjectsymbols -whyload -seg1addr @gol 729-sectcreate -sectobjectsymbols -sectorder @gol 730-segaddr -segs_read_only_addr -segs_read_write_addr @gol 731-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 732-segprot -segs_read_only_addr -segs_read_write_addr @gol 733-single_module -static -sub_library -sub_umbrella @gol 734-twolevel_namespace -umbrella -undefined @gol 735-unexported_symbols_list -weak_reference_mismatches @gol 736-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 737-mkernel -mone-byte-bool} 738 739@emph{DEC Alpha Options} 740@gccoptlist{-mno-fp-regs -msoft-float @gol 741-mieee -mieee-with-inexact -mieee-conformant @gol 742-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 743-mtrap-precision=@var{mode} -mbuild-constants @gol 744-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 745-mbwx -mmax -mfix -mcix @gol 746-mfloat-vax -mfloat-ieee @gol 747-mexplicit-relocs -msmall-data -mlarge-data @gol 748-msmall-text -mlarge-text @gol 749-mmemory-latency=@var{time}} 750 751@emph{FR30 Options} 752@gccoptlist{-msmall-model -mno-lsim} 753 754@emph{FT32 Options} 755@gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm} 756 757@emph{FRV Options} 758@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 759-mhard-float -msoft-float @gol 760-malloc-cc -mfixed-cc -mdword -mno-dword @gol 761-mdouble -mno-double @gol 762-mmedia -mno-media -mmuladd -mno-muladd @gol 763-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 764-mlinked-fp -mlong-calls -malign-labels @gol 765-mlibrary-pic -macc-4 -macc-8 @gol 766-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 767-moptimize-membar -mno-optimize-membar @gol 768-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 769-mvliw-branch -mno-vliw-branch @gol 770-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 771-mno-nested-cond-exec -mtomcat-stats @gol 772-mTLS -mtls @gol 773-mcpu=@var{cpu}} 774 775@emph{GNU/Linux Options} 776@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol 777-tno-android-cc -tno-android-ld} 778 779@emph{H8/300 Options} 780@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 781 782@emph{HPPA Options} 783@gccoptlist{-march=@var{architecture-type} @gol 784-mcaller-copies -mdisable-fpregs -mdisable-indexing @gol 785-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 786-mfixed-range=@var{register-range} @gol 787-mjump-in-delay -mlinker-opt -mlong-calls @gol 788-mlong-load-store -mno-disable-fpregs @gol 789-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 790-mno-jump-in-delay -mno-long-load-store @gol 791-mno-portable-runtime -mno-soft-float @gol 792-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 793-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 794-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 795-munix=@var{unix-std} -nolibdld -static -threads} 796 797@emph{IA-64 Options} 798@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 799-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 800-mconstant-gp -mauto-pic -mfused-madd @gol 801-minline-float-divide-min-latency @gol 802-minline-float-divide-max-throughput @gol 803-mno-inline-float-divide @gol 804-minline-int-divide-min-latency @gol 805-minline-int-divide-max-throughput @gol 806-mno-inline-int-divide @gol 807-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 808-mno-inline-sqrt @gol 809-mdwarf2-asm -mearly-stop-bits @gol 810-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 811-mtune=@var{cpu-type} -milp32 -mlp64 @gol 812-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 813-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 814-msched-spec-ldc -msched-spec-control-ldc @gol 815-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 816-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 817-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 818-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 819 820@emph{LM32 Options} 821@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 822-msign-extend-enabled -muser-enabled} 823 824@emph{M32R/D Options} 825@gccoptlist{-m32r2 -m32rx -m32r @gol 826-mdebug @gol 827-malign-loops -mno-align-loops @gol 828-missue-rate=@var{number} @gol 829-mbranch-cost=@var{number} @gol 830-mmodel=@var{code-size-model-type} @gol 831-msdata=@var{sdata-type} @gol 832-mno-flush-func -mflush-func=@var{name} @gol 833-mno-flush-trap -mflush-trap=@var{number} @gol 834-G @var{num}} 835 836@emph{M32C Options} 837@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 838 839@emph{M680x0 Options} 840@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol 841-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 842-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 843-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 844-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 845-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 846-malign-int -mstrict-align -msep-data -mno-sep-data @gol 847-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 848-mxgot -mno-xgot -mlong-jump-table-offsets} 849 850@emph{MCore Options} 851@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 852-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 853-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 854-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 855-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 856 857@emph{MeP Options} 858@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 859-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 860-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 861-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 862-mtiny=@var{n}} 863 864@emph{MicroBlaze Options} 865@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 866-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 867-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 868-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 869-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}} 870 871@emph{MIPS Options} 872@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 873-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol 874-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol 875-mips16 -mno-mips16 -mflip-mips16 @gol 876-minterlink-compressed -mno-interlink-compressed @gol 877-minterlink-mips16 -mno-interlink-mips16 @gol 878-mabi=@var{abi} -mabicalls -mno-abicalls @gol 879-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 880-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol 881-mno-float -msingle-float -mdouble-float @gol 882-modd-spreg -mno-odd-spreg @gol 883-mabs=@var{mode} -mnan=@var{encoding} @gol 884-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 885-mmcu -mmno-mcu @gol 886-meva -mno-eva @gol 887-mvirt -mno-virt @gol 888-mxpa -mno-xpa @gol 889-mmicromips -mno-micromips @gol 890-mmsa -mno-msa @gol 891-mfpu=@var{fpu-type} @gol 892-msmartmips -mno-smartmips @gol 893-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 894-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 895-mlong64 -mlong32 -msym32 -mno-sym32 @gol 896-G@var{num} -mlocal-sdata -mno-local-sdata @gol 897-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 898-membedded-data -mno-embedded-data @gol 899-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 900-mcode-readable=@var{setting} @gol 901-msplit-addresses -mno-split-addresses @gol 902-mexplicit-relocs -mno-explicit-relocs @gol 903-mcheck-zero-division -mno-check-zero-division @gol 904-mdivide-traps -mdivide-breaks @gol 905-mload-store-pairs -mno-load-store-pairs @gol 906-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 907-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol 908-mfix-24k -mno-fix-24k @gol 909-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 910-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol 911-mfix-vr4120 -mno-fix-vr4120 @gol 912-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 913-mflush-func=@var{func} -mno-flush-func @gol 914-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 915-mcompact-branches=@var{policy} @gol 916-mfp-exceptions -mno-fp-exceptions @gol 917-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 918-mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol 919-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol 920-mframe-header-opt -mno-frame-header-opt} 921 922@emph{MMIX Options} 923@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 924-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 925-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 926-mno-base-addresses -msingle-exit -mno-single-exit} 927 928@emph{MN10300 Options} 929@gccoptlist{-mmult-bug -mno-mult-bug @gol 930-mno-am33 -mam33 -mam33-2 -mam34 @gol 931-mtune=@var{cpu-type} @gol 932-mreturn-pointer-on-d0 @gol 933-mno-crt0 -mrelax -mliw -msetlb} 934 935@emph{Moxie Options} 936@gccoptlist{-meb -mel -mmul.x -mno-crt0} 937 938@emph{MSP430 Options} 939@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol 940-mwarn-mcu @gol 941-mcode-region= -mdata-region= @gol 942-msilicon-errata= -msilicon-errata-warn= @gol 943-mhwmult= -minrt} 944 945@emph{NDS32 Options} 946@gccoptlist{-mbig-endian -mlittle-endian @gol 947-mreduced-regs -mfull-regs @gol 948-mcmov -mno-cmov @gol 949-mext-perf -mno-ext-perf @gol 950-mext-perf2 -mno-ext-perf2 @gol 951-mext-string -mno-ext-string @gol 952-mv3push -mno-v3push @gol 953-m16bit -mno-16bit @gol 954-misr-vector-size=@var{num} @gol 955-mcache-block-size=@var{num} @gol 956-march=@var{arch} @gol 957-mcmodel=@var{code-model} @gol 958-mctor-dtor -mrelax} 959 960@emph{Nios II Options} 961@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol 962-mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol 963-mel -meb @gol 964-mno-bypass-cache -mbypass-cache @gol 965-mno-cache-volatile -mcache-volatile @gol 966-mno-fast-sw-div -mfast-sw-div @gol 967-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol 968-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol 969-mcustom-fpu-cfg=@var{name} @gol 970-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol 971-march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx} 972 973@emph{Nvidia PTX Options} 974@gccoptlist{-m32 -m64 -mmainkernel -moptimize} 975 976@emph{PDP-11 Options} 977@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 978-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 979-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 980-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 981-mbranch-expensive -mbranch-cheap @gol 982-munix-asm -mdec-asm} 983 984@emph{picoChip Options} 985@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 986-msymbol-as-address -mno-inefficient-warnings} 987 988@emph{PowerPC Options} 989See RS/6000 and PowerPC Options. 990 991@emph{PowerPC SPE Options} 992@gccoptlist{-mcpu=@var{cpu-type} @gol 993-mtune=@var{cpu-type} @gol 994-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol 995-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 996-m32 -mxl-compat -mno-xl-compat @gol 997-malign-power -malign-natural @gol 998-msoft-float -mhard-float -mmultiple -mno-multiple @gol 999-msingle-float -mdouble-float @gol 1000-mupdate -mno-update @gol 1001-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 1002-mstrict-align -mno-strict-align -mrelocatable @gol 1003-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 1004-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 1005-msingle-pic-base @gol 1006-mprioritize-restricted-insns=@var{priority} @gol 1007-msched-costly-dep=@var{dependence_type} @gol 1008-minsert-sched-nops=@var{scheme} @gol 1009-mcall-sysv -mcall-netbsd @gol 1010-maix-struct-return -msvr4-struct-return @gol 1011-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 1012-mblock-move-inline-limit=@var{num} @gol 1013-misel -mno-isel @gol 1014-misel=yes -misel=no @gol 1015-mspe -mno-spe @gol 1016-mspe=yes -mspe=no @gol 1017-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 1018-mprototype -mno-prototype @gol 1019-msim -mmvme -mads -myellowknife -memb -msdata @gol 1020-msdata=@var{opt} -mvxworks -G @var{num} @gol 1021-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 1022-mno-recip-precision @gol 1023-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 1024-msave-toc-indirect -mno-save-toc-indirect @gol 1025-mcompat-align-parm -mno-compat-align-parm @gol 1026-mfloat128 -mno-float128 @gol 1027-mgnu-attribute -mno-gnu-attribute @gol 1028-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1029-mstack-protector-guard-offset=@var{offset}} 1030 1031@emph{RISC-V Options} 1032@gccoptlist{-mbranch-cost=@var{N-instruction} @gol 1033-mplt -mno-plt @gol 1034-mabi=@var{ABI-string} @gol 1035-mfdiv -mno-fdiv @gol 1036-mdiv -mno-div @gol 1037-march=@var{ISA-string} @gol 1038-mtune=@var{processor-string} @gol 1039-mpreferred-stack-boundary=@var{num} @gol 1040-msmall-data-limit=@var{N-bytes} @gol 1041-msave-restore -mno-save-restore @gol 1042-mstrict-align -mno-strict-align @gol 1043-mcmodel=medlow -mcmodel=medany @gol 1044-mexplicit-relocs -mno-explicit-relocs @gol 1045-mrelax -mno-relax @gol} 1046 1047@emph{RL78 Options} 1048@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol 1049-mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol 1050-m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts} 1051 1052@emph{RS/6000 and PowerPC Options} 1053@gccoptlist{-mcpu=@var{cpu-type} @gol 1054-mtune=@var{cpu-type} @gol 1055-mcmodel=@var{code-model} @gol 1056-mpowerpc64 @gol 1057-maltivec -mno-altivec @gol 1058-mpowerpc-gpopt -mno-powerpc-gpopt @gol 1059-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 1060-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 1061-mfprnd -mno-fprnd @gol 1062-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol 1063-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 1064-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 1065-malign-power -malign-natural @gol 1066-msoft-float -mhard-float -mmultiple -mno-multiple @gol 1067-msingle-float -mdouble-float -msimple-fpu @gol 1068-mupdate -mno-update @gol 1069-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 1070-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 1071-mstrict-align -mno-strict-align -mrelocatable @gol 1072-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 1073-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 1074-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol 1075-mprioritize-restricted-insns=@var{priority} @gol 1076-msched-costly-dep=@var{dependence_type} @gol 1077-minsert-sched-nops=@var{scheme} @gol 1078-mcall-aixdesc -mcall-eabi -mcall-freebsd @gol 1079-mcall-linux -mcall-netbsd -mcall-openbsd @gol 1080-mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol 1081-mtraceback=@var{traceback_type} @gol 1082-maix-struct-return -msvr4-struct-return @gol 1083-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 1084-mblock-move-inline-limit=@var{num} @gol 1085-mblock-compare-inline-limit=@var{num} @gol 1086-mblock-compare-inline-loop-limit=@var{num} @gol 1087-mstring-compare-inline-limit=@var{num} @gol 1088-misel -mno-isel @gol 1089-misel=yes -misel=no @gol 1090-mpaired @gol 1091-mvrsave -mno-vrsave @gol 1092-mmulhw -mno-mulhw @gol 1093-mdlmzb -mno-dlmzb @gol 1094-mprototype -mno-prototype @gol 1095-msim -mmvme -mads -myellowknife -memb -msdata @gol 1096-msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol 1097-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 1098-mno-recip-precision @gol 1099-mveclibabi=@var{type} -mfriz -mno-friz @gol 1100-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 1101-msave-toc-indirect -mno-save-toc-indirect @gol 1102-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 1103-mcrypto -mno-crypto -mhtm -mno-htm @gol 1104-mquad-memory -mno-quad-memory @gol 1105-mquad-memory-atomic -mno-quad-memory-atomic @gol 1106-mcompat-align-parm -mno-compat-align-parm @gol 1107-mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol 1108-mgnu-attribute -mno-gnu-attribute @gol 1109-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol 1110-mstack-protector-guard-offset=@var{offset}} 1111 1112@emph{RX Options} 1113@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 1114-mcpu=@gol 1115-mbig-endian-data -mlittle-endian-data @gol 1116-msmall-data @gol 1117-msim -mno-sim@gol 1118-mas100-syntax -mno-as100-syntax@gol 1119-mrelax@gol 1120-mmax-constant-size=@gol 1121-mint-register=@gol 1122-mpid@gol 1123-mallow-string-insns -mno-allow-string-insns@gol 1124-mjsr@gol 1125-mno-warn-multiple-fast-interrupts@gol 1126-msave-acc-in-interrupts} 1127 1128@emph{S/390 and zSeries Options} 1129@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1130-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 1131-mlong-double-64 -mlong-double-128 @gol 1132-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 1133-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 1134-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 1135-mhtm -mvx -mzvector @gol 1136-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 1137-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 1138-mhotpatch=@var{halfwords},@var{halfwords}} 1139 1140@emph{Score Options} 1141@gccoptlist{-meb -mel @gol 1142-mnhwloop @gol 1143-muls @gol 1144-mmac @gol 1145-mscore5 -mscore5u -mscore7 -mscore7d} 1146 1147@emph{SH Options} 1148@gccoptlist{-m1 -m2 -m2e @gol 1149-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 1150-m3 -m3e @gol 1151-m4-nofpu -m4-single-only -m4-single -m4 @gol 1152-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 1153-mb -ml -mdalign -mrelax @gol 1154-mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol 1155-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 1156-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 1157-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 1158-maccumulate-outgoing-args @gol 1159-matomic-model=@var{atomic-model} @gol 1160-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol 1161-mcbranch-force-delay-slot @gol 1162-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 1163-mpretend-cmove -mtas} 1164 1165@emph{Solaris 2 Options} 1166@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol 1167-pthreads} 1168 1169@emph{SPARC Options} 1170@gccoptlist{-mcpu=@var{cpu-type} @gol 1171-mtune=@var{cpu-type} @gol 1172-mcmodel=@var{code-model} @gol 1173-mmemory-model=@var{mem-model} @gol 1174-m32 -m64 -mapp-regs -mno-app-regs @gol 1175-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 1176-mfpu -mno-fpu -mhard-float -msoft-float @gol 1177-mhard-quad-float -msoft-quad-float @gol 1178-mstack-bias -mno-stack-bias @gol 1179-mstd-struct-return -mno-std-struct-return @gol 1180-munaligned-doubles -mno-unaligned-doubles @gol 1181-muser-mode -mno-user-mode @gol 1182-mv8plus -mno-v8plus -mvis -mno-vis @gol 1183-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 1184-mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol 1185-mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol 1186-mpopc -mno-popc -msubxc -mno-subxc @gol 1187-mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol 1188-mlra -mno-lra} 1189 1190@emph{SPU Options} 1191@gccoptlist{-mwarn-reloc -merror-reloc @gol 1192-msafe-dma -munsafe-dma @gol 1193-mbranch-hints @gol 1194-msmall-mem -mlarge-mem -mstdmain @gol 1195-mfixed-range=@var{register-range} @gol 1196-mea32 -mea64 @gol 1197-maddress-space-conversion -mno-address-space-conversion @gol 1198-mcache-size=@var{cache-size} @gol 1199-matomic-updates -mno-atomic-updates} 1200 1201@emph{System V Options} 1202@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 1203 1204@emph{TILE-Gx Options} 1205@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol 1206-mcmodel=@var{code-model}} 1207 1208@emph{TILEPro Options} 1209@gccoptlist{-mcpu=@var{cpu} -m32} 1210 1211@emph{V850 Options} 1212@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 1213-mprolog-function -mno-prolog-function -mspace @gol 1214-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 1215-mapp-regs -mno-app-regs @gol 1216-mdisable-callt -mno-disable-callt @gol 1217-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 1218-mv850e -mv850 -mv850e3v5 @gol 1219-mloop @gol 1220-mrelax @gol 1221-mlong-jumps @gol 1222-msoft-float @gol 1223-mhard-float @gol 1224-mgcc-abi @gol 1225-mrh850-abi @gol 1226-mbig-switch} 1227 1228@emph{VAX Options} 1229@gccoptlist{-mg -mgnu -munix} 1230 1231@emph{Visium Options} 1232@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol 1233-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} 1234 1235@emph{VMS Options} 1236@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 1237-mpointer-size=@var{size}} 1238 1239@emph{VxWorks Options} 1240@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 1241-Xbind-lazy -Xbind-now} 1242 1243@emph{x86 Options} 1244@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1245-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol 1246-mfpmath=@var{unit} @gol 1247-masm=@var{dialect} -mno-fancy-math-387 @gol 1248-mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol 1249-mno-wide-multiply -mrtd -malign-double @gol 1250-mpreferred-stack-boundary=@var{num} @gol 1251-mincoming-stack-boundary=@var{num} @gol 1252-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol 1253-mrecip -mrecip=@var{opt} @gol 1254-mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol 1255-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 1256-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol 1257-mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol 1258-mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol 1259-mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol 1260-msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol 1261-madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol 1262-mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes @gol 1263-mshstk -mforce-indirect-call -mavx512vbmi2 @gol 1264-mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol 1265-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol 1266-mrdseed -msgx @gol 1267-mms-bitfields -mno-align-stringops -minline-all-stringops @gol 1268-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 1269-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol 1270-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 1271-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol 1272-mregparm=@var{num} -msseregparm @gol 1273-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 1274-mpc32 -mpc64 -mpc80 -mstackrealign @gol 1275-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 1276-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 1277-m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol 1278-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol 1279-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol 1280-malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol 1281-mstack-protector-guard-reg=@var{reg} @gol 1282-mstack-protector-guard-offset=@var{offset} @gol 1283-mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol 1284-mgeneral-regs-only -mcall-ms2sysv-xlogues @gol 1285-mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol 1286-mindirect-branch-register} 1287 1288@emph{x86 Windows Options} 1289@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 1290-mnop-fun-dllimport -mthread @gol 1291-municode -mwin32 -mwindows -fno-set-stack-executable} 1292 1293@emph{Xstormy16 Options} 1294@gccoptlist{-msim} 1295 1296@emph{Xtensa Options} 1297@gccoptlist{-mconst16 -mno-const16 @gol 1298-mfused-madd -mno-fused-madd @gol 1299-mforce-no-pic @gol 1300-mserialize-volatile -mno-serialize-volatile @gol 1301-mtext-section-literals -mno-text-section-literals @gol 1302-mauto-litpools -mno-auto-litpools @gol 1303-mtarget-align -mno-target-align @gol 1304-mlongcalls -mno-longcalls} 1305 1306@emph{zSeries Options} 1307See S/390 and zSeries Options. 1308@end table 1309 1310 1311@node Overall Options 1312@section Options Controlling the Kind of Output 1313 1314Compilation can involve up to four stages: preprocessing, compilation 1315proper, assembly and linking, always in that order. GCC is capable of 1316preprocessing and compiling several files either into several 1317assembler input files, or into one assembler input file; then each 1318assembler input file produces an object file, and linking combines all 1319the object files (those newly compiled, and those specified as input) 1320into an executable file. 1321 1322@cindex file name suffix 1323For any given input file, the file name suffix determines what kind of 1324compilation is done: 1325 1326@table @gcctabopt 1327@item @var{file}.c 1328C source code that must be preprocessed. 1329 1330@item @var{file}.i 1331C source code that should not be preprocessed. 1332 1333@item @var{file}.ii 1334C++ source code that should not be preprocessed. 1335 1336@item @var{file}.m 1337Objective-C source code. Note that you must link with the @file{libobjc} 1338library to make an Objective-C program work. 1339 1340@item @var{file}.mi 1341Objective-C source code that should not be preprocessed. 1342 1343@item @var{file}.mm 1344@itemx @var{file}.M 1345Objective-C++ source code. Note that you must link with the @file{libobjc} 1346library to make an Objective-C++ program work. Note that @samp{.M} refers 1347to a literal capital M@. 1348 1349@item @var{file}.mii 1350Objective-C++ source code that should not be preprocessed. 1351 1352@item @var{file}.h 1353C, C++, Objective-C or Objective-C++ header file to be turned into a 1354precompiled header (default), or C, C++ header file to be turned into an 1355Ada spec (via the @option{-fdump-ada-spec} switch). 1356 1357@item @var{file}.cc 1358@itemx @var{file}.cp 1359@itemx @var{file}.cxx 1360@itemx @var{file}.cpp 1361@itemx @var{file}.CPP 1362@itemx @var{file}.c++ 1363@itemx @var{file}.C 1364C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1365the last two letters must both be literally @samp{x}. Likewise, 1366@samp{.C} refers to a literal capital C@. 1367 1368@item @var{file}.mm 1369@itemx @var{file}.M 1370Objective-C++ source code that must be preprocessed. 1371 1372@item @var{file}.mii 1373Objective-C++ source code that should not be preprocessed. 1374 1375@item @var{file}.hh 1376@itemx @var{file}.H 1377@itemx @var{file}.hp 1378@itemx @var{file}.hxx 1379@itemx @var{file}.hpp 1380@itemx @var{file}.HPP 1381@itemx @var{file}.h++ 1382@itemx @var{file}.tcc 1383C++ header file to be turned into a precompiled header or Ada spec. 1384 1385@item @var{file}.f 1386@itemx @var{file}.for 1387@itemx @var{file}.ftn 1388Fixed form Fortran source code that should not be preprocessed. 1389 1390@item @var{file}.F 1391@itemx @var{file}.FOR 1392@itemx @var{file}.fpp 1393@itemx @var{file}.FPP 1394@itemx @var{file}.FTN 1395Fixed form Fortran source code that must be preprocessed (with the traditional 1396preprocessor). 1397 1398@item @var{file}.f90 1399@itemx @var{file}.f95 1400@itemx @var{file}.f03 1401@itemx @var{file}.f08 1402Free form Fortran source code that should not be preprocessed. 1403 1404@item @var{file}.F90 1405@itemx @var{file}.F95 1406@itemx @var{file}.F03 1407@itemx @var{file}.F08 1408Free form Fortran source code that must be preprocessed (with the 1409traditional preprocessor). 1410 1411@item @var{file}.go 1412Go source code. 1413 1414@item @var{file}.brig 1415BRIG files (binary representation of HSAIL). 1416 1417@item @var{file}.ads 1418Ada source code file that contains a library unit declaration (a 1419declaration of a package, subprogram, or generic, or a generic 1420instantiation), or a library unit renaming declaration (a package, 1421generic, or subprogram renaming declaration). Such files are also 1422called @dfn{specs}. 1423 1424@item @var{file}.adb 1425Ada source code file containing a library unit body (a subprogram or 1426package body). Such files are also called @dfn{bodies}. 1427 1428@c GCC also knows about some suffixes for languages not yet included: 1429@c Pascal: 1430@c @var{file}.p 1431@c @var{file}.pas 1432@c Ratfor: 1433@c @var{file}.r 1434 1435@item @var{file}.s 1436Assembler code. 1437 1438@item @var{file}.S 1439@itemx @var{file}.sx 1440Assembler code that must be preprocessed. 1441 1442@item @var{other} 1443An object file to be fed straight into linking. 1444Any file name with no recognized suffix is treated this way. 1445@end table 1446 1447@opindex x 1448You can specify the input language explicitly with the @option{-x} option: 1449 1450@table @gcctabopt 1451@item -x @var{language} 1452Specify explicitly the @var{language} for the following input files 1453(rather than letting the compiler choose a default based on the file 1454name suffix). This option applies to all following input files until 1455the next @option{-x} option. Possible values for @var{language} are: 1456@smallexample 1457c c-header cpp-output 1458c++ c++-header c++-cpp-output 1459objective-c objective-c-header objective-c-cpp-output 1460objective-c++ objective-c++-header objective-c++-cpp-output 1461assembler assembler-with-cpp 1462ada 1463f77 f77-cpp-input f95 f95-cpp-input 1464go 1465brig 1466@end smallexample 1467 1468@item -x none 1469Turn off any specification of a language, so that subsequent files are 1470handled according to their file name suffixes (as they are if @option{-x} 1471has not been used at all). 1472@end table 1473 1474If you only want some of the stages of compilation, you can use 1475@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1476one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1477@command{gcc} is to stop. Note that some combinations (for example, 1478@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1479 1480@table @gcctabopt 1481@item -c 1482@opindex c 1483Compile or assemble the source files, but do not link. The linking 1484stage simply is not done. The ultimate output is in the form of an 1485object file for each source file. 1486 1487By default, the object file name for a source file is made by replacing 1488the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1489 1490Unrecognized input files, not requiring compilation or assembly, are 1491ignored. 1492 1493@item -S 1494@opindex S 1495Stop after the stage of compilation proper; do not assemble. The output 1496is in the form of an assembler code file for each non-assembler input 1497file specified. 1498 1499By default, the assembler file name for a source file is made by 1500replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1501 1502Input files that don't require compilation are ignored. 1503 1504@item -E 1505@opindex E 1506Stop after the preprocessing stage; do not run the compiler proper. The 1507output is in the form of preprocessed source code, which is sent to the 1508standard output. 1509 1510Input files that don't require preprocessing are ignored. 1511 1512@cindex output file option 1513@item -o @var{file} 1514@opindex o 1515Place output in file @var{file}. This applies to whatever 1516sort of output is being produced, whether it be an executable file, 1517an object file, an assembler file or preprocessed C code. 1518 1519If @option{-o} is not specified, the default is to put an executable 1520file in @file{a.out}, the object file for 1521@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1522assembler file in @file{@var{source}.s}, a precompiled header file in 1523@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1524standard output. 1525 1526@item -v 1527@opindex v 1528Print (on standard error output) the commands executed to run the stages 1529of compilation. Also print the version number of the compiler driver 1530program and of the preprocessor and the compiler proper. 1531 1532@item -### 1533@opindex ### 1534Like @option{-v} except the commands are not executed and arguments 1535are quoted unless they contain only alphanumeric characters or @code{./-_}. 1536This is useful for shell scripts to capture the driver-generated command lines. 1537 1538@item --help 1539@opindex help 1540Print (on the standard output) a description of the command-line options 1541understood by @command{gcc}. If the @option{-v} option is also specified 1542then @option{--help} is also passed on to the various processes 1543invoked by @command{gcc}, so that they can display the command-line options 1544they accept. If the @option{-Wextra} option has also been specified 1545(prior to the @option{--help} option), then command-line options that 1546have no documentation associated with them are also displayed. 1547 1548@item --target-help 1549@opindex target-help 1550Print (on the standard output) a description of target-specific command-line 1551options for each tool. For some targets extra target-specific 1552information may also be printed. 1553 1554@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 1555Print (on the standard output) a description of the command-line 1556options understood by the compiler that fit into all specified classes 1557and qualifiers. These are the supported classes: 1558 1559@table @asis 1560@item @samp{optimizers} 1561Display all of the optimization options supported by the 1562compiler. 1563 1564@item @samp{warnings} 1565Display all of the options controlling warning messages 1566produced by the compiler. 1567 1568@item @samp{target} 1569Display target-specific options. Unlike the 1570@option{--target-help} option however, target-specific options of the 1571linker and assembler are not displayed. This is because those 1572tools do not currently support the extended @option{--help=} syntax. 1573 1574@item @samp{params} 1575Display the values recognized by the @option{--param} 1576option. 1577 1578@item @var{language} 1579Display the options supported for @var{language}, where 1580@var{language} is the name of one of the languages supported in this 1581version of GCC@. 1582 1583@item @samp{common} 1584Display the options that are common to all languages. 1585@end table 1586 1587These are the supported qualifiers: 1588 1589@table @asis 1590@item @samp{undocumented} 1591Display only those options that are undocumented. 1592 1593@item @samp{joined} 1594Display options taking an argument that appears after an equal 1595sign in the same continuous piece of text, such as: 1596@samp{--help=target}. 1597 1598@item @samp{separate} 1599Display options taking an argument that appears as a separate word 1600following the original option, such as: @samp{-o output-file}. 1601@end table 1602 1603Thus for example to display all the undocumented target-specific 1604switches supported by the compiler, use: 1605 1606@smallexample 1607--help=target,undocumented 1608@end smallexample 1609 1610The sense of a qualifier can be inverted by prefixing it with the 1611@samp{^} character, so for example to display all binary warning 1612options (i.e., ones that are either on or off and that do not take an 1613argument) that have a description, use: 1614 1615@smallexample 1616--help=warnings,^joined,^undocumented 1617@end smallexample 1618 1619The argument to @option{--help=} should not consist solely of inverted 1620qualifiers. 1621 1622Combining several classes is possible, although this usually 1623restricts the output so much that there is nothing to display. One 1624case where it does work, however, is when one of the classes is 1625@var{target}. For example, to display all the target-specific 1626optimization options, use: 1627 1628@smallexample 1629--help=target,optimizers 1630@end smallexample 1631 1632The @option{--help=} option can be repeated on the command line. Each 1633successive use displays its requested class of options, skipping 1634those that have already been displayed. 1635 1636If the @option{-Q} option appears on the command line before the 1637@option{--help=} option, then the descriptive text displayed by 1638@option{--help=} is changed. Instead of describing the displayed 1639options, an indication is given as to whether the option is enabled, 1640disabled or set to a specific value (assuming that the compiler 1641knows this at the point where the @option{--help=} option is used). 1642 1643Here is a truncated example from the ARM port of @command{gcc}: 1644 1645@smallexample 1646 % gcc -Q -mabi=2 --help=target -c 1647 The following options are target specific: 1648 -mabi= 2 1649 -mabort-on-noreturn [disabled] 1650 -mapcs [disabled] 1651@end smallexample 1652 1653The output is sensitive to the effects of previous command-line 1654options, so for example it is possible to find out which optimizations 1655are enabled at @option{-O2} by using: 1656 1657@smallexample 1658-Q -O2 --help=optimizers 1659@end smallexample 1660 1661Alternatively you can discover which binary optimizations are enabled 1662by @option{-O3} by using: 1663 1664@smallexample 1665gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 1666gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 1667diff /tmp/O2-opts /tmp/O3-opts | grep enabled 1668@end smallexample 1669 1670@item --version 1671@opindex version 1672Display the version number and copyrights of the invoked GCC@. 1673 1674@item -pass-exit-codes 1675@opindex pass-exit-codes 1676Normally the @command{gcc} program exits with the code of 1 if any 1677phase of the compiler returns a non-success return code. If you specify 1678@option{-pass-exit-codes}, the @command{gcc} program instead returns with 1679the numerically highest error produced by any phase returning an error 1680indication. The C, C++, and Fortran front ends return 4 if an internal 1681compiler error is encountered. 1682 1683@item -pipe 1684@opindex pipe 1685Use pipes rather than temporary files for communication between the 1686various stages of compilation. This fails to work on some systems where 1687the assembler is unable to read from a pipe; but the GNU assembler has 1688no trouble. 1689 1690@item -specs=@var{file} 1691@opindex specs 1692Process @var{file} after the compiler reads in the standard @file{specs} 1693file, in order to override the defaults which the @command{gcc} driver 1694program uses when determining what switches to pass to @command{cc1}, 1695@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 1696@option{-specs=@var{file}} can be specified on the command line, and they 1697are processed in order, from left to right. @xref{Spec Files}, for 1698information about the format of the @var{file}. 1699 1700@item -wrapper 1701@opindex wrapper 1702Invoke all subcommands under a wrapper program. The name of the 1703wrapper program and its parameters are passed as a comma separated 1704list. 1705 1706@smallexample 1707gcc -c t.c -wrapper gdb,--args 1708@end smallexample 1709 1710@noindent 1711This invokes all subprograms of @command{gcc} under 1712@samp{gdb --args}, thus the invocation of @command{cc1} is 1713@samp{gdb --args cc1 @dots{}}. 1714 1715@item -ffile-prefix-map=@var{old}=@var{new} 1716@opindex ffile-prefix-map 1717When compiling files residing in directory @file{@var{old}}, record 1718any references to them in the result of the compilation as if the 1719files resided in directory @file{@var{new}} instead. Specifying this 1720option is equivalent to specifying all the individual 1721@option{-f*-prefix-map} options. This can be used to make reproducible 1722builds that are location independent. See also 1723@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}. 1724 1725@item -fplugin=@var{name}.so 1726@opindex fplugin 1727Load the plugin code in file @var{name}.so, assumed to be a 1728shared object to be dlopen'd by the compiler. The base name of 1729the shared object file is used to identify the plugin for the 1730purposes of argument parsing (See 1731@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 1732Each plugin should define the callback functions specified in the 1733Plugins API. 1734 1735@item -fplugin-arg-@var{name}-@var{key}=@var{value} 1736@opindex fplugin-arg 1737Define an argument called @var{key} with a value of @var{value} 1738for the plugin called @var{name}. 1739 1740@item -fdump-ada-spec@r{[}-slim@r{]} 1741@opindex fdump-ada-spec 1742For C and C++ source and include files, generate corresponding Ada specs. 1743@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 1744GNAT User's Guide}, which provides detailed documentation on this feature. 1745 1746@item -fada-spec-parent=@var{unit} 1747@opindex fada-spec-parent 1748In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 1749Ada specs as child units of parent @var{unit}. 1750 1751@item -fdump-go-spec=@var{file} 1752@opindex fdump-go-spec 1753For input files in any language, generate corresponding Go 1754declarations in @var{file}. This generates Go @code{const}, 1755@code{type}, @code{var}, and @code{func} declarations which may be a 1756useful way to start writing a Go interface to code written in some 1757other language. 1758 1759@include @value{srcdir}/../libiberty/at-file.texi 1760@end table 1761 1762@node Invoking G++ 1763@section Compiling C++ Programs 1764 1765@cindex suffixes for C++ source 1766@cindex C++ source file suffixes 1767C++ source files conventionally use one of the suffixes @samp{.C}, 1768@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1769@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 1770@samp{.H}, or (for shared template code) @samp{.tcc}; and 1771preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1772files with these names and compiles them as C++ programs even if you 1773call the compiler the same way as for compiling C programs (usually 1774with the name @command{gcc}). 1775 1776@findex g++ 1777@findex c++ 1778However, the use of @command{gcc} does not add the C++ library. 1779@command{g++} is a program that calls GCC and automatically specifies linking 1780against the C++ library. It treats @samp{.c}, 1781@samp{.h} and @samp{.i} files as C++ source files instead of C source 1782files unless @option{-x} is used. This program is also useful when 1783precompiling a C header file with a @samp{.h} extension for use in C++ 1784compilations. On many systems, @command{g++} is also installed with 1785the name @command{c++}. 1786 1787@cindex invoking @command{g++} 1788When you compile C++ programs, you may specify many of the same 1789command-line options that you use for compiling programs in any 1790language; or command-line options meaningful for C and related 1791languages; or options that are meaningful only for C++ programs. 1792@xref{C Dialect Options,,Options Controlling C Dialect}, for 1793explanations of options for languages related to C@. 1794@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1795explanations of options that are meaningful only for C++ programs. 1796 1797@node C Dialect Options 1798@section Options Controlling C Dialect 1799@cindex dialect options 1800@cindex language dialect options 1801@cindex options, dialect 1802 1803The following options control the dialect of C (or languages derived 1804from C, such as C++, Objective-C and Objective-C++) that the compiler 1805accepts: 1806 1807@table @gcctabopt 1808@cindex ANSI support 1809@cindex ISO support 1810@item -ansi 1811@opindex ansi 1812In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 1813equivalent to @option{-std=c++98}. 1814 1815This turns off certain features of GCC that are incompatible with ISO 1816C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1817such as the @code{asm} and @code{typeof} keywords, and 1818predefined macros such as @code{unix} and @code{vax} that identify the 1819type of system you are using. It also enables the undesirable and 1820rarely used ISO trigraph feature. For the C compiler, 1821it disables recognition of C++ style @samp{//} comments as well as 1822the @code{inline} keyword. 1823 1824The alternate keywords @code{__asm__}, @code{__extension__}, 1825@code{__inline__} and @code{__typeof__} continue to work despite 1826@option{-ansi}. You would not want to use them in an ISO C program, of 1827course, but it is useful to put them in header files that might be included 1828in compilations done with @option{-ansi}. Alternate predefined macros 1829such as @code{__unix__} and @code{__vax__} are also available, with or 1830without @option{-ansi}. 1831 1832The @option{-ansi} option does not cause non-ISO programs to be 1833rejected gratuitously. For that, @option{-Wpedantic} is required in 1834addition to @option{-ansi}. @xref{Warning Options}. 1835 1836The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1837option is used. Some header files may notice this macro and refrain 1838from declaring certain functions or defining certain macros that the 1839ISO standard doesn't call for; this is to avoid interfering with any 1840programs that might use these names for other things. 1841 1842Functions that are normally built in but do not have semantics 1843defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1844functions when @option{-ansi} is used. @xref{Other Builtins,,Other 1845built-in functions provided by GCC}, for details of the functions 1846affected. 1847 1848@item -std= 1849@opindex std 1850Determine the language standard. @xref{Standards,,Language Standards 1851Supported by GCC}, for details of these standard versions. This option 1852is currently only supported when compiling C or C++. 1853 1854The compiler can accept several base standards, such as @samp{c90} or 1855@samp{c++98}, and GNU dialects of those standards, such as 1856@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 1857compiler accepts all programs following that standard plus those 1858using GNU extensions that do not contradict it. For example, 1859@option{-std=c90} turns off certain features of GCC that are 1860incompatible with ISO C90, such as the @code{asm} and @code{typeof} 1861keywords, but not other GNU extensions that do not have a meaning in 1862ISO C90, such as omitting the middle term of a @code{?:} 1863expression. On the other hand, when a GNU dialect of a standard is 1864specified, all features supported by the compiler are enabled, even when 1865those features change the meaning of the base standard. As a result, some 1866strict-conforming programs may be rejected. The particular standard 1867is used by @option{-Wpedantic} to identify which features are GNU 1868extensions given that version of the standard. For example 1869@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 1870comments, while @option{-std=gnu99 -Wpedantic} does not. 1871 1872A value for this option must be provided; possible values are 1873 1874@table @samp 1875@item c90 1876@itemx c89 1877@itemx iso9899:1990 1878Support all ISO C90 programs (certain GNU extensions that conflict 1879with ISO C90 are disabled). Same as @option{-ansi} for C code. 1880 1881@item iso9899:199409 1882ISO C90 as modified in amendment 1. 1883 1884@item c99 1885@itemx c9x 1886@itemx iso9899:1999 1887@itemx iso9899:199x 1888ISO C99. This standard is substantially completely supported, modulo 1889bugs and floating-point issues 1890(mainly but not entirely relating to optional C99 features from 1891Annexes F and G). See 1892@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The 1893names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1894 1895@item c11 1896@itemx c1x 1897@itemx iso9899:2011 1898ISO C11, the 2011 revision of the ISO C standard. This standard is 1899substantially completely supported, modulo bugs, floating-point issues 1900(mainly but not entirely relating to optional C11 features from 1901Annexes F and G) and the optional Annexes K (Bounds-checking 1902interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. 1903 1904@item c17 1905@itemx c18 1906@itemx iso9899:2017 1907@itemx iso9899:2018 1908ISO C17, the 2017 revision of the ISO C standard (expected to be 1909published in 2018). This standard is 1910same as C11 except for corrections of defects (all of which are also 1911applied with @option{-std=c11}) and a new value of 1912@code{__STDC_VERSION__}, and so is supported to the same extent as C11. 1913 1914@item gnu90 1915@itemx gnu89 1916GNU dialect of ISO C90 (including some C99 features). 1917 1918@item gnu99 1919@itemx gnu9x 1920GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. 1921 1922@item gnu11 1923@itemx gnu1x 1924GNU dialect of ISO C11. 1925The name @samp{gnu1x} is deprecated. 1926 1927@item gnu17 1928@itemx gnu18 1929GNU dialect of ISO C17. This is the default for C code. 1930 1931@item c++98 1932@itemx c++03 1933The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 1934additional defect reports. Same as @option{-ansi} for C++ code. 1935 1936@item gnu++98 1937@itemx gnu++03 1938GNU dialect of @option{-std=c++98}. 1939 1940@item c++11 1941@itemx c++0x 1942The 2011 ISO C++ standard plus amendments. 1943The name @samp{c++0x} is deprecated. 1944 1945@item gnu++11 1946@itemx gnu++0x 1947GNU dialect of @option{-std=c++11}. 1948The name @samp{gnu++0x} is deprecated. 1949 1950@item c++14 1951@itemx c++1y 1952The 2014 ISO C++ standard plus amendments. 1953The name @samp{c++1y} is deprecated. 1954 1955@item gnu++14 1956@itemx gnu++1y 1957GNU dialect of @option{-std=c++14}. 1958This is the default for C++ code. 1959The name @samp{gnu++1y} is deprecated. 1960 1961@item c++17 1962@itemx c++1z 1963The 2017 ISO C++ standard plus amendments. 1964The name @samp{c++1z} is deprecated. 1965 1966@item gnu++17 1967@itemx gnu++1z 1968GNU dialect of @option{-std=c++17}. 1969The name @samp{gnu++1z} is deprecated. 1970 1971@item c++2a 1972The next revision of the ISO C++ standard, tentatively planned for 19732020. Support is highly experimental, and will almost certainly 1974change in incompatible ways in future releases. 1975 1976@item gnu++2a 1977GNU dialect of @option{-std=c++2a}. Support is highly experimental, 1978and will almost certainly change in incompatible ways in future 1979releases. 1980@end table 1981 1982@item -fgnu89-inline 1983@opindex fgnu89-inline 1984The option @option{-fgnu89-inline} tells GCC to use the traditional 1985GNU semantics for @code{inline} functions when in C99 mode. 1986@xref{Inline,,An Inline Function is As Fast As a Macro}. 1987Using this option is roughly equivalent to adding the 1988@code{gnu_inline} function attribute to all inline functions 1989(@pxref{Function Attributes}). 1990 1991The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 1992C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 1993specifies the default behavior). 1994This option is not supported in @option{-std=c90} or 1995@option{-std=gnu90} mode. 1996 1997The preprocessor macros @code{__GNUC_GNU_INLINE__} and 1998@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1999in effect for @code{inline} functions. @xref{Common Predefined 2000Macros,,,cpp,The C Preprocessor}. 2001 2002@item -fpermitted-flt-eval-methods=@var{style} 2003@opindex fpermitted-flt-eval-methods 2004@opindex fpermitted-flt-eval-methods=c11 2005@opindex fpermitted-flt-eval-methods=ts-18661-3 2006ISO/IEC TS 18661-3 defines new permissible values for 2007@code{FLT_EVAL_METHOD} that indicate that operations and constants with 2008a semantic type that is an interchange or extended format should be 2009evaluated to the precision and range of that type. These new values are 2010a superset of those permitted under C99/C11, which does not specify the 2011meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code 2012conforming to C11 may not have been written expecting the possibility of 2013the new values. 2014 2015@option{-fpermitted-flt-eval-methods} specifies whether the compiler 2016should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11, 2017or the extended set of values specified in ISO/IEC TS 18661-3. 2018 2019@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate. 2020 2021The default when in a standards compliant mode (@option{-std=c11} or similar) 2022is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU 2023dialect (@option{-std=gnu11} or similar) is 2024@option{-fpermitted-flt-eval-methods=ts-18661-3}. 2025 2026@item -aux-info @var{filename} 2027@opindex aux-info 2028Output to the given filename prototyped declarations for all functions 2029declared and/or defined in a translation unit, including those in header 2030files. This option is silently ignored in any language other than C@. 2031 2032Besides declarations, the file indicates, in comments, the origin of 2033each declaration (source file and line), whether the declaration was 2034implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 2035@samp{O} for old, respectively, in the first character after the line 2036number and the colon), and whether it came from a declaration or a 2037definition (@samp{C} or @samp{F}, respectively, in the following 2038character). In the case of function definitions, a K&R-style list of 2039arguments followed by their declarations is also provided, inside 2040comments, after the declaration. 2041 2042@item -fallow-parameterless-variadic-functions 2043@opindex fallow-parameterless-variadic-functions 2044Accept variadic functions without named parameters. 2045 2046Although it is possible to define such a function, this is not very 2047useful as it is not possible to read the arguments. This is only 2048supported for C as this construct is allowed by C++. 2049 2050@item -fno-asm 2051@opindex fno-asm 2052Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 2053keyword, so that code can use these words as identifiers. You can use 2054the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 2055instead. @option{-ansi} implies @option{-fno-asm}. 2056 2057In C++, this switch only affects the @code{typeof} keyword, since 2058@code{asm} and @code{inline} are standard keywords. You may want to 2059use the @option{-fno-gnu-keywords} flag instead, which has the same 2060effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 2061switch only affects the @code{asm} and @code{typeof} keywords, since 2062@code{inline} is a standard keyword in ISO C99. 2063 2064@item -fno-builtin 2065@itemx -fno-builtin-@var{function} 2066@opindex fno-builtin 2067@cindex built-in functions 2068Don't recognize built-in functions that do not begin with 2069@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 2070functions provided by GCC}, for details of the functions affected, 2071including those which are not built-in functions when @option{-ansi} or 2072@option{-std} options for strict ISO C conformance are used because they 2073do not have an ISO standard meaning. 2074 2075GCC normally generates special code to handle certain built-in functions 2076more efficiently; for instance, calls to @code{alloca} may become single 2077instructions which adjust the stack directly, and calls to @code{memcpy} 2078may become inline copy loops. The resulting code is often both smaller 2079and faster, but since the function calls no longer appear as such, you 2080cannot set a breakpoint on those calls, nor can you change the behavior 2081of the functions by linking with a different library. In addition, 2082when a function is recognized as a built-in function, GCC may use 2083information about that function to warn about problems with calls to 2084that function, or to generate more efficient code, even if the 2085resulting code still contains calls to that function. For example, 2086warnings are given with @option{-Wformat} for bad calls to 2087@code{printf} when @code{printf} is built in and @code{strlen} is 2088known not to modify global memory. 2089 2090With the @option{-fno-builtin-@var{function}} option 2091only the built-in function @var{function} is 2092disabled. @var{function} must not begin with @samp{__builtin_}. If a 2093function is named that is not built-in in this version of GCC, this 2094option is ignored. There is no corresponding 2095@option{-fbuiltin-@var{function}} option; if you wish to enable 2096built-in functions selectively when using @option{-fno-builtin} or 2097@option{-ffreestanding}, you may define macros such as: 2098 2099@smallexample 2100#define abs(n) __builtin_abs ((n)) 2101#define strcpy(d, s) __builtin_strcpy ((d), (s)) 2102@end smallexample 2103 2104@item -fgimple 2105@opindex fgimple 2106 2107Enable parsing of function definitions marked with @code{__GIMPLE}. 2108This is an experimental feature that allows unit testing of GIMPLE 2109passes. 2110 2111@item -fhosted 2112@opindex fhosted 2113@cindex hosted environment 2114 2115Assert that compilation targets a hosted environment. This implies 2116@option{-fbuiltin}. A hosted environment is one in which the 2117entire standard library is available, and in which @code{main} has a return 2118type of @code{int}. Examples are nearly everything except a kernel. 2119This is equivalent to @option{-fno-freestanding}. 2120 2121@item -ffreestanding 2122@opindex ffreestanding 2123@cindex hosted environment 2124 2125Assert that compilation targets a freestanding environment. This 2126implies @option{-fno-builtin}. A freestanding environment 2127is one in which the standard library may not exist, and program startup may 2128not necessarily be at @code{main}. The most obvious example is an OS kernel. 2129This is equivalent to @option{-fno-hosted}. 2130 2131@xref{Standards,,Language Standards Supported by GCC}, for details of 2132freestanding and hosted environments. 2133 2134@item -fopenacc 2135@opindex fopenacc 2136@cindex OpenACC accelerator programming 2137Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and 2138@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the 2139compiler generates accelerated code according to the OpenACC Application 2140Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option 2141implies @option{-pthread}, and thus is only supported on targets that 2142have support for @option{-pthread}. 2143 2144@item -fopenacc-dim=@var{geom} 2145@opindex fopenacc-dim 2146@cindex OpenACC accelerator programming 2147Specify default compute dimensions for parallel offload regions that do 2148not explicitly specify. The @var{geom} value is a triple of 2149':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size 2150can be omitted, to use a target-specific default value. 2151 2152@item -fopenmp 2153@opindex fopenmp 2154@cindex OpenMP parallel 2155Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 2156@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 2157compiler generates parallel code according to the OpenMP Application 2158Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option 2159implies @option{-pthread}, and thus is only supported on targets that 2160have support for @option{-pthread}. @option{-fopenmp} implies 2161@option{-fopenmp-simd}. 2162 2163@item -fopenmp-simd 2164@opindex fopenmp-simd 2165@cindex OpenMP SIMD 2166@cindex SIMD 2167Enable handling of OpenMP's SIMD directives with @code{#pragma omp} 2168in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives 2169are ignored. 2170 2171@item -fgnu-tm 2172@opindex fgnu-tm 2173When the option @option{-fgnu-tm} is specified, the compiler 2174generates code for the Linux variant of Intel's current Transactional 2175Memory ABI specification document (Revision 1.1, May 6 2009). This is 2176an experimental feature whose interface may change in future versions 2177of GCC, as the official specification changes. Please note that not 2178all architectures are supported for this feature. 2179 2180For more information on GCC's support for transactional memory, 2181@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 2182Transactional Memory Library}. 2183 2184Note that the transactional memory feature is not supported with 2185non-call exceptions (@option{-fnon-call-exceptions}). 2186 2187@item -fms-extensions 2188@opindex fms-extensions 2189Accept some non-standard constructs used in Microsoft header files. 2190 2191In C++ code, this allows member names in structures to be similar 2192to previous types declarations. 2193 2194@smallexample 2195typedef int UOW; 2196struct ABC @{ 2197 UOW UOW; 2198@}; 2199@end smallexample 2200 2201Some cases of unnamed fields in structures and unions are only 2202accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 2203fields within structs/unions}, for details. 2204 2205Note that this option is off for all targets but x86 2206targets using ms-abi. 2207 2208@item -fplan9-extensions 2209@opindex fplan9-extensions 2210Accept some non-standard constructs used in Plan 9 code. 2211 2212This enables @option{-fms-extensions}, permits passing pointers to 2213structures with anonymous fields to functions that expect pointers to 2214elements of the type of the field, and permits referring to anonymous 2215fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 2216struct/union fields within structs/unions}, for details. This is only 2217supported for C, not C++. 2218 2219@item -fcond-mismatch 2220@opindex fcond-mismatch 2221Allow conditional expressions with mismatched types in the second and 2222third arguments. The value of such an expression is void. This option 2223is not supported for C++. 2224 2225@item -flax-vector-conversions 2226@opindex flax-vector-conversions 2227Allow implicit conversions between vectors with differing numbers of 2228elements and/or incompatible element types. This option should not be 2229used for new code. 2230 2231@item -funsigned-char 2232@opindex funsigned-char 2233Let the type @code{char} be unsigned, like @code{unsigned char}. 2234 2235Each kind of machine has a default for what @code{char} should 2236be. It is either like @code{unsigned char} by default or like 2237@code{signed char} by default. 2238 2239Ideally, a portable program should always use @code{signed char} or 2240@code{unsigned char} when it depends on the signedness of an object. 2241But many programs have been written to use plain @code{char} and 2242expect it to be signed, or expect it to be unsigned, depending on the 2243machines they were written for. This option, and its inverse, let you 2244make such a program work with the opposite default. 2245 2246The type @code{char} is always a distinct type from each of 2247@code{signed char} or @code{unsigned char}, even though its behavior 2248is always just like one of those two. 2249 2250@item -fsigned-char 2251@opindex fsigned-char 2252Let the type @code{char} be signed, like @code{signed char}. 2253 2254Note that this is equivalent to @option{-fno-unsigned-char}, which is 2255the negative form of @option{-funsigned-char}. Likewise, the option 2256@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 2257 2258@item -fsigned-bitfields 2259@itemx -funsigned-bitfields 2260@itemx -fno-signed-bitfields 2261@itemx -fno-unsigned-bitfields 2262@opindex fsigned-bitfields 2263@opindex funsigned-bitfields 2264@opindex fno-signed-bitfields 2265@opindex fno-unsigned-bitfields 2266These options control whether a bit-field is signed or unsigned, when the 2267declaration does not use either @code{signed} or @code{unsigned}. By 2268default, such a bit-field is signed, because this is consistent: the 2269basic integer types such as @code{int} are signed types. 2270 2271@item -fsso-struct=@var{endianness} 2272@opindex fsso-struct 2273Set the default scalar storage order of structures and unions to the 2274specified endianness. The accepted values are @samp{big-endian}, 2275@samp{little-endian} and @samp{native} for the native endianness of 2276the target (the default). This option is not supported for C++. 2277 2278@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate 2279code that is not binary compatible with code generated without it if the 2280specified endianness is not the native endianness of the target. 2281@end table 2282 2283@node C++ Dialect Options 2284@section Options Controlling C++ Dialect 2285 2286@cindex compiler options, C++ 2287@cindex C++ options, command-line 2288@cindex options, C++ 2289This section describes the command-line options that are only meaningful 2290for C++ programs. You can also use most of the GNU compiler options 2291regardless of what language your program is in. For example, you 2292might compile a file @file{firstClass.C} like this: 2293 2294@smallexample 2295g++ -g -fstrict-enums -O -c firstClass.C 2296@end smallexample 2297 2298@noindent 2299In this example, only @option{-fstrict-enums} is an option meant 2300only for C++ programs; you can use the other options with any 2301language supported by GCC@. 2302 2303Some options for compiling C programs, such as @option{-std}, are also 2304relevant for C++ programs. 2305@xref{C Dialect Options,,Options Controlling C Dialect}. 2306 2307Here is a list of options that are @emph{only} for compiling C++ programs: 2308 2309@table @gcctabopt 2310 2311@item -fabi-version=@var{n} 2312@opindex fabi-version 2313Use version @var{n} of the C++ ABI@. The default is version 0. 2314 2315Version 0 refers to the version conforming most closely to 2316the C++ ABI specification. Therefore, the ABI obtained using version 0 2317will change in different versions of G++ as ABI bugs are fixed. 2318 2319Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 2320 2321Version 2 is the version of the C++ ABI that first appeared in G++ 23223.4, and was the default through G++ 4.9. 2323 2324Version 3 corrects an error in mangling a constant address as a 2325template argument. 2326 2327Version 4, which first appeared in G++ 4.5, implements a standard 2328mangling for vector types. 2329 2330Version 5, which first appeared in G++ 4.6, corrects the mangling of 2331attribute const/volatile on function pointer types, decltype of a 2332plain decl, and use of a function parameter in the declaration of 2333another parameter. 2334 2335Version 6, which first appeared in G++ 4.7, corrects the promotion 2336behavior of C++11 scoped enums and the mangling of template argument 2337packs, const/static_cast, prefix ++ and --, and a class scope function 2338used as a template argument. 2339 2340Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a 2341builtin type and corrects the mangling of lambdas in default argument 2342scope. 2343 2344Version 8, which first appeared in G++ 4.9, corrects the substitution 2345behavior of function types with function-cv-qualifiers. 2346 2347Version 9, which first appeared in G++ 5.2, corrects the alignment of 2348@code{nullptr_t}. 2349 2350Version 10, which first appeared in G++ 6.1, adds mangling of 2351attributes that affect type identity, such as ia32 calling convention 2352attributes (e.g. @samp{stdcall}). 2353 2354Version 11, which first appeared in G++ 7, corrects the mangling of 2355sizeof... expressions and operator names. For multiple entities with 2356the same name within a function, that are declared in different scopes, 2357the mangling now changes starting with the twelfth occurrence. It also 2358implies @option{-fnew-inheriting-ctors}. 2359 2360Version 12, which first appeared in G++ 8, corrects the calling 2361conventions for empty classes on the x86_64 target and for classes 2362with only deleted copy/move constructors. It accidentally changes the 2363calling convention for classes with a deleted copy constructor and a 2364trivial move constructor. 2365 2366Version 13, which first appeared in G++ 8.2, fixes the accidental 2367change in version 12. 2368 2369See also @option{-Wabi}. 2370 2371@item -fabi-compat-version=@var{n} 2372@opindex fabi-compat-version 2373On targets that support strong aliases, G++ 2374works around mangling changes by creating an alias with the correct 2375mangled name when defining a symbol with an incorrect mangled name. 2376This switch specifies which ABI version to use for the alias. 2377 2378With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7 2379compatibility). If another ABI version is explicitly selected, this 2380defaults to 0. For compatibility with GCC versions 3.2 through 4.9, 2381use @option{-fabi-compat-version=2}. 2382 2383If this option is not provided but @option{-Wabi=@var{n}} is, that 2384version is used for compatibility aliases. If this option is provided 2385along with @option{-Wabi} (without the version), the version from this 2386option is used for the warning. 2387 2388@item -fno-access-control 2389@opindex fno-access-control 2390Turn off all access checking. This switch is mainly useful for working 2391around bugs in the access control code. 2392 2393@item -faligned-new 2394@opindex faligned-new 2395Enable support for C++17 @code{new} of types that require more 2396alignment than @code{void* ::operator new(std::size_t)} provides. A 2397numeric argument such as @code{-faligned-new=32} can be used to 2398specify how much alignment (in bytes) is provided by that function, 2399but few users will need to override the default of 2400@code{alignof(std::max_align_t)}. 2401 2402This flag is enabled by default for @option{-std=c++17}. 2403 2404@item -fcheck-new 2405@opindex fcheck-new 2406Check that the pointer returned by @code{operator new} is non-null 2407before attempting to modify the storage allocated. This check is 2408normally unnecessary because the C++ standard specifies that 2409@code{operator new} only returns @code{0} if it is declared 2410@code{throw()}, in which case the compiler always checks the 2411return value even without this option. In all other cases, when 2412@code{operator new} has a non-empty exception specification, memory 2413exhaustion is signalled by throwing @code{std::bad_alloc}. See also 2414@samp{new (nothrow)}. 2415 2416@item -fconcepts 2417@opindex fconcepts 2418Enable support for the C++ Extensions for Concepts Technical 2419Specification, ISO 19217 (2015), which allows code like 2420 2421@smallexample 2422template <class T> concept bool Addable = requires (T t) @{ t + t; @}; 2423template <Addable T> T add (T a, T b) @{ return a + b; @} 2424@end smallexample 2425 2426@item -fconstexpr-depth=@var{n} 2427@opindex fconstexpr-depth 2428Set the maximum nested evaluation depth for C++11 constexpr functions 2429to @var{n}. A limit is needed to detect endless recursion during 2430constant expression evaluation. The minimum specified by the standard 2431is 512. 2432 2433@item -fconstexpr-loop-limit=@var{n} 2434@opindex fconstexpr-loop-limit 2435Set the maximum number of iterations for a loop in C++14 constexpr functions 2436to @var{n}. A limit is needed to detect infinite loops during 2437constant expression evaluation. The default is 262144 (1<<18). 2438 2439@item -fdeduce-init-list 2440@opindex fdeduce-init-list 2441Enable deduction of a template type parameter as 2442@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@: 2443 2444@smallexample 2445template <class T> auto forward(T t) -> decltype (realfn (t)) 2446@{ 2447 return realfn (t); 2448@} 2449 2450void f() 2451@{ 2452 forward(@{1,2@}); // call forward<std::initializer_list<int>> 2453@} 2454@end smallexample 2455 2456This deduction was implemented as a possible extension to the 2457originally proposed semantics for the C++11 standard, but was not part 2458of the final standard, so it is disabled by default. This option is 2459deprecated, and may be removed in a future version of G++. 2460 2461@item -ffriend-injection 2462@opindex ffriend-injection 2463Inject friend functions into the enclosing namespace, so that they are 2464visible outside the scope of the class in which they are declared. 2465Friend functions were documented to work this way in the old Annotated 2466C++ Reference Manual. 2467However, in ISO C++ a friend function that is not declared 2468in an enclosing scope can only be found using argument dependent 2469lookup. GCC defaults to the standard behavior. 2470 2471This option is deprecated and will be removed. 2472 2473@item -fno-elide-constructors 2474@opindex fno-elide-constructors 2475The C++ standard allows an implementation to omit creating a temporary 2476that is only used to initialize another object of the same type. 2477Specifying this option disables that optimization, and forces G++ to 2478call the copy constructor in all cases. This option also causes G++ 2479to call trivial member functions which otherwise would be expanded inline. 2480 2481In C++17, the compiler is required to omit these temporaries, but this 2482option still affects trivial member functions. 2483 2484@item -fno-enforce-eh-specs 2485@opindex fno-enforce-eh-specs 2486Don't generate code to check for violation of exception specifications 2487at run time. This option violates the C++ standard, but may be useful 2488for reducing code size in production builds, much like defining 2489@code{NDEBUG}. This does not give user code permission to throw 2490exceptions in violation of the exception specifications; the compiler 2491still optimizes based on the specifications, so throwing an 2492unexpected exception results in undefined behavior at run time. 2493 2494@item -fextern-tls-init 2495@itemx -fno-extern-tls-init 2496@opindex fextern-tls-init 2497@opindex fno-extern-tls-init 2498The C++11 and OpenMP standards allow @code{thread_local} and 2499@code{threadprivate} variables to have dynamic (runtime) 2500initialization. To support this, any use of such a variable goes 2501through a wrapper function that performs any necessary initialization. 2502When the use and definition of the variable are in the same 2503translation unit, this overhead can be optimized away, but when the 2504use is in a different translation unit there is significant overhead 2505even if the variable doesn't actually need dynamic initialization. If 2506the programmer can be sure that no use of the variable in a 2507non-defining TU needs to trigger dynamic initialization (either 2508because the variable is statically initialized, or a use of the 2509variable in the defining TU will be executed before any uses in 2510another TU), they can avoid this overhead with the 2511@option{-fno-extern-tls-init} option. 2512 2513On targets that support symbol aliases, the default is 2514@option{-fextern-tls-init}. On targets that do not support symbol 2515aliases, the default is @option{-fno-extern-tls-init}. 2516 2517@item -ffor-scope 2518@itemx -fno-for-scope 2519@opindex ffor-scope 2520@opindex fno-for-scope 2521If @option{-ffor-scope} is specified, the scope of variables declared in 2522a @i{for-init-statement} is limited to the @code{for} loop itself, 2523as specified by the C++ standard. 2524If @option{-fno-for-scope} is specified, the scope of variables declared in 2525a @i{for-init-statement} extends to the end of the enclosing scope, 2526as was the case in old versions of G++, and other (traditional) 2527implementations of C++. 2528 2529This option is deprecated and the associated non-standard 2530functionality will be removed. 2531 2532@item -fno-gnu-keywords 2533@opindex fno-gnu-keywords 2534Do not recognize @code{typeof} as a keyword, so that code can use this 2535word as an identifier. You can use the keyword @code{__typeof__} instead. 2536This option is implied by the strict ISO C++ dialects: @option{-ansi}, 2537@option{-std=c++98}, @option{-std=c++11}, etc. 2538 2539@item -fno-implicit-templates 2540@opindex fno-implicit-templates 2541Never emit code for non-inline templates that are instantiated 2542implicitly (i.e.@: by use); only emit code for explicit instantiations. 2543@xref{Template Instantiation}, for more information. 2544 2545@item -fno-implicit-inline-templates 2546@opindex fno-implicit-inline-templates 2547Don't emit code for implicit instantiations of inline templates, either. 2548The default is to handle inlines differently so that compiles with and 2549without optimization need the same set of explicit instantiations. 2550 2551@item -fno-implement-inlines 2552@opindex fno-implement-inlines 2553To save space, do not emit out-of-line copies of inline functions 2554controlled by @code{#pragma implementation}. This causes linker 2555errors if these functions are not inlined everywhere they are called. 2556 2557@item -fms-extensions 2558@opindex fms-extensions 2559Disable Wpedantic warnings about constructs used in MFC, such as implicit 2560int and getting a pointer to member function via non-standard syntax. 2561 2562@item -fnew-inheriting-ctors 2563@opindex fnew-inheriting-ctors 2564Enable the P0136 adjustment to the semantics of C++11 constructor 2565inheritance. This is part of C++17 but also considered to be a Defect 2566Report against C++11 and C++14. This flag is enabled by default 2567unless @option{-fabi-version=10} or lower is specified. 2568 2569@item -fnew-ttp-matching 2570@opindex fnew-ttp-matching 2571Enable the P0522 resolution to Core issue 150, template template 2572parameters and default arguments: this allows a template with default 2573template arguments as an argument for a template template parameter 2574with fewer template parameters. This flag is enabled by default for 2575@option{-std=c++17}. 2576 2577@item -fno-nonansi-builtins 2578@opindex fno-nonansi-builtins 2579Disable built-in declarations of functions that are not mandated by 2580ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 2581@code{index}, @code{bzero}, @code{conjf}, and other related functions. 2582 2583@item -fnothrow-opt 2584@opindex fnothrow-opt 2585Treat a @code{throw()} exception specification as if it were a 2586@code{noexcept} specification to reduce or eliminate the text size 2587overhead relative to a function with no exception specification. If 2588the function has local variables of types with non-trivial 2589destructors, the exception specification actually makes the 2590function smaller because the EH cleanups for those variables can be 2591optimized away. The semantic effect is that an exception thrown out of 2592a function with such an exception specification results in a call 2593to @code{terminate} rather than @code{unexpected}. 2594 2595@item -fno-operator-names 2596@opindex fno-operator-names 2597Do not treat the operator name keywords @code{and}, @code{bitand}, 2598@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 2599synonyms as keywords. 2600 2601@item -fno-optional-diags 2602@opindex fno-optional-diags 2603Disable diagnostics that the standard says a compiler does not need to 2604issue. Currently, the only such diagnostic issued by G++ is the one for 2605a name having multiple meanings within a class. 2606 2607@item -fpermissive 2608@opindex fpermissive 2609Downgrade some diagnostics about nonconformant code from errors to 2610warnings. Thus, using @option{-fpermissive} allows some 2611nonconforming code to compile. 2612 2613@item -fno-pretty-templates 2614@opindex fno-pretty-templates 2615When an error message refers to a specialization of a function 2616template, the compiler normally prints the signature of the 2617template followed by the template arguments and any typedefs or 2618typenames in the signature (e.g. @code{void f(T) [with T = int]} 2619rather than @code{void f(int)}) so that it's clear which template is 2620involved. When an error message refers to a specialization of a class 2621template, the compiler omits any template arguments that match 2622the default template arguments for that template. If either of these 2623behaviors make it harder to understand the error message rather than 2624easier, you can use @option{-fno-pretty-templates} to disable them. 2625 2626@item -frepo 2627@opindex frepo 2628Enable automatic template instantiation at link time. This option also 2629implies @option{-fno-implicit-templates}. @xref{Template 2630Instantiation}, for more information. 2631 2632@item -fno-rtti 2633@opindex fno-rtti 2634Disable generation of information about every class with virtual 2635functions for use by the C++ run-time type identification features 2636(@code{dynamic_cast} and @code{typeid}). If you don't use those parts 2637of the language, you can save some space by using this flag. Note that 2638exception handling uses the same information, but G++ generates it as 2639needed. The @code{dynamic_cast} operator can still be used for casts that 2640do not require run-time type information, i.e.@: casts to @code{void *} or to 2641unambiguous base classes. 2642 2643@item -fsized-deallocation 2644@opindex fsized-deallocation 2645Enable the built-in global declarations 2646@smallexample 2647void operator delete (void *, std::size_t) noexcept; 2648void operator delete[] (void *, std::size_t) noexcept; 2649@end smallexample 2650as introduced in C++14. This is useful for user-defined replacement 2651deallocation functions that, for example, use the size of the object 2652to make deallocation faster. Enabled by default under 2653@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} 2654warns about places that might want to add a definition. 2655 2656@item -fstrict-enums 2657@opindex fstrict-enums 2658Allow the compiler to optimize using the assumption that a value of 2659enumerated type can only be one of the values of the enumeration (as 2660defined in the C++ standard; basically, a value that can be 2661represented in the minimum number of bits needed to represent all the 2662enumerators). This assumption may not be valid if the program uses a 2663cast to convert an arbitrary integer value to the enumerated type. 2664 2665@item -fstrong-eval-order 2666@opindex fstrong-eval-order 2667Evaluate member access, array subscripting, and shift expressions in 2668left-to-right order, and evaluate assignment in right-to-left order, 2669as adopted for C++17. Enabled by default with @option{-std=c++17}. 2670@option{-fstrong-eval-order=some} enables just the ordering of member 2671access and shift expressions, and is the default without 2672@option{-std=c++17}. 2673 2674@item -ftemplate-backtrace-limit=@var{n} 2675@opindex ftemplate-backtrace-limit 2676Set the maximum number of template instantiation notes for a single 2677warning or error to @var{n}. The default value is 10. 2678 2679@item -ftemplate-depth=@var{n} 2680@opindex ftemplate-depth 2681Set the maximum instantiation depth for template classes to @var{n}. 2682A limit on the template instantiation depth is needed to detect 2683endless recursions during template class instantiation. ANSI/ISO C++ 2684conforming programs must not rely on a maximum depth greater than 17 2685(changed to 1024 in C++11). The default value is 900, as the compiler 2686can run out of stack space before hitting 1024 in some situations. 2687 2688@item -fno-threadsafe-statics 2689@opindex fno-threadsafe-statics 2690Do not emit the extra code to use the routines specified in the C++ 2691ABI for thread-safe initialization of local statics. You can use this 2692option to reduce code size slightly in code that doesn't need to be 2693thread-safe. 2694 2695@item -fuse-cxa-atexit 2696@opindex fuse-cxa-atexit 2697Register destructors for objects with static storage duration with the 2698@code{__cxa_atexit} function rather than the @code{atexit} function. 2699This option is required for fully standards-compliant handling of static 2700destructors, but only works if your C library supports 2701@code{__cxa_atexit}. 2702 2703@item -fno-use-cxa-get-exception-ptr 2704@opindex fno-use-cxa-get-exception-ptr 2705Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 2706causes @code{std::uncaught_exception} to be incorrect, but is necessary 2707if the runtime routine is not available. 2708 2709@item -fvisibility-inlines-hidden 2710@opindex fvisibility-inlines-hidden 2711This switch declares that the user does not attempt to compare 2712pointers to inline functions or methods where the addresses of the two functions 2713are taken in different shared objects. 2714 2715The effect of this is that GCC may, effectively, mark inline methods with 2716@code{__attribute__ ((visibility ("hidden")))} so that they do not 2717appear in the export table of a DSO and do not require a PLT indirection 2718when used within the DSO@. Enabling this option can have a dramatic effect 2719on load and link times of a DSO as it massively reduces the size of the 2720dynamic export table when the library makes heavy use of templates. 2721 2722The behavior of this switch is not quite the same as marking the 2723methods as hidden directly, because it does not affect static variables 2724local to the function or cause the compiler to deduce that 2725the function is defined in only one shared object. 2726 2727You may mark a method as having a visibility explicitly to negate the 2728effect of the switch for that method. For example, if you do want to 2729compare pointers to a particular inline method, you might mark it as 2730having default visibility. Marking the enclosing class with explicit 2731visibility has no effect. 2732 2733Explicitly instantiated inline methods are unaffected by this option 2734as their linkage might otherwise cross a shared library boundary. 2735@xref{Template Instantiation}. 2736 2737@item -fvisibility-ms-compat 2738@opindex fvisibility-ms-compat 2739This flag attempts to use visibility settings to make GCC's C++ 2740linkage model compatible with that of Microsoft Visual Studio. 2741 2742The flag makes these changes to GCC's linkage model: 2743 2744@enumerate 2745@item 2746It sets the default visibility to @code{hidden}, like 2747@option{-fvisibility=hidden}. 2748 2749@item 2750Types, but not their members, are not hidden by default. 2751 2752@item 2753The One Definition Rule is relaxed for types without explicit 2754visibility specifications that are defined in more than one 2755shared object: those declarations are permitted if they are 2756permitted when this option is not used. 2757@end enumerate 2758 2759In new code it is better to use @option{-fvisibility=hidden} and 2760export those classes that are intended to be externally visible. 2761Unfortunately it is possible for code to rely, perhaps accidentally, 2762on the Visual Studio behavior. 2763 2764Among the consequences of these changes are that static data members 2765of the same type with the same name but defined in different shared 2766objects are different, so changing one does not change the other; 2767and that pointers to function members defined in different shared 2768objects may not compare equal. When this flag is given, it is a 2769violation of the ODR to define types with the same name differently. 2770 2771@item -fno-weak 2772@opindex fno-weak 2773Do not use weak symbol support, even if it is provided by the linker. 2774By default, G++ uses weak symbols if they are available. This 2775option exists only for testing, and should not be used by end-users; 2776it results in inferior code and has no benefits. This option may 2777be removed in a future release of G++. 2778 2779@item -nostdinc++ 2780@opindex nostdinc++ 2781Do not search for header files in the standard directories specific to 2782C++, but do still search the other standard directories. (This option 2783is used when building the C++ library.) 2784@end table 2785 2786In addition, these optimization, warning, and code generation options 2787have meanings only for C++ programs: 2788 2789@table @gcctabopt 2790@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 2791@opindex Wabi 2792@opindex Wno-abi 2793Warn when G++ it generates code that is probably not compatible with 2794the vendor-neutral C++ ABI@. Since G++ now defaults to updating the 2795ABI with each major release, normally @option{-Wabi} will warn only if 2796there is a check added later in a release series for an ABI issue 2797discovered since the initial release. @option{-Wabi} will warn about 2798more things if an older ABI version is selected (with 2799@option{-fabi-version=@var{n}}). 2800 2801@option{-Wabi} can also be used with an explicit version number to 2802warn about compatibility with a particular @option{-fabi-version} 2803level, e.g. @option{-Wabi=2} to warn about changes relative to 2804@option{-fabi-version=2}. 2805 2806If an explicit version number is provided and 2807@option{-fabi-compat-version} is not specified, the version number 2808from this option is used for compatibility aliases. If no explicit 2809version number is provided with this option, but 2810@option{-fabi-compat-version} is specified, that version number is 2811used for ABI warnings. 2812 2813Although an effort has been made to warn about 2814all such cases, there are probably some cases that are not warned about, 2815even though G++ is generating incompatible code. There may also be 2816cases where warnings are emitted even though the code that is generated 2817is compatible. 2818 2819You should rewrite your code to avoid these warnings if you are 2820concerned about the fact that code generated by G++ may not be binary 2821compatible with code generated by other compilers. 2822 2823Known incompatibilities in @option{-fabi-version=2} (which was the 2824default from GCC 3.4 to 4.9) include: 2825 2826@itemize @bullet 2827 2828@item 2829A template with a non-type template parameter of reference type was 2830mangled incorrectly: 2831@smallexample 2832extern int N; 2833template <int &> struct S @{@}; 2834void n (S<N>) @{2@} 2835@end smallexample 2836 2837This was fixed in @option{-fabi-version=3}. 2838 2839@item 2840SIMD vector types declared using @code{__attribute ((vector_size))} were 2841mangled in a non-standard way that does not allow for overloading of 2842functions taking vectors of different sizes. 2843 2844The mangling was changed in @option{-fabi-version=4}. 2845 2846@item 2847@code{__attribute ((const))} and @code{noreturn} were mangled as type 2848qualifiers, and @code{decltype} of a plain declaration was folded away. 2849 2850These mangling issues were fixed in @option{-fabi-version=5}. 2851 2852@item 2853Scoped enumerators passed as arguments to a variadic function are 2854promoted like unscoped enumerators, causing @code{va_arg} to complain. 2855On most targets this does not actually affect the parameter passing 2856ABI, as there is no way to pass an argument smaller than @code{int}. 2857 2858Also, the ABI changed the mangling of template argument packs, 2859@code{const_cast}, @code{static_cast}, prefix increment/decrement, and 2860a class scope function used as a template argument. 2861 2862These issues were corrected in @option{-fabi-version=6}. 2863 2864@item 2865Lambdas in default argument scope were mangled incorrectly, and the 2866ABI changed the mangling of @code{nullptr_t}. 2867 2868These issues were corrected in @option{-fabi-version=7}. 2869 2870@item 2871When mangling a function type with function-cv-qualifiers, the 2872un-qualified function type was incorrectly treated as a substitution 2873candidate. 2874 2875This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. 2876 2877@item 2878@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to 2879unaligned accesses. Note that this did not affect the ABI of a 2880function with a @code{nullptr_t} parameter, as parameters have a 2881minimum alignment. 2882 2883This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. 2884 2885@item 2886Target-specific attributes that affect the identity of a type, such as 2887ia32 calling conventions on a function type (stdcall, regparm, etc.), 2888did not affect the mangled name, leading to name collisions when 2889function pointers were used as template arguments. 2890 2891This was fixed in @option{-fabi-version=10}, the default for GCC 6.1. 2892 2893@end itemize 2894 2895It also warns about psABI-related changes. The known psABI changes at this 2896point include: 2897 2898@itemize @bullet 2899 2900@item 2901For SysV/x86-64, unions with @code{long double} members are 2902passed in memory as specified in psABI. For example: 2903 2904@smallexample 2905union U @{ 2906 long double ld; 2907 int i; 2908@}; 2909@end smallexample 2910 2911@noindent 2912@code{union U} is always passed in memory. 2913 2914@end itemize 2915 2916@item -Wabi-tag @r{(C++ and Objective-C++ only)} 2917@opindex Wabi-tag 2918@opindex -Wabi-tag 2919Warn when a type with an ABI tag is used in a context that does not 2920have that ABI tag. See @ref{C++ Attributes} for more information 2921about ABI tags. 2922 2923@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 2924@opindex Wctor-dtor-privacy 2925@opindex Wno-ctor-dtor-privacy 2926Warn when a class seems unusable because all the constructors or 2927destructors in that class are private, and it has neither friends nor 2928public static member functions. Also warn if there are no non-private 2929methods, and there's at least one private member function that isn't 2930a constructor or destructor. 2931 2932@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 2933@opindex Wdelete-non-virtual-dtor 2934@opindex Wno-delete-non-virtual-dtor 2935Warn when @code{delete} is used to destroy an instance of a class that 2936has virtual functions and non-virtual destructor. It is unsafe to delete 2937an instance of a derived class through a pointer to a base class if the 2938base class does not have a virtual destructor. This warning is enabled 2939by @option{-Wall}. 2940 2941@item -Wliteral-suffix @r{(C++ and Objective-C++ only)} 2942@opindex Wliteral-suffix 2943@opindex Wno-literal-suffix 2944Warn when a string or character literal is followed by a ud-suffix which does 2945not begin with an underscore. As a conforming extension, GCC treats such 2946suffixes as separate preprocessing tokens in order to maintain backwards 2947compatibility with code that uses formatting macros from @code{<inttypes.h>}. 2948For example: 2949 2950@smallexample 2951#define __STDC_FORMAT_MACROS 2952#include <inttypes.h> 2953#include <stdio.h> 2954 2955int main() @{ 2956 int64_t i64 = 123; 2957 printf("My int64: %" PRId64"\n", i64); 2958@} 2959@end smallexample 2960 2961In this case, @code{PRId64} is treated as a separate preprocessing token. 2962 2963Additionally, warn when a user-defined literal operator is declared with 2964a literal suffix identifier that doesn't begin with an underscore. Literal 2965suffix identifiers that don't begin with an underscore are reserved for 2966future standardization. 2967 2968This warning is enabled by default. 2969 2970@item -Wlto-type-mismatch 2971@opindex Wlto-type-mismatch 2972@opindex Wno-lto-type-mismatch 2973 2974During the link-time optimization warn about type mismatches in 2975global declarations from different compilation units. 2976Requires @option{-flto} to be enabled. Enabled by default. 2977 2978@item -Wno-narrowing @r{(C++ and Objective-C++ only)} 2979@opindex Wnarrowing 2980@opindex Wno-narrowing 2981For C++11 and later standards, narrowing conversions are diagnosed by default, 2982as required by the standard. A narrowing conversion from a constant produces 2983an error, and a narrowing conversion from a non-constant produces a warning, 2984but @option{-Wno-narrowing} suppresses the diagnostic. 2985Note that this does not affect the meaning of well-formed code; 2986narrowing conversions are still considered ill-formed in SFINAE contexts. 2987 2988With @option{-Wnarrowing} in C++98, warn when a narrowing 2989conversion prohibited by C++11 occurs within 2990@samp{@{ @}}, e.g. 2991 2992@smallexample 2993int i = @{ 2.2 @}; // error: narrowing from double to int 2994@end smallexample 2995 2996This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 2997 2998@item -Wnoexcept @r{(C++ and Objective-C++ only)} 2999@opindex Wnoexcept 3000@opindex Wno-noexcept 3001Warn when a noexcept-expression evaluates to false because of a call 3002to a function that does not have a non-throwing exception 3003specification (i.e. @code{throw()} or @code{noexcept}) but is known by 3004the compiler to never throw an exception. 3005 3006@item -Wnoexcept-type @r{(C++ and Objective-C++ only)} 3007@opindex Wnoexcept-type 3008@opindex Wno-noexcept-type 3009Warn if the C++17 feature making @code{noexcept} part of a function 3010type changes the mangled name of a symbol relative to C++14. Enabled 3011by @option{-Wabi} and @option{-Wc++17-compat}. 3012 3013As an example: 3014 3015@smallexample 3016template <class T> void f(T t) @{ t(); @}; 3017void g() noexcept; 3018void h() @{ f(g); @} 3019@end smallexample 3020 3021@noindent 3022In C++14, @code{f} calls @code{f<void(*)()>}, but in 3023C++17 it calls @code{f<void(*)()noexcept>}. 3024 3025@item -Wclass-memaccess @r{(C++ and Objective-C++ only)} 3026@opindex Wclass-memaccess 3027Warn when the destination of a call to a raw memory function such as 3028@code{memset} or @code{memcpy} is an object of class type, and when writing 3029into such an object might bypass the class non-trivial or deleted constructor 3030or copy assignment, violate const-correctness or encapsulation, or corrupt 3031virtual table pointers. Modifying the representation of such objects may 3032violate invariants maintained by member functions of the class. For example, 3033the call to @code{memset} below is undefined because it modifies a non-trivial 3034class object and is, therefore, diagnosed. The safe way to either initialize 3035or clear the storage of objects of such types is by using the appropriate 3036constructor or assignment operator, if one is available. 3037@smallexample 3038std::string str = "abc"; 3039memset (&str, 0, sizeof str); 3040@end smallexample 3041The @option{-Wclass-memaccess} option is enabled by @option{-Wall}. 3042Explicitly casting the pointer to the class object to @code{void *} or 3043to a type that can be safely accessed by the raw memory function suppresses 3044the warning. 3045 3046@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 3047@opindex Wnon-virtual-dtor 3048@opindex Wno-non-virtual-dtor 3049Warn when a class has virtual functions and an accessible non-virtual 3050destructor itself or in an accessible polymorphic base class, in which 3051case it is possible but unsafe to delete an instance of a derived 3052class through a pointer to the class itself or base class. This 3053warning is automatically enabled if @option{-Weffc++} is specified. 3054 3055@item -Wregister @r{(C++ and Objective-C++ only)} 3056@opindex Wregister 3057@opindex Wno-register 3058Warn on uses of the @code{register} storage class specifier, except 3059when it is part of the GNU @ref{Explicit Register Variables} extension. 3060The use of the @code{register} keyword as storage class specifier has 3061been deprecated in C++11 and removed in C++17. 3062Enabled by default with @option{-std=c++17}. 3063 3064@item -Wreorder @r{(C++ and Objective-C++ only)} 3065@opindex Wreorder 3066@opindex Wno-reorder 3067@cindex reordering, warning 3068@cindex warning for reordering of member initializers 3069Warn when the order of member initializers given in the code does not 3070match the order in which they must be executed. For instance: 3071 3072@smallexample 3073struct A @{ 3074 int i; 3075 int j; 3076 A(): j (0), i (1) @{ @} 3077@}; 3078@end smallexample 3079 3080@noindent 3081The compiler rearranges the member initializers for @code{i} 3082and @code{j} to match the declaration order of the members, emitting 3083a warning to that effect. This warning is enabled by @option{-Wall}. 3084 3085@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 3086@opindex fext-numeric-literals 3087@opindex fno-ext-numeric-literals 3088Accept imaginary, fixed-point, or machine-defined 3089literal number suffixes as GNU extensions. 3090When this option is turned off these suffixes are treated 3091as C++11 user-defined literal numeric suffixes. 3092This is on by default for all pre-C++11 dialects and all GNU dialects: 3093@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 3094@option{-std=gnu++14}. 3095This option is off by default 3096for ISO C++11 onwards (@option{-std=c++11}, ...). 3097@end table 3098 3099The following @option{-W@dots{}} options are not affected by @option{-Wall}. 3100 3101@table @gcctabopt 3102@item -Weffc++ @r{(C++ and Objective-C++ only)} 3103@opindex Weffc++ 3104@opindex Wno-effc++ 3105Warn about violations of the following style guidelines from Scott Meyers' 3106@cite{Effective C++} series of books: 3107 3108@itemize @bullet 3109@item 3110Define a copy constructor and an assignment operator for classes 3111with dynamically-allocated memory. 3112 3113@item 3114Prefer initialization to assignment in constructors. 3115 3116@item 3117Have @code{operator=} return a reference to @code{*this}. 3118 3119@item 3120Don't try to return a reference when you must return an object. 3121 3122@item 3123Distinguish between prefix and postfix forms of increment and 3124decrement operators. 3125 3126@item 3127Never overload @code{&&}, @code{||}, or @code{,}. 3128 3129@end itemize 3130 3131This option also enables @option{-Wnon-virtual-dtor}, which is also 3132one of the effective C++ recommendations. However, the check is 3133extended to warn about the lack of virtual destructor in accessible 3134non-polymorphic bases classes too. 3135 3136When selecting this option, be aware that the standard library 3137headers do not obey all of these guidelines; use @samp{grep -v} 3138to filter out those warnings. 3139 3140@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 3141@opindex Wstrict-null-sentinel 3142@opindex Wno-strict-null-sentinel 3143Warn about the use of an uncasted @code{NULL} as sentinel. When 3144compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 3145to @code{__null}. Although it is a null pointer constant rather than a 3146null pointer, it is guaranteed to be of the same size as a pointer. 3147But this use is not portable across different compilers. 3148 3149@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 3150@opindex Wno-non-template-friend 3151@opindex Wnon-template-friend 3152Disable warnings when non-template friend functions are declared 3153within a template. In very old versions of GCC that predate implementation 3154of the ISO standard, declarations such as 3155@samp{friend int foo(int)}, where the name of the friend is an unqualified-id, 3156could be interpreted as a particular specialization of a template 3157function; the warning exists to diagnose compatibility problems, 3158and is enabled by default. 3159 3160@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 3161@opindex Wold-style-cast 3162@opindex Wno-old-style-cast 3163Warn if an old-style (C-style) cast to a non-void type is used within 3164a C++ program. The new-style casts (@code{dynamic_cast}, 3165@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are 3166less vulnerable to unintended effects and much easier to search for. 3167 3168@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 3169@opindex Woverloaded-virtual 3170@opindex Wno-overloaded-virtual 3171@cindex overloaded virtual function, warning 3172@cindex warning for overloaded virtual function 3173Warn when a function declaration hides virtual functions from a 3174base class. For example, in: 3175 3176@smallexample 3177struct A @{ 3178 virtual void f(); 3179@}; 3180 3181struct B: public A @{ 3182 void f(int); 3183@}; 3184@end smallexample 3185 3186the @code{A} class version of @code{f} is hidden in @code{B}, and code 3187like: 3188 3189@smallexample 3190B* b; 3191b->f(); 3192@end smallexample 3193 3194@noindent 3195fails to compile. 3196 3197@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 3198@opindex Wno-pmf-conversions 3199@opindex Wpmf-conversions 3200Disable the diagnostic for converting a bound pointer to member function 3201to a plain pointer. 3202 3203@item -Wsign-promo @r{(C++ and Objective-C++ only)} 3204@opindex Wsign-promo 3205@opindex Wno-sign-promo 3206Warn when overload resolution chooses a promotion from unsigned or 3207enumerated type to a signed type, over a conversion to an unsigned type of 3208the same size. Previous versions of G++ tried to preserve 3209unsignedness, but the standard mandates the current behavior. 3210 3211@item -Wtemplates @r{(C++ and Objective-C++ only)} 3212@opindex Wtemplates 3213Warn when a primary template declaration is encountered. Some coding 3214rules disallow templates, and this may be used to enforce that rule. 3215The warning is inactive inside a system header file, such as the STL, so 3216one can still use the STL. One may also instantiate or specialize 3217templates. 3218 3219@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)} 3220@opindex Wmultiple-inheritance 3221Warn when a class is defined with multiple direct base classes. Some 3222coding rules disallow multiple inheritance, and this may be used to 3223enforce that rule. The warning is inactive inside a system header file, 3224such as the STL, so one can still use the STL. One may also define 3225classes that indirectly use multiple inheritance. 3226 3227@item -Wvirtual-inheritance 3228@opindex Wvirtual-inheritance 3229Warn when a class is defined with a virtual direct base class. Some 3230coding rules disallow multiple inheritance, and this may be used to 3231enforce that rule. The warning is inactive inside a system header file, 3232such as the STL, so one can still use the STL. One may also define 3233classes that indirectly use virtual inheritance. 3234 3235@item -Wnamespaces 3236@opindex Wnamespaces 3237Warn when a namespace definition is opened. Some coding rules disallow 3238namespaces, and this may be used to enforce that rule. The warning is 3239inactive inside a system header file, such as the STL, so one can still 3240use the STL. One may also use using directives and qualified names. 3241 3242@item -Wno-terminate @r{(C++ and Objective-C++ only)} 3243@opindex Wterminate 3244@opindex Wno-terminate 3245Disable the warning about a throw-expression that will immediately 3246result in a call to @code{terminate}. 3247@end table 3248 3249@node Objective-C and Objective-C++ Dialect Options 3250@section Options Controlling Objective-C and Objective-C++ Dialects 3251 3252@cindex compiler options, Objective-C and Objective-C++ 3253@cindex Objective-C and Objective-C++ options, command-line 3254@cindex options, Objective-C and Objective-C++ 3255(NOTE: This manual does not describe the Objective-C and Objective-C++ 3256languages themselves. @xref{Standards,,Language Standards 3257Supported by GCC}, for references.) 3258 3259This section describes the command-line options that are only meaningful 3260for Objective-C and Objective-C++ programs. You can also use most of 3261the language-independent GNU compiler options. 3262For example, you might compile a file @file{some_class.m} like this: 3263 3264@smallexample 3265gcc -g -fgnu-runtime -O -c some_class.m 3266@end smallexample 3267 3268@noindent 3269In this example, @option{-fgnu-runtime} is an option meant only for 3270Objective-C and Objective-C++ programs; you can use the other options with 3271any language supported by GCC@. 3272 3273Note that since Objective-C is an extension of the C language, Objective-C 3274compilations may also use options specific to the C front-end (e.g., 3275@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 3276C++-specific options (e.g., @option{-Wabi}). 3277 3278Here is a list of options that are @emph{only} for compiling Objective-C 3279and Objective-C++ programs: 3280 3281@table @gcctabopt 3282@item -fconstant-string-class=@var{class-name} 3283@opindex fconstant-string-class 3284Use @var{class-name} as the name of the class to instantiate for each 3285literal string specified with the syntax @code{@@"@dots{}"}. The default 3286class name is @code{NXConstantString} if the GNU runtime is being used, and 3287@code{NSConstantString} if the NeXT runtime is being used (see below). The 3288@option{-fconstant-cfstrings} option, if also present, overrides the 3289@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals 3290to be laid out as constant CoreFoundation strings. 3291 3292@item -fgnu-runtime 3293@opindex fgnu-runtime 3294Generate object code compatible with the standard GNU Objective-C 3295runtime. This is the default for most types of systems. 3296 3297@item -fnext-runtime 3298@opindex fnext-runtime 3299Generate output compatible with the NeXT runtime. This is the default 3300for NeXT-based systems, including Darwin and Mac OS X@. The macro 3301@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 3302used. 3303 3304@item -fno-nil-receivers 3305@opindex fno-nil-receivers 3306Assume that all Objective-C message dispatches (@code{[receiver 3307message:arg]}) in this translation unit ensure that the receiver is 3308not @code{nil}. This allows for more efficient entry points in the 3309runtime to be used. This option is only available in conjunction with 3310the NeXT runtime and ABI version 0 or 1. 3311 3312@item -fobjc-abi-version=@var{n} 3313@opindex fobjc-abi-version 3314Use version @var{n} of the Objective-C ABI for the selected runtime. 3315This option is currently supported only for the NeXT runtime. In that 3316case, Version 0 is the traditional (32-bit) ABI without support for 3317properties and other Objective-C 2.0 additions. Version 1 is the 3318traditional (32-bit) ABI with support for properties and other 3319Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 3320nothing is specified, the default is Version 0 on 32-bit target 3321machines, and Version 2 on 64-bit target machines. 3322 3323@item -fobjc-call-cxx-cdtors 3324@opindex fobjc-call-cxx-cdtors 3325For each Objective-C class, check if any of its instance variables is a 3326C++ object with a non-trivial default constructor. If so, synthesize a 3327special @code{- (id) .cxx_construct} instance method which runs 3328non-trivial default constructors on any such instance variables, in order, 3329and then return @code{self}. Similarly, check if any instance variable 3330is a C++ object with a non-trivial destructor, and if so, synthesize a 3331special @code{- (void) .cxx_destruct} method which runs 3332all such default destructors, in reverse order. 3333 3334The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 3335methods thusly generated only operate on instance variables 3336declared in the current Objective-C class, and not those inherited 3337from superclasses. It is the responsibility of the Objective-C 3338runtime to invoke all such methods in an object's inheritance 3339hierarchy. The @code{- (id) .cxx_construct} methods are invoked 3340by the runtime immediately after a new object instance is allocated; 3341the @code{- (void) .cxx_destruct} methods are invoked immediately 3342before the runtime deallocates an object instance. 3343 3344As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 3345support for invoking the @code{- (id) .cxx_construct} and 3346@code{- (void) .cxx_destruct} methods. 3347 3348@item -fobjc-direct-dispatch 3349@opindex fobjc-direct-dispatch 3350Allow fast jumps to the message dispatcher. On Darwin this is 3351accomplished via the comm page. 3352 3353@item -fobjc-exceptions 3354@opindex fobjc-exceptions 3355Enable syntactic support for structured exception handling in 3356Objective-C, similar to what is offered by C++. This option 3357is required to use the Objective-C keywords @code{@@try}, 3358@code{@@throw}, @code{@@catch}, @code{@@finally} and 3359@code{@@synchronized}. This option is available with both the GNU 3360runtime and the NeXT runtime (but not available in conjunction with 3361the NeXT runtime on Mac OS X 10.2 and earlier). 3362 3363@item -fobjc-gc 3364@opindex fobjc-gc 3365Enable garbage collection (GC) in Objective-C and Objective-C++ 3366programs. This option is only available with the NeXT runtime; the 3367GNU runtime has a different garbage collection implementation that 3368does not require special compiler flags. 3369 3370@item -fobjc-nilcheck 3371@opindex fobjc-nilcheck 3372For the NeXT runtime with version 2 of the ABI, check for a nil 3373receiver in method invocations before doing the actual method call. 3374This is the default and can be disabled using 3375@option{-fno-objc-nilcheck}. Class methods and super calls are never 3376checked for nil in this way no matter what this flag is set to. 3377Currently this flag does nothing when the GNU runtime, or an older 3378version of the NeXT runtime ABI, is used. 3379 3380@item -fobjc-std=objc1 3381@opindex fobjc-std 3382Conform to the language syntax of Objective-C 1.0, the language 3383recognized by GCC 4.0. This only affects the Objective-C additions to 3384the C/C++ language; it does not affect conformance to C/C++ standards, 3385which is controlled by the separate C/C++ dialect option flags. When 3386this option is used with the Objective-C or Objective-C++ compiler, 3387any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 3388This is useful if you need to make sure that your Objective-C code can 3389be compiled with older versions of GCC@. 3390 3391@item -freplace-objc-classes 3392@opindex freplace-objc-classes 3393Emit a special marker instructing @command{ld(1)} not to statically link in 3394the resulting object file, and allow @command{dyld(1)} to load it in at 3395run time instead. This is used in conjunction with the Fix-and-Continue 3396debugging mode, where the object file in question may be recompiled and 3397dynamically reloaded in the course of program execution, without the need 3398to restart the program itself. Currently, Fix-and-Continue functionality 3399is only available in conjunction with the NeXT runtime on Mac OS X 10.3 3400and later. 3401 3402@item -fzero-link 3403@opindex fzero-link 3404When compiling for the NeXT runtime, the compiler ordinarily replaces calls 3405to @code{objc_getClass("@dots{}")} (when the name of the class is known at 3406compile time) with static class references that get initialized at load time, 3407which improves run-time performance. Specifying the @option{-fzero-link} flag 3408suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 3409to be retained. This is useful in Zero-Link debugging mode, since it allows 3410for individual class implementations to be modified during program execution. 3411The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 3412regardless of command-line options. 3413 3414@item -fno-local-ivars 3415@opindex fno-local-ivars 3416@opindex flocal-ivars 3417By default instance variables in Objective-C can be accessed as if 3418they were local variables from within the methods of the class they're 3419declared in. This can lead to shadowing between instance variables 3420and other variables declared either locally inside a class method or 3421globally with the same name. Specifying the @option{-fno-local-ivars} 3422flag disables this behavior thus avoiding variable shadowing issues. 3423 3424@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} 3425@opindex fivar-visibility 3426Set the default instance variable visibility to the specified option 3427so that instance variables declared outside the scope of any access 3428modifier directives default to the specified visibility. 3429 3430@item -gen-decls 3431@opindex gen-decls 3432Dump interface declarations for all classes seen in the source file to a 3433file named @file{@var{sourcename}.decl}. 3434 3435@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 3436@opindex Wassign-intercept 3437@opindex Wno-assign-intercept 3438Warn whenever an Objective-C assignment is being intercepted by the 3439garbage collector. 3440 3441@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 3442@opindex Wno-protocol 3443@opindex Wprotocol 3444If a class is declared to implement a protocol, a warning is issued for 3445every method in the protocol that is not implemented by the class. The 3446default behavior is to issue a warning for every method not explicitly 3447implemented in the class, even if a method implementation is inherited 3448from the superclass. If you use the @option{-Wno-protocol} option, then 3449methods inherited from the superclass are considered to be implemented, 3450and no warning is issued for them. 3451 3452@item -Wselector @r{(Objective-C and Objective-C++ only)} 3453@opindex Wselector 3454@opindex Wno-selector 3455Warn if multiple methods of different types for the same selector are 3456found during compilation. The check is performed on the list of methods 3457in the final stage of compilation. Additionally, a check is performed 3458for each selector appearing in a @code{@@selector(@dots{})} 3459expression, and a corresponding method for that selector has been found 3460during compilation. Because these checks scan the method table only at 3461the end of compilation, these warnings are not produced if the final 3462stage of compilation is not reached, for example because an error is 3463found during compilation, or because the @option{-fsyntax-only} option is 3464being used. 3465 3466@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 3467@opindex Wstrict-selector-match 3468@opindex Wno-strict-selector-match 3469Warn if multiple methods with differing argument and/or return types are 3470found for a given selector when attempting to send a message using this 3471selector to a receiver of type @code{id} or @code{Class}. When this flag 3472is off (which is the default behavior), the compiler omits such warnings 3473if any differences found are confined to types that share the same size 3474and alignment. 3475 3476@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 3477@opindex Wundeclared-selector 3478@opindex Wno-undeclared-selector 3479Warn if a @code{@@selector(@dots{})} expression referring to an 3480undeclared selector is found. A selector is considered undeclared if no 3481method with that name has been declared before the 3482@code{@@selector(@dots{})} expression, either explicitly in an 3483@code{@@interface} or @code{@@protocol} declaration, or implicitly in 3484an @code{@@implementation} section. This option always performs its 3485checks as soon as a @code{@@selector(@dots{})} expression is found, 3486while @option{-Wselector} only performs its checks in the final stage of 3487compilation. This also enforces the coding style convention 3488that methods and selectors must be declared before being used. 3489 3490@item -print-objc-runtime-info 3491@opindex print-objc-runtime-info 3492Generate C header describing the largest structure that is passed by 3493value, if any. 3494 3495@end table 3496 3497@node Diagnostic Message Formatting Options 3498@section Options to Control Diagnostic Messages Formatting 3499@cindex options to control diagnostics formatting 3500@cindex diagnostic messages 3501@cindex message formatting 3502 3503Traditionally, diagnostic messages have been formatted irrespective of 3504the output device's aspect (e.g.@: its width, @dots{}). You can use the 3505options described below 3506to control the formatting algorithm for diagnostic messages, 3507e.g.@: how many characters per line, how often source location 3508information should be reported. Note that some language front ends may not 3509honor these options. 3510 3511@table @gcctabopt 3512@item -fmessage-length=@var{n} 3513@opindex fmessage-length 3514Try to format error messages so that they fit on lines of about 3515@var{n} characters. If @var{n} is zero, then no line-wrapping is 3516done; each error message appears on a single line. This is the 3517default for all front ends. 3518 3519@item -fdiagnostics-show-location=once 3520@opindex fdiagnostics-show-location 3521Only meaningful in line-wrapping mode. Instructs the diagnostic messages 3522reporter to emit source location information @emph{once}; that is, in 3523case the message is too long to fit on a single physical line and has to 3524be wrapped, the source location won't be emitted (as prefix) again, 3525over and over, in subsequent continuation lines. This is the default 3526behavior. 3527 3528@item -fdiagnostics-show-location=every-line 3529Only meaningful in line-wrapping mode. Instructs the diagnostic 3530messages reporter to emit the same source location information (as 3531prefix) for physical lines that result from the process of breaking 3532a message which is too long to fit on a single line. 3533 3534@item -fdiagnostics-color[=@var{WHEN}] 3535@itemx -fno-diagnostics-color 3536@opindex fdiagnostics-color 3537@cindex highlight, color 3538@vindex GCC_COLORS @r{environment variable} 3539Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, 3540or @samp{auto}. The default depends on how the compiler has been configured, 3541it can be any of the above @var{WHEN} options or also @samp{never} 3542if @env{GCC_COLORS} environment variable isn't present in the environment, 3543and @samp{auto} otherwise. 3544@samp{auto} means to use color only when the standard error is a terminal. 3545The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are 3546aliases for @option{-fdiagnostics-color=always} and 3547@option{-fdiagnostics-color=never}, respectively. 3548 3549The colors are defined by the environment variable @env{GCC_COLORS}. 3550Its value is a colon-separated list of capabilities and Select Graphic 3551Rendition (SGR) substrings. SGR commands are interpreted by the 3552terminal or terminal emulator. (See the section in the documentation 3553of your text terminal for permitted values and their meanings as 3554character attributes.) These substring values are integers in decimal 3555representation and can be concatenated with semicolons. 3556Common values to concatenate include 3557@samp{1} for bold, 3558@samp{4} for underline, 3559@samp{5} for blink, 3560@samp{7} for inverse, 3561@samp{39} for default foreground color, 3562@samp{30} to @samp{37} for foreground colors, 3563@samp{90} to @samp{97} for 16-color mode foreground colors, 3564@samp{38;5;0} to @samp{38;5;255} 3565for 88-color and 256-color modes foreground colors, 3566@samp{49} for default background color, 3567@samp{40} to @samp{47} for background colors, 3568@samp{100} to @samp{107} for 16-color mode background colors, 3569and @samp{48;5;0} to @samp{48;5;255} 3570for 88-color and 256-color modes background colors. 3571 3572The default @env{GCC_COLORS} is 3573@smallexample 3574error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\ 3575quote=01:fixit-insert=32:fixit-delete=31:\ 3576diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ 3577type-diff=01;32 3578@end smallexample 3579@noindent 3580where @samp{01;31} is bold red, @samp{01;35} is bold magenta, 3581@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue, 3582@samp{01} is bold, and @samp{31} is red. 3583Setting @env{GCC_COLORS} to the empty string disables colors. 3584Supported capabilities are as follows. 3585 3586@table @code 3587@item error= 3588@vindex error GCC_COLORS @r{capability} 3589SGR substring for error: markers. 3590 3591@item warning= 3592@vindex warning GCC_COLORS @r{capability} 3593SGR substring for warning: markers. 3594 3595@item note= 3596@vindex note GCC_COLORS @r{capability} 3597SGR substring for note: markers. 3598 3599@item range1= 3600@vindex range1 GCC_COLORS @r{capability} 3601SGR substring for first additional range. 3602 3603@item range2= 3604@vindex range2 GCC_COLORS @r{capability} 3605SGR substring for second additional range. 3606 3607@item locus= 3608@vindex locus GCC_COLORS @r{capability} 3609SGR substring for location information, @samp{file:line} or 3610@samp{file:line:column} etc. 3611 3612@item quote= 3613@vindex quote GCC_COLORS @r{capability} 3614SGR substring for information printed within quotes. 3615 3616@item fixit-insert= 3617@vindex fixit-insert GCC_COLORS @r{capability} 3618SGR substring for fix-it hints suggesting text to 3619be inserted or replaced. 3620 3621@item fixit-delete= 3622@vindex fixit-delete GCC_COLORS @r{capability} 3623SGR substring for fix-it hints suggesting text to 3624be deleted. 3625 3626@item diff-filename= 3627@vindex diff-filename GCC_COLORS @r{capability} 3628SGR substring for filename headers within generated patches. 3629 3630@item diff-hunk= 3631@vindex diff-hunk GCC_COLORS @r{capability} 3632SGR substring for the starts of hunks within generated patches. 3633 3634@item diff-delete= 3635@vindex diff-delete GCC_COLORS @r{capability} 3636SGR substring for deleted lines within generated patches. 3637 3638@item diff-insert= 3639@vindex diff-insert GCC_COLORS @r{capability} 3640SGR substring for inserted lines within generated patches. 3641 3642@item type-diff= 3643@vindex type-diff GCC_COLORS @r{capability} 3644SGR substring for highlighting mismatching types within template 3645arguments in the C++ frontend. 3646@end table 3647 3648@item -fno-diagnostics-show-option 3649@opindex fno-diagnostics-show-option 3650@opindex fdiagnostics-show-option 3651By default, each diagnostic emitted includes text indicating the 3652command-line option that directly controls the diagnostic (if such an 3653option is known to the diagnostic machinery). Specifying the 3654@option{-fno-diagnostics-show-option} flag suppresses that behavior. 3655 3656@item -fno-diagnostics-show-caret 3657@opindex fno-diagnostics-show-caret 3658@opindex fdiagnostics-show-caret 3659By default, each diagnostic emitted includes the original source line 3660and a caret @samp{^} indicating the column. This option suppresses this 3661information. The source line is truncated to @var{n} characters, if 3662the @option{-fmessage-length=n} option is given. When the output is done 3663to the terminal, the width is limited to the width given by the 3664@env{COLUMNS} environment variable or, if not set, to the terminal width. 3665 3666@item -fdiagnostics-parseable-fixits 3667@opindex fdiagnostics-parseable-fixits 3668Emit fix-it hints in a machine-parseable format, suitable for consumption 3669by IDEs. For each fix-it, a line will be printed after the relevant 3670diagnostic, starting with the string ``fix-it:''. For example: 3671 3672@smallexample 3673fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all" 3674@end smallexample 3675 3676The location is expressed as a half-open range, expressed as a count of 3677bytes, starting at byte 1 for the initial column. In the above example, 3678bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the 3679given string: 3680 3681@smallexample 368200000000011111111112222222222 368312345678901234567890123456789 3684 gtk_widget_showall (dlg); 3685 ^^^^^^^^^^^^^^^^^^ 3686 gtk_widget_show_all 3687@end smallexample 3688 3689The filename and replacement string escape backslash as ``\\", tab as ``\t'', 3690newline as ``\n'', double quotes as ``\"'', non-printable characters as octal 3691(e.g. vertical tab as ``\013''). 3692 3693An empty replacement string indicates that the given range is to be removed. 3694An empty range (e.g. ``45:3-45:3'') indicates that the string is to 3695be inserted at the given position. 3696 3697@item -fdiagnostics-generate-patch 3698@opindex fdiagnostics-generate-patch 3699Print fix-it hints to stderr in unified diff format, after any diagnostics 3700are printed. For example: 3701 3702@smallexample 3703--- test.c 3704+++ test.c 3705@@ -42,5 +42,5 @@ 3706 3707 void show_cb(GtkDialog *dlg) 3708 @{ 3709- gtk_widget_showall(dlg); 3710+ gtk_widget_show_all(dlg); 3711 @} 3712 3713@end smallexample 3714 3715The diff may or may not be colorized, following the same rules 3716as for diagnostics (see @option{-fdiagnostics-color}). 3717 3718@item -fdiagnostics-show-template-tree 3719@opindex fdiagnostics-show-template-tree 3720 3721In the C++ frontend, when printing diagnostics showing mismatching 3722template types, such as: 3723 3724@smallexample 3725 could not convert 'std::map<int, std::vector<double> >()' 3726 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 3727@end smallexample 3728 3729the @option{-fdiagnostics-show-template-tree} flag enables printing a 3730tree-like structure showing the common and differing parts of the types, 3731such as: 3732 3733@smallexample 3734 map< 3735 [...], 3736 vector< 3737 [double != float]>> 3738@end smallexample 3739 3740The parts that differ are highlighted with color (``double'' and 3741``float'' in this case). 3742 3743@item -fno-elide-type 3744@opindex fno-elide-type 3745@opindex felide-type 3746By default when the C++ frontend prints diagnostics showing mismatching 3747template types, common parts of the types are printed as ``[...]'' to 3748simplify the error message. For example: 3749 3750@smallexample 3751 could not convert 'std::map<int, std::vector<double> >()' 3752 from 'map<[...],vector<double>>' to 'map<[...],vector<float>> 3753@end smallexample 3754 3755Specifying the @option{-fno-elide-type} flag suppresses that behavior. 3756This flag also affects the output of the 3757@option{-fdiagnostics-show-template-tree} flag. 3758 3759@item -fno-show-column 3760@opindex fno-show-column 3761Do not print column numbers in diagnostics. This may be necessary if 3762diagnostics are being scanned by a program that does not understand the 3763column numbers, such as @command{dejagnu}. 3764 3765@end table 3766 3767@node Warning Options 3768@section Options to Request or Suppress Warnings 3769@cindex options to control warnings 3770@cindex warning messages 3771@cindex messages, warning 3772@cindex suppressing warnings 3773 3774Warnings are diagnostic messages that report constructions that 3775are not inherently erroneous but that are risky or suggest there 3776may have been an error. 3777 3778The following language-independent options do not enable specific 3779warnings but control the kinds of diagnostics produced by GCC@. 3780 3781@table @gcctabopt 3782@cindex syntax checking 3783@item -fsyntax-only 3784@opindex fsyntax-only 3785Check the code for syntax errors, but don't do anything beyond that. 3786 3787@item -fmax-errors=@var{n} 3788@opindex fmax-errors 3789Limits the maximum number of error messages to @var{n}, at which point 3790GCC bails out rather than attempting to continue processing the source 3791code. If @var{n} is 0 (the default), there is no limit on the number 3792of error messages produced. If @option{-Wfatal-errors} is also 3793specified, then @option{-Wfatal-errors} takes precedence over this 3794option. 3795 3796@item -w 3797@opindex w 3798Inhibit all warning messages. 3799 3800@item -Werror 3801@opindex Werror 3802@opindex Wno-error 3803Make all warnings into errors. 3804 3805@item -Werror= 3806@opindex Werror= 3807@opindex Wno-error= 3808Make the specified warning into an error. The specifier for a warning 3809is appended; for example @option{-Werror=switch} turns the warnings 3810controlled by @option{-Wswitch} into errors. This switch takes a 3811negative form, to be used to negate @option{-Werror} for specific 3812warnings; for example @option{-Wno-error=switch} makes 3813@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3814is in effect. 3815 3816The warning message for each controllable warning includes the 3817option that controls the warning. That option can then be used with 3818@option{-Werror=} and @option{-Wno-error=} as described above. 3819(Printing of the option in the warning message can be disabled using the 3820@option{-fno-diagnostics-show-option} flag.) 3821 3822Note that specifying @option{-Werror=}@var{foo} automatically implies 3823@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3824imply anything. 3825 3826@item -Wfatal-errors 3827@opindex Wfatal-errors 3828@opindex Wno-fatal-errors 3829This option causes the compiler to abort compilation on the first error 3830occurred rather than trying to keep going and printing further error 3831messages. 3832 3833@end table 3834 3835You can request many specific warnings with options beginning with 3836@samp{-W}, for example @option{-Wimplicit} to request warnings on 3837implicit declarations. Each of these specific warning options also 3838has a negative form beginning @samp{-Wno-} to turn off warnings; for 3839example, @option{-Wno-implicit}. This manual lists only one of the 3840two forms, whichever is not the default. For further 3841language-specific options also refer to @ref{C++ Dialect Options} and 3842@ref{Objective-C and Objective-C++ Dialect Options}. 3843 3844Some options, such as @option{-Wall} and @option{-Wextra}, turn on other 3845options, such as @option{-Wunused}, which may turn on further options, 3846such as @option{-Wunused-value}. The combined effect of positive and 3847negative forms is that more specific options have priority over less 3848specific ones, independently of their position in the command-line. For 3849options of the same specificity, the last one takes effect. Options 3850enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect 3851as if they appeared at the end of the command-line. 3852 3853When an unrecognized warning option is requested (e.g., 3854@option{-Wunknown-warning}), GCC emits a diagnostic stating 3855that the option is not recognized. However, if the @option{-Wno-} form 3856is used, the behavior is slightly different: no diagnostic is 3857produced for @option{-Wno-unknown-warning} unless other diagnostics 3858are being produced. This allows the use of new @option{-Wno-} options 3859with old compilers, but if something goes wrong, the compiler 3860warns that an unrecognized option is present. 3861 3862@table @gcctabopt 3863@item -Wpedantic 3864@itemx -pedantic 3865@opindex pedantic 3866@opindex Wpedantic 3867Issue all the warnings demanded by strict ISO C and ISO C++; 3868reject all programs that use forbidden extensions, and some other 3869programs that do not follow ISO C and ISO C++. For ISO C, follows the 3870version of the ISO C standard specified by any @option{-std} option used. 3871 3872Valid ISO C and ISO C++ programs should compile properly with or without 3873this option (though a rare few require @option{-ansi} or a 3874@option{-std} option specifying the required version of ISO C)@. However, 3875without this option, certain GNU extensions and traditional C and C++ 3876features are supported as well. With this option, they are rejected. 3877 3878@option{-Wpedantic} does not cause warning messages for use of the 3879alternate keywords whose names begin and end with @samp{__}. Pedantic 3880warnings are also disabled in the expression that follows 3881@code{__extension__}. However, only system header files should use 3882these escape routes; application programs should avoid them. 3883@xref{Alternate Keywords}. 3884 3885Some users try to use @option{-Wpedantic} to check programs for strict ISO 3886C conformance. They soon find that it does not do quite what they want: 3887it finds some non-ISO practices, but not all---only those for which 3888ISO C @emph{requires} a diagnostic, and some others for which 3889diagnostics have been added. 3890 3891A feature to report any failure to conform to ISO C might be useful in 3892some instances, but would require considerable additional work and would 3893be quite different from @option{-Wpedantic}. We don't have plans to 3894support such a feature in the near future. 3895 3896Where the standard specified with @option{-std} represents a GNU 3897extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 3898corresponding @dfn{base standard}, the version of ISO C on which the GNU 3899extended dialect is based. Warnings from @option{-Wpedantic} are given 3900where they are required by the base standard. (It does not make sense 3901for such warnings to be given only for features not in the specified GNU 3902C dialect, since by definition the GNU dialects of C include all 3903features the compiler supports with the given option, and there would be 3904nothing to warn about.) 3905 3906@item -pedantic-errors 3907@opindex pedantic-errors 3908Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 3909requires a diagnostic, in some cases where there is undefined behavior 3910at compile-time and in some other cases that do not prevent compilation 3911of programs that are valid according to the standard. This is not 3912equivalent to @option{-Werror=pedantic}, since there are errors enabled 3913by this option and not enabled by the latter and vice versa. 3914 3915@item -Wall 3916@opindex Wall 3917@opindex Wno-all 3918This enables all the warnings about constructions that some users 3919consider questionable, and that are easy to avoid (or modify to 3920prevent the warning), even in conjunction with macros. This also 3921enables some language-specific warnings described in @ref{C++ Dialect 3922Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 3923 3924@option{-Wall} turns on the following warning flags: 3925 3926@gccoptlist{-Waddress @gol 3927-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 3928-Wbool-compare @gol 3929-Wbool-operation @gol 3930-Wc++11-compat -Wc++14-compat @gol 3931-Wcatch-value @r{(C++ and Objective-C++ only)} @gol 3932-Wchar-subscripts @gol 3933-Wcomment @gol 3934-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol 3935-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 3936-Wformat @gol 3937-Wint-in-bool-context @gol 3938-Wimplicit @r{(C and Objective-C only)} @gol 3939-Wimplicit-int @r{(C and Objective-C only)} @gol 3940-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 3941-Winit-self @r{(only for C++)} @gol 3942-Wlogical-not-parentheses @gol 3943-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 3944-Wmaybe-uninitialized @gol 3945-Wmemset-elt-size @gol 3946-Wmemset-transposed-args @gol 3947-Wmisleading-indentation @r{(only for C/C++)} @gol 3948-Wmissing-attributes @gol 3949-Wmissing-braces @r{(only for C/ObjC)} @gol 3950-Wmultistatement-macros @gol 3951-Wnarrowing @r{(only for C++)} @gol 3952-Wnonnull @gol 3953-Wnonnull-compare @gol 3954-Wopenmp-simd @gol 3955-Wparentheses @gol 3956-Wpointer-sign @gol 3957-Wreorder @gol 3958-Wrestrict @gol 3959-Wreturn-type @gol 3960-Wsequence-point @gol 3961-Wsign-compare @r{(only in C++)} @gol 3962-Wsizeof-pointer-div @gol 3963-Wsizeof-pointer-memaccess @gol 3964-Wstrict-aliasing @gol 3965-Wstrict-overflow=1 @gol 3966-Wstringop-truncation @gol 3967-Wswitch @gol 3968-Wtautological-compare @gol 3969-Wtrigraphs @gol 3970-Wuninitialized @gol 3971-Wunknown-pragmas @gol 3972-Wunused-function @gol 3973-Wunused-label @gol 3974-Wunused-value @gol 3975-Wunused-variable @gol 3976-Wvolatile-register-var @gol 3977} 3978 3979Note that some warning flags are not implied by @option{-Wall}. Some of 3980them warn about constructions that users generally do not consider 3981questionable, but which occasionally you might wish to check for; 3982others warn about constructions that are necessary or hard to avoid in 3983some cases, and there is no simple way to modify the code to suppress 3984the warning. Some of them are enabled by @option{-Wextra} but many of 3985them must be enabled individually. 3986 3987@item -Wextra 3988@opindex W 3989@opindex Wextra 3990@opindex Wno-extra 3991This enables some extra warning flags that are not enabled by 3992@option{-Wall}. (This option used to be called @option{-W}. The older 3993name is still supported, but the newer name is more descriptive.) 3994 3995@gccoptlist{-Wclobbered @gol 3996-Wcast-function-type @gol 3997-Wempty-body @gol 3998-Wignored-qualifiers @gol 3999-Wimplicit-fallthrough=3 @gol 4000-Wmissing-field-initializers @gol 4001-Wmissing-parameter-type @r{(C only)} @gol 4002-Wold-style-declaration @r{(C only)} @gol 4003-Woverride-init @gol 4004-Wsign-compare @r{(C only)} @gol 4005-Wtype-limits @gol 4006-Wuninitialized @gol 4007-Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol 4008-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 4009-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 4010} 4011 4012The option @option{-Wextra} also prints warning messages for the 4013following cases: 4014 4015@itemize @bullet 4016 4017@item 4018A pointer is compared against integer zero with @code{<}, @code{<=}, 4019@code{>}, or @code{>=}. 4020 4021@item 4022(C++ only) An enumerator and a non-enumerator both appear in a 4023conditional expression. 4024 4025@item 4026(C++ only) Ambiguous virtual bases. 4027 4028@item 4029(C++ only) Subscripting an array that has been declared @code{register}. 4030 4031@item 4032(C++ only) Taking the address of a variable that has been declared 4033@code{register}. 4034 4035@item 4036(C++ only) A base class is not initialized in the copy constructor 4037of a derived class. 4038 4039@end itemize 4040 4041@item -Wchar-subscripts 4042@opindex Wchar-subscripts 4043@opindex Wno-char-subscripts 4044Warn if an array subscript has type @code{char}. This is a common cause 4045of error, as programmers often forget that this type is signed on some 4046machines. 4047This warning is enabled by @option{-Wall}. 4048 4049@item -Wchkp 4050@opindex Wchkp 4051Warn about an invalid memory access that is found by Pointer Bounds Checker 4052(@option{-fcheck-pointer-bounds}). 4053 4054@item -Wno-coverage-mismatch 4055@opindex Wno-coverage-mismatch 4056Warn if feedback profiles do not match when using the 4057@option{-fprofile-use} option. 4058If a source file is changed between compiling with @option{-fprofile-gen} and 4059with @option{-fprofile-use}, the files with the profile feedback can fail 4060to match the source file and GCC cannot use the profile feedback 4061information. By default, this warning is enabled and is treated as an 4062error. @option{-Wno-coverage-mismatch} can be used to disable the 4063warning or @option{-Wno-error=coverage-mismatch} can be used to 4064disable the error. Disabling the error for this warning can result in 4065poorly optimized code and is useful only in the 4066case of very minor changes such as bug fixes to an existing code-base. 4067Completely disabling the warning is not recommended. 4068 4069@item -Wno-cpp 4070@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 4071 4072Suppress warning messages emitted by @code{#warning} directives. 4073 4074@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 4075@opindex Wdouble-promotion 4076@opindex Wno-double-promotion 4077Give a warning when a value of type @code{float} is implicitly 4078promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 4079floating-point unit implement @code{float} in hardware, but emulate 4080@code{double} in software. On such a machine, doing computations 4081using @code{double} values is much more expensive because of the 4082overhead required for software emulation. 4083 4084It is easy to accidentally do computations with @code{double} because 4085floating-point literals are implicitly of type @code{double}. For 4086example, in: 4087@smallexample 4088@group 4089float area(float radius) 4090@{ 4091 return 3.14159 * radius * radius; 4092@} 4093@end group 4094@end smallexample 4095the compiler performs the entire computation with @code{double} 4096because the floating-point literal is a @code{double}. 4097 4098@item -Wduplicate-decl-specifier @r{(C and Objective-C only)} 4099@opindex Wduplicate-decl-specifier 4100@opindex Wno-duplicate-decl-specifier 4101Warn if a declaration has duplicate @code{const}, @code{volatile}, 4102@code{restrict} or @code{_Atomic} specifier. This warning is enabled by 4103@option{-Wall}. 4104 4105@item -Wformat 4106@itemx -Wformat=@var{n} 4107@opindex Wformat 4108@opindex Wno-format 4109@opindex ffreestanding 4110@opindex fno-builtin 4111@opindex Wformat= 4112Check calls to @code{printf} and @code{scanf}, etc., to make sure that 4113the arguments supplied have types appropriate to the format string 4114specified, and that the conversions specified in the format string make 4115sense. This includes standard functions, and others specified by format 4116attributes (@pxref{Function Attributes}), in the @code{printf}, 4117@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 4118not in the C standard) families (or other target-specific families). 4119Which functions are checked without format attributes having been 4120specified depends on the standard version selected, and such checks of 4121functions without the attribute specified are disabled by 4122@option{-ffreestanding} or @option{-fno-builtin}. 4123 4124The formats are checked against the format features supported by GNU 4125libc version 2.2. These include all ISO C90 and C99 features, as well 4126as features from the Single Unix Specification and some BSD and GNU 4127extensions. Other library implementations may not support all these 4128features; GCC does not support warning about features that go beyond a 4129particular library's limitations. However, if @option{-Wpedantic} is used 4130with @option{-Wformat}, warnings are given about format features not 4131in the selected standard version (but not for @code{strfmon} formats, 4132since those are not in any version of the C standard). @xref{C Dialect 4133Options,,Options Controlling C Dialect}. 4134 4135@table @gcctabopt 4136@item -Wformat=1 4137@itemx -Wformat 4138@opindex Wformat 4139@opindex Wformat=1 4140Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 4141@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 4142@option{-Wformat} also checks for null format arguments for several 4143functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 4144aspects of this level of format checking can be disabled by the 4145options: @option{-Wno-format-contains-nul}, 4146@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 4147@option{-Wformat} is enabled by @option{-Wall}. 4148 4149@item -Wno-format-contains-nul 4150@opindex Wno-format-contains-nul 4151@opindex Wformat-contains-nul 4152If @option{-Wformat} is specified, do not warn about format strings that 4153contain NUL bytes. 4154 4155@item -Wno-format-extra-args 4156@opindex Wno-format-extra-args 4157@opindex Wformat-extra-args 4158If @option{-Wformat} is specified, do not warn about excess arguments to a 4159@code{printf} or @code{scanf} format function. The C standard specifies 4160that such arguments are ignored. 4161 4162Where the unused arguments lie between used arguments that are 4163specified with @samp{$} operand number specifications, normally 4164warnings are still given, since the implementation could not know what 4165type to pass to @code{va_arg} to skip the unused arguments. However, 4166in the case of @code{scanf} formats, this option suppresses the 4167warning if the unused arguments are all pointers, since the Single 4168Unix Specification says that such unused arguments are allowed. 4169 4170@item -Wformat-overflow 4171@itemx -Wformat-overflow=@var{level} 4172@opindex Wformat-overflow 4173@opindex Wno-format-overflow 4174Warn about calls to formatted input/output functions such as @code{sprintf} 4175and @code{vsprintf} that might overflow the destination buffer. When the 4176exact number of bytes written by a format directive cannot be determined 4177at compile-time it is estimated based on heuristics that depend on the 4178@var{level} argument and on optimization. While enabling optimization 4179will in most cases improve the accuracy of the warning, it may also 4180result in false positives. 4181 4182@table @gcctabopt 4183@item -Wformat-overflow 4184@itemx -Wformat-overflow=1 4185@opindex Wformat-overflow 4186@opindex Wno-format-overflow 4187Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat} 4188employs a conservative approach that warns only about calls that most 4189likely overflow the buffer. At this level, numeric arguments to format 4190directives with unknown values are assumed to have the value of one, and 4191strings of unknown length to be empty. Numeric arguments that are known 4192to be bounded to a subrange of their type, or string arguments whose output 4193is bounded either by their directive's precision or by a finite set of 4194string literals, are assumed to take on the value within the range that 4195results in the most bytes on output. For example, the call to @code{sprintf} 4196below is diagnosed because even with both @var{a} and @var{b} equal to zero, 4197the terminating NUL character (@code{'\0'}) appended by the function 4198to the destination buffer will be written past its end. Increasing 4199the size of the buffer by a single byte is sufficient to avoid the 4200warning, though it may not be sufficient to avoid the overflow. 4201 4202@smallexample 4203void f (int a, int b) 4204@{ 4205 char buf [13]; 4206 sprintf (buf, "a = %i, b = %i\n", a, b); 4207@} 4208@end smallexample 4209 4210@item -Wformat-overflow=2 4211Level @var{2} warns also about calls that might overflow the destination 4212buffer given an argument of sufficient length or magnitude. At level 4213@var{2}, unknown numeric arguments are assumed to have the minimum 4214representable value for signed types with a precision greater than 1, and 4215the maximum representable value otherwise. Unknown string arguments whose 4216length cannot be assumed to be bounded either by the directive's precision, 4217or by a finite set of string literals they may evaluate to, or the character 4218array they may point to, are assumed to be 1 character long. 4219 4220At level @var{2}, the call in the example above is again diagnosed, but 4221this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first 4222@code{%i} directive will write some of its digits beyond the end of 4223the destination buffer. To make the call safe regardless of the values 4224of the two variables, the size of the destination buffer must be increased 4225to at least 34 bytes. GCC includes the minimum size of the buffer in 4226an informational note following the warning. 4227 4228An alternative to increasing the size of the destination buffer is to 4229constrain the range of formatted values. The maximum length of string 4230arguments can be bounded by specifying the precision in the format 4231directive. When numeric arguments of format directives can be assumed 4232to be bounded by less than the precision of their type, choosing 4233an appropriate length modifier to the format specifier will reduce 4234the required buffer size. For example, if @var{a} and @var{b} in the 4235example above can be assumed to be within the precision of 4236the @code{short int} type then using either the @code{%hi} format 4237directive or casting the argument to @code{short} reduces the maximum 4238required size of the buffer to 24 bytes. 4239 4240@smallexample 4241void f (int a, int b) 4242@{ 4243 char buf [23]; 4244 sprintf (buf, "a = %hi, b = %i\n", a, (short)b); 4245@} 4246@end smallexample 4247@end table 4248 4249@item -Wno-format-zero-length 4250@opindex Wno-format-zero-length 4251@opindex Wformat-zero-length 4252If @option{-Wformat} is specified, do not warn about zero-length formats. 4253The C standard specifies that zero-length formats are allowed. 4254 4255 4256@item -Wformat=2 4257@opindex Wformat=2 4258Enable @option{-Wformat} plus additional format checks. Currently 4259equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 4260-Wformat-y2k}. 4261 4262@item -Wformat-nonliteral 4263@opindex Wformat-nonliteral 4264@opindex Wno-format-nonliteral 4265If @option{-Wformat} is specified, also warn if the format string is not a 4266string literal and so cannot be checked, unless the format function 4267takes its format arguments as a @code{va_list}. 4268 4269@item -Wformat-security 4270@opindex Wformat-security 4271@opindex Wno-format-security 4272If @option{-Wformat} is specified, also warn about uses of format 4273functions that represent possible security problems. At present, this 4274warns about calls to @code{printf} and @code{scanf} functions where the 4275format string is not a string literal and there are no format arguments, 4276as in @code{printf (foo);}. This may be a security hole if the format 4277string came from untrusted input and contains @samp{%n}. (This is 4278currently a subset of what @option{-Wformat-nonliteral} warns about, but 4279in future warnings may be added to @option{-Wformat-security} that are not 4280included in @option{-Wformat-nonliteral}.) 4281 4282@item -Wformat-signedness 4283@opindex Wformat-signedness 4284@opindex Wno-format-signedness 4285If @option{-Wformat} is specified, also warn if the format string 4286requires an unsigned argument and the argument is signed and vice versa. 4287 4288@item -Wformat-truncation 4289@itemx -Wformat-truncation=@var{level} 4290@opindex Wformat-truncation 4291@opindex Wno-format-truncation 4292Warn about calls to formatted input/output functions such as @code{snprintf} 4293and @code{vsnprintf} that might result in output truncation. When the exact 4294number of bytes written by a format directive cannot be determined at 4295compile-time it is estimated based on heuristics that depend on 4296the @var{level} argument and on optimization. While enabling optimization 4297will in most cases improve the accuracy of the warning, it may also result 4298in false positives. Except as noted otherwise, the option uses the same 4299logic @option{-Wformat-overflow}. 4300 4301@table @gcctabopt 4302@item -Wformat-truncation 4303@itemx -Wformat-truncation=1 4304@opindex Wformat-truncation 4305@opindex Wno-format-overflow 4306Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat} 4307employs a conservative approach that warns only about calls to bounded 4308functions whose return value is unused and that will most likely result 4309in output truncation. 4310 4311@item -Wformat-truncation=2 4312Level @var{2} warns also about calls to bounded functions whose return 4313value is used and that might result in truncation given an argument of 4314sufficient length or magnitude. 4315@end table 4316 4317@item -Wformat-y2k 4318@opindex Wformat-y2k 4319@opindex Wno-format-y2k 4320If @option{-Wformat} is specified, also warn about @code{strftime} 4321formats that may yield only a two-digit year. 4322@end table 4323 4324@item -Wnonnull 4325@opindex Wnonnull 4326@opindex Wno-nonnull 4327Warn about passing a null pointer for arguments marked as 4328requiring a non-null value by the @code{nonnull} function attribute. 4329 4330@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 4331can be disabled with the @option{-Wno-nonnull} option. 4332 4333@item -Wnonnull-compare 4334@opindex Wnonnull-compare 4335@opindex Wno-nonnull-compare 4336Warn when comparing an argument marked with the @code{nonnull} 4337function attribute against null inside the function. 4338 4339@option{-Wnonnull-compare} is included in @option{-Wall}. It 4340can be disabled with the @option{-Wno-nonnull-compare} option. 4341 4342@item -Wnull-dereference 4343@opindex Wnull-dereference 4344@opindex Wno-null-dereference 4345Warn if the compiler detects paths that trigger erroneous or 4346undefined behavior due to dereferencing a null pointer. This option 4347is only active when @option{-fdelete-null-pointer-checks} is active, 4348which is enabled by optimizations in most targets. The precision of 4349the warnings depends on the optimization options used. 4350 4351@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 4352@opindex Winit-self 4353@opindex Wno-init-self 4354Warn about uninitialized variables that are initialized with themselves. 4355Note this option can only be used with the @option{-Wuninitialized} option. 4356 4357For example, GCC warns about @code{i} being uninitialized in the 4358following snippet only when @option{-Winit-self} has been specified: 4359@smallexample 4360@group 4361int f() 4362@{ 4363 int i = i; 4364 return i; 4365@} 4366@end group 4367@end smallexample 4368 4369This warning is enabled by @option{-Wall} in C++. 4370 4371@item -Wimplicit-int @r{(C and Objective-C only)} 4372@opindex Wimplicit-int 4373@opindex Wno-implicit-int 4374Warn when a declaration does not specify a type. 4375This warning is enabled by @option{-Wall}. 4376 4377@item -Wimplicit-function-declaration @r{(C and Objective-C only)} 4378@opindex Wimplicit-function-declaration 4379@opindex Wno-implicit-function-declaration 4380Give a warning whenever a function is used before being declared. In 4381C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is 4382enabled by default and it is made into an error by 4383@option{-pedantic-errors}. This warning is also enabled by 4384@option{-Wall}. 4385 4386@item -Wimplicit @r{(C and Objective-C only)} 4387@opindex Wimplicit 4388@opindex Wno-implicit 4389Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 4390This warning is enabled by @option{-Wall}. 4391 4392@item -Wimplicit-fallthrough 4393@opindex Wimplicit-fallthrough 4394@opindex Wno-implicit-fallthrough 4395@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3} 4396and @option{-Wno-implicit-fallthrough} is the same as 4397@option{-Wimplicit-fallthrough=0}. 4398 4399@item -Wimplicit-fallthrough=@var{n} 4400@opindex Wimplicit-fallthrough= 4401Warn when a switch case falls through. For example: 4402 4403@smallexample 4404@group 4405switch (cond) 4406 @{ 4407 case 1: 4408 a = 1; 4409 break; 4410 case 2: 4411 a = 2; 4412 case 3: 4413 a = 3; 4414 break; 4415 @} 4416@end group 4417@end smallexample 4418 4419This warning does not warn when the last statement of a case cannot 4420fall through, e.g. when there is a return statement or a call to function 4421declared with the noreturn attribute. @option{-Wimplicit-fallthrough=} 4422also takes into account control flow statements, such as ifs, and only 4423warns when appropriate. E.g.@: 4424 4425@smallexample 4426@group 4427switch (cond) 4428 @{ 4429 case 1: 4430 if (i > 3) @{ 4431 bar (5); 4432 break; 4433 @} else if (i < 1) @{ 4434 bar (0); 4435 @} else 4436 return; 4437 default: 4438 @dots{} 4439 @} 4440@end group 4441@end smallexample 4442 4443Since there are occasions where a switch case fall through is desirable, 4444GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is 4445to be used along with a null statement to suppress this warning that 4446would normally occur: 4447 4448@smallexample 4449@group 4450switch (cond) 4451 @{ 4452 case 1: 4453 bar (0); 4454 __attribute__ ((fallthrough)); 4455 default: 4456 @dots{} 4457 @} 4458@end group 4459@end smallexample 4460 4461C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough} 4462warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11 4463or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension. 4464Instead of these attributes, it is also possible to add a fallthrough comment 4465to silence the warning. The whole body of the C or C++ style comment should 4466match the given regular expressions listed below. The option argument @var{n} 4467specifies what kind of comments are accepted: 4468 4469@itemize @bullet 4470 4471@item @option{-Wimplicit-fallthrough=0} disables the warning altogether. 4472 4473@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular 4474expression, any comment is used as fallthrough comment. 4475 4476@item @option{-Wimplicit-fallthrough=2} case insensitively matches 4477@code{.*falls?[ \t-]*thr(ough|u).*} regular expression. 4478 4479@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the 4480following regular expressions: 4481 4482@itemize @bullet 4483 4484@item @code{-fallthrough} 4485 4486@item @code{@@fallthrough@@} 4487 4488@item @code{lint -fallthrough[ \t]*} 4489 4490@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?} 4491 4492@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?} 4493 4494@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?} 4495 4496@end itemize 4497 4498@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the 4499following regular expressions: 4500 4501@itemize @bullet 4502 4503@item @code{-fallthrough} 4504 4505@item @code{@@fallthrough@@} 4506 4507@item @code{lint -fallthrough[ \t]*} 4508 4509@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*} 4510 4511@end itemize 4512 4513@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as 4514fallthrough comments, only attributes disable the warning. 4515 4516@end itemize 4517 4518The comment needs to be followed after optional whitespace and other comments 4519by @code{case} or @code{default} keywords or by a user label that precedes some 4520@code{case} or @code{default} label. 4521 4522@smallexample 4523@group 4524switch (cond) 4525 @{ 4526 case 1: 4527 bar (0); 4528 /* FALLTHRU */ 4529 default: 4530 @dots{} 4531 @} 4532@end group 4533@end smallexample 4534 4535The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}. 4536 4537@item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 4538@opindex Wif-not-aligned 4539@opindex Wno-if-not-aligned 4540Control if warning triggered by the @code{warn_if_not_aligned} attribute 4541should be issued. This is enabled by default. 4542Use @option{-Wno-if-not-aligned} to disable it. 4543 4544@item -Wignored-qualifiers @r{(C and C++ only)} 4545@opindex Wignored-qualifiers 4546@opindex Wno-ignored-qualifiers 4547Warn if the return type of a function has a type qualifier 4548such as @code{const}. For ISO C such a type qualifier has no effect, 4549since the value returned by a function is not an lvalue. 4550For C++, the warning is only emitted for scalar types or @code{void}. 4551ISO C prohibits qualified @code{void} return types on function 4552definitions, so such return types always receive a warning 4553even without this option. 4554 4555This warning is also enabled by @option{-Wextra}. 4556 4557@item -Wignored-attributes @r{(C and C++ only)} 4558@opindex Wignored-attributes 4559@opindex Wno-ignored-attributes 4560Warn when an attribute is ignored. This is different from the 4561@option{-Wattributes} option in that it warns whenever the compiler decides 4562to drop an attribute, not that the attribute is either unknown, used in a 4563wrong place, etc. This warning is enabled by default. 4564 4565@item -Wmain 4566@opindex Wmain 4567@opindex Wno-main 4568Warn if the type of @code{main} is suspicious. @code{main} should be 4569a function with external linkage, returning int, taking either zero 4570arguments, two, or three arguments of appropriate types. This warning 4571is enabled by default in C++ and is enabled by either @option{-Wall} 4572or @option{-Wpedantic}. 4573 4574@item -Wmisleading-indentation @r{(C and C++ only)} 4575@opindex Wmisleading-indentation 4576@opindex Wno-misleading-indentation 4577Warn when the indentation of the code does not reflect the block structure. 4578Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and 4579@code{for} clauses with a guarded statement that does not use braces, 4580followed by an unguarded statement with the same indentation. 4581 4582In the following example, the call to ``bar'' is misleadingly indented as 4583if it were guarded by the ``if'' conditional. 4584 4585@smallexample 4586 if (some_condition ()) 4587 foo (); 4588 bar (); /* Gotcha: this is not guarded by the "if". */ 4589@end smallexample 4590 4591In the case of mixed tabs and spaces, the warning uses the 4592@option{-ftabstop=} option to determine if the statements line up 4593(defaulting to 8). 4594 4595The warning is not issued for code involving multiline preprocessor logic 4596such as the following example. 4597 4598@smallexample 4599 if (flagA) 4600 foo (0); 4601#if SOME_CONDITION_THAT_DOES_NOT_HOLD 4602 if (flagB) 4603#endif 4604 foo (1); 4605@end smallexample 4606 4607The warning is not issued after a @code{#line} directive, since this 4608typically indicates autogenerated code, and no assumptions can be made 4609about the layout of the file that the directive references. 4610 4611This warning is enabled by @option{-Wall} in C and C++. 4612 4613@item -Wmissing-attributes 4614@opindex Wmissing-attributes 4615@opindex Wno-missing-attributes 4616Warn when a declaration of a function is missing one or more attributes 4617that a related function is declared with and whose absence may adversely 4618affect the correctness or efficiency of generated code. For example, in 4619C++, the warning is issued when an explicit specialization of a primary 4620template declared with attribute @code{alloc_align}, @code{alloc_size}, 4621@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc}, 4622or @code{nonnull} is declared without it. Attributes @code{deprecated}, 4623@code{error}, and @code{warning} suppress the warning. 4624(@pxref{Function Attributes}). 4625 4626@option{-Wmissing-attributes} is enabled by @option{-Wall}. 4627 4628For example, since the declaration of the primary function template 4629below makes use of both attribute @code{malloc} and @code{alloc_size} 4630the declaration of the explicit specialization of the template is 4631diagnosed because it is missing one of the attributes. 4632 4633@smallexample 4634template <class T> 4635T* __attribute__ ((malloc, alloc_size (1))) 4636allocate (size_t); 4637 4638template <> 4639void* __attribute__ ((malloc)) // missing alloc_size 4640allocate<void> (size_t); 4641@end smallexample 4642 4643@item -Wmissing-braces 4644@opindex Wmissing-braces 4645@opindex Wno-missing-braces 4646Warn if an aggregate or union initializer is not fully bracketed. In 4647the following example, the initializer for @code{a} is not fully 4648bracketed, but that for @code{b} is fully bracketed. This warning is 4649enabled by @option{-Wall} in C. 4650 4651@smallexample 4652int a[2][2] = @{ 0, 1, 2, 3 @}; 4653int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 4654@end smallexample 4655 4656This warning is enabled by @option{-Wall}. 4657 4658@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 4659@opindex Wmissing-include-dirs 4660@opindex Wno-missing-include-dirs 4661Warn if a user-supplied include directory does not exist. 4662 4663@item -Wmultistatement-macros 4664@opindex Wmultistatement-macros 4665@opindex Wno-multistatement-macros 4666Warn about unsafe multiple statement macros that appear to be guarded 4667by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or 4668@code{while}, in which only the first statement is actually guarded after 4669the macro is expanded. 4670 4671For example: 4672 4673@smallexample 4674#define DOIT x++; y++ 4675if (c) 4676 DOIT; 4677@end smallexample 4678 4679will increment @code{y} unconditionally, not just when @code{c} holds. 4680The can usually be fixed by wrapping the macro in a do-while loop: 4681@smallexample 4682#define DOIT do @{ x++; y++; @} while (0) 4683if (c) 4684 DOIT; 4685@end smallexample 4686 4687This warning is enabled by @option{-Wall} in C and C++. 4688 4689@item -Wparentheses 4690@opindex Wparentheses 4691@opindex Wno-parentheses 4692Warn if parentheses are omitted in certain contexts, such 4693as when there is an assignment in a context where a truth value 4694is expected, or when operators are nested whose precedence people 4695often get confused about. 4696 4697Also warn if a comparison like @code{x<=y<=z} appears; this is 4698equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 4699interpretation from that of ordinary mathematical notation. 4700 4701Also warn for dangerous uses of the GNU extension to 4702@code{?:} with omitted middle operand. When the condition 4703in the @code{?}: operator is a boolean expression, the omitted value is 4704always 1. Often programmers expect it to be a value computed 4705inside the conditional expression instead. 4706 4707For C++ this also warns for some cases of unnecessary parentheses in 4708declarations, which can indicate an attempt at a function call instead 4709of a declaration: 4710@smallexample 4711@{ 4712 // Declares a local variable called mymutex. 4713 std::unique_lock<std::mutex> (mymutex); 4714 // User meant std::unique_lock<std::mutex> lock (mymutex); 4715@} 4716@end smallexample 4717 4718This warning is enabled by @option{-Wall}. 4719 4720@item -Wsequence-point 4721@opindex Wsequence-point 4722@opindex Wno-sequence-point 4723Warn about code that may have undefined semantics because of violations 4724of sequence point rules in the C and C++ standards. 4725 4726The C and C++ standards define the order in which expressions in a C/C++ 4727program are evaluated in terms of @dfn{sequence points}, which represent 4728a partial ordering between the execution of parts of the program: those 4729executed before the sequence point, and those executed after it. These 4730occur after the evaluation of a full expression (one which is not part 4731of a larger expression), after the evaluation of the first operand of a 4732@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 4733function is called (but after the evaluation of its arguments and the 4734expression denoting the called function), and in certain other places. 4735Other than as expressed by the sequence point rules, the order of 4736evaluation of subexpressions of an expression is not specified. All 4737these rules describe only a partial order rather than a total order, 4738since, for example, if two functions are called within one expression 4739with no sequence point between them, the order in which the functions 4740are called is not specified. However, the standards committee have 4741ruled that function calls do not overlap. 4742 4743It is not specified when between sequence points modifications to the 4744values of objects take effect. Programs whose behavior depends on this 4745have undefined behavior; the C and C++ standards specify that ``Between 4746the previous and next sequence point an object shall have its stored 4747value modified at most once by the evaluation of an expression. 4748Furthermore, the prior value shall be read only to determine the value 4749to be stored.''. If a program breaks these rules, the results on any 4750particular implementation are entirely unpredictable. 4751 4752Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 4753= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 4754diagnosed by this option, and it may give an occasional false positive 4755result, but in general it has been found fairly effective at detecting 4756this sort of problem in programs. 4757 4758The C++17 standard will define the order of evaluation of operands in 4759more cases: in particular it requires that the right-hand side of an 4760assignment be evaluated before the left-hand side, so the above 4761examples are no longer undefined. But this warning will still warn 4762about them, to help people avoid writing code that is undefined in C 4763and earlier revisions of C++. 4764 4765The standard is worded confusingly, therefore there is some debate 4766over the precise meaning of the sequence point rules in subtle cases. 4767Links to discussions of the problem, including proposed formal 4768definitions, may be found on the GCC readings page, at 4769@uref{http://gcc.gnu.org/@/readings.html}. 4770 4771This warning is enabled by @option{-Wall} for C and C++. 4772 4773@item -Wno-return-local-addr 4774@opindex Wno-return-local-addr 4775@opindex Wreturn-local-addr 4776Do not warn about returning a pointer (or in C++, a reference) to a 4777variable that goes out of scope after the function returns. 4778 4779@item -Wreturn-type 4780@opindex Wreturn-type 4781@opindex Wno-return-type 4782Warn whenever a function is defined with a return type that defaults 4783to @code{int}. Also warn about any @code{return} statement with no 4784return value in a function whose return type is not @code{void} 4785(falling off the end of the function body is considered returning 4786without a value). 4787 4788For C only, warn about a @code{return} statement with an expression in a 4789function whose return type is @code{void}, unless the expression type is 4790also @code{void}. As a GNU extension, the latter case is accepted 4791without a warning unless @option{-Wpedantic} is used. 4792 4793For C++, a function without return type always produces a diagnostic 4794message, even when @option{-Wno-return-type} is specified. The only 4795exceptions are @code{main} and functions defined in system headers. 4796 4797This warning is enabled by default for C++ and is enabled by @option{-Wall}. 4798 4799@item -Wshift-count-negative 4800@opindex Wshift-count-negative 4801@opindex Wno-shift-count-negative 4802Warn if shift count is negative. This warning is enabled by default. 4803 4804@item -Wshift-count-overflow 4805@opindex Wshift-count-overflow 4806@opindex Wno-shift-count-overflow 4807Warn if shift count >= width of type. This warning is enabled by default. 4808 4809@item -Wshift-negative-value 4810@opindex Wshift-negative-value 4811@opindex Wno-shift-negative-value 4812Warn if left shifting a negative value. This warning is enabled by 4813@option{-Wextra} in C99 and C++11 modes (and newer). 4814 4815@item -Wshift-overflow 4816@itemx -Wshift-overflow=@var{n} 4817@opindex Wshift-overflow 4818@opindex Wno-shift-overflow 4819Warn about left shift overflows. This warning is enabled by 4820default in C99 and C++11 modes (and newer). 4821 4822@table @gcctabopt 4823@item -Wshift-overflow=1 4824This is the warning level of @option{-Wshift-overflow} and is enabled 4825by default in C99 and C++11 modes (and newer). This warning level does 4826not warn about left-shifting 1 into the sign bit. (However, in C, such 4827an overflow is still rejected in contexts where an integer constant expression 4828is required.) 4829 4830@item -Wshift-overflow=2 4831This warning level also warns about left-shifting 1 into the sign bit, 4832unless C++14 mode is active. 4833@end table 4834 4835@item -Wswitch 4836@opindex Wswitch 4837@opindex Wno-switch 4838Warn whenever a @code{switch} statement has an index of enumerated type 4839and lacks a @code{case} for one or more of the named codes of that 4840enumeration. (The presence of a @code{default} label prevents this 4841warning.) @code{case} labels outside the enumeration range also 4842provoke warnings when this option is used (even if there is a 4843@code{default} label). 4844This warning is enabled by @option{-Wall}. 4845 4846@item -Wswitch-default 4847@opindex Wswitch-default 4848@opindex Wno-switch-default 4849Warn whenever a @code{switch} statement does not have a @code{default} 4850case. 4851 4852@item -Wswitch-enum 4853@opindex Wswitch-enum 4854@opindex Wno-switch-enum 4855Warn whenever a @code{switch} statement has an index of enumerated type 4856and lacks a @code{case} for one or more of the named codes of that 4857enumeration. @code{case} labels outside the enumeration range also 4858provoke warnings when this option is used. The only difference 4859between @option{-Wswitch} and this option is that this option gives a 4860warning about an omitted enumeration code even if there is a 4861@code{default} label. 4862 4863@item -Wswitch-bool 4864@opindex Wswitch-bool 4865@opindex Wno-switch-bool 4866Warn whenever a @code{switch} statement has an index of boolean type 4867and the case values are outside the range of a boolean type. 4868It is possible to suppress this warning by casting the controlling 4869expression to a type other than @code{bool}. For example: 4870@smallexample 4871@group 4872switch ((int) (a == 4)) 4873 @{ 4874 @dots{} 4875 @} 4876@end group 4877@end smallexample 4878This warning is enabled by default for C and C++ programs. 4879 4880@item -Wswitch-unreachable 4881@opindex Wswitch-unreachable 4882@opindex Wno-switch-unreachable 4883Warn whenever a @code{switch} statement contains statements between the 4884controlling expression and the first case label, which will never be 4885executed. For example: 4886@smallexample 4887@group 4888switch (cond) 4889 @{ 4890 i = 15; 4891 @dots{} 4892 case 5: 4893 @dots{} 4894 @} 4895@end group 4896@end smallexample 4897@option{-Wswitch-unreachable} does not warn if the statement between the 4898controlling expression and the first case label is just a declaration: 4899@smallexample 4900@group 4901switch (cond) 4902 @{ 4903 int i; 4904 @dots{} 4905 case 5: 4906 i = 5; 4907 @dots{} 4908 @} 4909@end group 4910@end smallexample 4911This warning is enabled by default for C and C++ programs. 4912 4913@item -Wsync-nand @r{(C and C++ only)} 4914@opindex Wsync-nand 4915@opindex Wno-sync-nand 4916Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 4917built-in functions are used. These functions changed semantics in GCC 4.4. 4918 4919@item -Wunused-but-set-parameter 4920@opindex Wunused-but-set-parameter 4921@opindex Wno-unused-but-set-parameter 4922Warn whenever a function parameter is assigned to, but otherwise unused 4923(aside from its declaration). 4924 4925To suppress this warning use the @code{unused} attribute 4926(@pxref{Variable Attributes}). 4927 4928This warning is also enabled by @option{-Wunused} together with 4929@option{-Wextra}. 4930 4931@item -Wunused-but-set-variable 4932@opindex Wunused-but-set-variable 4933@opindex Wno-unused-but-set-variable 4934Warn whenever a local variable is assigned to, but otherwise unused 4935(aside from its declaration). 4936This warning is enabled by @option{-Wall}. 4937 4938To suppress this warning use the @code{unused} attribute 4939(@pxref{Variable Attributes}). 4940 4941This warning is also enabled by @option{-Wunused}, which is enabled 4942by @option{-Wall}. 4943 4944@item -Wunused-function 4945@opindex Wunused-function 4946@opindex Wno-unused-function 4947Warn whenever a static function is declared but not defined or a 4948non-inline static function is unused. 4949This warning is enabled by @option{-Wall}. 4950 4951@item -Wunused-label 4952@opindex Wunused-label 4953@opindex Wno-unused-label 4954Warn whenever a label is declared but not used. 4955This warning is enabled by @option{-Wall}. 4956 4957To suppress this warning use the @code{unused} attribute 4958(@pxref{Variable Attributes}). 4959 4960@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 4961@opindex Wunused-local-typedefs 4962Warn when a typedef locally defined in a function is not used. 4963This warning is enabled by @option{-Wall}. 4964 4965@item -Wunused-parameter 4966@opindex Wunused-parameter 4967@opindex Wno-unused-parameter 4968Warn whenever a function parameter is unused aside from its declaration. 4969 4970To suppress this warning use the @code{unused} attribute 4971(@pxref{Variable Attributes}). 4972 4973@item -Wno-unused-result 4974@opindex Wunused-result 4975@opindex Wno-unused-result 4976Do not warn if a caller of a function marked with attribute 4977@code{warn_unused_result} (@pxref{Function Attributes}) does not use 4978its return value. The default is @option{-Wunused-result}. 4979 4980@item -Wunused-variable 4981@opindex Wunused-variable 4982@opindex Wno-unused-variable 4983Warn whenever a local or static variable is unused aside from its 4984declaration. This option implies @option{-Wunused-const-variable=1} for C, 4985but not for C++. This warning is enabled by @option{-Wall}. 4986 4987To suppress this warning use the @code{unused} attribute 4988(@pxref{Variable Attributes}). 4989 4990@item -Wunused-const-variable 4991@itemx -Wunused-const-variable=@var{n} 4992@opindex Wunused-const-variable 4993@opindex Wno-unused-const-variable 4994Warn whenever a constant static variable is unused aside from its declaration. 4995@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable} 4996for C, but not for C++. In C this declares variable storage, but in C++ this 4997is not an error since const variables take the place of @code{#define}s. 4998 4999To suppress this warning use the @code{unused} attribute 5000(@pxref{Variable Attributes}). 5001 5002@table @gcctabopt 5003@item -Wunused-const-variable=1 5004This is the warning level that is enabled by @option{-Wunused-variable} for 5005C. It warns only about unused static const variables defined in the main 5006compilation unit, but not about static const variables declared in any 5007header included. 5008 5009@item -Wunused-const-variable=2 5010This warning level also warns for unused constant static variables in 5011headers (excluding system headers). This is the warning level of 5012@option{-Wunused-const-variable} and must be explicitly requested since 5013in C++ this isn't an error and in C it might be harder to clean up all 5014headers included. 5015@end table 5016 5017@item -Wunused-value 5018@opindex Wunused-value 5019@opindex Wno-unused-value 5020Warn whenever a statement computes a result that is explicitly not 5021used. To suppress this warning cast the unused expression to 5022@code{void}. This includes an expression-statement or the left-hand 5023side of a comma expression that contains no side effects. For example, 5024an expression such as @code{x[i,j]} causes a warning, while 5025@code{x[(void)i,j]} does not. 5026 5027This warning is enabled by @option{-Wall}. 5028 5029@item -Wunused 5030@opindex Wunused 5031@opindex Wno-unused 5032All the above @option{-Wunused} options combined. 5033 5034In order to get a warning about an unused function parameter, you must 5035either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 5036@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 5037 5038@item -Wuninitialized 5039@opindex Wuninitialized 5040@opindex Wno-uninitialized 5041Warn if an automatic variable is used without first being initialized 5042or if a variable may be clobbered by a @code{setjmp} call. In C++, 5043warn if a non-static reference or non-static @code{const} member 5044appears in a class without constructors. 5045 5046If you want to warn about code that uses the uninitialized value of the 5047variable in its own initializer, use the @option{-Winit-self} option. 5048 5049These warnings occur for individual uninitialized or clobbered 5050elements of structure, union or array variables as well as for 5051variables that are uninitialized or clobbered as a whole. They do 5052not occur for variables or elements declared @code{volatile}. Because 5053these warnings depend on optimization, the exact variables or elements 5054for which there are warnings depends on the precise optimization 5055options and version of GCC used. 5056 5057Note that there may be no warning about a variable that is used only 5058to compute a value that itself is never used, because such 5059computations may be deleted by data flow analysis before the warnings 5060are printed. 5061 5062@item -Winvalid-memory-model 5063@opindex Winvalid-memory-model 5064@opindex Wno-invalid-memory-model 5065Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, 5066and the C11 atomic generic functions with a memory consistency argument 5067that is either invalid for the operation or outside the range of values 5068of the @code{memory_order} enumeration. For example, since the 5069@code{__atomic_store} and @code{__atomic_store_n} built-ins are only 5070defined for the relaxed, release, and sequentially consistent memory 5071orders the following code is diagnosed: 5072 5073@smallexample 5074void store (int *i) 5075@{ 5076 __atomic_store_n (i, 0, memory_order_consume); 5077@} 5078@end smallexample 5079 5080@option{-Winvalid-memory-model} is enabled by default. 5081 5082@item -Wmaybe-uninitialized 5083@opindex Wmaybe-uninitialized 5084@opindex Wno-maybe-uninitialized 5085For an automatic (i.e.@ local) variable, if there exists a path from the 5086function entry to a use of the variable that is initialized, but there exist 5087some other paths for which the variable is not initialized, the compiler 5088emits a warning if it cannot prove the uninitialized paths are not 5089executed at run time. 5090 5091These warnings are only possible in optimizing compilation, because otherwise 5092GCC does not keep track of the state of variables. 5093 5094These warnings are made optional because GCC may not be able to determine when 5095the code is correct in spite of appearing to have an error. Here is one 5096example of how this can happen: 5097 5098@smallexample 5099@group 5100@{ 5101 int x; 5102 switch (y) 5103 @{ 5104 case 1: x = 1; 5105 break; 5106 case 2: x = 4; 5107 break; 5108 case 3: x = 5; 5109 @} 5110 foo (x); 5111@} 5112@end group 5113@end smallexample 5114 5115@noindent 5116If the value of @code{y} is always 1, 2 or 3, then @code{x} is 5117always initialized, but GCC doesn't know this. To suppress the 5118warning, you need to provide a default case with assert(0) or 5119similar code. 5120 5121@cindex @code{longjmp} warnings 5122This option also warns when a non-volatile automatic variable might be 5123changed by a call to @code{longjmp}. 5124The compiler sees only the calls to @code{setjmp}. It cannot know 5125where @code{longjmp} will be called; in fact, a signal handler could 5126call it at any point in the code. As a result, you may get a warning 5127even when there is in fact no problem because @code{longjmp} cannot 5128in fact be called at the place that would cause a problem. 5129 5130Some spurious warnings can be avoided if you declare all the functions 5131you use that never return as @code{noreturn}. @xref{Function 5132Attributes}. 5133 5134This warning is enabled by @option{-Wall} or @option{-Wextra}. 5135 5136@item -Wunknown-pragmas 5137@opindex Wunknown-pragmas 5138@opindex Wno-unknown-pragmas 5139@cindex warning for unknown pragmas 5140@cindex unknown pragmas, warning 5141@cindex pragmas, warning of unknown 5142Warn when a @code{#pragma} directive is encountered that is not understood by 5143GCC@. If this command-line option is used, warnings are even issued 5144for unknown pragmas in system header files. This is not the case if 5145the warnings are only enabled by the @option{-Wall} command-line option. 5146 5147@item -Wno-pragmas 5148@opindex Wno-pragmas 5149@opindex Wpragmas 5150Do not warn about misuses of pragmas, such as incorrect parameters, 5151invalid syntax, or conflicts between pragmas. See also 5152@option{-Wunknown-pragmas}. 5153 5154@item -Wstrict-aliasing 5155@opindex Wstrict-aliasing 5156@opindex Wno-strict-aliasing 5157This option is only active when @option{-fstrict-aliasing} is active. 5158It warns about code that might break the strict aliasing rules that the 5159compiler is using for optimization. The warning does not catch all 5160cases, but does attempt to catch the more common pitfalls. It is 5161included in @option{-Wall}. 5162It is equivalent to @option{-Wstrict-aliasing=3} 5163 5164@item -Wstrict-aliasing=n 5165@opindex Wstrict-aliasing=n 5166This option is only active when @option{-fstrict-aliasing} is active. 5167It warns about code that might break the strict aliasing rules that the 5168compiler is using for optimization. 5169Higher levels correspond to higher accuracy (fewer false positives). 5170Higher levels also correspond to more effort, similar to the way @option{-O} 5171works. 5172@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 5173 5174Level 1: Most aggressive, quick, least accurate. 5175Possibly useful when higher levels 5176do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 5177false negatives. However, it has many false positives. 5178Warns for all pointer conversions between possibly incompatible types, 5179even if never dereferenced. Runs in the front end only. 5180 5181Level 2: Aggressive, quick, not too precise. 5182May still have many false positives (not as many as level 1 though), 5183and few false negatives (but possibly more than level 1). 5184Unlike level 1, it only warns when an address is taken. Warns about 5185incomplete types. Runs in the front end only. 5186 5187Level 3 (default for @option{-Wstrict-aliasing}): 5188Should have very few false positives and few false 5189negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 5190Takes care of the common pun+dereference pattern in the front end: 5191@code{*(int*)&some_float}. 5192If optimization is enabled, it also runs in the back end, where it deals 5193with multiple statement cases using flow-sensitive points-to information. 5194Only warns when the converted pointer is dereferenced. 5195Does not warn about incomplete types. 5196 5197@item -Wstrict-overflow 5198@itemx -Wstrict-overflow=@var{n} 5199@opindex Wstrict-overflow 5200@opindex Wno-strict-overflow 5201This option is only active when signed overflow is undefined. 5202It warns about cases where the compiler optimizes based on the 5203assumption that signed overflow does not occur. Note that it does not 5204warn about all cases where the code might overflow: it only warns 5205about cases where the compiler implements some optimization. Thus 5206this warning depends on the optimization level. 5207 5208An optimization that assumes that signed overflow does not occur is 5209perfectly safe if the values of the variables involved are such that 5210overflow never does, in fact, occur. Therefore this warning can 5211easily give a false positive: a warning about code that is not 5212actually a problem. To help focus on important issues, several 5213warning levels are defined. No warnings are issued for the use of 5214undefined signed overflow when estimating how many iterations a loop 5215requires, in particular when determining whether a loop will be 5216executed at all. 5217 5218@table @gcctabopt 5219@item -Wstrict-overflow=1 5220Warn about cases that are both questionable and easy to avoid. For 5221example the compiler simplifies 5222@code{x + 1 > x} to @code{1}. This level of 5223@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 5224are not, and must be explicitly requested. 5225 5226@item -Wstrict-overflow=2 5227Also warn about other cases where a comparison is simplified to a 5228constant. For example: @code{abs (x) >= 0}. This can only be 5229simplified when signed integer overflow is undefined, because 5230@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 5231zero. @option{-Wstrict-overflow} (with no level) is the same as 5232@option{-Wstrict-overflow=2}. 5233 5234@item -Wstrict-overflow=3 5235Also warn about other cases where a comparison is simplified. For 5236example: @code{x + 1 > 1} is simplified to @code{x > 0}. 5237 5238@item -Wstrict-overflow=4 5239Also warn about other simplifications not covered by the above cases. 5240For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 5241 5242@item -Wstrict-overflow=5 5243Also warn about cases where the compiler reduces the magnitude of a 5244constant involved in a comparison. For example: @code{x + 2 > y} is 5245simplified to @code{x + 1 >= y}. This is reported only at the 5246highest warning level because this simplification applies to many 5247comparisons, so this warning level gives a very large number of 5248false positives. 5249@end table 5250 5251@item -Wstringop-overflow 5252@itemx -Wstringop-overflow=@var{type} 5253@opindex Wstringop-overflow 5254@opindex Wno-stringop-overflow 5255Warn for calls to string manipulation functions such as @code{memcpy} and 5256@code{strcpy} that are determined to overflow the destination buffer. The 5257optional argument is one greater than the type of Object Size Checking to 5258perform to determine the size of the destination. @xref{Object Size Checking}. 5259The argument is meaningful only for functions that operate on character arrays 5260but not for raw memory functions like @code{memcpy} which always make use 5261of Object Size type-0. The option also warns for calls that specify a size 5262in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes. 5263The option produces the best results with optimization enabled but can detect 5264a small subset of simple buffer overflows even without optimization in 5265calls to the GCC built-in functions like @code{__builtin_memcpy} that 5266correspond to the standard functions. In any case, the option warns about 5267just a subset of buffer overflows detected by the corresponding overflow 5268checking built-ins. For example, the option will issue a warning for 5269the @code{strcpy} call below because it copies at least 5 characters 5270(the string @code{"blue"} including the terminating NUL) into the buffer 5271of size 4. 5272 5273@smallexample 5274enum Color @{ blue, purple, yellow @}; 5275const char* f (enum Color clr) 5276@{ 5277 static char buf [4]; 5278 const char *str; 5279 switch (clr) 5280 @{ 5281 case blue: str = "blue"; break; 5282 case purple: str = "purple"; break; 5283 case yellow: str = "yellow"; break; 5284 @} 5285 5286 return strcpy (buf, str); // warning here 5287@} 5288@end smallexample 5289 5290Option @option{-Wstringop-overflow=2} is enabled by default. 5291 5292@table @gcctabopt 5293@item -Wstringop-overflow 5294@itemx -Wstringop-overflow=1 5295@opindex Wstringop-overflow 5296@opindex Wno-stringop-overflow 5297The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking 5298to determine the sizes of destination objects. This is the default setting 5299of the option. At this setting the option will not warn for writes past 5300the end of subobjects of larger objects accessed by pointers unless the 5301size of the largest surrounding object is known. When the destination may 5302be one of several objects it is assumed to be the largest one of them. On 5303Linux systems, when optimization is enabled at this setting the option warns 5304for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to 5305a non-zero value. 5306 5307@item -Wstringop-overflow=2 5308The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking 5309to determine the sizes of destination objects. At this setting the option 5310will warn about overflows when writing to members of the largest complete 5311objects whose exact size is known. It will, however, not warn for excessive 5312writes to the same members of unknown objects referenced by pointers since 5313they may point to arrays containing unknown numbers of elements. 5314 5315@item -Wstringop-overflow=3 5316The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking 5317to determine the sizes of destination objects. At this setting the option 5318warns about overflowing the smallest object or data member. This is the 5319most restrictive setting of the option that may result in warnings for safe 5320code. 5321 5322@item -Wstringop-overflow=4 5323The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking 5324to determine the sizes of destination objects. At this setting the option 5325will warn about overflowing any data members, and when the destination is 5326one of several objects it uses the size of the largest of them to decide 5327whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this 5328setting of the option may result in warnings for benign code. 5329@end table 5330 5331@item -Wstringop-truncation 5332@opindex Wstringop-truncation 5333@opindex Wno-stringop-truncation 5334Warn for calls to bounded string manipulation functions such as @code{strncat}, 5335@code{strncpy}, and @code{stpncpy} that may either truncate the copied string 5336or leave the destination unchanged. 5337 5338In the following example, the call to @code{strncat} specifies a bound that 5339is less than the length of the source string. As a result, the copy of 5340the source will be truncated and so the call is diagnosed. To avoid the 5341warning use @code{bufsize - strlen (buf) - 1)} as the bound. 5342 5343@smallexample 5344void append (char *buf, size_t bufsize) 5345@{ 5346 strncat (buf, ".txt", 3); 5347@} 5348@end smallexample 5349 5350As another example, the following call to @code{strncpy} results in copying 5351to @code{d} just the characters preceding the terminating NUL, without 5352appending the NUL to the end. Assuming the result of @code{strncpy} is 5353necessarily a NUL-terminated string is a common mistake, and so the call 5354is diagnosed. To avoid the warning when the result is not expected to be 5355NUL-terminated, call @code{memcpy} instead. 5356 5357@smallexample 5358void copy (char *d, const char *s) 5359@{ 5360 strncpy (d, s, strlen (s)); 5361@} 5362@end smallexample 5363 5364In the following example, the call to @code{strncpy} specifies the size 5365of the destination buffer as the bound. If the length of the source 5366string is equal to or greater than this size the result of the copy will 5367not be NUL-terminated. Therefore, the call is also diagnosed. To avoid 5368the warning, specify @code{sizeof buf - 1} as the bound and set the last 5369element of the buffer to @code{NUL}. 5370 5371@smallexample 5372void copy (const char *s) 5373@{ 5374 char buf[80]; 5375 strncpy (buf, s, sizeof buf); 5376 @dots{} 5377@} 5378@end smallexample 5379 5380In situations where a character array is intended to store a sequence 5381of bytes with no terminating @code{NUL} such an array may be annotated 5382with attribute @code{nonstring} to avoid this warning. Such arrays, 5383however, are not suitable arguments to functions that expect 5384@code{NUL}-terminated strings. To help detect accidental misuses of 5385such arrays GCC issues warnings unless it can prove that the use is 5386safe. @xref{Common Variable Attributes}. 5387 5388Option @option{-Wstringop-truncation} is enabled by @option{-Wall}. 5389 5390@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]} 5391@opindex Wsuggest-attribute= 5392@opindex Wno-suggest-attribute= 5393Warn for cases where adding an attribute may be beneficial. The 5394attributes currently supported are listed below. 5395 5396@table @gcctabopt 5397@item -Wsuggest-attribute=pure 5398@itemx -Wsuggest-attribute=const 5399@itemx -Wsuggest-attribute=noreturn 5400@itemx -Wsuggest-attribute=malloc 5401@opindex Wsuggest-attribute=pure 5402@opindex Wno-suggest-attribute=pure 5403@opindex Wsuggest-attribute=const 5404@opindex Wno-suggest-attribute=const 5405@opindex Wsuggest-attribute=noreturn 5406@opindex Wno-suggest-attribute=noreturn 5407@opindex Wsuggest-attribute=malloc 5408@opindex Wno-suggest-attribute=malloc 5409 5410Warn about functions that might be candidates for attributes 5411@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler 5412only warns for functions visible in other compilation units or (in the case of 5413@code{pure} and @code{const}) if it cannot prove that the function returns 5414normally. A function returns normally if it doesn't contain an infinite loop or 5415return abnormally by throwing, calling @code{abort} or trapping. This analysis 5416requires option @option{-fipa-pure-const}, which is enabled by default at 5417@option{-O} and higher. Higher optimization levels improve the accuracy 5418of the analysis. 5419 5420@item -Wsuggest-attribute=format 5421@itemx -Wmissing-format-attribute 5422@opindex Wsuggest-attribute=format 5423@opindex Wmissing-format-attribute 5424@opindex Wno-suggest-attribute=format 5425@opindex Wno-missing-format-attribute 5426@opindex Wformat 5427@opindex Wno-format 5428 5429Warn about function pointers that might be candidates for @code{format} 5430attributes. Note these are only possible candidates, not absolute ones. 5431GCC guesses that function pointers with @code{format} attributes that 5432are used in assignment, initialization, parameter passing or return 5433statements should have a corresponding @code{format} attribute in the 5434resulting type. I.e.@: the left-hand side of the assignment or 5435initialization, the type of the parameter variable, or the return type 5436of the containing function respectively should also have a @code{format} 5437attribute to avoid the warning. 5438 5439GCC also warns about function definitions that might be 5440candidates for @code{format} attributes. Again, these are only 5441possible candidates. GCC guesses that @code{format} attributes 5442might be appropriate for any function that calls a function like 5443@code{vprintf} or @code{vscanf}, but this might not always be the 5444case, and some functions for which @code{format} attributes are 5445appropriate may not be detected. 5446 5447@item -Wsuggest-attribute=cold 5448@opindex Wsuggest-attribute=cold 5449@opindex Wno-suggest-attribute=cold 5450 5451Warn about functions that might be candidates for @code{cold} attribute. This 5452is based on static detection and generally will only warn about functions which 5453always leads to a call to another @code{cold} function such as wrappers of 5454C++ @code{throw} or fatal error reporting functions leading to @code{abort}. 5455@end table 5456 5457@item -Wsuggest-final-types 5458@opindex Wno-suggest-final-types 5459@opindex Wsuggest-final-types 5460Warn about types with virtual methods where code quality would be improved 5461if the type were declared with the C++11 @code{final} specifier, 5462or, if possible, 5463declared in an anonymous namespace. This allows GCC to more aggressively 5464devirtualize the polymorphic calls. This warning is more effective with link 5465time optimization, where the information about the class hierarchy graph is 5466more complete. 5467 5468@item -Wsuggest-final-methods 5469@opindex Wno-suggest-final-methods 5470@opindex Wsuggest-final-methods 5471Warn about virtual methods where code quality would be improved if the method 5472were declared with the C++11 @code{final} specifier, 5473or, if possible, its type were 5474declared in an anonymous namespace or with the @code{final} specifier. 5475This warning is 5476more effective with link-time optimization, where the information about the 5477class hierarchy graph is more complete. It is recommended to first consider 5478suggestions of @option{-Wsuggest-final-types} and then rebuild with new 5479annotations. 5480 5481@item -Wsuggest-override 5482Warn about overriding virtual functions that are not marked with the override 5483keyword. 5484 5485@item -Walloc-zero 5486@opindex Wno-alloc-zero 5487@opindex Walloc-zero 5488Warn about calls to allocation functions decorated with attribute 5489@code{alloc_size} that specify zero bytes, including those to the built-in 5490forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc}, 5491@code{malloc}, and @code{realloc}. Because the behavior of these functions 5492when called with a zero size differs among implementations (and in the case 5493of @code{realloc} has been deprecated) relying on it may result in subtle 5494portability bugs and should be avoided. 5495 5496@item -Walloc-size-larger-than=@var{n} 5497Warn about calls to functions decorated with attribute @code{alloc_size} 5498that attempt to allocate objects larger than the specified number of bytes, 5499or where the result of the size computation in an integer type with infinite 5500precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n} 5501may end in one of the standard suffixes designating a multiple of bytes 5502such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively, 5503@code{MB} and @code{MiB} for megabyte and mebibyte, and so on. 5504@option{-Walloc-size-larger-than=}@var{PTRDIFF_MAX} is enabled by default. 5505Warnings controlled by the option can be disabled by specifying @var{n} 5506of @var{SIZE_MAX} or more. 5507@xref{Function Attributes}. 5508 5509@item -Walloca 5510@opindex Wno-alloca 5511@opindex Walloca 5512This option warns on all uses of @code{alloca} in the source. 5513 5514@item -Walloca-larger-than=@var{n} 5515This option warns on calls to @code{alloca} that are not bounded by a 5516controlling predicate limiting its argument of integer type to at most 5517@var{n} bytes, or calls to @code{alloca} where the bound is unknown. 5518Arguments of non-integer types are considered unbounded even if they 5519appear to be constrained to the expected range. 5520 5521For example, a bounded case of @code{alloca} could be: 5522 5523@smallexample 5524void func (size_t n) 5525@{ 5526 void *p; 5527 if (n <= 1000) 5528 p = alloca (n); 5529 else 5530 p = malloc (n); 5531 f (p); 5532@} 5533@end smallexample 5534 5535In the above example, passing @code{-Walloca-larger-than=1000} would not 5536issue a warning because the call to @code{alloca} is known to be at most 55371000 bytes. However, if @code{-Walloca-larger-than=500} were passed, 5538the compiler would emit a warning. 5539 5540Unbounded uses, on the other hand, are uses of @code{alloca} with no 5541controlling predicate constraining its integer argument. For example: 5542 5543@smallexample 5544void func () 5545@{ 5546 void *p = alloca (n); 5547 f (p); 5548@} 5549@end smallexample 5550 5551If @code{-Walloca-larger-than=500} were passed, the above would trigger 5552a warning, but this time because of the lack of bounds checking. 5553 5554Note, that even seemingly correct code involving signed integers could 5555cause a warning: 5556 5557@smallexample 5558void func (signed int n) 5559@{ 5560 if (n < 500) 5561 @{ 5562 p = alloca (n); 5563 f (p); 5564 @} 5565@} 5566@end smallexample 5567 5568In the above example, @var{n} could be negative, causing a larger than 5569expected argument to be implicitly cast into the @code{alloca} call. 5570 5571This option also warns when @code{alloca} is used in a loop. 5572 5573This warning is not enabled by @option{-Wall}, and is only active when 5574@option{-ftree-vrp} is active (default for @option{-O2} and above). 5575 5576See also @option{-Wvla-larger-than=@var{n}}. 5577 5578@item -Warray-bounds 5579@itemx -Warray-bounds=@var{n} 5580@opindex Wno-array-bounds 5581@opindex Warray-bounds 5582This option is only active when @option{-ftree-vrp} is active 5583(default for @option{-O2} and above). It warns about subscripts to arrays 5584that are always out of bounds. This warning is enabled by @option{-Wall}. 5585 5586@table @gcctabopt 5587@item -Warray-bounds=1 5588This is the warning level of @option{-Warray-bounds} and is enabled 5589by @option{-Wall}; higher levels are not, and must be explicitly requested. 5590 5591@item -Warray-bounds=2 5592This warning level also warns about out of bounds access for 5593arrays at the end of a struct and for arrays accessed through 5594pointers. This warning level may give a larger number of 5595false positives and is deactivated by default. 5596@end table 5597 5598@item -Wattribute-alias 5599Warn about declarations using the @code{alias} and similar attributes whose 5600target is incompatible with the type of the alias. @xref{Function Attributes, 5601,Declaring Attributes of Functions}. 5602 5603@item -Wbool-compare 5604@opindex Wno-bool-compare 5605@opindex Wbool-compare 5606Warn about boolean expression compared with an integer value different from 5607@code{true}/@code{false}. For instance, the following comparison is 5608always false: 5609@smallexample 5610int n = 5; 5611@dots{} 5612if ((n > 1) == 2) @{ @dots{} @} 5613@end smallexample 5614This warning is enabled by @option{-Wall}. 5615 5616@item -Wbool-operation 5617@opindex Wno-bool-operation 5618@opindex Wbool-operation 5619Warn about suspicious operations on expressions of a boolean type. For 5620instance, bitwise negation of a boolean is very likely a bug in the program. 5621For C, this warning also warns about incrementing or decrementing a boolean, 5622which rarely makes sense. (In C++, decrementing a boolean is always invalid. 5623Incrementing a boolean is invalid in C++17, and deprecated otherwise.) 5624 5625This warning is enabled by @option{-Wall}. 5626 5627@item -Wduplicated-branches 5628@opindex Wno-duplicated-branches 5629@opindex Wduplicated-branches 5630Warn when an if-else has identical branches. This warning detects cases like 5631@smallexample 5632if (p != NULL) 5633 return 0; 5634else 5635 return 0; 5636@end smallexample 5637It doesn't warn when both branches contain just a null statement. This warning 5638also warn for conditional operators: 5639@smallexample 5640 int i = x ? *p : *p; 5641@end smallexample 5642 5643@item -Wduplicated-cond 5644@opindex Wno-duplicated-cond 5645@opindex Wduplicated-cond 5646Warn about duplicated conditions in an if-else-if chain. For instance, 5647warn for the following code: 5648@smallexample 5649if (p->q != NULL) @{ @dots{} @} 5650else if (p->q != NULL) @{ @dots{} @} 5651@end smallexample 5652 5653@item -Wframe-address 5654@opindex Wno-frame-address 5655@opindex Wframe-address 5656Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address} 5657is called with an argument greater than 0. Such calls may return indeterminate 5658values or crash the program. The warning is included in @option{-Wall}. 5659 5660@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 5661@opindex Wno-discarded-qualifiers 5662@opindex Wdiscarded-qualifiers 5663Do not warn if type qualifiers on pointers are being discarded. 5664Typically, the compiler warns if a @code{const char *} variable is 5665passed to a function that takes a @code{char *} parameter. This option 5666can be used to suppress such a warning. 5667 5668@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 5669@opindex Wno-discarded-array-qualifiers 5670@opindex Wdiscarded-array-qualifiers 5671Do not warn if type qualifiers on arrays which are pointer targets 5672are being discarded. Typically, the compiler warns if a 5673@code{const int (*)[]} variable is passed to a function that 5674takes a @code{int (*)[]} parameter. This option can be used to 5675suppress such a warning. 5676 5677@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 5678@opindex Wno-incompatible-pointer-types 5679@opindex Wincompatible-pointer-types 5680Do not warn when there is a conversion between pointers that have incompatible 5681types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 5682which warns for pointer argument passing or assignment with different 5683signedness. 5684 5685@item -Wno-int-conversion @r{(C and Objective-C only)} 5686@opindex Wno-int-conversion 5687@opindex Wint-conversion 5688Do not warn about incompatible integer to pointer and pointer to integer 5689conversions. This warning is about implicit conversions; for explicit 5690conversions the warnings @option{-Wno-int-to-pointer-cast} and 5691@option{-Wno-pointer-to-int-cast} may be used. 5692 5693@item -Wno-div-by-zero 5694@opindex Wno-div-by-zero 5695@opindex Wdiv-by-zero 5696Do not warn about compile-time integer division by zero. Floating-point 5697division by zero is not warned about, as it can be a legitimate way of 5698obtaining infinities and NaNs. 5699 5700@item -Wsystem-headers 5701@opindex Wsystem-headers 5702@opindex Wno-system-headers 5703@cindex warnings from system headers 5704@cindex system headers, warnings from 5705Print warning messages for constructs found in system header files. 5706Warnings from system headers are normally suppressed, on the assumption 5707that they usually do not indicate real problems and would only make the 5708compiler output harder to read. Using this command-line option tells 5709GCC to emit warnings from system headers as if they occurred in user 5710code. However, note that using @option{-Wall} in conjunction with this 5711option does @emph{not} warn about unknown pragmas in system 5712headers---for that, @option{-Wunknown-pragmas} must also be used. 5713 5714@item -Wtautological-compare 5715@opindex Wtautological-compare 5716@opindex Wno-tautological-compare 5717Warn if a self-comparison always evaluates to true or false. This 5718warning detects various mistakes such as: 5719@smallexample 5720int i = 1; 5721@dots{} 5722if (i > i) @{ @dots{} @} 5723@end smallexample 5724 5725This warning also warns about bitwise comparisons that always evaluate 5726to true or false, for instance: 5727@smallexample 5728if ((a & 16) == 10) @{ @dots{} @} 5729@end smallexample 5730will always be false. 5731 5732This warning is enabled by @option{-Wall}. 5733 5734@item -Wtrampolines 5735@opindex Wtrampolines 5736@opindex Wno-trampolines 5737Warn about trampolines generated for pointers to nested functions. 5738A trampoline is a small piece of data or code that is created at run 5739time on the stack when the address of a nested function is taken, and is 5740used to call the nested function indirectly. For some targets, it is 5741made up of data only and thus requires no special treatment. But, for 5742most targets, it is made up of code and thus requires the stack to be 5743made executable in order for the program to work properly. 5744 5745@item -Wfloat-equal 5746@opindex Wfloat-equal 5747@opindex Wno-float-equal 5748Warn if floating-point values are used in equality comparisons. 5749 5750The idea behind this is that sometimes it is convenient (for the 5751programmer) to consider floating-point values as approximations to 5752infinitely precise real numbers. If you are doing this, then you need 5753to compute (by analyzing the code, or in some other way) the maximum or 5754likely maximum error that the computation introduces, and allow for it 5755when performing comparisons (and when producing output, but that's a 5756different problem). In particular, instead of testing for equality, you 5757should check to see whether the two values have ranges that overlap; and 5758this is done with the relational operators, so equality comparisons are 5759probably mistaken. 5760 5761@item -Wtraditional @r{(C and Objective-C only)} 5762@opindex Wtraditional 5763@opindex Wno-traditional 5764Warn about certain constructs that behave differently in traditional and 5765ISO C@. Also warn about ISO C constructs that have no traditional C 5766equivalent, and/or problematic constructs that should be avoided. 5767 5768@itemize @bullet 5769@item 5770Macro parameters that appear within string literals in the macro body. 5771In traditional C macro replacement takes place within string literals, 5772but in ISO C it does not. 5773 5774@item 5775In traditional C, some preprocessor directives did not exist. 5776Traditional preprocessors only considered a line to be a directive 5777if the @samp{#} appeared in column 1 on the line. Therefore 5778@option{-Wtraditional} warns about directives that traditional C 5779understands but ignores because the @samp{#} does not appear as the 5780first character on the line. It also suggests you hide directives like 5781@code{#pragma} not understood by traditional C by indenting them. Some 5782traditional implementations do not recognize @code{#elif}, so this option 5783suggests avoiding it altogether. 5784 5785@item 5786A function-like macro that appears without arguments. 5787 5788@item 5789The unary plus operator. 5790 5791@item 5792The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 5793constant suffixes. (Traditional C does support the @samp{L} suffix on integer 5794constants.) Note, these suffixes appear in macros defined in the system 5795headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 5796Use of these macros in user code might normally lead to spurious 5797warnings, however GCC's integrated preprocessor has enough context to 5798avoid warning in these cases. 5799 5800@item 5801A function declared external in one block and then used after the end of 5802the block. 5803 5804@item 5805A @code{switch} statement has an operand of type @code{long}. 5806 5807@item 5808A non-@code{static} function declaration follows a @code{static} one. 5809This construct is not accepted by some traditional C compilers. 5810 5811@item 5812The ISO type of an integer constant has a different width or 5813signedness from its traditional type. This warning is only issued if 5814the base of the constant is ten. I.e.@: hexadecimal or octal values, which 5815typically represent bit patterns, are not warned about. 5816 5817@item 5818Usage of ISO string concatenation is detected. 5819 5820@item 5821Initialization of automatic aggregates. 5822 5823@item 5824Identifier conflicts with labels. Traditional C lacks a separate 5825namespace for labels. 5826 5827@item 5828Initialization of unions. If the initializer is zero, the warning is 5829omitted. This is done under the assumption that the zero initializer in 5830user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 5831initializer warnings and relies on default initialization to zero in the 5832traditional C case. 5833 5834@item 5835Conversions by prototypes between fixed/floating-point values and vice 5836versa. The absence of these prototypes when compiling with traditional 5837C causes serious problems. This is a subset of the possible 5838conversion warnings; for the full set use @option{-Wtraditional-conversion}. 5839 5840@item 5841Use of ISO C style function definitions. This warning intentionally is 5842@emph{not} issued for prototype declarations or variadic functions 5843because these ISO C features appear in your code when using 5844libiberty's traditional C compatibility macros, @code{PARAMS} and 5845@code{VPARAMS}. This warning is also bypassed for nested functions 5846because that feature is already a GCC extension and thus not relevant to 5847traditional C compatibility. 5848@end itemize 5849 5850@item -Wtraditional-conversion @r{(C and Objective-C only)} 5851@opindex Wtraditional-conversion 5852@opindex Wno-traditional-conversion 5853Warn if a prototype causes a type conversion that is different from what 5854would happen to the same argument in the absence of a prototype. This 5855includes conversions of fixed point to floating and vice versa, and 5856conversions changing the width or signedness of a fixed-point argument 5857except when the same as the default promotion. 5858 5859@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 5860@opindex Wdeclaration-after-statement 5861@opindex Wno-declaration-after-statement 5862Warn when a declaration is found after a statement in a block. This 5863construct, known from C++, was introduced with ISO C99 and is by default 5864allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}. 5865 5866@item -Wshadow 5867@opindex Wshadow 5868@opindex Wno-shadow 5869Warn whenever a local variable or type declaration shadows another 5870variable, parameter, type, class member (in C++), or instance variable 5871(in Objective-C) or whenever a built-in function is shadowed. Note 5872that in C++, the compiler warns if a local variable shadows an 5873explicit typedef, but not if it shadows a struct/class/enum. 5874Same as @option{-Wshadow=global}. 5875 5876@item -Wno-shadow-ivar @r{(Objective-C only)} 5877@opindex Wno-shadow-ivar 5878@opindex Wshadow-ivar 5879Do not warn whenever a local variable shadows an instance variable in an 5880Objective-C method. 5881 5882@item -Wshadow=global 5883@opindex Wshadow=local 5884The default for @option{-Wshadow}. Warns for any (global) shadowing. 5885 5886@item -Wshadow=local 5887@opindex Wshadow=local 5888Warn when a local variable shadows another local variable or parameter. 5889This warning is enabled by @option{-Wshadow=global}. 5890 5891@item -Wshadow=compatible-local 5892@opindex Wshadow=compatible-local 5893Warn when a local variable shadows another local variable or parameter 5894whose type is compatible with that of the shadowing variable. In C++, 5895type compatibility here means the type of the shadowing variable can be 5896converted to that of the shadowed variable. The creation of this flag 5897(in addition to @option{-Wshadow=local}) is based on the idea that when 5898a local variable shadows another one of incompatible type, it is most 5899likely intentional, not a bug or typo, as shown in the following example: 5900 5901@smallexample 5902@group 5903for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) 5904@{ 5905 for (int i = 0; i < N; ++i) 5906 @{ 5907 ... 5908 @} 5909 ... 5910@} 5911@end group 5912@end smallexample 5913 5914Since the two variable @code{i} in the example above have incompatible types, 5915enabling only @option{-Wshadow=compatible-local} will not emit a warning. 5916Because their types are incompatible, if a programmer accidentally uses one 5917in place of the other, type checking will catch that and emit an error or 5918warning. So not warning (about shadowing) in this case will not lead to 5919undetected bugs. Use of this flag instead of @option{-Wshadow=local} can 5920possibly reduce the number of warnings triggered by intentional shadowing. 5921 5922This warning is enabled by @option{-Wshadow=local}. 5923 5924@item -Wlarger-than=@var{len} 5925@opindex Wlarger-than=@var{len} 5926@opindex Wlarger-than-@var{len} 5927Warn whenever an object of larger than @var{len} bytes is defined. 5928 5929@item -Wframe-larger-than=@var{len} 5930@opindex Wframe-larger-than 5931Warn if the size of a function frame is larger than @var{len} bytes. 5932The computation done to determine the stack frame size is approximate 5933and not conservative. 5934The actual requirements may be somewhat greater than @var{len} 5935even if you do not get a warning. In addition, any space allocated 5936via @code{alloca}, variable-length arrays, or related constructs 5937is not included by the compiler when determining 5938whether or not to issue a warning. 5939 5940@item -Wno-free-nonheap-object 5941@opindex Wno-free-nonheap-object 5942@opindex Wfree-nonheap-object 5943Do not warn when attempting to free an object that was not allocated 5944on the heap. 5945 5946@item -Wstack-usage=@var{len} 5947@opindex Wstack-usage 5948Warn if the stack usage of a function might be larger than @var{len} bytes. 5949The computation done to determine the stack usage is conservative. 5950Any space allocated via @code{alloca}, variable-length arrays, or related 5951constructs is included by the compiler when determining whether or not to 5952issue a warning. 5953 5954The message is in keeping with the output of @option{-fstack-usage}. 5955 5956@itemize 5957@item 5958If the stack usage is fully static but exceeds the specified amount, it's: 5959 5960@smallexample 5961 warning: stack usage is 1120 bytes 5962@end smallexample 5963@item 5964If the stack usage is (partly) dynamic but bounded, it's: 5965 5966@smallexample 5967 warning: stack usage might be 1648 bytes 5968@end smallexample 5969@item 5970If the stack usage is (partly) dynamic and not bounded, it's: 5971 5972@smallexample 5973 warning: stack usage might be unbounded 5974@end smallexample 5975@end itemize 5976 5977@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 5978@opindex Wno-pedantic-ms-format 5979@opindex Wpedantic-ms-format 5980When used in combination with @option{-Wformat} 5981and @option{-pedantic} without GNU extensions, this option 5982disables the warnings about non-ISO @code{printf} / @code{scanf} format 5983width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 5984which depend on the MS runtime. 5985 5986@item -Waligned-new 5987@opindex Waligned-new 5988@opindex Wno-aligned-new 5989Warn about a new-expression of a type that requires greater alignment 5990than the @code{alignof(std::max_align_t)} but uses an allocation 5991function without an explicit alignment parameter. This option is 5992enabled by @option{-Wall}. 5993 5994Normally this only warns about global allocation functions, but 5995@option{-Waligned-new=all} also warns about class member allocation 5996functions. 5997 5998@item -Wplacement-new 5999@itemx -Wplacement-new=@var{n} 6000@opindex Wplacement-new 6001@opindex Wno-placement-new 6002Warn about placement new expressions with undefined behavior, such as 6003constructing an object in a buffer that is smaller than the type of 6004the object. For example, the placement new expression below is diagnosed 6005because it attempts to construct an array of 64 integers in a buffer only 600664 bytes large. 6007@smallexample 6008char buf [64]; 6009new (buf) int[64]; 6010@end smallexample 6011This warning is enabled by default. 6012 6013@table @gcctabopt 6014@item -Wplacement-new=1 6015This is the default warning level of @option{-Wplacement-new}. At this 6016level the warning is not issued for some strictly undefined constructs that 6017GCC allows as extensions for compatibility with legacy code. For example, 6018the following @code{new} expression is not diagnosed at this level even 6019though it has undefined behavior according to the C++ standard because 6020it writes past the end of the one-element array. 6021@smallexample 6022struct S @{ int n, a[1]; @}; 6023S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]); 6024new (s->a)int [32](); 6025@end smallexample 6026 6027@item -Wplacement-new=2 6028At this level, in addition to diagnosing all the same constructs as at level 60291, a diagnostic is also issued for placement new expressions that construct 6030an object in the last member of structure whose type is an array of a single 6031element and whose size is less than the size of the object being constructed. 6032While the previous example would be diagnosed, the following construct makes 6033use of the flexible member array extension to avoid the warning at level 2. 6034@smallexample 6035struct S @{ int n, a[]; @}; 6036S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]); 6037new (s->a)int [32](); 6038@end smallexample 6039 6040@end table 6041 6042@item -Wpointer-arith 6043@opindex Wpointer-arith 6044@opindex Wno-pointer-arith 6045Warn about anything that depends on the ``size of'' a function type or 6046of @code{void}. GNU C assigns these types a size of 1, for 6047convenience in calculations with @code{void *} pointers and pointers 6048to functions. In C++, warn also when an arithmetic operation involves 6049@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 6050 6051@item -Wpointer-compare 6052@opindex Wpointer-compare 6053@opindex Wno-pointer-compare 6054Warn if a pointer is compared with a zero character constant. This usually 6055means that the pointer was meant to be dereferenced. For example: 6056 6057@smallexample 6058const char *p = foo (); 6059if (p == '\0') 6060 return 42; 6061@end smallexample 6062 6063Note that the code above is invalid in C++11. 6064 6065This warning is enabled by default. 6066 6067@item -Wtype-limits 6068@opindex Wtype-limits 6069@opindex Wno-type-limits 6070Warn if a comparison is always true or always false due to the limited 6071range of the data type, but do not warn for constant expressions. For 6072example, warn if an unsigned variable is compared against zero with 6073@code{<} or @code{>=}. This warning is also enabled by 6074@option{-Wextra}. 6075 6076@include cppwarnopts.texi 6077 6078@item -Wbad-function-cast @r{(C and Objective-C only)} 6079@opindex Wbad-function-cast 6080@opindex Wno-bad-function-cast 6081Warn when a function call is cast to a non-matching type. 6082For example, warn if a call to a function returning an integer type 6083is cast to a pointer type. 6084 6085@item -Wc90-c99-compat @r{(C and Objective-C only)} 6086@opindex Wc90-c99-compat 6087@opindex Wno-c90-c99-compat 6088Warn about features not present in ISO C90, but present in ISO C99. 6089For instance, warn about use of variable length arrays, @code{long long} 6090type, @code{bool} type, compound literals, designated initializers, and so 6091on. This option is independent of the standards mode. Warnings are disabled 6092in the expression that follows @code{__extension__}. 6093 6094@item -Wc99-c11-compat @r{(C and Objective-C only)} 6095@opindex Wc99-c11-compat 6096@opindex Wno-c99-c11-compat 6097Warn about features not present in ISO C99, but present in ISO C11. 6098For instance, warn about use of anonymous structures and unions, 6099@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 6100@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 6101and so on. This option is independent of the standards mode. Warnings are 6102disabled in the expression that follows @code{__extension__}. 6103 6104@item -Wc++-compat @r{(C and Objective-C only)} 6105@opindex Wc++-compat 6106Warn about ISO C constructs that are outside of the common subset of 6107ISO C and ISO C++, e.g.@: request for implicit conversion from 6108@code{void *} to a pointer to non-@code{void} type. 6109 6110@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 6111@opindex Wc++11-compat 6112Warn about C++ constructs whose meaning differs between ISO C++ 1998 6113and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 6114in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 6115enabled by @option{-Wall}. 6116 6117@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 6118@opindex Wc++14-compat 6119Warn about C++ constructs whose meaning differs between ISO C++ 2011 6120and ISO C++ 2014. This warning is enabled by @option{-Wall}. 6121 6122@item -Wc++17-compat @r{(C++ and Objective-C++ only)} 6123@opindex Wc++17-compat 6124Warn about C++ constructs whose meaning differs between ISO C++ 2014 6125and ISO C++ 2017. This warning is enabled by @option{-Wall}. 6126 6127@item -Wcast-qual 6128@opindex Wcast-qual 6129@opindex Wno-cast-qual 6130Warn whenever a pointer is cast so as to remove a type qualifier from 6131the target type. For example, warn if a @code{const char *} is cast 6132to an ordinary @code{char *}. 6133 6134Also warn when making a cast that introduces a type qualifier in an 6135unsafe way. For example, casting @code{char **} to @code{const char **} 6136is unsafe, as in this example: 6137 6138@smallexample 6139 /* p is char ** value. */ 6140 const char **q = (const char **) p; 6141 /* Assignment of readonly string to const char * is OK. */ 6142 *q = "string"; 6143 /* Now char** pointer points to read-only memory. */ 6144 **p = 'b'; 6145@end smallexample 6146 6147@item -Wcast-align 6148@opindex Wcast-align 6149@opindex Wno-cast-align 6150Warn whenever a pointer is cast such that the required alignment of the 6151target is increased. For example, warn if a @code{char *} is cast to 6152an @code{int *} on machines where integers can only be accessed at 6153two- or four-byte boundaries. 6154 6155@item -Wcast-align=strict 6156@opindex Wcast-align=strict 6157Warn whenever a pointer is cast such that the required alignment of the 6158target is increased. For example, warn if a @code{char *} is cast to 6159an @code{int *} regardless of the target machine. 6160 6161@item -Wcast-function-type 6162@opindex Wcast-function-type 6163@opindex Wno-cast-function-type 6164Warn when a function pointer is cast to an incompatible function pointer. 6165In a cast involving function types with a variable argument list only 6166the types of initial arguments that are provided are considered. 6167Any parameter of pointer-type matches any other pointer-type. Any benign 6168differences in integral types are ignored, like @code{int} vs. @code{long} 6169on ILP32 targets. Likewise type qualifiers are ignored. The function 6170type @code{void (*) (void)} is special and matches everything, which can 6171be used to suppress this warning. 6172In a cast involving pointer to member types this warning warns whenever 6173the type cast is changing the pointer to member type. 6174This warning is enabled by @option{-Wextra}. 6175 6176@item -Wwrite-strings 6177@opindex Wwrite-strings 6178@opindex Wno-write-strings 6179When compiling C, give string constants the type @code{const 6180char[@var{length}]} so that copying the address of one into a 6181non-@code{const} @code{char *} pointer produces a warning. These 6182warnings help you find at compile time code that can try to write 6183into a string constant, but only if you have been very careful about 6184using @code{const} in declarations and prototypes. Otherwise, it is 6185just a nuisance. This is why we did not make @option{-Wall} request 6186these warnings. 6187 6188When compiling C++, warn about the deprecated conversion from string 6189literals to @code{char *}. This warning is enabled by default for C++ 6190programs. 6191 6192@item -Wcatch-value 6193@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)} 6194@opindex Wcatch-value 6195@opindex Wno-catch-value 6196Warn about catch handlers that do not catch via reference. 6197With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short) 6198warn about polymorphic class types that are caught by value. 6199With @option{-Wcatch-value=2} warn about all class types that are caught 6200by value. With @option{-Wcatch-value=3} warn about all types that are 6201not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}. 6202 6203@item -Wclobbered 6204@opindex Wclobbered 6205@opindex Wno-clobbered 6206Warn for variables that might be changed by @code{longjmp} or 6207@code{vfork}. This warning is also enabled by @option{-Wextra}. 6208 6209@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 6210@opindex Wconditionally-supported 6211@opindex Wno-conditionally-supported 6212Warn for conditionally-supported (C++11 [intro.defs]) constructs. 6213 6214@item -Wconversion 6215@opindex Wconversion 6216@opindex Wno-conversion 6217Warn for implicit conversions that may alter a value. This includes 6218conversions between real and integer, like @code{abs (x)} when 6219@code{x} is @code{double}; conversions between signed and unsigned, 6220like @code{unsigned ui = -1}; and conversions to smaller types, like 6221@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 6222((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 6223changed by the conversion like in @code{abs (2.0)}. Warnings about 6224conversions between signed and unsigned integers can be disabled by 6225using @option{-Wno-sign-conversion}. 6226 6227For C++, also warn for confusing overload resolution for user-defined 6228conversions; and conversions that never use a type conversion 6229operator: conversions to @code{void}, the same type, a base class or a 6230reference to them. Warnings about conversions between signed and 6231unsigned integers are disabled by default in C++ unless 6232@option{-Wsign-conversion} is explicitly enabled. 6233 6234@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 6235@opindex Wconversion-null 6236@opindex Wno-conversion-null 6237Do not warn for conversions between @code{NULL} and non-pointer 6238types. @option{-Wconversion-null} is enabled by default. 6239 6240@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 6241@opindex Wzero-as-null-pointer-constant 6242@opindex Wno-zero-as-null-pointer-constant 6243Warn when a literal @samp{0} is used as null pointer constant. This can 6244be useful to facilitate the conversion to @code{nullptr} in C++11. 6245 6246@item -Wsubobject-linkage @r{(C++ and Objective-C++ only)} 6247@opindex Wsubobject-linkage 6248@opindex Wno-subobject-linkage 6249Warn if a class type has a base or a field whose type uses the anonymous 6250namespace or depends on a type with no linkage. If a type A depends on 6251a type B with no or internal linkage, defining it in multiple 6252translation units would be an ODR violation because the meaning of B 6253is different in each translation unit. If A only appears in a single 6254translation unit, the best way to silence the warning is to give it 6255internal linkage by putting it in an anonymous namespace as well. The 6256compiler doesn't give this warning for types defined in the main .C 6257file, as those are unlikely to have multiple definitions. 6258@option{-Wsubobject-linkage} is enabled by default. 6259 6260@item -Wdangling-else 6261@opindex Wdangling-else 6262@opindex Wno-dangling-else 6263Warn about constructions where there may be confusion to which 6264@code{if} statement an @code{else} branch belongs. Here is an example of 6265such a case: 6266 6267@smallexample 6268@group 6269@{ 6270 if (a) 6271 if (b) 6272 foo (); 6273 else 6274 bar (); 6275@} 6276@end group 6277@end smallexample 6278 6279In C/C++, every @code{else} branch belongs to the innermost possible 6280@code{if} statement, which in this example is @code{if (b)}. This is 6281often not what the programmer expected, as illustrated in the above 6282example by indentation the programmer chose. When there is the 6283potential for this confusion, GCC issues a warning when this flag 6284is specified. To eliminate the warning, add explicit braces around 6285the innermost @code{if} statement so there is no way the @code{else} 6286can belong to the enclosing @code{if}. The resulting code 6287looks like this: 6288 6289@smallexample 6290@group 6291@{ 6292 if (a) 6293 @{ 6294 if (b) 6295 foo (); 6296 else 6297 bar (); 6298 @} 6299@} 6300@end group 6301@end smallexample 6302 6303This warning is enabled by @option{-Wparentheses}. 6304 6305@item -Wdate-time 6306@opindex Wdate-time 6307@opindex Wno-date-time 6308Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 6309are encountered as they might prevent bit-wise-identical reproducible 6310compilations. 6311 6312@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)} 6313@opindex Wdelete-incomplete 6314@opindex Wno-delete-incomplete 6315Warn when deleting a pointer to incomplete type, which may cause 6316undefined behavior at runtime. This warning is enabled by default. 6317 6318@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 6319@opindex Wuseless-cast 6320@opindex Wno-useless-cast 6321Warn when an expression is casted to its own type. 6322 6323@item -Wempty-body 6324@opindex Wempty-body 6325@opindex Wno-empty-body 6326Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 6327while} statement. This warning is also enabled by @option{-Wextra}. 6328 6329@item -Wenum-compare 6330@opindex Wenum-compare 6331@opindex Wno-enum-compare 6332Warn about a comparison between values of different enumerated types. 6333In C++ enumerated type mismatches in conditional expressions are also 6334diagnosed and the warning is enabled by default. In C this warning is 6335enabled by @option{-Wall}. 6336 6337@item -Wextra-semi @r{(C++, Objective-C++ only)} 6338@opindex Wextra-semi 6339@opindex Wno-extra-semi 6340Warn about redundant semicolon after in-class function definition. 6341 6342@item -Wjump-misses-init @r{(C, Objective-C only)} 6343@opindex Wjump-misses-init 6344@opindex Wno-jump-misses-init 6345Warn if a @code{goto} statement or a @code{switch} statement jumps 6346forward across the initialization of a variable, or jumps backward to a 6347label after the variable has been initialized. This only warns about 6348variables that are initialized when they are declared. This warning is 6349only supported for C and Objective-C; in C++ this sort of branch is an 6350error in any case. 6351 6352@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 6353can be disabled with the @option{-Wno-jump-misses-init} option. 6354 6355@item -Wsign-compare 6356@opindex Wsign-compare 6357@opindex Wno-sign-compare 6358@cindex warning for comparison of signed and unsigned values 6359@cindex comparison of signed and unsigned values, warning 6360@cindex signed and unsigned values, comparison warning 6361Warn when a comparison between signed and unsigned values could produce 6362an incorrect result when the signed value is converted to unsigned. 6363In C++, this warning is also enabled by @option{-Wall}. In C, it is 6364also enabled by @option{-Wextra}. 6365 6366@item -Wsign-conversion 6367@opindex Wsign-conversion 6368@opindex Wno-sign-conversion 6369Warn for implicit conversions that may change the sign of an integer 6370value, like assigning a signed integer expression to an unsigned 6371integer variable. An explicit cast silences the warning. In C, this 6372option is enabled also by @option{-Wconversion}. 6373 6374@item -Wfloat-conversion 6375@opindex Wfloat-conversion 6376@opindex Wno-float-conversion 6377Warn for implicit conversions that reduce the precision of a real value. 6378This includes conversions from real to integer, and from higher precision 6379real to lower precision real values. This option is also enabled by 6380@option{-Wconversion}. 6381 6382@item -Wno-scalar-storage-order 6383@opindex -Wno-scalar-storage-order 6384@opindex -Wscalar-storage-order 6385Do not warn on suspicious constructs involving reverse scalar storage order. 6386 6387@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 6388@opindex Wsized-deallocation 6389@opindex Wno-sized-deallocation 6390Warn about a definition of an unsized deallocation function 6391@smallexample 6392void operator delete (void *) noexcept; 6393void operator delete[] (void *) noexcept; 6394@end smallexample 6395without a definition of the corresponding sized deallocation function 6396@smallexample 6397void operator delete (void *, std::size_t) noexcept; 6398void operator delete[] (void *, std::size_t) noexcept; 6399@end smallexample 6400or vice versa. Enabled by @option{-Wextra} along with 6401@option{-fsized-deallocation}. 6402 6403@item -Wsizeof-pointer-div 6404@opindex Wsizeof-pointer-div 6405@opindex Wno-sizeof-pointer-div 6406Warn for suspicious divisions of two sizeof expressions that divide 6407the pointer size by the element size, which is the usual way to compute 6408the array size but won't work out correctly with pointers. This warning 6409warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is 6410not an array, but a pointer. This warning is enabled by @option{-Wall}. 6411 6412@item -Wsizeof-pointer-memaccess 6413@opindex Wsizeof-pointer-memaccess 6414@opindex Wno-sizeof-pointer-memaccess 6415Warn for suspicious length parameters to certain string and memory built-in 6416functions if the argument uses @code{sizeof}. This warning triggers for 6417example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not 6418an array, but a pointer, and suggests a possible fix, or about 6419@code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess} 6420also warns about calls to bounded string copy functions like @code{strncat} 6421or @code{strncpy} that specify as the bound a @code{sizeof} expression of 6422the source array. For example, in the following function the call to 6423@code{strncat} specifies the size of the source string as the bound. That 6424is almost certainly a mistake and so the call is diagnosed. 6425@smallexample 6426void make_file (const char *name) 6427@{ 6428 char path[PATH_MAX]; 6429 strncpy (path, name, sizeof path - 1); 6430 strncat (path, ".text", sizeof ".text"); 6431 @dots{} 6432@} 6433@end smallexample 6434 6435The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}. 6436 6437@item -Wsizeof-array-argument 6438@opindex Wsizeof-array-argument 6439@opindex Wno-sizeof-array-argument 6440Warn when the @code{sizeof} operator is applied to a parameter that is 6441declared as an array in a function definition. This warning is enabled by 6442default for C and C++ programs. 6443 6444@item -Wmemset-elt-size 6445@opindex Wmemset-elt-size 6446@opindex Wno-memset-elt-size 6447Warn for suspicious calls to the @code{memset} built-in function, if the 6448first argument references an array, and the third argument is a number 6449equal to the number of elements, but not equal to the size of the array 6450in memory. This indicates that the user has omitted a multiplication by 6451the element size. This warning is enabled by @option{-Wall}. 6452 6453@item -Wmemset-transposed-args 6454@opindex Wmemset-transposed-args 6455@opindex Wno-memset-transposed-args 6456Warn for suspicious calls to the @code{memset} built-in function, if the 6457second argument is not zero and the third argument is zero. This warns e.g.@ 6458about @code{memset (buf, sizeof buf, 0)} where most probably 6459@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics 6460is only emitted if the third argument is literal zero. If it is some 6461expression that is folded to zero, a cast of zero to some type, etc., 6462it is far less likely that the user has mistakenly exchanged the arguments 6463and no warning is emitted. This warning is enabled by @option{-Wall}. 6464 6465@item -Waddress 6466@opindex Waddress 6467@opindex Wno-address 6468Warn about suspicious uses of memory addresses. These include using 6469the address of a function in a conditional expression, such as 6470@code{void func(void); if (func)}, and comparisons against the memory 6471address of a string literal, such as @code{if (x == "abc")}. Such 6472uses typically indicate a programmer error: the address of a function 6473always evaluates to true, so their use in a conditional usually 6474indicate that the programmer forgot the parentheses in a function 6475call; and comparisons against string literals result in unspecified 6476behavior and are not portable in C, so they usually indicate that the 6477programmer intended to use @code{strcmp}. This warning is enabled by 6478@option{-Wall}. 6479 6480@item -Wlogical-op 6481@opindex Wlogical-op 6482@opindex Wno-logical-op 6483Warn about suspicious uses of logical operators in expressions. 6484This includes using logical operators in contexts where a 6485bit-wise operator is likely to be expected. Also warns when 6486the operands of a logical operator are the same: 6487@smallexample 6488extern int a; 6489if (a < 0 && a < 0) @{ @dots{} @} 6490@end smallexample 6491 6492@item -Wlogical-not-parentheses 6493@opindex Wlogical-not-parentheses 6494@opindex Wno-logical-not-parentheses 6495Warn about logical not used on the left hand side operand of a comparison. 6496This option does not warn if the right operand is considered to be a boolean 6497expression. Its purpose is to detect suspicious code like the following: 6498@smallexample 6499int a; 6500@dots{} 6501if (!a > 1) @{ @dots{} @} 6502@end smallexample 6503 6504It is possible to suppress the warning by wrapping the LHS into 6505parentheses: 6506@smallexample 6507if ((!a) > 1) @{ @dots{} @} 6508@end smallexample 6509 6510This warning is enabled by @option{-Wall}. 6511 6512@item -Waggregate-return 6513@opindex Waggregate-return 6514@opindex Wno-aggregate-return 6515Warn if any functions that return structures or unions are defined or 6516called. (In languages where you can return an array, this also elicits 6517a warning.) 6518 6519@item -Wno-aggressive-loop-optimizations 6520@opindex Wno-aggressive-loop-optimizations 6521@opindex Waggressive-loop-optimizations 6522Warn if in a loop with constant number of iterations the compiler detects 6523undefined behavior in some statement during one or more of the iterations. 6524 6525@item -Wno-attributes 6526@opindex Wno-attributes 6527@opindex Wattributes 6528Do not warn if an unexpected @code{__attribute__} is used, such as 6529unrecognized attributes, function attributes applied to variables, 6530etc. This does not stop errors for incorrect use of supported 6531attributes. 6532 6533@item -Wno-builtin-declaration-mismatch 6534@opindex Wno-builtin-declaration-mismatch 6535@opindex Wbuiltin-declaration-mismatch 6536Warn if a built-in function is declared with the wrong signature or 6537as non-function. 6538This warning is enabled by default. 6539 6540@item -Wno-builtin-macro-redefined 6541@opindex Wno-builtin-macro-redefined 6542@opindex Wbuiltin-macro-redefined 6543Do not warn if certain built-in macros are redefined. This suppresses 6544warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 6545@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 6546 6547@item -Wstrict-prototypes @r{(C and Objective-C only)} 6548@opindex Wstrict-prototypes 6549@opindex Wno-strict-prototypes 6550Warn if a function is declared or defined without specifying the 6551argument types. (An old-style function definition is permitted without 6552a warning if preceded by a declaration that specifies the argument 6553types.) 6554 6555@item -Wold-style-declaration @r{(C and Objective-C only)} 6556@opindex Wold-style-declaration 6557@opindex Wno-old-style-declaration 6558Warn for obsolescent usages, according to the C Standard, in a 6559declaration. For example, warn if storage-class specifiers like 6560@code{static} are not the first things in a declaration. This warning 6561is also enabled by @option{-Wextra}. 6562 6563@item -Wold-style-definition @r{(C and Objective-C only)} 6564@opindex Wold-style-definition 6565@opindex Wno-old-style-definition 6566Warn if an old-style function definition is used. A warning is given 6567even if there is a previous prototype. 6568 6569@item -Wmissing-parameter-type @r{(C and Objective-C only)} 6570@opindex Wmissing-parameter-type 6571@opindex Wno-missing-parameter-type 6572A function parameter is declared without a type specifier in K&R-style 6573functions: 6574 6575@smallexample 6576void foo(bar) @{ @} 6577@end smallexample 6578 6579This warning is also enabled by @option{-Wextra}. 6580 6581@item -Wmissing-prototypes @r{(C and Objective-C only)} 6582@opindex Wmissing-prototypes 6583@opindex Wno-missing-prototypes 6584Warn if a global function is defined without a previous prototype 6585declaration. This warning is issued even if the definition itself 6586provides a prototype. Use this option to detect global functions 6587that do not have a matching prototype declaration in a header file. 6588This option is not valid for C++ because all function declarations 6589provide prototypes and a non-matching declaration declares an 6590overload rather than conflict with an earlier declaration. 6591Use @option{-Wmissing-declarations} to detect missing declarations in C++. 6592 6593@item -Wmissing-declarations 6594@opindex Wmissing-declarations 6595@opindex Wno-missing-declarations 6596Warn if a global function is defined without a previous declaration. 6597Do so even if the definition itself provides a prototype. 6598Use this option to detect global functions that are not declared in 6599header files. In C, no warnings are issued for functions with previous 6600non-prototype declarations; use @option{-Wmissing-prototypes} to detect 6601missing prototypes. In C++, no warnings are issued for function templates, 6602or for inline functions, or for functions in anonymous namespaces. 6603 6604@item -Wmissing-field-initializers 6605@opindex Wmissing-field-initializers 6606@opindex Wno-missing-field-initializers 6607@opindex W 6608@opindex Wextra 6609@opindex Wno-extra 6610Warn if a structure's initializer has some fields missing. For 6611example, the following code causes such a warning, because 6612@code{x.h} is implicitly zero: 6613 6614@smallexample 6615struct s @{ int f, g, h; @}; 6616struct s x = @{ 3, 4 @}; 6617@end smallexample 6618 6619This option does not warn about designated initializers, so the following 6620modification does not trigger a warning: 6621 6622@smallexample 6623struct s @{ int f, g, h; @}; 6624struct s x = @{ .f = 3, .g = 4 @}; 6625@end smallexample 6626 6627In C this option does not warn about the universal zero initializer 6628@samp{@{ 0 @}}: 6629 6630@smallexample 6631struct s @{ int f, g, h; @}; 6632struct s x = @{ 0 @}; 6633@end smallexample 6634 6635Likewise, in C++ this option does not warn about the empty @{ @} 6636initializer, for example: 6637 6638@smallexample 6639struct s @{ int f, g, h; @}; 6640s x = @{ @}; 6641@end smallexample 6642 6643This warning is included in @option{-Wextra}. To get other @option{-Wextra} 6644warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 6645 6646@item -Wno-multichar 6647@opindex Wno-multichar 6648@opindex Wmultichar 6649Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 6650Usually they indicate a typo in the user's code, as they have 6651implementation-defined values, and should not be used in portable code. 6652 6653@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} 6654@opindex Wnormalized= 6655@opindex Wnormalized 6656@opindex Wno-normalized 6657@cindex NFC 6658@cindex NFKC 6659@cindex character set, input normalization 6660In ISO C and ISO C++, two identifiers are different if they are 6661different sequences of characters. However, sometimes when characters 6662outside the basic ASCII character set are used, you can have two 6663different character sequences that look the same. To avoid confusion, 6664the ISO 10646 standard sets out some @dfn{normalization rules} which 6665when applied ensure that two sequences that look the same are turned into 6666the same sequence. GCC can warn you if you are using identifiers that 6667have not been normalized; this option controls that warning. 6668 6669There are four levels of warning supported by GCC@. The default is 6670@option{-Wnormalized=nfc}, which warns about any identifier that is 6671not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 6672recommended form for most uses. It is equivalent to 6673@option{-Wnormalized}. 6674 6675Unfortunately, there are some characters allowed in identifiers by 6676ISO C and ISO C++ that, when turned into NFC, are not allowed in 6677identifiers. That is, there's no way to use these symbols in portable 6678ISO C or C++ and have all your identifiers in NFC@. 6679@option{-Wnormalized=id} suppresses the warning for these characters. 6680It is hoped that future versions of the standards involved will correct 6681this, which is why this option is not the default. 6682 6683You can switch the warning off for all characters by writing 6684@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 6685only do this if you are using some other normalization scheme (like 6686``D''), because otherwise you can easily create bugs that are 6687literally impossible to see. 6688 6689Some characters in ISO 10646 have distinct meanings but look identical 6690in some fonts or display methodologies, especially once formatting has 6691been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 6692LETTER N'', displays just like a regular @code{n} that has been 6693placed in a superscript. ISO 10646 defines the @dfn{NFKC} 6694normalization scheme to convert all these into a standard form as 6695well, and GCC warns if your code is not in NFKC if you use 6696@option{-Wnormalized=nfkc}. This warning is comparable to warning 6697about every identifier that contains the letter O because it might be 6698confused with the digit 0, and so is not the default, but may be 6699useful as a local coding convention if the programming environment 6700cannot be fixed to display these characters distinctly. 6701 6702@item -Wno-deprecated 6703@opindex Wno-deprecated 6704@opindex Wdeprecated 6705Do not warn about usage of deprecated features. @xref{Deprecated Features}. 6706 6707@item -Wno-deprecated-declarations 6708@opindex Wno-deprecated-declarations 6709@opindex Wdeprecated-declarations 6710Do not warn about uses of functions (@pxref{Function Attributes}), 6711variables (@pxref{Variable Attributes}), and types (@pxref{Type 6712Attributes}) marked as deprecated by using the @code{deprecated} 6713attribute. 6714 6715@item -Wno-overflow 6716@opindex Wno-overflow 6717@opindex Woverflow 6718Do not warn about compile-time overflow in constant expressions. 6719 6720@item -Wno-odr 6721@opindex Wno-odr 6722@opindex Wodr 6723Warn about One Definition Rule violations during link-time optimization. 6724Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default. 6725 6726@item -Wopenmp-simd 6727@opindex Wopenm-simd 6728Warn if the vectorizer cost model overrides the OpenMP 6729simd directive set by user. The @option{-fsimd-cost-model=unlimited} 6730option can be used to relax the cost model. 6731 6732@item -Woverride-init @r{(C and Objective-C only)} 6733@opindex Woverride-init 6734@opindex Wno-override-init 6735@opindex W 6736@opindex Wextra 6737@opindex Wno-extra 6738Warn if an initialized field without side effects is overridden when 6739using designated initializers (@pxref{Designated Inits, , Designated 6740Initializers}). 6741 6742This warning is included in @option{-Wextra}. To get other 6743@option{-Wextra} warnings without this one, use @option{-Wextra 6744-Wno-override-init}. 6745 6746@item -Woverride-init-side-effects @r{(C and Objective-C only)} 6747@opindex Woverride-init-side-effects 6748@opindex Wno-override-init-side-effects 6749Warn if an initialized field with side effects is overridden when 6750using designated initializers (@pxref{Designated Inits, , Designated 6751Initializers}). This warning is enabled by default. 6752 6753@item -Wpacked 6754@opindex Wpacked 6755@opindex Wno-packed 6756Warn if a structure is given the packed attribute, but the packed 6757attribute has no effect on the layout or size of the structure. 6758Such structures may be mis-aligned for little benefit. For 6759instance, in this code, the variable @code{f.x} in @code{struct bar} 6760is misaligned even though @code{struct bar} does not itself 6761have the packed attribute: 6762 6763@smallexample 6764@group 6765struct foo @{ 6766 int x; 6767 char a, b, c, d; 6768@} __attribute__((packed)); 6769struct bar @{ 6770 char z; 6771 struct foo f; 6772@}; 6773@end group 6774@end smallexample 6775 6776@item -Wpacked-bitfield-compat 6777@opindex Wpacked-bitfield-compat 6778@opindex Wno-packed-bitfield-compat 6779The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 6780on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but 6781the change can lead to differences in the structure layout. GCC 6782informs you when the offset of such a field has changed in GCC 4.4. 6783For example there is no longer a 4-bit padding between field @code{a} 6784and @code{b} in this structure: 6785 6786@smallexample 6787struct foo 6788@{ 6789 char a:4; 6790 char b:8; 6791@} __attribute__ ((packed)); 6792@end smallexample 6793 6794This warning is enabled by default. Use 6795@option{-Wno-packed-bitfield-compat} to disable this warning. 6796 6797@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} 6798@opindex Wpacked-not-aligned 6799@opindex Wno-packed-not-aligned 6800Warn if a structure field with explicitly specified alignment in a 6801packed struct or union is misaligned. For example, a warning will 6802be issued on @code{struct S}, like, @code{warning: alignment 1 of 6803'struct S' is less than 8}, in this code: 6804 6805@smallexample 6806@group 6807struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @}; 6808struct __attribute__ ((packed)) S @{ 6809 struct S8 s8; 6810@}; 6811@end group 6812@end smallexample 6813 6814This warning is enabled by @option{-Wall}. 6815 6816@item -Wpadded 6817@opindex Wpadded 6818@opindex Wno-padded 6819Warn if padding is included in a structure, either to align an element 6820of the structure or to align the whole structure. Sometimes when this 6821happens it is possible to rearrange the fields of the structure to 6822reduce the padding and so make the structure smaller. 6823 6824@item -Wredundant-decls 6825@opindex Wredundant-decls 6826@opindex Wno-redundant-decls 6827Warn if anything is declared more than once in the same scope, even in 6828cases where multiple declaration is valid and changes nothing. 6829 6830@item -Wno-restrict 6831@opindex Wrestrict 6832@opindex Wno-restrict 6833Warn when an object referenced by a @code{restrict}-qualified parameter 6834(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another 6835argument, or when copies between such objects overlap. For example, 6836the call to the @code{strcpy} function below attempts to truncate the string 6837by replacing its initial characters with the last four. However, because 6838the call writes the terminating NUL into @code{a[4]}, the copies overlap and 6839the call is diagnosed. 6840 6841@smallexample 6842void foo (void) 6843@{ 6844 char a[] = "abcd1234"; 6845 strcpy (a, a + 4); 6846 @dots{} 6847@} 6848@end smallexample 6849The @option{-Wrestrict} option detects some instances of simple overlap 6850even without optimization but works best at @option{-O2} and above. It 6851is included in @option{-Wall}. 6852 6853@item -Wnested-externs @r{(C and Objective-C only)} 6854@opindex Wnested-externs 6855@opindex Wno-nested-externs 6856Warn if an @code{extern} declaration is encountered within a function. 6857 6858@item -Wno-inherited-variadic-ctor 6859@opindex Winherited-variadic-ctor 6860@opindex Wno-inherited-variadic-ctor 6861Suppress warnings about use of C++11 inheriting constructors when the 6862base class inherited from has a C variadic constructor; the warning is 6863on by default because the ellipsis is not inherited. 6864 6865@item -Winline 6866@opindex Winline 6867@opindex Wno-inline 6868Warn if a function that is declared as inline cannot be inlined. 6869Even with this option, the compiler does not warn about failures to 6870inline functions declared in system headers. 6871 6872The compiler uses a variety of heuristics to determine whether or not 6873to inline a function. For example, the compiler takes into account 6874the size of the function being inlined and the amount of inlining 6875that has already been done in the current function. Therefore, 6876seemingly insignificant changes in the source program can cause the 6877warnings produced by @option{-Winline} to appear or disappear. 6878 6879@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 6880@opindex Wno-invalid-offsetof 6881@opindex Winvalid-offsetof 6882Suppress warnings from applying the @code{offsetof} macro to a non-POD 6883type. According to the 2014 ISO C++ standard, applying @code{offsetof} 6884to a non-standard-layout type is undefined. In existing C++ implementations, 6885however, @code{offsetof} typically gives meaningful results. 6886This flag is for users who are aware that they are 6887writing nonportable code and who have deliberately chosen to ignore the 6888warning about it. 6889 6890The restrictions on @code{offsetof} may be relaxed in a future version 6891of the C++ standard. 6892 6893@item -Wint-in-bool-context 6894@opindex Wint-in-bool-context 6895@opindex Wno-int-in-bool-context 6896Warn for suspicious use of integer values where boolean values are expected, 6897such as conditional expressions (?:) using non-boolean integer constants in 6898boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed 6899integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise 6900for all kinds of multiplications regardless of the data type. 6901This warning is enabled by @option{-Wall}. 6902 6903@item -Wno-int-to-pointer-cast 6904@opindex Wno-int-to-pointer-cast 6905@opindex Wint-to-pointer-cast 6906Suppress warnings from casts to pointer type of an integer of a 6907different size. In C++, casting to a pointer type of smaller size is 6908an error. @option{Wint-to-pointer-cast} is enabled by default. 6909 6910 6911@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 6912@opindex Wno-pointer-to-int-cast 6913@opindex Wpointer-to-int-cast 6914Suppress warnings from casts from a pointer to an integer type of a 6915different size. 6916 6917@item -Winvalid-pch 6918@opindex Winvalid-pch 6919@opindex Wno-invalid-pch 6920Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 6921the search path but cannot be used. 6922 6923@item -Wlong-long 6924@opindex Wlong-long 6925@opindex Wno-long-long 6926Warn if @code{long long} type is used. This is enabled by either 6927@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 6928modes. To inhibit the warning messages, use @option{-Wno-long-long}. 6929 6930@item -Wvariadic-macros 6931@opindex Wvariadic-macros 6932@opindex Wno-variadic-macros 6933Warn if variadic macros are used in ISO C90 mode, or if the GNU 6934alternate syntax is used in ISO C99 mode. This is enabled by either 6935@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 6936messages, use @option{-Wno-variadic-macros}. 6937 6938@item -Wvarargs 6939@opindex Wvarargs 6940@opindex Wno-varargs 6941Warn upon questionable usage of the macros used to handle variable 6942arguments like @code{va_start}. This is default. To inhibit the 6943warning messages, use @option{-Wno-varargs}. 6944 6945@item -Wvector-operation-performance 6946@opindex Wvector-operation-performance 6947@opindex Wno-vector-operation-performance 6948Warn if vector operation is not implemented via SIMD capabilities of the 6949architecture. Mainly useful for the performance tuning. 6950Vector operation can be implemented @code{piecewise}, which means that the 6951scalar operation is performed on every vector element; 6952@code{in parallel}, which means that the vector operation is implemented 6953using scalars of wider type, which normally is more performance efficient; 6954and @code{as a single scalar}, which means that vector fits into a 6955scalar type. 6956 6957@item -Wno-virtual-move-assign 6958@opindex Wvirtual-move-assign 6959@opindex Wno-virtual-move-assign 6960Suppress warnings about inheriting from a virtual base with a 6961non-trivial C++11 move assignment operator. This is dangerous because 6962if the virtual base is reachable along more than one path, it is 6963moved multiple times, which can mean both objects end up in the 6964moved-from state. If the move assignment operator is written to avoid 6965moving from a moved-from object, this warning can be disabled. 6966 6967@item -Wvla 6968@opindex Wvla 6969@opindex Wno-vla 6970Warn if a variable-length array is used in the code. 6971@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 6972the variable-length array. 6973 6974@item -Wvla-larger-than=@var{n} 6975If this option is used, the compiler will warn on uses of 6976variable-length arrays where the size is either unbounded, or bounded 6977by an argument that can be larger than @var{n} bytes. This is similar 6978to how @option{-Walloca-larger-than=@var{n}} works, but with 6979variable-length arrays. 6980 6981Note that GCC may optimize small variable-length arrays of a known 6982value into plain arrays, so this warning may not get triggered for 6983such arrays. 6984 6985This warning is not enabled by @option{-Wall}, and is only active when 6986@option{-ftree-vrp} is active (default for @option{-O2} and above). 6987 6988See also @option{-Walloca-larger-than=@var{n}}. 6989 6990@item -Wvolatile-register-var 6991@opindex Wvolatile-register-var 6992@opindex Wno-volatile-register-var 6993Warn if a register variable is declared volatile. The volatile 6994modifier does not inhibit all optimizations that may eliminate reads 6995and/or writes to register variables. This warning is enabled by 6996@option{-Wall}. 6997 6998@item -Wdisabled-optimization 6999@opindex Wdisabled-optimization 7000@opindex Wno-disabled-optimization 7001Warn if a requested optimization pass is disabled. This warning does 7002not generally indicate that there is anything wrong with your code; it 7003merely indicates that GCC's optimizers are unable to handle the code 7004effectively. Often, the problem is that your code is too big or too 7005complex; GCC refuses to optimize programs when the optimization 7006itself is likely to take inordinate amounts of time. 7007 7008@item -Wpointer-sign @r{(C and Objective-C only)} 7009@opindex Wpointer-sign 7010@opindex Wno-pointer-sign 7011Warn for pointer argument passing or assignment with different signedness. 7012This option is only supported for C and Objective-C@. It is implied by 7013@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 7014@option{-Wno-pointer-sign}. 7015 7016@item -Wstack-protector 7017@opindex Wstack-protector 7018@opindex Wno-stack-protector 7019This option is only active when @option{-fstack-protector} is active. It 7020warns about functions that are not protected against stack smashing. 7021 7022@item -Woverlength-strings 7023@opindex Woverlength-strings 7024@opindex Wno-overlength-strings 7025Warn about string constants that are longer than the ``minimum 7026maximum'' length specified in the C standard. Modern compilers 7027generally allow string constants that are much longer than the 7028standard's minimum limit, but very portable programs should avoid 7029using longer strings. 7030 7031The limit applies @emph{after} string constant concatenation, and does 7032not count the trailing NUL@. In C90, the limit was 509 characters; in 7033C99, it was raised to 4095. C++98 does not specify a normative 7034minimum maximum, so we do not diagnose overlength strings in C++@. 7035 7036This option is implied by @option{-Wpedantic}, and can be disabled with 7037@option{-Wno-overlength-strings}. 7038 7039@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 7040@opindex Wunsuffixed-float-constants 7041 7042Issue a warning for any floating constant that does not have 7043a suffix. When used together with @option{-Wsystem-headers} it 7044warns about such constants in system header files. This can be useful 7045when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 7046from the decimal floating-point extension to C99. 7047 7048@item -Wno-designated-init @r{(C and Objective-C only)} 7049Suppress warnings when a positional initializer is used to initialize 7050a structure that has been marked with the @code{designated_init} 7051attribute. 7052 7053@item -Whsa 7054Issue a warning when HSAIL cannot be emitted for the compiled function or 7055OpenMP construct. 7056 7057@end table 7058 7059@node Debugging Options 7060@section Options for Debugging Your Program 7061@cindex options, debugging 7062@cindex debugging information options 7063 7064To tell GCC to emit extra information for use by a debugger, in almost 7065all cases you need only to add @option{-g} to your other options. 7066 7067GCC allows you to use @option{-g} with 7068@option{-O}. The shortcuts taken by optimized code may occasionally 7069be surprising: some variables you declared may not exist 7070at all; flow of control may briefly move where you did not expect it; 7071some statements may not be executed because they compute constant 7072results or their values are already at hand; some statements may 7073execute in different places because they have been moved out of loops. 7074Nevertheless it is possible to debug optimized output. This makes 7075it reasonable to use the optimizer for programs that might have bugs. 7076 7077If you are not using some other optimization option, consider 7078using @option{-Og} (@pxref{Optimize Options}) with @option{-g}. 7079With no @option{-O} option at all, some compiler passes that collect 7080information useful for debugging do not run at all, so that 7081@option{-Og} may result in a better debugging experience. 7082 7083@table @gcctabopt 7084@item -g 7085@opindex g 7086Produce debugging information in the operating system's native format 7087(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 7088information. 7089 7090On most systems that use stabs format, @option{-g} enables use of extra 7091debugging information that only GDB can use; this extra information 7092makes debugging work better in GDB but probably makes other debuggers 7093crash or 7094refuse to read the program. If you want to control for certain whether 7095to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 7096@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 7097 7098@item -ggdb 7099@opindex ggdb 7100Produce debugging information for use by GDB@. This means to use the 7101most expressive format available (DWARF, stabs, or the native format 7102if neither of those are supported), including GDB extensions if at all 7103possible. 7104 7105@item -gdwarf 7106@itemx -gdwarf-@var{version} 7107@opindex gdwarf 7108Produce debugging information in DWARF format (if that is supported). 7109The value of @var{version} may be either 2, 3, 4 or 5; the default version 7110for most targets is 4. DWARF Version 5 is only experimental. 7111 7112Note that with DWARF Version 2, some ports require and always 7113use some non-conflicting DWARF 3 extensions in the unwind tables. 7114 7115Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 7116for maximum benefit. 7117 7118GCC no longer supports DWARF Version 1, which is substantially 7119different than Version 2 and later. For historical reasons, some 7120other DWARF-related options such as 7121@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2 7122in their names, but apply to all currently-supported versions of DWARF. 7123 7124@item -gstabs 7125@opindex gstabs 7126Produce debugging information in stabs format (if that is supported), 7127without GDB extensions. This is the format used by DBX on most BSD 7128systems. On MIPS, Alpha and System V Release 4 systems this option 7129produces stabs debugging output that is not understood by DBX@. 7130On System V Release 4 systems this option requires the GNU assembler. 7131 7132@item -gstabs+ 7133@opindex gstabs+ 7134Produce debugging information in stabs format (if that is supported), 7135using GNU extensions understood only by the GNU debugger (GDB)@. The 7136use of these extensions is likely to make other debuggers crash or 7137refuse to read the program. 7138 7139@item -gxcoff 7140@opindex gxcoff 7141Produce debugging information in XCOFF format (if that is supported). 7142This is the format used by the DBX debugger on IBM RS/6000 systems. 7143 7144@item -gxcoff+ 7145@opindex gxcoff+ 7146Produce debugging information in XCOFF format (if that is supported), 7147using GNU extensions understood only by the GNU debugger (GDB)@. The 7148use of these extensions is likely to make other debuggers crash or 7149refuse to read the program, and may cause assemblers other than the GNU 7150assembler (GAS) to fail with an error. 7151 7152@item -gvms 7153@opindex gvms 7154Produce debugging information in Alpha/VMS debug format (if that is 7155supported). This is the format used by DEBUG on Alpha/VMS systems. 7156 7157@item -g@var{level} 7158@itemx -ggdb@var{level} 7159@itemx -gstabs@var{level} 7160@itemx -gxcoff@var{level} 7161@itemx -gvms@var{level} 7162Request debugging information and also use @var{level} to specify how 7163much information. The default level is 2. 7164 7165Level 0 produces no debug information at all. Thus, @option{-g0} negates 7166@option{-g}. 7167 7168Level 1 produces minimal information, enough for making backtraces in 7169parts of the program that you don't plan to debug. This includes 7170descriptions of functions and external variables, and line number 7171tables, but no information about local variables. 7172 7173Level 3 includes extra information, such as all the macro definitions 7174present in the program. Some debuggers support macro expansion when 7175you use @option{-g3}. 7176 7177@option{-gdwarf} does not accept a concatenated debug level, to avoid 7178confusion with @option{-gdwarf-@var{level}}. 7179Instead use an additional @option{-g@var{level}} option to change the 7180debug level for DWARF. 7181 7182@item -feliminate-unused-debug-symbols 7183@opindex feliminate-unused-debug-symbols 7184Produce debugging information in stabs format (if that is supported), 7185for only symbols that are actually used. 7186 7187@item -femit-class-debug-always 7188@opindex femit-class-debug-always 7189Instead of emitting debugging information for a C++ class in only one 7190object file, emit it in all object files using the class. This option 7191should be used only with debuggers that are unable to handle the way GCC 7192normally emits debugging information for classes because using this 7193option increases the size of debugging information by as much as a 7194factor of two. 7195 7196@item -fno-merge-debug-strings 7197@opindex fmerge-debug-strings 7198@opindex fno-merge-debug-strings 7199Direct the linker to not merge together strings in the debugging 7200information that are identical in different object files. Merging is 7201not supported by all assemblers or linkers. Merging decreases the size 7202of the debug information in the output file at the cost of increasing 7203link processing time. Merging is enabled by default. 7204 7205@item -fdebug-prefix-map=@var{old}=@var{new} 7206@opindex fdebug-prefix-map 7207When compiling files residing in directory @file{@var{old}}, record 7208debugging information describing them as if the files resided in 7209directory @file{@var{new}} instead. This can be used to replace a 7210build-time path with an install-time path in the debug info. It can 7211also be used to change an absolute path to a relative path by using 7212@file{.} for @var{new}. This can give more reproducible builds, which 7213are location independent, but may require an extra command to tell GDB 7214where to find the source files. See also @option{-ffile-prefix-map}. 7215 7216@item -fvar-tracking 7217@opindex fvar-tracking 7218Run variable tracking pass. It computes where variables are stored at each 7219position in code. Better debugging information is then generated 7220(if the debugging information format supports this information). 7221 7222It is enabled by default when compiling with optimization (@option{-Os}, 7223@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 7224the debug info format supports it. 7225 7226@item -fvar-tracking-assignments 7227@opindex fvar-tracking-assignments 7228@opindex fno-var-tracking-assignments 7229Annotate assignments to user variables early in the compilation and 7230attempt to carry the annotations over throughout the compilation all the 7231way to the end, in an attempt to improve debug information while 7232optimizing. Use of @option{-gdwarf-4} is recommended along with it. 7233 7234It can be enabled even if var-tracking is disabled, in which case 7235annotations are created and maintained, but discarded at the end. 7236By default, this flag is enabled together with @option{-fvar-tracking}, 7237except when selective scheduling is enabled. 7238 7239@item -gsplit-dwarf 7240@opindex gsplit-dwarf 7241Separate as much DWARF debugging information as possible into a 7242separate output file with the extension @file{.dwo}. This option allows 7243the build system to avoid linking files with debug information. To 7244be useful, this option requires a debugger capable of reading @file{.dwo} 7245files. 7246 7247@item -gpubnames 7248@opindex gpubnames 7249Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections. 7250 7251@item -ggnu-pubnames 7252@opindex ggnu-pubnames 7253Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format 7254suitable for conversion into a GDB@ index. This option is only useful 7255with a linker that can produce GDB@ index version 7. 7256 7257@item -fdebug-types-section 7258@opindex fdebug-types-section 7259@opindex fno-debug-types-section 7260When using DWARF Version 4 or higher, type DIEs can be put into 7261their own @code{.debug_types} section instead of making them part of the 7262@code{.debug_info} section. It is more efficient to put them in a separate 7263comdat sections since the linker can then remove duplicates. 7264But not all DWARF consumers support @code{.debug_types} sections yet 7265and on some objects @code{.debug_types} produces larger instead of smaller 7266debugging information. 7267 7268@item -grecord-gcc-switches 7269@itemx -gno-record-gcc-switches 7270@opindex grecord-gcc-switches 7271@opindex gno-record-gcc-switches 7272This switch causes the command-line options used to invoke the 7273compiler that may affect code generation to be appended to the 7274DW_AT_producer attribute in DWARF debugging information. The options 7275are concatenated with spaces separating them from each other and from 7276the compiler version. 7277It is enabled by default. 7278See also @option{-frecord-gcc-switches} for another 7279way of storing compiler options into the object file. 7280 7281@item -gstrict-dwarf 7282@opindex gstrict-dwarf 7283Disallow using extensions of later DWARF standard version than selected 7284with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 7285DWARF extensions from later standard versions is allowed. 7286 7287@item -gno-strict-dwarf 7288@opindex gno-strict-dwarf 7289Allow using extensions of later DWARF standard version than selected with 7290@option{-gdwarf-@var{version}}. 7291 7292@item -gas-loc-support 7293@opindex gas-loc-support 7294Inform the compiler that the assembler supports @code{.loc} directives. 7295It may then use them for the assembler to generate DWARF2+ line number 7296tables. 7297 7298This is generally desirable, because assembler-generated line-number 7299tables are a lot more compact than those the compiler can generate 7300itself. 7301 7302This option will be enabled by default if, at GCC configure time, the 7303assembler was found to support such directives. 7304 7305@item -gno-as-loc-support 7306@opindex gno-as-loc-support 7307Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ 7308line number tables are to be generated. 7309 7310@item gas-locview-support 7311@opindex gas-locview-support 7312Inform the compiler that the assembler supports @code{view} assignment 7313and reset assertion checking in @code{.loc} directives. 7314 7315This option will be enabled by default if, at GCC configure time, the 7316assembler was found to support them. 7317 7318@item gno-as-locview-support 7319Force GCC to assign view numbers internally, if 7320@option{-gvariable-location-views} are explicitly requested. 7321 7322@item -gcolumn-info 7323@itemx -gno-column-info 7324@opindex gcolumn-info 7325@opindex gno-column-info 7326Emit location column information into DWARF debugging information, rather 7327than just file and line. 7328This option is enabled by default. 7329 7330@item -gstatement-frontiers 7331@itemx -gno-statement-frontiers 7332@opindex gstatement-frontiers 7333@opindex gno-statement-frontiers 7334This option causes GCC to create markers in the internal representation 7335at the beginning of statements, and to keep them roughly in place 7336throughout compilation, using them to guide the output of @code{is_stmt} 7337markers in the line number table. This is enabled by default when 7338compiling with optimization (@option{-Os}, @option{-O}, @option{-O2}, 7339@dots{}), and outputting DWARF 2 debug information at the normal level. 7340 7341@item -gvariable-location-views 7342@itemx -gvariable-location-views=incompat5 7343@itemx -gno-variable-location-views 7344@opindex gvariable-location-views 7345@opindex gvariable-location-views=incompat5 7346@opindex gno-variable-location-views 7347Augment variable location lists with progressive view numbers implied 7348from the line number table. This enables debug information consumers to 7349inspect state at certain points of the program, even if no instructions 7350associated with the corresponding source locations are present at that 7351point. If the assembler lacks support for view numbers in line number 7352tables, this will cause the compiler to emit the line number table, 7353which generally makes them somewhat less compact. The augmented line 7354number tables and location lists are fully backward-compatible, so they 7355can be consumed by debug information consumers that are not aware of 7356these augmentations, but they won't derive any benefit from them either. 7357 7358This is enabled by default when outputting DWARF 2 debug information at 7359the normal level, as long as there is assembler support, 7360@option{-fvar-tracking-assignments} is enabled and 7361@option{-gstrict-dwarf} is not. When assembler support is not 7362available, this may still be enabled, but it will force GCC to output 7363internal line number tables, and if 7364@option{-ginternal-reset-location-views} is not enabled, that will most 7365certainly lead to silently mismatching location views. 7366 7367There is a proposed representation for view numbers that is not backward 7368compatible with the location list format introduced in DWARF 5, that can 7369be enabled with @option{-gvariable-location-views=incompat5}. This 7370option may be removed in the future, is only provided as a reference 7371implementation of the proposed representation. Debug information 7372consumers are not expected to support this extended format, and they 7373would be rendered unable to decode location lists using it. 7374 7375@item -ginternal-reset-location-views 7376@itemx -gno-internal-reset-location-views 7377@opindex ginternal-reset-location-views 7378@opindex gno-internal-reset-location-views 7379Attempt to determine location views that can be omitted from location 7380view lists. This requires the compiler to have very accurate insn 7381length estimates, which isn't always the case, and it may cause 7382incorrect view lists to be generated silently when using an assembler 7383that does not support location view lists. The GNU assembler will flag 7384any such error as a @code{view number mismatch}. This is only enabled 7385on ports that define a reliable estimation function. 7386 7387@item -ginline-points 7388@itemx -gno-inline-points 7389@opindex ginline-points 7390@opindex gno-inline-points 7391Generate extended debug information for inlined functions. Location 7392view tracking markers are inserted at inlined entry points, so that 7393address and view numbers can be computed and output in debug 7394information. This can be enabled independently of location views, in 7395which case the view numbers won't be output, but it can only be enabled 7396along with statement frontiers, and it is only enabled by default if 7397location views are enabled. 7398 7399@item -gz@r{[}=@var{type}@r{]} 7400@opindex gz 7401Produce compressed debug sections in DWARF format, if that is supported. 7402If @var{type} is not given, the default type depends on the capabilities 7403of the assembler and linker used. @var{type} may be one of 7404@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 7405compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 7406compression in traditional GNU format). If the linker doesn't support 7407writing compressed debug sections, the option is rejected. Otherwise, 7408if the assembler does not support them, @option{-gz} is silently ignored 7409when producing object files. 7410 7411@item -femit-struct-debug-baseonly 7412@opindex femit-struct-debug-baseonly 7413Emit debug information for struct-like types 7414only when the base name of the compilation source file 7415matches the base name of file in which the struct is defined. 7416 7417This option substantially reduces the size of debugging information, 7418but at significant potential loss in type information to the debugger. 7419See @option{-femit-struct-debug-reduced} for a less aggressive option. 7420See @option{-femit-struct-debug-detailed} for more detailed control. 7421 7422This option works only with DWARF debug output. 7423 7424@item -femit-struct-debug-reduced 7425@opindex femit-struct-debug-reduced 7426Emit debug information for struct-like types 7427only when the base name of the compilation source file 7428matches the base name of file in which the type is defined, 7429unless the struct is a template or defined in a system header. 7430 7431This option significantly reduces the size of debugging information, 7432with some potential loss in type information to the debugger. 7433See @option{-femit-struct-debug-baseonly} for a more aggressive option. 7434See @option{-femit-struct-debug-detailed} for more detailed control. 7435 7436This option works only with DWARF debug output. 7437 7438@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 7439@opindex femit-struct-debug-detailed 7440Specify the struct-like types 7441for which the compiler generates debug information. 7442The intent is to reduce duplicate struct debug information 7443between different object files within the same program. 7444 7445This option is a detailed version of 7446@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 7447which serves for most needs. 7448 7449A specification has the syntax@* 7450[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 7451 7452The optional first word limits the specification to 7453structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 7454A struct type is used directly when it is the type of a variable, member. 7455Indirect uses arise through pointers to structs. 7456That is, when use of an incomplete struct is valid, the use is indirect. 7457An example is 7458@samp{struct one direct; struct two * indirect;}. 7459 7460The optional second word limits the specification to 7461ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 7462Generic structs are a bit complicated to explain. 7463For C++, these are non-explicit specializations of template classes, 7464or non-template classes within the above. 7465Other programming languages have generics, 7466but @option{-femit-struct-debug-detailed} does not yet implement them. 7467 7468The third word specifies the source files for those 7469structs for which the compiler should emit debug information. 7470The values @samp{none} and @samp{any} have the normal meaning. 7471The value @samp{base} means that 7472the base of name of the file in which the type declaration appears 7473must match the base of the name of the main compilation file. 7474In practice, this means that when compiling @file{foo.c}, debug information 7475is generated for types declared in that file and @file{foo.h}, 7476but not other header files. 7477The value @samp{sys} means those types satisfying @samp{base} 7478or declared in system or compiler headers. 7479 7480You may need to experiment to determine the best settings for your application. 7481 7482The default is @option{-femit-struct-debug-detailed=all}. 7483 7484This option works only with DWARF debug output. 7485 7486@item -fno-dwarf2-cfi-asm 7487@opindex fdwarf2-cfi-asm 7488@opindex fno-dwarf2-cfi-asm 7489Emit DWARF unwind info as compiler generated @code{.eh_frame} section 7490instead of using GAS @code{.cfi_*} directives. 7491 7492@item -fno-eliminate-unused-debug-types 7493@opindex feliminate-unused-debug-types 7494@opindex fno-eliminate-unused-debug-types 7495Normally, when producing DWARF output, GCC avoids producing debug symbol 7496output for types that are nowhere used in the source file being compiled. 7497Sometimes it is useful to have GCC emit debugging 7498information for all types declared in a compilation 7499unit, regardless of whether or not they are actually used 7500in that compilation unit, for example 7501if, in the debugger, you want to cast a value to a type that is 7502not actually used in your program (but is declared). More often, 7503however, this results in a significant amount of wasted space. 7504@end table 7505 7506@node Optimize Options 7507@section Options That Control Optimization 7508@cindex optimize options 7509@cindex options, optimization 7510 7511These options control various sorts of optimizations. 7512 7513Without any optimization option, the compiler's goal is to reduce the 7514cost of compilation and to make debugging produce the expected 7515results. Statements are independent: if you stop the program with a 7516breakpoint between statements, you can then assign a new value to any 7517variable or change the program counter to any other statement in the 7518function and get exactly the results you expect from the source 7519code. 7520 7521Turning on optimization flags makes the compiler attempt to improve 7522the performance and/or code size at the expense of compilation time 7523and possibly the ability to debug the program. 7524 7525The compiler performs optimization based on the knowledge it has of the 7526program. Compiling multiple files at once to a single output file mode allows 7527the compiler to use information gained from all of the files when compiling 7528each of them. 7529 7530Not all optimizations are controlled directly by a flag. Only 7531optimizations that have a flag are listed in this section. 7532 7533Most optimizations are only enabled if an @option{-O} level is set on 7534the command line. Otherwise they are disabled, even if individual 7535optimization flags are specified. 7536 7537Depending on the target and how GCC was configured, a slightly different 7538set of optimizations may be enabled at each @option{-O} level than 7539those listed here. You can invoke GCC with @option{-Q --help=optimizers} 7540to find out the exact set of optimizations that are enabled at each level. 7541@xref{Overall Options}, for examples. 7542 7543@table @gcctabopt 7544@item -O 7545@itemx -O1 7546@opindex O 7547@opindex O1 7548Optimize. Optimizing compilation takes somewhat more time, and a lot 7549more memory for a large function. 7550 7551With @option{-O}, the compiler tries to reduce code size and execution 7552time, without performing any optimizations that take a great deal of 7553compilation time. 7554 7555@option{-O} turns on the following optimization flags: 7556@gccoptlist{ 7557-fauto-inc-dec @gol 7558-fbranch-count-reg @gol 7559-fcombine-stack-adjustments @gol 7560-fcompare-elim @gol 7561-fcprop-registers @gol 7562-fdce @gol 7563-fdefer-pop @gol 7564-fdelayed-branch @gol 7565-fdse @gol 7566-fforward-propagate @gol 7567-fguess-branch-probability @gol 7568-fif-conversion2 @gol 7569-fif-conversion @gol 7570-finline-functions-called-once @gol 7571-fipa-pure-const @gol 7572-fipa-profile @gol 7573-fipa-reference @gol 7574-fmerge-constants @gol 7575-fmove-loop-invariants @gol 7576-fomit-frame-pointer @gol 7577-freorder-blocks @gol 7578-fshrink-wrap @gol 7579-fshrink-wrap-separate @gol 7580-fsplit-wide-types @gol 7581-fssa-backprop @gol 7582-fssa-phiopt @gol 7583-ftree-bit-ccp @gol 7584-ftree-ccp @gol 7585-ftree-ch @gol 7586-ftree-coalesce-vars @gol 7587-ftree-copy-prop @gol 7588-ftree-dce @gol 7589-ftree-dominator-opts @gol 7590-ftree-dse @gol 7591-ftree-forwprop @gol 7592-ftree-fre @gol 7593-ftree-phiprop @gol 7594-ftree-sink @gol 7595-ftree-slsr @gol 7596-ftree-sra @gol 7597-ftree-pta @gol 7598-ftree-ter @gol 7599-funit-at-a-time} 7600 7601@item -O2 7602@opindex O2 7603Optimize even more. GCC performs nearly all supported optimizations 7604that do not involve a space-speed tradeoff. 7605As compared to @option{-O}, this option increases both compilation time 7606and the performance of the generated code. 7607 7608@option{-O2} turns on all optimization flags specified by @option{-O}. It 7609also turns on the following optimization flags: 7610@gccoptlist{-fthread-jumps @gol 7611-falign-functions -falign-jumps @gol 7612-falign-loops -falign-labels @gol 7613-fcaller-saves @gol 7614-fcrossjumping @gol 7615-fcse-follow-jumps -fcse-skip-blocks @gol 7616-fdelete-null-pointer-checks @gol 7617-fdevirtualize -fdevirtualize-speculatively @gol 7618-fexpensive-optimizations @gol 7619-fgcse -fgcse-lm @gol 7620-fhoist-adjacent-loads @gol 7621-finline-small-functions @gol 7622-findirect-inlining @gol 7623-fipa-cp @gol 7624-fipa-bit-cp @gol 7625-fipa-vrp @gol 7626-fipa-sra @gol 7627-fipa-icf @gol 7628-fisolate-erroneous-paths-dereference @gol 7629-flra-remat @gol 7630-foptimize-sibling-calls @gol 7631-foptimize-strlen @gol 7632-fpartial-inlining @gol 7633-fpeephole2 @gol 7634-freorder-blocks-algorithm=stc @gol 7635-freorder-blocks-and-partition -freorder-functions @gol 7636-frerun-cse-after-loop @gol 7637-fsched-interblock -fsched-spec @gol 7638-fschedule-insns -fschedule-insns2 @gol 7639-fstore-merging @gol 7640-fstrict-aliasing @gol 7641-ftree-builtin-call-dce @gol 7642-ftree-switch-conversion -ftree-tail-merge @gol 7643-fcode-hoisting @gol 7644-ftree-pre @gol 7645-ftree-vrp @gol 7646-fipa-ra} 7647 7648Please note the warning under @option{-fgcse} about 7649invoking @option{-O2} on programs that use computed gotos. 7650 7651@item -O3 7652@opindex O3 7653Optimize yet more. @option{-O3} turns on all optimizations specified 7654by @option{-O2} and also turns on the following optimization flags: 7655@gccoptlist{-finline-functions @gol 7656-funswitch-loops @gol 7657-fpredictive-commoning @gol 7658-fgcse-after-reload @gol 7659-ftree-loop-vectorize @gol 7660-ftree-loop-distribution @gol 7661-ftree-loop-distribute-patterns @gol 7662-floop-interchange @gol 7663-floop-unroll-and-jam @gol 7664-fsplit-paths @gol 7665-ftree-slp-vectorize @gol 7666-fvect-cost-model @gol 7667-ftree-partial-pre @gol 7668-fpeel-loops @gol 7669-fipa-cp-clone} 7670 7671@item -O0 7672@opindex O0 7673Reduce compilation time and make debugging produce the expected 7674results. This is the default. 7675 7676@item -Os 7677@opindex Os 7678Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 7679do not typically increase code size. 7680 7681@option{-Os} disables the following optimization flags: 7682@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 7683-falign-labels -fprefetch-loop-arrays} 7684 7685It also enables @option{-finline-functions}, causes the compiler to tune for 7686code size rather than execution speed, and performs further optimizations 7687designed to reduce code size. 7688 7689@item -Ofast 7690@opindex Ofast 7691Disregard strict standards compliance. @option{-Ofast} enables all 7692@option{-O3} optimizations. It also enables optimizations that are not 7693valid for all standard-compliant programs. 7694It turns on @option{-ffast-math} and the Fortran-specific 7695@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is 7696specified, and @option{-fno-protect-parens}. 7697 7698@item -Og 7699@opindex Og 7700Optimize debugging experience. @option{-Og} enables optimizations 7701that do not interfere with debugging. It should be the optimization 7702level of choice for the standard edit-compile-debug cycle, offering 7703a reasonable level of optimization while maintaining fast compilation 7704and a good debugging experience. 7705@end table 7706 7707If you use multiple @option{-O} options, with or without level numbers, 7708the last such option is the one that is effective. 7709 7710Options of the form @option{-f@var{flag}} specify machine-independent 7711flags. Most flags have both positive and negative forms; the negative 7712form of @option{-ffoo} is @option{-fno-foo}. In the table 7713below, only one of the forms is listed---the one you typically 7714use. You can figure out the other form by either removing @samp{no-} 7715or adding it. 7716 7717The following options control specific optimizations. They are either 7718activated by @option{-O} options or are related to ones that are. You 7719can use the following flags in the rare cases when ``fine-tuning'' of 7720optimizations to be performed is desired. 7721 7722@table @gcctabopt 7723@item -fno-defer-pop 7724@opindex fno-defer-pop 7725Always pop the arguments to each function call as soon as that function 7726returns. For machines that must pop arguments after a function call, 7727the compiler normally lets arguments accumulate on the stack for several 7728function calls and pops them all at once. 7729 7730Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7731 7732@item -fforward-propagate 7733@opindex fforward-propagate 7734Perform a forward propagation pass on RTL@. The pass tries to combine two 7735instructions and checks if the result can be simplified. If loop unrolling 7736is active, two passes are performed and the second is scheduled after 7737loop unrolling. 7738 7739This option is enabled by default at optimization levels @option{-O}, 7740@option{-O2}, @option{-O3}, @option{-Os}. 7741 7742@item -ffp-contract=@var{style} 7743@opindex ffp-contract 7744@option{-ffp-contract=off} disables floating-point expression contraction. 7745@option{-ffp-contract=fast} enables floating-point expression contraction 7746such as forming of fused multiply-add operations if the target has 7747native support for them. 7748@option{-ffp-contract=on} enables floating-point expression contraction 7749if allowed by the language standard. This is currently not implemented 7750and treated equal to @option{-ffp-contract=off}. 7751 7752The default is @option{-ffp-contract=fast}. 7753 7754@item -fomit-frame-pointer 7755@opindex fomit-frame-pointer 7756Omit the frame pointer in functions that don't need one. This avoids the 7757instructions to save, set up and restore the frame pointer; on many targets 7758it also makes an extra register available. 7759 7760On some targets this flag has no effect because the standard calling sequence 7761always uses a frame pointer, so it cannot be omitted. 7762 7763Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer 7764is used in all functions. Several targets always omit the frame pointer in 7765leaf functions. 7766 7767Enabled by default at @option{-O} and higher. 7768 7769@item -foptimize-sibling-calls 7770@opindex foptimize-sibling-calls 7771Optimize sibling and tail recursive calls. 7772 7773Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7774 7775@item -foptimize-strlen 7776@opindex foptimize-strlen 7777Optimize various standard C string functions (e.g. @code{strlen}, 7778@code{strchr} or @code{strcpy}) and 7779their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 7780 7781Enabled at levels @option{-O2}, @option{-O3}. 7782 7783@item -fno-inline 7784@opindex fno-inline 7785Do not expand any functions inline apart from those marked with 7786the @code{always_inline} attribute. This is the default when not 7787optimizing. 7788 7789Single functions can be exempted from inlining by marking them 7790with the @code{noinline} attribute. 7791 7792@item -finline-small-functions 7793@opindex finline-small-functions 7794Integrate functions into their callers when their body is smaller than expected 7795function call code (so overall size of program gets smaller). The compiler 7796heuristically decides which functions are simple enough to be worth integrating 7797in this way. This inlining applies to all functions, even those not declared 7798inline. 7799 7800Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7801 7802@item -findirect-inlining 7803@opindex findirect-inlining 7804Inline also indirect calls that are discovered to be known at compile 7805time thanks to previous inlining. This option has any effect only 7806when inlining itself is turned on by the @option{-finline-functions} 7807or @option{-finline-small-functions} options. 7808 7809Enabled at levels @option{-O3}, @option{-Os}. Also enabled 7810by @option{-fprofile-use} and @option{-fauto-profile}. 7811 7812@item -finline-functions 7813@opindex finline-functions 7814Consider all functions for inlining, even if they are not declared inline. 7815The compiler heuristically decides which functions are worth integrating 7816in this way. 7817 7818If all calls to a given function are integrated, and the function is 7819declared @code{static}, then the function is normally not output as 7820assembler code in its own right. 7821 7822Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7823 7824@item -finline-functions-called-once 7825@opindex finline-functions-called-once 7826Consider all @code{static} functions called once for inlining into their 7827caller even if they are not marked @code{inline}. If a call to a given 7828function is integrated, then the function is not output as assembler code 7829in its own right. 7830 7831Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. 7832 7833@item -fearly-inlining 7834@opindex fearly-inlining 7835Inline functions marked by @code{always_inline} and functions whose body seems 7836smaller than the function call overhead early before doing 7837@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 7838makes profiling significantly cheaper and usually inlining faster on programs 7839having large chains of nested wrapper functions. 7840 7841Enabled by default. 7842 7843@item -fipa-sra 7844@opindex fipa-sra 7845Perform interprocedural scalar replacement of aggregates, removal of 7846unused parameters and replacement of parameters passed by reference 7847by parameters passed by value. 7848 7849Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 7850 7851@item -finline-limit=@var{n} 7852@opindex finline-limit 7853By default, GCC limits the size of functions that can be inlined. This flag 7854allows coarse control of this limit. @var{n} is the size of functions that 7855can be inlined in number of pseudo instructions. 7856 7857Inlining is actually controlled by a number of parameters, which may be 7858specified individually by using @option{--param @var{name}=@var{value}}. 7859The @option{-finline-limit=@var{n}} option sets some of these parameters 7860as follows: 7861 7862@table @gcctabopt 7863@item max-inline-insns-single 7864is set to @var{n}/2. 7865@item max-inline-insns-auto 7866is set to @var{n}/2. 7867@end table 7868 7869See below for a documentation of the individual 7870parameters controlling inlining and for the defaults of these parameters. 7871 7872@emph{Note:} there may be no value to @option{-finline-limit} that results 7873in default behavior. 7874 7875@emph{Note:} pseudo instruction represents, in this particular context, an 7876abstract measurement of function's size. In no way does it represent a count 7877of assembly instructions and as such its exact meaning might change from one 7878release to an another. 7879 7880@item -fno-keep-inline-dllexport 7881@opindex fno-keep-inline-dllexport 7882This is a more fine-grained version of @option{-fkeep-inline-functions}, 7883which applies only to functions that are declared using the @code{dllexport} 7884attribute or declspec. @xref{Function Attributes,,Declaring Attributes of 7885Functions}. 7886 7887@item -fkeep-inline-functions 7888@opindex fkeep-inline-functions 7889In C, emit @code{static} functions that are declared @code{inline} 7890into the object file, even if the function has been inlined into all 7891of its callers. This switch does not affect functions using the 7892@code{extern inline} extension in GNU C90@. In C++, emit any and all 7893inline functions into the object file. 7894 7895@item -fkeep-static-functions 7896@opindex fkeep-static-functions 7897Emit @code{static} functions into the object file, even if the function 7898is never used. 7899 7900@item -fkeep-static-consts 7901@opindex fkeep-static-consts 7902Emit variables declared @code{static const} when optimization isn't turned 7903on, even if the variables aren't referenced. 7904 7905GCC enables this option by default. If you want to force the compiler to 7906check if a variable is referenced, regardless of whether or not 7907optimization is turned on, use the @option{-fno-keep-static-consts} option. 7908 7909@item -fmerge-constants 7910@opindex fmerge-constants 7911Attempt to merge identical constants (string constants and floating-point 7912constants) across compilation units. 7913 7914This option is the default for optimized compilation if the assembler and 7915linker support it. Use @option{-fno-merge-constants} to inhibit this 7916behavior. 7917 7918Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7919 7920@item -fmerge-all-constants 7921@opindex fmerge-all-constants 7922Attempt to merge identical constants and identical variables. 7923 7924This option implies @option{-fmerge-constants}. In addition to 7925@option{-fmerge-constants} this considers e.g.@: even constant initialized 7926arrays or initialized constant variables with integral or floating-point 7927types. Languages like C or C++ require each variable, including multiple 7928instances of the same variable in recursive calls, to have distinct locations, 7929so using this option results in non-conforming 7930behavior. 7931 7932@item -fmodulo-sched 7933@opindex fmodulo-sched 7934Perform swing modulo scheduling immediately before the first scheduling 7935pass. This pass looks at innermost loops and reorders their 7936instructions by overlapping different iterations. 7937 7938@item -fmodulo-sched-allow-regmoves 7939@opindex fmodulo-sched-allow-regmoves 7940Perform more aggressive SMS-based modulo scheduling with register moves 7941allowed. By setting this flag certain anti-dependences edges are 7942deleted, which triggers the generation of reg-moves based on the 7943life-range analysis. This option is effective only with 7944@option{-fmodulo-sched} enabled. 7945 7946@item -fno-branch-count-reg 7947@opindex fno-branch-count-reg 7948Avoid running a pass scanning for opportunities to use ``decrement and 7949branch'' instructions on a count register instead of generating sequences 7950of instructions that decrement a register, compare it against zero, and 7951then branch based upon the result. This option is only meaningful on 7952architectures that support such instructions, which include x86, PowerPC, 7953IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option 7954doesn't remove the decrement and branch instructions from the generated 7955instruction stream introduced by other optimization passes. 7956 7957Enabled by default at @option{-O1} and higher. 7958 7959The default is @option{-fbranch-count-reg}. 7960 7961@item -fno-function-cse 7962@opindex fno-function-cse 7963Do not put function addresses in registers; make each instruction that 7964calls a constant function contain the function's address explicitly. 7965 7966This option results in less efficient code, but some strange hacks 7967that alter the assembler output may be confused by the optimizations 7968performed when this option is not used. 7969 7970The default is @option{-ffunction-cse} 7971 7972@item -fno-zero-initialized-in-bss 7973@opindex fno-zero-initialized-in-bss 7974If the target supports a BSS section, GCC by default puts variables that 7975are initialized to zero into BSS@. This can save space in the resulting 7976code. 7977 7978This option turns off this behavior because some programs explicitly 7979rely on variables going to the data section---e.g., so that the 7980resulting executable can find the beginning of that section and/or make 7981assumptions based on that. 7982 7983The default is @option{-fzero-initialized-in-bss}. 7984 7985@item -fthread-jumps 7986@opindex fthread-jumps 7987Perform optimizations that check to see if a jump branches to a 7988location where another comparison subsumed by the first is found. If 7989so, the first branch is redirected to either the destination of the 7990second branch or a point immediately following it, depending on whether 7991the condition is known to be true or false. 7992 7993Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7994 7995@item -fsplit-wide-types 7996@opindex fsplit-wide-types 7997When using a type that occupies multiple registers, such as @code{long 7998long} on a 32-bit system, split the registers apart and allocate them 7999independently. This normally generates better code for those types, 8000but may make debugging more difficult. 8001 8002Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 8003@option{-Os}. 8004 8005@item -fcse-follow-jumps 8006@opindex fcse-follow-jumps 8007In common subexpression elimination (CSE), scan through jump instructions 8008when the target of the jump is not reached by any other path. For 8009example, when CSE encounters an @code{if} statement with an 8010@code{else} clause, CSE follows the jump when the condition 8011tested is false. 8012 8013Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8014 8015@item -fcse-skip-blocks 8016@opindex fcse-skip-blocks 8017This is similar to @option{-fcse-follow-jumps}, but causes CSE to 8018follow jumps that conditionally skip over blocks. When CSE 8019encounters a simple @code{if} statement with no else clause, 8020@option{-fcse-skip-blocks} causes CSE to follow the jump around the 8021body of the @code{if}. 8022 8023Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8024 8025@item -frerun-cse-after-loop 8026@opindex frerun-cse-after-loop 8027Re-run common subexpression elimination after loop optimizations are 8028performed. 8029 8030Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8031 8032@item -fgcse 8033@opindex fgcse 8034Perform a global common subexpression elimination pass. 8035This pass also performs global constant and copy propagation. 8036 8037@emph{Note:} When compiling a program using computed gotos, a GCC 8038extension, you may get better run-time performance if you disable 8039the global common subexpression elimination pass by adding 8040@option{-fno-gcse} to the command line. 8041 8042Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8043 8044@item -fgcse-lm 8045@opindex fgcse-lm 8046When @option{-fgcse-lm} is enabled, global common subexpression elimination 8047attempts to move loads that are only killed by stores into themselves. This 8048allows a loop containing a load/store sequence to be changed to a load outside 8049the loop, and a copy/store within the loop. 8050 8051Enabled by default when @option{-fgcse} is enabled. 8052 8053@item -fgcse-sm 8054@opindex fgcse-sm 8055When @option{-fgcse-sm} is enabled, a store motion pass is run after 8056global common subexpression elimination. This pass attempts to move 8057stores out of loops. When used in conjunction with @option{-fgcse-lm}, 8058loops containing a load/store sequence can be changed to a load before 8059the loop and a store after the loop. 8060 8061Not enabled at any optimization level. 8062 8063@item -fgcse-las 8064@opindex fgcse-las 8065When @option{-fgcse-las} is enabled, the global common subexpression 8066elimination pass eliminates redundant loads that come after stores to the 8067same memory location (both partial and full redundancies). 8068 8069Not enabled at any optimization level. 8070 8071@item -fgcse-after-reload 8072@opindex fgcse-after-reload 8073When @option{-fgcse-after-reload} is enabled, a redundant load elimination 8074pass is performed after reload. The purpose of this pass is to clean up 8075redundant spilling. 8076 8077@item -faggressive-loop-optimizations 8078@opindex faggressive-loop-optimizations 8079This option tells the loop optimizer to use language constraints to 8080derive bounds for the number of iterations of a loop. This assumes that 8081loop code does not invoke undefined behavior by for example causing signed 8082integer overflows or out-of-bound array accesses. The bounds for the 8083number of iterations of a loop are used to guide loop unrolling and peeling 8084and loop exit test optimizations. 8085This option is enabled by default. 8086 8087@item -funconstrained-commons 8088@opindex funconstrained-commons 8089This option tells the compiler that variables declared in common blocks 8090(e.g. Fortran) may later be overridden with longer trailing arrays. This 8091prevents certain optimizations that depend on knowing the array bounds. 8092 8093@item -fcrossjumping 8094@opindex fcrossjumping 8095Perform cross-jumping transformation. 8096This transformation unifies equivalent code and saves code size. The 8097resulting code may or may not perform better than without cross-jumping. 8098 8099Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8100 8101@item -fauto-inc-dec 8102@opindex fauto-inc-dec 8103Combine increments or decrements of addresses with memory accesses. 8104This pass is always skipped on architectures that do not have 8105instructions to support this. Enabled by default at @option{-O} and 8106higher on architectures that support this. 8107 8108@item -fdce 8109@opindex fdce 8110Perform dead code elimination (DCE) on RTL@. 8111Enabled by default at @option{-O} and higher. 8112 8113@item -fdse 8114@opindex fdse 8115Perform dead store elimination (DSE) on RTL@. 8116Enabled by default at @option{-O} and higher. 8117 8118@item -fif-conversion 8119@opindex fif-conversion 8120Attempt to transform conditional jumps into branch-less equivalents. This 8121includes use of conditional moves, min, max, set flags and abs instructions, and 8122some tricks doable by standard arithmetics. The use of conditional execution 8123on chips where it is available is controlled by @option{-fif-conversion2}. 8124 8125Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8126 8127@item -fif-conversion2 8128@opindex fif-conversion2 8129Use conditional execution (where available) to transform conditional jumps into 8130branch-less equivalents. 8131 8132Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8133 8134@item -fdeclone-ctor-dtor 8135@opindex fdeclone-ctor-dtor 8136The C++ ABI requires multiple entry points for constructors and 8137destructors: one for a base subobject, one for a complete object, and 8138one for a virtual destructor that calls operator delete afterwards. 8139For a hierarchy with virtual bases, the base and complete variants are 8140clones, which means two copies of the function. With this option, the 8141base and complete variants are changed to be thunks that call a common 8142implementation. 8143 8144Enabled by @option{-Os}. 8145 8146@item -fdelete-null-pointer-checks 8147@opindex fdelete-null-pointer-checks 8148Assume that programs cannot safely dereference null pointers, and that 8149no code or data element resides at address zero. 8150This option enables simple constant 8151folding optimizations at all optimization levels. In addition, other 8152optimization passes in GCC use this flag to control global dataflow 8153analyses that eliminate useless checks for null pointers; these assume 8154that a memory access to address zero always results in a trap, so 8155that if a pointer is checked after it has already been dereferenced, 8156it cannot be null. 8157 8158Note however that in some environments this assumption is not true. 8159Use @option{-fno-delete-null-pointer-checks} to disable this optimization 8160for programs that depend on that behavior. 8161 8162This option is enabled by default on most targets. On Nios II ELF, it 8163defaults to off. On AVR, CR16, and MSP430, this option is completely disabled. 8164 8165Passes that use the dataflow information 8166are enabled independently at different optimization levels. 8167 8168@item -fdevirtualize 8169@opindex fdevirtualize 8170Attempt to convert calls to virtual functions to direct calls. This 8171is done both within a procedure and interprocedurally as part of 8172indirect inlining (@option{-findirect-inlining}) and interprocedural constant 8173propagation (@option{-fipa-cp}). 8174Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8175 8176@item -fdevirtualize-speculatively 8177@opindex fdevirtualize-speculatively 8178Attempt to convert calls to virtual functions to speculative direct calls. 8179Based on the analysis of the type inheritance graph, determine for a given call 8180the set of likely targets. If the set is small, preferably of size 1, change 8181the call into a conditional deciding between direct and indirect calls. The 8182speculative calls enable more optimizations, such as inlining. When they seem 8183useless after further optimization, they are converted back into original form. 8184 8185@item -fdevirtualize-at-ltrans 8186@opindex fdevirtualize-at-ltrans 8187Stream extra information needed for aggressive devirtualization when running 8188the link-time optimizer in local transformation mode. 8189This option enables more devirtualization but 8190significantly increases the size of streamed data. For this reason it is 8191disabled by default. 8192 8193@item -fexpensive-optimizations 8194@opindex fexpensive-optimizations 8195Perform a number of minor optimizations that are relatively expensive. 8196 8197Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8198 8199@item -free 8200@opindex free 8201Attempt to remove redundant extension instructions. This is especially 8202helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 8203registers after writing to their lower 32-bit half. 8204 8205Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 8206@option{-O3}, @option{-Os}. 8207 8208@item -fno-lifetime-dse 8209@opindex fno-lifetime-dse 8210In C++ the value of an object is only affected by changes within its 8211lifetime: when the constructor begins, the object has an indeterminate 8212value, and any changes during the lifetime of the object are dead when 8213the object is destroyed. Normally dead store elimination will take 8214advantage of this; if your code relies on the value of the object 8215storage persisting beyond the lifetime of the object, you can use this 8216flag to disable this optimization. To preserve stores before the 8217constructor starts (e.g. because your operator new clears the object 8218storage) but still treat the object as dead after the destructor you, 8219can use @option{-flifetime-dse=1}. The default behavior can be 8220explicitly selected with @option{-flifetime-dse=2}. 8221@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}. 8222 8223@item -flive-range-shrinkage 8224@opindex flive-range-shrinkage 8225Attempt to decrease register pressure through register live range 8226shrinkage. This is helpful for fast processors with small or moderate 8227size register sets. 8228 8229@item -fira-algorithm=@var{algorithm} 8230@opindex fira-algorithm 8231Use the specified coloring algorithm for the integrated register 8232allocator. The @var{algorithm} argument can be @samp{priority}, which 8233specifies Chow's priority coloring, or @samp{CB}, which specifies 8234Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 8235for all architectures, but for those targets that do support it, it is 8236the default because it generates better code. 8237 8238@item -fira-region=@var{region} 8239@opindex fira-region 8240Use specified regions for the integrated register allocator. The 8241@var{region} argument should be one of the following: 8242 8243@table @samp 8244 8245@item all 8246Use all loops as register allocation regions. 8247This can give the best results for machines with a small and/or 8248irregular register set. 8249 8250@item mixed 8251Use all loops except for loops with small register pressure 8252as the regions. This value usually gives 8253the best results in most cases and for most architectures, 8254and is enabled by default when compiling with optimization for speed 8255(@option{-O}, @option{-O2}, @dots{}). 8256 8257@item one 8258Use all functions as a single region. 8259This typically results in the smallest code size, and is enabled by default for 8260@option{-Os} or @option{-O0}. 8261 8262@end table 8263 8264@item -fira-hoist-pressure 8265@opindex fira-hoist-pressure 8266Use IRA to evaluate register pressure in the code hoisting pass for 8267decisions to hoist expressions. This option usually results in smaller 8268code, but it can slow the compiler down. 8269 8270This option is enabled at level @option{-Os} for all targets. 8271 8272@item -fira-loop-pressure 8273@opindex fira-loop-pressure 8274Use IRA to evaluate register pressure in loops for decisions to move 8275loop invariants. This option usually results in generation 8276of faster and smaller code on machines with large register files (>= 32 8277registers), but it can slow the compiler down. 8278 8279This option is enabled at level @option{-O3} for some targets. 8280 8281@item -fno-ira-share-save-slots 8282@opindex fno-ira-share-save-slots 8283Disable sharing of stack slots used for saving call-used hard 8284registers living through a call. Each hard register gets a 8285separate stack slot, and as a result function stack frames are 8286larger. 8287 8288@item -fno-ira-share-spill-slots 8289@opindex fno-ira-share-spill-slots 8290Disable sharing of stack slots allocated for pseudo-registers. Each 8291pseudo-register that does not get a hard register gets a separate 8292stack slot, and as a result function stack frames are larger. 8293 8294@item -flra-remat 8295@opindex flra-remat 8296Enable CFG-sensitive rematerialization in LRA. Instead of loading 8297values of spilled pseudos, LRA tries to rematerialize (recalculate) 8298values if it is profitable. 8299 8300Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8301 8302@item -fdelayed-branch 8303@opindex fdelayed-branch 8304If supported for the target machine, attempt to reorder instructions 8305to exploit instruction slots available after delayed branch 8306instructions. 8307 8308Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8309 8310@item -fschedule-insns 8311@opindex fschedule-insns 8312If supported for the target machine, attempt to reorder instructions to 8313eliminate execution stalls due to required data being unavailable. This 8314helps machines that have slow floating point or memory load instructions 8315by allowing other instructions to be issued until the result of the load 8316or floating-point instruction is required. 8317 8318Enabled at levels @option{-O2}, @option{-O3}. 8319 8320@item -fschedule-insns2 8321@opindex fschedule-insns2 8322Similar to @option{-fschedule-insns}, but requests an additional pass of 8323instruction scheduling after register allocation has been done. This is 8324especially useful on machines with a relatively small number of 8325registers and where memory load instructions take more than one cycle. 8326 8327Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8328 8329@item -fno-sched-interblock 8330@opindex fno-sched-interblock 8331Don't schedule instructions across basic blocks. This is normally 8332enabled by default when scheduling before register allocation, i.e.@: 8333with @option{-fschedule-insns} or at @option{-O2} or higher. 8334 8335@item -fno-sched-spec 8336@opindex fno-sched-spec 8337Don't allow speculative motion of non-load instructions. This is normally 8338enabled by default when scheduling before register allocation, i.e.@: 8339with @option{-fschedule-insns} or at @option{-O2} or higher. 8340 8341@item -fsched-pressure 8342@opindex fsched-pressure 8343Enable register pressure sensitive insn scheduling before register 8344allocation. This only makes sense when scheduling before register 8345allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 8346@option{-O2} or higher. Usage of this option can improve the 8347generated code and decrease its size by preventing register pressure 8348increase above the number of available hard registers and subsequent 8349spills in register allocation. 8350 8351@item -fsched-spec-load 8352@opindex fsched-spec-load 8353Allow speculative motion of some load instructions. This only makes 8354sense when scheduling before register allocation, i.e.@: with 8355@option{-fschedule-insns} or at @option{-O2} or higher. 8356 8357@item -fsched-spec-load-dangerous 8358@opindex fsched-spec-load-dangerous 8359Allow speculative motion of more load instructions. This only makes 8360sense when scheduling before register allocation, i.e.@: with 8361@option{-fschedule-insns} or at @option{-O2} or higher. 8362 8363@item -fsched-stalled-insns 8364@itemx -fsched-stalled-insns=@var{n} 8365@opindex fsched-stalled-insns 8366Define how many insns (if any) can be moved prematurely from the queue 8367of stalled insns into the ready list during the second scheduling pass. 8368@option{-fno-sched-stalled-insns} means that no insns are moved 8369prematurely, @option{-fsched-stalled-insns=0} means there is no limit 8370on how many queued insns can be moved prematurely. 8371@option{-fsched-stalled-insns} without a value is equivalent to 8372@option{-fsched-stalled-insns=1}. 8373 8374@item -fsched-stalled-insns-dep 8375@itemx -fsched-stalled-insns-dep=@var{n} 8376@opindex fsched-stalled-insns-dep 8377Define how many insn groups (cycles) are examined for a dependency 8378on a stalled insn that is a candidate for premature removal from the queue 8379of stalled insns. This has an effect only during the second scheduling pass, 8380and only if @option{-fsched-stalled-insns} is used. 8381@option{-fno-sched-stalled-insns-dep} is equivalent to 8382@option{-fsched-stalled-insns-dep=0}. 8383@option{-fsched-stalled-insns-dep} without a value is equivalent to 8384@option{-fsched-stalled-insns-dep=1}. 8385 8386@item -fsched2-use-superblocks 8387@opindex fsched2-use-superblocks 8388When scheduling after register allocation, use superblock scheduling. 8389This allows motion across basic block boundaries, 8390resulting in faster schedules. This option is experimental, as not all machine 8391descriptions used by GCC model the CPU closely enough to avoid unreliable 8392results from the algorithm. 8393 8394This only makes sense when scheduling after register allocation, i.e.@: with 8395@option{-fschedule-insns2} or at @option{-O2} or higher. 8396 8397@item -fsched-group-heuristic 8398@opindex fsched-group-heuristic 8399Enable the group heuristic in the scheduler. This heuristic favors 8400the instruction that belongs to a schedule group. This is enabled 8401by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 8402or @option{-fschedule-insns2} or at @option{-O2} or higher. 8403 8404@item -fsched-critical-path-heuristic 8405@opindex fsched-critical-path-heuristic 8406Enable the critical-path heuristic in the scheduler. This heuristic favors 8407instructions on the critical path. This is enabled by default when 8408scheduling is enabled, i.e.@: with @option{-fschedule-insns} 8409or @option{-fschedule-insns2} or at @option{-O2} or higher. 8410 8411@item -fsched-spec-insn-heuristic 8412@opindex fsched-spec-insn-heuristic 8413Enable the speculative instruction heuristic in the scheduler. This 8414heuristic favors speculative instructions with greater dependency weakness. 8415This is enabled by default when scheduling is enabled, i.e.@: 8416with @option{-fschedule-insns} or @option{-fschedule-insns2} 8417or at @option{-O2} or higher. 8418 8419@item -fsched-rank-heuristic 8420@opindex fsched-rank-heuristic 8421Enable the rank heuristic in the scheduler. This heuristic favors 8422the instruction belonging to a basic block with greater size or frequency. 8423This is enabled by default when scheduling is enabled, i.e.@: 8424with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8425at @option{-O2} or higher. 8426 8427@item -fsched-last-insn-heuristic 8428@opindex fsched-last-insn-heuristic 8429Enable the last-instruction heuristic in the scheduler. This heuristic 8430favors the instruction that is less dependent on the last instruction 8431scheduled. This is enabled by default when scheduling is enabled, 8432i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8433at @option{-O2} or higher. 8434 8435@item -fsched-dep-count-heuristic 8436@opindex fsched-dep-count-heuristic 8437Enable the dependent-count heuristic in the scheduler. This heuristic 8438favors the instruction that has more instructions depending on it. 8439This is enabled by default when scheduling is enabled, i.e.@: 8440with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8441at @option{-O2} or higher. 8442 8443@item -freschedule-modulo-scheduled-loops 8444@opindex freschedule-modulo-scheduled-loops 8445Modulo scheduling is performed before traditional scheduling. If a loop 8446is modulo scheduled, later scheduling passes may change its schedule. 8447Use this option to control that behavior. 8448 8449@item -fselective-scheduling 8450@opindex fselective-scheduling 8451Schedule instructions using selective scheduling algorithm. Selective 8452scheduling runs instead of the first scheduler pass. 8453 8454@item -fselective-scheduling2 8455@opindex fselective-scheduling2 8456Schedule instructions using selective scheduling algorithm. Selective 8457scheduling runs instead of the second scheduler pass. 8458 8459@item -fsel-sched-pipelining 8460@opindex fsel-sched-pipelining 8461Enable software pipelining of innermost loops during selective scheduling. 8462This option has no effect unless one of @option{-fselective-scheduling} or 8463@option{-fselective-scheduling2} is turned on. 8464 8465@item -fsel-sched-pipelining-outer-loops 8466@opindex fsel-sched-pipelining-outer-loops 8467When pipelining loops during selective scheduling, also pipeline outer loops. 8468This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 8469 8470@item -fsemantic-interposition 8471@opindex fsemantic-interposition 8472Some object formats, like ELF, allow interposing of symbols by the 8473dynamic linker. 8474This means that for symbols exported from the DSO, the compiler cannot perform 8475interprocedural propagation, inlining and other optimizations in anticipation 8476that the function or variable in question may change. While this feature is 8477useful, for example, to rewrite memory allocation functions by a debugging 8478implementation, it is expensive in the terms of code quality. 8479With @option{-fno-semantic-interposition} the compiler assumes that 8480if interposition happens for functions the overwriting function will have 8481precisely the same semantics (and side effects). 8482Similarly if interposition happens 8483for variables, the constructor of the variable will be the same. The flag 8484has no effect for functions explicitly declared inline 8485(where it is never allowed for interposition to change semantics) 8486and for symbols explicitly declared weak. 8487 8488@item -fshrink-wrap 8489@opindex fshrink-wrap 8490Emit function prologues only before parts of the function that need it, 8491rather than at the top of the function. This flag is enabled by default at 8492@option{-O} and higher. 8493 8494@item -fshrink-wrap-separate 8495@opindex fshrink-wrap-separate 8496Shrink-wrap separate parts of the prologue and epilogue separately, so that 8497those parts are only executed when needed. 8498This option is on by default, but has no effect unless @option{-fshrink-wrap} 8499is also turned on and the target supports this. 8500 8501@item -fcaller-saves 8502@opindex fcaller-saves 8503Enable allocation of values to registers that are clobbered by 8504function calls, by emitting extra instructions to save and restore the 8505registers around such calls. Such allocation is done only when it 8506seems to result in better code. 8507 8508This option is always enabled by default on certain machines, usually 8509those which have no call-preserved registers to use instead. 8510 8511Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8512 8513@item -fcombine-stack-adjustments 8514@opindex fcombine-stack-adjustments 8515Tracks stack adjustments (pushes and pops) and stack memory references 8516and then tries to find ways to combine them. 8517 8518Enabled by default at @option{-O1} and higher. 8519 8520@item -fipa-ra 8521@opindex fipa-ra 8522Use caller save registers for allocation if those registers are not used by 8523any called function. In that case it is not necessary to save and restore 8524them around calls. This is only possible if called functions are part of 8525same compilation unit as current function and they are compiled before it. 8526 8527Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option 8528is disabled if generated code will be instrumented for profiling 8529(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known 8530exactly (this happens on targets that do not expose prologues 8531and epilogues in RTL). 8532 8533@item -fconserve-stack 8534@opindex fconserve-stack 8535Attempt to minimize stack usage. The compiler attempts to use less 8536stack space, even if that makes the program slower. This option 8537implies setting the @option{large-stack-frame} parameter to 100 8538and the @option{large-stack-frame-growth} parameter to 400. 8539 8540@item -ftree-reassoc 8541@opindex ftree-reassoc 8542Perform reassociation on trees. This flag is enabled by default 8543at @option{-O} and higher. 8544 8545@item -fcode-hoisting 8546@opindex fcode-hoisting 8547Perform code hoisting. Code hoisting tries to move the 8548evaluation of expressions executed on all paths to the function exit 8549as early as possible. This is especially useful as a code size 8550optimization, but it often helps for code speed as well. 8551This flag is enabled by default at @option{-O2} and higher. 8552 8553@item -ftree-pre 8554@opindex ftree-pre 8555Perform partial redundancy elimination (PRE) on trees. This flag is 8556enabled by default at @option{-O2} and @option{-O3}. 8557 8558@item -ftree-partial-pre 8559@opindex ftree-partial-pre 8560Make partial redundancy elimination (PRE) more aggressive. This flag is 8561enabled by default at @option{-O3}. 8562 8563@item -ftree-forwprop 8564@opindex ftree-forwprop 8565Perform forward propagation on trees. This flag is enabled by default 8566at @option{-O} and higher. 8567 8568@item -ftree-fre 8569@opindex ftree-fre 8570Perform full redundancy elimination (FRE) on trees. The difference 8571between FRE and PRE is that FRE only considers expressions 8572that are computed on all paths leading to the redundant computation. 8573This analysis is faster than PRE, though it exposes fewer redundancies. 8574This flag is enabled by default at @option{-O} and higher. 8575 8576@item -ftree-phiprop 8577@opindex ftree-phiprop 8578Perform hoisting of loads from conditional pointers on trees. This 8579pass is enabled by default at @option{-O} and higher. 8580 8581@item -fhoist-adjacent-loads 8582@opindex fhoist-adjacent-loads 8583Speculatively hoist loads from both branches of an if-then-else if the 8584loads are from adjacent locations in the same structure and the target 8585architecture has a conditional move instruction. This flag is enabled 8586by default at @option{-O2} and higher. 8587 8588@item -ftree-copy-prop 8589@opindex ftree-copy-prop 8590Perform copy propagation on trees. This pass eliminates unnecessary 8591copy operations. This flag is enabled by default at @option{-O} and 8592higher. 8593 8594@item -fipa-pure-const 8595@opindex fipa-pure-const 8596Discover which functions are pure or constant. 8597Enabled by default at @option{-O} and higher. 8598 8599@item -fipa-reference 8600@opindex fipa-reference 8601Discover which static variables do not escape the 8602compilation unit. 8603Enabled by default at @option{-O} and higher. 8604 8605@item -fipa-pta 8606@opindex fipa-pta 8607Perform interprocedural pointer analysis and interprocedural modification 8608and reference analysis. This option can cause excessive memory and 8609compile-time usage on large compilation units. It is not enabled by 8610default at any optimization level. 8611 8612@item -fipa-profile 8613@opindex fipa-profile 8614Perform interprocedural profile propagation. The functions called only from 8615cold functions are marked as cold. Also functions executed once (such as 8616@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold 8617functions and loop less parts of functions executed once are then optimized for 8618size. 8619Enabled by default at @option{-O} and higher. 8620 8621@item -fipa-cp 8622@opindex fipa-cp 8623Perform interprocedural constant propagation. 8624This optimization analyzes the program to determine when values passed 8625to functions are constants and then optimizes accordingly. 8626This optimization can substantially increase performance 8627if the application has constants passed to functions. 8628This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 8629 8630@item -fipa-cp-clone 8631@opindex fipa-cp-clone 8632Perform function cloning to make interprocedural constant propagation stronger. 8633When enabled, interprocedural constant propagation performs function cloning 8634when externally visible function can be called with constant arguments. 8635Because this optimization can create multiple copies of functions, 8636it may significantly increase code size 8637(see @option{--param ipcp-unit-growth=@var{value}}). 8638This flag is enabled by default at @option{-O3}. 8639 8640@item -fipa-bit-cp 8641@opindex -fipa-bit-cp 8642When enabled, perform interprocedural bitwise constant 8643propagation. This flag is enabled by default at @option{-O2}. It 8644requires that @option{-fipa-cp} is enabled. 8645 8646@item -fipa-vrp 8647@opindex -fipa-vrp 8648When enabled, perform interprocedural propagation of value 8649ranges. This flag is enabled by default at @option{-O2}. It requires 8650that @option{-fipa-cp} is enabled. 8651 8652@item -fipa-icf 8653@opindex fipa-icf 8654Perform Identical Code Folding for functions and read-only variables. 8655The optimization reduces code size and may disturb unwind stacks by replacing 8656a function by equivalent one with a different name. The optimization works 8657more effectively with link-time optimization enabled. 8658 8659Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF 8660works on different levels and thus the optimizations are not same - there are 8661equivalences that are found only by GCC and equivalences found only by Gold. 8662 8663This flag is enabled by default at @option{-O2} and @option{-Os}. 8664 8665@item -fisolate-erroneous-paths-dereference 8666@opindex fisolate-erroneous-paths-dereference 8667Detect paths that trigger erroneous or undefined behavior due to 8668dereferencing a null pointer. Isolate those paths from the main control 8669flow and turn the statement with erroneous or undefined behavior into a trap. 8670This flag is enabled by default at @option{-O2} and higher and depends on 8671@option{-fdelete-null-pointer-checks} also being enabled. 8672 8673@item -fisolate-erroneous-paths-attribute 8674@opindex fisolate-erroneous-paths-attribute 8675Detect paths that trigger erroneous or undefined behavior due to a null value 8676being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 8677attribute. Isolate those paths from the main control flow and turn the 8678statement with erroneous or undefined behavior into a trap. This is not 8679currently enabled, but may be enabled by @option{-O2} in the future. 8680 8681@item -ftree-sink 8682@opindex ftree-sink 8683Perform forward store motion on trees. This flag is 8684enabled by default at @option{-O} and higher. 8685 8686@item -ftree-bit-ccp 8687@opindex ftree-bit-ccp 8688Perform sparse conditional bit constant propagation on trees and propagate 8689pointer alignment information. 8690This pass only operates on local scalar variables and is enabled by default 8691at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled. 8692 8693@item -ftree-ccp 8694@opindex ftree-ccp 8695Perform sparse conditional constant propagation (CCP) on trees. This 8696pass only operates on local scalar variables and is enabled by default 8697at @option{-O} and higher. 8698 8699@item -fssa-backprop 8700@opindex fssa-backprop 8701Propagate information about uses of a value up the definition chain 8702in order to simplify the definitions. For example, this pass strips 8703sign operations if the sign of a value never matters. The flag is 8704enabled by default at @option{-O} and higher. 8705 8706@item -fssa-phiopt 8707@opindex fssa-phiopt 8708Perform pattern matching on SSA PHI nodes to optimize conditional 8709code. This pass is enabled by default at @option{-O} and higher. 8710 8711@item -ftree-switch-conversion 8712@opindex ftree-switch-conversion 8713Perform conversion of simple initializations in a switch to 8714initializations from a scalar array. This flag is enabled by default 8715at @option{-O2} and higher. 8716 8717@item -ftree-tail-merge 8718@opindex ftree-tail-merge 8719Look for identical code sequences. When found, replace one with a jump to the 8720other. This optimization is known as tail merging or cross jumping. This flag 8721is enabled by default at @option{-O2} and higher. The compilation time 8722in this pass can 8723be limited using @option{max-tail-merge-comparisons} parameter and 8724@option{max-tail-merge-iterations} parameter. 8725 8726@item -ftree-dce 8727@opindex ftree-dce 8728Perform dead code elimination (DCE) on trees. This flag is enabled by 8729default at @option{-O} and higher. 8730 8731@item -ftree-builtin-call-dce 8732@opindex ftree-builtin-call-dce 8733Perform conditional dead code elimination (DCE) for calls to built-in functions 8734that may set @code{errno} but are otherwise free of side effects. This flag is 8735enabled by default at @option{-O2} and higher if @option{-Os} is not also 8736specified. 8737 8738@item -ftree-dominator-opts 8739@opindex ftree-dominator-opts 8740Perform a variety of simple scalar cleanups (constant/copy 8741propagation, redundancy elimination, range propagation and expression 8742simplification) based on a dominator tree traversal. This also 8743performs jump threading (to reduce jumps to jumps). This flag is 8744enabled by default at @option{-O} and higher. 8745 8746@item -ftree-dse 8747@opindex ftree-dse 8748Perform dead store elimination (DSE) on trees. A dead store is a store into 8749a memory location that is later overwritten by another store without 8750any intervening loads. In this case the earlier store can be deleted. This 8751flag is enabled by default at @option{-O} and higher. 8752 8753@item -ftree-ch 8754@opindex ftree-ch 8755Perform loop header copying on trees. This is beneficial since it increases 8756effectiveness of code motion optimizations. It also saves one jump. This flag 8757is enabled by default at @option{-O} and higher. It is not enabled 8758for @option{-Os}, since it usually increases code size. 8759 8760@item -ftree-loop-optimize 8761@opindex ftree-loop-optimize 8762Perform loop optimizations on trees. This flag is enabled by default 8763at @option{-O} and higher. 8764 8765@item -ftree-loop-linear 8766@itemx -floop-strip-mine 8767@itemx -floop-block 8768@opindex ftree-loop-linear 8769@opindex floop-strip-mine 8770@opindex floop-block 8771Perform loop nest optimizations. Same as 8772@option{-floop-nest-optimize}. To use this code transformation, GCC has 8773to be configured with @option{--with-isl} to enable the Graphite loop 8774transformation infrastructure. 8775 8776@item -fgraphite-identity 8777@opindex fgraphite-identity 8778Enable the identity transformation for graphite. For every SCoP we generate 8779the polyhedral representation and transform it back to gimple. Using 8780@option{-fgraphite-identity} we can check the costs or benefits of the 8781GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 8782are also performed by the code generator isl, like index splitting and 8783dead code elimination in loops. 8784 8785@item -floop-nest-optimize 8786@opindex floop-nest-optimize 8787Enable the isl based loop nest optimizer. This is a generic loop nest 8788optimizer based on the Pluto optimization algorithms. It calculates a loop 8789structure optimized for data-locality and parallelism. This option 8790is experimental. 8791 8792@item -floop-parallelize-all 8793@opindex floop-parallelize-all 8794Use the Graphite data dependence analysis to identify loops that can 8795be parallelized. Parallelize all the loops that can be analyzed to 8796not contain loop carried dependences without checking that it is 8797profitable to parallelize the loops. 8798 8799@item -ftree-coalesce-vars 8800@opindex ftree-coalesce-vars 8801While transforming the program out of the SSA representation, attempt to 8802reduce copying by coalescing versions of different user-defined 8803variables, instead of just compiler temporaries. This may severely 8804limit the ability to debug an optimized program compiled with 8805@option{-fno-var-tracking-assignments}. In the negated form, this flag 8806prevents SSA coalescing of user variables. This option is enabled by 8807default if optimization is enabled, and it does very little otherwise. 8808 8809@item -ftree-loop-if-convert 8810@opindex ftree-loop-if-convert 8811Attempt to transform conditional jumps in the innermost loops to 8812branch-less equivalents. The intent is to remove control-flow from 8813the innermost loops in order to improve the ability of the 8814vectorization pass to handle these loops. This is enabled by default 8815if vectorization is enabled. 8816 8817@item -ftree-loop-distribution 8818@opindex ftree-loop-distribution 8819Perform loop distribution. This flag can improve cache performance on 8820big loop bodies and allow further loop optimizations, like 8821parallelization or vectorization, to take place. For example, the loop 8822@smallexample 8823DO I = 1, N 8824 A(I) = B(I) + C 8825 D(I) = E(I) * F 8826ENDDO 8827@end smallexample 8828is transformed to 8829@smallexample 8830DO I = 1, N 8831 A(I) = B(I) + C 8832ENDDO 8833DO I = 1, N 8834 D(I) = E(I) * F 8835ENDDO 8836@end smallexample 8837 8838@item -ftree-loop-distribute-patterns 8839@opindex ftree-loop-distribute-patterns 8840Perform loop distribution of patterns that can be code generated with 8841calls to a library. This flag is enabled by default at @option{-O3}. 8842 8843This pass distributes the initialization loops and generates a call to 8844memset zero. For example, the loop 8845@smallexample 8846DO I = 1, N 8847 A(I) = 0 8848 B(I) = A(I) + I 8849ENDDO 8850@end smallexample 8851is transformed to 8852@smallexample 8853DO I = 1, N 8854 A(I) = 0 8855ENDDO 8856DO I = 1, N 8857 B(I) = A(I) + I 8858ENDDO 8859@end smallexample 8860and the initialization loop is transformed into a call to memset zero. 8861 8862@item -floop-interchange 8863@opindex floop-interchange 8864Perform loop interchange outside of graphite. This flag can improve cache 8865performance on loop nest and allow further loop optimizations, like 8866vectorization, to take place. For example, the loop 8867@smallexample 8868for (int i = 0; i < N; i++) 8869 for (int j = 0; j < N; j++) 8870 for (int k = 0; k < N; k++) 8871 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 8872@end smallexample 8873is transformed to 8874@smallexample 8875for (int i = 0; i < N; i++) 8876 for (int k = 0; k < N; k++) 8877 for (int j = 0; j < N; j++) 8878 c[i][j] = c[i][j] + a[i][k]*b[k][j]; 8879@end smallexample 8880This flag is enabled by default at @option{-O3}. 8881 8882@item -floop-unroll-and-jam 8883@opindex floop-unroll-and-jam 8884Apply unroll and jam transformations on feasible loops. In a loop 8885nest this unrolls the outer loop by some factor and fuses the resulting 8886multiple inner loops. This flag is enabled by default at @option{-O3}. 8887 8888@item -ftree-loop-im 8889@opindex ftree-loop-im 8890Perform loop invariant motion on trees. This pass moves only invariants that 8891are hard to handle at RTL level (function calls, operations that expand to 8892nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 8893operands of conditions that are invariant out of the loop, so that we can use 8894just trivial invariantness analysis in loop unswitching. The pass also includes 8895store motion. 8896 8897@item -ftree-loop-ivcanon 8898@opindex ftree-loop-ivcanon 8899Create a canonical counter for number of iterations in loops for which 8900determining number of iterations requires complicated analysis. Later 8901optimizations then may determine the number easily. Useful especially 8902in connection with unrolling. 8903 8904@item -fivopts 8905@opindex fivopts 8906Perform induction variable optimizations (strength reduction, induction 8907variable merging and induction variable elimination) on trees. 8908 8909@item -ftree-parallelize-loops=n 8910@opindex ftree-parallelize-loops 8911Parallelize loops, i.e., split their iteration space to run in n threads. 8912This is only possible for loops whose iterations are independent 8913and can be arbitrarily reordered. The optimization is only 8914profitable on multiprocessor machines, for loops that are CPU-intensive, 8915rather than constrained e.g.@: by memory bandwidth. This option 8916implies @option{-pthread}, and thus is only supported on targets 8917that have support for @option{-pthread}. 8918 8919@item -ftree-pta 8920@opindex ftree-pta 8921Perform function-local points-to analysis on trees. This flag is 8922enabled by default at @option{-O} and higher. 8923 8924@item -ftree-sra 8925@opindex ftree-sra 8926Perform scalar replacement of aggregates. This pass replaces structure 8927references with scalars to prevent committing structures to memory too 8928early. This flag is enabled by default at @option{-O} and higher. 8929 8930@item -fstore-merging 8931@opindex fstore-merging 8932Perform merging of narrow stores to consecutive memory addresses. This pass 8933merges contiguous stores of immediate values narrower than a word into fewer 8934wider stores to reduce the number of instructions. This is enabled by default 8935at @option{-O2} and higher as well as @option{-Os}. 8936 8937@item -ftree-ter 8938@opindex ftree-ter 8939Perform temporary expression replacement during the SSA->normal phase. Single 8940use/single def temporaries are replaced at their use location with their 8941defining expression. This results in non-GIMPLE code, but gives the expanders 8942much more complex trees to work on resulting in better RTL generation. This is 8943enabled by default at @option{-O} and higher. 8944 8945@item -ftree-slsr 8946@opindex ftree-slsr 8947Perform straight-line strength reduction on trees. This recognizes related 8948expressions involving multiplications and replaces them by less expensive 8949calculations when possible. This is enabled by default at @option{-O} and 8950higher. 8951 8952@item -ftree-vectorize 8953@opindex ftree-vectorize 8954Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 8955and @option{-ftree-slp-vectorize} if not explicitly specified. 8956 8957@item -ftree-loop-vectorize 8958@opindex ftree-loop-vectorize 8959Perform loop vectorization on trees. This flag is enabled by default at 8960@option{-O3} and when @option{-ftree-vectorize} is enabled. 8961 8962@item -ftree-slp-vectorize 8963@opindex ftree-slp-vectorize 8964Perform basic block vectorization on trees. This flag is enabled by default at 8965@option{-O3} and when @option{-ftree-vectorize} is enabled. 8966 8967@item -fvect-cost-model=@var{model} 8968@opindex fvect-cost-model 8969Alter the cost model used for vectorization. The @var{model} argument 8970should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}. 8971With the @samp{unlimited} model the vectorized code-path is assumed 8972to be profitable while with the @samp{dynamic} model a runtime check 8973guards the vectorized code-path to enable it only for iteration 8974counts that will likely execute faster than when executing the original 8975scalar loop. The @samp{cheap} model disables vectorization of 8976loops where doing so would be cost prohibitive for example due to 8977required runtime checks for data dependence or alignment but otherwise 8978is equal to the @samp{dynamic} model. 8979The default cost model depends on other optimization flags and is 8980either @samp{dynamic} or @samp{cheap}. 8981 8982@item -fsimd-cost-model=@var{model} 8983@opindex fsimd-cost-model 8984Alter the cost model used for vectorization of loops marked with the OpenMP 8985simd directive. The @var{model} argument should be one of 8986@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 8987have the same meaning as described in @option{-fvect-cost-model} and by 8988default a cost model defined with @option{-fvect-cost-model} is used. 8989 8990@item -ftree-vrp 8991@opindex ftree-vrp 8992Perform Value Range Propagation on trees. This is similar to the 8993constant propagation pass, but instead of values, ranges of values are 8994propagated. This allows the optimizers to remove unnecessary range 8995checks like array bound checks and null pointer checks. This is 8996enabled by default at @option{-O2} and higher. Null pointer check 8997elimination is only done if @option{-fdelete-null-pointer-checks} is 8998enabled. 8999 9000@item -fsplit-paths 9001@opindex fsplit-paths 9002Split paths leading to loop backedges. This can improve dead code 9003elimination and common subexpression elimination. This is enabled by 9004default at @option{-O2} and above. 9005 9006@item -fsplit-ivs-in-unroller 9007@opindex fsplit-ivs-in-unroller 9008Enables expression of values of induction variables in later iterations 9009of the unrolled loop using the value in the first iteration. This breaks 9010long dependency chains, thus improving efficiency of the scheduling passes. 9011 9012A combination of @option{-fweb} and CSE is often sufficient to obtain the 9013same effect. However, that is not reliable in cases where the loop body 9014is more complicated than a single basic block. It also does not work at all 9015on some architectures due to restrictions in the CSE pass. 9016 9017This optimization is enabled by default. 9018 9019@item -fvariable-expansion-in-unroller 9020@opindex fvariable-expansion-in-unroller 9021With this option, the compiler creates multiple copies of some 9022local variables when unrolling a loop, which can result in superior code. 9023 9024@item -fpartial-inlining 9025@opindex fpartial-inlining 9026Inline parts of functions. This option has any effect only 9027when inlining itself is turned on by the @option{-finline-functions} 9028or @option{-finline-small-functions} options. 9029 9030Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9031 9032@item -fpredictive-commoning 9033@opindex fpredictive-commoning 9034Perform predictive commoning optimization, i.e., reusing computations 9035(especially memory loads and stores) performed in previous 9036iterations of loops. 9037 9038This option is enabled at level @option{-O3}. 9039 9040@item -fprefetch-loop-arrays 9041@opindex fprefetch-loop-arrays 9042If supported by the target machine, generate instructions to prefetch 9043memory to improve the performance of loops that access large arrays. 9044 9045This option may generate better or worse code; results are highly 9046dependent on the structure of loops within the source code. 9047 9048Disabled at level @option{-Os}. 9049 9050@item -fno-printf-return-value 9051@opindex fno-printf-return-value 9052Do not substitute constants for known return value of formatted output 9053functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and 9054@code{vsnprintf} (but not @code{printf} of @code{fprintf}). This 9055transformation allows GCC to optimize or even eliminate branches based 9056on the known return value of these functions called with arguments that 9057are either constant, or whose values are known to be in a range that 9058makes determining the exact return value possible. For example, when 9059@option{-fprintf-return-value} is in effect, both the branch and the 9060body of the @code{if} statement (but not the call to @code{snprint}) 9061can be optimized away when @code{i} is a 32-bit or smaller integer 9062because the return value is guaranteed to be at most 8. 9063 9064@smallexample 9065char buf[9]; 9066if (snprintf (buf, "%08x", i) >= sizeof buf) 9067 @dots{} 9068@end smallexample 9069 9070The @option{-fprintf-return-value} option relies on other optimizations 9071and yields best results with @option{-O2} and above. It works in tandem 9072with the @option{-Wformat-overflow} and @option{-Wformat-truncation} 9073options. The @option{-fprintf-return-value} option is enabled by default. 9074 9075@item -fno-peephole 9076@itemx -fno-peephole2 9077@opindex fno-peephole 9078@opindex fno-peephole2 9079Disable any machine-specific peephole optimizations. The difference 9080between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 9081are implemented in the compiler; some targets use one, some use the 9082other, a few use both. 9083 9084@option{-fpeephole} is enabled by default. 9085@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9086 9087@item -fno-guess-branch-probability 9088@opindex fno-guess-branch-probability 9089Do not guess branch probabilities using heuristics. 9090 9091GCC uses heuristics to guess branch probabilities if they are 9092not provided by profiling feedback (@option{-fprofile-arcs}). These 9093heuristics are based on the control flow graph. If some branch probabilities 9094are specified by @code{__builtin_expect}, then the heuristics are 9095used to guess branch probabilities for the rest of the control flow graph, 9096taking the @code{__builtin_expect} info into account. The interactions 9097between the heuristics and @code{__builtin_expect} can be complex, and in 9098some cases, it may be useful to disable the heuristics so that the effects 9099of @code{__builtin_expect} are easier to understand. 9100 9101The default is @option{-fguess-branch-probability} at levels 9102@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9103 9104@item -freorder-blocks 9105@opindex freorder-blocks 9106Reorder basic blocks in the compiled function in order to reduce number of 9107taken branches and improve code locality. 9108 9109Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9110 9111@item -freorder-blocks-algorithm=@var{algorithm} 9112@opindex freorder-blocks-algorithm 9113Use the specified algorithm for basic block reordering. The 9114@var{algorithm} argument can be @samp{simple}, which does not increase 9115code size (except sometimes due to secondary effects like alignment), 9116or @samp{stc}, the ``software trace cache'' algorithm, which tries to 9117put all often executed code together, minimizing the number of branches 9118executed by making extra copies of code. 9119 9120The default is @samp{simple} at levels @option{-O}, @option{-Os}, and 9121@samp{stc} at levels @option{-O2}, @option{-O3}. 9122 9123@item -freorder-blocks-and-partition 9124@opindex freorder-blocks-and-partition 9125In addition to reordering basic blocks in the compiled function, in order 9126to reduce number of taken branches, partitions hot and cold basic blocks 9127into separate sections of the assembly and @file{.o} files, to improve 9128paging and cache locality performance. 9129 9130This optimization is automatically turned off in the presence of 9131exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined 9132section attribute and on any architecture that does not support named 9133sections. When @option{-fsplit-stack} is used this option is not 9134enabled by default (to avoid linker errors), but may be enabled 9135explicitly (if using a working linker). 9136 9137Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}. 9138 9139@item -freorder-functions 9140@opindex freorder-functions 9141Reorder functions in the object file in order to 9142improve code locality. This is implemented by using special 9143subsections @code{.text.hot} for most frequently executed functions and 9144@code{.text.unlikely} for unlikely executed functions. Reordering is done by 9145the linker so object file format must support named sections and linker must 9146place them in a reasonable way. 9147 9148Also profile feedback must be available to make this option effective. See 9149@option{-fprofile-arcs} for details. 9150 9151Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9152 9153@item -fstrict-aliasing 9154@opindex fstrict-aliasing 9155Allow the compiler to assume the strictest aliasing rules applicable to 9156the language being compiled. For C (and C++), this activates 9157optimizations based on the type of expressions. In particular, an 9158object of one type is assumed never to reside at the same address as an 9159object of a different type, unless the types are almost the same. For 9160example, an @code{unsigned int} can alias an @code{int}, but not a 9161@code{void*} or a @code{double}. A character type may alias any other 9162type. 9163 9164@anchor{Type-punning}Pay special attention to code like this: 9165@smallexample 9166union a_union @{ 9167 int i; 9168 double d; 9169@}; 9170 9171int f() @{ 9172 union a_union t; 9173 t.d = 3.0; 9174 return t.i; 9175@} 9176@end smallexample 9177The practice of reading from a different union member than the one most 9178recently written to (called ``type-punning'') is common. Even with 9179@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 9180is accessed through the union type. So, the code above works as 9181expected. @xref{Structures unions enumerations and bit-fields 9182implementation}. However, this code might not: 9183@smallexample 9184int f() @{ 9185 union a_union t; 9186 int* ip; 9187 t.d = 3.0; 9188 ip = &t.i; 9189 return *ip; 9190@} 9191@end smallexample 9192 9193Similarly, access by taking the address, casting the resulting pointer 9194and dereferencing the result has undefined behavior, even if the cast 9195uses a union type, e.g.: 9196@smallexample 9197int f() @{ 9198 double d = 3.0; 9199 return ((union a_union *) &d)->i; 9200@} 9201@end smallexample 9202 9203The @option{-fstrict-aliasing} option is enabled at levels 9204@option{-O2}, @option{-O3}, @option{-Os}. 9205 9206@item -falign-functions 9207@itemx -falign-functions=@var{n} 9208@opindex falign-functions 9209Align the start of functions to the next power-of-two greater than 9210@var{n}, skipping up to @var{n} bytes. For instance, 9211@option{-falign-functions=32} aligns functions to the next 32-byte 9212boundary, but @option{-falign-functions=24} aligns to the next 921332-byte boundary only if this can be done by skipping 23 bytes or less. 9214 9215@option{-fno-align-functions} and @option{-falign-functions=1} are 9216equivalent and mean that functions are not aligned. 9217 9218Some assemblers only support this flag when @var{n} is a power of two; 9219in that case, it is rounded up. 9220 9221If @var{n} is not specified or is zero, use a machine-dependent default. 9222The maximum allowed @var{n} option value is 65536. 9223 9224Enabled at levels @option{-O2}, @option{-O3}. 9225 9226@item -flimit-function-alignment 9227If this option is enabled, the compiler tries to avoid unnecessarily 9228overaligning functions. It attempts to instruct the assembler to align 9229by the amount specified by @option{-falign-functions}, but not to 9230skip more bytes than the size of the function. 9231 9232@item -falign-labels 9233@itemx -falign-labels=@var{n} 9234@opindex falign-labels 9235Align all branch targets to a power-of-two boundary, skipping up to 9236@var{n} bytes like @option{-falign-functions}. This option can easily 9237make code slower, because it must insert dummy operations for when the 9238branch target is reached in the usual flow of the code. 9239 9240@option{-fno-align-labels} and @option{-falign-labels=1} are 9241equivalent and mean that labels are not aligned. 9242 9243If @option{-falign-loops} or @option{-falign-jumps} are applicable and 9244are greater than this value, then their values are used instead. 9245 9246If @var{n} is not specified or is zero, use a machine-dependent default 9247which is very likely to be @samp{1}, meaning no alignment. 9248The maximum allowed @var{n} option value is 65536. 9249 9250Enabled at levels @option{-O2}, @option{-O3}. 9251 9252@item -falign-loops 9253@itemx -falign-loops=@var{n} 9254@opindex falign-loops 9255Align loops to a power-of-two boundary, skipping up to @var{n} bytes 9256like @option{-falign-functions}. If the loops are 9257executed many times, this makes up for any execution of the dummy 9258operations. 9259 9260@option{-fno-align-loops} and @option{-falign-loops=1} are 9261equivalent and mean that loops are not aligned. 9262The maximum allowed @var{n} option value is 65536. 9263 9264If @var{n} is not specified or is zero, use a machine-dependent default. 9265 9266Enabled at levels @option{-O2}, @option{-O3}. 9267 9268@item -falign-jumps 9269@itemx -falign-jumps=@var{n} 9270@opindex falign-jumps 9271Align branch targets to a power-of-two boundary, for branch targets 9272where the targets can only be reached by jumping, skipping up to @var{n} 9273bytes like @option{-falign-functions}. In this case, no dummy operations 9274need be executed. 9275 9276@option{-fno-align-jumps} and @option{-falign-jumps=1} are 9277equivalent and mean that loops are not aligned. 9278 9279If @var{n} is not specified or is zero, use a machine-dependent default. 9280The maximum allowed @var{n} option value is 65536. 9281 9282Enabled at levels @option{-O2}, @option{-O3}. 9283 9284@item -funit-at-a-time 9285@opindex funit-at-a-time 9286This option is left for compatibility reasons. @option{-funit-at-a-time} 9287has no effect, while @option{-fno-unit-at-a-time} implies 9288@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 9289 9290Enabled by default. 9291 9292@item -fno-toplevel-reorder 9293@opindex fno-toplevel-reorder 9294Do not reorder top-level functions, variables, and @code{asm} 9295statements. Output them in the same order that they appear in the 9296input file. When this option is used, unreferenced static variables 9297are not removed. This option is intended to support existing code 9298that relies on a particular ordering. For new code, it is better to 9299use attributes when possible. 9300 9301Enabled at level @option{-O0}. When disabled explicitly, it also implies 9302@option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some 9303targets. 9304 9305@item -fweb 9306@opindex fweb 9307Constructs webs as commonly used for register allocation purposes and assign 9308each web individual pseudo register. This allows the register allocation pass 9309to operate on pseudos directly, but also strengthens several other optimization 9310passes, such as CSE, loop optimizer and trivial dead code remover. It can, 9311however, make debugging impossible, since variables no longer stay in a 9312``home register''. 9313 9314Enabled by default with @option{-funroll-loops}. 9315 9316@item -fwhole-program 9317@opindex fwhole-program 9318Assume that the current compilation unit represents the whole program being 9319compiled. All public functions and variables with the exception of @code{main} 9320and those merged by attribute @code{externally_visible} become static functions 9321and in effect are optimized more aggressively by interprocedural optimizers. 9322 9323This option should not be used in combination with @option{-flto}. 9324Instead relying on a linker plugin should provide safer and more precise 9325information. 9326 9327@item -flto[=@var{n}] 9328@opindex flto 9329This option runs the standard link-time optimizer. When invoked 9330with source code, it generates GIMPLE (one of GCC's internal 9331representations) and writes it to special ELF sections in the object 9332file. When the object files are linked together, all the function 9333bodies are read from these ELF sections and instantiated as if they 9334had been part of the same translation unit. 9335 9336To use the link-time optimizer, @option{-flto} and optimization 9337options should be specified at compile time and during the final link. 9338It is recommended that you compile all the files participating in the 9339same link with the same options and also specify those options at 9340link time. 9341For example: 9342 9343@smallexample 9344gcc -c -O2 -flto foo.c 9345gcc -c -O2 -flto bar.c 9346gcc -o myprog -flto -O2 foo.o bar.o 9347@end smallexample 9348 9349The first two invocations to GCC save a bytecode representation 9350of GIMPLE into special ELF sections inside @file{foo.o} and 9351@file{bar.o}. The final invocation reads the GIMPLE bytecode from 9352@file{foo.o} and @file{bar.o}, merges the two files into a single 9353internal image, and compiles the result as usual. Since both 9354@file{foo.o} and @file{bar.o} are merged into a single image, this 9355causes all the interprocedural analyses and optimizations in GCC to 9356work across the two files as if they were a single one. This means, 9357for example, that the inliner is able to inline functions in 9358@file{bar.o} into functions in @file{foo.o} and vice-versa. 9359 9360Another (simpler) way to enable link-time optimization is: 9361 9362@smallexample 9363gcc -o myprog -flto -O2 foo.c bar.c 9364@end smallexample 9365 9366The above generates bytecode for @file{foo.c} and @file{bar.c}, 9367merges them together into a single GIMPLE representation and optimizes 9368them as usual to produce @file{myprog}. 9369 9370The only important thing to keep in mind is that to enable link-time 9371optimizations you need to use the GCC driver to perform the link step. 9372GCC then automatically performs link-time optimization if any of the 9373objects involved were compiled with the @option{-flto} command-line option. 9374You generally 9375should specify the optimization options to be used for link-time 9376optimization though GCC tries to be clever at guessing an 9377optimization level to use from the options used at compile time 9378if you fail to specify one at link time. You can always override 9379the automatic decision to do link-time optimization 9380by passing @option{-fno-lto} to the link command. 9381 9382To make whole program optimization effective, it is necessary to make 9383certain whole program assumptions. The compiler needs to know 9384what functions and variables can be accessed by libraries and runtime 9385outside of the link-time optimized unit. When supported by the linker, 9386the linker plugin (see @option{-fuse-linker-plugin}) passes information 9387to the compiler about used and externally visible symbols. When 9388the linker plugin is not available, @option{-fwhole-program} should be 9389used to allow the compiler to make these assumptions, which leads 9390to more aggressive optimization decisions. 9391 9392When @option{-fuse-linker-plugin} is not enabled, when a file is 9393compiled with @option{-flto}, the generated object file is larger than 9394a regular object file because it contains GIMPLE bytecodes and the usual 9395final code (see @option{-ffat-lto-objects}. This means that 9396object files with LTO information can be linked as normal object 9397files; if @option{-fno-lto} is passed to the linker, no 9398interprocedural optimizations are applied. Note that when 9399@option{-fno-fat-lto-objects} is enabled the compile stage is faster 9400but you cannot perform a regular, non-LTO link on them. 9401 9402Additionally, the optimization flags used to compile individual files 9403are not necessarily related to those used at link time. For instance, 9404 9405@smallexample 9406gcc -c -O0 -ffat-lto-objects -flto foo.c 9407gcc -c -O0 -ffat-lto-objects -flto bar.c 9408gcc -o myprog -O3 foo.o bar.o 9409@end smallexample 9410 9411This produces individual object files with unoptimized assembler 9412code, but the resulting binary @file{myprog} is optimized at 9413@option{-O3}. If, instead, the final binary is generated with 9414@option{-fno-lto}, then @file{myprog} is not optimized. 9415 9416When producing the final binary, GCC only 9417applies link-time optimizations to those files that contain bytecode. 9418Therefore, you can mix and match object files and libraries with 9419GIMPLE bytecodes and final object code. GCC automatically selects 9420which files to optimize in LTO mode and which files to link without 9421further processing. 9422 9423There are some code generation flags preserved by GCC when 9424generating bytecodes, as they need to be used during the final link 9425stage. Generally options specified at link time override those 9426specified at compile time. 9427 9428If you do not specify an optimization level option @option{-O} at 9429link time, then GCC uses the highest optimization level 9430used when compiling the object files. 9431 9432Currently, the following options and their settings are taken from 9433the first object file that explicitly specifies them: 9434@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon}, 9435@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm} 9436and all the @option{-m} target flags. 9437 9438Certain ABI-changing flags are required to match in all compilation units, 9439and trying to override this at link time with a conflicting value 9440is ignored. This includes options such as @option{-freg-struct-return} 9441and @option{-fpcc-struct-return}. 9442 9443Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 9444@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 9445are passed through to the link stage and merged conservatively for 9446conflicting translation units. Specifically 9447@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 9448precedence; and for example @option{-ffp-contract=off} takes precedence 9449over @option{-ffp-contract=fast}. You can override them at link time. 9450 9451If LTO encounters objects with C linkage declared with incompatible 9452types in separate translation units to be linked together (undefined 9453behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 9454issued. The behavior is still undefined at run time. Similar 9455diagnostics may be raised for other languages. 9456 9457Another feature of LTO is that it is possible to apply interprocedural 9458optimizations on files written in different languages: 9459 9460@smallexample 9461gcc -c -flto foo.c 9462g++ -c -flto bar.cc 9463gfortran -c -flto baz.f90 9464g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 9465@end smallexample 9466 9467Notice that the final link is done with @command{g++} to get the C++ 9468runtime libraries and @option{-lgfortran} is added to get the Fortran 9469runtime libraries. In general, when mixing languages in LTO mode, you 9470should use the same link command options as when mixing languages in a 9471regular (non-LTO) compilation. 9472 9473If object files containing GIMPLE bytecode are stored in a library archive, say 9474@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 9475are using a linker with plugin support. To create static libraries suitable 9476for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 9477and @command{ranlib}; 9478to show the symbols of object files with GIMPLE bytecode, use 9479@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 9480and @command{nm} have been compiled with plugin support. At link time, use the 9481flag @option{-fuse-linker-plugin} to ensure that the library participates in 9482the LTO optimization process: 9483 9484@smallexample 9485gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 9486@end smallexample 9487 9488With the linker plugin enabled, the linker extracts the needed 9489GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 9490to make them part of the aggregated GIMPLE image to be optimized. 9491 9492If you are not using a linker with plugin support and/or do not 9493enable the linker plugin, then the objects inside @file{libfoo.a} 9494are extracted and linked as usual, but they do not participate 9495in the LTO optimization process. In order to make a static library suitable 9496for both LTO optimization and usual linkage, compile its object files with 9497@option{-flto} @option{-ffat-lto-objects}. 9498 9499Link-time optimizations do not require the presence of the whole program to 9500operate. If the program does not require any symbols to be exported, it is 9501possible to combine @option{-flto} and @option{-fwhole-program} to allow 9502the interprocedural optimizers to use more aggressive assumptions which may 9503lead to improved optimization opportunities. 9504Use of @option{-fwhole-program} is not needed when linker plugin is 9505active (see @option{-fuse-linker-plugin}). 9506 9507The current implementation of LTO makes no 9508attempt to generate bytecode that is portable between different 9509types of hosts. The bytecode files are versioned and there is a 9510strict version check, so bytecode files generated in one version of 9511GCC do not work with an older or newer version of GCC. 9512 9513Link-time optimization does not work well with generation of debugging 9514information on systems other than those using a combination of ELF and 9515DWARF. 9516 9517If you specify the optional @var{n}, the optimization and code 9518generation done at link time is executed in parallel using @var{n} 9519parallel jobs by utilizing an installed @command{make} program. The 9520environment variable @env{MAKE} may be used to override the program 9521used. The default value for @var{n} is 1. 9522 9523You can also specify @option{-flto=jobserver} to use GNU make's 9524job server mode to determine the number of parallel jobs. This 9525is useful when the Makefile calling GCC is already executing in parallel. 9526You must prepend a @samp{+} to the command recipe in the parent Makefile 9527for this to work. This option likely only works if @env{MAKE} is 9528GNU make. 9529 9530@item -flto-partition=@var{alg} 9531@opindex flto-partition 9532Specify the partitioning algorithm used by the link-time optimizer. 9533The value is either @samp{1to1} to specify a partitioning mirroring 9534the original source files or @samp{balanced} to specify partitioning 9535into equally sized chunks (whenever possible) or @samp{max} to create 9536new partition for every symbol where possible. Specifying @samp{none} 9537as an algorithm disables partitioning and streaming completely. 9538The default value is @samp{balanced}. While @samp{1to1} can be used 9539as an workaround for various code ordering issues, the @samp{max} 9540partitioning is intended for internal testing only. 9541The value @samp{one} specifies that exactly one partition should be 9542used while the value @samp{none} bypasses partitioning and executes 9543the link-time optimization step directly from the WPA phase. 9544 9545@item -flto-odr-type-merging 9546@opindex flto-odr-type-merging 9547Enable streaming of mangled types names of C++ types and their unification 9548at link time. This increases size of LTO object files, but enables 9549diagnostics about One Definition Rule violations. 9550 9551@item -flto-compression-level=@var{n} 9552@opindex flto-compression-level 9553This option specifies the level of compression used for intermediate 9554language written to LTO object files, and is only meaningful in 9555conjunction with LTO mode (@option{-flto}). Valid 9556values are 0 (no compression) to 9 (maximum compression). Values 9557outside this range are clamped to either 0 or 9. If the option is not 9558given, a default balanced compression setting is used. 9559 9560@item -fuse-linker-plugin 9561@opindex fuse-linker-plugin 9562Enables the use of a linker plugin during link-time optimization. This 9563option relies on plugin support in the linker, which is available in gold 9564or in GNU ld 2.21 or newer. 9565 9566This option enables the extraction of object files with GIMPLE bytecode out 9567of library archives. This improves the quality of optimization by exposing 9568more code to the link-time optimizer. This information specifies what 9569symbols can be accessed externally (by non-LTO object or during dynamic 9570linking). Resulting code quality improvements on binaries (and shared 9571libraries that use hidden visibility) are similar to @option{-fwhole-program}. 9572See @option{-flto} for a description of the effect of this flag and how to 9573use it. 9574 9575This option is enabled by default when LTO support in GCC is enabled 9576and GCC was configured for use with 9577a linker supporting plugins (GNU ld 2.21 or newer or gold). 9578 9579@item -ffat-lto-objects 9580@opindex ffat-lto-objects 9581Fat LTO objects are object files that contain both the intermediate language 9582and the object code. This makes them usable for both LTO linking and normal 9583linking. This option is effective only when compiling with @option{-flto} 9584and is ignored at link time. 9585 9586@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 9587requires the complete toolchain to be aware of LTO. It requires a linker with 9588linker plugin support for basic functionality. Additionally, 9589@command{nm}, @command{ar} and @command{ranlib} 9590need to support linker plugins to allow a full-featured build environment 9591(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 9592@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 9593to these tools. With non fat LTO makefiles need to be modified to use them. 9594 9595Note that modern binutils provide plugin auto-load mechanism. 9596Installing the linker plugin into @file{$libdir/bfd-plugins} has the same 9597effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and 9598@command{gcc-ranlib}). 9599 9600The default is @option{-fno-fat-lto-objects} on targets with linker plugin 9601support. 9602 9603@item -fcompare-elim 9604@opindex fcompare-elim 9605After register allocation and post-register allocation instruction splitting, 9606identify arithmetic instructions that compute processor flags similar to a 9607comparison operation based on that arithmetic. If possible, eliminate the 9608explicit comparison operation. 9609 9610This pass only applies to certain targets that cannot explicitly represent 9611the comparison operation before register allocation is complete. 9612 9613Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9614 9615@item -fcprop-registers 9616@opindex fcprop-registers 9617After register allocation and post-register allocation instruction splitting, 9618perform a copy-propagation pass to try to reduce scheduling dependencies 9619and occasionally eliminate the copy. 9620 9621Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9622 9623@item -fprofile-correction 9624@opindex fprofile-correction 9625Profiles collected using an instrumented binary for multi-threaded programs may 9626be inconsistent due to missed counter updates. When this option is specified, 9627GCC uses heuristics to correct or smooth out such inconsistencies. By 9628default, GCC emits an error message when an inconsistent profile is detected. 9629 9630@item -fprofile-use 9631@itemx -fprofile-use=@var{path} 9632@opindex fprofile-use 9633Enable profile feedback-directed optimizations, 9634and the following optimizations 9635which are generally profitable only with profile feedback available: 9636@option{-fbranch-probabilities}, @option{-fvpt}, 9637@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, 9638@option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}. 9639 9640Before you can use this option, you must first generate profiling information. 9641@xref{Instrumentation Options}, for information about the 9642@option{-fprofile-generate} option. 9643 9644By default, GCC emits an error message if the feedback profiles do not 9645match the source code. This error can be turned into a warning by using 9646@option{-Wcoverage-mismatch}. Note this may result in poorly optimized 9647code. 9648 9649If @var{path} is specified, GCC looks at the @var{path} to find 9650the profile feedback data files. See @option{-fprofile-dir}. 9651 9652@item -fauto-profile 9653@itemx -fauto-profile=@var{path} 9654@opindex fauto-profile 9655Enable sampling-based feedback-directed optimizations, 9656and the following optimizations 9657which are generally profitable only with profile feedback available: 9658@option{-fbranch-probabilities}, @option{-fvpt}, 9659@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, 9660@option{-ftree-vectorize}, 9661@option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone}, 9662@option{-fpredictive-commoning}, @option{-funswitch-loops}, 9663@option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}. 9664 9665@var{path} is the name of a file containing AutoFDO profile information. 9666If omitted, it defaults to @file{fbdata.afdo} in the current directory. 9667 9668Producing an AutoFDO profile data file requires running your program 9669with the @command{perf} utility on a supported GNU/Linux target system. 9670For more information, see @uref{https://perf.wiki.kernel.org/}. 9671 9672E.g. 9673@smallexample 9674perf record -e br_inst_retired:near_taken -b -o perf.data \ 9675 -- your_program 9676@end smallexample 9677 9678Then use the @command{create_gcov} tool to convert the raw profile data 9679to a format that can be used by GCC.@ You must also supply the 9680unstripped binary for your program to this tool. 9681See @uref{https://github.com/google/autofdo}. 9682 9683E.g. 9684@smallexample 9685create_gcov --binary=your_program.unstripped --profile=perf.data \ 9686 --gcov=profile.afdo 9687@end smallexample 9688@end table 9689 9690The following options control compiler behavior regarding floating-point 9691arithmetic. These options trade off between speed and 9692correctness. All must be specifically enabled. 9693 9694@table @gcctabopt 9695@item -ffloat-store 9696@opindex ffloat-store 9697Do not store floating-point variables in registers, and inhibit other 9698options that might change whether a floating-point value is taken from a 9699register or memory. 9700 9701@cindex floating-point precision 9702This option prevents undesirable excess precision on machines such as 9703the 68000 where the floating registers (of the 68881) keep more 9704precision than a @code{double} is supposed to have. Similarly for the 9705x86 architecture. For most programs, the excess precision does only 9706good, but a few programs rely on the precise definition of IEEE floating 9707point. Use @option{-ffloat-store} for such programs, after modifying 9708them to store all pertinent intermediate computations into variables. 9709 9710@item -fexcess-precision=@var{style} 9711@opindex fexcess-precision 9712This option allows further control over excess precision on machines 9713where floating-point operations occur in a format with more precision or 9714range than the IEEE standard and interchange floating-point types. By 9715default, @option{-fexcess-precision=fast} is in effect; this means that 9716operations may be carried out in a wider precision than the types specified 9717in the source if that would result in faster code, and it is unpredictable 9718when rounding to the types specified in the source code takes place. 9719When compiling C, if @option{-fexcess-precision=standard} is specified then 9720excess precision follows the rules specified in ISO C99; in particular, 9721both casts and assignments cause values to be rounded to their 9722semantic types (whereas @option{-ffloat-store} only affects 9723assignments). This option is enabled by default for C if a strict 9724conformance option such as @option{-std=c99} is used. 9725@option{-ffast-math} enables @option{-fexcess-precision=fast} by default 9726regardless of whether a strict conformance option is used. 9727 9728@opindex mfpmath 9729@option{-fexcess-precision=standard} is not implemented for languages 9730other than C. On the x86, it has no effect if @option{-mfpmath=sse} 9731or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 9732semantics apply without excess precision, and in the latter, rounding 9733is unpredictable. 9734 9735@item -ffast-math 9736@opindex ffast-math 9737Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 9738@option{-ffinite-math-only}, @option{-fno-rounding-math}, 9739@option{-fno-signaling-nans}, @option{-fcx-limited-range} and 9740@option{-fexcess-precision=fast}. 9741 9742This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 9743 9744This option is not turned on by any @option{-O} option besides 9745@option{-Ofast} since it can result in incorrect output for programs 9746that depend on an exact implementation of IEEE or ISO rules/specifications 9747for math functions. It may, however, yield faster code for programs 9748that do not require the guarantees of these specifications. 9749 9750@item -fno-math-errno 9751@opindex fno-math-errno 9752Do not set @code{errno} after calling math functions that are executed 9753with a single instruction, e.g., @code{sqrt}. A program that relies on 9754IEEE exceptions for math error handling may want to use this flag 9755for speed while maintaining IEEE arithmetic compatibility. 9756 9757This option is not turned on by any @option{-O} option since 9758it can result in incorrect output for programs that depend on 9759an exact implementation of IEEE or ISO rules/specifications for 9760math functions. It may, however, yield faster code for programs 9761that do not require the guarantees of these specifications. 9762 9763The default is @option{-fmath-errno}. 9764 9765On Darwin systems, the math library never sets @code{errno}. There is 9766therefore no reason for the compiler to consider the possibility that 9767it might, and @option{-fno-math-errno} is the default. 9768 9769@item -funsafe-math-optimizations 9770@opindex funsafe-math-optimizations 9771 9772Allow optimizations for floating-point arithmetic that (a) assume 9773that arguments and results are valid and (b) may violate IEEE or 9774ANSI standards. When used at link time, it may include libraries 9775or startup files that change the default FPU control word or other 9776similar optimizations. 9777 9778This option is not turned on by any @option{-O} option since 9779it can result in incorrect output for programs that depend on 9780an exact implementation of IEEE or ISO rules/specifications for 9781math functions. It may, however, yield faster code for programs 9782that do not require the guarantees of these specifications. 9783Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 9784@option{-fassociative-math} and @option{-freciprocal-math}. 9785 9786The default is @option{-fno-unsafe-math-optimizations}. 9787 9788@item -fassociative-math 9789@opindex fassociative-math 9790 9791Allow re-association of operands in series of floating-point operations. 9792This violates the ISO C and C++ language standard by possibly changing 9793computation result. NOTE: re-ordering may change the sign of zero as 9794well as ignore NaNs and inhibit or create underflow or overflow (and 9795thus cannot be used on code that relies on rounding behavior like 9796@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 9797and thus may not be used when ordered comparisons are required. 9798This option requires that both @option{-fno-signed-zeros} and 9799@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 9800much sense with @option{-frounding-math}. For Fortran the option 9801is automatically enabled when both @option{-fno-signed-zeros} and 9802@option{-fno-trapping-math} are in effect. 9803 9804The default is @option{-fno-associative-math}. 9805 9806@item -freciprocal-math 9807@opindex freciprocal-math 9808 9809Allow the reciprocal of a value to be used instead of dividing by 9810the value if this enables optimizations. For example @code{x / y} 9811can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 9812is subject to common subexpression elimination. Note that this loses 9813precision and increases the number of flops operating on the value. 9814 9815The default is @option{-fno-reciprocal-math}. 9816 9817@item -ffinite-math-only 9818@opindex ffinite-math-only 9819Allow optimizations for floating-point arithmetic that assume 9820that arguments and results are not NaNs or +-Infs. 9821 9822This option is not turned on by any @option{-O} option since 9823it can result in incorrect output for programs that depend on 9824an exact implementation of IEEE or ISO rules/specifications for 9825math functions. It may, however, yield faster code for programs 9826that do not require the guarantees of these specifications. 9827 9828The default is @option{-fno-finite-math-only}. 9829 9830@item -fno-signed-zeros 9831@opindex fno-signed-zeros 9832Allow optimizations for floating-point arithmetic that ignore the 9833signedness of zero. IEEE arithmetic specifies the behavior of 9834distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 9835of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 9836This option implies that the sign of a zero result isn't significant. 9837 9838The default is @option{-fsigned-zeros}. 9839 9840@item -fno-trapping-math 9841@opindex fno-trapping-math 9842Compile code assuming that floating-point operations cannot generate 9843user-visible traps. These traps include division by zero, overflow, 9844underflow, inexact result and invalid operation. This option requires 9845that @option{-fno-signaling-nans} be in effect. Setting this option may 9846allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 9847 9848This option should never be turned on by any @option{-O} option since 9849it can result in incorrect output for programs that depend on 9850an exact implementation of IEEE or ISO rules/specifications for 9851math functions. 9852 9853The default is @option{-ftrapping-math}. 9854 9855@item -frounding-math 9856@opindex frounding-math 9857Disable transformations and optimizations that assume default floating-point 9858rounding behavior. This is round-to-zero for all floating point 9859to integer conversions, and round-to-nearest for all other arithmetic 9860truncations. This option should be specified for programs that change 9861the FP rounding mode dynamically, or that may be executed with a 9862non-default rounding mode. This option disables constant folding of 9863floating-point expressions at compile time (which may be affected by 9864rounding mode) and arithmetic transformations that are unsafe in the 9865presence of sign-dependent rounding modes. 9866 9867The default is @option{-fno-rounding-math}. 9868 9869This option is experimental and does not currently guarantee to 9870disable all GCC optimizations that are affected by rounding mode. 9871Future versions of GCC may provide finer control of this setting 9872using C99's @code{FENV_ACCESS} pragma. This command-line option 9873will be used to specify the default state for @code{FENV_ACCESS}. 9874 9875@item -fsignaling-nans 9876@opindex fsignaling-nans 9877Compile code assuming that IEEE signaling NaNs may generate user-visible 9878traps during floating-point operations. Setting this option disables 9879optimizations that may change the number of exceptions visible with 9880signaling NaNs. This option implies @option{-ftrapping-math}. 9881 9882This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 9883be defined. 9884 9885The default is @option{-fno-signaling-nans}. 9886 9887This option is experimental and does not currently guarantee to 9888disable all GCC optimizations that affect signaling NaN behavior. 9889 9890@item -fno-fp-int-builtin-inexact 9891@opindex fno-fp-int-builtin-inexact 9892Do not allow the built-in functions @code{ceil}, @code{floor}, 9893@code{round} and @code{trunc}, and their @code{float} and @code{long 9894double} variants, to generate code that raises the ``inexact'' 9895floating-point exception for noninteger arguments. ISO C99 and C11 9896allow these functions to raise the ``inexact'' exception, but ISO/IEC 9897TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these 9898functions to do so. 9899 9900The default is @option{-ffp-int-builtin-inexact}, allowing the 9901exception to be raised. This option does nothing unless 9902@option{-ftrapping-math} is in effect. 9903 9904Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions 9905generate a call to a library function then the ``inexact'' exception 9906may be raised if the library implementation does not follow TS 18661. 9907 9908@item -fsingle-precision-constant 9909@opindex fsingle-precision-constant 9910Treat floating-point constants as single precision instead of 9911implicitly converting them to double-precision constants. 9912 9913@item -fcx-limited-range 9914@opindex fcx-limited-range 9915When enabled, this option states that a range reduction step is not 9916needed when performing complex division. Also, there is no checking 9917whether the result of a complex multiplication or division is @code{NaN 9918+ I*NaN}, with an attempt to rescue the situation in that case. The 9919default is @option{-fno-cx-limited-range}, but is enabled by 9920@option{-ffast-math}. 9921 9922This option controls the default setting of the ISO C99 9923@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 9924all languages. 9925 9926@item -fcx-fortran-rules 9927@opindex fcx-fortran-rules 9928Complex multiplication and division follow Fortran rules. Range 9929reduction is done as part of complex division, but there is no checking 9930whether the result of a complex multiplication or division is @code{NaN 9931+ I*NaN}, with an attempt to rescue the situation in that case. 9932 9933The default is @option{-fno-cx-fortran-rules}. 9934 9935@end table 9936 9937The following options control optimizations that may improve 9938performance, but are not enabled by any @option{-O} options. This 9939section includes experimental options that may produce broken code. 9940 9941@table @gcctabopt 9942@item -fbranch-probabilities 9943@opindex fbranch-probabilities 9944After running a program compiled with @option{-fprofile-arcs} 9945(@pxref{Instrumentation Options}), 9946you can compile it a second time using 9947@option{-fbranch-probabilities}, to improve optimizations based on 9948the number of times each branch was taken. When a program 9949compiled with @option{-fprofile-arcs} exits, it saves arc execution 9950counts to a file called @file{@var{sourcename}.gcda} for each source 9951file. The information in this data file is very dependent on the 9952structure of the generated code, so you must use the same source code 9953and the same optimization options for both compilations. 9954 9955With @option{-fbranch-probabilities}, GCC puts a 9956@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 9957These can be used to improve optimization. Currently, they are only 9958used in one place: in @file{reorg.c}, instead of guessing which path a 9959branch is most likely to take, the @samp{REG_BR_PROB} values are used to 9960exactly determine which path is taken more often. 9961 9962@item -fprofile-values 9963@opindex fprofile-values 9964If combined with @option{-fprofile-arcs}, it adds code so that some 9965data about values of expressions in the program is gathered. 9966 9967With @option{-fbranch-probabilities}, it reads back the data gathered 9968from profiling values of expressions for usage in optimizations. 9969 9970Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 9971 9972@item -fprofile-reorder-functions 9973@opindex fprofile-reorder-functions 9974Function reordering based on profile instrumentation collects 9975first time of execution of a function and orders these functions 9976in ascending order. 9977 9978Enabled with @option{-fprofile-use}. 9979 9980@item -fvpt 9981@opindex fvpt 9982If combined with @option{-fprofile-arcs}, this option instructs the compiler 9983to add code to gather information about values of expressions. 9984 9985With @option{-fbranch-probabilities}, it reads back the data gathered 9986and actually performs the optimizations based on them. 9987Currently the optimizations include specialization of division operations 9988using the knowledge about the value of the denominator. 9989 9990@item -frename-registers 9991@opindex frename-registers 9992Attempt to avoid false dependencies in scheduled code by making use 9993of registers left over after register allocation. This optimization 9994most benefits processors with lots of registers. Depending on the 9995debug information format adopted by the target, however, it can 9996make debugging impossible, since variables no longer stay in 9997a ``home register''. 9998 9999Enabled by default with @option{-funroll-loops}. 10000 10001@item -fschedule-fusion 10002@opindex fschedule-fusion 10003Performs a target dependent pass over the instruction stream to schedule 10004instructions of same type together because target machine can execute them 10005more efficiently if they are adjacent to each other in the instruction flow. 10006 10007Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 10008 10009@item -ftracer 10010@opindex ftracer 10011Perform tail duplication to enlarge superblock size. This transformation 10012simplifies the control flow of the function allowing other optimizations to do 10013a better job. 10014 10015Enabled with @option{-fprofile-use}. 10016 10017@item -funroll-loops 10018@opindex funroll-loops 10019Unroll loops whose number of iterations can be determined at compile time or 10020upon entry to the loop. @option{-funroll-loops} implies 10021@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 10022It also turns on complete loop peeling (i.e.@: complete removal of loops with 10023a small constant number of iterations). This option makes code larger, and may 10024or may not make it run faster. 10025 10026Enabled with @option{-fprofile-use}. 10027 10028@item -funroll-all-loops 10029@opindex funroll-all-loops 10030Unroll all loops, even if their number of iterations is uncertain when 10031the loop is entered. This usually makes programs run more slowly. 10032@option{-funroll-all-loops} implies the same options as 10033@option{-funroll-loops}. 10034 10035@item -fpeel-loops 10036@opindex fpeel-loops 10037Peels loops for which there is enough information that they do not 10038roll much (from profile feedback or static analysis). It also turns on 10039complete loop peeling (i.e.@: complete removal of loops with small constant 10040number of iterations). 10041 10042Enabled with @option{-O3} and/or @option{-fprofile-use}. 10043 10044@item -fmove-loop-invariants 10045@opindex fmove-loop-invariants 10046Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 10047at level @option{-O1} 10048 10049@item -fsplit-loops 10050@opindex fsplit-loops 10051Split a loop into two if it contains a condition that's always true 10052for one side of the iteration space and false for the other. 10053 10054@item -funswitch-loops 10055@opindex funswitch-loops 10056Move branches with loop invariant conditions out of the loop, with duplicates 10057of the loop on both branches (modified according to result of the condition). 10058 10059@item -ffunction-sections 10060@itemx -fdata-sections 10061@opindex ffunction-sections 10062@opindex fdata-sections 10063Place each function or data item into its own section in the output 10064file if the target supports arbitrary sections. The name of the 10065function or the name of the data item determines the section's name 10066in the output file. 10067 10068Use these options on systems where the linker can perform optimizations to 10069improve locality of reference in the instruction space. Most systems using the 10070ELF object format have linkers with such optimizations. On AIX, the linker 10071rearranges sections (CSECTs) based on the call graph. The performance impact 10072varies. 10073 10074Together with a linker garbage collection (linker @option{--gc-sections} 10075option) these options may lead to smaller statically-linked executables (after 10076stripping). 10077 10078On ELF/DWARF systems these options do not degenerate the quality of the debug 10079information. There could be issues with other object files/debug info formats. 10080 10081Only use these options when there are significant benefits from doing so. When 10082you specify these options, the assembler and linker create larger object and 10083executable files and are also slower. These options affect code generation. 10084They prevent optimizations by the compiler and assembler using relative 10085locations inside a translation unit since the locations are unknown until 10086link time. An example of such an optimization is relaxing calls to short call 10087instructions. 10088 10089@item -fbranch-target-load-optimize 10090@opindex fbranch-target-load-optimize 10091Perform branch target register load optimization before prologue / epilogue 10092threading. 10093The use of target registers can typically be exposed only during reload, 10094thus hoisting loads out of loops and doing inter-block scheduling needs 10095a separate optimization pass. 10096 10097@item -fbranch-target-load-optimize2 10098@opindex fbranch-target-load-optimize2 10099Perform branch target register load optimization after prologue / epilogue 10100threading. 10101 10102@item -fbtr-bb-exclusive 10103@opindex fbtr-bb-exclusive 10104When performing branch target register load optimization, don't reuse 10105branch target registers within any basic block. 10106 10107@item -fstdarg-opt 10108@opindex fstdarg-opt 10109Optimize the prologue of variadic argument functions with respect to usage of 10110those arguments. 10111 10112@item -fsection-anchors 10113@opindex fsection-anchors 10114Try to reduce the number of symbolic address calculations by using 10115shared ``anchor'' symbols to address nearby objects. This transformation 10116can help to reduce the number of GOT entries and GOT accesses on some 10117targets. 10118 10119For example, the implementation of the following function @code{foo}: 10120 10121@smallexample 10122static int a, b, c; 10123int foo (void) @{ return a + b + c; @} 10124@end smallexample 10125 10126@noindent 10127usually calculates the addresses of all three variables, but if you 10128compile it with @option{-fsection-anchors}, it accesses the variables 10129from a common anchor point instead. The effect is similar to the 10130following pseudocode (which isn't valid C): 10131 10132@smallexample 10133int foo (void) 10134@{ 10135 register int *xr = &x; 10136 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 10137@} 10138@end smallexample 10139 10140Not all targets support this option. 10141 10142@item --param @var{name}=@var{value} 10143@opindex param 10144In some places, GCC uses various constants to control the amount of 10145optimization that is done. For example, GCC does not inline functions 10146that contain more than a certain number of instructions. You can 10147control some of these constants on the command line using the 10148@option{--param} option. 10149 10150The names of specific parameters, and the meaning of the values, are 10151tied to the internals of the compiler, and are subject to change 10152without notice in future releases. 10153 10154In each case, the @var{value} is an integer. The allowable choices for 10155@var{name} are: 10156 10157@table @gcctabopt 10158@item predictable-branch-outcome 10159When branch is predicted to be taken with probability lower than this threshold 10160(in percent), then it is considered well predictable. The default is 10. 10161 10162@item max-rtl-if-conversion-insns 10163RTL if-conversion tries to remove conditional branches around a block and 10164replace them with conditionally executed instructions. This parameter 10165gives the maximum number of instructions in a block which should be 10166considered for if-conversion. The default is 10, though the compiler will 10167also use other heuristics to decide whether if-conversion is likely to be 10168profitable. 10169 10170@item max-rtl-if-conversion-predictable-cost 10171@itemx max-rtl-if-conversion-unpredictable-cost 10172RTL if-conversion will try to remove conditional branches around a block 10173and replace them with conditionally executed instructions. These parameters 10174give the maximum permissible cost for the sequence that would be generated 10175by if-conversion depending on whether the branch is statically determined 10176to be predictable or not. The units for this parameter are the same as 10177those for the GCC internal seq_cost metric. The compiler will try to 10178provide a reasonable default for this parameter using the BRANCH_COST 10179target macro. 10180 10181@item max-crossjump-edges 10182The maximum number of incoming edges to consider for cross-jumping. 10183The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 10184the number of edges incoming to each block. Increasing values mean 10185more aggressive optimization, making the compilation time increase with 10186probably small improvement in executable size. 10187 10188@item min-crossjump-insns 10189The minimum number of instructions that must be matched at the end 10190of two blocks before cross-jumping is performed on them. This 10191value is ignored in the case where all instructions in the block being 10192cross-jumped from are matched. The default value is 5. 10193 10194@item max-grow-copy-bb-insns 10195The maximum code size expansion factor when copying basic blocks 10196instead of jumping. The expansion is relative to a jump instruction. 10197The default value is 8. 10198 10199@item max-goto-duplication-insns 10200The maximum number of instructions to duplicate to a block that jumps 10201to a computed goto. To avoid @math{O(N^2)} behavior in a number of 10202passes, GCC factors computed gotos early in the compilation process, 10203and unfactors them as late as possible. Only computed jumps at the 10204end of a basic blocks with no more than max-goto-duplication-insns are 10205unfactored. The default value is 8. 10206 10207@item max-delay-slot-insn-search 10208The maximum number of instructions to consider when looking for an 10209instruction to fill a delay slot. If more than this arbitrary number of 10210instructions are searched, the time savings from filling the delay slot 10211are minimal, so stop searching. Increasing values mean more 10212aggressive optimization, making the compilation time increase with probably 10213small improvement in execution time. 10214 10215@item max-delay-slot-live-search 10216When trying to fill delay slots, the maximum number of instructions to 10217consider when searching for a block with valid live register 10218information. Increasing this arbitrarily chosen value means more 10219aggressive optimization, increasing the compilation time. This parameter 10220should be removed when the delay slot code is rewritten to maintain the 10221control-flow graph. 10222 10223@item max-gcse-memory 10224The approximate maximum amount of memory that can be allocated in 10225order to perform the global common subexpression elimination 10226optimization. If more memory than specified is required, the 10227optimization is not done. 10228 10229@item max-gcse-insertion-ratio 10230If the ratio of expression insertions to deletions is larger than this value 10231for any expression, then RTL PRE inserts or removes the expression and thus 10232leaves partially redundant computations in the instruction stream. The default value is 20. 10233 10234@item max-pending-list-length 10235The maximum number of pending dependencies scheduling allows 10236before flushing the current state and starting over. Large functions 10237with few branches or calls can create excessively large lists which 10238needlessly consume memory and resources. 10239 10240@item max-modulo-backtrack-attempts 10241The maximum number of backtrack attempts the scheduler should make 10242when modulo scheduling a loop. Larger values can exponentially increase 10243compilation time. 10244 10245@item max-inline-insns-single 10246Several parameters control the tree inliner used in GCC@. 10247This number sets the maximum number of instructions (counted in GCC's 10248internal representation) in a single function that the tree inliner 10249considers for inlining. This only affects functions declared 10250inline and methods implemented in a class declaration (C++). 10251The default value is 400. 10252 10253@item max-inline-insns-auto 10254When you use @option{-finline-functions} (included in @option{-O3}), 10255a lot of functions that would otherwise not be considered for inlining 10256by the compiler are investigated. To those functions, a different 10257(more restrictive) limit compared to functions declared inline can 10258be applied. 10259The default value is 30. 10260 10261@item inline-min-speedup 10262When estimated performance improvement of caller + callee runtime exceeds this 10263threshold (in percent), the function can be inlined regardless of the limit on 10264@option{--param max-inline-insns-single} and @option{--param 10265max-inline-insns-auto}. 10266The default value is 15. 10267 10268@item large-function-insns 10269The limit specifying really large functions. For functions larger than this 10270limit after inlining, inlining is constrained by 10271@option{--param large-function-growth}. This parameter is useful primarily 10272to avoid extreme compilation time caused by non-linear algorithms used by the 10273back end. 10274The default value is 2700. 10275 10276@item large-function-growth 10277Specifies maximal growth of large function caused by inlining in percents. 10278The default value is 100 which limits large function growth to 2.0 times 10279the original size. 10280 10281@item large-unit-insns 10282The limit specifying large translation unit. Growth caused by inlining of 10283units larger than this limit is limited by @option{--param inline-unit-growth}. 10284For small units this might be too tight. 10285For example, consider a unit consisting of function A 10286that is inline and B that just calls A three times. If B is small relative to 10287A, the growth of unit is 300\% and yet such inlining is very sane. For very 10288large units consisting of small inlineable functions, however, the overall unit 10289growth limit is needed to avoid exponential explosion of code size. Thus for 10290smaller units, the size is increased to @option{--param large-unit-insns} 10291before applying @option{--param inline-unit-growth}. The default is 10000. 10292 10293@item inline-unit-growth 10294Specifies maximal overall growth of the compilation unit caused by inlining. 10295The default value is 20 which limits unit growth to 1.2 times the original 10296size. Cold functions (either marked cold via an attribute or by profile 10297feedback) are not accounted into the unit size. 10298 10299@item ipcp-unit-growth 10300Specifies maximal overall growth of the compilation unit caused by 10301interprocedural constant propagation. The default value is 10 which limits 10302unit growth to 1.1 times the original size. 10303 10304@item large-stack-frame 10305The limit specifying large stack frames. While inlining the algorithm is trying 10306to not grow past this limit too much. The default value is 256 bytes. 10307 10308@item large-stack-frame-growth 10309Specifies maximal growth of large stack frames caused by inlining in percents. 10310The default value is 1000 which limits large stack frame growth to 11 times 10311the original size. 10312 10313@item max-inline-insns-recursive 10314@itemx max-inline-insns-recursive-auto 10315Specifies the maximum number of instructions an out-of-line copy of a 10316self-recursive inline 10317function can grow into by performing recursive inlining. 10318 10319@option{--param max-inline-insns-recursive} applies to functions 10320declared inline. 10321For functions not declared inline, recursive inlining 10322happens only when @option{-finline-functions} (included in @option{-O3}) is 10323enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The 10324default value is 450. 10325 10326@item max-inline-recursive-depth 10327@itemx max-inline-recursive-depth-auto 10328Specifies the maximum recursion depth used for recursive inlining. 10329 10330@option{--param max-inline-recursive-depth} applies to functions 10331declared inline. For functions not declared inline, recursive inlining 10332happens only when @option{-finline-functions} (included in @option{-O3}) is 10333enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The 10334default value is 8. 10335 10336@item min-inline-recursive-probability 10337Recursive inlining is profitable only for function having deep recursion 10338in average and can hurt for function having little recursion depth by 10339increasing the prologue size or complexity of function body to other 10340optimizers. 10341 10342When profile feedback is available (see @option{-fprofile-generate}) the actual 10343recursion depth can be guessed from the probability that function recurses 10344via a given call expression. This parameter limits inlining only to call 10345expressions whose probability exceeds the given threshold (in percents). 10346The default value is 10. 10347 10348@item early-inlining-insns 10349Specify growth that the early inliner can make. In effect it increases 10350the amount of inlining for code having a large abstraction penalty. 10351The default value is 14. 10352 10353@item max-early-inliner-iterations 10354Limit of iterations of the early inliner. This basically bounds 10355the number of nested indirect calls the early inliner can resolve. 10356Deeper chains are still handled by late inlining. 10357 10358@item comdat-sharing-probability 10359Probability (in percent) that C++ inline function with comdat visibility 10360are shared across multiple compilation units. The default value is 20. 10361 10362@item profile-func-internal-id 10363A parameter to control whether to use function internal id in profile 10364database lookup. If the value is 0, the compiler uses an id that 10365is based on function assembler name and filename, which makes old profile 10366data more tolerant to source changes such as function reordering etc. 10367The default value is 0. 10368 10369@item min-vect-loop-bound 10370The minimum number of iterations under which loops are not vectorized 10371when @option{-ftree-vectorize} is used. The number of iterations after 10372vectorization needs to be greater than the value specified by this option 10373to allow vectorization. The default value is 0. 10374 10375@item gcse-cost-distance-ratio 10376Scaling factor in calculation of maximum distance an expression 10377can be moved by GCSE optimizations. This is currently supported only in the 10378code hoisting pass. The bigger the ratio, the more aggressive code hoisting 10379is with simple expressions, i.e., the expressions that have cost 10380less than @option{gcse-unrestricted-cost}. Specifying 0 disables 10381hoisting of simple expressions. The default value is 10. 10382 10383@item gcse-unrestricted-cost 10384Cost, roughly measured as the cost of a single typical machine 10385instruction, at which GCSE optimizations do not constrain 10386the distance an expression can travel. This is currently 10387supported only in the code hoisting pass. The lesser the cost, 10388the more aggressive code hoisting is. Specifying 0 10389allows all expressions to travel unrestricted distances. 10390The default value is 3. 10391 10392@item max-hoist-depth 10393The depth of search in the dominator tree for expressions to hoist. 10394This is used to avoid quadratic behavior in hoisting algorithm. 10395The value of 0 does not limit on the search, but may slow down compilation 10396of huge functions. The default value is 30. 10397 10398@item max-tail-merge-comparisons 10399The maximum amount of similar bbs to compare a bb with. This is used to 10400avoid quadratic behavior in tree tail merging. The default value is 10. 10401 10402@item max-tail-merge-iterations 10403The maximum amount of iterations of the pass over the function. This is used to 10404limit compilation time in tree tail merging. The default value is 2. 10405 10406@item store-merging-allow-unaligned 10407Allow the store merging pass to introduce unaligned stores if it is legal to 10408do so. The default value is 1. 10409 10410@item max-stores-to-merge 10411The maximum number of stores to attempt to merge into wider stores in the store 10412merging pass. The minimum value is 2 and the default is 64. 10413 10414@item max-unrolled-insns 10415The maximum number of instructions that a loop may have to be unrolled. 10416If a loop is unrolled, this parameter also determines how many times 10417the loop code is unrolled. 10418 10419@item max-average-unrolled-insns 10420The maximum number of instructions biased by probabilities of their execution 10421that a loop may have to be unrolled. If a loop is unrolled, 10422this parameter also determines how many times the loop code is unrolled. 10423 10424@item max-unroll-times 10425The maximum number of unrollings of a single loop. 10426 10427@item max-peeled-insns 10428The maximum number of instructions that a loop may have to be peeled. 10429If a loop is peeled, this parameter also determines how many times 10430the loop code is peeled. 10431 10432@item max-peel-times 10433The maximum number of peelings of a single loop. 10434 10435@item max-peel-branches 10436The maximum number of branches on the hot path through the peeled sequence. 10437 10438@item max-completely-peeled-insns 10439The maximum number of insns of a completely peeled loop. 10440 10441@item max-completely-peel-times 10442The maximum number of iterations of a loop to be suitable for complete peeling. 10443 10444@item max-completely-peel-loop-nest-depth 10445The maximum depth of a loop nest suitable for complete peeling. 10446 10447@item max-unswitch-insns 10448The maximum number of insns of an unswitched loop. 10449 10450@item max-unswitch-level 10451The maximum number of branches unswitched in a single loop. 10452 10453@item max-loop-headers-insns 10454The maximum number of insns in loop header duplicated by the copy loop headers 10455pass. 10456 10457@item lim-expensive 10458The minimum cost of an expensive expression in the loop invariant motion. 10459 10460@item iv-consider-all-candidates-bound 10461Bound on number of candidates for induction variables, below which 10462all candidates are considered for each use in induction variable 10463optimizations. If there are more candidates than this, 10464only the most relevant ones are considered to avoid quadratic time complexity. 10465 10466@item iv-max-considered-uses 10467The induction variable optimizations give up on loops that contain more 10468induction variable uses. 10469 10470@item iv-always-prune-cand-set-bound 10471If the number of candidates in the set is smaller than this value, 10472always try to remove unnecessary ivs from the set 10473when adding a new one. 10474 10475@item avg-loop-niter 10476Average number of iterations of a loop. 10477 10478@item dse-max-object-size 10479Maximum size (in bytes) of objects tracked bytewise by dead store elimination. 10480Larger values may result in larger compilation times. 10481 10482@item scev-max-expr-size 10483Bound on size of expressions used in the scalar evolutions analyzer. 10484Large expressions slow the analyzer. 10485 10486@item scev-max-expr-complexity 10487Bound on the complexity of the expressions in the scalar evolutions analyzer. 10488Complex expressions slow the analyzer. 10489 10490@item max-tree-if-conversion-phi-args 10491Maximum number of arguments in a PHI supported by TREE if conversion 10492unless the loop is marked with simd pragma. 10493 10494@item vect-max-version-for-alignment-checks 10495The maximum number of run-time checks that can be performed when 10496doing loop versioning for alignment in the vectorizer. 10497 10498@item vect-max-version-for-alias-checks 10499The maximum number of run-time checks that can be performed when 10500doing loop versioning for alias in the vectorizer. 10501 10502@item vect-max-peeling-for-alignment 10503The maximum number of loop peels to enhance access alignment 10504for vectorizer. Value -1 means no limit. 10505 10506@item max-iterations-to-track 10507The maximum number of iterations of a loop the brute-force algorithm 10508for analysis of the number of iterations of the loop tries to evaluate. 10509 10510@item hot-bb-count-ws-permille 10511A basic block profile count is considered hot if it contributes to 10512the given permillage (i.e. 0...1000) of the entire profiled execution. 10513 10514@item hot-bb-frequency-fraction 10515Select fraction of the entry block frequency of executions of basic block in 10516function given basic block needs to have to be considered hot. 10517 10518@item max-predicted-iterations 10519The maximum number of loop iterations we predict statically. This is useful 10520in cases where a function contains a single loop with known bound and 10521another loop with unknown bound. 10522The known number of iterations is predicted correctly, while 10523the unknown number of iterations average to roughly 10. This means that the 10524loop without bounds appears artificially cold relative to the other one. 10525 10526@item builtin-expect-probability 10527Control the probability of the expression having the specified value. This 10528parameter takes a percentage (i.e. 0 ... 100) as input. 10529The default probability of 90 is obtained empirically. 10530 10531@item align-threshold 10532 10533Select fraction of the maximal frequency of executions of a basic block in 10534a function to align the basic block. 10535 10536@item align-loop-iterations 10537 10538A loop expected to iterate at least the selected number of iterations is 10539aligned. 10540 10541@item tracer-dynamic-coverage 10542@itemx tracer-dynamic-coverage-feedback 10543 10544This value is used to limit superblock formation once the given percentage of 10545executed instructions is covered. This limits unnecessary code size 10546expansion. 10547 10548The @option{tracer-dynamic-coverage-feedback} parameter 10549is used only when profile 10550feedback is available. The real profiles (as opposed to statically estimated 10551ones) are much less balanced allowing the threshold to be larger value. 10552 10553@item tracer-max-code-growth 10554Stop tail duplication once code growth has reached given percentage. This is 10555a rather artificial limit, as most of the duplicates are eliminated later in 10556cross jumping, so it may be set to much higher values than is the desired code 10557growth. 10558 10559@item tracer-min-branch-ratio 10560 10561Stop reverse growth when the reverse probability of best edge is less than this 10562threshold (in percent). 10563 10564@item tracer-min-branch-probability 10565@itemx tracer-min-branch-probability-feedback 10566 10567Stop forward growth if the best edge has probability lower than this 10568threshold. 10569 10570Similarly to @option{tracer-dynamic-coverage} two parameters are 10571provided. @option{tracer-min-branch-probability-feedback} is used for 10572compilation with profile feedback and @option{tracer-min-branch-probability} 10573compilation without. The value for compilation with profile feedback 10574needs to be more conservative (higher) in order to make tracer 10575effective. 10576 10577@item stack-clash-protection-guard-size 10578Specify the size of the operating system provided stack guard as 105792 raised to @var{num} bytes. The default value is 12 (4096 bytes). 10580Acceptable values are between 12 and 30. Higher values may reduce the 10581number of explicit probes, but a value larger than the operating system 10582provided guard will leave code vulnerable to stack clash style attacks. 10583 10584@item stack-clash-protection-probe-interval 10585Stack clash protection involves probing stack space as it is allocated. This 10586param controls the maximum distance between probes into the stack as 2 raised 10587to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to 1058812. Higher values may reduce the number of explicit probes, but a value 10589larger than the operating system provided guard will leave code vulnerable to 10590stack clash style attacks. 10591 10592@item max-cse-path-length 10593 10594The maximum number of basic blocks on path that CSE considers. 10595The default is 10. 10596 10597@item max-cse-insns 10598The maximum number of instructions CSE processes before flushing. 10599The default is 1000. 10600 10601@item ggc-min-expand 10602 10603GCC uses a garbage collector to manage its own memory allocation. This 10604parameter specifies the minimum percentage by which the garbage 10605collector's heap should be allowed to expand between collections. 10606Tuning this may improve compilation speed; it has no effect on code 10607generation. 10608 10609The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 10610RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 10611the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 10612GCC is not able to calculate RAM on a particular platform, the lower 10613bound of 30% is used. Setting this parameter and 10614@option{ggc-min-heapsize} to zero causes a full collection to occur at 10615every opportunity. This is extremely slow, but can be useful for 10616debugging. 10617 10618@item ggc-min-heapsize 10619 10620Minimum size of the garbage collector's heap before it begins bothering 10621to collect garbage. The first collection occurs after the heap expands 10622by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 10623tuning this may improve compilation speed, and has no effect on code 10624generation. 10625 10626The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 10627tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 10628with a lower bound of 4096 (four megabytes) and an upper bound of 10629131072 (128 megabytes). If GCC is not able to calculate RAM on a 10630particular platform, the lower bound is used. Setting this parameter 10631very large effectively disables garbage collection. Setting this 10632parameter and @option{ggc-min-expand} to zero causes a full collection 10633to occur at every opportunity. 10634 10635@item max-reload-search-insns 10636The maximum number of instruction reload should look backward for equivalent 10637register. Increasing values mean more aggressive optimization, making the 10638compilation time increase with probably slightly better performance. 10639The default value is 100. 10640 10641@item max-cselib-memory-locations 10642The maximum number of memory locations cselib should take into account. 10643Increasing values mean more aggressive optimization, making the compilation time 10644increase with probably slightly better performance. The default value is 500. 10645 10646@item max-sched-ready-insns 10647The maximum number of instructions ready to be issued the scheduler should 10648consider at any given time during the first scheduling pass. Increasing 10649values mean more thorough searches, making the compilation time increase 10650with probably little benefit. The default value is 100. 10651 10652@item max-sched-region-blocks 10653The maximum number of blocks in a region to be considered for 10654interblock scheduling. The default value is 10. 10655 10656@item max-pipeline-region-blocks 10657The maximum number of blocks in a region to be considered for 10658pipelining in the selective scheduler. The default value is 15. 10659 10660@item max-sched-region-insns 10661The maximum number of insns in a region to be considered for 10662interblock scheduling. The default value is 100. 10663 10664@item max-pipeline-region-insns 10665The maximum number of insns in a region to be considered for 10666pipelining in the selective scheduler. The default value is 200. 10667 10668@item min-spec-prob 10669The minimum probability (in percents) of reaching a source block 10670for interblock speculative scheduling. The default value is 40. 10671 10672@item max-sched-extend-regions-iters 10673The maximum number of iterations through CFG to extend regions. 10674A value of 0 (the default) disables region extensions. 10675 10676@item max-sched-insn-conflict-delay 10677The maximum conflict delay for an insn to be considered for speculative motion. 10678The default value is 3. 10679 10680@item sched-spec-prob-cutoff 10681The minimal probability of speculation success (in percents), so that 10682speculative insns are scheduled. 10683The default value is 40. 10684 10685@item sched-state-edge-prob-cutoff 10686The minimum probability an edge must have for the scheduler to save its 10687state across it. 10688The default value is 10. 10689 10690@item sched-mem-true-dep-cost 10691Minimal distance (in CPU cycles) between store and load targeting same 10692memory locations. The default value is 1. 10693 10694@item selsched-max-lookahead 10695The maximum size of the lookahead window of selective scheduling. It is a 10696depth of search for available instructions. 10697The default value is 50. 10698 10699@item selsched-max-sched-times 10700The maximum number of times that an instruction is scheduled during 10701selective scheduling. This is the limit on the number of iterations 10702through which the instruction may be pipelined. The default value is 2. 10703 10704@item selsched-insns-to-rename 10705The maximum number of best instructions in the ready list that are considered 10706for renaming in the selective scheduler. The default value is 2. 10707 10708@item sms-min-sc 10709The minimum value of stage count that swing modulo scheduler 10710generates. The default value is 2. 10711 10712@item max-last-value-rtl 10713The maximum size measured as number of RTLs that can be recorded in an expression 10714in combiner for a pseudo register as last known value of that register. The default 10715is 10000. 10716 10717@item max-combine-insns 10718The maximum number of instructions the RTL combiner tries to combine. 10719The default value is 2 at @option{-Og} and 4 otherwise. 10720 10721@item integer-share-limit 10722Small integer constants can use a shared data structure, reducing the 10723compiler's memory usage and increasing its speed. This sets the maximum 10724value of a shared integer constant. The default value is 256. 10725 10726@item ssp-buffer-size 10727The minimum size of buffers (i.e.@: arrays) that receive stack smashing 10728protection when @option{-fstack-protection} is used. 10729 10730@item min-size-for-stack-sharing 10731The minimum size of variables taking part in stack slot sharing when not 10732optimizing. The default value is 32. 10733 10734@item max-jump-thread-duplication-stmts 10735Maximum number of statements allowed in a block that needs to be 10736duplicated when threading jumps. 10737 10738@item max-fields-for-field-sensitive 10739Maximum number of fields in a structure treated in 10740a field sensitive manner during pointer analysis. The default is zero 10741for @option{-O0} and @option{-O1}, 10742and 100 for @option{-Os}, @option{-O2}, and @option{-O3}. 10743 10744@item prefetch-latency 10745Estimate on average number of instructions that are executed before 10746prefetch finishes. The distance prefetched ahead is proportional 10747to this constant. Increasing this number may also lead to less 10748streams being prefetched (see @option{simultaneous-prefetches}). 10749 10750@item simultaneous-prefetches 10751Maximum number of prefetches that can run at the same time. 10752 10753@item l1-cache-line-size 10754The size of cache line in L1 cache, in bytes. 10755 10756@item l1-cache-size 10757The size of L1 cache, in kilobytes. 10758 10759@item l2-cache-size 10760The size of L2 cache, in kilobytes. 10761 10762@item loop-interchange-max-num-stmts 10763The maximum number of stmts in a loop to be interchanged. 10764 10765@item loop-interchange-stride-ratio 10766The minimum ratio between stride of two loops for interchange to be profitable. 10767 10768@item min-insn-to-prefetch-ratio 10769The minimum ratio between the number of instructions and the 10770number of prefetches to enable prefetching in a loop. 10771 10772@item prefetch-min-insn-to-mem-ratio 10773The minimum ratio between the number of instructions and the 10774number of memory references to enable prefetching in a loop. 10775 10776@item use-canonical-types 10777Whether the compiler should use the ``canonical'' type system. By 10778default, this should always be 1, which uses a more efficient internal 10779mechanism for comparing types in C++ and Objective-C++. However, if 10780bugs in the canonical type system are causing compilation failures, 10781set this value to 0 to disable canonical types. 10782 10783@item switch-conversion-max-branch-ratio 10784Switch initialization conversion refuses to create arrays that are 10785bigger than @option{switch-conversion-max-branch-ratio} times the number of 10786branches in the switch. 10787 10788@item max-partial-antic-length 10789Maximum length of the partial antic set computed during the tree 10790partial redundancy elimination optimization (@option{-ftree-pre}) when 10791optimizing at @option{-O3} and above. For some sorts of source code 10792the enhanced partial redundancy elimination optimization can run away, 10793consuming all of the memory available on the host machine. This 10794parameter sets a limit on the length of the sets that are computed, 10795which prevents the runaway behavior. Setting a value of 0 for 10796this parameter allows an unlimited set length. 10797 10798@item sccvn-max-scc-size 10799Maximum size of a strongly connected component (SCC) during SCCVN 10800processing. If this limit is hit, SCCVN processing for the whole 10801function is not done and optimizations depending on it are 10802disabled. The default maximum SCC size is 10000. 10803 10804@item sccvn-max-alias-queries-per-access 10805Maximum number of alias-oracle queries we perform when looking for 10806redundancies for loads and stores. If this limit is hit the search 10807is aborted and the load or store is not considered redundant. The 10808number of queries is algorithmically limited to the number of 10809stores on all paths from the load to the function entry. 10810The default maximum number of queries is 1000. 10811 10812@item ira-max-loops-num 10813IRA uses regional register allocation by default. If a function 10814contains more loops than the number given by this parameter, only at most 10815the given number of the most frequently-executed loops form regions 10816for regional register allocation. The default value of the 10817parameter is 100. 10818 10819@item ira-max-conflict-table-size 10820Although IRA uses a sophisticated algorithm to compress the conflict 10821table, the table can still require excessive amounts of memory for 10822huge functions. If the conflict table for a function could be more 10823than the size in MB given by this parameter, the register allocator 10824instead uses a faster, simpler, and lower-quality 10825algorithm that does not require building a pseudo-register conflict table. 10826The default value of the parameter is 2000. 10827 10828@item ira-loop-reserved-regs 10829IRA can be used to evaluate more accurate register pressure in loops 10830for decisions to move loop invariants (see @option{-O3}). The number 10831of available registers reserved for some other purposes is given 10832by this parameter. The default value of the parameter is 2, which is 10833the minimal number of registers needed by typical instructions. 10834This value is the best found from numerous experiments. 10835 10836@item lra-inheritance-ebb-probability-cutoff 10837LRA tries to reuse values reloaded in registers in subsequent insns. 10838This optimization is called inheritance. EBB is used as a region to 10839do this optimization. The parameter defines a minimal fall-through 10840edge probability in percentage used to add BB to inheritance EBB in 10841LRA. The default value of the parameter is 40. The value was chosen 10842from numerous runs of SPEC2000 on x86-64. 10843 10844@item loop-invariant-max-bbs-in-loop 10845Loop invariant motion can be very expensive, both in compilation time and 10846in amount of needed compile-time memory, with very large loops. Loops 10847with more basic blocks than this parameter won't have loop invariant 10848motion optimization performed on them. The default value of the 10849parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above. 10850 10851@item loop-max-datarefs-for-datadeps 10852Building data dependencies is expensive for very large loops. This 10853parameter limits the number of data references in loops that are 10854considered for data dependence analysis. These large loops are no 10855handled by the optimizations using loop data dependencies. 10856The default value is 1000. 10857 10858@item max-vartrack-size 10859Sets a maximum number of hash table slots to use during variable 10860tracking dataflow analysis of any function. If this limit is exceeded 10861with variable tracking at assignments enabled, analysis for that 10862function is retried without it, after removing all debug insns from 10863the function. If the limit is exceeded even without debug insns, var 10864tracking analysis is completely disabled for the function. Setting 10865the parameter to zero makes it unlimited. 10866 10867@item max-vartrack-expr-depth 10868Sets a maximum number of recursion levels when attempting to map 10869variable names or debug temporaries to value expressions. This trades 10870compilation time for more complete debug information. If this is set too 10871low, value expressions that are available and could be represented in 10872debug information may end up not being used; setting this higher may 10873enable the compiler to find more complex debug expressions, but compile 10874time and memory use may grow. The default is 12. 10875 10876@item max-debug-marker-count 10877Sets a threshold on the number of debug markers (e.g. begin stmt 10878markers) to avoid complexity explosion at inlining or expanding to RTL. 10879If a function has more such gimple stmts than the set limit, such stmts 10880will be dropped from the inlined copy of a function, and from its RTL 10881expansion. The default is 100000. 10882 10883@item min-nondebug-insn-uid 10884Use uids starting at this parameter for nondebug insns. The range below 10885the parameter is reserved exclusively for debug insns created by 10886@option{-fvar-tracking-assignments}, but debug insns may get 10887(non-overlapping) uids above it if the reserved range is exhausted. 10888 10889@item ipa-sra-ptr-growth-factor 10890IPA-SRA replaces a pointer to an aggregate with one or more new 10891parameters only when their cumulative size is less or equal to 10892@option{ipa-sra-ptr-growth-factor} times the size of the original 10893pointer parameter. 10894 10895@item sra-max-scalarization-size-Ospeed 10896@itemx sra-max-scalarization-size-Osize 10897The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 10898replace scalar parts of aggregates with uses of independent scalar 10899variables. These parameters control the maximum size, in storage units, 10900of aggregate which is considered for replacement when compiling for 10901speed 10902(@option{sra-max-scalarization-size-Ospeed}) or size 10903(@option{sra-max-scalarization-size-Osize}) respectively. 10904 10905@item tm-max-aggregate-size 10906When making copies of thread-local variables in a transaction, this 10907parameter specifies the size in bytes after which variables are 10908saved with the logging functions as opposed to save/restore code 10909sequence pairs. This option only applies when using 10910@option{-fgnu-tm}. 10911 10912@item graphite-max-nb-scop-params 10913To avoid exponential effects in the Graphite loop transforms, the 10914number of parameters in a Static Control Part (SCoP) is bounded. The 10915default value is 10 parameters, a value of zero can be used to lift 10916the bound. A variable whose value is unknown at compilation time and 10917defined outside a SCoP is a parameter of the SCoP. 10918 10919@item loop-block-tile-size 10920Loop blocking or strip mining transforms, enabled with 10921@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 10922loop in the loop nest by a given number of iterations. The strip 10923length can be changed using the @option{loop-block-tile-size} 10924parameter. The default value is 51 iterations. 10925 10926@item loop-unroll-jam-size 10927Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The 10928default value is 4. 10929 10930@item loop-unroll-jam-depth 10931Specify the dimension to be unrolled (counting from the most inner loop) 10932for the @option{-floop-unroll-and-jam}. The default value is 2. 10933 10934@item ipa-cp-value-list-size 10935IPA-CP attempts to track all possible values and types passed to a function's 10936parameter in order to propagate them and perform devirtualization. 10937@option{ipa-cp-value-list-size} is the maximum number of values and types it 10938stores per one formal parameter of a function. 10939 10940@item ipa-cp-eval-threshold 10941IPA-CP calculates its own score of cloning profitability heuristics 10942and performs those cloning opportunities with scores that exceed 10943@option{ipa-cp-eval-threshold}. 10944 10945@item ipa-cp-recursion-penalty 10946Percentage penalty the recursive functions will receive when they 10947are evaluated for cloning. 10948 10949@item ipa-cp-single-call-penalty 10950Percentage penalty functions containing a single call to another 10951function will receive when they are evaluated for cloning. 10952 10953 10954@item ipa-max-agg-items 10955IPA-CP is also capable to propagate a number of scalar values passed 10956in an aggregate. @option{ipa-max-agg-items} controls the maximum 10957number of such values per one parameter. 10958 10959@item ipa-cp-loop-hint-bonus 10960When IPA-CP determines that a cloning candidate would make the number 10961of iterations of a loop known, it adds a bonus of 10962@option{ipa-cp-loop-hint-bonus} to the profitability score of 10963the candidate. 10964 10965@item ipa-cp-array-index-hint-bonus 10966When IPA-CP determines that a cloning candidate would make the index of 10967an array access known, it adds a bonus of 10968@option{ipa-cp-array-index-hint-bonus} to the profitability 10969score of the candidate. 10970 10971@item ipa-max-aa-steps 10972During its analysis of function bodies, IPA-CP employs alias analysis 10973in order to track values pointed to by function parameters. In order 10974not spend too much time analyzing huge functions, it gives up and 10975consider all memory clobbered after examining 10976@option{ipa-max-aa-steps} statements modifying memory. 10977 10978@item lto-partitions 10979Specify desired number of partitions produced during WHOPR compilation. 10980The number of partitions should exceed the number of CPUs used for compilation. 10981The default value is 32. 10982 10983@item lto-min-partition 10984Size of minimal partition for WHOPR (in estimated instructions). 10985This prevents expenses of splitting very small programs into too many 10986partitions. 10987 10988@item lto-max-partition 10989Size of max partition for WHOPR (in estimated instructions). 10990to provide an upper bound for individual size of partition. 10991Meant to be used only with balanced partitioning. 10992 10993@item cxx-max-namespaces-for-diagnostic-help 10994The maximum number of namespaces to consult for suggestions when C++ 10995name lookup fails for an identifier. The default is 1000. 10996 10997@item sink-frequency-threshold 10998The maximum relative execution frequency (in percents) of the target block 10999relative to a statement's original block to allow statement sinking of a 11000statement. Larger numbers result in more aggressive statement sinking. 11001The default value is 75. A small positive adjustment is applied for 11002statements with memory operands as those are even more profitable so sink. 11003 11004@item max-stores-to-sink 11005The maximum number of conditional store pairs that can be sunk. Set to 0 11006if either vectorization (@option{-ftree-vectorize}) or if-conversion 11007(@option{-ftree-loop-if-convert}) is disabled. The default is 2. 11008 11009@item allow-store-data-races 11010Allow optimizers to introduce new data races on stores. 11011Set to 1 to allow, otherwise to 0. This option is enabled by default 11012at optimization level @option{-Ofast}. 11013 11014@item case-values-threshold 11015The smallest number of different values for which it is best to use a 11016jump-table instead of a tree of conditional branches. If the value is 110170, use the default for the machine. The default is 0. 11018 11019@item tree-reassoc-width 11020Set the maximum number of instructions executed in parallel in 11021reassociated tree. This parameter overrides target dependent 11022heuristics used by default if has non zero value. 11023 11024@item sched-pressure-algorithm 11025Choose between the two available implementations of 11026@option{-fsched-pressure}. Algorithm 1 is the original implementation 11027and is the more likely to prevent instructions from being reordered. 11028Algorithm 2 was designed to be a compromise between the relatively 11029conservative approach taken by algorithm 1 and the rather aggressive 11030approach taken by the default scheduler. It relies more heavily on 11031having a regular register file and accurate register pressure classes. 11032See @file{haifa-sched.c} in the GCC sources for more details. 11033 11034The default choice depends on the target. 11035 11036@item max-slsr-cand-scan 11037Set the maximum number of existing candidates that are considered when 11038seeking a basis for a new straight-line strength reduction candidate. 11039 11040@item asan-globals 11041Enable buffer overflow detection for global objects. This kind 11042of protection is enabled by default if you are using 11043@option{-fsanitize=address} option. 11044To disable global objects protection use @option{--param asan-globals=0}. 11045 11046@item asan-stack 11047Enable buffer overflow detection for stack objects. This kind of 11048protection is enabled by default when using @option{-fsanitize=address}. 11049To disable stack protection use @option{--param asan-stack=0} option. 11050 11051@item asan-instrument-reads 11052Enable buffer overflow detection for memory reads. This kind of 11053protection is enabled by default when using @option{-fsanitize=address}. 11054To disable memory reads protection use 11055@option{--param asan-instrument-reads=0}. 11056 11057@item asan-instrument-writes 11058Enable buffer overflow detection for memory writes. This kind of 11059protection is enabled by default when using @option{-fsanitize=address}. 11060To disable memory writes protection use 11061@option{--param asan-instrument-writes=0} option. 11062 11063@item asan-memintrin 11064Enable detection for built-in functions. This kind of protection 11065is enabled by default when using @option{-fsanitize=address}. 11066To disable built-in functions protection use 11067@option{--param asan-memintrin=0}. 11068 11069@item asan-use-after-return 11070Enable detection of use-after-return. This kind of protection 11071is enabled by default when using the @option{-fsanitize=address} option. 11072To disable it use @option{--param asan-use-after-return=0}. 11073 11074Note: By default the check is disabled at run time. To enable it, 11075add @code{detect_stack_use_after_return=1} to the environment variable 11076@env{ASAN_OPTIONS}. 11077 11078@item asan-instrumentation-with-call-threshold 11079If number of memory accesses in function being instrumented 11080is greater or equal to this number, use callbacks instead of inline checks. 11081E.g. to disable inline code use 11082@option{--param asan-instrumentation-with-call-threshold=0}. 11083 11084@item use-after-scope-direct-emission-threshold 11085If the size of a local variable in bytes is smaller or equal to this 11086number, directly poison (or unpoison) shadow memory instead of using 11087run-time callbacks. The default value is 256. 11088 11089@item chkp-max-ctor-size 11090Static constructors generated by Pointer Bounds Checker may become very 11091large and significantly increase compile time at optimization level 11092@option{-O1} and higher. This parameter is a maximum number of statements 11093in a single generated constructor. Default value is 5000. 11094 11095@item max-fsm-thread-path-insns 11096Maximum number of instructions to copy when duplicating blocks on a 11097finite state automaton jump thread path. The default is 100. 11098 11099@item max-fsm-thread-length 11100Maximum number of basic blocks on a finite state automaton jump thread 11101path. The default is 10. 11102 11103@item max-fsm-thread-paths 11104Maximum number of new jump thread paths to create for a finite state 11105automaton. The default is 50. 11106 11107@item parloops-chunk-size 11108Chunk size of omp schedule for loops parallelized by parloops. The default 11109is 0. 11110 11111@item parloops-schedule 11112Schedule type of omp schedule for loops parallelized by parloops (static, 11113dynamic, guided, auto, runtime). The default is static. 11114 11115@item parloops-min-per-thread 11116The minimum number of iterations per thread of an innermost parallelized 11117loop for which the parallelized variant is prefered over the single threaded 11118one. The default is 100. Note that for a parallelized loop nest the 11119minimum number of iterations of the outermost loop per thread is two. 11120 11121@item max-ssa-name-query-depth 11122Maximum depth of recursion when querying properties of SSA names in things 11123like fold routines. One level of recursion corresponds to following a 11124use-def chain. 11125 11126@item hsa-gen-debug-stores 11127Enable emission of special debug stores within HSA kernels which are 11128then read and reported by libgomp plugin. Generation of these stores 11129is disabled by default, use @option{--param hsa-gen-debug-stores=1} to 11130enable it. 11131 11132@item max-speculative-devirt-maydefs 11133The maximum number of may-defs we analyze when looking for a must-def 11134specifying the dynamic type of an object that invokes a virtual call 11135we may be able to devirtualize speculatively. 11136 11137@item max-vrp-switch-assertions 11138The maximum number of assertions to add along the default edge of a switch 11139statement during VRP. The default is 10. 11140 11141@item unroll-jam-min-percent 11142The minimum percentage of memory references that must be optimized 11143away for the unroll-and-jam transformation to be considered profitable. 11144 11145@item unroll-jam-max-unroll 11146The maximum number of times the outer loop should be unrolled by 11147the unroll-and-jam transformation. 11148@end table 11149@end table 11150 11151@node Instrumentation Options 11152@section Program Instrumentation Options 11153@cindex instrumentation options 11154@cindex program instrumentation options 11155@cindex run-time error checking options 11156@cindex profiling options 11157@cindex options, program instrumentation 11158@cindex options, run-time error checking 11159@cindex options, profiling 11160 11161GCC supports a number of command-line options that control adding 11162run-time instrumentation to the code it normally generates. 11163For example, one purpose of instrumentation is collect profiling 11164statistics for use in finding program hot spots, code coverage 11165analysis, or profile-guided optimizations. 11166Another class of program instrumentation is adding run-time checking 11167to detect programming errors like invalid pointer 11168dereferences or out-of-bounds array accesses, as well as deliberately 11169hostile attacks such as stack smashing or C++ vtable hijacking. 11170There is also a general hook which can be used to implement other 11171forms of tracing or function-level instrumentation for debug or 11172program analysis purposes. 11173 11174@table @gcctabopt 11175@cindex @command{prof} 11176@item -p 11177@opindex p 11178Generate extra code to write profile information suitable for the 11179analysis program @command{prof}. You must use this option when compiling 11180the source files you want data about, and you must also use it when 11181linking. 11182 11183@cindex @command{gprof} 11184@item -pg 11185@opindex pg 11186Generate extra code to write profile information suitable for the 11187analysis program @command{gprof}. You must use this option when compiling 11188the source files you want data about, and you must also use it when 11189linking. 11190 11191@item -fprofile-arcs 11192@opindex fprofile-arcs 11193Add code so that program flow @dfn{arcs} are instrumented. During 11194execution the program records how many times each branch and call is 11195executed and how many times it is taken or returns. On targets that support 11196constructors with priority support, profiling properly handles constructors, 11197destructors and C++ constructors (and destructors) of classes which are used 11198as a type of a global variable. 11199 11200When the compiled 11201program exits it saves this data to a file called 11202@file{@var{auxname}.gcda} for each source file. The data may be used for 11203profile-directed optimizations (@option{-fbranch-probabilities}), or for 11204test coverage analysis (@option{-ftest-coverage}). Each object file's 11205@var{auxname} is generated from the name of the output file, if 11206explicitly specified and it is not the final executable, otherwise it is 11207the basename of the source file. In both cases any suffix is removed 11208(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 11209@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 11210@xref{Cross-profiling}. 11211 11212@cindex @command{gcov} 11213@item --coverage 11214@opindex coverage 11215 11216This option is used to compile and link code instrumented for coverage 11217analysis. The option is a synonym for @option{-fprofile-arcs} 11218@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 11219linking). See the documentation for those options for more details. 11220 11221@itemize 11222 11223@item 11224Compile the source files with @option{-fprofile-arcs} plus optimization 11225and code generation options. For test coverage analysis, use the 11226additional @option{-ftest-coverage} option. You do not need to profile 11227every source file in a program. 11228 11229@item 11230Compile the source files additionally with @option{-fprofile-abs-path} 11231to create absolute path names in the @file{.gcno} files. This allows 11232@command{gcov} to find the correct sources in projects where compilations 11233occur with different working directories. 11234 11235@item 11236Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 11237(the latter implies the former). 11238 11239@item 11240Run the program on a representative workload to generate the arc profile 11241information. This may be repeated any number of times. You can run 11242concurrent instances of your program, and provided that the file system 11243supports locking, the data files will be correctly updated. Unless 11244a strict ISO C dialect option is in effect, @code{fork} calls are 11245detected and correctly handled without double counting. 11246 11247@item 11248For profile-directed optimizations, compile the source files again with 11249the same optimization and code generation options plus 11250@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 11251Control Optimization}). 11252 11253@item 11254For test coverage analysis, use @command{gcov} to produce human readable 11255information from the @file{.gcno} and @file{.gcda} files. Refer to the 11256@command{gcov} documentation for further information. 11257 11258@end itemize 11259 11260With @option{-fprofile-arcs}, for each function of your program GCC 11261creates a program flow graph, then finds a spanning tree for the graph. 11262Only arcs that are not on the spanning tree have to be instrumented: the 11263compiler adds code to count the number of times that these arcs are 11264executed. When an arc is the only exit or only entrance to a block, the 11265instrumentation code can be added to the block; otherwise, a new basic 11266block must be created to hold the instrumentation code. 11267 11268@need 2000 11269@item -ftest-coverage 11270@opindex ftest-coverage 11271Produce a notes file that the @command{gcov} code-coverage utility 11272(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 11273show program coverage. Each source file's note file is called 11274@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 11275above for a description of @var{auxname} and instructions on how to 11276generate test coverage data. Coverage data matches the source files 11277more closely if you do not optimize. 11278 11279@item -fprofile-abs-path 11280@opindex fprofile-abs-path 11281Automatically convert relative source file names to absolute path names 11282in the @file{.gcno} files. This allows @command{gcov} to find the correct 11283sources in projects where compilations occur with different working 11284directories. 11285 11286@item -fprofile-dir=@var{path} 11287@opindex fprofile-dir 11288 11289Set the directory to search for the profile data files in to @var{path}. 11290This option affects only the profile data generated by 11291@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 11292and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 11293and its related options. Both absolute and relative paths can be used. 11294By default, GCC uses the current directory as @var{path}, thus the 11295profile data file appears in the same directory as the object file. 11296 11297@item -fprofile-generate 11298@itemx -fprofile-generate=@var{path} 11299@opindex fprofile-generate 11300 11301Enable options usually used for instrumenting application to produce 11302profile useful for later recompilation with profile feedback based 11303optimization. You must use @option{-fprofile-generate} both when 11304compiling and when linking your program. 11305 11306The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}. 11307 11308If @var{path} is specified, GCC looks at the @var{path} to find 11309the profile feedback data files. See @option{-fprofile-dir}. 11310 11311To optimize the program based on the collected profile information, use 11312@option{-fprofile-use}. @xref{Optimize Options}, for more information. 11313 11314@item -fprofile-update=@var{method} 11315@opindex fprofile-update 11316 11317Alter the update method for an application instrumented for profile 11318feedback based optimization. The @var{method} argument should be one of 11319@samp{single}, @samp{atomic} or @samp{prefer-atomic}. 11320The first one is useful for single-threaded applications, 11321while the second one prevents profile corruption by emitting thread-safe code. 11322 11323@strong{Warning:} When an application does not properly join all threads 11324(or creates an detached thread), a profile file can be still corrupted. 11325 11326Using @samp{prefer-atomic} would be transformed either to @samp{atomic}, 11327when supported by a target, or to @samp{single} otherwise. The GCC driver 11328automatically selects @samp{prefer-atomic} when @option{-pthread} 11329is present in the command line. 11330 11331@item -fsanitize=address 11332@opindex fsanitize=address 11333Enable AddressSanitizer, a fast memory error detector. 11334Memory access instructions are instrumented to detect 11335out-of-bounds and use-after-free bugs. 11336The option enables @option{-fsanitize-address-use-after-scope}. 11337See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 11338more details. The run-time behavior can be influenced using the 11339@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 11340the available options are shown at startup of the instrumented program. See 11341@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 11342for a list of supported options. 11343The option cannot be combined with @option{-fsanitize=thread} 11344and/or @option{-fcheck-pointer-bounds}. 11345 11346@item -fsanitize=kernel-address 11347@opindex fsanitize=kernel-address 11348Enable AddressSanitizer for Linux kernel. 11349See @uref{https://github.com/google/kasan/wiki} for more details. 11350The option cannot be combined with @option{-fcheck-pointer-bounds}. 11351 11352@item -fsanitize=pointer-compare 11353@opindex fsanitize=pointer-compare 11354Instrument comparison operation (<, <=, >, >=) with pointer operands. 11355The option must be combined with either @option{-fsanitize=kernel-address} or 11356@option{-fsanitize=address} 11357The option cannot be combined with @option{-fsanitize=thread} 11358and/or @option{-fcheck-pointer-bounds}. 11359Note: By default the check is disabled at run time. To enable it, 11360add @code{detect_invalid_pointer_pairs=2} to the environment variable 11361@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 11362invalid operation only when both pointers are non-null. 11363 11364@item -fsanitize=pointer-subtract 11365@opindex fsanitize=pointer-subtract 11366Instrument subtraction with pointer operands. 11367The option must be combined with either @option{-fsanitize=kernel-address} or 11368@option{-fsanitize=address} 11369The option cannot be combined with @option{-fsanitize=thread} 11370and/or @option{-fcheck-pointer-bounds}. 11371Note: By default the check is disabled at run time. To enable it, 11372add @code{detect_invalid_pointer_pairs=2} to the environment variable 11373@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects 11374invalid operation only when both pointers are non-null. 11375 11376@item -fsanitize=thread 11377@opindex fsanitize=thread 11378Enable ThreadSanitizer, a fast data race detector. 11379Memory access instructions are instrumented to detect 11380data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 11381details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 11382environment variable; see 11383@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 11384supported options. 11385The option cannot be combined with @option{-fsanitize=address}, 11386@option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}. 11387 11388Note that sanitized atomic builtins cannot throw exceptions when 11389operating on invalid memory addresses with non-call exceptions 11390(@option{-fnon-call-exceptions}). 11391 11392@item -fsanitize=leak 11393@opindex fsanitize=leak 11394Enable LeakSanitizer, a memory leak detector. 11395This option only matters for linking of executables and 11396the executable is linked against a library that overrides @code{malloc} 11397and other allocator functions. See 11398@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 11399details. The run-time behavior can be influenced using the 11400@env{LSAN_OPTIONS} environment variable. 11401The option cannot be combined with @option{-fsanitize=thread}. 11402 11403@item -fsanitize=undefined 11404@opindex fsanitize=undefined 11405Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 11406Various computations are instrumented to detect undefined behavior 11407at runtime. Current suboptions are: 11408 11409@table @gcctabopt 11410 11411@item -fsanitize=shift 11412@opindex fsanitize=shift 11413This option enables checking that the result of a shift operation is 11414not undefined. Note that what exactly is considered undefined differs 11415slightly between C and C++, as well as between ISO C90 and C99, etc. 11416This option has two suboptions, @option{-fsanitize=shift-base} and 11417@option{-fsanitize=shift-exponent}. 11418 11419@item -fsanitize=shift-exponent 11420@opindex fsanitize=shift-exponent 11421This option enables checking that the second argument of a shift operation 11422is not negative and is smaller than the precision of the promoted first 11423argument. 11424 11425@item -fsanitize=shift-base 11426@opindex fsanitize=shift-base 11427If the second argument of a shift operation is within range, check that the 11428result of a shift operation is not undefined. Note that what exactly is 11429considered undefined differs slightly between C and C++, as well as between 11430ISO C90 and C99, etc. 11431 11432@item -fsanitize=integer-divide-by-zero 11433@opindex fsanitize=integer-divide-by-zero 11434Detect integer division by zero as well as @code{INT_MIN / -1} division. 11435 11436@item -fsanitize=unreachable 11437@opindex fsanitize=unreachable 11438With this option, the compiler turns the @code{__builtin_unreachable} 11439call into a diagnostics message call instead. When reaching the 11440@code{__builtin_unreachable} call, the behavior is undefined. 11441 11442@item -fsanitize=vla-bound 11443@opindex fsanitize=vla-bound 11444This option instructs the compiler to check that the size of a variable 11445length array is positive. 11446 11447@item -fsanitize=null 11448@opindex fsanitize=null 11449This option enables pointer checking. Particularly, the application 11450built with this option turned on will issue an error message when it 11451tries to dereference a NULL pointer, or if a reference (possibly an 11452rvalue reference) is bound to a NULL pointer, or if a method is invoked 11453on an object pointed by a NULL pointer. 11454 11455@item -fsanitize=return 11456@opindex fsanitize=return 11457This option enables return statement checking. Programs 11458built with this option turned on will issue an error message 11459when the end of a non-void function is reached without actually 11460returning a value. This option works in C++ only. 11461 11462@item -fsanitize=signed-integer-overflow 11463@opindex fsanitize=signed-integer-overflow 11464This option enables signed integer overflow checking. We check that 11465the result of @code{+}, @code{*}, and both unary and binary @code{-} 11466does not overflow in the signed arithmetics. Note, integer promotion 11467rules must be taken into account. That is, the following is not an 11468overflow: 11469@smallexample 11470signed char a = SCHAR_MAX; 11471a++; 11472@end smallexample 11473 11474@item -fsanitize=bounds 11475@opindex fsanitize=bounds 11476This option enables instrumentation of array bounds. Various out of bounds 11477accesses are detected. Flexible array members, flexible array member-like 11478arrays, and initializers of variables with static storage are not instrumented. 11479The option cannot be combined with @option{-fcheck-pointer-bounds}. 11480 11481@item -fsanitize=bounds-strict 11482@opindex fsanitize=bounds-strict 11483This option enables strict instrumentation of array bounds. Most out of bounds 11484accesses are detected, including flexible array members and flexible array 11485member-like arrays. Initializers of variables with static storage are not 11486instrumented. The option cannot be combined 11487with @option{-fcheck-pointer-bounds}. 11488 11489@item -fsanitize=alignment 11490@opindex fsanitize=alignment 11491 11492This option enables checking of alignment of pointers when they are 11493dereferenced, or when a reference is bound to insufficiently aligned target, 11494or when a method or constructor is invoked on insufficiently aligned object. 11495 11496@item -fsanitize=object-size 11497@opindex fsanitize=object-size 11498This option enables instrumentation of memory references using the 11499@code{__builtin_object_size} function. Various out of bounds pointer 11500accesses are detected. 11501 11502@item -fsanitize=float-divide-by-zero 11503@opindex fsanitize=float-divide-by-zero 11504Detect floating-point division by zero. Unlike other similar options, 11505@option{-fsanitize=float-divide-by-zero} is not enabled by 11506@option{-fsanitize=undefined}, since floating-point division by zero can 11507be a legitimate way of obtaining infinities and NaNs. 11508 11509@item -fsanitize=float-cast-overflow 11510@opindex fsanitize=float-cast-overflow 11511This option enables floating-point type to integer conversion checking. 11512We check that the result of the conversion does not overflow. 11513Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 11514not enabled by @option{-fsanitize=undefined}. 11515This option does not work well with @code{FE_INVALID} exceptions enabled. 11516 11517@item -fsanitize=nonnull-attribute 11518@opindex fsanitize=nonnull-attribute 11519 11520This option enables instrumentation of calls, checking whether null values 11521are not passed to arguments marked as requiring a non-null value by the 11522@code{nonnull} function attribute. 11523 11524@item -fsanitize=returns-nonnull-attribute 11525@opindex fsanitize=returns-nonnull-attribute 11526 11527This option enables instrumentation of return statements in functions 11528marked with @code{returns_nonnull} function attribute, to detect returning 11529of null values from such functions. 11530 11531@item -fsanitize=bool 11532@opindex fsanitize=bool 11533 11534This option enables instrumentation of loads from bool. If a value other 11535than 0/1 is loaded, a run-time error is issued. 11536 11537@item -fsanitize=enum 11538@opindex fsanitize=enum 11539 11540This option enables instrumentation of loads from an enum type. If 11541a value outside the range of values for the enum type is loaded, 11542a run-time error is issued. 11543 11544@item -fsanitize=vptr 11545@opindex fsanitize=vptr 11546 11547This option enables instrumentation of C++ member function calls, member 11548accesses and some conversions between pointers to base and derived classes, 11549to verify the referenced object has the correct dynamic type. 11550 11551@item -fsanitize=pointer-overflow 11552@opindex fsanitize=pointer-overflow 11553 11554This option enables instrumentation of pointer arithmetics. If the pointer 11555arithmetics overflows, a run-time error is issued. 11556 11557@item -fsanitize=builtin 11558@opindex fsanitize=builtin 11559 11560This option enables instrumentation of arguments to selected builtin 11561functions. If an invalid value is passed to such arguments, a run-time 11562error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz} 11563or @code{__builtin_clz} invokes undefined behavior and is diagnosed 11564by this option. 11565 11566@end table 11567 11568While @option{-ftrapv} causes traps for signed overflows to be emitted, 11569@option{-fsanitize=undefined} gives a diagnostic message. 11570This currently works only for the C family of languages. 11571 11572@item -fno-sanitize=all 11573@opindex fno-sanitize=all 11574 11575This option disables all previously enabled sanitizers. 11576@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 11577together. 11578 11579@item -fasan-shadow-offset=@var{number} 11580@opindex fasan-shadow-offset 11581This option forces GCC to use custom shadow offset in AddressSanitizer checks. 11582It is useful for experimenting with different shadow memory layouts in 11583Kernel AddressSanitizer. 11584 11585@item -fsanitize-sections=@var{s1},@var{s2},... 11586@opindex fsanitize-sections 11587Sanitize global variables in selected user-defined sections. @var{si} may 11588contain wildcards. 11589 11590@item -fsanitize-recover@r{[}=@var{opts}@r{]} 11591@opindex fsanitize-recover 11592@opindex fno-sanitize-recover 11593@option{-fsanitize-recover=} controls error recovery mode for sanitizers 11594mentioned in comma-separated list of @var{opts}. Enabling this option 11595for a sanitizer component causes it to attempt to continue 11596running the program as if no error happened. This means multiple 11597runtime errors can be reported in a single program run, and the exit 11598code of the program may indicate success even when errors 11599have been reported. The @option{-fno-sanitize-recover=} option 11600can be used to alter 11601this behavior: only the first detected error is reported 11602and program then exits with a non-zero exit code. 11603 11604Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 11605except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 11606@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero}, 11607@option{-fsanitize=bounds-strict}, 11608@option{-fsanitize=kernel-address} and @option{-fsanitize=address}. 11609For these sanitizers error recovery is turned on by default, 11610except @option{-fsanitize=address}, for which this feature is experimental. 11611@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 11612accepted, the former enables recovery for all sanitizers that support it, 11613the latter disables recovery for all sanitizers that support it. 11614 11615Even if a recovery mode is turned on the compiler side, it needs to be also 11616enabled on the runtime library side, otherwise the failures are still fatal. 11617The runtime library defaults to @code{halt_on_error=0} for 11618ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for 11619AddressSanitizer is @code{halt_on_error=1}. This can be overridden through 11620setting the @code{halt_on_error} flag in the corresponding environment variable. 11621 11622Syntax without an explicit @var{opts} parameter is deprecated. It is 11623equivalent to specifying an @var{opts} list of: 11624 11625@smallexample 11626undefined,float-cast-overflow,float-divide-by-zero,bounds-strict 11627@end smallexample 11628 11629@item -fsanitize-address-use-after-scope 11630@opindex fsanitize-address-use-after-scope 11631Enable sanitization of local variables to detect use-after-scope bugs. 11632The option sets @option{-fstack-reuse} to @samp{none}. 11633 11634@item -fsanitize-undefined-trap-on-error 11635@opindex fsanitize-undefined-trap-on-error 11636The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 11637report undefined behavior using @code{__builtin_trap} rather than 11638a @code{libubsan} library routine. The advantage of this is that the 11639@code{libubsan} library is not needed and is not linked in, so this 11640is usable even in freestanding environments. 11641 11642@item -fsanitize-coverage=trace-pc 11643@opindex fsanitize-coverage=trace-pc 11644Enable coverage-guided fuzzing code instrumentation. 11645Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block. 11646 11647@item -fsanitize-coverage=trace-cmp 11648@opindex fsanitize-coverage=trace-cmp 11649Enable dataflow guided fuzzing code instrumentation. 11650Inserts a call to @code{__sanitizer_cov_trace_cmp1}, 11651@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or 11652@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands 11653variable or @code{__sanitizer_cov_trace_const_cmp1}, 11654@code{__sanitizer_cov_trace_const_cmp2}, 11655@code{__sanitizer_cov_trace_const_cmp4} or 11656@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one 11657operand constant, @code{__sanitizer_cov_trace_cmpf} or 11658@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and 11659@code{__sanitizer_cov_trace_switch} for switch statements. 11660 11661@item -fbounds-check 11662@opindex fbounds-check 11663For front ends that support it, generate additional code to check that 11664indices used to access arrays are within the declared range. This is 11665currently only supported by the Fortran front end, where this option 11666defaults to false. 11667 11668@item -fcheck-pointer-bounds 11669@opindex fcheck-pointer-bounds 11670@opindex fno-check-pointer-bounds 11671@cindex Pointer Bounds Checker options 11672Enable Pointer Bounds Checker instrumentation. Each memory reference 11673is instrumented with checks of the pointer used for memory access against 11674bounds associated with that pointer. 11675 11676Currently there 11677is only an implementation for Intel MPX available, thus x86 GNU/Linux target 11678and @option{-mmpx} are required to enable this feature. 11679MPX-based instrumentation requires 11680a runtime library to enable MPX in hardware and handle bounds 11681violation signals. By default when @option{-fcheck-pointer-bounds} 11682and @option{-mmpx} options are used to link a program, the GCC driver 11683links against the @file{libmpx} and @file{libmpxwrappers} libraries. 11684Bounds checking on calls to dynamic libraries requires a linker 11685with @option{-z bndplt} support; if GCC was configured with a linker 11686without support for this option (including the Gold linker and older 11687versions of ld), a warning is given if you link with @option{-mmpx} 11688without also specifying @option{-static}, since the overall effectiveness 11689of the bounds checking protection is reduced. 11690See also @option{-static-libmpxwrappers}. 11691 11692MPX-based instrumentation 11693may be used for debugging and also may be included in production code 11694to increase program security. Depending on usage, you may 11695have different requirements for the runtime library. The current version 11696of the MPX runtime library is more oriented for use as a debugging 11697tool. MPX runtime library usage implies @option{-lpthread}. See 11698also @option{-static-libmpx}. The runtime library behavior can be 11699influenced using various @env{CHKP_RT_*} environment variables. See 11700@uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler} 11701for more details. 11702 11703Generated instrumentation may be controlled by various 11704@option{-fchkp-*} options and by the @code{bnd_variable_size} 11705structure field attribute (@pxref{Type Attributes}) and 11706@code{bnd_legacy}, and @code{bnd_instrument} function attributes 11707(@pxref{Function Attributes}). GCC also provides a number of built-in 11708functions for controlling the Pointer Bounds Checker. @xref{Pointer 11709Bounds Checker builtins}, for more information. 11710 11711@item -fchkp-check-incomplete-type 11712@opindex fchkp-check-incomplete-type 11713@opindex fno-chkp-check-incomplete-type 11714Generate pointer bounds checks for variables with incomplete type. 11715Enabled by default. 11716 11717@item -fchkp-narrow-bounds 11718@opindex fchkp-narrow-bounds 11719@opindex fno-chkp-narrow-bounds 11720Controls bounds used by Pointer Bounds Checker for pointers to object 11721fields. If narrowing is enabled then field bounds are used. Otherwise 11722object bounds are used. See also @option{-fchkp-narrow-to-innermost-array} 11723and @option{-fchkp-first-field-has-own-bounds}. Enabled by default. 11724 11725@item -fchkp-first-field-has-own-bounds 11726@opindex fchkp-first-field-has-own-bounds 11727@opindex fno-chkp-first-field-has-own-bounds 11728Forces Pointer Bounds Checker to use narrowed bounds for the address of the 11729first field in the structure. By default a pointer to the first field has 11730the same bounds as a pointer to the whole structure. 11731 11732@item -fchkp-flexible-struct-trailing-arrays 11733@opindex fchkp-flexible-struct-trailing-arrays 11734@opindex fno-chkp-flexible-struct-trailing-arrays 11735Forces Pointer Bounds Checker to treat all trailing arrays in structures as 11736possibly flexible. By default only array fields with zero length or that are 11737marked with attribute bnd_variable_size are treated as flexible. 11738 11739@item -fchkp-narrow-to-innermost-array 11740@opindex fchkp-narrow-to-innermost-array 11741@opindex fno-chkp-narrow-to-innermost-array 11742Forces Pointer Bounds Checker to use bounds of the innermost arrays in 11743case of nested static array access. By default this option is disabled and 11744bounds of the outermost array are used. 11745 11746@item -fchkp-optimize 11747@opindex fchkp-optimize 11748@opindex fno-chkp-optimize 11749Enables Pointer Bounds Checker optimizations. Enabled by default at 11750optimization levels @option{-O}, @option{-O2}, @option{-O3}. 11751 11752@item -fchkp-use-fast-string-functions 11753@opindex fchkp-use-fast-string-functions 11754@opindex fno-chkp-use-fast-string-functions 11755Enables use of @code{*_nobnd} versions of string functions (not copying bounds) 11756by Pointer Bounds Checker. Disabled by default. 11757 11758@item -fchkp-use-nochk-string-functions 11759@opindex fchkp-use-nochk-string-functions 11760@opindex fno-chkp-use-nochk-string-functions 11761Enables use of @code{*_nochk} versions of string functions (not checking bounds) 11762by Pointer Bounds Checker. Disabled by default. 11763 11764@item -fchkp-use-static-bounds 11765@opindex fchkp-use-static-bounds 11766@opindex fno-chkp-use-static-bounds 11767Allow Pointer Bounds Checker to generate static bounds holding 11768bounds of static variables. Enabled by default. 11769 11770@item -fchkp-use-static-const-bounds 11771@opindex fchkp-use-static-const-bounds 11772@opindex fno-chkp-use-static-const-bounds 11773Use statically-initialized bounds for constant bounds instead of 11774generating them each time they are required. By default enabled when 11775@option{-fchkp-use-static-bounds} is enabled. 11776 11777@item -fchkp-treat-zero-dynamic-size-as-infinite 11778@opindex fchkp-treat-zero-dynamic-size-as-infinite 11779@opindex fno-chkp-treat-zero-dynamic-size-as-infinite 11780With this option, objects with incomplete type whose 11781dynamically-obtained size is zero are treated as having infinite size 11782instead by Pointer Bounds 11783Checker. This option may be helpful if a program is linked with a library 11784missing size information for some symbols. Disabled by default. 11785 11786@item -fchkp-check-read 11787@opindex fchkp-check-read 11788@opindex fno-chkp-check-read 11789Instructs Pointer Bounds Checker to generate checks for all read 11790accesses to memory. Enabled by default. 11791 11792@item -fchkp-check-write 11793@opindex fchkp-check-write 11794@opindex fno-chkp-check-write 11795Instructs Pointer Bounds Checker to generate checks for all write 11796accesses to memory. Enabled by default. 11797 11798@item -fchkp-store-bounds 11799@opindex fchkp-store-bounds 11800@opindex fno-chkp-store-bounds 11801Instructs Pointer Bounds Checker to generate bounds stores for 11802pointer writes. Enabled by default. 11803 11804@item -fchkp-instrument-calls 11805@opindex fchkp-instrument-calls 11806@opindex fno-chkp-instrument-calls 11807Instructs Pointer Bounds Checker to pass pointer bounds to calls. 11808Enabled by default. 11809 11810@item -fchkp-instrument-marked-only 11811@opindex fchkp-instrument-marked-only 11812@opindex fno-chkp-instrument-marked-only 11813Instructs Pointer Bounds Checker to instrument only functions 11814marked with the @code{bnd_instrument} attribute 11815(@pxref{Function Attributes}). Disabled by default. 11816 11817@item -fchkp-use-wrappers 11818@opindex fchkp-use-wrappers 11819@opindex fno-chkp-use-wrappers 11820Allows Pointer Bounds Checker to replace calls to built-in functions 11821with calls to wrapper functions. When @option{-fchkp-use-wrappers} 11822is used to link a program, the GCC driver automatically links 11823against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}. 11824Enabled by default. 11825 11826@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} 11827@opindex fcf-protection 11828Enable code instrumentation of control-flow transfers to increase 11829program security by checking that target addresses of control-flow 11830transfer instructions (such as indirect function call, function return, 11831indirect jump) are valid. This prevents diverting the flow of control 11832to an unexpected target. This is intended to protect against such 11833threats as Return-oriented Programming (ROP), and similarly 11834call/jmp-oriented programming (COP/JOP). 11835 11836The value @code{branch} tells the compiler to implement checking of 11837validity of control-flow transfer at the point of indirect branch 11838instructions, i.e. call/jmp instructions. The value @code{return} 11839implements checking of validity at the point of returning from a 11840function. The value @code{full} is an alias for specifying both 11841@code{branch} and @code{return}. The value @code{none} turns off 11842instrumentation. 11843 11844The macro @code{__CET__} is defined when @option{-fcf-protection} is 11845used. The first bit of @code{__CET__} is set to 1 for the value 11846@code{branch} and the second bit of @code{__CET__} is set to 1 for 11847the @code{return}. 11848 11849You can also use the @code{nocf_check} attribute to identify 11850which functions and calls should be skipped from instrumentation 11851(@pxref{Function Attributes}). 11852 11853Currently the x86 GNU/Linux target provides an implementation based 11854on Intel Control-flow Enforcement Technology (CET). 11855 11856@item -fstack-protector 11857@opindex fstack-protector 11858Emit extra code to check for buffer overflows, such as stack smashing 11859attacks. This is done by adding a guard variable to functions with 11860vulnerable objects. This includes functions that call @code{alloca}, and 11861functions with buffers larger than 8 bytes. The guards are initialized 11862when a function is entered and then checked when the function exits. 11863If a guard check fails, an error message is printed and the program exits. 11864 11865@item -fstack-protector-all 11866@opindex fstack-protector-all 11867Like @option{-fstack-protector} except that all functions are protected. 11868 11869@item -fstack-protector-strong 11870@opindex fstack-protector-strong 11871Like @option{-fstack-protector} but includes additional functions to 11872be protected --- those that have local array definitions, or have 11873references to local frame addresses. 11874 11875@item -fstack-protector-explicit 11876@opindex fstack-protector-explicit 11877Like @option{-fstack-protector} but only protects those functions which 11878have the @code{stack_protect} attribute. 11879 11880@item -fstack-check 11881@opindex fstack-check 11882Generate code to verify that you do not go beyond the boundary of the 11883stack. You should specify this flag if you are running in an 11884environment with multiple threads, but you only rarely need to specify it in 11885a single-threaded environment since stack overflow is automatically 11886detected on nearly all systems if there is only one stack. 11887 11888Note that this switch does not actually cause checking to be done; the 11889operating system or the language runtime must do that. The switch causes 11890generation of code to ensure that they see the stack being extended. 11891 11892You can additionally specify a string parameter: @samp{no} means no 11893checking, @samp{generic} means force the use of old-style checking, 11894@samp{specific} means use the best checking method and is equivalent 11895to bare @option{-fstack-check}. 11896 11897Old-style checking is a generic mechanism that requires no specific 11898target support in the compiler but comes with the following drawbacks: 11899 11900@enumerate 11901@item 11902Modified allocation strategy for large objects: they are always 11903allocated dynamically if their size exceeds a fixed threshold. Note this 11904may change the semantics of some code. 11905 11906@item 11907Fixed limit on the size of the static frame of functions: when it is 11908topped by a particular function, stack checking is not reliable and 11909a warning is issued by the compiler. 11910 11911@item 11912Inefficiency: because of both the modified allocation strategy and the 11913generic implementation, code performance is hampered. 11914@end enumerate 11915 11916Note that old-style stack checking is also the fallback method for 11917@samp{specific} if no target support has been added in the compiler. 11918 11919@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion 11920and stack overflows. @samp{specific} is an excellent choice when compiling 11921Ada code. It is not generally sufficient to protect against stack-clash 11922attacks. To protect against those you want @samp{-fstack-clash-protection}. 11923 11924@item -fstack-clash-protection 11925@opindex fstack-clash-protection 11926Generate code to prevent stack clash style attacks. When this option is 11927enabled, the compiler will only allocate one page of stack space at a time 11928and each page is accessed immediately after allocation. Thus, it prevents 11929allocations from jumping over any stack guard page provided by the 11930operating system. 11931 11932Most targets do not fully support stack clash protection. However, on 11933those targets @option{-fstack-clash-protection} will protect dynamic stack 11934allocations. @option{-fstack-clash-protection} may also provide limited 11935protection for static stack allocations if the target supports 11936@option{-fstack-check=specific}. 11937 11938@item -fstack-limit-register=@var{reg} 11939@itemx -fstack-limit-symbol=@var{sym} 11940@itemx -fno-stack-limit 11941@opindex fstack-limit-register 11942@opindex fstack-limit-symbol 11943@opindex fno-stack-limit 11944Generate code to ensure that the stack does not grow beyond a certain value, 11945either the value of a register or the address of a symbol. If a larger 11946stack is required, a signal is raised at run time. For most targets, 11947the signal is raised before the stack overruns the boundary, so 11948it is possible to catch the signal without taking special precautions. 11949 11950For instance, if the stack starts at absolute address @samp{0x80000000} 11951and grows downwards, you can use the flags 11952@option{-fstack-limit-symbol=__stack_limit} and 11953@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 11954of 128KB@. Note that this may only work with the GNU linker. 11955 11956You can locally override stack limit checking by using the 11957@code{no_stack_limit} function attribute (@pxref{Function Attributes}). 11958 11959@item -fsplit-stack 11960@opindex fsplit-stack 11961Generate code to automatically split the stack before it overflows. 11962The resulting program has a discontiguous stack which can only 11963overflow if the program is unable to allocate any more memory. This 11964is most useful when running threaded programs, as it is no longer 11965necessary to calculate a good stack size to use for each thread. This 11966is currently only implemented for the x86 targets running 11967GNU/Linux. 11968 11969When code compiled with @option{-fsplit-stack} calls code compiled 11970without @option{-fsplit-stack}, there may not be much stack space 11971available for the latter code to run. If compiling all code, 11972including library code, with @option{-fsplit-stack} is not an option, 11973then the linker can fix up these calls so that the code compiled 11974without @option{-fsplit-stack} always has a large stack. Support for 11975this is implemented in the gold linker in GNU binutils release 2.21 11976and later. 11977 11978@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 11979@opindex fvtable-verify 11980This option is only available when compiling C++ code. 11981It turns on (or off, if using @option{-fvtable-verify=none}) the security 11982feature that verifies at run time, for every virtual call, that 11983the vtable pointer through which the call is made is valid for the type of 11984the object, and has not been corrupted or overwritten. If an invalid vtable 11985pointer is detected at run time, an error is reported and execution of the 11986program is immediately halted. 11987 11988This option causes run-time data structures to be built at program startup, 11989which are used for verifying the vtable pointers. 11990The options @samp{std} and @samp{preinit} 11991control the timing of when these data structures are built. In both cases the 11992data structures are built before execution reaches @code{main}. Using 11993@option{-fvtable-verify=std} causes the data structures to be built after 11994shared libraries have been loaded and initialized. 11995@option{-fvtable-verify=preinit} causes them to be built before shared 11996libraries have been loaded and initialized. 11997 11998If this option appears multiple times in the command line with different 11999values specified, @samp{none} takes highest priority over both @samp{std} and 12000@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 12001 12002@item -fvtv-debug 12003@opindex fvtv-debug 12004When used in conjunction with @option{-fvtable-verify=std} or 12005@option{-fvtable-verify=preinit}, causes debug versions of the 12006runtime functions for the vtable verification feature to be called. 12007This flag also causes the compiler to log information about which 12008vtable pointers it finds for each class. 12009This information is written to a file named @file{vtv_set_ptr_data.log} 12010in the directory named by the environment variable @env{VTV_LOGS_DIR} 12011if that is defined or the current working directory otherwise. 12012 12013Note: This feature @emph{appends} data to the log file. If you want a fresh log 12014file, be sure to delete any existing one. 12015 12016@item -fvtv-counts 12017@opindex fvtv-counts 12018This is a debugging flag. When used in conjunction with 12019@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 12020causes the compiler to keep track of the total number of virtual calls 12021it encounters and the number of verifications it inserts. It also 12022counts the number of calls to certain run-time library functions 12023that it inserts and logs this information for each compilation unit. 12024The compiler writes this information to a file named 12025@file{vtv_count_data.log} in the directory named by the environment 12026variable @env{VTV_LOGS_DIR} if that is defined or the current working 12027directory otherwise. It also counts the size of the vtable pointer sets 12028for each class, and writes this information to @file{vtv_class_set_sizes.log} 12029in the same directory. 12030 12031Note: This feature @emph{appends} data to the log files. To get fresh log 12032files, be sure to delete any existing ones. 12033 12034@item -finstrument-functions 12035@opindex finstrument-functions 12036Generate instrumentation calls for entry and exit to functions. Just 12037after function entry and just before function exit, the following 12038profiling functions are called with the address of the current 12039function and its call site. (On some platforms, 12040@code{__builtin_return_address} does not work beyond the current 12041function, so the call site information may not be available to the 12042profiling functions otherwise.) 12043 12044@smallexample 12045void __cyg_profile_func_enter (void *this_fn, 12046 void *call_site); 12047void __cyg_profile_func_exit (void *this_fn, 12048 void *call_site); 12049@end smallexample 12050 12051The first argument is the address of the start of the current function, 12052which may be looked up exactly in the symbol table. 12053 12054This instrumentation is also done for functions expanded inline in other 12055functions. The profiling calls indicate where, conceptually, the 12056inline function is entered and exited. This means that addressable 12057versions of such functions must be available. If all your uses of a 12058function are expanded inline, this may mean an additional expansion of 12059code size. If you use @code{extern inline} in your C code, an 12060addressable version of such functions must be provided. (This is 12061normally the case anyway, but if you get lucky and the optimizer always 12062expands the functions inline, you might have gotten away without 12063providing static copies.) 12064 12065A function may be given the attribute @code{no_instrument_function}, in 12066which case this instrumentation is not done. This can be used, for 12067example, for the profiling functions listed above, high-priority 12068interrupt routines, and any functions from which the profiling functions 12069cannot safely be called (perhaps signal handlers, if the profiling 12070routines generate output or allocate memory). 12071 12072@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 12073@opindex finstrument-functions-exclude-file-list 12074 12075Set the list of functions that are excluded from instrumentation (see 12076the description of @option{-finstrument-functions}). If the file that 12077contains a function definition matches with one of @var{file}, then 12078that function is not instrumented. The match is done on substrings: 12079if the @var{file} parameter is a substring of the file name, it is 12080considered to be a match. 12081 12082For example: 12083 12084@smallexample 12085-finstrument-functions-exclude-file-list=/bits/stl,include/sys 12086@end smallexample 12087 12088@noindent 12089excludes any inline function defined in files whose pathnames 12090contain @file{/bits/stl} or @file{include/sys}. 12091 12092If, for some reason, you want to include letter @samp{,} in one of 12093@var{sym}, write @samp{\,}. For example, 12094@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 12095(note the single quote surrounding the option). 12096 12097@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 12098@opindex finstrument-functions-exclude-function-list 12099 12100This is similar to @option{-finstrument-functions-exclude-file-list}, 12101but this option sets the list of function names to be excluded from 12102instrumentation. The function name to be matched is its user-visible 12103name, such as @code{vector<int> blah(const vector<int> &)}, not the 12104internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 12105match is done on substrings: if the @var{sym} parameter is a substring 12106of the function name, it is considered to be a match. For C99 and C++ 12107extended identifiers, the function name must be given in UTF-8, not 12108using universal character names. 12109 12110@item -fpatchable-function-entry=@var{N}[,@var{M}] 12111@opindex fpatchable-function-entry 12112Generate @var{N} NOPs right at the beginning 12113of each function, with the function entry point before the @var{M}th NOP. 12114If @var{M} is omitted, it defaults to @code{0} so the 12115function entry points to the address just at the first NOP. 12116The NOP instructions reserve extra space which can be used to patch in 12117any desired instrumentation at run time, provided that the code segment 12118is writable. The amount of space is controllable indirectly via 12119the number of NOPs; the NOP instruction used corresponds to the instruction 12120emitted by the internal GCC back-end interface @code{gen_nop}. This behavior 12121is target-specific and may also depend on the architecture variant and/or 12122other compilation options. 12123 12124For run-time identification, the starting addresses of these areas, 12125which correspond to their respective function entries minus @var{M}, 12126are additionally collected in the @code{__patchable_function_entries} 12127section of the resulting binary. 12128 12129Note that the value of @code{__attribute__ ((patchable_function_entry 12130(N,M)))} takes precedence over command-line option 12131@option{-fpatchable-function-entry=N,M}. This can be used to increase 12132the area size or to remove it completely on a single function. 12133If @code{N=0}, no pad location is recorded. 12134 12135The NOP instructions are inserted at---and maybe before, depending on 12136@var{M}---the function entry address, even before the prologue. 12137 12138@end table 12139 12140 12141@node Preprocessor Options 12142@section Options Controlling the Preprocessor 12143@cindex preprocessor options 12144@cindex options, preprocessor 12145 12146These options control the C preprocessor, which is run on each C source 12147file before actual compilation. 12148 12149If you use the @option{-E} option, nothing is done except preprocessing. 12150Some of these options make sense only together with @option{-E} because 12151they cause the preprocessor output to be unsuitable for actual 12152compilation. 12153 12154In addition to the options listed here, there are a number of options 12155to control search paths for include files documented in 12156@ref{Directory Options}. 12157Options to control preprocessor diagnostics are listed in 12158@ref{Warning Options}. 12159 12160@table @gcctabopt 12161@include cppopts.texi 12162 12163@item -Wp,@var{option} 12164@opindex Wp 12165You can use @option{-Wp,@var{option}} to bypass the compiler driver 12166and pass @var{option} directly through to the preprocessor. If 12167@var{option} contains commas, it is split into multiple options at the 12168commas. However, many options are modified, translated or interpreted 12169by the compiler driver before being passed to the preprocessor, and 12170@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 12171interface is undocumented and subject to change, so whenever possible 12172you should avoid using @option{-Wp} and let the driver handle the 12173options instead. 12174 12175@item -Xpreprocessor @var{option} 12176@opindex Xpreprocessor 12177Pass @var{option} as an option to the preprocessor. You can use this to 12178supply system-specific preprocessor options that GCC does not 12179recognize. 12180 12181If you want to pass an option that takes an argument, you must use 12182@option{-Xpreprocessor} twice, once for the option and once for the argument. 12183 12184@item -no-integrated-cpp 12185@opindex no-integrated-cpp 12186Perform preprocessing as a separate pass before compilation. 12187By default, GCC performs preprocessing as an integrated part of 12188input tokenization and parsing. 12189If this option is provided, the appropriate language front end 12190(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 12191and Objective-C, respectively) is instead invoked twice, 12192once for preprocessing only and once for actual compilation 12193of the preprocessed input. 12194This option may be useful in conjunction with the @option{-B} or 12195@option{-wrapper} options to specify an alternate preprocessor or 12196perform additional processing of the program source between 12197normal preprocessing and compilation. 12198 12199@end table 12200 12201@node Assembler Options 12202@section Passing Options to the Assembler 12203 12204@c prevent bad page break with this line 12205You can pass options to the assembler. 12206 12207@table @gcctabopt 12208@item -Wa,@var{option} 12209@opindex Wa 12210Pass @var{option} as an option to the assembler. If @var{option} 12211contains commas, it is split into multiple options at the commas. 12212 12213@item -Xassembler @var{option} 12214@opindex Xassembler 12215Pass @var{option} as an option to the assembler. You can use this to 12216supply system-specific assembler options that GCC does not 12217recognize. 12218 12219If you want to pass an option that takes an argument, you must use 12220@option{-Xassembler} twice, once for the option and once for the argument. 12221 12222@end table 12223 12224@node Link Options 12225@section Options for Linking 12226@cindex link options 12227@cindex options, linking 12228 12229These options come into play when the compiler links object files into 12230an executable output file. They are meaningless if the compiler is 12231not doing a link step. 12232 12233@table @gcctabopt 12234@cindex file names 12235@item @var{object-file-name} 12236A file name that does not end in a special recognized suffix is 12237considered to name an object file or library. (Object files are 12238distinguished from libraries by the linker according to the file 12239contents.) If linking is done, these object files are used as input 12240to the linker. 12241 12242@item -c 12243@itemx -S 12244@itemx -E 12245@opindex c 12246@opindex S 12247@opindex E 12248If any of these options is used, then the linker is not run, and 12249object file names should not be used as arguments. @xref{Overall 12250Options}. 12251 12252@item -fuse-ld=bfd 12253@opindex fuse-ld=bfd 12254Use the @command{bfd} linker instead of the default linker. 12255 12256@item -fuse-ld=gold 12257@opindex fuse-ld=gold 12258Use the @command{gold} linker instead of the default linker. 12259 12260@cindex Libraries 12261@item -l@var{library} 12262@itemx -l @var{library} 12263@opindex l 12264Search the library named @var{library} when linking. (The second 12265alternative with the library as a separate argument is only for 12266POSIX compliance and is not recommended.) 12267 12268It makes a difference where in the command you write this option; the 12269linker searches and processes libraries and object files in the order they 12270are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 12271after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 12272to functions in @samp{z}, those functions may not be loaded. 12273 12274The linker searches a standard list of directories for the library, 12275which is actually a file named @file{lib@var{library}.a}. The linker 12276then uses this file as if it had been specified precisely by name. 12277 12278The directories searched include several standard system directories 12279plus any that you specify with @option{-L}. 12280 12281Normally the files found this way are library files---archive files 12282whose members are object files. The linker handles an archive file by 12283scanning through it for members which define symbols that have so far 12284been referenced but not defined. But if the file that is found is an 12285ordinary object file, it is linked in the usual fashion. The only 12286difference between using an @option{-l} option and specifying a file name 12287is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 12288and searches several directories. 12289 12290@item -lobjc 12291@opindex lobjc 12292You need this special case of the @option{-l} option in order to 12293link an Objective-C or Objective-C++ program. 12294 12295@item -nostartfiles 12296@opindex nostartfiles 12297Do not use the standard system startup files when linking. 12298The standard system libraries are used normally, unless @option{-nostdlib} 12299or @option{-nodefaultlibs} is used. 12300 12301@item -nodefaultlibs 12302@opindex nodefaultlibs 12303Do not use the standard system libraries when linking. 12304Only the libraries you specify are passed to the linker, and options 12305specifying linkage of the system libraries, such as @option{-static-libgcc} 12306or @option{-shared-libgcc}, are ignored. 12307The standard startup files are used normally, unless @option{-nostartfiles} 12308is used. 12309 12310The compiler may generate calls to @code{memcmp}, 12311@code{memset}, @code{memcpy} and @code{memmove}. 12312These entries are usually resolved by entries in 12313libc. These entry points should be supplied through some other 12314mechanism when this option is specified. 12315 12316@item -nostdlib 12317@opindex nostdlib 12318Do not use the standard system startup files or libraries when linking. 12319No startup files and only the libraries you specify are passed to 12320the linker, and options specifying linkage of the system libraries, such as 12321@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 12322 12323The compiler may generate calls to @code{memcmp}, @code{memset}, 12324@code{memcpy} and @code{memmove}. 12325These entries are usually resolved by entries in 12326libc. These entry points should be supplied through some other 12327mechanism when this option is specified. 12328 12329@cindex @option{-lgcc}, use with @option{-nostdlib} 12330@cindex @option{-nostdlib} and unresolved references 12331@cindex unresolved references and @option{-nostdlib} 12332@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 12333@cindex @option{-nodefaultlibs} and unresolved references 12334@cindex unresolved references and @option{-nodefaultlibs} 12335One of the standard libraries bypassed by @option{-nostdlib} and 12336@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 12337which GCC uses to overcome shortcomings of particular machines, or special 12338needs for some languages. 12339(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 12340Collection (GCC) Internals}, 12341for more discussion of @file{libgcc.a}.) 12342In most cases, you need @file{libgcc.a} even when you want to avoid 12343other standard libraries. In other words, when you specify @option{-nostdlib} 12344or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 12345This ensures that you have no unresolved references to internal GCC 12346library subroutines. 12347(An example of such an internal subroutine is @code{__main}, used to ensure C++ 12348constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 12349GNU Compiler Collection (GCC) Internals}.) 12350 12351@item -pie 12352@opindex pie 12353Produce a dynamically linked position independent executable on targets 12354that support it. For predictable results, you must also specify the same 12355set of options used for compilation (@option{-fpie}, @option{-fPIE}, 12356or model suboptions) when you specify this linker option. 12357 12358@item -no-pie 12359@opindex no-pie 12360Don't produce a dynamically linked position independent executable. 12361 12362@item -static-pie 12363@opindex static-pie 12364Produce a static position independent executable on targets that support 12365it. A static position independent executable is similar to a static 12366executable, but can be loaded at any address without a dynamic linker. 12367For predictable results, you must also specify the same set of options 12368used for compilation (@option{-fpie}, @option{-fPIE}, or model 12369suboptions) when you specify this linker option. 12370 12371@item -pthread 12372@opindex pthread 12373Link with the POSIX threads library. This option is supported on 12374GNU/Linux targets, most other Unix derivatives, and also on 12375x86 Cygwin and MinGW targets. On some targets this option also sets 12376flags for the preprocessor, so it should be used consistently for both 12377compilation and linking. 12378 12379@item -rdynamic 12380@opindex rdynamic 12381Pass the flag @option{-export-dynamic} to the ELF linker, on targets 12382that support it. This instructs the linker to add all symbols, not 12383only used ones, to the dynamic symbol table. This option is needed 12384for some uses of @code{dlopen} or to allow obtaining backtraces 12385from within a program. 12386 12387@item -s 12388@opindex s 12389Remove all symbol table and relocation information from the executable. 12390 12391@item -static 12392@opindex static 12393On systems that support dynamic linking, this overrides @option{-pie} 12394and prevents linking with the shared libraries. On other systems, this 12395option has no effect. 12396 12397@item -shared 12398@opindex shared 12399Produce a shared object which can then be linked with other objects to 12400form an executable. Not all systems support this option. For predictable 12401results, you must also specify the same set of options used for compilation 12402(@option{-fpic}, @option{-fPIC}, or model suboptions) when 12403you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 12404needs to build supplementary stub code for constructors to work. On 12405multi-libbed systems, @samp{gcc -shared} must select the correct support 12406libraries to link against. Failing to supply the correct flags may lead 12407to subtle defects. Supplying them in cases where they are not necessary 12408is innocuous.} 12409 12410@item -shared-libgcc 12411@itemx -static-libgcc 12412@opindex shared-libgcc 12413@opindex static-libgcc 12414On systems that provide @file{libgcc} as a shared library, these options 12415force the use of either the shared or static version, respectively. 12416If no shared version of @file{libgcc} was built when the compiler was 12417configured, these options have no effect. 12418 12419There are several situations in which an application should use the 12420shared @file{libgcc} instead of the static version. The most common 12421of these is when the application wishes to throw and catch exceptions 12422across different shared libraries. In that case, each of the libraries 12423as well as the application itself should use the shared @file{libgcc}. 12424 12425Therefore, the G++ driver automatically adds @option{-shared-libgcc} 12426whenever you build a shared library or a main executable, because C++ 12427programs typically use exceptions, so this is the right thing to do. 12428 12429If, instead, you use the GCC driver to create shared libraries, you may 12430find that they are not always linked with the shared @file{libgcc}. 12431If GCC finds, at its configuration time, that you have a non-GNU linker 12432or a GNU linker that does not support option @option{--eh-frame-hdr}, 12433it links the shared version of @file{libgcc} into shared libraries 12434by default. Otherwise, it takes advantage of the linker and optimizes 12435away the linking with the shared version of @file{libgcc}, linking with 12436the static version of libgcc by default. This allows exceptions to 12437propagate through such shared libraries, without incurring relocation 12438costs at library load time. 12439 12440However, if a library or main executable is supposed to throw or catch 12441exceptions, you must link it using the G++ driver, or using the option 12442@option{-shared-libgcc}, such that it is linked with the shared 12443@file{libgcc}. 12444 12445@item -static-libasan 12446@opindex static-libasan 12447When the @option{-fsanitize=address} option is used to link a program, 12448the GCC driver automatically links against @option{libasan}. If 12449@file{libasan} is available as a shared library, and the @option{-static} 12450option is not used, then this links against the shared version of 12451@file{libasan}. The @option{-static-libasan} option directs the GCC 12452driver to link @file{libasan} statically, without necessarily linking 12453other libraries statically. 12454 12455@item -static-libtsan 12456@opindex static-libtsan 12457When the @option{-fsanitize=thread} option is used to link a program, 12458the GCC driver automatically links against @option{libtsan}. If 12459@file{libtsan} is available as a shared library, and the @option{-static} 12460option is not used, then this links against the shared version of 12461@file{libtsan}. The @option{-static-libtsan} option directs the GCC 12462driver to link @file{libtsan} statically, without necessarily linking 12463other libraries statically. 12464 12465@item -static-liblsan 12466@opindex static-liblsan 12467When the @option{-fsanitize=leak} option is used to link a program, 12468the GCC driver automatically links against @option{liblsan}. If 12469@file{liblsan} is available as a shared library, and the @option{-static} 12470option is not used, then this links against the shared version of 12471@file{liblsan}. The @option{-static-liblsan} option directs the GCC 12472driver to link @file{liblsan} statically, without necessarily linking 12473other libraries statically. 12474 12475@item -static-libubsan 12476@opindex static-libubsan 12477When the @option{-fsanitize=undefined} option is used to link a program, 12478the GCC driver automatically links against @option{libubsan}. If 12479@file{libubsan} is available as a shared library, and the @option{-static} 12480option is not used, then this links against the shared version of 12481@file{libubsan}. The @option{-static-libubsan} option directs the GCC 12482driver to link @file{libubsan} statically, without necessarily linking 12483other libraries statically. 12484 12485@item -static-libmpx 12486@opindex static-libmpx 12487When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are 12488used to link a program, the GCC driver automatically links against 12489@file{libmpx}. If @file{libmpx} is available as a shared library, 12490and the @option{-static} option is not used, then this links against 12491the shared version of @file{libmpx}. The @option{-static-libmpx} 12492option directs the GCC driver to link @file{libmpx} statically, 12493without necessarily linking other libraries statically. 12494 12495@item -static-libmpxwrappers 12496@opindex static-libmpxwrappers 12497When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used 12498to link a program without also using @option{-fno-chkp-use-wrappers}, the 12499GCC driver automatically links against @file{libmpxwrappers}. If 12500@file{libmpxwrappers} is available as a shared library, and the 12501@option{-static} option is not used, then this links against the shared 12502version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers} 12503option directs the GCC driver to link @file{libmpxwrappers} statically, 12504without necessarily linking other libraries statically. 12505 12506@item -static-libstdc++ 12507@opindex static-libstdc++ 12508When the @command{g++} program is used to link a C++ program, it 12509normally automatically links against @option{libstdc++}. If 12510@file{libstdc++} is available as a shared library, and the 12511@option{-static} option is not used, then this links against the 12512shared version of @file{libstdc++}. That is normally fine. However, it 12513is sometimes useful to freeze the version of @file{libstdc++} used by 12514the program without going all the way to a fully static link. The 12515@option{-static-libstdc++} option directs the @command{g++} driver to 12516link @file{libstdc++} statically, without necessarily linking other 12517libraries statically. 12518 12519@item -symbolic 12520@opindex symbolic 12521Bind references to global symbols when building a shared object. Warn 12522about any unresolved references (unless overridden by the link editor 12523option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 12524this option. 12525 12526@item -T @var{script} 12527@opindex T 12528@cindex linker script 12529Use @var{script} as the linker script. This option is supported by most 12530systems using the GNU linker. On some targets, such as bare-board 12531targets without an operating system, the @option{-T} option may be required 12532when linking to avoid references to undefined symbols. 12533 12534@item -Xlinker @var{option} 12535@opindex Xlinker 12536Pass @var{option} as an option to the linker. You can use this to 12537supply system-specific linker options that GCC does not recognize. 12538 12539If you want to pass an option that takes a separate argument, you must use 12540@option{-Xlinker} twice, once for the option and once for the argument. 12541For example, to pass @option{-assert definitions}, you must write 12542@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 12543@option{-Xlinker "-assert definitions"}, because this passes the entire 12544string as a single argument, which is not what the linker expects. 12545 12546When using the GNU linker, it is usually more convenient to pass 12547arguments to linker options using the @option{@var{option}=@var{value}} 12548syntax than as separate arguments. For example, you can specify 12549@option{-Xlinker -Map=output.map} rather than 12550@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 12551this syntax for command-line options. 12552 12553@item -Wl,@var{option} 12554@opindex Wl 12555Pass @var{option} as an option to the linker. If @var{option} contains 12556commas, it is split into multiple options at the commas. You can use this 12557syntax to pass an argument to the option. 12558For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 12559linker. When using the GNU linker, you can also get the same effect with 12560@option{-Wl,-Map=output.map}. 12561 12562@item -u @var{symbol} 12563@opindex u 12564Pretend the symbol @var{symbol} is undefined, to force linking of 12565library modules to define it. You can use @option{-u} multiple times with 12566different symbols to force loading of additional library modules. 12567 12568@item -z @var{keyword} 12569@opindex z 12570@option{-z} is passed directly on to the linker along with the keyword 12571@var{keyword}. See the section in the documentation of your linker for 12572permitted values and their meanings. 12573@end table 12574 12575@node Directory Options 12576@section Options for Directory Search 12577@cindex directory options 12578@cindex options, directory search 12579@cindex search path 12580 12581These options specify directories to search for header files, for 12582libraries and for parts of the compiler: 12583 12584@table @gcctabopt 12585@include cppdiropts.texi 12586 12587@item -iplugindir=@var{dir} 12588@opindex iplugindir= 12589Set the directory to search for plugins that are passed 12590by @option{-fplugin=@var{name}} instead of 12591@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 12592to be used by the user, but only passed by the driver. 12593 12594@item -L@var{dir} 12595@opindex L 12596Add directory @var{dir} to the list of directories to be searched 12597for @option{-l}. 12598 12599@item -B@var{prefix} 12600@opindex B 12601This option specifies where to find the executables, libraries, 12602include files, and data files of the compiler itself. 12603 12604The compiler driver program runs one or more of the subprograms 12605@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 12606@var{prefix} as a prefix for each program it tries to run, both with and 12607without @samp{@var{machine}/@var{version}/} for the corresponding target 12608machine and compiler version. 12609 12610For each subprogram to be run, the compiler driver first tries the 12611@option{-B} prefix, if any. If that name is not found, or if @option{-B} 12612is not specified, the driver tries two standard prefixes, 12613@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 12614those results in a file name that is found, the unmodified program 12615name is searched for using the directories specified in your 12616@env{PATH} environment variable. 12617 12618The compiler checks to see if the path provided by @option{-B} 12619refers to a directory, and if necessary it adds a directory 12620separator character at the end of the path. 12621 12622@option{-B} prefixes that effectively specify directory names also apply 12623to libraries in the linker, because the compiler translates these 12624options into @option{-L} options for the linker. They also apply to 12625include files in the preprocessor, because the compiler translates these 12626options into @option{-isystem} options for the preprocessor. In this case, 12627the compiler appends @samp{include} to the prefix. 12628 12629The runtime support file @file{libgcc.a} can also be searched for using 12630the @option{-B} prefix, if needed. If it is not found there, the two 12631standard prefixes above are tried, and that is all. The file is left 12632out of the link if it is not found by those means. 12633 12634Another way to specify a prefix much like the @option{-B} prefix is to use 12635the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 12636Variables}. 12637 12638As a special kludge, if the path provided by @option{-B} is 12639@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 126409, then it is replaced by @file{[dir/]include}. This is to help 12641with boot-strapping the compiler. 12642 12643@item -no-canonical-prefixes 12644@opindex no-canonical-prefixes 12645Do not expand any symbolic links, resolve references to @samp{/../} 12646or @samp{/./}, or make the path absolute when generating a relative 12647prefix. 12648 12649@item --sysroot=@var{dir} 12650@opindex sysroot 12651Use @var{dir} as the logical root directory for headers and libraries. 12652For example, if the compiler normally searches for headers in 12653@file{/usr/include} and libraries in @file{/usr/lib}, it instead 12654searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 12655 12656If you use both this option and the @option{-isysroot} option, then 12657the @option{--sysroot} option applies to libraries, but the 12658@option{-isysroot} option applies to header files. 12659 12660The GNU linker (beginning with version 2.16) has the necessary support 12661for this option. If your linker does not support this option, the 12662header file aspect of @option{--sysroot} still works, but the 12663library aspect does not. 12664 12665@item --no-sysroot-suffix 12666@opindex no-sysroot-suffix 12667For some targets, a suffix is added to the root directory specified 12668with @option{--sysroot}, depending on the other options used, so that 12669headers may for example be found in 12670@file{@var{dir}/@var{suffix}/usr/include} instead of 12671@file{@var{dir}/usr/include}. This option disables the addition of 12672such a suffix. 12673 12674@end table 12675 12676@node Code Gen Options 12677@section Options for Code Generation Conventions 12678@cindex code generation conventions 12679@cindex options, code generation 12680@cindex run-time options 12681 12682These machine-independent options control the interface conventions 12683used in code generation. 12684 12685Most of them have both positive and negative forms; the negative form 12686of @option{-ffoo} is @option{-fno-foo}. In the table below, only 12687one of the forms is listed---the one that is not the default. You 12688can figure out the other form by either removing @samp{no-} or adding 12689it. 12690 12691@table @gcctabopt 12692@item -fstack-reuse=@var{reuse-level} 12693@opindex fstack_reuse 12694This option controls stack space reuse for user declared local/auto variables 12695and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 12696@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 12697local variables and temporaries, @samp{named_vars} enables the reuse only for 12698user defined local variables with names, and @samp{none} disables stack reuse 12699completely. The default value is @samp{all}. The option is needed when the 12700program extends the lifetime of a scoped local variable or a compiler generated 12701temporary beyond the end point defined by the language. When a lifetime of 12702a variable ends, and if the variable lives in memory, the optimizing compiler 12703has the freedom to reuse its stack space with other temporaries or scoped 12704local variables whose live range does not overlap with it. Legacy code extending 12705local lifetime is likely to break with the stack reuse optimization. 12706 12707For example, 12708 12709@smallexample 12710 int *p; 12711 @{ 12712 int local1; 12713 12714 p = &local1; 12715 local1 = 10; 12716 .... 12717 @} 12718 @{ 12719 int local2; 12720 local2 = 20; 12721 ... 12722 @} 12723 12724 if (*p == 10) // out of scope use of local1 12725 @{ 12726 12727 @} 12728@end smallexample 12729 12730Another example: 12731@smallexample 12732 12733 struct A 12734 @{ 12735 A(int k) : i(k), j(k) @{ @} 12736 int i; 12737 int j; 12738 @}; 12739 12740 A *ap; 12741 12742 void foo(const A& ar) 12743 @{ 12744 ap = &ar; 12745 @} 12746 12747 void bar() 12748 @{ 12749 foo(A(10)); // temp object's lifetime ends when foo returns 12750 12751 @{ 12752 A a(20); 12753 .... 12754 @} 12755 ap->i+= 10; // ap references out of scope temp whose space 12756 // is reused with a. What is the value of ap->i? 12757 @} 12758 12759@end smallexample 12760 12761The lifetime of a compiler generated temporary is well defined by the C++ 12762standard. When a lifetime of a temporary ends, and if the temporary lives 12763in memory, the optimizing compiler has the freedom to reuse its stack 12764space with other temporaries or scoped local variables whose live range 12765does not overlap with it. However some of the legacy code relies on 12766the behavior of older compilers in which temporaries' stack space is 12767not reused, the aggressive stack reuse can lead to runtime errors. This 12768option is used to control the temporary stack reuse optimization. 12769 12770@item -ftrapv 12771@opindex ftrapv 12772This option generates traps for signed overflow on addition, subtraction, 12773multiplication operations. 12774The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 12775@option{-ftrapv} @option{-fwrapv} on the command-line results in 12776@option{-fwrapv} being effective. Note that only active options override, so 12777using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 12778results in @option{-ftrapv} being effective. 12779 12780@item -fwrapv 12781@opindex fwrapv 12782This option instructs the compiler to assume that signed arithmetic 12783overflow of addition, subtraction and multiplication wraps around 12784using twos-complement representation. This flag enables some optimizations 12785and disables others. 12786The options @option{-ftrapv} and @option{-fwrapv} override each other, so using 12787@option{-ftrapv} @option{-fwrapv} on the command-line results in 12788@option{-fwrapv} being effective. Note that only active options override, so 12789using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line 12790results in @option{-ftrapv} being effective. 12791 12792@item -fwrapv-pointer 12793@opindex fwrapv-pointer 12794This option instructs the compiler to assume that pointer arithmetic 12795overflow on addition and subtraction wraps around using twos-complement 12796representation. This flag disables some optimizations which assume 12797pointer overflow is invalid. 12798 12799@item -fstrict-overflow 12800@opindex fstrict-overflow 12801This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when 12802negated implies @option{-fwrapv} @option{-fwrapv-pointer}. 12803 12804@item -fexceptions 12805@opindex fexceptions 12806Enable exception handling. Generates extra code needed to propagate 12807exceptions. For some targets, this implies GCC generates frame 12808unwind information for all functions, which can produce significant data 12809size overhead, although it does not affect execution. If you do not 12810specify this option, GCC enables it by default for languages like 12811C++ that normally require exception handling, and disables it for 12812languages like C that do not normally require it. However, you may need 12813to enable this option when compiling C code that needs to interoperate 12814properly with exception handlers written in C++. You may also wish to 12815disable this option if you are compiling older C++ programs that don't 12816use exception handling. 12817 12818@item -fnon-call-exceptions 12819@opindex fnon-call-exceptions 12820Generate code that allows trapping instructions to throw exceptions. 12821Note that this requires platform-specific runtime support that does 12822not exist everywhere. Moreover, it only allows @emph{trapping} 12823instructions to throw exceptions, i.e.@: memory references or floating-point 12824instructions. It does not allow exceptions to be thrown from 12825arbitrary signal handlers such as @code{SIGALRM}. 12826 12827@item -fdelete-dead-exceptions 12828@opindex fdelete-dead-exceptions 12829Consider that instructions that may throw exceptions but don't otherwise 12830contribute to the execution of the program can be optimized away. 12831This option is enabled by default for the Ada front end, as permitted by 12832the Ada language specification. 12833Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 12834 12835@item -funwind-tables 12836@opindex funwind-tables 12837Similar to @option{-fexceptions}, except that it just generates any needed 12838static data, but does not affect the generated code in any other way. 12839You normally do not need to enable this option; instead, a language processor 12840that needs this handling enables it on your behalf. 12841 12842@item -fasynchronous-unwind-tables 12843@opindex fasynchronous-unwind-tables 12844Generate unwind table in DWARF format, if supported by target machine. The 12845table is exact at each instruction boundary, so it can be used for stack 12846unwinding from asynchronous events (such as debugger or garbage collector). 12847 12848@item -fno-gnu-unique 12849@opindex fno-gnu-unique 12850On systems with recent GNU assembler and C library, the C++ compiler 12851uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 12852of template static data members and static local variables in inline 12853functions are unique even in the presence of @code{RTLD_LOCAL}; this 12854is necessary to avoid problems with a library used by two different 12855@code{RTLD_LOCAL} plugins depending on a definition in one of them and 12856therefore disagreeing with the other one about the binding of the 12857symbol. But this causes @code{dlclose} to be ignored for affected 12858DSOs; if your program relies on reinitialization of a DSO via 12859@code{dlclose} and @code{dlopen}, you can use 12860@option{-fno-gnu-unique}. 12861 12862@item -fpcc-struct-return 12863@opindex fpcc-struct-return 12864Return ``short'' @code{struct} and @code{union} values in memory like 12865longer ones, rather than in registers. This convention is less 12866efficient, but it has the advantage of allowing intercallability between 12867GCC-compiled files and files compiled with other compilers, particularly 12868the Portable C Compiler (pcc). 12869 12870The precise convention for returning structures in memory depends 12871on the target configuration macros. 12872 12873Short structures and unions are those whose size and alignment match 12874that of some integer type. 12875 12876@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 12877switch is not binary compatible with code compiled with the 12878@option{-freg-struct-return} switch. 12879Use it to conform to a non-default application binary interface. 12880 12881@item -freg-struct-return 12882@opindex freg-struct-return 12883Return @code{struct} and @code{union} values in registers when possible. 12884This is more efficient for small structures than 12885@option{-fpcc-struct-return}. 12886 12887If you specify neither @option{-fpcc-struct-return} nor 12888@option{-freg-struct-return}, GCC defaults to whichever convention is 12889standard for the target. If there is no standard convention, GCC 12890defaults to @option{-fpcc-struct-return}, except on targets where GCC is 12891the principal compiler. In those cases, we can choose the standard, and 12892we chose the more efficient register return alternative. 12893 12894@strong{Warning:} code compiled with the @option{-freg-struct-return} 12895switch is not binary compatible with code compiled with the 12896@option{-fpcc-struct-return} switch. 12897Use it to conform to a non-default application binary interface. 12898 12899@item -fshort-enums 12900@opindex fshort-enums 12901Allocate to an @code{enum} type only as many bytes as it needs for the 12902declared range of possible values. Specifically, the @code{enum} type 12903is equivalent to the smallest integer type that has enough room. 12904 12905@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 12906code that is not binary compatible with code generated without that switch. 12907Use it to conform to a non-default application binary interface. 12908 12909@item -fshort-wchar 12910@opindex fshort-wchar 12911Override the underlying type for @code{wchar_t} to be @code{short 12912unsigned int} instead of the default for the target. This option is 12913useful for building programs to run under WINE@. 12914 12915@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 12916code that is not binary compatible with code generated without that switch. 12917Use it to conform to a non-default application binary interface. 12918 12919@item -fno-common 12920@opindex fno-common 12921@cindex tentative definitions 12922In C code, this option controls the placement of global variables 12923defined without an initializer, known as @dfn{tentative definitions} 12924in the C standard. Tentative definitions are distinct from declarations 12925of a variable with the @code{extern} keyword, which do not allocate storage. 12926 12927Unix C compilers have traditionally allocated storage for 12928uninitialized global variables in a common block. This allows the 12929linker to resolve all tentative definitions of the same variable 12930in different compilation units to the same object, or to a non-tentative 12931definition. 12932This is the behavior specified by @option{-fcommon}, and is the default for 12933GCC on most targets. 12934On the other hand, this behavior is not required by ISO 12935C, and on some targets may carry a speed or code size penalty on 12936variable references. 12937 12938The @option{-fno-common} option specifies that the compiler should instead 12939place uninitialized global variables in the data section of the object file. 12940This inhibits the merging of tentative definitions by the linker so 12941you get a multiple-definition error if the same 12942variable is defined in more than one compilation unit. 12943Compiling with @option{-fno-common} is useful on targets for which 12944it provides better performance, or if you wish to verify that the 12945program will work on other systems that always treat uninitialized 12946variable definitions this way. 12947 12948@item -fno-ident 12949@opindex fno-ident 12950Ignore the @code{#ident} directive. 12951 12952@item -finhibit-size-directive 12953@opindex finhibit-size-directive 12954Don't output a @code{.size} assembler directive, or anything else that 12955would cause trouble if the function is split in the middle, and the 12956two halves are placed at locations far apart in memory. This option is 12957used when compiling @file{crtstuff.c}; you should not need to use it 12958for anything else. 12959 12960@item -fverbose-asm 12961@opindex fverbose-asm 12962Put extra commentary information in the generated assembly code to 12963make it more readable. This option is generally only of use to those 12964who actually need to read the generated assembly code (perhaps while 12965debugging the compiler itself). 12966 12967@option{-fno-verbose-asm}, the default, causes the 12968extra information to be omitted and is useful when comparing two assembler 12969files. 12970 12971The added comments include: 12972 12973@itemize @bullet 12974 12975@item 12976information on the compiler version and command-line options, 12977 12978@item 12979the source code lines associated with the assembly instructions, 12980in the form FILENAME:LINENUMBER:CONTENT OF LINE, 12981 12982@item 12983hints on which high-level expressions correspond to 12984the various assembly instruction operands. 12985 12986@end itemize 12987 12988For example, given this C source file: 12989 12990@smallexample 12991int test (int n) 12992@{ 12993 int i; 12994 int total = 0; 12995 12996 for (i = 0; i < n; i++) 12997 total += i * i; 12998 12999 return total; 13000@} 13001@end smallexample 13002 13003compiling to (x86_64) assembly via @option{-S} and emitting the result 13004direct to stdout via @option{-o} @option{-} 13005 13006@smallexample 13007gcc -S test.c -fverbose-asm -Os -o - 13008@end smallexample 13009 13010gives output similar to this: 13011 13012@smallexample 13013 .file "test.c" 13014# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu) 13015 [...snip...] 13016# options passed: 13017 [...snip...] 13018 13019 .text 13020 .globl test 13021 .type test, @@function 13022test: 13023.LFB0: 13024 .cfi_startproc 13025# test.c:4: int total = 0; 13026 xorl %eax, %eax # <retval> 13027# test.c:6: for (i = 0; i < n; i++) 13028 xorl %edx, %edx # i 13029.L2: 13030# test.c:6: for (i = 0; i < n; i++) 13031 cmpl %edi, %edx # n, i 13032 jge .L5 #, 13033# test.c:7: total += i * i; 13034 movl %edx, %ecx # i, tmp92 13035 imull %edx, %ecx # i, tmp92 13036# test.c:6: for (i = 0; i < n; i++) 13037 incl %edx # i 13038# test.c:7: total += i * i; 13039 addl %ecx, %eax # tmp92, <retval> 13040 jmp .L2 # 13041.L5: 13042# test.c:10: @} 13043 ret 13044 .cfi_endproc 13045.LFE0: 13046 .size test, .-test 13047 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)" 13048 .section .note.GNU-stack,"",@@progbits 13049@end smallexample 13050 13051The comments are intended for humans rather than machines and hence the 13052precise format of the comments is subject to change. 13053 13054@item -frecord-gcc-switches 13055@opindex frecord-gcc-switches 13056This switch causes the command line used to invoke the 13057compiler to be recorded into the object file that is being created. 13058This switch is only implemented on some targets and the exact format 13059of the recording is target and binary file format dependent, but it 13060usually takes the form of a section containing ASCII text. This 13061switch is related to the @option{-fverbose-asm} switch, but that 13062switch only records information in the assembler output file as 13063comments, so it never reaches the object file. 13064See also @option{-grecord-gcc-switches} for another 13065way of storing compiler options into the object file. 13066 13067@item -fpic 13068@opindex fpic 13069@cindex global offset table 13070@cindex PIC 13071Generate position-independent code (PIC) suitable for use in a shared 13072library, if supported for the target machine. Such code accesses all 13073constant addresses through a global offset table (GOT)@. The dynamic 13074loader resolves the GOT entries when the program starts (the dynamic 13075loader is not part of GCC; it is part of the operating system). If 13076the GOT size for the linked executable exceeds a machine-specific 13077maximum size, you get an error message from the linker indicating that 13078@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13079instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k 13080on the m68k and RS/6000. The x86 has no such limit.) 13081 13082Position-independent code requires special support, and therefore works 13083only on certain machines. For the x86, GCC supports PIC for System V 13084but not for the Sun 386i. Code generated for the IBM RS/6000 is always 13085position-independent. 13086 13087When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13088are defined to 1. 13089 13090@item -fPIC 13091@opindex fPIC 13092If supported for the target machine, emit position-independent code, 13093suitable for dynamic linking and avoiding any limit on the size of the 13094global offset table. This option makes a difference on AArch64, m68k, 13095PowerPC and SPARC@. 13096 13097Position-independent code requires special support, and therefore works 13098only on certain machines. 13099 13100When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13101are defined to 2. 13102 13103@item -fpie 13104@itemx -fPIE 13105@opindex fpie 13106@opindex fPIE 13107These options are similar to @option{-fpic} and @option{-fPIC}, but 13108generated position independent code can be only linked into executables. 13109Usually these options are used when @option{-pie} GCC option is 13110used during linking. 13111 13112@option{-fpie} and @option{-fPIE} both define the macros 13113@code{__pie__} and @code{__PIE__}. The macros have the value 1 13114for @option{-fpie} and 2 for @option{-fPIE}. 13115 13116@item -fno-plt 13117@opindex fno-plt 13118Do not use the PLT for external function calls in position-independent code. 13119Instead, load the callee address at call sites from the GOT and branch to it. 13120This leads to more efficient code by eliminating PLT stubs and exposing 13121GOT loads to optimizations. On architectures such as 32-bit x86 where 13122PLT stubs expect the GOT pointer in a specific register, this gives more 13123register allocation freedom to the compiler. 13124Lazy binding requires use of the PLT; 13125with @option{-fno-plt} all external symbols are resolved at load time. 13126 13127Alternatively, the function attribute @code{noplt} can be used to avoid calls 13128through the PLT for specific external functions. 13129 13130In position-dependent code, a few targets also convert calls to 13131functions that are marked to not use the PLT to use the GOT instead. 13132 13133@item -fno-jump-tables 13134@opindex fno-jump-tables 13135Do not use jump tables for switch statements even where it would be 13136more efficient than other code generation strategies. This option is 13137of use in conjunction with @option{-fpic} or @option{-fPIC} for 13138building code that forms part of a dynamic linker and cannot 13139reference the address of a jump table. On some targets, jump tables 13140do not require a GOT and this option is not needed. 13141 13142@item -ffixed-@var{reg} 13143@opindex ffixed 13144Treat the register named @var{reg} as a fixed register; generated code 13145should never refer to it (except perhaps as a stack pointer, frame 13146pointer or in some other fixed role). 13147 13148@var{reg} must be the name of a register. The register names accepted 13149are machine-specific and are defined in the @code{REGISTER_NAMES} 13150macro in the machine description macro file. 13151 13152This flag does not have a negative form, because it specifies a 13153three-way choice. 13154 13155@item -fcall-used-@var{reg} 13156@opindex fcall-used 13157Treat the register named @var{reg} as an allocable register that is 13158clobbered by function calls. It may be allocated for temporaries or 13159variables that do not live across a call. Functions compiled this way 13160do not save and restore the register @var{reg}. 13161 13162It is an error to use this flag with the frame pointer or stack pointer. 13163Use of this flag for other registers that have fixed pervasive roles in 13164the machine's execution model produces disastrous results. 13165 13166This flag does not have a negative form, because it specifies a 13167three-way choice. 13168 13169@item -fcall-saved-@var{reg} 13170@opindex fcall-saved 13171Treat the register named @var{reg} as an allocable register saved by 13172functions. It may be allocated even for temporaries or variables that 13173live across a call. Functions compiled this way save and restore 13174the register @var{reg} if they use it. 13175 13176It is an error to use this flag with the frame pointer or stack pointer. 13177Use of this flag for other registers that have fixed pervasive roles in 13178the machine's execution model produces disastrous results. 13179 13180A different sort of disaster results from the use of this flag for 13181a register in which function values may be returned. 13182 13183This flag does not have a negative form, because it specifies a 13184three-way choice. 13185 13186@item -fpack-struct[=@var{n}] 13187@opindex fpack-struct 13188Without a value specified, pack all structure members together without 13189holes. When a value is specified (which must be a small power of two), pack 13190structure members according to this value, representing the maximum 13191alignment (that is, objects with default alignment requirements larger than 13192this are output potentially unaligned at the next fitting location. 13193 13194@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13195code that is not binary compatible with code generated without that switch. 13196Additionally, it makes the code suboptimal. 13197Use it to conform to a non-default application binary interface. 13198 13199@item -fleading-underscore 13200@opindex fleading-underscore 13201This option and its counterpart, @option{-fno-leading-underscore}, forcibly 13202change the way C symbols are represented in the object file. One use 13203is to help link with legacy assembly code. 13204 13205@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13206generate code that is not binary compatible with code generated without that 13207switch. Use it to conform to a non-default application binary interface. 13208Not all targets provide complete support for this switch. 13209 13210@item -ftls-model=@var{model} 13211@opindex ftls-model 13212Alter the thread-local storage model to be used (@pxref{Thread-Local}). 13213The @var{model} argument should be one of @samp{global-dynamic}, 13214@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 13215Note that the choice is subject to optimization: the compiler may use 13216a more efficient model for symbols not visible outside of the translation 13217unit, or if @option{-fpic} is not given on the command line. 13218 13219The default without @option{-fpic} is @samp{initial-exec}; with 13220@option{-fpic} the default is @samp{global-dynamic}. 13221 13222@item -ftrampolines 13223@opindex ftrampolines 13224For targets that normally need trampolines for nested functions, always 13225generate them instead of using descriptors. Otherwise, for targets that 13226do not need them, like for example HP-PA or IA-64, do nothing. 13227 13228A trampoline is a small piece of code that is created at run time on the 13229stack when the address of a nested function is taken, and is used to call 13230the nested function indirectly. Therefore, it requires the stack to be 13231made executable in order for the program to work properly. 13232 13233@option{-fno-trampolines} is enabled by default on a language by language 13234basis to let the compiler avoid generating them, if it computes that this 13235is safe, and replace them with descriptors. Descriptors are made up of data 13236only, but the generated code must be prepared to deal with them. As of this 13237writing, @option{-fno-trampolines} is enabled by default only for Ada. 13238 13239Moreover, code compiled with @option{-ftrampolines} and code compiled with 13240@option{-fno-trampolines} are not binary compatible if nested functions are 13241present. This option must therefore be used on a program-wide basis and be 13242manipulated with extreme care. 13243 13244@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 13245@opindex fvisibility 13246Set the default ELF image symbol visibility to the specified option---all 13247symbols are marked with this unless overridden within the code. 13248Using this feature can very substantially improve linking and 13249load times of shared object libraries, produce more optimized 13250code, provide near-perfect API export and prevent symbol clashes. 13251It is @strong{strongly} recommended that you use this in any shared objects 13252you distribute. 13253 13254Despite the nomenclature, @samp{default} always means public; i.e., 13255available to be linked against from outside the shared object. 13256@samp{protected} and @samp{internal} are pretty useless in real-world 13257usage so the only other commonly used option is @samp{hidden}. 13258The default if @option{-fvisibility} isn't specified is 13259@samp{default}, i.e., make every symbol public. 13260 13261A good explanation of the benefits offered by ensuring ELF 13262symbols have the correct visibility is given by ``How To Write 13263Shared Libraries'' by Ulrich Drepper (which can be found at 13264@w{@uref{https://www.akkadia.org/drepper/}})---however a superior 13265solution made possible by this option to marking things hidden when 13266the default is public is to make the default hidden and mark things 13267public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 13268and @code{__attribute__ ((visibility("default")))} instead of 13269@code{__declspec(dllexport)} you get almost identical semantics with 13270identical syntax. This is a great boon to those working with 13271cross-platform projects. 13272 13273For those adding visibility support to existing code, you may find 13274@code{#pragma GCC visibility} of use. This works by you enclosing 13275the declarations you wish to set visibility for with (for example) 13276@code{#pragma GCC visibility push(hidden)} and 13277@code{#pragma GCC visibility pop}. 13278Bear in mind that symbol visibility should be viewed @strong{as 13279part of the API interface contract} and thus all new code should 13280always specify visibility when it is not the default; i.e., declarations 13281only for use within the local DSO should @strong{always} be marked explicitly 13282as hidden as so to avoid PLT indirection overheads---making this 13283abundantly clear also aids readability and self-documentation of the code. 13284Note that due to ISO C++ specification requirements, @code{operator new} and 13285@code{operator delete} must always be of default visibility. 13286 13287Be aware that headers from outside your project, in particular system 13288headers and headers from any other library you use, may not be 13289expecting to be compiled with visibility other than the default. You 13290may need to explicitly say @code{#pragma GCC visibility push(default)} 13291before including any such headers. 13292 13293@code{extern} declarations are not affected by @option{-fvisibility}, so 13294a lot of code can be recompiled with @option{-fvisibility=hidden} with 13295no modifications. However, this means that calls to @code{extern} 13296functions with no explicit visibility use the PLT, so it is more 13297effective to use @code{__attribute ((visibility))} and/or 13298@code{#pragma GCC visibility} to tell the compiler which @code{extern} 13299declarations should be treated as hidden. 13300 13301Note that @option{-fvisibility} does affect C++ vague linkage 13302entities. This means that, for instance, an exception class that is 13303be thrown between DSOs must be explicitly marked with default 13304visibility so that the @samp{type_info} nodes are unified between 13305the DSOs. 13306 13307An overview of these techniques, their benefits and how to use them 13308is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 13309 13310@item -fstrict-volatile-bitfields 13311@opindex fstrict-volatile-bitfields 13312This option should be used if accesses to volatile bit-fields (or other 13313structure fields, although the compiler usually honors those types 13314anyway) should use a single access of the width of the 13315field's type, aligned to a natural alignment if possible. For 13316example, targets with memory-mapped peripheral registers might require 13317all such accesses to be 16 bits wide; with this flag you can 13318declare all peripheral bit-fields as @code{unsigned short} (assuming short 13319is 16 bits on these targets) to force GCC to use 16-bit accesses 13320instead of, perhaps, a more efficient 32-bit access. 13321 13322If this option is disabled, the compiler uses the most efficient 13323instruction. In the previous example, that might be a 32-bit load 13324instruction, even though that accesses bytes that do not contain 13325any portion of the bit-field, or memory-mapped registers unrelated to 13326the one being updated. 13327 13328In some cases, such as when the @code{packed} attribute is applied to a 13329structure field, it may not be possible to access the field with a single 13330read or write that is correctly aligned for the target machine. In this 13331case GCC falls back to generating multiple accesses rather than code that 13332will fault or truncate the result at run time. 13333 13334Note: Due to restrictions of the C/C++11 memory model, write accesses are 13335not allowed to touch non bit-field members. It is therefore recommended 13336to define all bits of the field's type as bit-field members. 13337 13338The default value of this option is determined by the application binary 13339interface for the target processor. 13340 13341@item -fsync-libcalls 13342@opindex fsync-libcalls 13343This option controls whether any out-of-line instance of the @code{__sync} 13344family of functions may be used to implement the C++11 @code{__atomic} 13345family of functions. 13346 13347The default value of this option is enabled, thus the only useful form 13348of the option is @option{-fno-sync-libcalls}. This option is used in 13349the implementation of the @file{libatomic} runtime library. 13350 13351@end table 13352 13353@node Developer Options 13354@section GCC Developer Options 13355@cindex developer options 13356@cindex debugging GCC 13357@cindex debug dump options 13358@cindex dump options 13359@cindex compilation statistics 13360 13361This section describes command-line options that are primarily of 13362interest to GCC developers, including options to support compiler 13363testing and investigation of compiler bugs and compile-time 13364performance problems. This includes options that produce debug dumps 13365at various points in the compilation; that print statistics such as 13366memory use and execution time; and that print information about GCC's 13367configuration, such as where it searches for libraries. You should 13368rarely need to use any of these options for ordinary compilation and 13369linking tasks. 13370 13371@table @gcctabopt 13372 13373@item -d@var{letters} 13374@itemx -fdump-rtl-@var{pass} 13375@itemx -fdump-rtl-@var{pass}=@var{filename} 13376@opindex d 13377@opindex fdump-rtl-@var{pass} 13378Says to make debugging dumps during compilation at times specified by 13379@var{letters}. This is used for debugging the RTL-based passes of the 13380compiler. The file names for most of the dumps are made by appending 13381a pass number and a word to the @var{dumpname}, and the files are 13382created in the directory of the output file. In case of 13383@option{=@var{filename}} option, the dump is output on the given file 13384instead of the pass numbered dump files. Note that the pass number is 13385assigned as passes are registered into the pass manager. Most passes 13386are registered in the order that they will execute and for these passes 13387the number corresponds to the pass execution order. However, passes 13388registered by plugins, passes specific to compilation targets, or 13389passes that are otherwise registered after all the other passes are 13390numbered higher than a pass named "final", even if they are executed 13391earlier. @var{dumpname} is generated from the name of the output 13392file if explicitly specified and not an executable, otherwise it is 13393the basename of the source file. 13394 13395Some @option{-d@var{letters}} switches have different meaning when 13396@option{-E} is used for preprocessing. @xref{Preprocessor Options}, 13397for information about preprocessor-specific dump options. 13398 13399Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 13400@option{-d} option @var{letters}. Here are the possible 13401letters for use in @var{pass} and @var{letters}, and their meanings: 13402 13403@table @gcctabopt 13404 13405@item -fdump-rtl-alignments 13406@opindex fdump-rtl-alignments 13407Dump after branch alignments have been computed. 13408 13409@item -fdump-rtl-asmcons 13410@opindex fdump-rtl-asmcons 13411Dump after fixing rtl statements that have unsatisfied in/out constraints. 13412 13413@item -fdump-rtl-auto_inc_dec 13414@opindex fdump-rtl-auto_inc_dec 13415Dump after auto-inc-dec discovery. This pass is only run on 13416architectures that have auto inc or auto dec instructions. 13417 13418@item -fdump-rtl-barriers 13419@opindex fdump-rtl-barriers 13420Dump after cleaning up the barrier instructions. 13421 13422@item -fdump-rtl-bbpart 13423@opindex fdump-rtl-bbpart 13424Dump after partitioning hot and cold basic blocks. 13425 13426@item -fdump-rtl-bbro 13427@opindex fdump-rtl-bbro 13428Dump after block reordering. 13429 13430@item -fdump-rtl-btl1 13431@itemx -fdump-rtl-btl2 13432@opindex fdump-rtl-btl2 13433@opindex fdump-rtl-btl2 13434@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 13435after the two branch 13436target load optimization passes. 13437 13438@item -fdump-rtl-bypass 13439@opindex fdump-rtl-bypass 13440Dump after jump bypassing and control flow optimizations. 13441 13442@item -fdump-rtl-combine 13443@opindex fdump-rtl-combine 13444Dump after the RTL instruction combination pass. 13445 13446@item -fdump-rtl-compgotos 13447@opindex fdump-rtl-compgotos 13448Dump after duplicating the computed gotos. 13449 13450@item -fdump-rtl-ce1 13451@itemx -fdump-rtl-ce2 13452@itemx -fdump-rtl-ce3 13453@opindex fdump-rtl-ce1 13454@opindex fdump-rtl-ce2 13455@opindex fdump-rtl-ce3 13456@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 13457@option{-fdump-rtl-ce3} enable dumping after the three 13458if conversion passes. 13459 13460@item -fdump-rtl-cprop_hardreg 13461@opindex fdump-rtl-cprop_hardreg 13462Dump after hard register copy propagation. 13463 13464@item -fdump-rtl-csa 13465@opindex fdump-rtl-csa 13466Dump after combining stack adjustments. 13467 13468@item -fdump-rtl-cse1 13469@itemx -fdump-rtl-cse2 13470@opindex fdump-rtl-cse1 13471@opindex fdump-rtl-cse2 13472@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 13473the two common subexpression elimination passes. 13474 13475@item -fdump-rtl-dce 13476@opindex fdump-rtl-dce 13477Dump after the standalone dead code elimination passes. 13478 13479@item -fdump-rtl-dbr 13480@opindex fdump-rtl-dbr 13481Dump after delayed branch scheduling. 13482 13483@item -fdump-rtl-dce1 13484@itemx -fdump-rtl-dce2 13485@opindex fdump-rtl-dce1 13486@opindex fdump-rtl-dce2 13487@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 13488the two dead store elimination passes. 13489 13490@item -fdump-rtl-eh 13491@opindex fdump-rtl-eh 13492Dump after finalization of EH handling code. 13493 13494@item -fdump-rtl-eh_ranges 13495@opindex fdump-rtl-eh_ranges 13496Dump after conversion of EH handling range regions. 13497 13498@item -fdump-rtl-expand 13499@opindex fdump-rtl-expand 13500Dump after RTL generation. 13501 13502@item -fdump-rtl-fwprop1 13503@itemx -fdump-rtl-fwprop2 13504@opindex fdump-rtl-fwprop1 13505@opindex fdump-rtl-fwprop2 13506@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 13507dumping after the two forward propagation passes. 13508 13509@item -fdump-rtl-gcse1 13510@itemx -fdump-rtl-gcse2 13511@opindex fdump-rtl-gcse1 13512@opindex fdump-rtl-gcse2 13513@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 13514after global common subexpression elimination. 13515 13516@item -fdump-rtl-init-regs 13517@opindex fdump-rtl-init-regs 13518Dump after the initialization of the registers. 13519 13520@item -fdump-rtl-initvals 13521@opindex fdump-rtl-initvals 13522Dump after the computation of the initial value sets. 13523 13524@item -fdump-rtl-into_cfglayout 13525@opindex fdump-rtl-into_cfglayout 13526Dump after converting to cfglayout mode. 13527 13528@item -fdump-rtl-ira 13529@opindex fdump-rtl-ira 13530Dump after iterated register allocation. 13531 13532@item -fdump-rtl-jump 13533@opindex fdump-rtl-jump 13534Dump after the second jump optimization. 13535 13536@item -fdump-rtl-loop2 13537@opindex fdump-rtl-loop2 13538@option{-fdump-rtl-loop2} enables dumping after the rtl 13539loop optimization passes. 13540 13541@item -fdump-rtl-mach 13542@opindex fdump-rtl-mach 13543Dump after performing the machine dependent reorganization pass, if that 13544pass exists. 13545 13546@item -fdump-rtl-mode_sw 13547@opindex fdump-rtl-mode_sw 13548Dump after removing redundant mode switches. 13549 13550@item -fdump-rtl-rnreg 13551@opindex fdump-rtl-rnreg 13552Dump after register renumbering. 13553 13554@item -fdump-rtl-outof_cfglayout 13555@opindex fdump-rtl-outof_cfglayout 13556Dump after converting from cfglayout mode. 13557 13558@item -fdump-rtl-peephole2 13559@opindex fdump-rtl-peephole2 13560Dump after the peephole pass. 13561 13562@item -fdump-rtl-postreload 13563@opindex fdump-rtl-postreload 13564Dump after post-reload optimizations. 13565 13566@item -fdump-rtl-pro_and_epilogue 13567@opindex fdump-rtl-pro_and_epilogue 13568Dump after generating the function prologues and epilogues. 13569 13570@item -fdump-rtl-sched1 13571@itemx -fdump-rtl-sched2 13572@opindex fdump-rtl-sched1 13573@opindex fdump-rtl-sched2 13574@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 13575after the basic block scheduling passes. 13576 13577@item -fdump-rtl-ree 13578@opindex fdump-rtl-ree 13579Dump after sign/zero extension elimination. 13580 13581@item -fdump-rtl-seqabstr 13582@opindex fdump-rtl-seqabstr 13583Dump after common sequence discovery. 13584 13585@item -fdump-rtl-shorten 13586@opindex fdump-rtl-shorten 13587Dump after shortening branches. 13588 13589@item -fdump-rtl-sibling 13590@opindex fdump-rtl-sibling 13591Dump after sibling call optimizations. 13592 13593@item -fdump-rtl-split1 13594@itemx -fdump-rtl-split2 13595@itemx -fdump-rtl-split3 13596@itemx -fdump-rtl-split4 13597@itemx -fdump-rtl-split5 13598@opindex fdump-rtl-split1 13599@opindex fdump-rtl-split2 13600@opindex fdump-rtl-split3 13601@opindex fdump-rtl-split4 13602@opindex fdump-rtl-split5 13603These options enable dumping after five rounds of 13604instruction splitting. 13605 13606@item -fdump-rtl-sms 13607@opindex fdump-rtl-sms 13608Dump after modulo scheduling. This pass is only run on some 13609architectures. 13610 13611@item -fdump-rtl-stack 13612@opindex fdump-rtl-stack 13613Dump after conversion from GCC's ``flat register file'' registers to the 13614x87's stack-like registers. This pass is only run on x86 variants. 13615 13616@item -fdump-rtl-subreg1 13617@itemx -fdump-rtl-subreg2 13618@opindex fdump-rtl-subreg1 13619@opindex fdump-rtl-subreg2 13620@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 13621the two subreg expansion passes. 13622 13623@item -fdump-rtl-unshare 13624@opindex fdump-rtl-unshare 13625Dump after all rtl has been unshared. 13626 13627@item -fdump-rtl-vartrack 13628@opindex fdump-rtl-vartrack 13629Dump after variable tracking. 13630 13631@item -fdump-rtl-vregs 13632@opindex fdump-rtl-vregs 13633Dump after converting virtual registers to hard registers. 13634 13635@item -fdump-rtl-web 13636@opindex fdump-rtl-web 13637Dump after live range splitting. 13638 13639@item -fdump-rtl-regclass 13640@itemx -fdump-rtl-subregs_of_mode_init 13641@itemx -fdump-rtl-subregs_of_mode_finish 13642@itemx -fdump-rtl-dfinit 13643@itemx -fdump-rtl-dfinish 13644@opindex fdump-rtl-regclass 13645@opindex fdump-rtl-subregs_of_mode_init 13646@opindex fdump-rtl-subregs_of_mode_finish 13647@opindex fdump-rtl-dfinit 13648@opindex fdump-rtl-dfinish 13649These dumps are defined but always produce empty files. 13650 13651@item -da 13652@itemx -fdump-rtl-all 13653@opindex da 13654@opindex fdump-rtl-all 13655Produce all the dumps listed above. 13656 13657@item -dA 13658@opindex dA 13659Annotate the assembler output with miscellaneous debugging information. 13660 13661@item -dD 13662@opindex dD 13663Dump all macro definitions, at the end of preprocessing, in addition to 13664normal output. 13665 13666@item -dH 13667@opindex dH 13668Produce a core dump whenever an error occurs. 13669 13670@item -dp 13671@opindex dp 13672Annotate the assembler output with a comment indicating which 13673pattern and alternative is used. The length and cost of each instruction are 13674also printed. 13675 13676@item -dP 13677@opindex dP 13678Dump the RTL in the assembler output as a comment before each instruction. 13679Also turns on @option{-dp} annotation. 13680 13681@item -dx 13682@opindex dx 13683Just generate RTL for a function instead of compiling it. Usually used 13684with @option{-fdump-rtl-expand}. 13685@end table 13686 13687@item -fdump-noaddr 13688@opindex fdump-noaddr 13689When doing debugging dumps, suppress address output. This makes it more 13690feasible to use diff on debugging dumps for compiler invocations with 13691different compiler binaries and/or different 13692text / bss / data / heap / stack / dso start locations. 13693 13694@item -freport-bug 13695@opindex freport-bug 13696Collect and dump debug information into a temporary file if an 13697internal compiler error (ICE) occurs. 13698 13699@item -fdump-unnumbered 13700@opindex fdump-unnumbered 13701When doing debugging dumps, suppress instruction numbers and address output. 13702This makes it more feasible to use diff on debugging dumps for compiler 13703invocations with different options, in particular with and without 13704@option{-g}. 13705 13706@item -fdump-unnumbered-links 13707@opindex fdump-unnumbered-links 13708When doing debugging dumps (see @option{-d} option above), suppress 13709instruction numbers for the links to the previous and next instructions 13710in a sequence. 13711 13712@item -fdump-ipa-@var{switch} 13713@opindex fdump-ipa 13714Control the dumping at various stages of inter-procedural analysis 13715language tree to a file. The file name is generated by appending a 13716switch specific suffix to the source file name, and the file is created 13717in the same directory as the output file. The following dumps are 13718possible: 13719 13720@table @samp 13721@item all 13722Enables all inter-procedural analysis dumps. 13723 13724@item cgraph 13725Dumps information about call-graph optimization, unused function removal, 13726and inlining decisions. 13727 13728@item inline 13729Dump after function inlining. 13730 13731@end table 13732 13733@item -fdump-lang-all 13734@itemx -fdump-lang-@var{switch} 13735@itemx -fdump-lang-@var{switch}-@var{options} 13736@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename} 13737@opindex fdump-lang-all 13738@opindex fdump-lang 13739Control the dumping of language-specific information. The @var{options} 13740and @var{filename} portions behave as described in the 13741@option{-fdump-tree} option. The following @var{switch} values are 13742accepted: 13743 13744@table @samp 13745@item all 13746 13747Enable all language-specific dumps. 13748 13749@item class 13750Dump class hierarchy information. Virtual table information is emitted 13751unless '@option{slim}' is specified. This option is applicable to C++ only. 13752 13753@item raw 13754Dump the raw internal tree data. This option is applicable to C++ only. 13755 13756@end table 13757 13758@item -fdump-passes 13759@opindex fdump-passes 13760Print on @file{stderr} the list of optimization passes that are turned 13761on and off by the current command-line options. 13762 13763@item -fdump-statistics-@var{option} 13764@opindex fdump-statistics 13765Enable and control dumping of pass statistics in a separate file. The 13766file name is generated by appending a suffix ending in 13767@samp{.statistics} to the source file name, and the file is created in 13768the same directory as the output file. If the @samp{-@var{option}} 13769form is used, @samp{-stats} causes counters to be summed over the 13770whole compilation unit while @samp{-details} dumps every event as 13771the passes generate them. The default with no option is to sum 13772counters for each function compiled. 13773 13774@item -fdump-tree-all 13775@itemx -fdump-tree-@var{switch} 13776@itemx -fdump-tree-@var{switch}-@var{options} 13777@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 13778@opindex fdump-tree-all 13779@opindex fdump-tree 13780Control the dumping at various stages of processing the intermediate 13781language tree to a file. The file name is generated by appending a 13782switch-specific suffix to the source file name, and the file is 13783created in the same directory as the output file. In case of 13784@option{=@var{filename}} option, the dump is output on the given file 13785instead of the auto named dump files. If the @samp{-@var{options}} 13786form is used, @var{options} is a list of @samp{-} separated options 13787which control the details of the dump. Not all options are applicable 13788to all dumps; those that are not meaningful are ignored. The 13789following options are available 13790 13791@table @samp 13792@item address 13793Print the address of each node. Usually this is not meaningful as it 13794changes according to the environment and source file. Its primary use 13795is for tying up a dump file with a debug environment. 13796@item asmname 13797If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 13798in the dump instead of @code{DECL_NAME}. Its primary use is ease of 13799use working backward from mangled names in the assembly file. 13800@item slim 13801When dumping front-end intermediate representations, inhibit dumping 13802of members of a scope or body of a function merely because that scope 13803has been reached. Only dump such items when they are directly reachable 13804by some other path. 13805 13806When dumping pretty-printed trees, this option inhibits dumping the 13807bodies of control structures. 13808 13809When dumping RTL, print the RTL in slim (condensed) form instead of 13810the default LISP-like representation. 13811@item raw 13812Print a raw representation of the tree. By default, trees are 13813pretty-printed into a C-like representation. 13814@item details 13815Enable more detailed dumps (not honored by every dump option). Also 13816include information from the optimization passes. 13817@item stats 13818Enable dumping various statistics about the pass (not honored by every dump 13819option). 13820@item blocks 13821Enable showing basic block boundaries (disabled in raw dumps). 13822@item graph 13823For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 13824dump a representation of the control flow graph suitable for viewing with 13825GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 13826the file is pretty-printed as a subgraph, so that GraphViz can render them 13827all in a single plot. 13828 13829This option currently only works for RTL dumps, and the RTL is always 13830dumped in slim form. 13831@item vops 13832Enable showing virtual operands for every statement. 13833@item lineno 13834Enable showing line numbers for statements. 13835@item uid 13836Enable showing the unique ID (@code{DECL_UID}) for each variable. 13837@item verbose 13838Enable showing the tree dump for each statement. 13839@item eh 13840Enable showing the EH region number holding each statement. 13841@item scev 13842Enable showing scalar evolution analysis details. 13843@item optimized 13844Enable showing optimization information (only available in certain 13845passes). 13846@item missed 13847Enable showing missed optimization information (only available in certain 13848passes). 13849@item note 13850Enable other detailed optimization information (only available in 13851certain passes). 13852@item =@var{filename} 13853Instead of an auto named dump file, output into the given file 13854name. The file names @file{stdout} and @file{stderr} are treated 13855specially and are considered already open standard streams. For 13856example, 13857 13858@smallexample 13859gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump 13860 -fdump-tree-pre=/dev/stderr file.c 13861@end smallexample 13862 13863outputs vectorizer dump into @file{foo.dump}, while the PRE dump is 13864output on to @file{stderr}. If two conflicting dump filenames are 13865given for the same pass, then the latter option overrides the earlier 13866one. 13867 13868@item all 13869Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 13870and @option{lineno}. 13871 13872@item optall 13873Turn on all optimization options, i.e., @option{optimized}, 13874@option{missed}, and @option{note}. 13875@end table 13876 13877To determine what tree dumps are available or find the dump for a pass 13878of interest follow the steps below. 13879 13880@enumerate 13881@item 13882Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output 13883look for a code that corresponds to the pass you are interested in. 13884For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and 13885@code{tree-vrp2} correspond to the three Value Range Propagation passes. 13886The number at the end distinguishes distinct invocations of the same pass. 13887@item 13888To enable the creation of the dump file, append the pass code to 13889the @option{-fdump-} option prefix and invoke GCC with it. For example, 13890to enable the dump from the Early Value Range Propagation pass, invoke 13891GCC with the @option{-fdump-tree-evrp} option. Optionally, you may 13892specify the name of the dump file. If you don't specify one, GCC 13893creates as described below. 13894@item 13895Find the pass dump in a file whose name is composed of three components 13896separated by a period: the name of the source file GCC was invoked to 13897compile, a numeric suffix indicating the pass number followed by the 13898letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes), 13899and finally the pass code. For example, the Early VRP pass dump might 13900be in a file named @file{myfile.c.038t.evrp} in the current working 13901directory. Note that the numeric codes are not stable and may change 13902from one version of GCC to another. 13903@end enumerate 13904 13905@item -fopt-info 13906@itemx -fopt-info-@var{options} 13907@itemx -fopt-info-@var{options}=@var{filename} 13908@opindex fopt-info 13909Controls optimization dumps from various optimization passes. If the 13910@samp{-@var{options}} form is used, @var{options} is a list of 13911@samp{-} separated option keywords to select the dump details and 13912optimizations. 13913 13914The @var{options} can be divided into two groups: options describing the 13915verbosity of the dump, and options describing which optimizations 13916should be included. The options from both the groups can be freely 13917mixed as they are non-overlapping. However, in case of any conflicts, 13918the later options override the earlier options on the command 13919line. 13920 13921The following options control the dump verbosity: 13922 13923@table @samp 13924@item optimized 13925Print information when an optimization is successfully applied. It is 13926up to a pass to decide which information is relevant. For example, the 13927vectorizer passes print the source location of loops which are 13928successfully vectorized. 13929@item missed 13930Print information about missed optimizations. Individual passes 13931control which information to include in the output. 13932@item note 13933Print verbose information about optimizations, such as certain 13934transformations, more detailed messages about decisions etc. 13935@item all 13936Print detailed optimization information. This includes 13937@samp{optimized}, @samp{missed}, and @samp{note}. 13938@end table 13939 13940One or more of the following option keywords can be used to describe a 13941group of optimizations: 13942 13943@table @samp 13944@item ipa 13945Enable dumps from all interprocedural optimizations. 13946@item loop 13947Enable dumps from all loop optimizations. 13948@item inline 13949Enable dumps from all inlining optimizations. 13950@item omp 13951Enable dumps from all OMP (Offloading and Multi Processing) optimizations. 13952@item vec 13953Enable dumps from all vectorization optimizations. 13954@item optall 13955Enable dumps from all optimizations. This is a superset of 13956the optimization groups listed above. 13957@end table 13958 13959If @var{options} is 13960omitted, it defaults to @samp{optimized-optall}, which means to dump all 13961info about successful optimizations from all the passes. 13962 13963If the @var{filename} is provided, then the dumps from all the 13964applicable optimizations are concatenated into the @var{filename}. 13965Otherwise the dump is output onto @file{stderr}. Though multiple 13966@option{-fopt-info} options are accepted, only one of them can include 13967a @var{filename}. If other filenames are provided then all but the 13968first such option are ignored. 13969 13970Note that the output @var{filename} is overwritten 13971in case of multiple translation units. If a combined output from 13972multiple translation units is desired, @file{stderr} should be used 13973instead. 13974 13975In the following example, the optimization info is output to 13976@file{stderr}: 13977 13978@smallexample 13979gcc -O3 -fopt-info 13980@end smallexample 13981 13982This example: 13983@smallexample 13984gcc -O3 -fopt-info-missed=missed.all 13985@end smallexample 13986 13987@noindent 13988outputs missed optimization report from all the passes into 13989@file{missed.all}, and this one: 13990 13991@smallexample 13992gcc -O2 -ftree-vectorize -fopt-info-vec-missed 13993@end smallexample 13994 13995@noindent 13996prints information about missed optimization opportunities from 13997vectorization passes on @file{stderr}. 13998Note that @option{-fopt-info-vec-missed} is equivalent to 13999@option{-fopt-info-missed-vec}. The order of the optimization group 14000names and message types listed after @option{-fopt-info} does not matter. 14001 14002As another example, 14003@smallexample 14004gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 14005@end smallexample 14006 14007@noindent 14008outputs information about missed optimizations as well as 14009optimized locations from all the inlining passes into 14010@file{inline.txt}. 14011 14012Finally, consider: 14013 14014@smallexample 14015gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 14016@end smallexample 14017 14018@noindent 14019Here the two output filenames @file{vec.miss} and @file{loop.opt} are 14020in conflict since only one output file is allowed. In this case, only 14021the first option takes effect and the subsequent options are 14022ignored. Thus only @file{vec.miss} is produced which contains 14023dumps from the vectorizer about missed opportunities. 14024 14025@item -fsched-verbose=@var{n} 14026@opindex fsched-verbose 14027On targets that use instruction scheduling, this option controls the 14028amount of debugging output the scheduler prints to the dump files. 14029 14030For @var{n} greater than zero, @option{-fsched-verbose} outputs the 14031same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 14032For @var{n} greater than one, it also output basic block probabilities, 14033detailed ready list information and unit/insn info. For @var{n} greater 14034than two, it includes RTL at abort point, control-flow and regions info. 14035And for @var{n} over four, @option{-fsched-verbose} also includes 14036dependence info. 14037 14038 14039 14040@item -fenable-@var{kind}-@var{pass} 14041@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 14042@opindex fdisable- 14043@opindex fenable- 14044 14045This is a set of options that are used to explicitly disable/enable 14046optimization passes. These options are intended for use for debugging GCC. 14047Compiler users should use regular options for enabling/disabling 14048passes instead. 14049 14050@table @gcctabopt 14051 14052@item -fdisable-ipa-@var{pass} 14053Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 14054statically invoked in the compiler multiple times, the pass name should be 14055appended with a sequential number starting from 1. 14056 14057@item -fdisable-rtl-@var{pass} 14058@itemx -fdisable-rtl-@var{pass}=@var{range-list} 14059Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 14060statically invoked in the compiler multiple times, the pass name should be 14061appended with a sequential number starting from 1. @var{range-list} is a 14062comma-separated list of function ranges or assembler names. Each range is a number 14063pair separated by a colon. The range is inclusive in both ends. If the range 14064is trivial, the number pair can be simplified as a single number. If the 14065function's call graph node's @var{uid} falls within one of the specified ranges, 14066the @var{pass} is disabled for that function. The @var{uid} is shown in the 14067function header of a dump file, and the pass names can be dumped by using 14068option @option{-fdump-passes}. 14069 14070@item -fdisable-tree-@var{pass} 14071@itemx -fdisable-tree-@var{pass}=@var{range-list} 14072Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 14073option arguments. 14074 14075@item -fenable-ipa-@var{pass} 14076Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 14077statically invoked in the compiler multiple times, the pass name should be 14078appended with a sequential number starting from 1. 14079 14080@item -fenable-rtl-@var{pass} 14081@itemx -fenable-rtl-@var{pass}=@var{range-list} 14082Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 14083description and examples. 14084 14085@item -fenable-tree-@var{pass} 14086@itemx -fenable-tree-@var{pass}=@var{range-list} 14087Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 14088of option arguments. 14089 14090@end table 14091 14092Here are some examples showing uses of these options. 14093 14094@smallexample 14095 14096# disable ccp1 for all functions 14097 -fdisable-tree-ccp1 14098# disable complete unroll for function whose cgraph node uid is 1 14099 -fenable-tree-cunroll=1 14100# disable gcse2 for functions at the following ranges [1,1], 14101# [300,400], and [400,1000] 14102# disable gcse2 for functions foo and foo2 14103 -fdisable-rtl-gcse2=foo,foo2 14104# disable early inlining 14105 -fdisable-tree-einline 14106# disable ipa inlining 14107 -fdisable-ipa-inline 14108# enable tree full unroll 14109 -fenable-tree-unroll 14110 14111@end smallexample 14112 14113@item -fchecking 14114@itemx -fchecking=@var{n} 14115@opindex fchecking 14116@opindex fno-checking 14117Enable internal consistency checking. The default depends on 14118the compiler configuration. @option{-fchecking=2} enables further 14119internal consistency checking that might affect code generation. 14120 14121@item -frandom-seed=@var{string} 14122@opindex frandom-seed 14123This option provides a seed that GCC uses in place of 14124random numbers in generating certain symbol names 14125that have to be different in every compiled file. It is also used to 14126place unique stamps in coverage data files and the object files that 14127produce them. You can use the @option{-frandom-seed} option to produce 14128reproducibly identical object files. 14129 14130The @var{string} can either be a number (decimal, octal or hex) or an 14131arbitrary string (in which case it's converted to a number by 14132computing CRC32). 14133 14134The @var{string} should be different for every file you compile. 14135 14136@item -save-temps 14137@itemx -save-temps=cwd 14138@opindex save-temps 14139Store the usual ``temporary'' intermediate files permanently; place them 14140in the current directory and name them based on the source file. Thus, 14141compiling @file{foo.c} with @option{-c -save-temps} produces files 14142@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 14143preprocessed @file{foo.i} output file even though the compiler now 14144normally uses an integrated preprocessor. 14145 14146When used in combination with the @option{-x} command-line option, 14147@option{-save-temps} is sensible enough to avoid over writing an 14148input source file with the same extension as an intermediate file. 14149The corresponding intermediate file may be obtained by renaming the 14150source file before using @option{-save-temps}. 14151 14152If you invoke GCC in parallel, compiling several different source 14153files that share a common base name in different subdirectories or the 14154same source file compiled for multiple output destinations, it is 14155likely that the different parallel compilers will interfere with each 14156other, and overwrite the temporary files. For instance: 14157 14158@smallexample 14159gcc -save-temps -o outdir1/foo.o indir1/foo.c& 14160gcc -save-temps -o outdir2/foo.o indir2/foo.c& 14161@end smallexample 14162 14163may result in @file{foo.i} and @file{foo.o} being written to 14164simultaneously by both compilers. 14165 14166@item -save-temps=obj 14167@opindex save-temps=obj 14168Store the usual ``temporary'' intermediate files permanently. If the 14169@option{-o} option is used, the temporary files are based on the 14170object file. If the @option{-o} option is not used, the 14171@option{-save-temps=obj} switch behaves like @option{-save-temps}. 14172 14173For example: 14174 14175@smallexample 14176gcc -save-temps=obj -c foo.c 14177gcc -save-temps=obj -c bar.c -o dir/xbar.o 14178gcc -save-temps=obj foobar.c -o dir2/yfoobar 14179@end smallexample 14180 14181@noindent 14182creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, 14183@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and 14184@file{dir2/yfoobar.o}. 14185 14186@item -time@r{[}=@var{file}@r{]} 14187@opindex time 14188Report the CPU time taken by each subprocess in the compilation 14189sequence. For C source files, this is the compiler proper and assembler 14190(plus the linker if linking is done). 14191 14192Without the specification of an output file, the output looks like this: 14193 14194@smallexample 14195# cc1 0.12 0.01 14196# as 0.00 0.01 14197@end smallexample 14198 14199The first number on each line is the ``user time'', that is time spent 14200executing the program itself. The second number is ``system time'', 14201time spent executing operating system routines on behalf of the program. 14202Both numbers are in seconds. 14203 14204With the specification of an output file, the output is appended to the 14205named file, and it looks like this: 14206 14207@smallexample 142080.12 0.01 cc1 @var{options} 142090.00 0.01 as @var{options} 14210@end smallexample 14211 14212The ``user time'' and the ``system time'' are moved before the program 14213name, and the options passed to the program are displayed, so that one 14214can later tell what file was being compiled, and with which options. 14215 14216@item -fdump-final-insns@r{[}=@var{file}@r{]} 14217@opindex fdump-final-insns 14218Dump the final internal representation (RTL) to @var{file}. If the 14219optional argument is omitted (or if @var{file} is @code{.}), the name 14220of the dump file is determined by appending @code{.gkd} to the 14221compilation output file name. 14222 14223@item -fcompare-debug@r{[}=@var{opts}@r{]} 14224@opindex fcompare-debug 14225@opindex fno-compare-debug 14226If no error occurs during compilation, run the compiler a second time, 14227adding @var{opts} and @option{-fcompare-debug-second} to the arguments 14228passed to the second compilation. Dump the final internal 14229representation in both compilations, and print an error if they differ. 14230 14231If the equal sign is omitted, the default @option{-gtoggle} is used. 14232 14233The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 14234and nonzero, implicitly enables @option{-fcompare-debug}. If 14235@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 14236then it is used for @var{opts}, otherwise the default @option{-gtoggle} 14237is used. 14238 14239@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 14240is equivalent to @option{-fno-compare-debug}, which disables the dumping 14241of the final representation and the second compilation, preventing even 14242@env{GCC_COMPARE_DEBUG} from taking effect. 14243 14244To verify full coverage during @option{-fcompare-debug} testing, set 14245@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 14246which GCC rejects as an invalid option in any actual compilation 14247(rather than preprocessing, assembly or linking). To get just a 14248warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 14249not overridden} will do. 14250 14251@item -fcompare-debug-second 14252@opindex fcompare-debug-second 14253This option is implicitly passed to the compiler for the second 14254compilation requested by @option{-fcompare-debug}, along with options to 14255silence warnings, and omitting other options that would cause the compiler 14256to produce output to files or to standard output as a side effect. Dump 14257files and preserved temporary files are renamed so as to contain the 14258@code{.gk} additional extension during the second compilation, to avoid 14259overwriting those generated by the first. 14260 14261When this option is passed to the compiler driver, it causes the 14262@emph{first} compilation to be skipped, which makes it useful for little 14263other than debugging the compiler proper. 14264 14265@item -gtoggle 14266@opindex gtoggle 14267Turn off generation of debug info, if leaving out this option 14268generates it, or turn it on at level 2 otherwise. The position of this 14269argument in the command line does not matter; it takes effect after all 14270other options are processed, and it does so only once, no matter how 14271many times it is given. This is mainly intended to be used with 14272@option{-fcompare-debug}. 14273 14274@item -fvar-tracking-assignments-toggle 14275@opindex fvar-tracking-assignments-toggle 14276@opindex fno-var-tracking-assignments-toggle 14277Toggle @option{-fvar-tracking-assignments}, in the same way that 14278@option{-gtoggle} toggles @option{-g}. 14279 14280@item -Q 14281@opindex Q 14282Makes the compiler print out each function name as it is compiled, and 14283print some statistics about each pass when it finishes. 14284 14285@item -ftime-report 14286@opindex ftime-report 14287Makes the compiler print some statistics about the time consumed by each 14288pass when it finishes. 14289 14290@item -ftime-report-details 14291@opindex ftime-report-details 14292Record the time consumed by infrastructure parts separately for each pass. 14293 14294@item -fira-verbose=@var{n} 14295@opindex fira-verbose 14296Control the verbosity of the dump file for the integrated register allocator. 14297The default value is 5. If the value @var{n} is greater or equal to 10, 14298the dump output is sent to stderr using the same format as @var{n} minus 10. 14299 14300@item -flto-report 14301@opindex flto-report 14302Prints a report with internal details on the workings of the link-time 14303optimizer. The contents of this report vary from version to version. 14304It is meant to be useful to GCC developers when processing object 14305files in LTO mode (via @option{-flto}). 14306 14307Disabled by default. 14308 14309@item -flto-report-wpa 14310@opindex flto-report-wpa 14311Like @option{-flto-report}, but only print for the WPA phase of Link 14312Time Optimization. 14313 14314@item -fmem-report 14315@opindex fmem-report 14316Makes the compiler print some statistics about permanent memory 14317allocation when it finishes. 14318 14319@item -fmem-report-wpa 14320@opindex fmem-report-wpa 14321Makes the compiler print some statistics about permanent memory 14322allocation for the WPA phase only. 14323 14324@item -fpre-ipa-mem-report 14325@opindex fpre-ipa-mem-report 14326@item -fpost-ipa-mem-report 14327@opindex fpost-ipa-mem-report 14328Makes the compiler print some statistics about permanent memory 14329allocation before or after interprocedural optimization. 14330 14331@item -fprofile-report 14332@opindex fprofile-report 14333Makes the compiler print some statistics about consistency of the 14334(estimated) profile and effect of individual passes. 14335 14336@item -fstack-usage 14337@opindex fstack-usage 14338Makes the compiler output stack usage information for the program, on a 14339per-function basis. The filename for the dump is made by appending 14340@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 14341the output file, if explicitly specified and it is not an executable, 14342otherwise it is the basename of the source file. An entry is made up 14343of three fields: 14344 14345@itemize 14346@item 14347The name of the function. 14348@item 14349A number of bytes. 14350@item 14351One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 14352@end itemize 14353 14354The qualifier @code{static} means that the function manipulates the stack 14355statically: a fixed number of bytes are allocated for the frame on function 14356entry and released on function exit; no stack adjustments are otherwise made 14357in the function. The second field is this fixed number of bytes. 14358 14359The qualifier @code{dynamic} means that the function manipulates the stack 14360dynamically: in addition to the static allocation described above, stack 14361adjustments are made in the body of the function, for example to push/pop 14362arguments around function calls. If the qualifier @code{bounded} is also 14363present, the amount of these adjustments is bounded at compile time and 14364the second field is an upper bound of the total amount of stack used by 14365the function. If it is not present, the amount of these adjustments is 14366not bounded at compile time and the second field only represents the 14367bounded part. 14368 14369@item -fstats 14370@opindex fstats 14371Emit statistics about front-end processing at the end of the compilation. 14372This option is supported only by the C++ front end, and 14373the information is generally only useful to the G++ development team. 14374 14375@item -fdbg-cnt-list 14376@opindex fdbg-cnt-list 14377Print the name and the counter upper bound for all debug counters. 14378 14379 14380@item -fdbg-cnt=@var{counter-value-list} 14381@opindex fdbg-cnt 14382Set the internal debug counter upper bound. @var{counter-value-list} 14383is a comma-separated list of @var{name}:@var{value} pairs 14384which sets the upper bound of each debug counter @var{name} to @var{value}. 14385All debug counters have the initial upper bound of @code{UINT_MAX}; 14386thus @code{dbg_cnt} returns true always unless the upper bound 14387is set by this option. 14388For example, with @option{-fdbg-cnt=dce:10,tail_call:0}, 14389@code{dbg_cnt(dce)} returns true only for first 10 invocations. 14390 14391@item -print-file-name=@var{library} 14392@opindex print-file-name 14393Print the full absolute name of the library file @var{library} that 14394would be used when linking---and don't do anything else. With this 14395option, GCC does not compile or link anything; it just prints the 14396file name. 14397 14398@item -print-multi-directory 14399@opindex print-multi-directory 14400Print the directory name corresponding to the multilib selected by any 14401other switches present in the command line. This directory is supposed 14402to exist in @env{GCC_EXEC_PREFIX}. 14403 14404@item -print-multi-lib 14405@opindex print-multi-lib 14406Print the mapping from multilib directory names to compiler switches 14407that enable them. The directory name is separated from the switches by 14408@samp{;}, and each switch starts with an @samp{@@} instead of the 14409@samp{-}, without spaces between multiple switches. This is supposed to 14410ease shell processing. 14411 14412@item -print-multi-os-directory 14413@opindex print-multi-os-directory 14414Print the path to OS libraries for the selected 14415multilib, relative to some @file{lib} subdirectory. If OS libraries are 14416present in the @file{lib} subdirectory and no multilibs are used, this is 14417usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 14418sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 14419@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 14420subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 14421 14422@item -print-multiarch 14423@opindex print-multiarch 14424Print the path to OS libraries for the selected multiarch, 14425relative to some @file{lib} subdirectory. 14426 14427@item -print-prog-name=@var{program} 14428@opindex print-prog-name 14429Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 14430 14431@item -print-libgcc-file-name 14432@opindex print-libgcc-file-name 14433Same as @option{-print-file-name=libgcc.a}. 14434 14435This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 14436but you do want to link with @file{libgcc.a}. You can do: 14437 14438@smallexample 14439gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 14440@end smallexample 14441 14442@item -print-search-dirs 14443@opindex print-search-dirs 14444Print the name of the configured installation directory and a list of 14445program and library directories @command{gcc} searches---and don't do anything else. 14446 14447This is useful when @command{gcc} prints the error message 14448@samp{installation problem, cannot exec cpp0: No such file or directory}. 14449To resolve this you either need to put @file{cpp0} and the other compiler 14450components where @command{gcc} expects to find them, or you can set the environment 14451variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 14452Don't forget the trailing @samp{/}. 14453@xref{Environment Variables}. 14454 14455@item -print-sysroot 14456@opindex print-sysroot 14457Print the target sysroot directory that is used during 14458compilation. This is the target sysroot specified either at configure 14459time or using the @option{--sysroot} option, possibly with an extra 14460suffix that depends on compilation options. If no target sysroot is 14461specified, the option prints nothing. 14462 14463@item -print-sysroot-headers-suffix 14464@opindex print-sysroot-headers-suffix 14465Print the suffix added to the target sysroot when searching for 14466headers, or give an error if the compiler is not configured with such 14467a suffix---and don't do anything else. 14468 14469@item -dumpmachine 14470@opindex dumpmachine 14471Print the compiler's target machine (for example, 14472@samp{i686-pc-linux-gnu})---and don't do anything else. 14473 14474@item -dumpversion 14475@opindex dumpversion 14476Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do 14477anything else. This is the compiler version used in filesystem paths, 14478specs, can be depending on how the compiler has been configured just 14479a single number (major version), two numbers separated by dot (major and 14480minor version) or three numbers separated by dots (major, minor and patchlevel 14481version). 14482 14483@item -dumpfullversion 14484@opindex dumpfullversion 14485Print the full compiler version, always 3 numbers separated by dots, 14486major, minor and patchlevel version. 14487 14488@item -dumpspecs 14489@opindex dumpspecs 14490Print the compiler's built-in specs---and don't do anything else. (This 14491is used when GCC itself is being built.) @xref{Spec Files}. 14492@end table 14493 14494@node Submodel Options 14495@section Machine-Dependent Options 14496@cindex submodel options 14497@cindex specifying hardware config 14498@cindex hardware models and configurations, specifying 14499@cindex target-dependent options 14500@cindex machine-dependent options 14501 14502Each target machine supported by GCC can have its own options---for 14503example, to allow you to compile for a particular processor variant or 14504ABI, or to control optimizations specific to that machine. By 14505convention, the names of machine-specific options start with 14506@samp{-m}. 14507 14508Some configurations of the compiler also support additional target-specific 14509options, usually for compatibility with other compilers on the same 14510platform. 14511 14512@c This list is ordered alphanumerically by subsection name. 14513@c It should be the same order and spelling as these options are listed 14514@c in Machine Dependent Options 14515 14516@menu 14517* AArch64 Options:: 14518* Adapteva Epiphany Options:: 14519* ARC Options:: 14520* ARM Options:: 14521* AVR Options:: 14522* Blackfin Options:: 14523* C6X Options:: 14524* CRIS Options:: 14525* CR16 Options:: 14526* Darwin Options:: 14527* DEC Alpha Options:: 14528* FR30 Options:: 14529* FT32 Options:: 14530* FRV Options:: 14531* GNU/Linux Options:: 14532* H8/300 Options:: 14533* HPPA Options:: 14534* IA-64 Options:: 14535* LM32 Options:: 14536* M32C Options:: 14537* M32R/D Options:: 14538* M680x0 Options:: 14539* MCore Options:: 14540* MeP Options:: 14541* MicroBlaze Options:: 14542* MIPS Options:: 14543* MMIX Options:: 14544* MN10300 Options:: 14545* Moxie Options:: 14546* MSP430 Options:: 14547* NDS32 Options:: 14548* Nios II Options:: 14549* Nvidia PTX Options:: 14550* PDP-11 Options:: 14551* picoChip Options:: 14552* PowerPC Options:: 14553* PowerPC SPE Options:: 14554* RISC-V Options:: 14555* RL78 Options:: 14556* RS/6000 and PowerPC Options:: 14557* RX Options:: 14558* S/390 and zSeries Options:: 14559* Score Options:: 14560* SH Options:: 14561* Solaris 2 Options:: 14562* SPARC Options:: 14563* SPU Options:: 14564* System V Options:: 14565* TILE-Gx Options:: 14566* TILEPro Options:: 14567* V850 Options:: 14568* VAX Options:: 14569* Visium Options:: 14570* VMS Options:: 14571* VxWorks Options:: 14572* x86 Options:: 14573* x86 Windows Options:: 14574* Xstormy16 Options:: 14575* Xtensa Options:: 14576* zSeries Options:: 14577@end menu 14578 14579@node AArch64 Options 14580@subsection AArch64 Options 14581@cindex AArch64 Options 14582 14583These options are defined for AArch64 implementations: 14584 14585@table @gcctabopt 14586 14587@item -mabi=@var{name} 14588@opindex mabi 14589Generate code for the specified data model. Permissible values 14590are @samp{ilp32} for SysV-like data model where int, long int and pointers 14591are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits, 14592but long int and pointers are 64 bits. 14593 14594The default depends on the specific target configuration. Note that 14595the LP64 and ILP32 ABIs are not link-compatible; you must compile your 14596entire program with the same ABI, and link with a compatible set of libraries. 14597 14598@item -mbig-endian 14599@opindex mbig-endian 14600Generate big-endian code. This is the default when GCC is configured for an 14601@samp{aarch64_be-*-*} target. 14602 14603@item -mgeneral-regs-only 14604@opindex mgeneral-regs-only 14605Generate code which uses only the general-purpose registers. This will prevent 14606the compiler from using floating-point and Advanced SIMD registers but will not 14607impose any restrictions on the assembler. 14608 14609@item -mlittle-endian 14610@opindex mlittle-endian 14611Generate little-endian code. This is the default when GCC is configured for an 14612@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 14613 14614@item -mcmodel=tiny 14615@opindex mcmodel=tiny 14616Generate code for the tiny code model. The program and its statically defined 14617symbols must be within 1MB of each other. Programs can be statically or 14618dynamically linked. 14619 14620@item -mcmodel=small 14621@opindex mcmodel=small 14622Generate code for the small code model. The program and its statically defined 14623symbols must be within 4GB of each other. Programs can be statically or 14624dynamically linked. This is the default code model. 14625 14626@item -mcmodel=large 14627@opindex mcmodel=large 14628Generate code for the large code model. This makes no assumptions about 14629addresses and sizes of sections. Programs can be statically linked only. 14630 14631@item -mstrict-align 14632@opindex mstrict-align 14633Avoid generating memory accesses that may not be aligned on a natural object 14634boundary as described in the architecture specification. 14635 14636@item -momit-leaf-frame-pointer 14637@itemx -mno-omit-leaf-frame-pointer 14638@opindex momit-leaf-frame-pointer 14639@opindex mno-omit-leaf-frame-pointer 14640Omit or keep the frame pointer in leaf functions. The former behavior is the 14641default. 14642 14643@item -mtls-dialect=desc 14644@opindex mtls-dialect=desc 14645Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 14646of TLS variables. This is the default. 14647 14648@item -mtls-dialect=traditional 14649@opindex mtls-dialect=traditional 14650Use traditional TLS as the thread-local storage mechanism for dynamic accesses 14651of TLS variables. 14652 14653@item -mtls-size=@var{size} 14654@opindex mtls-size 14655Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48. 14656This option requires binutils 2.26 or newer. 14657 14658@item -mfix-cortex-a53-835769 14659@itemx -mno-fix-cortex-a53-835769 14660@opindex mfix-cortex-a53-835769 14661@opindex mno-fix-cortex-a53-835769 14662Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 14663This involves inserting a NOP instruction between memory instructions and 1466464-bit integer multiply-accumulate instructions. 14665 14666@item -mfix-cortex-a53-843419 14667@itemx -mno-fix-cortex-a53-843419 14668@opindex mfix-cortex-a53-843419 14669@opindex mno-fix-cortex-a53-843419 14670Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 14671This erratum workaround is made at link time and this will only pass the 14672corresponding flag to the linker. 14673 14674@item -mlow-precision-recip-sqrt 14675@itemx -mno-low-precision-recip-sqrt 14676@opindex mlow-precision-recip-sqrt 14677@opindex mno-low-precision-recip-sqrt 14678Enable or disable the reciprocal square root approximation. 14679This option only has an effect if @option{-ffast-math} or 14680@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 14681precision of reciprocal square root results to about 16 bits for 14682single precision and to 32 bits for double precision. 14683 14684@item -mlow-precision-sqrt 14685@itemx -mno-low-precision-sqrt 14686@opindex -mlow-precision-sqrt 14687@opindex -mno-low-precision-sqrt 14688Enable or disable the square root approximation. 14689This option only has an effect if @option{-ffast-math} or 14690@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 14691precision of square root results to about 16 bits for 14692single precision and to 32 bits for double precision. 14693If enabled, it implies @option{-mlow-precision-recip-sqrt}. 14694 14695@item -mlow-precision-div 14696@itemx -mno-low-precision-div 14697@opindex -mlow-precision-div 14698@opindex -mno-low-precision-div 14699Enable or disable the division approximation. 14700This option only has an effect if @option{-ffast-math} or 14701@option{-funsafe-math-optimizations} is used as well. Enabling this reduces 14702precision of division results to about 16 bits for 14703single precision and to 32 bits for double precision. 14704 14705@item -march=@var{name} 14706@opindex march 14707Specify the name of the target architecture and, optionally, one or 14708more feature modifiers. This option has the form 14709@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}. 14710 14711The permissible values for @var{arch} are @samp{armv8-a}, 14712@samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a} 14713or @var{native}. 14714 14715The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler 14716support for the ARMv8.4-A architecture extensions. 14717 14718The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler 14719support for the ARMv8.3-A architecture extensions. 14720 14721The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler 14722support for the ARMv8.2-A architecture extensions. 14723 14724The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler 14725support for the ARMv8.1-A architecture extension. In particular, it 14726enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features. 14727 14728The value @samp{native} is available on native AArch64 GNU/Linux and 14729causes the compiler to pick the architecture of the host system. This 14730option has no effect if the compiler is unable to recognize the 14731architecture of the host system, 14732 14733The permissible values for @var{feature} are listed in the sub-section 14734on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 14735Feature Modifiers}. Where conflicting feature modifiers are 14736specified, the right-most feature is used. 14737 14738GCC uses @var{name} to determine what kind of instructions it can emit 14739when generating assembly code. If @option{-march} is specified 14740without either of @option{-mtune} or @option{-mcpu} also being 14741specified, the code is tuned to perform well across a range of target 14742processors implementing the target architecture. 14743 14744@item -mtune=@var{name} 14745@opindex mtune 14746Specify the name of the target processor for which GCC should tune the 14747performance of the code. Permissible values for this option are: 14748@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 14749@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 14750@samp{cortex-a76}, @samp{ares}, @samp{neoverse-n1} 14751@samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx}, @samp{saphira}, 14752@samp{xgene1}, @samp{vulcan}, @samp{thunderx}, 14753@samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81}, 14754@samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53}, 14755@samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35}, 14756@samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55}, 14757@samp{native}. 14758 14759The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 14760@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, 14761@samp{cortex-a75.cortex-a55} specify that GCC should tune for a 14762big.LITTLE system. 14763 14764Additionally on native AArch64 GNU/Linux systems the value 14765@samp{native} tunes performance to the host system. This option has no effect 14766if the compiler is unable to recognize the processor of the host system. 14767 14768Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 14769are specified, the code is tuned to perform well across a range 14770of target processors. 14771 14772This option cannot be suffixed by feature modifiers. 14773 14774@item -mcpu=@var{name} 14775@opindex mcpu 14776Specify the name of the target processor, optionally suffixed by one 14777or more feature modifiers. This option has the form 14778@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where 14779the permissible values for @var{cpu} are the same as those available 14780for @option{-mtune}. The permissible values for @var{feature} are 14781documented in the sub-section on 14782@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu} 14783Feature Modifiers}. Where conflicting feature modifiers are 14784specified, the right-most feature is used. 14785 14786GCC uses @var{name} to determine what kind of instructions it can emit when 14787generating assembly code (as if by @option{-march}) and to determine 14788the target processor for which to tune for performance (as if 14789by @option{-mtune}). Where this option is used in conjunction 14790with @option{-march} or @option{-mtune}, those options take precedence 14791over the appropriate part of this option. 14792 14793@item -moverride=@var{string} 14794@opindex moverride 14795Override tuning decisions made by the back-end in response to a 14796@option{-mtune=} switch. The syntax, semantics, and accepted values 14797for @var{string} in this option are not guaranteed to be consistent 14798across releases. 14799 14800This option is only intended to be useful when developing GCC. 14801 14802@item -mverbose-cost-dump 14803@opindex mverbose-cost-dump 14804Enable verbose cost model dumping in the debug dump files. This option is 14805provided for use in debugging the compiler. 14806 14807@item -mpc-relative-literal-loads 14808@itemx -mno-pc-relative-literal-loads 14809@opindex mpc-relative-literal-loads 14810@opindex mno-pc-relative-literal-loads 14811Enable or disable PC-relative literal loads. With this option literal pools are 14812accessed using a single instruction and emitted after each function. This 14813limits the maximum size of functions to 1MB. This is enabled by default for 14814@option{-mcmodel=tiny}. 14815 14816@item -msign-return-address=@var{scope} 14817@opindex msign-return-address 14818Select the function scope on which return address signing will be applied. 14819Permissible values are @samp{none}, which disables return address signing, 14820@samp{non-leaf}, which enables pointer signing for functions which are not leaf 14821functions, and @samp{all}, which enables pointer signing for all functions. The 14822default value is @samp{none}. 14823 14824@item -msve-vector-bits=@var{bits} 14825@opindex msve-vector-bits 14826Specify the number of bits in an SVE vector register. This option only has 14827an effect when SVE is enabled. 14828 14829GCC supports two forms of SVE code generation: ``vector-length 14830agnostic'' output that works with any size of vector register and 14831``vector-length specific'' output that allows GCC to make assumptions 14832about the vector length when it is useful for optimization reasons. 14833The possible values of @samp{bits} are: @samp{scalable}, @samp{128}, 14834@samp{256}, @samp{512}, @samp{1024} and @samp{2048}. 14835Specifying @samp{scalable} selects vector-length agnostic 14836output. At present @samp{-msve-vector-bits=128} also generates vector-length 14837agnostic output. All other values generate vector-length specific code. 14838The behavior of these values may change in future releases and no value except 14839@samp{scalable} should be relied on for producing code that is portable across 14840different hardware SVE vector lengths. 14841 14842The default is @samp{-msve-vector-bits=scalable}, which produces 14843vector-length agnostic code. 14844@end table 14845 14846@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 14847@anchor{aarch64-feature-modifiers} 14848@cindex @option{-march} feature modifiers 14849@cindex @option{-mcpu} feature modifiers 14850Feature modifiers used with @option{-march} and @option{-mcpu} can be any of 14851the following and their inverses @option{no@var{feature}}: 14852 14853@table @samp 14854@item crc 14855Enable CRC extension. This is on by default for 14856@option{-march=armv8.1-a}. 14857@item crypto 14858Enable Crypto extension. This also enables Advanced SIMD and floating-point 14859instructions. 14860@item fp 14861Enable floating-point instructions. This is on by default for all possible 14862values for options @option{-march} and @option{-mcpu}. 14863@item simd 14864Enable Advanced SIMD instructions. This also enables floating-point 14865instructions. This is on by default for all possible values for options 14866@option{-march} and @option{-mcpu}. 14867@item sve 14868Enable Scalable Vector Extension instructions. This also enables Advanced 14869SIMD and floating-point instructions. 14870@item lse 14871Enable Large System Extension instructions. This is on by default for 14872@option{-march=armv8.1-a}. 14873@item rdma 14874Enable Round Double Multiply Accumulate instructions. This is on by default 14875for @option{-march=armv8.1-a}. 14876@item fp16 14877Enable FP16 extension. This also enables floating-point instructions. 14878@item fp16fml 14879Enable FP16 fmla extension. This also enables FP16 extensions and 14880floating-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. 14881 14882@item rcpc 14883Enable the RcPc extension. This does not change code generation from GCC, 14884but is passed on to the assembler, enabling inline asm statements to use 14885instructions from the RcPc extension. 14886@item dotprod 14887Enable the Dot Product extension. This also enables Advanced SIMD instructions. 14888@item aes 14889Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced 14890SIMD instructions. 14891@item sha2 14892Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions. 14893@item sha3 14894Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD 14895instructions. Use of this option with architectures prior to Armv8.2-A is not supported. 14896@item sm4 14897Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. 14898Use of this option with architectures prior to Armv8.2-A is not supported. 14899 14900@end table 14901 14902Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd}, 14903which implies @option{fp}. 14904Conversely, @option{nofp} implies @option{nosimd}, which implies 14905@option{nocrypto}, @option{noaes} and @option{nosha2}. 14906 14907@node Adapteva Epiphany Options 14908@subsection Adapteva Epiphany Options 14909 14910These @samp{-m} options are defined for Adapteva Epiphany: 14911 14912@table @gcctabopt 14913@item -mhalf-reg-file 14914@opindex mhalf-reg-file 14915Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 14916That allows code to run on hardware variants that lack these registers. 14917 14918@item -mprefer-short-insn-regs 14919@opindex mprefer-short-insn-regs 14920Preferentially allocate registers that allow short instruction generation. 14921This can result in increased instruction count, so this may either reduce or 14922increase overall code size. 14923 14924@item -mbranch-cost=@var{num} 14925@opindex mbranch-cost 14926Set the cost of branches to roughly @var{num} ``simple'' instructions. 14927This cost is only a heuristic and is not guaranteed to produce 14928consistent results across releases. 14929 14930@item -mcmove 14931@opindex mcmove 14932Enable the generation of conditional moves. 14933 14934@item -mnops=@var{num} 14935@opindex mnops 14936Emit @var{num} NOPs before every other generated instruction. 14937 14938@item -mno-soft-cmpsf 14939@opindex mno-soft-cmpsf 14940For single-precision floating-point comparisons, emit an @code{fsub} instruction 14941and test the flags. This is faster than a software comparison, but can 14942get incorrect results in the presence of NaNs, or when two different small 14943numbers are compared such that their difference is calculated as zero. 14944The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 14945software comparisons. 14946 14947@item -mstack-offset=@var{num} 14948@opindex mstack-offset 14949Set the offset between the top of the stack and the stack pointer. 14950E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 14951can be used by leaf functions without stack allocation. 14952Values other than @samp{8} or @samp{16} are untested and unlikely to work. 14953Note also that this option changes the ABI; compiling a program with a 14954different stack offset than the libraries have been compiled with 14955generally does not work. 14956This option can be useful if you want to evaluate if a different stack 14957offset would give you better code, but to actually use a different stack 14958offset to build working programs, it is recommended to configure the 14959toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 14960 14961@item -mno-round-nearest 14962@opindex mno-round-nearest 14963Make the scheduler assume that the rounding mode has been set to 14964truncating. The default is @option{-mround-nearest}. 14965 14966@item -mlong-calls 14967@opindex mlong-calls 14968If not otherwise specified by an attribute, assume all calls might be beyond 14969the offset range of the @code{b} / @code{bl} instructions, and therefore load the 14970function address into a register before performing a (otherwise direct) call. 14971This is the default. 14972 14973@item -mshort-calls 14974@opindex short-calls 14975If not otherwise specified by an attribute, assume all direct calls are 14976in the range of the @code{b} / @code{bl} instructions, so use these instructions 14977for direct calls. The default is @option{-mlong-calls}. 14978 14979@item -msmall16 14980@opindex msmall16 14981Assume addresses can be loaded as 16-bit unsigned values. This does not 14982apply to function addresses for which @option{-mlong-calls} semantics 14983are in effect. 14984 14985@item -mfp-mode=@var{mode} 14986@opindex mfp-mode 14987Set the prevailing mode of the floating-point unit. 14988This determines the floating-point mode that is provided and expected 14989at function call and return time. Making this mode match the mode you 14990predominantly need at function start can make your programs smaller and 14991faster by avoiding unnecessary mode switches. 14992 14993@var{mode} can be set to one the following values: 14994 14995@table @samp 14996@item caller 14997Any mode at function entry is valid, and retained or restored when 14998the function returns, and when it calls other functions. 14999This mode is useful for compiling libraries or other compilation units 15000you might want to incorporate into different programs with different 15001prevailing FPU modes, and the convenience of being able to use a single 15002object file outweighs the size and speed overhead for any extra 15003mode switching that might be needed, compared with what would be needed 15004with a more specific choice of prevailing FPU mode. 15005 15006@item truncate 15007This is the mode used for floating-point calculations with 15008truncating (i.e.@: round towards zero) rounding mode. That includes 15009conversion from floating point to integer. 15010 15011@item round-nearest 15012This is the mode used for floating-point calculations with 15013round-to-nearest-or-even rounding mode. 15014 15015@item int 15016This is the mode used to perform integer calculations in the FPU, e.g.@: 15017integer multiply, or integer multiply-and-accumulate. 15018@end table 15019 15020The default is @option{-mfp-mode=caller} 15021 15022@item -mnosplit-lohi 15023@itemx -mno-postinc 15024@itemx -mno-postmodify 15025@opindex mnosplit-lohi 15026@opindex mno-postinc 15027@opindex mno-postmodify 15028Code generation tweaks that disable, respectively, splitting of 32-bit 15029loads, generation of post-increment addresses, and generation of 15030post-modify addresses. The defaults are @option{msplit-lohi}, 15031@option{-mpost-inc}, and @option{-mpost-modify}. 15032 15033@item -mnovect-double 15034@opindex mno-vect-double 15035Change the preferred SIMD mode to SImode. The default is 15036@option{-mvect-double}, which uses DImode as preferred SIMD mode. 15037 15038@item -max-vect-align=@var{num} 15039@opindex max-vect-align 15040The maximum alignment for SIMD vector mode types. 15041@var{num} may be 4 or 8. The default is 8. 15042Note that this is an ABI change, even though many library function 15043interfaces are unaffected if they don't use SIMD vector modes 15044in places that affect size and/or alignment of relevant types. 15045 15046@item -msplit-vecmove-early 15047@opindex msplit-vecmove-early 15048Split vector moves into single word moves before reload. In theory this 15049can give better register allocation, but so far the reverse seems to be 15050generally the case. 15051 15052@item -m1reg-@var{reg} 15053@opindex m1reg- 15054Specify a register to hold the constant @minus{}1, which makes loading small negative 15055constants and certain bitmasks faster. 15056Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 15057which specify use of that register as a fixed register, 15058and @samp{none}, which means that no register is used for this 15059purpose. The default is @option{-m1reg-none}. 15060 15061@end table 15062 15063@node ARC Options 15064@subsection ARC Options 15065@cindex ARC options 15066 15067The following options control the architecture variant for which code 15068is being compiled: 15069 15070@c architecture variants 15071@table @gcctabopt 15072 15073@item -mbarrel-shifter 15074@opindex mbarrel-shifter 15075Generate instructions supported by barrel shifter. This is the default 15076unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect. 15077 15078@item -mjli-always 15079@opindex mjli-alawys 15080Force to call a function using jli_s instruction. This option is 15081valid only for ARCv2 architecture. 15082 15083@item -mcpu=@var{cpu} 15084@opindex mcpu 15085Set architecture type, register usage, and instruction scheduling 15086parameters for @var{cpu}. There are also shortcut alias options 15087available for backward compatibility and convenience. Supported 15088values for @var{cpu} are 15089 15090@table @samp 15091@opindex mA6 15092@opindex mARC600 15093@item arc600 15094Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 15095 15096@item arc601 15097@opindex mARC601 15098Compile for ARC601. Alias: @option{-mARC601}. 15099 15100@item arc700 15101@opindex mA7 15102@opindex mARC700 15103Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 15104This is the default when configured with @option{--with-cpu=arc700}@. 15105 15106@item arcem 15107Compile for ARC EM. 15108 15109@item archs 15110Compile for ARC HS. 15111 15112@item em 15113Compile for ARC EM CPU with no hardware extensions. 15114 15115@item em4 15116Compile for ARC EM4 CPU. 15117 15118@item em4_dmips 15119Compile for ARC EM4 DMIPS CPU. 15120 15121@item em4_fpus 15122Compile for ARC EM4 DMIPS CPU with the single-precision floating-point 15123extension. 15124 15125@item em4_fpuda 15126Compile for ARC EM4 DMIPS CPU with single-precision floating-point and 15127double assist instructions. 15128 15129@item hs 15130Compile for ARC HS CPU with no hardware extensions except the atomic 15131instructions. 15132 15133@item hs34 15134Compile for ARC HS34 CPU. 15135 15136@item hs38 15137Compile for ARC HS38 CPU. 15138 15139@item hs38_linux 15140Compile for ARC HS38 CPU with all hardware extensions on. 15141 15142@item arc600_norm 15143Compile for ARC 600 CPU with @code{norm} instructions enabled. 15144 15145@item arc600_mul32x16 15146Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 15147instructions enabled. 15148 15149@item arc600_mul64 15150Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 15151instructions enabled. 15152 15153@item arc601_norm 15154Compile for ARC 601 CPU with @code{norm} instructions enabled. 15155 15156@item arc601_mul32x16 15157Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply 15158instructions enabled. 15159 15160@item arc601_mul64 15161Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family 15162instructions enabled. 15163 15164@item nps400 15165Compile for ARC 700 on NPS400 chip. 15166 15167@item em_mini 15168Compile for ARC EM minimalist configuration featuring reduced register 15169set. 15170 15171@end table 15172 15173@item -mdpfp 15174@opindex mdpfp 15175@itemx -mdpfp-compact 15176@opindex mdpfp-compact 15177Generate double-precision FPX instructions, tuned for the compact 15178implementation. 15179 15180@item -mdpfp-fast 15181@opindex mdpfp-fast 15182Generate double-precision FPX instructions, tuned for the fast 15183implementation. 15184 15185@item -mno-dpfp-lrsr 15186@opindex mno-dpfp-lrsr 15187Disable @code{lr} and @code{sr} instructions from using FPX extension 15188aux registers. 15189 15190@item -mea 15191@opindex mea 15192Generate extended arithmetic instructions. Currently only 15193@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 15194supported. This is always enabled for @option{-mcpu=ARC700}. 15195 15196@item -mno-mpy 15197@opindex mno-mpy 15198Do not generate @code{mpy}-family instructions for ARC700. This option is 15199deprecated. 15200 15201@item -mmul32x16 15202@opindex mmul32x16 15203Generate 32x16-bit multiply and multiply-accumulate instructions. 15204 15205@item -mmul64 15206@opindex mmul64 15207Generate @code{mul64} and @code{mulu64} instructions. 15208Only valid for @option{-mcpu=ARC600}. 15209 15210@item -mnorm 15211@opindex mnorm 15212Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700} 15213is in effect. 15214 15215@item -mspfp 15216@opindex mspfp 15217@itemx -mspfp-compact 15218@opindex mspfp-compact 15219Generate single-precision FPX instructions, tuned for the compact 15220implementation. 15221 15222@item -mspfp-fast 15223@opindex mspfp-fast 15224Generate single-precision FPX instructions, tuned for the fast 15225implementation. 15226 15227@item -msimd 15228@opindex msimd 15229Enable generation of ARC SIMD instructions via target-specific 15230builtins. Only valid for @option{-mcpu=ARC700}. 15231 15232@item -msoft-float 15233@opindex msoft-float 15234This option ignored; it is provided for compatibility purposes only. 15235Software floating-point code is emitted by default, and this default 15236can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or 15237@option{-mspfp-fast} for single precision, and @option{-mdpfp}, 15238@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision. 15239 15240@item -mswap 15241@opindex mswap 15242Generate @code{swap} instructions. 15243 15244@item -matomic 15245@opindex matomic 15246This enables use of the locked load/store conditional extension to implement 15247atomic memory built-in functions. Not available for ARC 6xx or ARC 15248EM cores. 15249 15250@item -mdiv-rem 15251@opindex mdiv-rem 15252Enable @code{div} and @code{rem} instructions for ARCv2 cores. 15253 15254@item -mcode-density 15255@opindex mcode-density 15256Enable code density instructions for ARC EM. 15257This option is on by default for ARC HS. 15258 15259@item -mll64 15260@opindex mll64 15261Enable double load/store operations for ARC HS cores. 15262 15263@item -mtp-regno=@var{regno} 15264@opindex mtp-regno 15265Specify thread pointer register number. 15266 15267@item -mmpy-option=@var{multo} 15268@opindex mmpy-option 15269Compile ARCv2 code with a multiplier design option. You can specify 15270the option using either a string or numeric value for @var{multo}. 15271@samp{wlh1} is the default value. The recognized values are: 15272 15273@table @samp 15274@item 0 15275@itemx none 15276No multiplier available. 15277 15278@item 1 15279@itemx w 1528016x16 multiplier, fully pipelined. 15281The following instructions are enabled: @code{mpyw} and @code{mpyuw}. 15282 15283@item 2 15284@itemx wlh1 1528532x32 multiplier, fully 15286pipelined (1 stage). The following instructions are additionally 15287enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 15288 15289@item 3 15290@itemx wlh2 1529132x32 multiplier, fully pipelined 15292(2 stages). The following instructions are additionally enabled: @code{mpy}, 15293@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 15294 15295@item 4 15296@itemx wlh3 15297Two 16x16 multipliers, blocking, 15298sequential. The following instructions are additionally enabled: @code{mpy}, 15299@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 15300 15301@item 5 15302@itemx wlh4 15303One 16x16 multiplier, blocking, 15304sequential. The following instructions are additionally enabled: @code{mpy}, 15305@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 15306 15307@item 6 15308@itemx wlh5 15309One 32x4 multiplier, blocking, 15310sequential. The following instructions are additionally enabled: @code{mpy}, 15311@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}. 15312 15313@item 7 15314@itemx plus_dmpy 15315ARC HS SIMD support. 15316 15317@item 8 15318@itemx plus_macd 15319ARC HS SIMD support. 15320 15321@item 9 15322@itemx plus_qmacw 15323ARC HS SIMD support. 15324 15325@end table 15326 15327This option is only available for ARCv2 cores@. 15328 15329@item -mfpu=@var{fpu} 15330@opindex mfpu 15331Enables support for specific floating-point hardware extensions for ARCv2 15332cores. Supported values for @var{fpu} are: 15333 15334@table @samp 15335 15336@item fpus 15337Enables support for single-precision floating-point hardware 15338extensions@. 15339 15340@item fpud 15341Enables support for double-precision floating-point hardware 15342extensions. The single-precision floating-point extension is also 15343enabled. Not available for ARC EM@. 15344 15345@item fpuda 15346Enables support for double-precision floating-point hardware 15347extensions using double-precision assist instructions. The single-precision 15348floating-point extension is also enabled. This option is 15349only available for ARC EM@. 15350 15351@item fpuda_div 15352Enables support for double-precision floating-point hardware 15353extensions using double-precision assist instructions. 15354The single-precision floating-point, square-root, and divide 15355extensions are also enabled. This option is 15356only available for ARC EM@. 15357 15358@item fpuda_fma 15359Enables support for double-precision floating-point hardware 15360extensions using double-precision assist instructions. 15361The single-precision floating-point and fused multiply and add 15362hardware extensions are also enabled. This option is 15363only available for ARC EM@. 15364 15365@item fpuda_all 15366Enables support for double-precision floating-point hardware 15367extensions using double-precision assist instructions. 15368All single-precision floating-point hardware extensions are also 15369enabled. This option is only available for ARC EM@. 15370 15371@item fpus_div 15372Enables support for single-precision floating-point, square-root and divide 15373hardware extensions@. 15374 15375@item fpud_div 15376Enables support for double-precision floating-point, square-root and divide 15377hardware extensions. This option 15378includes option @samp{fpus_div}. Not available for ARC EM@. 15379 15380@item fpus_fma 15381Enables support for single-precision floating-point and 15382fused multiply and add hardware extensions@. 15383 15384@item fpud_fma 15385Enables support for double-precision floating-point and 15386fused multiply and add hardware extensions. This option 15387includes option @samp{fpus_fma}. Not available for ARC EM@. 15388 15389@item fpus_all 15390Enables support for all single-precision floating-point hardware 15391extensions@. 15392 15393@item fpud_all 15394Enables support for all single- and double-precision floating-point 15395hardware extensions. Not available for ARC EM@. 15396 15397@end table 15398 15399@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count} 15400@opindex mirq-ctrl-saved 15401Specifies general-purposes registers that the processor automatically 15402saves/restores on interrupt entry and exit. @var{register-range} is 15403specified as two registers separated by a dash. The register range 15404always starts with @code{r0}, the upper limit is @code{fp} register. 15405@var{blink} and @var{lp_count} are optional. This option is only 15406valid for ARC EM and ARC HS cores. 15407 15408@item -mrgf-banked-regs=@var{number} 15409@opindex mrgf-banked-regs 15410Specifies the number of registers replicated in second register bank 15411on entry to fast interrupt. Fast interrupts are interrupts with the 15412highest priority level P0. These interrupts save only PC and STATUS32 15413registers to avoid memory transactions during interrupt entry and exit 15414sequences. Use this option when you are using fast interrupts in an 15415ARC V2 family processor. Permitted values are 4, 8, 16, and 32. 15416 15417@item -mlpc-width=@var{width} 15418@opindex mlpc-width 15419Specify the width of the @code{lp_count} register. Valid values for 15420@var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is 15421fixed to 32 bits. If the width is less than 32, the compiler does not 15422attempt to transform loops in your program to use the zero-delay loop 15423mechanism unless it is known that the @code{lp_count} register can 15424hold the required loop-counter value. Depending on the width 15425specified, the compiler and run-time library might continue to use the 15426loop mechanism for various needs. This option defines macro 15427@code{__ARC_LPC_WIDTH__} with the value of @var{width}. 15428 15429@item -mrf16 15430@opindex mrf16 15431This option instructs the compiler to generate code for a 16-entry 15432register file. This option defines the @code{__ARC_RF16__} 15433preprocessor macro. 15434 15435@end table 15436 15437The following options are passed through to the assembler, and also 15438define preprocessor macro symbols. 15439 15440@c Flags used by the assembler, but for which we define preprocessor 15441@c macro symbols as well. 15442@table @gcctabopt 15443@item -mdsp-packa 15444@opindex mdsp-packa 15445Passed down to the assembler to enable the DSP Pack A extensions. 15446Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is 15447deprecated. 15448 15449@item -mdvbf 15450@opindex mdvbf 15451Passed down to the assembler to enable the dual Viterbi butterfly 15452extension. Also sets the preprocessor symbol @code{__Xdvbf}. This 15453option is deprecated. 15454 15455@c ARC700 4.10 extension instruction 15456@item -mlock 15457@opindex mlock 15458Passed down to the assembler to enable the locked load/store 15459conditional extension. Also sets the preprocessor symbol 15460@code{__Xlock}. 15461 15462@item -mmac-d16 15463@opindex mmac-d16 15464Passed down to the assembler. Also sets the preprocessor symbol 15465@code{__Xxmac_d16}. This option is deprecated. 15466 15467@item -mmac-24 15468@opindex mmac-24 15469Passed down to the assembler. Also sets the preprocessor symbol 15470@code{__Xxmac_24}. This option is deprecated. 15471 15472@c ARC700 4.10 extension instruction 15473@item -mrtsc 15474@opindex mrtsc 15475Passed down to the assembler to enable the 64-bit time-stamp counter 15476extension instruction. Also sets the preprocessor symbol 15477@code{__Xrtsc}. This option is deprecated. 15478 15479@c ARC700 4.10 extension instruction 15480@item -mswape 15481@opindex mswape 15482Passed down to the assembler to enable the swap byte ordering 15483extension instruction. Also sets the preprocessor symbol 15484@code{__Xswape}. 15485 15486@item -mtelephony 15487@opindex mtelephony 15488Passed down to the assembler to enable dual- and single-operand 15489instructions for telephony. Also sets the preprocessor symbol 15490@code{__Xtelephony}. This option is deprecated. 15491 15492@item -mxy 15493@opindex mxy 15494Passed down to the assembler to enable the XY memory extension. Also 15495sets the preprocessor symbol @code{__Xxy}. 15496 15497@end table 15498 15499The following options control how the assembly code is annotated: 15500 15501@c Assembly annotation options 15502@table @gcctabopt 15503@item -misize 15504@opindex misize 15505Annotate assembler instructions with estimated addresses. 15506 15507@item -mannotate-align 15508@opindex mannotate-align 15509Explain what alignment considerations lead to the decision to make an 15510instruction short or long. 15511 15512@end table 15513 15514The following options are passed through to the linker: 15515 15516@c options passed through to the linker 15517@table @gcctabopt 15518@item -marclinux 15519@opindex marclinux 15520Passed through to the linker, to specify use of the @code{arclinux} emulation. 15521This option is enabled by default in tool chains built for 15522@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 15523when profiling is not requested. 15524 15525@item -marclinux_prof 15526@opindex marclinux_prof 15527Passed through to the linker, to specify use of the 15528@code{arclinux_prof} emulation. This option is enabled by default in 15529tool chains built for @w{@code{arc-linux-uclibc}} and 15530@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 15531 15532@end table 15533 15534The following options control the semantics of generated code: 15535 15536@c semantically relevant code generation options 15537@table @gcctabopt 15538@item -mlong-calls 15539@opindex mlong-calls 15540Generate calls as register indirect calls, thus providing access 15541to the full 32-bit address range. 15542 15543@item -mmedium-calls 15544@opindex mmedium-calls 15545Don't use less than 25-bit addressing range for calls, which is the 15546offset available for an unconditional branch-and-link 15547instruction. Conditional execution of function calls is suppressed, to 15548allow use of the 25-bit range, rather than the 21-bit range with 15549conditional branch-and-link. This is the default for tool chains built 15550for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 15551 15552@item -G @var{num} 15553@opindex G 15554Put definitions of externally-visible data in a small data section if 15555that data is no bigger than @var{num} bytes. The default value of 15556@var{num} is 4 for any ARC configuration, or 8 when we have double 15557load/store operations. 15558 15559@item -mno-sdata 15560@opindex mno-sdata 15561Do not generate sdata references. This is the default for tool chains 15562built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 15563targets. 15564 15565@item -mvolatile-cache 15566@opindex mvolatile-cache 15567Use ordinarily cached memory accesses for volatile references. This is the 15568default. 15569 15570@item -mno-volatile-cache 15571@opindex mno-volatile-cache 15572Enable cache bypass for volatile references. 15573 15574@end table 15575 15576The following options fine tune code generation: 15577@c code generation tuning options 15578@table @gcctabopt 15579@item -malign-call 15580@opindex malign-call 15581Do alignment optimizations for call instructions. 15582 15583@item -mauto-modify-reg 15584@opindex mauto-modify-reg 15585Enable the use of pre/post modify with register displacement. 15586 15587@item -mbbit-peephole 15588@opindex mbbit-peephole 15589Enable bbit peephole2. 15590 15591@item -mno-brcc 15592@opindex mno-brcc 15593This option disables a target-specific pass in @file{arc_reorg} to 15594generate compare-and-branch (@code{br@var{cc}}) instructions. 15595It has no effect on 15596generation of these instructions driven by the combiner pass. 15597 15598@item -mcase-vector-pcrel 15599@opindex mcase-vector-pcrel 15600Use PC-relative switch case tables to enable case table shortening. 15601This is the default for @option{-Os}. 15602 15603@item -mcompact-casesi 15604@opindex mcompact-casesi 15605Enable compact @code{casesi} pattern. This is the default for @option{-Os}, 15606and only available for ARCv1 cores. 15607 15608@item -mno-cond-exec 15609@opindex mno-cond-exec 15610Disable the ARCompact-specific pass to generate conditional 15611execution instructions. 15612 15613Due to delay slot scheduling and interactions between operand numbers, 15614literal sizes, instruction lengths, and the support for conditional execution, 15615the target-independent pass to generate conditional execution is often lacking, 15616so the ARC port has kept a special pass around that tries to find more 15617conditional execution generation opportunities after register allocation, 15618branch shortening, and delay slot scheduling have been done. This pass 15619generally, but not always, improves performance and code size, at the cost of 15620extra compilation time, which is why there is an option to switch it off. 15621If you have a problem with call instructions exceeding their allowable 15622offset range because they are conditionalized, you should consider using 15623@option{-mmedium-calls} instead. 15624 15625@item -mearly-cbranchsi 15626@opindex mearly-cbranchsi 15627Enable pre-reload use of the @code{cbranchsi} pattern. 15628 15629@item -mexpand-adddi 15630@opindex mexpand-adddi 15631Expand @code{adddi3} and @code{subdi3} at RTL generation time into 15632@code{add.f}, @code{adc} etc. This option is deprecated. 15633 15634@item -mindexed-loads 15635@opindex mindexed-loads 15636Enable the use of indexed loads. This can be problematic because some 15637optimizers then assume that indexed stores exist, which is not 15638the case. 15639 15640@item -mlra 15641@opindex mlra 15642Enable Local Register Allocation. This is still experimental for ARC, 15643so by default the compiler uses standard reload 15644(i.e. @option{-mno-lra}). 15645 15646@item -mlra-priority-none 15647@opindex mlra-priority-none 15648Don't indicate any priority for target registers. 15649 15650@item -mlra-priority-compact 15651@opindex mlra-priority-compact 15652Indicate target register priority for r0..r3 / r12..r15. 15653 15654@item -mlra-priority-noncompact 15655@opindex mlra-priority-noncompact 15656Reduce target register priority for r0..r3 / r12..r15. 15657 15658@item -mno-millicode 15659@opindex mno-millicode 15660When optimizing for size (using @option{-Os}), prologues and epilogues 15661that have to save or restore a large number of registers are often 15662shortened by using call to a special function in libgcc; this is 15663referred to as a @emph{millicode} call. As these calls can pose 15664performance issues, and/or cause linking issues when linking in a 15665nonstandard way, this option is provided to turn off millicode call 15666generation. 15667 15668@item -mmixed-code 15669@opindex mmixed-code 15670Tweak register allocation to help 16-bit instruction generation. 15671This generally has the effect of decreasing the average instruction size 15672while increasing the instruction count. 15673 15674@item -mq-class 15675@opindex mq-class 15676Enable @samp{q} instruction alternatives. 15677This is the default for @option{-Os}. 15678 15679@item -mRcq 15680@opindex mRcq 15681Enable @samp{Rcq} constraint handling. 15682Most short code generation depends on this. 15683This is the default. 15684 15685@item -mRcw 15686@opindex mRcw 15687Enable @samp{Rcw} constraint handling. 15688Most ccfsm condexec mostly depends on this. 15689This is the default. 15690 15691@item -msize-level=@var{level} 15692@opindex msize-level 15693Fine-tune size optimization with regards to instruction lengths and alignment. 15694The recognized values for @var{level} are: 15695@table @samp 15696@item 0 15697No size optimization. This level is deprecated and treated like @samp{1}. 15698 15699@item 1 15700Short instructions are used opportunistically. 15701 15702@item 2 15703In addition, alignment of loops and of code after barriers are dropped. 15704 15705@item 3 15706In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 15707 15708@end table 15709 15710This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 15711the behavior when this is not set is equivalent to level @samp{1}. 15712 15713@item -mtune=@var{cpu} 15714@opindex mtune 15715Set instruction scheduling parameters for @var{cpu}, overriding any implied 15716by @option{-mcpu=}. 15717 15718Supported values for @var{cpu} are 15719 15720@table @samp 15721@item ARC600 15722Tune for ARC600 CPU. 15723 15724@item ARC601 15725Tune for ARC601 CPU. 15726 15727@item ARC700 15728Tune for ARC700 CPU with standard multiplier block. 15729 15730@item ARC700-xmac 15731Tune for ARC700 CPU with XMAC block. 15732 15733@item ARC725D 15734Tune for ARC725D CPU. 15735 15736@item ARC750D 15737Tune for ARC750D CPU. 15738 15739@end table 15740 15741@item -mmultcost=@var{num} 15742@opindex mmultcost 15743Cost to assume for a multiply instruction, with @samp{4} being equal to a 15744normal instruction. 15745 15746@item -munalign-prob-threshold=@var{probability} 15747@opindex munalign-prob-threshold 15748Set probability threshold for unaligning branches. 15749When tuning for @samp{ARC700} and optimizing for speed, branches without 15750filled delay slot are preferably emitted unaligned and long, unless 15751profiling indicates that the probability for the branch to be taken 15752is below @var{probability}. @xref{Cross-profiling}. 15753The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. 15754 15755@end table 15756 15757The following options are maintained for backward compatibility, but 15758are now deprecated and will be removed in a future release: 15759 15760@c Deprecated options 15761@table @gcctabopt 15762 15763@item -margonaut 15764@opindex margonaut 15765Obsolete FPX. 15766 15767@item -mbig-endian 15768@opindex mbig-endian 15769@itemx -EB 15770@opindex EB 15771Compile code for big-endian targets. Use of these options is now 15772deprecated. Big-endian code is supported by configuring GCC to build 15773@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets, 15774for which big endian is the default. 15775 15776@item -mlittle-endian 15777@opindex mlittle-endian 15778@itemx -EL 15779@opindex EL 15780Compile code for little-endian targets. Use of these options is now 15781deprecated. Little-endian code is supported by configuring GCC to build 15782@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets, 15783for which little endian is the default. 15784 15785@item -mbarrel_shifter 15786@opindex mbarrel_shifter 15787Replaced by @option{-mbarrel-shifter}. 15788 15789@item -mdpfp_compact 15790@opindex mdpfp_compact 15791Replaced by @option{-mdpfp-compact}. 15792 15793@item -mdpfp_fast 15794@opindex mdpfp_fast 15795Replaced by @option{-mdpfp-fast}. 15796 15797@item -mdsp_packa 15798@opindex mdsp_packa 15799Replaced by @option{-mdsp-packa}. 15800 15801@item -mEA 15802@opindex mEA 15803Replaced by @option{-mea}. 15804 15805@item -mmac_24 15806@opindex mmac_24 15807Replaced by @option{-mmac-24}. 15808 15809@item -mmac_d16 15810@opindex mmac_d16 15811Replaced by @option{-mmac-d16}. 15812 15813@item -mspfp_compact 15814@opindex mspfp_compact 15815Replaced by @option{-mspfp-compact}. 15816 15817@item -mspfp_fast 15818@opindex mspfp_fast 15819Replaced by @option{-mspfp-fast}. 15820 15821@item -mtune=@var{cpu} 15822@opindex mtune 15823Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 15824@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 15825@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively. 15826 15827@item -multcost=@var{num} 15828@opindex multcost 15829Replaced by @option{-mmultcost}. 15830 15831@end table 15832 15833@node ARM Options 15834@subsection ARM Options 15835@cindex ARM options 15836 15837These @samp{-m} options are defined for the ARM port: 15838 15839@table @gcctabopt 15840@item -mabi=@var{name} 15841@opindex mabi 15842Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 15843@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 15844 15845@item -mapcs-frame 15846@opindex mapcs-frame 15847Generate a stack frame that is compliant with the ARM Procedure Call 15848Standard for all functions, even if this is not strictly necessary for 15849correct execution of the code. Specifying @option{-fomit-frame-pointer} 15850with this option causes the stack frames not to be generated for 15851leaf functions. The default is @option{-mno-apcs-frame}. 15852This option is deprecated. 15853 15854@item -mapcs 15855@opindex mapcs 15856This is a synonym for @option{-mapcs-frame} and is deprecated. 15857 15858@ignore 15859@c not currently implemented 15860@item -mapcs-stack-check 15861@opindex mapcs-stack-check 15862Generate code to check the amount of stack space available upon entry to 15863every function (that actually uses some stack space). If there is 15864insufficient space available then either the function 15865@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 15866called, depending upon the amount of stack space required. The runtime 15867system is required to provide these functions. The default is 15868@option{-mno-apcs-stack-check}, since this produces smaller code. 15869 15870@c not currently implemented 15871@item -mapcs-reentrant 15872@opindex mapcs-reentrant 15873Generate reentrant, position-independent code. The default is 15874@option{-mno-apcs-reentrant}. 15875@end ignore 15876 15877@item -mthumb-interwork 15878@opindex mthumb-interwork 15879Generate code that supports calling between the ARM and Thumb 15880instruction sets. Without this option, on pre-v5 architectures, the 15881two instruction sets cannot be reliably used inside one program. The 15882default is @option{-mno-thumb-interwork}, since slightly larger code 15883is generated when @option{-mthumb-interwork} is specified. In AAPCS 15884configurations this option is meaningless. 15885 15886@item -mno-sched-prolog 15887@opindex mno-sched-prolog 15888Prevent the reordering of instructions in the function prologue, or the 15889merging of those instruction with the instructions in the function's 15890body. This means that all functions start with a recognizable set 15891of instructions (or in fact one of a choice from a small set of 15892different function prologues), and this information can be used to 15893locate the start of functions inside an executable piece of code. The 15894default is @option{-msched-prolog}. 15895 15896@item -mfloat-abi=@var{name} 15897@opindex mfloat-abi 15898Specifies which floating-point ABI to use. Permissible values 15899are: @samp{soft}, @samp{softfp} and @samp{hard}. 15900 15901Specifying @samp{soft} causes GCC to generate output containing 15902library calls for floating-point operations. 15903@samp{softfp} allows the generation of code using hardware floating-point 15904instructions, but still uses the soft-float calling conventions. 15905@samp{hard} allows generation of floating-point instructions 15906and uses FPU-specific calling conventions. 15907 15908The default depends on the specific target configuration. Note that 15909the hard-float and soft-float ABIs are not link-compatible; you must 15910compile your entire program with the same ABI, and link with a 15911compatible set of libraries. 15912 15913@item -mlittle-endian 15914@opindex mlittle-endian 15915Generate code for a processor running in little-endian mode. This is 15916the default for all standard configurations. 15917 15918@item -mbig-endian 15919@opindex mbig-endian 15920Generate code for a processor running in big-endian mode; the default is 15921to compile code for a little-endian processor. 15922 15923@item -mbe8 15924@itemx -mbe32 15925@opindex mbe8 15926When linking a big-endian image select between BE8 and BE32 formats. 15927The option has no effect for little-endian images and is ignored. The 15928default is dependent on the selected target architecture. For ARMv6 15929and later architectures the default is BE8, for older architectures 15930the default is BE32. BE32 format has been deprecated by ARM. 15931 15932@item -march=@var{name}@r{[}+extension@dots{}@r{]} 15933@opindex march 15934This specifies the name of the target ARM architecture. GCC uses this 15935name to determine what kind of instructions it can emit when generating 15936assembly code. This option can be used in conjunction with or instead 15937of the @option{-mcpu=} option. 15938 15939Permissible names are: 15940@samp{armv4t}, 15941@samp{armv5t}, @samp{armv5te}, 15942@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2}, 15943@samp{armv6z}, @samp{armv6zk}, 15944@samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 15945@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, 15946@samp{armv8.4-a}, 15947@samp{armv7-r}, 15948@samp{armv8-r}, 15949@samp{armv6-m}, @samp{armv6s-m}, 15950@samp{armv7-m}, @samp{armv7e-m}, 15951@samp{armv8-m.base}, @samp{armv8-m.main}, 15952@samp{iwmmxt} and @samp{iwmmxt2}. 15953 15954Additionally, the following architectures, which lack support for the 15955Thumb execution state, are recognized but support is deprecated: 15956@samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m}, 15957@samp{armv4}, @samp{armv5} and @samp{armv5e}. 15958 15959Many of the architectures support extensions. These can be added by 15960appending @samp{+@var{extension}} to the architecture name. Extension 15961options are processed in order and capabilities accumulate. An extension 15962will also enable any necessary base extensions 15963upon which it depends. For example, the @samp{+crypto} extension 15964will always enable the @samp{+simd} extension. The exception to the 15965additive construction is for extensions that are prefixed with 15966@samp{+no@dots{}}: these extensions disable the specified option and 15967any other extensions that may depend on the presence of that 15968extension. 15969 15970For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to 15971writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is 15972entirely disabled by the @samp{+nofp} option that follows it. 15973 15974Most extension names are generically named, but have an effect that is 15975dependent upon the architecture to which it is applied. For example, 15976the @samp{+simd} option can be applied to both @samp{armv7-a} and 15977@samp{armv8-a} architectures, but will enable the original ARMv7-A 15978Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A 15979variant for @samp{armv8-a}. 15980 15981The table below lists the supported extensions for each architecture. 15982Architectures not mentioned do not support any extensions. 15983 15984@table @samp 15985@item armv5e 15986@itemx armv5te 15987@itemx armv6 15988@itemx armv6j 15989@itemx armv6k 15990@itemx armv6kz 15991@itemx armv6t2 15992@itemx armv6z 15993@itemx armv6zk 15994@table @samp 15995@item +fp 15996The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be 15997used as an alias for this extension. 15998 15999@item +nofp 16000Disable the floating-point instructions. 16001@end table 16002 16003@item armv7 16004The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures. 16005@table @samp 16006@item +fp 16007The VFPv3 floating-point instructions, with 16 double-precision 16008registers. The extension @samp{+vfpv3-d16} can be used as an alias 16009for this extension. Note that floating-point is not supported by the 16010base ARMv7-M architecture, but is compatible with both the ARMv7-A and 16011ARMv7-R architectures. 16012 16013@item +nofp 16014Disable the floating-point instructions. 16015@end table 16016 16017@item armv7-a 16018@table @samp 16019@item +mp 16020The multiprocessing extension. 16021 16022@item +sec 16023The security extension. 16024 16025@item +fp 16026The VFPv3 floating-point instructions, with 16 double-precision 16027registers. The extension @samp{+vfpv3-d16} can be used as an alias 16028for this extension. 16029 16030@item +simd 16031The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 16032The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases 16033for this extension. 16034 16035@item +vfpv3 16036The VFPv3 floating-point instructions, with 32 double-precision 16037registers. 16038 16039@item +vfpv3-d16-fp16 16040The VFPv3 floating-point instructions, with 16 double-precision 16041registers and the half-precision floating-point conversion operations. 16042 16043@item +vfpv3-fp16 16044The VFPv3 floating-point instructions, with 32 double-precision 16045registers and the half-precision floating-point conversion operations. 16046 16047@item +vfpv4-d16 16048The VFPv4 floating-point instructions, with 16 double-precision 16049registers. 16050 16051@item +vfpv4 16052The VFPv4 floating-point instructions, with 32 double-precision 16053registers. 16054 16055@item +neon-fp16 16056The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 16057the half-precision floating-point conversion operations. 16058 16059@item +neon-vfpv4 16060The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. 16061 16062@item +nosimd 16063Disable the Advanced SIMD instructions (does not disable floating point). 16064 16065@item +nofp 16066Disable the floating-point and Advanced SIMD instructions. 16067@end table 16068 16069@item armv7ve 16070The extended version of the ARMv7-A architecture with support for 16071virtualization. 16072@table @samp 16073@item +fp 16074The VFPv4 floating-point instructions, with 16 double-precision registers. 16075The extension @samp{+vfpv4-d16} can be used as an alias for this extension. 16076 16077@item +simd 16078The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The 16079extension @samp{+neon-vfpv4} can be used as an alias for this extension. 16080 16081@item +vfpv3-d16 16082The VFPv3 floating-point instructions, with 16 double-precision 16083registers. 16084 16085@item +vfpv3 16086The VFPv3 floating-point instructions, with 32 double-precision 16087registers. 16088 16089@item +vfpv3-d16-fp16 16090The VFPv3 floating-point instructions, with 16 double-precision 16091registers and the half-precision floating-point conversion operations. 16092 16093@item +vfpv3-fp16 16094The VFPv3 floating-point instructions, with 32 double-precision 16095registers and the half-precision floating-point conversion operations. 16096 16097@item +vfpv4-d16 16098The VFPv4 floating-point instructions, with 16 double-precision 16099registers. 16100 16101@item +vfpv4 16102The VFPv4 floating-point instructions, with 32 double-precision 16103registers. 16104 16105@item +neon 16106The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. 16107The extension @samp{+neon-vfpv3} can be used as an alias for this extension. 16108 16109@item +neon-fp16 16110The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with 16111the half-precision floating-point conversion operations. 16112 16113@item +nosimd 16114Disable the Advanced SIMD instructions (does not disable floating point). 16115 16116@item +nofp 16117Disable the floating-point and Advanced SIMD instructions. 16118@end table 16119 16120@item armv8-a 16121@table @samp 16122@item +crc 16123The Cyclic Redundancy Check (CRC) instructions. 16124@item +simd 16125The ARMv8-A Advanced SIMD and floating-point instructions. 16126@item +crypto 16127The cryptographic instructions. 16128@item +nocrypto 16129Disable the cryptographic instructions. 16130@item +nofp 16131Disable the floating-point, Advanced SIMD and cryptographic instructions. 16132@end table 16133 16134@item armv8.1-a 16135@table @samp 16136@item +simd 16137The ARMv8.1-A Advanced SIMD and floating-point instructions. 16138 16139@item +crypto 16140The cryptographic instructions. This also enables the Advanced SIMD and 16141floating-point instructions. 16142 16143@item +nocrypto 16144Disable the cryptographic instructions. 16145 16146@item +nofp 16147Disable the floating-point, Advanced SIMD and cryptographic instructions. 16148@end table 16149 16150@item armv8.2-a 16151@itemx armv8.3-a 16152@table @samp 16153@item +fp16 16154The half-precision floating-point data processing instructions. 16155This also enables the Advanced SIMD and floating-point instructions. 16156 16157@item +fp16fml 16158The half-precision floating-point fmla extension. This also enables 16159the half-precision floating-point extension and Advanced SIMD and 16160floating-point instructions. 16161 16162@item +simd 16163The ARMv8.1-A Advanced SIMD and floating-point instructions. 16164 16165@item +crypto 16166The cryptographic instructions. This also enables the Advanced SIMD and 16167floating-point instructions. 16168 16169@item +dotprod 16170Enable the Dot Product extension. This also enables Advanced SIMD instructions. 16171 16172@item +nocrypto 16173Disable the cryptographic extension. 16174 16175@item +nofp 16176Disable the floating-point, Advanced SIMD and cryptographic instructions. 16177@end table 16178 16179@item armv8.4-a 16180@table @samp 16181@item +fp16 16182The half-precision floating-point data processing instructions. 16183This also enables the Advanced SIMD and floating-point instructions as well 16184as the Dot Product extension and the half-precision floating-point fmla 16185extension. 16186 16187@item +simd 16188The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the 16189Dot Product extension. 16190 16191@item +crypto 16192The cryptographic instructions. This also enables the Advanced SIMD and 16193floating-point instructions as well as the Dot Product extension. 16194 16195@item +nocrypto 16196Disable the cryptographic extension. 16197 16198@item +nofp 16199Disable the floating-point, Advanced SIMD and cryptographic instructions. 16200@end table 16201 16202@item armv7-r 16203@table @samp 16204@item +fp.sp 16205The single-precision VFPv3 floating-point instructions. The extension 16206@samp{+vfpv3xd} can be used as an alias for this extension. 16207 16208@item +fp 16209The VFPv3 floating-point instructions with 16 double-precision registers. 16210The extension +vfpv3-d16 can be used as an alias for this extension. 16211 16212@item +vfpv3xd-d16-fp16 16213The single-precision VFPv3 floating-point instructions with 16 double-precision 16214registers and the half-precision floating-point conversion operations. 16215 16216@item +vfpv3-d16-fp16 16217The VFPv3 floating-point instructions, with 16 double-precision 16218registers and the half-precision floating-point conversion operations. 16219 16220@item +nofp 16221Disable the floating-point extension. 16222 16223@item +idiv 16224The ARM-state integer division instructions. 16225 16226@item +noidiv 16227Disable the ARM-state integer division extension. 16228@end table 16229 16230@item armv7e-m 16231@table @samp 16232@item +fp 16233The single-precision VFPv4 floating-point instructions. 16234 16235@item +fpv5 16236The single-precision FPv5 floating-point instructions. 16237 16238@item +fp.dp 16239The single- and double-precision FPv5 floating-point instructions. 16240 16241@item +nofp 16242Disable the floating-point extensions. 16243@end table 16244 16245@item armv8-m.main 16246@table @samp 16247@item +dsp 16248The DSP instructions. 16249 16250@item +nodsp 16251Disable the DSP extension. 16252 16253@item +fp 16254The single-precision floating-point instructions. 16255 16256@item +fp.dp 16257The single- and double-precision floating-point instructions. 16258 16259@item +nofp 16260Disable the floating-point extension. 16261@end table 16262 16263@item armv8-r 16264@table @samp 16265@item +crc 16266The Cyclic Redundancy Check (CRC) instructions. 16267@item +fp.sp 16268The single-precision FPv5 floating-point instructions. 16269@item +simd 16270The ARMv8-A Advanced SIMD and floating-point instructions. 16271@item +crypto 16272The cryptographic instructions. 16273@item +nocrypto 16274Disable the cryptographic instructions. 16275@item +nofp 16276Disable the floating-point, Advanced SIMD and cryptographic instructions. 16277@end table 16278 16279@end table 16280 16281@option{-march=native} causes the compiler to auto-detect the architecture 16282of the build computer. At present, this feature is only supported on 16283GNU/Linux, and not all architectures are recognized. If the auto-detect 16284is unsuccessful the option has no effect. 16285 16286@item -mtune=@var{name} 16287@opindex mtune 16288This option specifies the name of the target ARM processor for 16289which GCC should tune the performance of the code. 16290For some ARM implementations better performance can be obtained by using 16291this option. 16292Permissible names are: @samp{arm2}, @samp{arm250}, 16293@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 16294@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 16295@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 16296@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 16297@samp{arm720}, 16298@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 16299@samp{arm710t}, @samp{arm720t}, @samp{arm740t}, 16300@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 16301@samp{strongarm1110}, 16302@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 16303@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 16304@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 16305@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 16306@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 16307@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 16308@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 16309@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, 16310@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17}, 16311@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, 16312@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, 16313@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, 16314@samp{cortex-r8}, @samp{cortex-r52}, 16315@samp{cortex-m33}, 16316@samp{cortex-m23}, 16317@samp{cortex-m7}, 16318@samp{cortex-m4}, 16319@samp{cortex-m3}, 16320@samp{cortex-m1}, 16321@samp{cortex-m0}, 16322@samp{cortex-m0plus}, 16323@samp{cortex-m1.small-multiply}, 16324@samp{cortex-m0.small-multiply}, 16325@samp{cortex-m0plus.small-multiply}, 16326@samp{exynos-m1}, 16327@samp{marvell-pj4}, 16328@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, 16329@samp{fa526}, @samp{fa626}, 16330@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, 16331@samp{xgene1}. 16332 16333Additionally, this option can specify that GCC should tune the performance 16334of the code for a big.LITTLE system. Permissible names are: 16335@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7}, 16336@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 16337@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}, 16338@samp{cortex-a75.cortex-a55}. 16339 16340@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 16341performance for a blend of processors within architecture @var{arch}. 16342The aim is to generate code that run well on the current most popular 16343processors, balancing between optimizations that benefit some CPUs in the 16344range, and avoiding performance pitfalls of other CPUs. The effects of 16345this option may change in future GCC versions as CPU models come and go. 16346 16347@option{-mtune} permits the same extension options as @option{-mcpu}, but 16348the extension options do not affect the tuning of the generated code. 16349 16350@option{-mtune=native} causes the compiler to auto-detect the CPU 16351of the build computer. At present, this feature is only supported on 16352GNU/Linux, and not all architectures are recognized. If the auto-detect is 16353unsuccessful the option has no effect. 16354 16355@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]} 16356@opindex mcpu 16357This specifies the name of the target ARM processor. GCC uses this name 16358to derive the name of the target ARM architecture (as if specified 16359by @option{-march}) and the ARM processor type for which to tune for 16360performance (as if specified by @option{-mtune}). Where this option 16361is used in conjunction with @option{-march} or @option{-mtune}, 16362those options take precedence over the appropriate part of this option. 16363 16364Many of the supported CPUs implement optional architectural 16365extensions. Where this is so the architectural extensions are 16366normally enabled by default. If implementations that lack the 16367extension exist, then the extension syntax can be used to disable 16368those extensions that have been omitted. For floating-point and 16369Advanced SIMD (Neon) instructions, the settings of the options 16370@option{-mfloat-abi} and @option{-mfpu} must also be considered: 16371floating-point and Advanced SIMD instructions will only be used if 16372@option{-mfloat-abi} is not set to @samp{soft}; and any setting of 16373@option{-mfpu} other than @samp{auto} will override the available 16374floating-point and SIMD extension instructions. 16375 16376For example, @samp{cortex-a9} can be found in three major 16377configurations: integer only, with just a floating-point unit or with 16378floating-point and Advanced SIMD. The default is to enable all the 16379instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can 16380be used to disable just the SIMD or both the SIMD and floating-point 16381instructions respectively. 16382 16383Permissible names for this option are the same as those for 16384@option{-mtune}. 16385 16386The following extension options are common to the listed CPUs: 16387 16388@table @samp 16389@item +nodsp 16390Disable the DSP instructions on @samp{cortex-m33}. 16391 16392@item +nofp 16393Disables the floating-point instructions on @samp{arm9e}, 16394@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e}, 16395@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s}, 16396@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, 16397@samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}. 16398Disables the floating-point and SIMD instructions on 16399@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, 16400@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12}, 16401@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7}, 16402@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35}, 16403@samp{cortex-a53} and @samp{cortex-a55}. 16404 16405@item +nofp.dp 16406Disables the double-precision component of the floating-point instructions 16407on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and 16408@samp{cortex-m7}. 16409 16410@item +nosimd 16411Disables the SIMD (but not floating-point) instructions on 16412@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7} 16413and @samp{cortex-a9}. 16414 16415@item +crypto 16416Enables the cryptographic instructions on @samp{cortex-a32}, 16417@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57}, 16418@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1}, 16419@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}, 16420@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and 16421@samp{cortex-a75.cortex-a55}. 16422@end table 16423 16424Additionally the @samp{generic-armv7-a} pseudo target defaults to 16425VFPv3 with 16 double-precision registers. It supports the following 16426extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16}, 16427@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, 16428@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, 16429@samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for 16430the extensions to @option{-march=armv7-a}. 16431 16432@option{-mcpu=generic-@var{arch}} is also permissible, and is 16433equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 16434See @option{-mtune} for more information. 16435 16436@option{-mcpu=native} causes the compiler to auto-detect the CPU 16437of the build computer. At present, this feature is only supported on 16438GNU/Linux, and not all architectures are recognized. If the auto-detect 16439is unsuccessful the option has no effect. 16440 16441@item -mfpu=@var{name} 16442@opindex mfpu 16443This specifies what floating-point hardware (or hardware emulation) is 16444available on the target. Permissible names are: @samp{auto}, @samp{vfpv2}, 16445@samp{vfpv3}, 16446@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 16447@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4}, 16448@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 16449@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 16450@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}. 16451Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp} 16452is an alias for @samp{vfpv2}. 16453 16454The setting @samp{auto} is the default and is special. It causes the 16455compiler to select the floating-point and Advanced SIMD instructions 16456based on the settings of @option{-mcpu} and @option{-march}. 16457 16458If the selected floating-point hardware includes the NEON extension 16459(e.g. @option{-mfpu=neon}), note that floating-point 16460operations are not generated by GCC's auto-vectorization pass unless 16461@option{-funsafe-math-optimizations} is also specified. This is 16462because NEON hardware does not fully implement the IEEE 754 standard for 16463floating-point arithmetic (in particular denormal values are treated as 16464zero), so the use of NEON instructions may lead to a loss of precision. 16465 16466You 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}). 16467 16468@item -mfp16-format=@var{name} 16469@opindex mfp16-format 16470Specify the format of the @code{__fp16} half-precision floating-point type. 16471Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 16472the default is @samp{none}, in which case the @code{__fp16} type is not 16473defined. @xref{Half-Precision}, for more information. 16474 16475@item -mstructure-size-boundary=@var{n} 16476@opindex mstructure-size-boundary 16477The sizes of all structures and unions are rounded up to a multiple 16478of the number of bits set by this option. Permissible values are 8, 32 16479and 64. The default value varies for different toolchains. For the COFF 16480targeted toolchain the default value is 8. A value of 64 is only allowed 16481if the underlying ABI supports it. 16482 16483Specifying a larger number can produce faster, more efficient code, but 16484can also increase the size of the program. Different values are potentially 16485incompatible. Code compiled with one value cannot necessarily expect to 16486work with code or libraries compiled with another value, if they exchange 16487information using structures or unions. 16488 16489This option is deprecated. 16490 16491@item -mabort-on-noreturn 16492@opindex mabort-on-noreturn 16493Generate a call to the function @code{abort} at the end of a 16494@code{noreturn} function. It is executed if the function tries to 16495return. 16496 16497@item -mlong-calls 16498@itemx -mno-long-calls 16499@opindex mlong-calls 16500@opindex mno-long-calls 16501Tells the compiler to perform function calls by first loading the 16502address of the function into a register and then performing a subroutine 16503call on this register. This switch is needed if the target function 16504lies outside of the 64-megabyte addressing range of the offset-based 16505version of subroutine call instruction. 16506 16507Even if this switch is enabled, not all function calls are turned 16508into long calls. The heuristic is that static functions, functions 16509that have the @code{short_call} attribute, functions that are inside 16510the scope of a @code{#pragma no_long_calls} directive, and functions whose 16511definitions have already been compiled within the current compilation 16512unit are not turned into long calls. The exceptions to this rule are 16513that weak function definitions, functions with the @code{long_call} 16514attribute or the @code{section} attribute, and functions that are within 16515the scope of a @code{#pragma long_calls} directive are always 16516turned into long calls. 16517 16518This feature is not enabled by default. Specifying 16519@option{-mno-long-calls} restores the default behavior, as does 16520placing the function calls within the scope of a @code{#pragma 16521long_calls_off} directive. Note these switches have no effect on how 16522the compiler generates code to handle function calls via function 16523pointers. 16524 16525@item -msingle-pic-base 16526@opindex msingle-pic-base 16527Treat the register used for PIC addressing as read-only, rather than 16528loading it in the prologue for each function. The runtime system is 16529responsible for initializing this register with an appropriate value 16530before execution begins. 16531 16532@item -mpic-register=@var{reg} 16533@opindex mpic-register 16534Specify the register to be used for PIC addressing. 16535For standard PIC base case, the default is any suitable register 16536determined by compiler. For single PIC base case, the default is 16537@samp{R9} if target is EABI based or stack-checking is enabled, 16538otherwise the default is @samp{R10}. 16539 16540@item -mpic-data-is-text-relative 16541@opindex mpic-data-is-text-relative 16542Assume that the displacement between the text and data segments is fixed 16543at static link time. This permits using PC-relative addressing 16544operations to access data known to be in the data segment. For 16545non-VxWorks RTP targets, this option is enabled by default. When 16546disabled on such targets, it will enable @option{-msingle-pic-base} by 16547default. 16548 16549@item -mpoke-function-name 16550@opindex mpoke-function-name 16551Write the name of each function into the text section, directly 16552preceding the function prologue. The generated code is similar to this: 16553 16554@smallexample 16555 t0 16556 .ascii "arm_poke_function_name", 0 16557 .align 16558 t1 16559 .word 0xff000000 + (t1 - t0) 16560 arm_poke_function_name 16561 mov ip, sp 16562 stmfd sp!, @{fp, ip, lr, pc@} 16563 sub fp, ip, #4 16564@end smallexample 16565 16566When performing a stack backtrace, code can inspect the value of 16567@code{pc} stored at @code{fp + 0}. If the trace function then looks at 16568location @code{pc - 12} and the top 8 bits are set, then we know that 16569there is a function name embedded immediately preceding this location 16570and has length @code{((pc[-3]) & 0xff000000)}. 16571 16572@item -mthumb 16573@itemx -marm 16574@opindex marm 16575@opindex mthumb 16576 16577Select between generating code that executes in ARM and Thumb 16578states. The default for most configurations is to generate code 16579that executes in ARM state, but the default can be changed by 16580configuring GCC with the @option{--with-mode=}@var{state} 16581configure option. 16582 16583You can also override the ARM and Thumb mode for each function 16584by using the @code{target("thumb")} and @code{target("arm")} function attributes 16585(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}). 16586 16587@item -mflip-thumb 16588@opindex mflip-thumb 16589Switch ARM/Thumb modes on alternating functions. 16590This option is provided for regression testing of mixed Thumb/ARM code 16591generation, and is not intended for ordinary use in compiling code. 16592 16593@item -mtpcs-frame 16594@opindex mtpcs-frame 16595Generate a stack frame that is compliant with the Thumb Procedure Call 16596Standard for all non-leaf functions. (A leaf function is one that does 16597not call any other functions.) The default is @option{-mno-tpcs-frame}. 16598 16599@item -mtpcs-leaf-frame 16600@opindex mtpcs-leaf-frame 16601Generate a stack frame that is compliant with the Thumb Procedure Call 16602Standard for all leaf functions. (A leaf function is one that does 16603not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 16604 16605@item -mcallee-super-interworking 16606@opindex mcallee-super-interworking 16607Gives all externally visible functions in the file being compiled an ARM 16608instruction set header which switches to Thumb mode before executing the 16609rest of the function. This allows these functions to be called from 16610non-interworking code. This option is not valid in AAPCS configurations 16611because interworking is enabled by default. 16612 16613@item -mcaller-super-interworking 16614@opindex mcaller-super-interworking 16615Allows calls via function pointers (including virtual functions) to 16616execute correctly regardless of whether the target code has been 16617compiled for interworking or not. There is a small overhead in the cost 16618of executing a function pointer if this option is enabled. This option 16619is not valid in AAPCS configurations because interworking is enabled 16620by default. 16621 16622@item -mtp=@var{name} 16623@opindex mtp 16624Specify the access model for the thread local storage pointer. The valid 16625models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 16626@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 16627(supported in the arm6k architecture), and @samp{auto}, which uses the 16628best available method for the selected processor. The default setting is 16629@samp{auto}. 16630 16631@item -mtls-dialect=@var{dialect} 16632@opindex mtls-dialect 16633Specify the dialect to use for accessing thread local storage. Two 16634@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 16635@samp{gnu} dialect selects the original GNU scheme for supporting 16636local and global dynamic TLS models. The @samp{gnu2} dialect 16637selects the GNU descriptor scheme, which provides better performance 16638for shared libraries. The GNU descriptor scheme is compatible with 16639the original scheme, but does require new assembler, linker and 16640library support. Initial and local exec TLS models are unaffected by 16641this option and always use the original scheme. 16642 16643@item -mword-relocations 16644@opindex mword-relocations 16645Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). 16646This is enabled by default on targets (uClinux, SymbianOS) where the runtime 16647loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 16648is specified. 16649 16650@item -mfix-cortex-m3-ldrd 16651@opindex mfix-cortex-m3-ldrd 16652Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 16653with overlapping destination and base registers are used. This option avoids 16654generating these instructions. This option is enabled by default when 16655@option{-mcpu=cortex-m3} is specified. 16656 16657@item -munaligned-access 16658@itemx -mno-unaligned-access 16659@opindex munaligned-access 16660@opindex mno-unaligned-access 16661Enables (or disables) reading and writing of 16- and 32- bit values 16662from addresses that are not 16- or 32- bit aligned. By default 16663unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for 16664ARMv8-M Baseline architectures, and enabled for all other 16665architectures. If unaligned access is not enabled then words in packed 16666data structures are accessed a byte at a time. 16667 16668The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 16669generated object file to either true or false, depending upon the 16670setting of this option. If unaligned access is enabled then the 16671preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 16672defined. 16673 16674@item -mneon-for-64bits 16675@opindex mneon-for-64bits 16676Enables using Neon to handle scalar 64-bits operations. This is 16677disabled by default since the cost of moving data from core registers 16678to Neon is high. 16679 16680@item -mslow-flash-data 16681@opindex mslow-flash-data 16682Assume loading data from flash is slower than fetching instruction. 16683Therefore literal load is minimized for better performance. 16684This option is only supported when compiling for ARMv7 M-profile and 16685off by default. 16686 16687@item -masm-syntax-unified 16688@opindex masm-syntax-unified 16689Assume inline assembler is using unified asm syntax. The default is 16690currently off which implies divided syntax. This option has no impact 16691on Thumb2. However, this may change in future releases of GCC. 16692Divided syntax should be considered deprecated. 16693 16694@item -mrestrict-it 16695@opindex mrestrict-it 16696Restricts generation of IT blocks to conform to the rules of ARMv8-A. 16697IT blocks can only contain a single 16-bit instruction from a select 16698set of instructions. This option is on by default for ARMv8-A Thumb mode. 16699 16700@item -mprint-tune-info 16701@opindex mprint-tune-info 16702Print CPU tuning information as comment in assembler file. This is 16703an option used only for regression testing of the compiler and not 16704intended for ordinary use in compiling code. This option is disabled 16705by default. 16706 16707@item -mverbose-cost-dump 16708@opindex mverbose-cost-dump 16709Enable verbose cost model dumping in the debug dump files. This option is 16710provided for use in debugging the compiler. 16711 16712@item -mpure-code 16713@opindex mpure-code 16714Do not allow constant data to be placed in code sections. 16715Additionally, when compiling for ELF object format give all text sections the 16716ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option 16717is only available when generating non-pic code for M-profile targets with the 16718MOVT instruction. 16719 16720@item -mcmse 16721@opindex mcmse 16722Generate secure code as per the "ARMv8-M Security Extensions: Requirements on 16723Development Tools Engineering Specification", which can be found on 16724@url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}. 16725@end table 16726 16727@node AVR Options 16728@subsection AVR Options 16729@cindex AVR Options 16730 16731These options are defined for AVR implementations: 16732 16733@table @gcctabopt 16734@item -mmcu=@var{mcu} 16735@opindex mmcu 16736Specify Atmel AVR instruction set architectures (ISA) or MCU type. 16737 16738The default for this option is@tie{}@samp{avr2}. 16739 16740GCC supports the following AVR devices and ISAs: 16741 16742@include avr-mmcu.texi 16743 16744@item -mabsdata 16745@opindex mabsdata 16746 16747Assume that all data in static storage can be accessed by LDS / STS 16748instructions. This option has only an effect on reduced Tiny devices like 16749ATtiny40. See also the @code{absdata} 16750@ref{AVR Variable Attributes,variable attribute}. 16751 16752@item -maccumulate-args 16753@opindex maccumulate-args 16754Accumulate outgoing function arguments and acquire/release the needed 16755stack space for outgoing function arguments once in function 16756prologue/epilogue. Without this option, outgoing arguments are pushed 16757before calling a function and popped afterwards. 16758 16759Popping the arguments after the function call can be expensive on 16760AVR so that accumulating the stack space might lead to smaller 16761executables because arguments need not be removed from the 16762stack after such a function call. 16763 16764This option can lead to reduced code size for functions that perform 16765several calls to functions that get their arguments on the stack like 16766calls to printf-like functions. 16767 16768@item -mbranch-cost=@var{cost} 16769@opindex mbranch-cost 16770Set the branch costs for conditional branch instructions to 16771@var{cost}. Reasonable values for @var{cost} are small, non-negative 16772integers. The default branch cost is 0. 16773 16774@item -mcall-prologues 16775@opindex mcall-prologues 16776Functions prologues/epilogues are expanded as calls to appropriate 16777subroutines. Code size is smaller. 16778 16779@item -mgas-isr-prologues 16780@opindex mgas-isr-prologues 16781Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo 16782instruction supported by GNU Binutils. 16783If this option is on, the feature can still be disabled for individual 16784ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}} 16785function attribute. This feature is activated per default 16786if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}), 16787and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}. 16788 16789@item -mint8 16790@opindex mint8 16791Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 16792@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 16793and @code{long long} is 4 bytes. Please note that this option does not 16794conform to the C standards, but it results in smaller code 16795size. 16796 16797@item -mmain-is-OS_task 16798@opindex mmain-is-OS_task 16799Do not save registers in @code{main}. The effect is the same like 16800attaching attribute @ref{AVR Function Attributes,,@code{OS_task}} 16801to @code{main}. It is activated per default if optimization is on. 16802 16803@item -mn-flash=@var{num} 16804@opindex mn-flash 16805Assume that the flash memory has a size of 16806@var{num} times 64@tie{}KiB. 16807 16808@item -mno-interrupts 16809@opindex mno-interrupts 16810Generated code is not compatible with hardware interrupts. 16811Code size is smaller. 16812 16813@item -mrelax 16814@opindex mrelax 16815Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 16816@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 16817Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 16818the assembler's command line and the @option{--relax} option to the 16819linker's command line. 16820 16821Jump relaxing is performed by the linker because jump offsets are not 16822known before code is located. Therefore, the assembler code generated by the 16823compiler is the same, but the instructions in the executable may 16824differ from instructions in the assembler code. 16825 16826Relaxing must be turned on if linker stubs are needed, see the 16827section on @code{EIND} and linker stubs below. 16828 16829@item -mrmw 16830@opindex mrmw 16831Assume that the device supports the Read-Modify-Write 16832instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 16833 16834@item -mshort-calls 16835@opindex mshort-calls 16836 16837Assume that @code{RJMP} and @code{RCALL} can target the whole 16838program memory. 16839 16840This option is used internally for multilib selection. It is 16841not an optimization option, and you don't need to set it by hand. 16842 16843@item -msp8 16844@opindex msp8 16845Treat the stack pointer register as an 8-bit register, 16846i.e.@: assume the high byte of the stack pointer is zero. 16847In general, you don't need to set this option by hand. 16848 16849This option is used internally by the compiler to select and 16850build multilibs for architectures @code{avr2} and @code{avr25}. 16851These architectures mix devices with and without @code{SPH}. 16852For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 16853the compiler driver adds or removes this option from the compiler 16854proper's command line, because the compiler then knows if the device 16855or architecture has an 8-bit stack pointer and thus no @code{SPH} 16856register or not. 16857 16858@item -mstrict-X 16859@opindex mstrict-X 16860Use address register @code{X} in a way proposed by the hardware. This means 16861that @code{X} is only used in indirect, post-increment or 16862pre-decrement addressing. 16863 16864Without this option, the @code{X} register may be used in the same way 16865as @code{Y} or @code{Z} which then is emulated by additional 16866instructions. 16867For example, loading a value with @code{X+const} addressing with a 16868small non-negative @code{const < 64} to a register @var{Rn} is 16869performed as 16870 16871@example 16872adiw r26, const ; X += const 16873ld @var{Rn}, X ; @var{Rn} = *X 16874sbiw r26, const ; X -= const 16875@end example 16876 16877@item -mtiny-stack 16878@opindex mtiny-stack 16879Only change the lower 8@tie{}bits of the stack pointer. 16880 16881@item -mfract-convert-truncate 16882@opindex mfract-convert-truncate 16883Allow to use truncation instead of rounding towards zero for fractional fixed-point types. 16884 16885@item -nodevicelib 16886@opindex nodevicelib 16887Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. 16888 16889@item -nodevicespecs 16890@opindex nodevicespecs 16891Don't add @option{-specs=device-specs/specs-<mcu>} to the compiler driver's 16892command line. The user takes responsibility for supplying the sub-processes 16893like compiler proper, assembler and linker with appropriate command line 16894options. 16895 16896@item -Waddr-space-convert 16897@opindex Waddr-space-convert 16898Warn about conversions between address spaces in the case where the 16899resulting address space is not contained in the incoming address space. 16900 16901@item -Wmisspelled-isr 16902@opindex Wmisspelled-isr 16903Warn if the ISR is misspelled, i.e. without __vector prefix. 16904Enabled by default. 16905@end table 16906 16907@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 16908@cindex @code{EIND} 16909Pointers in the implementation are 16@tie{}bits wide. 16910The address of a function or label is represented as word address so 16911that indirect jumps and calls can target any code address in the 16912range of 64@tie{}Ki words. 16913 16914In order to facilitate indirect jump on devices with more than 128@tie{}Ki 16915bytes of program memory space, there is a special function register called 16916@code{EIND} that serves as most significant part of the target address 16917when @code{EICALL} or @code{EIJMP} instructions are used. 16918 16919Indirect jumps and calls on these devices are handled as follows by 16920the compiler and are subject to some limitations: 16921 16922@itemize @bullet 16923 16924@item 16925The compiler never sets @code{EIND}. 16926 16927@item 16928The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP} 16929instructions or might read @code{EIND} directly in order to emulate an 16930indirect call/jump by means of a @code{RET} instruction. 16931 16932@item 16933The compiler assumes that @code{EIND} never changes during the startup 16934code or during the application. In particular, @code{EIND} is not 16935saved/restored in function or interrupt service routine 16936prologue/epilogue. 16937 16938@item 16939For indirect calls to functions and computed goto, the linker 16940generates @emph{stubs}. Stubs are jump pads sometimes also called 16941@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 16942The stub contains a direct jump to the desired address. 16943 16944@item 16945Linker relaxation must be turned on so that the linker generates 16946the stubs correctly in all situations. See the compiler option 16947@option{-mrelax} and the linker option @option{--relax}. 16948There are corner cases where the linker is supposed to generate stubs 16949but aborts without relaxation and without a helpful error message. 16950 16951@item 16952The default linker script is arranged for code with @code{EIND = 0}. 16953If code is supposed to work for a setup with @code{EIND != 0}, a custom 16954linker script has to be used in order to place the sections whose 16955name start with @code{.trampolines} into the segment where @code{EIND} 16956points to. 16957 16958@item 16959The startup code from libgcc never sets @code{EIND}. 16960Notice that startup code is a blend of code from libgcc and AVR-LibC. 16961For the impact of AVR-LibC on @code{EIND}, see the 16962@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 16963 16964@item 16965It is legitimate for user-specific startup code to set up @code{EIND} 16966early, for example by means of initialization code located in 16967section @code{.init3}. Such code runs prior to general startup code 16968that initializes RAM and calls constructors, but after the bit 16969of startup code from AVR-LibC that sets @code{EIND} to the segment 16970where the vector table is located. 16971@example 16972#include <avr/io.h> 16973 16974static void 16975__attribute__((section(".init3"),naked,used,no_instrument_function)) 16976init3_set_eind (void) 16977@{ 16978 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 16979 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 16980@} 16981@end example 16982 16983@noindent 16984The @code{__trampolines_start} symbol is defined in the linker script. 16985 16986@item 16987Stubs are generated automatically by the linker if 16988the following two conditions are met: 16989@itemize @minus 16990 16991@item The address of a label is taken by means of the @code{gs} modifier 16992(short for @emph{generate stubs}) like so: 16993@example 16994LDI r24, lo8(gs(@var{func})) 16995LDI r25, hi8(gs(@var{func})) 16996@end example 16997@item The final location of that label is in a code segment 16998@emph{outside} the segment where the stubs are located. 16999@end itemize 17000 17001@item 17002The compiler emits such @code{gs} modifiers for code labels in the 17003following situations: 17004@itemize @minus 17005@item Taking address of a function or code label. 17006@item Computed goto. 17007@item If prologue-save function is used, see @option{-mcall-prologues} 17008command-line option. 17009@item Switch/case dispatch tables. If you do not want such dispatch 17010tables you can specify the @option{-fno-jump-tables} command-line option. 17011@item C and C++ constructors/destructors called during startup/shutdown. 17012@item If the tools hit a @code{gs()} modifier explained above. 17013@end itemize 17014 17015@item 17016Jumping to non-symbolic addresses like so is @emph{not} supported: 17017 17018@example 17019int main (void) 17020@{ 17021 /* Call function at word address 0x2 */ 17022 return ((int(*)(void)) 0x2)(); 17023@} 17024@end example 17025 17026Instead, a stub has to be set up, i.e.@: the function has to be called 17027through a symbol (@code{func_4} in the example): 17028 17029@example 17030int main (void) 17031@{ 17032 extern int func_4 (void); 17033 17034 /* Call function at byte address 0x4 */ 17035 return func_4(); 17036@} 17037@end example 17038 17039and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 17040Alternatively, @code{func_4} can be defined in the linker script. 17041@end itemize 17042 17043@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 17044@cindex @code{RAMPD} 17045@cindex @code{RAMPX} 17046@cindex @code{RAMPY} 17047@cindex @code{RAMPZ} 17048Some AVR devices support memories larger than the 64@tie{}KiB range 17049that can be accessed with 16-bit pointers. To access memory locations 17050outside this 64@tie{}KiB range, the content of a @code{RAMP} 17051register is used as high part of the address: 17052The @code{X}, @code{Y}, @code{Z} address register is concatenated 17053with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 17054register, respectively, to get a wide address. Similarly, 17055@code{RAMPD} is used together with direct addressing. 17056 17057@itemize 17058@item 17059The startup code initializes the @code{RAMP} special function 17060registers with zero. 17061 17062@item 17063If a @ref{AVR Named Address Spaces,named address space} other than 17064generic or @code{__flash} is used, then @code{RAMPZ} is set 17065as needed before the operation. 17066 17067@item 17068If the device supports RAM larger than 64@tie{}KiB and the compiler 17069needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 17070is reset to zero after the operation. 17071 17072@item 17073If the device comes with a specific @code{RAMP} register, the ISR 17074prologue/epilogue saves/restores that SFR and initializes it with 17075zero in case the ISR code might (implicitly) use it. 17076 17077@item 17078RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 17079If you use inline assembler to read from locations outside the 1708016-bit address range and change one of the @code{RAMP} registers, 17081you must reset it to zero after the access. 17082 17083@end itemize 17084 17085@subsubsection AVR Built-in Macros 17086 17087GCC defines several built-in macros so that the user code can test 17088for the presence or absence of features. Almost any of the following 17089built-in macros are deduced from device capabilities and thus 17090triggered by the @option{-mmcu=} command-line option. 17091 17092For even more AVR-specific built-in macros see 17093@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 17094 17095@table @code 17096 17097@item __AVR_ARCH__ 17098Build-in macro that resolves to a decimal number that identifies the 17099architecture and depends on the @option{-mmcu=@var{mcu}} option. 17100Possible values are: 17101 17102@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 17103@code{4}, @code{5}, @code{51}, @code{6} 17104 17105for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 17106@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 17107 17108respectively and 17109 17110@code{100}, 17111@code{102}, @code{103}, @code{104}, 17112@code{105}, @code{106}, @code{107} 17113 17114for @var{mcu}=@code{avrtiny}, 17115@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4}, 17116@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 17117If @var{mcu} specifies a device, this built-in macro is set 17118accordingly. For example, with @option{-mmcu=atmega8} the macro is 17119defined to @code{4}. 17120 17121@item __AVR_@var{Device}__ 17122Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 17123the device's name. For example, @option{-mmcu=atmega8} defines the 17124built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 17125@code{__AVR_ATtiny261A__}, etc. 17126 17127The built-in macros' names follow 17128the scheme @code{__AVR_@var{Device}__} where @var{Device} is 17129the device name as from the AVR user manual. The difference between 17130@var{Device} in the built-in macro and @var{device} in 17131@option{-mmcu=@var{device}} is that the latter is always lowercase. 17132 17133If @var{device} is not a device but only a core architecture like 17134@samp{avr51}, this macro is not defined. 17135 17136@item __AVR_DEVICE_NAME__ 17137Setting @option{-mmcu=@var{device}} defines this built-in macro to 17138the device's name. For example, with @option{-mmcu=atmega8} the macro 17139is defined to @code{atmega8}. 17140 17141If @var{device} is not a device but only a core architecture like 17142@samp{avr51}, this macro is not defined. 17143 17144@item __AVR_XMEGA__ 17145The device / architecture belongs to the XMEGA family of devices. 17146 17147@item __AVR_HAVE_ELPM__ 17148The device has the @code{ELPM} instruction. 17149 17150@item __AVR_HAVE_ELPMX__ 17151The device has the @code{ELPM R@var{n},Z} and @code{ELPM 17152R@var{n},Z+} instructions. 17153 17154@item __AVR_HAVE_MOVW__ 17155The device has the @code{MOVW} instruction to perform 16-bit 17156register-register moves. 17157 17158@item __AVR_HAVE_LPMX__ 17159The device has the @code{LPM R@var{n},Z} and 17160@code{LPM R@var{n},Z+} instructions. 17161 17162@item __AVR_HAVE_MUL__ 17163The device has a hardware multiplier. 17164 17165@item __AVR_HAVE_JMP_CALL__ 17166The device has the @code{JMP} and @code{CALL} instructions. 17167This is the case for devices with more than 8@tie{}KiB of program 17168memory. 17169 17170@item __AVR_HAVE_EIJMP_EICALL__ 17171@itemx __AVR_3_BYTE_PC__ 17172The device has the @code{EIJMP} and @code{EICALL} instructions. 17173This is the case for devices with more than 128@tie{}KiB of program memory. 17174This also means that the program counter 17175(PC) is 3@tie{}bytes wide. 17176 17177@item __AVR_2_BYTE_PC__ 17178The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 17179with up to 128@tie{}KiB of program memory. 17180 17181@item __AVR_HAVE_8BIT_SP__ 17182@itemx __AVR_HAVE_16BIT_SP__ 17183The stack pointer (SP) register is treated as 8-bit respectively 1718416-bit register by the compiler. 17185The definition of these macros is affected by @option{-mtiny-stack}. 17186 17187@item __AVR_HAVE_SPH__ 17188@itemx __AVR_SP8__ 17189The device has the SPH (high part of stack pointer) special function 17190register or has an 8-bit stack pointer, respectively. 17191The definition of these macros is affected by @option{-mmcu=} and 17192in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 17193by @option{-msp8}. 17194 17195@item __AVR_HAVE_RAMPD__ 17196@itemx __AVR_HAVE_RAMPX__ 17197@itemx __AVR_HAVE_RAMPY__ 17198@itemx __AVR_HAVE_RAMPZ__ 17199The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 17200@code{RAMPZ} special function register, respectively. 17201 17202@item __NO_INTERRUPTS__ 17203This macro reflects the @option{-mno-interrupts} command-line option. 17204 17205@item __AVR_ERRATA_SKIP__ 17206@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 17207Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 17208instructions because of a hardware erratum. Skip instructions are 17209@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 17210The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 17211set. 17212 17213@item __AVR_ISA_RMW__ 17214The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 17215 17216@item __AVR_SFR_OFFSET__=@var{offset} 17217Instructions that can address I/O special function registers directly 17218like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 17219address as if addressed by an instruction to access RAM like @code{LD} 17220or @code{STS}. This offset depends on the device architecture and has 17221to be subtracted from the RAM address in order to get the 17222respective I/O@tie{}address. 17223 17224@item __AVR_SHORT_CALLS__ 17225The @option{-mshort-calls} command line option is set. 17226 17227@item __AVR_PM_BASE_ADDRESS__=@var{addr} 17228Some devices support reading from flash memory by means of @code{LD*} 17229instructions. The flash memory is seen in the data address space 17230at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro 17231is not defined, this feature is not available. If defined, 17232the address space is linear and there is no need to put 17233@code{.rodata} into RAM. This is handled by the default linker 17234description file, and is currently available for 17235@code{avrtiny} and @code{avrxmega3}. Even more convenient, 17236there is no need to use address spaces like @code{__flash} or 17237features like attribute @code{progmem} and @code{pgm_read_*}. 17238 17239@item __WITH_AVRLIBC__ 17240The compiler is configured to be used together with AVR-Libc. 17241See the @option{--with-avrlibc} configure option. 17242 17243@end table 17244 17245@node Blackfin Options 17246@subsection Blackfin Options 17247@cindex Blackfin Options 17248 17249@table @gcctabopt 17250@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 17251@opindex mcpu= 17252Specifies the name of the target Blackfin processor. Currently, @var{cpu} 17253can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 17254@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 17255@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 17256@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 17257@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 17258@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 17259@samp{bf561}, @samp{bf592}. 17260 17261The optional @var{sirevision} specifies the silicon revision of the target 17262Blackfin processor. Any workarounds available for the targeted silicon revision 17263are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 17264If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 17265are enabled. The @code{__SILICON_REVISION__} macro is defined to two 17266hexadecimal digits representing the major and minor numbers in the silicon 17267revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 17268is not defined. If @var{sirevision} is @samp{any}, the 17269@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 17270If this optional @var{sirevision} is not used, GCC assumes the latest known 17271silicon revision of the targeted Blackfin processor. 17272 17273GCC defines a preprocessor macro for the specified @var{cpu}. 17274For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 17275provided by libgloss to be linked in if @option{-msim} is not given. 17276 17277Without this option, @samp{bf532} is used as the processor by default. 17278 17279Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 17280only the preprocessor macro is defined. 17281 17282@item -msim 17283@opindex msim 17284Specifies that the program will be run on the simulator. This causes 17285the simulator BSP provided by libgloss to be linked in. This option 17286has effect only for @samp{bfin-elf} toolchain. 17287Certain other options, such as @option{-mid-shared-library} and 17288@option{-mfdpic}, imply @option{-msim}. 17289 17290@item -momit-leaf-frame-pointer 17291@opindex momit-leaf-frame-pointer 17292Don't keep the frame pointer in a register for leaf functions. This 17293avoids the instructions to save, set up and restore frame pointers and 17294makes an extra register available in leaf functions. 17295 17296@item -mspecld-anomaly 17297@opindex mspecld-anomaly 17298When enabled, the compiler ensures that the generated code does not 17299contain speculative loads after jump instructions. If this option is used, 17300@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 17301 17302@item -mno-specld-anomaly 17303@opindex mno-specld-anomaly 17304Don't generate extra code to prevent speculative loads from occurring. 17305 17306@item -mcsync-anomaly 17307@opindex mcsync-anomaly 17308When enabled, the compiler ensures that the generated code does not 17309contain CSYNC or SSYNC instructions too soon after conditional branches. 17310If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 17311 17312@item -mno-csync-anomaly 17313@opindex mno-csync-anomaly 17314Don't generate extra code to prevent CSYNC or SSYNC instructions from 17315occurring too soon after a conditional branch. 17316 17317@item -mlow-64k 17318@opindex mlow-64k 17319When enabled, the compiler is free to take advantage of the knowledge that 17320the entire program fits into the low 64k of memory. 17321 17322@item -mno-low-64k 17323@opindex mno-low-64k 17324Assume that the program is arbitrarily large. This is the default. 17325 17326@item -mstack-check-l1 17327@opindex mstack-check-l1 17328Do stack checking using information placed into L1 scratchpad memory by the 17329uClinux kernel. 17330 17331@item -mid-shared-library 17332@opindex mid-shared-library 17333Generate code that supports shared libraries via the library ID method. 17334This allows for execute in place and shared libraries in an environment 17335without virtual memory management. This option implies @option{-fPIC}. 17336With a @samp{bfin-elf} target, this option implies @option{-msim}. 17337 17338@item -mno-id-shared-library 17339@opindex mno-id-shared-library 17340Generate code that doesn't assume ID-based shared libraries are being used. 17341This is the default. 17342 17343@item -mleaf-id-shared-library 17344@opindex mleaf-id-shared-library 17345Generate code that supports shared libraries via the library ID method, 17346but assumes that this library or executable won't link against any other 17347ID shared libraries. That allows the compiler to use faster code for jumps 17348and calls. 17349 17350@item -mno-leaf-id-shared-library 17351@opindex mno-leaf-id-shared-library 17352Do not assume that the code being compiled won't link against any ID shared 17353libraries. Slower code is generated for jump and call insns. 17354 17355@item -mshared-library-id=n 17356@opindex mshared-library-id 17357Specifies the identification number of the ID-based shared library being 17358compiled. Specifying a value of 0 generates more compact code; specifying 17359other values forces the allocation of that number to the current 17360library but is no more space- or time-efficient than omitting this option. 17361 17362@item -msep-data 17363@opindex msep-data 17364Generate code that allows the data segment to be located in a different 17365area of memory from the text segment. This allows for execute in place in 17366an environment without virtual memory management by eliminating relocations 17367against the text section. 17368 17369@item -mno-sep-data 17370@opindex mno-sep-data 17371Generate code that assumes that the data segment follows the text segment. 17372This is the default. 17373 17374@item -mlong-calls 17375@itemx -mno-long-calls 17376@opindex mlong-calls 17377@opindex mno-long-calls 17378Tells the compiler to perform function calls by first loading the 17379address of the function into a register and then performing a subroutine 17380call on this register. This switch is needed if the target function 17381lies outside of the 24-bit addressing range of the offset-based 17382version of subroutine call instruction. 17383 17384This feature is not enabled by default. Specifying 17385@option{-mno-long-calls} restores the default behavior. Note these 17386switches have no effect on how the compiler generates code to handle 17387function calls via function pointers. 17388 17389@item -mfast-fp 17390@opindex mfast-fp 17391Link with the fast floating-point library. This library relaxes some of 17392the IEEE floating-point standard's rules for checking inputs against 17393Not-a-Number (NAN), in the interest of performance. 17394 17395@item -minline-plt 17396@opindex minline-plt 17397Enable inlining of PLT entries in function calls to functions that are 17398not known to bind locally. It has no effect without @option{-mfdpic}. 17399 17400@item -mmulticore 17401@opindex mmulticore 17402Build a standalone application for multicore Blackfin processors. 17403This option causes proper start files and link scripts supporting 17404multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 17405It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 17406 17407This option can be used with @option{-mcorea} or @option{-mcoreb}, which 17408selects the one-application-per-core programming model. Without 17409@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 17410programming model is used. In this model, the main function of Core B 17411should be named as @code{coreb_main}. 17412 17413If this option is not used, the single-core application programming 17414model is used. 17415 17416@item -mcorea 17417@opindex mcorea 17418Build a standalone application for Core A of BF561 when using 17419the one-application-per-core programming model. Proper start files 17420and link scripts are used to support Core A, and the macro 17421@code{__BFIN_COREA} is defined. 17422This option can only be used in conjunction with @option{-mmulticore}. 17423 17424@item -mcoreb 17425@opindex mcoreb 17426Build a standalone application for Core B of BF561 when using 17427the one-application-per-core programming model. Proper start files 17428and link scripts are used to support Core B, and the macro 17429@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 17430should be used instead of @code{main}. 17431This option can only be used in conjunction with @option{-mmulticore}. 17432 17433@item -msdram 17434@opindex msdram 17435Build a standalone application for SDRAM. Proper start files and 17436link scripts are used to put the application into SDRAM, and the macro 17437@code{__BFIN_SDRAM} is defined. 17438The loader should initialize SDRAM before loading the application. 17439 17440@item -micplb 17441@opindex micplb 17442Assume that ICPLBs are enabled at run time. This has an effect on certain 17443anomaly workarounds. For Linux targets, the default is to assume ICPLBs 17444are enabled; for standalone applications the default is off. 17445@end table 17446 17447@node C6X Options 17448@subsection C6X Options 17449@cindex C6X Options 17450 17451@table @gcctabopt 17452@item -march=@var{name} 17453@opindex march 17454This specifies the name of the target architecture. GCC uses this 17455name to determine what kind of instructions it can emit when generating 17456assembly code. Permissible names are: @samp{c62x}, 17457@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 17458 17459@item -mbig-endian 17460@opindex mbig-endian 17461Generate code for a big-endian target. 17462 17463@item -mlittle-endian 17464@opindex mlittle-endian 17465Generate code for a little-endian target. This is the default. 17466 17467@item -msim 17468@opindex msim 17469Choose startup files and linker script suitable for the simulator. 17470 17471@item -msdata=default 17472@opindex msdata=default 17473Put small global and static data in the @code{.neardata} section, 17474which is pointed to by register @code{B14}. Put small uninitialized 17475global and static data in the @code{.bss} section, which is adjacent 17476to the @code{.neardata} section. Put small read-only data into the 17477@code{.rodata} section. The corresponding sections used for large 17478pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 17479 17480@item -msdata=all 17481@opindex msdata=all 17482Put all data, not just small objects, into the sections reserved for 17483small data, and use addressing relative to the @code{B14} register to 17484access them. 17485 17486@item -msdata=none 17487@opindex msdata=none 17488Make no use of the sections reserved for small data, and use absolute 17489addresses to access all data. Put all initialized global and static 17490data in the @code{.fardata} section, and all uninitialized data in the 17491@code{.far} section. Put all constant data into the @code{.const} 17492section. 17493@end table 17494 17495@node CRIS Options 17496@subsection CRIS Options 17497@cindex CRIS Options 17498 17499These options are defined specifically for the CRIS ports. 17500 17501@table @gcctabopt 17502@item -march=@var{architecture-type} 17503@itemx -mcpu=@var{architecture-type} 17504@opindex march 17505@opindex mcpu 17506Generate code for the specified architecture. The choices for 17507@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 17508respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 17509Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 17510@samp{v10}. 17511 17512@item -mtune=@var{architecture-type} 17513@opindex mtune 17514Tune to @var{architecture-type} everything applicable about the generated 17515code, except for the ABI and the set of available instructions. The 17516choices for @var{architecture-type} are the same as for 17517@option{-march=@var{architecture-type}}. 17518 17519@item -mmax-stack-frame=@var{n} 17520@opindex mmax-stack-frame 17521Warn when the stack frame of a function exceeds @var{n} bytes. 17522 17523@item -metrax4 17524@itemx -metrax100 17525@opindex metrax4 17526@opindex metrax100 17527The options @option{-metrax4} and @option{-metrax100} are synonyms for 17528@option{-march=v3} and @option{-march=v8} respectively. 17529 17530@item -mmul-bug-workaround 17531@itemx -mno-mul-bug-workaround 17532@opindex mmul-bug-workaround 17533@opindex mno-mul-bug-workaround 17534Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 17535models where it applies. This option is active by default. 17536 17537@item -mpdebug 17538@opindex mpdebug 17539Enable CRIS-specific verbose debug-related information in the assembly 17540code. This option also has the effect of turning off the @samp{#NO_APP} 17541formatted-code indicator to the assembler at the beginning of the 17542assembly file. 17543 17544@item -mcc-init 17545@opindex mcc-init 17546Do not use condition-code results from previous instruction; always emit 17547compare and test instructions before use of condition codes. 17548 17549@item -mno-side-effects 17550@opindex mno-side-effects 17551Do not emit instructions with side effects in addressing modes other than 17552post-increment. 17553 17554@item -mstack-align 17555@itemx -mno-stack-align 17556@itemx -mdata-align 17557@itemx -mno-data-align 17558@itemx -mconst-align 17559@itemx -mno-const-align 17560@opindex mstack-align 17561@opindex mno-stack-align 17562@opindex mdata-align 17563@opindex mno-data-align 17564@opindex mconst-align 17565@opindex mno-const-align 17566These options (@samp{no-} options) arrange (eliminate arrangements) for the 17567stack frame, individual data and constants to be aligned for the maximum 17568single data access size for the chosen CPU model. The default is to 17569arrange for 32-bit alignment. ABI details such as structure layout are 17570not affected by these options. 17571 17572@item -m32-bit 17573@itemx -m16-bit 17574@itemx -m8-bit 17575@opindex m32-bit 17576@opindex m16-bit 17577@opindex m8-bit 17578Similar to the stack- data- and const-align options above, these options 17579arrange for stack frame, writable data and constants to all be 32-bit, 1758016-bit or 8-bit aligned. The default is 32-bit alignment. 17581 17582@item -mno-prologue-epilogue 17583@itemx -mprologue-epilogue 17584@opindex mno-prologue-epilogue 17585@opindex mprologue-epilogue 17586With @option{-mno-prologue-epilogue}, the normal function prologue and 17587epilogue which set up the stack frame are omitted and no return 17588instructions or return sequences are generated in the code. Use this 17589option only together with visual inspection of the compiled code: no 17590warnings or errors are generated when call-saved registers must be saved, 17591or storage for local variables needs to be allocated. 17592 17593@item -mno-gotplt 17594@itemx -mgotplt 17595@opindex mno-gotplt 17596@opindex mgotplt 17597With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 17598instruction sequences that load addresses for functions from the PLT part 17599of the GOT rather than (traditional on other architectures) calls to the 17600PLT@. The default is @option{-mgotplt}. 17601 17602@item -melf 17603@opindex melf 17604Legacy no-op option only recognized with the cris-axis-elf and 17605cris-axis-linux-gnu targets. 17606 17607@item -mlinux 17608@opindex mlinux 17609Legacy no-op option only recognized with the cris-axis-linux-gnu target. 17610 17611@item -sim 17612@opindex sim 17613This option, recognized for the cris-axis-elf, arranges 17614to link with input-output functions from a simulator library. Code, 17615initialized data and zero-initialized data are allocated consecutively. 17616 17617@item -sim2 17618@opindex sim2 17619Like @option{-sim}, but pass linker options to locate initialized data at 176200x40000000 and zero-initialized data at 0x80000000. 17621@end table 17622 17623@node CR16 Options 17624@subsection CR16 Options 17625@cindex CR16 Options 17626 17627These options are defined specifically for the CR16 ports. 17628 17629@table @gcctabopt 17630 17631@item -mmac 17632@opindex mmac 17633Enable the use of multiply-accumulate instructions. Disabled by default. 17634 17635@item -mcr16cplus 17636@itemx -mcr16c 17637@opindex mcr16cplus 17638@opindex mcr16c 17639Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 17640is default. 17641 17642@item -msim 17643@opindex msim 17644Links the library libsim.a which is in compatible with simulator. Applicable 17645to ELF compiler only. 17646 17647@item -mint32 17648@opindex mint32 17649Choose integer type as 32-bit wide. 17650 17651@item -mbit-ops 17652@opindex mbit-ops 17653Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 17654 17655@item -mdata-model=@var{model} 17656@opindex mdata-model 17657Choose a data model. The choices for @var{model} are @samp{near}, 17658@samp{far} or @samp{medium}. @samp{medium} is default. 17659However, @samp{far} is not valid with @option{-mcr16c}, as the 17660CR16C architecture does not support the far data model. 17661@end table 17662 17663@node Darwin Options 17664@subsection Darwin Options 17665@cindex Darwin options 17666 17667These options are defined for all architectures running the Darwin operating 17668system. 17669 17670FSF GCC on Darwin does not create ``fat'' object files; it creates 17671an object file for the single architecture that GCC was built to 17672target. Apple's GCC on Darwin does create ``fat'' files if multiple 17673@option{-arch} options are used; it does so by running the compiler or 17674linker multiple times and joining the results together with 17675@file{lipo}. 17676 17677The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 17678@samp{i686}) is determined by the flags that specify the ISA 17679that GCC is targeting, like @option{-mcpu} or @option{-march}. The 17680@option{-force_cpusubtype_ALL} option can be used to override this. 17681 17682The Darwin tools vary in their behavior when presented with an ISA 17683mismatch. The assembler, @file{as}, only permits instructions to 17684be used that are valid for the subtype of the file it is generating, 17685so you cannot put 64-bit instructions in a @samp{ppc750} object file. 17686The linker for shared libraries, @file{/usr/bin/libtool}, fails 17687and prints an error if asked to create a shared library with a less 17688restrictive subtype than its input files (for instance, trying to put 17689a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 17690for executables, @command{ld}, quietly gives the executable the most 17691restrictive subtype of any of its input files. 17692 17693@table @gcctabopt 17694@item -F@var{dir} 17695@opindex F 17696Add the framework directory @var{dir} to the head of the list of 17697directories to be searched for header files. These directories are 17698interleaved with those specified by @option{-I} options and are 17699scanned in a left-to-right order. 17700 17701A framework directory is a directory with frameworks in it. A 17702framework is a directory with a @file{Headers} and/or 17703@file{PrivateHeaders} directory contained directly in it that ends 17704in @file{.framework}. The name of a framework is the name of this 17705directory excluding the @file{.framework}. Headers associated with 17706the framework are found in one of those two directories, with 17707@file{Headers} being searched first. A subframework is a framework 17708directory that is in a framework's @file{Frameworks} directory. 17709Includes of subframework headers can only appear in a header of a 17710framework that contains the subframework, or in a sibling subframework 17711header. Two subframeworks are siblings if they occur in the same 17712framework. A subframework should not have the same name as a 17713framework; a warning is issued if this is violated. Currently a 17714subframework cannot have subframeworks; in the future, the mechanism 17715may be extended to support this. The standard frameworks can be found 17716in @file{/System/Library/Frameworks} and 17717@file{/Library/Frameworks}. An example include looks like 17718@code{#include <Framework/header.h>}, where @file{Framework} denotes 17719the name of the framework and @file{header.h} is found in the 17720@file{PrivateHeaders} or @file{Headers} directory. 17721 17722@item -iframework@var{dir} 17723@opindex iframework 17724Like @option{-F} except the directory is a treated as a system 17725directory. The main difference between this @option{-iframework} and 17726@option{-F} is that with @option{-iframework} the compiler does not 17727warn about constructs contained within header files found via 17728@var{dir}. This option is valid only for the C family of languages. 17729 17730@item -gused 17731@opindex gused 17732Emit debugging information for symbols that are used. For stabs 17733debugging format, this enables @option{-feliminate-unused-debug-symbols}. 17734This is by default ON@. 17735 17736@item -gfull 17737@opindex gfull 17738Emit debugging information for all symbols and types. 17739 17740@item -mmacosx-version-min=@var{version} 17741The earliest version of MacOS X that this executable will run on 17742is @var{version}. Typical values of @var{version} include @code{10.1}, 17743@code{10.2}, and @code{10.3.9}. 17744 17745If the compiler was built to use the system's headers by default, 17746then the default for this option is the system version on which the 17747compiler is running, otherwise the default is to make choices that 17748are compatible with as many systems and code bases as possible. 17749 17750@item -mkernel 17751@opindex mkernel 17752Enable kernel development mode. The @option{-mkernel} option sets 17753@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 17754@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 17755@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 17756applicable. This mode also sets @option{-mno-altivec}, 17757@option{-msoft-float}, @option{-fno-builtin} and 17758@option{-mlong-branch} for PowerPC targets. 17759 17760@item -mone-byte-bool 17761@opindex mone-byte-bool 17762Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 17763By default @code{sizeof(bool)} is @code{4} when compiling for 17764Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 17765option has no effect on x86. 17766 17767@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 17768to generate code that is not binary compatible with code generated 17769without that switch. Using this switch may require recompiling all 17770other modules in a program, including system libraries. Use this 17771switch to conform to a non-default data model. 17772 17773@item -mfix-and-continue 17774@itemx -ffix-and-continue 17775@itemx -findirect-data 17776@opindex mfix-and-continue 17777@opindex ffix-and-continue 17778@opindex findirect-data 17779Generate code suitable for fast turnaround development, such as to 17780allow GDB to dynamically load @file{.o} files into already-running 17781programs. @option{-findirect-data} and @option{-ffix-and-continue} 17782are provided for backwards compatibility. 17783 17784@item -all_load 17785@opindex all_load 17786Loads all members of static archive libraries. 17787See man ld(1) for more information. 17788 17789@item -arch_errors_fatal 17790@opindex arch_errors_fatal 17791Cause the errors having to do with files that have the wrong architecture 17792to be fatal. 17793 17794@item -bind_at_load 17795@opindex bind_at_load 17796Causes the output file to be marked such that the dynamic linker will 17797bind all undefined references when the file is loaded or launched. 17798 17799@item -bundle 17800@opindex bundle 17801Produce a Mach-o bundle format file. 17802See man ld(1) for more information. 17803 17804@item -bundle_loader @var{executable} 17805@opindex bundle_loader 17806This option specifies the @var{executable} that will load the build 17807output file being linked. See man ld(1) for more information. 17808 17809@item -dynamiclib 17810@opindex dynamiclib 17811When passed this option, GCC produces a dynamic library instead of 17812an executable when linking, using the Darwin @file{libtool} command. 17813 17814@item -force_cpusubtype_ALL 17815@opindex force_cpusubtype_ALL 17816This causes GCC's output file to have the @samp{ALL} subtype, instead of 17817one controlled by the @option{-mcpu} or @option{-march} option. 17818 17819@item -allowable_client @var{client_name} 17820@itemx -client_name 17821@itemx -compatibility_version 17822@itemx -current_version 17823@itemx -dead_strip 17824@itemx -dependency-file 17825@itemx -dylib_file 17826@itemx -dylinker_install_name 17827@itemx -dynamic 17828@itemx -exported_symbols_list 17829@itemx -filelist 17830@need 800 17831@itemx -flat_namespace 17832@itemx -force_flat_namespace 17833@itemx -headerpad_max_install_names 17834@itemx -image_base 17835@itemx -init 17836@itemx -install_name 17837@itemx -keep_private_externs 17838@itemx -multi_module 17839@itemx -multiply_defined 17840@itemx -multiply_defined_unused 17841@need 800 17842@itemx -noall_load 17843@itemx -no_dead_strip_inits_and_terms 17844@itemx -nofixprebinding 17845@itemx -nomultidefs 17846@itemx -noprebind 17847@itemx -noseglinkedit 17848@itemx -pagezero_size 17849@itemx -prebind 17850@itemx -prebind_all_twolevel_modules 17851@itemx -private_bundle 17852@need 800 17853@itemx -read_only_relocs 17854@itemx -sectalign 17855@itemx -sectobjectsymbols 17856@itemx -whyload 17857@itemx -seg1addr 17858@itemx -sectcreate 17859@itemx -sectobjectsymbols 17860@itemx -sectorder 17861@itemx -segaddr 17862@itemx -segs_read_only_addr 17863@need 800 17864@itemx -segs_read_write_addr 17865@itemx -seg_addr_table 17866@itemx -seg_addr_table_filename 17867@itemx -seglinkedit 17868@itemx -segprot 17869@itemx -segs_read_only_addr 17870@itemx -segs_read_write_addr 17871@itemx -single_module 17872@itemx -static 17873@itemx -sub_library 17874@need 800 17875@itemx -sub_umbrella 17876@itemx -twolevel_namespace 17877@itemx -umbrella 17878@itemx -undefined 17879@itemx -unexported_symbols_list 17880@itemx -weak_reference_mismatches 17881@itemx -whatsloaded 17882@opindex allowable_client 17883@opindex client_name 17884@opindex compatibility_version 17885@opindex current_version 17886@opindex dead_strip 17887@opindex dependency-file 17888@opindex dylib_file 17889@opindex dylinker_install_name 17890@opindex dynamic 17891@opindex exported_symbols_list 17892@opindex filelist 17893@opindex flat_namespace 17894@opindex force_flat_namespace 17895@opindex headerpad_max_install_names 17896@opindex image_base 17897@opindex init 17898@opindex install_name 17899@opindex keep_private_externs 17900@opindex multi_module 17901@opindex multiply_defined 17902@opindex multiply_defined_unused 17903@opindex noall_load 17904@opindex no_dead_strip_inits_and_terms 17905@opindex nofixprebinding 17906@opindex nomultidefs 17907@opindex noprebind 17908@opindex noseglinkedit 17909@opindex pagezero_size 17910@opindex prebind 17911@opindex prebind_all_twolevel_modules 17912@opindex private_bundle 17913@opindex read_only_relocs 17914@opindex sectalign 17915@opindex sectobjectsymbols 17916@opindex whyload 17917@opindex seg1addr 17918@opindex sectcreate 17919@opindex sectobjectsymbols 17920@opindex sectorder 17921@opindex segaddr 17922@opindex segs_read_only_addr 17923@opindex segs_read_write_addr 17924@opindex seg_addr_table 17925@opindex seg_addr_table_filename 17926@opindex seglinkedit 17927@opindex segprot 17928@opindex segs_read_only_addr 17929@opindex segs_read_write_addr 17930@opindex single_module 17931@opindex static 17932@opindex sub_library 17933@opindex sub_umbrella 17934@opindex twolevel_namespace 17935@opindex umbrella 17936@opindex undefined 17937@opindex unexported_symbols_list 17938@opindex weak_reference_mismatches 17939@opindex whatsloaded 17940These options are passed to the Darwin linker. The Darwin linker man page 17941describes them in detail. 17942@end table 17943 17944@node DEC Alpha Options 17945@subsection DEC Alpha Options 17946 17947These @samp{-m} options are defined for the DEC Alpha implementations: 17948 17949@table @gcctabopt 17950@item -mno-soft-float 17951@itemx -msoft-float 17952@opindex mno-soft-float 17953@opindex msoft-float 17954Use (do not use) the hardware floating-point instructions for 17955floating-point operations. When @option{-msoft-float} is specified, 17956functions in @file{libgcc.a} are used to perform floating-point 17957operations. Unless they are replaced by routines that emulate the 17958floating-point operations, or compiled in such a way as to call such 17959emulations routines, these routines issue floating-point 17960operations. If you are compiling for an Alpha without floating-point 17961operations, you must ensure that the library is built so as not to call 17962them. 17963 17964Note that Alpha implementations without floating-point operations are 17965required to have floating-point registers. 17966 17967@item -mfp-reg 17968@itemx -mno-fp-regs 17969@opindex mfp-reg 17970@opindex mno-fp-regs 17971Generate code that uses (does not use) the floating-point register set. 17972@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 17973register set is not used, floating-point operands are passed in integer 17974registers as if they were integers and floating-point results are passed 17975in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 17976so any function with a floating-point argument or return value called by code 17977compiled with @option{-mno-fp-regs} must also be compiled with that 17978option. 17979 17980A typical use of this option is building a kernel that does not use, 17981and hence need not save and restore, any floating-point registers. 17982 17983@item -mieee 17984@opindex mieee 17985The Alpha architecture implements floating-point hardware optimized for 17986maximum performance. It is mostly compliant with the IEEE floating-point 17987standard. However, for full compliance, software assistance is 17988required. This option generates code fully IEEE-compliant code 17989@emph{except} that the @var{inexact-flag} is not maintained (see below). 17990If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 17991defined during compilation. The resulting code is less efficient but is 17992able to correctly support denormalized numbers and exceptional IEEE 17993values such as not-a-number and plus/minus infinity. Other Alpha 17994compilers call this option @option{-ieee_with_no_inexact}. 17995 17996@item -mieee-with-inexact 17997@opindex mieee-with-inexact 17998This is like @option{-mieee} except the generated code also maintains 17999the IEEE @var{inexact-flag}. Turning on this option causes the 18000generated code to implement fully-compliant IEEE math. In addition to 18001@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 18002macro. On some Alpha implementations the resulting code may execute 18003significantly slower than the code generated by default. Since there is 18004very little code that depends on the @var{inexact-flag}, you should 18005normally not specify this option. Other Alpha compilers call this 18006option @option{-ieee_with_inexact}. 18007 18008@item -mfp-trap-mode=@var{trap-mode} 18009@opindex mfp-trap-mode 18010This option controls what floating-point related traps are enabled. 18011Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 18012The trap mode can be set to one of four values: 18013 18014@table @samp 18015@item n 18016This is the default (normal) setting. The only traps that are enabled 18017are the ones that cannot be disabled in software (e.g., division by zero 18018trap). 18019 18020@item u 18021In addition to the traps enabled by @samp{n}, underflow traps are enabled 18022as well. 18023 18024@item su 18025Like @samp{u}, but the instructions are marked to be safe for software 18026completion (see Alpha architecture manual for details). 18027 18028@item sui 18029Like @samp{su}, but inexact traps are enabled as well. 18030@end table 18031 18032@item -mfp-rounding-mode=@var{rounding-mode} 18033@opindex mfp-rounding-mode 18034Selects the IEEE rounding mode. Other Alpha compilers call this option 18035@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 18036of: 18037 18038@table @samp 18039@item n 18040Normal IEEE rounding mode. Floating-point numbers are rounded towards 18041the nearest machine number or towards the even machine number in case 18042of a tie. 18043 18044@item m 18045Round towards minus infinity. 18046 18047@item c 18048Chopped rounding mode. Floating-point numbers are rounded towards zero. 18049 18050@item d 18051Dynamic rounding mode. A field in the floating-point control register 18052(@var{fpcr}, see Alpha architecture reference manual) controls the 18053rounding mode in effect. The C library initializes this register for 18054rounding towards plus infinity. Thus, unless your program modifies the 18055@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 18056@end table 18057 18058@item -mtrap-precision=@var{trap-precision} 18059@opindex mtrap-precision 18060In the Alpha architecture, floating-point traps are imprecise. This 18061means without software assistance it is impossible to recover from a 18062floating trap and program execution normally needs to be terminated. 18063GCC can generate code that can assist operating system trap handlers 18064in determining the exact location that caused a floating-point trap. 18065Depending on the requirements of an application, different levels of 18066precisions can be selected: 18067 18068@table @samp 18069@item p 18070Program precision. This option is the default and means a trap handler 18071can only identify which program caused a floating-point exception. 18072 18073@item f 18074Function precision. The trap handler can determine the function that 18075caused a floating-point exception. 18076 18077@item i 18078Instruction precision. The trap handler can determine the exact 18079instruction that caused a floating-point exception. 18080@end table 18081 18082Other Alpha compilers provide the equivalent options called 18083@option{-scope_safe} and @option{-resumption_safe}. 18084 18085@item -mieee-conformant 18086@opindex mieee-conformant 18087This option marks the generated code as IEEE conformant. You must not 18088use this option unless you also specify @option{-mtrap-precision=i} and either 18089@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 18090is to emit the line @samp{.eflag 48} in the function prologue of the 18091generated assembly file. 18092 18093@item -mbuild-constants 18094@opindex mbuild-constants 18095Normally GCC examines a 32- or 64-bit integer constant to 18096see if it can construct it from smaller constants in two or three 18097instructions. If it cannot, it outputs the constant as a literal and 18098generates code to load it from the data segment at run time. 18099 18100Use this option to require GCC to construct @emph{all} integer constants 18101using code, even if it takes more instructions (the maximum is six). 18102 18103You typically use this option to build a shared library dynamic 18104loader. Itself a shared library, it must relocate itself in memory 18105before it can find the variables and constants in its own data segment. 18106 18107@item -mbwx 18108@itemx -mno-bwx 18109@itemx -mcix 18110@itemx -mno-cix 18111@itemx -mfix 18112@itemx -mno-fix 18113@itemx -mmax 18114@itemx -mno-max 18115@opindex mbwx 18116@opindex mno-bwx 18117@opindex mcix 18118@opindex mno-cix 18119@opindex mfix 18120@opindex mno-fix 18121@opindex mmax 18122@opindex mno-max 18123Indicate whether GCC should generate code to use the optional BWX, 18124CIX, FIX and MAX instruction sets. The default is to use the instruction 18125sets supported by the CPU type specified via @option{-mcpu=} option or that 18126of the CPU on which GCC was built if none is specified. 18127 18128@item -mfloat-vax 18129@itemx -mfloat-ieee 18130@opindex mfloat-vax 18131@opindex mfloat-ieee 18132Generate code that uses (does not use) VAX F and G floating-point 18133arithmetic instead of IEEE single and double precision. 18134 18135@item -mexplicit-relocs 18136@itemx -mno-explicit-relocs 18137@opindex mexplicit-relocs 18138@opindex mno-explicit-relocs 18139Older Alpha assemblers provided no way to generate symbol relocations 18140except via assembler macros. Use of these macros does not allow 18141optimal instruction scheduling. GNU binutils as of version 2.12 18142supports a new syntax that allows the compiler to explicitly mark 18143which relocations should apply to which instructions. This option 18144is mostly useful for debugging, as GCC detects the capabilities of 18145the assembler when it is built and sets the default accordingly. 18146 18147@item -msmall-data 18148@itemx -mlarge-data 18149@opindex msmall-data 18150@opindex mlarge-data 18151When @option{-mexplicit-relocs} is in effect, static data is 18152accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 18153is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 18154(the @code{.sdata} and @code{.sbss} sections) and are accessed via 1815516-bit relocations off of the @code{$gp} register. This limits the 18156size of the small data area to 64KB, but allows the variables to be 18157directly accessed via a single instruction. 18158 18159The default is @option{-mlarge-data}. With this option the data area 18160is limited to just below 2GB@. Programs that require more than 2GB of 18161data must use @code{malloc} or @code{mmap} to allocate the data in the 18162heap instead of in the program's data segment. 18163 18164When generating code for shared libraries, @option{-fpic} implies 18165@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 18166 18167@item -msmall-text 18168@itemx -mlarge-text 18169@opindex msmall-text 18170@opindex mlarge-text 18171When @option{-msmall-text} is used, the compiler assumes that the 18172code of the entire program (or shared library) fits in 4MB, and is 18173thus reachable with a branch instruction. When @option{-msmall-data} 18174is used, the compiler can assume that all local symbols share the 18175same @code{$gp} value, and thus reduce the number of instructions 18176required for a function call from 4 to 1. 18177 18178The default is @option{-mlarge-text}. 18179 18180@item -mcpu=@var{cpu_type} 18181@opindex mcpu 18182Set the instruction set and instruction scheduling parameters for 18183machine type @var{cpu_type}. You can specify either the @samp{EV} 18184style name or the corresponding chip number. GCC supports scheduling 18185parameters for the EV4, EV5 and EV6 family of processors and 18186chooses the default values for the instruction set from the processor 18187you specify. If you do not specify a processor type, GCC defaults 18188to the processor on which the compiler was built. 18189 18190Supported values for @var{cpu_type} are 18191 18192@table @samp 18193@item ev4 18194@itemx ev45 18195@itemx 21064 18196Schedules as an EV4 and has no instruction set extensions. 18197 18198@item ev5 18199@itemx 21164 18200Schedules as an EV5 and has no instruction set extensions. 18201 18202@item ev56 18203@itemx 21164a 18204Schedules as an EV5 and supports the BWX extension. 18205 18206@item pca56 18207@itemx 21164pc 18208@itemx 21164PC 18209Schedules as an EV5 and supports the BWX and MAX extensions. 18210 18211@item ev6 18212@itemx 21264 18213Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 18214 18215@item ev67 18216@itemx 21264a 18217Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 18218@end table 18219 18220Native toolchains also support the value @samp{native}, 18221which selects the best architecture option for the host processor. 18222@option{-mcpu=native} has no effect if GCC does not recognize 18223the processor. 18224 18225@item -mtune=@var{cpu_type} 18226@opindex mtune 18227Set only the instruction scheduling parameters for machine type 18228@var{cpu_type}. The instruction set is not changed. 18229 18230Native toolchains also support the value @samp{native}, 18231which selects the best architecture option for the host processor. 18232@option{-mtune=native} has no effect if GCC does not recognize 18233the processor. 18234 18235@item -mmemory-latency=@var{time} 18236@opindex mmemory-latency 18237Sets the latency the scheduler should assume for typical memory 18238references as seen by the application. This number is highly 18239dependent on the memory access patterns used by the application 18240and the size of the external cache on the machine. 18241 18242Valid options for @var{time} are 18243 18244@table @samp 18245@item @var{number} 18246A decimal number representing clock cycles. 18247 18248@item L1 18249@itemx L2 18250@itemx L3 18251@itemx main 18252The compiler contains estimates of the number of clock cycles for 18253``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 18254(also called Dcache, Scache, and Bcache), as well as to main memory. 18255Note that L3 is only valid for EV5. 18256 18257@end table 18258@end table 18259 18260@node FR30 Options 18261@subsection FR30 Options 18262@cindex FR30 Options 18263 18264These options are defined specifically for the FR30 port. 18265 18266@table @gcctabopt 18267 18268@item -msmall-model 18269@opindex msmall-model 18270Use the small address space model. This can produce smaller code, but 18271it does assume that all symbolic values and addresses fit into a 1827220-bit range. 18273 18274@item -mno-lsim 18275@opindex mno-lsim 18276Assume that runtime support has been provided and so there is no need 18277to include the simulator library (@file{libsim.a}) on the linker 18278command line. 18279 18280@end table 18281 18282@node FT32 Options 18283@subsection FT32 Options 18284@cindex FT32 Options 18285 18286These options are defined specifically for the FT32 port. 18287 18288@table @gcctabopt 18289 18290@item -msim 18291@opindex msim 18292Specifies that the program will be run on the simulator. This causes 18293an alternate runtime startup and library to be linked. 18294You must not use this option when generating programs that will run on 18295real hardware; you must provide your own runtime library for whatever 18296I/O functions are needed. 18297 18298@item -mlra 18299@opindex mlra 18300Enable Local Register Allocation. This is still experimental for FT32, 18301so by default the compiler uses standard reload. 18302 18303@item -mnodiv 18304@opindex mnodiv 18305Do not use div and mod instructions. 18306 18307@item -mft32b 18308@opindex mft32b 18309Enable use of the extended instructions of the FT32B processor. 18310 18311@item -mcompress 18312@opindex mcompress 18313Compress all code using the Ft32B code compression scheme. 18314 18315@item -mnopm 18316@opindex mnopm 18317Do not generate code that reads program memory. 18318 18319@end table 18320 18321@node FRV Options 18322@subsection FRV Options 18323@cindex FRV Options 18324 18325@table @gcctabopt 18326@item -mgpr-32 18327@opindex mgpr-32 18328 18329Only use the first 32 general-purpose registers. 18330 18331@item -mgpr-64 18332@opindex mgpr-64 18333 18334Use all 64 general-purpose registers. 18335 18336@item -mfpr-32 18337@opindex mfpr-32 18338 18339Use only the first 32 floating-point registers. 18340 18341@item -mfpr-64 18342@opindex mfpr-64 18343 18344Use all 64 floating-point registers. 18345 18346@item -mhard-float 18347@opindex mhard-float 18348 18349Use hardware instructions for floating-point operations. 18350 18351@item -msoft-float 18352@opindex msoft-float 18353 18354Use library routines for floating-point operations. 18355 18356@item -malloc-cc 18357@opindex malloc-cc 18358 18359Dynamically allocate condition code registers. 18360 18361@item -mfixed-cc 18362@opindex mfixed-cc 18363 18364Do not try to dynamically allocate condition code registers, only 18365use @code{icc0} and @code{fcc0}. 18366 18367@item -mdword 18368@opindex mdword 18369 18370Change ABI to use double word insns. 18371 18372@item -mno-dword 18373@opindex mno-dword 18374 18375Do not use double word instructions. 18376 18377@item -mdouble 18378@opindex mdouble 18379 18380Use floating-point double instructions. 18381 18382@item -mno-double 18383@opindex mno-double 18384 18385Do not use floating-point double instructions. 18386 18387@item -mmedia 18388@opindex mmedia 18389 18390Use media instructions. 18391 18392@item -mno-media 18393@opindex mno-media 18394 18395Do not use media instructions. 18396 18397@item -mmuladd 18398@opindex mmuladd 18399 18400Use multiply and add/subtract instructions. 18401 18402@item -mno-muladd 18403@opindex mno-muladd 18404 18405Do not use multiply and add/subtract instructions. 18406 18407@item -mfdpic 18408@opindex mfdpic 18409 18410Select the FDPIC ABI, which uses function descriptors to represent 18411pointers to functions. Without any PIC/PIE-related options, it 18412implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 18413assumes GOT entries and small data are within a 12-bit range from the 18414GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 18415are computed with 32 bits. 18416With a @samp{bfin-elf} target, this option implies @option{-msim}. 18417 18418@item -minline-plt 18419@opindex minline-plt 18420 18421Enable inlining of PLT entries in function calls to functions that are 18422not known to bind locally. It has no effect without @option{-mfdpic}. 18423It's enabled by default if optimizing for speed and compiling for 18424shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 18425optimization option such as @option{-O3} or above is present in the 18426command line. 18427 18428@item -mTLS 18429@opindex mTLS 18430 18431Assume a large TLS segment when generating thread-local code. 18432 18433@item -mtls 18434@opindex mtls 18435 18436Do not assume a large TLS segment when generating thread-local code. 18437 18438@item -mgprel-ro 18439@opindex mgprel-ro 18440 18441Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 18442that is known to be in read-only sections. It's enabled by default, 18443except for @option{-fpic} or @option{-fpie}: even though it may help 18444make the global offset table smaller, it trades 1 instruction for 4. 18445With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 18446one of which may be shared by multiple symbols, and it avoids the need 18447for a GOT entry for the referenced symbol, so it's more likely to be a 18448win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 18449 18450@item -multilib-library-pic 18451@opindex multilib-library-pic 18452 18453Link with the (library, not FD) pic libraries. It's implied by 18454@option{-mlibrary-pic}, as well as by @option{-fPIC} and 18455@option{-fpic} without @option{-mfdpic}. You should never have to use 18456it explicitly. 18457 18458@item -mlinked-fp 18459@opindex mlinked-fp 18460 18461Follow the EABI requirement of always creating a frame pointer whenever 18462a stack frame is allocated. This option is enabled by default and can 18463be disabled with @option{-mno-linked-fp}. 18464 18465@item -mlong-calls 18466@opindex mlong-calls 18467 18468Use indirect addressing to call functions outside the current 18469compilation unit. This allows the functions to be placed anywhere 18470within the 32-bit address space. 18471 18472@item -malign-labels 18473@opindex malign-labels 18474 18475Try to align labels to an 8-byte boundary by inserting NOPs into the 18476previous packet. This option only has an effect when VLIW packing 18477is enabled. It doesn't create new packets; it merely adds NOPs to 18478existing ones. 18479 18480@item -mlibrary-pic 18481@opindex mlibrary-pic 18482 18483Generate position-independent EABI code. 18484 18485@item -macc-4 18486@opindex macc-4 18487 18488Use only the first four media accumulator registers. 18489 18490@item -macc-8 18491@opindex macc-8 18492 18493Use all eight media accumulator registers. 18494 18495@item -mpack 18496@opindex mpack 18497 18498Pack VLIW instructions. 18499 18500@item -mno-pack 18501@opindex mno-pack 18502 18503Do not pack VLIW instructions. 18504 18505@item -mno-eflags 18506@opindex mno-eflags 18507 18508Do not mark ABI switches in e_flags. 18509 18510@item -mcond-move 18511@opindex mcond-move 18512 18513Enable the use of conditional-move instructions (default). 18514 18515This switch is mainly for debugging the compiler and will likely be removed 18516in a future version. 18517 18518@item -mno-cond-move 18519@opindex mno-cond-move 18520 18521Disable the use of conditional-move instructions. 18522 18523This switch is mainly for debugging the compiler and will likely be removed 18524in a future version. 18525 18526@item -mscc 18527@opindex mscc 18528 18529Enable the use of conditional set instructions (default). 18530 18531This switch is mainly for debugging the compiler and will likely be removed 18532in a future version. 18533 18534@item -mno-scc 18535@opindex mno-scc 18536 18537Disable the use of conditional set instructions. 18538 18539This switch is mainly for debugging the compiler and will likely be removed 18540in a future version. 18541 18542@item -mcond-exec 18543@opindex mcond-exec 18544 18545Enable the use of conditional execution (default). 18546 18547This switch is mainly for debugging the compiler and will likely be removed 18548in a future version. 18549 18550@item -mno-cond-exec 18551@opindex mno-cond-exec 18552 18553Disable the use of conditional execution. 18554 18555This switch is mainly for debugging the compiler and will likely be removed 18556in a future version. 18557 18558@item -mvliw-branch 18559@opindex mvliw-branch 18560 18561Run a pass to pack branches into VLIW instructions (default). 18562 18563This switch is mainly for debugging the compiler and will likely be removed 18564in a future version. 18565 18566@item -mno-vliw-branch 18567@opindex mno-vliw-branch 18568 18569Do not run a pass to pack branches into VLIW instructions. 18570 18571This switch is mainly for debugging the compiler and will likely be removed 18572in a future version. 18573 18574@item -mmulti-cond-exec 18575@opindex mmulti-cond-exec 18576 18577Enable optimization of @code{&&} and @code{||} in conditional execution 18578(default). 18579 18580This switch is mainly for debugging the compiler and will likely be removed 18581in a future version. 18582 18583@item -mno-multi-cond-exec 18584@opindex mno-multi-cond-exec 18585 18586Disable optimization of @code{&&} and @code{||} in conditional execution. 18587 18588This switch is mainly for debugging the compiler and will likely be removed 18589in a future version. 18590 18591@item -mnested-cond-exec 18592@opindex mnested-cond-exec 18593 18594Enable nested conditional execution optimizations (default). 18595 18596This switch is mainly for debugging the compiler and will likely be removed 18597in a future version. 18598 18599@item -mno-nested-cond-exec 18600@opindex mno-nested-cond-exec 18601 18602Disable nested conditional execution optimizations. 18603 18604This switch is mainly for debugging the compiler and will likely be removed 18605in a future version. 18606 18607@item -moptimize-membar 18608@opindex moptimize-membar 18609 18610This switch removes redundant @code{membar} instructions from the 18611compiler-generated code. It is enabled by default. 18612 18613@item -mno-optimize-membar 18614@opindex mno-optimize-membar 18615 18616This switch disables the automatic removal of redundant @code{membar} 18617instructions from the generated code. 18618 18619@item -mtomcat-stats 18620@opindex mtomcat-stats 18621 18622Cause gas to print out tomcat statistics. 18623 18624@item -mcpu=@var{cpu} 18625@opindex mcpu 18626 18627Select the processor type for which to generate code. Possible values are 18628@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 18629@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 18630 18631@end table 18632 18633@node GNU/Linux Options 18634@subsection GNU/Linux Options 18635 18636These @samp{-m} options are defined for GNU/Linux targets: 18637 18638@table @gcctabopt 18639@item -mglibc 18640@opindex mglibc 18641Use the GNU C library. This is the default except 18642on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and 18643@samp{*-*-linux-*android*} targets. 18644 18645@item -muclibc 18646@opindex muclibc 18647Use uClibc C library. This is the default on 18648@samp{*-*-linux-*uclibc*} targets. 18649 18650@item -mmusl 18651@opindex mmusl 18652Use the musl C library. This is the default on 18653@samp{*-*-linux-*musl*} targets. 18654 18655@item -mbionic 18656@opindex mbionic 18657Use Bionic C library. This is the default on 18658@samp{*-*-linux-*android*} targets. 18659 18660@item -mandroid 18661@opindex mandroid 18662Compile code compatible with Android platform. This is the default on 18663@samp{*-*-linux-*android*} targets. 18664 18665When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 18666@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 18667this option makes the GCC driver pass Android-specific options to the linker. 18668Finally, this option causes the preprocessor macro @code{__ANDROID__} 18669to be defined. 18670 18671@item -tno-android-cc 18672@opindex tno-android-cc 18673Disable compilation effects of @option{-mandroid}, i.e., do not enable 18674@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 18675@option{-fno-rtti} by default. 18676 18677@item -tno-android-ld 18678@opindex tno-android-ld 18679Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 18680linking options to the linker. 18681 18682@end table 18683 18684@node H8/300 Options 18685@subsection H8/300 Options 18686 18687These @samp{-m} options are defined for the H8/300 implementations: 18688 18689@table @gcctabopt 18690@item -mrelax 18691@opindex mrelax 18692Shorten some address references at link time, when possible; uses the 18693linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 18694ld, Using ld}, for a fuller description. 18695 18696@item -mh 18697@opindex mh 18698Generate code for the H8/300H@. 18699 18700@item -ms 18701@opindex ms 18702Generate code for the H8S@. 18703 18704@item -mn 18705@opindex mn 18706Generate code for the H8S and H8/300H in the normal mode. This switch 18707must be used either with @option{-mh} or @option{-ms}. 18708 18709@item -ms2600 18710@opindex ms2600 18711Generate code for the H8S/2600. This switch must be used with @option{-ms}. 18712 18713@item -mexr 18714@opindex mexr 18715Extended registers are stored on stack before execution of function 18716with monitor attribute. Default option is @option{-mexr}. 18717This option is valid only for H8S targets. 18718 18719@item -mno-exr 18720@opindex mno-exr 18721Extended registers are not stored on stack before execution of function 18722with monitor attribute. Default option is @option{-mno-exr}. 18723This option is valid only for H8S targets. 18724 18725@item -mint32 18726@opindex mint32 18727Make @code{int} data 32 bits by default. 18728 18729@item -malign-300 18730@opindex malign-300 18731On the H8/300H and H8S, use the same alignment rules as for the H8/300. 18732The default for the H8/300H and H8S is to align longs and floats on 187334-byte boundaries. 18734@option{-malign-300} causes them to be aligned on 2-byte boundaries. 18735This option has no effect on the H8/300. 18736@end table 18737 18738@node HPPA Options 18739@subsection HPPA Options 18740@cindex HPPA Options 18741 18742These @samp{-m} options are defined for the HPPA family of computers: 18743 18744@table @gcctabopt 18745@item -march=@var{architecture-type} 18746@opindex march 18747Generate code for the specified architecture. The choices for 18748@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 187491.1, and @samp{2.0} for PA 2.0 processors. Refer to 18750@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 18751architecture option for your machine. Code compiled for lower numbered 18752architectures runs on higher numbered architectures, but not the 18753other way around. 18754 18755@item -mpa-risc-1-0 18756@itemx -mpa-risc-1-1 18757@itemx -mpa-risc-2-0 18758@opindex mpa-risc-1-0 18759@opindex mpa-risc-1-1 18760@opindex mpa-risc-2-0 18761Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 18762 18763@item -mcaller-copies 18764@opindex mcaller-copies 18765The caller copies function arguments passed by hidden reference. This 18766option should be used with care as it is not compatible with the default 1876732-bit runtime. However, only aggregates larger than eight bytes are 18768passed by hidden reference and the option provides better compatibility 18769with OpenMP. 18770 18771@item -mjump-in-delay 18772@opindex mjump-in-delay 18773This option is ignored and provided for compatibility purposes only. 18774 18775@item -mdisable-fpregs 18776@opindex mdisable-fpregs 18777Prevent floating-point registers from being used in any manner. This is 18778necessary for compiling kernels that perform lazy context switching of 18779floating-point registers. If you use this option and attempt to perform 18780floating-point operations, the compiler aborts. 18781 18782@item -mdisable-indexing 18783@opindex mdisable-indexing 18784Prevent the compiler from using indexing address modes. This avoids some 18785rather obscure problems when compiling MIG generated code under MACH@. 18786 18787@item -mno-space-regs 18788@opindex mno-space-regs 18789Generate code that assumes the target has no space registers. This allows 18790GCC to generate faster indirect calls and use unscaled index address modes. 18791 18792Such code is suitable for level 0 PA systems and kernels. 18793 18794@item -mfast-indirect-calls 18795@opindex mfast-indirect-calls 18796Generate code that assumes calls never cross space boundaries. This 18797allows GCC to emit code that performs faster indirect calls. 18798 18799This option does not work in the presence of shared libraries or nested 18800functions. 18801 18802@item -mfixed-range=@var{register-range} 18803@opindex mfixed-range 18804Generate code treating the given register range as fixed registers. 18805A fixed register is one that the register allocator cannot use. This is 18806useful when compiling kernel code. A register range is specified as 18807two registers separated by a dash. Multiple register ranges can be 18808specified separated by a comma. 18809 18810@item -mlong-load-store 18811@opindex mlong-load-store 18812Generate 3-instruction load and store sequences as sometimes required by 18813the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 18814the HP compilers. 18815 18816@item -mportable-runtime 18817@opindex mportable-runtime 18818Use the portable calling conventions proposed by HP for ELF systems. 18819 18820@item -mgas 18821@opindex mgas 18822Enable the use of assembler directives only GAS understands. 18823 18824@item -mschedule=@var{cpu-type} 18825@opindex mschedule 18826Schedule code according to the constraints for the machine type 18827@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 18828@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 18829to @file{/usr/lib/sched.models} on an HP-UX system to determine the 18830proper scheduling option for your machine. The default scheduling is 18831@samp{8000}. 18832 18833@item -mlinker-opt 18834@opindex mlinker-opt 18835Enable the optimization pass in the HP-UX linker. Note this makes symbolic 18836debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 18837linkers in which they give bogus error messages when linking some programs. 18838 18839@item -msoft-float 18840@opindex msoft-float 18841Generate output containing library calls for floating point. 18842@strong{Warning:} the requisite libraries are not available for all HPPA 18843targets. Normally the facilities of the machine's usual C compiler are 18844used, but this cannot be done directly in cross-compilation. You must make 18845your own arrangements to provide suitable library functions for 18846cross-compilation. 18847 18848@option{-msoft-float} changes the calling convention in the output file; 18849therefore, it is only useful if you compile @emph{all} of a program with 18850this option. In particular, you need to compile @file{libgcc.a}, the 18851library that comes with GCC, with @option{-msoft-float} in order for 18852this to work. 18853 18854@item -msio 18855@opindex msio 18856Generate the predefine, @code{_SIO}, for server IO@. The default is 18857@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 18858@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 18859options are available under HP-UX and HI-UX@. 18860 18861@item -mgnu-ld 18862@opindex mgnu-ld 18863Use options specific to GNU @command{ld}. 18864This passes @option{-shared} to @command{ld} when 18865building a shared library. It is the default when GCC is configured, 18866explicitly or implicitly, with the GNU linker. This option does not 18867affect which @command{ld} is called; it only changes what parameters 18868are passed to that @command{ld}. 18869The @command{ld} that is called is determined by the 18870@option{--with-ld} configure option, GCC's program search path, and 18871finally by the user's @env{PATH}. The linker used by GCC can be printed 18872using @samp{which `gcc -print-prog-name=ld`}. This option is only available 18873on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 18874 18875@item -mhp-ld 18876@opindex mhp-ld 18877Use options specific to HP @command{ld}. 18878This passes @option{-b} to @command{ld} when building 18879a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 18880links. It is the default when GCC is configured, explicitly or 18881implicitly, with the HP linker. This option does not affect 18882which @command{ld} is called; it only changes what parameters are passed to that 18883@command{ld}. 18884The @command{ld} that is called is determined by the @option{--with-ld} 18885configure option, GCC's program search path, and finally by the user's 18886@env{PATH}. The linker used by GCC can be printed using @samp{which 18887`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 18888HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 18889 18890@item -mlong-calls 18891@opindex mno-long-calls 18892Generate code that uses long call sequences. This ensures that a call 18893is always able to reach linker generated stubs. The default is to generate 18894long calls only when the distance from the call site to the beginning 18895of the function or translation unit, as the case may be, exceeds a 18896predefined limit set by the branch type being used. The limits for 18897normal calls are 7,600,000 and 240,000 bytes, respectively for the 18898PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 18899240,000 bytes. 18900 18901Distances are measured from the beginning of functions when using the 18902@option{-ffunction-sections} option, or when using the @option{-mgas} 18903and @option{-mno-portable-runtime} options together under HP-UX with 18904the SOM linker. 18905 18906It is normally not desirable to use this option as it degrades 18907performance. However, it may be useful in large applications, 18908particularly when partial linking is used to build the application. 18909 18910The types of long calls used depends on the capabilities of the 18911assembler and linker, and the type of code being generated. The 18912impact on systems that support long absolute calls, and long pic 18913symbol-difference or pc-relative calls should be relatively small. 18914However, an indirect call is used on 32-bit ELF systems in pic code 18915and it is quite long. 18916 18917@item -munix=@var{unix-std} 18918@opindex march 18919Generate compiler predefines and select a startfile for the specified 18920UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 18921and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 18922is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 1892311.11 and later. The default values are @samp{93} for HP-UX 10.00, 18924@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 18925and later. 18926 18927@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 18928@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 18929and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 18930@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 18931@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 18932@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 18933 18934It is @emph{important} to note that this option changes the interfaces 18935for various library routines. It also affects the operational behavior 18936of the C library. Thus, @emph{extreme} care is needed in using this 18937option. 18938 18939Library code that is intended to operate with more than one UNIX 18940standard must test, set and restore the variable @code{__xpg4_extended_mask} 18941as appropriate. Most GNU software doesn't provide this capability. 18942 18943@item -nolibdld 18944@opindex nolibdld 18945Suppress the generation of link options to search libdld.sl when the 18946@option{-static} option is specified on HP-UX 10 and later. 18947 18948@item -static 18949@opindex static 18950The HP-UX implementation of setlocale in libc has a dependency on 18951libdld.sl. There isn't an archive version of libdld.sl. Thus, 18952when the @option{-static} option is specified, special link options 18953are needed to resolve this dependency. 18954 18955On HP-UX 10 and later, the GCC driver adds the necessary options to 18956link with libdld.sl when the @option{-static} option is specified. 18957This causes the resulting binary to be dynamic. On the 64-bit port, 18958the linkers generate dynamic binaries by default in any case. The 18959@option{-nolibdld} option can be used to prevent the GCC driver from 18960adding these link options. 18961 18962@item -threads 18963@opindex threads 18964Add support for multithreading with the @dfn{dce thread} library 18965under HP-UX@. This option sets flags for both the preprocessor and 18966linker. 18967@end table 18968 18969@node IA-64 Options 18970@subsection IA-64 Options 18971@cindex IA-64 Options 18972 18973These are the @samp{-m} options defined for the Intel IA-64 architecture. 18974 18975@table @gcctabopt 18976@item -mbig-endian 18977@opindex mbig-endian 18978Generate code for a big-endian target. This is the default for HP-UX@. 18979 18980@item -mlittle-endian 18981@opindex mlittle-endian 18982Generate code for a little-endian target. This is the default for AIX5 18983and GNU/Linux. 18984 18985@item -mgnu-as 18986@itemx -mno-gnu-as 18987@opindex mgnu-as 18988@opindex mno-gnu-as 18989Generate (or don't) code for the GNU assembler. This is the default. 18990@c Also, this is the default if the configure option @option{--with-gnu-as} 18991@c is used. 18992 18993@item -mgnu-ld 18994@itemx -mno-gnu-ld 18995@opindex mgnu-ld 18996@opindex mno-gnu-ld 18997Generate (or don't) code for the GNU linker. This is the default. 18998@c Also, this is the default if the configure option @option{--with-gnu-ld} 18999@c is used. 19000 19001@item -mno-pic 19002@opindex mno-pic 19003Generate code that does not use a global pointer register. The result 19004is not position independent code, and violates the IA-64 ABI@. 19005 19006@item -mvolatile-asm-stop 19007@itemx -mno-volatile-asm-stop 19008@opindex mvolatile-asm-stop 19009@opindex mno-volatile-asm-stop 19010Generate (or don't) a stop bit immediately before and after volatile asm 19011statements. 19012 19013@item -mregister-names 19014@itemx -mno-register-names 19015@opindex mregister-names 19016@opindex mno-register-names 19017Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 19018the stacked registers. This may make assembler output more readable. 19019 19020@item -mno-sdata 19021@itemx -msdata 19022@opindex mno-sdata 19023@opindex msdata 19024Disable (or enable) optimizations that use the small data section. This may 19025be useful for working around optimizer bugs. 19026 19027@item -mconstant-gp 19028@opindex mconstant-gp 19029Generate code that uses a single constant global pointer value. This is 19030useful when compiling kernel code. 19031 19032@item -mauto-pic 19033@opindex mauto-pic 19034Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 19035This is useful when compiling firmware code. 19036 19037@item -minline-float-divide-min-latency 19038@opindex minline-float-divide-min-latency 19039Generate code for inline divides of floating-point values 19040using the minimum latency algorithm. 19041 19042@item -minline-float-divide-max-throughput 19043@opindex minline-float-divide-max-throughput 19044Generate code for inline divides of floating-point values 19045using the maximum throughput algorithm. 19046 19047@item -mno-inline-float-divide 19048@opindex mno-inline-float-divide 19049Do not generate inline code for divides of floating-point values. 19050 19051@item -minline-int-divide-min-latency 19052@opindex minline-int-divide-min-latency 19053Generate code for inline divides of integer values 19054using the minimum latency algorithm. 19055 19056@item -minline-int-divide-max-throughput 19057@opindex minline-int-divide-max-throughput 19058Generate code for inline divides of integer values 19059using the maximum throughput algorithm. 19060 19061@item -mno-inline-int-divide 19062@opindex mno-inline-int-divide 19063Do not generate inline code for divides of integer values. 19064 19065@item -minline-sqrt-min-latency 19066@opindex minline-sqrt-min-latency 19067Generate code for inline square roots 19068using the minimum latency algorithm. 19069 19070@item -minline-sqrt-max-throughput 19071@opindex minline-sqrt-max-throughput 19072Generate code for inline square roots 19073using the maximum throughput algorithm. 19074 19075@item -mno-inline-sqrt 19076@opindex mno-inline-sqrt 19077Do not generate inline code for @code{sqrt}. 19078 19079@item -mfused-madd 19080@itemx -mno-fused-madd 19081@opindex mfused-madd 19082@opindex mno-fused-madd 19083Do (don't) generate code that uses the fused multiply/add or multiply/subtract 19084instructions. The default is to use these instructions. 19085 19086@item -mno-dwarf2-asm 19087@itemx -mdwarf2-asm 19088@opindex mno-dwarf2-asm 19089@opindex mdwarf2-asm 19090Don't (or do) generate assembler code for the DWARF line number debugging 19091info. This may be useful when not using the GNU assembler. 19092 19093@item -mearly-stop-bits 19094@itemx -mno-early-stop-bits 19095@opindex mearly-stop-bits 19096@opindex mno-early-stop-bits 19097Allow stop bits to be placed earlier than immediately preceding the 19098instruction that triggered the stop bit. This can improve instruction 19099scheduling, but does not always do so. 19100 19101@item -mfixed-range=@var{register-range} 19102@opindex mfixed-range 19103Generate code treating the given register range as fixed registers. 19104A fixed register is one that the register allocator cannot use. This is 19105useful when compiling kernel code. A register range is specified as 19106two registers separated by a dash. Multiple register ranges can be 19107specified separated by a comma. 19108 19109@item -mtls-size=@var{tls-size} 19110@opindex mtls-size 19111Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 1911264. 19113 19114@item -mtune=@var{cpu-type} 19115@opindex mtune 19116Tune the instruction scheduling for a particular CPU, Valid values are 19117@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 19118and @samp{mckinley}. 19119 19120@item -milp32 19121@itemx -mlp64 19122@opindex milp32 19123@opindex mlp64 19124Generate code for a 32-bit or 64-bit environment. 19125The 32-bit environment sets int, long and pointer to 32 bits. 19126The 64-bit environment sets int to 32 bits and long and pointer 19127to 64 bits. These are HP-UX specific flags. 19128 19129@item -mno-sched-br-data-spec 19130@itemx -msched-br-data-spec 19131@opindex mno-sched-br-data-spec 19132@opindex msched-br-data-spec 19133(Dis/En)able data speculative scheduling before reload. 19134This results in generation of @code{ld.a} instructions and 19135the corresponding check instructions (@code{ld.c} / @code{chk.a}). 19136The default setting is disabled. 19137 19138@item -msched-ar-data-spec 19139@itemx -mno-sched-ar-data-spec 19140@opindex msched-ar-data-spec 19141@opindex mno-sched-ar-data-spec 19142(En/Dis)able data speculative scheduling after reload. 19143This results in generation of @code{ld.a} instructions and 19144the corresponding check instructions (@code{ld.c} / @code{chk.a}). 19145The default setting is enabled. 19146 19147@item -mno-sched-control-spec 19148@itemx -msched-control-spec 19149@opindex mno-sched-control-spec 19150@opindex msched-control-spec 19151(Dis/En)able control speculative scheduling. This feature is 19152available only during region scheduling (i.e.@: before reload). 19153This results in generation of the @code{ld.s} instructions and 19154the corresponding check instructions @code{chk.s}. 19155The default setting is disabled. 19156 19157@item -msched-br-in-data-spec 19158@itemx -mno-sched-br-in-data-spec 19159@opindex msched-br-in-data-spec 19160@opindex mno-sched-br-in-data-spec 19161(En/Dis)able speculative scheduling of the instructions that 19162are dependent on the data speculative loads before reload. 19163This is effective only with @option{-msched-br-data-spec} enabled. 19164The default setting is enabled. 19165 19166@item -msched-ar-in-data-spec 19167@itemx -mno-sched-ar-in-data-spec 19168@opindex msched-ar-in-data-spec 19169@opindex mno-sched-ar-in-data-spec 19170(En/Dis)able speculative scheduling of the instructions that 19171are dependent on the data speculative loads after reload. 19172This is effective only with @option{-msched-ar-data-spec} enabled. 19173The default setting is enabled. 19174 19175@item -msched-in-control-spec 19176@itemx -mno-sched-in-control-spec 19177@opindex msched-in-control-spec 19178@opindex mno-sched-in-control-spec 19179(En/Dis)able speculative scheduling of the instructions that 19180are dependent on the control speculative loads. 19181This is effective only with @option{-msched-control-spec} enabled. 19182The default setting is enabled. 19183 19184@item -mno-sched-prefer-non-data-spec-insns 19185@itemx -msched-prefer-non-data-spec-insns 19186@opindex mno-sched-prefer-non-data-spec-insns 19187@opindex msched-prefer-non-data-spec-insns 19188If enabled, data-speculative instructions are chosen for schedule 19189only if there are no other choices at the moment. This makes 19190the use of the data speculation much more conservative. 19191The default setting is disabled. 19192 19193@item -mno-sched-prefer-non-control-spec-insns 19194@itemx -msched-prefer-non-control-spec-insns 19195@opindex mno-sched-prefer-non-control-spec-insns 19196@opindex msched-prefer-non-control-spec-insns 19197If enabled, control-speculative instructions are chosen for schedule 19198only if there are no other choices at the moment. This makes 19199the use of the control speculation much more conservative. 19200The default setting is disabled. 19201 19202@item -mno-sched-count-spec-in-critical-path 19203@itemx -msched-count-spec-in-critical-path 19204@opindex mno-sched-count-spec-in-critical-path 19205@opindex msched-count-spec-in-critical-path 19206If enabled, speculative dependencies are considered during 19207computation of the instructions priorities. This makes the use of the 19208speculation a bit more conservative. 19209The default setting is disabled. 19210 19211@item -msched-spec-ldc 19212@opindex msched-spec-ldc 19213Use a simple data speculation check. This option is on by default. 19214 19215@item -msched-control-spec-ldc 19216@opindex msched-spec-ldc 19217Use a simple check for control speculation. This option is on by default. 19218 19219@item -msched-stop-bits-after-every-cycle 19220@opindex msched-stop-bits-after-every-cycle 19221Place a stop bit after every cycle when scheduling. This option is on 19222by default. 19223 19224@item -msched-fp-mem-deps-zero-cost 19225@opindex msched-fp-mem-deps-zero-cost 19226Assume that floating-point stores and loads are not likely to cause a conflict 19227when placed into the same instruction group. This option is disabled by 19228default. 19229 19230@item -msel-sched-dont-check-control-spec 19231@opindex msel-sched-dont-check-control-spec 19232Generate checks for control speculation in selective scheduling. 19233This flag is disabled by default. 19234 19235@item -msched-max-memory-insns=@var{max-insns} 19236@opindex msched-max-memory-insns 19237Limit on the number of memory insns per instruction group, giving lower 19238priority to subsequent memory insns attempting to schedule in the same 19239instruction group. Frequently useful to prevent cache bank conflicts. 19240The default value is 1. 19241 19242@item -msched-max-memory-insns-hard-limit 19243@opindex msched-max-memory-insns-hard-limit 19244Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 19245disallowing more than that number in an instruction group. 19246Otherwise, the limit is ``soft'', meaning that non-memory operations 19247are preferred when the limit is reached, but memory operations may still 19248be scheduled. 19249 19250@end table 19251 19252@node LM32 Options 19253@subsection LM32 Options 19254@cindex LM32 options 19255 19256These @option{-m} options are defined for the LatticeMico32 architecture: 19257 19258@table @gcctabopt 19259@item -mbarrel-shift-enabled 19260@opindex mbarrel-shift-enabled 19261Enable barrel-shift instructions. 19262 19263@item -mdivide-enabled 19264@opindex mdivide-enabled 19265Enable divide and modulus instructions. 19266 19267@item -mmultiply-enabled 19268@opindex multiply-enabled 19269Enable multiply instructions. 19270 19271@item -msign-extend-enabled 19272@opindex msign-extend-enabled 19273Enable sign extend instructions. 19274 19275@item -muser-enabled 19276@opindex muser-enabled 19277Enable user-defined instructions. 19278 19279@end table 19280 19281@node M32C Options 19282@subsection M32C Options 19283@cindex M32C options 19284 19285@table @gcctabopt 19286@item -mcpu=@var{name} 19287@opindex mcpu= 19288Select the CPU for which code is generated. @var{name} may be one of 19289@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 19290/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 19291the M32C/80 series. 19292 19293@item -msim 19294@opindex msim 19295Specifies that the program will be run on the simulator. This causes 19296an alternate runtime library to be linked in which supports, for 19297example, file I/O@. You must not use this option when generating 19298programs that will run on real hardware; you must provide your own 19299runtime library for whatever I/O functions are needed. 19300 19301@item -memregs=@var{number} 19302@opindex memregs= 19303Specifies the number of memory-based pseudo-registers GCC uses 19304during code generation. These pseudo-registers are used like real 19305registers, so there is a tradeoff between GCC's ability to fit the 19306code into available registers, and the performance penalty of using 19307memory instead of registers. Note that all modules in a program must 19308be compiled with the same value for this option. Because of that, you 19309must not use this option with GCC's default runtime libraries. 19310 19311@end table 19312 19313@node M32R/D Options 19314@subsection M32R/D Options 19315@cindex M32R/D options 19316 19317These @option{-m} options are defined for Renesas M32R/D architectures: 19318 19319@table @gcctabopt 19320@item -m32r2 19321@opindex m32r2 19322Generate code for the M32R/2@. 19323 19324@item -m32rx 19325@opindex m32rx 19326Generate code for the M32R/X@. 19327 19328@item -m32r 19329@opindex m32r 19330Generate code for the M32R@. This is the default. 19331 19332@item -mmodel=small 19333@opindex mmodel=small 19334Assume all objects live in the lower 16MB of memory (so that their addresses 19335can be loaded with the @code{ld24} instruction), and assume all subroutines 19336are reachable with the @code{bl} instruction. 19337This is the default. 19338 19339The addressability of a particular object can be set with the 19340@code{model} attribute. 19341 19342@item -mmodel=medium 19343@opindex mmodel=medium 19344Assume objects may be anywhere in the 32-bit address space (the compiler 19345generates @code{seth/add3} instructions to load their addresses), and 19346assume all subroutines are reachable with the @code{bl} instruction. 19347 19348@item -mmodel=large 19349@opindex mmodel=large 19350Assume objects may be anywhere in the 32-bit address space (the compiler 19351generates @code{seth/add3} instructions to load their addresses), and 19352assume subroutines may not be reachable with the @code{bl} instruction 19353(the compiler generates the much slower @code{seth/add3/jl} 19354instruction sequence). 19355 19356@item -msdata=none 19357@opindex msdata=none 19358Disable use of the small data area. Variables are put into 19359one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 19360@code{section} attribute has been specified). 19361This is the default. 19362 19363The small data area consists of sections @code{.sdata} and @code{.sbss}. 19364Objects may be explicitly put in the small data area with the 19365@code{section} attribute using one of these sections. 19366 19367@item -msdata=sdata 19368@opindex msdata=sdata 19369Put small global and static data in the small data area, but do not 19370generate special code to reference them. 19371 19372@item -msdata=use 19373@opindex msdata=use 19374Put small global and static data in the small data area, and generate 19375special instructions to reference them. 19376 19377@item -G @var{num} 19378@opindex G 19379@cindex smaller data references 19380Put global and static objects less than or equal to @var{num} bytes 19381into the small data or BSS sections instead of the normal data or BSS 19382sections. The default value of @var{num} is 8. 19383The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 19384for this option to have any effect. 19385 19386All modules should be compiled with the same @option{-G @var{num}} value. 19387Compiling with different values of @var{num} may or may not work; if it 19388doesn't the linker gives an error message---incorrect code is not 19389generated. 19390 19391@item -mdebug 19392@opindex mdebug 19393Makes the M32R-specific code in the compiler display some statistics 19394that might help in debugging programs. 19395 19396@item -malign-loops 19397@opindex malign-loops 19398Align all loops to a 32-byte boundary. 19399 19400@item -mno-align-loops 19401@opindex mno-align-loops 19402Do not enforce a 32-byte alignment for loops. This is the default. 19403 19404@item -missue-rate=@var{number} 19405@opindex missue-rate=@var{number} 19406Issue @var{number} instructions per cycle. @var{number} can only be 1 19407or 2. 19408 19409@item -mbranch-cost=@var{number} 19410@opindex mbranch-cost=@var{number} 19411@var{number} can only be 1 or 2. If it is 1 then branches are 19412preferred over conditional code, if it is 2, then the opposite applies. 19413 19414@item -mflush-trap=@var{number} 19415@opindex mflush-trap=@var{number} 19416Specifies the trap number to use to flush the cache. The default is 1941712. Valid numbers are between 0 and 15 inclusive. 19418 19419@item -mno-flush-trap 19420@opindex mno-flush-trap 19421Specifies that the cache cannot be flushed by using a trap. 19422 19423@item -mflush-func=@var{name} 19424@opindex mflush-func=@var{name} 19425Specifies the name of the operating system function to call to flush 19426the cache. The default is @samp{_flush_cache}, but a function call 19427is only used if a trap is not available. 19428 19429@item -mno-flush-func 19430@opindex mno-flush-func 19431Indicates that there is no OS function for flushing the cache. 19432 19433@end table 19434 19435@node M680x0 Options 19436@subsection M680x0 Options 19437@cindex M680x0 options 19438 19439These are the @samp{-m} options defined for M680x0 and ColdFire processors. 19440The default settings depend on which architecture was selected when 19441the compiler was configured; the defaults for the most common choices 19442are given below. 19443 19444@table @gcctabopt 19445@item -march=@var{arch} 19446@opindex march 19447Generate code for a specific M680x0 or ColdFire instruction set 19448architecture. Permissible values of @var{arch} for M680x0 19449architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 19450@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 19451architectures are selected according to Freescale's ISA classification 19452and the permissible values are: @samp{isaa}, @samp{isaaplus}, 19453@samp{isab} and @samp{isac}. 19454 19455GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 19456code for a ColdFire target. The @var{arch} in this macro is one of the 19457@option{-march} arguments given above. 19458 19459When used together, @option{-march} and @option{-mtune} select code 19460that runs on a family of similar processors but that is optimized 19461for a particular microarchitecture. 19462 19463@item -mcpu=@var{cpu} 19464@opindex mcpu 19465Generate code for a specific M680x0 or ColdFire processor. 19466The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 19467@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 19468and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 19469below, which also classifies the CPUs into families: 19470 19471@multitable @columnfractions 0.20 0.80 19472@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 19473@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} 19474@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 19475@item @samp{5206e} @tab @samp{5206e} 19476@item @samp{5208} @tab @samp{5207} @samp{5208} 19477@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 19478@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 19479@item @samp{5216} @tab @samp{5214} @samp{5216} 19480@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 19481@item @samp{5225} @tab @samp{5224} @samp{5225} 19482@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 19483@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 19484@item @samp{5249} @tab @samp{5249} 19485@item @samp{5250} @tab @samp{5250} 19486@item @samp{5271} @tab @samp{5270} @samp{5271} 19487@item @samp{5272} @tab @samp{5272} 19488@item @samp{5275} @tab @samp{5274} @samp{5275} 19489@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 19490@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 19491@item @samp{5307} @tab @samp{5307} 19492@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 19493@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 19494@item @samp{5407} @tab @samp{5407} 19495@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} 19496@end multitable 19497 19498@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 19499@var{arch} is compatible with @var{cpu}. Other combinations of 19500@option{-mcpu} and @option{-march} are rejected. 19501 19502GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 19503@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 19504where the value of @var{family} is given by the table above. 19505 19506@item -mtune=@var{tune} 19507@opindex mtune 19508Tune the code for a particular microarchitecture within the 19509constraints set by @option{-march} and @option{-mcpu}. 19510The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 19511@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 19512and @samp{cpu32}. The ColdFire microarchitectures 19513are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 19514 19515You can also use @option{-mtune=68020-40} for code that needs 19516to run relatively well on 68020, 68030 and 68040 targets. 19517@option{-mtune=68020-60} is similar but includes 68060 targets 19518as well. These two options select the same tuning decisions as 19519@option{-m68020-40} and @option{-m68020-60} respectively. 19520 19521GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 19522when tuning for 680x0 architecture @var{arch}. It also defines 19523@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 19524option is used. If GCC is tuning for a range of architectures, 19525as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 19526it defines the macros for every architecture in the range. 19527 19528GCC also defines the macro @code{__m@var{uarch}__} when tuning for 19529ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 19530of the arguments given above. 19531 19532@item -m68000 19533@itemx -mc68000 19534@opindex m68000 19535@opindex mc68000 19536Generate output for a 68000. This is the default 19537when the compiler is configured for 68000-based systems. 19538It is equivalent to @option{-march=68000}. 19539 19540Use this option for microcontrollers with a 68000 or EC000 core, 19541including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 19542 19543@item -m68010 19544@opindex m68010 19545Generate output for a 68010. This is the default 19546when the compiler is configured for 68010-based systems. 19547It is equivalent to @option{-march=68010}. 19548 19549@item -m68020 19550@itemx -mc68020 19551@opindex m68020 19552@opindex mc68020 19553Generate output for a 68020. This is the default 19554when the compiler is configured for 68020-based systems. 19555It is equivalent to @option{-march=68020}. 19556 19557@item -m68030 19558@opindex m68030 19559Generate output for a 68030. This is the default when the compiler is 19560configured for 68030-based systems. It is equivalent to 19561@option{-march=68030}. 19562 19563@item -m68040 19564@opindex m68040 19565Generate output for a 68040. This is the default when the compiler is 19566configured for 68040-based systems. It is equivalent to 19567@option{-march=68040}. 19568 19569This option inhibits the use of 68881/68882 instructions that have to be 19570emulated by software on the 68040. Use this option if your 68040 does not 19571have code to emulate those instructions. 19572 19573@item -m68060 19574@opindex m68060 19575Generate output for a 68060. This is the default when the compiler is 19576configured for 68060-based systems. It is equivalent to 19577@option{-march=68060}. 19578 19579This option inhibits the use of 68020 and 68881/68882 instructions that 19580have to be emulated by software on the 68060. Use this option if your 68060 19581does not have code to emulate those instructions. 19582 19583@item -mcpu32 19584@opindex mcpu32 19585Generate output for a CPU32. This is the default 19586when the compiler is configured for CPU32-based systems. 19587It is equivalent to @option{-march=cpu32}. 19588 19589Use this option for microcontrollers with a 19590CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1959168336, 68340, 68341, 68349 and 68360. 19592 19593@item -m5200 19594@opindex m5200 19595Generate output for a 520X ColdFire CPU@. This is the default 19596when the compiler is configured for 520X-based systems. 19597It is equivalent to @option{-mcpu=5206}, and is now deprecated 19598in favor of that option. 19599 19600Use this option for microcontroller with a 5200 core, including 19601the MCF5202, MCF5203, MCF5204 and MCF5206. 19602 19603@item -m5206e 19604@opindex m5206e 19605Generate output for a 5206e ColdFire CPU@. The option is now 19606deprecated in favor of the equivalent @option{-mcpu=5206e}. 19607 19608@item -m528x 19609@opindex m528x 19610Generate output for a member of the ColdFire 528X family. 19611The option is now deprecated in favor of the equivalent 19612@option{-mcpu=528x}. 19613 19614@item -m5307 19615@opindex m5307 19616Generate output for a ColdFire 5307 CPU@. The option is now deprecated 19617in favor of the equivalent @option{-mcpu=5307}. 19618 19619@item -m5407 19620@opindex m5407 19621Generate output for a ColdFire 5407 CPU@. The option is now deprecated 19622in favor of the equivalent @option{-mcpu=5407}. 19623 19624@item -mcfv4e 19625@opindex mcfv4e 19626Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 19627This includes use of hardware floating-point instructions. 19628The option is equivalent to @option{-mcpu=547x}, and is now 19629deprecated in favor of that option. 19630 19631@item -m68020-40 19632@opindex m68020-40 19633Generate output for a 68040, without using any of the new instructions. 19634This results in code that can run relatively efficiently on either a 1963568020/68881 or a 68030 or a 68040. The generated code does use the 1963668881 instructions that are emulated on the 68040. 19637 19638The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 19639 19640@item -m68020-60 19641@opindex m68020-60 19642Generate output for a 68060, without using any of the new instructions. 19643This results in code that can run relatively efficiently on either a 1964468020/68881 or a 68030 or a 68040. The generated code does use the 1964568881 instructions that are emulated on the 68060. 19646 19647The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 19648 19649@item -mhard-float 19650@itemx -m68881 19651@opindex mhard-float 19652@opindex m68881 19653Generate floating-point instructions. This is the default for 68020 19654and above, and for ColdFire devices that have an FPU@. It defines the 19655macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 19656on ColdFire targets. 19657 19658@item -msoft-float 19659@opindex msoft-float 19660Do not generate floating-point instructions; use library calls instead. 19661This is the default for 68000, 68010, and 68832 targets. It is also 19662the default for ColdFire devices that have no FPU. 19663 19664@item -mdiv 19665@itemx -mno-div 19666@opindex mdiv 19667@opindex mno-div 19668Generate (do not generate) ColdFire hardware divide and remainder 19669instructions. If @option{-march} is used without @option{-mcpu}, 19670the default is ``on'' for ColdFire architectures and ``off'' for M680x0 19671architectures. Otherwise, the default is taken from the target CPU 19672(either the default CPU, or the one specified by @option{-mcpu}). For 19673example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 19674@option{-mcpu=5206e}. 19675 19676GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 19677 19678@item -mshort 19679@opindex mshort 19680Consider type @code{int} to be 16 bits wide, like @code{short int}. 19681Additionally, parameters passed on the stack are also aligned to a 1968216-bit boundary even on targets whose API mandates promotion to 32-bit. 19683 19684@item -mno-short 19685@opindex mno-short 19686Do not consider type @code{int} to be 16 bits wide. This is the default. 19687 19688@item -mnobitfield 19689@itemx -mno-bitfield 19690@opindex mnobitfield 19691@opindex mno-bitfield 19692Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 19693and @option{-m5200} options imply @w{@option{-mnobitfield}}. 19694 19695@item -mbitfield 19696@opindex mbitfield 19697Do use the bit-field instructions. The @option{-m68020} option implies 19698@option{-mbitfield}. This is the default if you use a configuration 19699designed for a 68020. 19700 19701@item -mrtd 19702@opindex mrtd 19703Use a different function-calling convention, in which functions 19704that take a fixed number of arguments return with the @code{rtd} 19705instruction, which pops their arguments while returning. This 19706saves one instruction in the caller since there is no need to pop 19707the arguments there. 19708 19709This calling convention is incompatible with the one normally 19710used on Unix, so you cannot use it if you need to call libraries 19711compiled with the Unix compiler. 19712 19713Also, you must provide function prototypes for all functions that 19714take variable numbers of arguments (including @code{printf}); 19715otherwise incorrect code is generated for calls to those 19716functions. 19717 19718In addition, seriously incorrect code results if you call a 19719function with too many arguments. (Normally, extra arguments are 19720harmlessly ignored.) 19721 19722The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1972368040, 68060 and CPU32 processors, but not by the 68000 or 5200. 19724 19725@item -mno-rtd 19726@opindex mno-rtd 19727Do not use the calling conventions selected by @option{-mrtd}. 19728This is the default. 19729 19730@item -malign-int 19731@itemx -mno-align-int 19732@opindex malign-int 19733@opindex mno-align-int 19734Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 19735@code{float}, @code{double}, and @code{long double} variables on a 32-bit 19736boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 19737Aligning variables on 32-bit boundaries produces code that runs somewhat 19738faster on processors with 32-bit busses at the expense of more memory. 19739 19740@strong{Warning:} if you use the @option{-malign-int} switch, GCC 19741aligns structures containing the above types differently than 19742most published application binary interface specifications for the m68k. 19743 19744@item -mpcrel 19745@opindex mpcrel 19746Use the pc-relative addressing mode of the 68000 directly, instead of 19747using a global offset table. At present, this option implies @option{-fpic}, 19748allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 19749not presently supported with @option{-mpcrel}, though this could be supported for 1975068020 and higher processors. 19751 19752@item -mno-strict-align 19753@itemx -mstrict-align 19754@opindex mno-strict-align 19755@opindex mstrict-align 19756Do not (do) assume that unaligned memory references are handled by 19757the system. 19758 19759@item -msep-data 19760Generate code that allows the data segment to be located in a different 19761area of memory from the text segment. This allows for execute-in-place in 19762an environment without virtual memory management. This option implies 19763@option{-fPIC}. 19764 19765@item -mno-sep-data 19766Generate code that assumes that the data segment follows the text segment. 19767This is the default. 19768 19769@item -mid-shared-library 19770Generate code that supports shared libraries via the library ID method. 19771This allows for execute-in-place and shared libraries in an environment 19772without virtual memory management. This option implies @option{-fPIC}. 19773 19774@item -mno-id-shared-library 19775Generate code that doesn't assume ID-based shared libraries are being used. 19776This is the default. 19777 19778@item -mshared-library-id=n 19779Specifies the identification number of the ID-based shared library being 19780compiled. Specifying a value of 0 generates more compact code; specifying 19781other values forces the allocation of that number to the current 19782library, but is no more space- or time-efficient than omitting this option. 19783 19784@item -mxgot 19785@itemx -mno-xgot 19786@opindex mxgot 19787@opindex mno-xgot 19788When generating position-independent code for ColdFire, generate code 19789that works if the GOT has more than 8192 entries. This code is 19790larger and slower than code generated without this option. On M680x0 19791processors, this option is not needed; @option{-fPIC} suffices. 19792 19793GCC normally uses a single instruction to load values from the GOT@. 19794While this is relatively efficient, it only works if the GOT 19795is smaller than about 64k. Anything larger causes the linker 19796to report an error such as: 19797 19798@cindex relocation truncated to fit (ColdFire) 19799@smallexample 19800relocation truncated to fit: R_68K_GOT16O foobar 19801@end smallexample 19802 19803If this happens, you should recompile your code with @option{-mxgot}. 19804It should then work with very large GOTs. However, code generated with 19805@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 19806the value of a global symbol. 19807 19808Note that some linkers, including newer versions of the GNU linker, 19809can create multiple GOTs and sort GOT entries. If you have such a linker, 19810you should only need to use @option{-mxgot} when compiling a single 19811object file that accesses more than 8192 GOT entries. Very few do. 19812 19813These options have no effect unless GCC is generating 19814position-independent code. 19815 19816@item -mlong-jump-table-offsets 19817@opindex mlong-jump-table-offsets 19818Use 32-bit offsets in @code{switch} tables. The default is to use 1981916-bit offsets. 19820 19821@end table 19822 19823@node MCore Options 19824@subsection MCore Options 19825@cindex MCore options 19826 19827These are the @samp{-m} options defined for the Motorola M*Core 19828processors. 19829 19830@table @gcctabopt 19831 19832@item -mhardlit 19833@itemx -mno-hardlit 19834@opindex mhardlit 19835@opindex mno-hardlit 19836Inline constants into the code stream if it can be done in two 19837instructions or less. 19838 19839@item -mdiv 19840@itemx -mno-div 19841@opindex mdiv 19842@opindex mno-div 19843Use the divide instruction. (Enabled by default). 19844 19845@item -mrelax-immediate 19846@itemx -mno-relax-immediate 19847@opindex mrelax-immediate 19848@opindex mno-relax-immediate 19849Allow arbitrary-sized immediates in bit operations. 19850 19851@item -mwide-bitfields 19852@itemx -mno-wide-bitfields 19853@opindex mwide-bitfields 19854@opindex mno-wide-bitfields 19855Always treat bit-fields as @code{int}-sized. 19856 19857@item -m4byte-functions 19858@itemx -mno-4byte-functions 19859@opindex m4byte-functions 19860@opindex mno-4byte-functions 19861Force all functions to be aligned to a 4-byte boundary. 19862 19863@item -mcallgraph-data 19864@itemx -mno-callgraph-data 19865@opindex mcallgraph-data 19866@opindex mno-callgraph-data 19867Emit callgraph information. 19868 19869@item -mslow-bytes 19870@itemx -mno-slow-bytes 19871@opindex mslow-bytes 19872@opindex mno-slow-bytes 19873Prefer word access when reading byte quantities. 19874 19875@item -mlittle-endian 19876@itemx -mbig-endian 19877@opindex mlittle-endian 19878@opindex mbig-endian 19879Generate code for a little-endian target. 19880 19881@item -m210 19882@itemx -m340 19883@opindex m210 19884@opindex m340 19885Generate code for the 210 processor. 19886 19887@item -mno-lsim 19888@opindex mno-lsim 19889Assume that runtime support has been provided and so omit the 19890simulator library (@file{libsim.a)} from the linker command line. 19891 19892@item -mstack-increment=@var{size} 19893@opindex mstack-increment 19894Set the maximum amount for a single stack increment operation. Large 19895values can increase the speed of programs that contain functions 19896that need a large amount of stack space, but they can also trigger a 19897segmentation fault if the stack is extended too much. The default 19898value is 0x1000. 19899 19900@end table 19901 19902@node MeP Options 19903@subsection MeP Options 19904@cindex MeP options 19905 19906@table @gcctabopt 19907 19908@item -mabsdiff 19909@opindex mabsdiff 19910Enables the @code{abs} instruction, which is the absolute difference 19911between two registers. 19912 19913@item -mall-opts 19914@opindex mall-opts 19915Enables all the optional instructions---average, multiply, divide, bit 19916operations, leading zero, absolute difference, min/max, clip, and 19917saturation. 19918 19919 19920@item -maverage 19921@opindex maverage 19922Enables the @code{ave} instruction, which computes the average of two 19923registers. 19924 19925@item -mbased=@var{n} 19926@opindex mbased= 19927Variables of size @var{n} bytes or smaller are placed in the 19928@code{.based} section by default. Based variables use the @code{$tp} 19929register as a base register, and there is a 128-byte limit to the 19930@code{.based} section. 19931 19932@item -mbitops 19933@opindex mbitops 19934Enables the bit operation instructions---bit test (@code{btstm}), set 19935(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 19936test-and-set (@code{tas}). 19937 19938@item -mc=@var{name} 19939@opindex mc= 19940Selects which section constant data is placed in. @var{name} may 19941be @samp{tiny}, @samp{near}, or @samp{far}. 19942 19943@item -mclip 19944@opindex mclip 19945Enables the @code{clip} instruction. Note that @option{-mclip} is not 19946useful unless you also provide @option{-mminmax}. 19947 19948@item -mconfig=@var{name} 19949@opindex mconfig= 19950Selects one of the built-in core configurations. Each MeP chip has 19951one or more modules in it; each module has a core CPU and a variety of 19952coprocessors, optional instructions, and peripherals. The 19953@code{MeP-Integrator} tool, not part of GCC, provides these 19954configurations through this option; using this option is the same as 19955using all the corresponding command-line options. The default 19956configuration is @samp{default}. 19957 19958@item -mcop 19959@opindex mcop 19960Enables the coprocessor instructions. By default, this is a 32-bit 19961coprocessor. Note that the coprocessor is normally enabled via the 19962@option{-mconfig=} option. 19963 19964@item -mcop32 19965@opindex mcop32 19966Enables the 32-bit coprocessor's instructions. 19967 19968@item -mcop64 19969@opindex mcop64 19970Enables the 64-bit coprocessor's instructions. 19971 19972@item -mivc2 19973@opindex mivc2 19974Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 19975 19976@item -mdc 19977@opindex mdc 19978Causes constant variables to be placed in the @code{.near} section. 19979 19980@item -mdiv 19981@opindex mdiv 19982Enables the @code{div} and @code{divu} instructions. 19983 19984@item -meb 19985@opindex meb 19986Generate big-endian code. 19987 19988@item -mel 19989@opindex mel 19990Generate little-endian code. 19991 19992@item -mio-volatile 19993@opindex mio-volatile 19994Tells the compiler that any variable marked with the @code{io} 19995attribute is to be considered volatile. 19996 19997@item -ml 19998@opindex ml 19999Causes variables to be assigned to the @code{.far} section by default. 20000 20001@item -mleadz 20002@opindex mleadz 20003Enables the @code{leadz} (leading zero) instruction. 20004 20005@item -mm 20006@opindex mm 20007Causes variables to be assigned to the @code{.near} section by default. 20008 20009@item -mminmax 20010@opindex mminmax 20011Enables the @code{min} and @code{max} instructions. 20012 20013@item -mmult 20014@opindex mmult 20015Enables the multiplication and multiply-accumulate instructions. 20016 20017@item -mno-opts 20018@opindex mno-opts 20019Disables all the optional instructions enabled by @option{-mall-opts}. 20020 20021@item -mrepeat 20022@opindex mrepeat 20023Enables the @code{repeat} and @code{erepeat} instructions, used for 20024low-overhead looping. 20025 20026@item -ms 20027@opindex ms 20028Causes all variables to default to the @code{.tiny} section. Note 20029that there is a 65536-byte limit to this section. Accesses to these 20030variables use the @code{%gp} base register. 20031 20032@item -msatur 20033@opindex msatur 20034Enables the saturation instructions. Note that the compiler does not 20035currently generate these itself, but this option is included for 20036compatibility with other tools, like @code{as}. 20037 20038@item -msdram 20039@opindex msdram 20040Link the SDRAM-based runtime instead of the default ROM-based runtime. 20041 20042@item -msim 20043@opindex msim 20044Link the simulator run-time libraries. 20045 20046@item -msimnovec 20047@opindex msimnovec 20048Link the simulator runtime libraries, excluding built-in support 20049for reset and exception vectors and tables. 20050 20051@item -mtf 20052@opindex mtf 20053Causes all functions to default to the @code{.far} section. Without 20054this option, functions default to the @code{.near} section. 20055 20056@item -mtiny=@var{n} 20057@opindex mtiny= 20058Variables that are @var{n} bytes or smaller are allocated to the 20059@code{.tiny} section. These variables use the @code{$gp} base 20060register. The default for this option is 4, but note that there's a 2006165536-byte limit to the @code{.tiny} section. 20062 20063@end table 20064 20065@node MicroBlaze Options 20066@subsection MicroBlaze Options 20067@cindex MicroBlaze Options 20068 20069@table @gcctabopt 20070 20071@item -msoft-float 20072@opindex msoft-float 20073Use software emulation for floating point (default). 20074 20075@item -mhard-float 20076@opindex mhard-float 20077Use hardware floating-point instructions. 20078 20079@item -mmemcpy 20080@opindex mmemcpy 20081Do not optimize block moves, use @code{memcpy}. 20082 20083@item -mno-clearbss 20084@opindex mno-clearbss 20085This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 20086 20087@item -mcpu=@var{cpu-type} 20088@opindex mcpu= 20089Use features of, and schedule code for, the given CPU. 20090Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 20091where @var{X} is a major version, @var{YY} is the minor version, and 20092@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 20093@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}. 20094 20095@item -mxl-soft-mul 20096@opindex mxl-soft-mul 20097Use software multiply emulation (default). 20098 20099@item -mxl-soft-div 20100@opindex mxl-soft-div 20101Use software emulation for divides (default). 20102 20103@item -mxl-barrel-shift 20104@opindex mxl-barrel-shift 20105Use the hardware barrel shifter. 20106 20107@item -mxl-pattern-compare 20108@opindex mxl-pattern-compare 20109Use pattern compare instructions. 20110 20111@item -msmall-divides 20112@opindex msmall-divides 20113Use table lookup optimization for small signed integer divisions. 20114 20115@item -mxl-stack-check 20116@opindex mxl-stack-check 20117This option is deprecated. Use @option{-fstack-check} instead. 20118 20119@item -mxl-gp-opt 20120@opindex mxl-gp-opt 20121Use GP-relative @code{.sdata}/@code{.sbss} sections. 20122 20123@item -mxl-multiply-high 20124@opindex mxl-multiply-high 20125Use multiply high instructions for high part of 32x32 multiply. 20126 20127@item -mxl-float-convert 20128@opindex mxl-float-convert 20129Use hardware floating-point conversion instructions. 20130 20131@item -mxl-float-sqrt 20132@opindex mxl-float-sqrt 20133Use hardware floating-point square root instruction. 20134 20135@item -mbig-endian 20136@opindex mbig-endian 20137Generate code for a big-endian target. 20138 20139@item -mlittle-endian 20140@opindex mlittle-endian 20141Generate code for a little-endian target. 20142 20143@item -mxl-reorder 20144@opindex mxl-reorder 20145Use reorder instructions (swap and byte reversed load/store). 20146 20147@item -mxl-mode-@var{app-model} 20148Select application model @var{app-model}. Valid models are 20149@table @samp 20150@item executable 20151normal executable (default), uses startup code @file{crt0.o}. 20152 20153@item xmdstub 20154for use with Xilinx Microprocessor Debugger (XMD) based 20155software intrusive debug agent called xmdstub. This uses startup file 20156@file{crt1.o} and sets the start address of the program to 0x800. 20157 20158@item bootstrap 20159for applications that are loaded using a bootloader. 20160This model uses startup file @file{crt2.o} which does not contain a processor 20161reset vector handler. This is suitable for transferring control on a 20162processor reset to the bootloader rather than the application. 20163 20164@item novectors 20165for applications that do not require any of the 20166MicroBlaze vectors. This option may be useful for applications running 20167within a monitoring application. This model uses @file{crt3.o} as a startup file. 20168@end table 20169 20170Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 20171@option{-mxl-mode-@var{app-model}}. 20172 20173@end table 20174 20175@node MIPS Options 20176@subsection MIPS Options 20177@cindex MIPS options 20178 20179@table @gcctabopt 20180 20181@item -EB 20182@opindex EB 20183Generate big-endian code. 20184 20185@item -EL 20186@opindex EL 20187Generate little-endian code. This is the default for @samp{mips*el-*-*} 20188configurations. 20189 20190@item -march=@var{arch} 20191@opindex march 20192Generate code that runs on @var{arch}, which can be the name of a 20193generic MIPS ISA, or the name of a particular processor. 20194The ISA names are: 20195@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 20196@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 20197@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 20198@samp{mips64r5} and @samp{mips64r6}. 20199The processor names are: 20200@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 20201@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 20202@samp{5kc}, @samp{5kf}, 20203@samp{20kc}, 20204@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 20205@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 20206@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 20207@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 20208@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 20209@samp{i6400}, 20210@samp{interaptiv}, 20211@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, 20212@samp{m4k}, 20213@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 20214@samp{m5100}, @samp{m5101}, 20215@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 20216@samp{orion}, 20217@samp{p5600}, 20218@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 20219@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000}, 20220@samp{rm7000}, @samp{rm9000}, 20221@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 20222@samp{sb1}, 20223@samp{sr71000}, 20224@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 20225@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 20226@samp{xlr} and @samp{xlp}. 20227The special value @samp{from-abi} selects the 20228most compatible architecture for the selected ABI (that is, 20229@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 20230 20231The native Linux/GNU toolchain also supports the value @samp{native}, 20232which selects the best architecture option for the host processor. 20233@option{-march=native} has no effect if GCC does not recognize 20234the processor. 20235 20236In processor names, a final @samp{000} can be abbreviated as @samp{k} 20237(for example, @option{-march=r2k}). Prefixes are optional, and 20238@samp{vr} may be written @samp{r}. 20239 20240Names of the form @samp{@var{n}f2_1} refer to processors with 20241FPUs clocked at half the rate of the core, names of the form 20242@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 20243rate as the core, and names of the form @samp{@var{n}f3_2} refer to 20244processors with FPUs clocked a ratio of 3:2 with respect to the core. 20245For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 20246for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 20247accepted as synonyms for @samp{@var{n}f1_1}. 20248 20249GCC defines two macros based on the value of this option. The first 20250is @code{_MIPS_ARCH}, which gives the name of target architecture, as 20251a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 20252where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 20253For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 20254to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 20255 20256Note that the @code{_MIPS_ARCH} macro uses the processor names given 20257above. In other words, it has the full prefix and does not 20258abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 20259the macro names the resolved architecture (either @code{"mips1"} or 20260@code{"mips3"}). It names the default architecture when no 20261@option{-march} option is given. 20262 20263@item -mtune=@var{arch} 20264@opindex mtune 20265Optimize for @var{arch}. Among other things, this option controls 20266the way instructions are scheduled, and the perceived cost of arithmetic 20267operations. The list of @var{arch} values is the same as for 20268@option{-march}. 20269 20270When this option is not used, GCC optimizes for the processor 20271specified by @option{-march}. By using @option{-march} and 20272@option{-mtune} together, it is possible to generate code that 20273runs on a family of processors, but optimize the code for one 20274particular member of that family. 20275 20276@option{-mtune} defines the macros @code{_MIPS_TUNE} and 20277@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 20278@option{-march} ones described above. 20279 20280@item -mips1 20281@opindex mips1 20282Equivalent to @option{-march=mips1}. 20283 20284@item -mips2 20285@opindex mips2 20286Equivalent to @option{-march=mips2}. 20287 20288@item -mips3 20289@opindex mips3 20290Equivalent to @option{-march=mips3}. 20291 20292@item -mips4 20293@opindex mips4 20294Equivalent to @option{-march=mips4}. 20295 20296@item -mips32 20297@opindex mips32 20298Equivalent to @option{-march=mips32}. 20299 20300@item -mips32r3 20301@opindex mips32r3 20302Equivalent to @option{-march=mips32r3}. 20303 20304@item -mips32r5 20305@opindex mips32r5 20306Equivalent to @option{-march=mips32r5}. 20307 20308@item -mips32r6 20309@opindex mips32r6 20310Equivalent to @option{-march=mips32r6}. 20311 20312@item -mips64 20313@opindex mips64 20314Equivalent to @option{-march=mips64}. 20315 20316@item -mips64r2 20317@opindex mips64r2 20318Equivalent to @option{-march=mips64r2}. 20319 20320@item -mips64r3 20321@opindex mips64r3 20322Equivalent to @option{-march=mips64r3}. 20323 20324@item -mips64r5 20325@opindex mips64r5 20326Equivalent to @option{-march=mips64r5}. 20327 20328@item -mips64r6 20329@opindex mips64r6 20330Equivalent to @option{-march=mips64r6}. 20331 20332@item -mips16 20333@itemx -mno-mips16 20334@opindex mips16 20335@opindex mno-mips16 20336Generate (do not generate) MIPS16 code. If GCC is targeting a 20337MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 20338 20339MIPS16 code generation can also be controlled on a per-function basis 20340by means of @code{mips16} and @code{nomips16} attributes. 20341@xref{Function Attributes}, for more information. 20342 20343@item -mflip-mips16 20344@opindex mflip-mips16 20345Generate MIPS16 code on alternating functions. This option is provided 20346for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 20347not intended for ordinary use in compiling user code. 20348 20349@item -minterlink-compressed 20350@itemx -mno-interlink-compressed 20351@opindex minterlink-compressed 20352@opindex mno-interlink-compressed 20353Require (do not require) that code using the standard (uncompressed) MIPS ISA 20354be link-compatible with MIPS16 and microMIPS code, and vice versa. 20355 20356For example, code using the standard ISA encoding cannot jump directly 20357to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 20358@option{-minterlink-compressed} therefore disables direct jumps unless GCC 20359knows that the target of the jump is not compressed. 20360 20361@item -minterlink-mips16 20362@itemx -mno-interlink-mips16 20363@opindex minterlink-mips16 20364@opindex mno-interlink-mips16 20365Aliases of @option{-minterlink-compressed} and 20366@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 20367and are retained for backwards compatibility. 20368 20369@item -mabi=32 20370@itemx -mabi=o64 20371@itemx -mabi=n32 20372@itemx -mabi=64 20373@itemx -mabi=eabi 20374@opindex mabi=32 20375@opindex mabi=o64 20376@opindex mabi=n32 20377@opindex mabi=64 20378@opindex mabi=eabi 20379Generate code for the given ABI@. 20380 20381Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 20382generates 64-bit code when you select a 64-bit architecture, but you 20383can use @option{-mgp32} to get 32-bit code instead. 20384 20385For information about the O64 ABI, see 20386@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 20387 20388GCC supports a variant of the o32 ABI in which floating-point registers 20389are 64 rather than 32 bits wide. You can select this combination with 20390@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 20391and @code{mfhc1} instructions and is therefore only supported for 20392MIPS32R2, MIPS32R3 and MIPS32R5 processors. 20393 20394The register assignments for arguments and return values remain the 20395same, but each scalar value is passed in a single 64-bit register 20396rather than a pair of 32-bit registers. For example, scalar 20397floating-point values are returned in @samp{$f0} only, not a 20398@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 20399remains the same in that the even-numbered double-precision registers 20400are saved. 20401 20402Two additional variants of the o32 ABI are supported to enable 20403a transition from 32-bit to 64-bit registers. These are FPXX 20404(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 20405The FPXX extension mandates that all code must execute correctly 20406when run using 32-bit or 64-bit registers. The code can be interlinked 20407with either FP32 or FP64, but not both. 20408The FP64A extension is similar to the FP64 extension but forbids the 20409use of odd-numbered single-precision registers. This can be used 20410in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 20411processors and allows both FP32 and FP64A code to interlink and 20412run in the same process without changing FPU modes. 20413 20414@item -mabicalls 20415@itemx -mno-abicalls 20416@opindex mabicalls 20417@opindex mno-abicalls 20418Generate (do not generate) code that is suitable for SVR4-style 20419dynamic objects. @option{-mabicalls} is the default for SVR4-based 20420systems. 20421 20422@item -mshared 20423@itemx -mno-shared 20424Generate (do not generate) code that is fully position-independent, 20425and that can therefore be linked into shared libraries. This option 20426only affects @option{-mabicalls}. 20427 20428All @option{-mabicalls} code has traditionally been position-independent, 20429regardless of options like @option{-fPIC} and @option{-fpic}. However, 20430as an extension, the GNU toolchain allows executables to use absolute 20431accesses for locally-binding symbols. It can also use shorter GP 20432initialization sequences and generate direct calls to locally-defined 20433functions. This mode is selected by @option{-mno-shared}. 20434 20435@option{-mno-shared} depends on binutils 2.16 or higher and generates 20436objects that can only be linked by the GNU linker. However, the option 20437does not affect the ABI of the final executable; it only affects the ABI 20438of relocatable objects. Using @option{-mno-shared} generally makes 20439executables both smaller and quicker. 20440 20441@option{-mshared} is the default. 20442 20443@item -mplt 20444@itemx -mno-plt 20445@opindex mplt 20446@opindex mno-plt 20447Assume (do not assume) that the static and dynamic linkers 20448support PLTs and copy relocations. This option only affects 20449@option{-mno-shared -mabicalls}. For the n64 ABI, this option 20450has no effect without @option{-msym32}. 20451 20452You can make @option{-mplt} the default by configuring 20453GCC with @option{--with-mips-plt}. The default is 20454@option{-mno-plt} otherwise. 20455 20456@item -mxgot 20457@itemx -mno-xgot 20458@opindex mxgot 20459@opindex mno-xgot 20460Lift (do not lift) the usual restrictions on the size of the global 20461offset table. 20462 20463GCC normally uses a single instruction to load values from the GOT@. 20464While this is relatively efficient, it only works if the GOT 20465is smaller than about 64k. Anything larger causes the linker 20466to report an error such as: 20467 20468@cindex relocation truncated to fit (MIPS) 20469@smallexample 20470relocation truncated to fit: R_MIPS_GOT16 foobar 20471@end smallexample 20472 20473If this happens, you should recompile your code with @option{-mxgot}. 20474This works with very large GOTs, although the code is also 20475less efficient, since it takes three instructions to fetch the 20476value of a global symbol. 20477 20478Note that some linkers can create multiple GOTs. If you have such a 20479linker, you should only need to use @option{-mxgot} when a single object 20480file accesses more than 64k's worth of GOT entries. Very few do. 20481 20482These options have no effect unless GCC is generating position 20483independent code. 20484 20485@item -mgp32 20486@opindex mgp32 20487Assume that general-purpose registers are 32 bits wide. 20488 20489@item -mgp64 20490@opindex mgp64 20491Assume that general-purpose registers are 64 bits wide. 20492 20493@item -mfp32 20494@opindex mfp32 20495Assume that floating-point registers are 32 bits wide. 20496 20497@item -mfp64 20498@opindex mfp64 20499Assume that floating-point registers are 64 bits wide. 20500 20501@item -mfpxx 20502@opindex mfpxx 20503Do not assume the width of floating-point registers. 20504 20505@item -mhard-float 20506@opindex mhard-float 20507Use floating-point coprocessor instructions. 20508 20509@item -msoft-float 20510@opindex msoft-float 20511Do not use floating-point coprocessor instructions. Implement 20512floating-point calculations using library calls instead. 20513 20514@item -mno-float 20515@opindex mno-float 20516Equivalent to @option{-msoft-float}, but additionally asserts that the 20517program being compiled does not perform any floating-point operations. 20518This option is presently supported only by some bare-metal MIPS 20519configurations, where it may select a special set of libraries 20520that lack all floating-point support (including, for example, the 20521floating-point @code{printf} formats). 20522If code compiled with @option{-mno-float} accidentally contains 20523floating-point operations, it is likely to suffer a link-time 20524or run-time failure. 20525 20526@item -msingle-float 20527@opindex msingle-float 20528Assume that the floating-point coprocessor only supports single-precision 20529operations. 20530 20531@item -mdouble-float 20532@opindex mdouble-float 20533Assume that the floating-point coprocessor supports double-precision 20534operations. This is the default. 20535 20536@item -modd-spreg 20537@itemx -mno-odd-spreg 20538@opindex modd-spreg 20539@opindex mno-odd-spreg 20540Enable the use of odd-numbered single-precision floating-point registers 20541for the o32 ABI. This is the default for processors that are known to 20542support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 20543is set by default. 20544 20545@item -mabs=2008 20546@itemx -mabs=legacy 20547@opindex mabs=2008 20548@opindex mabs=legacy 20549These options control the treatment of the special not-a-number (NaN) 20550IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 20551@code{neg.@i{fmt}} machine instructions. 20552 20553By default or when @option{-mabs=legacy} is used the legacy 20554treatment is selected. In this case these instructions are considered 20555arithmetic and avoided where correct operation is required and the 20556input operand might be a NaN. A longer sequence of instructions that 20557manipulate the sign bit of floating-point datum manually is used 20558instead unless the @option{-ffinite-math-only} option has also been 20559specified. 20560 20561The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 20562this case these instructions are considered non-arithmetic and therefore 20563operating correctly in all cases, including in particular where the 20564input operand is a NaN. These instructions are therefore always used 20565for the respective operations. 20566 20567@item -mnan=2008 20568@itemx -mnan=legacy 20569@opindex mnan=2008 20570@opindex mnan=legacy 20571These options control the encoding of the special not-a-number (NaN) 20572IEEE 754 floating-point data. 20573 20574The @option{-mnan=legacy} option selects the legacy encoding. In this 20575case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 20576significand field being 0, whereas signaling NaNs (sNaNs) are denoted 20577by the first bit of their trailing significand field being 1. 20578 20579The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 20580this case qNaNs are denoted by the first bit of their trailing 20581significand field being 1, whereas sNaNs are denoted by the first bit of 20582their trailing significand field being 0. 20583 20584The default is @option{-mnan=legacy} unless GCC has been configured with 20585@option{--with-nan=2008}. 20586 20587@item -mllsc 20588@itemx -mno-llsc 20589@opindex mllsc 20590@opindex mno-llsc 20591Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 20592implement atomic memory built-in functions. When neither option is 20593specified, GCC uses the instructions if the target architecture 20594supports them. 20595 20596@option{-mllsc} is useful if the runtime environment can emulate the 20597instructions and @option{-mno-llsc} can be useful when compiling for 20598nonstandard ISAs. You can make either option the default by 20599configuring GCC with @option{--with-llsc} and @option{--without-llsc} 20600respectively. @option{--with-llsc} is the default for some 20601configurations; see the installation documentation for details. 20602 20603@item -mdsp 20604@itemx -mno-dsp 20605@opindex mdsp 20606@opindex mno-dsp 20607Use (do not use) revision 1 of the MIPS DSP ASE@. 20608@xref{MIPS DSP Built-in Functions}. This option defines the 20609preprocessor macro @code{__mips_dsp}. It also defines 20610@code{__mips_dsp_rev} to 1. 20611 20612@item -mdspr2 20613@itemx -mno-dspr2 20614@opindex mdspr2 20615@opindex mno-dspr2 20616Use (do not use) revision 2 of the MIPS DSP ASE@. 20617@xref{MIPS DSP Built-in Functions}. This option defines the 20618preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 20619It also defines @code{__mips_dsp_rev} to 2. 20620 20621@item -msmartmips 20622@itemx -mno-smartmips 20623@opindex msmartmips 20624@opindex mno-smartmips 20625Use (do not use) the MIPS SmartMIPS ASE. 20626 20627@item -mpaired-single 20628@itemx -mno-paired-single 20629@opindex mpaired-single 20630@opindex mno-paired-single 20631Use (do not use) paired-single floating-point instructions. 20632@xref{MIPS Paired-Single Support}. This option requires 20633hardware floating-point support to be enabled. 20634 20635@item -mdmx 20636@itemx -mno-mdmx 20637@opindex mdmx 20638@opindex mno-mdmx 20639Use (do not use) MIPS Digital Media Extension instructions. 20640This option can only be used when generating 64-bit code and requires 20641hardware floating-point support to be enabled. 20642 20643@item -mips3d 20644@itemx -mno-mips3d 20645@opindex mips3d 20646@opindex mno-mips3d 20647Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 20648The option @option{-mips3d} implies @option{-mpaired-single}. 20649 20650@item -mmicromips 20651@itemx -mno-micromips 20652@opindex mmicromips 20653@opindex mno-mmicromips 20654Generate (do not generate) microMIPS code. 20655 20656MicroMIPS code generation can also be controlled on a per-function basis 20657by means of @code{micromips} and @code{nomicromips} attributes. 20658@xref{Function Attributes}, for more information. 20659 20660@item -mmt 20661@itemx -mno-mt 20662@opindex mmt 20663@opindex mno-mt 20664Use (do not use) MT Multithreading instructions. 20665 20666@item -mmcu 20667@itemx -mno-mcu 20668@opindex mmcu 20669@opindex mno-mcu 20670Use (do not use) the MIPS MCU ASE instructions. 20671 20672@item -meva 20673@itemx -mno-eva 20674@opindex meva 20675@opindex mno-eva 20676Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 20677 20678@item -mvirt 20679@itemx -mno-virt 20680@opindex mvirt 20681@opindex mno-virt 20682Use (do not use) the MIPS Virtualization (VZ) instructions. 20683 20684@item -mxpa 20685@itemx -mno-xpa 20686@opindex mxpa 20687@opindex mno-xpa 20688Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 20689 20690@item -mlong64 20691@opindex mlong64 20692Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 20693an explanation of the default and the way that the pointer size is 20694determined. 20695 20696@item -mlong32 20697@opindex mlong32 20698Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 20699 20700The default size of @code{int}s, @code{long}s and pointers depends on 20701the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 20702uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 2070332-bit @code{long}s. Pointers are the same size as @code{long}s, 20704or the same size as integer registers, whichever is smaller. 20705 20706@item -msym32 20707@itemx -mno-sym32 20708@opindex msym32 20709@opindex mno-sym32 20710Assume (do not assume) that all symbols have 32-bit values, regardless 20711of the selected ABI@. This option is useful in combination with 20712@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 20713to generate shorter and faster references to symbolic addresses. 20714 20715@item -G @var{num} 20716@opindex G 20717Put definitions of externally-visible data in a small data section 20718if that data is no bigger than @var{num} bytes. GCC can then generate 20719more efficient accesses to the data; see @option{-mgpopt} for details. 20720 20721The default @option{-G} option depends on the configuration. 20722 20723@item -mlocal-sdata 20724@itemx -mno-local-sdata 20725@opindex mlocal-sdata 20726@opindex mno-local-sdata 20727Extend (do not extend) the @option{-G} behavior to local data too, 20728such as to static variables in C@. @option{-mlocal-sdata} is the 20729default for all configurations. 20730 20731If the linker complains that an application is using too much small data, 20732you might want to try rebuilding the less performance-critical parts with 20733@option{-mno-local-sdata}. You might also want to build large 20734libraries with @option{-mno-local-sdata}, so that the libraries leave 20735more room for the main program. 20736 20737@item -mextern-sdata 20738@itemx -mno-extern-sdata 20739@opindex mextern-sdata 20740@opindex mno-extern-sdata 20741Assume (do not assume) that externally-defined data is in 20742a small data section if the size of that data is within the @option{-G} limit. 20743@option{-mextern-sdata} is the default for all configurations. 20744 20745If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 20746@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 20747that is no bigger than @var{num} bytes, you must make sure that @var{Var} 20748is placed in a small data section. If @var{Var} is defined by another 20749module, you must either compile that module with a high-enough 20750@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 20751definition. If @var{Var} is common, you must link the application 20752with a high-enough @option{-G} setting. 20753 20754The easiest way of satisfying these restrictions is to compile 20755and link every module with the same @option{-G} option. However, 20756you may wish to build a library that supports several different 20757small data limits. You can do this by compiling the library with 20758the highest supported @option{-G} setting and additionally using 20759@option{-mno-extern-sdata} to stop the library from making assumptions 20760about externally-defined data. 20761 20762@item -mgpopt 20763@itemx -mno-gpopt 20764@opindex mgpopt 20765@opindex mno-gpopt 20766Use (do not use) GP-relative accesses for symbols that are known to be 20767in a small data section; see @option{-G}, @option{-mlocal-sdata} and 20768@option{-mextern-sdata}. @option{-mgpopt} is the default for all 20769configurations. 20770 20771@option{-mno-gpopt} is useful for cases where the @code{$gp} register 20772might not hold the value of @code{_gp}. For example, if the code is 20773part of a library that might be used in a boot monitor, programs that 20774call boot monitor routines pass an unknown value in @code{$gp}. 20775(In such situations, the boot monitor itself is usually compiled 20776with @option{-G0}.) 20777 20778@option{-mno-gpopt} implies @option{-mno-local-sdata} and 20779@option{-mno-extern-sdata}. 20780 20781@item -membedded-data 20782@itemx -mno-embedded-data 20783@opindex membedded-data 20784@opindex mno-embedded-data 20785Allocate variables to the read-only data section first if possible, then 20786next in the small data section if possible, otherwise in data. This gives 20787slightly slower code than the default, but reduces the amount of RAM required 20788when executing, and thus may be preferred for some embedded systems. 20789 20790@item -muninit-const-in-rodata 20791@itemx -mno-uninit-const-in-rodata 20792@opindex muninit-const-in-rodata 20793@opindex mno-uninit-const-in-rodata 20794Put uninitialized @code{const} variables in the read-only data section. 20795This option is only meaningful in conjunction with @option{-membedded-data}. 20796 20797@item -mcode-readable=@var{setting} 20798@opindex mcode-readable 20799Specify whether GCC may generate code that reads from executable sections. 20800There are three possible settings: 20801 20802@table @gcctabopt 20803@item -mcode-readable=yes 20804Instructions may freely access executable sections. This is the 20805default setting. 20806 20807@item -mcode-readable=pcrel 20808MIPS16 PC-relative load instructions can access executable sections, 20809but other instructions must not do so. This option is useful on 4KSc 20810and 4KSd processors when the code TLBs have the Read Inhibit bit set. 20811It is also useful on processors that can be configured to have a dual 20812instruction/data SRAM interface and that, like the M4K, automatically 20813redirect PC-relative loads to the instruction RAM. 20814 20815@item -mcode-readable=no 20816Instructions must not access executable sections. This option can be 20817useful on targets that are configured to have a dual instruction/data 20818SRAM interface but that (unlike the M4K) do not automatically redirect 20819PC-relative loads to the instruction RAM. 20820@end table 20821 20822@item -msplit-addresses 20823@itemx -mno-split-addresses 20824@opindex msplit-addresses 20825@opindex mno-split-addresses 20826Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 20827relocation operators. This option has been superseded by 20828@option{-mexplicit-relocs} but is retained for backwards compatibility. 20829 20830@item -mexplicit-relocs 20831@itemx -mno-explicit-relocs 20832@opindex mexplicit-relocs 20833@opindex mno-explicit-relocs 20834Use (do not use) assembler relocation operators when dealing with symbolic 20835addresses. The alternative, selected by @option{-mno-explicit-relocs}, 20836is to use assembler macros instead. 20837 20838@option{-mexplicit-relocs} is the default if GCC was configured 20839to use an assembler that supports relocation operators. 20840 20841@item -mcheck-zero-division 20842@itemx -mno-check-zero-division 20843@opindex mcheck-zero-division 20844@opindex mno-check-zero-division 20845Trap (do not trap) on integer division by zero. 20846 20847The default is @option{-mcheck-zero-division}. 20848 20849@item -mdivide-traps 20850@itemx -mdivide-breaks 20851@opindex mdivide-traps 20852@opindex mdivide-breaks 20853MIPS systems check for division by zero by generating either a 20854conditional trap or a break instruction. Using traps results in 20855smaller code, but is only supported on MIPS II and later. Also, some 20856versions of the Linux kernel have a bug that prevents trap from 20857generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 20858allow conditional traps on architectures that support them and 20859@option{-mdivide-breaks} to force the use of breaks. 20860 20861The default is usually @option{-mdivide-traps}, but this can be 20862overridden at configure time using @option{--with-divide=breaks}. 20863Divide-by-zero checks can be completely disabled using 20864@option{-mno-check-zero-division}. 20865 20866@item -mload-store-pairs 20867@itemx -mno-load-store-pairs 20868@opindex mload-store-pairs 20869@opindex mno-load-store-pairs 20870Enable (disable) an optimization that pairs consecutive load or store 20871instructions to enable load/store bonding. This option is enabled by 20872default but only takes effect when the selected architecture is known 20873to support bonding. 20874 20875@item -mmemcpy 20876@itemx -mno-memcpy 20877@opindex mmemcpy 20878@opindex mno-memcpy 20879Force (do not force) the use of @code{memcpy} for non-trivial block 20880moves. The default is @option{-mno-memcpy}, which allows GCC to inline 20881most constant-sized copies. 20882 20883@item -mlong-calls 20884@itemx -mno-long-calls 20885@opindex mlong-calls 20886@opindex mno-long-calls 20887Disable (do not disable) use of the @code{jal} instruction. Calling 20888functions using @code{jal} is more efficient but requires the caller 20889and callee to be in the same 256 megabyte segment. 20890 20891This option has no effect on abicalls code. The default is 20892@option{-mno-long-calls}. 20893 20894@item -mmad 20895@itemx -mno-mad 20896@opindex mmad 20897@opindex mno-mad 20898Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 20899instructions, as provided by the R4650 ISA@. 20900 20901@item -mimadd 20902@itemx -mno-imadd 20903@opindex mimadd 20904@opindex mno-imadd 20905Enable (disable) use of the @code{madd} and @code{msub} integer 20906instructions. The default is @option{-mimadd} on architectures 20907that support @code{madd} and @code{msub} except for the 74k 20908architecture where it was found to generate slower code. 20909 20910@item -mfused-madd 20911@itemx -mno-fused-madd 20912@opindex mfused-madd 20913@opindex mno-fused-madd 20914Enable (disable) use of the floating-point multiply-accumulate 20915instructions, when they are available. The default is 20916@option{-mfused-madd}. 20917 20918On the R8000 CPU when multiply-accumulate instructions are used, 20919the intermediate product is calculated to infinite precision 20920and is not subject to the FCSR Flush to Zero bit. This may be 20921undesirable in some circumstances. On other processors the result 20922is numerically identical to the equivalent computation using 20923separate multiply, add, subtract and negate instructions. 20924 20925@item -nocpp 20926@opindex nocpp 20927Tell the MIPS assembler to not run its preprocessor over user 20928assembler files (with a @samp{.s} suffix) when assembling them. 20929 20930@item -mfix-24k 20931@itemx -mno-fix-24k 20932@opindex mfix-24k 20933@opindex mno-fix-24k 20934Work around the 24K E48 (lost data on stores during refill) errata. 20935The workarounds are implemented by the assembler rather than by GCC@. 20936 20937@item -mfix-r4000 20938@itemx -mno-fix-r4000 20939@opindex mfix-r4000 20940@opindex mno-fix-r4000 20941Work around certain R4000 CPU errata: 20942@itemize @minus 20943@item 20944A double-word or a variable shift may give an incorrect result if executed 20945immediately after starting an integer division. 20946@item 20947A double-word or a variable shift may give an incorrect result if executed 20948while an integer multiplication is in progress. 20949@item 20950An integer division may give an incorrect result if started in a delay slot 20951of a taken branch or a jump. 20952@end itemize 20953 20954@item -mfix-r4400 20955@itemx -mno-fix-r4400 20956@opindex mfix-r4400 20957@opindex mno-fix-r4400 20958Work around certain R4400 CPU errata: 20959@itemize @minus 20960@item 20961A double-word or a variable shift may give an incorrect result if executed 20962immediately after starting an integer division. 20963@end itemize 20964 20965@item -mfix-r10000 20966@itemx -mno-fix-r10000 20967@opindex mfix-r10000 20968@opindex mno-fix-r10000 20969Work around certain R10000 errata: 20970@itemize @minus 20971@item 20972@code{ll}/@code{sc} sequences may not behave atomically on revisions 20973prior to 3.0. They may deadlock on revisions 2.6 and earlier. 20974@end itemize 20975 20976This option can only be used if the target architecture supports 20977branch-likely instructions. @option{-mfix-r10000} is the default when 20978@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 20979otherwise. 20980 20981@item -mfix-rm7000 20982@itemx -mno-fix-rm7000 20983@opindex mfix-rm7000 20984Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 20985workarounds are implemented by the assembler rather than by GCC@. 20986 20987@item -mfix-vr4120 20988@itemx -mno-fix-vr4120 20989@opindex mfix-vr4120 20990Work around certain VR4120 errata: 20991@itemize @minus 20992@item 20993@code{dmultu} does not always produce the correct result. 20994@item 20995@code{div} and @code{ddiv} do not always produce the correct result if one 20996of the operands is negative. 20997@end itemize 20998The workarounds for the division errata rely on special functions in 20999@file{libgcc.a}. At present, these functions are only provided by 21000the @code{mips64vr*-elf} configurations. 21001 21002Other VR4120 errata require a NOP to be inserted between certain pairs of 21003instructions. These errata are handled by the assembler, not by GCC itself. 21004 21005@item -mfix-vr4130 21006@opindex mfix-vr4130 21007Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 21008workarounds are implemented by the assembler rather than by GCC, 21009although GCC avoids using @code{mflo} and @code{mfhi} if the 21010VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 21011instructions are available instead. 21012 21013@item -mfix-sb1 21014@itemx -mno-fix-sb1 21015@opindex mfix-sb1 21016Work around certain SB-1 CPU core errata. 21017(This flag currently works around the SB-1 revision 2 21018``F1'' and ``F2'' floating-point errata.) 21019 21020@item -mr10k-cache-barrier=@var{setting} 21021@opindex mr10k-cache-barrier 21022Specify whether GCC should insert cache barriers to avoid the 21023side effects of speculation on R10K processors. 21024 21025In common with many processors, the R10K tries to predict the outcome 21026of a conditional branch and speculatively executes instructions from 21027the ``taken'' branch. It later aborts these instructions if the 21028predicted outcome is wrong. However, on the R10K, even aborted 21029instructions can have side effects. 21030 21031This problem only affects kernel stores and, depending on the system, 21032kernel loads. As an example, a speculatively-executed store may load 21033the target memory into cache and mark the cache line as dirty, even if 21034the store itself is later aborted. If a DMA operation writes to the 21035same area of memory before the ``dirty'' line is flushed, the cached 21036data overwrites the DMA-ed data. See the R10K processor manual 21037for a full description, including other potential problems. 21038 21039One workaround is to insert cache barrier instructions before every memory 21040access that might be speculatively executed and that might have side 21041effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 21042controls GCC's implementation of this workaround. It assumes that 21043aborted accesses to any byte in the following regions does not have 21044side effects: 21045 21046@enumerate 21047@item 21048the memory occupied by the current function's stack frame; 21049 21050@item 21051the memory occupied by an incoming stack argument; 21052 21053@item 21054the memory occupied by an object with a link-time-constant address. 21055@end enumerate 21056 21057It is the kernel's responsibility to ensure that speculative 21058accesses to these regions are indeed safe. 21059 21060If the input program contains a function declaration such as: 21061 21062@smallexample 21063void foo (void); 21064@end smallexample 21065 21066then the implementation of @code{foo} must allow @code{j foo} and 21067@code{jal foo} to be executed speculatively. GCC honors this 21068restriction for functions it compiles itself. It expects non-GCC 21069functions (such as hand-written assembly code) to do the same. 21070 21071The option has three forms: 21072 21073@table @gcctabopt 21074@item -mr10k-cache-barrier=load-store 21075Insert a cache barrier before a load or store that might be 21076speculatively executed and that might have side effects even 21077if aborted. 21078 21079@item -mr10k-cache-barrier=store 21080Insert a cache barrier before a store that might be speculatively 21081executed and that might have side effects even if aborted. 21082 21083@item -mr10k-cache-barrier=none 21084Disable the insertion of cache barriers. This is the default setting. 21085@end table 21086 21087@item -mflush-func=@var{func} 21088@itemx -mno-flush-func 21089@opindex mflush-func 21090Specifies the function to call to flush the I and D caches, or to not 21091call any such function. If called, the function must take the same 21092arguments as the common @code{_flush_func}, that is, the address of the 21093memory range for which the cache is being flushed, the size of the 21094memory range, and the number 3 (to flush both caches). The default 21095depends on the target GCC was configured for, but commonly is either 21096@code{_flush_func} or @code{__cpu_flush}. 21097 21098@item mbranch-cost=@var{num} 21099@opindex mbranch-cost 21100Set the cost of branches to roughly @var{num} ``simple'' instructions. 21101This cost is only a heuristic and is not guaranteed to produce 21102consistent results across releases. A zero cost redundantly selects 21103the default, which is based on the @option{-mtune} setting. 21104 21105@item -mbranch-likely 21106@itemx -mno-branch-likely 21107@opindex mbranch-likely 21108@opindex mno-branch-likely 21109Enable or disable use of Branch Likely instructions, regardless of the 21110default for the selected architecture. By default, Branch Likely 21111instructions may be generated if they are supported by the selected 21112architecture. An exception is for the MIPS32 and MIPS64 architectures 21113and processors that implement those architectures; for those, Branch 21114Likely instructions are not be generated by default because the MIPS32 21115and MIPS64 architectures specifically deprecate their use. 21116 21117@item -mcompact-branches=never 21118@itemx -mcompact-branches=optimal 21119@itemx -mcompact-branches=always 21120@opindex mcompact-branches=never 21121@opindex mcompact-branches=optimal 21122@opindex mcompact-branches=always 21123These options control which form of branches will be generated. The 21124default is @option{-mcompact-branches=optimal}. 21125 21126The @option{-mcompact-branches=never} option ensures that compact branch 21127instructions will never be generated. 21128 21129The @option{-mcompact-branches=always} option ensures that a compact 21130branch instruction will be generated if available. If a compact branch 21131instruction is not available, a delay slot form of the branch will be 21132used instead. 21133 21134This option is supported from MIPS Release 6 onwards. 21135 21136The @option{-mcompact-branches=optimal} option will cause a delay slot 21137branch to be used if one is available in the current ISA and the delay 21138slot is successfully filled. If the delay slot is not filled, a compact 21139branch will be chosen if one is available. 21140 21141@item -mfp-exceptions 21142@itemx -mno-fp-exceptions 21143@opindex mfp-exceptions 21144Specifies whether FP exceptions are enabled. This affects how 21145FP instructions are scheduled for some processors. 21146The default is that FP exceptions are 21147enabled. 21148 21149For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 2115064-bit code, then we can use both FP pipes. Otherwise, we can only use one 21151FP pipe. 21152 21153@item -mvr4130-align 21154@itemx -mno-vr4130-align 21155@opindex mvr4130-align 21156The VR4130 pipeline is two-way superscalar, but can only issue two 21157instructions together if the first one is 8-byte aligned. When this 21158option is enabled, GCC aligns pairs of instructions that it 21159thinks should execute in parallel. 21160 21161This option only has an effect when optimizing for the VR4130. 21162It normally makes code faster, but at the expense of making it bigger. 21163It is enabled by default at optimization level @option{-O3}. 21164 21165@item -msynci 21166@itemx -mno-synci 21167@opindex msynci 21168Enable (disable) generation of @code{synci} instructions on 21169architectures that support it. The @code{synci} instructions (if 21170enabled) are generated when @code{__builtin___clear_cache} is 21171compiled. 21172 21173This option defaults to @option{-mno-synci}, but the default can be 21174overridden by configuring GCC with @option{--with-synci}. 21175 21176When compiling code for single processor systems, it is generally safe 21177to use @code{synci}. However, on many multi-core (SMP) systems, it 21178does not invalidate the instruction caches on all cores and may lead 21179to undefined behavior. 21180 21181@item -mrelax-pic-calls 21182@itemx -mno-relax-pic-calls 21183@opindex mrelax-pic-calls 21184Try to turn PIC calls that are normally dispatched via register 21185@code{$25} into direct calls. This is only possible if the linker can 21186resolve the destination at link time and if the destination is within 21187range for a direct call. 21188 21189@option{-mrelax-pic-calls} is the default if GCC was configured to use 21190an assembler and a linker that support the @code{.reloc} assembly 21191directive and @option{-mexplicit-relocs} is in effect. With 21192@option{-mno-explicit-relocs}, this optimization can be performed by the 21193assembler and the linker alone without help from the compiler. 21194 21195@item -mmcount-ra-address 21196@itemx -mno-mcount-ra-address 21197@opindex mmcount-ra-address 21198@opindex mno-mcount-ra-address 21199Emit (do not emit) code that allows @code{_mcount} to modify the 21200calling function's return address. When enabled, this option extends 21201the usual @code{_mcount} interface with a new @var{ra-address} 21202parameter, which has type @code{intptr_t *} and is passed in register 21203@code{$12}. @code{_mcount} can then modify the return address by 21204doing both of the following: 21205@itemize 21206@item 21207Returning the new address in register @code{$31}. 21208@item 21209Storing the new address in @code{*@var{ra-address}}, 21210if @var{ra-address} is nonnull. 21211@end itemize 21212 21213The default is @option{-mno-mcount-ra-address}. 21214 21215@item -mframe-header-opt 21216@itemx -mno-frame-header-opt 21217@opindex mframe-header-opt 21218Enable (disable) frame header optimization in the o32 ABI. When using the 21219o32 ABI, calling functions will allocate 16 bytes on the stack for the called 21220function to write out register arguments. When enabled, this optimization 21221will suppress the allocation of the frame header if it can be determined that 21222it is unused. 21223 21224This optimization is off by default at all optimization levels. 21225 21226@item -mlxc1-sxc1 21227@itemx -mno-lxc1-sxc1 21228@opindex mlxc1-sxc1 21229When applicable, enable (disable) the generation of @code{lwxc1}, 21230@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default. 21231 21232@item -mmadd4 21233@itemx -mno-madd4 21234@opindex mmadd4 21235When applicable, enable (disable) the generation of 4-operand @code{madd.s}, 21236@code{madd.d} and related instructions. Enabled by default. 21237 21238@end table 21239 21240@node MMIX Options 21241@subsection MMIX Options 21242@cindex MMIX Options 21243 21244These options are defined for the MMIX: 21245 21246@table @gcctabopt 21247@item -mlibfuncs 21248@itemx -mno-libfuncs 21249@opindex mlibfuncs 21250@opindex mno-libfuncs 21251Specify that intrinsic library functions are being compiled, passing all 21252values in registers, no matter the size. 21253 21254@item -mepsilon 21255@itemx -mno-epsilon 21256@opindex mepsilon 21257@opindex mno-epsilon 21258Generate floating-point comparison instructions that compare with respect 21259to the @code{rE} epsilon register. 21260 21261@item -mabi=mmixware 21262@itemx -mabi=gnu 21263@opindex mabi=mmixware 21264@opindex mabi=gnu 21265Generate code that passes function parameters and return values that (in 21266the called function) are seen as registers @code{$0} and up, as opposed to 21267the GNU ABI which uses global registers @code{$231} and up. 21268 21269@item -mzero-extend 21270@itemx -mno-zero-extend 21271@opindex mzero-extend 21272@opindex mno-zero-extend 21273When reading data from memory in sizes shorter than 64 bits, use (do not 21274use) zero-extending load instructions by default, rather than 21275sign-extending ones. 21276 21277@item -mknuthdiv 21278@itemx -mno-knuthdiv 21279@opindex mknuthdiv 21280@opindex mno-knuthdiv 21281Make the result of a division yielding a remainder have the same sign as 21282the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 21283remainder follows the sign of the dividend. Both methods are 21284arithmetically valid, the latter being almost exclusively used. 21285 21286@item -mtoplevel-symbols 21287@itemx -mno-toplevel-symbols 21288@opindex mtoplevel-symbols 21289@opindex mno-toplevel-symbols 21290Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 21291code can be used with the @code{PREFIX} assembly directive. 21292 21293@item -melf 21294@opindex melf 21295Generate an executable in the ELF format, rather than the default 21296@samp{mmo} format used by the @command{mmix} simulator. 21297 21298@item -mbranch-predict 21299@itemx -mno-branch-predict 21300@opindex mbranch-predict 21301@opindex mno-branch-predict 21302Use (do not use) the probable-branch instructions, when static branch 21303prediction indicates a probable branch. 21304 21305@item -mbase-addresses 21306@itemx -mno-base-addresses 21307@opindex mbase-addresses 21308@opindex mno-base-addresses 21309Generate (do not generate) code that uses @emph{base addresses}. Using a 21310base address automatically generates a request (handled by the assembler 21311and the linker) for a constant to be set up in a global register. The 21312register is used for one or more base address requests within the range 0 21313to 255 from the value held in the register. The generally leads to short 21314and fast code, but the number of different data items that can be 21315addressed is limited. This means that a program that uses lots of static 21316data may require @option{-mno-base-addresses}. 21317 21318@item -msingle-exit 21319@itemx -mno-single-exit 21320@opindex msingle-exit 21321@opindex mno-single-exit 21322Force (do not force) generated code to have a single exit point in each 21323function. 21324@end table 21325 21326@node MN10300 Options 21327@subsection MN10300 Options 21328@cindex MN10300 options 21329 21330These @option{-m} options are defined for Matsushita MN10300 architectures: 21331 21332@table @gcctabopt 21333@item -mmult-bug 21334@opindex mmult-bug 21335Generate code to avoid bugs in the multiply instructions for the MN10300 21336processors. This is the default. 21337 21338@item -mno-mult-bug 21339@opindex mno-mult-bug 21340Do not generate code to avoid bugs in the multiply instructions for the 21341MN10300 processors. 21342 21343@item -mam33 21344@opindex mam33 21345Generate code using features specific to the AM33 processor. 21346 21347@item -mno-am33 21348@opindex mno-am33 21349Do not generate code using features specific to the AM33 processor. This 21350is the default. 21351 21352@item -mam33-2 21353@opindex mam33-2 21354Generate code using features specific to the AM33/2.0 processor. 21355 21356@item -mam34 21357@opindex mam34 21358Generate code using features specific to the AM34 processor. 21359 21360@item -mtune=@var{cpu-type} 21361@opindex mtune 21362Use the timing characteristics of the indicated CPU type when 21363scheduling instructions. This does not change the targeted processor 21364type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 21365@samp{am33-2} or @samp{am34}. 21366 21367@item -mreturn-pointer-on-d0 21368@opindex mreturn-pointer-on-d0 21369When generating a function that returns a pointer, return the pointer 21370in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 21371only in @code{a0}, and attempts to call such functions without a prototype 21372result in errors. Note that this option is on by default; use 21373@option{-mno-return-pointer-on-d0} to disable it. 21374 21375@item -mno-crt0 21376@opindex mno-crt0 21377Do not link in the C run-time initialization object file. 21378 21379@item -mrelax 21380@opindex mrelax 21381Indicate to the linker that it should perform a relaxation optimization pass 21382to shorten branches, calls and absolute memory addresses. This option only 21383has an effect when used on the command line for the final link step. 21384 21385This option makes symbolic debugging impossible. 21386 21387@item -mliw 21388@opindex mliw 21389Allow the compiler to generate @emph{Long Instruction Word} 21390instructions if the target is the @samp{AM33} or later. This is the 21391default. This option defines the preprocessor macro @code{__LIW__}. 21392 21393@item -mnoliw 21394@opindex mnoliw 21395Do not allow the compiler to generate @emph{Long Instruction Word} 21396instructions. This option defines the preprocessor macro 21397@code{__NO_LIW__}. 21398 21399@item -msetlb 21400@opindex msetlb 21401Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 21402instructions if the target is the @samp{AM33} or later. This is the 21403default. This option defines the preprocessor macro @code{__SETLB__}. 21404 21405@item -mnosetlb 21406@opindex mnosetlb 21407Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 21408instructions. This option defines the preprocessor macro 21409@code{__NO_SETLB__}. 21410 21411@end table 21412 21413@node Moxie Options 21414@subsection Moxie Options 21415@cindex Moxie Options 21416 21417@table @gcctabopt 21418 21419@item -meb 21420@opindex meb 21421Generate big-endian code. This is the default for @samp{moxie-*-*} 21422configurations. 21423 21424@item -mel 21425@opindex mel 21426Generate little-endian code. 21427 21428@item -mmul.x 21429@opindex mmul.x 21430Generate mul.x and umul.x instructions. This is the default for 21431@samp{moxiebox-*-*} configurations. 21432 21433@item -mno-crt0 21434@opindex mno-crt0 21435Do not link in the C run-time initialization object file. 21436 21437@end table 21438 21439@node MSP430 Options 21440@subsection MSP430 Options 21441@cindex MSP430 Options 21442 21443These options are defined for the MSP430: 21444 21445@table @gcctabopt 21446 21447@item -masm-hex 21448@opindex masm-hex 21449Force assembly output to always use hex constants. Normally such 21450constants are signed decimals, but this option is available for 21451testsuite and/or aesthetic purposes. 21452 21453@item -mmcu= 21454@opindex mmcu= 21455Select the MCU to target. This is used to create a C preprocessor 21456symbol based upon the MCU name, converted to upper case and pre- and 21457post-fixed with @samp{__}. This in turn is used by the 21458@file{msp430.h} header file to select an MCU-specific supplementary 21459header file. 21460 21461The option also sets the ISA to use. If the MCU name is one that is 21462known to only support the 430 ISA then that is selected, otherwise the 21463430X ISA is selected. A generic MCU name of @samp{msp430} can also be 21464used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 21465name selects the 430X ISA. 21466 21467In addition an MCU-specific linker script is added to the linker 21468command line. The script's name is the name of the MCU with 21469@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 21470command line defines the C preprocessor symbol @code{__XXX__} and 21471cause the linker to search for a script called @file{xxx.ld}. 21472 21473This option is also passed on to the assembler. 21474 21475@item -mwarn-mcu 21476@itemx -mno-warn-mcu 21477@opindex mwarn-mcu 21478@opindex mno-warn-mcu 21479This option enables or disables warnings about conflicts between the 21480MCU name specified by the @option{-mmcu} option and the ISA set by the 21481@option{-mcpu} option and/or the hardware multiply support set by the 21482@option{-mhwmult} option. It also toggles warnings about unrecognized 21483MCU names. This option is on by default. 21484 21485@item -mcpu= 21486@opindex mcpu= 21487Specifies the ISA to use. Accepted values are @samp{msp430}, 21488@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 21489@option{-mmcu=} option should be used to select the ISA. 21490 21491@item -msim 21492@opindex msim 21493Link to the simulator runtime libraries and linker script. Overrides 21494any scripts that would be selected by the @option{-mmcu=} option. 21495 21496@item -mlarge 21497@opindex mlarge 21498Use large-model addressing (20-bit pointers, 32-bit @code{size_t}). 21499 21500@item -msmall 21501@opindex msmall 21502Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 21503 21504@item -mrelax 21505@opindex mrelax 21506This option is passed to the assembler and linker, and allows the 21507linker to perform certain optimizations that cannot be done until 21508the final link. 21509 21510@item mhwmult= 21511@opindex mhwmult= 21512Describes the type of hardware multiply supported by the target. 21513Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 21514for the original 16-bit-only multiply supported by early MCUs. 21515@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 21516@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 21517A value of @samp{auto} can also be given. This tells GCC to deduce 21518the hardware multiply support based upon the MCU name provided by the 21519@option{-mmcu} option. If no @option{-mmcu} option is specified or if 21520the MCU name is not recognized then no hardware multiply support is 21521assumed. @code{auto} is the default setting. 21522 21523Hardware multiplies are normally performed by calling a library 21524routine. This saves space in the generated code. When compiling at 21525@option{-O3} or higher however the hardware multiplier is invoked 21526inline. This makes for bigger, but faster code. 21527 21528The hardware multiply routines disable interrupts whilst running and 21529restore the previous interrupt state when they finish. This makes 21530them safe to use inside interrupt handlers as well as in normal code. 21531 21532@item -minrt 21533@opindex minrt 21534Enable the use of a minimum runtime environment - no static 21535initializers or constructors. This is intended for memory-constrained 21536devices. The compiler includes special symbols in some objects 21537that tell the linker and runtime which code fragments are required. 21538 21539@item -mcode-region= 21540@itemx -mdata-region= 21541@opindex mcode-region 21542@opindex mdata-region 21543These options tell the compiler where to place functions and data that 21544do not have one of the @code{lower}, @code{upper}, @code{either} or 21545@code{section} attributes. Possible values are @code{lower}, 21546@code{upper}, @code{either} or @code{any}. The first three behave 21547like the corresponding attribute. The fourth possible value - 21548@code{any} - is the default. It leaves placement entirely up to the 21549linker script and how it assigns the standard sections 21550(@code{.text}, @code{.data}, etc) to the memory regions. 21551 21552@item -msilicon-errata= 21553@opindex msilicon-errata 21554This option passes on a request to assembler to enable the fixes for 21555the named silicon errata. 21556 21557@item -msilicon-errata-warn= 21558@opindex msilicon-errata-warn 21559This option passes on a request to the assembler to enable warning 21560messages when a silicon errata might need to be applied. 21561 21562@end table 21563 21564@node NDS32 Options 21565@subsection NDS32 Options 21566@cindex NDS32 Options 21567 21568These options are defined for NDS32 implementations: 21569 21570@table @gcctabopt 21571 21572@item -mbig-endian 21573@opindex mbig-endian 21574Generate code in big-endian mode. 21575 21576@item -mlittle-endian 21577@opindex mlittle-endian 21578Generate code in little-endian mode. 21579 21580@item -mreduced-regs 21581@opindex mreduced-regs 21582Use reduced-set registers for register allocation. 21583 21584@item -mfull-regs 21585@opindex mfull-regs 21586Use full-set registers for register allocation. 21587 21588@item -mcmov 21589@opindex mcmov 21590Generate conditional move instructions. 21591 21592@item -mno-cmov 21593@opindex mno-cmov 21594Do not generate conditional move instructions. 21595 21596@item -mext-perf 21597@opindex mperf-ext 21598Generate performance extension instructions. 21599 21600@item -mno-ext-perf 21601@opindex mno-perf-ext 21602Do not generate performance extension instructions. 21603 21604@item -mext-perf2 21605@opindex mperf-ext 21606Generate performance extension 2 instructions. 21607 21608@item -mno-ext-perf2 21609@opindex mno-perf-ext 21610Do not generate performance extension 2 instructions. 21611 21612@item -mext-string 21613@opindex mperf-ext 21614Generate string extension instructions. 21615 21616@item -mno-ext-string 21617@opindex mno-perf-ext 21618Do not generate string extension instructions. 21619 21620@item -mv3push 21621@opindex mv3push 21622Generate v3 push25/pop25 instructions. 21623 21624@item -mno-v3push 21625@opindex mno-v3push 21626Do not generate v3 push25/pop25 instructions. 21627 21628@item -m16-bit 21629@opindex m16-bit 21630Generate 16-bit instructions. 21631 21632@item -mno-16-bit 21633@opindex mno-16-bit 21634Do not generate 16-bit instructions. 21635 21636@item -misr-vector-size=@var{num} 21637@opindex misr-vector-size 21638Specify the size of each interrupt vector, which must be 4 or 16. 21639 21640@item -mcache-block-size=@var{num} 21641@opindex mcache-block-size 21642Specify the size of each cache block, 21643which must be a power of 2 between 4 and 512. 21644 21645@item -march=@var{arch} 21646@opindex march 21647Specify the name of the target architecture. 21648 21649@item -mcmodel=@var{code-model} 21650@opindex mcmodel 21651Set the code model to one of 21652@table @asis 21653@item @samp{small} 21654All the data and read-only data segments must be within 512KB addressing space. 21655The text segment must be within 16MB addressing space. 21656@item @samp{medium} 21657The data segment must be within 512KB while the read-only data segment can be 21658within 4GB addressing space. The text segment should be still within 16MB 21659addressing space. 21660@item @samp{large} 21661All the text and data segments can be within 4GB addressing space. 21662@end table 21663 21664@item -mctor-dtor 21665@opindex mctor-dtor 21666Enable constructor/destructor feature. 21667 21668@item -mrelax 21669@opindex mrelax 21670Guide linker to relax instructions. 21671 21672@end table 21673 21674@node Nios II Options 21675@subsection Nios II Options 21676@cindex Nios II options 21677@cindex Altera Nios II options 21678 21679These are the options defined for the Altera Nios II processor. 21680 21681@table @gcctabopt 21682 21683@item -G @var{num} 21684@opindex G 21685@cindex smaller data references 21686Put global and static objects less than or equal to @var{num} bytes 21687into the small data or BSS sections instead of the normal data or BSS 21688sections. The default value of @var{num} is 8. 21689 21690@item -mgpopt=@var{option} 21691@itemx -mgpopt 21692@itemx -mno-gpopt 21693@opindex mgpopt 21694@opindex mno-gpopt 21695Generate (do not generate) GP-relative accesses. The following 21696@var{option} names are recognized: 21697 21698@table @samp 21699 21700@item none 21701Do not generate GP-relative accesses. 21702 21703@item local 21704Generate GP-relative accesses for small data objects that are not 21705external, weak, or uninitialized common symbols. 21706Also use GP-relative addressing for objects that 21707have been explicitly placed in a small data section via a @code{section} 21708attribute. 21709 21710@item global 21711As for @samp{local}, but also generate GP-relative accesses for 21712small data objects that are external, weak, or common. If you use this option, 21713you must ensure that all parts of your program (including libraries) are 21714compiled with the same @option{-G} setting. 21715 21716@item data 21717Generate GP-relative accesses for all data objects in the program. If you 21718use this option, the entire data and BSS segments 21719of your program must fit in 64K of memory and you must use an appropriate 21720linker script to allocate them within the addressable range of the 21721global pointer. 21722 21723@item all 21724Generate GP-relative addresses for function pointers as well as data 21725pointers. If you use this option, the entire text, data, and BSS segments 21726of your program must fit in 64K of memory and you must use an appropriate 21727linker script to allocate them within the addressable range of the 21728global pointer. 21729 21730@end table 21731 21732@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 21733@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 21734 21735The default is @option{-mgpopt} except when @option{-fpic} or 21736@option{-fPIC} is specified to generate position-independent code. 21737Note that the Nios II ABI does not permit GP-relative accesses from 21738shared libraries. 21739 21740You may need to specify @option{-mno-gpopt} explicitly when building 21741programs that include large amounts of small data, including large 21742GOT data sections. In this case, the 16-bit offset for GP-relative 21743addressing may not be large enough to allow access to the entire 21744small data section. 21745 21746@item -mgprel-sec=@var{regexp} 21747@opindex mgprel-sec 21748This option specifies additional section names that can be accessed via 21749GP-relative addressing. It is most useful in conjunction with 21750@code{section} attributes on variable declarations 21751(@pxref{Common Variable Attributes}) and a custom linker script. 21752The @var{regexp} is a POSIX Extended Regular Expression. 21753 21754This option does not affect the behavior of the @option{-G} option, and 21755the specified sections are in addition to the standard @code{.sdata} 21756and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}. 21757 21758@item -mr0rel-sec=@var{regexp} 21759@opindex mr0rel-sec 21760This option specifies names of sections that can be accessed via a 2176116-bit offset from @code{r0}; that is, in the low 32K or high 32K 21762of the 32-bit address space. It is most useful in conjunction with 21763@code{section} attributes on variable declarations 21764(@pxref{Common Variable Attributes}) and a custom linker script. 21765The @var{regexp} is a POSIX Extended Regular Expression. 21766 21767In contrast to the use of GP-relative addressing for small data, 21768zero-based addressing is never generated by default and there are no 21769conventional section names used in standard linker scripts for sections 21770in the low or high areas of memory. 21771 21772@item -mel 21773@itemx -meb 21774@opindex mel 21775@opindex meb 21776Generate little-endian (default) or big-endian (experimental) code, 21777respectively. 21778 21779@item -march=@var{arch} 21780@opindex march 21781This specifies the name of the target Nios II architecture. GCC uses this 21782name to determine what kind of instructions it can emit when generating 21783assembly code. Permissible names are: @samp{r1}, @samp{r2}. 21784 21785The preprocessor macro @code{__nios2_arch__} is available to programs, 21786with value 1 or 2, indicating the targeted ISA level. 21787 21788@item -mbypass-cache 21789@itemx -mno-bypass-cache 21790@opindex mno-bypass-cache 21791@opindex mbypass-cache 21792Force all load and store instructions to always bypass cache by 21793using I/O variants of the instructions. The default is not to 21794bypass the cache. 21795 21796@item -mno-cache-volatile 21797@itemx -mcache-volatile 21798@opindex mcache-volatile 21799@opindex mno-cache-volatile 21800Volatile memory access bypass the cache using the I/O variants of 21801the load and store instructions. The default is not to bypass the cache. 21802 21803@item -mno-fast-sw-div 21804@itemx -mfast-sw-div 21805@opindex mno-fast-sw-div 21806@opindex mfast-sw-div 21807Do not use table-based fast divide for small numbers. The default 21808is to use the fast divide at @option{-O3} and above. 21809 21810@item -mno-hw-mul 21811@itemx -mhw-mul 21812@itemx -mno-hw-mulx 21813@itemx -mhw-mulx 21814@itemx -mno-hw-div 21815@itemx -mhw-div 21816@opindex mno-hw-mul 21817@opindex mhw-mul 21818@opindex mno-hw-mulx 21819@opindex mhw-mulx 21820@opindex mno-hw-div 21821@opindex mhw-div 21822Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 21823instructions by the compiler. The default is to emit @code{mul} 21824and not emit @code{div} and @code{mulx}. 21825 21826@item -mbmx 21827@itemx -mno-bmx 21828@itemx -mcdx 21829@itemx -mno-cdx 21830Enable or disable generation of Nios II R2 BMX (bit manipulation) and 21831CDX (code density) instructions. Enabling these instructions also 21832requires @option{-march=r2}. Since these instructions are optional 21833extensions to the R2 architecture, the default is not to emit them. 21834 21835@item -mcustom-@var{insn}=@var{N} 21836@itemx -mno-custom-@var{insn} 21837@opindex mcustom-@var{insn} 21838@opindex mno-custom-@var{insn} 21839Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 21840custom instruction with encoding @var{N} when generating code that uses 21841@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 21842instruction 253 for single-precision floating-point add operations instead 21843of the default behavior of using a library call. 21844 21845The following values of @var{insn} are supported. Except as otherwise 21846noted, floating-point operations are expected to be implemented with 21847normal IEEE 754 semantics and correspond directly to the C operators or the 21848equivalent GCC built-in functions (@pxref{Other Builtins}). 21849 21850Single-precision floating point: 21851@table @asis 21852 21853@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 21854Binary arithmetic operations. 21855 21856@item @samp{fnegs} 21857Unary negation. 21858 21859@item @samp{fabss} 21860Unary absolute value. 21861 21862@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 21863Comparison operations. 21864 21865@item @samp{fmins}, @samp{fmaxs} 21866Floating-point minimum and maximum. These instructions are only 21867generated if @option{-ffinite-math-only} is specified. 21868 21869@item @samp{fsqrts} 21870Unary square root operation. 21871 21872@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 21873Floating-point trigonometric and exponential functions. These instructions 21874are only generated if @option{-funsafe-math-optimizations} is also specified. 21875 21876@end table 21877 21878Double-precision floating point: 21879@table @asis 21880 21881@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 21882Binary arithmetic operations. 21883 21884@item @samp{fnegd} 21885Unary negation. 21886 21887@item @samp{fabsd} 21888Unary absolute value. 21889 21890@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 21891Comparison operations. 21892 21893@item @samp{fmind}, @samp{fmaxd} 21894Double-precision minimum and maximum. These instructions are only 21895generated if @option{-ffinite-math-only} is specified. 21896 21897@item @samp{fsqrtd} 21898Unary square root operation. 21899 21900@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 21901Double-precision trigonometric and exponential functions. These instructions 21902are only generated if @option{-funsafe-math-optimizations} is also specified. 21903 21904@end table 21905 21906Conversions: 21907@table @asis 21908@item @samp{fextsd} 21909Conversion from single precision to double precision. 21910 21911@item @samp{ftruncds} 21912Conversion from double precision to single precision. 21913 21914@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 21915Conversion from floating point to signed or unsigned integer types, with 21916truncation towards zero. 21917 21918@item @samp{round} 21919Conversion from single-precision floating point to signed integer, 21920rounding to the nearest integer and ties away from zero. 21921This corresponds to the @code{__builtin_lroundf} function when 21922@option{-fno-math-errno} is used. 21923 21924@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 21925Conversion from signed or unsigned integer types to floating-point types. 21926 21927@end table 21928 21929In addition, all of the following transfer instructions for internal 21930registers X and Y must be provided to use any of the double-precision 21931floating-point instructions. Custom instructions taking two 21932double-precision source operands expect the first operand in the 2193364-bit register X. The other operand (or only operand of a unary 21934operation) is given to the custom arithmetic instruction with the 21935least significant half in source register @var{src1} and the most 21936significant half in @var{src2}. A custom instruction that returns a 21937double-precision result returns the most significant 32 bits in the 21938destination register and the other half in 32-bit register Y. 21939GCC automatically generates the necessary code sequences to write 21940register X and/or read register Y when double-precision floating-point 21941instructions are used. 21942 21943@table @asis 21944 21945@item @samp{fwrx} 21946Write @var{src1} into the least significant half of X and @var{src2} into 21947the most significant half of X. 21948 21949@item @samp{fwry} 21950Write @var{src1} into Y. 21951 21952@item @samp{frdxhi}, @samp{frdxlo} 21953Read the most or least (respectively) significant half of X and store it in 21954@var{dest}. 21955 21956@item @samp{frdy} 21957Read the value of Y and store it into @var{dest}. 21958@end table 21959 21960Note that you can gain more local control over generation of Nios II custom 21961instructions by using the @code{target("custom-@var{insn}=@var{N}")} 21962and @code{target("no-custom-@var{insn}")} function attributes 21963(@pxref{Function Attributes}) 21964or pragmas (@pxref{Function Specific Option Pragmas}). 21965 21966@item -mcustom-fpu-cfg=@var{name} 21967@opindex mcustom-fpu-cfg 21968 21969This option enables a predefined, named set of custom instruction encodings 21970(see @option{-mcustom-@var{insn}} above). 21971Currently, the following sets are defined: 21972 21973@option{-mcustom-fpu-cfg=60-1} is equivalent to: 21974@gccoptlist{-mcustom-fmuls=252 @gol 21975-mcustom-fadds=253 @gol 21976-mcustom-fsubs=254 @gol 21977-fsingle-precision-constant} 21978 21979@option{-mcustom-fpu-cfg=60-2} is equivalent to: 21980@gccoptlist{-mcustom-fmuls=252 @gol 21981-mcustom-fadds=253 @gol 21982-mcustom-fsubs=254 @gol 21983-mcustom-fdivs=255 @gol 21984-fsingle-precision-constant} 21985 21986@option{-mcustom-fpu-cfg=72-3} is equivalent to: 21987@gccoptlist{-mcustom-floatus=243 @gol 21988-mcustom-fixsi=244 @gol 21989-mcustom-floatis=245 @gol 21990-mcustom-fcmpgts=246 @gol 21991-mcustom-fcmples=249 @gol 21992-mcustom-fcmpeqs=250 @gol 21993-mcustom-fcmpnes=251 @gol 21994-mcustom-fmuls=252 @gol 21995-mcustom-fadds=253 @gol 21996-mcustom-fsubs=254 @gol 21997-mcustom-fdivs=255 @gol 21998-fsingle-precision-constant} 21999 22000Custom instruction assignments given by individual 22001@option{-mcustom-@var{insn}=} options override those given by 22002@option{-mcustom-fpu-cfg=}, regardless of the 22003order of the options on the command line. 22004 22005Note that you can gain more local control over selection of a FPU 22006configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 22007function attribute (@pxref{Function Attributes}) 22008or pragma (@pxref{Function Specific Option Pragmas}). 22009 22010@end table 22011 22012These additional @samp{-m} options are available for the Altera Nios II 22013ELF (bare-metal) target: 22014 22015@table @gcctabopt 22016 22017@item -mhal 22018@opindex mhal 22019Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 22020startup and termination code, and is typically used in conjunction with 22021@option{-msys-crt0=} to specify the location of the alternate startup code 22022provided by the HAL BSP. 22023 22024@item -msmallc 22025@opindex msmallc 22026Link with a limited version of the C library, @option{-lsmallc}, rather than 22027Newlib. 22028 22029@item -msys-crt0=@var{startfile} 22030@opindex msys-crt0 22031@var{startfile} is the file name of the startfile (crt0) to use 22032when linking. This option is only useful in conjunction with @option{-mhal}. 22033 22034@item -msys-lib=@var{systemlib} 22035@opindex msys-lib 22036@var{systemlib} is the library name of the library that provides 22037low-level system calls required by the C library, 22038e.g. @code{read} and @code{write}. 22039This option is typically used to link with a library provided by a HAL BSP. 22040 22041@end table 22042 22043@node Nvidia PTX Options 22044@subsection Nvidia PTX Options 22045@cindex Nvidia PTX options 22046@cindex nvptx options 22047 22048These options are defined for Nvidia PTX: 22049 22050@table @gcctabopt 22051 22052@item -m32 22053@itemx -m64 22054@opindex m32 22055@opindex m64 22056Generate code for 32-bit or 64-bit ABI. 22057 22058@item -mmainkernel 22059@opindex mmainkernel 22060Link in code for a __main kernel. This is for stand-alone instead of 22061offloading execution. 22062 22063@item -moptimize 22064@opindex moptimize 22065Apply partitioned execution optimizations. This is the default when any 22066level of optimization is selected. 22067 22068@item -msoft-stack 22069@opindex msoft-stack 22070Generate code that does not use @code{.local} memory 22071directly for stack storage. Instead, a per-warp stack pointer is 22072maintained explicitly. This enables variable-length stack allocation (with 22073variable-length arrays or @code{alloca}), and when global memory is used for 22074underlying storage, makes it possible to access automatic variables from other 22075threads, or with atomic instructions. This code generation variant is used 22076for OpenMP offloading, but the option is exposed on its own for the purpose 22077of testing the compiler; to generate code suitable for linking into programs 22078using OpenMP offloading, use option @option{-mgomp}. 22079 22080@item -muniform-simt 22081@opindex muniform-simt 22082Switch to code generation variant that allows to execute all threads in each 22083warp, while maintaining memory state and side effects as if only one thread 22084in each warp was active outside of OpenMP SIMD regions. All atomic operations 22085and calls to runtime (malloc, free, vprintf) are conditionally executed (iff 22086current lane index equals the master lane index), and the register being 22087assigned is copied via a shuffle instruction from the master lane. Outside of 22088SIMD regions lane 0 is the master; inside, each thread sees itself as the 22089master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or 22090all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD 22091regions). Each thread can bitwise-and the bitmask at position @code{tid.y} 22092with current lane index to compute the master lane index. 22093 22094@item -mgomp 22095@opindex mgomp 22096Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and 22097@option{-muniform-simt} options, and selects corresponding multilib variant. 22098 22099@end table 22100 22101@node PDP-11 Options 22102@subsection PDP-11 Options 22103@cindex PDP-11 Options 22104 22105These options are defined for the PDP-11: 22106 22107@table @gcctabopt 22108@item -mfpu 22109@opindex mfpu 22110Use hardware FPP floating point. This is the default. (FIS floating 22111point on the PDP-11/40 is not supported.) 22112 22113@item -msoft-float 22114@opindex msoft-float 22115Do not use hardware floating point. 22116 22117@item -mac0 22118@opindex mac0 22119Return floating-point results in ac0 (fr0 in Unix assembler syntax). 22120 22121@item -mno-ac0 22122@opindex mno-ac0 22123Return floating-point results in memory. This is the default. 22124 22125@item -m40 22126@opindex m40 22127Generate code for a PDP-11/40. 22128 22129@item -m45 22130@opindex m45 22131Generate code for a PDP-11/45. This is the default. 22132 22133@item -m10 22134@opindex m10 22135Generate code for a PDP-11/10. 22136 22137@item -mbcopy-builtin 22138@opindex mbcopy-builtin 22139Use inline @code{movmemhi} patterns for copying memory. This is the 22140default. 22141 22142@item -mbcopy 22143@opindex mbcopy 22144Do not use inline @code{movmemhi} patterns for copying memory. 22145 22146@item -mint16 22147@itemx -mno-int32 22148@opindex mint16 22149@opindex mno-int32 22150Use 16-bit @code{int}. This is the default. 22151 22152@item -mint32 22153@itemx -mno-int16 22154@opindex mint32 22155@opindex mno-int16 22156Use 32-bit @code{int}. 22157 22158@item -mfloat64 22159@itemx -mno-float32 22160@opindex mfloat64 22161@opindex mno-float32 22162Use 64-bit @code{float}. This is the default. 22163 22164@item -mfloat32 22165@itemx -mno-float64 22166@opindex mfloat32 22167@opindex mno-float64 22168Use 32-bit @code{float}. 22169 22170@item -mabshi 22171@opindex mabshi 22172Use @code{abshi2} pattern. This is the default. 22173 22174@item -mno-abshi 22175@opindex mno-abshi 22176Do not use @code{abshi2} pattern. 22177 22178@item -mbranch-expensive 22179@opindex mbranch-expensive 22180Pretend that branches are expensive. This is for experimenting with 22181code generation only. 22182 22183@item -mbranch-cheap 22184@opindex mbranch-cheap 22185Do not pretend that branches are expensive. This is the default. 22186 22187@item -munix-asm 22188@opindex munix-asm 22189Use Unix assembler syntax. This is the default when configured for 22190@samp{pdp11-*-bsd}. 22191 22192@item -mdec-asm 22193@opindex mdec-asm 22194Use DEC assembler syntax. This is the default when configured for any 22195PDP-11 target other than @samp{pdp11-*-bsd}. 22196@end table 22197 22198@node picoChip Options 22199@subsection picoChip Options 22200@cindex picoChip options 22201 22202These @samp{-m} options are defined for picoChip implementations: 22203 22204@table @gcctabopt 22205 22206@item -mae=@var{ae_type} 22207@opindex mcpu 22208Set the instruction set, register set, and instruction scheduling 22209parameters for array element type @var{ae_type}. Supported values 22210for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 22211 22212@option{-mae=ANY} selects a completely generic AE type. Code 22213generated with this option runs on any of the other AE types. The 22214code is not as efficient as it would be if compiled for a specific 22215AE type, and some types of operation (e.g., multiplication) do not 22216work properly on all types of AE. 22217 22218@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 22219for compiled code, and is the default. 22220 22221@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 22222option may suffer from poor performance of byte (char) manipulation, 22223since the DSP AE does not provide hardware support for byte load/stores. 22224 22225@item -msymbol-as-address 22226Enable the compiler to directly use a symbol name as an address in a 22227load/store instruction, without first loading it into a 22228register. Typically, the use of this option generates larger 22229programs, which run faster than when the option isn't used. However, the 22230results vary from program to program, so it is left as a user option, 22231rather than being permanently enabled. 22232 22233@item -mno-inefficient-warnings 22234Disables warnings about the generation of inefficient code. These 22235warnings can be generated, for example, when compiling code that 22236performs byte-level memory operations on the MAC AE type. The MAC AE has 22237no hardware support for byte-level memory operations, so all byte 22238load/stores must be synthesized from word load/store operations. This is 22239inefficient and a warning is generated to indicate 22240that you should rewrite the code to avoid byte operations, or to target 22241an AE type that has the necessary hardware support. This option disables 22242these warnings. 22243 22244@end table 22245 22246@node PowerPC Options 22247@subsection PowerPC Options 22248@cindex PowerPC options 22249 22250These are listed under @xref{RS/6000 and PowerPC Options}. 22251 22252@node PowerPC SPE Options 22253@subsection PowerPC SPE Options 22254@cindex PowerPC SPE options 22255 22256These @samp{-m} options are defined for PowerPC SPE: 22257@table @gcctabopt 22258@item -mmfcrf 22259@itemx -mno-mfcrf 22260@itemx -mpopcntb 22261@itemx -mno-popcntb 22262@opindex mmfcrf 22263@opindex mno-mfcrf 22264@opindex mpopcntb 22265@opindex mno-popcntb 22266You use these options to specify which instructions are available on the 22267processor you are using. The default value of these options is 22268determined when configuring GCC@. Specifying the 22269@option{-mcpu=@var{cpu_type}} overrides the specification of these 22270options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 22271rather than the options listed above. 22272 22273The @option{-mmfcrf} option allows GCC to generate the move from 22274condition register field instruction implemented on the POWER4 22275processor and other processors that support the PowerPC V2.01 22276architecture. 22277The @option{-mpopcntb} option allows GCC to generate the popcount and 22278double-precision FP reciprocal estimate instruction implemented on the 22279POWER5 processor and other processors that support the PowerPC V2.02 22280architecture. 22281 22282@item -mcpu=@var{cpu_type} 22283@opindex mcpu 22284Set architecture type, register usage, and 22285instruction scheduling parameters for machine type @var{cpu_type}. 22286Supported values for @var{cpu_type} are @samp{8540}, @samp{8548}, 22287and @samp{native}. 22288 22289@option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either 22290endian), with an appropriate, generic processor model assumed for 22291scheduling purposes. 22292 22293Specifying @samp{native} as cpu type detects and selects the 22294architecture option that corresponds to the host processor of the 22295system performing the compilation. 22296@option{-mcpu=native} has no effect if GCC does not recognize the 22297processor. 22298 22299The other options specify a specific processor. Code generated under 22300those options runs best on that processor, and may not run at all on 22301others. 22302 22303The @option{-mcpu} options automatically enable or disable the 22304following options: 22305 22306@gccoptlist{-mhard-float -mmfcrf -mmultiple @gol 22307-mpopcntb -mpopcntd @gol 22308-msingle-float -mdouble-float @gol 22309-mfloat128} 22310 22311The particular options set for any particular CPU varies between 22312compiler versions, depending on what setting seems to produce optimal 22313code for that CPU; it doesn't necessarily reflect the actual hardware's 22314capabilities. If you wish to set an individual option to a particular 22315value, you may specify it after the @option{-mcpu} option, like 22316@option{-mcpu=8548}. 22317 22318@item -mtune=@var{cpu_type} 22319@opindex mtune 22320Set the instruction scheduling parameters for machine type 22321@var{cpu_type}, but do not set the architecture type or register usage, 22322as @option{-mcpu=@var{cpu_type}} does. The same 22323values for @var{cpu_type} are used for @option{-mtune} as for 22324@option{-mcpu}. If both are specified, the code generated uses the 22325architecture and registers set by @option{-mcpu}, but the 22326scheduling parameters set by @option{-mtune}. 22327 22328@item -msecure-plt 22329@opindex msecure-plt 22330Generate code that allows @command{ld} and @command{ld.so} 22331to build executables and shared 22332libraries with non-executable @code{.plt} and @code{.got} sections. 22333This is a PowerPC 2233432-bit SYSV ABI option. 22335 22336@item -mbss-plt 22337@opindex mbss-plt 22338Generate code that uses a BSS @code{.plt} section that @command{ld.so} 22339fills in, and 22340requires @code{.plt} and @code{.got} 22341sections that are both writable and executable. 22342This is a PowerPC 32-bit SYSV ABI option. 22343 22344@item -misel 22345@itemx -mno-isel 22346@opindex misel 22347@opindex mno-isel 22348This switch enables or disables the generation of ISEL instructions. 22349 22350@item -misel=@var{yes/no} 22351This switch has been deprecated. Use @option{-misel} and 22352@option{-mno-isel} instead. 22353 22354@item -mspe 22355@itemx -mno-spe 22356@opindex mspe 22357@opindex mno-spe 22358This switch enables or disables the generation of SPE simd 22359instructions. 22360 22361@item -mspe=@var{yes/no} 22362This option has been deprecated. Use @option{-mspe} and 22363@option{-mno-spe} instead. 22364 22365@item -mfloat128 22366@itemx -mno-float128 22367@opindex mfloat128 22368@opindex mno-float128 22369Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point 22370and use either software emulation for IEEE 128-bit floating point or 22371hardware instructions. 22372 22373@item -mfloat-gprs=@var{yes/single/double/no} 22374@itemx -mfloat-gprs 22375@opindex mfloat-gprs 22376This switch enables or disables the generation of floating-point 22377operations on the general-purpose registers for architectures that 22378support it. 22379 22380The argument @samp{yes} or @samp{single} enables the use of 22381single-precision floating-point operations. 22382 22383The argument @samp{double} enables the use of single and 22384double-precision floating-point operations. 22385 22386The argument @samp{no} disables floating-point operations on the 22387general-purpose registers. 22388 22389This option is currently only available on the MPC854x. 22390 22391@item -mfull-toc 22392@itemx -mno-fp-in-toc 22393@itemx -mno-sum-in-toc 22394@itemx -mminimal-toc 22395@opindex mfull-toc 22396@opindex mno-fp-in-toc 22397@opindex mno-sum-in-toc 22398@opindex mminimal-toc 22399Modify generation of the TOC (Table Of Contents), which is created for 22400every executable file. The @option{-mfull-toc} option is selected by 22401default. In that case, GCC allocates at least one TOC entry for 22402each unique non-automatic variable reference in your program. GCC 22403also places floating-point constants in the TOC@. However, only 2240416,384 entries are available in the TOC@. 22405 22406If you receive a linker error message that saying you have overflowed 22407the available TOC space, you can reduce the amount of TOC space used 22408with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 22409@option{-mno-fp-in-toc} prevents GCC from putting floating-point 22410constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 22411generate code to calculate the sum of an address and a constant at 22412run time instead of putting that sum into the TOC@. You may specify one 22413or both of these options. Each causes GCC to produce very slightly 22414slower and larger code at the expense of conserving TOC space. 22415 22416If you still run out of space in the TOC even when you specify both of 22417these options, specify @option{-mminimal-toc} instead. This option causes 22418GCC to make only one TOC entry for every file. When you specify this 22419option, GCC produces code that is slower and larger but which 22420uses extremely little TOC space. You may wish to use this option 22421only on files that contain less frequently-executed code. 22422 22423@item -maix32 22424@opindex maix32 22425Disables the 64-bit ABI. GCC defaults to @option{-maix32}. 22426 22427@item -mxl-compat 22428@itemx -mno-xl-compat 22429@opindex mxl-compat 22430@opindex mno-xl-compat 22431Produce code that conforms more closely to IBM XL compiler semantics 22432when using AIX-compatible ABI@. Pass floating-point arguments to 22433prototyped functions beyond the register save area (RSA) on the stack 22434in addition to argument FPRs. Do not assume that most significant 22435double in 128-bit long double value is properly rounded when comparing 22436values and converting to double. Use XL symbol names for long double 22437support routines. 22438 22439The AIX calling convention was extended but not initially documented to 22440handle an obscure K&R C case of calling a function that takes the 22441address of its arguments with fewer arguments than declared. IBM XL 22442compilers access floating-point arguments that do not fit in the 22443RSA from the stack when a subroutine is compiled without 22444optimization. Because always storing floating-point arguments on the 22445stack is inefficient and rarely needed, this option is not enabled by 22446default and only is necessary when calling subroutines compiled by IBM 22447XL compilers without optimization. 22448 22449@item -malign-natural 22450@itemx -malign-power 22451@opindex malign-natural 22452@opindex malign-power 22453On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 22454@option{-malign-natural} overrides the ABI-defined alignment of larger 22455types, such as floating-point doubles, on their natural size-based boundary. 22456The option @option{-malign-power} instructs GCC to follow the ABI-specified 22457alignment rules. GCC defaults to the standard alignment defined in the ABI@. 22458 22459On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 22460is not supported. 22461 22462@item -msoft-float 22463@itemx -mhard-float 22464@opindex msoft-float 22465@opindex mhard-float 22466Generate code that does not use (uses) the floating-point register set. 22467Software floating-point emulation is provided if you use the 22468@option{-msoft-float} option, and pass the option to GCC when linking. 22469 22470@item -msingle-float 22471@itemx -mdouble-float 22472@opindex msingle-float 22473@opindex mdouble-float 22474Generate code for single- or double-precision floating-point operations. 22475@option{-mdouble-float} implies @option{-msingle-float}. 22476 22477@item -mmultiple 22478@itemx -mno-multiple 22479@opindex mmultiple 22480@opindex mno-multiple 22481Generate code that uses (does not use) the load multiple word 22482instructions and the store multiple word instructions. These 22483instructions are generated by default on POWER systems, and not 22484generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 22485PowerPC systems, since those instructions do not work when the 22486processor is in little-endian mode. The exceptions are PPC740 and 22487PPC750 which permit these instructions in little-endian mode. 22488 22489@item -mupdate 22490@itemx -mno-update 22491@opindex mupdate 22492@opindex mno-update 22493Generate code that uses (does not use) the load or store instructions 22494that update the base register to the address of the calculated memory 22495location. These instructions are generated by default. If you use 22496@option{-mno-update}, there is a small window between the time that the 22497stack pointer is updated and the address of the previous frame is 22498stored, which means code that walks the stack frame across interrupts or 22499signals may get corrupted data. 22500 22501@item -mavoid-indexed-addresses 22502@itemx -mno-avoid-indexed-addresses 22503@opindex mavoid-indexed-addresses 22504@opindex mno-avoid-indexed-addresses 22505Generate code that tries to avoid (not avoid) the use of indexed load 22506or store instructions. These instructions can incur a performance 22507penalty on Power6 processors in certain situations, such as when 22508stepping through large arrays that cross a 16M boundary. This option 22509is enabled by default when targeting Power6 and disabled otherwise. 22510 22511@item -mfused-madd 22512@itemx -mno-fused-madd 22513@opindex mfused-madd 22514@opindex mno-fused-madd 22515Generate code that uses (does not use) the floating-point multiply and 22516accumulate instructions. These instructions are generated by default 22517if hardware floating point is used. The machine-dependent 22518@option{-mfused-madd} option is now mapped to the machine-independent 22519@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 22520mapped to @option{-ffp-contract=off}. 22521 22522@item -mno-strict-align 22523@itemx -mstrict-align 22524@opindex mno-strict-align 22525@opindex mstrict-align 22526On System V.4 and embedded PowerPC systems do not (do) assume that 22527unaligned memory references are handled by the system. 22528 22529@item -mrelocatable 22530@itemx -mno-relocatable 22531@opindex mrelocatable 22532@opindex mno-relocatable 22533Generate code that allows (does not allow) a static executable to be 22534relocated to a different address at run time. A simple embedded 22535PowerPC system loader should relocate the entire contents of 22536@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 22537a table of 32-bit addresses generated by this option. For this to 22538work, all objects linked together must be compiled with 22539@option{-mrelocatable} or @option{-mrelocatable-lib}. 22540@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 22541 22542@item -mrelocatable-lib 22543@itemx -mno-relocatable-lib 22544@opindex mrelocatable-lib 22545@opindex mno-relocatable-lib 22546Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 22547@code{.fixup} section to allow static executables to be relocated at 22548run time, but @option{-mrelocatable-lib} does not use the smaller stack 22549alignment of @option{-mrelocatable}. Objects compiled with 22550@option{-mrelocatable-lib} may be linked with objects compiled with 22551any combination of the @option{-mrelocatable} options. 22552 22553@item -mno-toc 22554@itemx -mtoc 22555@opindex mno-toc 22556@opindex mtoc 22557On System V.4 and embedded PowerPC systems do not (do) assume that 22558register 2 contains a pointer to a global area pointing to the addresses 22559used in the program. 22560 22561@item -mlittle 22562@itemx -mlittle-endian 22563@opindex mlittle 22564@opindex mlittle-endian 22565On System V.4 and embedded PowerPC systems compile code for the 22566processor in little-endian mode. The @option{-mlittle-endian} option is 22567the same as @option{-mlittle}. 22568 22569@item -mbig 22570@itemx -mbig-endian 22571@opindex mbig 22572@opindex mbig-endian 22573On System V.4 and embedded PowerPC systems compile code for the 22574processor in big-endian mode. The @option{-mbig-endian} option is 22575the same as @option{-mbig}. 22576 22577@item -mdynamic-no-pic 22578@opindex mdynamic-no-pic 22579On Darwin and Mac OS X systems, compile code so that it is not 22580relocatable, but that its external references are relocatable. The 22581resulting code is suitable for applications, but not shared 22582libraries. 22583 22584@item -msingle-pic-base 22585@opindex msingle-pic-base 22586Treat the register used for PIC addressing as read-only, rather than 22587loading it in the prologue for each function. The runtime system is 22588responsible for initializing this register with an appropriate value 22589before execution begins. 22590 22591@item -mprioritize-restricted-insns=@var{priority} 22592@opindex mprioritize-restricted-insns 22593This option controls the priority that is assigned to 22594dispatch-slot restricted instructions during the second scheduling 22595pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 22596or @samp{2} to assign no, highest, or second-highest (respectively) 22597priority to dispatch-slot restricted 22598instructions. 22599 22600@item -msched-costly-dep=@var{dependence_type} 22601@opindex msched-costly-dep 22602This option controls which dependences are considered costly 22603by the target during instruction scheduling. The argument 22604@var{dependence_type} takes one of the following values: 22605 22606@table @asis 22607@item @samp{no} 22608No dependence is costly. 22609 22610@item @samp{all} 22611All dependences are costly. 22612 22613@item @samp{true_store_to_load} 22614A true dependence from store to load is costly. 22615 22616@item @samp{store_to_load} 22617Any dependence from store to load is costly. 22618 22619@item @var{number} 22620Any dependence for which the latency is greater than or equal to 22621@var{number} is costly. 22622@end table 22623 22624@item -minsert-sched-nops=@var{scheme} 22625@opindex minsert-sched-nops 22626This option controls which NOP insertion scheme is used during 22627the second scheduling pass. The argument @var{scheme} takes one of the 22628following values: 22629 22630@table @asis 22631@item @samp{no} 22632Don't insert NOPs. 22633 22634@item @samp{pad} 22635Pad with NOPs any dispatch group that has vacant issue slots, 22636according to the scheduler's grouping. 22637 22638@item @samp{regroup_exact} 22639Insert NOPs to force costly dependent insns into 22640separate groups. Insert exactly as many NOPs as needed to force an insn 22641to a new group, according to the estimated processor grouping. 22642 22643@item @var{number} 22644Insert NOPs to force costly dependent insns into 22645separate groups. Insert @var{number} NOPs to force an insn to a new group. 22646@end table 22647 22648@item -mcall-sysv 22649@opindex mcall-sysv 22650On System V.4 and embedded PowerPC systems compile code using calling 22651conventions that adhere to the March 1995 draft of the System V 22652Application Binary Interface, PowerPC processor supplement. This is the 22653default unless you configured GCC using @samp{powerpc-*-eabiaix}. 22654 22655@item -mcall-sysv-eabi 22656@itemx -mcall-eabi 22657@opindex mcall-sysv-eabi 22658@opindex mcall-eabi 22659Specify both @option{-mcall-sysv} and @option{-meabi} options. 22660 22661@item -mcall-sysv-noeabi 22662@opindex mcall-sysv-noeabi 22663Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 22664 22665@item -mcall-aixdesc 22666@opindex m 22667On System V.4 and embedded PowerPC systems compile code for the AIX 22668operating system. 22669 22670@item -mcall-linux 22671@opindex mcall-linux 22672On System V.4 and embedded PowerPC systems compile code for the 22673Linux-based GNU system. 22674 22675@item -mcall-freebsd 22676@opindex mcall-freebsd 22677On System V.4 and embedded PowerPC systems compile code for the 22678FreeBSD operating system. 22679 22680@item -mcall-netbsd 22681@opindex mcall-netbsd 22682On System V.4 and embedded PowerPC systems compile code for the 22683NetBSD operating system. 22684 22685@item -mcall-openbsd 22686@opindex mcall-netbsd 22687On System V.4 and embedded PowerPC systems compile code for the 22688OpenBSD operating system. 22689 22690@item -maix-struct-return 22691@opindex maix-struct-return 22692Return all structures in memory (as specified by the AIX ABI)@. 22693 22694@item -msvr4-struct-return 22695@opindex msvr4-struct-return 22696Return structures smaller than 8 bytes in registers (as specified by the 22697SVR4 ABI)@. 22698 22699@item -mabi=@var{abi-type} 22700@opindex mabi 22701Extend the current ABI with a particular extension, or remove such extension. 22702Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe}, 22703@samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble}, 22704@samp{elfv1}, @samp{elfv2}@. 22705 22706@item -mabi=spe 22707@opindex mabi=spe 22708Extend the current ABI with SPE ABI extensions. This does not change 22709the default ABI, instead it adds the SPE ABI extensions to the current 22710ABI@. 22711 22712@item -mabi=no-spe 22713@opindex mabi=no-spe 22714Disable Book-E SPE ABI extensions for the current ABI@. 22715 22716@item -mabi=ibmlongdouble 22717@opindex mabi=ibmlongdouble 22718Change the current ABI to use IBM extended-precision long double. 22719This is not likely to work if your system defaults to using IEEE 22720extended-precision long double. If you change the long double type 22721from IEEE extended-precision, the compiler will issue a warning unless 22722you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 22723to be enabled. 22724 22725@item -mabi=ieeelongdouble 22726@opindex mabi=ieeelongdouble 22727Change the current ABI to use IEEE extended-precision long double. 22728This is not likely to work if your system defaults to using IBM 22729extended-precision long double. If you change the long double type 22730from IBM extended-precision, the compiler will issue a warning unless 22731you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 22732to be enabled. 22733 22734@item -mabi=elfv1 22735@opindex mabi=elfv1 22736Change the current ABI to use the ELFv1 ABI. 22737This is the default ABI for big-endian PowerPC 64-bit Linux. 22738Overriding the default ABI requires special system support and is 22739likely to fail in spectacular ways. 22740 22741@item -mabi=elfv2 22742@opindex mabi=elfv2 22743Change the current ABI to use the ELFv2 ABI. 22744This is the default ABI for little-endian PowerPC 64-bit Linux. 22745Overriding the default ABI requires special system support and is 22746likely to fail in spectacular ways. 22747 22748@item -mgnu-attribute 22749@itemx -mno-gnu-attribute 22750@opindex mgnu-attribute 22751@opindex mno-gnu-attribute 22752Emit .gnu_attribute assembly directives to set tag/value pairs in a 22753.gnu.attributes section that specify ABI variations in function 22754parameters or return values. 22755 22756@item -mprototype 22757@itemx -mno-prototype 22758@opindex mprototype 22759@opindex mno-prototype 22760On System V.4 and embedded PowerPC systems assume that all calls to 22761variable argument functions are properly prototyped. Otherwise, the 22762compiler must insert an instruction before every non-prototyped call to 22763set or clear bit 6 of the condition code register (@code{CR}) to 22764indicate whether floating-point values are passed in the floating-point 22765registers in case the function takes variable arguments. With 22766@option{-mprototype}, only calls to prototyped variable argument functions 22767set or clear the bit. 22768 22769@item -msim 22770@opindex msim 22771On embedded PowerPC systems, assume that the startup module is called 22772@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 22773@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 22774configurations. 22775 22776@item -mmvme 22777@opindex mmvme 22778On embedded PowerPC systems, assume that the startup module is called 22779@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 22780@file{libc.a}. 22781 22782@item -mads 22783@opindex mads 22784On embedded PowerPC systems, assume that the startup module is called 22785@file{crt0.o} and the standard C libraries are @file{libads.a} and 22786@file{libc.a}. 22787 22788@item -myellowknife 22789@opindex myellowknife 22790On embedded PowerPC systems, assume that the startup module is called 22791@file{crt0.o} and the standard C libraries are @file{libyk.a} and 22792@file{libc.a}. 22793 22794@item -mvxworks 22795@opindex mvxworks 22796On System V.4 and embedded PowerPC systems, specify that you are 22797compiling for a VxWorks system. 22798 22799@item -memb 22800@opindex memb 22801On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 22802header to indicate that @samp{eabi} extended relocations are used. 22803 22804@item -meabi 22805@itemx -mno-eabi 22806@opindex meabi 22807@opindex mno-eabi 22808On System V.4 and embedded PowerPC systems do (do not) adhere to the 22809Embedded Applications Binary Interface (EABI), which is a set of 22810modifications to the System V.4 specifications. Selecting @option{-meabi} 22811means that the stack is aligned to an 8-byte boundary, a function 22812@code{__eabi} is called from @code{main} to set up the EABI 22813environment, and the @option{-msdata} option can use both @code{r2} and 22814@code{r13} to point to two separate small data areas. Selecting 22815@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 22816no EABI initialization function is called from @code{main}, and the 22817@option{-msdata} option only uses @code{r13} to point to a single 22818small data area. The @option{-meabi} option is on by default if you 22819configured GCC using one of the @samp{powerpc*-*-eabi*} options. 22820 22821@item -msdata=eabi 22822@opindex msdata=eabi 22823On System V.4 and embedded PowerPC systems, put small initialized 22824@code{const} global and static data in the @code{.sdata2} section, which 22825is pointed to by register @code{r2}. Put small initialized 22826non-@code{const} global and static data in the @code{.sdata} section, 22827which is pointed to by register @code{r13}. Put small uninitialized 22828global and static data in the @code{.sbss} section, which is adjacent to 22829the @code{.sdata} section. The @option{-msdata=eabi} option is 22830incompatible with the @option{-mrelocatable} option. The 22831@option{-msdata=eabi} option also sets the @option{-memb} option. 22832 22833@item -msdata=sysv 22834@opindex msdata=sysv 22835On System V.4 and embedded PowerPC systems, put small global and static 22836data in the @code{.sdata} section, which is pointed to by register 22837@code{r13}. Put small uninitialized global and static data in the 22838@code{.sbss} section, which is adjacent to the @code{.sdata} section. 22839The @option{-msdata=sysv} option is incompatible with the 22840@option{-mrelocatable} option. 22841 22842@item -msdata=default 22843@itemx -msdata 22844@opindex msdata=default 22845@opindex msdata 22846On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 22847compile code the same as @option{-msdata=eabi}, otherwise compile code the 22848same as @option{-msdata=sysv}. 22849 22850@item -msdata=data 22851@opindex msdata=data 22852On System V.4 and embedded PowerPC systems, put small global 22853data in the @code{.sdata} section. Put small uninitialized global 22854data in the @code{.sbss} section. Do not use register @code{r13} 22855to address small data however. This is the default behavior unless 22856other @option{-msdata} options are used. 22857 22858@item -msdata=none 22859@itemx -mno-sdata 22860@opindex msdata=none 22861@opindex mno-sdata 22862On embedded PowerPC systems, put all initialized global and static data 22863in the @code{.data} section, and all uninitialized data in the 22864@code{.bss} section. 22865 22866@item -mblock-move-inline-limit=@var{num} 22867@opindex mblock-move-inline-limit 22868Inline all block moves (such as calls to @code{memcpy} or structure 22869copies) less than or equal to @var{num} bytes. The minimum value for 22870@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 22871targets. The default value is target-specific. 22872 22873@item -G @var{num} 22874@opindex G 22875@cindex smaller data references (PowerPC) 22876@cindex .sdata/.sdata2 references (PowerPC) 22877On embedded PowerPC systems, put global and static items less than or 22878equal to @var{num} bytes into the small data or BSS sections instead of 22879the normal data or BSS section. By default, @var{num} is 8. The 22880@option{-G @var{num}} switch is also passed to the linker. 22881All modules should be compiled with the same @option{-G @var{num}} value. 22882 22883@item -mregnames 22884@itemx -mno-regnames 22885@opindex mregnames 22886@opindex mno-regnames 22887On System V.4 and embedded PowerPC systems do (do not) emit register 22888names in the assembly language output using symbolic forms. 22889 22890@item -mlongcall 22891@itemx -mno-longcall 22892@opindex mlongcall 22893@opindex mno-longcall 22894By default assume that all calls are far away so that a longer and more 22895expensive calling sequence is required. This is required for calls 22896farther than 32 megabytes (33,554,432 bytes) from the current location. 22897A short call is generated if the compiler knows 22898the call cannot be that far away. This setting can be overridden by 22899the @code{shortcall} function attribute, or by @code{#pragma 22900longcall(0)}. 22901 22902Some linkers are capable of detecting out-of-range calls and generating 22903glue code on the fly. On these systems, long calls are unnecessary and 22904generate slower code. As of this writing, the AIX linker can do this, 22905as can the GNU linker for PowerPC/64. It is planned to add this feature 22906to the GNU linker for 32-bit PowerPC systems as well. 22907 22908In the future, GCC may ignore all longcall specifications 22909when the linker is known to generate glue. 22910 22911@item -mtls-markers 22912@itemx -mno-tls-markers 22913@opindex mtls-markers 22914@opindex mno-tls-markers 22915Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 22916specifying the function argument. The relocation allows the linker to 22917reliably associate function call with argument setup instructions for 22918TLS optimization, which in turn allows GCC to better schedule the 22919sequence. 22920 22921@item -mrecip 22922@itemx -mno-recip 22923@opindex mrecip 22924This option enables use of the reciprocal estimate and 22925reciprocal square root estimate instructions with additional 22926Newton-Raphson steps to increase precision instead of doing a divide or 22927square root and divide for floating-point arguments. You should use 22928the @option{-ffast-math} option when using @option{-mrecip} (or at 22929least @option{-funsafe-math-optimizations}, 22930@option{-ffinite-math-only}, @option{-freciprocal-math} and 22931@option{-fno-trapping-math}). Note that while the throughput of the 22932sequence is generally higher than the throughput of the non-reciprocal 22933instruction, the precision of the sequence can be decreased by up to 2 22934ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 22935roots. 22936 22937@item -mrecip=@var{opt} 22938@opindex mrecip=opt 22939This option controls which reciprocal estimate instructions 22940may be used. @var{opt} is a comma-separated list of options, which may 22941be preceded by a @code{!} to invert the option: 22942 22943@table @samp 22944 22945@item all 22946Enable all estimate instructions. 22947 22948@item default 22949Enable the default instructions, equivalent to @option{-mrecip}. 22950 22951@item none 22952Disable all estimate instructions, equivalent to @option{-mno-recip}. 22953 22954@item div 22955Enable the reciprocal approximation instructions for both 22956single and double precision. 22957 22958@item divf 22959Enable the single-precision reciprocal approximation instructions. 22960 22961@item divd 22962Enable the double-precision reciprocal approximation instructions. 22963 22964@item rsqrt 22965Enable the reciprocal square root approximation instructions for both 22966single and double precision. 22967 22968@item rsqrtf 22969Enable the single-precision reciprocal square root approximation instructions. 22970 22971@item rsqrtd 22972Enable the double-precision reciprocal square root approximation instructions. 22973 22974@end table 22975 22976So, for example, @option{-mrecip=all,!rsqrtd} enables 22977all of the reciprocal estimate instructions, except for the 22978@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 22979which handle the double-precision reciprocal square root calculations. 22980 22981@item -mrecip-precision 22982@itemx -mno-recip-precision 22983@opindex mrecip-precision 22984Assume (do not assume) that the reciprocal estimate instructions 22985provide higher-precision estimates than is mandated by the PowerPC 22986ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 22987@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 22988The double-precision square root estimate instructions are not generated by 22989default on low-precision machines, since they do not provide an 22990estimate that converges after three steps. 22991 22992@item -mpointers-to-nested-functions 22993@itemx -mno-pointers-to-nested-functions 22994@opindex mpointers-to-nested-functions 22995Generate (do not generate) code to load up the static chain register 22996(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 22997systems where a function pointer points to a 3-word descriptor giving 22998the function address, TOC value to be loaded in register @code{r2}, and 22999static chain value to be loaded in register @code{r11}. The 23000@option{-mpointers-to-nested-functions} is on by default. You cannot 23001call through pointers to nested functions or pointers 23002to functions compiled in other languages that use the static chain if 23003you use @option{-mno-pointers-to-nested-functions}. 23004 23005@item -msave-toc-indirect 23006@itemx -mno-save-toc-indirect 23007@opindex msave-toc-indirect 23008Generate (do not generate) code to save the TOC value in the reserved 23009stack location in the function prologue if the function calls through 23010a pointer on AIX and 64-bit Linux systems. If the TOC value is not 23011saved in the prologue, it is saved just before the call through the 23012pointer. The @option{-mno-save-toc-indirect} option is the default. 23013 23014@item -mcompat-align-parm 23015@itemx -mno-compat-align-parm 23016@opindex mcompat-align-parm 23017Generate (do not generate) code to pass structure parameters with a 23018maximum alignment of 64 bits, for compatibility with older versions 23019of GCC. 23020 23021Older versions of GCC (prior to 4.9.0) incorrectly did not align a 23022structure parameter on a 128-bit boundary when that structure contained 23023a member requiring 128-bit alignment. This is corrected in more 23024recent versions of GCC. This option may be used to generate code 23025that is compatible with functions compiled with older versions of 23026GCC. 23027 23028The @option{-mno-compat-align-parm} option is the default. 23029 23030@item -mstack-protector-guard=@var{guard} 23031@itemx -mstack-protector-guard-reg=@var{reg} 23032@itemx -mstack-protector-guard-offset=@var{offset} 23033@itemx -mstack-protector-guard-symbol=@var{symbol} 23034@opindex mstack-protector-guard 23035@opindex mstack-protector-guard-reg 23036@opindex mstack-protector-guard-offset 23037@opindex mstack-protector-guard-symbol 23038Generate stack protection code using canary at @var{guard}. Supported 23039locations are @samp{global} for global canary or @samp{tls} for per-thread 23040canary in the TLS block (the default with GNU libc version 2.4 or later). 23041 23042With the latter choice the options 23043@option{-mstack-protector-guard-reg=@var{reg}} and 23044@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 23045which register to use as base register for reading the canary, and from what 23046offset from that base register. The default for those is as specified in the 23047relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides 23048the offset with a symbol reference to a canary in the TLS block. 23049@end table 23050 23051 23052@node RISC-V Options 23053@subsection RISC-V Options 23054@cindex RISC-V Options 23055 23056These command-line options are defined for RISC-V targets: 23057 23058@table @gcctabopt 23059@item -mbranch-cost=@var{n} 23060@opindex mbranch-cost 23061Set the cost of branches to roughly @var{n} instructions. 23062 23063@item -mplt 23064@itemx -mno-plt 23065@opindex plt 23066When generating PIC code, do or don't allow the use of PLTs. Ignored for 23067non-PIC. The default is @option{-mplt}. 23068 23069@item -mabi=@var{ABI-string} 23070@opindex mabi 23071Specify integer and floating-point calling convention. @var{ABI-string} 23072contains two parts: the size of integer types and the registers used for 23073floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that 23074@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be 2307532-bit), and that floating-point values up to 64 bits wide are passed in F 23076registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still 23077allows the compiler to generate code that uses the F and D extensions but only 23078allows floating-point values up to 32 bits long to be passed in registers; or 23079@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be 23080passed in registers. 23081 23082The default for this argument is system dependent, users who want a specific 23083calling convention should specify one explicitly. The valid calling 23084conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64}, 23085@samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to 23086implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is 23087invalid because the ABI requires 64-bit values be passed in F registers, but F 23088registers are only 32 bits wide. 23089 23090@item -mfdiv 23091@itemx -mno-fdiv 23092@opindex mfdiv 23093Do or don't use hardware floating-point divide and square root instructions. 23094This requires the F or D extensions for floating-point registers. The default 23095is to use them if the specified architecture has these instructions. 23096 23097@item -mdiv 23098@itemx -mno-div 23099@opindex mdiv 23100Do or don't use hardware instructions for integer division. This requires the 23101M extension. The default is to use them if the specified architecture has 23102these instructions. 23103 23104@item -march=@var{ISA-string} 23105@opindex march 23106Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be 23107lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}. 23108 23109@item -mtune=@var{processor-string} 23110@opindex mtune 23111Optimize the output for the given processor, specified by microarchitecture 23112name. 23113 23114@item -mpreferred-stack-boundary=@var{num} 23115@opindex mpreferred-stack-boundary 23116Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 23117byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 23118the default is 4 (16 bytes or 128-bits). 23119 23120@strong{Warning:} If you use this switch, then you must build all modules with 23121the same value, including any libraries. This includes the system libraries 23122and startup modules. 23123 23124@item -msmall-data-limit=@var{n} 23125@opindex msmall-data-limit 23126Put global and static data smaller than @var{n} bytes into a special section 23127(on some targets). 23128 23129@item -msave-restore 23130@itemx -mno-save-restore 23131@opindex msave-restore 23132Do or don't use smaller but slower prologue and epilogue code that uses 23133library function calls. The default is to use fast inline prologues and 23134epilogues. 23135 23136@item -mstrict-align 23137@itemx -mno-strict-align 23138@opindex mstrict-align 23139Do not or do generate unaligned memory accesses. The default is set depending 23140on whether the processor we are optimizing for supports fast unaligned access 23141or not. 23142 23143@item -mcmodel=medlow 23144@opindex mcmodel=medlow 23145Generate code for the medium-low code model. The program and its statically 23146defined symbols must lie within a single 2 GiB address range and must lie 23147between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be 23148statically or dynamically linked. This is the default code model. 23149 23150@item -mcmodel=medany 23151@opindex mcmodel=medany 23152Generate code for the medium-any code model. The program and its statically 23153defined symbols must be within any single 2 GiB address range. Programs can be 23154statically or dynamically linked. 23155 23156@item -mexplicit-relocs 23157@itemx -mno-exlicit-relocs 23158Use or do not use assembler relocation operators when dealing with symbolic 23159addresses. The alternative is to use assembler macros instead, which may 23160limit optimization. 23161 23162@item -mrelax 23163@itemx -mno-relax 23164Take advantage of linker relaxations to reduce the number of instructions 23165required to materialize symbol addresses. The default is to take advantage of 23166linker relaxations. 23167 23168@end table 23169 23170@node RL78 Options 23171@subsection RL78 Options 23172@cindex RL78 Options 23173 23174@table @gcctabopt 23175 23176@item -msim 23177@opindex msim 23178Links in additional target libraries to support operation within a 23179simulator. 23180 23181@item -mmul=none 23182@itemx -mmul=g10 23183@itemx -mmul=g13 23184@itemx -mmul=g14 23185@itemx -mmul=rl78 23186@opindex mmul 23187Specifies the type of hardware multiplication and division support to 23188be used. The simplest is @code{none}, which uses software for both 23189multiplication and division. This is the default. The @code{g13} 23190value is for the hardware multiply/divide peripheral found on the 23191RL78/G13 (S2 core) targets. The @code{g14} value selects the use of 23192the multiplication and division instructions supported by the RL78/G14 23193(S3 core) parts. The value @code{rl78} is an alias for @code{g14} and 23194the value @code{mg10} is an alias for @code{none}. 23195 23196In addition a C preprocessor macro is defined, based upon the setting 23197of this option. Possible values are: @code{__RL78_MUL_NONE__}, 23198@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}. 23199 23200@item -mcpu=g10 23201@itemx -mcpu=g13 23202@itemx -mcpu=g14 23203@itemx -mcpu=rl78 23204@opindex mcpu 23205Specifies the RL78 core to target. The default is the G14 core, also 23206known as an S3 core or just RL78. The G13 or S2 core does not have 23207multiply or divide instructions, instead it uses a hardware peripheral 23208for these operations. The G10 or S1 core does not have register 23209banks, so it uses a different calling convention. 23210 23211If this option is set it also selects the type of hardware multiply 23212support to use, unless this is overridden by an explicit 23213@option{-mmul=none} option on the command line. Thus specifying 23214@option{-mcpu=g13} enables the use of the G13 hardware multiply 23215peripheral and specifying @option{-mcpu=g10} disables the use of 23216hardware multiplications altogether. 23217 23218Note, although the RL78/G14 core is the default target, specifying 23219@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does 23220change the behavior of the toolchain since it also enables G14 23221hardware multiply support. If these options are not specified on the 23222command line then software multiplication routines will be used even 23223though the code targets the RL78 core. This is for backwards 23224compatibility with older toolchains which did not have hardware 23225multiply and divide support. 23226 23227In addition a C preprocessor macro is defined, based upon the setting 23228of this option. Possible values are: @code{__RL78_G10__}, 23229@code{__RL78_G13__} or @code{__RL78_G14__}. 23230 23231@item -mg10 23232@itemx -mg13 23233@itemx -mg14 23234@itemx -mrl78 23235@opindex mg10 23236@opindex mg13 23237@opindex mg14 23238@opindex mrl78 23239These are aliases for the corresponding @option{-mcpu=} option. They 23240are provided for backwards compatibility. 23241 23242@item -mallregs 23243@opindex mallregs 23244Allow the compiler to use all of the available registers. By default 23245registers @code{r24..r31} are reserved for use in interrupt handlers. 23246With this option enabled these registers can be used in ordinary 23247functions as well. 23248 23249@item -m64bit-doubles 23250@itemx -m32bit-doubles 23251@opindex m64bit-doubles 23252@opindex m32bit-doubles 23253Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 23254or 32 bits (@option{-m32bit-doubles}) in size. The default is 23255@option{-m32bit-doubles}. 23256 23257@item -msave-mduc-in-interrupts 23258@itemx -mno-save-mduc-in-interrupts 23259@opindex msave-mduc-in-interrupts 23260@opindex mno-save-mduc-in-interrupts 23261Specifies that interrupt handler functions should preserve the 23262MDUC registers. This is only necessary if normal code might use 23263the MDUC registers, for example because it performs multiplication 23264and division operations. The default is to ignore the MDUC registers 23265as this makes the interrupt handlers faster. The target option -mg13 23266needs to be passed for this to work as this feature is only available 23267on the G13 target (S2 core). The MDUC registers will only be saved 23268if the interrupt handler performs a multiplication or division 23269operation or it calls another function. 23270 23271@end table 23272 23273@node RS/6000 and PowerPC Options 23274@subsection IBM RS/6000 and PowerPC Options 23275@cindex RS/6000 and PowerPC Options 23276@cindex IBM RS/6000 and PowerPC Options 23277 23278These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 23279@table @gcctabopt 23280@item -mpowerpc-gpopt 23281@itemx -mno-powerpc-gpopt 23282@itemx -mpowerpc-gfxopt 23283@itemx -mno-powerpc-gfxopt 23284@need 800 23285@itemx -mpowerpc64 23286@itemx -mno-powerpc64 23287@itemx -mmfcrf 23288@itemx -mno-mfcrf 23289@itemx -mpopcntb 23290@itemx -mno-popcntb 23291@itemx -mpopcntd 23292@itemx -mno-popcntd 23293@itemx -mfprnd 23294@itemx -mno-fprnd 23295@need 800 23296@itemx -mcmpb 23297@itemx -mno-cmpb 23298@itemx -mmfpgpr 23299@itemx -mno-mfpgpr 23300@itemx -mhard-dfp 23301@itemx -mno-hard-dfp 23302@opindex mpowerpc-gpopt 23303@opindex mno-powerpc-gpopt 23304@opindex mpowerpc-gfxopt 23305@opindex mno-powerpc-gfxopt 23306@opindex mpowerpc64 23307@opindex mno-powerpc64 23308@opindex mmfcrf 23309@opindex mno-mfcrf 23310@opindex mpopcntb 23311@opindex mno-popcntb 23312@opindex mpopcntd 23313@opindex mno-popcntd 23314@opindex mfprnd 23315@opindex mno-fprnd 23316@opindex mcmpb 23317@opindex mno-cmpb 23318@opindex mmfpgpr 23319@opindex mno-mfpgpr 23320@opindex mhard-dfp 23321@opindex mno-hard-dfp 23322You use these options to specify which instructions are available on the 23323processor you are using. The default value of these options is 23324determined when configuring GCC@. Specifying the 23325@option{-mcpu=@var{cpu_type}} overrides the specification of these 23326options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 23327rather than the options listed above. 23328 23329Specifying @option{-mpowerpc-gpopt} allows 23330GCC to use the optional PowerPC architecture instructions in the 23331General Purpose group, including floating-point square root. Specifying 23332@option{-mpowerpc-gfxopt} allows GCC to 23333use the optional PowerPC architecture instructions in the Graphics 23334group, including floating-point select. 23335 23336The @option{-mmfcrf} option allows GCC to generate the move from 23337condition register field instruction implemented on the POWER4 23338processor and other processors that support the PowerPC V2.01 23339architecture. 23340The @option{-mpopcntb} option allows GCC to generate the popcount and 23341double-precision FP reciprocal estimate instruction implemented on the 23342POWER5 processor and other processors that support the PowerPC V2.02 23343architecture. 23344The @option{-mpopcntd} option allows GCC to generate the popcount 23345instruction implemented on the POWER7 processor and other processors 23346that support the PowerPC V2.06 architecture. 23347The @option{-mfprnd} option allows GCC to generate the FP round to 23348integer instructions implemented on the POWER5+ processor and other 23349processors that support the PowerPC V2.03 architecture. 23350The @option{-mcmpb} option allows GCC to generate the compare bytes 23351instruction implemented on the POWER6 processor and other processors 23352that support the PowerPC V2.05 architecture. 23353The @option{-mmfpgpr} option allows GCC to generate the FP move to/from 23354general-purpose register instructions implemented on the POWER6X 23355processor and other processors that support the extended PowerPC V2.05 23356architecture. 23357The @option{-mhard-dfp} option allows GCC to generate the decimal 23358floating-point instructions implemented on some POWER processors. 23359 23360The @option{-mpowerpc64} option allows GCC to generate the additional 2336164-bit instructions that are found in the full PowerPC64 architecture 23362and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 23363@option{-mno-powerpc64}. 23364 23365@item -mcpu=@var{cpu_type} 23366@opindex mcpu 23367Set architecture type, register usage, and 23368instruction scheduling parameters for machine type @var{cpu_type}. 23369Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 23370@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 23371@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 23372@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 23373@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 23374@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 23375@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 23376@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 23377@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 23378@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, 23379@samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le}, 23380@samp{rs64}, and @samp{native}. 23381 23382@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 23383@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 23384endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 23385architecture machine types, with an appropriate, generic processor 23386model assumed for scheduling purposes. 23387 23388Specifying @samp{native} as cpu type detects and selects the 23389architecture option that corresponds to the host processor of the 23390system performing the compilation. 23391@option{-mcpu=native} has no effect if GCC does not recognize the 23392processor. 23393 23394The other options specify a specific processor. Code generated under 23395those options runs best on that processor, and may not run at all on 23396others. 23397 23398The @option{-mcpu} options automatically enable or disable the 23399following options: 23400 23401@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 23402-mpopcntb -mpopcntd -mpowerpc64 @gol 23403-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol 23404-msimple-fpu -mmulhw -mdlmzb -mmfpgpr -mvsx @gol 23405-mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol 23406-mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware} 23407 23408The particular options set for any particular CPU varies between 23409compiler versions, depending on what setting seems to produce optimal 23410code for that CPU; it doesn't necessarily reflect the actual hardware's 23411capabilities. If you wish to set an individual option to a particular 23412value, you may specify it after the @option{-mcpu} option, like 23413@option{-mcpu=970 -mno-altivec}. 23414 23415On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 23416not enabled or disabled by the @option{-mcpu} option at present because 23417AIX does not have full support for these options. You may still 23418enable or disable them individually if you're sure it'll work in your 23419environment. 23420 23421@item -mtune=@var{cpu_type} 23422@opindex mtune 23423Set the instruction scheduling parameters for machine type 23424@var{cpu_type}, but do not set the architecture type or register usage, 23425as @option{-mcpu=@var{cpu_type}} does. The same 23426values for @var{cpu_type} are used for @option{-mtune} as for 23427@option{-mcpu}. If both are specified, the code generated uses the 23428architecture and registers set by @option{-mcpu}, but the 23429scheduling parameters set by @option{-mtune}. 23430 23431@item -mcmodel=small 23432@opindex mcmodel=small 23433Generate PowerPC64 code for the small model: The TOC is limited to 2343464k. 23435 23436@item -mcmodel=medium 23437@opindex mcmodel=medium 23438Generate PowerPC64 code for the medium model: The TOC and other static 23439data may be up to a total of 4G in size. This is the default for 64-bit 23440Linux. 23441 23442@item -mcmodel=large 23443@opindex mcmodel=large 23444Generate PowerPC64 code for the large model: The TOC may be up to 4G 23445in size. Other data and code is only limited by the 64-bit address 23446space. 23447 23448@item -maltivec 23449@itemx -mno-altivec 23450@opindex maltivec 23451@opindex mno-altivec 23452Generate code that uses (does not use) AltiVec instructions, and also 23453enable the use of built-in functions that allow more direct access to 23454the AltiVec instruction set. You may also need to set 23455@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 23456enhancements. 23457 23458When @option{-maltivec} is used, rather than @option{-maltivec=le} or 23459@option{-maltivec=be}, the element order for AltiVec intrinsics such 23460as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 23461match array element order corresponding to the endianness of the 23462target. That is, element zero identifies the leftmost element in a 23463vector register when targeting a big-endian platform, and identifies 23464the rightmost element in a vector register when targeting a 23465little-endian platform. 23466 23467@item -maltivec=be 23468@opindex maltivec=be 23469Generate AltiVec instructions using big-endian element order, 23470regardless of whether the target is big- or little-endian. This is 23471the default when targeting a big-endian platform. Using this option 23472is currently deprecated. Support for this feature will be removed in 23473GCC 9. 23474 23475The element order is used to interpret element numbers in AltiVec 23476intrinsics such as @code{vec_splat}, @code{vec_extract}, and 23477@code{vec_insert}. By default, these match array element order 23478corresponding to the endianness for the target. 23479 23480@item -maltivec=le 23481@opindex maltivec=le 23482Generate AltiVec instructions using little-endian element order, 23483regardless of whether the target is big- or little-endian. This is 23484the default when targeting a little-endian platform. This option is 23485currently ignored when targeting a big-endian platform. 23486 23487The element order is used to interpret element numbers in AltiVec 23488intrinsics such as @code{vec_splat}, @code{vec_extract}, and 23489@code{vec_insert}. By default, these match array element order 23490corresponding to the endianness for the target. 23491 23492@item -mvrsave 23493@itemx -mno-vrsave 23494@opindex mvrsave 23495@opindex mno-vrsave 23496Generate VRSAVE instructions when generating AltiVec code. 23497 23498@item -msecure-plt 23499@opindex msecure-plt 23500Generate code that allows @command{ld} and @command{ld.so} 23501to build executables and shared 23502libraries with non-executable @code{.plt} and @code{.got} sections. 23503This is a PowerPC 2350432-bit SYSV ABI option. 23505 23506@item -mbss-plt 23507@opindex mbss-plt 23508Generate code that uses a BSS @code{.plt} section that @command{ld.so} 23509fills in, and 23510requires @code{.plt} and @code{.got} 23511sections that are both writable and executable. 23512This is a PowerPC 32-bit SYSV ABI option. 23513 23514@item -misel 23515@itemx -mno-isel 23516@opindex misel 23517@opindex mno-isel 23518This switch enables or disables the generation of ISEL instructions. 23519 23520@item -misel=@var{yes/no} 23521This switch has been deprecated. Use @option{-misel} and 23522@option{-mno-isel} instead. 23523 23524@item -mpaired 23525@itemx -mno-paired 23526@opindex mpaired 23527@opindex mno-paired 23528This switch enables or disables the generation of PAIRED simd 23529instructions. 23530 23531@item -mvsx 23532@itemx -mno-vsx 23533@opindex mvsx 23534@opindex mno-vsx 23535Generate code that uses (does not use) vector/scalar (VSX) 23536instructions, and also enable the use of built-in functions that allow 23537more direct access to the VSX instruction set. 23538 23539@item -mcrypto 23540@itemx -mno-crypto 23541@opindex mcrypto 23542@opindex mno-crypto 23543Enable the use (disable) of the built-in functions that allow direct 23544access to the cryptographic instructions that were added in version 235452.07 of the PowerPC ISA. 23546 23547@item -mhtm 23548@itemx -mno-htm 23549@opindex mhtm 23550@opindex mno-htm 23551Enable (disable) the use of the built-in functions that allow direct 23552access to the Hardware Transactional Memory (HTM) instructions that 23553were added in version 2.07 of the PowerPC ISA. 23554 23555@item -mpower8-fusion 23556@itemx -mno-power8-fusion 23557@opindex mpower8-fusion 23558@opindex mno-power8-fusion 23559Generate code that keeps (does not keeps) some integer operations 23560adjacent so that the instructions can be fused together on power8 and 23561later processors. 23562 23563@item -mpower8-vector 23564@itemx -mno-power8-vector 23565@opindex mpower8-vector 23566@opindex mno-power8-vector 23567Generate code that uses (does not use) the vector and scalar 23568instructions that were added in version 2.07 of the PowerPC ISA. Also 23569enable the use of built-in functions that allow more direct access to 23570the vector instructions. 23571 23572@item -mquad-memory 23573@itemx -mno-quad-memory 23574@opindex mquad-memory 23575@opindex mno-quad-memory 23576Generate code that uses (does not use) the non-atomic quad word memory 23577instructions. The @option{-mquad-memory} option requires use of 2357864-bit mode. 23579 23580@item -mquad-memory-atomic 23581@itemx -mno-quad-memory-atomic 23582@opindex mquad-memory-atomic 23583@opindex mno-quad-memory-atomic 23584Generate code that uses (does not use) the atomic quad word memory 23585instructions. The @option{-mquad-memory-atomic} option requires use of 2358664-bit mode. 23587 23588@item -mfloat128 23589@itemx -mno-float128 23590@opindex mfloat128 23591@opindex mno-float128 23592Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point 23593and use either software emulation for IEEE 128-bit floating point or 23594hardware instructions. 23595 23596The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, 23597@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to 23598use the IEEE 128-bit floating point support. The IEEE 128-bit 23599floating point support only works on PowerPC Linux systems. 23600 23601The default for @option{-mfloat128} is enabled on PowerPC Linux 23602systems using the VSX instruction set, and disabled on other systems. 23603 23604If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or 23605@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating 23606point support will also enable the generation of ISA 3.0 IEEE 128-bit 23607floating point instructions. Otherwise, if you do not specify to 23608generate ISA 3.0 instructions or you are targeting a 32-bit big endian 23609system, IEEE 128-bit floating point will be done with software 23610emulation. 23611 23612@item -mfloat128-hardware 23613@itemx -mno-float128-hardware 23614@opindex mfloat128-hardware 23615@opindex mno-float128-hardware 23616Enable/disable using ISA 3.0 hardware instructions to support the 23617@var{__float128} data type. 23618 23619The default for @option{-mfloat128-hardware} is enabled on PowerPC 23620Linux systems using the ISA 3.0 instruction set, and disabled on other 23621systems. 23622 23623@item -m32 23624@itemx -m64 23625@opindex m32 23626@opindex m64 23627Generate code for 32-bit or 64-bit environments of Darwin and SVR4 23628targets (including GNU/Linux). The 32-bit environment sets int, long 23629and pointer to 32 bits and generates code that runs on any PowerPC 23630variant. The 64-bit environment sets int to 32 bits and long and 23631pointer to 64 bits, and generates code for PowerPC64, as for 23632@option{-mpowerpc64}. 23633 23634@item -mfull-toc 23635@itemx -mno-fp-in-toc 23636@itemx -mno-sum-in-toc 23637@itemx -mminimal-toc 23638@opindex mfull-toc 23639@opindex mno-fp-in-toc 23640@opindex mno-sum-in-toc 23641@opindex mminimal-toc 23642Modify generation of the TOC (Table Of Contents), which is created for 23643every executable file. The @option{-mfull-toc} option is selected by 23644default. In that case, GCC allocates at least one TOC entry for 23645each unique non-automatic variable reference in your program. GCC 23646also places floating-point constants in the TOC@. However, only 2364716,384 entries are available in the TOC@. 23648 23649If you receive a linker error message that saying you have overflowed 23650the available TOC space, you can reduce the amount of TOC space used 23651with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 23652@option{-mno-fp-in-toc} prevents GCC from putting floating-point 23653constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 23654generate code to calculate the sum of an address and a constant at 23655run time instead of putting that sum into the TOC@. You may specify one 23656or both of these options. Each causes GCC to produce very slightly 23657slower and larger code at the expense of conserving TOC space. 23658 23659If you still run out of space in the TOC even when you specify both of 23660these options, specify @option{-mminimal-toc} instead. This option causes 23661GCC to make only one TOC entry for every file. When you specify this 23662option, GCC produces code that is slower and larger but which 23663uses extremely little TOC space. You may wish to use this option 23664only on files that contain less frequently-executed code. 23665 23666@item -maix64 23667@itemx -maix32 23668@opindex maix64 23669@opindex maix32 23670Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 23671@code{long} type, and the infrastructure needed to support them. 23672Specifying @option{-maix64} implies @option{-mpowerpc64}, 23673while @option{-maix32} disables the 64-bit ABI and 23674implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 23675 23676@item -mxl-compat 23677@itemx -mno-xl-compat 23678@opindex mxl-compat 23679@opindex mno-xl-compat 23680Produce code that conforms more closely to IBM XL compiler semantics 23681when using AIX-compatible ABI@. Pass floating-point arguments to 23682prototyped functions beyond the register save area (RSA) on the stack 23683in addition to argument FPRs. Do not assume that most significant 23684double in 128-bit long double value is properly rounded when comparing 23685values and converting to double. Use XL symbol names for long double 23686support routines. 23687 23688The AIX calling convention was extended but not initially documented to 23689handle an obscure K&R C case of calling a function that takes the 23690address of its arguments with fewer arguments than declared. IBM XL 23691compilers access floating-point arguments that do not fit in the 23692RSA from the stack when a subroutine is compiled without 23693optimization. Because always storing floating-point arguments on the 23694stack is inefficient and rarely needed, this option is not enabled by 23695default and only is necessary when calling subroutines compiled by IBM 23696XL compilers without optimization. 23697 23698@item -mpe 23699@opindex mpe 23700Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 23701application written to use message passing with special startup code to 23702enable the application to run. The system must have PE installed in the 23703standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 23704must be overridden with the @option{-specs=} option to specify the 23705appropriate directory location. The Parallel Environment does not 23706support threads, so the @option{-mpe} option and the @option{-pthread} 23707option are incompatible. 23708 23709@item -malign-natural 23710@itemx -malign-power 23711@opindex malign-natural 23712@opindex malign-power 23713On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 23714@option{-malign-natural} overrides the ABI-defined alignment of larger 23715types, such as floating-point doubles, on their natural size-based boundary. 23716The option @option{-malign-power} instructs GCC to follow the ABI-specified 23717alignment rules. GCC defaults to the standard alignment defined in the ABI@. 23718 23719On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 23720is not supported. 23721 23722@item -msoft-float 23723@itemx -mhard-float 23724@opindex msoft-float 23725@opindex mhard-float 23726Generate code that does not use (uses) the floating-point register set. 23727Software floating-point emulation is provided if you use the 23728@option{-msoft-float} option, and pass the option to GCC when linking. 23729 23730@item -msingle-float 23731@itemx -mdouble-float 23732@opindex msingle-float 23733@opindex mdouble-float 23734Generate code for single- or double-precision floating-point operations. 23735@option{-mdouble-float} implies @option{-msingle-float}. 23736 23737@item -msimple-fpu 23738@opindex msimple-fpu 23739Do not generate @code{sqrt} and @code{div} instructions for hardware 23740floating-point unit. 23741 23742@item -mfpu=@var{name} 23743@opindex mfpu 23744Specify type of floating-point unit. Valid values for @var{name} are 23745@samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}), 23746@samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}), 23747@samp{sp_full} (equivalent to @option{-msingle-float}), 23748and @samp{dp_full} (equivalent to @option{-mdouble-float}). 23749 23750@item -mxilinx-fpu 23751@opindex mxilinx-fpu 23752Perform optimizations for the floating-point unit on Xilinx PPC 405/440. 23753 23754@item -mmultiple 23755@itemx -mno-multiple 23756@opindex mmultiple 23757@opindex mno-multiple 23758Generate code that uses (does not use) the load multiple word 23759instructions and the store multiple word instructions. These 23760instructions are generated by default on POWER systems, and not 23761generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 23762PowerPC systems, since those instructions do not work when the 23763processor is in little-endian mode. The exceptions are PPC740 and 23764PPC750 which permit these instructions in little-endian mode. 23765 23766@item -mupdate 23767@itemx -mno-update 23768@opindex mupdate 23769@opindex mno-update 23770Generate code that uses (does not use) the load or store instructions 23771that update the base register to the address of the calculated memory 23772location. These instructions are generated by default. If you use 23773@option{-mno-update}, there is a small window between the time that the 23774stack pointer is updated and the address of the previous frame is 23775stored, which means code that walks the stack frame across interrupts or 23776signals may get corrupted data. 23777 23778@item -mavoid-indexed-addresses 23779@itemx -mno-avoid-indexed-addresses 23780@opindex mavoid-indexed-addresses 23781@opindex mno-avoid-indexed-addresses 23782Generate code that tries to avoid (not avoid) the use of indexed load 23783or store instructions. These instructions can incur a performance 23784penalty on Power6 processors in certain situations, such as when 23785stepping through large arrays that cross a 16M boundary. This option 23786is enabled by default when targeting Power6 and disabled otherwise. 23787 23788@item -mfused-madd 23789@itemx -mno-fused-madd 23790@opindex mfused-madd 23791@opindex mno-fused-madd 23792Generate code that uses (does not use) the floating-point multiply and 23793accumulate instructions. These instructions are generated by default 23794if hardware floating point is used. The machine-dependent 23795@option{-mfused-madd} option is now mapped to the machine-independent 23796@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 23797mapped to @option{-ffp-contract=off}. 23798 23799@item -mmulhw 23800@itemx -mno-mulhw 23801@opindex mmulhw 23802@opindex mno-mulhw 23803Generate code that uses (does not use) the half-word multiply and 23804multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 23805These instructions are generated by default when targeting those 23806processors. 23807 23808@item -mdlmzb 23809@itemx -mno-dlmzb 23810@opindex mdlmzb 23811@opindex mno-dlmzb 23812Generate code that uses (does not use) the string-search @samp{dlmzb} 23813instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 23814generated by default when targeting those processors. 23815 23816@item -mno-bit-align 23817@itemx -mbit-align 23818@opindex mno-bit-align 23819@opindex mbit-align 23820On System V.4 and embedded PowerPC systems do not (do) force structures 23821and unions that contain bit-fields to be aligned to the base type of the 23822bit-field. 23823 23824For example, by default a structure containing nothing but 8 23825@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 23826boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 23827the structure is aligned to a 1-byte boundary and is 1 byte in 23828size. 23829 23830@item -mno-strict-align 23831@itemx -mstrict-align 23832@opindex mno-strict-align 23833@opindex mstrict-align 23834On System V.4 and embedded PowerPC systems do not (do) assume that 23835unaligned memory references are handled by the system. 23836 23837@item -mrelocatable 23838@itemx -mno-relocatable 23839@opindex mrelocatable 23840@opindex mno-relocatable 23841Generate code that allows (does not allow) a static executable to be 23842relocated to a different address at run time. A simple embedded 23843PowerPC system loader should relocate the entire contents of 23844@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 23845a table of 32-bit addresses generated by this option. For this to 23846work, all objects linked together must be compiled with 23847@option{-mrelocatable} or @option{-mrelocatable-lib}. 23848@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 23849 23850@item -mrelocatable-lib 23851@itemx -mno-relocatable-lib 23852@opindex mrelocatable-lib 23853@opindex mno-relocatable-lib 23854Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 23855@code{.fixup} section to allow static executables to be relocated at 23856run time, but @option{-mrelocatable-lib} does not use the smaller stack 23857alignment of @option{-mrelocatable}. Objects compiled with 23858@option{-mrelocatable-lib} may be linked with objects compiled with 23859any combination of the @option{-mrelocatable} options. 23860 23861@item -mno-toc 23862@itemx -mtoc 23863@opindex mno-toc 23864@opindex mtoc 23865On System V.4 and embedded PowerPC systems do not (do) assume that 23866register 2 contains a pointer to a global area pointing to the addresses 23867used in the program. 23868 23869@item -mlittle 23870@itemx -mlittle-endian 23871@opindex mlittle 23872@opindex mlittle-endian 23873On System V.4 and embedded PowerPC systems compile code for the 23874processor in little-endian mode. The @option{-mlittle-endian} option is 23875the same as @option{-mlittle}. 23876 23877@item -mbig 23878@itemx -mbig-endian 23879@opindex mbig 23880@opindex mbig-endian 23881On System V.4 and embedded PowerPC systems compile code for the 23882processor in big-endian mode. The @option{-mbig-endian} option is 23883the same as @option{-mbig}. 23884 23885@item -mdynamic-no-pic 23886@opindex mdynamic-no-pic 23887On Darwin and Mac OS X systems, compile code so that it is not 23888relocatable, but that its external references are relocatable. The 23889resulting code is suitable for applications, but not shared 23890libraries. 23891 23892@item -msingle-pic-base 23893@opindex msingle-pic-base 23894Treat the register used for PIC addressing as read-only, rather than 23895loading it in the prologue for each function. The runtime system is 23896responsible for initializing this register with an appropriate value 23897before execution begins. 23898 23899@item -mprioritize-restricted-insns=@var{priority} 23900@opindex mprioritize-restricted-insns 23901This option controls the priority that is assigned to 23902dispatch-slot restricted instructions during the second scheduling 23903pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 23904or @samp{2} to assign no, highest, or second-highest (respectively) 23905priority to dispatch-slot restricted 23906instructions. 23907 23908@item -msched-costly-dep=@var{dependence_type} 23909@opindex msched-costly-dep 23910This option controls which dependences are considered costly 23911by the target during instruction scheduling. The argument 23912@var{dependence_type} takes one of the following values: 23913 23914@table @asis 23915@item @samp{no} 23916No dependence is costly. 23917 23918@item @samp{all} 23919All dependences are costly. 23920 23921@item @samp{true_store_to_load} 23922A true dependence from store to load is costly. 23923 23924@item @samp{store_to_load} 23925Any dependence from store to load is costly. 23926 23927@item @var{number} 23928Any dependence for which the latency is greater than or equal to 23929@var{number} is costly. 23930@end table 23931 23932@item -minsert-sched-nops=@var{scheme} 23933@opindex minsert-sched-nops 23934This option controls which NOP insertion scheme is used during 23935the second scheduling pass. The argument @var{scheme} takes one of the 23936following values: 23937 23938@table @asis 23939@item @samp{no} 23940Don't insert NOPs. 23941 23942@item @samp{pad} 23943Pad with NOPs any dispatch group that has vacant issue slots, 23944according to the scheduler's grouping. 23945 23946@item @samp{regroup_exact} 23947Insert NOPs to force costly dependent insns into 23948separate groups. Insert exactly as many NOPs as needed to force an insn 23949to a new group, according to the estimated processor grouping. 23950 23951@item @var{number} 23952Insert NOPs to force costly dependent insns into 23953separate groups. Insert @var{number} NOPs to force an insn to a new group. 23954@end table 23955 23956@item -mcall-sysv 23957@opindex mcall-sysv 23958On System V.4 and embedded PowerPC systems compile code using calling 23959conventions that adhere to the March 1995 draft of the System V 23960Application Binary Interface, PowerPC processor supplement. This is the 23961default unless you configured GCC using @samp{powerpc-*-eabiaix}. 23962 23963@item -mcall-sysv-eabi 23964@itemx -mcall-eabi 23965@opindex mcall-sysv-eabi 23966@opindex mcall-eabi 23967Specify both @option{-mcall-sysv} and @option{-meabi} options. 23968 23969@item -mcall-sysv-noeabi 23970@opindex mcall-sysv-noeabi 23971Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 23972 23973@item -mcall-aixdesc 23974@opindex m 23975On System V.4 and embedded PowerPC systems compile code for the AIX 23976operating system. 23977 23978@item -mcall-linux 23979@opindex mcall-linux 23980On System V.4 and embedded PowerPC systems compile code for the 23981Linux-based GNU system. 23982 23983@item -mcall-freebsd 23984@opindex mcall-freebsd 23985On System V.4 and embedded PowerPC systems compile code for the 23986FreeBSD operating system. 23987 23988@item -mcall-netbsd 23989@opindex mcall-netbsd 23990On System V.4 and embedded PowerPC systems compile code for the 23991NetBSD operating system. 23992 23993@item -mcall-openbsd 23994@opindex mcall-netbsd 23995On System V.4 and embedded PowerPC systems compile code for the 23996OpenBSD operating system. 23997 23998@item -mtraceback=@var{traceback_type} 23999@opindex mtraceback 24000Select the type of traceback table. Valid values for @var{traceback_type} 24001are @samp{full}, @samp{part}, and @samp{no}. 24002 24003@item -maix-struct-return 24004@opindex maix-struct-return 24005Return all structures in memory (as specified by the AIX ABI)@. 24006 24007@item -msvr4-struct-return 24008@opindex msvr4-struct-return 24009Return structures smaller than 8 bytes in registers (as specified by the 24010SVR4 ABI)@. 24011 24012@item -mabi=@var{abi-type} 24013@opindex mabi 24014Extend the current ABI with a particular extension, or remove such extension. 24015Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe}, 24016@samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble}, 24017@samp{elfv1}, @samp{elfv2}@. 24018 24019@item -mabi=ibmlongdouble 24020@opindex mabi=ibmlongdouble 24021Change the current ABI to use IBM extended-precision long double. 24022This is not likely to work if your system defaults to using IEEE 24023extended-precision long double. If you change the long double type 24024from IEEE extended-precision, the compiler will issue a warning unless 24025you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 24026to be enabled. 24027 24028@item -mabi=ieeelongdouble 24029@opindex mabi=ieeelongdouble 24030Change the current ABI to use IEEE extended-precision long double. 24031This is not likely to work if your system defaults to using IBM 24032extended-precision long double. If you change the long double type 24033from IBM extended-precision, the compiler will issue a warning unless 24034you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128} 24035to be enabled. 24036 24037@item -mabi=elfv1 24038@opindex mabi=elfv1 24039Change the current ABI to use the ELFv1 ABI. 24040This is the default ABI for big-endian PowerPC 64-bit Linux. 24041Overriding the default ABI requires special system support and is 24042likely to fail in spectacular ways. 24043 24044@item -mabi=elfv2 24045@opindex mabi=elfv2 24046Change the current ABI to use the ELFv2 ABI. 24047This is the default ABI for little-endian PowerPC 64-bit Linux. 24048Overriding the default ABI requires special system support and is 24049likely to fail in spectacular ways. 24050 24051@item -mgnu-attribute 24052@itemx -mno-gnu-attribute 24053@opindex mgnu-attribute 24054@opindex mno-gnu-attribute 24055Emit .gnu_attribute assembly directives to set tag/value pairs in a 24056.gnu.attributes section that specify ABI variations in function 24057parameters or return values. 24058 24059@item -mprototype 24060@itemx -mno-prototype 24061@opindex mprototype 24062@opindex mno-prototype 24063On System V.4 and embedded PowerPC systems assume that all calls to 24064variable argument functions are properly prototyped. Otherwise, the 24065compiler must insert an instruction before every non-prototyped call to 24066set or clear bit 6 of the condition code register (@code{CR}) to 24067indicate whether floating-point values are passed in the floating-point 24068registers in case the function takes variable arguments. With 24069@option{-mprototype}, only calls to prototyped variable argument functions 24070set or clear the bit. 24071 24072@item -msim 24073@opindex msim 24074On embedded PowerPC systems, assume that the startup module is called 24075@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 24076@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 24077configurations. 24078 24079@item -mmvme 24080@opindex mmvme 24081On embedded PowerPC systems, assume that the startup module is called 24082@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 24083@file{libc.a}. 24084 24085@item -mads 24086@opindex mads 24087On embedded PowerPC systems, assume that the startup module is called 24088@file{crt0.o} and the standard C libraries are @file{libads.a} and 24089@file{libc.a}. 24090 24091@item -myellowknife 24092@opindex myellowknife 24093On embedded PowerPC systems, assume that the startup module is called 24094@file{crt0.o} and the standard C libraries are @file{libyk.a} and 24095@file{libc.a}. 24096 24097@item -mvxworks 24098@opindex mvxworks 24099On System V.4 and embedded PowerPC systems, specify that you are 24100compiling for a VxWorks system. 24101 24102@item -memb 24103@opindex memb 24104On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 24105header to indicate that @samp{eabi} extended relocations are used. 24106 24107@item -meabi 24108@itemx -mno-eabi 24109@opindex meabi 24110@opindex mno-eabi 24111On System V.4 and embedded PowerPC systems do (do not) adhere to the 24112Embedded Applications Binary Interface (EABI), which is a set of 24113modifications to the System V.4 specifications. Selecting @option{-meabi} 24114means that the stack is aligned to an 8-byte boundary, a function 24115@code{__eabi} is called from @code{main} to set up the EABI 24116environment, and the @option{-msdata} option can use both @code{r2} and 24117@code{r13} to point to two separate small data areas. Selecting 24118@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 24119no EABI initialization function is called from @code{main}, and the 24120@option{-msdata} option only uses @code{r13} to point to a single 24121small data area. The @option{-meabi} option is on by default if you 24122configured GCC using one of the @samp{powerpc*-*-eabi*} options. 24123 24124@item -msdata=eabi 24125@opindex msdata=eabi 24126On System V.4 and embedded PowerPC systems, put small initialized 24127@code{const} global and static data in the @code{.sdata2} section, which 24128is pointed to by register @code{r2}. Put small initialized 24129non-@code{const} global and static data in the @code{.sdata} section, 24130which is pointed to by register @code{r13}. Put small uninitialized 24131global and static data in the @code{.sbss} section, which is adjacent to 24132the @code{.sdata} section. The @option{-msdata=eabi} option is 24133incompatible with the @option{-mrelocatable} option. The 24134@option{-msdata=eabi} option also sets the @option{-memb} option. 24135 24136@item -msdata=sysv 24137@opindex msdata=sysv 24138On System V.4 and embedded PowerPC systems, put small global and static 24139data in the @code{.sdata} section, which is pointed to by register 24140@code{r13}. Put small uninitialized global and static data in the 24141@code{.sbss} section, which is adjacent to the @code{.sdata} section. 24142The @option{-msdata=sysv} option is incompatible with the 24143@option{-mrelocatable} option. 24144 24145@item -msdata=default 24146@itemx -msdata 24147@opindex msdata=default 24148@opindex msdata 24149On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 24150compile code the same as @option{-msdata=eabi}, otherwise compile code the 24151same as @option{-msdata=sysv}. 24152 24153@item -msdata=data 24154@opindex msdata=data 24155On System V.4 and embedded PowerPC systems, put small global 24156data in the @code{.sdata} section. Put small uninitialized global 24157data in the @code{.sbss} section. Do not use register @code{r13} 24158to address small data however. This is the default behavior unless 24159other @option{-msdata} options are used. 24160 24161@item -msdata=none 24162@itemx -mno-sdata 24163@opindex msdata=none 24164@opindex mno-sdata 24165On embedded PowerPC systems, put all initialized global and static data 24166in the @code{.data} section, and all uninitialized data in the 24167@code{.bss} section. 24168 24169@item -mreadonly-in-sdata 24170@itemx -mreadonly-in-sdata 24171@opindex mreadonly-in-sdata 24172@opindex mno-readonly-in-sdata 24173Put read-only objects in the @code{.sdata} section as well. This is the 24174default. 24175 24176@item -mblock-move-inline-limit=@var{num} 24177@opindex mblock-move-inline-limit 24178Inline all block moves (such as calls to @code{memcpy} or structure 24179copies) less than or equal to @var{num} bytes. The minimum value for 24180@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 24181targets. The default value is target-specific. 24182 24183@item -mblock-compare-inline-limit=@var{num} 24184@opindex mblock-compare-inline-limit 24185Generate non-looping inline code for all block compares (such as calls 24186to @code{memcmp} or structure compares) less than or equal to @var{num} 24187bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of 24188block compare is disabled. The default value is target-specific. 24189 24190@item -mblock-compare-inline-loop-limit=@var{num} 24191@opindex mblock-compare-inline-loop-limit 24192Generate an inline expansion using loop code for all block compares that 24193are less than or equal to @var{num} bytes, but greater than the limit 24194for non-loop inline block compare expansion. If the block length is not 24195constant, at most @var{num} bytes will be compared before @code{memcmp} 24196is called to compare the remainder of the block. The default value is 24197target-specific. 24198 24199@item -mstring-compare-inline-limit=@var{num} 24200@opindex mstring-compare-inline-limit 24201Generate at most @var{num} pairs of load instructions to compare the 24202string inline. If the difference or end of string is not found at the 24203end of the inline compare a call to @code{strcmp} or @code{strncmp} will 24204take care of the rest of the comparison. The default is 8 pairs of 24205loads, which will compare 64 bytes on a 64-bit target and 32 bytes on a 2420632-bit target. 24207 24208@item -G @var{num} 24209@opindex G 24210@cindex smaller data references (PowerPC) 24211@cindex .sdata/.sdata2 references (PowerPC) 24212On embedded PowerPC systems, put global and static items less than or 24213equal to @var{num} bytes into the small data or BSS sections instead of 24214the normal data or BSS section. By default, @var{num} is 8. The 24215@option{-G @var{num}} switch is also passed to the linker. 24216All modules should be compiled with the same @option{-G @var{num}} value. 24217 24218@item -mregnames 24219@itemx -mno-regnames 24220@opindex mregnames 24221@opindex mno-regnames 24222On System V.4 and embedded PowerPC systems do (do not) emit register 24223names in the assembly language output using symbolic forms. 24224 24225@item -mlongcall 24226@itemx -mno-longcall 24227@opindex mlongcall 24228@opindex mno-longcall 24229By default assume that all calls are far away so that a longer and more 24230expensive calling sequence is required. This is required for calls 24231farther than 32 megabytes (33,554,432 bytes) from the current location. 24232A short call is generated if the compiler knows 24233the call cannot be that far away. This setting can be overridden by 24234the @code{shortcall} function attribute, or by @code{#pragma 24235longcall(0)}. 24236 24237Some linkers are capable of detecting out-of-range calls and generating 24238glue code on the fly. On these systems, long calls are unnecessary and 24239generate slower code. As of this writing, the AIX linker can do this, 24240as can the GNU linker for PowerPC/64. It is planned to add this feature 24241to the GNU linker for 32-bit PowerPC systems as well. 24242 24243On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 24244callee, L42}, plus a @dfn{branch island} (glue code). The two target 24245addresses represent the callee and the branch island. The 24246Darwin/PPC linker prefers the first address and generates a @code{bl 24247callee} if the PPC @code{bl} instruction reaches the callee directly; 24248otherwise, the linker generates @code{bl L42} to call the branch 24249island. The branch island is appended to the body of the 24250calling function; it computes the full 32-bit address of the callee 24251and jumps to it. 24252 24253On Mach-O (Darwin) systems, this option directs the compiler emit to 24254the glue for every direct call, and the Darwin linker decides whether 24255to use or discard it. 24256 24257In the future, GCC may ignore all longcall specifications 24258when the linker is known to generate glue. 24259 24260@item -mtls-markers 24261@itemx -mno-tls-markers 24262@opindex mtls-markers 24263@opindex mno-tls-markers 24264Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 24265specifying the function argument. The relocation allows the linker to 24266reliably associate function call with argument setup instructions for 24267TLS optimization, which in turn allows GCC to better schedule the 24268sequence. 24269 24270@item -mrecip 24271@itemx -mno-recip 24272@opindex mrecip 24273This option enables use of the reciprocal estimate and 24274reciprocal square root estimate instructions with additional 24275Newton-Raphson steps to increase precision instead of doing a divide or 24276square root and divide for floating-point arguments. You should use 24277the @option{-ffast-math} option when using @option{-mrecip} (or at 24278least @option{-funsafe-math-optimizations}, 24279@option{-ffinite-math-only}, @option{-freciprocal-math} and 24280@option{-fno-trapping-math}). Note that while the throughput of the 24281sequence is generally higher than the throughput of the non-reciprocal 24282instruction, the precision of the sequence can be decreased by up to 2 24283ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 24284roots. 24285 24286@item -mrecip=@var{opt} 24287@opindex mrecip=opt 24288This option controls which reciprocal estimate instructions 24289may be used. @var{opt} is a comma-separated list of options, which may 24290be preceded by a @code{!} to invert the option: 24291 24292@table @samp 24293 24294@item all 24295Enable all estimate instructions. 24296 24297@item default 24298Enable the default instructions, equivalent to @option{-mrecip}. 24299 24300@item none 24301Disable all estimate instructions, equivalent to @option{-mno-recip}. 24302 24303@item div 24304Enable the reciprocal approximation instructions for both 24305single and double precision. 24306 24307@item divf 24308Enable the single-precision reciprocal approximation instructions. 24309 24310@item divd 24311Enable the double-precision reciprocal approximation instructions. 24312 24313@item rsqrt 24314Enable the reciprocal square root approximation instructions for both 24315single and double precision. 24316 24317@item rsqrtf 24318Enable the single-precision reciprocal square root approximation instructions. 24319 24320@item rsqrtd 24321Enable the double-precision reciprocal square root approximation instructions. 24322 24323@end table 24324 24325So, for example, @option{-mrecip=all,!rsqrtd} enables 24326all of the reciprocal estimate instructions, except for the 24327@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 24328which handle the double-precision reciprocal square root calculations. 24329 24330@item -mrecip-precision 24331@itemx -mno-recip-precision 24332@opindex mrecip-precision 24333Assume (do not assume) that the reciprocal estimate instructions 24334provide higher-precision estimates than is mandated by the PowerPC 24335ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 24336@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 24337The double-precision square root estimate instructions are not generated by 24338default on low-precision machines, since they do not provide an 24339estimate that converges after three steps. 24340 24341@item -mveclibabi=@var{type} 24342@opindex mveclibabi 24343Specifies the ABI type to use for vectorizing intrinsics using an 24344external library. The only type supported at present is @samp{mass}, 24345which specifies to use IBM's Mathematical Acceleration Subsystem 24346(MASS) libraries for vectorizing intrinsics using external libraries. 24347GCC currently emits calls to @code{acosd2}, @code{acosf4}, 24348@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 24349@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 24350@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 24351@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 24352@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 24353@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 24354@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 24355@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 24356@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 24357@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 24358@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 24359@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 24360@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 24361for power7. Both @option{-ftree-vectorize} and 24362@option{-funsafe-math-optimizations} must also be enabled. The MASS 24363libraries must be specified at link time. 24364 24365@item -mfriz 24366@itemx -mno-friz 24367@opindex mfriz 24368Generate (do not generate) the @code{friz} instruction when the 24369@option{-funsafe-math-optimizations} option is used to optimize 24370rounding of floating-point values to 64-bit integer and back to floating 24371point. The @code{friz} instruction does not return the same value if 24372the floating-point number is too large to fit in an integer. 24373 24374@item -mpointers-to-nested-functions 24375@itemx -mno-pointers-to-nested-functions 24376@opindex mpointers-to-nested-functions 24377Generate (do not generate) code to load up the static chain register 24378(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 24379systems where a function pointer points to a 3-word descriptor giving 24380the function address, TOC value to be loaded in register @code{r2}, and 24381static chain value to be loaded in register @code{r11}. The 24382@option{-mpointers-to-nested-functions} is on by default. You cannot 24383call through pointers to nested functions or pointers 24384to functions compiled in other languages that use the static chain if 24385you use @option{-mno-pointers-to-nested-functions}. 24386 24387@item -msave-toc-indirect 24388@itemx -mno-save-toc-indirect 24389@opindex msave-toc-indirect 24390Generate (do not generate) code to save the TOC value in the reserved 24391stack location in the function prologue if the function calls through 24392a pointer on AIX and 64-bit Linux systems. If the TOC value is not 24393saved in the prologue, it is saved just before the call through the 24394pointer. The @option{-mno-save-toc-indirect} option is the default. 24395 24396@item -mcompat-align-parm 24397@itemx -mno-compat-align-parm 24398@opindex mcompat-align-parm 24399Generate (do not generate) code to pass structure parameters with a 24400maximum alignment of 64 bits, for compatibility with older versions 24401of GCC. 24402 24403Older versions of GCC (prior to 4.9.0) incorrectly did not align a 24404structure parameter on a 128-bit boundary when that structure contained 24405a member requiring 128-bit alignment. This is corrected in more 24406recent versions of GCC. This option may be used to generate code 24407that is compatible with functions compiled with older versions of 24408GCC. 24409 24410The @option{-mno-compat-align-parm} option is the default. 24411 24412@item -mstack-protector-guard=@var{guard} 24413@itemx -mstack-protector-guard-reg=@var{reg} 24414@itemx -mstack-protector-guard-offset=@var{offset} 24415@itemx -mstack-protector-guard-symbol=@var{symbol} 24416@opindex mstack-protector-guard 24417@opindex mstack-protector-guard-reg 24418@opindex mstack-protector-guard-offset 24419@opindex mstack-protector-guard-symbol 24420Generate stack protection code using canary at @var{guard}. Supported 24421locations are @samp{global} for global canary or @samp{tls} for per-thread 24422canary in the TLS block (the default with GNU libc version 2.4 or later). 24423 24424With the latter choice the options 24425@option{-mstack-protector-guard-reg=@var{reg}} and 24426@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 24427which register to use as base register for reading the canary, and from what 24428offset from that base register. The default for those is as specified in the 24429relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides 24430the offset with a symbol reference to a canary in the TLS block. 24431@end table 24432 24433@node RX Options 24434@subsection RX Options 24435@cindex RX Options 24436 24437These command-line options are defined for RX targets: 24438 24439@table @gcctabopt 24440@item -m64bit-doubles 24441@itemx -m32bit-doubles 24442@opindex m64bit-doubles 24443@opindex m32bit-doubles 24444Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 24445or 32 bits (@option{-m32bit-doubles}) in size. The default is 24446@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 24447works on 32-bit values, which is why the default is 24448@option{-m32bit-doubles}. 24449 24450@item -fpu 24451@itemx -nofpu 24452@opindex fpu 24453@opindex nofpu 24454Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 24455floating-point hardware. The default is enabled for the RX600 24456series and disabled for the RX200 series. 24457 24458Floating-point instructions are only generated for 32-bit floating-point 24459values, however, so the FPU hardware is not used for doubles if the 24460@option{-m64bit-doubles} option is used. 24461 24462@emph{Note} If the @option{-fpu} option is enabled then 24463@option{-funsafe-math-optimizations} is also enabled automatically. 24464This is because the RX FPU instructions are themselves unsafe. 24465 24466@item -mcpu=@var{name} 24467@opindex mcpu 24468Selects the type of RX CPU to be targeted. Currently three types are 24469supported, the generic @samp{RX600} and @samp{RX200} series hardware and 24470the specific @samp{RX610} CPU. The default is @samp{RX600}. 24471 24472The only difference between @samp{RX600} and @samp{RX610} is that the 24473@samp{RX610} does not support the @code{MVTIPL} instruction. 24474 24475The @samp{RX200} series does not have a hardware floating-point unit 24476and so @option{-nofpu} is enabled by default when this type is 24477selected. 24478 24479@item -mbig-endian-data 24480@itemx -mlittle-endian-data 24481@opindex mbig-endian-data 24482@opindex mlittle-endian-data 24483Store data (but not code) in the big-endian format. The default is 24484@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 24485format. 24486 24487@item -msmall-data-limit=@var{N} 24488@opindex msmall-data-limit 24489Specifies the maximum size in bytes of global and static variables 24490which can be placed into the small data area. Using the small data 24491area can lead to smaller and faster code, but the size of area is 24492limited and it is up to the programmer to ensure that the area does 24493not overflow. Also when the small data area is used one of the RX's 24494registers (usually @code{r13}) is reserved for use pointing to this 24495area, so it is no longer available for use by the compiler. This 24496could result in slower and/or larger code if variables are pushed onto 24497the stack instead of being held in this register. 24498 24499Note, common variables (variables that have not been initialized) and 24500constants are not placed into the small data area as they are assigned 24501to other sections in the output executable. 24502 24503The default value is zero, which disables this feature. Note, this 24504feature is not enabled by default with higher optimization levels 24505(@option{-O2} etc) because of the potentially detrimental effects of 24506reserving a register. It is up to the programmer to experiment and 24507discover whether this feature is of benefit to their program. See the 24508description of the @option{-mpid} option for a description of how the 24509actual register to hold the small data area pointer is chosen. 24510 24511@item -msim 24512@itemx -mno-sim 24513@opindex msim 24514@opindex mno-sim 24515Use the simulator runtime. The default is to use the libgloss 24516board-specific runtime. 24517 24518@item -mas100-syntax 24519@itemx -mno-as100-syntax 24520@opindex mas100-syntax 24521@opindex mno-as100-syntax 24522When generating assembler output use a syntax that is compatible with 24523Renesas's AS100 assembler. This syntax can also be handled by the GAS 24524assembler, but it has some restrictions so it is not generated by default. 24525 24526@item -mmax-constant-size=@var{N} 24527@opindex mmax-constant-size 24528Specifies the maximum size, in bytes, of a constant that can be used as 24529an operand in a RX instruction. Although the RX instruction set does 24530allow constants of up to 4 bytes in length to be used in instructions, 24531a longer value equates to a longer instruction. Thus in some 24532circumstances it can be beneficial to restrict the size of constants 24533that are used in instructions. Constants that are too big are instead 24534placed into a constant pool and referenced via register indirection. 24535 24536The value @var{N} can be between 0 and 4. A value of 0 (the default) 24537or 4 means that constants of any size are allowed. 24538 24539@item -mrelax 24540@opindex mrelax 24541Enable linker relaxation. Linker relaxation is a process whereby the 24542linker attempts to reduce the size of a program by finding shorter 24543versions of various instructions. Disabled by default. 24544 24545@item -mint-register=@var{N} 24546@opindex mint-register 24547Specify the number of registers to reserve for fast interrupt handler 24548functions. The value @var{N} can be between 0 and 4. A value of 1 24549means that register @code{r13} is reserved for the exclusive use 24550of fast interrupt handlers. A value of 2 reserves @code{r13} and 24551@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 24552@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 24553A value of 0, the default, does not reserve any registers. 24554 24555@item -msave-acc-in-interrupts 24556@opindex msave-acc-in-interrupts 24557Specifies that interrupt handler functions should preserve the 24558accumulator register. This is only necessary if normal code might use 24559the accumulator register, for example because it performs 64-bit 24560multiplications. The default is to ignore the accumulator as this 24561makes the interrupt handlers faster. 24562 24563@item -mpid 24564@itemx -mno-pid 24565@opindex mpid 24566@opindex mno-pid 24567Enables the generation of position independent data. When enabled any 24568access to constant data is done via an offset from a base address 24569held in a register. This allows the location of constant data to be 24570determined at run time without requiring the executable to be 24571relocated, which is a benefit to embedded applications with tight 24572memory constraints. Data that can be modified is not affected by this 24573option. 24574 24575Note, using this feature reserves a register, usually @code{r13}, for 24576the constant data base address. This can result in slower and/or 24577larger code, especially in complicated functions. 24578 24579The actual register chosen to hold the constant data base address 24580depends upon whether the @option{-msmall-data-limit} and/or the 24581@option{-mint-register} command-line options are enabled. Starting 24582with register @code{r13} and proceeding downwards, registers are 24583allocated first to satisfy the requirements of @option{-mint-register}, 24584then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 24585is possible for the small data area register to be @code{r8} if both 24586@option{-mint-register=4} and @option{-mpid} are specified on the 24587command line. 24588 24589By default this feature is not enabled. The default can be restored 24590via the @option{-mno-pid} command-line option. 24591 24592@item -mno-warn-multiple-fast-interrupts 24593@itemx -mwarn-multiple-fast-interrupts 24594@opindex mno-warn-multiple-fast-interrupts 24595@opindex mwarn-multiple-fast-interrupts 24596Prevents GCC from issuing a warning message if it finds more than one 24597fast interrupt handler when it is compiling a file. The default is to 24598issue a warning for each extra fast interrupt handler found, as the RX 24599only supports one such interrupt. 24600 24601@item -mallow-string-insns 24602@itemx -mno-allow-string-insns 24603@opindex mallow-string-insns 24604@opindex mno-allow-string-insns 24605Enables or disables the use of the string manipulation instructions 24606@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL} 24607@code{SWHILE} and also the @code{RMPA} instruction. These 24608instructions may prefetch data, which is not safe to do if accessing 24609an I/O register. (See section 12.2.7 of the RX62N Group User's Manual 24610for more information). 24611 24612The default is to allow these instructions, but it is not possible for 24613GCC to reliably detect all circumstances where a string instruction 24614might be used to access an I/O register, so their use cannot be 24615disabled automatically. Instead it is reliant upon the programmer to 24616use the @option{-mno-allow-string-insns} option if their program 24617accesses I/O space. 24618 24619When the instructions are enabled GCC defines the C preprocessor 24620symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the 24621symbol @code{__RX_DISALLOW_STRING_INSNS__}. 24622 24623@item -mjsr 24624@itemx -mno-jsr 24625@opindex mjsr 24626@opindex mno-jsr 24627Use only (or not only) @code{JSR} instructions to access functions. 24628This option can be used when code size exceeds the range of @code{BSR} 24629instructions. Note that @option{-mno-jsr} does not mean to not use 24630@code{JSR} but instead means that any type of branch may be used. 24631@end table 24632 24633@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 24634has special significance to the RX port when used with the 24635@code{interrupt} function attribute. This attribute indicates a 24636function intended to process fast interrupts. GCC ensures 24637that it only uses the registers @code{r10}, @code{r11}, @code{r12} 24638and/or @code{r13} and only provided that the normal use of the 24639corresponding registers have been restricted via the 24640@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 24641options. 24642 24643@node S/390 and zSeries Options 24644@subsection S/390 and zSeries Options 24645@cindex S/390 and zSeries Options 24646 24647These are the @samp{-m} options defined for the S/390 and zSeries architecture. 24648 24649@table @gcctabopt 24650@item -mhard-float 24651@itemx -msoft-float 24652@opindex mhard-float 24653@opindex msoft-float 24654Use (do not use) the hardware floating-point instructions and registers 24655for floating-point operations. When @option{-msoft-float} is specified, 24656functions in @file{libgcc.a} are used to perform floating-point 24657operations. When @option{-mhard-float} is specified, the compiler 24658generates IEEE floating-point instructions. This is the default. 24659 24660@item -mhard-dfp 24661@itemx -mno-hard-dfp 24662@opindex mhard-dfp 24663@opindex mno-hard-dfp 24664Use (do not use) the hardware decimal-floating-point instructions for 24665decimal-floating-point operations. When @option{-mno-hard-dfp} is 24666specified, functions in @file{libgcc.a} are used to perform 24667decimal-floating-point operations. When @option{-mhard-dfp} is 24668specified, the compiler generates decimal-floating-point hardware 24669instructions. This is the default for @option{-march=z9-ec} or higher. 24670 24671@item -mlong-double-64 24672@itemx -mlong-double-128 24673@opindex mlong-double-64 24674@opindex mlong-double-128 24675These switches control the size of @code{long double} type. A size 24676of 64 bits makes the @code{long double} type equivalent to the @code{double} 24677type. This is the default. 24678 24679@item -mbackchain 24680@itemx -mno-backchain 24681@opindex mbackchain 24682@opindex mno-backchain 24683Store (do not store) the address of the caller's frame as backchain pointer 24684into the callee's stack frame. 24685A backchain may be needed to allow debugging using tools that do not understand 24686DWARF call frame information. 24687When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 24688at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 24689the backchain is placed into the topmost word of the 96/160 byte register 24690save area. 24691 24692In general, code compiled with @option{-mbackchain} is call-compatible with 24693code compiled with @option{-mmo-backchain}; however, use of the backchain 24694for debugging purposes usually requires that the whole binary is built with 24695@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 24696@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 24697to build a linux kernel use @option{-msoft-float}. 24698 24699The default is to not maintain the backchain. 24700 24701@item -mpacked-stack 24702@itemx -mno-packed-stack 24703@opindex mpacked-stack 24704@opindex mno-packed-stack 24705Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 24706specified, the compiler uses the all fields of the 96/160 byte register save 24707area only for their default purpose; unused fields still take up stack space. 24708When @option{-mpacked-stack} is specified, register save slots are densely 24709packed at the top of the register save area; unused space is reused for other 24710purposes, allowing for more efficient use of the available stack space. 24711However, when @option{-mbackchain} is also in effect, the topmost word of 24712the save area is always used to store the backchain, and the return address 24713register is always saved two words below the backchain. 24714 24715As long as the stack frame backchain is not used, code generated with 24716@option{-mpacked-stack} is call-compatible with code generated with 24717@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 24718S/390 or zSeries generated code that uses the stack frame backchain at run 24719time, not just for debugging purposes. Such code is not call-compatible 24720with code compiled with @option{-mpacked-stack}. Also, note that the 24721combination of @option{-mbackchain}, 24722@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 24723to build a linux kernel use @option{-msoft-float}. 24724 24725The default is to not use the packed stack layout. 24726 24727@item -msmall-exec 24728@itemx -mno-small-exec 24729@opindex msmall-exec 24730@opindex mno-small-exec 24731Generate (or do not generate) code using the @code{bras} instruction 24732to do subroutine calls. 24733This only works reliably if the total executable size does not 24734exceed 64k. The default is to use the @code{basr} instruction instead, 24735which does not have this limitation. 24736 24737@item -m64 24738@itemx -m31 24739@opindex m64 24740@opindex m31 24741When @option{-m31} is specified, generate code compliant to the 24742GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 24743code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 24744particular to generate 64-bit instructions. For the @samp{s390} 24745targets, the default is @option{-m31}, while the @samp{s390x} 24746targets default to @option{-m64}. 24747 24748@item -mzarch 24749@itemx -mesa 24750@opindex mzarch 24751@opindex mesa 24752When @option{-mzarch} is specified, generate code using the 24753instructions available on z/Architecture. 24754When @option{-mesa} is specified, generate code using the 24755instructions available on ESA/390. Note that @option{-mesa} is 24756not possible with @option{-m64}. 24757When generating code compliant to the GNU/Linux for S/390 ABI, 24758the default is @option{-mesa}. When generating code compliant 24759to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 24760 24761@item -mhtm 24762@itemx -mno-htm 24763@opindex mhtm 24764@opindex mno-htm 24765The @option{-mhtm} option enables a set of builtins making use of 24766instructions available with the transactional execution facility 24767introduced with the IBM zEnterprise EC12 machine generation 24768@ref{S/390 System z Built-in Functions}. 24769@option{-mhtm} is enabled by default when using @option{-march=zEC12}. 24770 24771@item -mvx 24772@itemx -mno-vx 24773@opindex mvx 24774@opindex mno-vx 24775When @option{-mvx} is specified, generate code using the instructions 24776available with the vector extension facility introduced with the IBM 24777z13 machine generation. 24778This option changes the ABI for some vector type values with regard to 24779alignment and calling conventions. In case vector type values are 24780being used in an ABI-relevant context a GAS @samp{.gnu_attribute} 24781command will be added to mark the resulting binary with the ABI used. 24782@option{-mvx} is enabled by default when using @option{-march=z13}. 24783 24784@item -mzvector 24785@itemx -mno-zvector 24786@opindex mzvector 24787@opindex mno-zvector 24788The @option{-mzvector} option enables vector language extensions and 24789builtins using instructions available with the vector extension 24790facility introduced with the IBM z13 machine generation. 24791This option adds support for @samp{vector} to be used as a keyword to 24792define vector type variables and arguments. @samp{vector} is only 24793available when GNU extensions are enabled. It will not be expanded 24794when requesting strict standard compliance e.g. with @option{-std=c99}. 24795In addition to the GCC low-level builtins @option{-mzvector} enables 24796a set of builtins added for compatibility with AltiVec-style 24797implementations like Power and Cell. In order to make use of these 24798builtins the header file @file{vecintrin.h} needs to be included. 24799@option{-mzvector} is disabled by default. 24800 24801@item -mmvcle 24802@itemx -mno-mvcle 24803@opindex mmvcle 24804@opindex mno-mvcle 24805Generate (or do not generate) code using the @code{mvcle} instruction 24806to perform block moves. When @option{-mno-mvcle} is specified, 24807use a @code{mvc} loop instead. This is the default unless optimizing for 24808size. 24809 24810@item -mdebug 24811@itemx -mno-debug 24812@opindex mdebug 24813@opindex mno-debug 24814Print (or do not print) additional debug information when compiling. 24815The default is to not print debug information. 24816 24817@item -march=@var{cpu-type} 24818@opindex march 24819Generate code that runs on @var{cpu-type}, which is the name of a 24820system representing a certain processor type. Possible values for 24821@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6}, 24822@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8}, 24823@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, 24824@samp{z14}/@samp{arch12}, and @samp{native}. 24825 24826The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and 24827@samp{g6} are deprecated and will be removed with future releases. 24828 24829Specifying @samp{native} as cpu type can be used to select the best 24830architecture option for the host processor. 24831@option{-march=native} has no effect if GCC does not recognize the 24832processor. 24833 24834@item -mtune=@var{cpu-type} 24835@opindex mtune 24836Tune to @var{cpu-type} everything applicable about the generated code, 24837except for the ABI and the set of available instructions. 24838The list of @var{cpu-type} values is the same as for @option{-march}. 24839The default is the value used for @option{-march}. 24840 24841@item -mtpf-trace 24842@itemx -mno-tpf-trace 24843@opindex mtpf-trace 24844@opindex mno-tpf-trace 24845Generate code that adds (does not add) in TPF OS specific branches to trace 24846routines in the operating system. This option is off by default, even 24847when compiling for the TPF OS@. 24848 24849@item -mfused-madd 24850@itemx -mno-fused-madd 24851@opindex mfused-madd 24852@opindex mno-fused-madd 24853Generate code that uses (does not use) the floating-point multiply and 24854accumulate instructions. These instructions are generated by default if 24855hardware floating point is used. 24856 24857@item -mwarn-framesize=@var{framesize} 24858@opindex mwarn-framesize 24859Emit a warning if the current function exceeds the given frame size. Because 24860this is a compile-time check it doesn't need to be a real problem when the program 24861runs. It is intended to identify functions that most probably cause 24862a stack overflow. It is useful to be used in an environment with limited stack 24863size e.g.@: the linux kernel. 24864 24865@item -mwarn-dynamicstack 24866@opindex mwarn-dynamicstack 24867Emit a warning if the function calls @code{alloca} or uses dynamically-sized 24868arrays. This is generally a bad idea with a limited stack size. 24869 24870@item -mstack-guard=@var{stack-guard} 24871@itemx -mstack-size=@var{stack-size} 24872@opindex mstack-guard 24873@opindex mstack-size 24874If these options are provided the S/390 back end emits additional instructions in 24875the function prologue that trigger a trap if the stack size is @var{stack-guard} 24876bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 24877If the @var{stack-guard} option is omitted the smallest power of 2 larger than 24878the frame size of the compiled function is chosen. 24879These options are intended to be used to help debugging stack overflow problems. 24880The additionally emitted code causes only little overhead and hence can also be 24881used in production-like systems without greater performance degradation. The given 24882values have to be exact powers of 2 and @var{stack-size} has to be greater than 24883@var{stack-guard} without exceeding 64k. 24884In order to be efficient the extra code makes the assumption that the stack starts 24885at an address aligned to the value given by @var{stack-size}. 24886The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 24887 24888@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 24889@opindex mhotpatch 24890If the hotpatch option is enabled, a ``hot-patching'' function 24891prologue is generated for all functions in the compilation unit. 24892The funtion label is prepended with the given number of two-byte 24893NOP instructions (@var{pre-halfwords}, maximum 1000000). After 24894the label, 2 * @var{post-halfwords} bytes are appended, using the 24895largest NOP like instructions the architecture allows (maximum 248961000000). 24897 24898If both arguments are zero, hotpatching is disabled. 24899 24900This option can be overridden for individual functions with the 24901@code{hotpatch} attribute. 24902@end table 24903 24904@node Score Options 24905@subsection Score Options 24906@cindex Score Options 24907 24908These options are defined for Score implementations: 24909 24910@table @gcctabopt 24911@item -meb 24912@opindex meb 24913Compile code for big-endian mode. This is the default. 24914 24915@item -mel 24916@opindex mel 24917Compile code for little-endian mode. 24918 24919@item -mnhwloop 24920@opindex mnhwloop 24921Disable generation of @code{bcnz} instructions. 24922 24923@item -muls 24924@opindex muls 24925Enable generation of unaligned load and store instructions. 24926 24927@item -mmac 24928@opindex mmac 24929Enable the use of multiply-accumulate instructions. Disabled by default. 24930 24931@item -mscore5 24932@opindex mscore5 24933Specify the SCORE5 as the target architecture. 24934 24935@item -mscore5u 24936@opindex mscore5u 24937Specify the SCORE5U of the target architecture. 24938 24939@item -mscore7 24940@opindex mscore7 24941Specify the SCORE7 as the target architecture. This is the default. 24942 24943@item -mscore7d 24944@opindex mscore7d 24945Specify the SCORE7D as the target architecture. 24946@end table 24947 24948@node SH Options 24949@subsection SH Options 24950 24951These @samp{-m} options are defined for the SH implementations: 24952 24953@table @gcctabopt 24954@item -m1 24955@opindex m1 24956Generate code for the SH1. 24957 24958@item -m2 24959@opindex m2 24960Generate code for the SH2. 24961 24962@item -m2e 24963Generate code for the SH2e. 24964 24965@item -m2a-nofpu 24966@opindex m2a-nofpu 24967Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 24968that the floating-point unit is not used. 24969 24970@item -m2a-single-only 24971@opindex m2a-single-only 24972Generate code for the SH2a-FPU, in such a way that no double-precision 24973floating-point operations are used. 24974 24975@item -m2a-single 24976@opindex m2a-single 24977Generate code for the SH2a-FPU assuming the floating-point unit is in 24978single-precision mode by default. 24979 24980@item -m2a 24981@opindex m2a 24982Generate code for the SH2a-FPU assuming the floating-point unit is in 24983double-precision mode by default. 24984 24985@item -m3 24986@opindex m3 24987Generate code for the SH3. 24988 24989@item -m3e 24990@opindex m3e 24991Generate code for the SH3e. 24992 24993@item -m4-nofpu 24994@opindex m4-nofpu 24995Generate code for the SH4 without a floating-point unit. 24996 24997@item -m4-single-only 24998@opindex m4-single-only 24999Generate code for the SH4 with a floating-point unit that only 25000supports single-precision arithmetic. 25001 25002@item -m4-single 25003@opindex m4-single 25004Generate code for the SH4 assuming the floating-point unit is in 25005single-precision mode by default. 25006 25007@item -m4 25008@opindex m4 25009Generate code for the SH4. 25010 25011@item -m4-100 25012@opindex m4-100 25013Generate code for SH4-100. 25014 25015@item -m4-100-nofpu 25016@opindex m4-100-nofpu 25017Generate code for SH4-100 in such a way that the 25018floating-point unit is not used. 25019 25020@item -m4-100-single 25021@opindex m4-100-single 25022Generate code for SH4-100 assuming the floating-point unit is in 25023single-precision mode by default. 25024 25025@item -m4-100-single-only 25026@opindex m4-100-single-only 25027Generate code for SH4-100 in such a way that no double-precision 25028floating-point operations are used. 25029 25030@item -m4-200 25031@opindex m4-200 25032Generate code for SH4-200. 25033 25034@item -m4-200-nofpu 25035@opindex m4-200-nofpu 25036Generate code for SH4-200 without in such a way that the 25037floating-point unit is not used. 25038 25039@item -m4-200-single 25040@opindex m4-200-single 25041Generate code for SH4-200 assuming the floating-point unit is in 25042single-precision mode by default. 25043 25044@item -m4-200-single-only 25045@opindex m4-200-single-only 25046Generate code for SH4-200 in such a way that no double-precision 25047floating-point operations are used. 25048 25049@item -m4-300 25050@opindex m4-300 25051Generate code for SH4-300. 25052 25053@item -m4-300-nofpu 25054@opindex m4-300-nofpu 25055Generate code for SH4-300 without in such a way that the 25056floating-point unit is not used. 25057 25058@item -m4-300-single 25059@opindex m4-300-single 25060Generate code for SH4-300 in such a way that no double-precision 25061floating-point operations are used. 25062 25063@item -m4-300-single-only 25064@opindex m4-300-single-only 25065Generate code for SH4-300 in such a way that no double-precision 25066floating-point operations are used. 25067 25068@item -m4-340 25069@opindex m4-340 25070Generate code for SH4-340 (no MMU, no FPU). 25071 25072@item -m4-500 25073@opindex m4-500 25074Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 25075assembler. 25076 25077@item -m4a-nofpu 25078@opindex m4a-nofpu 25079Generate code for the SH4al-dsp, or for a SH4a in such a way that the 25080floating-point unit is not used. 25081 25082@item -m4a-single-only 25083@opindex m4a-single-only 25084Generate code for the SH4a, in such a way that no double-precision 25085floating-point operations are used. 25086 25087@item -m4a-single 25088@opindex m4a-single 25089Generate code for the SH4a assuming the floating-point unit is in 25090single-precision mode by default. 25091 25092@item -m4a 25093@opindex m4a 25094Generate code for the SH4a. 25095 25096@item -m4al 25097@opindex m4al 25098Same as @option{-m4a-nofpu}, except that it implicitly passes 25099@option{-dsp} to the assembler. GCC doesn't generate any DSP 25100instructions at the moment. 25101 25102@item -mb 25103@opindex mb 25104Compile code for the processor in big-endian mode. 25105 25106@item -ml 25107@opindex ml 25108Compile code for the processor in little-endian mode. 25109 25110@item -mdalign 25111@opindex mdalign 25112Align doubles at 64-bit boundaries. Note that this changes the calling 25113conventions, and thus some functions from the standard C library do 25114not work unless you recompile it first with @option{-mdalign}. 25115 25116@item -mrelax 25117@opindex mrelax 25118Shorten some address references at link time, when possible; uses the 25119linker option @option{-relax}. 25120 25121@item -mbigtable 25122@opindex mbigtable 25123Use 32-bit offsets in @code{switch} tables. The default is to use 2512416-bit offsets. 25125 25126@item -mbitops 25127@opindex mbitops 25128Enable the use of bit manipulation instructions on SH2A. 25129 25130@item -mfmovd 25131@opindex mfmovd 25132Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 25133alignment constraints. 25134 25135@item -mrenesas 25136@opindex mrenesas 25137Comply with the calling conventions defined by Renesas. 25138 25139@item -mno-renesas 25140@opindex mno-renesas 25141Comply with the calling conventions defined for GCC before the Renesas 25142conventions were available. This option is the default for all 25143targets of the SH toolchain. 25144 25145@item -mnomacsave 25146@opindex mnomacsave 25147Mark the @code{MAC} register as call-clobbered, even if 25148@option{-mrenesas} is given. 25149 25150@item -mieee 25151@itemx -mno-ieee 25152@opindex mieee 25153@opindex mno-ieee 25154Control the IEEE compliance of floating-point comparisons, which affects the 25155handling of cases where the result of a comparison is unordered. By default 25156@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 25157enabled @option{-mno-ieee} is implicitly set, which results in faster 25158floating-point greater-equal and less-equal comparisons. The implicit settings 25159can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 25160 25161@item -minline-ic_invalidate 25162@opindex minline-ic_invalidate 25163Inline code to invalidate instruction cache entries after setting up 25164nested function trampolines. 25165This option has no effect if @option{-musermode} is in effect and the selected 25166code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi} 25167instruction. 25168If the selected code generation option does not allow the use of the @code{icbi} 25169instruction, and @option{-musermode} is not in effect, the inlined code 25170manipulates the instruction cache address array directly with an associative 25171write. This not only requires privileged mode at run time, but it also 25172fails if the cache line had been mapped via the TLB and has become unmapped. 25173 25174@item -misize 25175@opindex misize 25176Dump instruction size and location in the assembly code. 25177 25178@item -mpadstruct 25179@opindex mpadstruct 25180This option is deprecated. It pads structures to multiple of 4 bytes, 25181which is incompatible with the SH ABI@. 25182 25183@item -matomic-model=@var{model} 25184@opindex matomic-model=@var{model} 25185Sets the model of atomic operations and additional parameters as a comma 25186separated list. For details on the atomic built-in functions see 25187@ref{__atomic Builtins}. The following models and parameters are supported: 25188 25189@table @samp 25190 25191@item none 25192Disable compiler generated atomic sequences and emit library calls for atomic 25193operations. This is the default if the target is not @code{sh*-*-linux*}. 25194 25195@item soft-gusa 25196Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 25197built-in functions. The generated atomic sequences require additional support 25198from the interrupt/exception handling code of the system and are only suitable 25199for SH3* and SH4* single-core systems. This option is enabled by default when 25200the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 25201this option also partially utilizes the hardware atomic instructions 25202@code{movli.l} and @code{movco.l} to create more efficient code, unless 25203@samp{strict} is specified. 25204 25205@item soft-tcb 25206Generate software atomic sequences that use a variable in the thread control 25207block. This is a variation of the gUSA sequences which can also be used on 25208SH1* and SH2* targets. The generated atomic sequences require additional 25209support from the interrupt/exception handling code of the system and are only 25210suitable for single-core systems. When using this model, the @samp{gbr-offset=} 25211parameter has to be specified as well. 25212 25213@item soft-imask 25214Generate software atomic sequences that temporarily disable interrupts by 25215setting @code{SR.IMASK = 1111}. This model works only when the program runs 25216in privileged mode and is only suitable for single-core systems. Additional 25217support from the interrupt/exception handling code of the system is not 25218required. This model is enabled by default when the target is 25219@code{sh*-*-linux*} and SH1* or SH2*. 25220 25221@item hard-llcs 25222Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 25223instructions only. This is only available on SH4A and is suitable for 25224multi-core systems. Since the hardware instructions support only 32 bit atomic 25225variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 25226Code compiled with this option is also compatible with other software 25227atomic model interrupt/exception handling systems if executed on an SH4A 25228system. Additional support from the interrupt/exception handling code of the 25229system is not required for this model. 25230 25231@item gbr-offset= 25232This parameter specifies the offset in bytes of the variable in the thread 25233control block structure that should be used by the generated atomic sequences 25234when the @samp{soft-tcb} model has been selected. For other models this 25235parameter is ignored. The specified value must be an integer multiple of four 25236and in the range 0-1020. 25237 25238@item strict 25239This parameter prevents mixed usage of multiple atomic models, even if they 25240are compatible, and makes the compiler generate atomic sequences of the 25241specified model only. 25242 25243@end table 25244 25245@item -mtas 25246@opindex mtas 25247Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 25248Notice that depending on the particular hardware and software configuration 25249this can degrade overall performance due to the operand cache line flushes 25250that are implied by the @code{tas.b} instruction. On multi-core SH4A 25251processors the @code{tas.b} instruction must be used with caution since it 25252can result in data corruption for certain cache configurations. 25253 25254@item -mprefergot 25255@opindex mprefergot 25256When generating position-independent code, emit function calls using 25257the Global Offset Table instead of the Procedure Linkage Table. 25258 25259@item -musermode 25260@itemx -mno-usermode 25261@opindex musermode 25262@opindex mno-usermode 25263Don't allow (allow) the compiler generating privileged mode code. Specifying 25264@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 25265inlined code would not work in user mode. @option{-musermode} is the default 25266when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 25267@option{-musermode} has no effect, since there is no user mode. 25268 25269@item -multcost=@var{number} 25270@opindex multcost=@var{number} 25271Set the cost to assume for a multiply insn. 25272 25273@item -mdiv=@var{strategy} 25274@opindex mdiv=@var{strategy} 25275Set the division strategy to be used for integer division operations. 25276@var{strategy} can be one of: 25277 25278@table @samp 25279 25280@item call-div1 25281Calls a library function that uses the single-step division instruction 25282@code{div1} to perform the operation. Division by zero calculates an 25283unspecified result and does not trap. This is the default except for SH4, 25284SH2A and SHcompact. 25285 25286@item call-fp 25287Calls a library function that performs the operation in double precision 25288floating point. Division by zero causes a floating-point exception. This is 25289the default for SHcompact with FPU. Specifying this for targets that do not 25290have a double precision FPU defaults to @code{call-div1}. 25291 25292@item call-table 25293Calls a library function that uses a lookup table for small divisors and 25294the @code{div1} instruction with case distinction for larger divisors. Division 25295by zero calculates an unspecified result and does not trap. This is the default 25296for SH4. Specifying this for targets that do not have dynamic shift 25297instructions defaults to @code{call-div1}. 25298 25299@end table 25300 25301When a division strategy has not been specified the default strategy is 25302selected based on the current target. For SH2A the default strategy is to 25303use the @code{divs} and @code{divu} instructions instead of library function 25304calls. 25305 25306@item -maccumulate-outgoing-args 25307@opindex maccumulate-outgoing-args 25308Reserve space once for outgoing arguments in the function prologue rather 25309than around each call. Generally beneficial for performance and size. Also 25310needed for unwinding to avoid changing the stack frame around conditional code. 25311 25312@item -mdivsi3_libfunc=@var{name} 25313@opindex mdivsi3_libfunc=@var{name} 25314Set the name of the library function used for 32-bit signed division to 25315@var{name}. 25316This only affects the name used in the @samp{call} division strategies, and 25317the compiler still expects the same sets of input/output/clobbered registers as 25318if this option were not present. 25319 25320@item -mfixed-range=@var{register-range} 25321@opindex mfixed-range 25322Generate code treating the given register range as fixed registers. 25323A fixed register is one that the register allocator can not use. This is 25324useful when compiling kernel code. A register range is specified as 25325two registers separated by a dash. Multiple register ranges can be 25326specified separated by a comma. 25327 25328@item -mbranch-cost=@var{num} 25329@opindex mbranch-cost=@var{num} 25330Assume @var{num} to be the cost for a branch instruction. Higher numbers 25331make the compiler try to generate more branch-free code if possible. 25332If not specified the value is selected depending on the processor type that 25333is being compiled for. 25334 25335@item -mzdcbranch 25336@itemx -mno-zdcbranch 25337@opindex mzdcbranch 25338@opindex mno-zdcbranch 25339Assume (do not assume) that zero displacement conditional branch instructions 25340@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 25341compiler prefers zero displacement branch code sequences. This is 25342enabled by default when generating code for SH4 and SH4A. It can be explicitly 25343disabled by specifying @option{-mno-zdcbranch}. 25344 25345@item -mcbranch-force-delay-slot 25346@opindex mcbranch-force-delay-slot 25347Force the usage of delay slots for conditional branches, which stuffs the delay 25348slot with a @code{nop} if a suitable instruction cannot be found. By default 25349this option is disabled. It can be enabled to work around hardware bugs as 25350found in the original SH7055. 25351 25352@item -mfused-madd 25353@itemx -mno-fused-madd 25354@opindex mfused-madd 25355@opindex mno-fused-madd 25356Generate code that uses (does not use) the floating-point multiply and 25357accumulate instructions. These instructions are generated by default 25358if hardware floating point is used. The machine-dependent 25359@option{-mfused-madd} option is now mapped to the machine-independent 25360@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 25361mapped to @option{-ffp-contract=off}. 25362 25363@item -mfsca 25364@itemx -mno-fsca 25365@opindex mfsca 25366@opindex mno-fsca 25367Allow or disallow the compiler to emit the @code{fsca} instruction for sine 25368and cosine approximations. The option @option{-mfsca} must be used in 25369combination with @option{-funsafe-math-optimizations}. It is enabled by default 25370when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 25371approximations even if @option{-funsafe-math-optimizations} is in effect. 25372 25373@item -mfsrra 25374@itemx -mno-fsrra 25375@opindex mfsrra 25376@opindex mno-fsrra 25377Allow or disallow the compiler to emit the @code{fsrra} instruction for 25378reciprocal square root approximations. The option @option{-mfsrra} must be used 25379in combination with @option{-funsafe-math-optimizations} and 25380@option{-ffinite-math-only}. It is enabled by default when generating code for 25381SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 25382even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 25383in effect. 25384 25385@item -mpretend-cmove 25386@opindex mpretend-cmove 25387Prefer zero-displacement conditional branches for conditional move instruction 25388patterns. This can result in faster code on the SH4 processor. 25389 25390@item -mfdpic 25391@opindex fdpic 25392Generate code using the FDPIC ABI. 25393 25394@end table 25395 25396@node Solaris 2 Options 25397@subsection Solaris 2 Options 25398@cindex Solaris 2 options 25399 25400These @samp{-m} options are supported on Solaris 2: 25401 25402@table @gcctabopt 25403@item -mclear-hwcap 25404@opindex mclear-hwcap 25405@option{-mclear-hwcap} tells the compiler to remove the hardware 25406capabilities generated by the Solaris assembler. This is only necessary 25407when object files use ISA extensions not supported by the current 25408machine, but check at runtime whether or not to use them. 25409 25410@item -mimpure-text 25411@opindex mimpure-text 25412@option{-mimpure-text}, used in addition to @option{-shared}, tells 25413the compiler to not pass @option{-z text} to the linker when linking a 25414shared object. Using this option, you can link position-dependent 25415code into a shared object. 25416 25417@option{-mimpure-text} suppresses the ``relocations remain against 25418allocatable but non-writable sections'' linker error message. 25419However, the necessary relocations trigger copy-on-write, and the 25420shared object is not actually shared across processes. Instead of 25421using @option{-mimpure-text}, you should compile all source code with 25422@option{-fpic} or @option{-fPIC}. 25423 25424@end table 25425 25426These switches are supported in addition to the above on Solaris 2: 25427 25428@table @gcctabopt 25429@item -pthreads 25430@opindex pthreads 25431This is a synonym for @option{-pthread}. 25432@end table 25433 25434@node SPARC Options 25435@subsection SPARC Options 25436@cindex SPARC options 25437 25438These @samp{-m} options are supported on the SPARC: 25439 25440@table @gcctabopt 25441@item -mno-app-regs 25442@itemx -mapp-regs 25443@opindex mno-app-regs 25444@opindex mapp-regs 25445Specify @option{-mapp-regs} to generate output using the global registers 254462 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 25447global register 1, each global register 2 through 4 is then treated as an 25448allocable register that is clobbered by function calls. This is the default. 25449 25450To be fully SVR4 ABI-compliant at the cost of some performance loss, 25451specify @option{-mno-app-regs}. You should compile libraries and system 25452software with this option. 25453 25454@item -mflat 25455@itemx -mno-flat 25456@opindex mflat 25457@opindex mno-flat 25458With @option{-mflat}, the compiler does not generate save/restore instructions 25459and uses a ``flat'' or single register window model. This model is compatible 25460with the regular register window model. The local registers and the input 25461registers (0--5) are still treated as ``call-saved'' registers and are 25462saved on the stack as needed. 25463 25464With @option{-mno-flat} (the default), the compiler generates save/restore 25465instructions (except for leaf functions). This is the normal operating mode. 25466 25467@item -mfpu 25468@itemx -mhard-float 25469@opindex mfpu 25470@opindex mhard-float 25471Generate output containing floating-point instructions. This is the 25472default. 25473 25474@item -mno-fpu 25475@itemx -msoft-float 25476@opindex mno-fpu 25477@opindex msoft-float 25478Generate output containing library calls for floating point. 25479@strong{Warning:} the requisite libraries are not available for all SPARC 25480targets. Normally the facilities of the machine's usual C compiler are 25481used, but this cannot be done directly in cross-compilation. You must make 25482your own arrangements to provide suitable library functions for 25483cross-compilation. The embedded targets @samp{sparc-*-aout} and 25484@samp{sparclite-*-*} do provide software floating-point support. 25485 25486@option{-msoft-float} changes the calling convention in the output file; 25487therefore, it is only useful if you compile @emph{all} of a program with 25488this option. In particular, you need to compile @file{libgcc.a}, the 25489library that comes with GCC, with @option{-msoft-float} in order for 25490this to work. 25491 25492@item -mhard-quad-float 25493@opindex mhard-quad-float 25494Generate output containing quad-word (long double) floating-point 25495instructions. 25496 25497@item -msoft-quad-float 25498@opindex msoft-quad-float 25499Generate output containing library calls for quad-word (long double) 25500floating-point instructions. The functions called are those specified 25501in the SPARC ABI@. This is the default. 25502 25503As of this writing, there are no SPARC implementations that have hardware 25504support for the quad-word floating-point instructions. They all invoke 25505a trap handler for one of these instructions, and then the trap handler 25506emulates the effect of the instruction. Because of the trap handler overhead, 25507this is much slower than calling the ABI library routines. Thus the 25508@option{-msoft-quad-float} option is the default. 25509 25510@item -mno-unaligned-doubles 25511@itemx -munaligned-doubles 25512@opindex mno-unaligned-doubles 25513@opindex munaligned-doubles 25514Assume that doubles have 8-byte alignment. This is the default. 25515 25516With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 25517alignment only if they are contained in another type, or if they have an 25518absolute address. Otherwise, it assumes they have 4-byte alignment. 25519Specifying this option avoids some rare compatibility problems with code 25520generated by other compilers. It is not the default because it results 25521in a performance loss, especially for floating-point code. 25522 25523@item -muser-mode 25524@itemx -mno-user-mode 25525@opindex muser-mode 25526@opindex mno-user-mode 25527Do not generate code that can only run in supervisor mode. This is relevant 25528only for the @code{casa} instruction emitted for the LEON3 processor. This 25529is the default. 25530 25531@item -mfaster-structs 25532@itemx -mno-faster-structs 25533@opindex mfaster-structs 25534@opindex mno-faster-structs 25535With @option{-mfaster-structs}, the compiler assumes that structures 25536should have 8-byte alignment. This enables the use of pairs of 25537@code{ldd} and @code{std} instructions for copies in structure 25538assignment, in place of twice as many @code{ld} and @code{st} pairs. 25539However, the use of this changed alignment directly violates the SPARC 25540ABI@. Thus, it's intended only for use on targets where the developer 25541acknowledges that their resulting code is not directly in line with 25542the rules of the ABI@. 25543 25544@item -mstd-struct-return 25545@itemx -mno-std-struct-return 25546@opindex mstd-struct-return 25547@opindex mno-std-struct-return 25548With @option{-mstd-struct-return}, the compiler generates checking code 25549in functions returning structures or unions to detect size mismatches 25550between the two sides of function calls, as per the 32-bit ABI@. 25551 25552The default is @option{-mno-std-struct-return}. This option has no effect 25553in 64-bit mode. 25554 25555@item -mlra 25556@itemx -mno-lra 25557@opindex mlra 25558@opindex mno-lra 25559Enable Local Register Allocation. This is the default for SPARC since GCC 7 25560so @option{-mno-lra} needs to be passed to get old Reload. 25561 25562@item -mcpu=@var{cpu_type} 25563@opindex mcpu 25564Set the instruction set, register set, and instruction scheduling parameters 25565for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 25566@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 25567@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 25568@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 25569@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 25570@samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}. 25571 25572Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 25573which selects the best architecture option for the host processor. 25574@option{-mcpu=native} has no effect if GCC does not recognize 25575the processor. 25576 25577Default instruction scheduling parameters are used for values that select 25578an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 25579@samp{sparclite}, @samp{sparclet}, @samp{v9}. 25580 25581Here is a list of each supported architecture and their supported 25582implementations. 25583 25584@table @asis 25585@item v7 25586cypress, leon3v7 25587 25588@item v8 25589supersparc, hypersparc, leon, leon3 25590 25591@item sparclite 25592f930, f934, sparclite86x 25593 25594@item sparclet 25595tsc701 25596 25597@item v9 25598ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, 25599niagara7, m8 25600@end table 25601 25602By default (unless configured otherwise), GCC generates code for the V7 25603variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 25604additionally optimizes it for the Cypress CY7C602 chip, as used in the 25605SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 25606SPARCStation 1, 2, IPX etc. 25607 25608With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 25609architecture. The only difference from V7 code is that the compiler emits 25610the integer multiply and integer divide instructions which exist in SPARC-V8 25611but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 25612optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 256132000 series. 25614 25615With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 25616the SPARC architecture. This adds the integer multiply, integer divide step 25617and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 25618With @option{-mcpu=f930}, the compiler additionally optimizes it for the 25619Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 25620@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 25621MB86934 chip, which is the more recent SPARClite with FPU@. 25622 25623With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 25624the SPARC architecture. This adds the integer multiply, multiply/accumulate, 25625integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 25626but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 25627optimizes it for the TEMIC SPARClet chip. 25628 25629With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 25630architecture. This adds 64-bit integer and floating-point move instructions, 256313 additional floating-point condition code registers and conditional move 25632instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 25633optimizes it for the Sun UltraSPARC I/II/IIi chips. With 25634@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 25635Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 25636@option{-mcpu=niagara}, the compiler additionally optimizes it for 25637Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 25638additionally optimizes it for Sun UltraSPARC T2 chips. With 25639@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 25640UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 25641additionally optimizes it for Sun UltraSPARC T4 chips. With 25642@option{-mcpu=niagara7}, the compiler additionally optimizes it for 25643Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler 25644additionally optimizes it for Oracle M8 chips. 25645 25646@item -mtune=@var{cpu_type} 25647@opindex mtune 25648Set the instruction scheduling parameters for machine type 25649@var{cpu_type}, but do not set the instruction set or register set that the 25650option @option{-mcpu=@var{cpu_type}} does. 25651 25652The same values for @option{-mcpu=@var{cpu_type}} can be used for 25653@option{-mtune=@var{cpu_type}}, but the only useful values are those 25654that select a particular CPU implementation. Those are 25655@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon}, 25656@samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934}, 25657@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 25658@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3}, 25659@samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris 25660and GNU/Linux toolchains, @samp{native} can also be used. 25661 25662@item -mv8plus 25663@itemx -mno-v8plus 25664@opindex mv8plus 25665@opindex mno-v8plus 25666With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 25667difference from the V8 ABI is that the global and out registers are 25668considered 64 bits wide. This is enabled by default on Solaris in 32-bit 25669mode for all SPARC-V9 processors. 25670 25671@item -mvis 25672@itemx -mno-vis 25673@opindex mvis 25674@opindex mno-vis 25675With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 25676Visual Instruction Set extensions. The default is @option{-mno-vis}. 25677 25678@item -mvis2 25679@itemx -mno-vis2 25680@opindex mvis2 25681@opindex mno-vis2 25682With @option{-mvis2}, GCC generates code that takes advantage of 25683version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 25684default is @option{-mvis2} when targeting a cpu that supports such 25685instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 25686also sets @option{-mvis}. 25687 25688@item -mvis3 25689@itemx -mno-vis3 25690@opindex mvis3 25691@opindex mno-vis3 25692With @option{-mvis3}, GCC generates code that takes advantage of 25693version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 25694default is @option{-mvis3} when targeting a cpu that supports such 25695instructions, such as niagara-3 and later. Setting @option{-mvis3} 25696also sets @option{-mvis2} and @option{-mvis}. 25697 25698@item -mvis4 25699@itemx -mno-vis4 25700@opindex mvis4 25701@opindex mno-vis4 25702With @option{-mvis4}, GCC generates code that takes advantage of 25703version 4.0 of the UltraSPARC Visual Instruction Set extensions. The 25704default is @option{-mvis4} when targeting a cpu that supports such 25705instructions, such as niagara-7 and later. Setting @option{-mvis4} 25706also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}. 25707 25708@item -mvis4b 25709@itemx -mno-vis4b 25710@opindex mvis4b 25711@opindex mno-vis4b 25712With @option{-mvis4b}, GCC generates code that takes advantage of 25713version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus 25714the additional VIS instructions introduced in the Oracle SPARC 25715Architecture 2017. The default is @option{-mvis4b} when targeting a 25716cpu that supports such instructions, such as m8 and later. Setting 25717@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3}, 25718@option{-mvis2} and @option{-mvis}. 25719 25720@item -mcbcond 25721@itemx -mno-cbcond 25722@opindex mcbcond 25723@opindex mno-cbcond 25724With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC 25725Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond} 25726when targeting a CPU that supports such instructions, such as Niagara-4 and 25727later. 25728 25729@item -mfmaf 25730@itemx -mno-fmaf 25731@opindex mfmaf 25732@opindex mno-fmaf 25733With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 25734Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf} 25735when targeting a CPU that supports such instructions, such as Niagara-3 and 25736later. 25737 25738@item -mfsmuld 25739@itemx -mno-fsmuld 25740@opindex mfsmuld 25741@opindex mno-fsmuld 25742With @option{-mfsmuld}, GCC generates code that takes advantage of the 25743Floating-point Multiply Single to Double (FsMULd) instruction. The default is 25744@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8 25745or V9 with FPU except @option{-mcpu=leon}. 25746 25747@item -mpopc 25748@itemx -mno-popc 25749@opindex mpopc 25750@opindex mno-popc 25751With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 25752Population Count instruction. The default is @option{-mpopc} 25753when targeting a CPU that supports such an instruction, such as Niagara-2 and 25754later. 25755 25756@item -msubxc 25757@itemx -mno-subxc 25758@opindex msubxc 25759@opindex mno-subxc 25760With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC 25761Subtract-Extended-with-Carry instruction. The default is @option{-msubxc} 25762when targeting a CPU that supports such an instruction, such as Niagara-7 and 25763later. 25764 25765@item -mfix-at697f 25766@opindex mfix-at697f 25767Enable the documented workaround for the single erratum of the Atmel AT697F 25768processor (which corresponds to erratum #13 of the AT697E processor). 25769 25770@item -mfix-ut699 25771@opindex mfix-ut699 25772Enable the documented workarounds for the floating-point errata and the data 25773cache nullify errata of the UT699 processor. 25774 25775@item -mfix-ut700 25776@opindex mfix-ut700 25777Enable the documented workaround for the back-to-back store errata of 25778the UT699E/UT700 processor. 25779 25780@item -mfix-gr712rc 25781@opindex mfix-gr712rc 25782Enable the documented workaround for the back-to-back store errata of 25783the GR712RC processor. 25784@end table 25785 25786These @samp{-m} options are supported in addition to the above 25787on SPARC-V9 processors in 64-bit environments: 25788 25789@table @gcctabopt 25790@item -m32 25791@itemx -m64 25792@opindex m32 25793@opindex m64 25794Generate code for a 32-bit or 64-bit environment. 25795The 32-bit environment sets int, long and pointer to 32 bits. 25796The 64-bit environment sets int to 32 bits and long and pointer 25797to 64 bits. 25798 25799@item -mcmodel=@var{which} 25800@opindex mcmodel 25801Set the code model to one of 25802 25803@table @samp 25804@item medlow 25805The Medium/Low code model: 64-bit addresses, programs 25806must be linked in the low 32 bits of memory. Programs can be statically 25807or dynamically linked. 25808 25809@item medmid 25810The Medium/Middle code model: 64-bit addresses, programs 25811must be linked in the low 44 bits of memory, the text and data segments must 25812be less than 2GB in size and the data segment must be located within 2GB of 25813the text segment. 25814 25815@item medany 25816The Medium/Anywhere code model: 64-bit addresses, programs 25817may be linked anywhere in memory, the text and data segments must be less 25818than 2GB in size and the data segment must be located within 2GB of the 25819text segment. 25820 25821@item embmedany 25822The Medium/Anywhere code model for embedded systems: 2582364-bit addresses, the text and data segments must be less than 2GB in 25824size, both starting anywhere in memory (determined at link time). The 25825global register %g4 points to the base of the data segment. Programs 25826are statically linked and PIC is not supported. 25827@end table 25828 25829@item -mmemory-model=@var{mem-model} 25830@opindex mmemory-model 25831Set the memory model in force on the processor to one of 25832 25833@table @samp 25834@item default 25835The default memory model for the processor and operating system. 25836 25837@item rmo 25838Relaxed Memory Order 25839 25840@item pso 25841Partial Store Order 25842 25843@item tso 25844Total Store Order 25845 25846@item sc 25847Sequential Consistency 25848@end table 25849 25850These memory models are formally defined in Appendix D of the SPARC-V9 25851architecture manual, as set in the processor's @code{PSTATE.MM} field. 25852 25853@item -mstack-bias 25854@itemx -mno-stack-bias 25855@opindex mstack-bias 25856@opindex mno-stack-bias 25857With @option{-mstack-bias}, GCC assumes that the stack pointer, and 25858frame pointer if present, are offset by @minus{}2047 which must be added back 25859when making stack frame references. This is the default in 64-bit mode. 25860Otherwise, assume no such offset is present. 25861@end table 25862 25863@node SPU Options 25864@subsection SPU Options 25865@cindex SPU options 25866 25867These @samp{-m} options are supported on the SPU: 25868 25869@table @gcctabopt 25870@item -mwarn-reloc 25871@itemx -merror-reloc 25872@opindex mwarn-reloc 25873@opindex merror-reloc 25874 25875The loader for SPU does not handle dynamic relocations. By default, GCC 25876gives an error when it generates code that requires a dynamic 25877relocation. @option{-mno-error-reloc} disables the error, 25878@option{-mwarn-reloc} generates a warning instead. 25879 25880@item -msafe-dma 25881@itemx -munsafe-dma 25882@opindex msafe-dma 25883@opindex munsafe-dma 25884 25885Instructions that initiate or test completion of DMA must not be 25886reordered with respect to loads and stores of the memory that is being 25887accessed. 25888With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect 25889memory accesses, but that can lead to inefficient code in places where the 25890memory is known to not change. Rather than mark the memory as volatile, 25891you can use @option{-msafe-dma} to tell the compiler to treat 25892the DMA instructions as potentially affecting all memory. 25893 25894@item -mbranch-hints 25895@opindex mbranch-hints 25896 25897By default, GCC generates a branch hint instruction to avoid 25898pipeline stalls for always-taken or probably-taken branches. A hint 25899is not generated closer than 8 instructions away from its branch. 25900There is little reason to disable them, except for debugging purposes, 25901or to make an object a little bit smaller. 25902 25903@item -msmall-mem 25904@itemx -mlarge-mem 25905@opindex msmall-mem 25906@opindex mlarge-mem 25907 25908By default, GCC generates code assuming that addresses are never larger 25909than 18 bits. With @option{-mlarge-mem} code is generated that assumes 25910a full 32-bit address. 25911 25912@item -mstdmain 25913@opindex mstdmain 25914 25915By default, GCC links against startup code that assumes the SPU-style 25916main function interface (which has an unconventional parameter list). 25917With @option{-mstdmain}, GCC links your program against startup 25918code that assumes a C99-style interface to @code{main}, including a 25919local copy of @code{argv} strings. 25920 25921@item -mfixed-range=@var{register-range} 25922@opindex mfixed-range 25923Generate code treating the given register range as fixed registers. 25924A fixed register is one that the register allocator cannot use. This is 25925useful when compiling kernel code. A register range is specified as 25926two registers separated by a dash. Multiple register ranges can be 25927specified separated by a comma. 25928 25929@item -mea32 25930@itemx -mea64 25931@opindex mea32 25932@opindex mea64 25933Compile code assuming that pointers to the PPU address space accessed 25934via the @code{__ea} named address space qualifier are either 32 or 64 25935bits wide. The default is 32 bits. As this is an ABI-changing option, 25936all object code in an executable must be compiled with the same setting. 25937 25938@item -maddress-space-conversion 25939@itemx -mno-address-space-conversion 25940@opindex maddress-space-conversion 25941@opindex mno-address-space-conversion 25942Allow/disallow treating the @code{__ea} address space as superset 25943of the generic address space. This enables explicit type casts 25944between @code{__ea} and generic pointer as well as implicit 25945conversions of generic pointers to @code{__ea} pointers. The 25946default is to allow address space pointer conversions. 25947 25948@item -mcache-size=@var{cache-size} 25949@opindex mcache-size 25950This option controls the version of libgcc that the compiler links to an 25951executable and selects a software-managed cache for accessing variables 25952in the @code{__ea} address space with a particular cache size. Possible 25953options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} 25954and @samp{128}. The default cache size is 64KB. 25955 25956@item -matomic-updates 25957@itemx -mno-atomic-updates 25958@opindex matomic-updates 25959@opindex mno-atomic-updates 25960This option controls the version of libgcc that the compiler links to an 25961executable and selects whether atomic updates to the software-managed 25962cache of PPU-side variables are used. If you use atomic updates, changes 25963to a PPU variable from SPU code using the @code{__ea} named address space 25964qualifier do not interfere with changes to other PPU variables residing 25965in the same cache line from PPU code. If you do not use atomic updates, 25966such interference may occur; however, writing back cache lines is 25967more efficient. The default behavior is to use atomic updates. 25968 25969@item -mdual-nops 25970@itemx -mdual-nops=@var{n} 25971@opindex mdual-nops 25972By default, GCC inserts NOPs to increase dual issue when it expects 25973it to increase performance. @var{n} can be a value from 0 to 10. A 25974smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the 25975same as @option{-mno-dual-nops}. Disabled with @option{-Os}. 25976 25977@item -mhint-max-nops=@var{n} 25978@opindex mhint-max-nops 25979Maximum number of NOPs to insert for a branch hint. A branch hint must 25980be at least 8 instructions away from the branch it is affecting. GCC 25981inserts up to @var{n} NOPs to enforce this, otherwise it does not 25982generate the branch hint. 25983 25984@item -mhint-max-distance=@var{n} 25985@opindex mhint-max-distance 25986The encoding of the branch hint instruction limits the hint to be within 25987256 instructions of the branch it is affecting. By default, GCC makes 25988sure it is within 125. 25989 25990@item -msafe-hints 25991@opindex msafe-hints 25992Work around a hardware bug that causes the SPU to stall indefinitely. 25993By default, GCC inserts the @code{hbrp} instruction to make sure 25994this stall won't happen. 25995 25996@end table 25997 25998@node System V Options 25999@subsection Options for System V 26000 26001These additional options are available on System V Release 4 for 26002compatibility with other compilers on those systems: 26003 26004@table @gcctabopt 26005@item -G 26006@opindex G 26007Create a shared object. 26008It is recommended that @option{-symbolic} or @option{-shared} be used instead. 26009 26010@item -Qy 26011@opindex Qy 26012Identify the versions of each tool used by the compiler, in a 26013@code{.ident} assembler directive in the output. 26014 26015@item -Qn 26016@opindex Qn 26017Refrain from adding @code{.ident} directives to the output file (this is 26018the default). 26019 26020@item -YP,@var{dirs} 26021@opindex YP 26022Search the directories @var{dirs}, and no others, for libraries 26023specified with @option{-l}. 26024 26025@item -Ym,@var{dir} 26026@opindex Ym 26027Look in the directory @var{dir} to find the M4 preprocessor. 26028The assembler uses this option. 26029@c This is supposed to go with a -Yd for predefined M4 macro files, but 26030@c the generic assembler that comes with Solaris takes just -Ym. 26031@end table 26032 26033@node TILE-Gx Options 26034@subsection TILE-Gx Options 26035@cindex TILE-Gx options 26036 26037These @samp{-m} options are supported on the TILE-Gx: 26038 26039@table @gcctabopt 26040@item -mcmodel=small 26041@opindex mcmodel=small 26042Generate code for the small model. The distance for direct calls is 26043limited to 500M in either direction. PC-relative addresses are 32 26044bits. Absolute addresses support the full address range. 26045 26046@item -mcmodel=large 26047@opindex mcmodel=large 26048Generate code for the large model. There is no limitation on call 26049distance, pc-relative addresses, or absolute addresses. 26050 26051@item -mcpu=@var{name} 26052@opindex mcpu 26053Selects the type of CPU to be targeted. Currently the only supported 26054type is @samp{tilegx}. 26055 26056@item -m32 26057@itemx -m64 26058@opindex m32 26059@opindex m64 26060Generate code for a 32-bit or 64-bit environment. The 32-bit 26061environment sets int, long, and pointer to 32 bits. The 64-bit 26062environment sets int to 32 bits and long and pointer to 64 bits. 26063 26064@item -mbig-endian 26065@itemx -mlittle-endian 26066@opindex mbig-endian 26067@opindex mlittle-endian 26068Generate code in big/little endian mode, respectively. 26069@end table 26070 26071@node TILEPro Options 26072@subsection TILEPro Options 26073@cindex TILEPro options 26074 26075These @samp{-m} options are supported on the TILEPro: 26076 26077@table @gcctabopt 26078@item -mcpu=@var{name} 26079@opindex mcpu 26080Selects the type of CPU to be targeted. Currently the only supported 26081type is @samp{tilepro}. 26082 26083@item -m32 26084@opindex m32 26085Generate code for a 32-bit environment, which sets int, long, and 26086pointer to 32 bits. This is the only supported behavior so the flag 26087is essentially ignored. 26088@end table 26089 26090@node V850 Options 26091@subsection V850 Options 26092@cindex V850 Options 26093 26094These @samp{-m} options are defined for V850 implementations: 26095 26096@table @gcctabopt 26097@item -mlong-calls 26098@itemx -mno-long-calls 26099@opindex mlong-calls 26100@opindex mno-long-calls 26101Treat all calls as being far away (near). If calls are assumed to be 26102far away, the compiler always loads the function's address into a 26103register, and calls indirect through the pointer. 26104 26105@item -mno-ep 26106@itemx -mep 26107@opindex mno-ep 26108@opindex mep 26109Do not optimize (do optimize) basic blocks that use the same index 26110pointer 4 or more times to copy pointer into the @code{ep} register, and 26111use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 26112option is on by default if you optimize. 26113 26114@item -mno-prolog-function 26115@itemx -mprolog-function 26116@opindex mno-prolog-function 26117@opindex mprolog-function 26118Do not use (do use) external functions to save and restore registers 26119at the prologue and epilogue of a function. The external functions 26120are slower, but use less code space if more than one function saves 26121the same number of registers. The @option{-mprolog-function} option 26122is on by default if you optimize. 26123 26124@item -mspace 26125@opindex mspace 26126Try to make the code as small as possible. At present, this just turns 26127on the @option{-mep} and @option{-mprolog-function} options. 26128 26129@item -mtda=@var{n} 26130@opindex mtda 26131Put static or global variables whose size is @var{n} bytes or less into 26132the tiny data area that register @code{ep} points to. The tiny data 26133area can hold up to 256 bytes in total (128 bytes for byte references). 26134 26135@item -msda=@var{n} 26136@opindex msda 26137Put static or global variables whose size is @var{n} bytes or less into 26138the small data area that register @code{gp} points to. The small data 26139area can hold up to 64 kilobytes. 26140 26141@item -mzda=@var{n} 26142@opindex mzda 26143Put static or global variables whose size is @var{n} bytes or less into 26144the first 32 kilobytes of memory. 26145 26146@item -mv850 26147@opindex mv850 26148Specify that the target processor is the V850. 26149 26150@item -mv850e3v5 26151@opindex mv850e3v5 26152Specify that the target processor is the V850E3V5. The preprocessor 26153constant @code{__v850e3v5__} is defined if this option is used. 26154 26155@item -mv850e2v4 26156@opindex mv850e2v4 26157Specify that the target processor is the V850E3V5. This is an alias for 26158the @option{-mv850e3v5} option. 26159 26160@item -mv850e2v3 26161@opindex mv850e2v3 26162Specify that the target processor is the V850E2V3. The preprocessor 26163constant @code{__v850e2v3__} is defined if this option is used. 26164 26165@item -mv850e2 26166@opindex mv850e2 26167Specify that the target processor is the V850E2. The preprocessor 26168constant @code{__v850e2__} is defined if this option is used. 26169 26170@item -mv850e1 26171@opindex mv850e1 26172Specify that the target processor is the V850E1. The preprocessor 26173constants @code{__v850e1__} and @code{__v850e__} are defined if 26174this option is used. 26175 26176@item -mv850es 26177@opindex mv850es 26178Specify that the target processor is the V850ES. This is an alias for 26179the @option{-mv850e1} option. 26180 26181@item -mv850e 26182@opindex mv850e 26183Specify that the target processor is the V850E@. The preprocessor 26184constant @code{__v850e__} is defined if this option is used. 26185 26186If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 26187nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 26188are defined then a default target processor is chosen and the 26189relevant @samp{__v850*__} preprocessor constant is defined. 26190 26191The preprocessor constants @code{__v850} and @code{__v851__} are always 26192defined, regardless of which processor variant is the target. 26193 26194@item -mdisable-callt 26195@itemx -mno-disable-callt 26196@opindex mdisable-callt 26197@opindex mno-disable-callt 26198This option suppresses generation of the @code{CALLT} instruction for the 26199v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 26200architecture. 26201 26202This option is enabled by default when the RH850 ABI is 26203in use (see @option{-mrh850-abi}), and disabled by default when the 26204GCC ABI is in use. If @code{CALLT} instructions are being generated 26205then the C preprocessor symbol @code{__V850_CALLT__} is defined. 26206 26207@item -mrelax 26208@itemx -mno-relax 26209@opindex mrelax 26210@opindex mno-relax 26211Pass on (or do not pass on) the @option{-mrelax} command-line option 26212to the assembler. 26213 26214@item -mlong-jumps 26215@itemx -mno-long-jumps 26216@opindex mlong-jumps 26217@opindex mno-long-jumps 26218Disable (or re-enable) the generation of PC-relative jump instructions. 26219 26220@item -msoft-float 26221@itemx -mhard-float 26222@opindex msoft-float 26223@opindex mhard-float 26224Disable (or re-enable) the generation of hardware floating point 26225instructions. This option is only significant when the target 26226architecture is @samp{V850E2V3} or higher. If hardware floating point 26227instructions are being generated then the C preprocessor symbol 26228@code{__FPU_OK__} is defined, otherwise the symbol 26229@code{__NO_FPU__} is defined. 26230 26231@item -mloop 26232@opindex mloop 26233Enables the use of the e3v5 LOOP instruction. The use of this 26234instruction is not enabled by default when the e3v5 architecture is 26235selected because its use is still experimental. 26236 26237@item -mrh850-abi 26238@itemx -mghs 26239@opindex mrh850-abi 26240@opindex mghs 26241Enables support for the RH850 version of the V850 ABI. This is the 26242default. With this version of the ABI the following rules apply: 26243 26244@itemize 26245@item 26246Integer sized structures and unions are returned via a memory pointer 26247rather than a register. 26248 26249@item 26250Large structures and unions (more than 8 bytes in size) are passed by 26251value. 26252 26253@item 26254Functions are aligned to 16-bit boundaries. 26255 26256@item 26257The @option{-m8byte-align} command-line option is supported. 26258 26259@item 26260The @option{-mdisable-callt} command-line option is enabled by 26261default. The @option{-mno-disable-callt} command-line option is not 26262supported. 26263@end itemize 26264 26265When this version of the ABI is enabled the C preprocessor symbol 26266@code{__V850_RH850_ABI__} is defined. 26267 26268@item -mgcc-abi 26269@opindex mgcc-abi 26270Enables support for the old GCC version of the V850 ABI. With this 26271version of the ABI the following rules apply: 26272 26273@itemize 26274@item 26275Integer sized structures and unions are returned in register @code{r10}. 26276 26277@item 26278Large structures and unions (more than 8 bytes in size) are passed by 26279reference. 26280 26281@item 26282Functions are aligned to 32-bit boundaries, unless optimizing for 26283size. 26284 26285@item 26286The @option{-m8byte-align} command-line option is not supported. 26287 26288@item 26289The @option{-mdisable-callt} command-line option is supported but not 26290enabled by default. 26291@end itemize 26292 26293When this version of the ABI is enabled the C preprocessor symbol 26294@code{__V850_GCC_ABI__} is defined. 26295 26296@item -m8byte-align 26297@itemx -mno-8byte-align 26298@opindex m8byte-align 26299@opindex mno-8byte-align 26300Enables support for @code{double} and @code{long long} types to be 26301aligned on 8-byte boundaries. The default is to restrict the 26302alignment of all objects to at most 4-bytes. When 26303@option{-m8byte-align} is in effect the C preprocessor symbol 26304@code{__V850_8BYTE_ALIGN__} is defined. 26305 26306@item -mbig-switch 26307@opindex mbig-switch 26308Generate code suitable for big switch tables. Use this option only if 26309the assembler/linker complain about out of range branches within a switch 26310table. 26311 26312@item -mapp-regs 26313@opindex mapp-regs 26314This option causes r2 and r5 to be used in the code generated by 26315the compiler. This setting is the default. 26316 26317@item -mno-app-regs 26318@opindex mno-app-regs 26319This option causes r2 and r5 to be treated as fixed registers. 26320 26321@end table 26322 26323@node VAX Options 26324@subsection VAX Options 26325@cindex VAX options 26326 26327These @samp{-m} options are defined for the VAX: 26328 26329@table @gcctabopt 26330@item -munix 26331@opindex munix 26332Do not output certain jump instructions (@code{aobleq} and so on) 26333that the Unix assembler for the VAX cannot handle across long 26334ranges. 26335 26336@item -mgnu 26337@opindex mgnu 26338Do output those jump instructions, on the assumption that the 26339GNU assembler is being used. 26340 26341@item -mg 26342@opindex mg 26343Output code for G-format floating-point numbers instead of D-format. 26344@end table 26345 26346@node Visium Options 26347@subsection Visium Options 26348@cindex Visium options 26349 26350@table @gcctabopt 26351 26352@item -mdebug 26353@opindex mdebug 26354A program which performs file I/O and is destined to run on an MCM target 26355should be linked with this option. It causes the libraries libc.a and 26356libdebug.a to be linked. The program should be run on the target under 26357the control of the GDB remote debugging stub. 26358 26359@item -msim 26360@opindex msim 26361A program which performs file I/O and is destined to run on the simulator 26362should be linked with option. This causes libraries libc.a and libsim.a to 26363be linked. 26364 26365@item -mfpu 26366@itemx -mhard-float 26367@opindex mfpu 26368@opindex mhard-float 26369Generate code containing floating-point instructions. This is the 26370default. 26371 26372@item -mno-fpu 26373@itemx -msoft-float 26374@opindex mno-fpu 26375@opindex msoft-float 26376Generate code containing library calls for floating-point. 26377 26378@option{-msoft-float} changes the calling convention in the output file; 26379therefore, it is only useful if you compile @emph{all} of a program with 26380this option. In particular, you need to compile @file{libgcc.a}, the 26381library that comes with GCC, with @option{-msoft-float} in order for 26382this to work. 26383 26384@item -mcpu=@var{cpu_type} 26385@opindex mcpu 26386Set the instruction set, register set, and instruction scheduling parameters 26387for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 26388@samp{mcm}, @samp{gr5} and @samp{gr6}. 26389 26390@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 26391 26392By default (unless configured otherwise), GCC generates code for the GR5 26393variant of the Visium architecture. 26394 26395With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 26396architecture. The only difference from GR5 code is that the compiler will 26397generate block move instructions. 26398 26399@item -mtune=@var{cpu_type} 26400@opindex mtune 26401Set the instruction scheduling parameters for machine type @var{cpu_type}, 26402but do not set the instruction set or register set that the option 26403@option{-mcpu=@var{cpu_type}} would. 26404 26405@item -msv-mode 26406@opindex msv-mode 26407Generate code for the supervisor mode, where there are no restrictions on 26408the access to general registers. This is the default. 26409 26410@item -muser-mode 26411@opindex muser-mode 26412Generate code for the user mode, where the access to some general registers 26413is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 26414mode; on the GR6, only registers r29 to r31 are affected. 26415@end table 26416 26417@node VMS Options 26418@subsection VMS Options 26419 26420These @samp{-m} options are defined for the VMS implementations: 26421 26422@table @gcctabopt 26423@item -mvms-return-codes 26424@opindex mvms-return-codes 26425Return VMS condition codes from @code{main}. The default is to return POSIX-style 26426condition (e.g.@ error) codes. 26427 26428@item -mdebug-main=@var{prefix} 26429@opindex mdebug-main=@var{prefix} 26430Flag the first routine whose name starts with @var{prefix} as the main 26431routine for the debugger. 26432 26433@item -mmalloc64 26434@opindex mmalloc64 26435Default to 64-bit memory allocation routines. 26436 26437@item -mpointer-size=@var{size} 26438@opindex mpointer-size=@var{size} 26439Set the default size of pointers. Possible options for @var{size} are 26440@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 26441for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 26442The later option disables @code{pragma pointer_size}. 26443@end table 26444 26445@node VxWorks Options 26446@subsection VxWorks Options 26447@cindex VxWorks Options 26448 26449The options in this section are defined for all VxWorks targets. 26450Options specific to the target hardware are listed with the other 26451options for that target. 26452 26453@table @gcctabopt 26454@item -mrtp 26455@opindex mrtp 26456GCC can generate code for both VxWorks kernels and real time processes 26457(RTPs). This option switches from the former to the latter. It also 26458defines the preprocessor macro @code{__RTP__}. 26459 26460@item -non-static 26461@opindex non-static 26462Link an RTP executable against shared libraries rather than static 26463libraries. The options @option{-static} and @option{-shared} can 26464also be used for RTPs (@pxref{Link Options}); @option{-static} 26465is the default. 26466 26467@item -Bstatic 26468@itemx -Bdynamic 26469@opindex Bstatic 26470@opindex Bdynamic 26471These options are passed down to the linker. They are defined for 26472compatibility with Diab. 26473 26474@item -Xbind-lazy 26475@opindex Xbind-lazy 26476Enable lazy binding of function calls. This option is equivalent to 26477@option{-Wl,-z,now} and is defined for compatibility with Diab. 26478 26479@item -Xbind-now 26480@opindex Xbind-now 26481Disable lazy binding of function calls. This option is the default and 26482is defined for compatibility with Diab. 26483@end table 26484 26485@node x86 Options 26486@subsection x86 Options 26487@cindex x86 Options 26488 26489These @samp{-m} options are defined for the x86 family of computers. 26490 26491@table @gcctabopt 26492 26493@item -march=@var{cpu-type} 26494@opindex march 26495Generate instructions for the machine type @var{cpu-type}. In contrast to 26496@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 26497for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 26498to generate code that may not run at all on processors other than the one 26499indicated. Specifying @option{-march=@var{cpu-type}} implies 26500@option{-mtune=@var{cpu-type}}. 26501 26502The choices for @var{cpu-type} are: 26503 26504@table @samp 26505@item native 26506This selects the CPU to generate code for at compilation time by determining 26507the processor type of the compiling machine. Using @option{-march=native} 26508enables all instruction subsets supported by the local machine (hence 26509the result might not run on different machines). Using @option{-mtune=native} 26510produces code optimized for the local machine under the constraints 26511of the selected instruction set. 26512 26513@item x86-64 26514A generic CPU with 64-bit extensions. 26515 26516@item i386 26517Original Intel i386 CPU@. 26518 26519@item i486 26520Intel i486 CPU@. (No scheduling is implemented for this chip.) 26521 26522@item i586 26523@itemx pentium 26524Intel Pentium CPU with no MMX support. 26525 26526@item lakemont 26527Intel Lakemont MCU, based on Intel Pentium CPU. 26528 26529@item pentium-mmx 26530Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 26531 26532@item pentiumpro 26533Intel Pentium Pro CPU@. 26534 26535@item i686 26536When used with @option{-march}, the Pentium Pro 26537instruction set is used, so the code runs on all i686 family chips. 26538When used with @option{-mtune}, it has the same meaning as @samp{generic}. 26539 26540@item pentium2 26541Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 26542support. 26543 26544@item pentium3 26545@itemx pentium3m 26546Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 26547set support. 26548 26549@item pentium-m 26550Intel Pentium M; low-power version of Intel Pentium III CPU 26551with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 26552 26553@item pentium4 26554@itemx pentium4m 26555Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 26556 26557@item prescott 26558Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 26559set support. 26560 26561@item nocona 26562Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 26563SSE2 and SSE3 instruction set support. 26564 26565@item core2 26566Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 26567instruction set support. 26568 26569@item nehalem 26570Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 26571SSE4.1, SSE4.2 and POPCNT instruction set support. 26572 26573@item westmere 26574Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 26575SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. 26576 26577@item sandybridge 26578Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 26579SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. 26580 26581@item ivybridge 26582Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 26583SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C 26584instruction set support. 26585 26586@item haswell 26587Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 26588SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 26589BMI, BMI2 and F16C instruction set support. 26590 26591@item broadwell 26592Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 26593SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 26594BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support. 26595 26596@item skylake 26597Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 26598SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 26599BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and 26600XSAVES instruction set support. 26601 26602@item bonnell 26603Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 26604instruction set support. 26605 26606@item silvermont 26607Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 26608SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support. 26609 26610@item knl 26611Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 26612SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 26613BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and 26614AVX512CD instruction set support. 26615 26616@item knm 26617Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 26618SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 26619BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD, 26620AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support. 26621 26622@item skylake-avx512 26623Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 26624SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 26625BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, 26626CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support. 26627 26628@item cannonlake 26629Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 26630SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 26631RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 26632XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 26633AVX512IFMA, SHA and UMIP instruction set support. 26634 26635@item icelake-client 26636Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 26637SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 26638RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 26639XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 26640AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 26641AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support. 26642 26643@item icelake-server 26644Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, 26645SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, 26646RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, 26647XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, 26648AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, 26649AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction 26650set support. 26651 26652@item k6 26653AMD K6 CPU with MMX instruction set support. 26654 26655@item k6-2 26656@itemx k6-3 26657Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 26658 26659@item athlon 26660@itemx athlon-tbird 26661AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 26662support. 26663 26664@item athlon-4 26665@itemx athlon-xp 26666@itemx athlon-mp 26667Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 26668instruction set support. 26669 26670@item k8 26671@itemx opteron 26672@itemx athlon64 26673@itemx athlon-fx 26674Processors based on the AMD K8 core with x86-64 instruction set support, 26675including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 26676(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 26677instruction set extensions.) 26678 26679@item k8-sse3 26680@itemx opteron-sse3 26681@itemx athlon64-sse3 26682Improved versions of AMD K8 cores with SSE3 instruction set support. 26683 26684@item amdfam10 26685@itemx barcelona 26686CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 26687supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 26688instruction set extensions.) 26689 26690@item bdver1 26691CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 26692supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 26693SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 26694@item bdver2 26695AMD Family 15h core based CPUs with x86-64 instruction set support. (This 26696supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, 26697SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 26698extensions.) 26699@item bdver3 26700AMD Family 15h core based CPUs with x86-64 instruction set support. (This 26701supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 26702PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 2670364-bit instruction set extensions. 26704@item bdver4 26705AMD Family 15h core based CPUs with x86-64 instruction set support. (This 26706supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 26707AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 26708SSE4.2, ABM and 64-bit instruction set extensions. 26709 26710@item znver1 26711AMD Family 17h core based CPUs with x86-64 instruction set support. (This 26712supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, 26713SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, 26714SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit 26715instruction set extensions. 26716 26717@item btver1 26718CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 26719supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 26720instruction set extensions.) 26721 26722@item btver2 26723CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 26724includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, 26725SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 26726 26727@item winchip-c6 26728IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 26729set support. 26730 26731@item winchip2 26732IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 26733instruction set support. 26734 26735@item c3 26736VIA C3 CPU with MMX and 3DNow!@: instruction set support. 26737(No scheduling is implemented for this chip.) 26738 26739@item c3-2 26740VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 26741(No scheduling is implemented for this chip.) 26742 26743@item c7 26744VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 26745(No scheduling is implemented for this chip.) 26746 26747@item samuel-2 26748VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support. 26749(No scheduling is implemented for this chip.) 26750 26751@item nehemiah 26752VIA Eden Nehemiah CPU with MMX and SSE instruction set support. 26753(No scheduling is implemented for this chip.) 26754 26755@item esther 26756VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 26757(No scheduling is implemented for this chip.) 26758 26759@item eden-x2 26760VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. 26761(No scheduling is implemented for this chip.) 26762 26763@item eden-x4 26764VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, 26765AVX and AVX2 instruction set support. 26766(No scheduling is implemented for this chip.) 26767 26768@item nano 26769Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 26770instruction set support. 26771(No scheduling is implemented for this chip.) 26772 26773@item nano-1000 26774VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 26775instruction set support. 26776(No scheduling is implemented for this chip.) 26777 26778@item nano-2000 26779VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 26780instruction set support. 26781(No scheduling is implemented for this chip.) 26782 26783@item nano-3000 26784VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 26785instruction set support. 26786(No scheduling is implemented for this chip.) 26787 26788@item nano-x2 26789VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 26790instruction set support. 26791(No scheduling is implemented for this chip.) 26792 26793@item nano-x4 26794VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 26795instruction set support. 26796(No scheduling is implemented for this chip.) 26797 26798@item geode 26799AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 26800@end table 26801 26802@item -mtune=@var{cpu-type} 26803@opindex mtune 26804Tune to @var{cpu-type} everything applicable about the generated code, except 26805for the ABI and the set of available instructions. 26806While picking a specific @var{cpu-type} schedules things appropriately 26807for that particular chip, the compiler does not generate any code that 26808cannot run on the default machine type unless you use a 26809@option{-march=@var{cpu-type}} option. 26810For example, if GCC is configured for i686-pc-linux-gnu 26811then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 26812but still runs on i686 machines. 26813 26814The choices for @var{cpu-type} are the same as for @option{-march}. 26815In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 26816 26817@table @samp 26818@item generic 26819Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 26820If you know the CPU on which your code will run, then you should use 26821the corresponding @option{-mtune} or @option{-march} option instead of 26822@option{-mtune=generic}. But, if you do not know exactly what CPU users 26823of your application will have, then you should use this option. 26824 26825As new processors are deployed in the marketplace, the behavior of this 26826option will change. Therefore, if you upgrade to a newer version of 26827GCC, code generation controlled by this option will change to reflect 26828the processors 26829that are most common at the time that version of GCC is released. 26830 26831There is no @option{-march=generic} option because @option{-march} 26832indicates the instruction set the compiler can use, and there is no 26833generic instruction set applicable to all processors. In contrast, 26834@option{-mtune} indicates the processor (or, in this case, collection of 26835processors) for which the code is optimized. 26836 26837@item intel 26838Produce code optimized for the most current Intel processors, which are 26839Haswell and Silvermont for this version of GCC. If you know the CPU 26840on which your code will run, then you should use the corresponding 26841@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 26842But, if you want your application performs better on both Haswell and 26843Silvermont, then you should use this option. 26844 26845As new Intel processors are deployed in the marketplace, the behavior of 26846this option will change. Therefore, if you upgrade to a newer version of 26847GCC, code generation controlled by this option will change to reflect 26848the most current Intel processors at the time that version of GCC is 26849released. 26850 26851There is no @option{-march=intel} option because @option{-march} indicates 26852the instruction set the compiler can use, and there is no common 26853instruction set applicable to all processors. In contrast, 26854@option{-mtune} indicates the processor (or, in this case, collection of 26855processors) for which the code is optimized. 26856@end table 26857 26858@item -mcpu=@var{cpu-type} 26859@opindex mcpu 26860A deprecated synonym for @option{-mtune}. 26861 26862@item -mfpmath=@var{unit} 26863@opindex mfpmath 26864Generate floating-point arithmetic for selected unit @var{unit}. The choices 26865for @var{unit} are: 26866 26867@table @samp 26868@item 387 26869Use the standard 387 floating-point coprocessor present on the majority of chips and 26870emulated otherwise. Code compiled with this option runs almost everywhere. 26871The temporary results are computed in 80-bit precision instead of the precision 26872specified by the type, resulting in slightly different results compared to most 26873of other chips. See @option{-ffloat-store} for more detailed description. 26874 26875This is the default choice for non-Darwin x86-32 targets. 26876 26877@item sse 26878Use scalar floating-point instructions present in the SSE instruction set. 26879This instruction set is supported by Pentium III and newer chips, 26880and in the AMD line 26881by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 26882instruction set supports only single-precision arithmetic, thus the double and 26883extended-precision arithmetic are still done using 387. A later version, present 26884only in Pentium 4 and AMD x86-64 chips, supports double-precision 26885arithmetic too. 26886 26887For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 26888or @option{-msse2} switches to enable SSE extensions and make this option 26889effective. For the x86-64 compiler, these extensions are enabled by default. 26890 26891The resulting code should be considerably faster in the majority of cases and avoid 26892the numerical instability problems of 387 code, but may break some existing 26893code that expects temporaries to be 80 bits. 26894 26895This is the default choice for the x86-64 compiler, Darwin x86-32 targets, 26896and the default choice for x86-32 targets with the SSE2 instruction set 26897when @option{-ffast-math} is enabled. 26898 26899@item sse,387 26900@itemx sse+387 26901@itemx both 26902Attempt to utilize both instruction sets at once. This effectively doubles the 26903amount of available registers, and on chips with separate execution units for 26904387 and SSE the execution resources too. Use this option with care, as it is 26905still experimental, because the GCC register allocator does not model separate 26906functional units well, resulting in unstable performance. 26907@end table 26908 26909@item -masm=@var{dialect} 26910@opindex masm=@var{dialect} 26911Output assembly instructions using selected @var{dialect}. Also affects 26912which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 26913extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 26914order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 26915not support @samp{intel}. 26916 26917@item -mieee-fp 26918@itemx -mno-ieee-fp 26919@opindex mieee-fp 26920@opindex mno-ieee-fp 26921Control whether or not the compiler uses IEEE floating-point 26922comparisons. These correctly handle the case where the result of a 26923comparison is unordered. 26924 26925@item -m80387 26926@itemx -mhard-float 26927@opindex 80387 26928@opindex mhard-float 26929Generate output containing 80387 instructions for floating point. 26930 26931@item -mno-80387 26932@itemx -msoft-float 26933@opindex no-80387 26934@opindex msoft-float 26935Generate output containing library calls for floating point. 26936 26937@strong{Warning:} the requisite libraries are not part of GCC@. 26938Normally the facilities of the machine's usual C compiler are used, but 26939this cannot be done directly in cross-compilation. You must make your 26940own arrangements to provide suitable library functions for 26941cross-compilation. 26942 26943On machines where a function returns floating-point results in the 80387 26944register stack, some floating-point opcodes may be emitted even if 26945@option{-msoft-float} is used. 26946 26947@item -mno-fp-ret-in-387 26948@opindex mno-fp-ret-in-387 26949Do not use the FPU registers for return values of functions. 26950 26951The usual calling convention has functions return values of types 26952@code{float} and @code{double} in an FPU register, even if there 26953is no FPU@. The idea is that the operating system should emulate 26954an FPU@. 26955 26956The option @option{-mno-fp-ret-in-387} causes such values to be returned 26957in ordinary CPU registers instead. 26958 26959@item -mno-fancy-math-387 26960@opindex mno-fancy-math-387 26961Some 387 emulators do not support the @code{sin}, @code{cos} and 26962@code{sqrt} instructions for the 387. Specify this option to avoid 26963generating those instructions. This option is the default on 26964OpenBSD and NetBSD@. This option is overridden when @option{-march} 26965indicates that the target CPU always has an FPU and so the 26966instruction does not need emulation. These 26967instructions are not generated unless you also use the 26968@option{-funsafe-math-optimizations} switch. 26969 26970@item -malign-double 26971@itemx -mno-align-double 26972@opindex malign-double 26973@opindex mno-align-double 26974Control whether GCC aligns @code{double}, @code{long double}, and 26975@code{long long} variables on a two-word boundary or a one-word 26976boundary. Aligning @code{double} variables on a two-word boundary 26977produces code that runs somewhat faster on a Pentium at the 26978expense of more memory. 26979 26980On x86-64, @option{-malign-double} is enabled by default. 26981 26982@strong{Warning:} if you use the @option{-malign-double} switch, 26983structures containing the above types are aligned differently than 26984the published application binary interface specifications for the x86-32 26985and are not binary compatible with structures in code compiled 26986without that switch. 26987 26988@item -m96bit-long-double 26989@itemx -m128bit-long-double 26990@opindex m96bit-long-double 26991@opindex m128bit-long-double 26992These switches control the size of @code{long double} type. The x86-32 26993application binary interface specifies the size to be 96 bits, 26994so @option{-m96bit-long-double} is the default in 32-bit mode. 26995 26996Modern architectures (Pentium and newer) prefer @code{long double} 26997to be aligned to an 8- or 16-byte boundary. In arrays or structures 26998conforming to the ABI, this is not possible. So specifying 26999@option{-m128bit-long-double} aligns @code{long double} 27000to a 16-byte boundary by padding the @code{long double} with an additional 2700132-bit zero. 27002 27003In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 27004its ABI specifies that @code{long double} is aligned on 16-byte boundary. 27005 27006Notice that neither of these options enable any extra precision over the x87 27007standard of 80 bits for a @code{long double}. 27008 27009@strong{Warning:} if you override the default value for your target ABI, this 27010changes the size of 27011structures and arrays containing @code{long double} variables, 27012as well as modifying the function calling convention for functions taking 27013@code{long double}. Hence they are not binary-compatible 27014with code compiled without that switch. 27015 27016@item -mlong-double-64 27017@itemx -mlong-double-80 27018@itemx -mlong-double-128 27019@opindex mlong-double-64 27020@opindex mlong-double-80 27021@opindex mlong-double-128 27022These switches control the size of @code{long double} type. A size 27023of 64 bits makes the @code{long double} type equivalent to the @code{double} 27024type. This is the default for 32-bit Bionic C library. A size 27025of 128 bits makes the @code{long double} type equivalent to the 27026@code{__float128} type. This is the default for 64-bit Bionic C library. 27027 27028@strong{Warning:} if you override the default value for your target ABI, this 27029changes the size of 27030structures and arrays containing @code{long double} variables, 27031as well as modifying the function calling convention for functions taking 27032@code{long double}. Hence they are not binary-compatible 27033with code compiled without that switch. 27034 27035@item -malign-data=@var{type} 27036@opindex malign-data 27037Control how GCC aligns variables. Supported values for @var{type} are 27038@samp{compat} uses increased alignment value compatible uses GCC 4.8 27039and earlier, @samp{abi} uses alignment value as specified by the 27040psABI, and @samp{cacheline} uses increased alignment value to match 27041the cache line size. @samp{compat} is the default. 27042 27043@item -mlarge-data-threshold=@var{threshold} 27044@opindex mlarge-data-threshold 27045When @option{-mcmodel=medium} is specified, data objects larger than 27046@var{threshold} are placed in the large data section. This value must be the 27047same across all objects linked into the binary, and defaults to 65535. 27048 27049@item -mrtd 27050@opindex mrtd 27051Use a different function-calling convention, in which functions that 27052take a fixed number of arguments return with the @code{ret @var{num}} 27053instruction, which pops their arguments while returning. This saves one 27054instruction in the caller since there is no need to pop the arguments 27055there. 27056 27057You can specify that an individual function is called with this calling 27058sequence with the function attribute @code{stdcall}. You can also 27059override the @option{-mrtd} option by using the function attribute 27060@code{cdecl}. @xref{Function Attributes}. 27061 27062@strong{Warning:} this calling convention is incompatible with the one 27063normally used on Unix, so you cannot use it if you need to call 27064libraries compiled with the Unix compiler. 27065 27066Also, you must provide function prototypes for all functions that 27067take variable numbers of arguments (including @code{printf}); 27068otherwise incorrect code is generated for calls to those 27069functions. 27070 27071In addition, seriously incorrect code results if you call a 27072function with too many arguments. (Normally, extra arguments are 27073harmlessly ignored.) 27074 27075@item -mregparm=@var{num} 27076@opindex mregparm 27077Control how many registers are used to pass integer arguments. By 27078default, no registers are used to pass arguments, and at most 3 27079registers can be used. You can control this behavior for a specific 27080function by using the function attribute @code{regparm}. 27081@xref{Function Attributes}. 27082 27083@strong{Warning:} if you use this switch, and 27084@var{num} is nonzero, then you must build all modules with the same 27085value, including any libraries. This includes the system libraries and 27086startup modules. 27087 27088@item -msseregparm 27089@opindex msseregparm 27090Use SSE register passing conventions for float and double arguments 27091and return values. You can control this behavior for a specific 27092function by using the function attribute @code{sseregparm}. 27093@xref{Function Attributes}. 27094 27095@strong{Warning:} if you use this switch then you must build all 27096modules with the same value, including any libraries. This includes 27097the system libraries and startup modules. 27098 27099@item -mvect8-ret-in-mem 27100@opindex mvect8-ret-in-mem 27101Return 8-byte vectors in memory instead of MMX registers. This is the 27102default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun 27103Studio compilers until version 12. Later compiler versions (starting 27104with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which 27105is the default on Solaris@tie{}10 and later. @emph{Only} use this option if 27106you need to remain compatible with existing code produced by those 27107previous compiler versions or older versions of GCC@. 27108 27109@item -mpc32 27110@itemx -mpc64 27111@itemx -mpc80 27112@opindex mpc32 27113@opindex mpc64 27114@opindex mpc80 27115 27116Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 27117is specified, the significands of results of floating-point operations are 27118rounded to 24 bits (single precision); @option{-mpc64} rounds the 27119significands of results of floating-point operations to 53 bits (double 27120precision) and @option{-mpc80} rounds the significands of results of 27121floating-point operations to 64 bits (extended double precision), which is 27122the default. When this option is used, floating-point operations in higher 27123precisions are not available to the programmer without setting the FPU 27124control word explicitly. 27125 27126Setting the rounding of floating-point operations to less than the default 2712780 bits can speed some programs by 2% or more. Note that some mathematical 27128libraries assume that extended-precision (80-bit) floating-point operations 27129are enabled by default; routines in such libraries could suffer significant 27130loss of accuracy, typically through so-called ``catastrophic cancellation'', 27131when this option is used to set the precision to less than extended precision. 27132 27133@item -mstackrealign 27134@opindex mstackrealign 27135Realign the stack at entry. On the x86, the @option{-mstackrealign} 27136option generates an alternate prologue and epilogue that realigns the 27137run-time stack if necessary. This supports mixing legacy codes that keep 271384-byte stack alignment with modern codes that keep 16-byte stack alignment for 27139SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 27140applicable to individual functions. 27141 27142@item -mpreferred-stack-boundary=@var{num} 27143@opindex mpreferred-stack-boundary 27144Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 27145byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 27146the default is 4 (16 bytes or 128 bits). 27147 27148@strong{Warning:} When generating code for the x86-64 architecture with 27149SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 27150used to keep the stack boundary aligned to 8 byte boundary. Since 27151x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 27152intended to be used in controlled environment where stack space is 27153important limitation. This option leads to wrong code when functions 27154compiled with 16 byte stack alignment (such as functions from a standard 27155library) are called with misaligned stack. In this case, SSE 27156instructions may lead to misaligned memory access traps. In addition, 27157variable arguments are handled incorrectly for 16 byte aligned 27158objects (including x87 long double and __int128), leading to wrong 27159results. You must build all modules with 27160@option{-mpreferred-stack-boundary=3}, including any libraries. This 27161includes the system libraries and startup modules. 27162 27163@item -mincoming-stack-boundary=@var{num} 27164@opindex mincoming-stack-boundary 27165Assume the incoming stack is aligned to a 2 raised to @var{num} byte 27166boundary. If @option{-mincoming-stack-boundary} is not specified, 27167the one specified by @option{-mpreferred-stack-boundary} is used. 27168 27169On Pentium and Pentium Pro, @code{double} and @code{long double} values 27170should be aligned to an 8-byte boundary (see @option{-malign-double}) or 27171suffer significant run time performance penalties. On Pentium III, the 27172Streaming SIMD Extension (SSE) data type @code{__m128} may not work 27173properly if it is not 16-byte aligned. 27174 27175To ensure proper alignment of this values on the stack, the stack boundary 27176must be as aligned as that required by any value stored on the stack. 27177Further, every function must be generated such that it keeps the stack 27178aligned. Thus calling a function compiled with a higher preferred 27179stack boundary from a function compiled with a lower preferred stack 27180boundary most likely misaligns the stack. It is recommended that 27181libraries that use callbacks always use the default setting. 27182 27183This extra alignment does consume extra stack space, and generally 27184increases code size. Code that is sensitive to stack space usage, such 27185as embedded systems and operating system kernels, may want to reduce the 27186preferred alignment to @option{-mpreferred-stack-boundary=2}. 27187 27188@need 200 27189@item -mmmx 27190@opindex mmmx 27191@need 200 27192@itemx -msse 27193@opindex msse 27194@need 200 27195@itemx -msse2 27196@opindex msse2 27197@need 200 27198@itemx -msse3 27199@opindex msse3 27200@need 200 27201@itemx -mssse3 27202@opindex mssse3 27203@need 200 27204@itemx -msse4 27205@opindex msse4 27206@need 200 27207@itemx -msse4a 27208@opindex msse4a 27209@need 200 27210@itemx -msse4.1 27211@opindex msse4.1 27212@need 200 27213@itemx -msse4.2 27214@opindex msse4.2 27215@need 200 27216@itemx -mavx 27217@opindex mavx 27218@need 200 27219@itemx -mavx2 27220@opindex mavx2 27221@need 200 27222@itemx -mavx512f 27223@opindex mavx512f 27224@need 200 27225@itemx -mavx512pf 27226@opindex mavx512pf 27227@need 200 27228@itemx -mavx512er 27229@opindex mavx512er 27230@need 200 27231@itemx -mavx512cd 27232@opindex mavx512cd 27233@need 200 27234@itemx -mavx512vl 27235@opindex mavx512vl 27236@need 200 27237@itemx -mavx512bw 27238@opindex mavx512bw 27239@need 200 27240@itemx -mavx512dq 27241@opindex mavx512dq 27242@need 200 27243@itemx -mavx512ifma 27244@opindex mavx512ifma 27245@need 200 27246@itemx -mavx512vbmi 27247@opindex mavx512vbmi 27248@need 200 27249@itemx -msha 27250@opindex msha 27251@need 200 27252@itemx -maes 27253@opindex maes 27254@need 200 27255@itemx -mpclmul 27256@opindex mpclmul 27257@need 200 27258@itemx -mclflushopt 27259@opindex mclflushopt 27260@need 200 27261@itemx -mclwb 27262@opindex mclwb 27263@need 200 27264@itemx -mfsgsbase 27265@opindex mfsgsbase 27266@need 200 27267@itemx -mrdrnd 27268@opindex mrdrnd 27269@need 200 27270@itemx -mf16c 27271@opindex mf16c 27272@need 200 27273@itemx -mfma 27274@opindex mfma 27275@need 200 27276@itemx -mpconfig 27277@opindex mpconfig 27278@need 200 27279@itemx -mwbnoinvd 27280@opindex mwbnoinvd 27281@need 200 27282@itemx -mfma4 27283@opindex mfma4 27284@need 200 27285@itemx -mprfchw 27286@opindex mprfchw 27287@need 200 27288@itemx -mrdpid 27289@opindex mrdpid 27290@need 200 27291@itemx -mprefetchwt1 27292@opindex mprefetchwt1 27293@need 200 27294@itemx -mrdseed 27295@opindex mrdseed 27296@need 200 27297@itemx -msgx 27298@opindex msgx 27299@need 200 27300@itemx -mxop 27301@opindex mxop 27302@need 200 27303@itemx -mlwp 27304@opindex mlwp 27305@need 200 27306@itemx -m3dnow 27307@opindex m3dnow 27308@need 200 27309@itemx -m3dnowa 27310@opindex m3dnowa 27311@need 200 27312@itemx -mpopcnt 27313@opindex mpopcnt 27314@need 200 27315@itemx -mabm 27316@opindex mabm 27317@need 200 27318@itemx -madx 27319@opindex madx 27320@need 200 27321@itemx -mbmi 27322@opindex mbmi 27323@need 200 27324@itemx -mbmi2 27325@opindex mbmi2 27326@need 200 27327@itemx -mlzcnt 27328@opindex mlzcnt 27329@need 200 27330@itemx -mfxsr 27331@opindex mfxsr 27332@need 200 27333@itemx -mxsave 27334@opindex mxsave 27335@need 200 27336@itemx -mxsaveopt 27337@opindex mxsaveopt 27338@need 200 27339@itemx -mxsavec 27340@opindex mxsavec 27341@need 200 27342@itemx -mxsaves 27343@opindex mxsaves 27344@need 200 27345@itemx -mrtm 27346@opindex mrtm 27347@need 200 27348@itemx -mhle 27349@opindex mhle 27350@need 200 27351@itemx -mtbm 27352@opindex mtbm 27353@need 200 27354@itemx -mmpx 27355@opindex mmpx 27356@need 200 27357@itemx -mmwaitx 27358@opindex mmwaitx 27359@need 200 27360@itemx -mclzero 27361@opindex mclzero 27362@need 200 27363@itemx -mpku 27364@opindex mpku 27365@need 200 27366@itemx -mavx512vbmi2 27367@opindex mavx512vbmi2 27368@need 200 27369@itemx -mgfni 27370@opindex mgfni 27371@need 200 27372@itemx -mvaes 27373@opindex mvaes 27374@need 200 27375@itemx -mvpclmulqdq 27376@opindex mvpclmulqdq 27377@need 200 27378@itemx -mavx512bitalg 27379@opindex mavx512bitalg 27380@need 200 27381@itemx -mmovdiri 27382@opindex mmovdiri 27383@need 200 27384@itemx -mmovdir64b 27385@opindex mmovdir64b 27386@need 200 27387@itemx -mavx512vpopcntdq 27388@opindex mavx512vpopcntdq 27389@need 200 27390@itemx -mavx5124fmaps 27391@opindex mavx5124fmaps 27392@need 200 27393@itemx -mavx512vnni 27394@opindex mavx512vnni 27395@need 200 27396@itemx -mavx5124vnniw 27397@opindex mavx5124vnniw 27398These switches enable the use of instructions in the MMX, SSE, 27399SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF, 27400AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA, 27401AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, RDRND, F16C, FMA, PCONFIG, 27402WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 274033DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE, 27404XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MPX, MWAITX, CLZERO, PKU, AVX512VBMI2, 27405GFNI, VAES, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, 27406AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, or AVX5124VNNIW 27407extended instruction sets. Each has a corresponding @option{-mno-} option to 27408disable use of these instructions. 27409 27410These extensions are also available as built-in functions: see 27411@ref{x86 Built-in Functions}, for details of the functions enabled and 27412disabled by these switches. 27413 27414To generate SSE/SSE2 instructions automatically from floating-point 27415code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 27416 27417GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 27418generates new AVX instructions or AVX equivalence for all SSEx instructions 27419when needed. 27420 27421These options enable GCC to use these extended instructions in 27422generated code, even without @option{-mfpmath=sse}. Applications that 27423perform run-time CPU detection must compile separate files for each 27424supported architecture, using the appropriate flags. In particular, 27425the file containing the CPU detection code should be compiled without 27426these options. 27427 27428@item -mdump-tune-features 27429@opindex mdump-tune-features 27430This option instructs GCC to dump the names of the x86 performance 27431tuning features and default settings. The names can be used in 27432@option{-mtune-ctrl=@var{feature-list}}. 27433 27434@item -mtune-ctrl=@var{feature-list} 27435@opindex mtune-ctrl=@var{feature-list} 27436This option is used to do fine grain control of x86 code generation features. 27437@var{feature-list} is a comma separated list of @var{feature} names. See also 27438@option{-mdump-tune-features}. When specified, the @var{feature} is turned 27439on if it is not preceded with @samp{^}, otherwise, it is turned off. 27440@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 27441developers. Using it may lead to code paths not covered by testing and can 27442potentially result in compiler ICEs or runtime errors. 27443 27444@item -mno-default 27445@opindex mno-default 27446This option instructs GCC to turn off all tunable features. See also 27447@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 27448 27449@item -mcld 27450@opindex mcld 27451This option instructs GCC to emit a @code{cld} instruction in the prologue 27452of functions that use string instructions. String instructions depend on 27453the DF flag to select between autoincrement or autodecrement mode. While the 27454ABI specifies the DF flag to be cleared on function entry, some operating 27455systems violate this specification by not clearing the DF flag in their 27456exception dispatchers. The exception handler can be invoked with the DF flag 27457set, which leads to wrong direction mode when string instructions are used. 27458This option can be enabled by default on 32-bit x86 targets by configuring 27459GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 27460instructions can be suppressed with the @option{-mno-cld} compiler option 27461in this case. 27462 27463@item -mvzeroupper 27464@opindex mvzeroupper 27465This option instructs GCC to emit a @code{vzeroupper} instruction 27466before a transfer of control flow out of the function to minimize 27467the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 27468intrinsics. 27469 27470@item -mprefer-avx128 27471@opindex mprefer-avx128 27472This option instructs GCC to use 128-bit AVX instructions instead of 27473256-bit AVX instructions in the auto-vectorizer. 27474 27475@item -mprefer-vector-width=@var{opt} 27476@opindex mprefer-vector-width 27477This option instructs GCC to use @var{opt}-bit vector width in instructions 27478instead of default on the selected platform. 27479 27480@table @samp 27481@item none 27482No extra limitations applied to GCC other than defined by the selected platform. 27483 27484@item 128 27485Prefer 128-bit vector width for instructions. 27486 27487@item 256 27488Prefer 256-bit vector width for instructions. 27489 27490@item 512 27491Prefer 512-bit vector width for instructions. 27492@end table 27493 27494@item -mcx16 27495@opindex mcx16 27496This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit 27497code to implement compare-and-exchange operations on 16-byte aligned 128-bit 27498objects. This is useful for atomic updates of data structures exceeding one 27499machine word in size. The compiler uses this instruction to implement 27500@ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on 27501128-bit integers, a library call is always used. 27502 27503@item -msahf 27504@opindex msahf 27505This option enables generation of @code{SAHF} instructions in 64-bit code. 27506Early Intel Pentium 4 CPUs with Intel 64 support, 27507prior to the introduction of Pentium 4 G1 step in December 2005, 27508lacked the @code{LAHF} and @code{SAHF} instructions 27509which are supported by AMD64. 27510These are load and store instructions, respectively, for certain status flags. 27511In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 27512@code{drem}, and @code{remainder} built-in functions; 27513see @ref{Other Builtins} for details. 27514 27515@item -mmovbe 27516@opindex mmovbe 27517This option enables use of the @code{movbe} instruction to implement 27518@code{__builtin_bswap32} and @code{__builtin_bswap64}. 27519 27520@item -mshstk 27521@opindex mshstk 27522The @option{-mshstk} option enables shadow stack built-in functions 27523from x86 Control-flow Enforcement Technology (CET). 27524 27525@item -mcrc32 27526@opindex mcrc32 27527This option enables built-in functions @code{__builtin_ia32_crc32qi}, 27528@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 27529@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 27530 27531@item -mrecip 27532@opindex mrecip 27533This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 27534(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 27535with an additional Newton-Raphson step 27536to increase precision instead of @code{DIVSS} and @code{SQRTSS} 27537(and their vectorized 27538variants) for single-precision floating-point arguments. These instructions 27539are generated only when @option{-funsafe-math-optimizations} is enabled 27540together with @option{-ffinite-math-only} and @option{-fno-trapping-math}. 27541Note that while the throughput of the sequence is higher than the throughput 27542of the non-reciprocal instruction, the precision of the sequence can be 27543decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994). 27544 27545Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 27546(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 27547combination), and doesn't need @option{-mrecip}. 27548 27549Also note that GCC emits the above sequence with additional Newton-Raphson step 27550for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 27551already with @option{-ffast-math} (or the above option combination), and 27552doesn't need @option{-mrecip}. 27553 27554@item -mrecip=@var{opt} 27555@opindex mrecip=opt 27556This option controls which reciprocal estimate instructions 27557may be used. @var{opt} is a comma-separated list of options, which may 27558be preceded by a @samp{!} to invert the option: 27559 27560@table @samp 27561@item all 27562Enable all estimate instructions. 27563 27564@item default 27565Enable the default instructions, equivalent to @option{-mrecip}. 27566 27567@item none 27568Disable all estimate instructions, equivalent to @option{-mno-recip}. 27569 27570@item div 27571Enable the approximation for scalar division. 27572 27573@item vec-div 27574Enable the approximation for vectorized division. 27575 27576@item sqrt 27577Enable the approximation for scalar square root. 27578 27579@item vec-sqrt 27580Enable the approximation for vectorized square root. 27581@end table 27582 27583So, for example, @option{-mrecip=all,!sqrt} enables 27584all of the reciprocal approximations, except for square root. 27585 27586@item -mveclibabi=@var{type} 27587@opindex mveclibabi 27588Specifies the ABI type to use for vectorizing intrinsics using an 27589external library. Supported values for @var{type} are @samp{svml} 27590for the Intel short 27591vector math library and @samp{acml} for the AMD math core library. 27592To use this option, both @option{-ftree-vectorize} and 27593@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 27594ABI-compatible library must be specified at link time. 27595 27596GCC currently emits calls to @code{vmldExp2}, 27597@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2}, 27598@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 27599@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 27600@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 27601@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, 27602@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 27603@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 27604@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 27605@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 27606function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 27607@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 27608@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 27609@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 27610@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 27611when @option{-mveclibabi=acml} is used. 27612 27613@item -mabi=@var{name} 27614@opindex mabi 27615Generate code for the specified calling convention. Permissible values 27616are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 27617@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 27618ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 27619You can control this behavior for specific functions by 27620using the function attributes @code{ms_abi} and @code{sysv_abi}. 27621@xref{Function Attributes}. 27622 27623@item -mforce-indirect-call 27624@opindex mforce-indirect-call 27625Force all calls to functions to be indirect. This is useful 27626when using Intel Processor Trace where it generates more precise timing 27627information for function calls. 27628 27629@item -mcall-ms2sysv-xlogues 27630@opindex mcall-ms2sysv-xlogues 27631@opindex mno-call-ms2sysv-xlogues 27632Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a 27633System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By 27634default, the code for saving and restoring these registers is emitted inline, 27635resulting in fairly lengthy prologues and epilogues. Using 27636@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that 27637use stubs in the static portion of libgcc to perform these saves and restores, 27638thus reducing function size at the cost of a few extra instructions. 27639 27640@item -mtls-dialect=@var{type} 27641@opindex mtls-dialect 27642Generate code to access thread-local storage using the @samp{gnu} or 27643@samp{gnu2} conventions. @samp{gnu} is the conservative default; 27644@samp{gnu2} is more efficient, but it may add compile- and run-time 27645requirements that cannot be satisfied on all systems. 27646 27647@item -mpush-args 27648@itemx -mno-push-args 27649@opindex mpush-args 27650@opindex mno-push-args 27651Use PUSH operations to store outgoing parameters. This method is shorter 27652and usually equally fast as method using SUB/MOV operations and is enabled 27653by default. In some cases disabling it may improve performance because of 27654improved scheduling and reduced dependencies. 27655 27656@item -maccumulate-outgoing-args 27657@opindex maccumulate-outgoing-args 27658If enabled, the maximum amount of space required for outgoing arguments is 27659computed in the function prologue. This is faster on most modern CPUs 27660because of reduced dependencies, improved scheduling and reduced stack usage 27661when the preferred stack boundary is not equal to 2. The drawback is a notable 27662increase in code size. This switch implies @option{-mno-push-args}. 27663 27664@item -mthreads 27665@opindex mthreads 27666Support thread-safe exception handling on MinGW. Programs that rely 27667on thread-safe exception handling must compile and link all code with the 27668@option{-mthreads} option. When compiling, @option{-mthreads} defines 27669@option{-D_MT}; when linking, it links in a special thread helper library 27670@option{-lmingwthrd} which cleans up per-thread exception-handling data. 27671 27672@item -mms-bitfields 27673@itemx -mno-ms-bitfields 27674@opindex mms-bitfields 27675@opindex mno-ms-bitfields 27676 27677Enable/disable bit-field layout compatible with the native Microsoft 27678Windows compiler. 27679 27680If @code{packed} is used on a structure, or if bit-fields are used, 27681it may be that the Microsoft ABI lays out the structure differently 27682than the way GCC normally does. Particularly when moving packed 27683data between functions compiled with GCC and the native Microsoft compiler 27684(either via function call or as data in a file), it may be necessary to access 27685either format. 27686 27687This option is enabled by default for Microsoft Windows 27688targets. This behavior can also be controlled locally by use of variable 27689or type attributes. For more information, see @ref{x86 Variable Attributes} 27690and @ref{x86 Type Attributes}. 27691 27692The Microsoft structure layout algorithm is fairly simple with the exception 27693of the bit-field packing. 27694The padding and alignment of members of structures and whether a bit-field 27695can straddle a storage-unit boundary are determine by these rules: 27696 27697@enumerate 27698@item Structure members are stored sequentially in the order in which they are 27699declared: the first member has the lowest memory address and the last member 27700the highest. 27701 27702@item Every data object has an alignment requirement. The alignment requirement 27703for all data except structures, unions, and arrays is either the size of the 27704object or the current packing size (specified with either the 27705@code{aligned} attribute or the @code{pack} pragma), 27706whichever is less. For structures, unions, and arrays, 27707the alignment requirement is the largest alignment requirement of its members. 27708Every object is allocated an offset so that: 27709 27710@smallexample 27711offset % alignment_requirement == 0 27712@end smallexample 27713 27714@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation 27715unit if the integral types are the same size and if the next bit-field fits 27716into the current allocation unit without crossing the boundary imposed by the 27717common alignment requirements of the bit-fields. 27718@end enumerate 27719 27720MSVC interprets zero-length bit-fields in the following ways: 27721 27722@enumerate 27723@item If a zero-length bit-field is inserted between two bit-fields that 27724are normally coalesced, the bit-fields are not coalesced. 27725 27726For example: 27727 27728@smallexample 27729struct 27730 @{ 27731 unsigned long bf_1 : 12; 27732 unsigned long : 0; 27733 unsigned long bf_2 : 12; 27734 @} t1; 27735@end smallexample 27736 27737@noindent 27738The size of @code{t1} is 8 bytes with the zero-length bit-field. If the 27739zero-length bit-field were removed, @code{t1}'s size would be 4 bytes. 27740 27741@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the 27742alignment of the zero-length bit-field is greater than the member that follows it, 27743@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field. 27744 27745For example: 27746 27747@smallexample 27748struct 27749 @{ 27750 char foo : 4; 27751 short : 0; 27752 char bar; 27753 @} t2; 27754 27755struct 27756 @{ 27757 char foo : 4; 27758 short : 0; 27759 double bar; 27760 @} t3; 27761@end smallexample 27762 27763@noindent 27764For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1. 27765Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length 27766bit-field does not affect the alignment of @code{bar} or, as a result, the size 27767of the structure. 27768 27769Taking this into account, it is important to note the following: 27770 27771@enumerate 27772@item If a zero-length bit-field follows a normal bit-field, the type of the 27773zero-length bit-field may affect the alignment of the structure as whole. For 27774example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a 27775normal bit-field, and is of type short. 27776 27777@item Even if a zero-length bit-field is not followed by a normal bit-field, it may 27778still affect the alignment of the structure: 27779 27780@smallexample 27781struct 27782 @{ 27783 char foo : 6; 27784 long : 0; 27785 @} t4; 27786@end smallexample 27787 27788@noindent 27789Here, @code{t4} takes up 4 bytes. 27790@end enumerate 27791 27792@item Zero-length bit-fields following non-bit-field members are ignored: 27793 27794@smallexample 27795struct 27796 @{ 27797 char foo; 27798 long : 0; 27799 char bar; 27800 @} t5; 27801@end smallexample 27802 27803@noindent 27804Here, @code{t5} takes up 2 bytes. 27805@end enumerate 27806 27807 27808@item -mno-align-stringops 27809@opindex mno-align-stringops 27810Do not align the destination of inlined string operations. This switch reduces 27811code size and improves performance in case the destination is already aligned, 27812but GCC doesn't know about it. 27813 27814@item -minline-all-stringops 27815@opindex minline-all-stringops 27816By default GCC inlines string operations only when the destination is 27817known to be aligned to least a 4-byte boundary. 27818This enables more inlining and increases code 27819size, but may improve performance of code that depends on fast 27820@code{memcpy}, @code{strlen}, 27821and @code{memset} for short lengths. 27822 27823@item -minline-stringops-dynamically 27824@opindex minline-stringops-dynamically 27825For string operations of unknown size, use run-time checks with 27826inline code for small blocks and a library call for large blocks. 27827 27828@item -mstringop-strategy=@var{alg} 27829@opindex mstringop-strategy=@var{alg} 27830Override the internal decision heuristic for the particular algorithm to use 27831for inlining string operations. The allowed values for @var{alg} are: 27832 27833@table @samp 27834@item rep_byte 27835@itemx rep_4byte 27836@itemx rep_8byte 27837Expand using i386 @code{rep} prefix of the specified size. 27838 27839@item byte_loop 27840@itemx loop 27841@itemx unrolled_loop 27842Expand into an inline loop. 27843 27844@item libcall 27845Always use a library call. 27846@end table 27847 27848@item -mmemcpy-strategy=@var{strategy} 27849@opindex mmemcpy-strategy=@var{strategy} 27850Override the internal decision heuristic to decide if @code{__builtin_memcpy} 27851should be inlined and what inline algorithm to use when the expected size 27852of the copy operation is known. @var{strategy} 27853is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 27854@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 27855the max byte size with which inline algorithm @var{alg} is allowed. For the last 27856triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 27857in the list must be specified in increasing order. The minimal byte size for 27858@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 27859preceding range. 27860 27861@item -mmemset-strategy=@var{strategy} 27862@opindex mmemset-strategy=@var{strategy} 27863The option is similar to @option{-mmemcpy-strategy=} except that it is to control 27864@code{__builtin_memset} expansion. 27865 27866@item -momit-leaf-frame-pointer 27867@opindex momit-leaf-frame-pointer 27868Don't keep the frame pointer in a register for leaf functions. This 27869avoids the instructions to save, set up, and restore frame pointers and 27870makes an extra register available in leaf functions. The option 27871@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 27872which might make debugging harder. 27873 27874@item -mtls-direct-seg-refs 27875@itemx -mno-tls-direct-seg-refs 27876@opindex mtls-direct-seg-refs 27877Controls whether TLS variables may be accessed with offsets from the 27878TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 27879or whether the thread base pointer must be added. Whether or not this 27880is valid depends on the operating system, and whether it maps the 27881segment to cover the entire TLS area. 27882 27883For systems that use the GNU C Library, the default is on. 27884 27885@item -msse2avx 27886@itemx -mno-sse2avx 27887@opindex msse2avx 27888Specify that the assembler should encode SSE instructions with VEX 27889prefix. The option @option{-mavx} turns this on by default. 27890 27891@item -mfentry 27892@itemx -mno-fentry 27893@opindex mfentry 27894If profiling is active (@option{-pg}), put the profiling 27895counter call before the prologue. 27896Note: On x86 architectures the attribute @code{ms_hook_prologue} 27897isn't possible at the moment for @option{-mfentry} and @option{-pg}. 27898 27899@item -mrecord-mcount 27900@itemx -mno-record-mcount 27901@opindex mrecord-mcount 27902If profiling is active (@option{-pg}), generate a __mcount_loc section 27903that contains pointers to each profiling call. This is useful for 27904automatically patching and out calls. 27905 27906@item -mnop-mcount 27907@itemx -mno-nop-mcount 27908@opindex mnop-mcount 27909If profiling is active (@option{-pg}), generate the calls to 27910the profiling functions as NOPs. This is useful when they 27911should be patched in later dynamically. This is likely only 27912useful together with @option{-mrecord-mcount}. 27913 27914@item -mskip-rax-setup 27915@itemx -mno-skip-rax-setup 27916@opindex mskip-rax-setup 27917When generating code for the x86-64 architecture with SSE extensions 27918disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 27919register when there are no variable arguments passed in vector registers. 27920 27921@strong{Warning:} Since RAX register is used to avoid unnecessarily 27922saving vector registers on stack when passing variable arguments, the 27923impacts of this option are callees may waste some stack space, 27924misbehave or jump to a random location. GCC 4.4 or newer don't have 27925those issues, regardless the RAX register value. 27926 27927@item -m8bit-idiv 27928@itemx -mno-8bit-idiv 27929@opindex m8bit-idiv 27930On some processors, like Intel Atom, 8-bit unsigned integer divide is 27931much faster than 32-bit/64-bit integer divide. This option generates a 27932run-time check. If both dividend and divisor are within range of 0 27933to 255, 8-bit unsigned integer divide is used instead of 2793432-bit/64-bit integer divide. 27935 27936@item -mavx256-split-unaligned-load 27937@itemx -mavx256-split-unaligned-store 27938@opindex mavx256-split-unaligned-load 27939@opindex mavx256-split-unaligned-store 27940Split 32-byte AVX unaligned load and store. 27941 27942@item -mstack-protector-guard=@var{guard} 27943@itemx -mstack-protector-guard-reg=@var{reg} 27944@itemx -mstack-protector-guard-offset=@var{offset} 27945@opindex mstack-protector-guard 27946@opindex mstack-protector-guard-reg 27947@opindex mstack-protector-guard-offset 27948Generate stack protection code using canary at @var{guard}. Supported 27949locations are @samp{global} for global canary or @samp{tls} for per-thread 27950canary in the TLS block (the default). This option has effect only when 27951@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 27952 27953With the latter choice the options 27954@option{-mstack-protector-guard-reg=@var{reg}} and 27955@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify 27956which segment register (@code{%fs} or @code{%gs}) to use as base register 27957for reading the canary, and from what offset from that base register. 27958The default for those is as specified in the relevant ABI. 27959 27960@item -mmitigate-rop 27961@opindex mmitigate-rop 27962Try to avoid generating code sequences that contain unintended return 27963opcodes, to mitigate against certain forms of attack. At the moment, 27964this option is limited in what it can do and should not be relied 27965on to provide serious protection. 27966 27967@item -mgeneral-regs-only 27968@opindex mgeneral-regs-only 27969Generate code that uses only the general-purpose registers. This 27970prevents the compiler from using floating-point, vector, mask and bound 27971registers. 27972 27973@item -mindirect-branch=@var{choice} 27974@opindex -mindirect-branch 27975Convert indirect call and jump with @var{choice}. The default is 27976@samp{keep}, which keeps indirect call and jump unmodified. 27977@samp{thunk} converts indirect call and jump to call and return thunk. 27978@samp{thunk-inline} converts indirect call and jump to inlined call 27979and return thunk. @samp{thunk-extern} converts indirect call and jump 27980to external call and return thunk provided in a separate object file. 27981You can control this behavior for a specific function by using the 27982function attribute @code{indirect_branch}. @xref{Function Attributes}. 27983 27984Note that @option{-mcmodel=large} is incompatible with 27985@option{-mindirect-branch=thunk} and 27986@option{-mindirect-branch=thunk-extern} since the thunk function may 27987not be reachable in the large code model. 27988 27989Note that @option{-mindirect-branch=thunk-extern} is incompatible with 27990@option{-fcf-protection=branch} and @option{-fcheck-pointer-bounds} 27991since the external thunk can not be modified to disable control-flow 27992check. 27993 27994@item -mfunction-return=@var{choice} 27995@opindex -mfunction-return 27996Convert function return with @var{choice}. The default is @samp{keep}, 27997which keeps function return unmodified. @samp{thunk} converts function 27998return to call and return thunk. @samp{thunk-inline} converts function 27999return to inlined call and return thunk. @samp{thunk-extern} converts 28000function return to external call and return thunk provided in a separate 28001object file. You can control this behavior for a specific function by 28002using the function attribute @code{function_return}. 28003@xref{Function Attributes}. 28004 28005Note that @option{-mcmodel=large} is incompatible with 28006@option{-mfunction-return=thunk} and 28007@option{-mfunction-return=thunk-extern} since the thunk function may 28008not be reachable in the large code model. 28009 28010 28011@item -mindirect-branch-register 28012@opindex -mindirect-branch-register 28013Force indirect call and jump via register. 28014 28015@end table 28016 28017These @samp{-m} switches are supported in addition to the above 28018on x86-64 processors in 64-bit environments. 28019 28020@table @gcctabopt 28021@item -m32 28022@itemx -m64 28023@itemx -mx32 28024@itemx -m16 28025@itemx -miamcu 28026@opindex m32 28027@opindex m64 28028@opindex mx32 28029@opindex m16 28030@opindex miamcu 28031Generate code for a 16-bit, 32-bit or 64-bit environment. 28032The @option{-m32} option sets @code{int}, @code{long}, and pointer types 28033to 32 bits, and 28034generates code that runs on any i386 system. 28035 28036The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 28037types to 64 bits, and generates code for the x86-64 architecture. 28038For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 28039and @option{-mdynamic-no-pic} options. 28040 28041The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 28042to 32 bits, and 28043generates code for the x86-64 architecture. 28044 28045The @option{-m16} option is the same as @option{-m32}, except for that 28046it outputs the @code{.code16gcc} assembly directive at the beginning of 28047the assembly output so that the binary can run in 16-bit mode. 28048 28049The @option{-miamcu} option generates code which conforms to Intel MCU 28050psABI. It requires the @option{-m32} option to be turned on. 28051 28052@item -mno-red-zone 28053@opindex mno-red-zone 28054Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 28055by the x86-64 ABI; it is a 128-byte area beyond the location of the 28056stack pointer that is not modified by signal or interrupt handlers 28057and therefore can be used for temporary data without adjusting the stack 28058pointer. The flag @option{-mno-red-zone} disables this red zone. 28059 28060@item -mcmodel=small 28061@opindex mcmodel=small 28062Generate code for the small code model: the program and its symbols must 28063be linked in the lower 2 GB of the address space. Pointers are 64 bits. 28064Programs can be statically or dynamically linked. This is the default 28065code model. 28066 28067@item -mcmodel=kernel 28068@opindex mcmodel=kernel 28069Generate code for the kernel code model. The kernel runs in the 28070negative 2 GB of the address space. 28071This model has to be used for Linux kernel code. 28072 28073@item -mcmodel=medium 28074@opindex mcmodel=medium 28075Generate code for the medium model: the program is linked in the lower 2 28076GB of the address space. Small symbols are also placed there. Symbols 28077with sizes larger than @option{-mlarge-data-threshold} are put into 28078large data or BSS sections and can be located above 2GB. Programs can 28079be statically or dynamically linked. 28080 28081@item -mcmodel=large 28082@opindex mcmodel=large 28083Generate code for the large model. This model makes no assumptions 28084about addresses and sizes of sections. 28085 28086@item -maddress-mode=long 28087@opindex maddress-mode=long 28088Generate code for long address mode. This is only supported for 64-bit 28089and x32 environments. It is the default address mode for 64-bit 28090environments. 28091 28092@item -maddress-mode=short 28093@opindex maddress-mode=short 28094Generate code for short address mode. This is only supported for 32-bit 28095and x32 environments. It is the default address mode for 32-bit and 28096x32 environments. 28097@end table 28098 28099@node x86 Windows Options 28100@subsection x86 Windows Options 28101@cindex x86 Windows Options 28102@cindex Windows Options for x86 28103 28104These additional options are available for Microsoft Windows targets: 28105 28106@table @gcctabopt 28107@item -mconsole 28108@opindex mconsole 28109This option 28110specifies that a console application is to be generated, by 28111instructing the linker to set the PE header subsystem type 28112required for console applications. 28113This option is available for Cygwin and MinGW targets and is 28114enabled by default on those targets. 28115 28116@item -mdll 28117@opindex mdll 28118This option is available for Cygwin and MinGW targets. It 28119specifies that a DLL---a dynamic link library---is to be 28120generated, enabling the selection of the required runtime 28121startup object and entry point. 28122 28123@item -mnop-fun-dllimport 28124@opindex mnop-fun-dllimport 28125This option is available for Cygwin and MinGW targets. It 28126specifies that the @code{dllimport} attribute should be ignored. 28127 28128@item -mthread 28129@opindex mthread 28130This option is available for MinGW targets. It specifies 28131that MinGW-specific thread support is to be used. 28132 28133@item -municode 28134@opindex municode 28135This option is available for MinGW-w64 targets. It causes 28136the @code{UNICODE} preprocessor macro to be predefined, and 28137chooses Unicode-capable runtime startup code. 28138 28139@item -mwin32 28140@opindex mwin32 28141This option is available for Cygwin and MinGW targets. It 28142specifies that the typical Microsoft Windows predefined macros are to 28143be set in the pre-processor, but does not influence the choice 28144of runtime library/startup code. 28145 28146@item -mwindows 28147@opindex mwindows 28148This option is available for Cygwin and MinGW targets. It 28149specifies that a GUI application is to be generated by 28150instructing the linker to set the PE header subsystem type 28151appropriately. 28152 28153@item -fno-set-stack-executable 28154@opindex fno-set-stack-executable 28155This option is available for MinGW targets. It specifies that 28156the executable flag for the stack used by nested functions isn't 28157set. This is necessary for binaries running in kernel mode of 28158Microsoft Windows, as there the User32 API, which is used to set executable 28159privileges, isn't available. 28160 28161@item -fwritable-relocated-rdata 28162@opindex fno-writable-relocated-rdata 28163This option is available for MinGW and Cygwin targets. It specifies 28164that relocated-data in read-only section is put into the @code{.data} 28165section. This is a necessary for older runtimes not supporting 28166modification of @code{.rdata} sections for pseudo-relocation. 28167 28168@item -mpe-aligned-commons 28169@opindex mpe-aligned-commons 28170This option is available for Cygwin and MinGW targets. It 28171specifies that the GNU extension to the PE file format that 28172permits the correct alignment of COMMON variables should be 28173used when generating code. It is enabled by default if 28174GCC detects that the target assembler found during configuration 28175supports the feature. 28176@end table 28177 28178See also under @ref{x86 Options} for standard options. 28179 28180@node Xstormy16 Options 28181@subsection Xstormy16 Options 28182@cindex Xstormy16 Options 28183 28184These options are defined for Xstormy16: 28185 28186@table @gcctabopt 28187@item -msim 28188@opindex msim 28189Choose startup files and linker script suitable for the simulator. 28190@end table 28191 28192@node Xtensa Options 28193@subsection Xtensa Options 28194@cindex Xtensa Options 28195 28196These options are supported for Xtensa targets: 28197 28198@table @gcctabopt 28199@item -mconst16 28200@itemx -mno-const16 28201@opindex mconst16 28202@opindex mno-const16 28203Enable or disable use of @code{CONST16} instructions for loading 28204constant values. The @code{CONST16} instruction is currently not a 28205standard option from Tensilica. When enabled, @code{CONST16} 28206instructions are always used in place of the standard @code{L32R} 28207instructions. The use of @code{CONST16} is enabled by default only if 28208the @code{L32R} instruction is not available. 28209 28210@item -mfused-madd 28211@itemx -mno-fused-madd 28212@opindex mfused-madd 28213@opindex mno-fused-madd 28214Enable or disable use of fused multiply/add and multiply/subtract 28215instructions in the floating-point option. This has no effect if the 28216floating-point option is not also enabled. Disabling fused multiply/add 28217and multiply/subtract instructions forces the compiler to use separate 28218instructions for the multiply and add/subtract operations. This may be 28219desirable in some cases where strict IEEE 754-compliant results are 28220required: the fused multiply add/subtract instructions do not round the 28221intermediate result, thereby producing results with @emph{more} bits of 28222precision than specified by the IEEE standard. Disabling fused multiply 28223add/subtract instructions also ensures that the program output is not 28224sensitive to the compiler's ability to combine multiply and add/subtract 28225operations. 28226 28227@item -mserialize-volatile 28228@itemx -mno-serialize-volatile 28229@opindex mserialize-volatile 28230@opindex mno-serialize-volatile 28231When this option is enabled, GCC inserts @code{MEMW} instructions before 28232@code{volatile} memory references to guarantee sequential consistency. 28233The default is @option{-mserialize-volatile}. Use 28234@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 28235 28236@item -mforce-no-pic 28237@opindex mforce-no-pic 28238For targets, like GNU/Linux, where all user-mode Xtensa code must be 28239position-independent code (PIC), this option disables PIC for compiling 28240kernel code. 28241 28242@item -mtext-section-literals 28243@itemx -mno-text-section-literals 28244@opindex mtext-section-literals 28245@opindex mno-text-section-literals 28246These options control the treatment of literal pools. The default is 28247@option{-mno-text-section-literals}, which places literals in a separate 28248section in the output file. This allows the literal pool to be placed 28249in a data RAM/ROM, and it also allows the linker to combine literal 28250pools from separate object files to remove redundant literals and 28251improve code size. With @option{-mtext-section-literals}, the literals 28252are interspersed in the text section in order to keep them as close as 28253possible to their references. This may be necessary for large assembly 28254files. Literals for each function are placed right before that function. 28255 28256@item -mauto-litpools 28257@itemx -mno-auto-litpools 28258@opindex mauto-litpools 28259@opindex mno-auto-litpools 28260These options control the treatment of literal pools. The default is 28261@option{-mno-auto-litpools}, which places literals in a separate 28262section in the output file unless @option{-mtext-section-literals} is 28263used. With @option{-mauto-litpools} the literals are interspersed in 28264the text section by the assembler. Compiler does not produce explicit 28265@code{.literal} directives and loads literals into registers with 28266@code{MOVI} instructions instead of @code{L32R} to let the assembler 28267do relaxation and place literals as necessary. This option allows 28268assembler to create several literal pools per function and assemble 28269very big functions, which may not be possible with 28270@option{-mtext-section-literals}. 28271 28272@item -mtarget-align 28273@itemx -mno-target-align 28274@opindex mtarget-align 28275@opindex mno-target-align 28276When this option is enabled, GCC instructs the assembler to 28277automatically align instructions to reduce branch penalties at the 28278expense of some code density. The assembler attempts to widen density 28279instructions to align branch targets and the instructions following call 28280instructions. If there are not enough preceding safe density 28281instructions to align a target, no widening is performed. The 28282default is @option{-mtarget-align}. These options do not affect the 28283treatment of auto-aligned instructions like @code{LOOP}, which the 28284assembler always aligns, either by widening density instructions or 28285by inserting NOP instructions. 28286 28287@item -mlongcalls 28288@itemx -mno-longcalls 28289@opindex mlongcalls 28290@opindex mno-longcalls 28291When this option is enabled, GCC instructs the assembler to translate 28292direct calls to indirect calls unless it can determine that the target 28293of a direct call is in the range allowed by the call instruction. This 28294translation typically occurs for calls to functions in other source 28295files. Specifically, the assembler translates a direct @code{CALL} 28296instruction into an @code{L32R} followed by a @code{CALLX} instruction. 28297The default is @option{-mno-longcalls}. This option should be used in 28298programs where the call target can potentially be out of range. This 28299option is implemented in the assembler, not the compiler, so the 28300assembly code generated by GCC still shows direct call 28301instructions---look at the disassembled object code to see the actual 28302instructions. Note that the assembler uses an indirect call for 28303every cross-file call, not just those that really are out of range. 28304@end table 28305 28306@node zSeries Options 28307@subsection zSeries Options 28308@cindex zSeries options 28309 28310These are listed under @xref{S/390 and zSeries Options}. 28311 28312 28313@c man end 28314 28315@node Spec Files 28316@section Specifying Subprocesses and the Switches to Pass to Them 28317@cindex Spec Files 28318 28319@command{gcc} is a driver program. It performs its job by invoking a 28320sequence of other programs to do the work of compiling, assembling and 28321linking. GCC interprets its command-line parameters and uses these to 28322deduce which programs it should invoke, and which command-line options 28323it ought to place on their command lines. This behavior is controlled 28324by @dfn{spec strings}. In most cases there is one spec string for each 28325program that GCC can invoke, but a few programs have multiple spec 28326strings to control their behavior. The spec strings built into GCC can 28327be overridden by using the @option{-specs=} command-line switch to specify 28328a spec file. 28329 28330@dfn{Spec files} are plain-text files that are used to construct spec 28331strings. They consist of a sequence of directives separated by blank 28332lines. The type of directive is determined by the first non-whitespace 28333character on the line, which can be one of the following: 28334 28335@table @code 28336@item %@var{command} 28337Issues a @var{command} to the spec file processor. The commands that can 28338appear here are: 28339 28340@table @code 28341@item %include <@var{file}> 28342@cindex @code{%include} 28343Search for @var{file} and insert its text at the current point in the 28344specs file. 28345 28346@item %include_noerr <@var{file}> 28347@cindex @code{%include_noerr} 28348Just like @samp{%include}, but do not generate an error message if the include 28349file cannot be found. 28350 28351@item %rename @var{old_name} @var{new_name} 28352@cindex @code{%rename} 28353Rename the spec string @var{old_name} to @var{new_name}. 28354 28355@end table 28356 28357@item *[@var{spec_name}]: 28358This tells the compiler to create, override or delete the named spec 28359string. All lines after this directive up to the next directive or 28360blank line are considered to be the text for the spec string. If this 28361results in an empty string then the spec is deleted. (Or, if the 28362spec did not exist, then nothing happens.) Otherwise, if the spec 28363does not currently exist a new spec is created. If the spec does 28364exist then its contents are overridden by the text of this 28365directive, unless the first character of that text is the @samp{+} 28366character, in which case the text is appended to the spec. 28367 28368@item [@var{suffix}]: 28369Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 28370and up to the next directive or blank line are considered to make up the 28371spec string for the indicated suffix. When the compiler encounters an 28372input file with the named suffix, it processes the spec string in 28373order to work out how to compile that file. For example: 28374 28375@smallexample 28376.ZZ: 28377z-compile -input %i 28378@end smallexample 28379 28380This says that any input file whose name ends in @samp{.ZZ} should be 28381passed to the program @samp{z-compile}, which should be invoked with the 28382command-line switch @option{-input} and with the result of performing the 28383@samp{%i} substitution. (See below.) 28384 28385As an alternative to providing a spec string, the text following a 28386suffix directive can be one of the following: 28387 28388@table @code 28389@item @@@var{language} 28390This says that the suffix is an alias for a known @var{language}. This is 28391similar to using the @option{-x} command-line switch to GCC to specify a 28392language explicitly. For example: 28393 28394@smallexample 28395.ZZ: 28396@@c++ 28397@end smallexample 28398 28399Says that .ZZ files are, in fact, C++ source files. 28400 28401@item #@var{name} 28402This causes an error messages saying: 28403 28404@smallexample 28405@var{name} compiler not installed on this system. 28406@end smallexample 28407@end table 28408 28409GCC already has an extensive list of suffixes built into it. 28410This directive adds an entry to the end of the list of suffixes, but 28411since the list is searched from the end backwards, it is effectively 28412possible to override earlier entries using this technique. 28413 28414@end table 28415 28416GCC has the following spec strings built into it. Spec files can 28417override these strings or create their own. Note that individual 28418targets can also add their own spec strings to this list. 28419 28420@smallexample 28421asm Options to pass to the assembler 28422asm_final Options to pass to the assembler post-processor 28423cpp Options to pass to the C preprocessor 28424cc1 Options to pass to the C compiler 28425cc1plus Options to pass to the C++ compiler 28426endfile Object files to include at the end of the link 28427link Options to pass to the linker 28428lib Libraries to include on the command line to the linker 28429libgcc Decides which GCC support library to pass to the linker 28430linker Sets the name of the linker 28431predefines Defines to be passed to the C preprocessor 28432signed_char Defines to pass to CPP to say whether @code{char} is signed 28433 by default 28434startfile Object files to include at the start of the link 28435@end smallexample 28436 28437Here is a small example of a spec file: 28438 28439@smallexample 28440%rename lib old_lib 28441 28442*lib: 28443--start-group -lgcc -lc -leval1 --end-group %(old_lib) 28444@end smallexample 28445 28446This example renames the spec called @samp{lib} to @samp{old_lib} and 28447then overrides the previous definition of @samp{lib} with a new one. 28448The new definition adds in some extra command-line options before 28449including the text of the old definition. 28450 28451@dfn{Spec strings} are a list of command-line options to be passed to their 28452corresponding program. In addition, the spec strings can contain 28453@samp{%}-prefixed sequences to substitute variable text or to 28454conditionally insert text into the command line. Using these constructs 28455it is possible to generate quite complex command lines. 28456 28457Here is a table of all defined @samp{%}-sequences for spec 28458strings. Note that spaces are not generated automatically around the 28459results of expanding these sequences. Therefore you can concatenate them 28460together or combine them with constant text in a single argument. 28461 28462@table @code 28463@item %% 28464Substitute one @samp{%} into the program name or argument. 28465 28466@item %i 28467Substitute the name of the input file being processed. 28468 28469@item %b 28470Substitute the basename of the input file being processed. 28471This is the substring up to (and not including) the last period 28472and not including the directory. 28473 28474@item %B 28475This is the same as @samp{%b}, but include the file suffix (text after 28476the last period). 28477 28478@item %d 28479Marks the argument containing or following the @samp{%d} as a 28480temporary file name, so that that file is deleted if GCC exits 28481successfully. Unlike @samp{%g}, this contributes no text to the 28482argument. 28483 28484@item %g@var{suffix} 28485Substitute a file name that has suffix @var{suffix} and is chosen 28486once per compilation, and mark the argument in the same way as 28487@samp{%d}. To reduce exposure to denial-of-service attacks, the file 28488name is now chosen in a way that is hard to predict even when previously 28489chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 28490might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 28491the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 28492treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 28493was simply substituted with a file name chosen once per compilation, 28494without regard to any appended suffix (which was therefore treated 28495just like ordinary text), making such attacks more likely to succeed. 28496 28497@item %u@var{suffix} 28498Like @samp{%g}, but generates a new temporary file name 28499each time it appears instead of once per compilation. 28500 28501@item %U@var{suffix} 28502Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 28503new one if there is no such last file name. In the absence of any 28504@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 28505the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 28506involves the generation of two distinct file names, one 28507for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 28508simply substituted with a file name chosen for the previous @samp{%u}, 28509without regard to any appended suffix. 28510 28511@item %j@var{suffix} 28512Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 28513writable, and if @option{-save-temps} is not used; 28514otherwise, substitute the name 28515of a temporary file, just like @samp{%u}. This temporary file is not 28516meant for communication between processes, but rather as a junk 28517disposal mechanism. 28518 28519@item %|@var{suffix} 28520@itemx %m@var{suffix} 28521Like @samp{%g}, except if @option{-pipe} is in effect. In that case 28522@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 28523all. These are the two most common ways to instruct a program that it 28524should read from standard input or write to standard output. If you 28525need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 28526construct: see for example @file{f/lang-specs.h}. 28527 28528@item %.@var{SUFFIX} 28529Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 28530when it is subsequently output with @samp{%*}. @var{SUFFIX} is 28531terminated by the next space or %. 28532 28533@item %w 28534Marks the argument containing or following the @samp{%w} as the 28535designated output file of this compilation. This puts the argument 28536into the sequence of arguments that @samp{%o} substitutes. 28537 28538@item %o 28539Substitutes the names of all the output files, with spaces 28540automatically placed around them. You should write spaces 28541around the @samp{%o} as well or the results are undefined. 28542@samp{%o} is for use in the specs for running the linker. 28543Input files whose names have no recognized suffix are not compiled 28544at all, but they are included among the output files, so they are 28545linked. 28546 28547@item %O 28548Substitutes the suffix for object files. Note that this is 28549handled specially when it immediately follows @samp{%g, %u, or %U}, 28550because of the need for those to form complete file names. The 28551handling is such that @samp{%O} is treated exactly as if it had already 28552been substituted, except that @samp{%g, %u, and %U} do not currently 28553support additional @var{suffix} characters following @samp{%O} as they do 28554following, for example, @samp{.o}. 28555 28556@item %p 28557Substitutes the standard macro predefinitions for the 28558current target machine. Use this when running @command{cpp}. 28559 28560@item %P 28561Like @samp{%p}, but puts @samp{__} before and after the name of each 28562predefined macro, except for macros that start with @samp{__} or with 28563@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 28564C@. 28565 28566@item %I 28567Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 28568@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 28569@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 28570and @option{-imultilib} as necessary. 28571 28572@item %s 28573Current argument is the name of a library or startup file of some sort. 28574Search for that file in a standard list of directories and substitute 28575the full name found. The current working directory is included in the 28576list of directories scanned. 28577 28578@item %T 28579Current argument is the name of a linker script. Search for that file 28580in the current list of directories to scan for libraries. If the file 28581is located insert a @option{--script} option into the command line 28582followed by the full path name found. If the file is not found then 28583generate an error message. Note: the current working directory is not 28584searched. 28585 28586@item %e@var{str} 28587Print @var{str} as an error message. @var{str} is terminated by a newline. 28588Use this when inconsistent options are detected. 28589 28590@item %(@var{name}) 28591Substitute the contents of spec string @var{name} at this point. 28592 28593@item %x@{@var{option}@} 28594Accumulate an option for @samp{%X}. 28595 28596@item %X 28597Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 28598spec string. 28599 28600@item %Y 28601Output the accumulated assembler options specified by @option{-Wa}. 28602 28603@item %Z 28604Output the accumulated preprocessor options specified by @option{-Wp}. 28605 28606@item %a 28607Process the @code{asm} spec. This is used to compute the 28608switches to be passed to the assembler. 28609 28610@item %A 28611Process the @code{asm_final} spec. This is a spec string for 28612passing switches to an assembler post-processor, if such a program is 28613needed. 28614 28615@item %l 28616Process the @code{link} spec. This is the spec for computing the 28617command line passed to the linker. Typically it makes use of the 28618@samp{%L %G %S %D and %E} sequences. 28619 28620@item %D 28621Dump out a @option{-L} option for each directory that GCC believes might 28622contain startup files. If the target supports multilibs then the 28623current multilib directory is prepended to each of these paths. 28624 28625@item %L 28626Process the @code{lib} spec. This is a spec string for deciding which 28627libraries are included on the command line to the linker. 28628 28629@item %G 28630Process the @code{libgcc} spec. This is a spec string for deciding 28631which GCC support library is included on the command line to the linker. 28632 28633@item %S 28634Process the @code{startfile} spec. This is a spec for deciding which 28635object files are the first ones passed to the linker. Typically 28636this might be a file named @file{crt0.o}. 28637 28638@item %E 28639Process the @code{endfile} spec. This is a spec string that specifies 28640the last object files that are passed to the linker. 28641 28642@item %C 28643Process the @code{cpp} spec. This is used to construct the arguments 28644to be passed to the C preprocessor. 28645 28646@item %1 28647Process the @code{cc1} spec. This is used to construct the options to be 28648passed to the actual C compiler (@command{cc1}). 28649 28650@item %2 28651Process the @code{cc1plus} spec. This is used to construct the options to be 28652passed to the actual C++ compiler (@command{cc1plus}). 28653 28654@item %* 28655Substitute the variable part of a matched option. See below. 28656Note that each comma in the substituted string is replaced by 28657a single space. 28658 28659@item %<S 28660Remove all occurrences of @code{-S} from the command line. Note---this 28661command is position dependent. @samp{%} commands in the spec string 28662before this one see @code{-S}, @samp{%} commands in the spec string 28663after this one do not. 28664 28665@item %:@var{function}(@var{args}) 28666Call the named function @var{function}, passing it @var{args}. 28667@var{args} is first processed as a nested spec string, then split 28668into an argument vector in the usual fashion. The function returns 28669a string which is processed as if it had appeared literally as part 28670of the current spec. 28671 28672The following built-in spec functions are provided: 28673 28674@table @code 28675@item @code{getenv} 28676The @code{getenv} spec function takes two arguments: an environment 28677variable name and a string. If the environment variable is not 28678defined, a fatal error is issued. Otherwise, the return value is the 28679value of the environment variable concatenated with the string. For 28680example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 28681 28682@smallexample 28683%:getenv(TOPDIR /include) 28684@end smallexample 28685 28686expands to @file{/path/to/top/include}. 28687 28688@item @code{if-exists} 28689The @code{if-exists} spec function takes one argument, an absolute 28690pathname to a file. If the file exists, @code{if-exists} returns the 28691pathname. Here is a small example of its usage: 28692 28693@smallexample 28694*startfile: 28695crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 28696@end smallexample 28697 28698@item @code{if-exists-else} 28699The @code{if-exists-else} spec function is similar to the @code{if-exists} 28700spec function, except that it takes two arguments. The first argument is 28701an absolute pathname to a file. If the file exists, @code{if-exists-else} 28702returns the pathname. If it does not exist, it returns the second argument. 28703This way, @code{if-exists-else} can be used to select one file or another, 28704based on the existence of the first. Here is a small example of its usage: 28705 28706@smallexample 28707*startfile: 28708crt0%O%s %:if-exists(crti%O%s) \ 28709%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 28710@end smallexample 28711 28712@item @code{replace-outfile} 28713The @code{replace-outfile} spec function takes two arguments. It looks for the 28714first argument in the outfiles array and replaces it with the second argument. Here 28715is a small example of its usage: 28716 28717@smallexample 28718%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 28719@end smallexample 28720 28721@item @code{remove-outfile} 28722The @code{remove-outfile} spec function takes one argument. It looks for the 28723first argument in the outfiles array and removes it. Here is a small example 28724its usage: 28725 28726@smallexample 28727%:remove-outfile(-lm) 28728@end smallexample 28729 28730@item @code{pass-through-libs} 28731The @code{pass-through-libs} spec function takes any number of arguments. It 28732finds any @option{-l} options and any non-options ending in @file{.a} (which it 28733assumes are the names of linker input library archive files) and returns a 28734result containing all the found arguments each prepended by 28735@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 28736intended to be passed to the LTO linker plugin. 28737 28738@smallexample 28739%:pass-through-libs(%G %L %G) 28740@end smallexample 28741 28742@item @code{print-asm-header} 28743The @code{print-asm-header} function takes no arguments and simply 28744prints a banner like: 28745 28746@smallexample 28747Assembler options 28748================= 28749 28750Use "-Wa,OPTION" to pass "OPTION" to the assembler. 28751@end smallexample 28752 28753It is used to separate compiler options from assembler options 28754in the @option{--target-help} output. 28755@end table 28756 28757@item %@{S@} 28758Substitutes the @code{-S} switch, if that switch is given to GCC@. 28759If that switch is not specified, this substitutes nothing. Note that 28760the leading dash is omitted when specifying this option, and it is 28761automatically inserted if the substitution is performed. Thus the spec 28762string @samp{%@{foo@}} matches the command-line option @option{-foo} 28763and outputs the command-line option @option{-foo}. 28764 28765@item %W@{S@} 28766Like %@{@code{S}@} but mark last argument supplied within as a file to be 28767deleted on failure. 28768 28769@item %@{S*@} 28770Substitutes all the switches specified to GCC whose names start 28771with @code{-S}, but which also take an argument. This is used for 28772switches like @option{-o}, @option{-D}, @option{-I}, etc. 28773GCC considers @option{-o foo} as being 28774one switch whose name starts with @samp{o}. %@{o*@} substitutes this 28775text, including the space. Thus two arguments are generated. 28776 28777@item %@{S*&T*@} 28778Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 28779(the order of @code{S} and @code{T} in the spec is not significant). 28780There can be any number of ampersand-separated variables; for each the 28781wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 28782 28783@item %@{S:X@} 28784Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 28785 28786@item %@{!S:X@} 28787Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 28788 28789@item %@{S*:X@} 28790Substitutes @code{X} if one or more switches whose names start with 28791@code{-S} are specified to GCC@. Normally @code{X} is substituted only 28792once, no matter how many such switches appeared. However, if @code{%*} 28793appears somewhere in @code{X}, then @code{X} is substituted once 28794for each matching switch, with the @code{%*} replaced by the part of 28795that switch matching the @code{*}. 28796 28797If @code{%*} appears as the last part of a spec sequence then a space 28798is added after the end of the last substitution. If there is more 28799text in the sequence, however, then a space is not generated. This 28800allows the @code{%*} substitution to be used as part of a larger 28801string. For example, a spec string like this: 28802 28803@smallexample 28804%@{mcu=*:--script=%*/memory.ld@} 28805@end smallexample 28806 28807@noindent 28808when matching an option like @option{-mcu=newchip} produces: 28809 28810@smallexample 28811--script=newchip/memory.ld 28812@end smallexample 28813 28814@item %@{.S:X@} 28815Substitutes @code{X}, if processing a file with suffix @code{S}. 28816 28817@item %@{!.S:X@} 28818Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 28819 28820@item %@{,S:X@} 28821Substitutes @code{X}, if processing a file for language @code{S}. 28822 28823@item %@{!,S:X@} 28824Substitutes @code{X}, if not processing a file for language @code{S}. 28825 28826@item %@{S|P:X@} 28827Substitutes @code{X} if either @code{-S} or @code{-P} is given to 28828GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 28829@code{*} sequences as well, although they have a stronger binding than 28830the @samp{|}. If @code{%*} appears in @code{X}, all of the 28831alternatives must be starred, and only the first matching alternative 28832is substituted. 28833 28834For example, a spec string like this: 28835 28836@smallexample 28837%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 28838@end smallexample 28839 28840@noindent 28841outputs the following command-line options from the following input 28842command-line options: 28843 28844@smallexample 28845fred.c -foo -baz 28846jim.d -bar -boggle 28847-d fred.c -foo -baz -boggle 28848-d jim.d -bar -baz -boggle 28849@end smallexample 28850 28851@item %@{S:X; T:Y; :D@} 28852 28853If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 28854given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 28855be as many clauses as you need. This may be combined with @code{.}, 28856@code{,}, @code{!}, @code{|}, and @code{*} as needed. 28857 28858 28859@end table 28860 28861The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}} 28862or similar construct can use a backslash to ignore the special meaning 28863of the character following it, thus allowing literal matching of a 28864character that is otherwise specially treated. For example, 28865@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the 28866@option{-std=iso9899:1999} option is given. 28867 28868The conditional text @code{X} in a @samp{%@{S:X@}} or similar 28869construct may contain other nested @samp{%} constructs or spaces, or 28870even newlines. They are processed as usual, as described above. 28871Trailing white space in @code{X} is ignored. White space may also 28872appear anywhere on the left side of the colon in these constructs, 28873except between @code{.} or @code{*} and the corresponding word. 28874 28875The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 28876handled specifically in these constructs. If another value of 28877@option{-O} or the negated form of a @option{-f}, @option{-m}, or 28878@option{-W} switch is found later in the command line, the earlier 28879switch value is ignored, except with @{@code{S}*@} where @code{S} is 28880just one letter, which passes all matching options. 28881 28882The character @samp{|} at the beginning of the predicate text is used to 28883indicate that a command should be piped to the following command, but 28884only if @option{-pipe} is specified. 28885 28886It is built into GCC which switches take arguments and which do not. 28887(You might think it would be useful to generalize this to allow each 28888compiler's spec to say which switches take arguments. But this cannot 28889be done in a consistent fashion. GCC cannot even decide which input 28890files have been specified without knowing which switches take arguments, 28891and it must know which input files to compile in order to tell which 28892compilers to run). 28893 28894GCC also knows implicitly that arguments starting in @option{-l} are to be 28895treated as compiler output files, and passed to the linker in their 28896proper position among the other output files. 28897 28898@node Environment Variables 28899@section Environment Variables Affecting GCC 28900@cindex environment variables 28901 28902@c man begin ENVIRONMENT 28903This section describes several environment variables that affect how GCC 28904operates. Some of them work by specifying directories or prefixes to use 28905when searching for various kinds of files. Some are used to specify other 28906aspects of the compilation environment. 28907 28908Note that you can also specify places to search using options such as 28909@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 28910take precedence over places specified using environment variables, which 28911in turn take precedence over those specified by the configuration of GCC@. 28912@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 28913GNU Compiler Collection (GCC) Internals}. 28914 28915@table @env 28916@item LANG 28917@itemx LC_CTYPE 28918@c @itemx LC_COLLATE 28919@itemx LC_MESSAGES 28920@c @itemx LC_MONETARY 28921@c @itemx LC_NUMERIC 28922@c @itemx LC_TIME 28923@itemx LC_ALL 28924@findex LANG 28925@findex LC_CTYPE 28926@c @findex LC_COLLATE 28927@findex LC_MESSAGES 28928@c @findex LC_MONETARY 28929@c @findex LC_NUMERIC 28930@c @findex LC_TIME 28931@findex LC_ALL 28932@cindex locale 28933These environment variables control the way that GCC uses 28934localization information which allows GCC to work with different 28935national conventions. GCC inspects the locale categories 28936@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 28937so. These locale categories can be set to any value supported by your 28938installation. A typical value is @samp{en_GB.UTF-8} for English in the United 28939Kingdom encoded in UTF-8. 28940 28941The @env{LC_CTYPE} environment variable specifies character 28942classification. GCC uses it to determine the character boundaries in 28943a string; this is needed for some multibyte encodings that contain quote 28944and escape characters that are otherwise interpreted as a string 28945end or escape. 28946 28947The @env{LC_MESSAGES} environment variable specifies the language to 28948use in diagnostic messages. 28949 28950If the @env{LC_ALL} environment variable is set, it overrides the value 28951of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 28952and @env{LC_MESSAGES} default to the value of the @env{LANG} 28953environment variable. If none of these variables are set, GCC 28954defaults to traditional C English behavior. 28955 28956@item TMPDIR 28957@findex TMPDIR 28958If @env{TMPDIR} is set, it specifies the directory to use for temporary 28959files. GCC uses temporary files to hold the output of one stage of 28960compilation which is to be used as input to the next stage: for example, 28961the output of the preprocessor, which is the input to the compiler 28962proper. 28963 28964@item GCC_COMPARE_DEBUG 28965@findex GCC_COMPARE_DEBUG 28966Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 28967@option{-fcompare-debug} to the compiler driver. See the documentation 28968of this option for more details. 28969 28970@item GCC_EXEC_PREFIX 28971@findex GCC_EXEC_PREFIX 28972If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 28973names of the subprograms executed by the compiler. No slash is added 28974when this prefix is combined with the name of a subprogram, but you can 28975specify a prefix that ends with a slash if you wish. 28976 28977If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 28978an appropriate prefix to use based on the pathname it is invoked with. 28979 28980If GCC cannot find the subprogram using the specified prefix, it 28981tries looking in the usual places for the subprogram. 28982 28983The default value of @env{GCC_EXEC_PREFIX} is 28984@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 28985the installed compiler. In many cases @var{prefix} is the value 28986of @code{prefix} when you ran the @file{configure} script. 28987 28988Other prefixes specified with @option{-B} take precedence over this prefix. 28989 28990This prefix is also used for finding files such as @file{crt0.o} that are 28991used for linking. 28992 28993In addition, the prefix is used in an unusual way in finding the 28994directories to search for header files. For each of the standard 28995directories whose name normally begins with @samp{/usr/local/lib/gcc} 28996(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 28997replacing that beginning with the specified prefix to produce an 28998alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 28999@file{foo/bar} just before it searches the standard directory 29000@file{/usr/local/lib/bar}. 29001If a standard directory begins with the configured 29002@var{prefix} then the value of @var{prefix} is replaced by 29003@env{GCC_EXEC_PREFIX} when looking for header files. 29004 29005@item COMPILER_PATH 29006@findex COMPILER_PATH 29007The value of @env{COMPILER_PATH} is a colon-separated list of 29008directories, much like @env{PATH}. GCC tries the directories thus 29009specified when searching for subprograms, if it cannot find the 29010subprograms using @env{GCC_EXEC_PREFIX}. 29011 29012@item LIBRARY_PATH 29013@findex LIBRARY_PATH 29014The value of @env{LIBRARY_PATH} is a colon-separated list of 29015directories, much like @env{PATH}. When configured as a native compiler, 29016GCC tries the directories thus specified when searching for special 29017linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking 29018using GCC also uses these directories when searching for ordinary 29019libraries for the @option{-l} option (but directories specified with 29020@option{-L} come first). 29021 29022@item LANG 29023@findex LANG 29024@cindex locale definition 29025This variable is used to pass locale information to the compiler. One way in 29026which this information is used is to determine the character set to be used 29027when character literals, string literals and comments are parsed in C and C++. 29028When the compiler is configured to allow multibyte characters, 29029the following values for @env{LANG} are recognized: 29030 29031@table @samp 29032@item C-JIS 29033Recognize JIS characters. 29034@item C-SJIS 29035Recognize SJIS characters. 29036@item C-EUCJP 29037Recognize EUCJP characters. 29038@end table 29039 29040If @env{LANG} is not defined, or if it has some other value, then the 29041compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 29042recognize and translate multibyte characters. 29043@end table 29044 29045@noindent 29046Some additional environment variables affect the behavior of the 29047preprocessor. 29048 29049@include cppenv.texi 29050 29051@c man end 29052 29053@node Precompiled Headers 29054@section Using Precompiled Headers 29055@cindex precompiled headers 29056@cindex speed of compilation 29057 29058Often large projects have many header files that are included in every 29059source file. The time the compiler takes to process these header files 29060over and over again can account for nearly all of the time required to 29061build the project. To make builds faster, GCC allows you to 29062@dfn{precompile} a header file. 29063 29064To create a precompiled header file, simply compile it as you would any 29065other file, if necessary using the @option{-x} option to make the driver 29066treat it as a C or C++ header file. You may want to use a 29067tool like @command{make} to keep the precompiled header up-to-date when 29068the headers it contains change. 29069 29070A precompiled header file is searched for when @code{#include} is 29071seen in the compilation. As it searches for the included file 29072(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 29073compiler looks for a precompiled header in each directory just before it 29074looks for the include file in that directory. The name searched for is 29075the name specified in the @code{#include} with @samp{.gch} appended. If 29076the precompiled header file cannot be used, it is ignored. 29077 29078For instance, if you have @code{#include "all.h"}, and you have 29079@file{all.h.gch} in the same directory as @file{all.h}, then the 29080precompiled header file is used if possible, and the original 29081header is used otherwise. 29082 29083Alternatively, you might decide to put the precompiled header file in a 29084directory and use @option{-I} to ensure that directory is searched 29085before (or instead of) the directory containing the original header. 29086Then, if you want to check that the precompiled header file is always 29087used, you can put a file of the same name as the original header in this 29088directory containing an @code{#error} command. 29089 29090This also works with @option{-include}. So yet another way to use 29091precompiled headers, good for projects not designed with precompiled 29092header files in mind, is to simply take most of the header files used by 29093a project, include them from another header file, precompile that header 29094file, and @option{-include} the precompiled header. If the header files 29095have guards against multiple inclusion, they are skipped because 29096they've already been included (in the precompiled header). 29097 29098If you need to precompile the same header file for different 29099languages, targets, or compiler options, you can instead make a 29100@emph{directory} named like @file{all.h.gch}, and put each precompiled 29101header in the directory, perhaps using @option{-o}. It doesn't matter 29102what you call the files in the directory; every precompiled header in 29103the directory is considered. The first precompiled header 29104encountered in the directory that is valid for this compilation is 29105used; they're searched in no particular order. 29106 29107There are many other possibilities, limited only by your imagination, 29108good sense, and the constraints of your build system. 29109 29110A precompiled header file can be used only when these conditions apply: 29111 29112@itemize 29113@item 29114Only one precompiled header can be used in a particular compilation. 29115 29116@item 29117A precompiled header cannot be used once the first C token is seen. You 29118can have preprocessor directives before a precompiled header; you cannot 29119include a precompiled header from inside another header. 29120 29121@item 29122The precompiled header file must be produced for the same language as 29123the current compilation. You cannot use a C precompiled header for a C++ 29124compilation. 29125 29126@item 29127The precompiled header file must have been produced by the same compiler 29128binary as the current compilation is using. 29129 29130@item 29131Any macros defined before the precompiled header is included must 29132either be defined in the same way as when the precompiled header was 29133generated, or must not affect the precompiled header, which usually 29134means that they don't appear in the precompiled header at all. 29135 29136The @option{-D} option is one way to define a macro before a 29137precompiled header is included; using a @code{#define} can also do it. 29138There are also some options that define macros implicitly, like 29139@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 29140defined this way. 29141 29142@item If debugging information is output when using the precompiled 29143header, using @option{-g} or similar, the same kind of debugging information 29144must have been output when building the precompiled header. However, 29145a precompiled header built using @option{-g} can be used in a compilation 29146when no debugging information is being output. 29147 29148@item The same @option{-m} options must generally be used when building 29149and using the precompiled header. @xref{Submodel Options}, 29150for any cases where this rule is relaxed. 29151 29152@item Each of the following options must be the same when building and using 29153the precompiled header: 29154 29155@gccoptlist{-fexceptions} 29156 29157@item 29158Some other command-line options starting with @option{-f}, 29159@option{-p}, or @option{-O} must be defined in the same way as when 29160the precompiled header was generated. At present, it's not clear 29161which options are safe to change and which are not; the safest choice 29162is to use exactly the same options when generating and using the 29163precompiled header. The following are known to be safe: 29164 29165@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 29166-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 29167-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 29168-pedantic-errors} 29169 29170@end itemize 29171 29172For all of these except the last, the compiler automatically 29173ignores the precompiled header if the conditions aren't met. If you 29174find an option combination that doesn't work and doesn't cause the 29175precompiled header to be ignored, please consider filing a bug report, 29176see @ref{Bugs}. 29177 29178If you do use differing options when generating and using the 29179precompiled header, the actual behavior is a mixture of the 29180behavior for the options. For instance, if you use @option{-g} to 29181generate the precompiled header but not when using it, you may or may 29182not get debugging information for routines in the precompiled header. 29183