Skip to content

Commit ed4ef4d

Browse files
cjacektru
authored andcommitted
[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.
1 parent 0e6f64c commit ed4ef4d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,11 @@ bool AArch64Arm64ECCallLowering::runOnModule(Module &Mod) {
833833
"EXP+" + MangledName.value())));
834834
A->setAliasee(&F);
835835

836+
if (F.hasDLLExportStorageClass()) {
837+
A->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
838+
F.setDLLStorageClass(GlobalValue::DefaultStorageClass);
839+
}
840+
836841
FnsMap[A] = GlobalAlias::create(GlobalValue::LinkOnceODRLinkage,
837842
MangledName.value(), &F);
838843
PatchableFns.insert(A);

llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ define dso_local void @caller() nounwind {
238238
; CHECK-NEXT: .symidx exp
239239
; CHECK-NEXT: .word 0
240240
; CHECK-NEXT: .section .drectve,"yni"
241-
; CHECK-NEXT: .ascii " /EXPORT:\"#exp$hp_target,EXPORTAS,exp$hp_target\""
241+
; CHECK-NEXT: .ascii " /EXPORT:exp"
242242

243243
; CHECK-NEXT: .def func;
244244
; CHECK-NEXT: .scl 2;

0 commit comments

Comments
 (0)