Automatically preload asan runtime library

develop
Pauli 2018-07-05 17:54:49 +03:00
parent d1a3f1a738
commit 05dfac28e1
1 changed files with 6 additions and 1 deletions

@ -61,7 +61,12 @@ fi
export LD_LIBRARY_PATH="./hack/libs:./hack:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="./hack/libs:./hack:$LD_LIBRARY_PATH"
PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}./hack/libdfhack.so" LIB="./hack/libdfhack.so"
LIBSAN=""
if which objdump > /dev/null; then
LIBSAN="$(objdump -p $LIB | sed -n 's/^.*NEEDED.*\(lib[a-z]san[a-z.0-9]*\).*$/\1/p' | head -n1):"
fi
PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}${LIBSAN}${LIB}"
setarch_arch=$(cat hack/dfhack_setarch.txt || printf i386) setarch_arch=$(cat hack/dfhack_setarch.txt || printf i386)