Skip to content

Commit

Permalink
[CodeGen][ARM64EC] Use alias symbol for exporting hybrid_patchable fu…
Browse files Browse the repository at this point in the history
…nctions.

This is not compatible with MSVC, but it allows using dllexport and hybrid_patchable
attributes together.
  • Loading branch information
cjacek committed Jun 3, 2024
1 parent 33589ba commit 4febef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,11 @@ bool AArch64Arm64ECCallLowering::runOnModule(Module &Mod) {
FnsMap[A] = GlobalAlias::create(GlobalValue::LinkOnceODRLinkage,
MangledName.value(), &F);
PatchableFns.insert(A);

if (F.hasDLLExportStorageClass()) {
A->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
F.setDLLStorageClass(GlobalValue::DefaultStorageClass);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4febef2

Please sign in to comment.