Skip to content

Commit 4718b81

Browse files
committed
build-compiler-rt: Build all runtimes for aarch64 and armv7 too
Since 0c391133c9201ef29273554a1505ef855ce17668 in llvm-project (LLVM 17), the sanitizers can be built for aarch64, and since 5ea9dd8c7076270695a1d90b9c73718e7d95e0bf (backported to LLVM 19.1.0 RC 4), they can be built for armv7 too. While they can be built, address sanitizer doesn't work for the non-x86 architecture, so omit those files from the install, to make it clear that they aren't expected to work. Thus, in practice, this builds the ubsan and profile runtimes for aarch64 and armv7.
1 parent b6b58d9 commit 4718b81

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ normal GCC/binutils based MinGW.
119119
variables.
120120
- The runtime libraries libunwind, libcxxabi and libcxx also assume that the
121121
target is Windows 7 or newer.
122-
- The sanitizers are only supported on x86.
122+
- Address sanitizer is only supported on x86.
123123
- LLD doesn't support linker script (in the COFF part of LLD). Linker script can be used for
124124
reprogramming how the linker lays out the output, but is in most cases
125125
in MinGW setups only used for passing lists of object files to link.

build-compiler-rt.sh

+13-19
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,6 @@ fi
9393

9494

9595
for arch in $ARCHS; do
96-
if [ -n "$SANITIZERS" ]; then
97-
case $arch in
98-
i686|x86_64)
99-
# Sanitizers on windows only support x86.
100-
;;
101-
*)
102-
continue
103-
;;
104-
esac
105-
fi
106-
10796
[ -z "$CLEAN" ] || rm -rf build-$arch$BUILD_SUFFIX
10897
mkdir -p build-$arch$BUILD_SUFFIX
10998
cd build-$arch$BUILD_SUFFIX
@@ -136,19 +125,24 @@ for arch in $ARCHS; do
136125
cmake --install . --prefix "$INSTALL_PREFIX"
137126
mkdir -p "$PREFIX/$arch-w64-mingw32/bin"
138127
if [ -n "$SANITIZERS" ]; then
139-
mv "$INSTALL_PREFIX/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
128+
case $arch in
129+
aarch64)
130+
# asan doesn't work on aarch64 or armv7; make this clear by omitting
131+
# the installed files altogether.
132+
rm "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*aarch64*
133+
;;
134+
armv7)
135+
rm "$INSTALL_PREFIX/lib/windows/libclang_rt.asan"*arm*
136+
;;
137+
*)
138+
mv "$INSTALL_PREFIX/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
139+
;;
140+
esac
140141
fi
141-
INSTALLED=1
142142
cd ..
143143
done
144144

145145
if [ "$INSTALL_PREFIX" != "$CLANG_RESOURCE_DIR" ]; then
146-
if [ -z "$INSTALLED" ]; then
147-
# Don't try to move the installed files in place, if nothing was
148-
# installed (e.g. if building with --build-sanitizers but not for x86).
149-
exit 0
150-
fi
151-
152146
# symlink to system headers - skip copy
153147
rm -rf "$INSTALL_PREFIX/include"
154148

0 commit comments

Comments
 (0)