Skip to content

[AArch64] Mangle names of all ARM64EC functions with entry thunks #80996

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

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ bool AArch64Arm64ECCallLowering::processFunction(
// name (emitting the definition) can grab it from the metadata.
//
// FIXME: Handle functions with weak linkage?
if (F.hasExternalLinkage() || F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
if (!F.hasLocalLinkage() || F.hasAddressTaken()) {
if (std::optional<std::string> MangledName =
getArm64ECMangledFunctionName(F.getName().str())) {
F.setMetadata("arm64ec_unmangled_name",
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,8 @@ void AArch64AsmPrinter::emitFunctionEntryLabel() {
TS->emitDirectiveVariantPCS(CurrentFnSym);
}

if (TM.getTargetTriple().isWindowsArm64EC()) {
if (TM.getTargetTriple().isWindowsArm64EC() &&
!MF->getFunction().hasLocalLinkage()) {
// For ARM64EC targets, a function definition's name is mangled differently
// from the normal symbol. We emit the alias from the unmangled symbol to
// mangled symbol name here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

; Validates when local linkage functions get a thunk generated.

; Being called does not cause a thunk to be generated.
; Being called does not cause a thunk to be generated or the symbol name to be mangled.
; CHECK-NOT: "#does_not_have_addr_taken":
; CHECK-NOT: $ientry_thunk$cdecl$v$f;
define internal void @does_not_have_addr_taken(float) nounwind {
ret void
Expand All @@ -12,7 +13,8 @@ define void @calls_does_not_have_addr_taken() nounwind {
ret void
}

; Having an address taken does cause a thunk to be generated.
; Having an address taken does cause a thunk to be generated and the symbol name to be mangled.
; CHECK: "#has_addr_taken":
; CHECK: $ientry_thunk$cdecl$v$i8;
define internal void @has_addr_taken(i64) nounwind {
ret void
Expand Down