Runtime-rt library build for RISCV

I used the command below as a command to build with llvm and compiler-rt.

cmake -DLLVM_ENABLE_PROJECTS=“clang;lld;” -DLLVM_TARGETS_TO_BUILD=“X86;RISCV;” -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES=compiler-rt -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/llvm-pdev …/llvm

However, the build result files seem to be created only for x86.

So I tried to build only compiler-rt separately with the command below.

cmake …/compiler-rt -DLLVM_CONFIG_PATH=/user/local/llvm-pdev/bin/llvm-config

This also seemed to only generate x86 target libraries.

Is therer any way to build the compiler-rt library for RISCV?

Thank you…

A quick glance at llvm/runtimes/CMakeLists.txt suggests you need to set LLVM_RUNTIME_TARGETS and LLVM_BUILTIN_TARGETS CMake variables to include riscv. I’ve not confirmed this however.

I suspect @petrhosek probably knows as he’s done a substantial amount of work in that CMake file.

Thank you. delcypher …
I tried to set LVM_RUNTIME_TARGETS and LLVM_BUILTIN_TARGETS like below .

cmake …/compiler-rt/ -DLLVM_CONFIG_PATH=/usr/local/llvm-pdev/bin/llvm-config -DLLVM_RUNTIME_TARGETS=“RISCV;” -DLLVM_BUILTIN_TARGETS=“RISCV;”

But during cmake configuration, I found this cmake message.

– Compiler-RT supported architectures: x86_64
– Builtin supported architectures: x86_64

In this attempt, it seemed to be created only for x86 too,
so I searched further and found the compiler-rt crosscompiler (ARM target) explanation page.
https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html

If you know about compiler-rt cross compile for RISCV, please let me know how to cross-compile for RISCV.

Thank you

Hi @sharav, did you succeed to cross compile compiler-rt for RISCV?
Any response is appreciated, thanks!