build-compiler-rt: Stop providing asan in msvcrt builds

See 0b296aefc0 for context, where
we stopped testing asan in msvcrt builds - see discussion at
https://github.com/llvm/llvm-project/pull/120397,
https://github.com/mstorsjo/llvm-mingw/issues/224 and
https://github.com/mstorsjo/llvm-mingw/issues/552.

This should make it clearer that asan isn't supported in msvcrt
builds, instead of silently just providing files that are known
not to work.

See 4718b81419 for earlier context
for where we remove the asan runtimes in armv7/aarch64 builds,
where the files do get built, but they don't work properly yet
(even on UCRT).
This commit is contained in:
Martin Storsjö
2026-03-22 12:33:20 +02:00
parent 13e18154e6
commit abc77c22a8
+32 -13
View File
@@ -82,6 +82,18 @@ else
esac
fi
cat<<EOF > is-ucrt.c
#include <corecrt.h>
#if !defined(_UCRT)
#error not ucrt
#endif
EOF
ANY_ARCH=$(echo $ARCHS | awk '{print $1}')
if $ANY_ARCH-w64-mingw32-gcc$TOOLEXT -E is-ucrt.c > /dev/null 2>&1; then
IS_UCRT=1
fi
rm -f is-ucrt.c
cd llvm-project/compiler-rt
INSTALL_PREFIX="$CLANG_RESOURCE_DIR"
@@ -162,19 +174,26 @@ for arch in $ARCHS; do
cmake --install . --prefix "$INSTALL_PREFIX"
mkdir -p "$PREFIX/$arch-w64-mingw32/bin"
if [ -n "$SANITIZERS" ]; then
case $arch in
aarch64)
# asan doesn't work on aarch64 or armv7; make this clear by omitting
# the installed files altogether.
rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*aarch64*
;;
armv7)
rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*arm*
;;
*)
mv "$INSTALL_PREFIX/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
;;
esac
if [ -z "$IS_UCRT" ]; then
# For msvcrt builds, remove the asan files; asan doesn't work
# properly on top of msvcrt, only on top of UCRT. Make this clear
# by omitting the installed files altogether.
rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*
else
case $arch in
aarch64)
# asan doesn't work on aarch64 or armv7; make this clear by omitting
# the installed files altogether.
rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*aarch64*
;;
armv7)
rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*arm*
;;
*)
mv "$INSTALL_PREFIX/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
;;
esac
fi
fi
cd ..
done