[lld] r313587 - Do not use inheritance for EhSectionPiece.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 16:07:22 PDT 2017
Author: ruiu
Date: Mon Sep 18 16:07:21 2017
New Revision: 313587
URL: http://llvm.org/viewvc/llvm-project?rev=313587&view=rev
Log:
Do not use inheritance for EhSectionPiece.
EhSectionPiece inherited from SectionPiece, but we did not actually use
EhSectionPiece objects as SectionPiece ojbects. They were handled as
distinct types. So it didn't make much sense to use inheritance.
Modified:
lld/trunk/ELF/InputSection.h
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=313587&r1=313586&r2=313587&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Mon Sep 18 16:07:21 2017
@@ -261,15 +261,18 @@ private:
llvm::DenseSet<uint64_t> LiveOffsets;
};
-struct EhSectionPiece : public SectionPiece {
+struct EhSectionPiece {
EhSectionPiece(size_t Off, InputSectionBase *ID, uint32_t Size,
unsigned FirstRelocation)
- : SectionPiece(Off, false), ID(ID), Size(Size),
+ : InputOff(Off), ID(ID), Size(Size),
FirstRelocation(FirstRelocation) {}
- InputSectionBase *ID;
- uint32_t Size;
ArrayRef<uint8_t> data() { return {ID->Data.data() + this->InputOff, Size}; }
+
+ size_t InputOff;
+ ssize_t OutputOff = -1;
+ InputSectionBase *ID;
+ uint32_t Size;
unsigned FirstRelocation;
};
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=313587&r1=313586&r2=313587&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Mon Sep 18 16:07:21 2017
@@ -609,7 +609,7 @@ template <class ELFT> void EhFrameSectio
if (In<ELFT>::EhFrameHdr) {
for (CieRecord *Cie : Cies) {
uint8_t Enc = getFdeEncoding<ELFT>(Cie->Piece);
- for (SectionPiece *Fde : Cie->FdePieces) {
+ for (EhSectionPiece *Fde : Cie->FdePieces) {
uint64_t Pc = getFdePc(Buf, Fde->OutputOff, Enc);
uint64_t FdeVA = getParent()->Addr + Fde->OutputOff;
In<ELFT>::EhFrameHdr->addFde(Pc, FdeVA);
More information about the llvm-commits
mailing list