Make sanitizers platform-agnostic
This commit is contained in:
parent
f5b0b0736c
commit
e1d2fe3135
6 changed files with 28 additions and 39 deletions
|
@ -3,11 +3,6 @@ ld="ld"
|
|||
# OS-and-processor customizations
|
||||
cflags_release+=(-march=nehalem)
|
||||
|
||||
# Build additions
|
||||
TYPES+=(msan usan)
|
||||
cflags_msan=("${cflags_debug[@]}" -fsanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer)
|
||||
cflags_usan=("${cflags_debug[@]}" -fsanitize-recover=all -fsanitize=undefined)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS+=(lto)
|
||||
cflags_lto=(-flto=thin)
|
||||
|
|
|
@ -8,19 +8,24 @@ if [[ $- == *i* ]]; then
|
|||
fi
|
||||
|
||||
# Release-type additions
|
||||
TYPES+=(release debug warnmore pgotrain optinfo)
|
||||
|
||||
# Note: -fno-math-errno allows better optimization of C/C++ math library functions
|
||||
cflags_release+=("${cflags[@]}" -DNDEBUG -O3 -fno-math-errno -fno-strict-aliasing)
|
||||
TYPES+=(release debug warnmore pgotrain optinfo msan usan)
|
||||
|
||||
# Note: no-math-errno improves optimization of C/C++ math functions
|
||||
cflags_release+=("${cflags[@]}" -DNDEBUG -O3 -fno-math-errno
|
||||
-fno-strict-aliasing)
|
||||
cflags_debug+=("${cflags[@]}" -g -fno-omit-frame-pointer)
|
||||
cflags_pgotrain+=("${cflags_debug[@]}" -fprofile-instr-generate -fcoverage-mapping)
|
||||
cflags_warnmore+=("${cflags_debug[@]}" -Wextra -Wshadow -Wcast-align -Wunused
|
||||
-Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion
|
||||
-Wdouble-promotion -Wformat=2)
|
||||
cflags_pgotrain+=("${cflags_debug[@]}" -fprofile-instr-generate
|
||||
-fcoverage-mapping)
|
||||
cflags_warnmore+=("${cflags_debug[@]}" -Wextra -Wshadow -Wcast-align
|
||||
-Wunused -Woverloaded-virtual -Wpedantic -Wconversion
|
||||
-Wsign-conversion -Wdouble-promotion -Wformat=2)
|
||||
cxxonly_warnmore+=(-Wnon-virtual-dtor -Woverloaded-virtual)
|
||||
cflags_optinfo+=("${cflags_release[@]}" -Rpass-analysis=loop-vectorize
|
||||
-gline-tables-only -gcolumn-info)
|
||||
cflags_msan=("${cflags_debug[@]}" -fsanitize-recover=all
|
||||
-fsanitize=memory -fno-omit-frame-pointer)
|
||||
cflags_usan=("${cflags_debug[@]}" -fsanitize-recover=all
|
||||
-fsanitize=undefined)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS=(fdo)
|
||||
|
|
|
@ -3,11 +3,6 @@ ar="llvm-ar${postfix}"
|
|||
ld="llvm-link${postfix}"
|
||||
ranlib="llvm-ranlib${postfix}"
|
||||
|
||||
# Build additions
|
||||
TYPES+=(msan usan)
|
||||
cflags_msan=("${cflags_debug[@]}" -fsanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer)
|
||||
cflags_usan=("${cflags_debug[@]}" -fsanitize-recover=all -fsanitize=undefined)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS+=(lto)
|
||||
cflags_lto+=(-O2 -flto=thin)
|
||||
|
|
|
@ -7,13 +7,6 @@ ranlib="ranlib"
|
|||
cflags_release+=(-march=nehalem)
|
||||
cflags_optinfo+=(-march=nehalem)
|
||||
|
||||
# Build additions
|
||||
TYPES+=(asan uasan usan tsan)
|
||||
cflags_asan=("${cflags_debug[@]}" -fsanitize=address)
|
||||
cflags_uasan=("${cflags_debug[@]}" -fsanitize=address,undefined -fsanitize-recover=signed-integer-overflow)
|
||||
cflags_usan=("${cflags_debug[@]}" -fsanitize=undefined -fsanitize-recover=signed-integer-overflow)
|
||||
cflags_tsan=("${cflags_debug[@]}" -fsanitize=thread)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS+=(lto)
|
||||
cflags_lto+=(-flto)
|
||||
|
|
|
@ -6,7 +6,8 @@ ld="gcc${postfix}"
|
|||
ranlib="gcc-ranlib${postfix}"
|
||||
|
||||
# Release-type additions
|
||||
TYPES+=(release debug warnmore pgotrain fdotrain optinfo)
|
||||
TYPES+=(release debug warnmore pgotrain fdotrain optinfo
|
||||
asan uasan usan tsan)
|
||||
|
||||
cflags+=(-fstack-protector -fdiagnostics-color=auto)
|
||||
cflags_debug+=("${cflags[@]}" -g -fno-omit-frame-pointer)
|
||||
|
@ -17,16 +18,23 @@ cflags_debug+=("${cflags[@]}" -g -fno-omit-frame-pointer)
|
|||
cflags_release+=("${cflags[@]}" -DNDEBUG -O3 -fno-strict-aliasing
|
||||
-fno-signed-zeros -fno-trapping-math -fassociative-math
|
||||
-frename-registers -ffunction-sections -fdata-sections)
|
||||
|
||||
cflags_pgotrain+=("${cflags_debug[@]}" -pg -ftree-vectorize)
|
||||
cflags_warnmore+=("${cflags_debug[@]}" -pedantic -Wcast-align -Wdouble-promotion
|
||||
-Wduplicated-branches -Wduplicated-cond -Wextra -Wformat=2
|
||||
-Wlogical-op -Wmisleading-indentation -Wnull-dereference
|
||||
-Wshadow -Wunused)
|
||||
cxxonly_warnmore+=(-Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wuseless-cast)
|
||||
cflags_warnmore+=("${cflags_debug[@]}" -pedantic -Wcast-align
|
||||
-Wdouble-promotion -Wduplicated-branches
|
||||
-Wduplicated-cond -Wextra -Wformat=2 -Wlogical-op
|
||||
-Wmisleading-indentation -Wnull-dereference -Wshadow
|
||||
-Wunused)
|
||||
cxxonly_warnmore+=(-Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
|
||||
-Wuseless-cast)
|
||||
cflags_fdotrain+=("${cflags[@]}" -DNDEBUG -g1 -fno-omit-frame-pointer)
|
||||
cflags_optinfo+=("${cflags_release[@]}" -fopt-info-missed
|
||||
-ftree-vectorizer-verbose=6)
|
||||
cflags_asan+=("${cflags_debug[@]}" -fsanitize=address)
|
||||
cflags_uasan+=("${cflags_debug[@]}" -fsanitize=address,undefined
|
||||
-fsanitize-recover=signed-integer-overflow)
|
||||
cflags_usan+=("${cflags_debug[@]}" -fsanitize=undefined
|
||||
-fsanitize-recover=signed-integer-overflow)
|
||||
cflags_tsan+=("${cflags_debug[@]}" -fsanitize=thread)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS=(fdo)
|
||||
|
|
|
@ -6,13 +6,6 @@ x86_math=(-mfpmath=sse -msse4.2)
|
|||
cflags_release+=("${x86_math[@]}")
|
||||
cflags_optinfo+=("${x86_math[@]}")
|
||||
|
||||
# Build additions
|
||||
TYPES+=(asan uasan usan tsan)
|
||||
cflags_asan=("${cflags_debug[@]}" -fsanitize=address)
|
||||
cflags_uasan=("${cflags_debug[@]}" -fsanitize=address,undefined -fsanitize-recover=signed-integer-overflow)
|
||||
cflags_usan=("${cflags_debug[@]}" -fsanitize=undefined -fsanitize-recover=signed-integer-overflow)
|
||||
cflags_tsan=("${cflags_debug[@]}" -fsanitize=thread)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS+=(lto)
|
||||
cflags_lto+=(-flto)
|
||||
|
|
Loading…
Add table
Reference in a new issue