diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -1343,6 +1343,8 @@ // been generated, construct one based on function signature. if (LineInfoGenerated == false) { auto *S = MI->getMF()->getFunction().getSubprogram(); + if (!S) // unable to get subprogram + return; MCSymbol *FuncLabel = Asm->getFunctionBegin(); constructLineInfo(S, FuncLabel, S->getLine(), 0); LineInfoGenerated = true;