Skip to content

Commit

Permalink
ci: use our own copies of runtime libraries (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
fw-immunant committed Oct 21, 2024
1 parent 4f48e0f commit 2eb0b9a
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,23 @@ jobs:
llvm-project/build/bin
llvm-project/build/lib/clang
key: ${{ runner.os }}-clang
- name: Cache built compiler-rt
id: cache-compiler-rt
- name: Cache built runtime libraries
id: cache-rtlibs
uses: actions/cache@v4
with:
path: |
llvm-project/build-compiler-rt/lib/linux
key: ${{ runner.os }}-compiler-rt
llvm-project/build-rtlibs/compiler-rt/lib/linux
llvm-project/build-rtlibs/lib
key: ${{ runner.os }}-rtlibs
- name: Check out LLVM
if: steps.cache-clang.outputs.cache-hit != 'true' || steps.cache-compiler-rt.outputs.cache-hit != 'true'
if: steps.cache-clang.outputs.cache-hit != 'true' || steps.cache-rtlibs.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: immunant/llvm-project
ref: fw/instrument-llvm-ir
path: ${{ github.workspace }}/llvm-project
- name: Build Clang
if: steps.cache-clang.outputs.cache-hit != 'true' || steps.cache-compiler-rt.outputs.cache-hit != 'true'
if: steps.cache-clang.outputs.cache-hit != 'true' || steps.cache-rtlibs.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/llvm-project
run: |
# first free up space used by unnecessary host tool cache to make room to build clang
Expand All @@ -140,18 +141,22 @@ jobs:
./build.sh
# free up space used by libs; our desired clang binary statically links them
rm -rf build/lib/*.a
- name: Build Compiler-rt
if: steps.cache-compiler-rt.outputs.cache-hit != 'true'
- name: Build runtime libraries
if: steps.cache-rtlibs.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/llvm-project
run: |
./cross-build-compiler-rt.sh
./cross-build-rtlibs.sh
- name: Test ARM build
run: |
LLVM_DIR=`llvm-config-15 --cmakedir`
Clang_DIR=`realpath $LLVM_DIR/../clang`
mkdir build
pushd build
cross_flags="-isystem /usr/aarch64-linux-gnu/include --gcc-toolchain=/usr -march=armv8.5-a+memtag -ffixed-x18"
cross_link_flags="-B$(pwd)/../llvm-project/build-rtlibs/compiler-rt/lib/linux -L`pwd`/../llvm-project/build-rtlibs/lib \
--rtlib=compiler-rt --unwindlib=libunwind"
# TODO: rpath needs addition but this would override it:
# "-Wl,-rpath,$(pwd)/../llvm-project/build-rtlibs/lib"
cross_flags="-isystem /usr/aarch64-linux-gnu/include --gcc-toolchain=/usr -march=armv8.5-a+memtag -ffixed-x18 --rtlib=compiler-rt --stdlib=libc++ --unwindlib=libunwind -Ibuild-rtlibs/include/c++/v1"
export LDFLAGS="-L/usr/aarch64-linux-gnu/lib"
cmake .. \
-DCMAKE_CROSSCOMPILING_EMULATOR=${{ github.workspace }}/qemu/build/qemu-aarch64 \
Expand All @@ -161,7 +166,8 @@ jobs:
-DCMAKE_OBJCOPY=/usr/bin/llvm-objcopy-15 \
-DCMAKE_C_FLAGS="$cross_flags" \
-DCMAKE_CXX_FLAGS="$cross_flags" \
-DCMAKE_EXE_LINKER_FLAGS=-B`pwd`/../llvm-project/build-compiler-rt/lib/linux \
-DCMAKE_EXE_LINKER_FLAGS="$cross_link_flags -lm" \
-DCMAKE_SHARED_LINKER_FLAGS="$cross_link_flags" \
-DClang_DIR=$Clang_DIR \
-DCLANG_EXE=`which clang-15` \
-DLLVM_DIR=$LLVM_DIR \
Expand Down

0 comments on commit 2eb0b9a

Please sign in to comment.