[clang] [llvm] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 08:32:16 PDT 2024


mstorsjo wrote:

One reason why I’m not entirely thrilled (not firmly against, but not thrilled - but I’m not sure if there are much better options either) with this direction, is that it becomes messy when cross compiling.

LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is automatically set based on the host OS, e.g. if building on Linux, it defaults to true, while if building on Windows, it defaults to false.

When building Clang separately from the runtimes, this decision comes even more as a surprise; if I first build a Linux Clang, then later build the runtimes for Windows (for a Linux hosted cross toolchain targeting Windows), this might mismatch.

For the change that currently is suggested, this mismatch might be benign and not matter for this particular setup/direction, but if we extend this pattern to skip all sorts of probing and just assume one layout or the other, it will matter.

I guess the solution to that will be that when I build the clang binary first, I need to set LLVM_ENABLE_PER_TARGET_RUNTIME_DIR based on how I’m going to build my runtimes later.

That’s probably acceptable, even though less convenient than now. However, if I instead have a Clang binary from e.g. a Linux distribution, and I want to build Windows runtimes to use with it, I would need a way to query which layout is hardcoded into the binary. There are various options for querying paths from the Clang executable, but it’s not very obvious to figure out which layout it will require, or whether it might support both.

https://github.com/llvm/llvm-project/pull/89775


More information about the cfe-commits mailing list