[PATCH] D104401: [MCA] Anchoring the vtable of CustomBehaviour
Min-Yih Hsu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 16 10:46:07 PDT 2021
myhsu created this revision.
myhsu added reviewers: holland11, andreadb.
Herald added subscribers: kerbowa, gbedwell, hiraditya, tpr, mgorny, nhaehnle, jvesely.
myhsu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104401
Files:
llvm/include/llvm/MCA/CustomBehaviour.h
llvm/lib/MCA/CustomBehaviour.cpp
llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
Index: llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
+++ llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
@@ -6,6 +6,7 @@
set(LLVM_LINK_COMPONENTS
AMDGPU
Core
+ MCA
Support
)
Index: llvm/lib/MCA/CustomBehaviour.cpp
===================================================================
--- llvm/lib/MCA/CustomBehaviour.cpp
+++ llvm/lib/MCA/CustomBehaviour.cpp
@@ -16,6 +16,8 @@
namespace llvm {
namespace mca {
+CustomBehaviour::~CustomBehaviour() {}
+
unsigned CustomBehaviour::checkCustomHazard(ArrayRef<InstRef> IssuedInst,
const InstRef &IR) {
// 0 signifies that there are no hazards that need to be waited on
Index: llvm/include/llvm/MCA/CustomBehaviour.h
===================================================================
--- llvm/include/llvm/MCA/CustomBehaviour.h
+++ llvm/include/llvm/MCA/CustomBehaviour.h
@@ -63,7 +63,7 @@
const MCInstrInfo &MCII)
: STI(STI), SrcMgr(SrcMgr), MCII(MCII) {}
- virtual ~CustomBehaviour() {}
+ virtual ~CustomBehaviour();
// Before the llvm-mca pipeline dispatches an instruction, it first checks
// for any register or resource dependencies / hazards. If it doesn't find
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104401.352479.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210616/1316bfe9/attachment.bin>
More information about the llvm-commits
mailing list