[lld] r361556 - ELF: Remove a comparison against In.EhFrame. NFCI.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 14:30:30 PDT 2019
Author: pcc
Date: Thu May 23 14:30:30 2019
New Revision: 361556
URL: http://llvm.org/viewvc/llvm-project?rev=361556&view=rev
Log:
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
Modified:
lld/trunk/ELF/MapFile.cpp
lld/trunk/ELF/SyntheticSections.h
Modified: lld/trunk/ELF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=361556&r1=361555&r2=361556&view=diff
==============================================================================
--- lld/trunk/ELF/MapFile.cpp (original)
+++ lld/trunk/ELF/MapFile.cpp Thu May 23 14:30:30 2019
@@ -106,7 +106,7 @@ getSymbolStrings(ArrayRef<Defined *> Sym
// .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
};
// 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;
}
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=361556&r1=361555&r2=361556&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Thu May 23 14:30:30 2019
@@ -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;
More information about the llvm-commits
mailing list