<div dir="ltr"><div>My overall goal is locally building [1] an LLVM toolchain which compiles a mixture of C and supporting assembler for bare RISC-V development environments (no OS). Library support is required for some language features on some RISC-V targets, e.g. integer division when the "M" extension isn't present. <br><div><br></div><div>From the details on <a href="https://compiler-rt.llvm.org/">https://compiler-rt.llvm.org/</a> I expected that something like this on release/12.x would build the support library for RISC-V:<br></div><div><br></div><div>cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release  -DLLVM_ENABLE_PROJECTS='clang;lld;compiler-rt' -DCMAKE_INSTALL_PREFIX=~/bin/s4e -DLLVM_TARGETS_TO_BUILD='RISCV'</div><div>ninja</div><div>ninja install<br></div><div><br></div><div>however
 although that yields the RISCV compiler target libraries 
(libLLVMRISCV*.a) it doesn't install any obvious RISCV runtime libraries
 (only x86 ones) and linking a test program with integer division fails:</div><div><br></div><div>clang  testdiv.c --target=riscv32 -march=rv32i<br>ld.lld: error: unable to find library -lc<br>ld.lld: error: unable to find library -lm<br>ld.lld: error: unable to find library -lclang_rt.builtins-riscv32</div><div><br></div><div>(using LLVM release/12.x on x86_64 release/12.x; also tried building all targets and also copying the cmake line from a build triggered by Phabricator for a RISC-V-related change to compiler-rt with the hope that some of the additional defines would prove the solution)</div><div><br></div><div>Thanks in advance for whatever advice you can provide for building the support libraries for RISC-V.</div><div><br></div><div>Tom Goodfellow<br></div></div><div><br></div><div><br></div><div>[1] in the very short-term obtaining working ones from another build would suffice, however I'll be needing to modify them soon anyway.<br></div></div>