[lld] r270522 - Make getFdeEncoding a non-member function.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 19:08:38 PDT 2016
Author: ruiu
Date: Mon May 23 21:08:38 2016
New Revision: 270522
URL: http://llvm.org/viewvc/llvm-project?rev=270522&view=rev
Log:
Make getFdeEncoding a non-member function.
This function does not depend on EhOutputSection class.
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=270522&r1=270521&r2=270522&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Mon May 23 21:08:38 2016
@@ -963,8 +963,7 @@ template <class ELFT> static void skipAu
D = D.slice(Size);
}
-template <class ELFT>
-uint8_t EhOutputSection<ELFT>::getFdeEncoding(ArrayRef<uint8_t> D) {
+template <class ELFT> static uint8_t getFdeEncoding(ArrayRef<uint8_t> D) {
if (D.size() < 8)
fatal("CIE too small");
D = D.slice(8);
@@ -1051,8 +1050,6 @@ CieRecord *EhOutputSection<ELFT>::addCie
// If not found, create a new one.
if (Cie->Piece == nullptr) {
Cie->Piece = &Piece;
- if (Config->EhFrameHdr)
- Cie->FdeEncoding = getFdeEncoding(Piece.Data);
Cies.push_back(Cie);
}
return Cie;
@@ -1214,8 +1211,9 @@ template <class ELFT> void EhOutputSecti
// we obtain two addresses and pass them to EhFrameHdr object.
if (Out<ELFT>::EhFrameHdr) {
for (CieRecord *Cie : Cies) {
+ uint8_t Enc = getFdeEncoding<ELFT>(Cie->Piece->Data);
for (SectionPiece *Fde : Cie->FdePieces) {
- uintX_t Pc = getFdePc(Buf, Fde->OutputOff, Cie->FdeEncoding);
+ uintX_t Pc = getFdePc(Buf, Fde->OutputOff, Enc);
uintX_t FdeVA = this->getVA() + Fde->OutputOff;
Out<ELFT>::EhFrameHdr->addFde(Pc, FdeVA);
}
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=270522&r1=270521&r2=270522&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Mon May 23 21:08:38 2016
@@ -328,7 +328,6 @@ private:
struct CieRecord {
SectionPiece *Piece = nullptr;
std::vector<SectionPiece *> FdePieces;
- uint8_t FdeEncoding = 0;
};
// Output section for .eh_frame.
@@ -363,8 +362,6 @@ private:
bool isFdeLive(SectionPiece &Piece, EHInputSection<ELFT> *Sec,
ArrayRef<RelTy> Rels);
- uint8_t getFdeEncoding(ArrayRef<uint8_t> D);
-
uintX_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc);
std::vector<EHInputSection<ELFT> *> Sections;
More information about the llvm-commits
mailing list