[llvm] [Triple] Ignore the vendor field for MinGW, wrt LTO/IR compatibility (PR #122801)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 00:41:32 PST 2025


================
@@ -2024,6 +2024,10 @@ bool Triple::isLittleEndian() const {
 }
 
 bool Triple::isCompatibleWith(const Triple &Other) const {
+  // On MinGW, C code is usually built with a "w64" vendor, while Rust
+  // often uses a "pc" vendor.
----------------
mstorsjo wrote:

Ah, thanks for pointing it out!

On an LTO/IR level, there's nothing there that would be incompatible. Of course, on functional level, code that doesn't target UWP may or may not work correct if code is linked in that isn't written with a UWP target in mind (but this issue is the same even if not involving LTO).

Also, thanks for pointing out the Rust use of `uwp` for the vendor field here; going that way would help using Clang config files for the UWP targets in llvm-mingw. (Currently we use the environment name `mingw32uwp`, but that gets normalized into the same `windows-gnu` as non-UWP.)

> Not sure if it's even a real triple in LLVM.

The `vendor` field is pretty much freeform and not really used by anything as far as I'm aware. Sure, there are a couple of known ones and an enum for them, but neither `w64` nor `uwp` map to any of the known enum values: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.6/llvm/lib/TargetParser/Triple.cpp#L627-L644

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


More information about the llvm-commits mailing list