[PATCH] D62280: ELF: Remove a comparison against In.EhFrame. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 18:36:27 PDT 2019
pcc created this revision.
pcc added a reviewer: ruiu.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
This won't work once we have multiple .eh_frame sections.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D62280
Files:
lld/ELF/MapFile.cpp
lld/ELF/SyntheticSections.h
Index: lld/ELF/SyntheticSections.h
===================================================================
--- lld/ELF/SyntheticSections.h
+++ lld/ELF/SyntheticSections.h
@@ -70,6 +70,10 @@
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;
Index: lld/ELF/MapFile.cpp
===================================================================
--- lld/ELF/MapFile.cpp
+++ lld/ELF/MapFile.cpp
@@ -106,7 +106,7 @@
// .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, EhFrameSection *Sec) {
std::vector<EhSectionPiece> Pieces;
auto Add = [&](const EhSectionPiece &P) {
@@ -123,13 +123,14 @@
};
// 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.
+ 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 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62280.200859.patch
Type: text/x-patch
Size: 2002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190523/264ec4ce/attachment.bin>
More information about the llvm-commits
mailing list