Skip to content

Commit 486d72f

Browse files
cjacekmstorsjo
authored andcommitted
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.
1 parent 192334d commit 486d72f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

build-compiler-rt.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ for arch in $ARCHS; do
122122
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \
123123
$SRC_DIR
124124
cmake --build . ${CORES:+-j${CORES}}
125+
126+
# Skip install on arm64ec, we merge archives instead.
127+
if [ "$arch" = "arm64ec" ]; then
128+
cd ..
129+
continue
130+
fi
131+
125132
cmake --install . --prefix "$INSTALL_PREFIX"
126133
mkdir -p "$PREFIX/$arch-w64-mingw32/bin"
127134
if [ -n "$SANITIZERS" ]; then
@@ -142,6 +149,20 @@ for arch in $ARCHS; do
142149
cd ..
143150
done
144151

152+
# Clang expects the aarch64 compiler-rt name on ARM64EC. While this could be adjusted
153+
# in Clang, the current approach mirrors MSVC, where the core CRT is provided as
154+
# archives containing both EC and native support. Ideally, the LLVM build system would
155+
# handle this automatically, but for now we can merge it here.
156+
for arch in $ARCHS; do
157+
if [ "$arch" = "arm64ec" ]; then
158+
rm -f "$INSTALL_PREFIX/lib/windows/libclang_rt.builtins-aarch64.a" \
159+
"$INSTALL_PREFIX/lib/windows/libclang_rt.builtins-arm64ec.a"
160+
"$PREFIX/bin/llvm-lib" -machine:arm64ec "-out:$INSTALL_PREFIX/lib/windows/libclang_rt.builtins-aarch64.a" \
161+
build-aarch64/lib/windows/libclang_rt.builtins-aarch64.a \
162+
build-arm64ec/lib/windows/libclang_rt.builtins-arm64ec.a
163+
fi
164+
done
165+
145166
if [ "$INSTALL_PREFIX" != "$CLANG_RESOURCE_DIR" ]; then
146167
# symlink to system headers - skip copy
147168
rm -rf "$INSTALL_PREFIX/include"

0 commit comments

Comments
 (0)