Skip to content

Commit 242416c

Browse files
committed
add script to build compiler-rt
1 parent 8759803 commit 242416c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cross-build-compiler-rt.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# see https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html
3+
mkdir -p build-compiler-rt
4+
cd build-compiler-rt
5+
cross_flags="--gcc-toolchain=/usr --sysroot=/usr/aarch64-linux-gnu -march=armv8.5-a+memtag -ffixed-x18"
6+
export LDFLAGS="-L/usr/aarch64-linux-gnu/lib"
7+
cmake -GNinja -DLLVM_TARGETS_TO_BUILD="AArch64" \
8+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
9+
-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
10+
ninja
11+
cd lib/linux
12+
# rename CRT files to expected filenames
13+
cp -a clang_rt.crtend-aarch64.o crtendS.o
14+
cp -a clang_rt.crtbegin-aarch64.o crtbeginS.o

0 commit comments

Comments
 (0)