diff options
| author | Eugene Leviant <eleviant@accesssoftek.com> | 2016-11-25 08:27:15 +0000 |
|---|---|---|
| committer | Eugene Leviant <eleviant@accesssoftek.com> | 2016-11-25 08:27:15 +0000 |
| commit | c8c1b7bfae45d830083209b402f5f1f77bb8d5c5 (patch) | |
| tree | 8cb0c4c2e9ec195a4cbcc776dea09d2863e8fbf9 | |
| parent | 11992c86d9bb40a3f7626502632c4cce7fcdb9fb (diff) | |
| download | bcm5719-llvm-c8c1b7bfae45d830083209b402f5f1f77bb8d5c5.tar.gz bcm5719-llvm-c8c1b7bfae45d830083209b402f5f1f77bb8d5c5.zip | |
[ELF] EhOutputSection improvements
Differential revision: https://reviews.llvm.org/D27098
llvm-svn: 287914
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 14 | ||||
| -rw-r--r-- | lld/ELF/OutputSections.h | 6 |
2 files changed, 9 insertions, 11 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 0123d70b932..241f93d9532 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -273,11 +273,11 @@ EhOutputSection<ELFT>::EhOutputSection() template <class ELFT> template <class RelTy> CieRecord *EhOutputSection<ELFT>::addCie(EhSectionPiece &Piece, - EhInputSection<ELFT> *Sec, ArrayRef<RelTy> Rels) { + auto *Sec = cast<EhInputSection<ELFT>>(Piece.ID); const endianness E = ELFT::TargetEndianness; if (read32<E>(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 @@ CieRecord *EhOutputSection<ELFT>::addCie(EhSectionPiece &Piece, template <class ELFT> template <class RelTy> bool EhOutputSection<ELFT>::isFdeLive(EhSectionPiece &Piece, - EhInputSection<ELFT> *Sec, ArrayRef<RelTy> Rels) { + auto *Sec = cast<EhInputSection<ELFT>>(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<DefinedRegular<ELFT>>(&B); @@ -333,16 +333,16 @@ void EhOutputSection<ELFT>::addSectionAux(EhInputSection<ELFT> *Sec, size_t Offset = Piece.InputOff; uint32_t ID = read32<E>(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++; diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index e4e4bf0d42f..edb028ff790 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -175,12 +175,10 @@ private: void addSectionAux(EhInputSection<ELFT> *S, llvm::ArrayRef<RelTy> Rels); template <class RelTy> - CieRecord *addCie(EhSectionPiece &Piece, EhInputSection<ELFT> *Sec, - ArrayRef<RelTy> Rels); + CieRecord *addCie(EhSectionPiece &Piece, ArrayRef<RelTy> Rels); template <class RelTy> - bool isFdeLive(EhSectionPiece &Piece, EhInputSection<ELFT> *Sec, - ArrayRef<RelTy> Rels); + bool isFdeLive(EhSectionPiece &Piece, ArrayRef<RelTy> Rels); uintX_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc); |

