Skip to content

Commit dc58f78

Browse files
authored
[ORC-RT] Fix ptrauth signing for dlsym return value (#75972)
dlsym signs text symbols as functions rather than data in dyld, so match that for orc runtime dlsym. This fixes run_program on arm64e.
1 parent 85525f8 commit dc58f78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler-rt/lib/orc/macho_platform.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,10 @@ void *MachOPlatformRuntimeState::dlsym(void *DSOHandle, const char *Symbol) {
825825
return nullptr;
826826
}
827827

828+
// Sign callable symbols as functions, to match dyld.
829+
if ((Result.second & MachOExecutorSymbolFlags::Callable) ==
830+
MachOExecutorSymbolFlags::Callable)
831+
return reinterpret_cast<void *>(Result.first.toPtr<void(void)>());
828832
return Result.first.toPtr<void *>();
829833
}
830834

0 commit comments

Comments
 (0)