[ELF] - Detemplate SymbolBody::getGotPltVA and SymbolBody::getGotPltOffset(). NFC.

That opens road to detemplate PltSection<ELFT>,
what allows then to detemplate all methods of SymbolBody.

llvm-svn: 297950
This commit is contained in:
George Rimar 2017-03-16 12:58:11 +00:00
parent f00c183847
commit 4670bb00b5
4 changed files with 10 additions and 20 deletions

View File

@ -795,13 +795,13 @@ static void scanRelocs(InputSectionBase &C, ArrayRef<RelTy> Rels) {
In<ELFT>::Iplt->addEntry(Body);
In<ELFT>::IgotPlt->addEntry(Body);
In<ELFT>::RelaIplt->addReloc({Target->IRelativeRel, In<ELFT>::IgotPlt,
Body.getGotPltOffset<ELFT>(),
!Preemptible, &Body, 0});
Body.getGotPltOffset(), !Preemptible,
&Body, 0});
} else {
In<ELFT>::Plt->addEntry(Body);
In<ELFT>::GotPlt->addEntry(Body);
In<ELFT>::RelaPlt->addReloc({Target->PltRel, In<ELFT>::GotPlt,
Body.getGotPltOffset<ELFT>(), !Preemptible,
Body.getGotPltOffset(), !Preemptible,
&Body, 0});
}
continue;

View File

@ -171,13 +171,13 @@ template <class ELFT> typename ELFT::uint SymbolBody::getGotOffset() const {
return GotIndex * Target->GotEntrySize;
}
template <class ELFT> typename ELFT::uint SymbolBody::getGotPltVA() const {
uint64_t SymbolBody::getGotPltVA() const {
if (this->IsInIgot)
return In<ELFT>::IgotPlt->getVA() + getGotPltOffset<ELFT>();
return In<ELFT>::GotPlt->getVA() + getGotPltOffset<ELFT>();
return InX::IgotPlt->getVA() + getGotPltOffset();
return InX::GotPlt->getVA() + getGotPltOffset();
}
template <class ELFT> typename ELFT::uint SymbolBody::getGotPltOffset() const {
uint64_t SymbolBody::getGotPltOffset() const {
return GotPltIndex * Target->GotPltEntrySize;
}
@ -391,16 +391,6 @@ template uint32_t SymbolBody::template getGotOffset<ELF32BE>() const;
template uint64_t SymbolBody::template getGotOffset<ELF64LE>() const;
template uint64_t SymbolBody::template getGotOffset<ELF64BE>() const;
template uint32_t SymbolBody::template getGotPltVA<ELF32LE>() const;
template uint32_t SymbolBody::template getGotPltVA<ELF32BE>() const;
template uint64_t SymbolBody::template getGotPltVA<ELF64LE>() const;
template uint64_t SymbolBody::template getGotPltVA<ELF64BE>() const;
template uint32_t SymbolBody::template getGotPltOffset<ELF32LE>() const;
template uint32_t SymbolBody::template getGotPltOffset<ELF32BE>() const;
template uint64_t SymbolBody::template getGotPltOffset<ELF64LE>() const;
template uint64_t SymbolBody::template getGotPltOffset<ELF64BE>() const;
template uint32_t SymbolBody::template getPltVA<ELF32LE>() const;
template uint32_t SymbolBody::template getPltVA<ELF32BE>() const;
template uint64_t SymbolBody::template getPltVA<ELF64LE>() const;

View File

@ -79,8 +79,8 @@ public:
template <class ELFT> typename ELFT::uint getGotOffset() const;
template <class ELFT> typename ELFT::uint getGotVA() const;
template <class ELFT> typename ELFT::uint getGotPltOffset() const;
template <class ELFT> typename ELFT::uint getGotPltVA() const;
uint64_t getGotPltOffset() const;
uint64_t getGotPltVA() const;
template <class ELFT> typename ELFT::uint getPltVA() const;
template <class ELFT> typename ELFT::uint getSize() const;
OutputSection *getOutputSection() const;

View File

@ -1659,7 +1659,7 @@ template <class ELFT> void PltSection<ELFT>::writeTo(uint8_t *Buf) {
for (auto &I : Entries) {
const SymbolBody *B = I.first;
unsigned RelOff = I.second + PltOff;
uint64_t Got = B->getGotPltVA<ELFT>();
uint64_t Got = B->getGotPltVA();
uint64_t Plt = this->getVA() + Off;
Target->writePlt(Buf + Off, Got, Plt, B->PltIndex, RelOff);
Off += Target->PltEntrySize;