diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -78,9 +78,12 @@ MCDwarfLineStr::MCDwarfLineStr(MCContext &Ctx) { UseRelocs = Ctx.getAsmInfo()->doesDwarfUseRelocationsAcrossSections(); - if (UseRelocs) - LineStrLabel = - Ctx.getObjectFileInfo()->getDwarfLineStrSection()->getBeginSymbol(); + if (UseRelocs) { + MCSection *DwarfLineStrSection = + Ctx.getObjectFileInfo()->getDwarfLineStrSection(); + assert(DwarfLineStrSection && "DwarfLineStrSection must not be NULL"); + LineStrLabel = DwarfLineStrSection->getBeginSymbol(); + } } //