diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2019-05-23 21:30:30 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-05-23 21:30:30 +0000 |
commit | ca6a8ae0bffe88f3f0974316b2408b2548ff6f77 (patch) | |
tree | 48dd5206a3a538374ec7f324f22756aad87cf223 | |
parent | b4cb7d8045e38b7fcca3cf6da254b2a1ba7b5710 (diff) | |
download | bcm5719-llvm-ca6a8ae0bffe88f3f0974316b2408b2548ff6f77.tar.gz bcm5719-llvm-ca6a8ae0bffe88f3f0974316b2408b2548ff6f77.zip |
ELF: Remove a comparison against In.EhFrame. NFCI.
This won't work once we have multiple .eh_frame sections.
Differential Revision: https://reviews.llvm.org/D62280
llvm-svn: 361556
-rw-r--r-- | lld/ELF/MapFile.cpp | 9 | ||||
-rw-r--r-- | lld/ELF/SyntheticSections.h | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index 11720e196d3..2f1921ec983 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -106,7 +106,7 @@ getSymbolStrings(ArrayRef<Defined *> Syms) { // .eh_frame tend to contain a lot of section pieces that are contiguous // both in input file and output file. Such pieces are squashed before // being displayed to make output compact. -static void printEhFrame(raw_ostream &OS, OutputSection *OSec) { +static void printEhFrame(raw_ostream &OS, const EhFrameSection *Sec) { std::vector<EhSectionPiece> Pieces; auto Add = [&](const EhSectionPiece &P) { @@ -123,13 +123,14 @@ static void printEhFrame(raw_ostream &OS, OutputSection *OSec) { }; // Gather section pieces. - for (const CieRecord *Rec : In.EhFrame->getCieRecords()) { + for (const CieRecord *Rec : Sec->getCieRecords()) { Add(*Rec->Cie); for (const EhSectionPiece *Fde : Rec->Fdes) Add(*Fde); } // Print out section pieces. + const OutputSection *OSec = Sec->getOutputSection(); for (EhSectionPiece &P : Pieces) { writeHeader(OS, OSec->Addr + P.OutputOff, OSec->getLMA() + P.OutputOff, P.Size, 1); @@ -179,8 +180,8 @@ void elf::writeMapFile() { for (BaseCommand *Base : OSec->SectionCommands) { if (auto *ISD = dyn_cast<InputSectionDescription>(Base)) { for (InputSection *IS : ISD->Sections) { - if (IS == In.EhFrame) { - printEhFrame(OS, OSec); + if (auto *EhSec = dyn_cast<EhFrameSection>(IS)) { + printEhFrame(OS, EhSec); continue; } diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index e848d0d76ab..58a01ea6c54 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -69,6 +69,10 @@ public: bool isNeeded() const override { return !Sections.empty(); } size_t getSize() const override { return Size; } + static bool classof(const SectionBase *D) { + return SyntheticSection::classof(D) && D->Name == ".eh_frame"; + } + template <class ELFT> void addSection(InputSectionBase *S); std::vector<EhInputSection *> Sections; |