-
Notifications
You must be signed in to change notification settings - Fork 448
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
Disambiguate Windows run-times when using clang to compile. #825
Conversation
Yeah, my impression is it's pretty much always wrong to use gcc for a -msvc target. @ChrisDenton any objections to merging this? |
Yes the current gnu toolchains, unlike llvm, do not aim to be compatible with msvc. |
// Disambiguate mingw and msvc on Windows. Problem is that | ||
// depending on the origin clang can default to a mismatchig | ||
// run-time. | ||
cmd.push_cc_arg(format!("--target={}", target).into()); |
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.
Does this still work if there's a mismatch between the clang target name and rust target name?
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.
To my knowledge, there is no mismatch between Rust and clang. Which shouldn't really come as surprise, both are llvm-based.
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.
Oh! Maybe you refer to aarch64-pc-windows-llvm, or what was it called? Fair enough, I'll double-check...
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.
Oh! Maybe you refer to aarch64-pc-windows-llvm,
It's *-pc-windows-gnullvm
, i.e. not just aarch64, and there is "gnu" in the name. Surprisingly enough clang appears to accept gnullvm and even do arguably right thing. It appears to be due to a pattern matching, because it also accepts gnufoobar, gnu-foobar, and even msvcfoobar and msvc-foobar. And it generates code targeting mingw runtime if there is gnu somewhere in the target name, and vc runtime otherwise.
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.
Yes, clang accepts far more target triples than rustc, which only accepts a finite set (clang, due to compatibility with GCC, does quite a bit of massaging of the value).
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.
To summarize, the answer to the original question is "yes, it still works."
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.
We can presumably check that it continues to work with official targets. My only concern would be third party rustc targets (which can be named anything). But we can either say they aren't supported or require setting the target
to a llvm compatible one.
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.
We can presumably check that it continues to work with official targets.
That's what "yes, it still works" effectively mean. It still works with official targets.
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.
I mean, I'm ok with this if @thomcc is. Though we might want to keep an eye out in case anyone is tripped up by the change.
I'm okay with it too. |
With cross-reference to #811, a case can be made that it would be appropriate to issue "unsupported" warning even for |
This is with reference to #819 (comment). In the comment I'm suggesting to take it as far as rejecting the use of gcc in the msvc compilation, while this PR only issues a warning.