summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBrian Smith <brian@dbsoft.org>2023-08-14 19:56:06 -0500
committerBrian Smith <brian@dbsoft.org>2023-08-14 19:56:06 -0500
commit369ba2e7d6dd91328e1e83a037daadf8f4b497f4 (patch)
tree67a526746efa1d3cf70662f1981991b685c8b8bf /build
parenta0fb8c06de8d4fc97bf38c36affcdc03ab5d8d82 (diff)
downloaduxp-369ba2e7d6dd91328e1e83a037daadf8f4b497f4.tar.gz
Issue #2266 - Part 1 - Allow MSVC and potentially GCC to use Address Sanitizer on Windows.
Check for WINNT instead of CLANG-CL, except for the Blacklist that isn't supported by MSVC. Neither CLANG-CL nor MSVC require -fsanitize=address on the link phase.
Diffstat (limited to 'build')
-rw-r--r--build/autoconf/sanitize.m46
-rw-r--r--build/moz.build8
-rw-r--r--build/unix/moz.build3
3 files changed, 8 insertions, 9 deletions
diff --git a/build/autoconf/sanitize.m4 b/build/autoconf/sanitize.m4
index 3193d5c624..8b18cd5bc7 100644
--- a/build/autoconf/sanitize.m4
+++ b/build/autoconf/sanitize.m4
@@ -13,7 +13,7 @@ MOZ_ARG_ENABLE_BOOL(address-sanitizer,
MOZ_ASAN= )
if test -n "$MOZ_ASAN"; then
MOZ_LLVM_HACKS=1
- if test -n "$CLANG_CL"; then
+ if test "$OS_ARCH" = "WINNT"; then
# Look for the ASan runtime binary
if test "$CPU_ARCH" = "x86_64"; then
MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-x86_64.dll
@@ -27,14 +27,14 @@ if test -n "$MOZ_ASAN"; then
fi
AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
# Suppressing errors in recompiled code.
- if test "$OS_ARCH" = "WINNT"; then
+ if test -n "$CLANG_CL"; then
CFLAGS="-fsanitize-blacklist=$_topsrcdir/build/sanitizers/asan_blacklist_win.txt $CFLAGS"
CXXFLAGS="-fsanitize-blacklist=$_topsrcdir/build/sanitizers/asan_blacklist_win.txt $CXXFLAGS"
fi
fi
CFLAGS="-fsanitize=address $CFLAGS"
CXXFLAGS="-fsanitize=address $CXXFLAGS"
- if test -z "$CLANG_CL"; then
+ if test "$OS_ARCH" != "WINNT"; then
LDFLAGS="-fsanitize=address $LDFLAGS"
fi
AC_DEFINE(MOZ_ASAN)
diff --git a/build/moz.build b/build/moz.build
index 6567dd944c..f3801976eb 100644
--- a/build/moz.build
+++ b/build/moz.build
@@ -58,9 +58,11 @@ FINAL_TARGET_FILES += ['/.gdbinit']
FINAL_TARGET_PP_FILES += ['.gdbinit_python.in']
OBJDIR_FILES += ['!/dist/bin/.gdbinit_python']
-# Install the clang-cl runtime library for ASAN next to the binaries we produce.
-if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']:
- FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
+# Install the clang runtime library for ASAN next to the binaries we produce.
+if CONFIG['MOZ_ASAN'] and CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']:
+ FINAL_TARGET_FILES += [CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
+if CONFIG['LLVM_SYMBOLIZER']:
+ FINAL_TARGET_FILES += [CONFIG['LLVM_SYMBOLIZER']]
if CONFIG['MOZ_APP_BASENAME']:
FINAL_TARGET_PP_FILES += ['application.ini']
diff --git a/build/unix/moz.build b/build/unix/moz.build
index 88c933295c..cd455b7a4d 100644
--- a/build/unix/moz.build
+++ b/build/unix/moz.build
@@ -9,9 +9,6 @@ if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] or CONFIG['MOZ_LIBSTDCXX_HOST_VERSION'
if CONFIG['USE_ELF_HACK']:
DIRS += ['elfhack']
-if CONFIG['LLVM_SYMBOLIZER']:
- FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]
-
SDK_FILES.bin += [
'run-mozilla.sh',
]