When compiling compiler-rt standalone (instead of as part of the
overall LLVM build) I have in the past used the following for the
rv32i build:
FLAGS="--target=riscv32-unknown-elf -march=rv32i -mabi=ilp32
--gcc-toolchain=$GCC_TOOLCHAIN --sysroot=$SYSROOT"
TEST_FLAGS="$FLAGS"
cmake $LLVM/compiler-rt \
-G "Ninja" \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_BUILD_PROFILE=OFF \
-DCMAKE_C_COMPILER=$LLVM_BUILD/bin/clang \
-DCMAKE_AR=$LLVM_BUILD/bin/llvm-ar \
-DCMAKE_NM=$LLVM_BUILD/bin/llvm-nm \
-DCMAKE_RANLIB=$LLVM_BUILD/bin/llvm-ranlib \
-DCMAKE_C_COMPILER_TARGET="riscv32-unknown-elf" \
-DCMAKE_ASM_COMPILER_TARGET="riscv32-unknown-elf" \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
-DCMAKE_C_FLAGS="$FLAGS" \
-DCMAKE_ASM_FLAGS="$FLAGS" \
-DCOMPILER_RT_OS_DIR="baremetal" \
-DCOMPILER_RT_BAREMETAL_BUILD=ON \
-DCOMPILER_RT_INCLUDE_TESTS=ON \
-DCOMPILER_RT_EMULATOR="qemu-riscv32 -L $SYSROOT" \
-DCOMPILER_RT_TEST_COMPILER="$LLVM_BUILD/bin/clang" \
-DCOMPILER_RT_TEST_COMPILER_CFLAGS="$TEST_FLAGS" \
-DLLVM_CONFIG_PATH=$LLVM_CONFIG
For compiling Compiler-RT as part of an integrated LLVM build, IIRC
you want to add it to the runtimes list (LLVM_ENABLE_RUNTIMES) and not
as a subproject. You can use cmake cache files to configure the
runtimes, and LLVM/compiler-rt has a weird setup for parsing cmake
settings of the form RUNTIMES_${target}_*. Check the existing cmake
cache files.
I hope that helps.
Best,
Luís
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev