This is an archive of the discontinued LLVM Phabricator instance.

[JITLink] Add missing vtable anchors
AbandonedPublic

Authored by sgraenitz on May 31 2023, 6:29 AM.

Details

Reviewers
lhames
Summary

This patch fixes the following missing symbols when linking JITLink in a shared library:

$ llvm-objdump -t libMyShared.so | grep _ZTVN4llvm7jitlink
0000000000000000         *UND*  0000000000000000 _ZTVN4llvm7jitlink25InProcessEHFrameRegistrarE
0000000000000000         *UND*  0000000000000000 _ZTVN4llvm7jitlink16EHFrameRegistrarE
0000000000000000         *UND*  0000000000000000 _ZTVN4llvm7jitlink14JITLinkContextE
0000000000000000         *UND*  0000000000000000 _ZTVN4llvm7jitlink22InProcessMemoryManagerE
0000000000000000         *UND*  0000000000000000 _ZTVN4llvm7jitlink20JITLinkMemoryManagerE

These symbols exist in the static lib, e.g.:

$ llvm-objdump -t lib/libLLVMJITLink.a | grep _ZTVN4llvm7jitlink25InProcessEHFrameRegistrarE
0000000000000038 g     O .data.rel.ro   0000000000000038 _ZTVN4llvm7jitlink25InProcessEHFrameRegistrarE

Diff Detail

Event Timeline

sgraenitz created this revision.May 31 2023, 6:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 6:29 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
sgraenitz requested review of this revision.May 31 2023, 6:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 6:29 AM
sgraenitz added a comment.EditedMay 31 2023, 6:50 AM

All modified classes have out-of-line virtual methods (or at least dtors) already. Nevertheless, without these additional anchors the vtable symbols appear to be missing from libMyShared.so. Eventually, I am not certain why this is necessary. I don't see similar issues for libLLVMOrcJIT.a and they are built and linked the same way.

sgraenitz abandoned this revision.May 31 2023, 7:06 AM

Scratch that. It turned out to be some side-effect of link order. I still don't quite get it, but the anchors are not necessary. Sorry for the noise.