[llvm] [CodeGen][ARM64EC] Use alias symbol for exporting hybrid_patchable functions. (PR #100872)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 06:14:27 PDT 2024
https://github.com/cjacek created https://github.com/llvm/llvm-project/pull/100872
Exporting $hp_target symbol doesn't make sense, use the unmangled alias instead. This is not compatible with MSVC, but it makes using dllexport together with hybrid_patchable attribute possible.
This provides a possible fix for #93910.
>From 84188e792d8189bbbf69362c8391370591917bc7 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Sun, 2 Jun 2024 16:41:37 +0200
Subject: [PATCH] [CodeGen][ARM64EC] Use alias symbol for exporting
hybrid_patchable functions.
Exporting $hp_target symbol doesn't make sense, use the unmangled alias instead.
This is not compatible with MSVC, but it makes using dllexport together with
hybrid_patchable attribute possible.
---
llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp | 5 +++++
llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
index 310b152ef9817..415edb189e60c 100644
--- a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
@@ -833,6 +833,11 @@ bool AArch64Arm64ECCallLowering::runOnModule(Module &Mod) {
"EXP+" + MangledName.value())));
A->setAliasee(&F);
+ if (F.hasDLLExportStorageClass()) {
+ A->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
+ F.setDLLStorageClass(GlobalValue::DefaultStorageClass);
+ }
+
FnsMap[A] = GlobalAlias::create(GlobalValue::LinkOnceODRLinkage,
MangledName.value(), &F);
PatchableFns.insert(A);
diff --git a/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll b/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll
index e5387d40b9c64..64fb5b36b2c62 100644
--- a/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll
+++ b/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll
@@ -238,7 +238,7 @@ define dso_local void @caller() nounwind {
; CHECK-NEXT: .symidx exp
; CHECK-NEXT: .word 0
; CHECK-NEXT: .section .drectve,"yni"
-; CHECK-NEXT: .ascii " /EXPORT:\"#exp$hp_target,EXPORTAS,exp$hp_target\""
+; CHECK-NEXT: .ascii " /EXPORT:exp"
; CHECK-NEXT: .def func;
; CHECK-NEXT: .scl 2;
More information about the llvm-commits
mailing list