-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Triple] Ignore the vendor field for MinGW, wrt LTO/IR compatibility #122801
Conversation
For MinGW environments, the regular C/C++ toolchains usually use "w64" for the vendor field in triples, while Rust toolchains usually use "pc" in the vendor field. The differences in the vendor field have no bearing on whether the IR is compatible on this platform. (This probably goes for most other OSes as well, but limiting the scope of the change to the specific case.) Add a unit test for the isCompatibleWith, including some existing test cases found in existing tests.
This fixes an issue brought up in mstorsjo/llvm-mingw#469 (comment); CC @Andarwinux @mati865. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with question addressed
// On MinGW, C code is usually built with a "w64" vendor, while Rust | ||
// often uses a "pc" vendor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is uwp-windows-gnu
compatible the other two mentioned variants? I think so but wanted to double-check.
Not sure if it's even a real triple in LLVM. Rust has it, but the GNU env is unmaintained: https://doc.rust-lang.org/rustc/platform-support.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't sure if there are any differences other than headers and libraries. We're good then.
…lvm#122801) For MinGW environments, the regular C/C++ toolchains usually use "w64" for the vendor field in triples, while Rust toolchains usually use "pc" in the vendor field. The differences in the vendor field have no bearing on whether the IR is compatible on this platform. (This probably goes for most other OSes as well, but limiting the scope of the change to the specific case.) Add a unit test for the isCompatibleWith, including some existing test cases found in existing tests.
…lvm#122801) For MinGW environments, the regular C/C++ toolchains usually use "w64" for the vendor field in triples, while Rust toolchains usually use "pc" in the vendor field. The differences in the vendor field have no bearing on whether the IR is compatible on this platform. (This probably goes for most other OSes as well, but limiting the scope of the change to the specific case.) Add a unit test for the isCompatibleWith, including some existing test cases found in existing tests.
For MinGW environments, the regular C/C++ toolchains usually use "w64" for the vendor field in triples, while Rust toolchains usually use "pc" in the vendor field.
The differences in the vendor field have no bearing on whether the IR is compatible on this platform. (This probably goes for most other OSes as well, but limiting the scope of the change to the specific case.)
Add a unit test for the isCompatibleWith, including some existing test cases found in existing tests.