diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp index 608be5160da7e..d536aed1d2114 100644 --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -1366,8 +1366,7 @@ void BTFDebug::processGlobals(bool ProcessingMapDef) { // Calculate symbol size const DataLayout &DL = Global.getParent()->getDataLayout(); - uint32_t Size = - DL.getTypeAllocSize(Global.getType()->getPointerElementType()); + uint32_t Size = DL.getTypeAllocSize(Global.getValueType()); DataSecEntries[std::string(SecName)]->addDataSecEntry(VarId, Asm->getSymbol(&Global), Size);