Skip to content

Commit 29239a7

Browse files
committed
add script to build compiler-rt
1 parent 8759803 commit 29239a7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cross-build-compiler-rt.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 -isystem /usr/aarch64-linux-gnu/include -march=armv8.5-a+memtag -ffixed-x18"
6+
export LDFLAGS="-L/usr/aarch64-linux-gnu/lib"
7+
cmake -GNinja -DLLVM_TARGETS_TO_BUILD="AArch64" -DLLVM_DEFAULT_TARGET_TRIPLE="aarch64-linux-gnu" \
8+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
9+
-DCMAKE_C_FLAGS="$cross_flags --target=aarch64-linux-gnu" -DCMAKE_CXX_FLAGS="$cross_flags --target=aarch64-linux-gnu" \
10+
-DCMAKE_C_COMPILER="$(pwd)/../build/bin/clang" -DCMAKE_CXX_COMPILER="$(pwd)/../build/bin/clang" \
11+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=true \
12+
-DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_MEMPROF=OFF -DCOMPILER_RT_BUILD_ORC=OFF \
13+
-DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
14+
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE="aarch64-linux-gnu" \
15+
../compiler-rt
16+
ninja
17+
cd lib/linux
18+
# rename CRT files to expected filenames
19+
cp -a clang_rt.crtend-aarch64.o crtendS.o
20+
cp -a clang_rt.crtbegin-aarch64.o crtbeginS.o

0 commit comments

Comments
 (0)