From 486d72ff9ea9a7b8ef40397162ffbf307b87992c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 29 Apr 2025 20:50:15 +0200 Subject: [PATCH] Merge aarch64 and arm64ec compiler-rt libs Clang expects the aarch64 compiler-rt name on ARM64EC. While this could be adjusted in Clang, the current approach mirrors MSVC, where the core CRT is provided as archives containing both EC and native support. Ideally, the LLVM build system would handle this automatically, but for now we can merge it here. --- build-compiler-rt.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build-compiler-rt.sh b/build-compiler-rt.sh index 2680e16..d7f3e3d 100755 --- a/build-compiler-rt.sh +++ b/build-compiler-rt.sh @@ -122,6 +122,13 @@ for arch in $ARCHS; do -DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \ $SRC_DIR cmake --build . ${CORES:+-j${CORES}} + + # Skip install on arm64ec, we merge archives instead. + if [ "$arch" = "arm64ec" ]; then + cd .. + continue + fi + cmake --install . --prefix "$INSTALL_PREFIX" mkdir -p "$PREFIX/$arch-w64-mingw32/bin" if [ -n "$SANITIZERS" ]; then @@ -142,6 +149,20 @@ for arch in $ARCHS; do cd .. done +# Clang expects the aarch64 compiler-rt name on ARM64EC. While this could be adjusted +# in Clang, the current approach mirrors MSVC, where the core CRT is provided as +# archives containing both EC and native support. Ideally, the LLVM build system would +# handle this automatically, but for now we can merge it here. +for arch in $ARCHS; do + if [ "$arch" = "arm64ec" ]; then + rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.builtins-aarch64.a" \ + "$INSTALL_PREFIX/lib/windows/libclang_rt.builtins-arm64ec.a" + "$PREFIX/bin/llvm-lib" -machine:arm64ec "-out:$INSTALL_PREFIX/lib/windows/libclang_rt.builtins-aarch64.a" \ + build-aarch64/lib/windows/libclang_rt.builtins-aarch64.a \ + build-arm64ec/lib/windows/libclang_rt.builtins-arm64ec.a + fi +done + if [ "$INSTALL_PREFIX" != "$CLANG_RESOURCE_DIR" ]; then # symlink to system headers - skip copy rm -rf "$INSTALL_PREFIX/include"