Bug 1084157 - Make --enable-address-sanitizer pass the correct -fsanitize arguments to the toolchain; r=glandium

This commit is contained in:
Ehsan Akhgari 2014-10-22 08:30:05 -04:00
parent 9ef1a5f323
commit 00175c0793
3 changed files with 12 additions and 2 deletions

View File

@ -9,10 +9,9 @@ export CXX="$topsrcdir/clang/bin/clang++"
export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer"
# Mandatory flags for ASan
export ASANFLAGS="-fsanitize=address -Dxmalloc=myxmalloc -fPIC"
export ASANFLAGS="-Dxmalloc=myxmalloc -fPIC"
export CFLAGS="$ASANFLAGS"
export CXXFLAGS="$ASANFLAGS"
export LDFLAGS="-fsanitize=address"
# Enable ASan specific code and build workarounds
ac_add_options --enable-address-sanitizer

View File

@ -1274,7 +1274,12 @@ if test -n "$MOZ_ASAN"; then
AC_MSG_ERROR([Couldn't find $MOZ_CLANG_RT_ASAN_LIB. It should be available in the same location as clang-cl.])
fi
AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
else
# We link through the compiler only on non-Windows.
LDFLAGS="$LDFLAGS -fsanitize=address"
fi
CFLAGS="$CFLAGS -fsanitize=address"
CXXFLAGS="$CXXFLAGS -fsanitize=address"
AC_DEFINE(MOZ_ASAN)
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
fi

View File

@ -1073,6 +1073,12 @@ MOZ_ARG_ENABLE_BOOL(address-sanitizer,
MOZ_ASAN= )
if test -n "$MOZ_ASAN"; then
MOZ_LLVM_HACKS=1
if test -z "$CLANG_CL"; then
# We link through the compiler only on non-Windows.
LDFLAGS="$LDFLAGS -fsanitize=address"
fi
CFLAGS="$CFLAGS -fsanitize=address"
CXXFLAGS="$CXXFLAGS -fsanitize=address"
AC_DEFINE(MOZ_ASAN)
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
fi