Skip to content

Commit c92f6af

Browse files
authored
Merge pull request #68748 from kubamracek/embedded-arm64e-deinit
[embedded] Fix incorrectly ptrauth signed destructor in vtables
2 parents 125343d + a454d9a commit c92f6af

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/IRGen/GenMeta.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3959,10 +3959,18 @@ namespace {
39593959

39603960
void addDestructorFunction() {
39613961
if (IGM.Context.LangOpts.hasFeature(Feature::Embedded)) {
3962-
auto dtorRef = SILDeclRef(Target->getDestructor(), SILDeclRef::Kind::Deallocator);
3963-
addReifiedVTableEntry(dtorRef);
3962+
auto dtorRef =
3963+
SILDeclRef(Target->getDestructor(), SILDeclRef::Kind::Deallocator);
3964+
auto entry = VTable->getEntry(IGM.getSILModule(), dtorRef);
3965+
if (llvm::Constant *ptr = IGM.getAddrOfSILFunction(
3966+
entry->getImplementation(), NotForDefinition)) {
3967+
B.addSignedPointer(ptr, IGM.getOptions().PointerAuth.HeapDestructors,
3968+
PointerAuthEntity::Special::HeapDestructor);
3969+
} else {
3970+
B.addNullPointer(IGM.FunctionPtrTy);
3971+
}
39643972
return;
3965-
}
3973+
}
39663974

39673975
if (asImpl().getFieldLayout().hasObjCImplementation())
39683976
return;

0 commit comments

Comments
 (0)