On Fri Nov 25 18:10:38 2022 +0000, Martin Storsjö wrote:
Thanks! This led me to this find: https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/clang/lib/Driver/Dr...
if (Args.getLastArgValue(options::OPT_fuse_ld_EQ) .startswith_insensitive("bfd")) TC = std::make_unique<toolchains::CrossWindowsToolChain >( *this, Target, Args); else TC = std::make_unique<toolchains::MSVCToolChain>(*this, Target, Args);
I'm not quite sure what the `CrossWindowsToolChain` is - I think it might be something used for the "windows-itanium" case (which is a third windows target in addition to mingw and msvc - it's a setup kinda inbetween msvc and mingw, used in some proprietary setups). With that in mind, I guess it's better to override `-fuse-ld=lld` so it actually picks the right MSVC toolchain, rather than trying to coerce `CrossWindowsToolChain` to behave as expected.
This is, like the case of `-rtlib` a problem with default parameters that are meant for the default target only, but which end up applying to all cross targets…