-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Triple: Fix handling of macos with unexpected target arches #75469
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
Conversation
Some tools with a specified target arch, but no full triple default to the host triple. On macos hosts, this would then force using macho on targets that didn't expect it, resulting in assertions. We should also probably emit explicit errors if the object format is specified on targets which don't handle it.
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 think this is the correct change, but I'm sure Apple has some out-of-tree code that will likely be impacted.
cc: @lhames, @dsandersllvm, @rudkx. Apologies I don't know Aditya, or Charu's GitHub accounts and the autocomplete is failing me.
llvm/lib/TargetParser/Triple.cpp
Outdated
|
||
if (T.isOSDarwin()) |
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.
nit: should we combine this with the two if's above and make it a switch on the OS (Windows, UEFI and Darwin are all OS bits)?
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.
It kind of works but isOSDarwin covers a few too many things:
return isMacOSX() || isiOS() || isWatchOS() || isDriverKit();
bool isiOS() const {
return getOS() == Triple::IOS || isTvOS();
}
@MaskRay FYI (since you did a bunch of march -> mtriple changes that were necessary before this). |
Thanks for CCing me!
I know that this serves as a change detector about the current behavior and not an endorsement of whether this makes sense. However, ELF does not make more sense here. If we want to unsupport some unexpected target triples, I feel that the change should be made at an upper level, or change the return value to If the issue is |
Created #75982 to change AMDGPU tests to use |
Some tools with a specified target arch, but no full triple default to the host triple. On macos hosts, this would then force using macho on targets that didn't expect it, resulting in assertions.
We should also probably emit explicit errors if the object format is specified on targets which don't handle it.