Linux "cc" Command Line Options and Examples
GNU project C and C compiler

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.


Usage:

gcc [-c|-S|-E] [-std=standard]
[-g] [-pg] [-Olevel]
[-Wwarn...] [-Wpedantic]
[-Idir...] [-Ldir...]
[-Dmacro[=defn]...] [-Umacro]
[-foption...] [-mmachine-option...]
[-o outfile] [@file] infile...






Command Line Options:

-c
-S -E -o file -x language -v -### --help[=class[,...]] --target-help --version -pass-exit-codes -pipe -specs=file
cc -c ...
-ansi
-std=standard -fgnu89-inline -fpermitted-flt-eval-methods=standard -aux-info filename
cc -ansi ...
-fallow-parameterless-variadic-functions
-fno-asm -fno-builtin -fno-builtin-function -fgimple -fhosted -ffreestanding
cc -fallow-parameterless-variadic-functions ...
-fopenacc
-fopenmp -fopenmp-simd -fms-extensions -fplan9-extensions -fsso-struct=endianness -fallow-single-precision
cc -fopenacc ...
-fabi-version
-fno-access-control -faligned-new=n -fargs-in-order=n -fcheck-new -fconstexpr-depth=n
cc -fabi-version ...
-fconstexpr-loop-limit
-ffriend-injection -fno-elide-constructors -fno-enforce-eh-specs -ffor-scope -fno-for-scope
cc -fconstexpr-loop-limit ...
-fno-gnu-keywords
-fno-implicit-templates -fno-implicit-inline-templates -fno-implement-inlines -fms-extensions
cc -fno-gnu-keywords ...
-fnew-inheriting-ctors
-fnew-ttp-matching -fno-nonansi-builtins -fnothrow-opt -fno-operator-names -fno-optional-diags
cc -fnew-inheriting-ctors ...
-fpermissive
-fno-pretty-templates -frepo -fno-rtti -fsized-deallocation -ftemplate-backtrace-limit=n -ftemplate-depth=n
cc -fpermissive ...
-fno-threadsafe-statics
-fuse-cxa-atexit -fno-weak -nostdinc++ -fvisibility-inlines-hidden -fvisibility-ms-compat
cc -fno-threadsafe-statics ...
-fext-numeric-literals
-Wabi=n -Wabi-tag -Wconversion-null -Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Wliteral-suffix
cc -fext-numeric-literals ...
-Wmultiple-inheritance
-Wnamespaces -Wnarrowing -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor -Wreorder -Wregister -Weffc++
cc -Wmultiple-inheritance ...
-Wstrict-null-sentinel
-Wtemplates -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions
cc -Wstrict-null-sentinel ...
-Wsign-promo
Objective-C and Objective-C++ Language Options
cc -Wsign-promo ...
-fconstant-string-class
-fgnu-runtime -fnext-runtime -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
cc -fconstant-string-class ...
-fobjc-direct-dispatch
-fobjc-exceptions -fobjc-gc -fobjc-nilcheck -fobjc-std=objc1 -fno-local-ivars
cc -fobjc-direct-dispatch ...
-fivar-visibility
-freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
cc -fivar-visibility ...
-Wno-protocol
Diagnostic Message Formatting Options
cc -Wno-protocol ...
-fmessage-length
-fdiagnostics-show-location=[once|every-line] -fdiagnostics-color=[auto|never|always]
cc -fmessage-length ...
-fno-diagnostics-show-option
-fno-diagnostics-show-caret -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
cc -fno-diagnostics-show-option ...
-fsyntax-only
-fmax-errors=n -Wpedantic -pedantic-errors -w -Wextra -Wall -Waddress -Waggregate-return -Walloc-zero
cc -fsyntax-only ...
-Walloc-size-larger-than
-Walloca -Walloca-larger-than=n -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=n
cc -Walloc-size-larger-than ...
-Wno-attributes
-Wbool-compare -Wbool-operation -Wno-builtin-declaration-mismatch -Wno-builtin-macro-redefined
cc -Wno-attributes ...
-Wc90-c99-compat
-Wc99-c11-compat -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual -Wchar-subscripts
cc -Wc90-c99-compat ...
-Wchkp
-Wclobbered -Wcomment -Wconditionally-supported -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else
cc -Wchkp ...
-Wdate-time
-Wdelete-incomplete -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init -Wdisabled-optimization
cc -Wdate-time ...
-Wno-discarded-qualifiers
-Wno-discarded-array-qualifiers -Wno-div-by-zero -Wdouble-promotion -Wduplicated-branches
cc -Wno-discarded-qualifiers ...
-Wduplicated-cond
-Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined -Werror -Werror=* -Wfatal-errors
cc -Wduplicated-cond ...
-Wfloat-equal
-Wformat -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral -Wformat-overflow=n
cc -Wfloat-equal ...
-Wformat-security
-Wformat-signedness -Wformat-truncation=n -Wformat-y2k -Wframe-address -Wframe-larger-than=len
cc -Wformat-security ...
-Wno-free-nonheap-object
-Wjump-misses-init -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types -Wimplicit
cc -Wno-free-nonheap-object ...
-Wimplicit-fallthrough
-Wimplicit-fallthrough=n -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Winline
cc -Wimplicit-fallthrough ...
-Wno-int-conversion
-Wint-in-bool-context -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof -Winvalid-pch
cc -Wno-int-conversion ...
-Wlarger-than
-Wlogical-op -Wlogical-not-parentheses -Wlong-long -Wmain -Wmaybe-uninitialized -Wmemset-elt-size
cc -Wlarger-than ...
-Wmemset-transposed-args
-Wmisleading-indentation -Wmissing-braces -Wmissing-field-initializers -Wmissing-include-dirs
cc -Wmemset-transposed-args ...
-Wno-multichar
-Wnonnull -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc] -Wnull-dereference -Wodr -Wno-overflow
cc -Wno-multichar ...
-Wopenmp-simd
-Woverride-init-side-effects -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded -Wparentheses
cc -Wopenmp-simd ...
-Wno-pedantic-ms-format
-Wplacement-new -Wplacement-new=n -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast
cc -Wno-pedantic-ms-format ...
-Wno-pragmas
-Wredundant-decls -Wrestrict -Wno-return-local-addr -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar
cc -Wno-pragmas ...
-Wshadow
-Wshadow=local -Wshadow=compatible-local -Wshift-overflow -Wshift-overflow=n -Wshift-count-negative
cc -Wshadow ...
-Wshift-count-overflow
-Wshift-negative-value -Wsign-compare -Wsign-conversion -Wfloat-conversion -Wno-scalar-storage-order
cc -Wshift-count-overflow ...
-Wsizeof-pointer-memaccess
-Wsizeof-array-argument -Wstack-protector -Wstack-usage=len -Wstrict-aliasing -Wstrict-aliasing=n
cc -Wsizeof-pointer-memaccess ...
-Wstrict-overflow
-Wstrict-overflow=n -Wstringop-overflow=n -Wsuggest-attribute=[pure|const|noreturn|format]
cc -Wstrict-overflow ...
-Wsuggest-final-types
-Wsuggest-final-methods -Wsuggest-override -Wmissing-format-attribute -Wsubobject-linkage -Wswitch
cc -Wsuggest-final-types ...
-Wswitch-bool
-Wswitch-default -Wswitch-enum -Wswitch-unreachable -Wsync-nand -Wsystem-headers -Wtautological-compare
cc -Wswitch-bool ...
-Wtrampolines
-Wtrigraphs -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations
cc -Wtrampolines ...
-Wunsuffixed-float-constants
-Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-macros
cc -Wunsuffixed-float-constants ...
-Wunused-parameter
-Wno-unused-result -Wunused-value -Wunused-variable -Wunused-const-variable -Wunused-const-variable=n
cc -Wunused-parameter ...
-Wunused-but-set-parameter
-Wunused-but-set-variable -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance -Wvla
cc -Wunused-but-set-parameter ...
-Wbad-function-cast
-Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
cc -Wbad-function-cast ...
-Wold-style-declaration
-Wold-style-definition -Wstrict-prototypes -Wtraditional -Wtraditional-conversion
cc -Wold-style-declaration ...
-Wdeclaration-after-statement
Debugging Options
cc -Wdeclaration-after-statement ...
-g
-glevel -gcoff -gdwarf -gdwarf-version -ggdb -grecord-gcc-switches -gno-record-gcc-switches -gstabs -gstabs+
cc -g ...
-gstrict-dwarf
-gno-strict-dwarf -gcolumn-info -gno-column-info -gvms -gxcoff -gxcoff+ -gz[=type] -fdebug-prefix-map=old=new
cc -gstrict-dwarf ...
-fdebug-types-section
-feliminate-dwarf2-dups -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
cc -fdebug-types-section ...
-femit-struct-debug-reduced
-femit-struct-debug-detailed[=spec-list] -feliminate-unused-debug-symbols -femit-class-debug-always
cc -femit-struct-debug-reduced ...
-fno-merge-debug-strings
Optimization Options
cc -fno-merge-debug-strings ...
-faggressive-loop-optimizations
-falign-functions[=n] -falign-jumps[=n] -falign-labels[=n] -falign-loops[=n] -fassociative-math
cc -faggressive-loop-optimizations ...
-fauto-profile
-fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize
cc -fauto-profile ...
-fbranch-target-load-optimize2
-fbtr-bb-exclusive -fcaller-saves -fcombine-stack-adjustments -fconserve-stack -fcompare-elim
cc -fbranch-target-load-optimize2 ...
-fcprop-registers
-fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range -fdata-sections
cc -fcprop-registers ...
-fdce
-fdelayed-branch -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fdevirtualize-at-ltrans
cc -fdce ...
-fdse
-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
cc -fdse ...
-fexcess-precision
-fforward-propagate -ffp-contract=style -ffunction-sections -fgcse -fgcse-after-reload -fgcse-las
cc -fexcess-precision ...
-fgcse-lm
-fgraphite-identity -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2 -findirect-inlining
cc -fgcse-lm ...
-finline-functions
-finline-functions-called-once -finline-limit=n -finline-small-functions -fipa-cp -fipa-cp-clone
cc -finline-functions ...
-fipa-bit-cp
-fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf -fira-algorithm=algorithm
cc -fipa-bit-cp ...
-fira-region
-fira-hoist-pressure -fira-loop-pressure -fno-ira-share-save-slots -fno-ira-share-spill-slots
cc -fira-region ...
-fisolate-erroneous-paths-dereference
-fisolate-erroneous-paths-attribute -fivopts -fkeep-inline-functions
cc -fisolate-erroneous-paths-dereference ...
-fkeep-static-functions
-fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage -floop-block -floop-interchange
cc -fkeep-static-functions ...
-floop-strip-mine
-floop-unroll-and-jam -floop-nest-optimize -floop-parallelize-all -flra-remat -flto -flto-compression-level
cc -floop-strip-mine ...
-flto-partition
-fmerge-all-constants -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves
cc -flto-partition ...
-fmove-loop-invariants
-fno-branch-count-reg -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
cc -fmove-loop-invariants ...
-fno-guess-branch-probability
-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 -fno-printf-return-value
cc -fno-guess-branch-probability ...
-fno-sched-interblock
-fno-sched-spec -fno-signed-zeros -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss
cc -fno-sched-interblock ...
-fomit-frame-pointer
-foptimize-sibling-calls -fpartial-inlining -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays
cc -fomit-frame-pointer ...
-fprofile-correction
-fprofile-use -fprofile-use=path -fprofile-values -fprofile-reorder-functions -freciprocal-math -free
cc -fprofile-correction ...
-frename-registers
-freorder-blocks -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition -freorder-functions
cc -frename-registers ...
-frerun-cse-after-loop
-freschedule-modulo-scheduled-loops -frounding-math -fsched2-use-superblocks -fsched-pressure
cc -frerun-cse-after-loop ...
-fsched-spec-load
-fsched-spec-load-dangerous -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n] -fsched-group-heuristic
cc -fsched-spec-load ...
-fsched-critical-path-heuristic
-fsched-spec-insn-heuristic -fsched-rank-heuristic -fsched-last-insn-heuristic
cc -fsched-critical-path-heuristic ...
-fsched-dep-count-heuristic
-fschedule-fusion -fschedule-insns -fschedule-insns2 -fsection-anchors -fselective-scheduling
cc -fsched-dep-count-heuristic ...
-fselective-scheduling2
-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fsemantic-interposition -fshrink-wrap
cc -fselective-scheduling2 ...
-fshrink-wrap-separate
-fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
cc -fshrink-wrap-separate ...
-fsplit-wide-types
-fssa-backprop -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing -fstrict-overflow
cc -fsplit-wide-types ...
-fthread-jumps
-ftracer -ftree-bit-ccp -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
cc -fthread-jumps ...
-ftree-dce
-ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert -ftree-loop-im
cc -ftree-dce ...
-ftree-phiprop
-ftree-loop-distribution -ftree-loop-distribute-patterns -ftree-loop-ivcanon -ftree-loop-linear
cc -ftree-phiprop ...
-ftree-loop-optimize
-ftree-loop-vectorize -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre -ftree-pta -ftree-reassoc
cc -ftree-loop-optimize ...
-ftree-sink
-ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge -ftree-ter -ftree-vectorize -ftree-vrp
cc -ftree-sink ...
-funconstrained-commons
-funit-at-a-time -funroll-all-loops -funroll-loops -funsafe-math-optimizations -funswitch-loops
cc -funconstrained-commons ...
-p
-pg -fprofile-arcs --coverage -ftest-coverage -fprofile-dir=path -fprofile-generate -fprofile-generate=path
cc -p ...
-fsanitize
-fsanitize-recover -fsanitize-recover=style -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
cc -fsanitize ...
-fsanitize-undefined-trap-on-error
-fbounds-check -fcheck-pointer-bounds -fchkp-check-incomplete-type
cc -fsanitize-undefined-trap-on-error ...
-fchkp-first-field-has-own-bounds
-fchkp-narrow-bounds -fchkp-narrow-to-innermost-array -fchkp-optimize
cc -fchkp-first-field-has-own-bounds ...
-fchkp-use-fast-string-functions
-fchkp-use-nochk-string-functions -fchkp-use-static-bounds -fchkp-use-static-const-bounds
cc -fchkp-use-fast-string-functions ...
-fchkp-treat-zero-dynamic-size-as-infinite
-fchkp-check-read -fchkp-check-read -fchkp-check-write -fchkp-store-bounds
cc -fchkp-treat-zero-dynamic-size-as-infinite ...
-fchkp-instrument-calls
-fchkp-instrument-marked-only -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays
cc -fchkp-instrument-calls ...
-fstack-protector
-fstack-protector-all -fstack-protector-strong -fstack-protector-explicit -fstack-check
cc -fstack-protector ...
-fstack-limit-register
-fstack-limit-symbol=sym -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
cc -fstack-limit-register ...
-fvtv-counts
-fvtv-debug -finstrument-functions -finstrument-functions-exclude-function-list=sym,sym,...
cc -fvtv-counts ...
-finstrument-functions-exclude-file-list
Preprocessor Options
cc -finstrument-functions-exclude-file-list ...
-Aquestion
-A-question[=answer] -C -CC -Dmacro[=defn] -dD -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
cc -Aquestion ...
-fdollars-in-identifiers
-fexec-charset=charset -fextended-identifiers -finput-charset=charset -fno-canonical-system-headers
cc -fdollars-in-identifiers ...
-fpch-deps
-fpch-preprocess -fpreprocessed -ftabstop=width -ftrack-macro-expansion -fwide-exec-charset=charset
cc -fpch-deps ...
-fworking-directory
-H -imacros file -include file -M -MD -MF -MG -MM -MMD -MP -MQ -MT -no-integrated-cpp -P -pthread
cc -fworking-directory ...
-remap
Assembler Options
cc -remap ...
-Wa,option
Linker Optionsobject-file-name -fuse-ld=linker -llibrary -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic -s -static
cc -Wa,option ...
-static-libgcc
-static-libstdc++ -static-libasan -static-libtsan -static-liblsan -static-libubsan -static-libmpx
cc -static-libgcc ...
-static-libmpxwrappers
Directory Options
cc -static-libmpxwrappers ...
-Bprefix
-Idir -I- -idirafter dir -imacros file -imultilib dir -iplugindir=dir -iprefix file -iquote dir -isysroot dir
cc -Bprefix ...
-isystem
dir -iwithprefix dir -iwithprefixbefore dir -Ldir -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
cc -isystem ...
--sysroot
Code Generation Options
cc --sysroot ...
-fcall-saved-reg
-fcall-used-reg -ffixed-reg -fexceptions -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
cc -fcall-saved-reg ...
-fasynchronous-unwind-tables
-fno-gnu-unique -finhibit-size-directive -fno-common -fno-ident -fpcc-struct-return -fpic -fPIC
cc -fasynchronous-unwind-tables ...
-fpie
-fPIE -fno-plt -fno-jump-tables -frecord-gcc-switches -freg-struct-return -fshort-enums -fshort-wchar -fverbose-asm
cc -fpie ...
-fpack-struct[
-fleading-underscore -ftls-model=model -fstack-reuse=reuse_level -ftrampolines -ftrapv -fwrapv
cc -fpack-struct[ ...
-fvisibility
Developer Options
cc -fvisibility ...
-fdisable-tree-pass-name
-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links -fdump-translation-unit[-n]
cc -fdisable-tree-pass-name ...
-fdump-class-hierarchy[-n]
-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline -fdump-passes -fdump-rtl-pass
cc -fdump-class-hierarchy[-n] ...
-fdump-rtl-pass
-fdump-statistics -fdump-final-insns[=file] -fdump-tree-all -fdump-tree-switch
cc -fdump-rtl-pass ...
-fdump-tree-switch-options
-fdump-tree-switch-options=filename -fcompare-debug[=opts] -fcompare-debug-second -fenable-kind-pass
cc -fdump-tree-switch-options ...
-fenable-kind-pass
-fira-verbose=n -flto-report -flto-report-wpa -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
cc -fenable-kind-pass ...
-fpost-ipa-mem-report
-fopt-info -fopt-info-options[=file] -fprofile-report -frandom-seed=string -fsched-verbose=n
cc -fpost-ipa-mem-report ...
-fsel-sched-verbose
-fsel-sched-dump-cfg -fsel-sched-pipelining-verbose -fstats -fstack-usage -ftime-report
cc -fsel-sched-verbose ...
-ftime-report-details
-fvar-tracking-assignments-toggle -gtoggle -print-file-name=library -print-libgcc-file-name
cc -ftime-report-details ...
-print-multi-directory
-print-multi-lib -print-multi-os-directory -print-prog-name=program -print-search-dirs -Q
cc -print-multi-directory ...
-mstrict-align
-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer -mtls-dialect=desc -mtls-dialect=traditional
cc -mstrict-align ...
-mtls-size
-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419
cc -mtls-size ...
-mlow-precision-recip-sqrt
-mno-low-precision-recip-sqrt -mlow-precision-sqrt -mno-low-precision-sqrt -mlow-precision-div
cc -mlow-precision-recip-sqrt ...
-mno-low-precision-div
Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf
cc -mno-low-precision-div ...
-msplit-lohi
-mpost-inc -mpost-modify -mstack-offset=num -mround-nearest -mlong-calls -mshort-calls -msmall16
cc -msplit-lohi ...
-mfp-mode=mode
ARC Options -mbarrel-shifter -mcpu=cpu -mA6 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr -mea
cc -mfp-mode=mode ...
-mno-mpy
-mmul32x16 -mmul64 -matomic -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap -mcrc
cc -mno-mpy ...
-mdsp-packa
-mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
cc -mdsp-packa ...
-marclinux_prof
-mlong-calls -mmedium-calls -msdata -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
cc -marclinux_prof ...
-mbbit-peephole
-mno-brcc -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi -mexpand-adddi
cc -mbbit-peephole ...
-mindexed-loads
-mlra -mlra-priority-none -mlra-priority-compact mlra-priority-noncompact -mno-millicode -mmixed-code
cc -mindexed-loads ...
-mq-class
-mRcq -mRcw -msize-level=level -mtune=cpu -mmultcost=num -munalign-prob-threshold=probability -mmpy-option=multo
cc -mq-class ...
-mdiv-rem
ARM Options -mapcs-frame -mno-apcs-frame -mabi=name -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
cc -mdiv-rem ...
-mno-apcs-reentrant
-msched-prolog -mno-sched-prolog -mlittle-endian -mbig-endian -mfloat-abi=name -mfp16-format=name
cc -mno-apcs-reentrant ...
-mthumb-interwork
-mno-thumb-interwork -mcpu=name -march=name -mfpu=name -mtune=name -mprint-tune-info
cc -mthumb-interwork ...
-mstructure-size-boundary
-mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base -mno-single-pic-base
cc -mstructure-size-boundary ...
-mpic-register
-mnop-fun-dllimport -mpoke-function-name -mthumb -marm -mtpcs-frame -mtpcs-leaf-frame
cc -mpic-register ...
-mcaller-super-interworking
-mcallee-super-interworking -mtp=name -mtls-dialect=dialect -mword-relocations -mfix-cortex-m3-ldrd
cc -mcaller-super-interworking ...
-munaligned-access
AVR Options -mmcu=mcu -mabsdata -maccumulate-args -mbranch-cost=cost -mcall-prologues -mint8 -mn_flash=size -mno-interrupts
cc -munaligned-access ...
-mno-specld-anomaly
-mcsync-anomaly -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library
cc -mno-specld-anomaly ...
-mno-id-shared-library
-mshared-library-id=n -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data -mno-sep-data
cc -mno-id-shared-library ...
-mcc-init
-mno-side-effects -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue
cc -mcc-init ...
-mno-gotplt
CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops -mdata-model=modelDarwin Options -all_load -allowable_client -arch -arch_errors_fatal -arch_only -bind_at_load -bundle -bundle_loader
cc -mno-gotplt ...
-client_name
-compatibility_version -current_version -dead_strip -dependency-file -dylib_file -dylinker_install_name -dynamic
cc -client_name ...
-dynamiclib
-exported_symbols_list -filelist -flat_namespace -force_cpusubtype_ALL -force_flat_namespace
cc -dynamiclib ...
-headerpad_max_install_names
-iframework -image_base -init -install_name -keep_private_externs -multi_module
cc -headerpad_max_install_names ...
-multiply_defined
-multiply_defined_unused -noall_load -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
cc -multiply_defined ...
-noprebind
-noseglinkedit -pagezero_size -prebind -prebind_all_twolevel_modules -private_bundle -read_only_relocs -sectalign
cc -noprebind ...
-sectobjectsymbols
-whyload -seg1addr -sectcreate -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
cc -sectobjectsymbols ...
-segs_read_write_addr
-seg_addr_table -seg_addr_table_filename -seglinkedit -segprot -segs_read_only_addr
cc -segs_read_write_addr ...
-unexported_symbols_list
-weak_reference_mismatches -whatsloaded -F -gused -gfull -mmacosx-version-min=version -mkernel
cc -unexported_symbols_list ...
-mone-byte-bool
DEC Alpha Options -mno-fp-regs -msoft-float -mieee -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
cc -mone-byte-bool ...
-mfp-rounding-mode
-mtrap-precision=mode -mbuild-constants -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
cc -mfp-rounding-mode ...
-mdouble
-mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic -minline-plt -mgprel-ro -multilib-library-pic
cc -mdouble ...
-mlinked-fp
-mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack -mno-pack -mno-eflags -mcond-move
cc -mlinked-fp ...
-mno-cond-move
-moptimize-membar -mno-optimize-membar -mscc -mno-scc -mcond-exec -mno-cond-exec -mvliw-branch
cc -mno-cond-move ...
-mno-vliw-branch
-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls
cc -mno-vliw-branch ...
-mcpu
GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid -tno-android-cc -tno-android-ldH8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300HPPA Options -march=architecture-type -mcaller-copies -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
cc -mcpu ...
-mgnu-ld
-mhp-ld -mfixed-range=register-range -mjump-in-delay -mlinker-opt -mlong-calls -mlong-load-store
cc -mgnu-ld ...
-mno-disable-fpregs
-mno-disable-indexing -mno-fast-indirect-calls -mno-gas -mno-jump-in-delay -mno-long-load-store
cc -mno-disable-fpregs ...
-mno-portable-runtime
-mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0 -mpa-risc-1-1 -mpa-risc-2-0
cc -mno-portable-runtime ...
-mportable-runtime
IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic -mvolatile-asm-stop -mregister-names -msdata
cc -mportable-runtime ...
-mno-sdata
-mconstant-gp -mauto-pic -mfused-madd -minline-float-divide-min-latency -minline-float-divide-max-throughput
cc -mno-sdata ...
-mno-inline-float-divide
-minline-int-divide-min-latency -minline-int-divide-max-throughput -mno-inline-int-divide
cc -mno-inline-float-divide ...
-msched-br-in-data-spec
-msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc -msched-spec-control-ldc
cc -msched-br-in-data-spec ...
-msched-prefer-non-data-spec-insns
-msched-prefer-non-control-spec-insns -msched-stop-bits-after-every-cycle
cc -msched-prefer-non-data-spec-insns ...
-msched-count-spec-in-critical-path
-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
cc -msched-count-spec-in-critical-path ...
-msched-max-memory-insns-hard-limit
LM32 Options -mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled -msign-extend-enabled -muser-enabledM32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops -mno-align-loops -missue-rate=number -mbranch-cost=number
cc -msched-max-memory-insns-hard-limit ...
-mmodel
M32C Options -mcpu=cpu -msim -memregs=numberM680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32
cc -mmodel ...
-m5200
-m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd
cc -m5200 ...
-mdiv
-mno-div -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel -malign-int -mstrict-align -msep-data
cc -mdiv ...
-mno-sep-data
MCore Options -mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates -mno-relax-immediates -mwide-bitfields
cc -mno-sep-data ...
-mno-wide-bitfields
-m4byte-functions -mno-4byte-functions -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
cc -mno-wide-bitfields ...
-mno-lsim
MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2
cc -mno-lsim ...
-mdc
-mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
cc -mdc ...
-msimnovec
MicroBlaze Options -msoft-float -mhard-float -msmall-divides -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div
cc -msimnovec ...
-mxl-barrel-shift
-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss -mxl-multiply-high -mxl-float-convert
cc -mxl-barrel-shift ...
-mxl-float-sqrt
MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5
cc -mxl-float-sqrt ...
-mips32r6
-mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16 -mno-mips16 -mflip-mips16 -minterlink-compressed
cc -mips32r6 ...
-mno-interlink-compressed
-minterlink-mips16 -mno-interlink-mips16 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared
cc -mno-interlink-compressed ...
-mplt
-mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float -mno-float -msingle-float
cc -mplt ...
-mdouble-float
-modd-spreg -mno-odd-spreg -mabs=mode -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu -mmno-mcu -meva
cc -mdouble-float ...
-mno-eva
-mvirt -mno-virt -mxpa -mno-xpa -mmicromips -mno-micromips -mmsa -mno-msa -mfpu=fpu-type -msmartmips -mno-smartmips
cc -mno-eva ...
-mpaired-single
-mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc -mlong64 -mlong32
cc -mpaired-single ...
-msym32
-mno-sym32 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
cc -msym32 ...
-mno-embedded-data
-muninit-const-in-rodata -mno-uninit-const-in-rodata -mcode-readable=setting -msplit-addresses
cc -mno-embedded-data ...
-mno-split-addresses
-mexplicit-relocs -mno-explicit-relocs -mcheck-zero-division -mno-check-zero-division -mdivide-traps
cc -mno-split-addresses ...
-mdivide-breaks
-mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls -mmad -mno-mad
cc -mdivide-breaks ...
-mimadd
-mno-imadd -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k -mfix-r4000 -mno-fix-r4000 -mfix-r4400
cc -mimadd ...
-mno-fix-r4400
-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
cc -mno-fix-r4400 ...
-mno-fix-vr4130
-mfix-sb1 -mno-fix-sb1 -mflush-func=func -mno-flush-func -mbranch-cost=num -mbranch-likely
cc -mno-fix-vr4130 ...
-mno-branch-likely
-mcompact-branches=policy -mfp-exceptions -mno-fp-exceptions -mvr4130-align -mno-vr4130-align -msynci
cc -mno-branch-likely ...
-mno-synci
-mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
cc -mno-synci ...
-mframe-header-opt
MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
cc -mframe-header-opt ...
-mtoplevel-symbols
-melf -mbranch-predict -mno-branch-predict -mbase-addresses -mno-base-addresses -msingle-exit
cc -mtoplevel-symbols ...
-mno-single-exit
MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
cc -mno-single-exit ...
-mrelax
Moxie Options -meb -mel -mmul.x -mno-crt0MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax -mwarn-mcu -mcode-region= -mdata-region=
cc -mrelax ...
-msilicon-errata=
NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs -mfull-regs -mcmov -mno-cmov -mperf-ext -mno-perf-ext -mv3push
cc -msilicon-errata= ...
-mno-v3push
Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt -mel -meb -mno-bypass-cache -mbypass-cache -mno-cache-volatile
cc -mno-v3push ...
-mcache-volatile
-mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div
cc -mcache-volatile ...
-mcustom-insn
-mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc -msys-crt0=name -msys-lib=name -march=arch -mbmx
cc -mcustom-insn ...
-mno-bmx
Nvidia PTX Options -m32 -m64 -mmainkernel -moptimizePDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 -mbcopy -mbcopy-builtin -mint32 -mno-int16 -mint16
cc -mno-bmx ...
-mno-int32
-mfloat32 -mno-float64 -mfloat64 -mno-float32 -mabshi -mno-abshi -mbranch-expensive -mbranch-cheap -munix-asm
cc -mno-int32 ...
-mdec-asm
picoChip Options -mae=ae_type -mvliw-lookahead=N -msymbol-as-address -mno-inefficient-warningsPowerPC Options See RS/6000 and PowerPC Options.RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-string
cc -mdec-asm ...
-mtune
-msmall-data-limit=N-bytes -msave-restore -mno-save-restore -mstrict-align -mno-strict-align
cc -mtune ...
-mcmodel
RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
cc -mcmodel ...
-m64bit-doubles
RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
cc -m64bit-doubles ...
-mpowerpc-gpopt
-mno-powerpc-gpopt -mpowerpc-gfxopt -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd
cc -mpowerpc-gpopt ...
-mno-popcntd
-mfprnd -mno-fprnd -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
cc -mno-popcntd ...
-mno-fp-in-toc
-mno-sum-in-toc -m64 -m32 -mxl-compat -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
cc -mno-fp-in-toc ...
-mhard-float
-mmultiple -mno-multiple -msingle-float -mdouble-float -msimple-fpu -mstring -mno-string -mupdate -mno-update
cc -mhard-float ...
-mavoid-indexed-addresses
-mno-avoid-indexed-addresses -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align -mstrict-align
cc -mavoid-indexed-addresses ...
-mno-strict-align
-mrelocatable -mno-relocatable -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
cc -mno-strict-align ...
-mlittle-endian
-mbig -mbig-endian -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base
cc -mlittle-endian ...
-mprioritize-restricted-insns
-msched-costly-dep=dependence_type -minsert-sched-nops=scheme -mcall-sysv -mcall-netbsd
cc -mprioritize-restricted-insns ...
-maix-struct-return
-msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt -mblock-move-inline-limit=num -misel -mno-isel
cc -maix-struct-return ...
-misel
-misel=no -mspe -mno-spe -mspe=yes -mspe=no -mpaired -mgen-cell-microcode -mwarn-cell-microcode -mvrsave
cc -misel ...
-mno-vrsave
-mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double
cc -mno-vrsave ...
-mpointers-to-nested-functions
-mno-pointers-to-nested-functions -msave-toc-indirect -mno-save-toc-indirect -mpower8-fusion
cc -mpointers-to-nested-functions ...
-mno-mpower8-fusion
-mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move
cc -mno-mpower8-fusion ...
-mquad-memory
-mno-quad-memory -mquad-memory-atomic -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
cc -mquad-memory ...
-mupper-regs-df
-mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf -mupper-regs-di -mno-upper-regs-di -mupper-regs
cc -mupper-regs-df ...
-mno-upper-regs
-mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
cc -mno-upper-regs ...
-mstack-protector-guard
RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu= -mbig-endian-data -mlittle-endian-data -msmall-data -msim
cc -mstack-protector-guard ...
-mno-sim
-mas100-syntax -mno-as100-syntax -mrelax -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
cc -mno-sim ...
-mno-allow-string-insns
S/390 and zSeries Options -mtune=cpu-type -march=cpu-type -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp -mlong-double-64
cc -mno-allow-string-insns ...
-mlong-double-128
-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec -mmvcle
cc -mlong-double-128 ...
-mno-mvcle
-m64 -m31 -mdebug -mno-debug -mesa -mzarch -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace -mfused-madd
cc -mno-mvcle ...
-mno-fused-madd
Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u -mscore7 -mscore7dSH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
cc -mno-fused-madd ...
-m4a-nofpu
-m4a-single-only -m4a-single -m4a -m4al -mb -ml -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
cc -m4a-nofpu ...
-mnomacsave
-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mprefergot -musermode -multcost=number
cc -mnomacsave ...
-mbranch-cost
-mzdcbranch -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd -mno-fused-madd -mfsca -mno-fsca
cc -mbranch-cost ...
-mfsrra
Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text -pthreadsSPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
cc -mfsrra ...
-mfaster-structs
-mno-faster-structs -mflat -mno-flat -mfpu -mno-fpu -mhard-float -msoft-float -mhard-quad-float
cc -mfaster-structs ...
-msoft-quad-float
-mstack-bias -mno-stack-bias -mstd-struct-return -mno-std-struct-return -munaligned-doubles
cc -msoft-quad-float ...
-mno-unaligned-doubles
-muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis -mvis2 -mno-vis2 -mvis3 -mno-vis3
cc -mno-unaligned-doubles ...
-mvis4
-mno-vis4 -mvis4b -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld -mpopc -mno-popc -msubxc
cc -mvis4 ...
-mno-subxc
SPU Options -mwarn-reloc -merror-reloc -msafe-dma -munsafe-dma -mbranch-hints -msmall-mem -mlarge-mem -mstdmain
cc -mno-subxc ...
-mfixed-range
-mea32 -mea64 -maddress-space-conversion -mno-address-space-conversion -mcache-size=cache-size
cc -mfixed-range ...
-matomic-updates
System V Options -Qy -Qn -YP,paths -Ym,dirTILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian -mcmodel=code-modelTILEPro Options -mcpu=cpu -m32V850 Options -mlong-calls -mno-long-calls -mep -mno-ep -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
cc -matomic-updates ...
-mzda
-mapp-regs -mno-app-regs -mdisable-callt -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e -mv850
cc -mzda ...
-mv850e3v5
VAX Options -mg -mgnu -munixVisium Options -mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
cc -mv850e3v5 ...
-muser-mode
VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64 -mpointer-size=sizeVxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy -Xbind-nowx86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-list -mdump-tune-features -mno-default -mfpmath=unit
cc -muser-mode ...
-masm
-mno-fancy-math-387 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float -mno-wide-multiply -mrtd
cc -masm ...
-malign-double
-mpreferred-stack-boundary=num -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip
cc -malign-double ...
-mrecip
-mvzeroupper -mprefer-avx128 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx -mavx2
cc -mrecip ...
-mavx512f
-mavx512pf -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
cc -mavx512f ...
-mpclmul
-mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 -mclflushopt -mxsavec -mxsaves -msse4a -m3dnow -m3dnowa -mpopcnt
cc -mpclmul ...
-mabm
-mbmi -mtbm -mfma4 -mxop -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero -mpku
cc -mabm ...
-mthreads
-mms-bitfields -mno-align-stringops -minline-all-stringops -minline-stringops-dynamically -mstringop-strategy=alg
cc -mthreads ...
-mmemcpy-strategy
-mmemset-strategy=strategy -mpush-args -maccumulate-outgoing-args -m128bit-long-double
cc -mmemcpy-strategy ...
-m96bit-long-double
-mlong-double-64 -mlong-double-80 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
cc -m96bit-long-double ...
-mvect8-ret-in-mem
-mpc32 -mpc64 -mpc80 -mstackrealign -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
cc -mvect8-ret-in-mem ...
-mfentry
-mrecord-mcount -mnop-mcount -m8bit-idiv -mavx256-split-unaligned-load -mavx256-split-unaligned-store
cc -mfentry ...
-malign-data
-mstack-protector-guard=guard -mmitigate-rop -mgeneral-regs-only -mindirect-branch=choice
cc -malign-data ...
-mfunction-return
x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
cc -mfunction-return ...
-fno-set-stack-executable
Xstormy16 Options -msimXtensa Options -mconst16 -mno-const16 -mfused-madd -mno-fused-madd -mforce-no-pic -mserialize-volatile -mno-serialize-volatile
cc -fno-set-stack-executable ...
-mtext-section-literals
-mno-text-section-literals -mauto-litpools -mno-auto-litpools -mtarget-align -mno-target-align
cc -mtext-section-literals ...
-mlongcalls
zSeries Options See S/390 and zSeries Options.Options Controlling the Kind of OutputCompilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order. GCC iscapable of preprocessing and compiling several files either into several assembler input files, or into one assembler input file;then each assembler input file produces an object file, and linking combines all the object files (those newly compiled, and thosespecified as input) into an executable file.For any given input file, the file name suffix determines what kind of compilation is done:file.cC source code that must be preprocessed.file.iC source code that should not be preprocessed.file.iiC++ source code that should not be preprocessed.file.mObjective-C source code. Note that you must link with the libobjc library to make an Objective-C program work.file.miObjective-C source code that should not be preprocessed.file.mmfile.MObjective-C++ source code. Note that you must link with the libobjc library to make an Objective-C++ program work. Note that .Mrefers to a literal capital M.file.miiObjective-C++ source code that should not be preprocessed.file.hC, C++, Objective-C or Objective-C++ header file to be turned into a precompiled header (default), or C, C++ header file to beturned into an Ada spec (via the -fdump-ada-spec switch).file.ccfile.cpfile.cxxfile.cppfile.CPPfile.c++file.CC++ source code that must be preprocessed. Note that in .cxx, the last two letters must both be literally x. Likewise, .Crefers to a literal capital C.file.mmfile.MObjective-C++ source code that must be preprocessed.file.miiObjective-C++ source code that should not be preprocessed.file.hhfile.Hfile.hpfile.hxxfile.hppfile.HPPfile.h++file.tccC++ header file to be turned into a precompiled header or Ada spec.file.ffile.forfile.ftnFixed form Fortran source code that should not be preprocessed.file.Ffile.FORfile.fppfile.FPPfile.FTNFixed form Fortran source code that must be preprocessed (with the traditional preprocessor).file.f90file.f95file.f03file.f08Free form Fortran source code that should not be preprocessed.file.F90file.F95file.F03file.F08Free form Fortran source code that must be preprocessed (with the traditional preprocessor).file.goGo source code.file.brigBRIG files (binary representation of HSAIL).file.adsAda source code file that contains a library unit declaration (a declaration of a package, subprogram, or generic, or a genericinstantiation), or a library unit renaming declaration (a package, generic, or subprogram renaming declaration). Such files arealso called specs.file.adbAda source code file containing a library unit body (a subprogram or package body). Such files are also called bodies.file.dD source code file.file.diD interface code file.file.ddD documentation code file.file.sAssembler code.file.Sfile.sxAssembler code that must be preprocessed.otherAn object file to be fed straight into linking. Any file name with no recognized suffix is treated this way.You can specify the input language explicitly with the -x option:
cc -mlongcalls ...
-x
Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on thefile name suffix). This option applies to all following input files until the next -x option. Possible values for language are:c c-header cpp-outputc++ c++-header c++-cpp-outputobjective-c objective-c-header objective-c-cpp-outputobjective-c++ objective-c++-header objective-c++-cpp-outputassembler assembler-with-cppadadf77 f77-cpp-input f95 f95-cpp-inputgobrig
cc -x ...
-o
Place output in file file. This applies to whatever sort of output is being produced, whether it be an executable file, anobject file, an assembler file or preprocessed C code.If -o is not specified, the default is to put an executable file in a.out, the object file for source.suffix in source.o, itsassembler file in source.s, a precompiled header file in source.suffix.gch, and all preprocessed C source on standard output.
cc -o ...
-###
Like -v except the commands are not executed and arguments are quoted unless they contain only alphanumeric characters or "./-_".This is useful for shell scripts to capture the driver-generated command lines.
cc -### ...
--help
Print (on the standard output) a description of the command-line options understood by gcc. If the -v option is also specifiedthen --help is also passed on to the various processes invoked by gcc, so that they can display the command-line options theyaccept. If the -Wextra option has also been specified (prior to the --help option), then command-line options that have nodocumentation associated with them are also displayed.
cc --help ...
--target-help
Print (on the standard output) a description of target-specific command-line options for each tool. For some targets extratarget-specific information may also be printed.
cc --target-help ...
-mapcs
The output is sensitive to the effects of previous command-line options, so for example it is possible to find out whichoptimizations are enabled at -O2 by using:
cc -mapcs ...
-Q
Alternatively you can discover which binary optimizations are enabled by -O3 by using:gcc -c -Q -O3 --help=optimizers > /tmp/O3-optsgcc -c -Q -O2 --help=optimizers > /tmp/O2-optsdiff /tmp/O2-opts /tmp/O3-opts | grep enabled
cc -Q ...
--version
Display the version number and copyrights of the invoked GCC.
cc --version ...
-pass-exit-codes
Normally the gcc program exits with the code of 1 if any phase of the compiler returns a non-success return code. If you specify
cc -pass-exit-codes ...
-pipe
Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on somesystems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble.
cc -pipe ...
-specs
Process file after the compiler reads in the standard specs file, in order to override the defaults which the gcc driver programuses when determining what switches to pass to cc1, cc1plus, as, ld, etc. More than one -specs=file can be specified on thecommand line, and they are processed in order, from left to right.
cc -specs ...
-wrapper
Invoke all subcommands under a wrapper program. The name of the wrapper program and its parameters are passed as a commaseparated list.gcc -c t.c -wrapper gdb,--argsThis invokes all subprograms of gcc under gdb --args, thus the invocation of cc1 is gdb --args cc1 ....
cc -wrapper ...
-fplugin
Load the plugin code in file name.so, assumed to be a shared object to be dlopen'd by the compiler. The base name of the sharedobject file is used to identify the plugin for the purposes of argument parsing (See -fplugin-arg-name-key=value below). Eachplugin should define the callback functions specified in the Plugins API.
cc -fplugin ...
-fplugin-arg-name-key
Define an argument called key with a value of value for the plugin called name.
cc -fplugin-arg-name-key ...
-fdump-ada-spec[-slim]
For C and C++ source and include files, generate corresponding Ada specs.
cc -fdump-ada-spec[-slim] ...
-fada-spec-parent
In conjunction with -fdump-ada-spec[-slim] above, generate Ada specs as child units of parent unit.
cc -fada-spec-parent ...
-fdump-go-spec
For input files in any language, generate corresponding Go declarations in file. This generates Go "const", "type", "var", and"func" declarations which may be a useful way to start writing a Go interface to code written in some other language.@fileRead command-line options from file. The options read are inserted in place of the original @file option. If file does notexist, or cannot be read, then the option will be treated literally, and not removed.Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entireoption in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to beincluded with a backslash. The file may itself contain additional @file options; any such options will be processed recursively.Compiling C++ ProgramsC++ source files conventionally use one of the suffixes .C, .cc, .cpp, .CPP, .c++, .cp, or .cxx; C++ header files often use .hh,.hpp, .H, or (for shared template code) .tcc; and preprocessed C++ files use the suffix .ii. GCC recognizes files with these namesand compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc).However, the use of gcc does not add the C++ library. g++ is a program that calls GCC and automatically specifies linking againstthe C++ library. It treats .c, .h and .i files as C++ source files instead of C source files unless -x is used. This program isalso useful when precompiling a C header file with a .h extension for use in C++ compilations. On many systems, g++ is alsoinstalled with the name c++.When you compile C++ programs, you may specify many of the same command-line options that you use for compiling programs in anylanguage; or command-line options meaningful for C and related languages; or options that are meaningful only for C++ programs.Options Controlling C DialectThe following options control the dialect of C (or languages derived from C, such as C++, Objective-C and Objective-C++) that thecompiler accepts:
cc -fdump-go-spec ...
-ansi.
The -ansi option does not cause non-ISO programs to be rejected gratuitously. For that, -Wpedantic is required in addition to
cc -ansi. ...
-std
Determine the language standard. This option is currently only supported when compiling C or C++.The compiler can accept several base standards, such as c90 or c++98, and GNU dialects of those standards, such as gnu90 orgnu++98. When a base standard is specified, the compiler accepts all programs following that standard plus those using GNUextensions that do not contradict it. For example, -std=c90 turns off certain features of GCC that are incompatible with ISOC90, such as the "asm" and "typeof" keywords, but not other GNU extensions that do not have a meaning in ISO C90, such asomitting the middle term of a "?:" expression. On the other hand, when a GNU dialect of a standard is specified, all featuressupported by the compiler are enabled, even when those features change the meaning of the base standard. As a result, somestrict-conforming programs may be rejected. The particular standard is used by -Wpedantic to identify which features are GNUextensions given that version of the standard. For example -std=gnu90 -Wpedantic warns about C++ style // comments, while
cc -std ...
-fgnu89-inline
The option -fgnu89-inline tells GCC to use the traditional GNU semantics for "inline" functions when in C99 mode.Using this option is roughly equivalent to adding the "gnu_inline" function attribute to all inline functions.The option -fno-gnu89-inline explicitly tells GCC to use the C99 semantics for "inline" when in C99 or gnu99 mode (i.e., itspecifies the default behavior). This option is not supported in -std=c90 or -std=gnu90 mode.The preprocessor macros "__GNUC_GNU_INLINE__" and "__GNUC_STDC_INLINE__" may be used to check which semantics are in effect for"inline" functions.
cc -fgnu89-inline ...
-fpermitted-flt-eval-methods
ISO/IEC TS 18661-3 defines new permissible values for "FLT_EVAL_METHOD" that indicate that operations and constants with asemantic type that is an interchange or extended format should be evaluated to the precision and range of that type. These newvalues are a superset of those permitted under C99/C11, which does not specify the meaning of other positive values of"FLT_EVAL_METHOD". As such, code conforming to C11 may not have been written expecting the possibility of the new values.
cc -fpermitted-flt-eval-methods ...
-aux-info
Output to the given filename prototyped declarations for all functions declared and/or defined in a translation unit, includingthose in header files. This option is silently ignored in any language other than C.Besides declarations, the file indicates, in comments, the origin of each declaration (source file and line), whether thedeclaration was implicit, prototyped or unprototyped (I, N for new or O for old, respectively, in the first character after theline number and the colon), and whether it came from a declaration or a definition (C or F, respectively, in the followingcharacter). In the case of function definitions, a K&R-style list of arguments followed by their declarations is also provided,inside comments, after the declaration.
cc -aux-info ...
-fno-asm
Do not recognize "asm", "inline" or "typeof" as a keyword, so that code can use these words as identifiers. You can use thekeywords "__asm__", "__inline__" and "__typeof__" instead. -ansi implies -fno-asm.In C++, this switch only affects the "typeof" keyword, since "asm" and "inline" are standard keywords. You may want to use the
cc -fno-asm ...
-fno-builtin-function
Don't recognize built-in functions that do not begin with __builtin_ as prefix.GCC normally generates special code to handle certain built-in functions more efficiently; for instance, calls to "alloca" maybecome single instructions which adjust the stack directly, and calls to "memcpy" may become inline copy loops. The resultingcode is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint onthose calls, nor can you change the behavior of the functions by linking with a different library. In addition, when a functionis recognized as a built-in function, GCC may use information about that function to warn about problems with calls to thatfunction, or to generate more efficient code, even if the resulting code still contains calls to that function. For example,warnings are given with -Wformat for bad calls to "printf" when "printf" is built in and "strlen" is known not to modify globalmemory.With the -fno-builtin-function option only the built-in function function is disabled. function must not begin with __builtin_.If a function is named that is not built-in in this version of GCC, this option is ignored. There is no corresponding
cc -fno-builtin-function ...
-fgimple
Enable parsing of function definitions marked with "__GIMPLE". This is an experimental feature that allows unit testing ofGIMPLE passes.
cc -fgimple ...
-fhosted
Assert that compilation targets a hosted environment. This implies -fbuiltin. A hosted environment is one in which the entirestandard library is available, and in which "main" has a return type of "int". Examples are nearly everything except a kernel.This is equivalent to -fno-freestanding.
cc -fhosted ...
-ffreestanding
Assert that compilation targets a freestanding environment. This implies -fno-builtin. A freestanding environment is one inwhich the standard library may not exist, and program startup may not necessarily be at "main". The most obvious example is anOS kernel. This is equivalent to -fno-hosted.
cc -ffreestanding ...
-fopenacc-dim
Specify default compute dimensions for parallel offload regions that do not explicitly specify. The geom value is a triple of':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size can be omitted, to use a target-specific default value.
cc -fopenacc-dim ...
-fopenmp
Enable handling of OpenMP directives "#pragma omp" in C/C++ and "!$omp" in Fortran. When -fopenmp is specified, the compilergenerates parallel code according to the OpenMP Application Program Interface v4.5 <http://www.openmp.org/>. This option implies
cc -fopenmp ...
-pthread
and thus is only supported on targets that have support for -pthread. -fopenmp implies -fopenmp-simd.
cc -pthread ...
-fopenmp-simd
Enable handling of OpenMP's SIMD directives with "#pragma omp" in C/C++ and "!$omp" in Fortran. Other OpenMP directives areignored.
cc -fopenmp-simd ...
-fcilkplus
Enable the usage of Cilk Plus language extension features for C/C++. When the option -fcilkplus is specified, enable the usageof the Cilk Plus Language extension features for C/C++. The present implementation follows ABI version 1.2. This is anexperimental feature that is only partially complete, and whose interface may change in future versions of GCC as the officialspecification changes. Currently, all features but "_Cilk_for" have been implemented.
cc -fcilkplus ...
-fgnu-tm
When the option -fgnu-tm is specified, the compiler generates code for the Linux variant of Intel's current Transactional MemoryABI specification document (Revision 1.1, May 6 2009). This is an experimental feature whose interface may change in futureversions of GCC, as the official specification changes. Please note that not all architectures are supported for this feature.For more information on GCC's support for transactional memory,Note that the transactional memory feature is not supported with non-call exceptions (-fnon-call-exceptions).
cc -fgnu-tm ...
-fms-extensions
Accept some non-standard constructs used in Microsoft header files.In C++ code, this allows member names in structures to be similar to previous types declarations.typedef int UOW;struct ABC {UOW UOW;};Some cases of unnamed fields in structures and unions are only accepted with this option.Note that this option is off for all targets but x86 targets using ms-abi.
cc -fms-extensions ...
-fplan9-extensions
Accept some non-standard constructs used in Plan 9 code.This enables -fms-extensions, permits passing pointers to structures with anonymous fields to functions that expect pointers toelements of the type of the field, and permits referring to anonymous fields declared using a typedef. This is only supportedfor C, not C++.
cc -fplan9-extensions ...
-fcond-mismatch
Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void.This option is not supported for C++.
cc -fcond-mismatch ...
-flax-vector-conversions
Allow implicit conversions between vectors with differing numbers of elements and/or incompatible element types. This optionshould not be used for new code.
cc -flax-vector-conversions ...
-funsigned-char
Let the type "char" be unsigned, like "unsigned char".Each kind of machine has a default for what "char" should be. It is either like "unsigned char" by default or like "signed char"by default.Ideally, a portable program should always use "signed char" or "unsigned char" when it depends on the signedness of an object.But many programs have been written to use plain "char" and expect it to be signed, or expect it to be unsigned, depending on themachines they were written for. This option, and its inverse, let you make such a program work with the opposite default.The type "char" is always a distinct type from each of "signed char" or "unsigned char", even though its behavior is always justlike one of those two.
cc -funsigned-char ...
-fsigned-char
Let the type "char" be signed, like "signed char".Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. Likewise, the option
cc -fsigned-char ...
-fno-signed-char
is equivalent to -funsigned-char.
cc -fno-signed-char ...
-fno-unsigned-bitfields
These options control whether a bit-field is signed or unsigned, when the declaration does not use either "signed" or "unsigned".By default, such a bit-field is signed, because this is consistent: the basic integer types such as "int" are signed types.
cc -fno-unsigned-bitfields ...
-fsso-struct
Set the default scalar storage order of structures and unions to the specified endianness. The accepted values are big-endian,little-endian and native for the native endianness of the target (the default). This option is not supported for C++.Warning: the -fsso-struct switch causes GCC to generate code that is not binary compatible with code generated without it if thespecified endianness is not the native endianness of the target.Options Controlling C++ DialectThis section describes the command-line options that are only meaningful for C++ programs. You can also use most of the GNU compileroptions regardless of what language your program is in. For example, you might compile a file firstClass.C like this:g++ -g -fstrict-enums -O -c firstClass.CIn this example, only -fstrict-enums is an option meant only for C++ programs; you can use the other options with any languagesupported by GCC.Some options for compiling C programs, such as -std, are also relevant for C++ programs.Here is a list of options that are only for compiling C++ programs:
cc -fsso-struct ...
-fabi-compat-version
On targets that support strong aliases, G++ works around mangling changes by creating an alias with the correct mangled name whendefining a symbol with an incorrect mangled name. This switch specifies which ABI version to use for the alias.With -fabi-version=0 (the default), this defaults to 8 (GCC 5 compatibility). If another ABI version is explicitly selected,this defaults to 0. For compatibility with GCC versions 3.2 through 4.9, use -fabi-compat-version=2.If this option is not provided but -Wabi=n is, that version is used for compatibility aliases. If this option is provided alongwith -Wabi (without the version), the version from this option is used for the warning.
cc -fabi-compat-version ...
-fno-access-control
Turn off all access checking. This switch is mainly useful for working around bugs in the access control code.
cc -fno-access-control ...
-faligned-new
Enable support for C++17 "new" of types that require more alignment than "void* ::operator new(std::size_t)" provides. A numericargument such as "-faligned-new=32" can be used to specify how much alignment (in bytes) is provided by that function, but fewusers will need to override the default of "alignof(std::max_align_t)".
cc -faligned-new ...
-fcheck-new
Check that the pointer returned by "operator new" is non-null before attempting to modify the storage allocated. This check isnormally unnecessary because the C++ standard specifies that "operator new" only returns 0 if it is declared "throw()", in whichcase the compiler always checks the return value even without this option. In all other cases, when "operator new" has a non-empty exception specification, memory exhaustion is signalled by throwing "std::bad_alloc". See also new (nothrow).
cc -fcheck-new ...
-fconcepts
Enable support for the C++ Extensions for Concepts Technical Specification, ISO 19217 (2015), which allows code liketemplate <class T> concept bool Addable = requires (T t) { t + t; };template <Addable T> T add (T a, T b) { return a + b; }
cc -fconcepts ...
-fconstexpr-depth
Set the maximum nested evaluation depth for C++11 constexpr functions to n. A limit is needed to detect endless recursion duringconstant expression evaluation. The minimum specified by the standard is 512.
cc -fconstexpr-depth ...
-fdeduce-init-list
Enable deduction of a template type parameter as "std::initializer_list" from a brace-enclosed initializer list, i.e.template <class T> auto forward(T t) -> decltype (realfn (t)){return realfn (t);}void f(){forward({1,2}); // call forward<std::initializer_list<int>>}This deduction was implemented as a possible extension to the originally proposed semantics for the C++11 standard, but was notpart of the final standard, so it is disabled by default. This option is deprecated, and may be removed in a future version ofG++.
cc -fdeduce-init-list ...
-ffriend-injection
Inject friend functions into the enclosing namespace, so that they are visible outside the scope of the class in which they aredeclared. Friend functions were documented to work this way in the old Annotated C++ Reference Manual. However, in ISO C++ afriend function that is not declared in an enclosing scope can only be found using argument dependent lookup. GCC defaults tothe standard behavior.This option is for compatibility, and may be removed in a future release of G++.
cc -ffriend-injection ...
-fno-elide-constructors
The C++ standard allows an implementation to omit creating a temporary that is only used to initialize another object of the sametype. Specifying this option disables that optimization, and forces G++ to call the copy constructor in all cases. This optionalso causes G++ to call trivial member functions which otherwise would be expanded inline.In C++17, the compiler is required to omit these temporaries, but this option still affects trivial member functions.
cc -fno-elide-constructors ...
-fno-enforce-eh-specs
Don't generate code to check for violation of exception specifications at run time. This option violates the C++ standard, butmay be useful for reducing code size in production builds, much like defining "NDEBUG". This does not give user code permissionto throw exceptions in violation of the exception specifications; the compiler still optimizes based on the specifications, sothrowing an unexpected exception results in undefined behavior at run time.
cc -fno-enforce-eh-specs ...
-fno-extern-tls-init
The C++11 and OpenMP standards allow "thread_local" and "threadprivate" variables to have dynamic (runtime) initialization. Tosupport this, any use of such a variable goes through a wrapper function that performs any necessary initialization. When theuse and definition of the variable are in the same translation unit, this overhead can be optimized away, but when the use is ina different translation unit there is significant overhead even if the variable doesn't actually need dynamic initialization. Ifthe programmer can be sure that no use of the variable in a non-defining TU needs to trigger dynamic initialization (eitherbecause the variable is statically initialized, or a use of the variable in the defining TU will be executed before any uses inanother TU), they can avoid this overhead with the -fno-extern-tls-init option.On targets that support symbol aliases, the default is -fextern-tls-init. On targets that do not support symbol aliases, thedefault is -fno-extern-tls-init.
cc -fno-extern-tls-init ...
-fno-for-scope
If -ffor-scope is specified, the scope of variables declared in a for-init-statement is limited to the "for" loop itself, asspecified by the C++ standard. If -fno-for-scope is specified, the scope of variables declared in a for-init-statement extendsto the end of the enclosing scope, as was the case in old versions of G++, and other (traditional) implementations of C++.If neither flag is given, the default is to follow the standard, but to allow and give a warning for old-style code that wouldotherwise be invalid, or have different behavior.
cc -fno-for-scope ...
-fno-implicit-templates
Never emit code for non-inline templates that are instantiated implicitly (i.e. by use); only emit code for explicitinstantiations.
cc -fno-implicit-templates ...
-fno-implicit-inline-templates
Don't emit code for implicit instantiations of inline templates, either. The default is to handle inlines differently so thatcompiles with and without optimization need the same set of explicit instantiations.
cc -fno-implicit-inline-templates ...
-fno-implement-inlines
To save space, do not emit out-of-line copies of inline functions controlled by "#pragma implementation". This causes linkererrors if these functions are not inlined everywhere they are called.
cc -fno-implement-inlines ...
-fnew-ttp-matching
Enable the P0522 resolution to Core issue 150, template template parameters and default arguments: this allows a template withdefault template arguments as an argument for a template template parameter with fewer template parameters. This flag is enabledby default for -std=c++1z.
cc -fnew-ttp-matching ...
-fno-nonansi-builtins
Disable built-in declarations of functions that are not mandated by ANSI/ISO C. These include "ffs", "alloca", "_exit", "index","bzero", "conjf", and other related functions.
cc -fno-nonansi-builtins ...
-fnothrow-opt
Treat a "throw()" exception specification as if it were a "noexcept" specification to reduce or eliminate the text size overheadrelative to a function with no exception specification. If the function has local variables of types with non-trivialdestructors, the exception specification actually makes the function smaller because the EH cleanups for those variables can beoptimized away. The semantic effect is that an exception thrown out of a function with such an exception specification resultsin a call to "terminate" rather than "unexpected".
cc -fnothrow-opt ...
-fno-operator-names
Do not treat the operator name keywords "and", "bitand", "bitor", "compl", "not", "or" and "xor" as synonyms as keywords.
cc -fno-operator-names ...
-fno-optional-diags
Disable diagnostics that the standard says a compiler does not need to issue. Currently, the only such diagnostic issued by G++is the one for a name having multiple meanings within a class.
cc -fno-optional-diags ...
-fno-pretty-templates
When an error message refers to a specialization of a function template, the compiler normally prints the signature of thetemplate followed by the template arguments and any typedefs or typenames in the signature (e.g. "void f(T) [with T = int]"rather than "void f(int)") so that it's clear which template is involved. When an error message refers to a specialization of aclass template, the compiler omits any template arguments that match the default template arguments for that template. If eitherof these behaviors make it harder to understand the error message rather than easier, you can use -fno-pretty-templates todisable them.
cc -fno-pretty-templates ...
-frepo
Enable automatic template instantiation at link time. This option also implies -fno-implicit-templates.
cc -frepo ...
-fno-rtti
Disable generation of information about every class with virtual functions for use by the C++ run-time type identificationfeatures ("dynamic_cast" and "typeid"). If you don't use those parts of the language, you can save some space by using thisflag. Note that exception handling uses the same information, but G++ generates it as needed. The "dynamic_cast" operator canstill be used for casts that do not require run-time type information, i.e. casts to "void *" or to unambiguous base classes.
cc -fno-rtti ...
-fsized-deallocation
Enable the built-in global declarationsvoid operator delete (void *, std::size_t) noexcept;void operator delete[] (void *, std::size_t) noexcept;as introduced in C++14. This is useful for user-defined replacement deallocation functions that, for example, use the size ofthe object to make deallocation faster. Enabled by default under -std=c++14 and above. The flag -Wsized-deallocation warnsabout places that might want to add a definition.
cc -fsized-deallocation ...
-fstrict-enums
Allow the compiler to optimize using the assumption that a value of enumerated type can only be one of the values of theenumeration (as defined in the C++ standard; basically, a value that can be represented in the minimum number of bits needed torepresent all the enumerators). This assumption may not be valid if the program uses a cast to convert an arbitrary integervalue to the enumerated type.
cc -fstrict-enums ...
-fstrong-eval-order
Evaluate member access, array subscripting, and shift expressions in left-to-right order, and evaluate assignment in right-to-left order, as adopted for C++17. Enabled by default with -std=c++1z. -fstrong-eval-order=some enables just the ordering ofmember access and shift expressions, and is the default without -std=c++1z.
cc -fstrong-eval-order ...
-ftemplate-backtrace-limit
Set the maximum number of template instantiation notes for a single warning or error to n. The default value is 10.
cc -ftemplate-backtrace-limit ...
-ftemplate-depth
Set the maximum instantiation depth for template classes to n. A limit on the template instantiation depth is needed to detectendless recursions during template class instantiation. ANSI/ISO C++ conforming programs must not rely on a maximum depthgreater than 17 (changed to 1024 in C++11). The default value is 900, as the compiler can run out of stack space before hitting1024 in some situations.
cc -ftemplate-depth ...
-fuse-cxa-atexit
Register destructors for objects with static storage duration with the "__cxa_atexit" function rather than the "atexit" function.This option is required for fully standards-compliant handling of static destructors, but only works if your C library supports"__cxa_atexit".
cc -fuse-cxa-atexit ...
-fno-use-cxa-get-exception-ptr
Don't use the "__cxa_get_exception_ptr" runtime routine. This causes "std::uncaught_exception" to be incorrect, but is necessaryif the runtime routine is not available.
cc -fno-use-cxa-get-exception-ptr ...
-fvisibility-inlines-hidden
This switch declares that the user does not attempt to compare pointers to inline functions or methods where the addresses of thetwo functions are taken in different shared objects.The effect of this is that GCC may, effectively, mark inline methods with "__attribute__ ((visibility ("hidden")))" so that theydo not appear in the export table of a DSO and do not require a PLT indirection when used within the DSO. Enabling this optioncan have a dramatic effect on load and link times of a DSO as it massively reduces the size of the dynamic export table when thelibrary makes heavy use of templates.The behavior of this switch is not quite the same as marking the methods as hidden directly, because it does not affect staticvariables local to the function or cause the compiler to deduce that the function is defined in only one shared object.You may mark a method as having a visibility explicitly to negate the effect of the switch for that method. For example, if youdo want to compare pointers to a particular inline method, you might mark it as having default visibility. Marking the enclosingclass with explicit visibility has no effect.Explicitly instantiated inline methods are unaffected by this option as their linkage might otherwise cross a shared libraryboundary.
cc -fvisibility-inlines-hidden ...
-fvisibility-ms-compat
This flag attempts to use visibility settings to make GCC's C++ linkage model compatible with that of Microsoft Visual Studio.The flag makes these changes to GCC's linkage model:1. It sets the default visibility to "hidden", like -fvisibility=hidden.2. Types, but not their members, are not hidden by default.3. The One Definition Rule is relaxed for types without explicit visibility specifications that are defined in more than oneshared object: those declarations are permitted if they are permitted when this option is not used.In new code it is better to use -fvisibility=hidden and export those classes that are intended to be externally visible.Unfortunately it is possible for code to rely, perhaps accidentally, on the Visual Studio behavior.Among the consequences of these changes are that static data members of the same type with the same name but defined in differentshared objects are different, so changing one does not change the other; and that pointers to function members defined indifferent shared objects may not compare equal. When this flag is given, it is a violation of the ODR to define types with thesame name differently.
cc -fvisibility-ms-compat ...
-fno-weak
Do not use weak symbol support, even if it is provided by the linker. By default, G++ uses weak symbols if they are available.This option exists only for testing, and should not be used by end-users; it results in inferior code and has no benefits. Thisoption may be removed in a future release of G++.
cc -fno-weak ...
-nostdinc++
Do not search for header files in the standard directories specific to C++, but do still search the other standard directories.(This option is used when building the C++ library.)In addition, these optimization, warning, and code generation options have meanings only for C++ programs:
cc -nostdinc++ ...
-Wabi
Warn when G++ it generates code that is probably not compatible with the vendor-neutral C++ ABI. Since G++ now defaults toupdating the ABI with each major release, normally -Wabi will warn only if there is a check added later in a release series foran ABI issue discovered since the initial release. -Wabi will warn about more things if an older ABI version is selected (with
cc -Wabi ...
-Wabi=2
If an explicit version number is provided and -fabi-compat-version is not specified, the version number from this option is usedfor compatibility aliases. If no explicit version number is provided with this option, but -fabi-compat-version is specified,that version number is used for ABI warnings.Although an effort has been made to warn about all such cases, there are probably some cases that are not warned about, eventhough G++ is generating incompatible code. There may also be cases where warnings are emitted even though the code that isgenerated is compatible.You should rewrite your code to avoid these warnings if you are concerned about the fact that code generated by G++ may not bebinary compatible with code generated by other compilers.Known incompatibilities in -fabi-version=2 (which was the default from GCC 3.4 to 4.9) include:* A template with a non-type template parameter of reference type was mangled incorrectly:extern int N;template <int &> struct S {};void n (S<N>) {2}This was fixed in -fabi-version=3.* SIMD vector types declared using "__attribute ((vector_size))" were mangled in a non-standard way that does not allow foroverloading of functions taking vectors of different sizes.The mangling was changed in -fabi-version=4.* "__attribute ((const))" and "noreturn" were mangled as type qualifiers, and "decltype" of a plain declaration was foldedaway.These mangling issues were fixed in -fabi-version=5.* Scoped enumerators passed as arguments to a variadic function are promoted like unscoped enumerators, causing "va_arg" tocomplain. On most targets this does not actually affect the parameter passing ABI, as there is no way to pass an argumentsmaller than "int".Also, the ABI changed the mangling of template argument packs, "const_cast", "static_cast", prefix increment/decrement, and aclass scope function used as a template argument.These issues were corrected in -fabi-version=6.* Lambdas in default argument scope were mangled incorrectly, and the ABI changed the mangling of "nullptr_t".These issues were corrected in -fabi-version=7.* When mangling a function type with function-cv-qualifiers, the un-qualified function type was incorrectly treated as asubstitution candidate.This was fixed in -fabi-version=8, the default for GCC 5.1.* "decltype(nullptr)" incorrectly had an alignment of 1, leading to unaligned accesses. Note that this did not affect the ABIof a function with a "nullptr_t" parameter, as parameters have a minimum alignment.This was fixed in -fabi-version=9, the default for GCC 5.2.* Target-specific attributes that affect the identity of a type, such as ia32 calling conventions on a function type (stdcall,regparm, etc.), did not affect the mangled name, leading to name collisions when function pointers were used as templatearguments.This was fixed in -fabi-version=10, the default for GCC 6.1.It also warns about psABI-related changes. The known psABI changes at this point include:* For SysV/x86-64, unions with "long double" members are passed in memory as specified in psABI. For example:union U {long double ld;int i;};"union U" is always passed in memory.
cc -Wabi=2 ...
-Wabi-tag
Warn when a type with an ABI tag is used in a context that does not have that ABI tag. See C++ Attributes for more informationabout ABI tags.
cc -Wabi-tag ...
-Wctor-dtor-privacy
Warn when a class seems unusable because all the constructors or destructors in that class are private, and it has neitherfriends nor public static member functions. Also warn if there are no non-private methods, and there's at least one privatemember function that isn't a constructor or destructor.
cc -Wctor-dtor-privacy ...
-Wdelete-non-virtual-dtor
Warn when "delete" is used to destroy an instance of a class that has virtual functions and non-virtual destructor. It is unsafeto delete an instance of a derived class through a pointer to a base class if the base class does not have a virtual destructor.This warning is enabled by -Wall.
cc -Wdelete-non-virtual-dtor ...
-Wliteral-suffix
Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore. As a conformingextension, GCC treats such suffixes as separate preprocessing tokens in order to maintain backwards compatibility with code thatuses formatting macros from "<inttypes.h>". For example:#define __STDC_FORMAT_MACROS#include <inttypes.h>#include <stdio.h>int main() {int64_t i64 = 123;printf("My int64: %" PRId64"\n", i64);}In this case, "PRId64" is treated as a separate preprocessing token.Additionally, warn when a user-defined literal operator is declared with a literal suffix identifier that doesn't begin with anunderscore. Literal suffix identifiers that don't begin with an underscore are reserved for future standardization.This warning is enabled by default.
cc -Wliteral-suffix ...
-Wlto-type-mismatch
During the link-time optimization warn about type mismatches in global declarations from different compilation units. Requires
cc -Wlto-type-mismatch ...
-flto
to be enabled. Enabled by default.
cc -flto ...
-Wno-narrowing
For C++11 and later standards, narrowing conversions are diagnosed by default, as required by the standard. A narrowingconversion from a constant produces an error, and a narrowing conversion from a non-constant produces a warning, but
cc -Wno-narrowing ...
-Wnoexcept
Warn when a noexcept-expression evaluates to false because of a call to a function that does not have a non-throwing exceptionspecification (i.e. "throw()" or "noexcept") but is known by the compiler to never throw an exception.
cc -Wnoexcept ...
-Wnoexcept-type
Warn if the C++1z feature making "noexcept" part of a function type changes the mangled name of a symbol relative to C++14.Enabled by -Wabi and -Wc++1z-compat.template <class T> void f(T t) { t(); };void g() noexcept;void h() { f(g); } // in C++14 calls f<void(*)()>, in C++1z calls f<void(*)()noexcept>
cc -Wnoexcept-type ...
-Wnon-virtual-dtor
Warn when a class has virtual functions and an accessible non-virtual destructor itself or in an accessible polymorphic baseclass, in which case it is possible but unsafe to delete an instance of a derived class through a pointer to the class itself orbase class. This warning is automatically enabled if -Weffc++ is specified.
cc -Wnon-virtual-dtor ...
-Wregister
Warn on uses of the "register" storage class specifier, except when it is part of the GNU Explicit Register Variables extension.The use of the "register" keyword as storage class specifier has been deprecated in C++11 and removed in C++17. Enabled bydefault with -std=c++1z.
cc -Wregister ...
-Wreorder
Warn when the order of member initializers given in the code does not match the order in which they must be executed. Forinstance:struct A {int i;int j;A(): j (0), i (1) { }};The compiler rearranges the member initializers for "i" and "j" to match the declaration order of the members, emitting a warningto that effect. This warning is enabled by -Wall.
cc -Wreorder ...
-std=c++11,
The following -W... options are not affected by -Wall.
cc -std=c++11, ...
-Weffc++
Warn about violations of the following style guidelines from Scott Meyers' Effective C++ series of books:* Define a copy constructor and an assignment operator for classes with dynamically-allocated memory.* Prefer initialization to assignment in constructors.* Have "operator=" return a reference to *this.* Don't try to return a reference when you must return an object.* Distinguish between prefix and postfix forms of increment and decrement operators.* Never overload "&&", "||", or ",".This option also enables -Wnon-virtual-dtor, which is also one of the effective C++ recommendations. However, the check isextended to warn about the lack of virtual destructor in accessible non-polymorphic bases classes too.When selecting this option, be aware that the standard library headers do not obey all of these guidelines; use grep -v to filterout those warnings.
cc -Weffc++ ...
-Wno-non-template-friend
Disable warnings when non-template friend functions are declared within a template. In very old versions of GCC that predateimplementation of the ISO standard, declarations such as friend int foo(int), where the name of the friend is an unqualified-id,could be interpreted as a particular specialization of a template function; the warning exists to diagnose compatibilityproblems, and is enabled by default.
cc -Wno-non-template-friend ...
-Wold-style-cast
Warn if an old-style (C-style) cast to a non-void type is used within a C++ program. The new-style casts ("dynamic_cast","static_cast", "reinterpret_cast", and "const_cast") are less vulnerable to unintended effects and much easier to search for.
cc -Wold-style-cast ...
-Woverloaded-virtual
Warn when a function declaration hides virtual functions from a base class. For example, in:struct A {virtual void f();};struct B: public A {void f(int);};the "A" class version of "f" is hidden in "B", and code like:B* b;
cc -Woverloaded-virtual ...
-Wno-pmf-conversions
Disable the diagnostic for converting a bound pointer to member function to a plain pointer.
cc -Wno-pmf-conversions ...
-Wtemplates
Warn when a primary template declaration is encountered. Some coding rules disallow templates, and this may be used to enforcethat rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may alsoinstantiate or specialize templates.
cc -Wtemplates ...
-Wvirtual-inheritance
Warn when a class is defined with a virtual direct base class. Some coding rules disallow multiple inheritance, and this may beused to enforce that rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL.One may also define classes that indirectly use virtual inheritance.
cc -Wvirtual-inheritance ...
-Wnamespaces
Warn when a namespace definition is opened. Some coding rules disallow namespaces, and this may be used to enforce that rule.The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may also use usingdirectives and qualified names.
cc -Wnamespaces ...
-Wno-terminate
Disable the warning about a throw-expression that will immediately result in a call to "terminate".Options Controlling Objective-C and Objective-C++ Dialects(NOTE: This manual does not describe the Objective-C and Objective-C++ languages themselves.This section describes the command-line options that are only meaningful for Objective-C and Objective-C++ programs. You can alsouse most of the language-independent GNU compiler options. For example, you might compile a file some_class.m like this:gcc -g -fgnu-runtime -O -c some_class.mIn this example, -fgnu-runtime is an option meant only for Objective-C and Objective-C++ programs; you can use the other options withany language supported by GCC.Note that since Objective-C is an extension of the C language, Objective-C compilations may also use options specific to the C front-end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may use C++-specific options (e.g., -Wabi).Here is a list of options that are only for compiling Objective-C and Objective-C++ programs:
cc -Wno-terminate ...
-fgnu-runtime
Generate object code compatible with the standard GNU Objective-C runtime. This is the default for most types of systems.
cc -fgnu-runtime ...
-fnext-runtime
Generate output compatible with the NeXT runtime. This is the default for NeXT-based systems, including Darwin and Mac OS X.The macro "__NEXT_RUNTIME__" is predefined if (and only if) this option is used.
cc -fnext-runtime ...
-fno-nil-receivers
Assume that all Objective-C message dispatches ("[receiver message:arg]") in this translation unit ensure that the receiver isnot "nil". This allows for more efficient entry points in the runtime to be used. This option is only available in conjunctionwith the NeXT runtime and ABI version 0 or 1.
cc -fno-nil-receivers ...
-fobjc-abi-version
Use version n of the Objective-C ABI for the selected runtime. This option is currently supported only for the NeXT runtime. Inthat case, Version 0 is the traditional (32-bit) ABI without support for properties and other Objective-C 2.0 additions. Version1 is the traditional (32-bit) ABI with support for properties and other Objective-C 2.0 additions. Version 2 is the modern(64-bit) ABI. If nothing is specified, the default is Version 0 on 32-bit target machines, and Version 2 on 64-bit targetmachines.
cc -fobjc-abi-version ...
-fobjc-call-cxx-cdtors
For each Objective-C class, check if any of its instance variables is a C++ object with a non-trivial default constructor. Ifso, synthesize a special "- (id) .cxx_construct" instance method which runs non-trivial default constructors on any such instancevariables, in order, and then return "self". Similarly, check if any instance variable is a C++ object with a non-trivialdestructor, and if so, synthesize a special "- (void) .cxx_destruct" method which runs all such default destructors, in reverseorder.The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods thusly generated only operate on instance variables declared inthe current Objective-C class, and not those inherited from superclasses. It is the responsibility of the Objective-C runtime toinvoke all such methods in an object's inheritance hierarchy. The "- (id) .cxx_construct" methods are invoked by the runtimeimmediately after a new object instance is allocated; the "- (void) .cxx_destruct" methods are invoked immediately before theruntime deallocates an object instance.As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has support for invoking the "- (id) .cxx_construct" and "-(void) .cxx_destruct" methods.
cc -fobjc-call-cxx-cdtors ...
-fobjc-exceptions
Enable syntactic support for structured exception handling in Objective-C, similar to what is offered by C++. This option isrequired to use the Objective-C keywords @try, @throw, @catch, @finally and @synchronized. This option is available with boththe GNU runtime and the NeXT runtime (but not available in conjunction with the NeXT runtime on Mac OS X 10.2 and earlier).
cc -fobjc-exceptions ...
-fobjc-gc
Enable garbage collection (GC) in Objective-C and Objective-C++ programs. This option is only available with the NeXT runtime;the GNU runtime has a different garbage collection implementation that does not require special compiler flags.
cc -fobjc-gc ...
-fobjc-nilcheck
For the NeXT runtime with version 2 of the ABI, check for a nil receiver in method invocations before doing the actual methodcall. This is the default and can be disabled using -fno-objc-nilcheck. Class methods and super calls are never checked for nilin this way no matter what this flag is set to. Currently this flag does nothing when the GNU runtime, or an older version ofthe NeXT runtime ABI, is used.
cc -fobjc-nilcheck ...
-fobjc-std
Conform to the language syntax of Objective-C 1.0, the language recognized by GCC 4.0. This only affects the Objective-Cadditions to the C/C++ language; it does not affect conformance to C/C++ standards, which is controlled by the separate C/C++dialect option flags. When this option is used with the Objective-C or Objective-C++ compiler, any Objective-C syntax that isnot recognized by GCC 4.0 is rejected. This is useful if you need to make sure that your Objective-C code can be compiled witholder versions of GCC.
cc -fobjc-std ...
-freplace-objc-classes
Emit a special marker instructing ld(1) not to statically link in the resulting object file, and allow dyld(1) to load it in atrun time instead. This is used in conjunction with the Fix-and-Continue debugging mode, where the object file in question may berecompiled and dynamically reloaded in the course of program execution, without the need to restart the program itself.Currently, Fix-and-Continue functionality is only available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
cc -freplace-objc-classes ...
-fzero-link
When compiling for the NeXT runtime, the compiler ordinarily replaces calls to "objc_getClass("...")" (when the name of the classis known at compile time) with static class references that get initialized at load time, which improves run-time performance.Specifying the -fzero-link flag suppresses this behavior and causes calls to "objc_getClass("...")" to be retained. This isuseful in Zero-Link debugging mode, since it allows for individual class implementations to be modified during program execution.The GNU runtime currently always retains calls to "objc_get_class("...")" regardless of command-line options.
cc -fzero-link ...
-fno-local-ivars
By default instance variables in Objective-C can be accessed as if they were local variables from within the methods of the classthey're declared in. This can lead to shadowing between instance variables and other variables declared either locally inside aclass method or globally with the same name. Specifying the -fno-local-ivars flag disables this behavior thus avoiding variableshadowing issues.
cc -fno-local-ivars ...
-gen-decls
Dump interface declarations for all classes seen in the source file to a file named sourcename.decl.
cc -gen-decls ...
-Wassign-intercept
Warn whenever an Objective-C assignment is being intercepted by the garbage collector.
cc -Wassign-intercept ...
-Wselector
Warn if multiple methods of different types for the same selector are found during compilation. The check is performed on thelist of methods in the final stage of compilation. Additionally, a check is performed for each selector appearing in a"@selector(...)" expression, and a corresponding method for that selector has been found during compilation. Because thesechecks scan the method table only at the end of compilation, these warnings are not produced if the final stage of compilation isnot reached, for example because an error is found during compilation, or because the -fsyntax-only option is being used.
cc -Wselector ...
-Wstrict-selector-match
Warn if multiple methods with differing argument and/or return types are found for a given selector when attempting to send amessage using this selector to a receiver of type "id" or "Class". When this flag is off (which is the default behavior), thecompiler omits such warnings if any differences found are confined to types that share the same size and alignment.
cc -Wstrict-selector-match ...
-Wundeclared-selector
Warn if a "@selector(...)" expression referring to an undeclared selector is found. A selector is considered undeclared if nomethod with that name has been declared before the "@selector(...)" expression, either explicitly in an @interface or @protocoldeclaration, or implicitly in an @implementation section. This option always performs its checks as soon as a "@selector(...)"expression is found, while -Wselector only performs its checks in the final stage of compilation. This also enforces the codingstyle convention that methods and selectors must be declared before being used.
cc -Wundeclared-selector ...
-print-objc-runtime-info
Generate C header describing the largest structure that is passed by value, if any.Options to Control Diagnostic Messages FormattingTraditionally, diagnostic messages have been formatted irrespective of the output device's aspect (e.g. its width, ...). You can usethe options described below to control the formatting algorithm for diagnostic messages, e.g. how many characters per line, how oftensource location information should be reported. Note that some language front ends may not honor these options.
cc -print-objc-runtime-info ...
-fdiagnostics-show-location
Only meaningful in line-wrapping mode. Instructs the diagnostic messages reporter to emit source location information once; thatis, in case the message is too long to fit on a single physical line and has to be wrapped, the source location won't be emitted(as prefix) again, over and over, in subsequent continuation lines. This is the default behavior.
cc -fdiagnostics-show-location ...
-fno-diagnostics-color
Use color in diagnostics. WHEN is never, always, or auto. The default depends on how the compiler has been configured, it canbe any of the above WHEN options or also never if GCC_COLORS environment variable isn't present in the environment, and autootherwise. auto means to use color only when the standard error is a terminal. The forms -fdiagnostics-color and
cc -fno-diagnostics-color ...
-fno-diagnostics-show-caret
By default, each diagnostic emitted includes the original source line and a caret ^ indicating the column. This optionsuppresses this information. The source line is truncated to n characters, if the -fmessage-length=n option is given. When theoutput is done to the terminal, the width is limited to the width given by the COLUMNS environment variable or, if not set, tothe terminal width.
cc -fno-diagnostics-show-caret ...
-fdiagnostics-parseable-fixits
Emit fix-it hints in a machine-parseable format, suitable for consumption by IDEs. For each fix-it, a line will be printed afterthe relevant diagnostic, starting with the string "fix-it:". For example:fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"The location is expressed as a half-open range, expressed as a count of bytes, starting at byte 1 for the initial column. In theabove example, bytes 3 through 20 of line 45 of "test.c" are to be replaced with the given string:0000000001111111111222222222212345678901234567890123456789gtk_widget_showall (dlg);^^^^^^^^^^^^^^^^^^gtk_widget_show_allThe filename and replacement string escape backslash as "\\", tab as "\t", newline as "\n", double quotes as "\"", non-printablecharacters as octal (e.g. vertical tab as "\013").An empty replacement string indicates that the given range is to be removed. An empty range (e.g. "45:3-45:3") indicates thatthe string is to be inserted at the given position.
cc -fdiagnostics-parseable-fixits ...
-fdiagnostics-generate-patch
Print fix-it hints to stderr in unified diff format, after any diagnostics are printed. For example:
cc -fdiagnostics-generate-patch ...
-42,5
void show_cb(GtkDialog *dlg){
cc -42,5 ...
-
+ gtk_widget_show_all(dlg);}The diff may or may not be colorized, following the same rules as for diagnostics (see -fdiagnostics-color).
cc - ...
-fno-show-column
Do not print column numbers in diagnostics. This may be necessary if diagnostics are being scanned by a program that does notunderstand the column numbers, such as dejagnu.Options to Request or Suppress WarningsWarnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there mayhave been an error.The following language-independent options do not enable specific warnings but control the kinds of diagnostics produced by GCC.
cc -fno-show-column ...
-fmax-errors
Limits the maximum number of error messages to n, at which point GCC bails out rather than attempting to continue processing thesource code. If n is 0 (the default), there is no limit on the number of error messages produced. If -Wfatal-errors is alsospecified, then -Wfatal-errors takes precedence over this option.
cc -fmax-errors ...
-w
Inhibit all warning messages.
cc -w ...
-Werror
Make all warnings into errors.
cc -Werror ...
-Wfatal-errors
This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printingfurther error messages.You can request many specific warnings with options beginning with -W, for example -Wimplicit to request warnings on implicitdeclarations. Each of these specific warning options also has a negative form beginning -Wno- to turn off warnings; for example,
cc -Wfatal-errors ...
-pedantic
Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some otherprograms that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std optionused.Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few require -ansi or a -stdoption specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++features are supported as well. With this option, they are rejected.
cc -pedantic ...
-pedantic-errors
Give an error whenever the base standard (see -Wpedantic) requires a diagnostic, in some cases where there is undefined behaviorat compile-time and in some other cases that do not prevent compilation of programs that are valid according to the standard.This is not equivalent to -Werror=pedantic, since there are errors enabled by this option and not enabled by the latter and viceversa.
cc -pedantic-errors ...
-Wall
This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify toprevent the warning), even in conjunction with macros. This also enables some language-specific warnings described in C++Dialect Options and Objective-C and Objective-C++ Dialect Options.
cc -Wall ...
-Waddress
-Warray-bounds=1 (only with -O2) -Wbool-compare -Wbool-operation -Wc++11-compat -Wc++14-compat -Wchar-subscripts
cc -Waddress ...
-Wcomment
-Wduplicate-decl-specifier (C and Objective-C only) -Wenum-compare (in C/ObjC; this is on by default in C++) -Wformat
cc -Wcomment ...
-Wint-in-bool-context
(C and Objective-C only) -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only for C/ObjC and unless -ffreestanding)
cc -Wint-in-bool-context ...
-Wmaybe-uninitialized
for C/ObjC) -Wnarrowing (only for C++) -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpointer-sign -Wreorder
cc -Wmaybe-uninitialized ...
-Wreturn-type
-Wsequence-point -Wsign-compare (only in C++) -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-overflow=1
cc -Wreturn-type ...
-Wswitch
-Wtautological-compare -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
cc -Wswitch ...
-Wunused-variable
Note that some warning flags are not implied by -Wall. Some of them warn about constructions that users generally do notconsider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary orhard to avoid in some cases, and there is no simple way to modify the code to suppress the warning. Some of them are enabled by
cc -Wunused-variable ...
-Wextra
but many of them must be enabled individually.
cc -Wextra ...
-Wclobbered
only) -Wold-style-declaration (C only) -Woverride-init -Wsign-compare (C only) -Wtype-limits -Wuninitialized
cc -Wclobbered ...
-Wshift-negative-value
(in C++03 and in C99 and newer) -Wunused-parameter (only with -Wunused or -Wall)
cc -Wshift-negative-value ...
-Wchar-subscripts
Warn if an array subscript has type "char". This is a common cause of error, as programmers often forget that this type issigned on some machines. This warning is enabled by -Wall.
cc -Wchar-subscripts ...
-Wno-coverage-mismatch
Warn if feedback profiles do not match when using the -fprofile-use option. If a source file is changed between compiling with
cc -Wno-coverage-mismatch ...
-Wno-cpp
(C, Objective-C, C++, Objective-C++ and Fortran only)Suppress warning messages emitted by "#warning" directives.
cc -Wno-cpp ...
-Wdouble-promotion
Give a warning when a value of type "float" is implicitly promoted to "double". CPUs with a 32-bit "single-precision" floating-point unit implement "float" in hardware, but emulate "double" in software. On such a machine, doing computations using "double"values is much more expensive because of the overhead required for software emulation.It is easy to accidentally do computations with "double" because floating-point literals are implicitly of type "double". Forexample, in:float area(float radius){return 3.14159 * radius * radius;}the compiler performs the entire computation with "double" because the floating-point literal is a "double".
cc -Wdouble-promotion ...
-Wduplicate-decl-specifier
Warn if a declaration has duplicate "const", "volatile", "restrict" or "_Atomic" specifier. This warning is enabled by -Wall.
cc -Wduplicate-decl-specifier ...
-Wformat
Check calls to "printf" and "scanf", etc., to make sure that the arguments supplied have types appropriate to the format stringspecified, and that the conversions specified in the format string make sense. This includes standard functions, and othersspecified by format attributes, in the "printf", "scanf", "strftime" and "strfmon" (an X/Open extension, not in the C standard)families (or other target-specific families). Which functions are checked without format attributes having been specifieddepends on the standard version selected, and such checks of functions without the attribute specified are disabled by
cc -Wformat ...
-Wno-format-contains-nul
If -Wformat is specified, do not warn about format strings that contain NUL bytes.
cc -Wno-format-contains-nul ...
-Wno-format-extra-args
If -Wformat is specified, do not warn about excess arguments to a "printf" or "scanf" format function. The C standardspecifies that such arguments are ignored.Where the unused arguments lie between used arguments that are specified with $ operand number specifications, normallywarnings are still given, since the implementation could not know what type to pass to "va_arg" to skip the unused arguments.However, in the case of "scanf" formats, this option suppresses the warning if the unused arguments are all pointers, sincethe Single Unix Specification says that such unused arguments are allowed.
cc -Wno-format-extra-args ...
-Wformat-overflow
Warn about calls to formatted input/output functions such as "sprintf" and "vsprintf" that might overflow the destinationbuffer. When the exact number of bytes written by a format directive cannot be determined at compile-time it is estimatedbased on heuristics that depend on the level argument and on optimization. While enabling optimization will in most casesimprove the accuracy of the warning, it may also result in false positives.
cc -Wformat-overflow ...
-Wno-format-zero-length
If -Wformat is specified, do not warn about zero-length formats. The C standard specifies that zero-length formats areallowed.
cc -Wno-format-zero-length ...
-Wformat-nonliteral
If -Wformat is specified, also warn if the format string is not a string literal and so cannot be checked, unless the formatfunction takes its format arguments as a "va_list".
cc -Wformat-nonliteral ...
-Wformat-signedness
If -Wformat is specified, also warn if the format string requires an unsigned argument and the argument is signed and viceversa.
cc -Wformat-signedness ...
-Wformat-truncation
Warn about calls to formatted input/output functions such as "snprintf" and "vsnprintf" that might result in outputtruncation. When the exact number of bytes written by a format directive cannot be determined at compile-time it isestimated based on heuristics that depend on the level argument and on optimization. While enabling optimization will inmost cases improve the accuracy of the warning, it may also result in false positives. Except as noted otherwise, the optionuses the same logic -Wformat-overflow.
cc -Wformat-truncation ...
-Wno-format-security
or disable all format warnings with -Wformat=0. To make format security warnings fatal specify
cc -Wno-format-security ...
-Wformat-y2k
If -Wformat is specified, also warn about "strftime" formats that may yield only a two-digit year.
cc -Wformat-y2k ...
-Wnonnull
Warn about passing a null pointer for arguments marked as requiring a non-null value by the "nonnull" function attribute.
cc -Wnonnull ...
-Wnonnull-compare
Warn when comparing an argument marked with the "nonnull" function attribute against null inside the function.
cc -Wnonnull-compare ...
-Wnull-dereference
Warn if the compiler detects paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. This optionis only active when -fdelete-null-pointer-checks is active, which is enabled by optimizations in most targets. The precision ofthe warnings depends on the optimization options used.
cc -Wnull-dereference ...
-Winit-self
Warn about uninitialized variables that are initialized with themselves. Note this option can only be used with the
cc -Winit-self ...
-Wuninitialized
For example, GCC warns about "i" being uninitialized in the following snippet only when -Winit-self has been specified:int f(){int i = i;return i;}This warning is enabled by -Wall in C++.
cc -Wuninitialized ...
-Wimplicit-int
Warn when a declaration does not specify a type. This warning is enabled by -Wall.
cc -Wimplicit-int ...
-Wimplicit-function-declaration
Give a warning whenever a function is used before being declared. In C99 mode (-std=c99 or -std=gnu99), this warning is enabledby default and it is made into an error by -pedantic-errors. This warning is also enabled by -Wall.
cc -Wimplicit-function-declaration ...
-Wimplicit
Same as -Wimplicit-int and -Wimplicit-function-declaration. This warning is enabled by -Wall.
cc -Wimplicit ...
-Wignored-qualifiers
Warn if the return type of a function has a type qualifier such as "const". For ISO C such a type qualifier has no effect, sincethe value returned by a function is not an lvalue. For C++, the warning is only emitted for scalar types or "void". ISO Cprohibits qualified "void" return types on function definitions, so such return types always receive a warning even without thisoption.This warning is also enabled by -Wextra.
cc -Wignored-qualifiers ...
-Wignored-attributes
Warn when an attribute is ignored. This is different from the -Wattributes option in that it warns whenever the compiler decidesto drop an attribute, not that the attribute is either unknown, used in a wrong place, etc. This warning is enabled by default.
cc -Wignored-attributes ...
-Wmain
Warn if the type of "main" is suspicious. "main" should be a function with external linkage, returning int, taking either zeroarguments, two, or three arguments of appropriate types. This warning is enabled by default in C++ and is enabled by either
cc -Wmain ...
-Wmisleading-indentation
Warn when the indentation of the code does not reflect the block structure. Specifically, a warning is issued for "if", "else","while", and "for" clauses with a guarded statement that does not use braces, followed by an unguarded statement with the sameindentation.In the following example, the call to "bar" is misleadingly indented as if it were guarded by the "if" conditional.if (some_condition ())foo ();bar (); /* Gotcha: this is not guarded by the "if". */In the case of mixed tabs and spaces, the warning uses the -ftabstop= option to determine if the statements line up (defaultingto 8).The warning is not issued for code involving multiline preprocessor logic such as the following example.if (flagA)foo (0);#if SOME_CONDITION_THAT_DOES_NOT_HOLDif (flagB)#endiffoo (1);The warning is not issued after a "#line" directive, since this typically indicates autogenerated code, and no assumptions can bemade about the layout of the file that the directive references.This warning is enabled by -Wall in C and C++.
cc -Wmisleading-indentation ...
-Wmissing-braces
Warn if an aggregate or union initializer is not fully bracketed. In the following example, the initializer for "a" is not fullybracketed, but that for "b" is fully bracketed. This warning is enabled by -Wall in C.int a[2][2] = { 0, 1, 2, 3 };int b[2][2] = { { 0, 1 }, { 2, 3 } };This warning is enabled by -Wall.
cc -Wmissing-braces ...
-Wmissing-include-dirs
Warn if a user-supplied include directory does not exist.
cc -Wmissing-include-dirs ...
-Wparentheses
Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value isexpected, or when operators are nested whose precedence people often get confused about.Also warn if a comparison like "x<=y<=z" appears; this is equivalent to "(x<=y ? 1 : 0) <= z", which is a differentinterpretation from that of ordinary mathematical notation.Also warn for dangerous uses of the GNU extension to "?:" with omitted middle operand. When the condition in the "?": operator isa boolean expression, the omitted value is always 1. Often programmers expect it to be a value computed inside the conditionalexpression instead.This warning is enabled by -Wall.
cc -Wparentheses ...
-Wsequence-point
Warn about code that may have undefined semantics because of violations of sequence point rules in the C and C++ standards.The C and C++ standards define the order in which expressions in a C/C++ program are evaluated in terms of sequence points, whichrepresent a partial ordering between the execution of parts of the program: those executed before the sequence point, and thoseexecuted after it. These occur after the evaluation of a full expression (one which is not part of a larger expression), afterthe evaluation of the first operand of a "&&", "||", "? :" or "," (comma) operator, before a function is called (but after theevaluation of its arguments and the expression denoting the called function), and in certain other places. Other than asexpressed by the sequence point rules, the order of evaluation of subexpressions of an expression is not specified. All theserules describe only a partial order rather than a total order, since, for example, if two functions are called within oneexpression with no sequence point between them, the order in which the functions are called is not specified. However, thestandards committee have ruled that function calls do not overlap.It is not specified when between sequence points modifications to the values of objects take effect. Programs whose behaviordepends on this have undefined behavior; the C and C++ standards specify that "Between the previous and next sequence point anobject shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shallbe read only to determine the value to be stored.". If a program breaks these rules, the results on any particularimplementation are entirely unpredictable.Examples of code with undefined behavior are "a = a++;", "a[n] = b[n++]" and "a[i++] = i;". Some more complicated cases are notdiagnosed by this option, and it may give an occasional false positive result, but in general it has been found fairly effectiveat detecting this sort of problem in programs.The C++17 standard will define the order of evaluation of operands in more cases: in particular it requires that the right-handside of an assignment be evaluated before the left-hand side, so the above examples are no longer undefined. But this warningwill still warn about them, to help people avoid writing code that is undefined in C and earlier revisions of C++.The standard is worded confusingly, therefore there is some debate over the precise meaning of the sequence point rules in subtlecases. Links to discussions of the problem, including proposed formal definitions, may be found on the GCC readings page, at<http://gcc.gnu.org/readings.html>.This warning is enabled by -Wall for C and C++.
cc -Wsequence-point ...
-Wno-return-local-addr
Do not warn about returning a pointer (or in C++, a reference) to a variable that goes out of scope after the function returns.
cc -Wno-return-local-addr ...
-Wshift-count-negative
Warn if shift count is negative. This warning is enabled by default.
cc -Wshift-count-negative ...
-Wshift-overflow
Warn about left shift overflows. This warning is enabled by default in C99 and C++11 modes (and newer).
cc -Wshift-overflow ...
-Wswitch-default
Warn whenever a "switch" statement does not have a "default" case.
cc -Wswitch-default ...
-Wswitch-enum
Warn whenever a "switch" statement has an index of enumerated type and lacks a "case" for one or more of the named codes of thatenumeration. "case" labels outside the enumeration range also provoke warnings when this option is used. The only differencebetween -Wswitch and this option is that this option gives a warning about an omitted enumeration code even if there is a"default" label.
cc -Wswitch-enum ...
-Wswitch-unreachable
Warn whenever a "switch" statement contains statements between the controlling expression and the first case label, which willnever be executed. For example:switch (cond){i = 15;...case 5:...}
cc -Wswitch-unreachable ...
-Wsync-nand
Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch" built-in functions are used. These functions changed semantics inGCC 4.4.
cc -Wsync-nand ...
-Wunused-but-set-variable
Warn whenever a local variable is assigned to, but otherwise unused (aside from its declaration). This warning is enabled by
cc -Wunused-but-set-variable ...
-Wall.
To suppress this warning use the "unused" attribute.This warning is also enabled by -Wunused, which is enabled by -Wall.
cc -Wall. ...
-Wunused-function
Warn whenever a static function is declared but not defined or a non-inline static function is unused. This warning is enabledby -Wall.
cc -Wunused-function ...
-Wunused-label
Warn whenever a label is declared but not used. This warning is enabled by -Wall.To suppress this warning use the "unused" attribute.
cc -Wunused-label ...
-Wunused-local-typedefs
Warn when a typedef locally defined in a function is not used. This warning is enabled by -Wall.
cc -Wunused-local-typedefs ...
-Wno-unused-result
Do not warn if a caller of a function marked with attribute "warn_unused_result" does not use its return value. The default is
cc -Wno-unused-result ...
-Wunused-const-variable
Warn whenever a constant static variable is unused aside from its declaration. -Wunused-const-variable=1 is enabled by
cc -Wunused-const-variable ...
-Wunused-value
Warn whenever a statement computes a result that is explicitly not used. To suppress this warning cast the unused expression to"void". This includes an expression-statement or the left-hand side of a comma expression that contains no side effects. Forexample, an expression such as "x[i,j]" causes a warning, while "x[(void)i,j]" does not.This warning is enabled by -Wall.
cc -Wunused-value ...
-Wunused
All the above -Wunused options combined.In order to get a warning about an unused function parameter, you must either specify -Wextra -Wunused (note that -Wall implies
cc -Wunused ...
-Wunused)
or separately specify -Wunused-parameter.
cc -Wunused) ...
-Winvalid-memory-model
Warn for invocations of __atomic Builtins, __sync Builtins, and the C11 atomic generic functions with a memory consistencyargument that is either invalid for the operation or outside the range of values of the "memory_order" enumeration. For example,since the "__atomic_store" and "__atomic_store_n" built-ins are only defined for the relaxed, release, and sequentiallyconsistent memory orders the following code is diagnosed:void store (int *i){__atomic_store_n (i, 0, memory_order_consume);}
cc -Winvalid-memory-model ...
-Wunknown-pragmas
Warn when a "#pragma" directive is encountered that is not understood by GCC. If this command-line option is used, warnings areeven issued for unknown pragmas in system header files. This is not the case if the warnings are only enabled by the -Wallcommand-line option.
cc -Wunknown-pragmas ...
-Wstrict-aliasing
This option is only active when -fstrict-aliasing is active. It warns about code that might break the strict aliasing rules thatthe compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more commonpitfalls. It is included in -Wall. It is equivalent to -Wstrict-aliasing=3
cc -Wstrict-aliasing ...
-Wstringop-overflow
Warn for calls to string manipulation functions such as "memcpy" and "strcpy" that are determined to overflow the destinationbuffer. The optional argument is one greater than the type of Object Size Checking to perform to determine the size of thedestination. The argument is meaningful only for functions that operate on character arrays but not for raw memory functionslike "memcpy" which always make use of Object Size type-0. The option also warns for calls that specify a size in excess of thelargest possible object or at most "SIZE_MAX / 2" bytes. The option produces the best results with optimization enabled but candetect a small subset of simple buffer overflows even without optimization in calls to the GCC built-in functions like"__builtin_memcpy" that correspond to the standard functions. In any case, the option warns about just a subset of bufferoverflows detected by the corresponding overflow checking built-ins. For example, the option will issue a warning for the"strcpy" call below because it copies at least 5 characters (the string "blue" including the terminating NUL) into the buffer ofsize 4.enum Color { blue, purple, yellow };const char* f (enum Color clr){static char buf [4];const char *str;switch (clr){case blue: str = "blue"; break;case purple: str = "purple"; break;case yellow: str = "yellow"; break;}return strcpy (buf, str); // warning here}Option -Wstringop-overflow=2 is enabled by default.
cc -Wstringop-overflow ...
-Wsuggest-attribute
Warn for cases where adding an attribute may be beneficial. The attributes currently supported are listed below.
cc -Wsuggest-attribute ...
-Wmissing-format-attribute
Warn about function pointers that might be candidates for "format" attributes. Note these are only possible candidates, notabsolute ones. GCC guesses that function pointers with "format" attributes that are used in assignment, initialization,parameter passing or return statements should have a corresponding "format" attribute in the resulting type. I.e. the left-hand side of the assignment or initialization, the type of the parameter variable, or the return type of the containingfunction respectively should also have a "format" attribute to avoid the warning.GCC also warns about function definitions that might be candidates for "format" attributes. Again, these are only possiblecandidates. GCC guesses that "format" attributes might be appropriate for any function that calls a function like "vprintf"or "vscanf", but this might not always be the case, and some functions for which "format" attributes are appropriate may notbe detected.
cc -Wmissing-format-attribute ...
-Wsuggest-final-methods
Warn about virtual methods where code quality would be improved if the method were declared with the C++11 "final" specifier, or,if possible, its type were declared in an anonymous namespace or with the "final" specifier. This warning is more effective withlink-time optimization, where the information about the class hierarchy graph is more complete. It is recommended to firstconsider suggestions of -Wsuggest-final-types and then rebuild with new annotations.
cc -Wsuggest-final-methods ...
-Wsuggest-override
Warn about overriding virtual functions that are not marked with the override keyword.
cc -Wsuggest-override ...
-Walloc-zero
Warn about calls to allocation functions decorated with attribute "alloc_size" that specify zero bytes, including those to thebuilt-in forms of the functions "aligned_alloc", "alloca", "calloc", "malloc", and "realloc". Because the behavior of thesefunctions when called with a zero size differs among implementations (and in the case of "realloc" has been deprecated) relyingon it may result in subtle portability bugs and should be avoided.
cc -Walloc-zero ...
-Walloca
This option warns on all uses of "alloca" in the source.
cc -Walloca ...
-Walloca-larger-than
This option warns on calls to "alloca" that are not bounded by a controlling predicate limiting its argument of integer type toat most n bytes, or calls to "alloca" where the bound is unknown. Arguments of non-integer types are considered unbounded evenif they appear to be constrained to the expected range.For example, a bounded case of "alloca" could be:void func (size_t n){void *p;if (n <= 1000)p = alloca (n);elsep = malloc (n);f (p);}In the above example, passing "-Walloca-larger-than=1000" would not issue a warning because the call to "alloca" is known to beat most 1000 bytes. However, if "-Walloca-larger-than=500" were passed, the compiler would emit a warning.Unbounded uses, on the other hand, are uses of "alloca" with no controlling predicate constraining its integer argument. Forexample:void func (){void *p = alloca (n);f (p);}If "-Walloca-larger-than=500" were passed, the above would trigger a warning, but this time because of the lack of boundschecking.Note, that even seemingly correct code involving signed integers could cause a warning:void func (signed int n){if (n < 500){p = alloca (n);f (p);}}In the above example, n could be negative, causing a larger than expected argument to be implicitly cast into the "alloca" call.This option also warns when "alloca" is used in a loop.This warning is not enabled by -Wall, and is only active when -ftree-vrp is active (default for -O2 and above).See also -Wvla-larger-than=n.
cc -Walloca-larger-than ...
-Warray-bounds
This option is only active when -ftree-vrp is active (default for -O2 and above). It warns about subscripts to arrays that arealways out of bounds. This warning is enabled by -Wall.
cc -Warray-bounds ...
-Wbool-compare
Warn about boolean expression compared with an integer value different from "true"/"false". For instance, the followingcomparison is always false:int n = 5;...if ((n > 1) == 2) { ... }This warning is enabled by -Wall.
cc -Wbool-compare ...
-Wbool-operation
Warn about suspicious operations on expressions of a boolean type. For instance, bitwise negation of a boolean is very likely abug in the program. For C, this warning also warns about incrementing or decrementing a boolean, which rarely makes sense. (InC++, decrementing a boolean is always invalid. Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)This warning is enabled by -Wall.
cc -Wbool-operation ...
-Wduplicated-branches
Warn when an if-else has identical branches. This warning detects cases likeif (p != NULL)return 0;elsereturn 0;It doesn't warn when both branches contain just a null statement. This warning also warn for conditional operators:int i = x ? *p : *p;
cc -Wduplicated-branches ...
-Wframe-address
Warn when the __builtin_frame_address or __builtin_return_address is called with an argument greater than 0. Such calls mayreturn indeterminate values or crash the program. The warning is included in -Wall.
cc -Wframe-address ...
-Wno-discarded-array-qualifiers
Do not warn if type qualifiers on arrays which are pointer targets are being discarded. Typically, the compiler warns if a "constint (*)[]" variable is passed to a function that takes a "int (*)[]" parameter. This option can be used to suppress such awarning.
cc -Wno-discarded-array-qualifiers ...
-Wno-incompatible-pointer-types
Do not warn when there is a conversion between pointers that have incompatible types. This warning is for cases not covered by
cc -Wno-incompatible-pointer-types ...
-Wno-pointer-sign
which warns for pointer argument passing or assignment with different signedness.
cc -Wno-pointer-sign ...
-Wno-div-by-zero
Do not warn about compile-time integer division by zero. Floating-point division by zero is not warned about, as it can be alegitimate way of obtaining infinities and NaNs.
cc -Wno-div-by-zero ...
-Wsystem-headers
Print warning messages for constructs found in system header files. Warnings from system headers are normally suppressed, on theassumption that they usually do not indicate real problems and would only make the compiler output harder to read. Using thiscommand-line option tells GCC to emit warnings from system headers as if they occurred in user code. However, note that using
cc -Wsystem-headers ...
-Wtautological-compare
Warn if a self-comparison always evaluates to true or false. This warning detects various mistakes such as:int i = 1;...if (i > i) { ... }This warning is enabled by -Wall.
cc -Wtautological-compare ...
-Wtraditional
Warn about certain constructs that behave differently in traditional and ISO C. Also warn about ISO C constructs that have notraditional C equivalent, and/or problematic constructs that should be avoided.* Macro parameters that appear within string literals in the macro body. In traditional C macro replacement takes place withinstring literals, but in ISO C it does not.* In traditional C, some preprocessor directives did not exist. Traditional preprocessors only considered a line to be adirective if the # appeared in column 1 on the line. Therefore -Wtraditional warns about directives that traditional Cunderstands but ignores because the # does not appear as the first character on the line. It also suggests you hidedirectives like "#pragma" not understood by traditional C by indenting them. Some traditional implementations do notrecognize "#elif", so this option suggests avoiding it altogether.* A function-like macro that appears without arguments.* The unary plus operator.* The U integer constant suffix, or the F or L floating-point constant suffixes. (Traditional C does support the L suffix oninteger constants.) Note, these suffixes appear in macros defined in the system headers of most modern systems, e.g. the_MIN/_MAX macros in "<limits.h>". Use of these macros in user code might normally lead to spurious warnings, however GCC'sintegrated preprocessor has enough context to avoid warning in these cases.* A function declared external in one block and then used after the end of the block.* A "switch" statement has an operand of type "long".* A non-"static" function declaration follows a "static" one. This construct is not accepted by some traditional C compilers.* The ISO type of an integer constant has a different width or signedness from its traditional type. This warning is onlyissued if the base of the constant is ten. I.e. hexadecimal or octal values, which typically represent bit patterns, are notwarned about.* Usage of ISO string concatenation is detected.* Initialization of automatic aggregates.* Identifier conflicts with labels. Traditional C lacks a separate namespace for labels.* Initialization of unions. If the initializer is zero, the warning is omitted. This is done under the assumption that thezero initializer in user code appears conditioned on e.g. "__STDC__" to avoid missing initializer warnings and relies ondefault initialization to zero in the traditional C case.* Conversions by prototypes between fixed/floating-point values and vice versa. The absence of these prototypes when compilingwith traditional C causes serious problems. This is a subset of the possible conversion warnings; for the full set use
cc -Wtraditional ...
-Wtraditional-conversion.
* Use of ISO C style function definitions. This warning intentionally is not issued for prototype declarations or variadicfunctions because these ISO C features appear in your code when using libiberty's traditional C compatibility macros,"PARAMS" and "VPARAMS". This warning is also bypassed for nested functions because that feature is already a GCC extensionand thus not relevant to traditional C compatibility.
cc -Wtraditional-conversion. ...
-Wtraditional-conversion
Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of aprototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signednessof a fixed-point argument except when the same as the default promotion.
cc -Wtraditional-conversion ...
-Wno-shadow-ivar
Do not warn whenever a local variable shadows an instance variable in an Objective-C method.
cc -Wno-shadow-ivar ...
-Wframe-larger-than
Warn if the size of a function frame is larger than len bytes. The computation done to determine the stack frame size isapproximate and not conservative. The actual requirements may be somewhat greater than len even if you do not get a warning. Inaddition, any space allocated via "alloca", variable-length arrays, or related constructs is not included by the compiler whendetermining whether or not to issue a warning.
cc -Wframe-larger-than ...
-Wstack-usage
Warn if the stack usage of a function might be larger than len bytes. The computation done to determine the stack usage isconservative. Any space allocated via "alloca", variable-length arrays, or related constructs is included by the compiler whendetermining whether or not to issue a warning.The message is in keeping with the output of -fstack-usage.* If the stack usage is fully static but exceeds the specified amount, it's:warning: stack usage is 1120 bytes* If the stack usage is (partly) dynamic but bounded, it's:warning: stack usage might be 1648 bytes* If the stack usage is (partly) dynamic and not bounded, it's:warning: stack usage might be unbounded
cc -Wstack-usage ...
-Wunsafe-loop-optimizations
Warn if the loop cannot be optimized because the compiler cannot assume anything on the bounds of the loop indices. With
cc -Wunsafe-loop-optimizations ...
-funsafe-loop-optimizations
warn if the compiler makes such assumptions.
cc -funsafe-loop-optimizations ...
-Waligned-new
Warn about a new-expression of a type that requires greater alignment than the "alignof(std::max_align_t)" but uses an allocationfunction without an explicit alignment parameter. This option is enabled by -Wall.Normally this only warns about global allocation functions, but -Waligned-new=all also warns about class member allocationfunctions.
cc -Waligned-new ...
-Wplacement-new
Warn about placement new expressions with undefined behavior, such as constructing an object in a buffer that is smaller than thetype of the object. For example, the placement new expression below is diagnosed because it attempts to construct an array of 64integers in a buffer only 64 bytes large.char buf [64];new (buf) int[64];This warning is enabled by default.
cc -Wplacement-new ...
-Wpointer-arith
Warn about anything that depends on the "size of" a function type or of "void". GNU C assigns these types a size of 1, forconvenience in calculations with "void *" pointers and pointers to functions. In C++, warn also when an arithmetic operationinvolves "NULL". This warning is also enabled by -Wpedantic.
cc -Wpointer-arith ...
-Wpointer-compare
Warn if a pointer is compared with a zero character constant. This usually means that the pointer was meant to be dereferenced.For example:const char *p = foo ();if (p == '\0')return 42;Note that the code above is invalid in C++11.This warning is enabled by default.
cc -Wpointer-compare ...
-Wtype-limits
Warn if a comparison is always true or always false due to the limited range of the data type, but do not warn for constantexpressions. For example, warn if an unsigned variable is compared against zero with "<" or ">=". This warning is also enabledby -Wextra.
cc -Wtype-limits ...
-Wcomments
Warn whenever a comment-start sequence /* appears in a /* comment, or whenever a backslash-newline appears in a // comment. Thiswarning is enabled by -Wall.
cc -Wcomments ...
-Wtrigraphs
Warn if any trigraphs are encountered that might change the meaning of the program. Trigraphs within comments are not warnedabout, except those that would form escaped newlines.This option is implied by -Wall. If -Wall is not given, this option is still enabled unless trigraphs are enabled. To gettrigraph conversion without warnings, but get the other -Wall warnings, use -trigraphs -Wall -Wno-trigraphs.
cc -Wtrigraphs ...
-Wundef
Warn if an undefined identifier is evaluated in an "#if" directive. Such identifiers are replaced with zero.
cc -Wundef ...
-Wexpansion-to-defined
Warn whenever defined is encountered in the expansion of a macro (including the case where the macro is expanded by an #ifdirective). Such usage is not portable. This warning is also enabled by -Wpedantic and -Wextra.
cc -Wexpansion-to-defined ...
-Wunused-macros
Warn about macros defined in the main file that are unused. A macro is used if it is expanded or tested for existence at leastonce. The preprocessor also warns if the macro has not been used at the time it is redefined or undefined.Built-in macros, macros defined on the command line, and macros defined in include files are not warned about.Note: If a macro is actually used, but only used in skipped conditional blocks, then the preprocessor reports it as unused. Toavoid the warning in such a case, you might improve the scope of the macro's definition by, for example, moving it into the firstskipped block. Alternatively, you could provide a dummy use with something like:#if defined the_macro_causing_the_warning#endif
cc -Wunused-macros ...
-Wno-endif-labels
Do not warn whenever an "#else" or an "#endif" are followed by text. This sometimes happens in older programs with code of theform#if FOO...#else FOO...#endif FOOThe second and third "FOO" should be in comments. This warning is on by default.
cc -Wno-endif-labels ...
-Wc99-c11-compat
Warn about features not present in ISO C99, but present in ISO C11. For instance, warn about use of anonymous structures andunions, "_Atomic" type qualifier, "_Thread_local" storage-class specifier, "_Alignas" specifier, "Alignof" operator, "_Generic"keyword, and so on. This option is independent of the standards mode. Warnings are disabled in the expression that follows"__extension__".
cc -Wc99-c11-compat ...
-Wc++-compat
Warn about ISO C constructs that are outside of the common subset of ISO C and ISO C++, e.g. request for implicit conversion from"void *" to a pointer to non-"void" type.
cc -Wc++-compat ...
-Wc++11-compat
Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that arekeywords in ISO C++ 2011. This warning turns on -Wnarrowing and is enabled by -Wall.
cc -Wc++11-compat ...
-Wc++14-compat
Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014. This warning is enabled by -Wall.
cc -Wc++14-compat ...
-Wc++1z-compat
Warn about C++ constructs whose meaning differs between ISO C++ 2014 and the forthoming ISO C++ 2017(?). This warning is enabledby -Wall.
cc -Wc++1z-compat ...
-Wcast-qual
Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a "const char *" iscast to an ordinary "char *".Also warn when making a cast that introduces a type qualifier in an unsafe way. For example, casting "char **" to "const char**" is unsafe, as in this example:/* p is char ** value. */const char **q = (const char **) p;/* Assignment of readonly string to const char * is OK. */*q = "string";/* Now char** pointer points to read-only memory. */**p = 'b';
cc -Wcast-qual ...
-Wcast-align
Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a "char *" iscast to an "int *" on machines where integers can only be accessed at two- or four-byte boundaries.
cc -Wcast-align ...
-Wwrite-strings
When compiling C, give string constants the type "const char[length]" so that copying the address of one into a non-"const" "char*" pointer produces a warning. These warnings help you find at compile time code that can try to write into a string constant,but only if you have been very careful about using "const" in declarations and prototypes. Otherwise, it is just a nuisance.This is why we did not make -Wall request these warnings.When compiling C++, warn about the deprecated conversion from string literals to "char *". This warning is enabled by defaultfor C++ programs.
cc -Wwrite-strings ...
-Wconditionally-supported
Warn for conditionally-supported (C++11 [intro.defs]) constructs.
cc -Wconditionally-supported ...
-Wconversion
Warn for implicit conversions that may alter a value. This includes conversions between real and integer, like "abs (x)" when "x"is "double"; conversions between signed and unsigned, like "unsigned ui = -1"; and conversions to smaller types, like "sqrtf(M_PI)". Do not warn for explicit casts like "abs ((int) x)" and "ui = (unsigned) -1", or if the value is not changed by theconversion like in "abs (2.0)". Warnings about conversions between signed and unsigned integers can be disabled by using
cc -Wconversion ...
-Wno-sign-conversion.
For C++, also warn for confusing overload resolution for user-defined conversions; and conversions that never use a typeconversion operator: conversions to "void", the same type, a base class or a reference to them. Warnings about conversionsbetween signed and unsigned integers are disabled by default in C++ unless -Wsign-conversion is explicitly enabled.
cc -Wno-sign-conversion. ...
-Wno-conversion-null
Do not warn for conversions between "NULL" and non-pointer types. -Wconversion-null is enabled by default.
cc -Wno-conversion-null ...
-Wzero-as-null-pointer-constant
Warn when a literal 0 is used as null pointer constant. This can be useful to facilitate the conversion to "nullptr" in C++11.
cc -Wzero-as-null-pointer-constant ...
-Wsubobject-linkage
Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage. If atype A depends on a type B with no or internal linkage, defining it in multiple translation units would be an ODR violationbecause the meaning of B is different in each translation unit. If A only appears in a single translation unit, the best way tosilence the warning is to give it internal linkage by putting it in an anonymous namespace as well. The compiler doesn't givethis warning for types defined in the main .C file, as those are unlikely to have multiple definitions. -Wsubobject-linkage isenabled by default.
cc -Wsubobject-linkage ...
-Wdangling-else
Warn about constructions where there may be confusion to which "if" statement an "else" branch belongs. Here is an example ofsuch a case:{if (a)if (b)foo ();elsebar ();}In C/C++, every "else" branch belongs to the innermost possible "if" statement, which in this example is "if (b)". This is oftennot what the programmer expected, as illustrated in the above example by indentation the programmer chose. When there is thepotential for this confusion, GCC issues a warning when this flag is specified. To eliminate the warning, add explicit bracesaround the innermost "if" statement so there is no way the "else" can belong to the enclosing "if". The resulting code lookslike this:{if (a){if (b)foo ();elsebar ();}}This warning is enabled by -Wparentheses.
cc -Wdangling-else ...
-Wdelete-incomplete
Warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime. This warning is enabled bydefault.
cc -Wdelete-incomplete ...
-Wuseless-cast
Warn when an expression is casted to its own type.
cc -Wuseless-cast ...
-Wempty-body
Warn if an empty body occurs in an "if", "else" or "do while" statement. This warning is also enabled by -Wextra.
cc -Wempty-body ...
-Wenum-compare
Warn about a comparison between values of different enumerated types. In C++ enumerated type mismatches in conditionalexpressions are also diagnosed and the warning is enabled by default. In C this warning is enabled by -Wall.
cc -Wenum-compare ...
-Wjump-misses-init
Warn if a "goto" statement or a "switch" statement jumps forward across the initialization of a variable, or jumps backward to alabel after the variable has been initialized. This only warns about variables that are initialized when they are declared.This warning is only supported for C and Objective-C; in C++ this sort of branch is an error in any case.
cc -Wjump-misses-init ...
-Wsign-compare
Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted tounsigned. In C++, this warning is also enabled by -Wall. In C, it is also enabled by -Wextra.
cc -Wsign-compare ...
-Wsign-conversion
Warn for implicit conversions that may change the sign of an integer value, like assigning a signed integer expression to anunsigned integer variable. An explicit cast silences the warning. In C, this option is enabled also by -Wconversion.
cc -Wsign-conversion ...
-Wfloat-conversion
Warn for implicit conversions that reduce the precision of a real value. This includes conversions from real to integer, andfrom higher precision real to lower precision real values. This option is also enabled by -Wconversion.
cc -Wfloat-conversion ...
-Wno-scalar-storage-order
Do not warn on suspicious constructs involving reverse scalar storage order.
cc -Wno-scalar-storage-order ...
-Wsized-deallocation
Warn about a definition of an unsized deallocation functionvoid operator delete (void *) noexcept;void operator delete[] (void *) noexcept;without a definition of the corresponding sized deallocation functionvoid operator delete (void *, std::size_t) noexcept;void operator delete[] (void *, std::size_t) noexcept;or vice versa. Enabled by -Wextra along with -fsized-deallocation.
cc -Wsized-deallocation ...
-Wsizeof-array-argument
Warn when the "sizeof" operator is applied to a parameter that is declared as an array in a function definition. This warning isenabled by default for C and C++ programs.
cc -Wsizeof-array-argument ...
-Wmemset-elt-size
Warn for suspicious calls to the "memset" built-in function, if the first argument references an array, and the third argument isa number equal to the number of elements, but not equal to the size of the array in memory. This indicates that the user hasomitted a multiplication by the element size. This warning is enabled by -Wall.
cc -Wmemset-elt-size ...
-Wlogical-op
Warn about suspicious uses of logical operators in expressions. This includes using logical operators in contexts where a bit-wise operator is likely to be expected. Also warns when the operands of a logical operator are the same:extern int a;if (a < 0 && a < 0) { ... }
cc -Wlogical-op ...
-Wlogical-not-parentheses
Warn about logical not used on the left hand side operand of a comparison. This option does not warn if the right operand isconsidered to be a boolean expression. Its purpose is to detect suspicious code like the following:int a;...if (!a > 1) { ... }It is possible to suppress the warning by wrapping the LHS into parentheses:if ((!a) > 1) { ... }This warning is enabled by -Wall.
cc -Wlogical-not-parentheses ...
-Waggregate-return
Warn if any functions that return structures or unions are defined or called. (In languages where you can return an array, thisalso elicits a warning.)
cc -Waggregate-return ...
-Wno-aggressive-loop-optimizations
Warn if in a loop with constant number of iterations the compiler detects undefined behavior in some statement during one or moreof the iterations.
cc -Wno-aggressive-loop-optimizations ...
-Wno-builtin-declaration-mismatch
Warn if a built-in function is declared with the wrong signature. This warning is enabled by default.
cc -Wno-builtin-declaration-mismatch ...
-Wno-builtin-macro-redefined
Do not warn if certain built-in macros are redefined. This suppresses warnings for redefinition of "__TIMESTAMP__", "__TIME__","__DATE__", "__FILE__", and "__BASE_FILE__".
cc -Wno-builtin-macro-redefined ...
-Wstrict-prototypes
Warn if a function is declared or defined without specifying the argument types. (An old-style function definition is permittedwithout a warning if preceded by a declaration that specifies the argument types.)
cc -Wstrict-prototypes ...
-Wold-style-definition
Warn if an old-style function definition is used. A warning is given even if there is a previous prototype.
cc -Wold-style-definition ...
-Wmissing-parameter-type
A function parameter is declared without a type specifier in K&R-style functions:void foo(bar) { }This warning is also enabled by -Wextra.
cc -Wmissing-parameter-type ...
-Wmissing-prototypes
Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definitionitself provides a prototype. Use this option to detect global functions that do not have a matching prototype declaration in aheader file. This option is not valid for C++ because all function declarations provide prototypes and a non-matchingdeclaration declares an overload rather than conflict with an earlier declaration. Use -Wmissing-declarations to detect missingdeclarations in C++.
cc -Wmissing-prototypes ...
-Wmissing-declarations
Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype.Use this option to detect global functions that are not declared in header files. In C, no warnings are issued for functionswith previous non-prototype declarations; use -Wmissing-prototypes to detect missing prototypes. In C++, no warnings are issuedfor function templates, or for inline functions, or for functions in anonymous namespaces.
cc -Wmissing-declarations ...
-Wmissing-field-initializers
Warn if a structure's initializer has some fields missing. For example, the following code causes such a warning, because "x.h"is implicitly zero:struct s { int f, g, h; };struct s x = { 3, 4 };This option does not warn about designated initializers, so the following modification does not trigger a warning:struct s { int f, g, h; };struct s x = { .f = 3, .g = 4 };In C++ this option does not warn either about the empty { } initializer, for example:struct s { int f, g, h; };s x = { };This warning is included in -Wextra. To get other -Wextra warnings without this one, use -Wextra
cc -Wmissing-field-initializers ...
-Wnormalized
In ISO C and ISO C++, two identifiers are different if they are different sequences of characters. However, sometimes whencharacters outside the basic ASCII character set are used, you can have two different character sequences that look the same. Toavoid confusion, the ISO 10646 standard sets out some normalization rules which when applied ensure that two sequences that lookthe same are turned into the same sequence. GCC can warn you if you are using identifiers that have not been normalized; thisoption controls that warning.There are four levels of warning supported by GCC. The default is -Wnormalized=nfc, which warns about any identifier that is notin the ISO 10646 "C" normalized form, NFC. NFC is the recommended form for most uses. It is equivalent to -Wnormalized.Unfortunately, there are some characters allowed in identifiers by ISO C and ISO C++ that, when turned into NFC, are not allowedin identifiers. That is, there's no way to use these symbols in portable ISO C or C++ and have all your identifiers in NFC.
cc -Wnormalized ...
-Wno-deprecated
Do not warn about usage of deprecated features.
cc -Wno-deprecated ...
-Wno-deprecated-declarations
Do not warn about uses of functions, variables, and types marked as deprecated by using the "deprecated" attribute.
cc -Wno-deprecated-declarations ...
-Wno-overflow
Do not warn about compile-time overflow in constant expressions.
cc -Wno-overflow ...
-Wno-odr
Warn about One Definition Rule violations during link-time optimization. Requires -flto-odr-type-merging to be enabled. Enabledby default.
cc -Wno-odr ...
-fsimd-cost-model
option can be used to relax the cost model.
cc -fsimd-cost-model ...
-Woverride-init
Warn if an initialized field without side effects is overridden when using designated initializers.This warning is included in -Wextra. To get other -Wextra warnings without this one, use -Wextra -Wno-override-init.
cc -Woverride-init ...
-Woverride-init-side-effects
Warn if an initialized field with side effects is overridden when using designated initializers. This warning is enabled bydefault.
cc -Woverride-init-side-effects ...
-Wpacked
Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or size of the structure.Such structures may be mis-aligned for little benefit. For instance, in this code, the variable "f.x" in "struct bar" ismisaligned even though "struct bar" does not itself have the packed attribute:struct foo {int x;char a, b, c, d;} __attribute__((packed));struct bar {char z;struct foo f;};
cc -Wpacked ...
-Wpacked-bitfield-compat
The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on bit-fields of type "char". This has been fixed in GCC 4.4but the change can lead to differences in the structure layout. GCC informs you when the offset of such a field has changed inGCC 4.4. For example there is no longer a 4-bit padding between field "a" and "b" in this structure:struct foo{char a:4;char b:8;} __attribute__ ((packed));This warning is enabled by default. Use -Wno-packed-bitfield-compat to disable this warning.
cc -Wpacked-bitfield-compat ...
-Wpadded
Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure.Sometimes when this happens it is possible to rearrange the fields of the structure to reduce the padding and so make thestructure smaller.
cc -Wpadded ...
-Wredundant-decls
Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changesnothing.
cc -Wredundant-decls ...
-Wrestrict
Warn when an argument passed to a restrict-qualified parameter aliases with another argument.
cc -Wrestrict ...
-Wnested-externs
Warn if an "extern" declaration is encountered within a function.
cc -Wnested-externs ...
-Wno-inherited-variadic-ctor
Suppress warnings about use of C++11 inheriting constructors when the base class inherited from has a C variadic constructor; thewarning is on by default because the ellipsis is not inherited.
cc -Wno-inherited-variadic-ctor ...
-Winline
Warn if a function that is declared as inline cannot be inlined. Even with this option, the compiler does not warn aboutfailures to inline functions declared in system headers.The compiler uses a variety of heuristics to determine whether or not to inline a function. For example, the compiler takes intoaccount the size of the function being inlined and the amount of inlining that has already been done in the current function.Therefore, seemingly insignificant changes in the source program can cause the warnings produced by -Winline to appear ordisappear.
cc -Winline ...
-Wno-invalid-offsetof
Suppress warnings from applying the "offsetof" macro to a non-POD type. According to the 2014 ISO C++ standard, applying"offsetof" to a non-standard-layout type is undefined. In existing C++ implementations, however, "offsetof" typically givesmeaningful results. This flag is for users who are aware that they are writing nonportable code and who have deliberately chosento ignore the warning about it.The restrictions on "offsetof" may be relaxed in a future version of the C++ standard.
cc -Wno-invalid-offsetof ...
-Wno-int-to-pointer-cast
Suppress warnings from casts to pointer type of an integer of a different size. In C++, casting to a pointer type of smaller sizeis an error. Wint-to-pointer-cast is enabled by default.
cc -Wno-int-to-pointer-cast ...
-Wno-pointer-to-int-cast
Suppress warnings from casts from a pointer to an integer type of a different size.
cc -Wno-pointer-to-int-cast ...
-Winvalid-pch
Warn if a precompiled header is found in the search path but cannot be used.
cc -Winvalid-pch ...
-Wlong-long
Warn if "long long" type is used. This is enabled by either -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibitthe warning messages, use -Wno-long-long.
cc -Wlong-long ...
-Wvariadic-macros
Warn if variadic macros are used in ISO C90 mode, or if the GNU alternate syntax is used in ISO C99 mode. This is enabled byeither -Wpedantic or -Wtraditional. To inhibit the warning messages, use -Wno-variadic-macros.
cc -Wvariadic-macros ...
-Wvarargs
Warn upon questionable usage of the macros used to handle variable arguments like "va_start". This is default. To inhibit thewarning messages, use -Wno-varargs.
cc -Wvarargs ...
-Wvector-operation-performance
Warn if vector operation is not implemented via SIMD capabilities of the architecture. Mainly useful for the performance tuning.Vector operation can be implemented "piecewise", which means that the scalar operation is performed on every vector element; "inparallel", which means that the vector operation is implemented using scalars of wider type, which normally is more performanceefficient; and "as a single scalar", which means that vector fits into a scalar type.
cc -Wvector-operation-performance ...
-Wno-virtual-move-assign
Suppress warnings about inheriting from a virtual base with a non-trivial C++11 move assignment operator. This is dangerousbecause if the virtual base is reachable along more than one path, it is moved multiple times, which can mean both objects end upin the moved-from state. If the move assignment operator is written to avoid moving from a moved-from object, this warning canbe disabled.
cc -Wno-virtual-move-assign ...
-Wvla
Warn if a variable-length array is used in the code. -Wno-vla prevents the -Wpedantic warning of the variable-length array.
cc -Wvla ...
-Wvla-larger-than
If this option is used, the compiler will warn on uses of variable-length arrays where the size is either unbounded, or boundedby an argument that can be larger than n bytes. This is similar to how -Walloca-larger-than=n works, but with variable-lengtharrays.Note that GCC may optimize small variable-length arrays of a known value into plain arrays, so this warning may not get triggeredfor such arrays.This warning is not enabled by -Wall, and is only active when -ftree-vrp is active (default for -O2 and above).See also -Walloca-larger-than=n.
cc -Wvla-larger-than ...
-Wvolatile-register-var
Warn if a register variable is declared volatile. The volatile modifier does not inhibit all optimizations that may eliminatereads and/or writes to register variables. This warning is enabled by -Wall.
cc -Wvolatile-register-var ...
-Wdisabled-optimization
Warn if a requested optimization pass is disabled. This warning does not generally indicate that there is anything wrong withyour code; it merely indicates that GCC's optimizers are unable to handle the code effectively. Often, the problem is that yourcode is too big or too complex; GCC refuses to optimize programs when the optimization itself is likely to take inordinateamounts of time.
cc -Wdisabled-optimization ...
-Wpointer-sign
Warn for pointer argument passing or assignment with different signedness. This option is only supported for C and Objective-C.It is implied by -Wall and by -Wpedantic, which can be disabled with -Wno-pointer-sign.
cc -Wpointer-sign ...
-Wstack-protector
This option is only active when -fstack-protector is active. It warns about functions that are not protected against stacksmashing.
cc -Wstack-protector ...
-Woverlength-strings
Warn about string constants that are longer than the "minimum maximum" length specified in the C standard. Modern compilersgenerally allow string constants that are much longer than the standard's minimum limit, but very portable programs should avoidusing longer strings.The limit applies after string constant concatenation, and does not count the trailing NUL. In C90, the limit was 509characters; in C99, it was raised to 4095. C++98 does not specify a normative minimum maximum, so we do not diagnose overlengthstrings in C++.This option is implied by -Wpedantic, and can be disabled with -Wno-overlength-strings.
cc -Woverlength-strings ...
-Wno-designated-init
Suppress warnings when a positional initializer is used to initialize a structure that has been marked with the "designated_init"attribute.
cc -Wno-designated-init ...
-Whsa
Issue a warning when HSAIL cannot be emitted for the compiled function or OpenMP construct.Options for Debugging Your ProgramTo tell GCC to emit extra information for use by a debugger, in almost all cases you need only to add -g to your other options.GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally be surprising: some variables you declaredmay not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because theycompute constant results or their values are already at hand; some statements may execute in different places because they have beenmoved out of loops. Nevertheless it is possible to debug optimized output. This makes it reasonable to use the optimizer forprograms that might have bugs.If you are not using some other optimization option, consider using -Og with -g. With no -O option at all, some compiler passes thatcollect information useful for debugging do not run at all, so that -Og may result in a better debugging experience.
cc -Whsa ...
-ggdb
Produce debugging information for use by GDB. This means to use the most expressive format available (DWARF, stabs, or thenative format if neither of those are supported), including GDB extensions if at all possible.
cc -ggdb ...
-gdwarf-version
Produce debugging information in DWARF format (if that is supported). The value of version may be either 2, 3, 4 or 5; thedefault version for most targets is 4. DWARF Version 5 is only experimental.Note that with DWARF Version 2, some ports require and always use some non-conflicting DWARF 3 extensions in the unwind tables.Version 4 may require GDB 7.0 and -fvar-tracking-assignments for maximum benefit.GCC no longer supports DWARF Version 1, which is substantially different than Version 2 and later. For historical reasons, someother DWARF-related options (including -feliminate-dwarf2-dups and -fno-dwarf2-cfi-asm) retain a reference to DWARF Version 2 intheir names, but apply to all currently-supported versions of DWARF.
cc -gdwarf-version ...
-gstabs
Produce debugging information in stabs format (if that is supported), without GDB extensions. This is the format used by DBX onmost BSD systems. On MIPS, Alpha and System V Release 4 systems this option produces stabs debugging output that is notunderstood by DBX or SDB. On System V Release 4 systems this option requires the GNU assembler.
cc -gstabs ...
-gstabs+
Produce debugging information in stabs format (if that is supported), using GNU extensions understood only by the GNU debugger(GDB). The use of these extensions is likely to make other debuggers crash or refuse to read the program.
cc -gstabs+ ...
-gcoff
Produce debugging information in COFF format (if that is supported). This is the format used by SDB on most System V systemsprior to System V Release 4.
cc -gcoff ...
-gxcoff
Produce debugging information in XCOFF format (if that is supported). This is the format used by the DBX debugger on IBM RS/6000systems.
cc -gxcoff ...
-gxcoff+
Produce debugging information in XCOFF format (if that is supported), using GNU extensions understood only by the GNU debugger(GDB). The use of these extensions is likely to make other debuggers crash or refuse to read the program, and may causeassemblers other than the GNU assembler (GAS) to fail with an error.
cc -gxcoff+ ...
-gvms
Produce debugging information in Alpha/VMS debug format (if that is supported). This is the format used by DEBUG on Alpha/VMSsystems.
cc -gvms ...
-gvmslevel
Request debugging information and also use level to specify how much information. The default level is 2.Level 0 produces no debug information at all. Thus, -g0 negates -g.Level 1 produces minimal information, enough for making backtraces in parts of the program that you don't plan to debug. Thisincludes descriptions of functions and external variables, and line number tables, but no information about local variables.Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macroexpansion when you use -g3.
cc -gvmslevel ...
-feliminate-unused-debug-symbols
Produce debugging information in stabs format (if that is supported), for only symbols that are actually used.
cc -feliminate-unused-debug-symbols ...
-femit-class-debug-always
Instead of emitting debugging information for a C++ class in only one object file, emit it in all object files using the class.This option should be used only with debuggers that are unable to handle the way GCC normally emits debugging information forclasses because using this option increases the size of debugging information by as much as a factor of two.
cc -femit-class-debug-always ...
-fdebug-prefix-map
When compiling files in directory old, record debugging information describing them as in new instead.
cc -fdebug-prefix-map ...
-fvar-tracking
Run variable tracking pass. It computes where variables are stored at each position in code. Better debugging information isthen generated (if the debugging information format supports this information).It is enabled by default when compiling with optimization (-Os, -O, -O2, ...), debugging information (-g) and the debug infoformat supports it.
cc -fvar-tracking ...
-fvar-tracking-assignments
Annotate assignments to user variables early in the compilation and attempt to carry the annotations over throughout thecompilation all the way to the end, in an attempt to improve debug information while optimizing. Use of -gdwarf-4 is recommendedalong with it.It can be enabled even if var-tracking is disabled, in which case annotations are created and maintained, but discarded at theend. By default, this flag is enabled together with -fvar-tracking, except when selective scheduling is enabled.
cc -fvar-tracking-assignments ...
-gsplit-dwarf
Separate as much DWARF debugging information as possible into a separate output file with the extension .dwo. This option allowsthe build system to avoid linking files with debug information. To be useful, this option requires a debugger capable of reading.dwo files.
cc -gsplit-dwarf ...
-gpubnames
Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
cc -gpubnames ...
-ggnu-pubnames
Generate ".debug_pubnames" and ".debug_pubtypes" sections in a format suitable for conversion into a GDB index. This option isonly useful with a linker that can produce GDB index version 7.
cc -ggnu-pubnames ...
-gno-record-gcc-switches
This switch causes the command-line options used to invoke the compiler that may affect code generation to be appended to theDW_AT_producer attribute in DWARF debugging information. The options are concatenated with spaces separating them from eachother and from the compiler version. It is enabled by default. See also -frecord-gcc-switches for another way of storingcompiler options into the object file.
cc -gno-record-gcc-switches ...
-gno-strict-dwarf
Allow using extensions of later DWARF standard version than selected with -gdwarf-version.
cc -gno-strict-dwarf ...
-gno-column-info
Emit location column information into DWARF debugging information, rather than just file and line. This option is disabled bydefault.
cc -gno-column-info ...
-gz[
Produce compressed debug sections in DWARF format, if that is supported. If type is not given, the default type depends on thecapabilities of the assembler and linker used. type may be one of none (don't compress debug sections), zlib (use zlibcompression in ELF gABI format), or zlib-gnu (use zlib compression in traditional GNU format). If the linker doesn't supportwriting compressed debug sections, the option is rejected. Otherwise, if the assembler does not support them, -gz is silentlyignored when producing object files.
cc -gz[ ...
-feliminate-dwarf2-dups
Compress DWARF debugging information by eliminating duplicated information about each symbol. This option only makes sense whengenerating DWARF debugging information.
cc -feliminate-dwarf2-dups ...
-femit-struct-debug-baseonly
Emit debug information for struct-like types only when the base name of the compilation source file matches the base name of filein which the struct is defined.This option substantially reduces the size of debugging information, but at significant potential loss in type information to thedebugger. See -femit-struct-debug-reduced for a less aggressive option. See -femit-struct-debug-detailed for more detailedcontrol.This option works only with DWARF debug output.
cc -femit-struct-debug-baseonly ...
-femit-struct-debug-detailed[
Specify the struct-like types for which the compiler generates debug information. The intent is to reduce duplicate struct debuginformation between different object files within the same program.This option is a detailed version of -femit-struct-debug-reduced and -femit-struct-debug-baseonly, which serves for most needs.A specification has the syntax[dir:|ind:][ord:|gen:](any|sys|base|none)The optional first word limits the specification to structs that are used directly (dir:) or used indirectly (ind:). A structtype is used directly when it is the type of a variable, member. Indirect uses arise through pointers to structs. That is, whenuse of an incomplete struct is valid, the use is indirect. An example is struct one direct; struct two * indirect;.The optional second word limits the specification to ordinary structs (ord:) or generic structs (gen:). Generic structs are abit complicated to explain. For C++, these are non-explicit specializations of template classes, or non-template classes withinthe above. Other programming languages have generics, but -femit-struct-debug-detailed does not yet implement them.The third word specifies the source files for those structs for which the compiler should emit debug information. The valuesnone and any have the normal meaning. The value base means that the base of name of the file in which the type declarationappears must match the base of the name of the main compilation file. In practice, this means that when compiling foo.c, debuginformation is generated for types declared in that file and foo.h, but not other header files. The value sys means those typessatisfying base or declared in system or compiler headers.You may need to experiment to determine the best settings for your application.The default is -femit-struct-debug-detailed=all.This option works only with DWARF debug output.
cc -femit-struct-debug-detailed[ ...
-fno-dwarf2-cfi-asm
Emit DWARF unwind info as compiler generated ".eh_frame" section instead of using GAS ".cfi_*" directives.
cc -fno-dwarf2-cfi-asm ...
-fno-eliminate-unused-debug-types
Normally, when producing DWARF output, GCC avoids producing debug symbol output for types that are nowhere used in the sourcefile being compiled. Sometimes it is useful to have GCC emit debugging information for all types declared in a compilation unit,regardless of whether or not they are actually used in that compilation unit, for example if, in the debugger, you want to cast avalue to a type that is not actually used in your program (but is declared). More often, however, this results in a significantamount of wasted space.Options That Control OptimizationThese options control various sorts of optimizations.Without any optimization option, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expectedresults. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new valueto any variable or change the program counter to any other statement in the function and get exactly the results you expect from thesource code.Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilationtime and possibly the ability to debug the program.The compiler performs optimization based on the knowledge it has of the program. Compiling multiple files at once to a single outputfile mode allows the compiler to use information gained from all of the files when compiling each of them.Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed in this section.Most optimizations are only enabled if an -O level is set on the command line. Otherwise they are disabled, even if individualoptimization flags are specified.Depending on the target and how GCC was configured, a slightly different set of optimizations may be enabled at each -O level thanthose listed here. You can invoke GCC with -Q --help=optimizers to find out the exact set of optimizations that are enabled at eachlevel.
cc -fno-eliminate-unused-debug-types ...
-O
turns on the following optimization flags:
cc -O ...
-fauto-inc-dec
-fbranch-count-reg -fcombine-stack-adjustments -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
cc -fauto-inc-dec ...
-fipa-pure-const
-fipa-profile -fipa-reference -fmerge-constants -fmove-loop-invariants -freorder-blocks -fshrink-wrap
cc -fipa-pure-const ...
-ftree-copy-prop
-ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-phiprop -ftree-sink -ftree-slsr
cc -ftree-copy-prop ...
-ftree-sra
-ftree-pta -ftree-ter -funit-at-a-time
cc -ftree-sra ...
-O2
Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to
cc -O2 ...
-falign-functions
-falign-jumps -falign-loops -falign-labels -fcaller-saves -fcrossjumping -fcse-follow-jumps
cc -falign-functions ...
-fcse-skip-blocks
-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fexpensive-optimizations -fgcse
cc -fcse-skip-blocks ...
-freorder-blocks-algorithm
-freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -fsched-interblock
cc -freorder-blocks-algorithm ...
-fsched-spec
-fschedule-insns -fschedule-insns2 -fstore-merging -fstrict-aliasing -fstrict-overflow -ftree-builtin-call-dce
cc -fsched-spec ...
-ftree-switch-conversion
Please note the warning under -fgcse about invoking -O2 on programs that use computed gotos.NOTE: In Ubuntu 8.10 and later versions, -D_FORTIFY_SOURCE=2 is set by default, and is activated when -O is set to 2 or higher.This enables additional compile-time and run-time checks for several libc functions. To disable, specify either
cc -ftree-switch-conversion ...
-U_FORTIFY_SOURCE
or -D_FORTIFY_SOURCE=0.
cc -U_FORTIFY_SOURCE ...
-O3
Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -funswitch-loops,
cc -O3 ...
-fpredictive-commoning
-fgcse-after-reload -ftree-loop-vectorize -ftree-loop-distribute-patterns -fsplit-paths
cc -fpredictive-commoning ...
-ftree-slp-vectorize
-fvect-cost-model -ftree-partial-pre -fpeel-loops and -fipa-cp-clone options.
cc -ftree-slp-vectorize ...
-O0
Reduce compilation time and make debugging produce the expected results. This is the default.
cc -O0 ...
-Os
disables the following optimization flags: -falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks
cc -Os ...
-Ofast
Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not validfor all standard-compliant programs. It turns on -ffast-math and the Fortran-specific -fno-protect-parens and -fstack-arrays.
cc -Ofast ...
-fno-defer-pop
Always pop the arguments to each function call as soon as that function returns. For machines that must pop arguments after afunction call, the compiler normally lets arguments accumulate on the stack for several function calls and pops them all at once.Disabled at levels -O, -O2, -O3, -Os.
cc -fno-defer-pop ...
-fforward-propagate
Perform a forward propagation pass on RTL. The pass tries to combine two instructions and checks if the result can besimplified. If loop unrolling is active, two passes are performed and the second is scheduled after loop unrolling.This option is enabled by default at optimization levels -O, -O2, -O3, -Os.
cc -fforward-propagate ...
-foptimize-sibling-calls
Optimize sibling and tail recursive calls.Enabled at levels -O2, -O3, -Os.
cc -foptimize-sibling-calls ...
-foptimize-strlen
Optimize various standard C string functions (e.g. "strlen", "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts intofaster alternatives.Enabled at levels -O2, -O3.
cc -foptimize-strlen ...
-fno-inline
Do not expand any functions inline apart from those marked with the "always_inline" attribute. This is the default when notoptimizing.Single functions can be exempted from inlining by marking them with the "noinline" attribute.
cc -fno-inline ...
-finline-small-functions
Integrate functions into their callers when their body is smaller than expected function call code (so overall size of programgets smaller). The compiler heuristically decides which functions are simple enough to be worth integrating in this way. Thisinlining applies to all functions, even those not declared inline.Enabled at level -O2.
cc -finline-small-functions ...
-findirect-inlining
Inline also indirect calls that are discovered to be known at compile time thanks to previous inlining. This option has anyeffect only when inlining itself is turned on by the -finline-functions or -finline-small-functions options.Enabled at level -O2.
cc -findirect-inlining ...
-finline-functions-called-once
Consider all "static" functions called once for inlining into their caller even if they are not marked "inline". If a call to agiven function is integrated, then the function is not output as assembler code in its own right.Enabled at levels -O1, -O2, -O3 and -Os.
cc -finline-functions-called-once ...
-fearly-inlining
Inline functions marked by "always_inline" and functions whose body seems smaller than the function call overhead early beforedoing -fprofile-generate instrumentation and real inlining pass. Doing so makes profiling significantly cheaper and usuallyinlining faster on programs having large chains of nested wrapper functions.Enabled by default.
cc -fearly-inlining ...
-fipa-sra
Perform interprocedural scalar replacement of aggregates, removal of unused parameters and replacement of parameters passed byreference by parameters passed by value.Enabled at levels -O2, -O3 and -Os.
cc -fipa-sra ...
-finline-limit
By default, GCC limits the size of functions that can be inlined. This flag allows coarse control of this limit. n is the sizeof functions that can be inlined in number of pseudo instructions.Inlining is actually controlled by a number of parameters, which may be specified individually by using --param name=value. The
cc -finline-limit ...
-finline-limit=n
max-inline-insns-singleis set to n/2.max-inline-insns-autois set to n/2.See below for a documentation of the individual parameters controlling inlining and for the defaults of these parameters.Note: there may be no value to -finline-limit that results in default behavior.Note: pseudo instruction represents, in this particular context, an abstract measurement of function's size. In no way does itrepresent a count of assembly instructions and as such its exact meaning might change from one release to an another.
cc -finline-limit=n ...
-fno-keep-inline-dllexport
This is a more fine-grained version of -fkeep-inline-functions, which applies only to functions that are declared using the"dllexport" attribute or declspec.
cc -fno-keep-inline-dllexport ...
-fkeep-inline-functions
In C, emit "static" functions that are declared "inline" into the object file, even if the function has been inlined into all ofits callers. This switch does not affect functions using the "extern inline" extension in GNU C90. In C++, emit any and allinline functions into the object file.
cc -fkeep-inline-functions ...
-fkeep-static-consts
Emit variables declared "static const" when optimization isn't turned on, even if the variables aren't referenced.GCC enables this option by default. If you want to force the compiler to check if a variable is referenced, regardless ofwhether or not optimization is turned on, use the -fno-keep-static-consts option.
cc -fkeep-static-consts ...
-fmerge-constants
Attempt to merge identical constants (string constants and floating-point constants) across compilation units.This option is the default for optimized compilation if the assembler and linker support it. Use -fno-merge-constants to inhibitthis behavior.Enabled at levels -O, -O2, -O3, -Os.
cc -fmerge-constants ...
-fmerge-all-constants
Attempt to merge identical constants and identical variables.This option implies -fmerge-constants. In addition to -fmerge-constants this considers e.g. even constant initialized arrays orinitialized constant variables with integral or floating-point types. Languages like C or C++ require each variable, includingmultiple instances of the same variable in recursive calls, to have distinct locations, so using this option results in non-conforming behavior.
cc -fmerge-all-constants ...
-fmodulo-sched
Perform swing modulo scheduling immediately before the first scheduling pass. This pass looks at innermost loops and reorderstheir instructions by overlapping different iterations.
cc -fmodulo-sched ...
-fmodulo-sched-allow-regmoves
Perform more aggressive SMS-based modulo scheduling with register moves allowed. By setting this flag certain anti-dependencesedges are deleted, which triggers the generation of reg-moves based on the life-range analysis. This option is effective onlywith -fmodulo-sched enabled.
cc -fmodulo-sched-allow-regmoves ...
-fno-branch-count-reg
Avoid running a pass scanning for opportunities to use "decrement and branch" instructions on a count register instead ofgenerating sequences of instructions that decrement a register, compare it against zero, and then branch based upon the result.This option is only meaningful on architectures that support such instructions, which include x86, PowerPC, IA-64 and S/390.Note that the -fno-branch-count-reg option doesn't remove the decrement and branch instructions from the generated instructionstream introduced by other optimization passes.Enabled by default at -O1 and higher.The default is -fbranch-count-reg.
cc -fno-branch-count-reg ...
-fno-function-cse
Do not put function addresses in registers; make each instruction that calls a constant function contain the function's addressexplicitly.This option results in less efficient code, but some strange hacks that alter the assembler output may be confused by theoptimizations performed when this option is not used.The default is -ffunction-cse
cc -fno-function-cse ...
-fno-zero-initialized-in-bss
If the target supports a BSS section, GCC by default puts variables that are initialized to zero into BSS. This can save spacein the resulting code.This option turns off this behavior because some programs explicitly rely on variables going to the data section---e.g., so thatthe resulting executable can find the beginning of that section and/or make assumptions based on that.The default is -fzero-initialized-in-bss.
cc -fno-zero-initialized-in-bss ...
-fcse-follow-jumps
In common subexpression elimination (CSE), scan through jump instructions when the target of the jump is not reached by any otherpath. For example, when CSE encounters an "if" statement with an "else" clause, CSE follows the jump when the condition testedis false.Enabled at levels -O2, -O3, -Os.
cc -fcse-follow-jumps ...
-fgcse
Perform a global common subexpression elimination pass. This pass also performs global constant and copy propagation.Note: When compiling a program using computed gotos, a GCC extension, you may get better run-time performance if you disable theglobal common subexpression elimination pass by adding -fno-gcse to the command line.Enabled at levels -O2, -O3, -Os.
cc -fgcse ...
-fgcse-sm
When -fgcse-sm is enabled, a store motion pass is run after global common subexpression elimination. This pass attempts to movestores out of loops. When used in conjunction with -fgcse-lm, loops containing a load/store sequence can be changed to a loadbefore the loop and a store after the loop.Not enabled at any optimization level.
cc -fgcse-sm ...
-fgcse-las
When -fgcse-las is enabled, the global common subexpression elimination pass eliminates redundant loads that come after stores tothe same memory location (both partial and full redundancies).Not enabled at any optimization level.
cc -fgcse-las ...
-fgcse-after-reload
When -fgcse-after-reload is enabled, a redundant load elimination pass is performed after reload. The purpose of this pass is toclean up redundant spilling.
cc -fgcse-after-reload ...
-fcrossjumping
Perform cross-jumping transformation. This transformation unifies equivalent code and saves code size. The resulting code mayor may not perform better than without cross-jumping.Enabled at levels -O2, -O3, -Os.
cc -fcrossjumping ...
-fif-conversion
Attempt to transform conditional jumps into branch-less equivalents. This includes use of conditional moves, min, max, set flagsand abs instructions, and some tricks doable by standard arithmetics. The use of conditional execution on chips where it isavailable is controlled by -fif-conversion2.Enabled at levels -O, -O2, -O3, -Os.
cc -fif-conversion ...
-fif-conversion2
Use conditional execution (where available) to transform conditional jumps into branch-less equivalents.Enabled at levels -O, -O2, -O3, -Os.
cc -fif-conversion2 ...
-fdeclone-ctor-dtor
The C++ ABI requires multiple entry points for constructors and destructors: one for a base subobject, one for a complete object,and one for a virtual destructor that calls operator delete afterwards. For a hierarchy with virtual bases, the base andcomplete variants are clones, which means two copies of the function. With this option, the base and complete variants arechanged to be thunks that call a common implementation.Enabled by -Os.
cc -fdeclone-ctor-dtor ...
-fdelete-null-pointer-checks
Assume that programs cannot safely dereference null pointers, and that no code or data element resides at address zero. Thisoption enables simple constant folding optimizations at all optimization levels. In addition, other optimization passes in GCCuse this flag to control global dataflow analyses that eliminate useless checks for null pointers; these assume that a memoryaccess to address zero always results in a trap, so that if a pointer is checked after it has already been dereferenced, itcannot be null.Note however that in some environments this assumption is not true. Use -fno-delete-null-pointer-checks to disable thisoptimization for programs that depend on that behavior.This option is enabled by default on most targets. On Nios II ELF, it defaults to off. On AVR and CR16, this option iscompletely disabled.Passes that use the dataflow information are enabled independently at different optimization levels.
cc -fdelete-null-pointer-checks ...
-fdevirtualize
Attempt to convert calls to virtual functions to direct calls. This is done both within a procedure and interprocedurally aspart of indirect inlining (-findirect-inlining) and interprocedural constant propagation (-fipa-cp). Enabled at levels -O2, -O3,
cc -fdevirtualize ...
-fdevirtualize-speculatively
Attempt to convert calls to virtual functions to speculative direct calls. Based on the analysis of the type inheritance graph,determine for a given call the set of likely targets. If the set is small, preferably of size 1, change the call into aconditional deciding between direct and indirect calls. The speculative calls enable more optimizations, such as inlining. Whenthey seem useless after further optimization, they are converted back into original form.
cc -fdevirtualize-speculatively ...
-fdevirtualize-at-ltrans
Stream extra information needed for aggressive devirtualization when running the link-time optimizer in local transformationmode. This option enables more devirtualization but significantly increases the size of streamed data. For this reason it isdisabled by default.
cc -fdevirtualize-at-ltrans ...
-fexpensive-optimizations
Perform a number of minor optimizations that are relatively expensive.Enabled at levels -O2, -O3, -Os.
cc -fexpensive-optimizations ...
-free
Attempt to remove redundant extension instructions. This is especially helpful for the x86-64 architecture, which implicitlyzero-extends in 64-bit registers after writing to their lower 32-bit half.Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
cc -free ...
-fno-lifetime-dse
In C++ the value of an object is only affected by changes within its lifetime: when the constructor begins, the object has anindeterminate value, and any changes during the lifetime of the object are dead when the object is destroyed. Normally deadstore elimination will take advantage of this; if your code relies on the value of the object storage persisting beyond thelifetime of the object, you can use this flag to disable this optimization. To preserve stores before the constructor starts(e.g. because your operator new clears the object storage) but still treat the object as dead after the destructor you, can use
cc -fno-lifetime-dse ...
-flifetime-dse
The default behavior can be explicitly selected with -flifetime-dse=2. -flifetime-dse=0 is equivalent to
cc -flifetime-dse ...
-flive-range-shrinkage
Attempt to decrease register pressure through register live range shrinkage. This is helpful for fast processors with small ormoderate size register sets.
cc -flive-range-shrinkage ...
-fira-algorithm
Use the specified coloring algorithm for the integrated register allocator. The algorithm argument can be priority, whichspecifies Chow's priority coloring, or CB, which specifies Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implementedfor all architectures, but for those targets that do support it, it is the default because it generates better code.
cc -fira-algorithm ...
-fira-hoist-pressure
Use IRA to evaluate register pressure in the code hoisting pass for decisions to hoist expressions. This option usually resultsin smaller code, but it can slow the compiler down.This option is enabled at level -Os for all targets.
cc -fira-hoist-pressure ...
-fira-loop-pressure
Use IRA to evaluate register pressure in loops for decisions to move loop invariants. This option usually results in generationof faster and smaller code on machines with large register files (>= 32 registers), but it can slow the compiler down.This option is enabled at level -O3 for some targets.
cc -fira-loop-pressure ...
-fno-ira-share-save-slots
Disable sharing of stack slots used for saving call-used hard registers living through a call. Each hard register gets aseparate stack slot, and as a result function stack frames are larger.
cc -fno-ira-share-save-slots ...
-fno-ira-share-spill-slots
Disable sharing of stack slots allocated for pseudo-registers. Each pseudo-register that does not get a hard register gets aseparate stack slot, and as a result function stack frames are larger.
cc -fno-ira-share-spill-slots ...
-flra-remat
Enable CFG-sensitive rematerialization in LRA. Instead of loading values of spilled pseudos, LRA tries to rematerialize(recalculate) values if it is profitable.Enabled at levels -O2, -O3, -Os.
cc -flra-remat ...
-fdelayed-branch
If supported for the target machine, attempt to reorder instructions to exploit instruction slots available after delayed branchinstructions.Enabled at levels -O, -O2, -O3, -Os.
cc -fdelayed-branch ...
-fschedule-insns
If supported for the target machine, attempt to reorder instructions to eliminate execution stalls due to required data beingunavailable. This helps machines that have slow floating point or memory load instructions by allowing other instructions to beissued until the result of the load or floating-point instruction is required.Enabled at levels -O2, -O3.
cc -fschedule-insns ...
-fschedule-insns2
Similar to -fschedule-insns, but requests an additional pass of instruction scheduling after register allocation has been done.This is especially useful on machines with a relatively small number of registers and where memory load instructions take morethan one cycle.Enabled at levels -O2, -O3, -Os.
cc -fschedule-insns2 ...
-fno-sched-spec
Don't allow speculative motion of non-load instructions. This is normally enabled by default when scheduling before registerallocation, i.e. with -fschedule-insns or at -O2 or higher.
cc -fno-sched-spec ...
-fsched-pressure
Enable register pressure sensitive insn scheduling before register allocation. This only makes sense when scheduling beforeregister allocation is enabled, i.e. with -fschedule-insns or at -O2 or higher. Usage of this option can improve the generatedcode and decrease its size by preventing register pressure increase above the number of available hard registers and subsequentspills in register allocation.
cc -fsched-pressure ...
-fsched-spec-load-dangerous
Allow speculative motion of more load instructions. This only makes sense when scheduling before register allocation, i.e. with
cc -fsched-spec-load-dangerous ...
-fsched-stalled-insns
Define how many insns (if any) can be moved prematurely from the queue of stalled insns into the ready list during the secondscheduling pass. -fno-sched-stalled-insns means that no insns are moved prematurely, -fsched-stalled-insns=0 means there is nolimit on how many queued insns can be moved prematurely. -fsched-stalled-insns without a value is equivalent to
cc -fsched-stalled-insns ...
-fsched-stalled-insns-dep
Define how many insn groups (cycles) are examined for a dependency on a stalled insn that is a candidate for premature removalfrom the queue of stalled insns. This has an effect only during the second scheduling pass, and only if -fsched-stalled-insns isused. -fno-sched-stalled-insns-dep is equivalent to -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a value isequivalent to -fsched-stalled-insns-dep=1.
cc -fsched-stalled-insns-dep ...
-fsched2-use-superblocks
When scheduling after register allocation, use superblock scheduling. This allows motion across basic block boundaries,resulting in faster schedules. This option is experimental, as not all machine descriptions used by GCC model the CPU closelyenough to avoid unreliable results from the algorithm.This only makes sense when scheduling after register allocation, i.e. with -fschedule-insns2 or at -O2 or higher.
cc -fsched2-use-superblocks ...
-fsched-group-heuristic
Enable the group heuristic in the scheduler. This heuristic favors the instruction that belongs to a schedule group. This isenabled by default when scheduling is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
cc -fsched-group-heuristic ...
-fsched-spec-insn-heuristic
Enable the speculative instruction heuristic in the scheduler. This heuristic favors speculative instructions with greaterdependency weakness. This is enabled by default when scheduling is enabled, i.e. with -fschedule-insns or -fschedule-insns2 orat -O2 or higher.
cc -fsched-spec-insn-heuristic ...
-fsched-rank-heuristic
Enable the rank heuristic in the scheduler. This heuristic favors the instruction belonging to a basic block with greater sizeor frequency. This is enabled by default when scheduling is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2or higher.
cc -fsched-rank-heuristic ...
-fsched-last-insn-heuristic
Enable the last-instruction heuristic in the scheduler. This heuristic favors the instruction that is less dependent on the lastinstruction scheduled. This is enabled by default when scheduling is enabled, i.e. with -fschedule-insns or -fschedule-insns2 orat -O2 or higher.
cc -fsched-last-insn-heuristic ...
-freschedule-modulo-scheduled-loops
Modulo scheduling is performed before traditional scheduling. If a loop is modulo scheduled, later scheduling passes may changeits schedule. Use this option to control that behavior.
cc -freschedule-modulo-scheduled-loops ...
-fselective-scheduling
Schedule instructions using selective scheduling algorithm. Selective scheduling runs instead of the first scheduler pass.
cc -fselective-scheduling ...
-fsel-sched-pipelining
Enable software pipelining of innermost loops during selective scheduling. This option has no effect unless one of
cc -fsel-sched-pipelining ...
-fsel-sched-pipelining-outer-loops
When pipelining loops during selective scheduling, also pipeline outer loops. This option has no effect unless
cc -fsel-sched-pipelining-outer-loops ...
-fsemantic-interposition
Some object formats, like ELF, allow interposing of symbols by the dynamic linker. This means that for symbols exported from theDSO, the compiler cannot perform interprocedural propagation, inlining and other optimizations in anticipation that the functionor variable in question may change. While this feature is useful, for example, to rewrite memory allocation functions by adebugging implementation, it is expensive in the terms of code quality. With -fno-semantic-interposition the compiler assumesthat if interposition happens for functions the overwriting function will have precisely the same semantics (and side effects).Similarly if interposition happens for variables, the constructor of the variable will be the same. The flag has no effect forfunctions explicitly declared inline (where it is never allowed for interposition to change semantics) and for symbols explicitlydeclared weak.
cc -fsemantic-interposition ...
-fshrink-wrap
Emit function prologues only before parts of the function that need it, rather than at the top of the function. This flag isenabled by default at -O and higher.
cc -fshrink-wrap ...
-fcaller-saves
Enable allocation of values to registers that are clobbered by function calls, by emitting extra instructions to save and restorethe registers around such calls. Such allocation is done only when it seems to result in better code.This option is always enabled by default on certain machines, usually those which have no call-preserved registers to useinstead.Enabled at levels -O2, -O3, -Os.
cc -fcaller-saves ...
-fcombine-stack-adjustments
Tracks stack adjustments (pushes and pops) and stack memory references and then tries to find ways to combine them.Enabled by default at -O1 and higher.
cc -fcombine-stack-adjustments ...
-fipa-ra
Use caller save registers for allocation if those registers are not used by any called function. In that case it is notnecessary to save and restore them around calls. This is only possible if called functions are part of same compilation unit ascurrent function and they are compiled before it.Enabled at levels -O2, -O3, -Os, however the option is disabled if generated code will be instrumented for profiling (-p, or -pg)or if callee's register usage cannot be known exactly (this happens on targets that do not expose prologues and epilogues inRTL).
cc -fipa-ra ...
-fconserve-stack
Attempt to minimize stack usage. The compiler attempts to use less stack space, even if that makes the program slower. Thisoption implies setting the large-stack-frame parameter to 100 and the large-stack-frame-growth parameter to 400.
cc -fconserve-stack ...
-ftree-reassoc
Perform reassociation on trees. This flag is enabled by default at -O and higher.
cc -ftree-reassoc ...
-fcode-hoisting
Perform code hoisting. Code hoisting tries to move the evaluation of expressions executed on all paths to the function exit asearly as possible. This is especially useful as a code size optimization, but it often helps for code speed as well. This flagis enabled by default at -O2 and higher.
cc -fcode-hoisting ...
-ftree-pre
Perform partial redundancy elimination (PRE) on trees. This flag is enabled by default at -O2 and -O3.
cc -ftree-pre ...
-ftree-partial-pre
Make partial redundancy elimination (PRE) more aggressive. This flag is enabled by default at -O3.
cc -ftree-partial-pre ...
-ftree-forwprop
Perform forward propagation on trees. This flag is enabled by default at -O and higher.
cc -ftree-forwprop ...
-ftree-fre
Perform full redundancy elimination (FRE) on trees. The difference between FRE and PRE is that FRE only considers expressionsthat are computed on all paths leading to the redundant computation. This analysis is faster than PRE, though it exposes fewerredundancies. This flag is enabled by default at -O and higher.
cc -ftree-fre ...
-fhoist-adjacent-loads
Speculatively hoist loads from both branches of an if-then-else if the loads are from adjacent locations in the same structureand the target architecture has a conditional move instruction. This flag is enabled by default at -O2 and higher.
cc -fhoist-adjacent-loads ...
-fipa-reference
Discover which static variables do not escape the compilation unit. Enabled by default at -O and higher.
cc -fipa-reference ...
-fipa-pta
Perform interprocedural pointer analysis and interprocedural modification and reference analysis. This option can causeexcessive memory and compile-time usage on large compilation units. It is not enabled by default at any optimization level.
cc -fipa-pta ...
-fipa-profile
Perform interprocedural profile propagation. The functions called only from cold functions are marked as cold. Also functionsexecuted once (such as "cold", "noreturn", static constructors or destructors) are identified. Cold functions and loop less partsof functions executed once are then optimized for size. Enabled by default at -O and higher.
cc -fipa-profile ...
-fipa-cp
Perform interprocedural constant propagation. This optimization analyzes the program to determine when values passed tofunctions are constants and then optimizes accordingly. This optimization can substantially increase performance if theapplication has constants passed to functions. This flag is enabled by default at -O2, -Os and -O3.
cc -fipa-cp ...
-fipa-cp-clone
Perform function cloning to make interprocedural constant propagation stronger. When enabled, interprocedural constantpropagation performs function cloning when externally visible function can be called with constant arguments. Because thisoptimization can create multiple copies of functions, it may significantly increase code size (see --paramipcp-unit-growth=value). This flag is enabled by default at -O3.
cc -fipa-cp-clone ...
-fipa-vrp
When enabled, perform interprocedural propagation of value ranges. This flag is enabled by default at -O2. It requires that
cc -fipa-vrp ...
-fipa-icf
Perform Identical Code Folding for functions and read-only variables. The optimization reduces code size and may disturb unwindstacks by replacing a function by equivalent one with a different name. The optimization works more effectively with link-timeoptimization enabled.Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF works on different levels and thus theoptimizations are not same - there are equivalences that are found only by GCC and equivalences found only by Gold.This flag is enabled by default at -O2 and -Os.
cc -fipa-icf ...
-fisolate-erroneous-paths-attribute
Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a"returns_nonnull" or "nonnull" attribute. Isolate those paths from the main control flow and turn the statement with erroneousor undefined behavior into a trap. This is not currently enabled, but may be enabled by -O2 in the future.
cc -fisolate-erroneous-paths-attribute ...
-ftree-bit-ccp
Perform sparse conditional bit constant propagation on trees and propagate pointer alignment information. This pass onlyoperates on local scalar variables and is enabled by default at -O and higher. It requires that -ftree-ccp is enabled.
cc -ftree-bit-ccp ...
-ftree-ccp
Perform sparse conditional constant propagation (CCP) on trees. This pass only operates on local scalar variables and is enabledby default at -O and higher.
cc -ftree-ccp ...
-fssa-backprop
Propagate information about uses of a value up the definition chain in order to simplify the definitions. For example, this passstrips sign operations if the sign of a value never matters. The flag is enabled by default at -O and higher.
cc -fssa-backprop ...
-fssa-phiopt
Perform pattern matching on SSA PHI nodes to optimize conditional code. This pass is enabled by default at -O and higher.
cc -fssa-phiopt ...
-ftree-tail-merge
Look for identical code sequences. When found, replace one with a jump to the other. This optimization is known as tail mergingor cross jumping. This flag is enabled by default at -O2 and higher. The compilation time in this pass can be limited usingmax-tail-merge-comparisons parameter and max-tail-merge-iterations parameter.
cc -ftree-tail-merge ...
-ftree-builtin-call-dce
Perform conditional dead code elimination (DCE) for calls to built-in functions that may set "errno" but are otherwise side-effect free. This flag is enabled by default at -O2 and higher if -Os is not also specified.
cc -ftree-builtin-call-dce ...
-ftree-dominator-opts
Perform a variety of simple scalar cleanups (constant/copy propagation, redundancy elimination, range propagation and expressionsimplification) based on a dominator tree traversal. This also performs jump threading (to reduce jumps to jumps). This flag isenabled by default at -O and higher.
cc -ftree-dominator-opts ...
-ftree-dse
Perform dead store elimination (DSE) on trees. A dead store is a store into a memory location that is later overwritten byanother store without any intervening loads. In this case the earlier store can be deleted. This flag is enabled by default at
cc -ftree-dse ...
-ftree-ch
Perform loop header copying on trees. This is beneficial since it increases effectiveness of code motion optimizations. It alsosaves one jump. This flag is enabled by default at -O and higher. It is not enabled for -Os, since it usually increases codesize.
cc -ftree-ch ...
-floop-unroll-and-jam
Perform loop nest optimizations. Same as -floop-nest-optimize. To use this code transformation, GCC has to be configured with
cc -floop-unroll-and-jam ...
--with-isl
to enable the Graphite loop transformation infrastructure.
cc --with-isl ...
-fgraphite-identity
Enable the identity transformation for graphite. For every SCoP we generate the polyhedral representation and transform it backto gimple. Using -fgraphite-identity we can check the costs or benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation.Some minimal optimizations are also performed by the code generator isl, like index splitting and dead code elimination in loops.
cc -fgraphite-identity ...
-floop-nest-optimize
Enable the isl based loop nest optimizer. This is a generic loop nest optimizer based on the Pluto optimization algorithms. Itcalculates a loop structure optimized for data-locality and parallelism. This option is experimental.
cc -floop-nest-optimize ...
-floop-parallelize-all
Use the Graphite data dependence analysis to identify loops that can be parallelized. Parallelize all the loops that can beanalyzed to not contain loop carried dependences without checking that it is profitable to parallelize the loops.
cc -floop-parallelize-all ...
-ftree-coalesce-vars
While transforming the program out of the SSA representation, attempt to reduce copying by coalescing versions of different user-defined variables, instead of just compiler temporaries. This may severely limit the ability to debug an optimized programcompiled with -fno-var-tracking-assignments. In the negated form, this flag prevents SSA coalescing of user variables. Thisoption is enabled by default if optimization is enabled, and it does very little otherwise.
cc -ftree-coalesce-vars ...
-ftree-loop-if-convert
Attempt to transform conditional jumps in the innermost loops to branch-less equivalents. The intent is to remove control-flowfrom the innermost loops in order to improve the ability of the vectorization pass to handle these loops. This is enabled bydefault if vectorization is enabled.
cc -ftree-loop-if-convert ...
-ftree-loop-distribution
Perform loop distribution. This flag can improve cache performance on big loop bodies and allow further loop optimizations, likeparallelization or vectorization, to take place. For example, the loopDO I = 1, NA(I) = B(I) + CD(I) = E(I) * FENDDOis transformed toDO I = 1, NA(I) = B(I) + CENDDODO I = 1, ND(I) = E(I) * FENDDO
cc -ftree-loop-distribution ...
-ftree-loop-distribute-patterns
Perform loop distribution of patterns that can be code generated with calls to a library. This flag is enabled by default at
cc -ftree-loop-distribute-patterns ...
-O3.
This pass distributes the initialization loops and generates a call to memset zero. For example, the loopDO I = 1, NA(I) = 0B(I) = A(I) + IENDDOis transformed toDO I = 1, NA(I) = 0ENDDODO I = 1, NB(I) = A(I) + IENDDOand the initialization loop is transformed into a call to memset zero.
cc -O3. ...
-ftree-loop-im
Perform loop invariant motion on trees. This pass moves only invariants that are hard to handle at RTL level (function calls,operations that expand to nontrivial sequences of insns). With -funswitch-loops it also moves operands of conditions that areinvariant out of the loop, so that we can use just trivial invariantness analysis in loop unswitching. The pass also includesstore motion.
cc -ftree-loop-im ...
-ftree-loop-ivcanon
Create a canonical counter for number of iterations in loops for which determining number of iterations requires complicatedanalysis. Later optimizations then may determine the number easily. Useful especially in connection with unrolling.
cc -ftree-loop-ivcanon ...
-fivopts
Perform induction variable optimizations (strength reduction, induction variable merging and induction variable elimination) ontrees.
cc -fivopts ...
-ftree-parallelize-loops
Parallelize loops, i.e., split their iteration space to run in n threads. This is only possible for loops whose iterations areindependent and can be arbitrarily reordered. The optimization is only profitable on multiprocessor machines, for loops that areCPU-intensive, rather than constrained e.g. by memory bandwidth. This option implies -pthread, and thus is only supported ontargets that have support for -pthread.
cc -ftree-parallelize-loops ...
-ftree-pta
Perform function-local points-to analysis on trees. This flag is enabled by default at -O and higher.
cc -ftree-pta ...
-fstore-merging
Perform merging of narrow stores to consecutive memory addresses. This pass merges contiguous stores of immediate valuesnarrower than a word into fewer wider stores to reduce the number of instructions. This is enabled by default at -O2 and higheras well as -Os.
cc -fstore-merging ...
-ftree-ter
Perform temporary expression replacement during the SSA->normal phase. Single use/single def temporaries are replaced at theiruse location with their defining expression. This results in non-GIMPLE code, but gives the expanders much more complex trees towork on resulting in better RTL generation. This is enabled by default at -O and higher.
cc -ftree-ter ...
-ftree-slsr
Perform straight-line strength reduction on trees. This recognizes related expressions involving multiplications and replacesthem by less expensive calculations when possible. This is enabled by default at -O and higher.
cc -ftree-slsr ...
-ftree-vectorize
Perform vectorization on trees. This flag enables -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly specified.
cc -ftree-vectorize ...
-ftree-loop-vectorize
Perform loop vectorization on trees. This flag is enabled by default at -O3 and when -ftree-vectorize is enabled.
cc -ftree-loop-vectorize ...
-fvect-cost-model
Alter the cost model used for vectorization. The model argument should be one of unlimited, dynamic or cheap. With theunlimited model the vectorized code-path is assumed to be profitable while with the dynamic model a runtime check guards thevectorized code-path to enable it only for iteration counts that will likely execute faster than when executing the originalscalar loop. The cheap model disables vectorization of loops where doing so would be cost prohibitive for example due torequired runtime checks for data dependence or alignment but otherwise is equal to the dynamic model. The default cost modeldepends on other optimization flags and is either dynamic or cheap.
cc -fvect-cost-model ...
-ftree-vrp
Perform Value Range Propagation on trees. This is similar to the constant propagation pass, but instead of values, ranges ofvalues are propagated. This allows the optimizers to remove unnecessary range checks like array bound checks and null pointerchecks. This is enabled by default at -O2 and higher. Null pointer check elimination is only done if
cc -ftree-vrp ...
-fsplit-paths
Split paths leading to loop backedges. This can improve dead code elimination and common subexpression elimination. This isenabled by default at -O2 and above.
cc -fsplit-paths ...
-fsplit-ivs-in-unroller
Enables expression of values of induction variables in later iterations of the unrolled loop using the value in the firstiteration. This breaks long dependency chains, thus improving efficiency of the scheduling passes.A combination of -fweb and CSE is often sufficient to obtain the same effect. However, that is not reliable in cases where theloop body is more complicated than a single basic block. It also does not work at all on some architectures due to restrictionsin the CSE pass.This optimization is enabled by default.
cc -fsplit-ivs-in-unroller ...
-fvariable-expansion-in-unroller
With this option, the compiler creates multiple copies of some local variables when unrolling a loop, which can result insuperior code.
cc -fvariable-expansion-in-unroller ...
-fpartial-inlining
Inline parts of functions. This option has any effect only when inlining itself is turned on by the -finline-functions or
cc -fpartial-inlining ...
-fprefetch-loop-arrays
If supported by the target machine, generate instructions to prefetch memory to improve the performance of loops that accesslarge arrays.This option may generate better or worse code; results are highly dependent on the structure of loops within the source code.Disabled at level -Os.
cc -fprefetch-loop-arrays ...
-fno-printf-return-value
Do not substitute constants for known return value of formatted output functions such as "sprintf", "snprintf", "vsprintf", and"vsnprintf" (but not "printf" of "fprintf"). This transformation allows GCC to optimize or even eliminate branches based on theknown return value of these functions called with arguments that are either constant, or whose values are known to be in a rangethat makes determining the exact return value possible. For example, when -fprintf-return-value is in effect, both the branchand the body of the "if" statement (but not the call to "snprint") can be optimized away when "i" is a 32-bit or smaller integerbecause the return value is guaranteed to be at most 8.char buf[9];if (snprintf (buf, "%08x", i) >= sizeof buf)...The -fprintf-return-value option relies on other optimizations and yields best results with -O2. It works in tandem with the
cc -fno-printf-return-value ...
-fno-peephole2
Disable any machine-specific peephole optimizations. The difference between -fno-peephole and -fno-peephole2 is in how they areimplemented in the compiler; some targets use one, some use the other, a few use both.
cc -fno-peephole2 ...
-fpeephole
is enabled by default. -fpeephole2 enabled at levels -O2, -O3, -Os.
cc -fpeephole ...
-freorder-blocks
Reorder basic blocks in the compiled function in order to reduce number of taken branches and improve code locality.Enabled at levels -O, -O2, -O3, -Os.
cc -freorder-blocks ...
-freorder-blocks-and-partition
In addition to reordering basic blocks in the compiled function, in order to reduce number of taken branches, partitions hot andcold basic blocks into separate sections of the assembly and .o files, to improve paging and cache locality performance.This optimization is automatically turned off in the presence of exception handling, for linkonce sections, for functions with auser-defined section attribute and on any architecture that does not support named sections.Enabled for x86 at levels -O2, -O3.
cc -freorder-blocks-and-partition ...
-freorder-functions
Reorder functions in the object file in order to improve code locality. This is implemented by using special subsections".text.hot" for most frequently executed functions and ".text.unlikely" for unlikely executed functions. Reordering is done bythe linker so object file format must support named sections and linker must place them in a reasonable way.Also profile feedback must be available to make this option effective. See -fprofile-arcs for details.Enabled at levels -O2, -O3, -Os.
cc -freorder-functions ...
-fstrict-aliasing
Allow the compiler to assume the strictest aliasing rules applicable to the language being compiled. For C (and C++), thisactivates optimizations based on the type of expressions. In particular, an object of one type is assumed never to reside at thesame address as an object of a different type, unless the types are almost the same. For example, an "unsigned int" can alias an"int", but not a "void*" or a "double". A character type may alias any other type.Pay special attention to code like this:union a_union {int i;double d;};int f() {union a_union t;t.d = 3.0;return t.i;}The practice of reading from a different union member than the one most recently written to (called "type-punning") is common.Even with -fstrict-aliasing, type-punning is allowed, provided the memory is accessed through the union type. So, the code aboveworks as expected. However, this code might not:int f() {union a_union t;int* ip;t.d = 3.0;ip = &t.i;return *ip;}Similarly, access by taking the address, casting the resulting pointer and dereferencing the result has undefined behavior, evenif the cast uses a union type, e.g.:int f() {double d = 3.0;return ((union a_union *) &d)->i;}The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
cc -fstrict-aliasing ...
-fstrict-overflow
Allow the compiler to assume strict signed overflow rules, depending on the language being compiled. For C (and C++) this meansthat overflow when doing arithmetic with signed numbers is undefined, which means that the compiler may assume that it does nothappen. This permits various optimizations. For example, the compiler assumes that an expression like "i + 10 > i" is alwaystrue for signed "i". This assumption is only valid if signed overflow is undefined, as the expression is false if "i + 10"overflows when using twos complement arithmetic. When this option is in effect any attempt to determine whether an operation onsigned numbers overflows must be written carefully to not actually involve overflow.This option also allows the compiler to assume strict pointer semantics: given a pointer to an object, if adding an offset tothat pointer does not produce a pointer to the same object, the addition is undefined. This permits the compiler to concludethat "p + u > p" is always true for a pointer "p" and unsigned integer "u". This assumption is only valid because pointerwraparound is undefined, as the expression is false if "p + u" overflows using twos complement arithmetic.See also the -fwrapv option. Using -fwrapv means that integer signed overflow is fully defined: it wraps. When -fwrapv is used,there is no difference between -fstrict-overflow and -fno-strict-overflow for integers. With -fwrapv certain types of overfloware permitted. For example, if the compiler gets an overflow when doing arithmetic on constants, the overflowed value can stillbe used with -fwrapv, but not otherwise.The -fstrict-overflow option is enabled at levels -O2, -O3, -Os.
cc -fstrict-overflow ...
-flimit-function-alignment
If this option is enabled, the compiler tries to avoid unnecessarily overaligning functions. It attempts to instruct theassembler to align by the amount specified by -falign-functions, but not to skip more bytes than the size of the function.
cc -flimit-function-alignment ...
-falign-labels
Align all branch targets to a power-of-two boundary, skipping up to n bytes like -falign-functions. This option can easily makecode slower, because it must insert dummy operations for when the branch target is reached in the usual flow of the code.
cc -falign-labels ...
-fno-align-labels
If -falign-loops or -falign-jumps are applicable and are greater than this value, then their values are used instead.If n is not specified or is zero, use a machine-dependent default which is very likely to be 1, meaning no alignment. Themaximum allowed n option value is 65536.Enabled at levels -O2, -O3.
cc -fno-align-labels ...
-falign-loops
Align loops to a power-of-two boundary, skipping up to n bytes like -falign-functions. If the loops are executed many times,this makes up for any execution of the dummy operations.
cc -falign-loops ...
-falign-jumps
Align branch targets to a power-of-two boundary, for branch targets where the targets can only be reached by jumping, skipping upto n bytes like -falign-functions. In this case, no dummy operations need be executed.
cc -falign-jumps ...
-fno-align-jumps
If n is not specified or is zero, use a machine-dependent default. The maximum allowed n option value is 65536.Enabled at levels -O2, -O3.
cc -fno-align-jumps ...
-funit-at-a-time
This option is left for compatibility reasons. -funit-at-a-time has no effect, while -fno-unit-at-a-time implies
cc -funit-at-a-time ...
-fno-toplevel-reorder
Enabled by default.
cc -fno-toplevel-reorder ...
-fweb
Constructs webs as commonly used for register allocation purposes and assign each web individual pseudo register. This allowsthe register allocation pass to operate on pseudos directly, but also strengthens several other optimization passes, such as CSE,loop optimizer and trivial dead code remover. It can, however, make debugging impossible, since variables no longer stay in a"home register".Enabled by default with -funroll-loops.
cc -fweb ...
-fwhole-program
Assume that the current compilation unit represents the whole program being compiled. All public functions and variables withthe exception of "main" and those merged by attribute "externally_visible" become static functions and in effect are optimizedmore aggressively by interprocedural optimizers.This option should not be used in combination with -flto. Instead relying on a linker plugin should provide safer and moreprecise information.
cc -fwhole-program ...
-flto[
This option runs the standard link-time optimizer. When invoked with source code, it generates GIMPLE (one of GCC's internalrepresentations) and writes it to special ELF sections in the object file. When the object files are linked together, all thefunction bodies are read from these ELF sections and instantiated as if they had been part of the same translation unit.To use the link-time optimizer, -flto and optimization options should be specified at compile time and during the final link. Itis recommended that you compile all the files participating in the same link with the same options and also specify those optionsat link time. For example:gcc -c -O2 -flto foo.cgcc -c -O2 -flto bar.cgcc -o myprog -flto -O2 foo.o bar.oThe first two invocations to GCC save a bytecode representation of GIMPLE into special ELF sections inside foo.o and bar.o. Thefinal invocation reads the GIMPLE bytecode from foo.o and bar.o, merges the two files into a single internal image, and compilesthe result as usual. Since both foo.o and bar.o are merged into a single image, this causes all the interprocedural analyses andoptimizations in GCC to work across the two files as if they were a single one. This means, for example, that the inliner isable to inline functions in bar.o into functions in foo.o and vice-versa.Another (simpler) way to enable link-time optimization is:gcc -o myprog -flto -O2 foo.c bar.cThe above generates bytecode for foo.c and bar.c, merges them together into a single GIMPLE representation and optimizes them asusual to produce myprog.The only important thing to keep in mind is that to enable link-time optimizations you need to use the GCC driver to perform thelink step. GCC then automatically performs link-time optimization if any of the objects involved were compiled with the -fltocommand-line option. You generally should specify the optimization options to be used for link-time optimization though GCCtries to be clever at guessing an optimization level to use from the options used at compile time if you fail to specify one atlink time. You can always override the automatic decision to do link-time optimization by passing -fno-lto to the link command.To make whole program optimization effective, it is necessary to make certain whole program assumptions. The compiler needs toknow what functions and variables can be accessed by libraries and runtime outside of the link-time optimized unit. Whensupported by the linker, the linker plugin (see -fuse-linker-plugin) passes information to the compiler about used and externallyvisible symbols. When the linker plugin is not available, -fwhole-program should be used to allow the compiler to make theseassumptions, which leads to more aggressive optimization decisions.When -fuse-linker-plugin is not enabled, when a file is compiled with -flto, the generated object file is larger than a regularobject file because it contains GIMPLE bytecodes and the usual final code (see -ffat-lto-objects. This means that object fileswith LTO information can be linked as normal object files; if -fno-lto is passed to the linker, no interprocedural optimizationsare applied. Note that when -fno-fat-lto-objects is enabled the compile stage is faster but you cannot perform a regular, non-LTO link on them.Additionally, the optimization flags used to compile individual files are not necessarily related to those used at link time.For instance,gcc -c -O0 -ffat-lto-objects -flto foo.cgcc -c -O0 -ffat-lto-objects -flto bar.cgcc -o myprog -O3 foo.o bar.oThis produces individual object files with unoptimized assembler code, but the resulting binary myprog is optimized at -O3. If,instead, the final binary is generated with -fno-lto, then myprog is not optimized.When producing the final binary, GCC only applies link-time optimizations to those files that contain bytecode. Therefore, youcan mix and match object files and libraries with GIMPLE bytecodes and final object code. GCC automatically selects which filesto optimize in LTO mode and which files to link without further processing.There are some code generation flags preserved by GCC when generating bytecodes, as they need to be used during the final linkstage. Generally options specified at link time override those specified at compile time.If you do not specify an optimization level option -O at link time, then GCC uses the highest optimization level used whencompiling the object files.Currently, the following options and their settings are taken from the first object file that explicitly specifies them: -fPIC,
cc -flto[ ...
-fpic
Certain ABI-changing flags are required to match in all compilation units, and trying to override this at link time with aconflicting value is ignored. This includes options such as -freg-struct-return and -fpcc-struct-return.Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv, -fno-trapv or -fno-strict-aliasing are passed through to thelink stage and merged conservatively for conflicting translation units. Specifically -fno-strict-overflow, -fwrapv and
cc -fpic ...
-flto-odr-type-merging
Enable streaming of mangled types names of C++ types and their unification at link time. This increases size of LTO objectfiles, but enables diagnostics about One Definition Rule violations.
cc -flto-odr-type-merging ...
-flto-compression-level
This option specifies the level of compression used for intermediate language written to LTO object files, and is only meaningfulin conjunction with LTO mode (-flto). Valid values are 0 (no compression) to 9 (maximum compression). Values outside this rangeare clamped to either 0 or 9. If the option is not given, a default balanced compression setting is used.
cc -flto-compression-level ...
-fuse-linker-plugin
Enables the use of a linker plugin during link-time optimization. This option relies on plugin support in the linker, which isavailable in gold or in GNU ld 2.21 or newer.This option enables the extraction of object files with GIMPLE bytecode out of library archives. This improves the quality ofoptimization by exposing more code to the link-time optimizer. This information specifies what symbols can be accessedexternally (by non-LTO object or during dynamic linking). Resulting code quality improvements on binaries (and shared librariesthat use hidden visibility) are similar to -fwhole-program. See -flto for a description of the effect of this flag and how touse it.This option is enabled by default when LTO support in GCC is enabled and GCC was configured for use with a linker supportingplugins (GNU ld 2.21 or newer or gold).
cc -fuse-linker-plugin ...
-ffat-lto-objects
Fat LTO objects are object files that contain both the intermediate language and the object code. This makes them usable for bothLTO linking and normal linking. This option is effective only when compiling with -flto and is ignored at link time.
cc -ffat-lto-objects ...
-fcompare-elim
After register allocation and post-register allocation instruction splitting, identify arithmetic instructions that computeprocessor flags similar to a comparison operation based on that arithmetic. If possible, eliminate the explicit comparisonoperation.This pass only applies to certain targets that cannot explicitly represent the comparison operation before register allocation iscomplete.Enabled at levels -O, -O2, -O3, -Os.
cc -fcompare-elim ...
-fprofile-use
Enable profile feedback-directed optimizations, and the following optimizations which are generally profitable only with profilefeedback available: -fbranch-probabilities, -fvpt, -funroll-loops, -fpeel-loops, -ftracer, -ftree-vectorize, and ftree-loop-distribute-patterns.Before you can use this option, you must first generate profiling information.By default, GCC emits an error message if the feedback profiles do not match the source code. This error can be turned into awarning by using -Wcoverage-mismatch. Note this may result in poorly optimized code.If path is specified, GCC looks at the path to find the profile feedback data files. See -fprofile-dir.
cc -fprofile-use ...
-ftree-loop-distribute-patterns.
path is the name of a file containing AutoFDO profile information. If omitted, it defaults to fbdata.afdo in the currentdirectory.Producing an AutoFDO profile data file requires running your program with the perf utility on a supported GNU/Linux targetsystem. For more information, see <https://perf.wiki.kernel.org/>.E.g.perf record -e br_inst_retired:near_taken -b -o perf.data \
cc -ftree-loop-distribute-patterns. ...
--
Then use the create_gcov tool to convert the raw profile data to a format that can be used by GCC. You must also supply theunstripped binary for your program to this tool. See <https://github.com/google/autofdo>.E.g.create_gcov --binary=your_program.unstripped --profile=perf.data \
cc -- ...
--gcov
The following options control compiler behavior regarding floating-point arithmetic. These options trade off between speed andcorrectness. All must be specifically enabled.
cc --gcov ...
-ffloat-store
Do not store floating-point variables in registers, and inhibit other options that might change whether a floating-point value istaken from a register or memory.This option prevents undesirable excess precision on machines such as the 68000 where the floating registers (of the 68881) keepmore precision than a "double" is supposed to have. Similarly for the x86 architecture. For most programs, the excess precisiondoes only good, but a few programs rely on the precise definition of IEEE floating point. Use -ffloat-store for such programs,after modifying them to store all pertinent intermediate computations into variables.
cc -ffloat-store ...
-ffast-math
Sets the options -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
cc -ffast-math ...
-fcx-limited-range
This option causes the preprocessor macro "__FAST_MATH__" to be defined.This option is not turned on by any -O option besides -Ofast since it can result in incorrect output for programs that depend onan exact implementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programsthat do not require the guarantees of these specifications.
cc -fcx-limited-range ...
-fno-math-errno
Do not set "errno" after calling math functions that are executed with a single instruction, e.g., "sqrt". A program that relieson IEEE exceptions for math error handling may want to use this flag for speed while maintaining IEEE arithmetic compatibility.This option is not turned on by any -O option since it can result in incorrect output for programs that depend on an exactimplementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that donot require the guarantees of these specifications.The default is -fmath-errno.On Darwin systems, the math library never sets "errno". There is therefore no reason for the compiler to consider thepossibility that it might, and -fno-math-errno is the default.
cc -fno-math-errno ...
-funsafe-math-optimizations
Allow optimizations for floating-point arithmetic that (a) assume that arguments and results are valid and (b) may violate IEEEor ANSI standards. When used at link time, it may include libraries or startup files that change the default FPU control word orother similar optimizations.This option is not turned on by any -O option since it can result in incorrect output for programs that depend on an exactimplementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that donot require the guarantees of these specifications. Enables -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
cc -funsafe-math-optimizations ...
-freciprocal-math.
The default is -fno-unsafe-math-optimizations.
cc -freciprocal-math. ...
-fassociative-math
Allow re-association of operands in series of floating-point operations. This violates the ISO C and C++ language standard bypossibly changing computation result. NOTE: re-ordering may change the sign of zero as well as ignore NaNs and inhibit or createunderflow or overflow (and thus cannot be used on code that relies on rounding behavior like "(x + 2**52) - 2**52". May alsoreorder floating-point comparisons and thus may not be used when ordered comparisons are required. This option requires thatboth -fno-signed-zeros and -fno-trapping-math be in effect. Moreover, it doesn't make much sense with -frounding-math. ForFortran the option is automatically enabled when both -fno-signed-zeros and -fno-trapping-math are in effect.The default is -fno-associative-math.
cc -fassociative-math ...
-freciprocal-math
Allow the reciprocal of a value to be used instead of dividing by the value if this enables optimizations. For example "x / y"can be replaced with "x * (1/y)", which is useful if "(1/y)" is subject to common subexpression elimination. Note that thisloses precision and increases the number of flops operating on the value.The default is -fno-reciprocal-math.
cc -freciprocal-math ...
-ffinite-math-only
Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs.This option is not turned on by any -O option since it can result in incorrect output for programs that depend on an exactimplementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that donot require the guarantees of these specifications.The default is -fno-finite-math-only.
cc -ffinite-math-only ...
-fno-signed-zeros
Allow optimizations for floating-point arithmetic that ignore the signedness of zero. IEEE arithmetic specifies the behavior ofdistinct +0.0 and -0.0 values, which then prohibits simplification of expressions such as x+0.0 or 0.0*x (even with
cc -fno-signed-zeros ...
-ffinite-math-only).
The default is -fsigned-zeros.
cc -ffinite-math-only). ...
-fno-trapping-math
Compile code assuming that floating-point operations cannot generate user-visible traps. These traps include division by zero,overflow, underflow, inexact result and invalid operation. This option requires that -fno-signaling-nans be in effect. Settingthis option may allow faster code if one relies on "non-stop" IEEE arithmetic, for example.This option should never be turned on by any -O option since it can result in incorrect output for programs that depend on anexact implementation of IEEE or ISO rules/specifications for math functions.The default is -ftrapping-math.
cc -fno-trapping-math ...
-frounding-math
Disable transformations and optimizations that assume default floating-point rounding behavior. This is round-to-zero for allfloating point to integer conversions, and round-to-nearest for all other arithmetic truncations. This option should bespecified for programs that change the FP rounding mode dynamically, or that may be executed with a non-default rounding mode.This option disables constant folding of floating-point expressions at compile time (which may be affected by rounding mode) andarithmetic transformations that are unsafe in the presence of sign-dependent rounding modes.The default is -fno-rounding-math.This option is experimental and does not currently guarantee to disable all GCC optimizations that are affected by rounding mode.Future versions of GCC may provide finer control of this setting using C99's "FENV_ACCESS" pragma. This command-line option willbe used to specify the default state for "FENV_ACCESS".
cc -frounding-math ...
-fsignaling-nans
Compile code assuming that IEEE signaling NaNs may generate user-visible traps during floating-point operations. Setting thisoption disables optimizations that may change the number of exceptions visible with signaling NaNs. This option implies
cc -fsignaling-nans ...
-ftrapping-math.
This option causes the preprocessor macro "__SUPPORT_SNAN__" to be defined.The default is -fno-signaling-nans.This option is experimental and does not currently guarantee to disable all GCC optimizations that affect signaling NaN behavior.
cc -ftrapping-math. ...
-fno-fp-int-builtin-inexact
Do not allow the built-in functions "ceil", "floor", "round" and "trunc", and their "float" and "long double" variants, togenerate code that raises the "inexact" floating-point exception for noninteger arguments. ISO C99 and C11 allow these functionsto raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these functions todo so.The default is -ffp-int-builtin-inexact, allowing the exception to be raised. This option does nothing unless -ftrapping-math isin effect.Even if -fno-fp-int-builtin-inexact is used, if the functions generate a call to a library function then the "inexact" exceptionmay be raised if the library implementation does not follow TS 18661.
cc -fno-fp-int-builtin-inexact ...
-fsingle-precision-constant
Treat floating-point constants as single precision instead of implicitly converting them to double-precision constants.
cc -fsingle-precision-constant ...
-fcx-fortran-rules
Complex multiplication and division follow Fortran rules. Range reduction is done as part of complex division, but there is nochecking whether the result of a complex multiplication or division is "NaN + I*NaN", with an attempt to rescue the situation inthat case.The default is -fno-cx-fortran-rules.The following options control optimizations that may improve performance, but are not enabled by any -O options. This sectionincludes experimental options that may produce broken code.
cc -fcx-fortran-rules ...
-fbranch-probabilities
After running a program compiled with -fprofile-arcs, you can compile it a second time using -fbranch-probabilities, to improveoptimizations based on the number of times each branch was taken. When a program compiled with -fprofile-arcs exits, it savesarc execution counts to a file called sourcename.gcda for each source file. The information in this data file is very dependenton the structure of the generated code, so you must use the same source code and the same optimization options for bothcompilations.With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each JUMP_INSN and CALL_INSN. These can be used to improveoptimization. Currently, they are only used in one place: in reorg.c, instead of guessing which path a branch is most likely totake, the REG_BR_PROB values are used to exactly determine which path is taken more often.
cc -fbranch-probabilities ...
-fprofile-values
If combined with -fprofile-arcs, it adds code so that some data about values of expressions in the program is gathered.With -fbranch-probabilities, it reads back the data gathered from profiling values of expressions for usage in optimizations.Enabled with -fprofile-generate and -fprofile-use.
cc -fprofile-values ...
-fprofile-reorder-functions
Function reordering based on profile instrumentation collects first time of execution of a function and orders these functions inascending order.Enabled with -fprofile-use.
cc -fprofile-reorder-functions ...
-fvpt
If combined with -fprofile-arcs, this option instructs the compiler to add code to gather information about values ofexpressions.With -fbranch-probabilities, it reads back the data gathered and actually performs the optimizations based on them. Currentlythe optimizations include specialization of division operations using the knowledge about the value of the denominator.
cc -fvpt ...
-fschedule-fusion
Performs a target dependent pass over the instruction stream to schedule instructions of same type together because targetmachine can execute them more efficiently if they are adjacent to each other in the instruction flow.Enabled at levels -O2, -O3, -Os.
cc -fschedule-fusion ...
-ftracer
Perform tail duplication to enlarge superblock size. This transformation simplifies the control flow of the function allowingother optimizations to do a better job.Enabled with -fprofile-use.
cc -ftracer ...
-funroll-loops
Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. -funroll-loops implies
cc -funroll-loops ...
-funroll-all-loops
Unroll all loops, even if their number of iterations is uncertain when the loop is entered. This usually makes programs run moreslowly. -funroll-all-loops implies the same options as -funroll-loops.
cc -funroll-all-loops ...
-fpeel-loops
Peels loops for which there is enough information that they do not roll much (from profile feedback or static analysis). It alsoturns on complete loop peeling (i.e. complete removal of loops with small constant number of iterations).Enabled with -O3 and/or -fprofile-use.
cc -fpeel-loops ...
-fsplit-loops
Split a loop into two if it contains a condition that's always true for one side of the iteration space and false for the other.
cc -fsplit-loops ...
-funswitch-loops
Move branches with loop invariant conditions out of the loop, with duplicates of the loop on both branches (modified according toresult of the condition).
cc -funswitch-loops ...
-fdata-sections
Place each function or data item into its own section in the output file if the target supports arbitrary sections. The name ofthe function or the name of the data item determines the section's name in the output file.Use these options on systems where the linker can perform optimizations to improve locality of reference in the instructionspace. Most systems using the ELF object format and SPARC processors running Solaris 2 have linkers with such optimizations.AIX may have these optimizations in the future.Only use these options when there are significant benefits from doing so. When you specify these options, the assembler andlinker create larger object and executable files and are also slower. You cannot use gprof on all systems if you specify thisoption, and you may have problems with debugging if you specify both this option and -g.
cc -fdata-sections ...
-fbranch-target-load-optimize
Perform branch target register load optimization before prologue / epilogue threading. The use of target registers can typicallybe exposed only during reload, thus hoisting loads out of loops and doing inter-block scheduling needs a separate optimizationpass.
cc -fbranch-target-load-optimize ...
-fbtr-bb-exclusive
When performing branch target register load optimization, don't reuse branch target registers within any basic block.
cc -fbtr-bb-exclusive ...
-fstdarg-opt
Optimize the prologue of variadic argument functions with respect to usage of those arguments.NOTE: In Ubuntu 14.10 and later versions, -fstack-protector-strong is enabled by default for C, C++, ObjC, ObjC++, if none of
cc -fstdarg-opt ...
-fno-stack-protector
-nostdlib nor -ffreestanding are found.
cc -fno-stack-protector ...
-fsection-anchors
Try to reduce the number of symbolic address calculations by using shared "anchor" symbols to address nearby objects. Thistransformation can help to reduce the number of GOT entries and GOT accesses on some targets.For example, the implementation of the following function "foo":static int a, b, c;int foo (void) { return a + b + c; }usually calculates the addresses of all three variables, but if you compile it with -fsection-anchors, it accesses the variablesfrom a common anchor point instead. The effect is similar to the following pseudocode (which isn't valid C):int foo (void){register int *xr = &x;return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];}Not all targets support this option.
cc -fsection-anchors ...
--param
In some places, GCC uses various constants to control the amount of optimization that is done. For example, GCC does not inlinefunctions that contain more than a certain number of instructions. You can control some of these constants on the command lineusing the --param option.The names of specific parameters, and the meaning of the values, are tied to the internals of the compiler, and are subject tochange without notice in future releases.In each case, the value is an integer. The allowable choices for name are:predictable-branch-outcomeWhen branch is predicted to be taken with probability lower than this threshold (in percent), then it is considered wellpredictable. The default is 10.max-rtl-if-conversion-insnsRTL if-conversion tries to remove conditional branches around a block and replace them with conditionally executedinstructions. This parameter gives the maximum number of instructions in a block which should be considered for if-conversion. The default is 10, though the compiler will also use other heuristics to decide whether if-conversion is likelyto be profitable.max-rtl-if-conversion-predictable-costmax-rtl-if-conversion-unpredictable-costRTL if-conversion will try to remove conditional branches around a block and replace them with conditionally executedinstructions. These parameters give the maximum permissible cost for the sequence that would be generated by if-conversiondepending on whether the branch is statically determined to be predictable or not. The units for this parameter are the sameas those for the GCC internal seq_cost metric. The compiler will try to provide a reasonable default for this parameterusing the BRANCH_COST target macro.max-crossjump-edgesThe maximum number of incoming edges to consider for cross-jumping. The algorithm used by -fcrossjumping is O(N^2) in thenumber of edges incoming to each block. Increasing values mean more aggressive optimization, making the compilation timeincrease with probably small improvement in executable size.min-crossjump-insnsThe minimum number of instructions that must be matched at the end of two blocks before cross-jumping is performed on them.This value is ignored in the case where all instructions in the block being cross-jumped from are matched. The default valueis 5.max-grow-copy-bb-insnsThe maximum code size expansion factor when copying basic blocks instead of jumping. The expansion is relative to a jumpinstruction. The default value is 8.max-goto-duplication-insnsThe maximum number of instructions to duplicate to a block that jumps to a computed goto. To avoid O(N^2) behavior in anumber of passes, GCC factors computed gotos early in the compilation process, and unfactors them as late as possible. Onlycomputed jumps at the end of a basic blocks with no more than max-goto-duplication-insns are unfactored. The default valueis 8.max-delay-slot-insn-searchThe maximum number of instructions to consider when looking for an instruction to fill a delay slot. If more than thisarbitrary number of instructions are searched, the time savings from filling the delay slot are minimal, so stop searching.Increasing values mean more aggressive optimization, making the compilation time increase with probably small improvement inexecution time.max-delay-slot-live-searchWhen trying to fill delay slots, the maximum number of instructions to consider when searching for a block with valid liveregister information. Increasing this arbitrarily chosen value means more aggressive optimization, increasing thecompilation time. This parameter should be removed when the delay slot code is rewritten to maintain the control-flow graph.max-gcse-memoryThe approximate maximum amount of memory that can be allocated in order to perform the global common subexpressionelimination optimization. If more memory than specified is required, the optimization is not done.max-gcse-insertion-ratioIf the ratio of expression insertions to deletions is larger than this value for any expression, then RTL PRE inserts orremoves the expression and thus leaves partially redundant computations in the instruction stream. The default value is 20.max-pending-list-lengthThe maximum number of pending dependencies scheduling allows before flushing the current state and starting over. Largefunctions with few branches or calls can create excessively large lists which needlessly consume memory and resources.max-modulo-backtrack-attemptsThe maximum number of backtrack attempts the scheduler should make when modulo scheduling a loop. Larger values canexponentially increase compilation time.max-inline-insns-singleSeveral parameters control the tree inliner used in GCC. This number sets the maximum number of instructions (counted inGCC's internal representation) in a single function that the tree inliner considers for inlining. This only affectsfunctions declared inline and methods implemented in a class declaration (C++). The default value is 400.max-inline-insns-autoWhen you use -finline-functions (included in -O3), a lot of functions that would otherwise not be considered for inlining bythe compiler are investigated. To those functions, a different (more restrictive) limit compared to functions declaredinline can be applied. The default value is 40.inline-min-speedupWhen estimated performance improvement of caller + callee runtime exceeds this threshold (in percent), the function can beinlined regardless of the limit on --param max-inline-insns-single and --param max-inline-insns-auto.large-function-insnsThe limit specifying really large functions. For functions larger than this limit after inlining, inlining is constrained by
cc --param ...
-fsanitize=address
asan-stackEnable buffer overflow detection for stack objects. This kind of protection is enabled by default when using
cc -fsanitize=address ...
-fsanitize=address.
asan-instrument-readsEnable buffer overflow detection for memory reads. This kind of protection is enabled by default when using
cc -fsanitize=address. ...
-fprofile-arcs
Add code so that program flow arcs are instrumented. During execution the program records how many times each branch and call isexecuted and how many times it is taken or returns. On targets that support constructors with priority support, profilingproperly handles constructors, destructors and C++ constructors (and destructors) of classes which are used as a type of a globalvariable.When the compiled program exits it saves this data to a file called auxname.gcda for each source file. The data may be used forprofile-directed optimizations (-fbranch-probabilities), or for test coverage analysis (-ftest-coverage). Each object file'sauxname is generated from the name of the output file, if explicitly specified and it is not the final executable, otherwise itis the basename of the source file. In both cases any suffix is removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcdafor output file specified as -o dir/foo.o).
cc -fprofile-arcs ...
--coverage
This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for -fprofile-arcs
cc --coverage ...
-ftest-coverage
Produce a notes file that the gcov code-coverage utility can use to show program coverage. Each source file's note file iscalled auxname.gcno. Refer to the -fprofile-arcs option above for a description of auxname and instructions on how to generatetest coverage data. Coverage data matches the source files more closely if you do not optimize.
cc -ftest-coverage ...
-fprofile-dir
Set the directory to search for the profile data files in to path. This option affects only the profile data generated by
cc -fprofile-dir ...
-fprofile-generate
Both absolute and relative paths can be used. By default, GCC uses the current directory as path, thus the profile data fileappears in the same directory as the object file.
cc -fprofile-generate ...
-fprofile-update
Alter the update method for an application instrumented for profile feedback based optimization. The method argument should beone of single, atomic or prefer-atomic. The first one is useful for single-threaded applications, while the second one preventsprofile corruption by emitting thread-safe code.Warning: When an application does not properly join all threads (or creates an detached thread), a profile file can be stillcorrupted.Using prefer-atomic would be transformed either to atomic, when supported by a target, or to single otherwise. The GCC driverautomatically selects prefer-atomic when -pthread is present in the command line.
cc -fprofile-update ...
-fno-sanitize
This option disables all previously enabled sanitizers. -fsanitize=all is not allowed, as some sanitizers cannot be usedtogether.
cc -fno-sanitize ...
-fasan-shadow-offset
This option forces GCC to use custom shadow offset in AddressSanitizer checks. It is useful for experimenting with differentshadow memory layouts in Kernel AddressSanitizer.
cc -fasan-shadow-offset ...
-fsanitize-sections
Sanitize global variables in selected user-defined sections. si may contain wildcards.
cc -fsanitize-sections ...
-fsanitize-address-use-after-scope
Enable sanitization of local variables to detect use-after-scope bugs. The option sets -fstack-reuse to none.
cc -fsanitize-address-use-after-scope ...
-fsanitize-coverage
Enable coverage-guided fuzzing code instrumentation. Inserts a call to "__sanitizer_cov_trace_pc" into every basic block.
cc -fsanitize-coverage ...
-fbounds-check
For front ends that support it, generate additional code to check that indices used to access arrays are within the declaredrange. This is currently only supported by the Fortran front end, where this option defaults to false.
cc -fbounds-check ...
-fcheck-pointer-bounds
Enable Pointer Bounds Checker instrumentation. Each memory reference is instrumented with checks of the pointer used for memoryaccess against bounds associated with that pointer.Currently there is only an implementation for Intel MPX available, thus x86 GNU/Linux target and -mmpx are required to enablethis feature. MPX-based instrumentation requires a runtime library to enable MPX in hardware and handle bounds violationsignals. By default when -fcheck-pointer-bounds and -mmpx options are used to link a program, the GCC driver links against thelibmpx and libmpxwrappers libraries. Bounds checking on calls to dynamic libraries requires a linker with -z bndplt support; ifGCC was configured with a linker without support for this option (including the Gold linker and older versions of ld), a warningis given if you link with -mmpx without also specifying -static, since the overall effectiveness of the bounds checkingprotection is reduced. See also -static-libmpxwrappers.MPX-based instrumentation may be used for debugging and also may be included in production code to increase program security.Depending on usage, you may have different requirements for the runtime library. The current version of the MPX runtime libraryis more oriented for use as a debugging tool. MPX runtime library usage implies -lpthread. See also -static-libmpx. Theruntime library behavior can be influenced using various CHKP_RT_* environment variables. See<https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler> for more details.Generated instrumentation may be controlled by various -fchkp-* options and by the "bnd_variable_size" structure field attributeand "bnd_legacy", and "bnd_instrument" function attributes. GCC also provides a number of built-in functions for controlling thePointer Bounds Checker.
cc -fcheck-pointer-bounds ...
-fchkp-check-incomplete-type
Generate pointer bounds checks for variables with incomplete type. Enabled by default.
cc -fchkp-check-incomplete-type ...
-fchkp-narrow-bounds
Controls bounds used by Pointer Bounds Checker for pointers to object fields. If narrowing is enabled then field bounds areused. Otherwise object bounds are used. See also -fchkp-narrow-to-innermost-array and -fchkp-first-field-has-own-bounds.Enabled by default.
cc -fchkp-narrow-bounds ...
-fchkp-flexible-struct-trailing-arrays
Forces Pointer Bounds Checker to treat all trailing arrays in structures as possibly flexible. By default only array fields withzero length or that are marked with attribute bnd_variable_size are treated as flexible.
cc -fchkp-flexible-struct-trailing-arrays ...
-fchkp-narrow-to-innermost-array
Forces Pointer Bounds Checker to use bounds of the innermost arrays in case of nested static array access. By default thisoption is disabled and bounds of the outermost array are used.
cc -fchkp-narrow-to-innermost-array ...
-fchkp-optimize
Enables Pointer Bounds Checker optimizations. Enabled by default at optimization levels -O, -O2, -O3.
cc -fchkp-optimize ...
-fchkp-use-nochk-string-functions
Enables use of *_nochk versions of string functions (not checking bounds) by Pointer Bounds Checker. Disabled by default.
cc -fchkp-use-nochk-string-functions ...
-fchkp-use-static-bounds
Allow Pointer Bounds Checker to generate static bounds holding bounds of static variables. Enabled by default.
cc -fchkp-use-static-bounds ...
-fchkp-use-static-const-bounds
Use statically-initialized bounds for constant bounds instead of generating them each time they are required. By default enabledwhen -fchkp-use-static-bounds is enabled.
cc -fchkp-use-static-const-bounds ...
-fchkp-check-read
Instructs Pointer Bounds Checker to generate checks for all read accesses to memory. Enabled by default.
cc -fchkp-check-read ...
-fchkp-check-write
Instructs Pointer Bounds Checker to generate checks for all write accesses to memory. Enabled by default.
cc -fchkp-check-write ...
-fchkp-store-bounds
Instructs Pointer Bounds Checker to generate bounds stores for pointer writes. Enabled by default.
cc -fchkp-store-bounds ...
-fchkp-instrument-marked-only
Instructs Pointer Bounds Checker to instrument only functions marked with the "bnd_instrument" attribute. Disabled by default.
cc -fchkp-instrument-marked-only ...
-fchkp-use-wrappers
Allows Pointer Bounds Checker to replace calls to built-in functions with calls to wrapper functions. When -fchkp-use-wrappersis used to link a program, the GCC driver automatically links against libmpxwrappers. See also -static-libmpxwrappers. Enabledby default.
cc -fchkp-use-wrappers ...
-fstack-protector-all
Like -fstack-protector except that all functions are protected.
cc -fstack-protector-all ...
-fstack-protector-strong
Like -fstack-protector but includes additional functions to be protected --- those that have local array definitions, or havereferences to local frame addresses.
cc -fstack-protector-strong ...
-fstack-protector-explicit
Like -fstack-protector but only protects those functions which have the "stack_protect" attribute.
cc -fstack-protector-explicit ...
-fstack-check
Generate code to verify that you do not go beyond the boundary of the stack. You should specify this flag if you are running inan environment with multiple threads, but you only rarely need to specify it in a single-threaded environment since stackoverflow is automatically detected on nearly all systems if there is only one stack.Note that this switch does not actually cause checking to be done; the operating system or the language runtime must do that.The switch causes generation of code to ensure that they see the stack being extended.You can additionally specify a string parameter: no means no checking, generic means force the use of old-style checking,specific means use the best checking method and is equivalent to bare -fstack-check.Old-style checking is a generic mechanism that requires no specific target support in the compiler but comes with the followingdrawbacks:1. Modified allocation strategy for large objects: they are always allocated dynamically if their size exceeds a fixedthreshold.2. Fixed limit on the size of the static frame of functions: when it is topped by a particular function, stack checking is notreliable and a warning is issued by the compiler.3. Inefficiency: because of both the modified allocation strategy and the generic implementation, code performance is hampered.Note that old-style stack checking is also the fallback method for specific if no target support has been added in the compiler.
cc -fstack-check ...
-fno-stack-limit
Generate code to ensure that the stack does not grow beyond a certain value, either the value of a register or the address of asymbol. If a larger stack is required, a signal is raised at run time. For most targets, the signal is raised before the stackoverruns the boundary, so it is possible to catch the signal without taking special precautions.For instance, if the stack starts at absolute address 0x80000000 and grows downwards, you can use the flags
cc -fno-stack-limit ...
-fsplit-stack
Generate code to automatically split the stack before it overflows. The resulting program has a discontiguous stack which canonly overflow if the program is unable to allocate any more memory. This is most useful when running threaded programs, as it isno longer necessary to calculate a good stack size to use for each thread. This is currently only implemented for the x86targets running GNU/Linux.When code compiled with -fsplit-stack calls code compiled without -fsplit-stack, there may not be much stack space available forthe latter code to run. If compiling all code, including library code, with -fsplit-stack is not an option, then the linker canfix up these calls so that the code compiled without -fsplit-stack always has a large stack. Support for this is implemented inthe gold linker in GNU binutils release 2.21 and later.
cc -fsplit-stack ...
-fvtable-verify
This option is only available when compiling C++ code. It turns on (or off, if using -fvtable-verify=none) the security featurethat verifies at run time, for every virtual call, that the vtable pointer through which the call is made is valid for the typeof the object, and has not been corrupted or overwritten. If an invalid vtable pointer is detected at run time, an error isreported and execution of the program is immediately halted.This option causes run-time data structures to be built at program startup, which are used for verifying the vtable pointers.The options std and preinit control the timing of when these data structures are built. In both cases the data structures arebuilt before execution reaches "main". Using -fvtable-verify=std causes the data structures to be built after shared librarieshave been loaded and initialized. -fvtable-verify=preinit causes them to be built before shared libraries have been loaded andinitialized.If this option appears multiple times in the command line with different values specified, none takes highest priority over bothstd and preinit; preinit takes priority over std.
cc -fvtable-verify ...
-fvtv-debug
When used in conjunction with -fvtable-verify=std or -fvtable-verify=preinit, causes debug versions of the runtime functions forthe vtable verification feature to be called. This flag also causes the compiler to log information about which vtable pointersit finds for each class. This information is written to a file named vtv_set_ptr_data.log in the directory named by theenvironment variable VTV_LOGS_DIR if that is defined or the current working directory otherwise.Note: This feature appends data to the log file. If you want a fresh log file, be sure to delete any existing one.
cc -fvtv-debug ...
-finstrument-functions
Generate instrumentation calls for entry and exit to functions. Just after function entry and just before function exit, thefollowing profiling functions are called with the address of the current function and its call site. (On some platforms,"__builtin_return_address" does not work beyond the current function, so the call site information may not be available to theprofiling functions otherwise.)void __cyg_profile_func_enter (void *this_fn,void *call_site);void __cyg_profile_func_exit (void *this_fn,void *call_site);The first argument is the address of the start of the current function, which may be looked up exactly in the symbol table.This instrumentation is also done for functions expanded inline in other functions. The profiling calls indicate where,conceptually, the inline function is entered and exited. This means that addressable versions of such functions must beavailable. If all your uses of a function are expanded inline, this may mean an additional expansion of code size. If you use"extern inline" in your C code, an addressable version of such functions must be provided. (This is normally the case anyway,but if you get lucky and the optimizer always expands the functions inline, you might have gotten away without providing staticcopies.)A function may be given the attribute "no_instrument_function", in which case this instrumentation is not done. This can beused, for example, for the profiling functions listed above, high-priority interrupt routines, and any functions from which theprofiling functions cannot safely be called (perhaps signal handlers, if the profiling routines generate output or allocatememory).
cc -finstrument-functions ...
-finstrument-functions-exclude-function-list
This is similar to -finstrument-functions-exclude-file-list, but this option sets the list of function names to be excluded frominstrumentation. The function name to be matched is its user-visible name, such as "vector<int> blah(const vector<int> &)", notthe internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The match is done on substrings: if the sym parameter is asubstring of the function name, it is considered to be a match. For C99 and C++ extended identifiers, the function name must begiven in UTF-8, not using universal character names.Options Controlling the PreprocessorThese options control the C preprocessor, which is run on each C source file before actual compilation.If you use the -E option, nothing is done except preprocessing. Some of these options make sense only together with -E because theycause the preprocessor output to be unsuitable for actual compilation.In addition to the options listed here, there are a number of options to control search paths for include files documented inDirectory Options. Options to control preprocessor diagnostics are listed in Warning Options.
cc -finstrument-functions-exclude-function-list ...
-D
Predefine name as a macro, with definition 1.
cc -D ...
-U
Cancel any previous definition of name, either built in or provided with a -D option.
cc -U ...
-include
Process file as if "#include "file"" appeared as the first line of the primary source file. However, the first directorysearched for file is the preprocessor's working directory instead of the directory containing the main source file. If not foundthere, it is searched for in the remainder of the "#include "..."" search chain as normal.If multiple -include options are given, the files are included in the order they appear on the command line.
cc -include ...
-imacros
Exactly like -include, except that any output produced by scanning file is thrown away. Macros it defines remain defined. Thisallows you to acquire all the macros from a header without also processing its declarations.All files specified by -imacros are processed before all files specified by -include.
cc -imacros ...
-undef
Do not predefine any system-specific or GCC-specific macros. The standard predefined macros remain defined.
cc -undef ...
-MF
When used with -M or -MM, specifies a file to write the dependencies to. If no -MF switch is given the preprocessor sends therules to the same place it would send preprocessed output.When used with the driver options -MD or -MMD, -MF overrides the default dependency output file.
cc -MF ...
-MT
Change the target of the rule emitted by dependency generation. By default CPP takes the name of the main input file, deletesany directory components and any file suffix such as .c, and appends the platform's usual object suffix. The result is thetarget.An -MT option sets the target to be exactly the string you specify. If you want multiple targets, you can specify them as asingle argument to -MT, or use multiple -MT options.For example, -MT '$(objpfx)foo.o' might give$(objpfx)foo.o: foo.c
cc -MT ...
-MQ
Same as -MT, but it quotes any characters which are special to Make. -MQ '$(objpfx)foo.o' gives$$(objpfx)foo.o: foo.cThe default target is automatically quoted, as if it were given with -MQ.
cc -MQ ...
-MD
given. If it is, the driver uses its argument but with a suffix of .d, otherwise it takes the name of the input file, removesany directory components and suffix, and applies a .d suffix.If -MD is used in conjunction with -E, any -o switch is understood to specify the dependency output file, but if used without -E,each -o is understood to specify a target object file.Since -E is not implied, -MD can be used to generate a dependency output file as a side-effect of the compilation process.
cc -MD ...
-MMD
Like -MD except mention only user header files, not system header files.
cc -MMD ...
-fpreprocessed
Indicate to the preprocessor that the input file has already been preprocessed. This suppresses things like macro expansion,trigraph conversion, escaped newline splicing, and processing of most directives. The preprocessor still recognizes and removescomments, so that you can pass a file preprocessed with -C to the compiler without problems. In this mode the integratedpreprocessor is little more than a tokenizer for the front ends.
cc -fpreprocessed ...
-fdirectives-only
When preprocessing, handle directives, but do not expand macros.The option's behavior depends on the -E and -fpreprocessed options.With -E, preprocessing is limited to the handling of directives such as "#define", "#ifdef", and "#error". Other preprocessoroperations, such as macro expansion and trigraph conversion are not performed. In addition, the -dD option is implicitlyenabled.With -fpreprocessed, predefinition of command line and most builtin macros is disabled. Macros such as "__LINE__", which arecontextually dependent, are handled normally. This enables compilation of files previously preprocessed with "-E
cc -fdirectives-only ...
-fdirectives-only".
With both -E and -fpreprocessed, the rules for -fpreprocessed take precedence. This enables full preprocessing of filespreviously preprocessed with "-E -fdirectives-only".
cc -fdirectives-only". ...
-fextended-identifiers
Accept universal character names in identifiers. This option is enabled by default for C99 (and later C standard versions) andC++.
cc -fextended-identifiers ...
-fno-canonical-system-headers
When preprocessing, do not shorten system header paths with canonicalization.
cc -fno-canonical-system-headers ...
-ftabstop
Set the distance between tab stops. This helps the preprocessor report correct column numbers in warnings or errors, even iftabs appear on the line. If the value is less than 1 or greater than 100, the option is ignored. The default is 8.
cc -ftabstop ...
-ftrack-macro-expansion[
Track locations of tokens across macro expansions. This allows the compiler to emit diagnostic about the current macro expansionstack when a compilation error occurs in a macro expansion. Using this option makes the preprocessor and the compiler consumemore memory. The level parameter can be used to choose the level of precision of token location tracking thus decreasing thememory consumption if necessary. Value 0 of level de-activates this option. Value 1 tracks tokens locations in a degraded modefor the sake of minimal memory overhead. In this mode all tokens resulting from the expansion of an argument of a function-likemacro have the same location. Value 2 tracks tokens locations completely. This value is the most memory hungry. When this optionis given no argument, the default parameter value is 2.Note that "-ftrack-macro-expansion=2" is activated by default.
cc -ftrack-macro-expansion[ ...
-fexec-charset
Set the execution character set, used for string and character constants. The default is UTF-8. charset can be any encodingsupported by the system's "iconv" library routine.
cc -fexec-charset ...
-fwide-exec-charset
Set the wide execution character set, used for wide string and character constants. The default is UTF-32 or UTF-16, whichevercorresponds to the width of "wchar_t". As with -fexec-charset, charset can be any encoding supported by the system's "iconv"library routine; however, you will have problems with encodings that do not fit exactly in "wchar_t".
cc -fwide-exec-charset ...
-finput-charset
Set the input character set, used for translation from the character set of the input file to the source character set used byGCC. If the locale does not specify, or GCC cannot get this information from the locale, the default is UTF-8. This can beoverridden by either the locale or this command-line option. Currently the command-line option takes precedence if there's aconflict. charset can be any encoding supported by the system's "iconv" library routine.
cc -finput-charset ...
-fpch-preprocess
This option allows use of a precompiled header together with -E. It inserts a special "#pragma", "#pragma GCC pch_preprocess"filename"" in the output to mark the place where the precompiled header was found, and its filename. When -fpreprocessed is inuse, GCC recognizes this "#pragma" and loads the PCH.This option is off by default, because the resulting preprocessed output is only really suitable as input to GCC. It is switchedon by -save-temps.You should not write this "#pragma" in your own code, but it is safe to edit the filename if the PCH file is available in adifferent location. The filename may be absolute or it may be relative to GCC's current directory.
cc -fpch-preprocess ...
-A
Make an assertion with the predicate predicate and answer answer. This form is preferred to the older form -A predicate(answer),which is still supported, because it does not use shell special characters.
cc -A ...
-traditional-cpp
Try to imitate the behavior of pre-standard C preprocessors, as opposed to ISO C preprocessors. See the GNU CPP manual fordetails.Note that GCC does not otherwise attempt to emulate a pre-standard C compiler, and these options are only supported with the -Eswitch, or when invoking CPP explicitly.
cc -traditional-cpp ...
-trigraphs
Support ISO C trigraphs. These are three-character sequences, all starting with ??, that are defined by ISO C to stand forsingle characters. For example, ??/ stands for \, so '??/n' is a character constant for a newline.The nine trigraphs and their replacements areTrigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-Replacement: [ ] { } # \ ^ | ~By default, GCC ignores trigraphs, but in standard-conforming modes it converts them. See the -std and -ansi options.
cc -trigraphs ...
-dletters
Says to make debugging dumps during compilation as specified by letters. The flags documented here are those relevant to thepreprocessor. Other letters are interpreted by the compiler proper, or reserved for future versions of GCC, and so are silentlyignored. If you specify letters whose behavior conflicts, the result is undefined.
cc -dletters ...
-dN
but emit only the macro names not their expansions.
cc -dN ...
-dI
Output #include directives in addition to the result of preprocessing.
cc -dI ...
-fdebug-cpp
This option is only useful for debugging GCC. When used from CPP or with -E, it dumps debugging information about location maps.Every token in the output is preceded by the dump of the map its location belongs to.When used from GCC without -E, this option has no effect.
cc -fdebug-cpp ...
-Wp,option
You can use -Wp,option to bypass the compiler driver and pass option directly through to the preprocessor. If option containscommas, it is split into multiple options at the commas. However, many options are modified, translated or interpreted by thecompiler driver before being passed to the preprocessor, and -Wp forcibly bypasses this phase. The preprocessor's directinterface is undocumented and subject to change, so whenever possible you should avoid using -Wp and let the driver handle theoptions instead.
cc -Wp,option ...
-Xpreprocessor
Pass option as an option to the preprocessor. You can use this to supply system-specific preprocessor options that GCC does notrecognize.If you want to pass an option that takes an argument, you must use -Xpreprocessor twice, once for the option and once for theargument.
cc -Xpreprocessor ...
-no-integrated-cpp
Perform preprocessing as a separate pass before compilation. By default, GCC performs preprocessing as an integrated part ofinput tokenization and parsing. If this option is provided, the appropriate language front end (cc1, cc1plus, or cc1obj for C,C++, and Objective-C, respectively) is instead invoked twice, once for preprocessing only and once for actual compilation of thepreprocessed input. This option may be useful in conjunction with the -B or -wrapper options to specify an alternatepreprocessor or perform additional processing of the program source between normal preprocessing and compilation.Passing Options to the AssemblerYou can pass options to the assembler.
cc -no-integrated-cpp ...
-Xassembler
Pass option as an option to the assembler. You can use this to supply system-specific assembler options that GCC does notrecognize.If you want to pass an option that takes an argument, you must use -Xassembler twice, once for the option and once for theargument.Options for LinkingThese options come into play when the compiler links object files into an executable output file. They are meaningless if thecompiler is not doing a link step.object-file-nameA file name that does not end in a special recognized suffix is considered to name an object file or library. (Object files aredistinguished from libraries by the linker according to the file contents.) If linking is done, these object files are used asinput to the linker.
cc -Xassembler ...
-E
If any of these options is used, then the linker is not run, and object file names should not be used as arguments.
cc -E ...
-fuse-ld
Use the bfd linker instead of the default linker.
cc -fuse-ld ...
-l
Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIXcompliance and is not recommended.)It makes a difference where in the command you write this option; the linker searches and processes libraries and object files inthe order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers tofunctions in z, those functions may not be loaded.The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker thenuses this file as if it had been specified precisely by name.The directories searched include several standard system directories plus any that you specify with -L.Normally the files found this way are library files---archive files whose members are object files. The linker handles anarchive file by scanning through it for members which define symbols that have so far been referenced but not defined. But ifthe file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -loption and specifying a file name is that -l surrounds library with lib and .a and searches several directories.
cc -l ...
-lobjc
You need this special case of the -l option in order to link an Objective-C or Objective-C++ program.
cc -lobjc ...
-nostartfiles
Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or
cc -nostartfiles ...
-nodefaultlibs
Do not use the standard system libraries when linking. Only the libraries you specify are passed to the linker, and optionsspecifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, are ignored. The standard startup filesare used normally, unless -nostartfiles is used.The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove". These entries are usually resolved by entries inlibc. These entry points should be supplied through some other mechanism when this option is specified.
cc -nodefaultlibs ...
-nostdlib
Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify arepassed to the linker, and options specifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, areignored.The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove". These entries are usually resolved by entries inlibc. These entry points should be supplied through some other mechanism when this option is specified.One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a, a library of internal subroutines which GCCuses to overcome shortcomings of particular machines, or special needs for some languages.In most cases, you need libgcc.a even when you want to avoid other standard libraries. In other words, when you specify
cc -nostdlib ...
-pie
Produce a position independent executable on targets that support it. For predictable results, you must also specify the sameset of options used for compilation (-fpie, -fPIE, or model suboptions) when you specify this linker option.
cc -pie ...
-no-pie
Don't produce a position independent executable.
cc -no-pie ...
-rdynamic
Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, notonly used ones, to the dynamic symbol table. This option is needed for some uses of "dlopen" or to allow obtaining backtracesfrom within a program.
cc -rdynamic ...
-s
Remove all symbol table and relocation information from the executable.
cc -s ...
-static
On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has noeffect.
cc -static ...
-shared
Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option.For predictable results, you must also specify the same set of options used for compilation (-fpic, -fPIC, or model suboptions)when you specify this linker option.[1]
cc -shared ...
-static-libasan
When the -fsanitize=address option is used to link a program, the GCC driver automatically links against libasan. If libasan isavailable as a shared library, and the -static option is not used, then this links against the shared version of libasan. The
cc -static-libasan ...
-static-libtsan
When the -fsanitize=thread option is used to link a program, the GCC driver automatically links against libtsan. If libtsan isavailable as a shared library, and the -static option is not used, then this links against the shared version of libtsan. The
cc -static-libtsan ...
-static-liblsan
When the -fsanitize=leak option is used to link a program, the GCC driver automatically links against liblsan. If liblsan isavailable as a shared library, and the -static option is not used, then this links against the shared version of liblsan. The
cc -static-liblsan ...
-static-libubsan
When the -fsanitize=undefined option is used to link a program, the GCC driver automatically links against libubsan. If libubsanis available as a shared library, and the -static option is not used, then this links against the shared version of libubsan.The -static-libubsan option directs the GCC driver to link libubsan statically, without necessarily linking other librariesstatically.
cc -static-libubsan ...
-static-libmpx
When the -fcheck-pointer bounds and -mmpx options are used to link a program, the GCC driver automatically links against libmpx.If libmpx is available as a shared library, and the -static option is not used, then this links against the shared version oflibmpx. The -static-libmpx option directs the GCC driver to link libmpx statically, without necessarily linking other librariesstatically.
cc -static-libmpx ...
-static-libstdc++
When the g++ program is used to link a C++ program, it normally automatically links against libstdc++. If libstdc++ is availableas a shared library, and the -static option is not used, then this links against the shared version of libstdc++. That isnormally fine. However, it is sometimes useful to freeze the version of libstdc++ used by the program without going all the wayto a fully static link. The -static-libstdc++ option directs the g++ driver to link libstdc++ statically, without necessarilylinking other libraries statically.
cc -static-libstdc++ ...
-symbolic
Bind references to global symbols when building a shared object. Warn about any unresolved references (unless overridden by thelink editor option -Xlinker -z -Xlinker defs). Only a few systems support this option.
cc -symbolic ...
-T
Use script as the linker script. This option is supported by most systems using the GNU linker. On some targets, such as bare-board targets without an operating system, the -T option may be required when linking to avoid references to undefined symbols.
cc -T ...
-Xlinker
Pass option as an option to the linker. You can use this to supply system-specific linker options that GCC does not recognize.If you want to pass an option that takes a separate argument, you must use -Xlinker twice, once for the option and once for theargument. For example, to pass -assert definitions, you must write -Xlinker -assert -Xlinker definitions. It does not work towrite -Xlinker "-assert definitions", because this passes the entire string as a single argument, which is not what the linkerexpects.When using the GNU linker, it is usually more convenient to pass arguments to linker options using the option=value syntax thanas separate arguments. For example, you can specify -Xlinker -Map=output.map rather than -Xlinker -Map -Xlinker output.map.Other linkers may not support this syntax for command-line options.
cc -Xlinker ...
-Wl,option
Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can usethis syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. Whenusing the GNU linker, you can also get the same effect with -Wl,-Map=output.map.NOTE: In Ubuntu 8.10 and later versions, for LDFLAGS, the option -Wl,-z,relro is used. To disable, use -Wl,-z,norelro.
cc -Wl,option ...
-u
Pretend the symbol symbol is undefined, to force linking of library modules to define it. You can use -u multiple times withdifferent symbols to force loading of additional library modules.
cc -u ...
-idirafter
Add the directory dir to the list of directories to be searched for header files during preprocessing. If dir begins with =,then the = is replaced by the sysroot prefix; see --sysroot and -isysroot.Directories specified with -iquote apply only to the quote form of the directive, "#include "file"". Directories specified with
cc -idirafter ...
-I
You can specify any number or combination of these options on the command line to search for header files in several directories.The lookup order is as follows:1. For the quote form of the include directive, the directory of the current file is searched first.2. For the quote form of the include directive, the directories specified by -iquote options are searched in left-to-rightorder, as they appear on the command line.3. Directories specified with -I options are scanned in left-to-right order.4. Directories specified with -isystem options are scanned in left-to-right order.5. Standard system directories are scanned.6. Directories specified with -idirafter options are scanned in left-to-right order.You can use -I to override a system header file, substituting your own version, since these directories are searched before thestandard system header file directories. However, you should not use this option to add directories that contain vendor-suppliedsystem header files; use -isystem for that.The -isystem and -idirafter options also mark the directory as a system directory, so that it gets the same special treatmentthat is applied to the standard system directories.If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option isignored. The directory is still searched but as a system directory at its normal position in the system include chain. This isto ensure that GCC's procedure to fix buggy system headers and the ordering for the "#include_next" directive are notinadvertently changed. If you really need to change the search order for system directories, use the -nostdinc and/or -isystemoptions.
cc -I ...
-iprefix
Specify prefix as the prefix for subsequent -iwithprefix options. If the prefix represents a directory, you should include thefinal /.
cc -iprefix ...
-iwithprefixbefore
Append dir to the prefix specified previously with -iprefix, and add the resulting directory to the include search path.
cc -iwithprefixbefore ...
-isysroot
This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to bothheader files and libraries). See the --sysroot option for more information.
cc -isysroot ...
-imultilib
Use dir as a subdirectory of the directory containing target-specific C++ headers.
cc -imultilib ...
-nostdinc
Do not search the standard system directories for header files. Only the directories explicitly specified with -I, -iquote,
cc -nostdinc ...
-iplugindir
Set the directory to search for plugins that are passed by -fplugin=name instead of -fplugin=path/name.so. This option is notmeant to be used by the user, but only passed by the driver.
cc -iplugindir ...
-Ldir
Add directory dir to the list of directories to be searched for -l.
cc -Ldir ...
-no-canonical-prefixes
Do not expand any symbolic links, resolve references to /../ or /./, or make the path absolute when generating a relative prefix.
cc -no-canonical-prefixes ...
--no-sysroot-suffix
For some targets, a suffix is added to the root directory specified with --sysroot, depending on the other options used, so thatheaders may for example be found in dir/suffix/usr/include instead of dir/usr/include. This option disables the addition of sucha suffix.Options for Code Generation ConventionsThese machine-independent options control the interface conventions used in code generation.Most of them have both positive and negative forms; the negative form of -ffoo is -fno-foo. In the table below, only one of theforms is listed---the one that is not the default. You can figure out the other form by either removing no- or adding it.
cc --no-sysroot-suffix ...
-fstack-reuse
This option controls stack space reuse for user declared local/auto variables and compiler generated temporaries. reuse_levelcan be all, named_vars, or none. all enables stack reuse for all local variables and temporaries, named_vars enables the reuseonly for user defined local variables with names, and none disables stack reuse completely. The default value is all. The optionis needed when the program extends the lifetime of a scoped local variable or a compiler generated temporary beyond the end pointdefined by the language. When a lifetime of a variable ends, and if the variable lives in memory, the optimizing compiler hasthe freedom to reuse its stack space with other temporaries or scoped local variables whose live range does not overlap with it.Legacy code extending local lifetime is likely to break with the stack reuse optimization.For example,int *p;{int local1;p = &local1;local1 = 10;....}{int local2;local2 = 20;...}if (*p == 10) // out of scope use of local1{}Another example:struct A{A(int k) : i(k), j(k) { }int i;int j;};A *ap;void foo(const A& ar){ap = &ar;}void bar(){foo(A(10)); // temp object's lifetime ends when foo returns{A a(20);....}ap->i+= 10; // ap references out of scope temp whose space// is reused with a. What is the value of ap->i?}The lifetime of a compiler generated temporary is well defined by the C++ standard. When a lifetime of a temporary ends, and ifthe temporary lives in memory, the optimizing compiler has the freedom to reuse its stack space with other temporaries or scopedlocal variables whose live range does not overlap with it. However some of the legacy code relies on the behavior of oldercompilers in which temporaries' stack space is not reused, the aggressive stack reuse can lead to runtime errors. This option isused to control the temporary stack reuse optimization.
cc -fstack-reuse ...
-ftrapv
This option generates traps for signed overflow on addition, subtraction, multiplication operations. The options -ftrapv and
cc -ftrapv ...
-fwrapv
This option instructs the compiler to assume that signed arithmetic overflow of addition, subtraction and multiplication wrapsaround using twos-complement representation. This flag enables some optimizations and disables others. The options -ftrapv and
cc -fwrapv ...
-fexceptions
Enable exception handling. Generates extra code needed to propagate exceptions. For some targets, this implies GCC generatesframe unwind information for all functions, which can produce significant data size overhead, although it does not affectexecution. If you do not specify this option, GCC enables it by default for languages like C++ that normally require exceptionhandling, and disables it for languages like C that do not normally require it. However, you may need to enable this option whencompiling C code that needs to interoperate properly with exception handlers written in C++. You may also wish to disable thisoption if you are compiling older C++ programs that don't use exception handling.
cc -fexceptions ...
-fnon-call-exceptions
Generate code that allows trapping instructions to throw exceptions. Note that this requires platform-specific runtime supportthat does not exist everywhere. Moreover, it only allows trapping instructions to throw exceptions, i.e. memory references orfloating-point instructions. It does not allow exceptions to be thrown from arbitrary signal handlers such as "SIGALRM".
cc -fnon-call-exceptions ...
-fdelete-dead-exceptions
Consider that instructions that may throw exceptions but don't otherwise contribute to the execution of the program can beoptimized away. This option is enabled by default for the Ada front end, as permitted by the Ada language specification.Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
cc -fdelete-dead-exceptions ...
-funwind-tables
Similar to -fexceptions, except that it just generates any needed static data, but does not affect the generated code in anyother way. You normally do not need to enable this option; instead, a language processor that needs this handling enables it onyour behalf.
cc -funwind-tables ...
-fno-gnu-unique
On systems with recent GNU assembler and C library, the C++ compiler uses the "STB_GNU_UNIQUE" binding to make sure thatdefinitions of template static data members and static local variables in inline functions are unique even in the presence of"RTLD_LOCAL"; this is necessary to avoid problems with a library used by two different "RTLD_LOCAL" plugins depending on adefinition in one of them and therefore disagreeing with the other one about the binding of the symbol. But this causes"dlclose" to be ignored for affected DSOs; if your program relies on reinitialization of a DSO via "dlclose" and "dlopen", youcan use -fno-gnu-unique.
cc -fno-gnu-unique ...
-fpcc-struct-return
Return "short" "struct" and "union" values in memory like longer ones, rather than in registers. This convention is lessefficient, but it has the advantage of allowing intercallability between GCC-compiled files and files compiled with othercompilers, particularly the Portable C Compiler (pcc).The precise convention for returning structures in memory depends on the target configuration macros.Short structures and unions are those whose size and alignment match that of some integer type.Warning: code compiled with the -fpcc-struct-return switch is not binary compatible with code compiled with the
cc -fpcc-struct-return ...
-freg-struct-return
switch. Use it to conform to a non-default application binary interface.
cc -freg-struct-return ...
-fpcc-struct-return.
If you specify neither -fpcc-struct-return nor -freg-struct-return, GCC defaults to whichever convention is standard for thetarget. If there is no standard convention, GCC defaults to -fpcc-struct-return, except on targets where GCC is the principalcompiler. In those cases, we can choose the standard, and we chose the more efficient register return alternative.Warning: code compiled with the -freg-struct-return switch is not binary compatible with code compiled with the
cc -fpcc-struct-return. ...
-fshort-enums
Allocate to an "enum" type only as many bytes as it needs for the declared range of possible values. Specifically, the "enum"type is equivalent to the smallest integer type that has enough room.Warning: the -fshort-enums switch causes GCC to generate code that is not binary compatible with code generated without thatswitch. Use it to conform to a non-default application binary interface.
cc -fshort-enums ...
-fshort-wchar
Override the underlying type for "wchar_t" to be "short unsigned int" instead of the default for the target. This option isuseful for building programs to run under WINE.Warning: the -fshort-wchar switch causes GCC to generate code that is not binary compatible with code generated without thatswitch. Use it to conform to a non-default application binary interface.
cc -fshort-wchar ...
-fno-common
In C code, this option controls the placement of global variables defined without an initializer, known as tentative definitionsin the C standard. Tentative definitions are distinct from declarations of a variable with the "extern" keyword, which do notallocate storage.Unix C compilers have traditionally allocated storage for uninitialized global variables in a common block. This allows thelinker to resolve all tentative definitions of the same variable in different compilation units to the same object, or to a non-tentative definition. This is the behavior specified by -fcommon, and is the default for GCC on most targets. On the otherhand, this behavior is not required by ISO C, and on some targets may carry a speed or code size penalty on variable references.The -fno-common option specifies that the compiler should instead place uninitialized global variables in the data section of theobject file. This inhibits the merging of tentative definitions by the linker so you get a multiple-definition error if the samevariable is defined in more than one compilation unit. Compiling with -fno-common is useful on targets for which it providesbetter performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variabledefinitions this way.
cc -fno-common ...
-fno-ident
Ignore the "#ident" directive.
cc -fno-ident ...
-finhibit-size-directive
Don't output a ".size" assembler directive, or anything else that would cause trouble if the function is split in the middle, andthe two halves are placed at locations far apart in memory. This option is used when compiling crtstuff.c; you should not needto use it for anything else.
cc -finhibit-size-directive ...
-fverbose-asm
Put extra commentary information in the generated assembly code to make it more readable. This option is generally only of useto those who actually need to read the generated assembly code (perhaps while debugging the compiler itself).
cc -fverbose-asm ...
-frecord-gcc-switches
This switch causes the command line used to invoke the compiler to be recorded into the object file that is being created. Thisswitch is only implemented on some targets and the exact format of the recording is target and binary file format dependent, butit usually takes the form of a section containing ASCII text. This switch is related to the -fverbose-asm switch, but thatswitch only records information in the assembler output file as comments, so it never reaches the object file. See also
cc -frecord-gcc-switches ...
-grecord-gcc-switches
for another way of storing compiler options into the object file.
cc -grecord-gcc-switches ...
-fPIC
If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on thesize of the global offset table. This option makes a difference on AArch64, m68k, PowerPC and SPARC.Position-independent code requires special support, and therefore works only on certain machines.When this flag is set, the macros "__pic__" and "__PIC__" are defined to 2.
cc -fPIC ...
-fPIE
These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables.Usually these options are used when -pie GCC option is used during linking.
cc -fPIE ...
-fno-plt
Do not use the PLT for external function calls in position-independent code. Instead, load the callee address at call sites fromthe GOT and branch to it. This leads to more efficient code by eliminating PLT stubs and exposing GOT loads to optimizations.On architectures such as 32-bit x86 where PLT stubs expect the GOT pointer in a specific register, this gives more registerallocation freedom to the compiler. Lazy binding requires use of the PLT; with -fno-plt all external symbols are resolved atload time.Alternatively, the function attribute "noplt" can be used to avoid calls through the PLT for specific external functions.In position-dependent code, a few targets also convert calls to functions that are marked to not use the PLT to use the GOTinstead.
cc -fno-plt ...
-fno-jump-tables
Do not use jump tables for switch statements even where it would be more efficient than other code generation strategies. Thisoption is of use in conjunction with -fpic or -fPIC for building code that forms part of a dynamic linker and cannot referencethe address of a jump table. On some targets, jump tables do not require a GOT and this option is not needed.
cc -fno-jump-tables ...
-ffixed-reg
Treat the register named reg as a fixed register; generated code should never refer to it (except perhaps as a stack pointer,frame pointer or in some other fixed role).reg must be the name of a register. The register names accepted are machine-specific and are defined in the "REGISTER_NAMES"macro in the machine description macro file.This flag does not have a negative form, because it specifies a three-way choice.
cc -ffixed-reg ...
-fcall-used-reg
Treat the register named reg as an allocable register that is clobbered by function calls. It may be allocated for temporariesor variables that do not live across a call. Functions compiled this way do not save and restore the register reg.It is an error to use this flag with the frame pointer or stack pointer. Use of this flag for other registers that have fixedpervasive roles in the machine's execution model produces disastrous results.This flag does not have a negative form, because it specifies a three-way choice.
cc -fcall-used-reg ...
-fleading-underscore
This option and its counterpart, -fno-leading-underscore, forcibly change the way C symbols are represented in the object file.One use is to help link with legacy assembly code.Warning: the -fleading-underscore switch causes GCC to generate code that is not binary compatible with code generated withoutthat switch. Use it to conform to a non-default application binary interface. Not all targets provide complete support for thisswitch.
cc -fleading-underscore ...
-ftls-model
Alter the thread-local storage model to be used. The model argument should be one of global-dynamic, local-dynamic, initial-execor local-exec. Note that the choice is subject to optimization: the compiler may use a more efficient model for symbols notvisible outside of the translation unit, or if -fpic is not given on the command line.The default without -fpic is initial-exec; with -fpic the default is global-dynamic.
cc -ftls-model ...
-ftrampolines
For targets that normally need trampolines for nested functions, always generate them instead of using descriptors. Otherwise,for targets that do not need them, like for example HP-PA or IA-64, do nothing.A trampoline is a small piece of code that is created at run time on the stack when the address of a nested function is taken,and is used to call the nested function indirectly. Therefore, it requires the stack to be made executable in order for theprogram to work properly.
cc -ftrampolines ...
-fstrict-volatile-bitfields
This option should be used if accesses to volatile bit-fields (or other structure fields, although the compiler usually honorsthose types anyway) should use a single access of the width of the field's type, aligned to a natural alignment if possible. Forexample, targets with memory-mapped peripheral registers might require all such accesses to be 16 bits wide; with this flag youcan declare all peripheral bit-fields as "unsigned short" (assuming short is 16 bits on these targets) to force GCC to use 16-bitaccesses instead of, perhaps, a more efficient 32-bit access.If this option is disabled, the compiler uses the most efficient instruction. In the previous example, that might be a 32-bitload instruction, even though that accesses bytes that do not contain any portion of the bit-field, or memory-mapped registersunrelated to the one being updated.In some cases, such as when the "packed" attribute is applied to a structure field, it may not be possible to access the fieldwith a single read or write that is correctly aligned for the target machine. In this case GCC falls back to generating multipleaccesses rather than code that will fault or truncate the result at run time.Note: Due to restrictions of the C/C++11 memory model, write accesses are not allowed to touch non bit-field members. It istherefore recommended to define all bits of the field's type as bit-field members.The default value of this option is determined by the application binary interface for the target processor.
cc -fstrict-volatile-bitfields ...
-fsync-libcalls
This option controls whether any out-of-line instance of the "__sync" family of functions may be used to implement the C++11"__atomic" family of functions.The default value of this option is enabled, thus the only useful form of the option is -fno-sync-libcalls. This option is usedin the implementation of the libatomic runtime library.GCC Developer OptionsThis section describes command-line options that are primarily of interest to GCC developers, including options to support compilertesting and investigation of compiler bugs and compile-time performance problems. This includes options that produce debug dumps atvarious points in the compilation; that print statistics such as memory use and execution time; and that print information aboutGCC's configuration, such as where it searches for libraries. You should rarely need to use any of these options for ordinarycompilation and linking tasks.
cc -fsync-libcalls ...
-fdump-rtl-alignments
Dump after branch alignments have been computed.
cc -fdump-rtl-alignments ...
-fdump-rtl-asmcons
Dump after fixing rtl statements that have unsatisfied in/out constraints.
cc -fdump-rtl-asmcons ...
-fdump-rtl-auto_inc_dec
Dump after auto-inc-dec discovery. This pass is only run on architectures that have auto inc or auto dec instructions.
cc -fdump-rtl-auto_inc_dec ...
-fdump-rtl-barriers
Dump after cleaning up the barrier instructions.
cc -fdump-rtl-barriers ...
-fdump-rtl-bbpart
Dump after partitioning hot and cold basic blocks.
cc -fdump-rtl-bbpart ...
-fdump-rtl-bbro
Dump after block reordering.
cc -fdump-rtl-bbro ...
-fdump-rtl-btl1
and -fdump-rtl-btl2 enable dumping after the two branch target load optimization passes.
cc -fdump-rtl-btl1 ...
-fdump-rtl-bypass
Dump after jump bypassing and control flow optimizations.
cc -fdump-rtl-bypass ...
-fdump-rtl-combine
Dump after the RTL instruction combination pass.
cc -fdump-rtl-combine ...
-fdump-rtl-compgotos
Dump after duplicating the computed gotos.
cc -fdump-rtl-compgotos ...
-fdump-rtl-ce1
-fdump-rtl-ce2 and -fdump-rtl-ce3 enable dumping after the three if conversion passes.
cc -fdump-rtl-ce1 ...
-fdump-rtl-cprop_hardreg
Dump after hard register copy propagation.
cc -fdump-rtl-cprop_hardreg ...
-fdump-rtl-csa
Dump after combining stack adjustments.
cc -fdump-rtl-csa ...
-fdump-rtl-cse1
and -fdump-rtl-cse2 enable dumping after the two common subexpression elimination passes.
cc -fdump-rtl-cse1 ...
-fdump-rtl-dce
Dump after the standalone dead code elimination passes.
cc -fdump-rtl-dce ...
-fdump-rtl-dbr
Dump after delayed branch scheduling.
cc -fdump-rtl-dbr ...
-fdump-rtl-dce1
and -fdump-rtl-dce2 enable dumping after the two dead store elimination passes.
cc -fdump-rtl-dce1 ...
-fdump-rtl-eh
Dump after finalization of EH handling code.
cc -fdump-rtl-eh ...
-fdump-rtl-eh_ranges
Dump after conversion of EH handling range regions.
cc -fdump-rtl-eh_ranges ...
-fdump-rtl-expand
Dump after RTL generation.
cc -fdump-rtl-expand ...
-fdump-rtl-fwprop1
and -fdump-rtl-fwprop2 enable dumping after the two forward propagation passes.
cc -fdump-rtl-fwprop1 ...
-fdump-rtl-gcse1
and -fdump-rtl-gcse2 enable dumping after global common subexpression elimination.
cc -fdump-rtl-gcse1 ...
-fdump-rtl-init-regs
Dump after the initialization of the registers.
cc -fdump-rtl-init-regs ...
-fdump-rtl-initvals
Dump after the computation of the initial value sets.
cc -fdump-rtl-initvals ...
-fdump-rtl-into_cfglayout
Dump after converting to cfglayout mode.
cc -fdump-rtl-into_cfglayout ...
-fdump-rtl-ira
Dump after iterated register allocation.
cc -fdump-rtl-ira ...
-fdump-rtl-jump
Dump after the second jump optimization.
cc -fdump-rtl-jump ...
-fdump-rtl-loop2
enables dumping after the rtl loop optimization passes.
cc -fdump-rtl-loop2 ...
-fdump-rtl-mach
Dump after performing the machine dependent reorganization pass, if that pass exists.
cc -fdump-rtl-mach ...
-fdump-rtl-mode_sw
Dump after removing redundant mode switches.
cc -fdump-rtl-mode_sw ...
-fdump-rtl-rnreg
Dump after register renumbering.
cc -fdump-rtl-rnreg ...
-fdump-rtl-outof_cfglayout
Dump after converting from cfglayout mode.
cc -fdump-rtl-outof_cfglayout ...
-fdump-rtl-peephole2
Dump after the peephole pass.
cc -fdump-rtl-peephole2 ...
-fdump-rtl-postreload
Dump after post-reload optimizations.
cc -fdump-rtl-postreload ...
-fdump-rtl-pro_and_epilogue
Dump after generating the function prologues and epilogues.
cc -fdump-rtl-pro_and_epilogue ...
-fdump-rtl-sched1
and -fdump-rtl-sched2 enable dumping after the basic block scheduling passes.
cc -fdump-rtl-sched1 ...
-fdump-rtl-ree
Dump after sign/zero extension elimination.
cc -fdump-rtl-ree ...
-fdump-rtl-seqabstr
Dump after common sequence discovery.
cc -fdump-rtl-seqabstr ...
-fdump-rtl-shorten
Dump after shortening branches.
cc -fdump-rtl-shorten ...
-fdump-rtl-sibling
Dump after sibling call optimizations.
cc -fdump-rtl-sibling ...
-fdump-rtl-split5
These options enable dumping after five rounds of instruction splitting.
cc -fdump-rtl-split5 ...
-fdump-rtl-sms
Dump after modulo scheduling. This pass is only run on some architectures.
cc -fdump-rtl-sms ...
-fdump-rtl-stack
Dump after conversion from GCC's "flat register file" registers to the x87's stack-like registers. This pass is only run onx86 variants.
cc -fdump-rtl-stack ...
-fdump-rtl-subreg1
and -fdump-rtl-subreg2 enable dumping after the two subreg expansion passes.
cc -fdump-rtl-subreg1 ...
-fdump-rtl-unshare
Dump after all rtl has been unshared.
cc -fdump-rtl-unshare ...
-fdump-rtl-vartrack
Dump after variable tracking.
cc -fdump-rtl-vartrack ...
-fdump-rtl-vregs
Dump after converting virtual registers to hard registers.
cc -fdump-rtl-vregs ...
-fdump-rtl-web
Dump after live range splitting.
cc -fdump-rtl-web ...
-fdump-rtl-dfinish
These dumps are defined but always produce empty files.
cc -fdump-rtl-dfinish ...
-fdump-rtl-all
Produce all the dumps listed above.
cc -fdump-rtl-all ...
-dA
Annotate the assembler output with miscellaneous debugging information.
cc -dA ...
-dD
at the end of preprocessing in addition to normal output.
cc -dD ...
-dH
Produce a core dump whenever an error occurs.
cc -dH ...
-dP
Dump the RTL in the assembler output as a comment before each instruction. Also turns on -dp annotation.
cc -dP ...
-dx
Just generate RTL for a function instead of compiling it. Usually used with -fdump-rtl-expand.
cc -dx ...
-fdump-noaddr
When doing debugging dumps, suppress address output. This makes it more feasible to use diff on debugging dumps for compilerinvocations with different compiler binaries and/or different text / bss / data / heap / stack / dso start locations.
cc -fdump-noaddr ...
-freport-bug
Collect and dump debug information into a temporary file if an internal compiler error (ICE) occurs.
cc -freport-bug ...
-fdump-unnumbered
When doing debugging dumps, suppress instruction numbers and address output. This makes it more feasible to use diff ondebugging dumps for compiler invocations with different options, in particular with and without -g.
cc -fdump-unnumbered ...
-fdump-unnumbered-links
When doing debugging dumps (see -d option above), suppress instruction numbers for the links to the previous and nextinstructions in a sequence.
cc -fdump-unnumbered-links ...
-fdump-translation-unit-options
Dump a representation of the tree structure for the entire translation unit to a file. The file name is made by appending .tu tothe source file name, and the file is created in the same directory as the output file. If the -options form is used, optionscontrols the details of the dump as described for the -fdump-tree options.
cc -fdump-translation-unit-options ...
-fdump-class-hierarchy-options
Dump a representation of each class's hierarchy and virtual function table layout to a file. The file name is made by appending.class to the source file name, and the file is created in the same directory as the output file. If the -options form is used,options controls the details of the dump as described for the -fdump-tree options.
cc -fdump-class-hierarchy-options ...
-fdump-ipa-switch
Control the dumping at various stages of inter-procedural analysis language tree to a file. The file name is generated byappending a switch specific suffix to the source file name, and the file is created in the same directory as the output file.The following dumps are possible:all Enables all inter-procedural analysis dumps.cgraphDumps information about call-graph optimization, unused function removal, and inlining decisions.inlineDump after function inlining.
cc -fdump-ipa-switch ...
-fdump-passes
Print on stderr the list of optimization passes that are turned on and off by the current command-line options.
cc -fdump-passes ...
-fdump-statistics-option
Enable and control dumping of pass statistics in a separate file. The file name is generated by appending a suffix ending in.statistics to the source file name, and the file is created in the same directory as the output file. If the -option form isused, -stats causes counters to be summed over the whole compilation unit while -details dumps every event as the passes generatethem. The default with no option is to sum counters for each function compiled.
cc -fdump-statistics-option ...
-fdump-tree-pre=/dev/stderr
outputs vectorizer dump into foo.dump, while the PRE dump is output on to stderr. If two conflicting dump filenames are givenfor the same pass, then the latter option overrides the earlier one.all Turn on all options, except raw, slim, verbose and lineno.optallTurn on all optimization options, i.e., optimized, missed, and note.To determine what tree dumps are available or find the dump for a pass of interest follow the steps below.1. Invoke GCC with -fdump-passes and in the stderr output look for a code that corresponds to the pass you are interested in.For example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2" correspond to the three Value Range Propagation passes. Thenumber at the end distinguishes distinct invocations of the same pass.2. To enable the creation of the dump file, append the pass code to the -fdump- option prefix and invoke GCC with it. Forexample, to enable the dump from the Early Value Range Propagation pass, invoke GCC with the -fdump-tree-evrp option.Optionally, you may specify the name of the dump file. If you don't specify one, GCC creates as described below.3. Find the pass dump in a file whose name is composed of three components separated by a period: the name of the source fileGCC was invoked to compile, a numeric suffix indicating the pass number followed by the letter t for tree passes (and theletter r for RTL passes), and finally the pass code. For example, the Early VRP pass dump might be in a file namedmyfile.c.038t.evrp in the current working directory. Note that the numeric codes are not stable and may change from oneversion of GCC to another.
cc -fdump-tree-pre=/dev/stderr ...
-fopt-info-options
Controls optimization dumps from various optimization passes. If the -options form is used, options is a list of - separatedoption keywords to select the dump details and optimizations.The options can be divided into two groups: options describing the verbosity of the dump, and options describing whichoptimizations should be included. The options from both the groups can be freely mixed as they are non-overlapping. However, incase of any conflicts, the later options override the earlier options on the command line.The following options control the dump verbosity:optimizedPrint information when an optimization is successfully applied. It is up to a pass to decide which information is relevant.For example, the vectorizer passes print the source location of loops which are successfully vectorized.missedPrint information about missed optimizations. Individual passes control which information to include in the output.notePrint verbose information about optimizations, such as certain transformations, more detailed messages about decisions etc.all Print detailed optimization information. This includes optimized, missed, and note.One or more of the following option keywords can be used to describe a group of optimizations:ipa Enable dumps from all interprocedural optimizations.loopEnable dumps from all loop optimizations.inlineEnable dumps from all inlining optimizations.omp Enable dumps from all OMP (Offloading and Multi Processing) optimizations.vec Enable dumps from all vectorization optimizations.optallEnable dumps from all optimizations. This is a superset of the optimization groups listed above.If options is omitted, it defaults to optimized-optall, which means to dump all info about successful optimizations from all thepasses.If the filename is provided, then the dumps from all the applicable optimizations are concatenated into the filename. Otherwisethe dump is output onto stderr. Though multiple -fopt-info options are accepted, only one of them can include a filename. Ifother filenames are provided then all but the first such option are ignored.Note that the output filename is overwritten in case of multiple translation units. If a combined output from multipletranslation units is desired, stderr should be used instead.In the following example, the optimization info is output to stderr:gcc -O3 -fopt-infoThis example:gcc -O3 -fopt-info-missed=missed.alloutputs missed optimization report from all the passes into missed.all, and this one:gcc -O2 -ftree-vectorize -fopt-info-vec-missedprints information about missed optimization opportunities from vectorization passes on stderr. Note that -fopt-info-vec-missedis equivalent to -fopt-info-missed-vec.As another example,gcc -O3 -fopt-info-inline-optimized-missed=inline.txtoutputs information about missed optimizations as well as optimized locations from all the inlining passes into inline.txt.Finally, consider:gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.optHere the two output filenames vec.miss and loop.opt are in conflict since only one output file is allowed. In this case, only thefirst option takes effect and the subsequent options are ignored. Thus only vec.miss is produced which contains dumps from thevectorizer about missed opportunities.
cc -fopt-info-options ...
-fsched-verbose
On targets that use instruction scheduling, this option controls the amount of debugging output the scheduler prints to the dumpfiles.For n greater than zero, -fsched-verbose outputs the same information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n greaterthan one, it also output basic block probabilities, detailed ready list information and unit/insn info. For n greater than two,it includes RTL at abort point, control-flow and regions info. And for n over four, -fsched-verbose also includes dependenceinfo.
cc -fsched-verbose ...
-fdisable-kind-pass
This is a set of options that are used to explicitly disable/enable optimization passes. These options are intended for use fordebugging GCC. Compiler users should use regular options for enabling/disabling passes instead.
cc -fdisable-kind-pass ...
-fdisable-ipa-pass
Disable IPA pass pass. pass is the pass name. If the same pass is statically invoked in the compiler multiple times, thepass name should be appended with a sequential number starting from 1.
cc -fdisable-ipa-pass ...
-fdisable-rtl-pass
Disable RTL pass pass. pass is the pass name. If the same pass is statically invoked in the compiler multiple times, thepass name should be appended with a sequential number starting from 1. range-list is a comma-separated list of functionranges or assembler names. Each range is a number pair separated by a colon. The range is inclusive in both ends. If therange is trivial, the number pair can be simplified as a single number. If the function's call graph node's uid falls withinone of the specified ranges, the pass is disabled for that function. The uid is shown in the function header of a dump file,and the pass names can be dumped by using option -fdump-passes.
cc -fdisable-rtl-pass ...
-fdisable-tree-pass
Disable tree pass pass. See -fdisable-rtl for the description of option arguments.
cc -fdisable-tree-pass ...
-fenable-ipa-pass
Enable IPA pass pass. pass is the pass name. If the same pass is statically invoked in the compiler multiple times, thepass name should be appended with a sequential number starting from 1.
cc -fenable-ipa-pass ...
-fenable-rtl-pass
Enable RTL pass pass. See -fdisable-rtl for option argument description and examples.
cc -fenable-rtl-pass ...
-fenable-tree-pass
Enable tree pass pass. See -fdisable-rtl for the description of option arguments.Here are some examples showing uses of these options.# disable ccp1 for all functions
cc -fenable-tree-pass ...
-fdisable-tree-ccp1
# disable complete unroll for function whose cgraph node uid is 1
cc -fdisable-tree-ccp1 ...
-fenable-tree-cunroll
# disable gcse2 for functions at the following ranges [1,1],# [300,400], and [400,1000]# disable gcse2 for functions foo and foo2
cc -fenable-tree-cunroll ...
-fdisable-rtl-gcse2
# disable early inlining
cc -fdisable-rtl-gcse2 ...
-fdisable-tree-einline
# disable ipa inlining
cc -fdisable-tree-einline ...
-fdisable-ipa-inline
# enable tree full unroll
cc -fdisable-ipa-inline ...
-fchecking
Enable internal consistency checking. The default depends on the compiler configuration. -fchecking=2 enables further internalconsistency checking that might affect code generation.
cc -fchecking ...
-frandom-seed
This option provides a seed that GCC uses in place of random numbers in generating certain symbol names that have to be differentin every compiled file. It is also used to place unique stamps in coverage data files and the object files that produce them.You can use the -frandom-seed option to produce reproducibly identical object files.The string can either be a number (decimal, octal or hex) or an arbitrary string (in which case it's converted to a number bycomputing CRC32).The string should be different for every file you compile.
cc -frandom-seed ...
-save-temps
Store the usual "temporary" intermediate files permanently; place them in the current directory and name them based on the sourcefile. Thus, compiling foo.c with -c -save-temps produces files foo.i and foo.s, as well as foo.o. This creates a preprocessedfoo.i output file even though the compiler now normally uses an integrated preprocessor.When used in combination with the -x command-line option, -save-temps is sensible enough to avoid over writing an input sourcefile with the same extension as an intermediate file. The corresponding intermediate file may be obtained by renaming the sourcefile before using -save-temps.If you invoke GCC in parallel, compiling several different source files that share a common base name in different subdirectoriesor the same source file compiled for multiple output destinations, it is likely that the different parallel compilers willinterfere with each other, and overwrite the temporary files. For instance:gcc -save-temps -o outdir1/foo.o indir1/foo.c&gcc -save-temps -o outdir2/foo.o indir2/foo.c&may result in foo.i and foo.o being written to simultaneously by both compilers.
cc -save-temps ...
-time[
Report the CPU time taken by each subprocess in the compilation sequence. For C source files, this is the compiler proper andassembler (plus the linker if linking is done).Without the specification of an output file, the output looks like this:# cc1 0.12 0.01# as 0.00 0.01The first number on each line is the "user time", that is time spent executing the program itself. The second number is "systemtime", time spent executing operating system routines on behalf of the program. Both numbers are in seconds.With the specification of an output file, the output is appended to the named file, and it looks like this:0.12 0.01 cc1 <options>0.00 0.01 as <options>The "user time" and the "system time" are moved before the program name, and the options passed to the program are displayed, sothat one can later tell what file was being compiled, and with which options.
cc -time[ ...
-fdump-final-insns[
Dump the final internal representation (RTL) to file. If the optional argument is omitted (or if file is "."), the name of thedump file is determined by appending ".gkd" to the compilation output file name.
cc -fdump-final-insns[ ...
-fcompare-debug[
If no error occurs during compilation, run the compiler a second time, adding opts and -fcompare-debug-second to the argumentspassed to the second compilation. Dump the final internal representation in both compilations, and print an error if theydiffer.If the equal sign is omitted, the default -gtoggle is used.The environment variable GCC_COMPARE_DEBUG, if defined, non-empty and nonzero, implicitly enables -fcompare-debug. IfGCC_COMPARE_DEBUG is defined to a string starting with a dash, then it is used for opts, otherwise the default -gtoggle is used.
cc -fcompare-debug[ ...
-fcompare-debug-second
This option is implicitly passed to the compiler for the second compilation requested by -fcompare-debug, along with options tosilence warnings, and omitting other options that would cause side-effect compiler outputs to files or to the standard output.Dump files and preserved temporary files are renamed so as to contain the ".gk" additional extension during the secondcompilation, to avoid overwriting those generated by the first.When this option is passed to the compiler driver, it causes the first compilation to be skipped, which makes it useful forlittle other than debugging the compiler proper.
cc -fcompare-debug-second ...
-gtoggle
Turn off generation of debug info, if leaving out this option generates it, or turn it on at level 2 otherwise. The position ofthis argument in the command line does not matter; it takes effect after all other options are processed, and it does so onlyonce, no matter how many times it is given. This is mainly intended to be used with -fcompare-debug.
cc -gtoggle ...
-fvar-tracking-assignments-toggle
Toggle -fvar-tracking-assignments, in the same way that -gtoggle toggles -g.
cc -fvar-tracking-assignments-toggle ...
-ftime-report
Makes the compiler print some statistics about the time consumed by each pass when it finishes.
cc -ftime-report ...
-fira-verbose
Control the verbosity of the dump file for the integrated register allocator. The default value is 5. If the value n is greateror equal to 10, the dump output is sent to stderr using the same format as n minus 10.
cc -fira-verbose ...
-flto-report
Prints a report with internal details on the workings of the link-time optimizer. The contents of this report vary from versionto version. It is meant to be useful to GCC developers when processing object files in LTO mode (via -flto).Disabled by default.
cc -flto-report ...
-flto-report-wpa
Like -flto-report, but only print for the WPA phase of Link Time Optimization.
cc -flto-report-wpa ...
-fmem-report
Makes the compiler print some statistics about permanent memory allocation when it finishes.
cc -fmem-report ...
-fmem-report-wpa
Makes the compiler print some statistics about permanent memory allocation for the WPA phase only.
cc -fmem-report-wpa ...
-fprofile-report
Makes the compiler print some statistics about consistency of the (estimated) profile and effect of individual passes.
cc -fprofile-report ...
-fstack-usage
Makes the compiler output stack usage information for the program, on a per-function basis. The filename for the dump is made byappending .su to the auxname. auxname is generated from the name of the output file, if explicitly specified and it is not anexecutable, otherwise it is the basename of the source file. An entry is made up of three fields:* The name of the function.* A number of bytes.* One or more qualifiers: "static", "dynamic", "bounded".The qualifier "static" means that the function manipulates the stack statically: a fixed number of bytes are allocated for theframe on function entry and released on function exit; no stack adjustments are otherwise made in the function. The second fieldis this fixed number of bytes.The qualifier "dynamic" means that the function manipulates the stack dynamically: in addition to the static allocation describedabove, stack adjustments are made in the body of the function, for example to push/pop arguments around function calls. If thequalifier "bounded" is also present, the amount of these adjustments is bounded at compile time and the second field is an upperbound of the total amount of stack used by the function. If it is not present, the amount of these adjustments is not bounded atcompile time and the second field only represents the bounded part.
cc -fstack-usage ...
-fstats
Emit statistics about front-end processing at the end of the compilation. This option is supported only by the C++ front end,and the information is generally only useful to the G++ development team.
cc -fstats ...
-fdbg-cnt-list
Print the name and the counter upper bound for all debug counters.
cc -fdbg-cnt-list ...
-fdbg-cnt
Set the internal debug counter upper bound. counter-value-list is a comma-separated list of name:value pairs which sets theupper bound of each debug counter name to value. All debug counters have the initial upper bound of "UINT_MAX"; thus "dbg_cnt"returns true always unless the upper bound is set by this option. For example, with -fdbg-cnt=dce:10,tail_call:0, "dbg_cnt(dce)"returns true only for first 10 invocations.
cc -fdbg-cnt ...
-print-file-name
Print the full absolute name of the library file library that would be used when linking---and don't do anything else. With thisoption, GCC does not compile or link anything; it just prints the file name.
cc -print-file-name ...
-print-multi-lib
Print the mapping from multilib directory names to compiler switches that enable them. The directory name is separated from theswitches by ;, and each switch starts with an @ instead of the -, without spaces between multiple switches. This is supposed toease shell processing.
cc -print-multi-lib ...
-print-multi-os-directory
Print the path to OS libraries for the selected multilib, relative to some lib subdirectory. If OS libraries are present in thelib subdirectory and no multilibs are used, this is usually just ., if OS libraries are present in libsuffix sibling directoriesthis prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are present in lib/subdir subdirectories it prints e.g. amd64,sparcv9 or ev6.
cc -print-multi-os-directory ...
-print-multiarch
Print the path to OS libraries for the selected multiarch, relative to some lib subdirectory.
cc -print-multiarch ...
-print-prog-name
Like -print-file-name, but searches for a program such as cpp.
cc -print-prog-name ...
-print-libgcc-file-name
Same as -print-file-name=libgcc.a.This is useful when you use -nostdlib or -nodefaultlibs but you do want to link with libgcc.a. You can do:gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
cc -print-libgcc-file-name ...
-print-search-dirs
Print the name of the configured installation directory and a list of program and library directories gcc searches---and don't doanything else.This is useful when gcc prints the error message installation problem, cannot exec cpp0: No such file or directory. To resolvethis you either need to put cpp0 and the other compiler components where gcc expects to find them, or you can set the environmentvariable GCC_EXEC_PREFIX to the directory where you installed them. Don't forget the trailing /.
cc -print-search-dirs ...
-print-sysroot
Print the target sysroot directory that is used during compilation. This is the target sysroot specified either at configuretime or using the --sysroot option, possibly with an extra suffix that depends on compilation options. If no target sysroot isspecified, the option prints nothing.
cc -print-sysroot ...
-print-sysroot-headers-suffix
Print the suffix added to the target sysroot when searching for headers, or give an error if the compiler is not configured withsuch a suffix---and don't do anything else.
cc -print-sysroot-headers-suffix ...
-dumpmachine
Print the compiler's target machine (for example, i686-pc-linux-gnu)---and don't do anything else.
cc -dumpmachine ...
-dumpversion
Print the compiler version (for example, 3.0, 6.3.0 or 7)---and don't do anything else. This is the compiler version used infilesystem paths, specs, can be depending on how the compiler has been configured just a single number (major version), twonumbers separated by dot (major and minor version) or three numbers separated by dots (major, minor and patchlevel version).
cc -dumpversion ...
-dumpfullversion
Print the full compiler version, always 3 numbers separated by dots, major, minor and patchlevel version.
cc -dumpfullversion ...
-dumpspecs
Print the compiler's built-in specs---and don't do anything else. (This is used when GCC itself is being built.)Machine-Dependent OptionsEach target machine supported by GCC can have its own options---for example, to allow you to compile for a particular processorvariant or ABI, or to control optimizations specific to that machine. By convention, the names of machine-specific options startwith -m.Some configurations of the compiler also support additional target-specific options, usually for compatibility with other compilerson the same platform.AArch64 OptionsThese options are defined for AArch64 implementations:
cc -dumpspecs ...
-mabi
Generate code for the specified data model. Permissible values are ilp32 for SysV-like data model where int, long int andpointers are 32 bits, and lp64 for SysV-like data model where int is 32 bits, but long int and pointers are 64 bits.The default depends on the specific target configuration. Note that the LP64 and ILP32 ABIs are not link-compatible; you mustcompile your entire program with the same ABI, and link with a compatible set of libraries.
cc -mabi ...
-mbig-endian
Generate big-endian code. This is the default when GCC is configured for an aarch64_be-*-* target.
cc -mbig-endian ...
-mgeneral-regs-only
Generate code which uses only the general-purpose registers. This will prevent the compiler from using floating-point andAdvanced SIMD registers but will not impose any restrictions on the assembler.
cc -mgeneral-regs-only ...
-mno-omit-leaf-frame-pointer
Omit or keep the frame pointer in leaf functions. The former behavior is the default.
cc -mno-omit-leaf-frame-pointer ...
-mtls-dialect
Use TLS descriptors as the thread-local storage mechanism for dynamic accesses of TLS variables. This is the default.
cc -mtls-dialect ...
-mno-fix-cortex-a53-835769
Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. This involves inserting a NOP instruction betweenmemory instructions and 64-bit integer multiply-accumulate instructions.
cc -mno-fix-cortex-a53-835769 ...
-mno-fix-cortex-a53-843419
Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. This erratum workaround is made at link time andthis will only pass the corresponding flag to the linker.
cc -mno-fix-cortex-a53-843419 ...
-mno-low-precision-recip-sqrt
Enable or disable the reciprocal square root approximation. This option only has an effect if -ffast-math or
cc -mno-low-precision-recip-sqrt ...
-mno-low-precision-sqrt
Enable or disable the square root approximation. This option only has an effect if -ffast-math or -funsafe-math-optimizations isused as well. Enabling this reduces precision of square root results to about 16 bits for single precision and to 32 bits fordouble precision. If enabled, it implies -mlow-precision-recip-sqrt.
cc -mno-low-precision-sqrt ...
-march
Specify the name of the target architecture and, optionally, one or more feature modifiers. This option has the form
cc -march ...
-moverride
Override tuning decisions made by the back-end in response to a -mtune= switch. The syntax, semantics, and accepted values forstring in this option are not guaranteed to be consistent across releases.This option is only intended to be useful when developing GCC.
cc -moverride ...
-mpc-relative-literal-loads
Enable PC-relative literal loads. With this option literal pools are accessed using a single instruction and emitted after eachfunction. This limits the maximum size of functions to 1MB. This is enabled by default for -mcmodel=tiny.
cc -mpc-relative-literal-loads ...
-msign-return-address
Select the function scope on which return address signing will be applied. Permissible values are none, which disables returnaddress signing, non-leaf, which enables pointer signing for functions which are not leaf functions, and all, which enablespointer signing for all functions. The default value is none.
cc -msign-return-address ...
-mhalf-reg-file
Don't allocate any register in the range "r32"..."r63". That allows code to run on hardware variants that lack these registers.
cc -mhalf-reg-file ...
-mprefer-short-insn-regs
Preferentially allocate registers that allow short instruction generation. This can result in increased instruction count, sothis may either reduce or increase overall code size.
cc -mprefer-short-insn-regs ...
-mcmove
Enable the generation of conditional moves.
cc -mcmove ...
-mnops
Emit num NOPs before every other generated instruction.
cc -mnops ...
-mno-soft-cmpsf
For single-precision floating-point comparisons, emit an "fsub" instruction and test the flags. This is faster than a softwarecomparison, but can get incorrect results in the presence of NaNs, or when two different small numbers are compared such thattheir difference is calculated as zero. The default is -msoft-cmpsf, which uses slower, but IEEE-compliant, softwarecomparisons.
cc -mno-soft-cmpsf ...
-mstack-offset
Set the offset between the top of the stack and the stack pointer. E.g., a value of 8 means that the eight bytes in the range"sp+0...sp+7" can be used by leaf functions without stack allocation. Values other than 8 or 16 are untested and unlikely towork. Note also that this option changes the ABI; compiling a program with a different stack offset than the libraries have beencompiled with generally does not work. This option can be useful if you want to evaluate if a different stack offset would giveyou better code, but to actually use a different stack offset to build working programs, it is recommended to configure thetoolchain with the appropriate --with-stack-offset=num option.
cc -mstack-offset ...
-mno-round-nearest
Make the scheduler assume that the rounding mode has been set to truncating. The default is -mround-nearest.
cc -mno-round-nearest ...
-mlong-calls
If not otherwise specified by an attribute, assume all calls might be beyond the offset range of the "b" / "bl" instructions, andtherefore load the function address into a register before performing a (otherwise direct) call. This is the default.
cc -mlong-calls ...
-mshort-calls
If not otherwise specified by an attribute, assume all direct calls are in the range of the "b" / "bl" instructions, so use theseinstructions for direct calls. The default is -mlong-calls.
cc -mshort-calls ...
-msmall16
Assume addresses can be loaded as 16-bit unsigned values. This does not apply to function addresses for which -mlong-callssemantics are in effect.
cc -msmall16 ...
-mfp-mode
Set the prevailing mode of the floating-point unit. This determines the floating-point mode that is provided and expected atfunction call and return time. Making this mode match the mode you predominantly need at function start can make your programssmaller and faster by avoiding unnecessary mode switches.mode can be set to one the following values:callerAny mode at function entry is valid, and retained or restored when the function returns, and when it calls other functions.This mode is useful for compiling libraries or other compilation units you might want to incorporate into different programswith different prevailing FPU modes, and the convenience of being able to use a single object file outweighs the size andspeed overhead for any extra mode switching that might be needed, compared with what would be needed with a more specificchoice of prevailing FPU mode.truncateThis is the mode used for floating-point calculations with truncating (i.e. round towards zero) rounding mode. That includesconversion from floating point to integer.round-nearestThis is the mode used for floating-point calculations with round-to-nearest-or-even rounding mode.int This is the mode used to perform integer calculations in the FPU, e.g. integer multiply, or integer multiply-and-accumulate.The default is -mfp-mode=caller
cc -mfp-mode ...
-mno-postmodify
Code generation tweaks that disable, respectively, splitting of 32-bit loads, generation of post-increment addresses, andgeneration of post-modify addresses. The defaults are msplit-lohi, -mpost-inc, and -mpost-modify.
cc -mno-postmodify ...
-mnovect-double
Change the preferred SIMD mode to SImode. The default is -mvect-double, which uses DImode as preferred SIMD mode.
cc -mnovect-double ...
-max-vect-align
The maximum alignment for SIMD vector mode types. num may be 4 or 8. The default is 8. Note that this is an ABI change, eventhough many library function interfaces are unaffected if they don't use SIMD vector modes in places that affect size and/oralignment of relevant types.
cc -max-vect-align ...
-msplit-vecmove-early
Split vector moves into single word moves before reload. In theory this can give better register allocation, but so far thereverse seems to be generally the case.
cc -msplit-vecmove-early ...
-m1reg-reg
Specify a register to hold the constant -1, which makes loading small negative constants and certain bitmasks faster. Allowablevalues for reg are r43 and r63, which specify use of that register as a fixed register, and none, which means that no register isused for this purpose. The default is -m1reg-none.ARC OptionsThe following options control the architecture variant for which code is being compiled:
cc -m1reg-reg ...
-mbarrel-shifter
Generate instructions supported by barrel shifter. This is the default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
cc -mbarrel-shifter ...
-mdpfp-compact
Generate double-precision FPX instructions, tuned for the compact implementation.
cc -mdpfp-compact ...
-mdpfp-fast
Generate double-precision FPX instructions, tuned for the fast implementation.
cc -mdpfp-fast ...
-mno-dpfp-lrsr
Disable "lr" and "sr" instructions from using FPX extension aux registers.
cc -mno-dpfp-lrsr ...
-mea
Generate extended arithmetic instructions. Currently only "divaw", "adds", "subs", and "sat16" are supported. This is alwaysenabled for -mcpu=ARC700.
cc -mea ...
-mmul32x16
Generate 32x16-bit multiply and multiply-accumulate instructions.
cc -mmul32x16 ...
-mmul64
Generate "mul64" and "mulu64" instructions. Only valid for -mcpu=ARC600.
cc -mmul64 ...
-mnorm
Generate "norm" instructions. This is the default if -mcpu=ARC700 is in effect.
cc -mnorm ...
-mspfp-compact
Generate single-precision FPX instructions, tuned for the compact implementation.
cc -mspfp-compact ...
-mspfp-fast
Generate single-precision FPX instructions, tuned for the fast implementation.
cc -mspfp-fast ...
-msimd
Enable generation of ARC SIMD instructions via target-specific builtins. Only valid for -mcpu=ARC700.
cc -msimd ...
-msoft-float
This option ignored; it is provided for compatibility purposes only. Software floating-point code is emitted by default, andthis default can overridden by FPX options; -mspfp, -mspfp-compact, or -mspfp-fast for single precision, and -mdpfp,
cc -msoft-float ...
-mswap
Generate "swap" instructions.
cc -mswap ...
-matomic
This enables use of the locked load/store conditional extension to implement atomic memory built-in functions. Not available forARC 6xx or ARC EM cores.
cc -matomic ...
-mcode-density
Enable code density instructions for ARC EM. This option is on by default for ARC HS.
cc -mcode-density ...
-mll64
Enable double load/store operations for ARC HS cores.
cc -mll64 ...
-mtp-regno
Specify thread pointer register number.
cc -mtp-regno ...
-mmpy-option
Compile ARCv2 code with a multiplier design option. You can specify the option using either a string or numeric value for multo.wlh1 is the default value. The recognized values are:0noneNo multiplier available.1w 16x16 multiplier, fully pipelined. The following instructions are enabled: "mpyw" and "mpyuw".2wlh132x32 multiplier, fully pipelined (1 stage). The following instructions are additionally enabled: "mpy", "mpyu", "mpym","mpymu", and "mpy_s".3wlh232x32 multiplier, fully pipelined (2 stages). The following instructions are additionally enabled: "mpy", "mpyu", "mpym","mpymu", and "mpy_s".4wlh3Two 16x16 multipliers, blocking, sequential. The following instructions are additionally enabled: "mpy", "mpyu", "mpym","mpymu", and "mpy_s".5wlh4One 16x16 multiplier, blocking, sequential. The following instructions are additionally enabled: "mpy", "mpyu", "mpym","mpymu", and "mpy_s".6wlh5One 32x4 multiplier, blocking, sequential. The following instructions are additionally enabled: "mpy", "mpyu", "mpym","mpymu", and "mpy_s".7plus_dmpyARC HS SIMD support.8plus_macdARC HS SIMD support.9plus_qmacwARC HS SIMD support.This option is only available for ARCv2 cores.
cc -mmpy-option ...
-mfpu
Enables support for specific floating-point hardware extensions for ARCv2 cores. Supported values for fpu are:fpusEnables support for single-precision floating-point hardware extensions.fpudEnables support for double-precision floating-point hardware extensions. The single-precision floating-point extension isalso enabled. Not available for ARC EM.fpudaEnables support for double-precision floating-point hardware extensions using double-precision assist instructions. Thesingle-precision floating-point extension is also enabled. This option is only available for ARC EM.fpuda_divEnables support for double-precision floating-point hardware extensions using double-precision assist instructions. Thesingle-precision floating-point, square-root, and divide extensions are also enabled. This option is only available for ARCEM.fpuda_fmaEnables support for double-precision floating-point hardware extensions using double-precision assist instructions. Thesingle-precision floating-point and fused multiply and add hardware extensions are also enabled. This option is onlyavailable for ARC EM.fpuda_allEnables support for double-precision floating-point hardware extensions using double-precision assist instructions. Allsingle-precision floating-point hardware extensions are also enabled. This option is only available for ARC EM.fpus_divEnables support for single-precision floating-point, square-root and divide hardware extensions.fpud_divEnables support for double-precision floating-point, square-root and divide hardware extensions. This option includes optionfpus_div. Not available for ARC EM.fpus_fmaEnables support for single-precision floating-point and fused multiply and add hardware extensions.fpud_fmaEnables support for double-precision floating-point and fused multiply and add hardware extensions. This option includesoption fpus_fma. Not available for ARC EM.fpus_allEnables support for all single-precision floating-point hardware extensions.fpud_allEnables support for all single- and double-precision floating-point hardware extensions. Not available for ARC EM.The following options are passed through to the assembler, and also define preprocessor macro symbols.
cc -mfpu ...
-mdvbf
Passed down to the assembler to enable the dual Viterbi butterfly extension. Also sets the preprocessor symbol "__Xdvbf". Thisoption is deprecated.
cc -mdvbf ...
-mlock
Passed down to the assembler to enable the locked load/store conditional extension. Also sets the preprocessor symbol "__Xlock".
cc -mlock ...
-mmac-d16
Passed down to the assembler. Also sets the preprocessor symbol "__Xxmac_d16". This option is deprecated.
cc -mmac-d16 ...
-mmac-24
Passed down to the assembler. Also sets the preprocessor symbol "__Xxmac_24". This option is deprecated.
cc -mmac-24 ...
-mrtsc
Passed down to the assembler to enable the 64-bit time-stamp counter extension instruction. Also sets the preprocessor symbol"__Xrtsc". This option is deprecated.
cc -mrtsc ...
-mswape
Passed down to the assembler to enable the swap byte ordering extension instruction. Also sets the preprocessor symbol"__Xswape".
cc -mswape ...
-mtelephony
Passed down to the assembler to enable dual- and single-operand instructions for telephony. Also sets the preprocessor symbol"__Xtelephony". This option is deprecated.
cc -mtelephony ...
-mxy
Passed down to the assembler to enable the XY memory extension. Also sets the preprocessor symbol "__Xxy".The following options control how the assembly code is annotated:
cc -mxy ...
-misize
Annotate assembler instructions with estimated addresses.
cc -misize ...
-mannotate-align
Explain what alignment considerations lead to the decision to make an instruction short or long.The following options are passed through to the linker:
cc -mannotate-align ...
-marclinux
Passed through to the linker, to specify use of the "arclinux" emulation. This option is enabled by default in tool chains builtfor "arc-linux-uclibc" and "arceb-linux-uclibc" targets when profiling is not requested.
cc -marclinux ...
-mmedium-calls
Don't use less than 25-bit addressing range for calls, which is the offset available for an unconditional branch-and-linkinstruction. Conditional execution of function calls is suppressed, to allow use of the 25-bit range, rather than the 21-bitrange with conditional branch-and-link. This is the default for tool chains built for "arc-linux-uclibc" and"arceb-linux-uclibc" targets.
cc -mmedium-calls ...
-mvolatile-cache
Use ordinarily cached memory accesses for volatile references. This is the default.
cc -mvolatile-cache ...
-mno-volatile-cache
Enable cache bypass for volatile references.The following options fine tune code generation:
cc -mno-volatile-cache ...
-malign-call
Do alignment optimizations for call instructions.
cc -malign-call ...
-mauto-modify-reg
Enable the use of pre/post modify with register displacement.
cc -mauto-modify-reg ...
-mno-brcc
This option disables a target-specific pass in arc_reorg to generate compare-and-branch ("brcc") instructions. It has no effecton generation of these instructions driven by the combiner pass.
cc -mno-brcc ...
-mcase-vector-pcrel
Use PC-relative switch case tables to enable case table shortening. This is the default for -Os.
cc -mcase-vector-pcrel ...
-mcompact-casesi
Enable compact "casesi" pattern. This is the default for -Os, and only available for ARCv1 cores.
cc -mcompact-casesi ...
-mno-cond-exec
Disable the ARCompact-specific pass to generate conditional execution instructions.Due to delay slot scheduling and interactions between operand numbers, literal sizes, instruction lengths, and the support forconditional execution, the target-independent pass to generate conditional execution is often lacking, so the ARC port has kept aspecial pass around that tries to find more conditional execution generation opportunities after register allocation, branchshortening, and delay slot scheduling have been done. This pass generally, but not always, improves performance and code size,at the cost of extra compilation time, which is why there is an option to switch it off. If you have a problem with callinstructions exceeding their allowable offset range because they are conditionalized, you should consider using -mmedium-callsinstead.
cc -mno-cond-exec ...
-mearly-cbranchsi
Enable pre-reload use of the "cbranchsi" pattern.
cc -mearly-cbranchsi ...
-mexpand-adddi
Expand "adddi3" and "subdi3" at RTL generation time into "add.f", "adc" etc.
cc -mexpand-adddi ...
-mlra-priority-none
Don't indicate any priority for target registers.
cc -mlra-priority-none ...
-mlra-priority-compact
Indicate target register priority for r0..r3 / r12..r15.
cc -mlra-priority-compact ...
-mlra-priority-noncompact
Reduce target register priority for r0..r3 / r12..r15.
cc -mlra-priority-noncompact ...
-mno-millicode
When optimizing for size (using -Os), prologues and epilogues that have to save or restore a large number of registers are oftenshortened by using call to a special function in libgcc; this is referred to as a millicode call. As these calls can poseperformance issues, and/or cause linking issues when linking in a nonstandard way, this option is provided to turn off millicodecall generation.
cc -mno-millicode ...
-mmixed-code
Tweak register allocation to help 16-bit instruction generation. This generally has the effect of decreasing the averageinstruction size while increasing the instruction count.
cc -mmixed-code ...
-mRcq
Enable Rcq constraint handling. Most short code generation depends on this. This is the default.
cc -mRcq ...
-mRcw
Enable Rcw constraint handling. Most ccfsm condexec mostly depends on this. This is the default.
cc -mRcw ...
-msize-level
Fine-tune size optimization with regards to instruction lengths and alignment. The recognized values for level are:0 No size optimization. This level is deprecated and treated like 1.1 Short instructions are used opportunistically.2 In addition, alignment of loops and of code after barriers are dropped.3 In addition, optional data alignment is dropped, and the option Os is enabled.This defaults to 3 when -Os is in effect. Otherwise, the behavior when this is not set is equivalent to level 1.
cc -msize-level ...
-mmultcost
Cost to assume for a multiply instruction, with 4 being equal to a normal instruction.
cc -mmultcost ...
-munalign-prob-threshold
Set probability threshold for unaligning branches. When tuning for ARC700 and optimizing for speed, branches without filleddelay slot are preferably emitted unaligned and long, unless profiling indicates that the probability for the branch to be takenis below probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.The following options are maintained for backward compatibility, but are now deprecated and will be removed in a future release:
cc -munalign-prob-threshold ...
-mbarrel_shifter
Replaced by -mbarrel-shifter.
cc -mbarrel_shifter ...
-mdpfp_compact
Replaced by -mdpfp-compact.
cc -mdpfp_compact ...
-mdpfp_fast
Replaced by -mdpfp-fast.
cc -mdpfp_fast ...
-mdsp_packa
Replaced by -mdsp-packa.
cc -mdsp_packa ...
-mEA
Replaced by -mea.
cc -mEA ...
-mmac_24
Replaced by -mmac-24.
cc -mmac_24 ...
-mmac_d16
Replaced by -mmac-d16.
cc -mmac_d16 ...
-mspfp_compact
Replaced by -mspfp-compact.
cc -mspfp_compact ...
-mspfp_fast
Replaced by -mspfp-fast.
cc -mspfp_fast ...
-multcost
Replaced by -mmultcost.ARM OptionsThese -m options are defined for the ARM port:
cc -multcost ...
-mapcs-frame
Generate a stack frame that is compliant with the ARM Procedure Call Standard for all functions, even if this is not strictlynecessary for correct execution of the code. Specifying -fomit-frame-pointer with this option causes the stack frames not to begenerated for leaf functions. The default is -mno-apcs-frame. This option is deprecated.
cc -mapcs-frame ...
-mno-sched-prolog
Prevent the reordering of instructions in the function prologue, or the merging of those instruction with the instructions in thefunction's body. This means that all functions start with a recognizable set of instructions (or in fact one of a choice from asmall set of different function prologues), and this information can be used to locate the start of functions inside anexecutable piece of code. The default is -msched-prolog.
cc -mno-sched-prolog ...
-mfloat-abi
Specifies which floating-point ABI to use. Permissible values are: soft, softfp and hard.Specifying soft causes GCC to generate output containing library calls for floating-point operations. softfp allows thegeneration of code using hardware floating-point instructions, but still uses the soft-float calling conventions. hard allowsgeneration of floating-point instructions and uses FPU-specific calling conventions.The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible;you must compile your entire program with the same ABI, and link with a compatible set of libraries.
cc -mfloat-abi ...
-mfp16-format
Specify the format of the "__fp16" half-precision floating-point type. Permissible names are none, ieee, and alternative; thedefault is none, in which case the "__fp16" type is not defined.
cc -mfp16-format ...
-mabort-on-noreturn
Generate a call to the function "abort" at the end of a "noreturn" function. It is executed if the function tries to return.
cc -mabort-on-noreturn ...
-mno-long-calls
Tells the compiler to perform function calls by first loading the address of the function into a register and then performing asubroutine call on this register. This switch is needed if the target function lies outside of the 64-megabyte addressing rangeof the offset-based version of subroutine call instruction.Even if this switch is enabled, not all function calls are turned into long calls. The heuristic is that static functions,functions that have the "short_call" attribute, functions that are inside the scope of a "#pragma no_long_calls" directive, andfunctions whose definitions have already been compiled within the current compilation unit are not turned into long calls. Theexceptions to this rule are that weak function definitions, functions with the "long_call" attribute or the "section" attribute,and functions that are within the scope of a "#pragma long_calls" directive are always turned into long calls.This feature is not enabled by default. Specifying -mno-long-calls restores the default behavior, as does placing the functioncalls within the scope of a "#pragma long_calls_off" directive. Note these switches have no effect on how the compiler generatescode to handle function calls via function pointers.
cc -mno-long-calls ...
-msingle-pic-base
Treat the register used for PIC addressing as read-only, rather than loading it in the prologue for each function. The runtimesystem is responsible for initializing this register with an appropriate value before execution begins.
cc -msingle-pic-base ...
-mpic-data-is-text-relative
Assume that the displacement between the text and data segments is fixed at static link time. This permits using PC-relativeaddressing operations to access data known to be in the data segment. For non-VxWorks RTP targets, this option is enabled bydefault. When disabled on such targets, it will enable -msingle-pic-base by default.
cc -mpic-data-is-text-relative ...
-mpoke-function-name
Write the name of each function into the text section, directly preceding the function prologue. The generated code is similarto this:t0.ascii "arm_poke_function_name", 0.alignt1.word 0xff000000 + (t1 - t0)arm_poke_function_namemov ip, spstmfd sp!, {fp, ip, lr, pc}sub fp, ip, #4When performing a stack backtrace, code can inspect the value of "pc" stored at "fp + 0". If the trace function then looks atlocation "pc - 12" and the top 8 bits are set, then we know that there is a function name embedded immediately preceding thislocation and has length "((pc[-3]) & 0xff000000)".
cc -mpoke-function-name ...
-marm
Select between generating code that executes in ARM and Thumb states. The default for most configurations is to generate codethat executes in ARM state, but the default can be changed by configuring GCC with the --with-mode=state configure option.You can also override the ARM and Thumb mode for each function by using the "target("thumb")" and "target("arm")" functionattributes or pragmas.
cc -marm ...
-mtpcs-frame
Generate a stack frame that is compliant with the Thumb Procedure Call Standard for all non-leaf functions. (A leaf function isone that does not call any other functions.) The default is -mno-tpcs-frame.
cc -mtpcs-frame ...
-mtpcs-leaf-frame
Generate a stack frame that is compliant with the Thumb Procedure Call Standard for all leaf functions. (A leaf function is onethat does not call any other functions.) The default is -mno-apcs-leaf-frame.
cc -mtpcs-leaf-frame ...
-mcallee-super-interworking
Gives all externally visible functions in the file being compiled an ARM instruction set header which switches to Thumb modebefore executing the rest of the function. This allows these functions to be called from non-interworking code. This option isnot valid in AAPCS configurations because interworking is enabled by default.
cc -mcallee-super-interworking ...
-mtp
Specify the access model for the thread local storage pointer. The valid models are soft, which generates calls to"__aeabi_read_tp", cp15, which fetches the thread pointer from "cp15" directly (supported in the arm6k architecture), and auto,which uses the best available method for the selected processor. The default setting is auto.
cc -mtp ...
-mword-relocations
Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). This is enabled by default on targets (uClinux,SymbianOS) where the runtime loader imposes this restriction, and when -fpic or -fPIC is specified.
cc -mword-relocations ...
-mfix-cortex-m3-ldrd
Some Cortex-M3 cores can cause data corruption when "ldrd" instructions with overlapping destination and base registers are used.This option avoids generating these instructions. This option is enabled by default when -mcpu=cortex-m3 is specified.
cc -mfix-cortex-m3-ldrd ...
-mno-unaligned-access
Enables (or disables) reading and writing of 16- and 32- bit values from addresses that are not 16- or 32- bit aligned. Bydefault unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for ARMv8-M Baseline architectures, and enabled for allother architectures. If unaligned access is not enabled then words in packed data structures are accessed a byte at a time.The ARM attribute "Tag_CPU_unaligned_access" is set in the generated object file to either true or false, depending upon thesetting of this option. If unaligned access is enabled then the preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
cc -mno-unaligned-access ...
-mneon-for-64bits
Enables using Neon to handle scalar 64-bits operations. This is disabled by default since the cost of moving data from coreregisters to Neon is high.
cc -mneon-for-64bits ...
-mslow-flash-data
Assume loading data from flash is slower than fetching instruction. Therefore literal load is minimized for better performance.This option is only supported when compiling for ARMv7 M-profile and off by default.
cc -mslow-flash-data ...
-masm-syntax-unified
Assume inline assembler is using unified asm syntax. The default is currently off which implies divided syntax. This option hasno impact on Thumb2. However, this may change in future releases of GCC. Divided syntax should be considered deprecated.
cc -masm-syntax-unified ...
-mrestrict-it
Restricts generation of IT blocks to conform to the rules of ARMv8. IT blocks can only contain a single 16-bit instruction froma select set of instructions. This option is on by default for ARMv8 Thumb mode.
cc -mrestrict-it ...
-mprint-tune-info
Print CPU tuning information as comment in assembler file. This is an option used only for regression testing of the compilerand not intended for ordinary use in compiling code. This option is disabled by default.
cc -mprint-tune-info ...
-mpure-code
Do not allow constant data to be placed in code sections. Additionally, when compiling for ELF object format give all textsections the ELF processor-specific section attribute "SHF_ARM_PURECODE". This option is only available when generating non-piccode for ARMv7-M targets.
cc -mpure-code ...
-mcmse
Generate secure code as per the "ARMv8-M Security Extensions: Requirements on Development Tools Engineering Specification", whichcan be found on<http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf>.AVR OptionsThese options are defined for AVR implementations:
cc -mcmse ...
-mmcu
Specify Atmel AVR instruction set architectures (ISA) or MCU type.The default for this option is@tie{}avr2.GCC supports the following AVR devices and ISAs:"avr2""Classic" devices with up to 8@tie{}KiB of program memory. mcu@tie{}= "attiny22", "attiny26", "at90c8534", "at90s2313","at90s2323", "at90s2333", "at90s2343", "at90s4414", "at90s4433", "at90s4434", "at90s8515", "at90s8535"."avr25""Classic" devices with up to 8@tie{}KiB of program memory and with the "MOVW" instruction. mcu@tie{}= "ata5272", "ata6616c","attiny13", "attiny13a", "attiny2313", "attiny2313a", "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a","attiny43u", "attiny4313", "attiny44", "attiny44a", "attiny441", "attiny45", "attiny461", "attiny461a", "attiny48","attiny828", "attiny84", "attiny84a", "attiny841", "attiny85", "attiny861", "attiny861a", "attiny87", "attiny88","at86rf401"."avr3""Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. mcu@tie{}= "at43usb355", "at76c711"."avr31""Classic" devices with 128@tie{}KiB of program memory. mcu@tie{}= "atmega103", "at43usb320"."avr35""Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program memory and with the "MOVW" instruction. mcu@tie{}="ata5505", "ata6617c", "ata664251", "atmega16u2", "atmega32u2", "atmega8u2", "attiny1634", "attiny167", "at90usb162","at90usb82"."avr4""Enhanced" devices with up to 8@tie{}KiB of program memory. mcu@tie{}= "ata6285", "ata6286", "ata6289", "ata6612c","atmega48", "atmega48a", "atmega48p", "atmega48pa", "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega8515","atmega8535", "atmega88", "atmega88a", "atmega88p", "atmega88pa", "atmega88pb", "at90pwm1", "at90pwm2", "at90pwm2b","at90pwm3", "at90pwm3b", "at90pwm81"."avr5""Enhanced" devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. mcu@tie{}= "ata5702m322", "ata5782", "ata5790","ata5790n", "ata5791", "ata5795", "ata5831", "ata6613c", "ata6614q", "ata8210", "ata8510", "atmega16", "atmega16a","atmega16hva", "atmega16hva2", "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4", "atmega161", "atmega162","atmega163", "atmega164a", "atmega164p", "atmega164pa", "atmega165", "atmega165a", "atmega165p", "atmega165pa", "atmega168","atmega168a", "atmega168p", "atmega168pa", "atmega168pb", "atmega169", "atmega169a", "atmega169p", "atmega169pa", "atmega32","atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb", "atmega32m1", "atmega32u4", "atmega32u6", "atmega323","atmega324a", "atmega324p", "atmega324pa", "atmega325", "atmega325a", "atmega325p", "atmega325pa", "atmega3250","atmega3250a", "atmega3250p", "atmega3250pa", "atmega328", "atmega328p", "atmega328pb", "atmega329", "atmega329a","atmega329p", "atmega329pa", "atmega3290", "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406", "atmega64","atmega64a", "atmega64c1", "atmega64hve", "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640", "atmega644","atmega644a", "atmega644p", "atmega644pa", "atmega644rfr2", "atmega645", "atmega645a", "atmega645p", "atmega6450","atmega6450a", "atmega6450p", "atmega649", "atmega649a", "atmega649p", "atmega6490", "atmega6490a", "atmega6490p","at90can32", "at90can64", "at90pwm161", "at90pwm216", "at90pwm316", "at90scr100", "at90usb646", "at90usb647", "at94k","m3000"."avr51""Enhanced" devices with 128@tie{}KiB of program memory. mcu@tie{}= "atmega128", "atmega128a", "atmega128rfa1","atmega128rfr2", "atmega1280", "atmega1281", "atmega1284", "atmega1284p", "atmega1284rfr2", "at90can128", "at90usb1286","at90usb1287"."avr6""Enhanced" devices with 3-byte PC, i.e. with more than 128@tie{}KiB of program memory. mcu@tie{}= "atmega256rfr2","atmega2560", "atmega2561", "atmega2564rfr2"."avrxmega2""XMEGA" devices with more than 8@tie{}KiB and up to 64@tie{}KiB of program memory. mcu@tie{}= "atxmega16a4", "atxmega16a4u","atxmega16c4", "atxmega16d4", "atxmega16e5", "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4", "atxmega32d3","atxmega32d4", "atxmega32e5", "atxmega8e5"."avrxmega4""XMEGA" devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory. mcu@tie{}= "atxmega64a3","atxmega64a3u", "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3", "atxmega64d3", "atxmega64d4"."avrxmega5""XMEGA" devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM.mcu@tie{}= "atxmega64a1", "atxmega64a1u"."avrxmega6""XMEGA" devices with more than 128@tie{}KiB of program memory. mcu@tie{}= "atxmega128a3", "atxmega128a3u", "atxmega128b1","atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4", "atxmega192a3", "atxmega192a3u", "atxmega192c3","atxmega192d3", "atxmega256a3", "atxmega256a3b", "atxmega256a3bu", "atxmega256a3u", "atxmega256c3", "atxmega256d3","atxmega384c3", "atxmega384d3"."avrxmega7""XMEGA" devices with more than 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM. mcu@tie{}= "atxmega128a1","atxmega128a1u", "atxmega128a4u"."avrtiny""TINY" Tiny core devices with 512@tie{}B up to 4@tie{}KiB of program memory. mcu@tie{}= "attiny10", "attiny20", "attiny4","attiny40", "attiny5", "attiny9"."avr1"This ISA is implemented by the minimal AVR core and supported for assembler only. mcu@tie{}= "attiny11", "attiny12","attiny15", "attiny28", "at90s1200".
cc -mmcu ...
-mabsdata
Assume that all data in static storage can be accessed by LDS / STS instructions. This option has only an effect on reduced Tinydevices like ATtiny40. See also the "absdata" AVR Variable Attributes,variable attribute.
cc -mabsdata ...
-maccumulate-args
Accumulate outgoing function arguments and acquire/release the needed stack space for outgoing function arguments once infunction prologue/epilogue. Without this option, outgoing arguments are pushed before calling a function and popped afterwards.Popping the arguments after the function call can be expensive on AVR so that accumulating the stack space might lead to smallerexecutables because arguments need not be removed from the stack after such a function call.This option can lead to reduced code size for functions that perform several calls to functions that get their arguments on thestack like calls to printf-like functions.
cc -maccumulate-args ...
-mcall-prologues
Functions prologues/epilogues are expanded as calls to appropriate subroutines. Code size is smaller.
cc -mcall-prologues ...
-mint8
Assume "int" to be 8-bit integer. This affects the sizes of all types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2bytes, and "long long" is 4 bytes. Please note that this option does not conform to the C standards, but it results in smallercode size.
cc -mint8 ...
-mn-flash
Assume that the flash memory has a size of num times 64@tie{}KiB.
cc -mn-flash ...
-mno-interrupts
Generated code is not compatible with hardware interrupts. Code size is smaller.
cc -mno-interrupts ...
-mrmw
Assume that the device supports the Read-Modify-Write instructions "XCH", "LAC", "LAS" and "LAT".
cc -mrmw ...
-msp8
Treat the stack pointer register as an 8-bit register, i.e. assume the high byte of the stack pointer is zero. In general, youdon't need to set this option by hand.This option is used internally by the compiler to select and build multilibs for architectures "avr2" and "avr25". Thesearchitectures mix devices with and without "SPH". For any setting other than -mmcu=avr2 or -mmcu=avr25 the compiler driver addsor removes this option from the compiler proper's command line, because the compiler then knows if the device or architecture hasan 8-bit stack pointer and thus no "SPH" register or not.
cc -msp8 ...
-mstrict-X
Use address register "X" in a way proposed by the hardware. This means that "X" is only used in indirect, post-increment or pre-decrement addressing.Without this option, the "X" register may be used in the same way as "Y" or "Z" which then is emulated by additionalinstructions. For example, loading a value with "X+const" addressing with a small non-negative "const < 64" to a register Rn isperformed asadiw r26, const ; X += constld <Rn>, X ; <Rn> = *Xsbiw r26, const ; X -= const
cc -mstrict-X ...
-mtiny-stack
Only change the lower 8@tie{}bits of the stack pointer.
cc -mtiny-stack ...
-mfract-convert-truncate
Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
cc -mfract-convert-truncate ...
-nodevicelib
Don't link against AVR-LibC's device specific library "lib<mcu>.a".
cc -nodevicelib ...
-Waddr-space-convert
Warn about conversions between address spaces in the case where the resulting address space is not contained in the incomingaddress space.
cc -Waddr-space-convert ...
-Wmisspelled-isr
Warn if the ISR is misspelled, i.e. without __vector prefix. Enabled by default."EIND" and Devices with More Than 128 Ki Bytes of FlashPointers in the implementation are 16@tie{}bits wide. The address of a function or label is represented as word address so thatindirect jumps and calls can target any code address in the range of 64@tie{}Ki words.In order to facilitate indirect jump on devices with more than 128@tie{}Ki bytes of program memory space, there is a special functionregister called "EIND" that serves as most significant part of the target address when "EICALL" or "EIJMP" instructions are used.Indirect jumps and calls on these devices are handled as follows by the compiler and are subject to some limitations:* The compiler never sets "EIND".* The compiler uses "EIND" implicitly in "EICALL"/"EIJMP" instructions or might read "EIND" directly in order to emulate anindirect call/jump by means of a "RET" instruction.* The compiler assumes that "EIND" never changes during the startup code or during the application. In particular, "EIND" is notsaved/restored in function or interrupt service routine prologue/epilogue.* For indirect calls to functions and computed goto, the linker generates stubs. Stubs are jump pads sometimes also calledtrampolines. Thus, the indirect call/jump jumps to such a stub. The stub contains a direct jump to the desired address.* Linker relaxation must be turned on so that the linker generates the stubs correctly in all situations. See the compiler option
cc -Wmisspelled-isr ...
-<The
(short for generate stubs) like so:LDI r24, lo8(gs(<func>))LDI r25, hi8(gs(<func>))
cc -<The ...
-<Taking
address of a function or code label.>
cc -<Taking ...
-<If
command-line option.
cc -<If ...
-<Switch/case
tables you can specify the -fno-jump-tables command-line option.
cc -<Switch/case ...
-<C
and C++ constructors/destructors called during startup/shutdown.>
cc -<C ...
-msim
Specifies that the program will be run on the simulator. This causes the simulator BSP provided by libgloss to be linked in.This option has effect only for bfin-elf toolchain. Certain other options, such as -mid-shared-library and -mfdpic, imply -msim.
cc -msim ...
-momit-leaf-frame-pointer
Don't keep the frame pointer in a register for leaf functions. This avoids the instructions to save, set up and restore framepointers and makes an extra register available in leaf functions. The option -fomit-frame-pointer removes the frame pointer forall functions, which might make debugging harder.
cc -momit-leaf-frame-pointer ...
-mspecld-anomaly
When enabled, the compiler ensures that the generated code does not contain speculative loads after jump instructions. If thisoption is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
cc -mspecld-anomaly ...
-mcsync-anomaly
When enabled, the compiler ensures that the generated code does not contain CSYNC or SSYNC instructions too soon afterconditional branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS" is defined.
cc -mcsync-anomaly ...
-mno-csync-anomaly
Don't generate extra code to prevent CSYNC or SSYNC instructions from occurring too soon after a conditional branch.
cc -mno-csync-anomaly ...
-mlow-64k
When enabled, the compiler is free to take advantage of the knowledge that the entire program fits into the low 64k of memory.
cc -mlow-64k ...
-mno-low-64k
Assume that the program is arbitrarily large. This is the default.
cc -mno-low-64k ...
-mstack-check-l1
Do stack checking using information placed into L1 scratchpad memory by the uClinux kernel.
cc -mstack-check-l1 ...
-mid-shared-library
Generate code that supports shared libraries via the library ID method. This allows for execute in place and shared libraries inan environment without virtual memory management. This option implies -fPIC. With a bfin-elf target, this option implies -msim.
cc -mid-shared-library ...
-mleaf-id-shared-library
Generate code that supports shared libraries via the library ID method, but assumes that this library or executable won't linkagainst any other ID shared libraries. That allows the compiler to use faster code for jumps and calls.
cc -mleaf-id-shared-library ...
-mno-leaf-id-shared-library
Do not assume that the code being compiled won't link against any ID shared libraries. Slower code is generated for jump andcall insns.
cc -mno-leaf-id-shared-library ...
-mshared-library-id
Specifies the identification number of the ID-based shared library being compiled. Specifying a value of 0 generates morecompact code; specifying other values forces the allocation of that number to the current library but is no more space- or time-efficient than omitting this option.
cc -mshared-library-id ...
-msep-data
Generate code that allows the data segment to be located in a different area of memory from the text segment. This allows forexecute in place in an environment without virtual memory management by eliminating relocations against the text section.
cc -msep-data ...
-mfast-fp
Link with the fast floating-point library. This library relaxes some of the IEEE floating-point standard's rules for checkinginputs against Not-a-Number (NAN), in the interest of performance.
cc -mfast-fp ...
-minline-plt
Enable inlining of PLT entries in function calls to functions that are not known to bind locally. It has no effect without
cc -minline-plt ...
-mmulticore
Build a standalone application for multicore Blackfin processors. This option causes proper start files and link scriptssupporting multicore to be used, and defines the macro "__BFIN_MULTICORE". It can only be used with -mcpu=bf561[-sirevision].This option can be used with -mcorea or -mcoreb, which selects the one-application-per-core programming model. Without -mcoreaor -mcoreb, the single-application/dual-core programming model is used. In this model, the main function of Core B should benamed as "coreb_main".If this option is not used, the single-core application programming model is used.
cc -mmulticore ...
-mcorea
Build a standalone application for Core A of BF561 when using the one-application-per-core programming model. Proper start filesand link scripts are used to support Core A, and the macro "__BFIN_COREA" is defined. This option can only be used inconjunction with -mmulticore.
cc -mcorea ...
-mcoreb
Build a standalone application for Core B of BF561 when using the one-application-per-core programming model. Proper start filesand link scripts are used to support Core B, and the macro "__BFIN_COREB" is defined. When this option is used, "coreb_main"should be used instead of "main". This option can only be used in conjunction with -mmulticore.
cc -mcoreb ...
-msdram
Build a standalone application for SDRAM. Proper start files and link scripts are used to put the application into SDRAM, and themacro "__BFIN_SDRAM" is defined. The loader should initialize SDRAM before loading the application.
cc -msdram ...
-micplb
Assume that ICPLBs are enabled at run time. This has an effect on certain anomaly workarounds. For Linux targets, the defaultis to assume ICPLBs are enabled; for standalone applications the default is off.C6X Options
cc -micplb ...
-msdata
Put small global and static data in the ".neardata" section, which is pointed to by register "B14". Put small uninitializedglobal and static data in the ".bss" section, which is adjacent to the ".neardata" section. Put small read-only data into the".rodata" section. The corresponding sections used for large pieces of data are ".fardata", ".far" and ".const".
cc -msdata ...
-mmax-stack-frame
Warn when the stack frame of a function exceeds n bytes.
cc -mmax-stack-frame ...
-metrax100
The options -metrax4 and -metrax100 are synonyms for -march=v3 and -march=v8 respectively.
cc -metrax100 ...
-mno-mul-bug-workaround
Work around a bug in the "muls" and "mulu" instructions for CPU models where it applies. This option is active by default.
cc -mno-mul-bug-workaround ...
-mpdebug
Enable CRIS-specific verbose debug-related information in the assembly code. This option also has the effect of turning off the#NO_APP formatted-code indicator to the assembler at the beginning of the assembly file.
cc -mpdebug ...
-mno-side-effects
Do not emit instructions with side effects in addressing modes other than post-increment.
cc -mno-side-effects ...
-mno-const-align
These options (no- options) arrange (eliminate arrangements) for the stack frame, individual data and constants to be aligned forthe maximum single data access size for the chosen CPU model. The default is to arrange for 32-bit alignment. ABI details suchas structure layout are not affected by these options.
cc -mno-const-align ...
-m8-bit
Similar to the stack- data- and const-align options above, these options arrange for stack frame, writable data and constants toall be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit alignment.
cc -m8-bit ...
-mprologue-epilogue
With -mno-prologue-epilogue, the normal function prologue and epilogue which set up the stack frame are omitted and no returninstructions or return sequences are generated in the code. Use this option only together with visual inspection of the compiledcode: no warnings or errors are generated when call-saved registers must be saved, or storage for local variables needs to beallocated.
cc -mprologue-epilogue ...
-mgotplt
With -fpic and -fPIC, don't generate (do generate) instruction sequences that load addresses for functions from the PLT part ofthe GOT rather than (traditional on other architectures) calls to the PLT. The default is -mgotplt.
cc -mgotplt ...
-melf
Legacy no-op option only recognized with the cris-axis-elf and cris-axis-linux-gnu targets.
cc -melf ...
-mlinux
Legacy no-op option only recognized with the cris-axis-linux-gnu target.
cc -mlinux ...
-sim
This option, recognized for the cris-axis-elf, arranges to link with input-output functions from a simulator library. Code,initialized data and zero-initialized data are allocated consecutively.
cc -sim ...
-sim2
Like -sim, but pass linker options to locate initialized data at 0x40000000 and zero-initialized data at 0x80000000.CR16 OptionsThese options are defined specifically for the CR16 ports.
cc -sim2 ...
-mmac
Enable the use of multiply-accumulate instructions. Disabled by default.
cc -mmac ...
-mcr16c
Generate code for CR16C or CR16C+ architecture. CR16C+ architecture is default.
cc -mcr16c ...
-mint32
Choose integer type as 32-bit wide.
cc -mint32 ...
-mbit-ops
Generates "sbit"/"cbit" instructions for bit manipulations.
cc -mbit-ops ...
-mdata-model
Choose a data model. The choices for model are near, far or medium. medium is default. However, far is not valid with -mcr16c,as the CR16C architecture does not support the far data model.Darwin OptionsThese options are defined for all architectures running the Darwin operating system.FSF GCC on Darwin does not create "fat" object files; it creates an object file for the single architecture that GCC was built totarget. Apple's GCC on Darwin does create "fat" files if multiple -arch options are used; it does so by running the compiler orlinker multiple times and joining the results together with lipo.The subtype of the file created (like ppc7400 or ppc970 or i686) is determined by the flags that specify the ISA that GCC istargeting, like -mcpu or -march. The -force_cpusubtype_ALL option can be used to override this.The Darwin tools vary in their behavior when presented with an ISA mismatch. The assembler, as, only permits instructions to be usedthat are valid for the subtype of the file it is generating, so you cannot put 64-bit instructions in a ppc750 object file. Thelinker for shared libraries, /usr/bin/libtool, fails and prints an error if asked to create a shared library with a less restrictivesubtype than its input files (for instance, trying to put a ppc970 object file in a ppc7400 library). The linker for executables,ld, quietly gives the executable the most restrictive subtype of any of its input files.
cc -mdata-model ...
-Fdir
Add the framework directory dir to the head of the list of directories to be searched for header files. These directories areinterleaved with those specified by -I options and are scanned in a left-to-right order.A framework directory is a directory with frameworks in it. A framework is a directory with a Headers and/or PrivateHeadersdirectory contained directly in it that ends in .framework. The name of a framework is the name of this directory excluding the.framework. Headers associated with the framework are found in one of those two directories, with Headers being searched first.A subframework is a framework directory that is in a framework's Frameworks directory. Includes of subframework headers can onlyappear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks aresiblings if they occur in the same framework. A subframework should not have the same name as a framework; a warning is issuedif this is violated. Currently a subframework cannot have subframeworks; in the future, the mechanism may be extended to supportthis. The standard frameworks can be found in /System/Library/Frameworks and /Library/Frameworks. An example include looks like"#include <Framework/header.h>", where Framework denotes the name of the framework and header.h is found in the PrivateHeaders orHeaders directory.
cc -Fdir ...
-iframeworkdir
Like -F except the directory is a treated as a system directory. The main difference between this -iframework and -F is thatwith -iframework the compiler does not warn about constructs contained within header files found via dir. This option is validonly for the C family of languages.
cc -iframeworkdir ...
-gused
Emit debugging information for symbols that are used. For stabs debugging format, this enables -feliminate-unused-debug-symbols.This is by default ON.
cc -gused ...
-gfull
Emit debugging information for all symbols and types.
cc -gfull ...
-mmacosx-version-min
The earliest version of MacOS X that this executable will run on is version. Typical values of version include 10.1, 10.2, and10.3.9.If the compiler was built to use the system's headers by default, then the default for this option is the system version on whichthe compiler is running, otherwise the default is to make choices that are compatible with as many systems and code bases aspossible.
cc -mmacosx-version-min ...
-mkernel
Enable kernel development mode. The -mkernel option sets -static, -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
cc -mkernel ...
-fno-non-call-exceptions
-fapple-kext -fno-weak and -fno-rtti where applicable. This mode also sets -mno-altivec
cc -fno-non-call-exceptions ...
-findirect-data
Generate code suitable for fast turnaround development, such as to allow GDB to dynamically load .o files into already-runningprograms. -findirect-data and -ffix-and-continue are provided for backwards compatibility.
cc -findirect-data ...
-all_load
Loads all members of static archive libraries. See man ld(1) for more information.
cc -all_load ...
-arch_errors_fatal
Cause the errors having to do with files that have the wrong architecture to be fatal.
cc -arch_errors_fatal ...
-bind_at_load
Causes the output file to be marked such that the dynamic linker will bind all undefined references when the file is loaded orlaunched.
cc -bind_at_load ...
-bundle
Produce a Mach-o bundle format file. See man ld(1) for more information.
cc -bundle ...
-bundle_loader
This option specifies the executable that will load the build output file being linked. See man ld(1) for more information.
cc -bundle_loader ...
-force_cpusubtype_ALL
This causes GCC's output file to have the ALL subtype, instead of one controlled by the -mcpu or -march option.
cc -force_cpusubtype_ALL ...
-whatsloaded
These options are passed to the Darwin linker. The Darwin linker man page describes them in detail.DEC Alpha OptionsThese -m options are defined for the DEC Alpha implementations:
cc -whatsloaded ...
-mno-fp-regs
Generate code that uses (does not use) the floating-point register set. -mno-fp-regs implies -msoft-float. If the floating-point register set is not used, floating-point operands are passed in integer registers as if they were integers and floating-point results are passed in $0 instead of $f0. This is a non-standard calling sequence, so any function with a floating-pointargument or return value called by code compiled with -mno-fp-regs must also be compiled with that option.A typical use of this option is building a kernel that does not use, and hence need not save and restore, any floating-pointregisters.
cc -mno-fp-regs ...
-mieee
The Alpha architecture implements floating-point hardware optimized for maximum performance. It is mostly compliant with theIEEE floating-point standard. However, for full compliance, software assistance is required. This option generates code fullyIEEE-compliant code except that the inexact-flag is not maintained (see below). If this option is turned on, the preprocessormacro "_IEEE_FP" is defined during compilation. The resulting code is less efficient but is able to correctly supportdenormalized numbers and exceptional IEEE values such as not-a-number and plus/minus infinity. Other Alpha compilers call thisoption -ieee_with_no_inexact.
cc -mieee ...
-mieee-with-inexact
This is like -mieee except the generated code also maintains the IEEE inexact-flag. Turning on this option causes the generatedcode to implement fully-compliant IEEE math. In addition to "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro. Onsome Alpha implementations the resulting code may execute significantly slower than the code generated by default. Since thereis very little code that depends on the inexact-flag, you should normally not specify this option. Other Alpha compilers callthis option -ieee_with_inexact.
cc -mieee-with-inexact ...
-mfp-trap-mode
This option controls what floating-point related traps are enabled. Other Alpha compilers call this option -fptm trap-mode. Thetrap mode can be set to one of four values:n This is the default (normal) setting. The only traps that are enabled are the ones that cannot be disabled in software(e.g., division by zero trap).u In addition to the traps enabled by n, underflow traps are enabled as well.su Like u, but the instructions are marked to be safe for software completion (see Alpha architecture manual for details).sui Like su, but inexact traps are enabled as well.
cc -mfp-trap-mode ...
-mtrap-precision
In the Alpha architecture, floating-point traps are imprecise. This means without software assistance it is impossible torecover from a floating trap and program execution normally needs to be terminated. GCC can generate code that can assistoperating system trap handlers in determining the exact location that caused a floating-point trap. Depending on therequirements of an application, different levels of precisions can be selected:p Program precision. This option is the default and means a trap handler can only identify which program caused a floating-point exception.f Function precision. The trap handler can determine the function that caused a floating-point exception.i Instruction precision. The trap handler can determine the exact instruction that caused a floating-point exception.Other Alpha compilers provide the equivalent options called -scope_safe and -resumption_safe.
cc -mtrap-precision ...
-mieee-conformant
This option marks the generated code as IEEE conformant. You must not use this option unless you also specify -mtrap-precision=iand either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is to emit the line .eflag 48 in the function prologue ofthe generated assembly file.
cc -mieee-conformant ...
-mbuild-constants
Normally GCC examines a 32- or 64-bit integer constant to see if it can construct it from smaller constants in two or threeinstructions. If it cannot, it outputs the constant as a literal and generates code to load it from the data segment at runtime.Use this option to require GCC to construct all integer constants using code, even if it takes more instructions (the maximum issix).You typically use this option to build a shared library dynamic loader. Itself a shared library, it must relocate itself inmemory before it can find the variables and constants in its own data segment.
cc -mbuild-constants ...
-mno-max
Indicate whether GCC should generate code to use the optional BWX, CIX, FIX and MAX instruction sets. The default is to use theinstruction sets supported by the CPU type specified via -mcpu= option or that of the CPU on which GCC was built if none isspecified.
cc -mno-max ...
-mfloat-ieee
Generate code that uses (does not use) VAX F and G floating-point arithmetic instead of IEEE single and double precision.
cc -mfloat-ieee ...
-mno-explicit-relocs
Older Alpha assemblers provided no way to generate symbol relocations except via assembler macros. Use of these macros does notallow optimal instruction scheduling. GNU binutils as of version 2.12 supports a new syntax that allows the compiler toexplicitly mark which relocations should apply to which instructions. This option is mostly useful for debugging, as GCC detectsthe capabilities of the assembler when it is built and sets the default accordingly.
cc -mno-explicit-relocs ...
-mlarge-data
When -mexplicit-relocs is in effect, static data is accessed via gp-relative relocations. When -msmall-data is used, objects 8bytes long or smaller are placed in a small data area (the ".sdata" and ".sbss" sections) and are accessed via 16-bit relocationsoff of the $gp register. This limits the size of the small data area to 64KB, but allows the variables to be directly accessedvia a single instruction.The default is -mlarge-data. With this option the data area is limited to just below 2GB. Programs that require more than 2GBof data must use "malloc" or "mmap" to allocate the data in the heap instead of in the program's data segment.When generating code for shared libraries, -fpic implies -msmall-data and -fPIC implies -mlarge-data.
cc -mlarge-data ...
-mlarge-text
When -msmall-text is used, the compiler assumes that the code of the entire program (or shared library) fits in 4MB, and is thusreachable with a branch instruction. When -msmall-data is used, the compiler can assume that all local symbols share the same$gp value, and thus reduce the number of instructions required for a function call from 4 to 1.The default is -mlarge-text.
cc -mlarge-text ...
-mmemory-latency
Sets the latency the scheduler should assume for typical memory references as seen by the application. This number is highlydependent on the memory access patterns used by the application and the size of the external cache on the machine.Valid options for time arenumberA decimal number representing clock cycles.L1L2L3mainThe compiler contains estimates of the number of clock cycles for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches(also called Dcache, Scache, and Bcache), as well as to main memory. Note that L3 is only valid for EV5.FR30 OptionsThese options are defined specifically for the FR30 port.
cc -mmemory-latency ...
-msmall-model
Use the small address space model. This can produce smaller code, but it does assume that all symbolic values and addresses fitinto a 20-bit range.
cc -msmall-model ...
-mlra
Enable Local Register Allocation. This is still experimental for FT32, so by default the compiler uses standard reload.
cc -mlra ...
-mnodiv
Do not use div and mod instructions.FRV Options
cc -mnodiv ...
-mgpr-32
Only use the first 32 general-purpose registers.
cc -mgpr-32 ...
-mgpr-64
Use all 64 general-purpose registers.
cc -mgpr-64 ...
-mfpr-32
Use only the first 32 floating-point registers.
cc -mfpr-32 ...
-mfpr-64
Use all 64 floating-point registers.
cc -mfpr-64 ...
-malloc-cc
Dynamically allocate condition code registers.
cc -malloc-cc ...
-mfixed-cc
Do not try to dynamically allocate condition code registers, only use "icc0" and "fcc0".
cc -mfixed-cc ...
-mdword
Change ABI to use double word insns.
cc -mdword ...
-mno-dword
Do not use double word instructions.
cc -mno-dword ...
-mno-double
Do not use floating-point double instructions.
cc -mno-double ...
-mmedia
Use media instructions.
cc -mmedia ...
-mno-media
Do not use media instructions.
cc -mno-media ...
-mmuladd
Use multiply and add/subtract instructions.
cc -mmuladd ...
-mno-muladd
Do not use multiply and add/subtract instructions.
cc -mno-muladd ...
-mfdpic
Select the FDPIC ABI, which uses function descriptors to represent pointers to functions. Without any PIC/PIE-related options,it implies -fPIE. With -fpic or -fpie, it assumes GOT entries and small data are within a 12-bit range from the GOT baseaddress; with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a bfin-elf target, this option implies -msim.
cc -mfdpic ...
-mTLS
Assume a large TLS segment when generating thread-local code.
cc -mTLS ...
-mtls
Do not assume a large TLS segment when generating thread-local code.
cc -mtls ...
-mgprel-ro
Enable the use of "GPREL" relocations in the FDPIC ABI for data that is known to be in read-only sections. It's enabled bydefault, except for -fpic or -fpie: even though it may help make the global offset table smaller, it trades 1 instruction for 4.With -fPIC or -fPIE, it trades 3 instructions for 4, one of which may be shared by multiple symbols, and it avoids the need for aGOT entry for the referenced symbol, so it's more likely to be a win. If it is not, -mno-gprel-ro can be used to disable it.
cc -mgprel-ro ...
-multilib-library-pic
Link with the (library, not FD) pic libraries. It's implied by -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic.You should never have to use it explicitly.
cc -multilib-library-pic ...
-malign-labels
Try to align labels to an 8-byte boundary by inserting NOPs into the previous packet. This option only has an effect when VLIWpacking is enabled. It doesn't create new packets; it merely adds NOPs to existing ones.
cc -malign-labels ...
-mlibrary-pic
Generate position-independent EABI code.
cc -mlibrary-pic ...
-macc-4
Use only the first four media accumulator registers.
cc -macc-4 ...
-macc-8
Use all eight media accumulator registers.
cc -macc-8 ...
-mpack
Pack VLIW instructions.
cc -mpack ...
-mno-pack
Do not pack VLIW instructions.
cc -mno-pack ...
-mno-eflags
Do not mark ABI switches in e_flags.
cc -mno-eflags ...
-mcond-move
Enable the use of conditional-move instructions (default).This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mcond-move ...
-mscc
Enable the use of conditional set instructions (default).This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mscc ...
-mno-scc
Disable the use of conditional set instructions.This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mno-scc ...
-mcond-exec
Enable the use of conditional execution (default).This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mcond-exec ...
-mvliw-branch
Run a pass to pack branches into VLIW instructions (default).This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mvliw-branch ...
-mmulti-cond-exec
Enable optimization of "&&" and "||" in conditional execution (default).This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mmulti-cond-exec ...
-mno-multi-cond-exec
Disable optimization of "&&" and "||" in conditional execution.This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mno-multi-cond-exec ...
-mnested-cond-exec
Enable nested conditional execution optimizations (default).This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mnested-cond-exec ...
-mno-nested-cond-exec
Disable nested conditional execution optimizations.This switch is mainly for debugging the compiler and will likely be removed in a future version.
cc -mno-nested-cond-exec ...
-moptimize-membar
This switch removes redundant "membar" instructions from the compiler-generated code. It is enabled by default.
cc -moptimize-membar ...
-mno-optimize-membar
This switch disables the automatic removal of redundant "membar" instructions from the generated code.
cc -mno-optimize-membar ...
-mtomcat-stats
Cause gas to print out tomcat statistics.
cc -mtomcat-stats ...
-mglibc
Use the GNU C library. This is the default except on *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android* targets.
cc -mglibc ...
-muclibc
Use uClibc C library. This is the default on *-*-linux-*uclibc* targets.
cc -muclibc ...
-mmusl
Use the musl C library. This is the default on *-*-linux-*musl* targets.
cc -mmusl ...
-mbionic
Use Bionic C library. This is the default on *-*-linux-*android* targets.
cc -mbionic ...
-mandroid
Compile code compatible with Android platform. This is the default on *-*-linux-*android* targets.When compiling, this option enables -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default. When linking, this option makesthe GCC driver pass Android-specific options to the linker. Finally, this option causes the preprocessor macro "__ANDROID__" tobe defined.
cc -mandroid ...
-tno-android-cc
Disable compilation effects of -mandroid, i.e., do not enable -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
cc -tno-android-cc ...
-tno-android-ld
Disable linking effects of -mandroid, i.e., pass standard Linux linking options to the linker.H8/300 OptionsThese -m options are defined for the H8/300 implementations:
cc -tno-android-ld ...
-mh
Generate code for the H8/300H.
cc -mh ...
-ms
Generate code for the H8S.
cc -ms ...
-mn
Generate code for the H8S and H8/300H in the normal mode. This switch must be used either with -mh or -ms.
cc -mn ...
-ms2600
Generate code for the H8S/2600. This switch must be used with -ms.
cc -ms2600 ...
-mexr
Extended registers are stored on stack before execution of function with monitor attribute. Default option is -mexr. This optionis valid only for H8S targets.
cc -mexr ...
-mno-exr
Extended registers are not stored on stack before execution of function with monitor attribute. Default option is -mno-exr. Thisoption is valid only for H8S targets.
cc -mno-exr ...
-malign-300
On the H8/300H and H8S, use the same alignment rules as for the H8/300. The default for the H8/300H and H8S is to align longsand floats on 4-byte boundaries. -malign-300 causes them to be aligned on 2-byte boundaries. This option has no effect on theH8/300.HPPA OptionsThese -m options are defined for the HPPA family of computers:
cc -malign-300 ...
-mpa-risc-2-0
Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
cc -mpa-risc-2-0 ...
-mcaller-copies
The caller copies function arguments passed by hidden reference. This option should be used with care as it is not compatiblewith the default 32-bit runtime. However, only aggregates larger than eight bytes are passed by hidden reference and the optionprovides better compatibility with OpenMP.
cc -mcaller-copies ...
-mjump-in-delay
This option is ignored and provided for compatibility purposes only.
cc -mjump-in-delay ...
-mdisable-fpregs
Prevent floating-point registers from being used in any manner. This is necessary for compiling kernels that perform lazycontext switching of floating-point registers. If you use this option and attempt to perform floating-point operations, thecompiler aborts.
cc -mdisable-fpregs ...
-mdisable-indexing
Prevent the compiler from using indexing address modes. This avoids some rather obscure problems when compiling MIG generatedcode under MACH.
cc -mdisable-indexing ...
-mno-space-regs
Generate code that assumes the target has no space registers. This allows GCC to generate faster indirect calls and use unscaledindex address modes.Such code is suitable for level 0 PA systems and kernels.
cc -mno-space-regs ...
-mfast-indirect-calls
Generate code that assumes calls never cross space boundaries. This allows GCC to emit code that performs faster indirect calls.This option does not work in the presence of shared libraries or nested functions.
cc -mfast-indirect-calls ...
-mlong-load-store
Generate 3-instruction load and store sequences as sometimes required by the HP-UX 10 linker. This is equivalent to the +koption to the HP compilers.
cc -mlong-load-store ...
-mgas
Enable the use of assembler directives only GAS understands.
cc -mgas ...
-mschedule
Schedule code according to the constraints for the machine type cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system to determine the proper scheduling option for your machine.The default scheduling is 8000.
cc -mschedule ...
-mlinker-opt
Enable the optimization pass in the HP-UX linker. Note this makes symbolic debugging impossible. It also triggers a bug in theHP-UX 8 and HP-UX 9 linkers in which they give bogus error messages when linking some programs.
cc -mlinker-opt ...
-msio
Generate the predefine, "_SIO", for server IO. The default is -mwsio. This generates the predefines, "__hp9000s700","__hp9000s700__" and "_WSIO", for workstation IO. These options are available under HP-UX and HI-UX.
cc -msio ...
-mhp-ld
Use options specific to HP ld. This passes -b to ld when building a shared library and passes +Accept TypeMismatch to ld on alllinks. It is the default when GCC is configured, explicitly or implicitly, with the HP linker. This option does not affectwhich ld is called; it only changes what parameters are passed to that ld. The ld that is called is determined by the --with-ldconfigure option, GCC's program search path, and finally by the user's PATH. The linker used by GCC can be printed using which`gcc -print-prog-name=ld`. This option is only available on the 64-bit HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
cc -mhp-ld ...
-munix
Generate compiler predefines and select a startfile for the specified UNIX standard. The choices for unix-std are 93, 95 and 98.93 is supported on all HP-UX versions. 95 is available on HP-UX 10.10 and later. 98 is available on HP-UX 11.11 and later. Thedefault values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to 11.00, and 98 for HP-UX 11.11 and later.
cc -munix ...
-nolibdld
Suppress the generation of link options to search libdld.sl when the -static option is specified on HP-UX 10 and later.
cc -nolibdld ...
-threads
Add support for multithreading with the dce thread library under HP-UX. This option sets flags for both the preprocessor andlinker.IA-64 OptionsThese are the -m options defined for the Intel IA-64 architecture.
cc -threads ...
-mno-gnu-as
Generate (or don't) code for the GNU assembler. This is the default.
cc -mno-gnu-as ...
-mno-gnu-ld
Generate (or don't) code for the GNU linker. This is the default.
cc -mno-gnu-ld ...
-mno-pic
Generate code that does not use a global pointer register. The result is not position independent code, and violates the IA-64ABI.
cc -mno-pic ...
-mno-volatile-asm-stop
Generate (or don't) a stop bit immediately before and after volatile asm statements.
cc -mno-volatile-asm-stop ...
-mno-register-names
Generate (or don't) in, loc, and out register names for the stacked registers. This may make assembler output more readable.
cc -mno-register-names ...
-mconstant-gp
Generate code that uses a single constant global pointer value. This is useful when compiling kernel code.
cc -mconstant-gp ...
-mauto-pic
Generate code that is self-relocatable. This implies -mconstant-gp. This is useful when compiling firmware code.
cc -mauto-pic ...
-minline-float-divide-min-latency
Generate code for inline divides of floating-point values using the minimum latency algorithm.
cc -minline-float-divide-min-latency ...
-minline-float-divide-max-throughput
Generate code for inline divides of floating-point values using the maximum throughput algorithm.
cc -minline-float-divide-max-throughput ...
-minline-int-divide-min-latency
Generate code for inline divides of integer values using the minimum latency algorithm.
cc -minline-int-divide-min-latency ...
-minline-int-divide-max-throughput
Generate code for inline divides of integer values using the maximum throughput algorithm.
cc -minline-int-divide-max-throughput ...
-mno-inline-int-divide
Do not generate inline code for divides of integer values.
cc -mno-inline-int-divide ...
-minline-sqrt-min-latency
Generate code for inline square roots using the minimum latency algorithm.
cc -minline-sqrt-min-latency ...
-minline-sqrt-max-throughput
Generate code for inline square roots using the maximum throughput algorithm.
cc -minline-sqrt-max-throughput ...
-mno-inline-sqrt
Do not generate inline code for "sqrt".
cc -mno-inline-sqrt ...
-mdwarf2-asm
Don't (or do) generate assembler code for the DWARF line number debugging info. This may be useful when not using the GNUassembler.
cc -mdwarf2-asm ...
-mno-early-stop-bits
Allow stop bits to be placed earlier than immediately preceding the instruction that triggered the stop bit. This can improveinstruction scheduling, but does not always do so.
cc -mno-early-stop-bits ...
-mlp64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits. The 64-bitenvironment sets int to 32 bits and long and pointer to 64 bits. These are HP-UX specific flags.
cc -mlp64 ...
-msched-br-data-spec
(Dis/En)able data speculative scheduling before reload. This results in generation of "ld.a" instructions and the correspondingcheck instructions ("ld.c" / "chk.a"). The default setting is disabled.
cc -msched-br-data-spec ...
-mno-sched-ar-data-spec
(En/Dis)able data speculative scheduling after reload. This results in generation of "ld.a" instructions and the correspondingcheck instructions ("ld.c" / "chk.a"). The default setting is enabled.
cc -mno-sched-ar-data-spec ...
-msched-control-spec
(Dis/En)able control speculative scheduling. This feature is available only during region scheduling (i.e. before reload). Thisresults in generation of the "ld.s" instructions and the corresponding check instructions "chk.s". The default setting isdisabled.
cc -msched-control-spec ...
-mno-sched-br-in-data-spec
(En/Dis)able speculative scheduling of the instructions that are dependent on the data speculative loads before reload. This iseffective only with -msched-br-data-spec enabled. The default setting is enabled.
cc -mno-sched-br-in-data-spec ...
-mno-sched-ar-in-data-spec
(En/Dis)able speculative scheduling of the instructions that are dependent on the data speculative loads after reload. This iseffective only with -msched-ar-data-spec enabled. The default setting is enabled.
cc -mno-sched-ar-in-data-spec ...
-mno-sched-in-control-spec
(En/Dis)able speculative scheduling of the instructions that are dependent on the control speculative loads. This is effectiveonly with -msched-control-spec enabled. The default setting is enabled.
cc -mno-sched-in-control-spec ...
-msched-prefer-non-control-spec-insns
If enabled, control-speculative instructions are chosen for schedule only if there are no other choices at the moment. Thismakes the use of the control speculation much more conservative. The default setting is disabled.
cc -msched-prefer-non-control-spec-insns ...
-msched-spec-ldc
Use a simple data speculation check. This option is on by default.
cc -msched-spec-ldc ...
-msched-control-spec-ldc
Use a simple check for control speculation. This option is on by default.
cc -msched-control-spec-ldc ...
-msched-stop-bits-after-every-cycle
Place a stop bit after every cycle when scheduling. This option is on by default.
cc -msched-stop-bits-after-every-cycle ...
-msched-fp-mem-deps-zero-cost
Assume that floating-point stores and loads are not likely to cause a conflict when placed into the same instruction group. Thisoption is disabled by default.
cc -msched-fp-mem-deps-zero-cost ...
-msel-sched-dont-check-control-spec
Generate checks for control speculation in selective scheduling. This flag is disabled by default.
cc -msel-sched-dont-check-control-spec ...
-msched-max-memory-insns
Limit on the number of memory insns per instruction group, giving lower priority to subsequent memory insns attempting toschedule in the same instruction group. Frequently useful to prevent cache bank conflicts. The default value is 1.
cc -msched-max-memory-insns ...
-mbarrel-shift-enabled
Enable barrel-shift instructions.
cc -mbarrel-shift-enabled ...
-mdivide-enabled
Enable divide and modulus instructions.
cc -mdivide-enabled ...
-mmultiply-enabled
Enable multiply instructions.
cc -mmultiply-enabled ...
-msign-extend-enabled
Enable sign extend instructions.
cc -msign-extend-enabled ...
-muser-enabled
Enable user-defined instructions.M32C Options
cc -muser-enabled ...
-memregs
Specifies the number of memory-based pseudo-registers GCC uses during code generation. These pseudo-registers are used like realregisters, so there is a tradeoff between GCC's ability to fit the code into available registers, and the performance penalty ofusing memory instead of registers. Note that all modules in a program must be compiled with the same value for this option.Because of that, you must not use this option with GCC's default runtime libraries.M32R/D OptionsThese -m options are defined for Renesas M32R/D architectures:
cc -memregs ...
-m32r2
Generate code for the M32R/2.
cc -m32r2 ...
-m32rx
Generate code for the M32R/X.
cc -m32rx ...
-m32r
Generate code for the M32R. This is the default.
cc -m32r ...
-G
Put global and static objects less than or equal to num bytes into the small data or BSS sections instead of the normal data orBSS sections. The default value of num is 8. The -msdata option must be set to one of sdata or use for this option to have anyeffect.All modules should be compiled with the same -G num value. Compiling with different values of num may or may not work; if itdoesn't the linker gives an error message---incorrect code is not generated.
cc -G ...
-mdebug
Makes the M32R-specific code in the compiler display some statistics that might help in debugging programs.
cc -mdebug ...
-malign-loops
Align all loops to a 32-byte boundary.
cc -malign-loops ...
-mno-align-loops
Do not enforce a 32-byte alignment for loops. This is the default.
cc -mno-align-loops ...
-missue-rate
Issue number instructions per cycle. number can only be 1 or 2.
cc -missue-rate ...
-mflush-trap
Specifies the trap number to use to flush the cache. The default is 12. Valid numbers are between 0 and 15 inclusive.
cc -mflush-trap ...
-mno-flush-trap
Specifies that the cache cannot be flushed by using a trap.
cc -mno-flush-trap ...
-mflush-func
Specifies the name of the operating system function to call to flush the cache. The default is _flush_cache, but a function callis only used if a trap is not available.
cc -mflush-func ...
-mno-flush-func
Indicates that there is no OS function for flushing the cache.M680x0 OptionsThese are the -m options defined for M680x0 and ColdFire processors. The default settings depend on which architecture was selectedwhen the compiler was configured; the defaults for the most common choices are given below.
cc -mno-flush-func ...
-mtune=68020-60,
GCC also defines the macro "__muarch__" when tuning for ColdFire microarchitecture uarch, where uarch is one of the argumentsgiven above.
cc -mtune=68020-60, ...
-mc68000
Generate output for a 68000. This is the default when the compiler is configured for 68000-based systems. It is equivalent to
cc -mc68000 ...
-m68010
Generate output for a 68010. This is the default when the compiler is configured for 68010-based systems. It is equivalent to
cc -m68010 ...
-mc68020
Generate output for a 68020. This is the default when the compiler is configured for 68020-based systems. It is equivalent to
cc -mc68020 ...
-m68030
Generate output for a 68030. This is the default when the compiler is configured for 68030-based systems. It is equivalent to
cc -m68030 ...
-m68040
Generate output for a 68040. This is the default when the compiler is configured for 68040-based systems. It is equivalent to
cc -m68040 ...
-m68060
Generate output for a 68060. This is the default when the compiler is configured for 68060-based systems. It is equivalent to
cc -m68060 ...
-mcpu32
Generate output for a CPU32. This is the default when the compiler is configured for CPU32-based systems. It is equivalent to
cc -mcpu32 ...
-m5206e
Generate output for a 5206e ColdFire CPU. The option is now deprecated in favor of the equivalent -mcpu=5206e.
cc -m5206e ...
-m528x
Generate output for a member of the ColdFire 528X family. The option is now deprecated in favor of the equivalent -mcpu=528x.
cc -m528x ...
-m5307
Generate output for a ColdFire 5307 CPU. The option is now deprecated in favor of the equivalent -mcpu=5307.
cc -m5307 ...
-m5407
Generate output for a ColdFire 5407 CPU. The option is now deprecated in favor of the equivalent -mcpu=5407.
cc -m5407 ...
-mcfv4e
Generate output for a ColdFire V4e family CPU (e.g. 547x/548x). This includes use of hardware floating-point instructions. Theoption is equivalent to -mcpu=547x, and is now deprecated in favor of that option.
cc -mcfv4e ...
-m68020-40
Generate output for a 68040, without using any of the new instructions. This results in code that can run relatively efficientlyon either a 68020/68881 or a 68030 or a 68040. The generated code does use the 68881 instructions that are emulated on the68040.The option is equivalent to -march=68020 -mtune=68020-40.
cc -m68020-40 ...
-m68020-60
Generate output for a 68060, without using any of the new instructions. This results in code that can run relatively efficientlyon either a 68020/68881 or a 68030 or a 68040. The generated code does use the 68881 instructions that are emulated on the68060.The option is equivalent to -march=68020 -mtune=68020-60.
cc -m68020-60 ...
-m68881
Generate floating-point instructions. This is the default for 68020 and above, and for ColdFire devices that have an FPU. Itdefines the macro "__HAVE_68881__" on M680x0 targets and "__mcffpu__" on ColdFire targets.
cc -m68881 ...
-mno-div
Generate (do not generate) ColdFire hardware divide and remainder instructions. If -march is used without -mcpu, the default is"on" for ColdFire architectures and "off" for M680x0 architectures. Otherwise, the default is taken from the target CPU (eitherthe default CPU, or the one specified by -mcpu). For example, the default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.GCC defines the macro "__mcfhwdiv__" when this option is enabled.
cc -mno-div ...
-mshort
Consider type "int" to be 16 bits wide, like "short int". Additionally, parameters passed on the stack are also aligned to a16-bit boundary even on targets whose API mandates promotion to 32-bit.
cc -mshort ...
-mno-short
Do not consider type "int" to be 16 bits wide. This is the default.
cc -mno-short ...
-mno-bitfield
Do not use the bit-field instructions. The -m68000, -mcpu32 and -m5200 options imply -mnobitfield.
cc -mno-bitfield ...
-mbitfield
Do use the bit-field instructions. The -m68020 option implies -mbitfield. This is the default if you use a configurationdesigned for a 68020.
cc -mbitfield ...
-mrtd
Use a different function-calling convention, in which functions that take a fixed number of arguments return with the "rtd"instruction, which pops their arguments while returning. This saves one instruction in the caller since there is no need to popthe arguments there.This calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call librariescompiled with the Unix compiler.Also, you must provide function prototypes for all functions that take variable numbers of arguments (including "printf");otherwise incorrect code is generated for calls to those functions.In addition, seriously incorrect code results if you call a function with too many arguments. (Normally, extra arguments areharmlessly ignored.)The "rtd" instruction is supported by the 68010, 68020, 68030, 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
cc -mrtd ...
-mno-rtd
Do not use the calling conventions selected by -mrtd. This is the default.
cc -mno-rtd ...
-mno-align-int
Control whether GCC aligns "int", "long", "long long", "float", "double", and "long double" variables on a 32-bit boundary
cc -mno-align-int ...
-mpcrel
Use the pc-relative addressing mode of the 68000 directly, instead of using a global offset table. At present, this optionimplies -fpic, allowing at most a 16-bit offset for pc-relative addressing. -fPIC is not presently supported with -mpcrel,though this could be supported for 68020 and higher processors.
cc -mpcrel ...
-mno-xgot
When generating position-independent code for ColdFire, generate code that works if the GOT has more than 8192 entries. Thiscode is larger and slower than code generated without this option. On M680x0 processors, this option is not needed; -fPICsuffices.GCC normally uses a single instruction to load values from the GOT. While this is relatively efficient, it only works if the GOTis smaller than about 64k. Anything larger causes the linker to report an error such as:relocation truncated to fit: R_68K_GOT16O foobarIf this happens, you should recompile your code with -mxgot. It should then work with very large GOTs. However, code generatedwith -mxgot is less efficient, since it takes 4 instructions to fetch the value of a global symbol.Note that some linkers, including newer versions of the GNU linker, can create multiple GOTs and sort GOT entries. If you havesuch a linker, you should only need to use -mxgot when compiling a single object file that accesses more than 8192 GOT entries.Very few do.These options have no effect unless GCC is generating position-independent code.
cc -mno-xgot ...
-mlong-jump-table-offsets
Use 32-bit offsets in "switch" tables. The default is to use 16-bit offsets.MCore OptionsThese are the -m options defined for the Motorola M*Core processors.
cc -mlong-jump-table-offsets ...
-mno-hardlit
Inline constants into the code stream if it can be done in two instructions or less.
cc -mno-hardlit ...
-mno-relax-immediate
Allow arbitrary-sized immediates in bit operations.
cc -mno-relax-immediate ...
-mno-4byte-functions
Force all functions to be aligned to a 4-byte boundary.
cc -mno-4byte-functions ...
-mno-callgraph-data
Emit callgraph information.
cc -mno-callgraph-data ...
-mno-slow-bytes
Prefer word access when reading byte quantities.
cc -mno-slow-bytes ...
-m340
Generate code for the 210 processor.
cc -m340 ...
-mstack-increment
Set the maximum amount for a single stack increment operation. Large values can increase the speed of programs that containfunctions that need a large amount of stack space, but they can also trigger a segmentation fault if the stack is extended toomuch. The default value is 0x1000.MeP Options
cc -mstack-increment ...
-mabsdiff
Enables the "abs" instruction, which is the absolute difference between two registers.
cc -mabsdiff ...
-mall-opts
Enables all the optional instructions---average, multiply, divide, bit operations, leading zero, absolute difference, min/max,clip, and saturation.
cc -mall-opts ...
-maverage
Enables the "ave" instruction, which computes the average of two registers.
cc -maverage ...
-mbased
Variables of size n bytes or smaller are placed in the ".based" section by default. Based variables use the $tp register as abase register, and there is a 128-byte limit to the ".based" section.
cc -mbased ...
-mbitops
Enables the bit operation instructions---bit test ("btstm"), set ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set("tas").
cc -mbitops ...
-mc
Selects which section constant data is placed in. name may be tiny, near, or far.
cc -mc ...
-mclip
Enables the "clip" instruction. Note that -mclip is not useful unless you also provide -mminmax.
cc -mclip ...
-mconfig
Selects one of the built-in core configurations. Each MeP chip has one or more modules in it; each module has a core CPU and avariety of coprocessors, optional instructions, and peripherals. The "MeP-Integrator" tool, not part of GCC, provides theseconfigurations through this option; using this option is the same as using all the corresponding command-line options. Thedefault configuration is default.
cc -mconfig ...
-mcop
Enables the coprocessor instructions. By default, this is a 32-bit coprocessor. Note that the coprocessor is normally enabledvia the -mconfig= option.
cc -mcop ...
-mcop32
Enables the 32-bit coprocessor's instructions.
cc -mcop32 ...
-mcop64
Enables the 64-bit coprocessor's instructions.
cc -mcop64 ...
-mivc2
Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
cc -mivc2 ...
-meb
Generate big-endian code.
cc -meb ...
-mel
Generate little-endian code.
cc -mel ...
-mio-volatile
Tells the compiler that any variable marked with the "io" attribute is to be considered volatile.
cc -mio-volatile ...
-ml
Causes variables to be assigned to the ".far" section by default.
cc -ml ...
-mleadz
Enables the "leadz" (leading zero) instruction.
cc -mleadz ...
-mm
Causes variables to be assigned to the ".near" section by default.
cc -mm ...
-mminmax
Enables the "min" and "max" instructions.
cc -mminmax ...
-mmult
Enables the multiplication and multiply-accumulate instructions.
cc -mmult ...
-mno-opts
Disables all the optional instructions enabled by -mall-opts.
cc -mno-opts ...
-mrepeat
Enables the "repeat" and "erepeat" instructions, used for low-overhead looping.
cc -mrepeat ...
-msatur
Enables the saturation instructions. Note that the compiler does not currently generate these itself, but this option isincluded for compatibility with other tools, like "as".
cc -msatur ...
-mtf
Causes all functions to default to the ".far" section. Without this option, functions default to the ".near" section.
cc -mtf ...
-mtiny
Variables that are n bytes or smaller are allocated to the ".tiny" section. These variables use the $gp base register. Thedefault for this option is 4, but note that there's a 65536-byte limit to the ".tiny" section.MicroBlaze Options
cc -mtiny ...
-mmemcpy
Do not optimize block moves, use "memcpy".
cc -mmemcpy ...
-mno-clearbss
This option is deprecated. Use -fno-zero-initialized-in-bss instead.
cc -mno-clearbss ...
-mxl-soft-mul
Use software multiply emulation (default).
cc -mxl-soft-mul ...
-mxl-soft-div
Use software emulation for divides (default).
cc -mxl-soft-div ...
-mxl-pattern-compare
Use pattern compare instructions.
cc -mxl-pattern-compare ...
-msmall-divides
Use table lookup optimization for small signed integer divisions.
cc -msmall-divides ...
-mxl-stack-check
This option is deprecated. Use -fstack-check instead.
cc -mxl-stack-check ...
-mxl-gp-opt
Use GP-relative ".sdata"/".sbss" sections.
cc -mxl-gp-opt ...
-mxl-multiply-high
Use multiply high instructions for high part of 32x32 multiply.
cc -mxl-multiply-high ...
-mxl-float-convert
Use hardware floating-point conversion instructions.
cc -mxl-float-convert ...
-mxl-reorder
Use reorder instructions (swap and byte reversed load/store).
cc -mxl-reorder ...
-mxl-mode-app-model
Select application model app-model. Valid models areexecutablenormal executable (default), uses startup code crt0.o.xmdstubfor use with Xilinx Microprocessor Debugger (XMD) based software intrusive debug agent called xmdstub. This uses startup filecrt1.o and sets the start address of the program to 0x800.bootstrapfor applications that are loaded using a bootloader. This model uses startup file crt2.o which does not contain a processorreset vector handler. This is suitable for transferring control on a processor reset to the bootloader rather than theapplication.novectorsfor applications that do not require any of the MicroBlaze vectors. This option may be useful for applications running withina monitoring application. This model uses crt3.o as a startup file.Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-model.MIPS Options
cc -mxl-mode-app-model ...
-EB
Generate big-endian code.
cc -EB ...
-EL
Generate little-endian code. This is the default for mips*el-*-* configurations.
cc -EL ...
-march=native
In processor names, a final 000 can be abbreviated as k (for example, -march=r2k). Prefixes are optional, and vr may be writtenr.Names of the form nf2_1 refer to processors with FPUs clocked at half the rate of the core, names of the form nf1_1 refer toprocessors with FPUs clocked at the same rate as the core, and names of the form nf3_2 refer to processors with FPUs clocked aratio of 3:2 with respect to the core. For compatibility reasons, nf is accepted as a synonym for nf2_1 while nx and bfx areaccepted as synonyms for nf1_1.GCC defines two macros based on the value of this option. The first is "_MIPS_ARCH", which gives the name of targetarchitecture, as a string. The second has the form "_MIPS_ARCH_foo", where foo is the capitalized value of "_MIPS_ARCH". Forexample, -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro "_MIPS_ARCH_R2000".Note that the "_MIPS_ARCH" macro uses the processor names given above. In other words, it has the full prefix and does notabbreviate 000 as k. In the case of from-abi, the macro names the resolved architecture (either "mips1" or "mips3"). It namesthe default architecture when no -march option is given.
cc -march=native ...
-mips1
Equivalent to -march=mips1.
cc -mips1 ...
-mips2
Equivalent to -march=mips2.
cc -mips2 ...
-mips3
Equivalent to -march=mips3.
cc -mips3 ...
-mips4
Equivalent to -march=mips4.
cc -mips4 ...
-mips32
Equivalent to -march=mips32.
cc -mips32 ...
-mips32r3
Equivalent to -march=mips32r3.
cc -mips32r3 ...
-mips32r5
Equivalent to -march=mips32r5.
cc -mips32r5 ...
-mips64
Equivalent to -march=mips64.
cc -mips64 ...
-mips64r2
Equivalent to -march=mips64r2.
cc -mips64r2 ...
-mips64r3
Equivalent to -march=mips64r3.
cc -mips64r3 ...
-mips64r5
Equivalent to -march=mips64r5.
cc -mips64r5 ...
-mips64r6
Equivalent to -march=mips64r6.
cc -mips64r6 ...
-mno-mips16
Generate (do not generate) MIPS16 code. If GCC is targeting a MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.MIPS16 code generation can also be controlled on a per-function basis by means of "mips16" and "nomips16" attributes.
cc -mno-mips16 ...
-mflip-mips16
Generate MIPS16 code on alternating functions. This option is provided for regression testing of mixed MIPS16/non-MIPS16 codegeneration, and is not intended for ordinary use in compiling user code.
cc -mflip-mips16 ...
-mno-interlink-mips16
Aliases of -minterlink-compressed and -mno-interlink-compressed. These options predate the microMIPS ASE and are retained forbackwards compatibility.
cc -mno-interlink-mips16 ...
-mno-abicalls
Generate (do not generate) code that is suitable for SVR4-style dynamic objects. -mabicalls is the default for SVR4-basedsystems.
cc -mno-abicalls ...
-mno-shared
Generate (do not generate) code that is fully position-independent, and that can therefore be linked into shared libraries. Thisoption only affects -mabicalls.All -mabicalls code has traditionally been position-independent, regardless of options like -fPIC and -fpic. However, as anextension, the GNU toolchain allows executables to use absolute accesses for locally-binding symbols. It can also use shorter GPinitialization sequences and generate direct calls to locally-defined functions. This mode is selected by -mno-shared.
cc -mno-shared ...
-mno-plt
Assume (do not assume) that the static and dynamic linkers support PLTs and copy relocations. This option only affects
cc -mno-plt ...
-mgp32
Assume that general-purpose registers are 32 bits wide.
cc -mgp32 ...
-mgp64
Assume that general-purpose registers are 64 bits wide.
cc -mgp64 ...
-mfp32
Assume that floating-point registers are 32 bits wide.
cc -mfp32 ...
-mfp64
Assume that floating-point registers are 64 bits wide.
cc -mfp64 ...
-mfpxx
Do not assume the width of floating-point registers.
cc -mfpxx ...
-mno-float
Equivalent to -msoft-float, but additionally asserts that the program being compiled does not perform any floating-pointoperations. This option is presently supported only by some bare-metal MIPS configurations, where it may select a special set oflibraries that lack all floating-point support (including, for example, the floating-point "printf" formats). If code compiledwith -mno-float accidentally contains floating-point operations, it is likely to suffer a link-time or run-time failure.
cc -mno-float ...
-msingle-float
Assume that the floating-point coprocessor only supports single-precision operations.
cc -msingle-float ...
-mno-odd-spreg
Enable the use of odd-numbered single-precision floating-point registers for the o32 ABI. This is the default for processorsthat are known to support these registers. When using the o32 FPXX ABI, -mno-odd-spreg is set by default.
cc -mno-odd-spreg ...
-mabs
These options control the treatment of the special not-a-number (NaN) IEEE 754 floating-point data with the "abs.fmt" and"neg.fmt" machine instructions.By default or when -mabs=legacy is used the legacy treatment is selected. In this case these instructions are consideredarithmetic and avoided where correct operation is required and the input operand might be a NaN. A longer sequence ofinstructions that manipulate the sign bit of floating-point datum manually is used instead unless the -ffinite-math-only optionhas also been specified.The -mabs=2008 option selects the IEEE 754-2008 treatment. In this case these instructions are considered non-arithmetic andtherefore operating correctly in all cases, including in particular where the input operand is a NaN. These instructions aretherefore always used for the respective operations.
cc -mabs ...
-mnan
These options control the encoding of the special not-a-number (NaN) IEEE 754 floating-point data.The -mnan=legacy option selects the legacy encoding. In this case quiet NaNs (qNaNs) are denoted by the first bit of theirtrailing significand field being 0, whereas signaling NaNs (sNaNs) are denoted by the first bit of their trailing significandfield being 1.The -mnan=2008 option selects the IEEE 754-2008 encoding. In this case qNaNs are denoted by the first bit of their trailingsignificand field being 1, whereas sNaNs are denoted by the first bit of their trailing significand field being 0.The default is -mnan=legacy unless GCC has been configured with --with-nan=2008.
cc -mnan ...
-mno-llsc
Use (do not use) ll, sc, and sync instructions to implement atomic memory built-in functions. When neither option is specified,GCC uses the instructions if the target architecture supports them.
cc -mno-llsc ...
--with-llsc
is the default for some configurations; see the installation documentation for details.
cc --with-llsc ...
-mno-dsp
Use (do not use) revision 1 of the MIPS DSP ASE.This option defines the preprocessor macro "__mips_dsp". It also defines "__mips_dsp_rev" to 1.
cc -mno-dsp ...
-mno-dspr2
Use (do not use) revision 2 of the MIPS DSP ASE.This option defines the preprocessor macros "__mips_dsp" and "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
cc -mno-dspr2 ...
-mno-smartmips
Use (do not use) the MIPS SmartMIPS ASE.
cc -mno-smartmips ...
-mno-paired-single
Use (do not use) paired-single floating-point instructions.This option requires hardware floating-point support to be enabled.
cc -mno-paired-single ...
-mno-mdmx
Use (do not use) MIPS Digital Media Extension instructions. This option can only be used when generating 64-bit code andrequires hardware floating-point support to be enabled.
cc -mno-mdmx ...
-mno-mips3d
Use (do not use) the MIPS-3D ASE. The option -mips3d implies -mpaired-single.
cc -mno-mips3d ...
-mno-micromips
Generate (do not generate) microMIPS code.MicroMIPS code generation can also be controlled on a per-function basis by means of "micromips" and "nomicromips" attributes.
cc -mno-micromips ...
-mno-mt
Use (do not use) MT Multithreading instructions.
cc -mno-mt ...
-mno-mcu
Use (do not use) the MIPS MCU ASE instructions.
cc -mno-mcu ...
-mno-virt
Use (do not use) the MIPS Virtualization (VZ) instructions.
cc -mno-virt ...
-mno-xpa
Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
cc -mno-xpa ...
-mlong64
Force "long" types to be 64 bits wide. See -mlong32 for an explanation of the default and the way that the pointer size isdetermined.
cc -mlong64 ...
-mlong32
Force "long", "int", and pointer types to be 32 bits wide.The default size of "int"s, "long"s and pointers depends on the ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses64-bit "long"s, as does the 64-bit EABI; the others use 32-bit "long"s. Pointers are the same size as "long"s, or the same sizeas integer registers, whichever is smaller.
cc -mlong32 ...
-mno-sym32
Assume (do not assume) that all symbols have 32-bit values, regardless of the selected ABI. This option is useful in combinationwith -mabi=64 and -mno-abicalls because it allows GCC to generate shorter and faster references to symbolic addresses.
cc -mno-sym32 ...
-mno-local-sdata
Extend (do not extend) the -G behavior to local data too, such as to static variables in C. -mlocal-sdata is the default for allconfigurations.If the linker complains that an application is using too much small data, you might want to try rebuilding the less performance-critical parts with -mno-local-sdata. You might also want to build large libraries with -mno-local-sdata, so that the librariesleave more room for the main program.
cc -mno-local-sdata ...
-mno-extern-sdata
Assume (do not assume) that externally-defined data is in a small data section if the size of that data is within the -G limit.
cc -mno-extern-sdata ...
-mextern-sdata
If you compile a module Mod with -mextern-sdata -G num -mgpopt, and Mod references a variable Var that is no bigger than numbytes, you must make sure that Var is placed in a small data section. If Var is defined by another module, you must eithercompile that module with a high-enough -G setting or attach a "section" attribute to Var's definition. If Var is common, youmust link the application with a high-enough -G setting.The easiest way of satisfying these restrictions is to compile and link every module with the same -G option. However, you maywish to build a library that supports several different small data limits. You can do this by compiling the library with thehighest supported -G setting and additionally using -mno-extern-sdata to stop the library from making assumptions aboutexternally-defined data.
cc -mextern-sdata ...
-mno-gpopt
Use (do not use) GP-relative accesses for symbols that are known to be in a small data section; see -G, -mlocal-sdata and
cc -mno-gpopt ...
-mextern-sdata.
-mgpopt is the default for all configurations.
cc -mextern-sdata. ...
-mno-uninit-const-in-rodata
Put uninitialized "const" variables in the read-only data section. This option is only meaningful in conjunction with
cc -mno-uninit-const-in-rodata ...
-mcode-readable
Specify whether GCC may generate code that reads from executable sections. There are three possible settings:
cc -mcode-readable ...
-mexplicit-relocs
but is retained for backwards compatibility.
cc -mexplicit-relocs ...
-mno-check-zero-division
Trap (do not trap) on integer division by zero.The default is -mcheck-zero-division.
cc -mno-check-zero-division ...
-mno-load-store-pairs
Enable (disable) an optimization that pairs consecutive load or store instructions to enable load/store bonding. This option isenabled by default but only takes effect when the selected architecture is known to support bonding.
cc -mno-load-store-pairs ...
-mno-memcpy
Force (do not force) the use of "memcpy" for non-trivial block moves. The default is -mno-memcpy, which allows GCC to inlinemost constant-sized copies.
cc -mno-memcpy ...
-mno-mad
Enable (disable) use of the "mad", "madu" and "mul" instructions, as provided by the R4650 ISA.
cc -mno-mad ...
-mno-imadd
Enable (disable) use of the "madd" and "msub" integer instructions. The default is -mimadd on architectures that support "madd"and "msub" except for the 74k architecture where it was found to generate slower code.
cc -mno-imadd ...
-mfused-madd.
On the R8000 CPU when multiply-accumulate instructions are used, the intermediate product is calculated to infinite precision andis not subject to the FCSR Flush to Zero bit. This may be undesirable in some circumstances. On other processors the result isnumerically identical to the equivalent computation using separate multiply, add, subtract and negate instructions.
cc -mfused-madd. ...
-nocpp
Tell the MIPS assembler to not run its preprocessor over user assembler files (with a .s suffix) when assembling them.
cc -nocpp ...
-mno-fix-24k
Work around the 24K E48 (lost data on stores during refill) errata. The workarounds are implemented by the assembler rather thanby GCC.
cc -mno-fix-24k ...
-mno-fix-r4000
Work around certain R4000 CPU errata:
cc -mno-fix-r4000 ...
-mno-fix-r10000
Work around certain R10000 errata:
cc -mno-fix-r10000 ...
-mno-fix-rm7000
Work around the RM7000 "dmult"/"dmultu" errata. The workarounds are implemented by the assembler rather than by GCC.
cc -mno-fix-rm7000 ...
-mno-fix-vr4120
Work around certain VR4120 errata:
cc -mno-fix-vr4120 ...
-mfix-vr4130
Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are implemented by the assembler rather than by GCC, although GCCavoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi", "dmacc" and "dmacchi" instructions are available instead.
cc -mfix-vr4130 ...
-mno-fix-sb1
Work around certain SB-1 CPU core errata. (This flag currently works around the SB-1 revision 2 "F1" and "F2" floating-pointerrata.)
cc -mno-fix-sb1 ...
-mr10k-cache-barrier
Specify whether GCC should insert cache barriers to avoid the side-effects of speculation on R10K processors.In common with many processors, the R10K tries to predict the outcome of a conditional branch and speculatively executesinstructions from the "taken" branch. It later aborts these instructions if the predicted outcome is wrong. However, on theR10K, even aborted instructions can have side effects.This problem only affects kernel stores and, depending on the system, kernel loads. As an example, a speculatively-executedstore may load the target memory into cache and mark the cache line as dirty, even if the store itself is later aborted. If aDMA operation writes to the same area of memory before the "dirty" line is flushed, the cached data overwrites the DMA-ed data.See the R10K processor manual for a full description, including other potential problems.One workaround is to insert cache barrier instructions before every memory access that might be speculatively executed and thatmight have side effects even if aborted. -mr10k-cache-barrier=setting controls GCC's implementation of this workaround. Itassumes that aborted accesses to any byte in the following regions does not have side effects:1. the memory occupied by the current function's stack frame;2. the memory occupied by an incoming stack argument;3. the memory occupied by an object with a link-time-constant address.It is the kernel's responsibility to ensure that speculative accesses to these regions are indeed safe.If the input program contains a function declaration such as:void foo (void);then the implementation of "foo" must allow "j foo" and "jal foo" to be executed speculatively. GCC honors this restriction forfunctions it compiles itself. It expects non-GCC functions (such as hand-written assembly code) to do the same.The option has three forms:
cc -mr10k-cache-barrier ...
-mcompact-branches
These options control which form of branches will be generated. The default is -mcompact-branches=optimal.The -mcompact-branches=never option ensures that compact branch instructions will never be generated.The -mcompact-branches=always option ensures that a compact branch instruction will be generated if available. If a compactbranch instruction is not available, a delay slot form of the branch will be used instead.This option is supported from MIPS Release 6 onwards.The -mcompact-branches=optimal option will cause a delay slot branch to be used if one is available in the current ISA and thedelay slot is successfully filled. If the delay slot is not filled, a compact branch will be chosen if one is available.
cc -mcompact-branches ...
-mno-fp-exceptions
Specifies whether FP exceptions are enabled. This affects how FP instructions are scheduled for some processors. The default isthat FP exceptions are enabled.For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 64-bit code, then we can use both FP pipes.Otherwise, we can only use one FP pipe.
cc -mno-fp-exceptions ...
-mno-vr4130-align
The VR4130 pipeline is two-way superscalar, but can only issue two instructions together if the first one is 8-byte aligned.When this option is enabled, GCC aligns pairs of instructions that it thinks should execute in parallel.This option only has an effect when optimizing for the VR4130. It normally makes code faster, but at the expense of making itbigger. It is enabled by default at optimization level -O3.
cc -mno-vr4130-align ...
-mno-relax-pic-calls
Try to turn PIC calls that are normally dispatched via register $25 into direct calls. This is only possible if the linker canresolve the destination at link time and if the destination is within range for a direct call.
cc -mno-relax-pic-calls ...
-mno-mcount-ra-address
Emit (do not emit) code that allows "_mcount" to modify the calling function's return address. When enabled, this option extendsthe usual "_mcount" interface with a new ra-address parameter, which has type "intptr_t *" and is passed in register $12."_mcount" can then modify the return address by doing both of the following:* Returning the new address in register $31.* Storing the new address in "*ra-address", if ra-address is nonnull.The default is -mno-mcount-ra-address.
cc -mno-mcount-ra-address ...
-mno-frame-header-opt
Enable (disable) frame header optimization in the o32 ABI. When using the o32 ABI, calling functions will allocate 16 bytes onthe stack for the called function to write out register arguments. When enabled, this optimization will suppress the allocationof the frame header if it can be determined that it is unused.This optimization is off by default at all optimization levels.
cc -mno-frame-header-opt ...
-mno-lxc1-sxc1
When applicable, enable (disable) the generation of "lwxc1", "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
cc -mno-lxc1-sxc1 ...
-mno-madd4
When applicable, enable (disable) the generation of 4-operand "madd.s", "madd.d" and related instructions. Enabled by default.MMIX OptionsThese options are defined for the MMIX:
cc -mno-madd4 ...
-mno-libfuncs
Specify that intrinsic library functions are being compiled, passing all values in registers, no matter the size.
cc -mno-libfuncs ...
-mno-epsilon
Generate floating-point comparison instructions that compare with respect to the "rE" epsilon register.
cc -mno-epsilon ...
-mno-zero-extend
When reading data from memory in sizes shorter than 64 bits, use (do not use) zero-extending load instructions by default, ratherthan sign-extending ones.
cc -mno-zero-extend ...
-mno-knuthdiv
Make the result of a division yielding a remainder have the same sign as the divisor. With the default, -mno-knuthdiv, the signof the remainder follows the sign of the dividend. Both methods are arithmetically valid, the latter being almost exclusivelyused.
cc -mno-knuthdiv ...
-mno-toplevel-symbols
Prepend (do not prepend) a : to all global symbols, so the assembly code can be used with the "PREFIX" assembly directive.
cc -mno-toplevel-symbols ...
-mno-branch-predict
Use (do not use) the probable-branch instructions, when static branch prediction indicates a probable branch.
cc -mno-branch-predict ...
-mno-base-addresses
Generate (do not generate) code that uses base addresses. Using a base address automatically generates a request (handled by theassembler and the linker) for a constant to be set up in a global register. The register is used for one or more base addressrequests within the range 0 to 255 from the value held in the register. The generally leads to short and fast code, but thenumber of different data items that can be addressed is limited. This means that a program that uses lots of static data mayrequire -mno-base-addresses.
cc -mno-base-addresses ...
-mmult-bug
Generate code to avoid bugs in the multiply instructions for the MN10300 processors. This is the default.
cc -mmult-bug ...
-mno-mult-bug
Do not generate code to avoid bugs in the multiply instructions for the MN10300 processors.
cc -mno-mult-bug ...
-mam33
Generate code using features specific to the AM33 processor.
cc -mam33 ...
-mno-am33
Do not generate code using features specific to the AM33 processor. This is the default.
cc -mno-am33 ...
-mam33-2
Generate code using features specific to the AM33/2.0 processor.
cc -mam33-2 ...
-mam34
Generate code using features specific to the AM34 processor.
cc -mam34 ...
-mreturn-pointer-on-d0
When generating a function that returns a pointer, return the pointer in both "a0" and "d0". Otherwise, the pointer is returnedonly in "a0", and attempts to call such functions without a prototype result in errors. Note that this option is on by default;use -mno-return-pointer-on-d0 to disable it.
cc -mreturn-pointer-on-d0 ...
-mno-crt0
Do not link in the C run-time initialization object file.
cc -mno-crt0 ...
-mliw
Allow the compiler to generate Long Instruction Word instructions if the target is the AM33 or later. This is the default. Thisoption defines the preprocessor macro "__LIW__".
cc -mliw ...
-mnoliw
Do not allow the compiler to generate Long Instruction Word instructions. This option defines the preprocessor macro"__NO_LIW__".
cc -mnoliw ...
-msetlb
Allow the compiler to generate the SETLB and Lcc instructions if the target is the AM33 or later. This is the default. Thisoption defines the preprocessor macro "__SETLB__".
cc -msetlb ...
-mnosetlb
Do not allow the compiler to generate SETLB or Lcc instructions. This option defines the preprocessor macro "__NO_SETLB__".Moxie Options
cc -mnosetlb ...
-mmul.x
Generate mul.x and umul.x instructions. This is the default for moxiebox-*-* configurations.
cc -mmul.x ...
-masm-hex
Force assembly output to always use hex constants. Normally such constants are signed decimals, but this option is available fortestsuite and/or aesthetic purposes.
cc -masm-hex ...
-mno-warn-mcu
This option enables or disables warnings about conflicts between the MCU name specified by the -mmcu option and the ISA set bythe -mcpu option and/or the hardware multiply support set by the -mhwmult option. It also toggles warnings about unrecognizedMCU names. This option is on by default.
cc -mno-warn-mcu ...
-mlarge
Use large-model addressing (20-bit pointers, 32-bit "size_t").
cc -mlarge ...
-msmall
Use small-model addressing (16-bit pointers, 16-bit "size_t").
cc -msmall ...
-minrt
Enable the use of a minimum runtime environment - no static initializers or constructors. This is intended for memory-constrained devices. The compiler includes special symbols in some objects that tell the linker and runtime which code fragmentsare required.
cc -minrt ...
-mdata-region
These options tell the compiler where to place functions and data that do not have one of the "lower", "upper", "either" or"section" attributes. Possible values are "lower", "upper", "either" or "any". The first three behave like the correspondingattribute. The fourth possible value - "any" - is the default. It leaves placement entirely up to the linker script and how itassigns the standard sections (".text", ".data", etc) to the memory regions.
cc -mdata-region ...
-msilicon-errata
This option passes on a request to assembler to enable the fixes for the named silicon errata.
cc -msilicon-errata ...
-msilicon-errata-warn
This option passes on a request to the assembler to enable warning messages when a silicon errata might need to be applied.NDS32 OptionsThese options are defined for NDS32 implementations:
cc -msilicon-errata-warn ...
-mreduced-regs
Use reduced-set registers for register allocation.
cc -mreduced-regs ...
-mfull-regs
Use full-set registers for register allocation.
cc -mfull-regs ...
-mcmov
Generate conditional move instructions.
cc -mcmov ...
-mno-cmov
Do not generate conditional move instructions.
cc -mno-cmov ...
-mperf-ext
Generate performance extension instructions.
cc -mperf-ext ...
-mno-perf-ext
Do not generate performance extension instructions.
cc -mno-perf-ext ...
-mv3push
Generate v3 push25/pop25 instructions.
cc -mv3push ...
-m16-bit
Generate 16-bit instructions.
cc -m16-bit ...
-mno-16-bit
Do not generate 16-bit instructions.
cc -mno-16-bit ...
-misr-vector-size
Specify the size of each interrupt vector, which must be 4 or 16.
cc -misr-vector-size ...
-mcache-block-size
Specify the size of each cache block, which must be a power of 2 between 4 and 512.
cc -mcache-block-size ...
-mctor-dtor
Enable constructor/destructor feature.
cc -mctor-dtor ...
-mgpopt
The default is -mgpopt except when -fpic or -fPIC is specified to generate position-independent code. Note that the Nios II ABIdoes not permit GP-relative accesses from shared libraries.You may need to specify -mno-gpopt explicitly when building programs that include large amounts of small data, including largeGOT data sections. In this case, the 16-bit offset for GP-relative addressing may not be large enough to allow access to theentire small data section.
cc -mgpopt ...
-mno-bypass-cache
Force all load and store instructions to always bypass cache by using I/O variants of the instructions. The default is not tobypass the cache.
cc -mno-bypass-cache ...
-mfast-sw-div
Do not use table-based fast divide for small numbers. The default is to use the fast divide at -O3 and above.
cc -mfast-sw-div ...
-mhw-div
Enable or disable emitting "mul", "mulx" and "div" family of instructions by the compiler. The default is to emit "mul" and notemit "div" and "mulx".
cc -mhw-div ...
-mno-cdx
Enable or disable generation of Nios II R2 BMX (bit manipulation) and CDX (code density) instructions. Enabling theseinstructions also requires -march=r2. Since these instructions are optional extensions to the R2 architecture, the default isnot to emit them.
cc -mno-cdx ...
-mno-custom-insn
Each -mcustom-insn=N option enables use of a custom instruction with encoding N when generating code that uses insn. Forexample, -mcustom-fadds=253 generates custom instruction 253 for single-precision floating-point add operations instead of thedefault behavior of using a library call.The following values of insn are supported. Except as otherwise noted, floating-point operations are expected to be implementedwith normal IEEE 754 semantics and correspond directly to the C operators or the equivalent GCC built-in functions.Single-precision floating point:fadds, fsubs, fdivs, fmulsBinary arithmetic operations.fnegsUnary negation.fabssUnary absolute value.fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnesComparison operations.fmins, fmaxsFloating-point minimum and maximum. These instructions are only generated if -ffinite-math-only is specified.fsqrtsUnary square root operation.fcoss, fsins, ftans, fatans, fexps, flogsFloating-point trigonometric and exponential functions. These instructions are only generated if -funsafe-math-optimizationsis also specified.Double-precision floating point:faddd, fsubd, fdivd, fmuldBinary arithmetic operations.fnegdUnary negation.fabsdUnary absolute value.fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpnedComparison operations.fmind, fmaxdDouble-precision minimum and maximum. These instructions are only generated if -ffinite-math-only is specified.fsqrtdUnary square root operation.fcosd, fsind, ftand, fatand, fexpd, flogdDouble-precision trigonometric and exponential functions. These instructions are only generated if
cc -mno-custom-insn ...
-mcustom-fpu-cfg
This option enables a predefined, named set of custom instruction encodings (see -mcustom-insn above). Currently, the followingsets are defined:
cc -mcustom-fpu-cfg ...
-mcustom-fcmples
-mcustom-fcmpeqs=250 -mcustom-fcmpnes=251 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
cc -mcustom-fcmples ...
-mcustom-fdivs
Custom instruction assignments given by individual -mcustom-insn= options override those given by -mcustom-fpu-cfg=, regardlessof the order of the options on the command line.Note that you can gain more local control over selection of a FPU configuration by using the "target("custom-fpu-cfg=name")"function attribute or pragma.These additional -m options are available for the Altera Nios II ELF (bare-metal) target:
cc -mcustom-fdivs ...
-mhal
Link with HAL BSP. This suppresses linking with the GCC-provided C runtime startup and termination code, and is typically usedin conjunction with -msys-crt0= to specify the location of the alternate startup code provided by the HAL BSP.
cc -mhal ...
-msmallc
Link with a limited version of the C library, -lsmallc, rather than Newlib.
cc -msmallc ...
-msys-crt0
startfile is the file name of the startfile (crt0) to use when linking. This option is only useful in conjunction with -mhal.
cc -msys-crt0 ...
-msys-lib
systemlib is the library name of the library that provides low-level system calls required by the C library, e.g. "read" and"write". This option is typically used to link with a library provided by a HAL BSP.Nvidia PTX OptionsThese options are defined for Nvidia PTX:
cc -msys-lib ...
-m64
Generate code for 32-bit or 64-bit ABI.
cc -m64 ...
-mmainkernel
Link in code for a __main kernel. This is for stand-alone instead of offloading execution.
cc -mmainkernel ...
-moptimize
Apply partitioned execution optimizations. This is the default when any level of optimization is selected.
cc -moptimize ...
-msoft-stack
Generate code that does not use ".local" memory directly for stack storage. Instead, a per-warp stack pointer is maintainedexplicitly. This enables variable-length stack allocation (with variable-length arrays or "alloca"), and when global memory isused for underlying storage, makes it possible to access automatic variables from other threads, or with atomic instructions.This code generation variant is used for OpenMP offloading, but the option is exposed on its own for the purpose of testing thecompiler; to generate code suitable for linking into programs using OpenMP offloading, use option -mgomp.
cc -msoft-stack ...
-muniform-simt
Switch to code generation variant that allows to execute all threads in each warp, while maintaining memory state and sideeffects as if only one thread in each warp was active outside of OpenMP SIMD regions. All atomic operations and calls to runtime(malloc, free, vprintf) are conditionally executed (iff current lane index equals the master lane index), and the register beingassigned is copied via a shuffle instruction from the master lane. Outside of SIMD regions lane 0 is the master; inside, eachthread sees itself as the master. Shared memory array "int __nvptx_uni[]" stores all-zeros or all-ones bitmasks for each warp,indicating current mode (0 outside of SIMD regions). Each thread can bitwise-and the bitmask at position "tid.y" with currentlane index to compute the master lane index.
cc -muniform-simt ...
-mgomp
Generate code for use in OpenMP offloading: enables -msoft-stack and -muniform-simt options, and selects corresponding multilibvariant.PDP-11 OptionsThese options are defined for the PDP-11:
cc -mgomp ...
-mac0
Return floating-point results in ac0 (fr0 in Unix assembler syntax).
cc -mac0 ...
-mno-ac0
Return floating-point results in memory. This is the default.
cc -mno-ac0 ...
-m40
Generate code for a PDP-11/40.
cc -m40 ...
-m45
Generate code for a PDP-11/45. This is the default.
cc -m45 ...
-m10
Generate code for a PDP-11/10.
cc -m10 ...
-mbcopy-builtin
Use inline "movmemhi" patterns for copying memory. This is the default.
cc -mbcopy-builtin ...
-mbcopy
Do not use inline "movmemhi" patterns for copying memory.
cc -mbcopy ...
-mno-int16
Use 32-bit "int".
cc -mno-int16 ...
-mno-float32
Use 64-bit "float". This is the default.
cc -mno-float32 ...
-mno-float64
Use 32-bit "float".
cc -mno-float64 ...
-mabshi
Use "abshi2" pattern. This is the default.
cc -mabshi ...
-mno-abshi
Do not use "abshi2" pattern.
cc -mno-abshi ...
-mbranch-expensive
Pretend that branches are expensive. This is for experimenting with code generation only.
cc -mbranch-expensive ...
-mbranch-cheap
Do not pretend that branches are expensive. This is the default.
cc -mbranch-cheap ...
-munix-asm
Use Unix assembler syntax. This is the default when configured for pdp11-*-bsd.
cc -munix-asm ...
-mae
Set the instruction set, register set, and instruction scheduling parameters for array element type ae_type. Supported valuesfor ae_type are ANY, MUL, and MAC.
cc -mae ...
-msymbol-as-address
Enable the compiler to directly use a symbol name as an address in a load/store instruction, without first loading it into aregister. Typically, the use of this option generates larger programs, which run faster than when the option isn't used.However, the results vary from program to program, so it is left as a user option, rather than being permanently enabled.
cc -msymbol-as-address ...
-mno-inefficient-warnings
Disables warnings about the generation of inefficient code. These warnings can be generated, for example, when compiling codethat performs byte-level memory operations on the MAC AE type. The MAC AE has no hardware support for byte-level memoryoperations, so all byte load/stores must be synthesized from word load/store operations. This is inefficient and a warning isgenerated to indicate that you should rewrite the code to avoid byte operations, or to target an AE type that has the necessaryhardware support. This option disables these warnings.PowerPC OptionsThese are listed underRISC-V OptionsThese command-line options are defined for RISC-V targets:
cc -mno-inefficient-warnings ...
-mno-fdiv
Do or don't use hardware floating-point divide and square root instructions. This requires the F or D extensions for floating-point registers. The default is to use them if the specified architecture has these instructions.
cc -mno-fdiv ...
-msmall-data-limit
Put global and static data smaller than n bytes into a special section (on some targets).
cc -msmall-data-limit ...
-mno-save-restore
Do or don't use smaller but slower prologue and epilogue code that uses library function calls. The default is to use fastinline prologues and epilogues.
cc -mno-save-restore ...
-mno-exlicit-relocs
Use or do not use assembler relocation operators when dealing with symbolic addresses. The alternative is to use assemblermacros instead, which may limit optimization.RL78 Options
cc -mno-exlicit-relocs ...
-mmul
Specifies the type of hardware multiplication and division support to be used. The simplest is "none", which uses software forboth multiplication and division. This is the default. The "g13" value is for the hardware multiply/divide peripheral found onthe RL78/G13 (S2 core) targets. The "g14" value selects the use of the multiplication and division instructions supported by theRL78/G14 (S3 core) parts. The value "rl78" is an alias for "g14" and the value "mg10" is an alias for "none".In addition a C preprocessor macro is defined, based upon the setting of this option. Possible values are: "__RL78_MUL_NONE__","__RL78_MUL_G13__" or "__RL78_MUL_G14__".
cc -mmul ...
-mrl78
These are aliases for the corresponding -mcpu= option. They are provided for backwards compatibility.
cc -mrl78 ...
-mallregs
Allow the compiler to use all of the available registers. By default registers "r24..r31" are reserved for use in interrupthandlers. With this option enabled these registers can be used in ordinary functions as well.
cc -mallregs ...
-m32bit-doubles
Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits (-m32bit-doubles) in size. The default is -m32bit-doubles.
cc -m32bit-doubles ...
-mno-save-mduc-in-interrupts
Specifies that interrupt handler functions should preserve the MDUC registers. This is only necessary if normal code might usethe MDUC registers, for example because it performs multiplication and division operations. The default is to ignore the MDUCregisters as this makes the interrupt handlers faster. The target option -mg13 needs to be passed for this to work as thisfeature is only available on the G13 target (S2 core). The MDUC registers will only be saved if the interrupt handler performs amultiplication or division operation or it calls another function.IBM RS/6000 and PowerPC OptionsThese -m options are defined for the IBM RS/6000 and PowerPC:
cc -mno-save-mduc-in-interrupts ...
-mno-hard-dfp
You use these options to specify which instructions are available on the processor you are using. The default value of theseoptions is determined when configuring GCC. Specifying the -mcpu=cpu_type overrides the specification of these options. Werecommend you use the -mcpu=cpu_type option rather than the options listed above.Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC architecture instructions in the General Purpose group,including floating-point square root. Specifying -mpowerpc-gfxopt allows GCC to use the optional PowerPC architectureinstructions in the Graphics group, including floating-point select.The -mmfcrf option allows GCC to generate the move from condition register field instruction implemented on the POWER4 processorand other processors that support the PowerPC V2.01 architecture. The -mpopcntb option allows GCC to generate the popcount anddouble-precision FP reciprocal estimate instruction implemented on the POWER5 processor and other processors that support thePowerPC V2.02 architecture. The -mpopcntd option allows GCC to generate the popcount instruction implemented on the POWER7processor and other processors that support the PowerPC V2.06 architecture. The -mfprnd option allows GCC to generate the FPround to integer instructions implemented on the POWER5+ processor and other processors that support the PowerPC V2.03architecture. The -mcmpb option allows GCC to generate the compare bytes instruction implemented on the POWER6 processor andother processors that support the PowerPC V2.05 architecture. The -mmfpgpr option allows GCC to generate the FP move to/fromgeneral-purpose register instructions implemented on the POWER6X processor and other processors that support the extended PowerPCV2.05 architecture. The -mhard-dfp option allows GCC to generate the decimal floating-point instructions implemented on somePOWER processors.The -mpowerpc64 option allows GCC to generate the additional 64-bit instructions that are found in the full PowerPC64architecture and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to -mno-powerpc64.
cc -mno-hard-dfp ...
-maltivec
-mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt
cc -maltivec ...
-mpower8-fusion
The particular options set for any particular CPU varies between compiler versions, depending on what setting seems to produceoptimal code for that CPU; it doesn't necessarily reflect the actual hardware's capabilities. If you wish to set an individualoption to a particular value, you may specify it after the -mcpu option, like -mcpu=970 -mno-altivec.On AIX, the -maltivec and -mpowerpc64 options are not enabled or disabled by the -mcpu option at present because AIX does nothave full support for these options. You may still enable or disable them individually if you're sure it'll work in yourenvironment.
cc -mpower8-fusion ...
-mno-altivec
Generate code that uses (does not use) AltiVec instructions, and also enable the use of built-in functions that allow more directaccess to the AltiVec instruction set. You may also need to set -mabi=altivec to adjust the current ABI with AltiVec ABIenhancements.When -maltivec is used, rather than -maltivec=le or -maltivec=be, the element order for AltiVec intrinsics such as "vec_splat","vec_extract", and "vec_insert" match array element order corresponding to the endianness of the target. That is, element zeroidentifies the leftmost element in a vector register when targeting a big-endian platform, and identifies the rightmost elementin a vector register when targeting a little-endian platform.
cc -mno-altivec ...
-mgen-cell-microcode
Generate Cell microcode instructions.
cc -mgen-cell-microcode ...
-mwarn-cell-microcode
Warn when a Cell microcode instruction is emitted. An example of a Cell microcode instruction is a variable shift.
cc -mwarn-cell-microcode ...
-msecure-plt
Generate code that allows ld and ld.so to build executables and shared libraries with non-executable ".plt" and ".got" sections.This is a PowerPC 32-bit SYSV ABI option.
cc -msecure-plt ...
-mbss-plt
Generate code that uses a BSS ".plt" section that ld.so fills in, and requires ".plt" and ".got" sections that are both writableand executable. This is a PowerPC 32-bit SYSV ABI option.
cc -mbss-plt ...
-mno-isel
This switch enables or disables the generation of ISEL instructions.
cc -mno-isel ...
-mno-spe
This switch enables or disables the generation of SPE simd instructions.
cc -mno-spe ...
-mno-paired
This switch enables or disables the generation of PAIRED simd instructions.
cc -mno-paired ...
-mspe
This option has been deprecated. Use -mspe and -mno-spe instead.
cc -mspe ...
-mno-vsx
Generate code that uses (does not use) vector/scalar (VSX) instructions, and also enable the use of built-in functions that allowmore direct access to the VSX instruction set.
cc -mno-vsx ...
-mno-crypto
Enable the use (disable) of the built-in functions that allow direct access to the cryptographic instructions that were added inversion 2.07 of the PowerPC ISA.
cc -mno-crypto ...
-mno-direct-move
Generate code that uses (does not use) the instructions to move data between the general purpose registers and the vector/scalar(VSX) registers that were added in version 2.07 of the PowerPC ISA.
cc -mno-direct-move ...
-mno-htm
Enable (disable) the use of the built-in functions that allow direct access to the Hardware Transactional Memory (HTM)instructions that were added in version 2.07 of the PowerPC ISA.
cc -mno-htm ...
-mno-power8-fusion
Generate code that keeps (does not keeps) some integer operations adjacent so that the instructions can be fused together onpower8 and later processors.
cc -mno-power8-fusion ...
-mno-power8-vector
Generate code that uses (does not use) the vector and scalar instructions that were added in version 2.07 of the PowerPC ISA.Also enable the use of built-in functions that allow more direct access to the vector instructions.
cc -mno-power8-vector ...
-mno-quad-memory
Generate code that uses (does not use) the non-atomic quad word memory instructions. The -mquad-memory option requires use of64-bit mode.
cc -mno-quad-memory ...
-mno-quad-memory-atomic
Generate code that uses (does not use) the atomic quad word memory instructions. The -mquad-memory-atomic option requires use of64-bit mode.
cc -mno-quad-memory-atomic ...
-mno-upper-regs-di
Generate code that uses (does not use) the scalar instructions that target all 64 registers in the vector/scalar floating pointregister set that were added in version 2.06 of the PowerPC ISA when processing integers. -mupper-regs-di is turned on bydefault if you use any of the -mcpu=power7, -mcpu=power8, -mcpu=power9, or -mvsx options.
cc -mno-upper-regs-di ...
-mno-upper-regs-df
Generate code that uses (does not use) the scalar double precision instructions that target all 64 registers in the vector/scalarfloating point register set that were added in version 2.06 of the PowerPC ISA. -mupper-regs-df is turned on by default if youuse any of the -mcpu=power7, -mcpu=power8, -mcpu=power9, or -mvsx options.
cc -mno-upper-regs-df ...
-mno-upper-regs-sf
Generate code that uses (does not use) the scalar single precision instructions that target all 64 registers in the vector/scalarfloating point register set that were added in version 2.07 of the PowerPC ISA. -mupper-regs-sf is turned on by default if youuse either of the -mcpu=power8, -mpower8-vector, or -mcpu=power9 options.
cc -mno-upper-regs-sf ...
-mno-float128
Enable/disable the __float128 keyword for IEEE 128-bit floating point and use either software emulation for IEEE 128-bit floatingpoint or hardware instructions.The VSX instruction set (-mvsx, -mcpu=power7, or -mcpu=power8) must be enabled to use the -mfloat128 option. The -mfloat128option only works on PowerPC 64-bit Linux systems.If you use the ISA 3.0 instruction set (-mcpu=power9), the -mfloat128 option will also enable the generation of ISA 3.0 IEEE128-bit floating point instructions. Otherwise, IEEE 128-bit floating point will be done with software emulation.
cc -mno-float128 ...
-mno-float128-hardware
Enable/disable using ISA 3.0 hardware instructions to support the __float128 data type.If you use -mfloat128-hardware, it will enable the option -mfloat128 as well.If you select ISA 3.0 instructions with -mcpu=power9, but do not use either -mfloat128 or -mfloat128-hardware, the IEEE 128-bitfloating point support will not be enabled.
cc -mno-float128-hardware ...
-mfloat-gprs
This switch enables or disables the generation of floating-point operations on the general-purpose registers for architecturesthat support it.The argument yes or single enables the use of single-precision floating-point operations.The argument double enables the use of single and double-precision floating-point operations.The argument no disables floating-point operations on the general-purpose registers.This option is currently only available on the MPC854x.
cc -mfloat-gprs ...
-mminimal-toc
Modify generation of the TOC (Table Of Contents), which is created for every executable file. The -mfull-toc option is selectedby default. In that case, GCC allocates at least one TOC entry for each unique non-automatic variable reference in your program.GCC also places floating-point constants in the TOC. However, only 16,384 entries are available in the TOC.If you receive a linker error message that saying you have overflowed the available TOC space, you can reduce the amount of TOCspace used with the -mno-fp-in-toc and -mno-sum-in-toc options. -mno-fp-in-toc prevents GCC from putting floating-pointconstants in the TOC and -mno-sum-in-toc forces GCC to generate code to calculate the sum of an address and a constant at runtime instead of putting that sum into the TOC. You may specify one or both of these options. Each causes GCC to produce veryslightly slower and larger code at the expense of conserving TOC space.If you still run out of space in the TOC even when you specify both of these options, specify -mminimal-toc instead. This optioncauses GCC to make only one TOC entry for every file. When you specify this option, GCC produces code that is slower and largerbut which uses extremely little TOC space. You may wish to use this option only on files that contain less frequently-executedcode.
cc -mminimal-toc ...
-maix32
Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit "long" type, and the infrastructure needed to support them.Specifying -maix64 implies -mpowerpc64, while -maix32 disables the 64-bit ABI and implies -mno-powerpc64. GCC defaults to
cc -maix32 ...
-mno-xl-compat
Produce code that conforms more closely to IBM XL compiler semantics when using AIX-compatible ABI. Pass floating-pointarguments to prototyped functions beyond the register save area (RSA) on the stack in addition to argument FPRs. Do not assumethat most significant double in 128-bit long double value is properly rounded when comparing values and converting to double.Use XL symbol names for long double support routines.The AIX calling convention was extended but not initially documented to handle an obscure K&R C case of calling a function thattakes the address of its arguments with fewer arguments than declared. IBM XL compilers access floating-point arguments that donot fit in the RSA from the stack when a subroutine is compiled without optimization. Because always storing floating-pointarguments on the stack is inefficient and rarely needed, this option is not enabled by default and only is necessary when callingsubroutines compiled by IBM XL compilers without optimization.
cc -mno-xl-compat ...
-mpe
Support IBM RS/6000 SP Parallel Environment (PE). Link an application written to use message passing with special startup codeto enable the application to run. The system must have PE installed in the standard location (/usr/lpp/ppe.poe/), or the specsfile must be overridden with the -specs= option to specify the appropriate directory location. The Parallel Environment does notsupport threads, so the -mpe option and the -pthread option are incompatible.
cc -mpe ...
-malign-power
On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option -malign-natural overrides the ABI-defined alignment of largertypes, such as floating-point doubles, on their natural size-based boundary. The option -malign-power instructs GCC to followthe ABI-specified alignment rules. GCC defaults to the standard alignment defined in the ABI.On 64-bit Darwin, natural alignment is the default, and -malign-power is not supported.
cc -malign-power ...
-msimple-fpu
Do not generate "sqrt" and "div" instructions for hardware floating-point unit.
cc -msimple-fpu ...
-mxilinx-fpu
Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
cc -mxilinx-fpu ...
-mno-multiple
Generate code that uses (does not use) the load multiple word instructions and the store multiple word instructions. Theseinstructions are generated by default on POWER systems, and not generated on PowerPC systems. Do not use -mmultiple on little-endian PowerPC systems, since those instructions do not work when the processor is in little-endian mode. The exceptions arePPC740 and PPC750 which permit these instructions in little-endian mode.
cc -mno-multiple ...
-mno-string
Generate code that uses (does not use) the load string instructions and the store string word instructions to save multipleregisters and do small block moves. These instructions are generated by default on POWER systems, and not generated on PowerPCsystems. Do not use -mstring on little-endian PowerPC systems, since those instructions do not work when the processor is inlittle-endian mode. The exceptions are PPC740 and PPC750 which permit these instructions in little-endian mode.
cc -mno-string ...
-mno-update
Generate code that uses (does not use) the load or store instructions that update the base register to the address of thecalculated memory location. These instructions are generated by default. If you use -mno-update, there is a small windowbetween the time that the stack pointer is updated and the address of the previous frame is stored, which means code that walksthe stack frame across interrupts or signals may get corrupted data.
cc -mno-update ...
-mno-avoid-indexed-addresses
Generate code that tries to avoid (not avoid) the use of indexed load or store instructions. These instructions can incur aperformance penalty on Power6 processors in certain situations, such as when stepping through large arrays that cross a 16Mboundary. This option is enabled by default when targeting Power6 and disabled otherwise.
cc -mno-avoid-indexed-addresses ...
-mno-mulhw
Generate code that uses (does not use) the half-word multiply and multiply-accumulate instructions on the IBM 405, 440, 464 and476 processors. These instructions are generated by default when targeting those processors.
cc -mno-mulhw ...
-mno-dlmzb
Generate code that uses (does not use) the string-search dlmzb instruction on the IBM 405, 440, 464 and 476 processors. Thisinstruction is generated by default when targeting those processors.
cc -mno-dlmzb ...
-mbit-align
On System V.4 and embedded PowerPC systems do not (do) force structures and unions that contain bit-fields to be aligned to thebase type of the bit-field.For example, by default a structure containing nothing but 8 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundaryand has a size of 4 bytes. By using -mno-bit-align, the structure is aligned to a 1-byte boundary and is 1 byte in size.
cc -mbit-align ...
-mno-relocatable
Generate code that allows (does not allow) a static executable to be relocated to a different address at run time. A simpleembedded PowerPC system loader should relocate the entire contents of ".got2" and 4-byte locations listed in the ".fixup"section, a table of 32-bit addresses generated by this option. For this to work, all objects linked together must be compiledwith -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the stack to an 8-byte boundary.
cc -mno-relocatable ...
-mno-relocatable-lib
Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section to allow static executables to be relocated at run time, but
cc -mno-relocatable-lib ...
-mtoc
On System V.4 and embedded PowerPC systems do not (do) assume that register 2 contains a pointer to a global area pointing to theaddresses used in the program.
cc -mtoc ...
-mdynamic-no-pic
On Darwin and Mac OS X systems, compile code so that it is not relocatable, but that its external references are relocatable.The resulting code is suitable for applications, but not shared libraries.
cc -mdynamic-no-pic ...
-msched-costly-dep
This option controls which dependences are considered costly by the target during instruction scheduling. The argumentdependence_type takes one of the following values:no No dependence is costly.all All dependences are costly.true_store_to_loadA true dependence from store to load is costly.store_to_loadAny dependence from store to load is costly.numberAny dependence for which the latency is greater than or equal to number is costly.
cc -msched-costly-dep ...
-minsert-sched-nops
This option controls which NOP insertion scheme is used during the second scheduling pass. The argument scheme takes one of thefollowing values:no Don't insert NOPs.pad Pad with NOPs any dispatch group that has vacant issue slots, according to the scheduler's grouping.regroup_exactInsert NOPs to force costly dependent insns into separate groups. Insert exactly as many NOPs as needed to force an insn toa new group, according to the estimated processor grouping.numberInsert NOPs to force costly dependent insns into separate groups. Insert number NOPs to force an insn to a new group.
cc -minsert-sched-nops ...
-mcall-sysv
On System V.4 and embedded PowerPC systems compile code using calling conventions that adhere to the March 1995 draft of theSystem V Application Binary Interface, PowerPC processor supplement. This is the default unless you configured GCC usingpowerpc-*-eabiaix.
cc -mcall-sysv ...
-mcall-eabi
Specify both -mcall-sysv and -meabi options.
cc -mcall-eabi ...
-mcall-sysv-noeabi
Specify both -mcall-sysv and -mno-eabi options.
cc -mcall-sysv-noeabi ...
-mcall-aixdesc
On System V.4 and embedded PowerPC systems compile code for the AIX operating system.
cc -mcall-aixdesc ...
-mcall-linux
On System V.4 and embedded PowerPC systems compile code for the Linux-based GNU system.
cc -mcall-linux ...
-mcall-freebsd
On System V.4 and embedded PowerPC systems compile code for the FreeBSD operating system.
cc -mcall-freebsd ...
-mcall-netbsd
On System V.4 and embedded PowerPC systems compile code for the NetBSD operating system.
cc -mcall-netbsd ...
-mcall-openbsd
On System V.4 and embedded PowerPC systems compile code for the OpenBSD operating system.
cc -mcall-openbsd ...
-msvr4-struct-return
Return structures smaller than 8 bytes in registers (as specified by the SVR4 ABI).
cc -msvr4-struct-return ...
-mno-gnu-attribute
Emit .gnu_attribute assembly directives to set tag/value pairs in a .gnu.attributes section that specify ABI variations infunction parameters or return values.
cc -mno-gnu-attribute ...
-mno-prototype
On System V.4 and embedded PowerPC systems assume that all calls to variable argument functions are properly prototyped.Otherwise, the compiler must insert an instruction before every non-prototyped call to set or clear bit 6 of the condition coderegister ("CR") to indicate whether floating-point values are passed in the floating-point registers in case the function takesvariable arguments. With -mprototype, only calls to prototyped variable argument functions set or clear the bit.
cc -mno-prototype ...
-mmvme
On embedded PowerPC systems, assume that the startup module is called crt0.o and the standard C libraries are libmvme.a andlibc.a.
cc -mmvme ...
-mads
On embedded PowerPC systems, assume that the startup module is called crt0.o and the standard C libraries are libads.a andlibc.a.
cc -mads ...
-myellowknife
On embedded PowerPC systems, assume that the startup module is called crt0.o and the standard C libraries are libyk.a and libc.a.
cc -myellowknife ...
-mvxworks
On System V.4 and embedded PowerPC systems, specify that you are compiling for a VxWorks system.
cc -mvxworks ...
-memb
On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags header to indicate that eabi extended relocations are used.
cc -memb ...
-mno-eabi
On System V.4 and embedded PowerPC systems do (do not) adhere to the Embedded Applications Binary Interface (EABI), which is aset of modifications to the System V.4 specifications. Selecting -meabi means that the stack is aligned to an 8-byte boundary, afunction "__eabi" is called from "main" to set up the EABI environment, and the -msdata option can use both "r2" and "r13" topoint to two separate small data areas. Selecting -mno-eabi means that the stack is aligned to a 16-byte boundary, no EABIinitialization function is called from "main", and the -msdata option only uses "r13" to point to a single small data area. The
cc -mno-eabi ...
-meabi
option is on by default if you configured GCC using one of the powerpc*-*-eabi* options.
cc -meabi ...
-mreadonly-in-sdata
Put read-only objects in the ".sdata" section as well. This is the default.
cc -mreadonly-in-sdata ...
-mblock-move-inline-limit
Inline all block moves (such as calls to "memcpy" or structure copies) less than or equal to num bytes. The minimum value fornum is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The default value is target-specific.
cc -mblock-move-inline-limit ...
-mno-regnames
On System V.4 and embedded PowerPC systems do (do not) emit register names in the assembly language output using symbolic forms.
cc -mno-regnames ...
-mno-longcall
By default assume that all calls are far away so that a longer and more expensive calling sequence is required. This is requiredfor calls farther than 32 megabytes (33,554,432 bytes) from the current location. A short call is generated if the compilerknows the call cannot be that far away. This setting can be overridden by the "shortcall" function attribute, or by "#pragmalongcall(0)".Some linkers are capable of detecting out-of-range calls and generating glue code on the fly. On these systems, long calls areunnecessary and generate slower code. As of this writing, the AIX linker can do this, as can the GNU linker for PowerPC/64. Itis planned to add this feature to the GNU linker for 32-bit PowerPC systems as well.On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee, L42", plus a branch island (glue code). The two targetaddresses represent the callee and the branch island. The Darwin/PPC linker prefers the first address and generates a "blcallee" if the PPC "bl" instruction reaches the callee directly; otherwise, the linker generates "bl L42" to call the branchisland. The branch island is appended to the body of the calling function; it computes the full 32-bit address of the callee andjumps to it.On Mach-O (Darwin) systems, this option directs the compiler emit to the glue for every direct call, and the Darwin linkerdecides whether to use or discard it.In the future, GCC may ignore all longcall specifications when the linker is known to generate glue.
cc -mno-longcall ...
-mno-tls-markers
Mark (do not mark) calls to "__tls_get_addr" with a relocation specifying the function argument. The relocation allows thelinker to reliably associate function call with argument setup instructions for TLS optimization, which in turn allows GCC tobetter schedule the sequence.
cc -mno-tls-markers ...
-mno-recip
This option enables use of the reciprocal estimate and reciprocal square root estimate instructions with additional Newton-Raphson steps to increase precision instead of doing a divide or square root and divide for floating-point arguments. You shoulduse the -ffast-math option when using -mrecip (or at least -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math and
cc -mno-recip ...
-mno-recip-precision
Assume (do not assume) that the reciprocal estimate instructions provide higher-precision estimates than is mandated by thePowerPC ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8 automatically selects -mrecip-precision. The double-precisionsquare root estimate instructions are not generated by default on low-precision machines, since they do not provide an estimatethat converges after three steps.
cc -mno-recip-precision ...
-mveclibabi
Specifies the ABI type to use for vectorizing intrinsics using an external library. The only type supported at present is mass,which specifies to use IBM's Mathematical Acceleration Subsystem (MASS) libraries for vectorizing intrinsics using externallibraries. GCC currently emits calls to "acosd2", "acosf4", "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4","atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4", "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4","erfcd2", "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4", "expm1d2", "expm1f4", "hypotd2", "hypotf4","lgammad2", "lgammaf4", "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4", "logd2", "logf4", "powd2", "powf4","sind2", "sinf4", "sinhd2", "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and "tanhf4" when generating code forpower7. Both -ftree-vectorize and -funsafe-math-optimizations must also be enabled. The MASS libraries must be specified atlink time.
cc -mveclibabi ...
-mno-friz
Generate (do not generate) the "friz" instruction when the -funsafe-math-optimizations option is used to optimize rounding offloating-point values to 64-bit integer and back to floating point. The "friz" instruction does not return the same value if thefloating-point number is too large to fit in an integer.
cc -mno-friz ...
-mno-pointers-to-nested-functions
Generate (do not generate) code to load up the static chain register ("r11") when calling through a pointer on AIX and 64-bitLinux systems where a function pointer points to a 3-word descriptor giving the function address, TOC value to be loaded inregister "r2", and static chain value to be loaded in register "r11". The -mpointers-to-nested-functions is on by default. Youcannot call through pointers to nested functions or pointers to functions compiled in other languages that use the static chainif you use -mno-pointers-to-nested-functions.
cc -mno-pointers-to-nested-functions ...
-mno-save-toc-indirect
Generate (do not generate) code to save the TOC value in the reserved stack location in the function prologue if the functioncalls through a pointer on AIX and 64-bit Linux systems. If the TOC value is not saved in the prologue, it is saved just beforethe call through the pointer. The -mno-save-toc-indirect option is the default.
cc -mno-save-toc-indirect ...
-mno-compat-align-parm
Generate (do not generate) code to pass structure parameters with a maximum alignment of 64 bits, for compatibility with olderversions of GCC.Older versions of GCC (prior to 4.9.0) incorrectly did not align a structure parameter on a 128-bit boundary when that structurecontained a member requiring 128-bit alignment. This is corrected in more recent versions of GCC. This option may be used togenerate code that is compatible with functions compiled with older versions of GCC.The -mno-compat-align-parm option is the default.
cc -mno-compat-align-parm ...
-mstack-protector-guard-offset
Generate stack protection code using canary at guard. Supported locations are global for global canary or tls for per-threadcanary in the TLS block (the default with GNU libc version 2.4 or later).With the latter choice the options -mstack-protector-guard-reg=reg and -mstack-protector-guard-offset=offset furthermore specifywhich register to use as base register for reading the canary, and from what offset from that base register. The default forthose is as specified in the relevant ABI.RX OptionsThese command-line options are defined for RX targets:
cc -mstack-protector-guard-offset ...
-nofpu
Enables (-fpu) or disables (-nofpu) the use of RX floating-point hardware. The default is enabled for the RX600 series anddisabled for the RX200 series.Floating-point instructions are only generated for 32-bit floating-point values, however, so the FPU hardware is not used fordoubles if the -m64bit-doubles option is used.Note If the -fpu option is enabled then -funsafe-math-optimizations is also enabled automatically. This is because the RX FPUinstructions are themselves unsafe.
cc -nofpu ...
-mlittle-endian-data
Store data (but not code) in the big-endian format. The default is -mlittle-endian-data, i.e. to store data in the little-endianformat.
cc -mlittle-endian-data ...
-mno-as100-syntax
When generating assembler output use a syntax that is compatible with Renesas's AS100 assembler. This syntax can also be handledby the GAS assembler, but it has some restrictions so it is not generated by default.
cc -mno-as100-syntax ...
-mmax-constant-size
Specifies the maximum size, in bytes, of a constant that can be used as an operand in a RX instruction. Although the RXinstruction set does allow constants of up to 4 bytes in length to be used in instructions, a longer value equates to a longerinstruction. Thus in some circumstances it can be beneficial to restrict the size of constants that are used in instructions.Constants that are too big are instead placed into a constant pool and referenced via register indirection.The value N can be between 0 and 4. A value of 0 (the default) or 4 means that constants of any size are allowed.
cc -mmax-constant-size ...
-mint-register
Specify the number of registers to reserve for fast interrupt handler functions. The value N can be between 0 and 4. A value of1 means that register "r13" is reserved for the exclusive use of fast interrupt handlers. A value of 2 reserves "r13" and "r12".A value of 3 reserves "r13", "r12" and "r11", and a value of 4 reserves "r13" through "r10". A value of 0, the default, does notreserve any registers.
cc -mint-register ...
-msave-acc-in-interrupts
Specifies that interrupt handler functions should preserve the accumulator register. This is only necessary if normal code mightuse the accumulator register, for example because it performs 64-bit multiplications. The default is to ignore the accumulatoras this makes the interrupt handlers faster.
cc -msave-acc-in-interrupts ...
-mno-pid
Enables the generation of position independent data. When enabled any access to constant data is done via an offset from a baseaddress held in a register. This allows the location of constant data to be determined at run time without requiring theexecutable to be relocated, which is a benefit to embedded applications with tight memory constraints. Data that can be modifiedis not affected by this option.Note, using this feature reserves a register, usually "r13", for the constant data base address. This can result in slowerand/or larger code, especially in complicated functions.The actual register chosen to hold the constant data base address depends upon whether the -msmall-data-limit and/or the
cc -mno-pid ...
-mwarn-multiple-fast-interrupts
Prevents GCC from issuing a warning message if it finds more than one fast interrupt handler when it is compiling a file. Thedefault is to issue a warning for each extra fast interrupt handler found, as the RX only supports one such interrupt.
cc -mwarn-multiple-fast-interrupts ...
-mno-jsr
Use only (or not only) "JSR" instructions to access functions. This option can be used when code size exceeds the range of "BSR"instructions. Note that -mno-jsr does not mean to not use "JSR" but instead means that any type of branch may be used.Note: The generic GCC command-line option -ffixed-reg has special significance to the RX port when used with the "interrupt" functionattribute. This attribute indicates a function intended to process fast interrupts. GCC ensures that it only uses the registers"r10", "r11", "r12" and/or "r13" and only provided that the normal use of the corresponding registers have been restricted via the
cc -mno-jsr ...
-mno-backchain
Store (do not store) the address of the caller's frame as backchain pointer into the callee's stack frame. A backchain may beneeded to allow debugging using tools that do not understand DWARF call frame information. When -mno-packed-stack is in effect,the backchain pointer is stored at the bottom of the stack frame; when -mpacked-stack is in effect, the backchain is placed intothe topmost word of the 96/160 byte register save area.In general, code compiled with -mbackchain is call-compatible with code compiled with -mmo-backchain; however, use of thebackchain for debugging purposes usually requires that the whole binary is built with -mbackchain. Note that the combination of
cc -mno-backchain ...
-mbackchain
The default is to not maintain the backchain.
cc -mbackchain ...
-mno-packed-stack
Use (do not use) the packed stack layout. When -mno-packed-stack is specified, the compiler uses the all fields of the 96/160byte register save area only for their default purpose; unused fields still take up stack space. When -mpacked-stack isspecified, register save slots are densely packed at the top of the register save area; unused space is reused for otherpurposes, allowing for more efficient use of the available stack space. However, when -mbackchain is also in effect, the topmostword of the save area is always used to store the backchain, and the return address register is always saved two words below thebackchain.As long as the stack frame backchain is not used, code generated with -mpacked-stack is call-compatible with code generated with
cc -mno-packed-stack ...
-mno-small-exec
Generate (or do not generate) code using the "bras" instruction to do subroutine calls. This only works reliably if the totalexecutable size does not exceed 64k. The default is to use the "basr" instruction instead, which does not have this limitation.
cc -mno-small-exec ...
-m31
When -m31 is specified, generate code compliant to the GNU/Linux for S/390 ABI. When -m64 is specified, generate code compliantto the GNU/Linux for zSeries ABI. This allows GCC in particular to generate 64-bit instructions. For the s390 targets, thedefault is -m31, while the s390x targets default to -m64.
cc -m31 ...
-mesa
When -mzarch is specified, generate code using the instructions available on z/Architecture. When -mesa is specified, generatecode using the instructions available on ESA/390. Note that -mesa is not possible with -m64. When generating code compliant tothe GNU/Linux for S/390 ABI, the default is -mesa. When generating code compliant to the GNU/Linux for zSeries ABI, the defaultis -mzarch.
cc -mesa ...
-mno-vx
When -mvx is specified, generate code using the instructions available with the vector extension facility introduced with the IBMz13 machine generation. This option changes the ABI for some vector type values with regard to alignment and callingconventions. In case vector type values are being used in an ABI-relevant context a GAS .gnu_attribute command will be added tomark the resulting binary with the ABI used. -mvx is enabled by default when using -march=z13.
cc -mno-vx ...
-mno-zvector
The -mzvector option enables vector language extensions and builtins using instructions available with the vector extensionfacility introduced with the IBM z13 machine generation. This option adds support for vector to be used as a keyword to definevector type variables and arguments. vector is only available when GNU extensions are enabled. It will not be expanded whenrequesting strict standard compliance e.g. with -std=c99. In addition to the GCC low-level builtins -mzvector enables a set ofbuiltins added for compatibility with AltiVec-style implementations like Power and Cell. In order to make use of these builtinsthe header file vecintrin.h needs to be included. -mzvector is disabled by default.
cc -mno-zvector ...
-mno-debug
Print (or do not print) additional debug information when compiling. The default is to not print debug information.
cc -mno-debug ...
-mno-tpf-trace
Generate code that adds (does not add) in TPF OS specific branches to trace routines in the operating system. This option is offby default, even when compiling for the TPF OS.
cc -mno-tpf-trace ...
-mwarn-framesize
Emit a warning if the current function exceeds the given frame size. Because this is a compile-time check it doesn't need to bea real problem when the program runs. It is intended to identify functions that most probably cause a stack overflow. It isuseful to be used in an environment with limited stack size e.g. the linux kernel.
cc -mwarn-framesize ...
-mwarn-dynamicstack
Emit a warning if the function calls "alloca" or uses dynamically-sized arrays. This is generally a bad idea with a limitedstack size.
cc -mwarn-dynamicstack ...
-mstack-size
If these options are provided the S/390 back end emits additional instructions in the function prologue that trigger a trap ifthe stack size is stack-guard bytes above the stack-size (remember that the stack on S/390 grows downward). If the stack-guardoption is omitted the smallest power of 2 larger than the frame size of the compiled function is chosen. These options areintended to be used to help debugging stack overflow problems. The additionally emitted code causes only little overhead andhence can also be used in production-like systems without greater performance degradation. The given values have to be exactpowers of 2 and stack-size has to be greater than stack-guard without exceeding 64k. In order to be efficient the extra codemakes the assumption that the stack starts at an address aligned to the value given by stack-size. The stack-guard option canonly be used in conjunction with stack-size.
cc -mstack-size ...
-mhotpatch
If the hotpatch option is enabled, a "hot-patching" function prologue is generated for all functions in the compilation unit.The funtion label is prepended with the given number of two-byte NOP instructions (pre-halfwords, maximum 1000000). After thelabel, 2 * post-halfwords bytes are appended, using the largest NOP like instructions the architecture allows (maximum 1000000).If both arguments are zero, hotpatching is disabled.This option can be overridden for individual functions with the "hotpatch" attribute.Score OptionsThese options are defined for Score implementations:
cc -mhotpatch ...
-mnhwloop
Disable generation of "bcnz" instructions.
cc -mnhwloop ...
-muls
Enable generation of unaligned load and store instructions.
cc -muls ...
-mscore5
Specify the SCORE5 as the target architecture.
cc -mscore5 ...
-mscore5u
Specify the SCORE5U of the target architecture.
cc -mscore5u ...
-mscore7
Specify the SCORE7 as the target architecture. This is the default.
cc -mscore7 ...
-mscore7d
Specify the SCORE7D as the target architecture.SH OptionsThese -m options are defined for the SH implementations:
cc -mscore7d ...
-m1
Generate code for the SH1.
cc -m1 ...
-m2
Generate code for the SH2.
cc -m2 ...
-m2e
Generate code for the SH2e.
cc -m2e ...
-m2a-nofpu
Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way that the floating-point unit is not used.
cc -m2a-nofpu ...
-m2a-single-only
Generate code for the SH2a-FPU, in such a way that no double-precision floating-point operations are used.
cc -m2a-single-only ...
-m2a-single
Generate code for the SH2a-FPU assuming the floating-point unit is in single-precision mode by default.
cc -m2a-single ...
-m2a
Generate code for the SH2a-FPU assuming the floating-point unit is in double-precision mode by default.
cc -m2a ...
-m3
Generate code for the SH3.
cc -m3 ...
-m3e
Generate code for the SH3e.
cc -m3e ...
-m4-nofpu
Generate code for the SH4 without a floating-point unit.
cc -m4-nofpu ...
-m4-single-only
Generate code for the SH4 with a floating-point unit that only supports single-precision arithmetic.
cc -m4-single-only ...
-m4-single
Generate code for the SH4 assuming the floating-point unit is in single-precision mode by default.
cc -m4-single ...
-m4
Generate code for the SH4.
cc -m4 ...
-m4-100
Generate code for SH4-100.
cc -m4-100 ...
-m4-100-nofpu
Generate code for SH4-100 in such a way that the floating-point unit is not used.
cc -m4-100-nofpu ...
-m4-100-single
Generate code for SH4-100 assuming the floating-point unit is in single-precision mode by default.
cc -m4-100-single ...
-m4-100-single-only
Generate code for SH4-100 in such a way that no double-precision floating-point operations are used.
cc -m4-100-single-only ...
-m4-200
Generate code for SH4-200.
cc -m4-200 ...
-m4-200-nofpu
Generate code for SH4-200 without in such a way that the floating-point unit is not used.
cc -m4-200-nofpu ...
-m4-200-single
Generate code for SH4-200 assuming the floating-point unit is in single-precision mode by default.
cc -m4-200-single ...
-m4-200-single-only
Generate code for SH4-200 in such a way that no double-precision floating-point operations are used.
cc -m4-200-single-only ...
-m4-300
Generate code for SH4-300.
cc -m4-300 ...
-m4-300-nofpu
Generate code for SH4-300 without in such a way that the floating-point unit is not used.
cc -m4-300-nofpu ...
-m4-300-single
Generate code for SH4-300 in such a way that no double-precision floating-point operations are used.
cc -m4-300-single ...
-m4-300-single-only
Generate code for SH4-300 in such a way that no double-precision floating-point operations are used.
cc -m4-300-single-only ...
-m4-340
Generate code for SH4-340 (no MMU, no FPU).
cc -m4-340 ...
-m4-500
Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the assembler.
cc -m4-500 ...
-m4a-single-only
Generate code for the SH4a, in such a way that no double-precision floating-point operations are used.
cc -m4a-single-only ...
-m4a-single
Generate code for the SH4a assuming the floating-point unit is in single-precision mode by default.
cc -m4a-single ...
-m4a
Generate code for the SH4a.
cc -m4a ...
-m4al
Same as -m4a-nofpu, except that it implicitly passes -dsp to the assembler. GCC doesn't generate any DSP instructions at themoment.
cc -m4al ...
-mb
Compile code for the processor in big-endian mode.
cc -mb ...
-mdalign
Align doubles at 64-bit boundaries. Note that this changes the calling conventions, and thus some functions from the standard Clibrary do not work unless you recompile it first with -mdalign.
cc -mdalign ...
-mbigtable
Use 32-bit offsets in "switch" tables. The default is to use 16-bit offsets.
cc -mbigtable ...
-mfmovd
Enable the use of the instruction "fmovd". Check -mdalign for alignment constraints.
cc -mfmovd ...
-mrenesas
Comply with the calling conventions defined by Renesas.
cc -mrenesas ...
-mno-renesas
Comply with the calling conventions defined for GCC before the Renesas conventions were available. This option is the defaultfor all targets of the SH toolchain.
cc -mno-renesas ...
-mno-ieee
Control the IEEE compliance of floating-point comparisons, which affects the handling of cases where the result of a comparisonis unordered. By default -mieee is implicitly enabled. If -ffinite-math-only is enabled -mno-ieee is implicitly set, whichresults in faster floating-point greater-equal and less-equal comparisons. The implicit settings can be overridden by specifyingeither -mieee or -mno-ieee.
cc -mno-ieee ...
-minline-ic_invalidate
Inline code to invalidate instruction cache entries after setting up nested function trampolines. This option has no effect if
cc -minline-ic_invalidate ...
-mpadstruct
This option is deprecated. It pads structures to multiple of 4 bytes, which is incompatible with the SH ABI.
cc -mpadstruct ...
-matomic-model
Sets the model of atomic operations and additional parameters as a comma separated list. For details on the atomic built-infunctions see __atomic Builtins. The following models and parameters are supported:noneDisable compiler generated atomic sequences and emit library calls for atomic operations. This is the default if the targetis not "sh*-*-linux*".soft-gusaGenerate GNU/Linux compatible gUSA software atomic sequences for the atomic built-in functions. The generated atomicsequences require additional support from the interrupt/exception handling code of the system and are only suitable for SH3*and SH4* single-core systems. This option is enabled by default when the target is "sh*-*-linux*" and SH3* or SH4*. Whenthe target is SH4A, this option also partially utilizes the hardware atomic instructions "movli.l" and "movco.l" to createmore efficient code, unless strict is specified.soft-tcbGenerate software atomic sequences that use a variable in the thread control block. This is a variation of the gUSAsequences which can also be used on SH1* and SH2* targets. The generated atomic sequences require additional support fromthe interrupt/exception handling code of the system and are only suitable for single-core systems. When using this model,the gbr-offset= parameter has to be specified as well.soft-imaskGenerate software atomic sequences that temporarily disable interrupts by setting "SR.IMASK = 1111". This model works onlywhen the program runs in privileged mode and is only suitable for single-core systems. Additional support from theinterrupt/exception handling code of the system is not required. This model is enabled by default when the target is"sh*-*-linux*" and SH1* or SH2*.hard-llcsGenerate hardware atomic sequences using the "movli.l" and "movco.l" instructions only. This is only available on SH4A andis suitable for multi-core systems. Since the hardware instructions support only 32 bit atomic variables access to 8 or 16bit variables is emulated with 32 bit accesses. Code compiled with this option is also compatible with other software atomicmodel interrupt/exception handling systems if executed on an SH4A system. Additional support from the interrupt/exceptionhandling code of the system is not required for this model.gbr-offset=This parameter specifies the offset in bytes of the variable in the thread control block structure that should be used by thegenerated atomic sequences when the soft-tcb model has been selected. For other models this parameter is ignored. Thespecified value must be an integer multiple of four and in the range 0-1020.strictThis parameter prevents mixed usage of multiple atomic models, even if they are compatible, and makes the compiler generateatomic sequences of the specified model only.
cc -matomic-model ...
-mtas
Generate the "tas.b" opcode for "__atomic_test_and_set". Notice that depending on the particular hardware and softwareconfiguration this can degrade overall performance due to the operand cache line flushes that are implied by the "tas.b"instruction. On multi-core SH4A processors the "tas.b" instruction must be used with caution since it can result in datacorruption for certain cache configurations.
cc -mtas ...
-mprefergot
When generating position-independent code, emit function calls using the Global Offset Table instead of the Procedure LinkageTable.
cc -mprefergot ...
-mno-usermode
Don't allow (allow) the compiler generating privileged mode code. Specifying -musermode also implies -mno-inline-ic_invalidateif the inlined code would not work in user mode. -musermode is the default when the target is "sh*-*-linux*". If the target isSH1* or SH2* -musermode has no effect, since there is no user mode.
cc -mno-usermode ...
-maccumulate-outgoing-args
Reserve space once for outgoing arguments in the function prologue rather than around each call. Generally beneficial forperformance and size. Also needed for unwinding to avoid changing the stack frame around conditional code.
cc -maccumulate-outgoing-args ...
-mdivsi3_libfunc
Set the name of the library function used for 32-bit signed division to name. This only affects the name used in the calldivision strategies, and the compiler still expects the same sets of input/output/clobbered registers as if this option were notpresent.
cc -mdivsi3_libfunc ...
-mno-zdcbranch
Assume (do not assume) that zero displacement conditional branch instructions "bt" and "bf" are fast. If -mzdcbranch isspecified, the compiler prefers zero displacement branch code sequences. This is enabled by default when generating code for SH4and SH4A. It can be explicitly disabled by specifying -mno-zdcbranch.
cc -mno-zdcbranch ...
-mcbranch-force-delay-slot
Force the usage of delay slots for conditional branches, which stuffs the delay slot with a "nop" if a suitable instructioncannot be found. By default this option is disabled. It can be enabled to work around hardware bugs as found in the originalSH7055.
cc -mcbranch-force-delay-slot ...
-mno-fsca
Allow or disallow the compiler to emit the "fsca" instruction for sine and cosine approximations. The option -mfsca must be usedin combination with -funsafe-math-optimizations. It is enabled by default when generating code for SH4A. Using -mno-fscadisables sine and cosine approximations even if -funsafe-math-optimizations is in effect.
cc -mno-fsca ...
-mno-fsrra
Allow or disallow the compiler to emit the "fsrra" instruction for reciprocal square root approximations. The option -mfsrramust be used in combination with -funsafe-math-optimizations and -ffinite-math-only. It is enabled by default when generatingcode for SH4A. Using -mno-fsrra disables reciprocal square root approximations even if -funsafe-math-optimizations and
cc -mno-fsrra ...
-mpretend-cmove
Prefer zero-displacement conditional branches for conditional move instruction patterns. This can result in faster code on theSH4 processor.
cc -mpretend-cmove ...
-mimpure-text,
These switches are supported in addition to the above on Solaris 2:
cc -mimpure-text, ...
-pthreads
This is a synonym for -pthread.SPARC OptionsThese -m options are supported on the SPARC:
cc -pthreads ...
-mapp-regs
Specify -mapp-regs to generate output using the global registers 2 through 4, which the SPARC SVR4 ABI reserves for applications.Like the global register 1, each global register 2 through 4 is then treated as an allocable register that is clobbered byfunction calls. This is the default.To be fully SVR4 ABI-compliant at the cost of some performance loss, specify -mno-app-regs. You should compile libraries andsystem software with this option.
cc -mapp-regs ...
-mno-flat
With -mflat, the compiler does not generate save/restore instructions and uses a "flat" or single register window model. Thismodel is compatible with the regular register window model. The local registers and the input registers (0--5) are still treatedas "call-saved" registers and are saved on the stack as needed.With -mno-flat (the default), the compiler generates save/restore instructions (except for leaf functions). This is the normaloperating mode.
cc -mno-flat ...
-mhard-quad-float
Generate output containing quad-word (long double) floating-point instructions.
cc -mhard-quad-float ...
-munaligned-doubles
Assume that doubles have 8-byte alignment. This is the default.With -munaligned-doubles, GCC assumes that doubles have 8-byte alignment only if they are contained in another type, or if theyhave an absolute address. Otherwise, it assumes they have 4-byte alignment. Specifying this option avoids some rarecompatibility problems with code generated by other compilers. It is not the default because it results in a performance loss,especially for floating-point code.
cc -munaligned-doubles ...
-mno-user-mode
Do not generate code that can only run in supervisor mode. This is relevant only for the "casa" instruction emitted for theLEON3 processor. This is the default.
cc -mno-user-mode ...
-mno-faster-structs
With -mfaster-structs, the compiler assumes that structures should have 8-byte alignment. This enables the use of pairs of "ldd"and "std" instructions for copies in structure assignment, in place of twice as many "ld" and "st" pairs. However, the use ofthis changed alignment directly violates the SPARC ABI. Thus, it's intended only for use on targets where the developeracknowledges that their resulting code is not directly in line with the rules of the ABI.
cc -mno-faster-structs ...
-mno-std-struct-return
With -mstd-struct-return, the compiler generates checking code in functions returning structures or unions to detect sizemismatches between the two sides of function calls, as per the 32-bit ABI.The default is -mno-std-struct-return. This option has no effect in 64-bit mode.
cc -mno-std-struct-return ...
-mno-lra
Enable Local Register Allocation. This is the default for SPARC since GCC 7 so -mno-lra needs to be passed to get old Reload.
cc -mno-lra ...
-mcpu=tsc701,
With -mcpu=v9, GCC generates code for the V9 variant of the SPARC architecture. This adds 64-bit integer and floating-point moveinstructions, 3 additional floating-point condition code registers and conditional move instructions. With -mcpu=ultrasparc, thecompiler additionally optimizes it for the Sun UltraSPARC I/II/IIi chips. With -mcpu=ultrasparc3, the compiler additionallyoptimizes it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With -mcpu=niagara, the compiler additionally optimizes itfor Sun UltraSPARC T1 chips. With -mcpu=niagara2, the compiler additionally optimizes it for Sun UltraSPARC T2 chips. With
cc -mcpu=tsc701, ...
-mno-v8plus
With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The difference from the V8 ABI is that the global and out registers areconsidered 64 bits wide. This is enabled by default on Solaris in 32-bit mode for all SPARC-V9 processors.
cc -mno-v8plus ...
-mno-vis
With -mvis, GCC generates code that takes advantage of the UltraSPARC Visual Instruction Set extensions. The default is
cc -mno-vis ...
-mno-vis2
With -mvis2, GCC generates code that takes advantage of version 2.0 of the UltraSPARC Visual Instruction Set extensions. Thedefault is -mvis2 when targeting a cpu that supports such instructions, such as UltraSPARC-III and later. Setting -mvis2 alsosets -mvis.
cc -mno-vis2 ...
-mno-vis3
With -mvis3, GCC generates code that takes advantage of version 3.0 of the UltraSPARC Visual Instruction Set extensions. Thedefault is -mvis3 when targeting a cpu that supports such instructions, such as niagara-3 and later. Setting -mvis3 also sets
cc -mno-vis3 ...
-mno-vis4
With -mvis4, GCC generates code that takes advantage of version 4.0 of the UltraSPARC Visual Instruction Set extensions. Thedefault is -mvis4 when targeting a cpu that supports such instructions, such as niagara-7 and later. Setting -mvis4 also sets
cc -mno-vis4 ...
-mvis3
-mvis2 and -mvis.
cc -mvis3 ...
-mno-vis4b
With -mvis4b, GCC generates code that takes advantage of version 4.0 of the UltraSPARC Visual Instruction Set extensions, plusthe additional VIS instructions introduced in the Oracle SPARC Architecture 2017. The default is -mvis4b when targeting a cputhat supports such instructions, such as m8 and later. Setting -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
cc -mno-vis4b ...
-mno-cbcond
With -mcbcond, GCC generates code that takes advantage of the UltraSPARC Compare-and-Branch-on-Condition instructions. Thedefault is -mcbcond when targeting a CPU that supports such instructions, such as Niagara-4 and later.
cc -mno-cbcond ...
-mno-fmaf
With -mfmaf, GCC generates code that takes advantage of the UltraSPARC Fused Multiply-Add Floating-point instructions. Thedefault is -mfmaf when targeting a CPU that supports such instructions, such as Niagara-3 and later.
cc -mno-fmaf ...
-mno-fsmuld
With -mfsmuld, GCC generates code that takes advantage of the Floating-point Multiply Single to Double (FsMULd) instruction. Thedefault is -mfsmuld when targeting a CPU supporting the architecture versions V8 or V9 with FPU except -mcpu=leon.
cc -mno-fsmuld ...
-mno-popc
With -mpopc, GCC generates code that takes advantage of the UltraSPARC Population Count instruction. The default is -mpopc whentargeting a CPU that supports such an instruction, such as Niagara-2 and later.
cc -mno-popc ...
-msubxc
when targeting a CPU that supports such an instruction, such as Niagara-7 and later.
cc -msubxc ...
-mfix-at697f
Enable the documented workaround for the single erratum of the Atmel AT697F processor (which corresponds to erratum #13 of theAT697E processor).
cc -mfix-at697f ...
-mfix-ut699
Enable the documented workarounds for the floating-point errata and the data cache nullify errata of the UT699 processor.
cc -mfix-ut699 ...
-mfix-ut700
Enable the documented workaround for the back-to-back store errata of the UT699E/UT700 processor.
cc -mfix-ut700 ...
-mfix-gr712rc
Enable the documented workaround for the back-to-back store errata of the GR712RC processor.These -m options are supported in addition to the above on SPARC-V9 processors in 64-bit environments:
cc -mfix-gr712rc ...
-mmemory-model
Set the memory model in force on the processor to one ofdefaultThe default memory model for the processor and operating system.rmo Relaxed Memory Orderpso Partial Store Ordertso Total Store Ordersc Sequential ConsistencyThese memory models are formally defined in Appendix D of the SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"field.
cc -mmemory-model ...
-mno-stack-bias
With -mstack-bias, GCC assumes that the stack pointer, and frame pointer if present, are offset by -2047 which must be added backwhen making stack frame references. This is the default in 64-bit mode. Otherwise, assume no such offset is present.SPU OptionsThese -m options are supported on the SPU:
cc -mno-stack-bias ...
-merror-reloc
The loader for SPU does not handle dynamic relocations. By default, GCC gives an error when it generates code that requires adynamic relocation. -mno-error-reloc disables the error, -mwarn-reloc generates a warning instead.
cc -merror-reloc ...
-munsafe-dma
Instructions that initiate or test completion of DMA must not be reordered with respect to loads and stores of the memory that isbeing accessed. With -munsafe-dma you must use the "volatile" keyword to protect memory accesses, but that can lead toinefficient code in places where the memory is known to not change. Rather than mark the memory as volatile, you can use
cc -munsafe-dma ...
-msafe-dma
to tell the compiler to treat the DMA instructions as potentially affecting all memory.
cc -msafe-dma ...
-mbranch-hints
By default, GCC generates a branch hint instruction to avoid pipeline stalls for always-taken or probably-taken branches. A hintis not generated closer than 8 instructions away from its branch. There is little reason to disable them, except for debuggingpurposes, or to make an object a little bit smaller.
cc -mbranch-hints ...
-mlarge-mem
By default, GCC generates code assuming that addresses are never larger than 18 bits. With -mlarge-mem code is generated thatassumes a full 32-bit address.
cc -mlarge-mem ...
-mstdmain
By default, GCC links against startup code that assumes the SPU-style main function interface (which has an unconventionalparameter list). With -mstdmain, GCC links your program against startup code that assumes a C99-style interface to "main",including a local copy of "argv" strings.
cc -mstdmain ...
-mea64
Compile code assuming that pointers to the PPU address space accessed via the "__ea" named address space qualifier are either 32or 64 bits wide. The default is 32 bits. As this is an ABI-changing option, all object code in an executable must be compiledwith the same setting.
cc -mea64 ...
-mno-address-space-conversion
Allow/disallow treating the "__ea" address space as superset of the generic address space. This enables explicit type castsbetween "__ea" and generic pointer as well as implicit conversions of generic pointers to "__ea" pointers. The default is toallow address space pointer conversions.
cc -mno-address-space-conversion ...
-mcache-size
This option controls the version of libgcc that the compiler links to an executable and selects a software-managed cache foraccessing variables in the "__ea" address space with a particular cache size. Possible options for cache-size are 8, 16, 32, 64and 128. The default cache size is 64KB.
cc -mcache-size ...
-mno-atomic-updates
This option controls the version of libgcc that the compiler links to an executable and selects whether atomic updates to thesoftware-managed cache of PPU-side variables are used. If you use atomic updates, changes to a PPU variable from SPU code usingthe "__ea" named address space qualifier do not interfere with changes to other PPU variables residing in the same cache linefrom PPU code. If you do not use atomic updates, such interference may occur; however, writing back cache lines is moreefficient. The default behavior is to use atomic updates.
cc -mno-atomic-updates ...
-mdual-nops
By default, GCC inserts NOPs to increase dual issue when it expects it to increase performance. n can be a value from 0 to 10.A smaller n inserts fewer NOPs. 10 is the default, 0 is the same as -mno-dual-nops. Disabled with -Os.
cc -mdual-nops ...
-mhint-max-nops
Maximum number of NOPs to insert for a branch hint. A branch hint must be at least 8 instructions away from the branch it isaffecting. GCC inserts up to n NOPs to enforce this, otherwise it does not generate the branch hint.
cc -mhint-max-nops ...
-mhint-max-distance
The encoding of the branch hint instruction limits the hint to be within 256 instructions of the branch it is affecting. Bydefault, GCC makes sure it is within 125.
cc -mhint-max-distance ...
-msafe-hints
Work around a hardware bug that causes the SPU to stall indefinitely. By default, GCC inserts the "hbrp" instruction to makesure this stall won't happen.Options for System VThese additional options are available on System V Release 4 for compatibility with other compilers on those systems:
cc -msafe-hints ...
-Qy
Identify the versions of each tool used by the compiler, in a ".ident" assembler directive in the output.
cc -Qy ...
-Qn
Refrain from adding ".ident" directives to the output file (this is the default).
cc -Qn ...
-YP,dirs
Search the directories dirs, and no others, for libraries specified with -l.
cc -YP,dirs ...
-Ym,dir
Look in the directory dir to find the M4 preprocessor. The assembler uses this option.TILE-Gx OptionsThese -m options are supported on the TILE-Gx:
cc -Ym,dir ...
-m32
Generate code for a 32-bit environment, which sets int, long, and pointer to 32 bits. This is the only supported behavior so theflag is essentially ignored.V850 OptionsThese -m options are defined for V850 implementations:
cc -m32 ...
-mep
Do not optimize (do optimize) basic blocks that use the same index pointer 4 or more times to copy pointer into the "ep"register, and use the shorter "sld" and "sst" instructions. The -mep option is on by default if you optimize.
cc -mep ...
-mprolog-function
Do not use (do use) external functions to save and restore registers at the prologue and epilogue of a function. The externalfunctions are slower, but use less code space if more than one function saves the same number of registers. The
cc -mprolog-function ...
-mspace
Try to make the code as small as possible. At present, this just turns on the -mep and -mprolog-function options.
cc -mspace ...
-mtda
Put static or global variables whose size is n bytes or less into the tiny data area that register "ep" points to. The tiny dataarea can hold up to 256 bytes in total (128 bytes for byte references).
cc -mtda ...
-msda
Put static or global variables whose size is n bytes or less into the small data area that register "gp" points to. The smalldata area can hold up to 64 kilobytes.
cc -msda ...
-mv850
Specify that the target processor is the V850.
cc -mv850 ...
-mv850e2v4
Specify that the target processor is the V850E3V5. This is an alias for the -mv850e3v5 option.
cc -mv850e2v4 ...
-mv850e2v3
Specify that the target processor is the V850E2V3. The preprocessor constant "__v850e2v3__" is defined if this option is used.
cc -mv850e2v3 ...
-mv850e2
Specify that the target processor is the V850E2. The preprocessor constant "__v850e2__" is defined if this option is used.
cc -mv850e2 ...
-mv850e1
Specify that the target processor is the V850E1. The preprocessor constants "__v850e1__" and "__v850e__" are defined if thisoption is used.
cc -mv850e1 ...
-mv850es
Specify that the target processor is the V850ES. This is an alias for the -mv850e1 option.
cc -mv850es ...
-mv850e
Specify that the target processor is the V850E. The preprocessor constant "__v850e__" is defined if this option is used.If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor -mv850e2v3 nor -mv850e3v5 are defined then a default target processoris chosen and the relevant __v850*__ preprocessor constant is defined.The preprocessor constants "__v850" and "__v851__" are always defined, regardless of which processor variant is the target.
cc -mv850e ...
-mno-disable-callt
This option suppresses generation of the "CALLT" instruction for the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of thev850 architecture.This option is enabled by default when the RH850 ABI is in use (see -mrh850-abi), and disabled by default when the GCC ABI is inuse. If "CALLT" instructions are being generated then the C preprocessor symbol "__V850_CALLT__" is defined.
cc -mno-disable-callt ...
-mno-relax
Pass on (or do not pass on) the -mrelax command-line option to the assembler.
cc -mno-relax ...
-mno-long-jumps
Disable (or re-enable) the generation of PC-relative jump instructions.
cc -mno-long-jumps ...
-mloop
Enables the use of the e3v5 LOOP instruction. The use of this instruction is not enabled by default when the e3v5 architectureis selected because its use is still experimental.
cc -mloop ...
-mghs
Enables support for the RH850 version of the V850 ABI. This is the default. With this version of the ABI the following rulesapply:* Integer sized structures and unions are returned via a memory pointer rather than a register.* Large structures and unions (more than 8 bytes in size) are passed by value.* Functions are aligned to 16-bit boundaries.* The -m8byte-align command-line option is supported.* The -mdisable-callt command-line option is enabled by default. The -mno-disable-callt command-line option is not supported.When this version of the ABI is enabled the C preprocessor symbol "__V850_RH850_ABI__" is defined.
cc -mghs ...
-mgcc-abi
Enables support for the old GCC version of the V850 ABI. With this version of the ABI the following rules apply:* Integer sized structures and unions are returned in register "r10".* Large structures and unions (more than 8 bytes in size) are passed by reference.* Functions are aligned to 32-bit boundaries, unless optimizing for size.* The -m8byte-align command-line option is not supported.* The -mdisable-callt command-line option is supported but not enabled by default.When this version of the ABI is enabled the C preprocessor symbol "__V850_GCC_ABI__" is defined.
cc -mgcc-abi ...
-mno-8byte-align
Enables support for "double" and "long long" types to be aligned on 8-byte boundaries. The default is to restrict the alignmentof all objects to at most 4-bytes. When -m8byte-align is in effect the C preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
cc -mno-8byte-align ...
-mbig-switch
Generate code suitable for big switch tables. Use this option only if the assembler/linker complain about out of range brancheswithin a switch table.
cc -mbig-switch ...
-mno-app-regs
This option causes r2 and r5 to be treated as fixed registers.VAX OptionsThese -m options are defined for the VAX:
cc -mno-app-regs ...
-mgnu
Do output those jump instructions, on the assumption that the GNU assembler is being used.
cc -mgnu ...
-msv-mode
Generate code for the supervisor mode, where there are no restrictions on the access to general registers. This is the default.
cc -msv-mode ...
-mvms-return-codes
Return VMS condition codes from "main". The default is to return POSIX-style condition (e.g. error) codes.
cc -mvms-return-codes ...
-mdebug-main
Flag the first routine whose name starts with prefix as the main routine for the debugger.
cc -mdebug-main ...
-mmalloc64
Default to 64-bit memory allocation routines.
cc -mmalloc64 ...
-mpointer-size
Set the default size of pointers. Possible options for size are 32 or short for 32 bit pointers, 64 or long for 64 bit pointers,and no for supporting only 32 bit pointers. The later option disables "pragma pointer_size".VxWorks OptionsThe options in this section are defined for all VxWorks targets. Options specific to the target hardware are listed with the otheroptions for that target.
cc -mpointer-size ...
-mrtp
GCC can generate code for both VxWorks kernels and real time processes (RTPs). This option switches from the former to thelatter. It also defines the preprocessor macro "__RTP__".
cc -mrtp ...
-non-static
Link an RTP executable against shared libraries rather than static libraries. The options -static and -shared can also be usedfor RTPs; -static is the default.
cc -non-static ...
-Bdynamic
These options are passed down to the linker. They are defined for compatibility with Diab.
cc -Bdynamic ...
-Xbind-lazy
Enable lazy binding of function calls. This option is equivalent to -Wl,-z,now and is defined for compatibility with Diab.
cc -Xbind-lazy ...
-Xbind-now
Disable lazy binding of function calls. This option is the default and is defined for compatibility with Diab.x86 OptionsThese -m options are defined for the x86 family of computers.
cc -Xbind-now ...
-mtune,
pentium2Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set support.pentium3pentium3mIntel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction set support.pentium-mIntel Pentium M; low-power version of Intel Pentium III CPU with MMX, SSE and SSE2 instruction set support. Used by Centrinonotebooks.pentium4pentium4mIntel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.prescottImproved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction set support.noconaImproved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, SSE2 and SSE3 instruction set support.core2Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support.nehalemIntel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.westmereIntel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instructionset support.sandybridgeIntel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMULinstruction set support.ivybridgeIntel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE,RDRND and F16C instruction set support.haswellIntel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL,FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction set support.broadwellIntel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.skylakeIntel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL,FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set support.bonnellIntel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support.silvermontIntel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL andRDRND instruction set support.knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2,AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and AVX512CDinstruction set support.skylake-avx512Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,AVX512BW, AVX512DQ and AVX512CD instruction set support.k6 AMD K6 CPU with MMX instruction set support.k6-2k6-3Improved versions of AMD K6 CPU with MMX and 3DNow! instruction set support.athlonathlon-tbirdAMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE prefetch instructions support.athlon-4athlon-xpathlon-mpImproved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and full SSE instruction set support.k8opteronathlon64athlon-fxProcessors based on the AMD K8 core with x86-64 instruction set support, including the AMD Opteron, Athlon 64, and Athlon 64FX processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow! and 64-bit instruction set extensions.)k8-sse3opteron-sse3athlon64-sse3Improved versions of AMD K8 cores with SSE3 instruction set support.amdfam10barcelonaCPUs based on AMD Family 10h cores with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,enhanced 3DNow!, ABM and 64-bit instruction set extensions.)bdver1CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL,CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)bdver2AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)bdver3AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction setextensions.bdver4AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bitinstruction set extensions.znver1AMD Family 17h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set extensions.btver1CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,CX16, ABM and 64-bit instruction set extensions.)btver2CPUs based on AMD Family 16h cores with x86-64 instruction set support. This includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES,SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.winchip-c6IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction set support.winchip2IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow! instruction set support.c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No scheduling is implemented for this chip.)c3-2VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. (No scheduling is implemented for this chip.)c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. (No scheduling is implemented for this chip.)samuel-2VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set support. (No scheduling is implemented for this chip.)nehemiahVIA Eden Nehemiah CPU with MMX and SSE instruction set support. (No scheduling is implemented for this chip.)estherVIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. (No scheduling is implemented for this chip.)eden-x2VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. (No scheduling is implemented for this chip.)eden-x4VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (Noscheduling is implemented for this chip.)nanoGeneric VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. (No scheduling is implemented forthis chip.)nano-1000VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. (No scheduling is implemented forthis chip.)nano-2000VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. (No scheduling is implemented forthis chip.)nano-3000VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling is implementedfor this chip.)nano-x2VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling isimplemented for this chip.)nano-x4VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling isimplemented for this chip.)geodeAMD Geode embedded processor with MMX and 3DNow! instruction set support.
cc -mtune, ...
-mfpmath
Generate floating-point arithmetic for selected unit unit. The choices for unit are:387 Use the standard 387 floating-point coprocessor present on the majority of chips and emulated otherwise. Code compiled withthis option runs almost everywhere. The temporary results are computed in 80-bit precision instead of the precisionspecified by the type, resulting in slightly different results compared to most of other chips. See -ffloat-store for moredetailed description.This is the default choice for non-Darwin x86-32 targets.sse Use scalar floating-point instructions present in the SSE instruction set. This instruction set is supported by Pentium IIIand newer chips, and in the AMD line by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE instructionset supports only single-precision arithmetic, thus the double and extended-precision arithmetic are still done using 387. Alater version, present only in Pentium 4 and AMD x86-64 chips, supports double-precision arithmetic too.For the x86-32 compiler, you must use -march=cpu-type, -msse or -msse2 switches to enable SSE extensions and make this optioneffective. For the x86-64 compiler, these extensions are enabled by default.The resulting code should be considerably faster in the majority of cases and avoid the numerical instability problems of 387code, but may break some existing code that expects temporaries to be 80 bits.This is the default choice for the x86-64 compiler, Darwin x86-32 targets, and the default choice for x86-32 targets with theSSE2 instruction set when -ffast-math is enabled.sse,387sse+387bothAttempt to utilize both instruction sets at once. This effectively doubles the amount of available registers, and on chipswith separate execution units for 387 and SSE the execution resources too. Use this option with care, as it is stillexperimental, because the GCC register allocator does not model separate functional units well, resulting in unstableperformance.
cc -mfpmath ...
-mno-ieee-fp
Control whether or not the compiler uses IEEE floating-point comparisons. These correctly handle the case where the result of acomparison is unordered.
cc -mno-ieee-fp ...
-mno-fp-ret-in-387
Do not use the FPU registers for return values of functions.The usual calling convention has functions return values of types "float" and "double" in an FPU register, even if there is noFPU. The idea is that the operating system should emulate an FPU.The option -mno-fp-ret-in-387 causes such values to be returned in ordinary CPU registers instead.
cc -mno-fp-ret-in-387 ...
-mno-fancy-math-387
Some 387 emulators do not support the "sin", "cos" and "sqrt" instructions for the 387. Specify this option to avoid generatingthose instructions. This option is the default on OpenBSD and NetBSD. This option is overridden when -march indicates that thetarget CPU always has an FPU and so the instruction does not need emulation. These instructions are not generated unless youalso use the -funsafe-math-optimizations switch.
cc -mno-fancy-math-387 ...
-mno-align-double
Control whether GCC aligns "double", "long double", and "long long" variables on a two-word boundary or a one-word boundary.Aligning "double" variables on a two-word boundary produces code that runs somewhat faster on a Pentium at the expense of morememory.On x86-64, -malign-double is enabled by default.Warning: if you use the -malign-double switch, structures containing the above types are aligned differently than the publishedapplication binary interface specifications for the x86-32 and are not binary compatible with structures in code compiled withoutthat switch.
cc -mno-align-double ...
-m128bit-long-double
These switches control the size of "long double" type. The x86-32 application binary interface specifies the size to be 96 bits,so -m96bit-long-double is the default in 32-bit mode.Modern architectures (Pentium and newer) prefer "long double" to be aligned to an 8- or 16-byte boundary. In arrays orstructures conforming to the ABI, this is not possible. So specifying -m128bit-long-double aligns "long double" to a 16-byteboundary by padding the "long double" with an additional 32-bit zero.In the x86-64 compiler, -m128bit-long-double is the default choice as its ABI specifies that "long double" is aligned on 16-byteboundary.Notice that neither of these options enable any extra precision over the x87 standard of 80 bits for a "long double".Warning: if you override the default value for your target ABI, this changes the size of structures and arrays containing "longdouble" variables, as well as modifying the function calling convention for functions taking "long double". Hence they are notbinary-compatible with code compiled without that switch.
cc -m128bit-long-double ...
-mlarge-data-threshold
When -mcmodel=medium is specified, data objects larger than threshold are placed in the large data section. This value must bethe same across all objects linked into the binary, and defaults to 65535.
cc -mlarge-data-threshold ...
-mregparm
Control how many registers are used to pass integer arguments. By default, no registers are used to pass arguments, and at most3 registers can be used. You can control this behavior for a specific function by using the function attribute "regparm".Warning: if you use this switch, and num is nonzero, then you must build all modules with the same value, including anylibraries. This includes the system libraries and startup modules.
cc -mregparm ...
-msseregparm
Use SSE register passing conventions for float and double arguments and return values. You can control this behavior for aspecific function by using the function attribute "sseregparm".Warning: if you use this switch then you must build all modules with the same value, including any libraries. This includes thesystem libraries and startup modules.
cc -msseregparm ...
-mpc80
Set 80387 floating-point precision to 32, 64 or 80 bits. When -mpc32 is specified, the significands of results of floating-pointoperations are rounded to 24 bits (single precision); -mpc64 rounds the significands of results of floating-point operations to53 bits (double precision) and -mpc80 rounds the significands of results of floating-point operations to 64 bits (extended doubleprecision), which is the default. When this option is used, floating-point operations in higher precisions are not available tothe programmer without setting the FPU control word explicitly.Setting the rounding of floating-point operations to less than the default 80 bits can speed some programs by 2% or more. Notethat some mathematical libraries assume that extended-precision (80-bit) floating-point operations are enabled by default;routines in such libraries could suffer significant loss of accuracy, typically through so-called "catastrophic cancellation",when this option is used to set the precision to less than extended precision.
cc -mpc80 ...
-mstackrealign
Realign the stack at entry. On the x86, the -mstackrealign option generates an alternate prologue and epilogue that realigns therun-time stack if necessary. This supports mixing legacy codes that keep 4-byte stack alignment with modern codes that keep16-byte stack alignment for SSE compatibility. See also the attribute "force_align_arg_pointer", applicable to individualfunctions.
cc -mstackrealign ...
-mpreferred-stack-boundary
Attempt to keep the stack boundary aligned to a 2 raised to num byte boundary. If -mpreferred-stack-boundary is not specified,the default is 4 (16 bytes or 128 bits).Warning: When generating code for the x86-64 architecture with SSE extensions disabled, -mpreferred-stack-boundary=3 can be usedto keep the stack boundary aligned to 8 byte boundary. Since x86-64 ABI require 16 byte stack alignment, this is ABIincompatible and intended to be used in controlled environment where stack space is important limitation. This option leads towrong code when functions compiled with 16 byte stack alignment (such as functions from a standard library) are called withmisaligned stack. In this case, SSE instructions may lead to misaligned memory access traps. In addition, variable argumentsare handled incorrectly for 16 byte aligned objects (including x87 long double and __int128), leading to wrong results. You mustbuild all modules with -mpreferred-stack-boundary=3, including any libraries. This includes the system libraries and startupmodules.
cc -mpreferred-stack-boundary ...
-mincoming-stack-boundary
Assume the incoming stack is aligned to a 2 raised to num byte boundary. If -mincoming-stack-boundary is not specified, the onespecified by -mpreferred-stack-boundary is used.On Pentium and Pentium Pro, "double" and "long double" values should be aligned to an 8-byte boundary (see -malign-double) orsuffer significant run time performance penalties. On Pentium III, the Streaming SIMD Extension (SSE) data type "__m128" may notwork properly if it is not 16-byte aligned.To ensure proper alignment of this values on the stack, the stack boundary must be as aligned as that required by any valuestored on the stack. Further, every function must be generated such that it keeps the stack aligned. Thus calling a functioncompiled with a higher preferred stack boundary from a function compiled with a lower preferred stack boundary most likelymisaligns the stack. It is recommended that libraries that use callbacks always use the default setting.This extra alignment does consume extra stack space, and generally increases code size. Code that is sensitive to stack spaceusage, such as embedded systems and operating system kernels, may want to reduce the preferred alignment to
cc -mincoming-stack-boundary ...
-mpku
These switches enable the use of instructions in the MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER,AVX512CD, SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMAAVX512VBMI, BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, 3DNow! or enhanced 3DNow! extended instruction sets.Each has a corresponding -mno- option to disable use of these instructions.These extensions are also available as built-in functions: see x86 Built-in Functions, for details of the functions enabled anddisabled by these switches.To generate SSE/SSE2 instructions automatically from floating-point code (as opposed to 387 instructions), see -mfpmath=sse.GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSExinstructions when needed.These options enable GCC to use these extended instructions in generated code, even without -mfpmath=sse. Applications thatperform run-time CPU detection must compile separate files for each supported architecture, using the appropriate flags. Inparticular, the file containing the CPU detection code should be compiled without these options.
cc -mpku ...
-mdump-tune-features
This option instructs GCC to dump the names of the x86 performance tuning features and default settings. The names can be used in
cc -mdump-tune-features ...
-mtune-ctrl
This option is used to do fine grain control of x86 code generation features. feature-list is a comma separated list of featurenames. See also -mdump-tune-features. When specified, the feature is turned on if it is not preceded with ^, otherwise, it isturned off. -mtune-ctrl=feature-list is intended to be used by GCC developers. Using it may lead to code paths not covered bytesting and can potentially result in compiler ICEs or runtime errors.
cc -mtune-ctrl ...
-mno-default
This option instructs GCC to turn off all tunable features. See also -mtune-ctrl=feature-list and -mdump-tune-features.
cc -mno-default ...
-mcld
This option instructs GCC to emit a "cld" instruction in the prologue of functions that use string instructions. Stringinstructions depend on the DF flag to select between autoincrement or autodecrement mode. While the ABI specifies the DF flag tobe cleared on function entry, some operating systems violate this specification by not clearing the DF flag in their exceptiondispatchers. The exception handler can be invoked with the DF flag set, which leads to wrong direction mode when stringinstructions are used. This option can be enabled by default on 32-bit x86 targets by configuring GCC with the --enable-cldconfigure option. Generation of "cld" instructions can be suppressed with the -mno-cld compiler option in this case.
cc -mcld ...
-mvzeroupper
This option instructs GCC to emit a "vzeroupper" instruction before a transfer of control flow out of the function to minimizethe AVX to SSE transition penalty as well as remove unnecessary "zeroupper" intrinsics.
cc -mvzeroupper ...
-mprefer-avx128
This option instructs GCC to use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer.
cc -mprefer-avx128 ...
-mcx16
This option enables GCC to generate "CMPXCHG16B" instructions in 64-bit code to implement compare-and-exchange operations on16-byte aligned 128-bit objects. This is useful for atomic updates of data structures exceeding one machine word in size. Thecompiler uses this instruction to implement __sync Builtins. However, for __atomic Builtins operating on 128-bit integers, alibrary call is always used.
cc -mcx16 ...
-msahf
This option enables generation of "SAHF" instructions in 64-bit code. Early Intel Pentium 4 CPUs with Intel 64 support, prior tothe introduction of Pentium 4 G1 step in December 2005, lacked the "LAHF" and "SAHF" instructions which are supported by AMD64.These are load and store instructions, respectively, for certain status flags. In 64-bit mode, the "SAHF" instruction is used tooptimize "fmod", "drem", and "remainder" built-in functions; see Other Builtins for details.
cc -msahf ...
-mmovbe
This option enables use of the "movbe" instruction to implement "__builtin_bswap32" and "__builtin_bswap64".
cc -mmovbe ...
-mcrc32
This option enables built-in functions "__builtin_ia32_crc32qi", "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and"__builtin_ia32_crc32di" to generate the "crc32" machine instruction.
cc -mcrc32 ...
-mno-push-args
Use PUSH operations to store outgoing parameters. This method is shorter and usually equally fast as method using SUB/MOVoperations and is enabled by default. In some cases disabling it may improve performance because of improved scheduling andreduced dependencies.
cc -mno-push-args ...
-mno-ms-bitfields
Enable/disable bit-field layout compatible with the native Microsoft Windows compiler.If "packed" is used on a structure, or if bit-fields are used, it may be that the Microsoft ABI lays out the structuredifferently than the way GCC normally does. Particularly when moving packed data between functions compiled with GCC and thenative Microsoft compiler (either via function call or as data in a file), it may be necessary to access either format.This option is enabled by default for Microsoft Windows targets. This behavior can also be controlled locally by use of variableor type attributes. For more information, see x86 Variable Attributes and x86 Type Attributes.The Microsoft structure layout algorithm is fairly simple with the exception of the bit-field packing. The padding and alignmentof members of structures and whether a bit-field can straddle a storage-unit boundary are determine by these rules:1. Structure members are stored sequentially in the order in which they aredeclared: the first member has the lowest memory address and the last member the highest.2. Every data object has an alignment requirement. The alignment requirementfor all data except structures, unions, and arrays is either the size of the object or the current packing size (specifiedwith either the "aligned" attribute or the "pack" pragma), whichever is less. For structures, unions, and arrays, thealignment requirement is the largest alignment requirement of its members. Every object is allocated an offset so that:offset % alignment_requirement == 03. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocationunit if the integral types are the same size and if the next bit-field fits into the current allocation unit without crossingthe boundary imposed by the common alignment requirements of the bit-fields.MSVC interprets zero-length bit-fields in the following ways:1. If a zero-length bit-field is inserted between two bit-fields thatare normally coalesced, the bit-fields are not coalesced.For example:struct{unsigned long bf_1 : 12;unsigned long : 0;unsigned long bf_2 : 12;} t1;The size of "t1" is 8 bytes with the zero-length bit-field. If the zero-length bit-field were removed, "t1"'s size would be4 bytes.2. If a zero-length bit-field is inserted after a bit-field, "foo", and thealignment of the zero-length bit-field is greater than the member that follows it, "bar", "bar" is aligned as the type of thezero-length bit-field.For example:struct{char foo : 4;short : 0;char bar;} t2;struct{char foo : 4;short : 0;double bar;} t3;For "t2", "bar" is placed at offset 2, rather than offset 1. Accordingly, the size of "t2" is 4. For "t3", the zero-lengthbit-field does not affect the alignment of "bar" or, as a result, the size of the structure.Taking this into account, it is important to note the following:1. If a zero-length bit-field follows a normal bit-field, the type of thezero-length bit-field may affect the alignment of the structure as whole. For example, "t2" has a size of 4 bytes, sincethe zero-length bit-field follows a normal bit-field, and is of type short.2. Even if a zero-length bit-field is not followed by a normal bit-field, it maystill affect the alignment of the structure:struct{char foo : 6;long : 0;} t4;Here, "t4" takes up 4 bytes.3. Zero-length bit-fields following non-bit-field members are ignored:struct{char foo;long : 0;char bar;} t5;Here, "t5" takes up 2 bytes.
cc -mno-ms-bitfields ...
-mno-align-stringops
Do not align the destination of inlined string operations. This switch reduces code size and improves performance in case thedestination is already aligned, but GCC doesn't know about it.
cc -mno-align-stringops ...
-minline-all-stringops
By default GCC inlines string operations only when the destination is known to be aligned to least a 4-byte boundary. Thisenables more inlining and increases code size, but may improve performance of code that depends on fast "memcpy", "strlen", and"memset" for short lengths.
cc -minline-all-stringops ...
-minline-stringops-dynamically
For string operations of unknown size, use run-time checks with inline code for small blocks and a library call for large blocks.
cc -minline-stringops-dynamically ...
-mstringop-strategy
Override the internal decision heuristic for the particular algorithm to use for inlining string operations. The allowed valuesfor alg are:rep_byterep_4byterep_8byteExpand using i386 "rep" prefix of the specified size.byte_looploopunrolled_loopExpand into an inline loop.libcallAlways use a library call.
cc -mstringop-strategy ...
-mmemset-strategy
The option is similar to -mmemcpy-strategy= except that it is to control "__builtin_memset" expansion.
cc -mmemset-strategy ...
-mno-tls-direct-seg-refs
Controls whether TLS variables may be accessed with offsets from the TLS segment register (%gs for 32-bit, %fs for 64-bit), orwhether the thread base pointer must be added. Whether or not this is valid depends on the operating system, and whether it mapsthe segment to cover the entire TLS area.For systems that use the GNU C Library, the default is on.
cc -mno-tls-direct-seg-refs ...
-mno-sse2avx
Specify that the assembler should encode SSE instructions with VEX prefix. The option -mavx turns this on by default.
cc -mno-sse2avx ...
-mno-fentry
If profiling is active (-pg), put the profiling counter call before the prologue. Note: On x86 architectures the attribute"ms_hook_prologue" isn't possible at the moment for -mfentry and -pg.
cc -mno-fentry ...
-mno-record-mcount
If profiling is active (-pg), generate a __mcount_loc section that contains pointers to each profiling call. This is useful forautomatically patching and out calls.
cc -mno-record-mcount ...
-mno-nop-mcount
If profiling is active (-pg), generate the calls to the profiling functions as NOPs. This is useful when they should be patchedin later dynamically. This is likely only useful together with -mrecord-mcount.
cc -mno-nop-mcount ...
-mno-skip-rax-setup
When generating code for the x86-64 architecture with SSE extensions disabled, -mskip-rax-setup can be used to skip setting upRAX register when there are no variable arguments passed in vector registers.Warning: Since RAX register is used to avoid unnecessarily saving vector registers on stack when passing variable arguments, theimpacts of this option are callees may waste some stack space, misbehave or jump to a random location. GCC 4.4 or newer don'thave those issues, regardless the RAX register value.
cc -mno-skip-rax-setup ...
-mno-8bit-idiv
On some processors, like Intel Atom, 8-bit unsigned integer divide is much faster than 32-bit/64-bit integer divide. This optiongenerates a run-time check. If both dividend and divisor are within range of 0 to 255, 8-bit unsigned integer divide is usedinstead of 32-bit/64-bit integer divide.
cc -mno-8bit-idiv ...
-mavx256-split-unaligned-store
Split 32-byte AVX unaligned load and store.
cc -mavx256-split-unaligned-store ...
-mmitigate-rop
Try to avoid generating code sequences that contain unintended return opcodes, to mitigate against certain forms of attack. Atthe moment, this option is limited in what it can do and should not be relied on to provide serious protection.
cc -mmitigate-rop ...
-mindirect-branch
Convert indirect call and jump with choice. The default is keep, which keeps indirect call and jump unmodified. thunk convertsindirect call and jump to call and return thunk. thunk-inline converts indirect call and jump to inlined call and return thunk.thunk-extern converts indirect call and jump to external call and return thunk provided in a separate object file. You cancontrol this behavior for a specific function by using the function attribute "indirect_branch".Note that -mcmodel=large is incompatible with -mindirect-branch=thunk nor -mindirect-branch=thunk-extern since the thunk functionmay not be reachable in large code model.
cc -mindirect-branch ...
-mindirect-branch-register
Force indirect call and jump via register.These -m switches are supported in addition to the above on x86-64 processors in 64-bit environments.
cc -mindirect-branch-register ...
-miamcu
Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32 option sets "int", "long", and pointer types to 32 bits, andgenerates code that runs on any i386 system.The -m64 option sets "int" to 32 bits and "long" and pointer types to 64 bits, and generates code for the x86-64 architecture.For Darwin only the -m64 option also turns off the -fno-pic and -mdynamic-no-pic options.The -mx32 option sets "int", "long", and pointer types to 32 bits, and generates code for the x86-64 architecture.The -m16 option is the same as -m32, except for that it outputs the ".code16gcc" assembly directive at the beginning of theassembly output so that the binary can run in 16-bit mode.The -miamcu option generates code which conforms to Intel MCU psABI. It requires the -m32 option to be turned on.
cc -miamcu ...
-mno-red-zone
Do not use a so-called "red zone" for x86-64 code. The red zone is mandated by the x86-64 ABI; it is a 128-byte area beyond thelocation of the stack pointer that is not modified by signal or interrupt handlers and therefore can be used for temporary datawithout adjusting the stack pointer. The flag -mno-red-zone disables this red zone.
cc -mno-red-zone ...
-maddress-mode
Generate code for long address mode. This is only supported for 64-bit and x32 environments. It is the default address mode for64-bit environments.
cc -maddress-mode ...
-mconsole
This option specifies that a console application is to be generated, by instructing the linker to set the PE header subsystemtype required for console applications. This option is available for Cygwin and MinGW targets and is enabled by default on thosetargets.
cc -mconsole ...
-mdll
This option is available for Cygwin and MinGW targets. It specifies that a DLL---a dynamic link library---is to be generated,enabling the selection of the required runtime startup object and entry point.
cc -mdll ...
-mnop-fun-dllimport
This option is available for Cygwin and MinGW targets. It specifies that the "dllimport" attribute should be ignored.
cc -mnop-fun-dllimport ...
-mthread
This option is available for MinGW targets. It specifies that MinGW-specific thread support is to be used.
cc -mthread ...
-municode
This option is available for MinGW-w64 targets. It causes the "UNICODE" preprocessor macro to be predefined, and choosesUnicode-capable runtime startup code.
cc -municode ...
-mwin32
This option is available for Cygwin and MinGW targets. It specifies that the typical Microsoft Windows predefined macros are tobe set in the pre-processor, but does not influence the choice of runtime library/startup code.
cc -mwin32 ...
-mwindows
This option is available for Cygwin and MinGW targets. It specifies that a GUI application is to be generated by instructing thelinker to set the PE header subsystem type appropriately.
cc -mwindows ...
-fwritable-relocated-rdata
This option is available for MinGW and Cygwin targets. It specifies that relocated-data in read-only section is put into the".data" section. This is a necessary for older runtimes not supporting modification of ".rdata" sections for pseudo-relocation.
cc -fwritable-relocated-rdata ...
-mpe-aligned-commons
This option is available for Cygwin and MinGW targets. It specifies that the GNU extension to the PE file format that permitsthe correct alignment of COMMON variables should be used when generating code. It is enabled by default if GCC detects that thetarget assembler found during configuration supports the feature.See also under x86 Options for standard options.Xstormy16 OptionsThese options are defined for Xstormy16:
cc -mpe-aligned-commons ...
-mno-const16
Enable or disable use of "CONST16" instructions for loading constant values. The "CONST16" instruction is currently not astandard option from Tensilica. When enabled, "CONST16" instructions are always used in place of the standard "L32R"instructions. The use of "CONST16" is enabled by default only if the "L32R" instruction is not available.
cc -mno-const16 ...
-mno-serialize-volatile
When this option is enabled, GCC inserts "MEMW" instructions before "volatile" memory references to guarantee sequentialconsistency. The default is -mserialize-volatile. Use -mno-serialize-volatile to omit the "MEMW" instructions.
cc -mno-serialize-volatile ...
-mforce-no-pic
For targets, like GNU/Linux, where all user-mode Xtensa code must be position-independent code (PIC), this option disables PICfor compiling kernel code.
cc -mforce-no-pic ...
-mno-text-section-literals
These options control the treatment of literal pools. The default is -mno-text-section-literals, which places literals in aseparate section in the output file. This allows the literal pool to be placed in a data RAM/ROM, and it also allows the linkerto combine literal pools from separate object files to remove redundant literals and improve code size. With
cc -mno-text-section-literals ...
-mno-auto-litpools
These options control the treatment of literal pools. The default is -mno-auto-litpools, which places literals in a separatesection in the output file unless -mtext-section-literals is used. With -mauto-litpools the literals are interspersed in thetext section by the assembler. Compiler does not produce explicit ".literal" directives and loads literals into registers with"MOVI" instructions instead of "L32R" to let the assembler do relaxation and place literals as necessary. This option allowsassembler to create several literal pools per function and assemble very big functions, which may not be possible with
cc -mno-auto-litpools ...
-mno-target-align
When this option is enabled, GCC instructs the assembler to automatically align instructions to reduce branch penalties at theexpense of some code density. The assembler attempts to widen density instructions to align branch targets and the instructionsfollowing call instructions. If there are not enough preceding safe density instructions to align a target, no widening isperformed. The default is -mtarget-align. These options do not affect the treatment of auto-aligned instructions like "LOOP",which the assembler always aligns, either by widening density instructions or by inserting NOP instructions.
cc -mno-target-align ...
-mno-longcalls
When this option is enabled, GCC instructs the assembler to translate direct calls to indirect calls unless it can determine thatthe target of a direct call is in the range allowed by the call instruction. This translation typically occurs for calls tofunctions in other source files. Specifically, the assembler translates a direct "CALL" instruction into an "L32R" followed by a"CALLX" instruction. The default is -mno-longcalls. This option should be used in programs where the call target canpotentially be out of range. This option is implemented in the assembler, not the compiler, so the assembly code generated byGCC still shows direct call instructions---look at the disassembled object code to see the actual instructions. Note that theassembler uses an indirect call for every cross-file call, not just those that really are out of range.zSeries OptionsThese are listed underENVIRONMENTThis section describes several environment variables that affect how GCC operates. Some of them work by specifying directories orprefixes to use when searching for various kinds of files. Some are used to specify other aspects of the compilation environment.Note that you can also specify places to search using options such as -B, -I and -L. These take precedence over places specifiedusing environment variables, which in turn take precedence over those specified by the configuration of GCC.LANGLC_CTYPELC_MESSAGESLC_ALLThese environment variables control the way that GCC uses localization information which allows GCC to work with differentnational conventions. GCC inspects the locale categories LC_CTYPE and LC_MESSAGES if it has been configured to do so. Theselocale categories can be set to any value supported by your installation. A typical value is en_GB.UTF-8 for English in theUnited Kingdom encoded in UTF-8.The LC_CTYPE environment variable specifies character classification. GCC uses it to determine the character boundaries in astring; this is needed for some multibyte encodings that contain quote and escape characters that are otherwise interpreted as astring end or escape.The LC_MESSAGES environment variable specifies the language to use in diagnostic messages.If the LC_ALL environment variable is set, it overrides the value of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE andLC_MESSAGES default to the value of the LANG environment variable. If none of these variables are set, GCC defaults totraditional C English behavior.TMPDIRIf TMPDIR is set, it specifies the directory to use for temporary files. GCC uses temporary files to hold the output of onestage of compilation which is to be used as input to the next stage: for example, the output of the preprocessor, which is theinput to the compiler proper.GCC_COMPARE_DEBUGSetting GCC_COMPARE_DEBUG is nearly equivalent to passing -fcompare-debug to the compiler driver. See the documentation of thisoption for more details.GCC_EXEC_PREFIXIf GCC_EXEC_PREFIX is set, it specifies a prefix to use in the names of the subprograms executed by the compiler. No slash isadded when this prefix is combined with the name of a subprogram, but you can specify a prefix that ends with a slash if youwish.If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an appropriate prefix to use based on the pathname it is invoked with.If GCC cannot find the subprogram using the specified prefix, it tries looking in the usual places for the subprogram.The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where prefix is the prefix to the installed compiler. In many casesprefix is the value of "prefix" when you ran the configure script.Other prefixes specified with -B take precedence over this prefix.This prefix is also used for finding files such as crt0.o that are used for linking.In addition, the prefix is used in an unusual way in finding the directories to search for header files. For each of thestandard directories whose name normally begins with /usr/local/lib/gcc (more precisely, with the value of GCC_INCLUDE_DIR), GCCtries replacing that beginning with the specified prefix to produce an alternate directory name. Thus, with -Bfoo/, GCC searchesfoo/bar just before it searches the standard directory /usr/local/lib/bar. If a standard directory begins with the configuredprefix then the value of prefix is replaced by GCC_EXEC_PREFIX when looking for header files.COMPILER_PATHThe value of COMPILER_PATH is a colon-separated list of directories, much like PATH. GCC tries the directories thus specifiedwhen searching for subprograms, if it cannot find the subprograms using GCC_EXEC_PREFIX.LIBRARY_PATHThe value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCCtries the directories thus specified when searching for special linker files, if it cannot find them using GCC_EXEC_PREFIX.Linking using GCC also uses these directories when searching for ordinary libraries for the -l option (but directories specifiedwith -L come first).LANGThis variable is used to pass locale information to the compiler. One way in which this information is used is to determine thecharacter set to be used when character literals, string literals and comments are parsed in C and C++. When the compiler isconfigured to allow multibyte characters, the following values for LANG are recognized:
cc -mno-longcalls ...
-JIS
Recognize JIS characters.
cc -JIS ...
-SJIS
Recognize SJIS characters.
cc -SJIS ...
-EUCJP
Recognize EUCJP characters.If LANG is not defined, or if it has some other value, then the compiler uses "mblen" and "mbtowc" as defined by the defaultlocale to recognize and translate multibyte characters.Some additional environment variables affect the behavior of the preprocessor.CPATHC_INCLUDE_PATHCPLUS_INCLUDE_PATHOBJC_INCLUDE_PATHEach variable's value is a list of directories separated by a special character, much like PATH, in which to look for headerfiles. The special character, "PATH_SEPARATOR", is target-dependent and determined at GCC build time. For Microsoft Windows-based targets it is a semicolon, and for almost all other targets it is a colon.CPATH specifies a list of directories to be searched as if specified with -I, but after any paths given with -I options on thecommand line. This environment variable is used regardless of which language is being preprocessed.The remaining environment variables apply only when preprocessing the particular language indicated. Each specifies a list ofdirectories to be searched as if specified with -isystem, but after any paths given with -isystem options on the command line.In all these variables, an empty element instructs the compiler to search its current working directory. Empty elements canappear at the beginning or end of a path. For instance, if the value of CPATH is ":/special/include", that has the same effectas -I. -I/special/include.DEPENDENCIES_OUTPUTIf this variable is set, its value specifies how to output dependencies for Make based on the non-system header files processedby the compiler. System header files are ignored in the dependency output.The value of DEPENDENCIES_OUTPUT can be just a file name, in which case the Make rules are written to that file, guessing thetarget name from the source file name. Or the value can have the form file target, in which case the rules are written to filefile using target as the target name.In other words, this environment variable is equivalent to combining the options -MM and -MF, with an optional -MT switch too.SUNPRO_DEPENDENCIESThis variable is the same as DEPENDENCIES_OUTPUT (see above), except that system header files are not ignored, so it implies -Mrather than -MM. However, the dependence on the main input file is omitted.SOURCE_DATE_EPOCHIf this variable is set, its value specifies a UNIX timestamp to be used in replacement of the current date and time in the"__DATE__" and "__TIME__" macros, so that the embedded timestamps become reproducible.The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as the number of seconds (excluding leap seconds) since 01 Jan1970 00:00:00 represented in ASCII; identical to the output of @command{date +%s} on GNU/Linux and other systems that support the%s extension in the "date" command.The value should be a known timestamp such as the last modification time of the source or package and it should be set by thebuild process.BUGSFor instructions on reporting bugs, see <file:///usr/share/doc/gcc-7/README.Bugs>.FOOTNOTES1. On some systems, gcc -shared needs to build supplementary stub code for constructors to work. On multi-libbed systems, gcc
cc -EUCJP ...