From 242416c3be91337f54149c50039fd70954646c99 Mon Sep 17 00:00:00 2001 From: Frances Wingerter Date: Wed, 2 Oct 2024 23:15:24 -0400 Subject: [PATCH] add script to build compiler-rt --- cross-build-compiler-rt.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 cross-build-compiler-rt.sh diff --git a/cross-build-compiler-rt.sh b/cross-build-compiler-rt.sh new file mode 100755 index 000000000000..1f11bc6edb39 --- /dev/null +++ b/cross-build-compiler-rt.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# see https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html +mkdir -p build-compiler-rt +cd build-compiler-rt +cross_flags="--gcc-toolchain=/usr --sysroot=/usr/aarch64-linux-gnu -march=armv8.5-a+memtag -ffixed-x18" +export LDFLAGS="-L/usr/aarch64-linux-gnu/lib" +cmake -GNinja -DLLVM_TARGETS_TO_BUILD="AArch64" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DLLVM_DEFAULT_TARGET_TRIPLE="aarch64-linux-gnu" -DCMAKE_C_FLAGS="$cross_flags --target=aarch64-linux-gnu" -DCMAKE_CXX_FLAGS="$cross_flags --target=aarch64-linux-gnu" -DCMAKE_C_COMPILER="$(pwd)/../build/bin/clang" -DCMAKE_CXX_COMPILER="$(pwd)/../build/bin/clang" -DCMAKE_BUILD_WITH_INSTALL_RPATH=true -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_MEMPROF=OFF -DCOMPILER_RT_BUILD_ORC=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE="aarch64-linux-gnu" ../compiler-rt +ninja +cd lib/linux +# rename CRT files to expected filenames +cp -a clang_rt.crtend-aarch64.o crtendS.o +cp -a clang_rt.crtbegin-aarch64.o crtbeginS.o