-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang][AArch64] Define __USER_LABEL_PREFIX__ to # for ARM64EC #78913
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
This is required so that the linker knows that any symbols defined in assembly code are ARM64EC rather than X86_64.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-backend-aarch64 Author: Billy Laws (bylaws) ChangesThis is required so that the linker knows that any symbols defined in assembly code are ARM64EC rather than X86_64. CC: @cjacek Full diff: https://github.com/llvm/llvm-project/pull/78913.diff 1 Files Affected:
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index d47181bfca4fc86..4f57c30279a91fb 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -1462,10 +1462,12 @@ WindowsARM64TargetInfo::WindowsARM64TargetInfo(const llvm::Triple &Triple,
}
void WindowsARM64TargetInfo::setDataLayout() {
- resetDataLayout(Triple.isOSBinFormatMachO()
- ? "e-m:o-i64:64-i128:128-n32:64-S128"
- : "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128",
- Triple.isOSBinFormatMachO() ? "_" : "");
+ if (Triple.isOSBinFormatMachO()) {
+ resetDataLayout("e-m:o-i64:64-i128:128-n32:64-S128", "_");
+ } else {
+ resetDataLayout("e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128",
+ Triple.isWindowsArm64EC() ? "#" : "");
+ }
}
TargetInfo::BuiltinVaListKind
|
: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128", | ||
Triple.isOSBinFormatMachO() ? "_" : ""); | ||
if (Triple.isOSBinFormatMachO()) { | ||
resetDataLayout("e-m:o-i64:64-i128:128-n32:64-S128", "_"); |
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.
Weird, I wonder when Windows+AArch64+Mach-O is ever used... maybe @compnerd knows?
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.
AFAIK Windows+MachO is used in some cases for JIT scenarios, because the runtime linking support in the JIT is much more complete for MachO than it is for PE/COFF.
Note that this prefix is expected on ARM64EC only for C function symbols. C++ symbols use a different mangling and data symbols are not decorated at all. This is different from other cases when |
I can sort of see how a define could be useful, but this doesn't match any existing usage of USER_LABEL_PREFIX given the relevant rules. I think reusing the name is more likely to cause confusion, rather than help anyone. |
@efriedma-quic Fair enough, I found this cleaned up things on the compiler-rt side but even then it still needed changes to handle concatenating a #, and I'd imagine that to be the same for any other existing user. It would still be nice to have something equivalent to A64NAME for user code but that probably better fits in mingw. |
This is required so that the linker knows that any symbols defined in assembly code are ARM64EC rather than X86_64.
CC: @cjacek