[lld] r313681 - Rename CieRecord instance variables.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 14:31:57 PDT 2017
Author: ruiu
Date: Tue Sep 19 14:31:57 2017
New Revision: 313681
URL: http://llvm.org/viewvc/llvm-project?rev=313681&view=rev
Log:
Rename CieRecord instance variables.
CieRecord is a struct containing a CIE and FDEs, but oftentimes the
struct itself is named `Cie` which caused some confusion. This patch
renames them `CieRecords` or `Rec`.
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/SyntheticSections.h
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=313681&r1=313680&r2=313681&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Sep 19 14:31:57 2017
@@ -403,38 +403,38 @@ EhFrameSection<ELFT>::EhFrameSection()
// and where their relocations point to.
template <class ELFT>
template <class RelTy>
-CieRecord *EhFrameSection<ELFT>::addCie(EhSectionPiece &Piece,
+CieRecord *EhFrameSection<ELFT>::addCie(EhSectionPiece &Cie,
ArrayRef<RelTy> Rels) {
- auto *Sec = cast<EhInputSection>(Piece.Sec);
+ auto *Sec = cast<EhInputSection>(Cie.Sec);
const endianness E = ELFT::TargetEndianness;
- if (read32<E>(Piece.data().data() + 4) != 0)
+ if (read32<E>(Cie.data().data() + 4) != 0)
fatal(toString(Sec) + ": CIE expected at beginning of .eh_frame");
SymbolBody *Personality = nullptr;
- unsigned FirstRelI = Piece.FirstRelocation;
+ unsigned FirstRelI = Cie.FirstRelocation;
if (FirstRelI != (unsigned)-1)
Personality =
&Sec->template getFile<ELFT>()->getRelocTargetSym(Rels[FirstRelI]);
// Search for an existing CIE by CIE contents/relocation target pair.
- CieRecord *Cie = &CieMap[{Piece.data(), Personality}];
+ CieRecord *Rec = &CieMap[{Cie.data(), Personality}];
// If not found, create a new one.
- if (Cie->Piece == nullptr) {
- Cie->Piece = &Piece;
- Cies.push_back(Cie);
+ if (Rec->Cie == nullptr) {
+ Rec->Cie = &Cie;
+ CieRecords.push_back(Rec);
}
- return Cie;
+ return Rec;
}
// There is one FDE per function. Returns true if a given FDE
// points to a live function.
template <class ELFT>
template <class RelTy>
-bool EhFrameSection<ELFT>::isFdeLive(EhSectionPiece &Piece,
+bool EhFrameSection<ELFT>::isFdeLive(EhSectionPiece &Fde,
ArrayRef<RelTy> Rels) {
- auto *Sec = cast<EhInputSection>(Piece.Sec);
- unsigned FirstRelI = Piece.FirstRelocation;
+ auto *Sec = cast<EhInputSection>(Fde.Sec);
+ unsigned FirstRelI = Fde.FirstRelocation;
// An FDE should point to some function because FDEs are to describe
// functions. That's however not always the case due to an issue of
@@ -476,13 +476,13 @@ void EhFrameSection<ELFT>::addSectionAux
}
uint32_t CieOffset = Offset + 4 - ID;
- CieRecord *Cie = OffsetToCie[CieOffset];
- if (!Cie)
+ CieRecord *Rec = OffsetToCie[CieOffset];
+ if (!Rec)
fatal(toString(Sec) + ": invalid CIE reference");
if (!isFdeLive(Piece, Rels))
continue;
- Cie->FdePieces.push_back(&Piece);
+ Rec->Fdes.push_back(&Piece);
NumFdes++;
}
}
@@ -530,11 +530,11 @@ template <class ELFT> void EhFrameSectio
return; // Already finalized.
size_t Off = 0;
- for (CieRecord *Cie : Cies) {
- Cie->Piece->OutputOff = Off;
- Off += alignTo(Cie->Piece->Size, Config->Wordsize);
+ for (CieRecord *Rec : CieRecords) {
+ Rec->Cie->OutputOff = Off;
+ Off += alignTo(Rec->Cie->Size, Config->Wordsize);
- for (EhSectionPiece *Fde : Cie->FdePieces) {
+ for (EhSectionPiece *Fde : Rec->Fdes) {
Fde->OutputOff = Off;
Off += alignTo(Fde->Size, Config->Wordsize);
}
@@ -584,11 +584,11 @@ uint64_t EhFrameSection<ELFT>::getFdePc(
template <class ELFT> void EhFrameSection<ELFT>::writeTo(uint8_t *Buf) {
const endianness E = ELFT::TargetEndianness;
- for (CieRecord *Cie : Cies) {
- size_t CieOffset = Cie->Piece->OutputOff;
- writeCieFde<ELFT>(Buf + CieOffset, Cie->Piece->data());
+ for (CieRecord *Rec : CieRecords) {
+ size_t CieOffset = Rec->Cie->OutputOff;
+ writeCieFde<ELFT>(Buf + CieOffset, Rec->Cie->data());
- for (EhSectionPiece *Fde : Cie->FdePieces) {
+ for (EhSectionPiece *Fde : Rec->Fdes) {
size_t Off = Fde->OutputOff;
writeCieFde<ELFT>(Buf + Off, Fde->data());
@@ -605,9 +605,9 @@ template <class ELFT> void EhFrameSectio
// to get a FDE from an address to which FDE is applied. So here
// we obtain two addresses and pass them to EhFrameHdr object.
if (In<ELFT>::EhFrameHdr) {
- for (CieRecord *Cie : Cies) {
- uint8_t Enc = getFdeEncoding<ELFT>(Cie->Piece);
- for (EhSectionPiece *Fde : Cie->FdePieces) {
+ for (CieRecord *Rec : CieRecords) {
+ uint8_t Enc = getFdeEncoding<ELFT>(Rec->Cie);
+ for (EhSectionPiece *Fde : Rec->Fdes) {
uint64_t Pc = getFdePc(Buf, Fde->OutputOff, Enc);
uint64_t FdeVA = getParent()->Addr + Fde->OutputOff;
In<ELFT>::EhFrameHdr->addFde(Pc, FdeVA);
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=313681&r1=313680&r2=313681&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Tue Sep 19 14:31:57 2017
@@ -59,8 +59,8 @@ public:
};
struct CieRecord {
- EhSectionPiece *Piece = nullptr;
- std::vector<EhSectionPiece *> FdePieces;
+ EhSectionPiece *Cie = nullptr;
+ std::vector<EhSectionPiece *> Fdes;
};
// Section for .eh_frame.
@@ -100,7 +100,7 @@ private:
uint64_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc);
- std::vector<CieRecord *> Cies;
+ std::vector<CieRecord *> CieRecords;
// CIE records are uniquified by their contents and personality functions.
llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord> CieMap;
More information about the llvm-commits
mailing list