mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 20:53:29 +08:00
[ELF] - Detemplate DynamicReloc class. NFC.
llvm-svn: 298072
This commit is contained in:
@@ -654,7 +654,7 @@ static void scanRelocs(InputSectionBase &C, ArrayRef<RelTy> Rels) {
|
||||
if (!Config->ZText)
|
||||
IsWrite = true;
|
||||
|
||||
auto AddDyn = [=](const DynamicReloc<ELFT> &Reloc) {
|
||||
auto AddDyn = [=](const DynamicReloc &Reloc) {
|
||||
In<ELFT>::RelaDyn->addReloc(Reloc);
|
||||
};
|
||||
|
||||
|
||||
@@ -1197,18 +1197,17 @@ template <class ELFT> void DynamicSection<ELFT>::writeTo(uint8_t *Buf) {
|
||||
}
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
uint64_t DynamicReloc<ELFT>::getOffset() const {
|
||||
uint64_t DynamicReloc::getOffset() const {
|
||||
return InputSec->OutSec->Addr + InputSec->getOffset(OffsetInSec);
|
||||
}
|
||||
|
||||
template <class ELFT> int64_t DynamicReloc<ELFT>::getAddend() const {
|
||||
int64_t DynamicReloc::getAddend() const {
|
||||
if (UseSymVA)
|
||||
return Sym->getVA(Addend);
|
||||
return Addend;
|
||||
}
|
||||
|
||||
template <class ELFT> uint32_t DynamicReloc<ELFT>::getSymIndex() const {
|
||||
uint32_t DynamicReloc::getSymIndex() const {
|
||||
if (Sym && !UseSymVA)
|
||||
return Sym->DynsymIndex;
|
||||
return 0;
|
||||
@@ -1223,7 +1222,7 @@ RelocationSection<ELFT>::RelocationSection(StringRef Name, bool Sort)
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
void RelocationSection<ELFT>::addReloc(const DynamicReloc<ELFT> &Reloc) {
|
||||
void RelocationSection<ELFT>::addReloc(const DynamicReloc &Reloc) {
|
||||
if (Reloc.Type == Target->RelativeRel)
|
||||
++NumRelativeRelocs;
|
||||
Relocs.push_back(Reloc);
|
||||
@@ -1241,7 +1240,7 @@ static bool compRelocations(const RelTy &A, const RelTy &B) {
|
||||
|
||||
template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
|
||||
uint8_t *BufBegin = Buf;
|
||||
for (const DynamicReloc<ELFT> &Rel : Relocs) {
|
||||
for (const DynamicReloc &Rel : Relocs) {
|
||||
auto *P = reinterpret_cast<Elf_Rela *>(Buf);
|
||||
Buf += Config->isRela() ? sizeof(Elf_Rela) : sizeof(Elf_Rel);
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ private:
|
||||
std::vector<StringRef> Strings;
|
||||
};
|
||||
|
||||
template <class ELFT> class DynamicReloc {
|
||||
class DynamicReloc {
|
||||
public:
|
||||
DynamicReloc(uint32_t Type, const InputSectionBase *InputSec,
|
||||
uint64_t OffsetInSec, bool UseSymVA, SymbolBody *Sym,
|
||||
@@ -388,7 +388,7 @@ template <class ELFT> class RelocationSection final : public SyntheticSection {
|
||||
|
||||
public:
|
||||
RelocationSection(StringRef Name, bool Sort);
|
||||
void addReloc(const DynamicReloc<ELFT> &Reloc);
|
||||
void addReloc(const DynamicReloc &Reloc);
|
||||
unsigned getRelocOffset();
|
||||
void finalizeContents() override;
|
||||
void writeTo(uint8_t *Buf) override;
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
private:
|
||||
bool Sort;
|
||||
size_t NumRelativeRelocs = 0;
|
||||
std::vector<DynamicReloc<ELFT>> Relocs;
|
||||
std::vector<DynamicReloc> Relocs;
|
||||
};
|
||||
|
||||
struct SymbolTableEntry {
|
||||
|
||||
Reference in New Issue
Block a user