Index: lld/trunk/ELF/OutputSections.h =================================================================== --- lld/trunk/ELF/OutputSections.h +++ lld/trunk/ELF/OutputSections.h @@ -175,12 +175,10 @@ void addSectionAux(EhInputSection *S, llvm::ArrayRef Rels); template - CieRecord *addCie(EhSectionPiece &Piece, EhInputSection *Sec, - ArrayRef Rels); + CieRecord *addCie(EhSectionPiece &Piece, ArrayRef Rels); template - bool isFdeLive(EhSectionPiece &Piece, EhInputSection *Sec, - ArrayRef Rels); + bool isFdeLive(EhSectionPiece &Piece, ArrayRef Rels); uintX_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc); Index: lld/trunk/ELF/OutputSections.cpp =================================================================== --- lld/trunk/ELF/OutputSections.cpp +++ lld/trunk/ELF/OutputSections.cpp @@ -273,11 +273,11 @@ template template CieRecord *EhOutputSection::addCie(EhSectionPiece &Piece, - EhInputSection *Sec, ArrayRef Rels) { + auto *Sec = cast>(Piece.ID); const endianness E = ELFT::TargetEndianness; if (read32(Piece.data().data() + 4) != 0) - fatal("CIE expected at beginning of .eh_frame: " + Sec->Name); + fatal(toString(Sec) + ": CIE expected at beginning of .eh_frame"); SymbolBody *Personality = nullptr; unsigned FirstRelI = Piece.FirstRelocation; @@ -300,11 +300,11 @@ template template bool EhOutputSection::isFdeLive(EhSectionPiece &Piece, - EhInputSection *Sec, ArrayRef Rels) { + auto *Sec = cast>(Piece.ID); unsigned FirstRelI = Piece.FirstRelocation; if (FirstRelI == (unsigned)-1) - fatal("FDE doesn't reference another section"); + fatal(toString(Sec) + ": FDE doesn't reference another section"); const RelTy &Rel = Rels[FirstRelI]; SymbolBody &B = Sec->getFile()->getRelocTargetSym(Rel); auto *D = dyn_cast>(&B); @@ -333,16 +333,16 @@ size_t Offset = Piece.InputOff; uint32_t ID = read32(Piece.data().data() + 4); if (ID == 0) { - OffsetToCie[Offset] = addCie(Piece, Sec, Rels); + OffsetToCie[Offset] = addCie(Piece, Rels); continue; } uint32_t CieOffset = Offset + 4 - ID; CieRecord *Cie = OffsetToCie[CieOffset]; if (!Cie) - fatal("invalid CIE reference"); + fatal(toString(Sec) + ": invalid CIE reference"); - if (!isFdeLive(Piece, Sec, Rels)) + if (!isFdeLive(Piece, Rels)) continue; Cie->FdePieces.push_back(&Piece); NumFdes++;