mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
ef57b08058
Some checks are pending
build / linux-wasi (push) Waiting to run
build / linux-wasi-api (push) Waiting to run
build / linux-csnext (push) Waiting to run
build / tarball (push) Waiting to run
build / linux-static (push) Waiting to run
build / linux-acr-rpm-64 (push) Waiting to run
build / linux-acr-deb (amd64) (push) Waiting to run
build / linux-acr-deb (arm64, aarch64-linux-gnu) (push) Waiting to run
build / linux-acr-deb (i386, multilib) (push) Waiting to run
build / macos-acr (arm64, 13) (push) Waiting to run
build / macos-acr (x86_64, 12) (push) Waiting to run
build / ios (cydia32) (push) Waiting to run
build / ios (true, cydia) (push) Waiting to run
build / android-acr (16, arm) (push) Waiting to run
build / android-acr (aarch64) (push) Waiting to run
build / android-meson (x86_64) (push) Waiting to run
build / w32-meson (push) Waiting to run
build / w64-static-2022 (push) Waiting to run
build / w64-static (push) Waiting to run
build / w64-meson (push) Waiting to run
build / check_abi_compatibility (push) Blocked by required conditions
build / check_release (push) Blocked by required conditions
build / release (push) Blocked by required conditions
CI / linux-acr-oldlibsbug (push) Waiting to run
CI / linux-nocs (push) Waiting to run
CI / linux-acr-gperf (push) Waiting to run
CI / linux-sys-capstone (push) Waiting to run
CI / linux-acr-resymlink (push) Waiting to run
CI / linux-test (push) Waiting to run
CI / linux-static-meson (push) Waiting to run
CI / macos-test (push) Waiting to run
CI / linux-rpath (push) Waiting to run
CI / macos-rpath (push) Waiting to run
CI / linux-meson-spaces (push) Waiting to run
CI / linux-tinyasan-fuzz (push) Waiting to run
CI / linux-asan-fuzz (push) Waiting to run
CI / w64-make (push) Waiting to run
CI / w32-mingw (push) Waiting to run
CI / w64-mingw (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Coverity Scan / latest (push) Waiting to run
tcc / ubuntu-tcc-newabi (push) Waiting to run
tcc / ubuntu-tcc-test (push) Waiting to run
tcc / ubuntu-tcc-nodbg (push) Waiting to run
tcc / r2pm-tcc (push) Waiting to run
tcc / ubuntu-tcc-syslibs (push) Waiting to run
78 lines
2.4 KiB
Bash
Executable File
78 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# SANITIZE="address leak memory undefined"
|
|
# SANITIZE="address signed-integer-overflow" # Faster build
|
|
# default:
|
|
if [ -n "$(echo $SANITIZE | grep memory)" ]; then
|
|
# This is linux (and CLANG) Specific
|
|
SANITIZE=${SANITIZE:="memory"}
|
|
# SANITIZE=${SANITIZE:="memory undefined signed-integer-overflow"}
|
|
export CFLAGS="-fsanitize-memory-track-origins=2"
|
|
export CC=clang
|
|
else
|
|
SANITIZE=${SANITIZE:="address undefined signed-integer-overflow"}
|
|
|
|
fi
|
|
# SANITIZE=${SANITIZE:="thread"}
|
|
# export CFLAGS="-mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -O0"
|
|
export CFLAGS="-mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
|
|
|
printf "\033[32m"
|
|
echo "========================================================================="
|
|
printf "\033[33m"
|
|
echo "Sanitize build script can be configured with the SANITIZE environment variable."
|
|
echo "Use one of the following words to specify which sanitizers to use:"
|
|
echo " - address - detect memory errors"
|
|
echo " - thread - detect thread racing issues"
|
|
echo " - leak - find memory leaks"
|
|
echo " - memory - detect uninitialized reads"
|
|
echo " - undefined - find undefined behaviour"
|
|
echo " - ..."
|
|
echo "For more information:"
|
|
echo " http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation"
|
|
echo "For example:"
|
|
echo " $ SANITIZE='leak memory address' sys/sanitize.sh"
|
|
echo "Current value:"
|
|
echo " SANITIZE=${SANITIZE}"
|
|
printf "\033[32m"
|
|
echo "========================================================================="
|
|
printf "\033[0m"
|
|
sleep 1
|
|
|
|
# memory leaks are detected by default, can only be disabled via env var
|
|
HAVE_LEAKS=1
|
|
for a in $SANITIZE ; do
|
|
export CFLAGS="${CFLAGS} -fsanitize=$a"
|
|
if [ "$a" = leak ]; then
|
|
HAVE_LEAKS=0
|
|
elif [ "$a" = address ]; then
|
|
export CFLAGS="${CFLAGS} -D__ASAN__=1"
|
|
fi
|
|
done
|
|
if [ "${HAVE_LEAKS}" = 0 ]; then
|
|
export ASAN_OPTIONS=detect_leaks=0
|
|
fi
|
|
if [ "`uname`" != Darwin ]; then
|
|
for a in $SANITIZE ; do
|
|
export LDFLAGS="${LDFLAGS} -fsanitize=$a"
|
|
done
|
|
fi
|
|
|
|
export CFLAGS="${CFLAGS} -fno-omit-frame-pointer"
|
|
|
|
echo 'int main(){return 0;}' > .a.c
|
|
[ -z "${CC}" ] && CC=gcc
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o .a.out .a.c
|
|
RET=$?
|
|
rm -f .a.out .a.c
|
|
if [ "$RET" != 0 ]; then
|
|
echo "Your compiler doesn't support a sanitizer in SANITIZE."
|
|
exit 1
|
|
fi
|
|
|
|
SCRIPT=install.sh
|
|
if [ "$1" = "-u" ]; then
|
|
shift
|
|
SCRIPT=user.sh
|
|
fi
|
|
exec sys/${SCRIPT} $* --with-check-level=0 --without-syscapstone
|