I’m trying to figure out whether it’s possible for rustc to use different LLVM per target. In my config.toml, I’ve set up different llvm-config paths for riscv64gc-unknown-linux-gnu and x86_64-unknown-linux-gnu like this:
However, after runnig ./x build, it seems that only the LLVM associated with the host target is actually being used, even when building for the other target. I'm not sure if this is the intended behavior or if I’ve misconfigured something.
Each rustc executable can only link against a single LLVM at a time. The llvm-config in the target section is for when you are compiling multiple rustc executables to run on different host platforms.
OK, thank you, I understand now!
I have one more question: If I want to build a cross-compiler targeting RISCV on an X86 host, should I bind an LLVM that supports both X86 and RISCV? My understanding is that although the final rustc only needs the RISCV backend, the bootstrap process still requires the X86 backend for the stage 1 rustc to compile the stage 2 rustc.
You almost always want rustc to also support compiling for the host. Cargo will compile build scripts and proc macros for the host, so if you use any crate that uses either, rustc must support compiling for the host too.