This is an archive of the discontinued LLVM Phabricator instance.

[MCA] Anchoring the vtable of CustomBehaviour
ClosedPublic

Authored by myhsu on Jun 16 2021, 10:46 AM.

Details

Summary

Put the dtor of mca::CustomBehaviour into the cpp file to avoid undefined vtable when linking libLLVMMCACustomBehaviourAMDGPU as shared library.

Here is the original error message:

FAILED: lib/libLLVMMCACustomBehaviourAMDGPU.so.13git
...
ld.lld: error: undefined symbol: vtable for llvm::mca::CustomBehaviour
>>> referenced by CustomBehaviour.h:64 (llvm-project/llvm/include/llvm/MCA/CustomBehaviour.h:64)
>>>               tools/llvm-mca/lib/AMDGPU/CMakeFiles/LLVMMCACustomBehaviourAMDGPU.dir/AMDGPUCustomBehaviour.cpp.o:(llvm::mca::CustomBehaviour::CustomBehaviour(llvm::MCSubtargetInfo const&, llvm::mca::CircularSourceMgr const&, llvm::MCInstrInfo const&))
>>> referenced by CustomBehaviour.h:66 (llvm-project/llvm/include/llvm/MCA/CustomBehaviour.h:66)
>>>               tools/llvm-mca/lib/AMDGPU/CMakeFiles/LLVMMCACustomBehaviourAMDGPU.dir/AMDGPUCustomBehaviour.cpp.o:(llvm::mca::CustomBehaviour::~CustomBehaviour())
the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

Diff Detail

Event Timeline

myhsu created this revision.Jun 16 2021, 10:46 AM
myhsu requested review of this revision.Jun 16 2021, 10:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2021, 10:46 AM
This revision is now accepted and ready to land.Jun 16 2021, 11:07 AM

+1 Thanks for catching this!

This revision was landed with ongoing or failed builds.Jun 16 2021, 12:45 PM
This revision was automatically updated to reflect the committed changes.