mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-01 13:20:25 +00:00
Rename EHInputSection -> EhInputSection.
llvm-svn: 270532
This commit is contained in:
parent
151ff30783
commit
0b9a90364b
@ -236,7 +236,7 @@ void elf::ObjectFile<ELFT>::initializeSections(
|
||||
S->RelocSections.push_back(&Sec);
|
||||
break;
|
||||
}
|
||||
if (auto *S = dyn_cast<EHInputSection<ELFT>>(Target)) {
|
||||
if (auto *S = dyn_cast<EhInputSection<ELFT>>(Target)) {
|
||||
if (S->RelocSection)
|
||||
fatal("multiple relocation sections to .eh_frame are not supported");
|
||||
S->RelocSection = &Sec;
|
||||
@ -305,7 +305,7 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
|
||||
// We dont need special handling of .eh_frame sections if relocatable
|
||||
// output was choosen. Proccess them as usual input sections.
|
||||
if (!Config->Relocatable && Name == ".eh_frame")
|
||||
return new (EHAlloc.Allocate()) EHInputSection<ELFT>(this, &Sec);
|
||||
return new (EHAlloc.Allocate()) EhInputSection<ELFT>(this, &Sec);
|
||||
if (shouldMerge<ELFT>(Sec))
|
||||
return new (MAlloc.Allocate()) MergeInputSection<ELFT>(this, &Sec);
|
||||
return new (IAlloc.Allocate()) InputSection<ELFT>(this, &Sec);
|
||||
|
@ -171,7 +171,7 @@ private:
|
||||
llvm::BumpPtrAllocator Alloc;
|
||||
llvm::SpecificBumpPtrAllocator<InputSection<ELFT>> IAlloc;
|
||||
llvm::SpecificBumpPtrAllocator<MergeInputSection<ELFT>> MAlloc;
|
||||
llvm::SpecificBumpPtrAllocator<EHInputSection<ELFT>> EHAlloc;
|
||||
llvm::SpecificBumpPtrAllocator<EhInputSection<ELFT>> EHAlloc;
|
||||
};
|
||||
|
||||
// LazyObjectFile is analogous to ArchiveFile in the sense that
|
||||
|
@ -61,7 +61,7 @@ typename ELFT::uint InputSectionBase<ELFT>::getOffset(uintX_t Offset) {
|
||||
case Regular:
|
||||
return cast<InputSection<ELFT>>(this)->OutSecOff + Offset;
|
||||
case EHFrame:
|
||||
return cast<EHInputSection<ELFT>>(this)->getOffset(Offset);
|
||||
return cast<EhInputSection<ELFT>>(this)->getOffset(Offset);
|
||||
case Merge:
|
||||
return cast<MergeInputSection<ELFT>>(this)->getOffset(Offset);
|
||||
case MipsReginfo:
|
||||
@ -394,7 +394,7 @@ SplitInputSection<ELFT>::SplitInputSection(
|
||||
: InputSectionBase<ELFT>(File, Header, SectionKind) {}
|
||||
|
||||
template <class ELFT>
|
||||
EHInputSection<ELFT>::EHInputSection(elf::ObjectFile<ELFT> *F,
|
||||
EhInputSection<ELFT>::EhInputSection(elf::ObjectFile<ELFT> *F,
|
||||
const Elf_Shdr *Header)
|
||||
: SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {
|
||||
// Mark .eh_frame sections as live by default because there are
|
||||
@ -404,14 +404,14 @@ EHInputSection<ELFT>::EHInputSection(elf::ObjectFile<ELFT> *F,
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
bool EHInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
|
||||
bool EhInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
|
||||
return S->SectionKind == InputSectionBase<ELFT>::EHFrame;
|
||||
}
|
||||
|
||||
// .eh_frame is a sequence of CIE or FDE records.
|
||||
// This function splits an input section into records and returns them.
|
||||
template <class ELFT>
|
||||
void EHInputSection<ELFT>::split() {
|
||||
void EhInputSection<ELFT>::split() {
|
||||
ArrayRef<uint8_t> Data = this->getSectionData();
|
||||
for (size_t Off = 0, End = Data.size(); Off != End;) {
|
||||
size_t Size = readEhRecordSize<ELFT>(Data.slice(Off));
|
||||
@ -424,7 +424,7 @@ void EHInputSection<ELFT>::split() {
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
typename ELFT::uint EHInputSection<ELFT>::getOffset(uintX_t Offset) {
|
||||
typename ELFT::uint EhInputSection<ELFT>::getOffset(uintX_t Offset) {
|
||||
// The file crtbeginT.o has relocations pointing to the start of an empty
|
||||
// .eh_frame that is known to be the first in the link. It does that to
|
||||
// identify the start of the output .eh_frame. Handle this special case.
|
||||
@ -598,10 +598,10 @@ template class elf::SplitInputSection<ELF32BE>;
|
||||
template class elf::SplitInputSection<ELF64LE>;
|
||||
template class elf::SplitInputSection<ELF64BE>;
|
||||
|
||||
template class elf::EHInputSection<ELF32LE>;
|
||||
template class elf::EHInputSection<ELF32BE>;
|
||||
template class elf::EHInputSection<ELF64LE>;
|
||||
template class elf::EHInputSection<ELF64BE>;
|
||||
template class elf::EhInputSection<ELF32LE>;
|
||||
template class elf::EhInputSection<ELF32BE>;
|
||||
template class elf::EhInputSection<ELF64LE>;
|
||||
template class elf::EhInputSection<ELF64BE>;
|
||||
|
||||
template class elf::MergeInputSection<ELF32LE>;
|
||||
template class elf::MergeInputSection<ELF32BE>;
|
||||
|
@ -186,11 +186,11 @@ private:
|
||||
};
|
||||
|
||||
// This corresponds to a .eh_frame section of an input file.
|
||||
template <class ELFT> class EHInputSection : public SplitInputSection<ELFT> {
|
||||
template <class ELFT> class EhInputSection : public SplitInputSection<ELFT> {
|
||||
public:
|
||||
typedef typename ELFT::Shdr Elf_Shdr;
|
||||
typedef typename ELFT::uint uintX_t;
|
||||
EHInputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header);
|
||||
EhInputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header);
|
||||
static bool classof(const InputSectionBase<ELFT> *S);
|
||||
void split();
|
||||
|
||||
|
@ -95,7 +95,7 @@ static void forEachSuccessor(InputSection<ELFT> *Sec,
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
static void scanEhFrameSection(EHInputSection<ELFT> &EH,
|
||||
static void scanEhFrameSection(EhInputSection<ELFT> &EH,
|
||||
std::function<void(ResolvedReloc<ELFT>)> Fn) {
|
||||
if (!EH.RelocSection)
|
||||
return;
|
||||
@ -183,7 +183,7 @@ template <class ELFT> void elf::markLive() {
|
||||
// .eh_frame is always marked as live now, but also it can reference to
|
||||
// sections that contain personality. We preserve all non-text sections
|
||||
// referred by .eh_frame here.
|
||||
if (auto *EH = dyn_cast_or_null<EHInputSection<ELFT>>(Sec))
|
||||
if (auto *EH = dyn_cast_or_null<EhInputSection<ELFT>>(Sec))
|
||||
scanEhFrameSection<ELFT>(*EH, Enqueue);
|
||||
if (isReserved(Sec) || Script<ELFT>::X->shouldKeep(Sec))
|
||||
Enqueue({Sec, 0});
|
||||
|
@ -913,7 +913,7 @@ EhOutputSection<ELFT>::EhOutputSection()
|
||||
template <class ELFT>
|
||||
void EhOutputSection<ELFT>::forEachInputSection(
|
||||
std::function<void(InputSectionBase<ELFT> *)> F) {
|
||||
for (EHInputSection<ELFT> *S : Sections)
|
||||
for (EhInputSection<ELFT> *S : Sections)
|
||||
F(S);
|
||||
}
|
||||
|
||||
@ -936,7 +936,7 @@ static const RelTy *getReloc(IntTy Begin, IntTy Size, ArrayRef<RelTy> Rels) {
|
||||
template <class ELFT>
|
||||
template <class RelTy>
|
||||
CieRecord *EhOutputSection<ELFT>::addCie(SectionPiece &Piece,
|
||||
EHInputSection<ELFT> *Sec,
|
||||
EhInputSection<ELFT> *Sec,
|
||||
ArrayRef<RelTy> Rels) {
|
||||
const endianness E = ELFT::TargetEndianness;
|
||||
if (read32<E>(Piece.Data.data() + 4) != 0)
|
||||
@ -970,7 +970,7 @@ template <class ELFT> static void validateFde(SectionPiece &Piece) {
|
||||
template <class ELFT>
|
||||
template <class RelTy>
|
||||
bool EhOutputSection<ELFT>::isFdeLive(SectionPiece &Piece,
|
||||
EHInputSection<ELFT> *Sec,
|
||||
EhInputSection<ELFT> *Sec,
|
||||
ArrayRef<RelTy> Rels) {
|
||||
const RelTy *Rel = getReloc(Piece.InputOff, Piece.size(), Rels);
|
||||
if (!Rel)
|
||||
@ -989,7 +989,7 @@ bool EhOutputSection<ELFT>::isFdeLive(SectionPiece &Piece,
|
||||
// one and associates FDEs to the CIE.
|
||||
template <class ELFT>
|
||||
template <class RelTy>
|
||||
void EhOutputSection<ELFT>::addSectionAux(EHInputSection<ELFT> *Sec,
|
||||
void EhOutputSection<ELFT>::addSectionAux(EhInputSection<ELFT> *Sec,
|
||||
ArrayRef<RelTy> Rels) {
|
||||
SectionPiece &CiePiece = Sec->Pieces[0];
|
||||
CieRecord *Cie = addCie(CiePiece, Sec, Rels);
|
||||
@ -1006,7 +1006,7 @@ void EhOutputSection<ELFT>::addSectionAux(EHInputSection<ELFT> *Sec,
|
||||
|
||||
template <class ELFT>
|
||||
void EhOutputSection<ELFT>::addSection(InputSectionBase<ELFT> *C) {
|
||||
auto *Sec = cast<EHInputSection<ELFT>>(C);
|
||||
auto *Sec = cast<EhInputSection<ELFT>>(C);
|
||||
Sec->OutSec = this;
|
||||
this->updateAlign(Sec->Align);
|
||||
Sections.push_back(Sec);
|
||||
@ -1105,7 +1105,7 @@ template <class ELFT> void EhOutputSection<ELFT>::writeTo(uint8_t *Buf) {
|
||||
}
|
||||
}
|
||||
|
||||
for (EHInputSection<ELFT> *S : Sections)
|
||||
for (EhInputSection<ELFT> *S : Sections)
|
||||
S->relocate(Buf, nullptr);
|
||||
|
||||
// Construct .eh_frame_hdr. .eh_frame_hdr is a binary search table
|
||||
|
@ -27,7 +27,7 @@ struct SectionPiece;
|
||||
template <class ELFT> class SymbolTable;
|
||||
template <class ELFT> class SymbolTableSection;
|
||||
template <class ELFT> class StringTableSection;
|
||||
template <class ELFT> class EHInputSection;
|
||||
template <class ELFT> class EhInputSection;
|
||||
template <class ELFT> class InputSection;
|
||||
template <class ELFT> class InputSectionBase;
|
||||
template <class ELFT> class MergeInputSection;
|
||||
@ -356,19 +356,19 @@ public:
|
||||
|
||||
private:
|
||||
template <class RelTy>
|
||||
void addSectionAux(EHInputSection<ELFT> *S, llvm::ArrayRef<RelTy> Rels);
|
||||
void addSectionAux(EhInputSection<ELFT> *S, llvm::ArrayRef<RelTy> Rels);
|
||||
|
||||
template <class RelTy>
|
||||
CieRecord *addCie(SectionPiece &Piece, EHInputSection<ELFT> *Sec,
|
||||
CieRecord *addCie(SectionPiece &Piece, EhInputSection<ELFT> *Sec,
|
||||
ArrayRef<RelTy> Rels);
|
||||
|
||||
template <class RelTy>
|
||||
bool isFdeLive(SectionPiece &Piece, EHInputSection<ELFT> *Sec,
|
||||
bool isFdeLive(SectionPiece &Piece, EhInputSection<ELFT> *Sec,
|
||||
ArrayRef<RelTy> Rels);
|
||||
|
||||
uintX_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc);
|
||||
|
||||
std::vector<EHInputSection<ELFT> *> Sections;
|
||||
std::vector<EhInputSection<ELFT> *> Sections;
|
||||
std::vector<CieRecord *> Cies;
|
||||
|
||||
// CIE records are uniquified by their contents and personality functions.
|
||||
|
@ -1363,7 +1363,7 @@ template <class ELFT> void Writer<ELFT>::createSections() {
|
||||
|
||||
// Now that scan relocs possibly changed the size, update the offset.
|
||||
Sec->setSize(Off + S->getSize());
|
||||
} else if (auto *EH = dyn_cast<EHInputSection<ELFT>>(S)) {
|
||||
} else if (auto *EH = dyn_cast<EhInputSection<ELFT>>(S)) {
|
||||
if (EH->RelocSection)
|
||||
scanRelocs(*EH, *EH->RelocSection);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user