build compiler-rt

This commit is contained in:
Lily Tsuru 2023-07-17 01:47:51 -04:00
parent 5936c684b9
commit 7f82d7ce97
2 changed files with 23 additions and 12 deletions

View File

@ -18,7 +18,7 @@ LLVM is built using a podman container (see Containerfile). The steps for replic
```
mkdir llvm_build
podman build -t llvm-build -f Containerfile.llvm
podman run --rm --cpus 16 -m 12G --mount type=bind,source=$PWD/llvm_build,destination=/build/llvm-build localhost/llvm-build
podman run --rm --cpus 24 -m 32G --mount type=bind,source=$PWD/llvm_build,destination=/build/llvm-build localhost/llvm-build
```

View File

@ -3,6 +3,9 @@
# This script builds the llvm components used by the LCPU addon.
# This is run in a debian container to try and keep everything ABI stable.
# Act like make, sort of, and fail the whole script if some part fails
set -e
JOBS=$(nproc)
# Configure LLVM. THis is a mouthful, but it's only a mouthful because we specialize things we don't
@ -15,15 +18,23 @@ cmake -Wno-dev -GNinja -S /build/llvm/llvm -B /build/llvm-build/build \
-DLLVM_TARGETS_TO_BUILD="RISCV" \
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-none-gnu"
ninja -C /build/llvm-bin/build -j $JOBS
ninja -C /build/llvm-build/build -j $JOBS
ninja -C /build/llvm-build install
# TODO: Build compiler-rt with our toolchain.
# This currently does not work as a single build (why would it), we instead
# need to stage things (the first building clang + lld), and this being the last stage currently
#cmake -Wno-dev -GNinja -S llvm_src/compiler-rt \
# -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
# -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
# -DCOMPILER_RT_BUILD_PROFILE=OFF \
# -DCOMPILER_RT_BUILD_MEMPROF=OFF \
# -DCOMPILER_RT_BUILD_ORC=OFF \
# -DCOMPILER_RT_BAREMETAL_BUILD=ON
# Build compiler-rt with our toolchain.
cmake -Wno-dev -GNinja -S /build/llvm/compiler-rt -B /build/llvm-build/build-compiler-rt \
-DCMAKE_C_COMPILER="/build/llvm-build/install/bin/clang" \
-DCMAKE_CXX_COMPILER="/build/llvm-build/install/bin/clang++" \
-DCMAKE_C_FLAGS="-target riscv32-none-gnu" \
-DCMAKE_CXX_FLAGS="-target riscv32-none-gnu" \
-DCMAKE_INSTALL_PREFIX="/build/llvm-build/install/lib/clang/${LLVM_VERSION}" \
-DLLVM_CONFIG_PATH="/build/llvm-build/install/bin/llvm-config" \
-DCOMPILER_RT_BAREMETAL_BUILD=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_BUILD_PROFILE=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
-DCOMPILER_RT_BUILD_ORC=OFF
ninja -C /build/llvm-build/build-compiler-rt -j $JOBS
ninja -C /build/llvm-build/build-compiler-rt install