Compiler-rt binary distribution

Since vanilla LLVM can be used as a cross-compiler out of the box, is there a reason there is no binary distro of compiler-rt (at least the builtins) including all architectures supported by LLVM?

The issue is you need a sysroot—libc in particular—to build compiler-rt; even some of the builtins include libc headers.

In our (Fuchsia) Clang toolchain build, we use a prepackaged sysroot which we use to build compiler-rt and other runtimes for a number common targets, but it still doesn’t cover all architectures and platforms supported by LLVM, and it requires the custom tooling we developed for packaging the sysroot.

This might become easier once LLVM libc provides all functions needed by compiler-rt, which hopefully will be soon.

1 Like

Thanks for the reply! Sorry, I should’ve been a bit more specific in my post. I am talking about bare-metal targets, no libc involved at all. It’s only the host machine that runs Linux, cross-compiling for Arm and RISC-V bare metal MCUs.

In a baremetal envionrment, you typically don’t need a libc to build builtins in my experience, but there’s another challenge which is a potentially large number of potential targets requiring the use of multilib. This area is under active development, see [RFC] Multilib, and there are still some areas for improvements such as the build system support.

If you’re interested in the baremetal target support, I’d recommend coming to the LLVM Embedded Toolchains Working Group sync up where we discuss these topics.

Thanks for the pointers! We may actually be able to help with the build system support. We’ll take a look and, once up to speed, join the sync up as well.