The LLVM build system has a mechanism designed for building runtime libraries targeting the platform that compiler's (be it Clang, Flang, Rust, etc. ) output will run on. For instance, since Clang intrinsically is a cross-compiler, such runtime libraries need to be compiled for each targeted platform. The mechanism originates from splitting target-side runtimes from host-side subprojects such as Clang, Polly, BOLT.
In this tutorial we will create a new runtime to exemplify the working of the often misunderstood LLVM_ENABLE_RUNTIMES system. Few contributors will ever feel the need to create a new runtime from scratch, but understanding it helps identifying and fixing build issues for configuration that no CI is actively testing. The talk will go into details of how multi-stage bootstrapping, cross-compilation, multilib, GPU-offloading, multi-compiler support, and inter-dependent runtimes are designed to work. We also explore configuration options and which corners could still be improved.