From ca60811f5d55254bec378919430dd0e7e6e5cdd1 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Thu, 23 Feb 2023 22:01:12 +0000 Subject: Update build scripts * Support for Ubuntu 22.04 * Remove support for Python2 * Better separation between sanitizer builds and non-sanitizer builds * Fix build of metaSMT on newer Ubuntu versions * Use ninja to build LLVM * Simplifying building arbitrary LLVM configurations, e.g. different LLVM sanitizer builds (MemSan, UBSan, ASan) * Use MemSan with origin tracking * Build sqlite3 container correctly * Add support to provide sqlite3 version number --- scripts/build/v-sanitizer.inc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'scripts/build/v-sanitizer.inc') diff --git a/scripts/build/v-sanitizer.inc b/scripts/build/v-sanitizer.inc index b86ef23f..09005df0 100644 --- a/scripts/build/v-sanitizer.inc +++ b/scripts/build/v-sanitizer.inc @@ -75,8 +75,8 @@ setup_variables_sanitizer() { # Undefined Behaviour Sanitizer if [ "${sanitizer}" == "undefined" ]; then echo "Using UBSan" - flags=("-fsanitize=undefined" "-fno-omit-frame-pointer" "-g" - "-fno-sanitize-recover=undefined") + # Allow to recover from any undefined behaviour + flags=("-fsanitize=undefined" "-fno-omit-frame-pointer" "-g" "-fsanitize-recover=signed-integer-overflow,alignment,vptr") SANITIZER_CXX_FLAGS+=("${flags[@]}") SANITIZER_C_FLAGS+=("${flags[@]}") SANITIZER_LD_FLAGS+=("${flags[@]}") @@ -87,6 +87,30 @@ setup_variables_sanitizer() { # Memory Sanitizer if [ "${sanitizer}" == "memory" ]; then echo "Using Memory Sanitizer" + # Generate full sanitizer ignore file. + cat "${DIR}/sanitizer/"*.txt > "${BASE}/sanitizer_ignore.txt" + flags=("-fsanitize=memory" "-fno-omit-frame-pointer" "-g" "-fsanitize-memory-track-origins" "-fsanitize-ignorelist=${BASE}/sanitizer_ignore.txt") + + if [[ -n "${LLVM_VERSION:-}" ]]; then + # Workaround as we have to pull in MemSan-instrumented libcxx + local LLVM_BUILD_LIBCXX="${BASE}/llvm-${LLVM_VERSION}0-install_NO_D_A_memsan-libcxx" + if [[ -d "${LLVM_BUILD_LIBCXX}" ]]; then + SANITIZER_CXX_FLAGS+=( + "-nostdinc++" + "-isystem ${LLVM_BUILD_LIBCXX}/include" + "-isystem ${LLVM_BUILD_LIBCXX}/include/c++/v1" + ) + SANITIZER_LD_FLAGS+=( + "-lc++abi" + "-Wl,--rpath=${LLVM_BUILD_LIBCXX}/lib" + "-L${LLVM_BUILD_LIBCXX}/lib" + "-stdlib=libc++" + ) + fi + fi + SANITIZER_CXX_FLAGS+=("${flags[@]}") + SANITIZER_C_FLAGS+=("${flags[@]}") + SANITIZER_LD_FLAGS+=("${flags[@]}") SANITIZER_SUFFIX+="_memsan" continue fi -- cgit 1.4.1