Skip to content

Commit

Permalink
build other runtime components to avoid any system code in our runtim…
Browse files Browse the repository at this point in the history
…e dependencies
  • Loading branch information
fw-immunant committed Oct 18, 2024
1 parent 29239a7 commit dd900ef
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cross-build-compiler-rt.sh → cross-build-libunwind.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#!/bin/sh
# build compiler-rt, libcxx, libcxxabi, and libunwind with our patched clang
# see https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html
mkdir -p build-compiler-rt
cd build-compiler-rt
cross_flags="--gcc-toolchain=/usr -isystem /usr/aarch64-linux-gnu/include -march=armv8.5-a+memtag -ffixed-x18"
mkdir -p build-rtlibs
cd build-rtlibs
cross_flags="--sysroot=/usr/aarch64-linux-gnu/ --gcc-install-dir=/usr/lib/gcc/aarch64-linux-gnu/14.1.0 --rtlib=compiler-rt -march=armv8+memtag -ffixed-x18"
export LDFLAGS="-L/usr/aarch64-linux-gnu/lib"
cmake -GNinja -DLLVM_TARGETS_TO_BUILD="AArch64" -DLLVM_DEFAULT_TARGET_TRIPLE="aarch64-linux-gnu" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-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
-DCMAKE_EXE_LINKER_FLAGS='--rtlib=compiler-rt' \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DLIBCXX_USE_COMPILER_RT=YES \
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;compiler-rt;libunwind' \
../runtimes
ninja
cd lib/linux
cd compiler-rt/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

0 comments on commit dd900ef

Please sign in to comment.