-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang] UEFI ABI fixes for X86_64 #124992
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5193,12 +5193,12 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC, | |
| CC = CC_X86RegCall; | ||
| break; | ||
| case ParsedAttr::AT_MSABI: | ||
| CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_C : | ||
| CC_Win64; | ||
| CC = Context.getTargetInfo().getTriple().isOSWindowsOrUEFI() ? CC_C | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This really highlights how
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure your comment makes sense in the context of the I think in general this will only matter on Win / non-Win x64 platforms where we have divergence between the Win/Posix worlds, while the are aligned in the ARM world. |
||
| : CC_Win64; | ||
| break; | ||
| case ParsedAttr::AT_SysVABI: | ||
| CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_X86_64SysV : | ||
| CC_C; | ||
| CC = Context.getTargetInfo().getTriple().isOSWindowsOrUEFI() ? CC_X86_64SysV | ||
| : CC_C; | ||
| break; | ||
| case ParsedAttr::AT_Pcs: { | ||
| StringRef StrRef; | ||
|
|
||
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.
As we discussed offline, I'd really rather see all sites like this use a predicate that's specific to what matters to the call site in precise terms. This predicate is really an answer to the question rather than the question that should be asked. It presumes the answer is "Windows or UEFI targets", when the question it should be asking is something more like, "What C++ ABI name mangling regime is in use by this target?"
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 make things more complicated, consider mingw. I am totally unfamiliar to UEFI, but it seems like folks want it to inherit lots of MSVC ABI features: the mangling scheme, the vftable ABI rules, the struct layout, etc. These rules are usually conditional on
isWindowsMSVCEnvironment(), so you'd need to audit those conditions.While explicit triple checks are convenient and necessary in many cases, we generally try to abstract these details with the various CXXABI interfaces, and if you can find a way to do that, it may help with readability.