Add ARM64X support
Extend the aarch64-w64-mingw32 prefix to provide ARM64EC libraries alongside standard AArch64 libraries, replacing the separate arm64ec-w64-mingw32 prefix. This aligns with how MSVC distributes ARM64EC libraries and enables the linker to process both targets simultaneously into a single hybrid binary. This extensively utilizes LLVM's -marm64x option, compiling both targets in a single compiler invocation to produce hybrid object files (unlike MSVC tools, which require separate compilation passes).
This commit is contained in:
1 parent
5e3f73a650
commit
64effa9a71
10 files changed
+127
-33
No files matched your search
+22
-22
@@ -134,7 +134,26 @@ if [ -n "$NATIVE" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ARM64X_FLAGS=""
|
||||
if [ -z "$SANITIZERS" ]; then
|
||||
for arch in $ARCHS; do
|
||||
case $arch in
|
||||
arm64ec) ARM64X_FLAGS="-marm64x" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
for arch in $ARCHS; do
|
||||
FLAGS=""
|
||||
case $arch in
|
||||
aarch64)
|
||||
FLAGS="$ARM64X_FLAGS"
|
||||
;;
|
||||
arm64ec)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -z "$CLEAN" ] || rm -rf build-$arch$BUILD_SUFFIX
|
||||
mkdir -p build-$arch$BUILD_SUFFIX
|
||||
cd build-$arch$BUILD_SUFFIX
|
||||
@@ -160,17 +179,12 @@ for arch in $ARCHS; do
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
|
||||
-DSANITIZER_CXX_ABI=libc++ \
|
||||
-DCMAKE_C_FLAGS_INIT="$CFGUARD_CFLAGS" \
|
||||
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \
|
||||
-DCMAKE_C_FLAGS_INIT="$CFGUARD_CFLAGS $FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS $FLAGS" \
|
||||
-DCMAKE_ASM_FLAGS_INIT="$FLAGS" \
|
||||
$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
|
||||
@@ -198,20 +212,6 @@ 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"
|
||||
|
||||
Reference in new issue
Block a user